menu_status = new Array();
note_status = new Array();
var lastnote;
var newWindow = null;
var lastopt = "1";
var lastsubopt = null;
var lastmainopt =null;
var imageno = null;
var imageid = null;
var textno = null;
var textid = null;
var jsubid = 0;
var jmainopt = null;
var jsubopt = null;
function putCookie()
{
	document.cookie="MainMenu="+lastmainopt;
	document.cookie="SubMenu="+lastsubopt;
}
function getCookie(jPar)
{
	
	var jString = document.cookie;
	var jStart = jString.indexOf(jPar);
		if (jStart != -1)
		{
		var jString2 = jString.substring(jStart,jString.length);
		var jEnd = jString2.indexOf(";");
		if (jEnd == -1)
			{
			jEnd = jString2.length;
			}
		var jStart2 = jString2.indexOf("=")+1;
		var jValue = jString2.substring(jStart2,jEnd)
		return jValue;
		}	
}

function showHideDT(thisopt)
{
        if (document.getElementById)
        {
                if (lastopt !=null && lastopt !=thisopt)
                {
                        imageno = "image" + lastopt;
                        imageid = document.getElementById(imageno);
                        textno = "text" + lastopt;
                        textid = document.getElementById(textno);
                        imageid.className = "hide";
                        textid.className = "hide";
                        imageno = "image" + thisopt;
                        imageid = document.getElementById(imageno);
                        textno = "text" + thisopt;
                        textid = document.getElementById(textno);
                        imageid.className = "show";
                        textid.className = "show";
                }
                lastopt = thisopt;
        }
}
function showHideTextDT(thisopt)
{
        if (document.getElementById)
        {
                if (lastopt !=null && lastopt !=thisopt)
                {
                        textno = "text" + lastopt;
                        textid = document.getElementById(textno);
                        textid.className = "hide";
                        textno = "text" + thisopt;
                        textid = document.getElementById(textno);
                        textid.className = "show";
                }
                lastopt = thisopt;
        }
}
function posSitemap()
{
        var leftPos=0;
        if (screen)
        {                            
                leftPos=(screen.width-225)/2-143;
        }
        if (document.getElementById)
        {
                var sitemap=document.getElementById("sitemap");
                sitemap.style.marginLeft=leftPos.toString()+"px";
        }
}

function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}

function popUpWin(url)
{
	
	closeWin();
	
        tools = "resizable=0,toolbar=0,location=0,scrollbars=0,width=320,height=425,left=200,top=0";
        newWindow = window.open(url, "newWin", tools);
	newWindow.focus();
}
function showMainGuide(theid)
{
    if (document.getElementById)
        {
        var jid = "menu" + theid;
        var switch_id = document.getElementById(jid);
        if (switch_id != null)
        	{
            	 switch_id.className = 'show';
                 menu_status[theid] = 'show';
                 lastmainopt=theid;
                 
         	}        

        }
}
function showSubGuide(theid)
{
    if (document.getElementById)
        {
        var jid = "menu" + theid;
        var switch_id = document.getElementById(jid);
        if (switch_id != null)
        	{
            	 switch_id.className = 'show';
                 menu_status[theid] = 'show';
                 lastsubopt=theid;
                 
         	}        

        }
}
function hideGuide(theid)
{
    
    if (document.getElementById)
        {
        var jid = "menu" + theid;
        var switch_id = document.getElementById(jid);
		 if (switch_id != null)
		 {
                 	switch_id.className = 'hide';
                 	menu_status[theid] = 'hide';
                 	lastmainopt = null;
                 	for (var jcount2 = 1; jcount2 < 20; jcount2 ++)
        	 	{
	         	jsubid = "menu"+theid + "_" + jcount2;
		 		var switch_id = document.getElementById(jsubid);
				if (switch_id != null)
				{
		 			switch_id.className = 'hide';
        	 		menu_status[jsubid] = 'hide';
		 			lastsubopt = null;
				}
        	 	}
		}

        }
}
function showGuide(theid)
{
	hideGuide(lastmainopt);
	showMainGuide(theid);
	
}
function hideall()
{
   for (var jcount =1; jcount < 12; jcount ++)
        {
        hideGuide(jcount)
        }
    showMainGuide(getCookie("MainMenu"));
    showSubGuide(getCookie("SubMenu"));    
}
function showHide(theid)
{
    if (document.getElementById)
        {
        var switch_id = document.getElementById(lastmainopt);
        if(switch_id != null && lastmainopt != theid)
                {
                switch_id.className = 'hide';
                menu_status[lastmainopt] = 'hide';
		menu_status[lastsubopt] = 'hide';
		lastsubopt = null;                
		}
        var switch_id = document.getElementById(theid);
        if (menu_status[theid] != 'show' && menu_status[theid] != null )
        	 {
                 switch_id.className = 'show';
                 menu_status[theid] = 'show';
                 lastmainopt=theid;
                 }
               	 else
                 {
                 switch_id.className = 'hide';
                 menu_status[theid] = 'hide';
                 menu_status[lastsubopt] = 'hide';
		 		 lastmainopt=null;
	        	 lastsubopt = null;
                 }

        }
}

