<!--
/**********************************
   Generic Global Variables
**********************************/
// globals for browser version branching
var Ver4 = parseInt(navigator.appVersion) >= 4;
var Nav4 = ((navigator.appName == "Netscape") && Ver4);
var IE4 = ((navigator.userAgent.indexOf("MSIE") != -1) && Ver4);
var reEmail = /^.+\@.+\..+$/
var whitespace = " \t\n\r";
var defaultEmptyOK = false

function newWindow02(page) {
	msgWindow=window.open(page,"windowName","width=631,height=450,menubar=no,status=no,scrollbars=yes,scrollable=yes,toolbar=no,resizable=no,location=no")
}


// client-side cookie getter
function getCookie(Name) {
   var search = Name + "=";

   if (document.cookie.length > 0) { // if there are any cookies
       offset = document.cookie.indexOf(search);
       if (offset != -1) { // if cookie exists
           offset += search.length;
           // set index of beginning of value
           end = document.cookie.indexOf(";", offset);
           // set index of end of cookie value
           if (end == -1)
               end = document.cookie.length;
           return unescape(document.cookie.substring(offset, end));
       }
   }
   return "";
}

// to open a new window:
function newWindow(page)
{
msgWindow=window.open(page,"windowName","width=650,height=590,menubar=yes,status=yes,scrollbars=yes,scrollable=yes,toolbar=yes,resizable=yes,location=yes");
}


// New readable version of the Browser-independent
// object finder function
// 2 arguments - 1. objName => the name of the obj to find
//		2. rootElement => the root element to start the search from

function findObj(objName, rootElement) {
	var frameIdentifier,obj;
	var i;

	// Identify presence of frames and root element
	if(!rootElement)
		rootElement=document;
	if((frameIdentifier=objName.indexOf("?"))>0&&parent.frames.length) {
		rootElement=parent.frames[objName.substring(frameIdentifier+1)].document;
		objName=objName.substring(0,frameIdentifier);
	}

	// First do a direct search
	if(!(obj=rootElement[objName]) && rootElement.all)
		obj=rootElement.all[objName];

	// Second look for object within forms, if any
	for (i=0;!obj&&i<rootElement.forms.length;i++)
		obj=rootElement.forms[i][objName];

	// Recursively search layers if object is still not found
	for(i=0;!obj && rootElement.layers && i<rootElement.layers.length;i++)
		obj=findObj(objName,rootElement.layers[i].document);

	return obj;
}

// New readable version of the browser-independent dynamic image
// swapper function
// 2 (or multiples of 2) arguments - img1 name, img1.newSrc, img2 name, img2.newSrc, ..
function imgSwap() {
	var obj;

	var argv = imgSwap.arguments;
	var argc = argv.length;
	var i,j=0;

	if ((argc % 2) != 0)
		return;
	for(i=0; i<argc; i+=2) {
		if ((obj=findObj(argv[i]))!=null){
			if(!obj.origSrc)
				obj.origSrc=obj.src;
			obj.src=argv[i+1];
		}
	}
}

// an image pre-loader.  variable is used within the pre-loader for the array.
var CalledImages = new Array();
function imgCall(Root)
	{
	if (document.images && CalledImages)
		{
		for (var xx=1; xx < imgCall.arguments.length; xx++)
			{
			var oo               = CalledImages.length;
			CalledImages[oo]     = new Image();
			CalledImages[oo].src = Root + imgCall.arguments[xx];
			}
		}
	}


function sendPage(url) {
	sendWindow = window.open(url + "?url=" + escape(document.URL), "send",
			"width=440,height=540,menubar=no,status=no,scrollbars=yes,scrollable=yes,toolbar=no,resizable=no,location=no");
}

function popLegal(url) {
	legal=window.open(url,"legal","width=440,height=540,menubar=no,status=no,scrollbars=yes,scrollable=yes,toolbar=no,resizable=no,location=no");
}

function popPrinter(url) {
	printer=window.open(url,"print","width=565,height=485,menubar=yes,status=no,scrollbars=yes,scrollable=yes,toolbar=yes,resizable=yes,location=no");
}

function popDefinition(url) {
	glossary=window.open(url,"glossary","width=300,height=250,menubar=no,status=no,scrollbars=yes,scrollable=yes,toolbar=no,resizable=no,location=no");
}

/*******************************************************/
/* General purpose utility functions used primarily for CSV
of site-wide feedback forms*/
/*******************************************************/


/* FUNCTIONS TO INTERACTIVELY CHECK VARIOUS FIELDS. */

// checkString (TEXTFIELD theField, STRING s, [, BOOLEAN emptyOK==false])
//
// Check that string theField.value is not all whitespace.
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.

function checkString (theField, emptyOK) {
	// Next line is needed on NN3 to avoid "undefined is not a number" error
    // in equality comparison below.
    if (checkString.arguments.length == 1) emptyOK = defaultEmptyOK;
    if ((emptyOK == true) && (isEmpty(theField.value))) return true;
    if (isWhitespace(theField.value)) {
		return false;
    } else return true;
}

// Check whether string s is empty.

