function doExternalLink(myLink){
	// This function opens a link to another page/website in a new window.
	// This is to replace the target attribute on the anchor elements, as the target attribute is NOT valid XHTML 1.0 STRICT.
	// Check to make sure that the "href" property is valid.
	if(this.href){
		// Open a new window using the "href" variable.
		window.open(this.href);
	}
	else if(myLink.href){
		// Open a new window using the "href" variable.
		window.open(myLink.href);
	}
	// End of IF statement.
	return false;
}
// End of function "doExternalLinks()"

function initMainNav(){
	if(document.getElementById("mainnav")){
		var nav = document.getElementById("mainnav");
		var navList = nav.getElementsByTagName("ul");
		if(navList.length > 0){
			var navItems = navList[0].getElementsByTagName("li");
			if(navItems.length > 0){
				for(i=0; i<navItems.length; i++){
						if(navItems[i].className == "noleft" || navItems[i].className == "noright"){
							if(navItems[i].className == "noleft") { var overImage = "BlueLeftEnd.png"; var outImage = "GreenLeftEnd.png"; }
							if(navItems[i].className == "noright") { var overImage = "BlueRightEnd.png"; var outImage = "GreenRightEnd.png"; }
							navItems[i].index = i;
							navItems[i].items = navItems;
							navItems[i].imageOut = outImage;
							navItems[i].imageOver = overImage;
							if(navItems[i].firstChild.className !== "current"){
								navItems[i].onmouseover = function(){
									if(this.index > 0 && this.items.length > 0){
										var el = this.items[this.index];
										if(el.className == "noleft") el = this.items[this.index-1];
										if(el.className == "noright") el = this.items[this.index+1];
											if(el.nodeName.toLowerCase() == "li" && (el.className == "first" || el.className == "last")){
												el.style.backgroundImage = "url('graphics/"+this.imageOver+"')";
											}
									}
								};
								// End of "navItems[i].onmouseover" event handler function.
								navItems[i].onmouseout = function(){
									if(this.index > 0 && this.items.length > 0){
										var el = this.items[this.index];
										if(el.className == "noleft") el = this.items[this.index-1];
										if(el.className == "noright") el = this.items[this.index+1];
											if(el.nodeName.toLowerCase() == "li" && (el.className == "first" || el.className == "last")){
												el.style.backgroundImage = "url('graphics/"+this.imageOut+"')";
											}
									}
								};
								// End of "navItems[i].onmouseout" event handler function.
							}
						}
						// End of IF statement.
				}
				// End of FOR Loop.
			}
			// End of IF statement.
		}
		// End of IF statement.
	}
	// End of IF statement.
}
// End of function "initMainNav()".
