// HORIZ NAV JS


hideElements = new Array();



// hides selectors when user rolls over horizontal dropdown

function findForm() {
	var theForm, theElem;

	for (var f=0; f<window.document.forms.length; f++) {

		theForm = window.document.forms[f];

		for (var e=0; e<theForm.elements.length; e++) {

			theElem = theForm.elements[e];
			if (theElem.tagName.toUpperCase() == "SELECT") {

				hideElements.push(theElem);

			}

		}

	}

};






function setNav() {
	var isIE = false;
	if (navigator.appName == "Microsoft Internet Explorer" && platform != "mac") {

		isIE = true;

		window.attachEvent("onload", findForm);

		//window.onload = findForm;

	}


	// decide if dropdown should hide any flash objects on the page

	var av = navigator.appVersion.toLowerCase();

	var ua = navigator.userAgent.toLowerCase();

	var platform;

	var browser;

	var hideFlash = false;

	var hideAd = false;

	if (av.indexOf("mac") != -1) {

		platform = "mac";

	} else if (av.indexOf("windows") != -1) {

		platform = "win";

	}

	if (ua.indexOf("firefox") != -1) {

		browser = "firefox";

	}



	// if firefox...

	if (browser == "firefox") {

		//alert('user has firefox');

		hideFlash = true;

	}

	

	if (browser == "firefox" || ua.indexOf("safari") != -1) {

		hideAd = true;

	}







	// swfPresent will be defined if hiding swfs
	swfPresent = false;

	if (window.swfList) {

		swfPresent = true;

		//alert('hiding: '+swfsToHide);

		//alert(swfList.length);

	}

	





	// drop down

	if (document.getElementById && document.getElementById("topNav")) {

		navRoot = document.getElementById("topNav");

		for (i=0; i<navRoot.childNodes.length; i++) {

			node = navRoot.childNodes[i];

			if (node.className == "collapsed") {

			

				node.onmouseover = function() {

					this.className = 'expanded';

					

					// testing form thing

					if (isIE) {

						for (e=0; e<hideElements.length; e++) {

							var formElem = document.getElementById(hideElements[e].id);

							if (formElem != null) {

								formElem.style.visibility = 'hidden';

							}

						}

						

					}

					

					// This hides the flash object(s)

					if (hideFlash && swfPresent) {

						for (var s=0; s<swfList.length; s++) {

							var flashobject = document.getElementById(swfList[s]);

							flashobject.style.visibility = 'hidden';

						}

					}

				

				}

				

				node.onmouseout = function() {

				this.className = 'collapsed';

					

					// testing form thing

					if (isIE) {

						for (e=0; e<hideElements.length; e++) {

							var formElem = document.getElementById(hideElements[e].id);

							if (formElem != null) {

								formElem.style.visibility = 'visible';

							}

						}

						

					}

					

					// This unhides the flash object(s)

					if (hideFlash && swfPresent) {

						for (var s=0; s<swfList.length; s++) {

							var flashobject = document.getElementById(swfList[s]);

							flashobject.style.visibility = 'visible';

						}

					}
					

				}

				

				for (j=0; j<node.childNodes.length; j++) {

					if (node.childNodes[j].className == "dropContainer") {

						elem = node.childNodes[j];

						for (k=0; k<elem.childNodes.length; k++) {

						

							// find 1st tier dropdowns

							if (elem.childNodes[k].className == "dropMenu" || elem.childNodes[k].className == "anchorDropMenu") {

								menuElem = elem.childNodes[k];

						

								for (q=0; q<menuElem.childNodes.length; q++) {



						

									if (menuElem.childNodes[q].className == "dropItem") {

										dropElem = menuElem.childNodes[q];

										dropElem.onmouseover = function() {

											//

											this.className = 'dropItemHi';

										}

										dropElem.onmouseout = function() {

											//

											this.className = 'dropItem';

										}

									

										// find 1st tier drop items that are also 2nd tier dropdowns

										for (d=0; d<dropElem.childNodes.length; d++) {

											if (dropElem.childNodes[d].className == "dropMenu2") {

												// found one

												tier2Item = dropElem.childNodes[d];

												// assign rollovers

												for (r=0; r<tier2Item.childNodes.length; r++) {

													if (tier2Item.childNodes[r].className != "rule") {

														tier2Item.childNodes[r].onmouseover = function() {

															this.className = 'dropItemHi';

														

														}

														tier2Item.childNodes[r].onmouseout = function() {

															this.className = 'dropItem';

														}

													}

												}

											}

										}

									} else if (menuElem.childNodes[q].className == "dropItem_s") { // special drop item, i.e. partner sites

										dropElem = menuElem.childNodes[q];

										dropElem.onmouseover = function() {

											//

											this.className = 'dropItemHi_s';

										}

										dropElem.onmouseout = function() {

											//

											this.className = 'dropItem_s';

										}

									}

								}

							}

						}

					}

				}

			}

		}

	}

	

	

}

function goTo(where) {

	window.location = where;

}

function goToNew(where,winName,features) {

	window.open(where,winName,features);

}


/**** SCRIPT TO INITIALIZE VERTICAL MENU ****/
function activateMenu(nav) {

    /* currentStyle restricts the Javascript to IE only */
	if (document.all && document.getElementById(nav).currentStyle) {  
        var navroot = document.getElementById(nav);
        
        /* Get all the list items within the menu */
        var lis=navroot.getElementsByTagName("LI");  
        for (i=0; i<lis.length; i++) {
           /* If the LI has another menu level */
            if(lis[i].lastChild.tagName=="UL"){
            	if(lis[i].lastChild.className=='section_static') { continue; }

                /* assign the function to the LI */
             	lis[i].onmouseover=function() {	
                
                   /* display the inner menu */
                   this.lastChild.style.display="block";
                }
                lis[i].onmouseout=function() {                       
                   this.lastChild.style.display="none";
                }
            }
        }
    }
}