function isEmpty(s) {
	return ((s == null) || (s.length == 0))
}

// Returns true if string s is empty or
// whitespace characters only.

function isWhitespace (s) {
	var i;

    // Is s empty?
    if (isEmpty(s)) return true;

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {
        // Check that current character isn't whitespace.
        var c = s.charAt(i);

        if (whitespace.indexOf(c) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}

// checkEmail (TEXTFIELD theField [, BOOLEAN emptyOK==false])
//
// Check that string theField.value is a valid Email.
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.

function checkEmail (theField, emptyOK) {
    if (checkEmail.arguments.length == 1) {
        emptyOK = defaultEmptyOK;
    }   
    if ((emptyOK == true) && (isEmpty(theField.value))) {
		return true;
    } else if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theField.value))) {
		return false;
    } else {
        return true;
    }
}

// isEmail (STRING s [, BOOLEAN emptyOK])
//
// Email address must be of form a@b.c -- in other words:
// * there can be no embedded white-space
// * there must be at least one character before the @
// * there must be at least one character before and after the .
// * the characters @ and . are both required
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.

function isEmail (s) {

	if (isEmpty(s))
       if (isEmail.arguments.length == 1) return defaultEmptyOK;
       else return (isEmail.arguments[1] == true);

    var i;
    var sLength = s.length;

    // s cannot have embedded whitespace
    for (i = 0; i < sLength; i++)
    {
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (whitespace.indexOf(c) != -1) return false;
    }

    // there must be >= 1 character before @, so we
    // start looking at character position 1
    // (i.e. second character)
	i = 1;

    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    // look for .
    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }

    // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}

function checkPhoneSuffix(theField, emptyOK) {

        if (checkPhoneSuffix.arguments.length == 1) emptyOK = defaultEmptyOK;
        if ((emptyOK == true) && (isEmpty(theField.value))) {
                return true;
        } else {
                if (!isInteger(theField.value) || theField.value.length != 4) {
                        return false;
                }
        }

        return true;
}

function checkPhonePrefix(theField, emptyOK) {

        if (checkPhonePrefix.arguments.length == 1) emptyOK = defaultEmptyOK;
        if ((emptyOK == true) && (isEmpty(theField.value))) {
                return true;
        } else {
                if (!isInteger(theField.value) || theField.value.length != 3) {
                        return false;
                }
        }

        return true;
}

function checkPhoneAreaCode(theField, emptyOK) {

        if (checkPhoneAreaCode.arguments.length == 1) emptyOK = defaultEmptyOK;
        if ((emptyOK == true) && (isEmpty(theField.value))) {
                return true;
        } else {
                if (!isInteger(theField.value) || theField.value.length != 3) {
                        return false;
                }
        }

        return true;
}

function checkPhoneExtension(theField, emptyOK) {

        if (checkPhoneExtension.arguments.length == 1) emptyOK = defaultEmptyOK;
        if ((emptyOK == true) && (isEmpty(theField.value))) {
                return true;
        } else {
                if (!isInteger(theField.value)) {
                        return false;
                }
        }

        return true;
}

// check5DigitZIP(TEXTFIELD theField [, BOOLEAN emptyOK==false])
//
// Check that string theField.value is a valid ZIP code.
//
// For explanation of optional argument emptyOK,
// see comments of function isInteger.

function check5DigitZIP(theField, emptyOK) {
	if (check5DigitZIP.arguments.length == 1) emptyOK = defaultEmptyOK;
	if ((emptyOK == true) && (isEmpty(theField.value))) {
		return true;
	} else {
		if (!isInteger(theField.value) || theField.value.length != 5) {
			return false;
		}
	}

	return true;
}

function checkZipCodeExt(theField, emptyOK) {
        if (checkZipCodeExt.arguments.length == 1) emptyOK = defaultEmptyOK;
        if ((emptyOK == true) && (isEmpty(theField.value))) {
                return true;
        } else {
          if (!isInteger(theField.value) || theField.value.length != 4) {
                return false;
          }
        }

        return true;
}

// Returns true if character c is a digit
// (0 .. 9).

function isDigit(c) {
	return ((c >= "0") && (c <= "9"))
}

// isInteger (STRING s [, BOOLEAN emptyOK])
//
// Returns true if all characters in string s are numbers.
//
// Accepts non-signed integers only. Does not accept floating
// point, exponential notation, etc.
//
// We don't use parseInt because that would accept a string
// with trailing non-numeric characters.
//
// By default, returns defaultEmptyOK if s is empty.
// There is an optional second argument called emptyOK.
// emptyOK is used to override for a single function call
//      the default behavior which is specified globally by
//      defaultEmptyOK.
// If emptyOK is false (or any value other than true),
//      the function will return false if s is empty.
// If emptyOK is true, the function will return true if s is empty.
//
// EXAMPLE FUNCTION CALL:     RESULT:
// isInteger ("5")            true
// isInteger ("")             defaultEmptyOK
// isInteger ("-5")           false
// isInteger ("", true)       true
// isInteger ("", false)      false
// isInteger ("5", false)     true

