function getElementsByClassName(oElm, strTagName, oClassNames){
	var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	var arrRegExpClassNames = new Array();
	if(typeof oClassNames == "object"){
		for(var i=0; i<oClassNames.length; i++){
			arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"));
		}
	}	else {
		arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)"));
	}
	var oElement;
	var bMatchesAll;
	for(var j=0; j<arrElements.length; j++){
		oElement = arrElements[j];
		bMatchesAll = true;
		for(var k=0; k<arrRegExpClassNames.length; k++){
			if(!arrRegExpClassNames[k].test(oElement.className)){
				bMatchesAll = false;
				break;
			}
		}
		if(bMatchesAll){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}
// ---
// Array support for the push method in IE 5
/*
Array.prototype.push = ArrayPush;
function ArrayPush(value){
	this[this.length] = value;
}
*/
/*
	Examples of how to call the function:

	To get all a elements in the document with a "info-links" class:
    getElementsByClassName(document, "a", "info-links");

	To get all div elements within the element named "container", with a "col" and a "left" class:
    getElementsByClassName(document.getElementById("container"), "div", ["col", "left"]);
*/


function IEHoverPseudo() {
	var navLvlTwo = document.getElementById("NavLvlTwo");
	if(navLvlTwo != null) {
		var navItems = document.getElementById("NavLvlTwo").getElementsByTagName("li");
		for (var i=0; i<navItems.length; i++) {
			if(navItems[i].className == "navLiLevelOne") {
				navItems[i].onmouseover=function() { 
					this.className += " over"; 
					if(document.getElementById("hideSelect")!=null && this.id=="extraHide"){ document.getElementById("hideSelect").style.visibility = 'hidden';}
				}
				navItems[i].onmouseout=function() {
					 this.className = "navLiLevelOne";
					 if(document.getElementById("hideSelect")!=null ){ document.getElementById("hideSelect").style.visibility = 'visible';}
				 }
			} else if(navItems[i].className == "navLiLevelOne noList") {
				navItems[i].onmouseover=function() { this.className = "navLiLevelOne noListover"; }
				navItems[i].onmouseout=function() { this.className = "navLiLevelOne noList"; }
			}
		}
	}
}

function FixWidthFirstLvl() {
	WidthContainer = 925;
	
	var navLvlTwo = document.getElementById("NavLvlTwo");
	if(navLvlTwo != null) {
		all1stLi = getElementsByClassName(document.getElementById("NavLvlTwo"), "li", "navLiLevelOne");
		
		WidthALarge = "";
		for(i = 0; i < all1stLi.length; i++) {
			allTagsA = getElementsByClassName(all1stLi[i], "a", "ItemLevelOne");
			
			WidthA = allTagsA[0].offsetWidth;
			//alert(WidthA);
			
			if(WidthALarge < WidthA)
				WidthALarge = WidthA;
			
			allTagsA[0].style.width = WidthA - 7 + "px";
			
			if(i != all1stLi.length-1)
				all1stLi[i].style.width = WidthA + 39 + "px";
			else
				all1stLi[i].style.width = WidthA + 7 + "px";
			
			allTagsA[0].style.fontWeight = "bold";
		}
		
		allDHTML = getElementsByClassName(document.getElementById("NavLvlTwo"), "ul", "navUlLevelTwo");
		
		for(i = 0; i < allDHTML.length; i++) {
			allDHTML[i].style.width = WidthALarge + 10 + "px";
			
			objTagLi = allDHTML[i].getElementsByTagName("li");
			for(j = 0; j < objTagLi.length; j++) {
				objTagLi[j].style.width = WidthALarge + 10 + "px";
			}
			
			objTagA = allDHTML[i].getElementsByTagName("a");
			for(j = 0; j < objTagA.length; j++) {
				objTagA[j].style.width = WidthALarge - 10 + "px";
			}
		}
		
		if(document.getElementById("nav_lvl1_item2").src.indexOf('_on') != -1) { // Center
			document.getElementById("NavLvlTwo").className = "FloatLeft";
			WidthMenu = document.getElementById("NavLvlTwo").offsetWidth;
			MarginLeft = (WidthContainer - WidthMenu) / 2;
			
			if(navigator.appName.indexOf('Internet Explorer') != -1)
				MarginLeft = MarginLeft/2;
			
			document.getElementById("NavLvlTwo").style.marginLeft = MarginLeft + "px";
		} else if(document.getElementById("nav_lvl1_item3").src.indexOf('_on') != -1) { // Right
			RightThirdMenu = document.getElementById("nav_lvl1_item1").offsetWidth + document.getElementById("nav_lvl1_item2").offsetWidth + document.getElementById("nav_lvl1_item3").offsetWidth;
			MarginRight = WidthContainer - RightThirdMenu - 22 + 10;
			document.getElementById("NavLvlTwo").className = "FloatRight";
			
			if(navigator.appName.indexOf('Internet Explorer') != -1)
				MarginRight = MarginRight/2;
				
			document.getElementById("NavLvlTwo").style.marginRight = MarginRight + "px";
		}
	}
}

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}

function addResizeEvent(func) { // Manage Resize Event
    var oldonresize = window.onresize;
    if (typeof window.onresize != 'function') {
        window.onresize = func;
    } else {
        window.onresize = function() {
            oldonresize();
            func();
        }
    }
}

addLoadEvent(IEHoverPseudo);
addLoadEvent(FixWidthFirstLvl);