﻿
var domSMenu = null;
var oldDomSMenu = null;
var t = 0;
var lDelay = 3;
var lCount = 0;
var pause = 100;
var lCurMenuNum;
var menu_strOrientation;

function popMenu(menuNum){
isID=0;
isAll=0;
isLayers=0;
if (document.getElementById&&!document.all) 
{	
	isID = 1; 
	isDHTML = 1;
}
else 
{
	if (document.all) 
	{	
		isAll = 1; 
		isDHTML = 1;
	}
	else 
	{
		browserVersion = parseInt(navigator.appVersion);
		if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) 
		{
			isLayers = 1; 
			isDHTML = 1;
		}
	}
}
	
	if (isDHTML) {
		///// Defines the DOMs of the menu objects
		
		var idMenu = 'menuHead';
		var domMenu = findDOM(idMenu,0);

		var idMenuOpt = 'menuHead' + menuNum;
		var domMenuOpt = findDOM(idMenuOpt,0);		
		


		var idSMenu = 'menu' + menuNum;
		domSMenu = findDOM(idSMenu,1);
		
			t = 2; 
			if ((oldDomSMenu)) {
					if(oldDomSMenu != domSMenu){
					oldDomSMenu.visibility = 'hidden'; 
					oldDomSMenu.zIndex = '0'; 	
					t = 2; 
					lCount = 0;
					}
			}
	
	lCurMenuNum=menuNum;

///// Defines the positions of the sub-menus
	if(menu_strOrientation=="vertical")
	{
		if (isAll) 
		{ 	
			var menuLeft = (domMenu.offsetLeft) + ((domMenuOpt.offsetLeft) - domMenuOpt.offsetWidth);
			var menuTop = ((domMenuOpt.offsetTop)) ;
			
		}
		if (isLayers) 
		{
			var menuLeft = document.layers[idMenu].layers[idMenuOpt].pageX;
			var menuTop = domMenu.pageY + domMenu.clip.height;
			
		}
		if (isID) 
		{ 	
			
			var menuLeft = (domMenu.offsetLeft - 2*domMenuOpt.offsetWidth) - 2;
			if (navigator.platform.indexOf ("Win32") != -1 ) { isWindows = 1;} 
			if(navigator.platform.indexOf ("Win32") == -1 && navigator.appName == "Microsoft Internet Explorer"){ isMacIE = 1; }

			if (navigator.userAgent.indexOf("Mac") != -1 && 
        typeof document.body.leftMargin != "undefined") {
				menuLeft = (domMenu.offsetLeft - domMenuOpt.offsetWidth) - 2;
        }
			var menuTop = (domMenuOpt.offsetTop) - 15;
		}
	}
	else
	{
		if (isID || isAll) 
		{ 	
			var menuLeft = (domMenuOpt.offsetLeft);
			var menuTop = (domMenu.offsetTop) + (domMenu.offsetHeight);
		}
		if (isLayers) 
		{
			var menuLeft = document.layers[idMenu].layers[idMenuOpt].pageX;
			var menuTop = domMenu.pageY + domMenu.clip.height;
		}
	}


///// Positions and shows the menu
		if (oldDomSMenu != domSMenu) {	
			domSMenu.left = menuLeft; 
			domSMenu.top = menuTop;
			domSMenu.visibility = 'visible';
			domSMenu.zIndex = '0';
			oldDomSMenu = domSMenu;
		}
	}

////// Returns a 'null' value for non-DHTML Browsers 
	else { return null; }
}

function delayHide() {
///// Checks to see if there is a menu showing and whether 
///// the global variable 't' has been set to 0
    if ((oldDomSMenu) && (t == 0)) {

///// Hides the old menu, resets menu conditions, 
///// and stops the function running
        oldDomSMenu.visibility = 'hidden'; 
        oldDomSMenu.zIndex = '0';
        oldDomSMenu = null;
        lCount = 0; 
        return false;
    }

///// Interupts the function if another menu is opened
    if (t == 2) { lCount = 0; return false; }

///// Repeats the function adding 1 to lCount each time until 
///// lCount is equal to lDelay and then sets 't' to 0 so that 
///// the menu will hide when it runs again
    if (t == 1) { 
        lCount = lCount + 1;
        if (lDelay == lCount) { t = 0; }
        //if (lDelay > lCount) { setTimeout('delayHide()',pause); }
        setTimeout('delayHide()',pause);
    }    
}

<!-- Copyright © 2004 iMart Corporation. All rights reserved. -->