function doubleLoad(menuID) {
	// 07/07/01 DLB	Changed info passed to MenuID.  SID is set in jsSID in bmConnector.inc.
	if (parseInt(navigator.appVersion.substring(0,1))>3){
		parent.frames[0].location = "bmBanner.aspx?mid=" + menuID + "&sid=" + jsSID;
		parent.frames[1].location = "bmMenuContents.aspx?mid=" + menuID + "&sid=" + jsSID;
	}
}
//-----------------------------------------------------------------------------
function singleLoad(where) {
	// 07/07/01 DLB	Added SID to querystring when called.
	if (parseInt(navigator.appVersion.substring(0,1))>3){
		//parent.frames[1].location = where + "&sid=" + jsSID;
		document.location = where + "&sid=" + jsSID;
		
	}
}
//-----------------------------------------------------------------------------
// new IE and NS menu function DJG 12/3/01
var menuWho = 0;

function showMenu(who){
	if (menuWho != who){
		menuWho = who;
		if (parseInt(navigator.appVersion.substring(0,1))>3){
			document.getElementById("MenuBlank").style.display = "none";
			if (document.getElementById("Menu1")){
				document.getElementById("Menu1").style.display = "none";
			}
			if (document.getElementById("Menu2")){
				document.getElementById("Menu2").style.display = "none";
			}
			if (document.getElementById("Menu3")){
				document.getElementById("Menu3").style.display = "none";
			}
			if (document.getElementById("Menu4")){
				document.getElementById("Menu4").style.display = "none";
			}
			if (document.getElementById("Menu5")){
				document.getElementById("Menu5").style.display = "none";
			}
			if (document.getElementById("Menu6")){
				document.getElementById("Menu6").style.display = "none";
			}
			if (document.getElementById("Menu7")){
				document.getElementById("Menu7").style.display = "none";
			}
			if (document.getElementById("Menu8")){
				document.getElementById("Menu8").style.display = "none";
			}
			if (document.getElementById("Menu9")){
				document.getElementById("Menu9").style.display = "none";
			}
			if (document.getElementById("Menu10")){
				document.getElementById("Menu10").style.display = "none";
			}
			if(who == 1){
				document.getElementById("Menu1").style.display = "inline";
			}else if(who == 2){
				document.getElementById("Menu2").style.display = "inline";
			}else if(who == 3){
				document.getElementById("Menu3").style.display = "inline";
			}else if(who == 4){
				document.getElementById("Menu4").style.display = "inline";
			}else if(who == 5){
				document.getElementById("Menu5").style.display = "inline";
			}else if(who == 6){
				document.getElementById("Menu6").style.display = "inline";
			}else if(who == 7){
				document.getElementById("Menu7").style.display = "inline";
			}else if(who == 8){
				document.getElementById("Menu8").style.display = "inline";
			}else if(who == 9){
				document.getElementById("Menu9").style.display = "inline";
			}else if(who ==10){
				document.getElementById("Menu10").style.display = "inline";
			}
		}
	}
}

// Popup Menu-----------------------------------------------------------------------------
var thisTimer = 0;
var menuState = 0;

function hideMenu(which) {
	if (window.document.getElementById("PopupMenu" + which)){
		document.getElementById("PopupMenu" + which).style.visibility = "hidden";
		menuState = 0;
	}
}

function PopMenu(Show, where, obj) {
	if (parseInt(navigator.appVersion.substring(0,1))>3){
		for (x = 0; x < 11; x++) {
			if (window.document.getElementById("PopupMenu" + x)){
				document.getElementById("PopupMenu" + x).style.visibility = "hidden";
			}
		}
		if (Show == 1){
			//document.getElementById("PopupMenu" + where).style.left = obj.getBoundingClientRect().left; 	// new (only IE, need NS function)
			document.getElementById("PopupMenu" + where).style.left = obj.offsetLeft; 	// new (only IE, need NS function)
			document.getElementById("PopupMenu" + where).style.visibility = "visible";
			menuState = 0;
		}
	}
}

function menuOut(which) {
	if (window.document.getElementById("PopupMenu" + which)){
		if (menuState == 1) {
			thisTimer = setTimeout('hideMenu(' + which + ')', 500);
			menuState = 0;
		}
	}
}

function menuOver() {
	menuState = 1;
}

//-----------------------------------------------------------------------------
function popPage(page,wTitle,x,y) {
	wTitle = window.open(page,wTitle,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width='+x+',height='+y);
	wTitle.focus();
}

//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
function appendToAllURLs(){
	//This function appends the SID to the URL of all links on the page.
	//Could be changed to append just about anything else to the URL as well.
	
	var i;
	var sURL;
	var pattern1 = /\?/;    //regular expression matching "?" anywhere in the string
	var pattern2 = /\?$/;   //regular expression matching "?" at the end of the string
	var pattern3 = /&sid=/i;  //regular expression matching "&sid=" (case-insensitive) anywhere in the string
	var pattern4 = /\?sid=/i;  //regular expression matching "?sid=" (case-insensitive) anywhere in the string
	
	for (i = 0; i < document.links.length; i++) {
		sURL = document.links[i].href;
		
		if ((sURL.search(pattern3) == -1)&(sURL.search(pattern4) == -1)){
			//"&sid=" not found and "?sid=" not found
			
			if (sURL.search(pattern1) != -1) {
				//"?" found; test whether it is the last character (empty query string)
				if (sURL.search(pattern2) != -1) {
					//"?" is the last character; add nothing to string
				}
				else {
					//"?" not the last character
					sURL += "&";
				}
			}
			else {
				//"?" not found
				sURL += "?";
			}
		
			sURL += "sid=" + jsSID;
		}
		
		document.links[i].href = sURL;
	}
}
