// Determine if we are on French or English page

var sLocation = new String(window.location);

var bEng = false;
var bFre = false;

if (sLocation.indexOf("/en/") > 0) {
	bEng = true;
} else if (sLocation.indexOf("/fr/") > 0) {
	bFre = true;
}


// PRE-LOADER
var preLoad = new Array();

function preLoadImgs() {
	for (var i = 0; i < preLoadImgs.arguments; i++) {
		preLoad[i] = new Image();
		preLoader.src = preLoadImgs.arguments[i];
	}
}

preLoadImgs("/en/images/right_surveys_on.gif", "/en/images/right_share_on.gif", "/en/images/right_guestbook.gif", "/fr/images/right_surveys_on.gif", "/fr/images/right_share_on.gif", "/fr/images/right_guestbook.gif");

function swapImg(theVar, state) {
	if (document.getElementById) {
		var imgName = theVar.childNodes[0].id.toString();
		var sLocation = new String(window.location);
		if (bEng) {
			document.getElementById(imgName).src = "/en/images/right_" + imgName + "_" + state + ".gif";
		} else if (bFre) {
			document.getElementById(imgName).src = "/fr/images/right_" + imgName + "_" + state + ".gif";
		}
	}
}



var navRoot;			//	Define it here so we can access it elsewhere

startList = function() {
	if (document.getElementById) {
		navRoot = document.getElementById("main_nav_list");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
			
				//	Set drop down menu functions for IE & NS6 since they do
				//	do interpret the li:hover event.
				if (browser.isIE) {		// 
					//	Show the dropdown menu
					node.onmouseover=function() {
						for (var j=0; j < this.childNodes.length; j++) {
							if (this.childNodes[j].tagName=="UL") {
								this.childNodes[j].className = this.childNodes[j].className.replace("no_show", "show");
								bHover = true;
								break;
							}
						}
					}

					//	Hide the dropdown menu
					node.onmouseout=function() {
						for (var j=0; j < this.childNodes.length; j++) {
							if (this.childNodes[j].tagName=="UL") {
								this.childNodes[j].className = this.childNodes[j].className.replace("show", "no_show");
								bHover = false;
								break;
							}
						}
					}
				}
				
				//	Set the background as PNG using DOM or IE's model
				for (var j=0; j < node.childNodes.length; j++) {
					if (node.childNodes[j].tagName=="UL") {
						var theULStyle = node.childNodes[j].style;
						if ((browser.isIE55 || browser.isIE6up) && browser.isWin32) {
							theULStyle.backgroundColor = "#00529B";
							theULStyle.filter = "filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=95);";
						//	theULStyle.filter = "filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='/images/drop_down_bkgd.png')";
						} else {
							// Set to transparents since there is a bg color set in the CSS
							// in case JS is turned off.
							theULStyle.backgroundImage = "url(/images/drop_down_bkgd.png)";
						}
					}
				}
			}
		}
	}
}
window.onload=startList;



