<!--

/*************************************************
 * Jump menu generated by Macromedia Dreamweaver *
 *************************************************/
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


/******************************************************************
 * Resizes the height of all column divs to match the tallest one *
 ******************************************************************/
function adjustColumnHeights()  
{  
 //alert("got here");
 // Get natural heights  
 var cHeight = xHeight("sub-right-col");  
 var lHeight = xHeight("sub-left-col");  
 //var rHeight = xHeight("rightcontent");  
 
 // Find the maximum height  
 //var maxHeight = Math.max(cHeight, Math.max(lHeight, rHeight));
 var maxHeight = Math.max(cHeight, lHeight);
 //set minimum height for 1024 x 768 resolution
 //alert(maxHeight);
 if (maxHeight < 400) {
	maxHeight = 400; 
 }
 //alert(maxHeight);
 //alert("maxHeight=" + maxHeight);
 
 // Assign maximum height to all columns
 xHeight("sub-right-col", maxHeight + 80);  //add 80 since top position of contacts div on office locations page is adjusted
 xHeight("sub-left-col", maxHeight + 80);	//add 80 since top position of contacts div on office locations page is adjusted
 xHeight("sub-content", maxHeight - 80);
 xHeight("wrapper", maxHeight + 207);
 //xHeight("right", maxHeight);  
 
 // Show the footer  
 xShow("footer-left");
 xShow("footer-right");
}



/*
	Written by Jonathan Snook, http://www.snook.ca/jonathan
	Add-ons by Robert Nyman, http://www.robertnyman.com
	http://www.robertnyman.com/2005/11/07/the-ultimate-getelementsbyclassname/ 
*/

function getElementsByClassName(oElm, strTagName, strClassName){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/-/g, "\-");
	var oRegExp = new RegExp("(^|\s)" + strClassName + "(\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];
		if(oRegExp.test(oElement.className)){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}

function showContacts(contactsToShow) {
    //alert(contactsToShow);
    //alert("sub-left-col height=" + document.getElementById("sub-left-col").style.height);
    //location.reload(true); --clears out the selected option
    clearContacts();
    document.getElementById(contactsToShow).style.visibility="visible";
    //alert("offsetHeight of contacts div=" + document.getElementById(contactsToShow).offsetHeight);
    //resize right column height (FF requires px on the end, IE does not)
    document.getElementById("sub-right-col").style.height=((document.getElementById(contactsToShow).offsetHeight)+150)+"px";
    adjustColumnHeights();
}

function clearContacts() {
    //hide all contacts divs
    var arrContactsDivs = getElementsByClassName(document, "div", "contacts");
    for(var i=0; i<arrContactsDivs.length; i++){
      arrContactsDivs[i].style.visibility="hidden";
    }
    //reset column heights
    document.getElementById("sub-left-col").style.height="200px";
    document.getElementById("sub-right-col").style.height="200px";
    document.getElementById("sub-content").style.height="110px";
    adjustColumnHeights();
}

/*
 * Get URL Parameters
 * http://www.netlobo.com/url_query_string_javascript.html
 * 
The way that the function is used is fairly simple. Let's say you have the following URL:

http://www.foo.com/index.html?bob=123&frank=321&tom=213#top

You want to get the value from the frank parameter so you call the javascript function as follows:

var frank_param = gup( 'frank' );

Now if you look at the frank_param variable it contains the number 321. The query string was parsed by the regular expression and the value of the frank parameter was retrieved. The function is smart in a couple of ways. For example, if you have an anchor in your URL like our example URL above does (#top) the gup() function knows to stop before the # character. Also, if a requested parameter doesn't exist in the query string then an empty string is returned instead of a null.
*/
function gup( name )
{
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var tmpURL = window.location.href;
  var results = regex.exec( tmpURL );
  if( results == null )
    return "";
  else
    return results[1];
}



//***************************************************************************************
//This function takes the values from the validatefields() function and uses it to test
//if any of the text boxes are empty. If they are, then a message displays the field name
//where the missing information is. It also disables the submit button.
//***************************************************************************************
function validateFieldArray(flds){
	for(var i=0; i<flds.length; i++){
		if(flds[i][0].value=="" ){
			alert("Please enter" + " "+flds[i][1]);
			flds[i][0].focus();
			//disableButton();
			return false;
		}
 		//return true;
 	} 
}


//**************************************************************************************
//Used for links in child windows.  Closes child window and opens link in parent window.
//**************************************************************************************
function openInParent(href){
	if (this.opener!=null)
	{
		window.close();
		opener.focus();
		opener.top.location.href=href;
	}
	else
	{
		window.location.href=href;
	}
}


//***************************************
//Opens a link in an informational window
//***************************************
function infoW(href) 
{
	window.open(href,"Viewer","width=600,height=400,screenX=0,screenY=0,dependent,scrollbars,resizable,menubar,status")
}


/******************************************
--check for the existence of a session cookie
--if it exists, return true
--if it doesn't exist, create it and return false
--called on same page as Flash banner so we can tell if the Flash banner has played once and not play it again during this same session
*******************************************/
function flashCookieExists(){
	//alert(document.cookie.indexOf("itsFlashRunOnce"));
	if (document.cookie.indexOf("itsFlashRunOnce")==-1){
			//doc.getElementById("bnrFlash").style.display="inline";
			document.cookie="itsFlashRunOnce=1";
			//alert("set cookie to " + document.cookie.indexOf("itsFlashRunOnce"));
			return false;
	}else{
		return true;
	}
}


//************************************************
//generates code to display a left navigation item
//************************************************
function displayLeftNavItem(strName, strFileName, strLevel, strURL) {
	//add >> character in front of level 2 options
	strBullet = "";
	if (strLevel=="2"){
		strBullet = "&raquo;";  //add a bullet if this is level 2 navigation
		strName = "<div>" + strName + "</div>"; //add a surrounding div if this is level 2 navigation
	}
   //remove extension from filename, keep dot
   strFileName = strFileName.substring(0, strFileName.lastIndexOf(".")+1);
   if (location.pathname.indexOf(strFileName) == -1) {
	document.write('<div class="navLeft_level' + strLevel + '"><a href="' + strURL + '">' + strBullet + strName + '</a></div>');
   } else {
	document.write('<div class="navLeft_level' + strLevel + '_on">' + strBullet + strName + '</div>');
   }
   return;
}



//  End -->
