
	//set the timeout in seconds to hide menu
timeSec = .5;

//---------------------------------------
//preload images
cso = new Image();
cso = 'images/mm_cs_over.gif';

//---------------------------------------
overBtn = 0;
menuId = 0;
// made dynamic in underwritersfuncs.asp
//menuItems = new Array (5,3,2,6,1,10);

var showMenu;

// only need to use an iframe in IE 5.5+ so popups float above select boxes
if (document.getElementById && document.attachEvent) // && (navigator.userAgent.indexOf('MSIE 5.') == -1))
{
	document.write("<iframe id='menuIframe' frameborder=0 style='position: absolute; display: none; z-index: 100000;' onmouseover='overBtn=1' onmouseout='overBtn=0; showMenu(\"timeout\");'></iframe>")
	/*window.attachEvent('onload', function(){
		var menuFrame = document.all.menuIframe;
		menuFrame = document.createElement('iframe');
		menuFrame.id = "menuIframe";
		menuFrame.frameBorder = 0;
		menuFrame.style.position = "absolute";
		menuFrame.style.display = "none";
		menuFrame.style.zIndex = "100000";	
		document.body.appendChild(menuFrame);
		menuFrame.attachEvent('onmouseover', function(){
			overBtn = 1;
		});
		menuFrame.attachEvent('onmouseout', function(){
			overBtn = 0;
			showMenu('timeout');
		});
	})*/
showMenu = function(setting)
{
	var secTimeout = timeSec * 1000;
	//perform actions--------------------------------------------
	//alert(overBtn);
	if (setting == "timeCheck")
	{
		if (overBtn == 0)
		{
			var menuIframe =  document.getElementById("menuIframe")
			if (! menuIframe) return;
			menuIframe.style.display = "none";
		}
	}
	else if (setting == "timeout")
	{
		setTimeout("showMenu('timeCheck')", secTimeout);
	}
	else
	{
		var i = menuId;
		var menuIframe = document.getElementById("menuIframe");
		if (! menuIframe) return;
		var popupWindow = window.frames.menuIframe;
		var doc = popupWindow.document;
		menuIframe.style.display = "";
		//menuIframe.style.top = document.getElementById("mainMenu" + i + "1").style.top;
		//menuIframe.style.left = document.getElementById("mainMenu" + i + "1").style.left;
		var menuToOpen = document.getElementById("mainMenu" + i + "1");
		menuIframe.style.top = menuToOpen.offsetTop +'px';
		menuIframe.style.left = menuToOpen.offsetLeft +'px';
		menuIframe.style.width = '1px'; //doc.body.firstChild.firstChild.offsetWidth;
		menuIframe.style.height = '1px'; //doc.body.firstChild.offsetHeight;
		doc.open();
		doc.write('<html>'
			+ '<head><base target="_top"><style>body {margin:0px; padding:0px; background-color: #FFFFFF; font-family:arial,helvetica,sans-serif; font-size:9pt; color:#000000;}.subnav_btn {	position:absolute; background-color : #CCCCCC; font-family: arial,helvetica,sans-serif; font-size: 10pt; color: #FFFFFF; border: 1px solid #666666; z-index:6; } .subnav_btn A { display: block; position: relative; left: 0px; padding: 4px 5px 3px 0px;} a.menu_link:link,a.menu_link:active,a.menu_link:visited { font-family:arial,sans-serif; font-size: 9pt; color:#000000; font-weight:bold; text-decoration:none; padding: 5px; background-color:transparent; } a.menu_link:hover,a.menu_link:visited:hover { font-family:arial,sans-serif; font-size: 9pt; color:#FFFFFF; font-weight:bold; text-decoration:none; padding: 5px; background-color:transparent; } </style></head><body style="margin:0px;overflow:hidden" onload="parent.resizeDropdown();"><div style="position:absolute; top:0px; width:1000px"><div style="float:left" onmouseover="parent.overBtn=1" onmouseout="parent.overBtn=0;parent.showMenu(\'timeout\');">');
		for (x=1; x<=menuItems[i]; x++){
			var menuToOpen = "mainMenu" + i + x;	
			doc.write("<div style='position: relative;' class='subnav_btn'>"+ document.getElementById(menuToOpen).innerHTML +"</div>");
		}
		doc.write('</div></div></body></html>');
		doc.close();
	}
};
resizeDropdown = function()
{
	var menuIframe = document.getElementById('menuIframe');
	if (! menuIframe) return;
	var popupWindow = window.frames.menuIframe;
	var doc = popupWindow.document;
	menuIframe.style.width = doc.body.firstChild.firstChild.offsetWidth +'px';
	menuIframe.style.height = doc.body.firstChild.offsetHeight +'px';
};
}
else

showMenu = function(setting){
	var secTimeout = timeSec * 1000;
	var path;
	var myVarId = "mainMenu" + menuId + 1;
	//check browser----------------------------------------------
	if(document.all){
		path = document.all[myVarId].style;
	}
	else if(document.getElementById){
		path = document.getElementById([myVarId]).style;
	}
	else if(document.layers){
		path = document.layers[myVarId];
	}
	//perform actions--------------------------------------------
	//alert(overBtn);
	if(setting == "timeCheck"){
		if(overBtn == 0){
			for (i=0; i<6; i++){
				for (x=1; x<=menuItems[i]; x++){
				var menuToClose = "mainMenu" + i + x;	
				//alert("Timeout Close " + menuToClose);
					if(document.all){
						document.all[menuToClose].style.visibility = "hidden";
					}
					else if(document.getElementById){
						document.getElementById([menuToClose]).style.visibility = "hidden";
					}
					else if(document.layers){
						path = document.layers[menuToClose].style.visibility = "hide";
					}
				}
			}
		}
	}
	else if(setting != "timeout"){
		if(path.visibility == "hidden" || path.visibility == "hide"){
			for (i=0; i<6; i++){
				if (i == menuId){
					for (x=1; x<=menuItems[i]; x++){
						var menuToOpen = "mainMenu" + i + x;	
						//alert("Open " + menuToOpen);
						if(document.all){
							document.all[menuToOpen].style.visibility = "visible";
						}
						else if(document.getElementById){
							document.getElementById([menuToOpen]).style.visibility = "visible";
						}
						else if(document.layers){
							document.layers[menuToClose].style.visibility = "visible";
						}
					}
				}
				else if (i != menuId){
					for (x=1; x<=menuItems[i]; x++){
						var menuToClose = "mainMenu" + i + x;
						//alert("Close " + menuToClose);
						if(document.all){
							document.all[menuToClose].style.visibility = "hidden";
						}
						else if(document.getElementById){
							document.getElementById([menuToClose]).style.visibility = "hidden";
						}
						else if(document.layers){
							document.layers[menuToClose].style.visibility = "hide";
						}
					}
				}
			}
		}
		else{
			for (i=0; i<6; i++){
				for (x=1; x<=menuItems[i]; x++){
				var menuToClose = "mainMenu" + i + x;	
					if(document.all){
						document.all[menuToClose].style.visibility = "hidden";
					}
					else if(document.getElementById){
						document.getElementById([menuToClose]).style.visibility = "hidden";
					}
					else if(document.layers){
						document.layers[menuToClose].style.visibility = "hide";
					}
				}
			}
		}
	}
	else{
	//IF SETTING == TIMEOUT
		if(path.visibility != "hidden" || path.visibility != "hide"){
			setTimeout("showMenu('timeCheck')", secTimeout);
		}
	}
}