function hideSub()
{
 	if (document.getElementById)
        {
       	var jid = "menu" + lastsubopt;
        var switch_id2 = document.getElementById(jid);
        if(switch_id2 != null)
           	{
        	switch_id2.className = 'hide';
            menu_status[lastsubopt] = 'hide';
            }
        lastsubopt = null;
        }
}
function hideMain()
{
    if (document.getElementById)
        {
        	var jid = "menu" + lastmainopt;
        	var switch_id = document.getElementById(jid);
        	if(switch_id != null)
          	{
            switch_id.className = 'hide';
            menu_status[lastmainopt] = 'hide';
            lastmainopt = null;
			}
		}

}			
function hideBoth()
{
	hideMain();
	hideSub();
}  
function showHide1(theid)
{
    if (document.getElementById)
        {
       	hideSub();
      	var jid = "menu" + theid;
       	var switch_id = document.getElementById(jid);
       		if (menu_status[theid] != 'show' && menu_status[theid] != null )
        	 	 {
                 switch_id.className = 'show';
                 menu_status[theid] = 'show';
                 hideMain();
                 lastmainopt=theid;
                 }
       	}
}
function showHide2(theid)
{
    if (document.getElementById)
        {
        var jid = "menu" + lastsubopt;
        var switch_id = document.getElementById(jid);
        if(switch_id != null && lastsubopt != theid)
                {
                switch_id.className = 'hide';
                menu_status[lastsubopt] = 'hide';
                }
        var jid = "menu" + theid;
        var switch_id = document.getElementById(jid);
        if (menu_status[theid] != 'show')
                {
                switch_id.className = 'show';
                menu_status[theid] = 'show';
                lastsubopt=theid;
                }
         else
                {
                switch_id.className = 'hide';
                menu_status[theid] = 'hide';
                lastsubopt=null;
                }

        }
}
function showmenu(theid)
{
    if (document.getElementById)
        {
        var switch_id = document.getElementById(theid);
        switch_id.className = 'show';
        menu_status[theid] = 'show';
        lastopt=theid;

        }
}
function toggleNotes(theid)
{
    if (document.getElementById)
        {
        var switch_id = document.getElementById(lastnote);
        if(switch_id != null && lastnote != theid)
                {
                switch_id.className = 'hide';
                note_status[lastnote] = 'hide';
                }
        var switch_id = document.getElementById(theid);
        theid2='click4'+theid;
        var switch_id2 = document.getElementById(theid2);

                if (note_status[theid] != 'show')
                        {
                        switch_id.className = 'show';
                        switch_id2.className = 'hide';
                        note_status[theid] = 'show';
                        lastnote=theid;
                        }
                else
                        {
                        switch_id.className = 'hide';
                        switch_id2.className = 'show';
                        note_status[theid] = 'hide';
                        lastnote=null;
                        }

        }
}
