﻿
function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    var regexS = "[\\?&]" + name + "=([^&#]*)";
    var regex = new RegExp(regexS);
    var results = regex.exec(window.location.href);
    if (results == null)
        return "";
    else
        return decodeURIComponent(results[1].replace(/\+/g, " "));
}

$(document).ready(function () {

    


    if (getParameterByName("form") == "open") {
        $("#futureWindow").show();       
    }

    if (document.images) {
        preload_image_object = new Image();
        // set image url
        image_url = new Array();
        image_url[0] = "images/dropdown_about_01.png";
        image_url[1] = "images/dropdown_about_02.png";
        image_url[2] = "images/dropdown_about_03.png";
        image_url[3] = "images/dropdown_buy_01.png";
        image_url[4] = "images/dropdown_buy_02.png";
        image_url[5] = "images/dropdown_buy_03.png";
        image_url[6] = "images/dropdown_asset_01.png";
        image_url[7] = "images/dropdown_asset_02.png";
        image_url[8] = "images/dropdown_hos_01.png";
        image_url[9] = "images/dropdown_hos_02.png";
        image_url[10] = "images/dropdown_lei_01.png";
        image_url[11] = "images/dropdown_lei_02.png";
        image_url[12] = "images/dropdown_lei_03.png";
        image_url[13] = "images/dropdown_inno_01.png";
        image_url[14] = "images/dropdown_inno_02.png";

        var i = 0;
        for (i = 0; i <= 3; i++)
            preload_image_object.src = image_url[i];
    }



    $("#Menu_About").mouseover(function () {
        if ($('#content_About').is(':hidden')) {
            closeTopMenu();
            $("#content_About").show('slide', { direction: 'up' });
        }
    });
    $("#Menu_BuyProperty").mouseover(function () {
        if ($('#content_BuyProperty').is(':hidden')) {
            closeTopMenu();
            $("#content_BuyProperty").show('slide', { direction: 'up' });
        }
    });
    $("#Menu_Asset").mouseover(function () {
        if ($('#content_Asset').is(':hidden')) {
            closeTopMenu();
            $("#content_Asset").show('slide', { direction: 'up' });
        }
    });
    $("#Menu_Hospitality").mouseover(function () {
        if ($('#content_Hospitality').is(':hidden')) {
            closeTopMenu();
            $("#content_Hospitality").show('slide', { direction: 'up' });
        }
    });
    $("#Menu_Leisure").mouseover(function () {
        if ($('#content_Leisure').is(':hidden')) {
            closeTopMenu();
            $("#content_Leisure").show('slide', { direction: 'up' });
        }
    });
    $("#Menu_Innovation").mouseover(function () {
        if ($('#content_Innovation').is(':hidden')) {
            closeTopMenu();
            $("#content_Innovation").show('slide', { direction: 'up' });
        }
    });
    $("#Menu_CSR").mouseover(function () {
        if ($('#content_CSR').is(':hidden')) {
            closeTopMenu();
            $("#content_CSR").show('slide', { direction: 'up' });
        }
    });


    $("#content_About").mouseleave(function () {
        closeTopMenu();
    });
    $("#content_BuyProperty").mouseleave(function () {
        closeTopMenu();
    });
    $("#content_Asset").mouseleave(function () {
        closeTopMenu();
    });
    $("#content_Hospitality").mouseleave(function () {
        closeTopMenu();
    });
    $("#content_Leisure").mouseleave(function () {
        closeTopMenu();
    });
    $("#content_Innovation").mouseleave(function () {
        closeTopMenu();
    });
    $("#content_CSR").mouseleave(function () {
        closeTopMenu();
    });


    $(".highlightClick01").click(function () {
        if ($('#highlight01').is(':hidden')) {
            closeTopMenu();
            $('#tableZ_highlight').attr('style', 'position:relative; z-index:999');
            $("#highlight01").show('slide', { direction: 'down' });
            $('#cycle_highlight01').cycle(0);
            return false;
        }
        else {
            $("#highlight01").hide('slide', { direction: 'down' });
        }
    });
    $(".highlightClick02").click(function () {
        if ($('#highlight02').is(':hidden')) {
            closeTopMenu();
            $('#tableZ_highlight').attr('style', 'position:relative; z-index:999');
            $("#highlight02").show('slide', { direction: 'down' });
            $('#cycle_highlight02').cycle(0);
            return false;
        }
        else {
            $("#highlight02").hide('slide', { direction: 'down' });
        }
    });
    $(".highlightClick03").click(function () {
        if ($('#highlight03').is(':hidden')) {
            closeTopMenu();
            $('#tableZ_highlight').attr('style', 'position:relative; z-index:999');
            $("#highlight03").show('slide', { direction: 'down' });
            $('#cycle_highlight03').cycle(0);
            return false;
        }
        else {
            $("#highlight03").hide('slide', { direction: 'down' });
        }
    });
    $(".highlightClick04").click(function () {
        if ($('#highlight04').is(':hidden')) {
            closeTopMenu();
            $('#tableZ_highlight').attr('style', 'position:relative; z-index:999');
            $("#highlight04").show('slide', { direction: 'down' });
            $('#cycle_highlight04').cycle(0);
            return false;
        }
        else {
            $("#highlight04").hide('slide', { direction: 'down' });
        }
    });
    $(".highlightClick05").click(function () {
        if ($('#highlight05').is(':hidden')) {
            closeTopMenu();
            $('#tableZ_highlight').attr('style', 'position:relative; z-index:999');
            $("#highlight05").show('slide', { direction: 'down' });
            $('#cycle_highlight05').cycle(0);
            return false;
        }
        else {
            $("#highlight05").hide('slide', { direction: 'down' });
        }
    });

    $(".presence_map").click(function () {
        if ($('#mapWindow').is(':hidden')) {
            closeTopMenu();
            $('#tableZ_highlight').attr('style', 'position:relative; z-index:0');
            $("#mapWindow").show('slide', { direction: 'down' });

        }
        else {
            $("#mapWindow").hide('slide', { direction: 'down' });
        }
    });

    $(".launches01").mouseenter(function () {
        if ($('#highlight03').is(':hidden')) {
            closeTopMenu();
            $('#tableZ_highlight').attr('style', 'position:relative; z-index:999');
            $("#highlight03").show('slide', { direction: 'down' });
            $('#cycle_highlight03').cycle(0);
            return false;
        }
        else {
            $('#cycle_highlight03').cycle(0);
        }
    });
    $(".launches02").mouseenter(function () {
        if ($('#highlight03').is(':hidden')) {
            closeTopMenu();
            $('#tableZ_highlight').attr('style', 'position:relative; z-index:999');
            $("#highlight03").show('slide', { direction: 'down' });
            $('#cycle_highlight03').cycle(1);
            return false;
        }
        else {
            $('#cycle_highlight03').cycle(1);
        }
    });
    $(".launches03").mouseenter(function () {
        if ($('#highlight03').is(':hidden')) {
            closeTopMenu();
            $('#tableZ_highlight').attr('style', 'position:relative; z-index:999');
            $("#highlight03").show('slide', { direction: 'down' });
            $('#cycle_highlight03').cycle(2);
            return false;
        }
        else {
            $('#cycle_highlight03').cycle(2);
        }
    });
    $(".future_launches01").mouseenter(function () {
        if ($('#highlight04').is(':hidden')) {
            closeTopMenu();
            $('#tableZ_highlight').attr('style', 'position:relative; z-index:999');
            $("#highlight04").show('slide', { direction: 'down' });
            $('#cycle_highlight04').cycle(0);
            return false;
        }
        else {
            $('#cycle_highlight04').cycle(0);
        }
    });
    $(".future_launches02").mouseenter(function () {
        if ($('#highlight04').is(':hidden')) {
            closeTopMenu();
            $('#tableZ_highlight').attr('style', 'position:relative; z-index:999');
            $("#highlight04").show('slide', { direction: 'down' });
            $('#cycle_highlight04').cycle(1);
            return false;
        }
        else {
            $('#cycle_highlight04').cycle(1);
        }
    });
    $(".future_launches03").mouseenter(function () {
        if ($('#highlight04').is(':hidden')) {
            closeTopMenu();
            $('#tableZ_highlight').attr('style', 'position:relative; z-index:999');
            $("#highlight04").show('slide', { direction: 'down' });
            $('#cycle_highlight04').cycle(2);
            return false;
        }
        else {
            $('#cycle_highlight04').cycle(2);
        }
    });
    $(".more_highlight01").mouseenter(function () {
        if ($('#highlight05').is(':hidden')) {
            closeTopMenu();
            $('#tableZ_highlight').attr('style', 'position:relative; z-index:999');
            $("#highlight05").show('slide', { direction: 'down' });
            $('#cycle_highlight05').cycle(0);
            return false;
        }
        else {
            $('#cycle_highlight05').cycle(0);
        }
    });
    $(".more_highlight02").mouseenter(function () {
        if ($('#highlight05').is(':hidden')) {
            closeTopMenu();
            $('#tableZ_highlight').attr('style', 'position:relative; z-index:999');
            $("#highlight05").show('slide', { direction: 'down' });
            $('#cycle_highlight05').cycle(1);
            return false;
        }
        else {
            $('#cycle_highlight05').cycle(1);
        }
    });
    $(".more_highlight03").mouseenter(function () {
        if ($('#highlight05').is(':hidden')) {
            closeTopMenu();
            $('#tableZ_highlight').attr('style', 'position:relative; z-index:999');
            $("#highlight05").show('slide', { direction: 'down' });
            $('#cycle_highlight05').cycle(2);
            return false;
        }
        else {
            $('#cycle_highlight05').cycle(2);
        }
    });

    $(".futureClick").click(function () {
        if ($('#futureWindow').is(':hidden')) {
            closeTopMenu();
            $('#tableZ_highlight').attr('style', 'position:relative; z-index:0');
            $("#futureWindow").show('slide', { direction: 'down' });
        }
        else {

            $('#tableZ_highlight').attr('style', '');
            $("#futureWindow").hide('slide', { direction: 'down' });
        }
    });

    $(".SearchClick").click(function () {
        if ($('#content_Search').is(':hidden')) {
            $('#tableZ_highlight').attr('style', '');
            $('#tableZ').attr('style', 'margin-top:57px; position:relative; z-index:10px');
            $("#content_About").hide();
            $("#content_BuyProperty").hide();
            $("#content_Asset").hide();
            $("#content_Hospitality").hide();
            $("#content_Leisure").hide();
            $("#content_Innovation").hide();
            $("#highlight01").hide();
            $("#highlight02").hide();
            $("#highlight03").hide();
            $("#highlight04").hide();
            $("#highlight05").hide();
            $("#mapWindow").hide();
            $("#content_Search").show('slide', { direction: 'down' });

        }
        else {

            $("#content_Search").hide('slide', { direction: 'down' });

        }

    });
    setTimeout("$(\"#Subcontent_Search\").slideToggle('slow');", 3000);

    $(".SubSearchClick").click(function () {
        $("#Subcontent_Search").slideToggle('slow');
    });


    $(".CloseSearch").click(function () {
        $("#content_Search").hide('slide', { direction: 'down' });

    });

    $(".CloseFuture").click(function () {
        $("#futureWindow").hide('slide', { direction: 'down' });
    });

    $("#dFutureClose").click(function () {
        $("#futureWindow").hide('slide', { direction: 'down' });
    });


    $(".CloseAll").click(function () {
        if ($('#highlight01').is(':hidden')) {

        }
        else {
            $("#highlight01").hide('slide', { direction: 'down' });
        }
        if ($('#highlight02').is(':hidden')) {

        }
        else {
            $("#highlight02").hide('slide', { direction: 'down' });
        }
        if ($('#highlight03').is(':hidden')) {

        }
        else {
            $("#highlight03").hide('slide', { direction: 'down' });
        }
        if ($('#highlight04').is(':hidden')) {

        }
        else {
            $("#highlight04").hide('slide', { direction: 'down' });
        }

        if ($('#highlight05').is(':hidden')) {
        }
        else {
            $("#highlight05").hide('slide', { direction: 'down' });
        }
        if ($('#mapWindow').is(':hidden')) {
        }
        else {
            $("#mapWindow").hide('slide', { direction: 'down' });
        }
    });

    //    $("#highlight01").mouseleave(function () {
    //        closeTopMenu();
    //    });
    //    $("#highlight02").mouseleave(function () {
    //        closeTopMenu();
    //    });
    //    $("#highlight03").mouseleave(function () {
    //        closeTopMenu();
    //    });
    //    $("#highlight04").mouseleave(function () {
    //        closeTopMenu();
    //    });
    //    $("#highlight05").mouseleave(function () {
    //        closeTopMenu();
    //    });

    function closeTopMenu() {
        $('#tableZ').attr('style', 'margin-top:57px;');
        $('#tableZ_highlight').attr('style', '');
        $("#content_About").hide();
        $("#content_BuyProperty").hide();
        $("#content_Asset").hide();
        $("#content_Hospitality").hide();
        $("#content_Leisure").hide();
        $("#content_Innovation").hide();
        $("#content_CSR").hide();
        $("#highlight01").hide();
        $("#highlight02").hide();
        $("#highlight03").hide();
        $("#highlight04").hide();
        $("#highlight05").hide();
        $("#futureWindow").hide();
        $("#content_Search").hide();
        $("#mapWindow").hide();
    }


    $("#panel_future01").click(function () {
        $("#content_future01").show();
        $("#content_future02").hide();
        $("#content_future03").hide();
        $("#content_future04").hide();
        $('#panel_future01').attr('class', 'futureTitleSelected');
        $('#panel_future02').attr('class', 'futureTitle');
        $('#panel_future03').attr('class', 'futureTitle');
        $('#panel_future04').attr('class', 'futureTitle');
        $("#side_future01").show();
        $("#side_future02").hide();
        $("#side_future03").hide();
        $("#side_future04").hide();
    });
    $("#panel_future02").click(function () {
        $("#content_future01").hide();
        $("#content_future02").show();
        $("#content_future03").hide();
        $("#content_future04").hide();
        $('#panel_future01').attr('class', 'futureTitle');
        $('#panel_future02').attr('class', 'futureTitleSelected');
        $('#panel_future03').attr('class', 'futureTitle');
        $('#panel_future04').attr('class', 'futureTitle');
        $("#side_future01").hide();
        $("#side_future02").show();
        $("#side_future03").hide();
        $("#side_future04").hide();
    });
    $("#panel_future03").click(function () {
        $("#content_future01").hide();
        $("#content_future02").hide();
        $("#content_future03").show();
        $("#content_future04").hide();
        $('#panel_future01').attr('class', 'futureTitle');
        $('#panel_future02').attr('class', 'futureTitle');
        $('#panel_future03').attr('class', 'futureTitleSelected');
        $('#panel_future04').attr('class', 'futureTitle');
        $("#side_future01").hide();
        $("#side_future02").hide();
        $("#side_future03").show();
        $("#side_future04").hide();
    });
    $("#panel_future04").click(function () {
        $("#content_future01").hide();
        $("#content_future02").hide();
        $("#content_future03").hide();
        $("#content_future04").show();
        $('#panel_future01').attr('class', 'futureTitle');
        $('#panel_future02').attr('class', 'futureTitle');
        $('#panel_future03').attr('class', 'futureTitle');
        $('#panel_future04').attr('class', 'futureTitleSelected');
        $("#side_future01").hide();
        $("#side_future02").hide();
        $("#side_future03").hide();
        $("#side_future04").show();
    });


    $("#regisNext01").click(function () {
        $("#content_future01").hide();
        $("#content_future02").show();
        $("#content_future03").hide();
        $("#content_future04").hide();
        $('#panel_future01').attr('class', 'futureTitle');
        $('#panel_future02').attr('class', 'futureTitleSelected');
        $('#panel_future03').attr('class', 'futureTitle');
        $('#panel_future04').attr('class', 'futureTitle');
        $("#side_future01").hide();
        $("#side_future02").show();
        $("#side_future03").hide();
        $("#side_future04").hide();
    });
    $("#regisNext02").click(function () {
        $("#content_future01").hide();
        $("#content_future02").hide();
        $("#content_future03").show();
        $("#content_future04").hide();
        $('#panel_future01').attr('class', 'futureTitle');
        $('#panel_future02').attr('class', 'futureTitle');
        $('#panel_future03').attr('class', 'futureTitleSelected');
        $('#panel_future04').attr('class', 'futureTitle');
        $("#side_future01").hide();
        $("#side_future02").hide();
        $("#side_future03").show();
        $("#side_future04").hide();
    });
    $("#regisNext03").click(function () {
        $("#content_future01").hide();
        $("#content_future02").hide();
        $("#content_future03").hide();
        $("#content_future04").show();
        $('#panel_future01').attr('class', 'futureTitle');
        $('#panel_future02').attr('class', 'futureTitle');
        $('#panel_future03').attr('class', 'futureTitle');
        $('#panel_future04').attr('class', 'futureTitleSelected');
        $("#side_future01").hide();
        $("#side_future02").hide();
        $("#side_future03").hide();
        $("#side_future04").show();
    });

    $("#regisBack02").click(function () {
        $("#content_future01").show();
        $("#content_future02").hide();
        $("#content_future03").hide();
        $("#content_future04").hide();
        $('#panel_future01').attr('class', 'futureTitleSelected');
        $('#panel_future02').attr('class', 'futureTitle');
        $('#panel_future03').attr('class', 'futureTitle');
        $('#panel_future04').attr('class', 'futureTitle');
        $("#side_future01").show();
        $("#side_future02").hide();
        $("#side_future03").hide();
        $("#side_future04").hide();
    });
    $("#regisBack03").click(function () {
        $("#content_future01").hide();
        $("#content_future02").show();
        $("#content_future03").hide();
        $("#content_future04").hide();
        $('#panel_future01').attr('class', 'futureTitle');
        $('#panel_future02').attr('class', 'futureTitleSelected');
        $('#panel_future03').attr('class', 'futureTitle');
        $('#panel_future04').attr('class', 'futureTitle');
        $("#side_future01").hide();
        $("#side_future02").show();
        $("#side_future03").hide();
        $("#side_future04").hide();
    });
    $("#regisBack04").click(function () {
        $("#content_future01").hide();
        $("#content_future02").hide();
        $("#content_future03").show();
        $("#content_future04").hide();
        $('#panel_future01').attr('class', 'futureTitle');
        $('#panel_future02').attr('class', 'futureTitle');
        $('#panel_future03').attr('class', 'futureTitleSelected');
        $('#panel_future04').attr('class', 'futureTitle');
        $("#side_future01").hide();
        $("#side_future02").hide();
        $("#side_future03").show();
        $("#side_future04").hide();
    });

    $("#logo_UK").mouseenter(function () {
        if ($('#content_map_UK').is(':hidden')) {
            closeMapContent()
            $("#content_map_UK").show('slide', { direction: 'down' });
        }
        else {
        }
    });
    $("#logo_China").mouseenter(function () {
        if ($('#content_map_China').is(':hidden')) {
            closeMapContent()
            $("#content_map_China").show('slide', { direction: 'down' });
        }
        else {
        }
    });
    $("#logo_Vietnam").mouseenter(function () {
        if ($('#content_map_Vietnam').is(':hidden')) {
            closeMapContent()
            $("#content_map_Vietnam").show('slide', { direction: 'down' });
        }
        else {
        }
    });
    $("#logo_Malaysia").mouseenter(function () {
        if ($('#content_map_Malaysia').is(':hidden')) {
            closeMapContent()
            $("#content_map_Malaysia").show('slide', { direction: 'right' });
        }
        else {
        }
    });
    $("#logo_Singapore").mouseenter(function () {
        if ($('#content_map_Singapore').is(':hidden')) {
            closeMapContent()
            $("#content_map_Singapore").show('slide', { direction: 'down' });
        }
        else {
        }
    });
    $("#logo_Australia").mouseenter(function () {
        if ($('#content_map_Australia').is(':hidden')) {
            closeMapContent()
            $("#content_map_Australia").show('slide', { direction: 'down' });
        }
        else {
        }
    });
    function closeMapContent() {
        $("#content_map_UK").hide();
        $("#content_map_China").hide();
        $("#content_map_Vietnam").hide();
        $("#content_map_Malaysia").hide();
        $("#content_map_Singapore").hide();
        $("#content_map_Australia").hide();
    }
    $(".map_content").click(function () {
        closeMapContent()
    });
    $("#mapBG").click(function () {
        closeMapContent()
    });
    
});
