﻿	var topMenuTmr;
	var topSubMenuTmr;
	var lastSelectSubMenu = "";
	var subMenuLeft = "";
	
	function topMenu( objTd, iId )
	{
		objTd.style.background 		= findColor( iId, 0 );
		if( lastSelectSubMenu != "" )
		{
			document.getElementById( "topMenuSub" + lastSelectSubMenu ).style.display 	= "none";
			lastSelectSubMenu = "";
		}
		for( i = 1; i < 4; i++ )
		{
			document.getElementById( "topMenu" + i + "Div" ).style.display 	= "none";
		}
		
		if( iId < 4 )
		{
			document.getElementById( "topMenu" + iId + "Div" ).style.display 	= "block";
		}
	}
		
	function topMenuOut( objTd, iId )
	{
		objTd.style.backgroundColor = '#E2E7F2';
	}
	
	function topMenuClsTmr( iId )
	{
		funcStr    = "topMenuCls( " + iId + " )"; 
		topMenuTmr = setTimeout( funcStr, 150 );
	}
	
	function topMenuCls( iId )
	{
		document.getElementById( "topMenu" + iId + "Div" ).style.display 	= "none";
	}

	function topMenuRstTmr()
	{
		window.clearTimeout( topMenuTmr );
	}

	function topSubMenuRstTmr()
	{
		window.clearTimeout( topSubMenuTmr );
		//document.getElementById( "iCtr" ).value = parseInt( document.getElementById( "iCtr" ).value ) + 1;
	}

	function topSubMenuClsTmr( iId )
	{
		window.clearTimeout( topSubMenuTmr );
		funcStr    	  = "topSubMenuCls( '" + iId + "' )"; 
		topSubMenuTmr = setTimeout( funcStr, 1 );
	}
	
	function topSubMenuCls( iId )
	{
		document.getElementById( "topMenuSub" + iId ).style.display 	= "none";
	}

	function openSubMenu( iId )
	{
		//document.getElementById( "topMenuSub" + iId ).style.left 	   += 150;
		if( subMenuLeft == "" )	
		{
			subMenuLeft = document.getElementById( "topMenuSub" + iId ).style.left + 100;
		}
		document.getElementById( "topMenuSub" + iId ).style.left 		= subMenuLeft;
		document.getElementById( "topMenuSub" + iId ).style.display 	= "block";
		
		lastSelectSubMenu = iId;
	}

	function closePrevSubMenu()
	{
		if( lastSelectSubMenu != "" )
		{
			document.getElementById( "topMenuSub" + lastSelectSubMenu ).style.display 	= "none";
			lastSelectSubMenu = "";
		}
	}

	function slctMenuItem( objTd, iId )
	{
		objTd.style.backgroundColor = findColor( iId, 1 );
	}

	function deSlctMenuItem( objTd, iId )
	{
		objTd.style.backgroundColor = findColor( iId, 0 );
	}
	
	function findColor( iId, typeSlct )
	{
		if( typeSlct == 0 )
		{
			switch( iId )
			{ 
				case 1 :
					tdColor = "#A6CEE8";
					break;
				case 2 :
					tdColor = "#D5C8DE";
					break;
				case 3 :
					tdColor = "#A1D7CC";
					break;
				case 4 :
					tdColor = "#DAE388";
					break;
				case 5 :
					tdColor = "#FFD4A5";
					break;
				case 6 :
					tdColor = "#DAE388";
					break;
			}
		}
		else
		{
			switch( iId )
			{ 
				case 1 :
					tdColor = "#4C9CD0";
					break;
				case 2 :
					tdColor = "#AE94BE";
					break;
				case 3 :
					tdColor = "#48B19C";
					break;
				case 4 :
					tdColor = "#7F9F1E";
					break;
			}
		}		
		return tdColor;

	}
	
	function goCategory( iId )
	{
		window.location = "Category.asp?cId=" + iId;
	}
    
    function MouseOverMenu(obj,menuId,levelid)
    {
        obj.style.backgroundColor = findColor( menuId, levelid );
    }
    