/**
* common library of javascript functions
*/

function addEvent(obj, evType, fn) {
    if (obj.addEventListener) {
		obj.addEventListener(evType, fn, true);
		return true;
    } else if (obj.attachEvent)  {
        var r = obj.attachEvent("on" + evType, fn);
        return r;
    } else {
        return false;
    }
}

/*
Nav Fix for IE hover
*/
navArray = Array('nav1');
startList = function() {
	if (document.all&&document.getElementById) {
		//Top Navs
		for (m=0; m<navArray.length; m++) {
			if (document.getElementById(navArray[m])) {
				topNavRoot = document.getElementById(navArray[m]);
				for (i=0; i<topNavRoot.childNodes.length; i++) {
					node = topNavRoot.childNodes[i];
					//alert(node.nodeName);
					if (node.nodeName=="LI") {
						//Sub UL
						for (j=0; j<node.childNodes.length; j++) {
							subTopNavRoot = node.childNodes[j];
							if (subTopNavRoot.nodeName=="UL") {
								for (k=0; k<subTopNavRoot.childNodes.length; k++) {
									subnode = subTopNavRoot.childNodes[k];
									if (subnode.nodeName=="LI") {
										subnode.onmouseover=function() {
											this.className="over "+this.className;
										}
										subnode.onmouseout=function() {
											this.className=this.className.replace("over ", "");
										}
									}
								}
							}
						}
						node.onmouseover=function() {
							//alert(" m = "+m+"\n i = "+i+"\n j = "+j+"\n k = "+k);
							this.className="over "+this.className;
						}
						node.onmouseout=function() {
							this.className=this.className.replace("over ", "");
						}
					}
				}
			}
		}
	}
}
addEvent(window, 'load', startList);



/*
Redirect to no cookies page
*/
function noCookies(redirect) {
	var tmpcookie = new Date();
	chkcookie = (tmpcookie.getTime() + '');
	document.cookie = "chkcookie=" + chkcookie + "; path=/";
	if (document.cookie.indexOf(chkcookie,0) < 0) {
		window.location = redirect;
	} else {
		return("true");
	}
}

function openNewWindow(theURL,winName,features) {
//  window.open(theURL,winName,features);
	window.open(theURL,winName,features);
}