function isInteger(s) {

	var i;

	if (isEmpty(s)) {
		if (isInteger.arguments.length == 1) {
			return defaultEmptyOK;
		} else {
			return (isInteger.arguments[1] == true);
		}
	}

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++) {

        // Check that current character is number.
        var c = s.charAt(i);

        if (!isDigit(c)) return false;
    }

    // All characters are numbers.
    return true;
}

// Auto tab functionality
var isNN = ( navigator.appName.indexOf( "Netscape" ) != -1 ); 
 
function autoTab( input,len, e ) { 
	var keyCode	= ( isNN ) ? e.which : e.keyCode; 
	var filter	= ( isNN ) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46]; 
	if( input.value.length >= len && !containsElement( filter, keyCode )) { 
	input.value = input.value.slice( 0, len ); 
	input.form[( getIndex( input ) + 1 ) % input.form.length].focus(); 
	} 
	return true; 
} 
 
function containsElement( arr, ele ) { 
	var found = false, index = 0; 
	while( !found && index < arr.length ) 
	if( arr[index] == ele ) { 
		found = true; 
	} else { 
		index++; 
	} 
	return found; 
} 
 
function getIndex( input ) { 
	var index = -1, i = 0, found = false; 
	while ( i < input.form.length && index == -1 ) 
	if ( input.form[i] == input ) { 
		index = i; 
	} else { 
		i++; 
	} 
	return index; 
} 

/*******************************************************/
// Search form Client-side validation and functionality
/*******************************************************/
function submitSearch()
{
        if(validSearchForm()) {
            document.googleSearch.submit();
        }
}
function validSearchForm()
{
    var searchArg;

    searchArg = document.googleSearch.elements["searchString"];
    if(!checkString(searchArg)){
        alert("Please input search argument");
        searchArg.select();
        return false;
    }
    searchArg.value = searchArg.value.toLowerCase();
    return true;
}

/*******************************************************/
/* (end search functionality)                          */
/*******************************************************/

/*******************************************************/
// Macromedia functions for on-state
/*******************************************************/

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/*******************************************************/
// end Macromedia functions
/*******************************************************/

// Auto tab functionality
var isNN = ( navigator.appName.indexOf( "Netscape" ) != -1 ); 
 
function autoTab( input,len, e ) { 
	var keyCode	= ( isNN ) ? e.which : e.keyCode; 
	var filter	= ( isNN ) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46]; 
	if( input.value.length >= len && !containsElement( filter, keyCode )) { 
	input.value = input.value.slice( 0, len ); 
	input.form[( getIndex( input ) + 1 ) % input.form.length].focus(); 
	} 
	return true; 
} 
 
function containsElement( arr, ele ) { 
	var found = false, index = 0; 
	while( !found && index < arr.length ) 
	if( arr[index] == ele ) { 
		found = true; 
	} else { 
		index++; 
	} 
	return found; 
} 
 
function getIndex( input ) { 
	var index = -1, i = 0, found = false; 
	while ( i < input.form.length && index == -1 ) 
	if ( input.form[i] == input ) { 
		index = i; 
	} else { 
		i++; 
	} 
	return index; 
} 

function openReferencesPopup(page) {
	OpenWin = this.open(page, "References", "scrollbars=yes,resizable=yes,width=500,height=600");
}

function openNewWindow(page,name,width,height,top,left,propSet) {
	
	var windowProps = new Array (8);

	windowProps[0] = "resizable=yes";
	windowProps[1] = "scrollbars=yes";
	windowProps[2] = "titlebar=yes";
	windowProps[3] = "toolbar=yes";
	windowProps[4] = "menubar=yes";
	windowProps[5] = "location=yes";
	windowProps[6] = "status=yes";
	windowProps[7] = "directories=yes";
	
	var myProps = "";
	var mySize = "";
	
	if (propSet == 'one') {
		 myProps = ',' + windowProps[0] + ',' + windowProps[1];
	} else if (propSet == "full") {
		myProps = ',' + windowProps.join(",");
	} else {
		myProps = "";
	}	
	
	if ((width > 50)||(height > 50)) {
		var mySize = 'width=' + width + ',' + 'height=' + height + ',' + 'top=' + top + ',' + 'left=' + left;
	}
	
	var myString = mySize + myProps;
	window.open(page,name,myString);
	
}

function openEmailColleaguePopup(page, emailPage) {
	var fullURL = page + "?url=" + emailPage;
	OpenWin = this.open(fullURL, "Email", "scrollbars=yes,resizable=yes,width=600,height=610");
}

function changeImages() {
	if (document.images) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

// Validate Check Box
function isCheckBoxChecked(field) {
     return field.checked;
}

function getStyleObject(objectId) {
    // cross-browser function to get an object's style object given its id
    if(document.getElementById && document.getElementById(objectId)) {
	// W3C DOM
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	// MSIE 4 DOM
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	// NN 4 DOM.. note: this won't find nested layers
	return document.layers[objectId];
    } else {
	return false;
    }
} // getStyleObject

function changeObjectVisibility(objectId, newVisibility) {
    // get a reference to the cross-browser style object and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
	return false;
    }
}

function parseURLParameters(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];
	}	

//-->
