﻿// JScript File
var t;
function SetStyle (classShow)
{
    setCookie("menu-home", classShow)
}
function SetProStyle (classShow)
{
    setCookie("project-type", classShow)
}
function clearTimeVar()
{
	if (t!=null) {clearTimeout(t)};
}
function timeMouseOut()
{
	t=setTimeout("DisplaySubMenu('')",1000);
}
function timeMouseOutP(intPro)
{
	t=setTimeout("DisplayContent(''," + intPro + ")",1000);
}
function DisplayContent (subcontent, intPro)
{
    for(i=0; i < intPro; i++)
    {
        document.getElementById("prot" + i.toString()).style.display="none";
   }
    if(subcontent != "")
    {
        document.getElementById(subcontent).style.display="block";
    }
    else
    {
        var classShow = getCookie("project-type");
        if(classShow != "")
        {
            var proid = classShow.replace('sty','prot');
            document.getElementById(proid).style.display="block";
        }
        else
            document.getElementById("prot0").style.display="block";
    }  
}
function DisplaySubMenu (submenu)
{
    if(submenu != "")
    {
        document.getElementById("LayerNews").style.display="none";
        document.getElementById("LayerProjects").style.display="none";
        document.getElementById("LayerLiving").style.display="none";
        document.getElementById("LayerIntro").style.display="none";
        document.getElementById(submenu).style.display="block";
    }
    else
    {
        document.getElementById("LayerNews").style.display="none";
        document.getElementById("LayerProjects").style.display="none";
        document.getElementById("LayerLiving").style.display="none";
        document.getElementById("LayerIntro").style.display="none";
        var classShow = getCookie("menu-home");
         if(classShow == "li2")
                {document.getElementById("LayerNews").style.display="block";}
            if(classShow == "li3")
                {document.getElementById("LayerProjects").style.display="block";}
            if(classShow == "li5")
                {document.getElementById("LayerLiving").style.display="block";}
            if(classShow == "li6")
                {document.getElementById("LayerIntro").style.display="block";}
    }  
}
function GetStyle ()
{
    var url = document.location.href;
    if(url.indexOf('Contact') > -1)
    {
        document.getElementById("li7").className='current';
    }
    else if(url.indexOf('Project') > -1)
    {
        document.getElementById("li3").className='current';
        DisplaySubMenu ('LayerProjects'); 
        SetStyle('li3');
    }
    else if(url.indexOf('Living') > -1)
    {
        document.getElementById("li5").className='current';
        DisplaySubMenu ('LayerLiving'); 
        SetStyle('li5');
    }
    else if(url.indexOf('Intro') > -1)
    {
        document.getElementById("li6").className='current';
        DisplaySubMenu ('LayerIntro');
        SetStyle('li6');
    }
    else if(url.indexOf('Estate') > -1 || url.indexOf('Member') > -1)
    {
        document.getElementById("li4").className='current';
    }
    else if(url.indexOf('News.aspx') > -1 || url.indexOf('NewsDetail.aspx') > -1)
    {
        document.getElementById("li2").className='current';
        DisplaySubMenu ('LayerNews');
        SetStyle('li2');
    }
    else
    {
         document.getElementById("li1").className='current';
    }
}

function GetProStyle ()
{
    var classShow = getCookie("project-type");
    if(classShow != "")
    {
        var proid = classShow.replace('sty','prot');
        document.getElementById(classShow).className='active';
        document.getElementById(proid).style.display="block";
    }
    else
    {
        document.getElementById("sty0").className='active';
        document.getElementById("prot0").style.display="block";
    }
}
function getCookie(Name){ 
var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re)[0].split("=")[1] //return its value
return ""
}
function setCookie(name, value){
document.cookie = name+"="+value //cookie value is domain wide (path=/)
}

