// JavaScript Document

menu_status = new Array();
menu_height = new Array();
var tshow,thide;
function openMenu(menuId,n)
{    
	var mh;        
    if( String(parseInt(menu_height[menuId])) =="NaN")
        mh=1;
    else
        mh=parseInt(menu_height[menuId])+5;    
    
    if(mh>=n*20)
    {        
        menu_status[menuId] = 'show';
        menu_height[menuId]=String(mh);;            
        window.clearTimeout(tshow);		
        return;
    }
    else
    {        
        menu_height[menuId]=mh;
        //document.getElementById('msg').innerHTML="--" + mh;
        document.getElementById(menuId).style.height=String(mh) + 'px';    
        document.getElementById(menuId).className = 'show';        
        
    }    
    tshow=setTimeout("openMenu('" + menuId + "'," + n + ")",0);
    
}

function closeMenu(menuId)
{
        var mh;        
    if( String(parseInt(menu_height[menuId])) =="NaN")
        mh1=1;
    else
        mh1=parseInt(menu_height[menuId])-3;    
    
    
    if(mh1>=1)
    {        
        menu_height[menuId]=mh1;
        document.getElementById(menuId).style.height=String(mh1) + 'px';    
        //document.getElementById('msg').innerHTML=mh1;
        document.getElementById(menuId).className='show';
    }
    else
    {    
        menu_status[menuId] = 'hide';
        menu_height[menuId]='0';
		document.getElementById(menuId).className='hide';            
        window.clearTimeout(thide);
        return;        
    }
    
    
        
    thide=setTimeout("closeMenu('" + menuId + "')",0);    
}


function showHide(theid,n){
	
    //alert(theid);
	if (document.getElementById) {
    var switch_id = document.getElementById(theid);
	var showLeftMenuDiv=theid + "_showdiv";
    hideAll(theid);
        if(menu_status[theid] != 'show') {
           if(document.getElementById(theid) && n) //n=0 means no submenu
		   {	
		   		openMenu(theid,n);		
		   }
		   hideAll_contentDivs();
		   if(document.getElementById(showLeftMenuDiv))
		   {
				document.getElementById(showLeftMenuDiv).className='show';
		   }
		   //else //if no div for left menu found show some default div here
		   //alert(showLeftMenuDiv);           
		   if(document.getElementById(theid))
		   {
		   	switch_id.className = 'show';
           	menu_status[theid] = 'show';
		   }
		   
        }else{           
           closeMenu(theid);
           //switch_id.className = 'hide';
           menu_status[theid] = 'hide';
        }
    }
}

function hideAll_contentDivs()
{
    //id=menuId.split("mymenu");
    for(i=10; i<=50; i++)
    {
        theId="sm"+i;
        if(document.getElementById(theId))
        {
            document.getElementById(theId).className='hide';            
            menu_status[theId] = 'hide';
            menu_height[theId]='0';
        }
    }
	
	for(i=1; i<=50; i++)
    {
        theId="sm"+i+"_showdiv";
        if(document.getElementById(theId))
        {
            document.getElementById(theId).className='hide';            
            //menu_status[theId] = 'hide';
           // menu_height[theId]='0';
        }
    }
	
	for(i=1; i<=50; i++)
    {
        theId="mlink"+i+"_midLinkdiv";
        if(document.getElementById(theId))
        {
            document.getElementById(theId).className='hide';            
            //menu_status[theId] = 'hide';
           // menu_height[theId]='0';
        }
    }
	
}

function hideAll(menuId)
{
    //id=menuId.split("mymenu");
	
    for(i=1; i<11; i++)
    {
        theId="sm"+i;
        if(theId!=menuId && document.getElementById(theId))
        {
            document.getElementById(theId).className='hide';            
            menu_status[theId] = 'hide';
            menu_height[theId]='0';
        }
    }
	
	
}

function hideAll_page(menuId)
{
    //id=menuId.split("mymenu");
	//alert(menuId);
	hideAll_contentDivs();
    for(i=11; i<=20; i++)
    {
        theId="sm"+i;
        if(document.getElementById(theId))
        {
            document.getElementById(theId).className='hide';            
            //menu_status[theId] = 'hide';
            //menu_height[theId]='0';
        }
    }
	
	if( document.getElementById(menuId) )
	{
		document.getElementById(menuId).className='show';   
	}
}

function showSubmenuDiv(theid)
{
	hideAll_contentDivs();
	var showLeftMenuDiv=theid + "_showdiv";
	var submenuMakeWhite=theid + "_sub1";
   if(document.getElementById(showLeftMenuDiv))
   {
		document.getElementById(showLeftMenuDiv).className='show';		
   }
   for(i=1; i<=50; i++)
   {
		var MakeWhite="sm" + i + "_sub1";
		
		if( document.getElementById(MakeWhite) )
		document.getElementById(MakeWhite).className='normtabhedertxt3';//.style.color='BLACK';	
   }
   if( document.getElementById(submenuMakeWhite) )
   document.getElementById(submenuMakeWhite).className='normtabhedertxt3black';//.style.color='WHITE';
}

function showMidlinkDiv(theid)
{	
	hideAll_contentDivs();
	var showLeftMenuDiv=theid + "_midLinkdiv";
	//alert(showLeftMenuDiv);
   if(document.getElementById(showLeftMenuDiv))
   {
		document.getElementById(showLeftMenuDiv).className='show';
   }
}
