//////////
// Global vars

	var vizDept = null;
	var vizMenu = null;
	var noAnnoy = false;
	
// 
////////// 

var displaySage = true
var mac = navigator.appVersion.indexOf("Mac")>-1

if ((navigator.userAgent.indexOf("Netscape6/6.1") != -1) || (window.location.hostname.indexOf("netsagecentral.com") != -1) || mac) {
	displaySage = false
}
    

//////////
//  Build menu

	function getMenu(deptName,menuName) {
		
		if(document.all && !mac) {
			
			var top = 0;
			var left = 1;
			var thisDept;
			
			if(vizDept != null && vizMenu != null) {
				if(vizMenu.style.visibility != 'hidden') {
					closeMenu();
					showSelect();
				}
			}
			
			vizDept = eval("document.all." + deptName);
			vizMenu = eval("document.all." + menuName);
			thisDept = vizDept;
				
			while(thisDept.tagName != "BODY") {
				top += thisDept.offsetTop;
				left += thisDept.offsetLeft;
				thisDept = thisDept.offsetParent;
			}
			
			//offset menu so dept heading is visible.
			top += (vizDept.offsetHeight);
						
			vizMenu.style.left = left;
			vizMenu.style.top = top;
			
			//set slight delay so menu will not annoy you.
			setTimeout('delayMenu()',300);
			
			event.cancelBubble = true;
		}
	}

// 
////////// 

//////////
//  Delay opening menu

	function delayMenu() {
		
		//hideSelect();
		openMenu();
	}

// 
////////// 

////////// 
//  Open menu

	function openMenu() {
	
		if(vizDept != null && vizMenu != null) {
			vizMenu.style.visibility = 'visible';
		}
	}

//
//////////	

//////////
// Close menu

	function closeMenu() {
	
		vizMenu.style.visibility = 'hidden';
	}
	
//
//////////	

//////////
// Keeps menu hidden
	
	function hideMenu() {
	
		if(document.all && !mac) {
		
			if(vizDept != null && vizMenu != null) {
				
				if(!vizMenu.contains(event.toElement)) {
					
					vizMenu.style.visibility = 'hidden';
					vizDept = null;
					vizMenu = null;
					showSelect();
				}
			}
		}
	}

//
//////////	

//////////
//  Turn off select tags

	function hideSelect() {
	
		var s = 0;
		var selTag;
		var thisTag;
		var top = 0;
		var left = 0;
		var menuHeight;
		
		for( s; s < document.all.tags("select").length; s++ ) {
		
			selTag = document.all.tags("select")[s];
			thisTag = selTag;
		
			while(thisTag.tagName != "BODY") {
			
				top += thisTag.offsetTop;
				left += thisTag.offsetLeft;
				thisTag = thisTag.offsetParent;
			}
			if(vizMenu != null) {
			
				menuHeight = (vizMenu.offsetTop + vizMenu.offsetHeight);
				
				if(top < menuHeight) {
							
					if((left < (vizMenu.offsetLeft + vizMenu.offsetWidth)) && (left + selTag.offsetWidth > vizMenu.offsetLeft)) {
						//document.all.CountrySelect.style.visibility = 'visible';
						//document.all.CountrySelect.style.zIndex=0;
					}
				}
			}
			top = 0;
			left = 0;
		}
	}
	
//
//////////	

//////////
//  Turn select tags back on

	function showSelect() {
	
		var s = 0;
		var selTag;
		
		for( s; s < document.all.tags("select").length; s++ ) {
		
			selTag = document.all.tags("select")[s];
			
			if(!selTag || !selTag.offsetParent)
				continue;
			selTag.style.visibility = 'visible';
		}
	}

//
//////////	

