	function parseQueryString(){
		var string = document.URL;
		var args = 0;
		
		if(string.indexOf('?') == -1){
			var pageVars = new Array();
			return pageVars;
		}
				
		string = string.substring(string.indexOf('?') + 1, string.length);
		for(i=0; i<string.length; i++){
			if(string.charAt(i) == '='){
				args++;			//count out how many arguments were passed with the URL
			}
		}  
		
		
		var pageVars = new Array(args);		
		
		var start = 0;  
		for(i=0; i<string.length; i++){
			if(string.charAt(i) != '&'){
				//do nothing;
			}else{
				Arg = string.substring(start, i);
				pageVars[Arg.substring(0, Arg.indexOf('='))] = Arg.substring(Arg.indexOf('=')+1, Arg.length);	
				start = i + 1;
			}
		}
		Arg = string.substring(start, i);
		pageVars[Arg.substring(0, Arg.indexOf('='))] = Arg.substring(Arg.indexOf('=')+1, Arg.length);
		
		return pageVars;
	}

	function checkEmail(address, AllowNull){  //validate that an entered e-mail is formatteed correctly
		var len = address.length;
		var badChars = " /:,;";
		var retVal = true;
		
		if(len == 0){				//if no address entered
				return AllowNull;	 							
			}			
		len--;
		      
		for(i=0; i<badChars.length; i++){  //check for invalid characters in e-mail
			badChar = badChars.charAt(i);
			if(address.indexOf(badChar,0) != -1)
				retVal = false;
				
		}	
		
		if(retVal == true){
			var ch = address.indexOf("@",1) 
			if(ch == -1 || ch == len)	//if '@' in first or last position or not present
				retVal = false;
		
		}
			
		if(retVal == true){
			if((address.indexOf(".",0) <= 0) || (address.indexOf(".", ch) == (ch + 1)) || (address.lastIndexOf(".",len) == len))  //if '.' in first or last position, immediately after @, or not present
				retVal = false;
	
		}
			
		return retVal;
	}
		
	function checkedIndex(ctrl){  //find the selected item in a radio button grouping
		var retVal = -1;
	
		for(var i = 0; i < ctrl.length; i++){
			if(ctrl[i].checked == true){
				retVal = i;
				break;
			}
		}
		return retVal;
	}

	function findForm(formname){
		var i;
		var retVal = -1;
		
		for(i=0; i<document.forms.length; i++){
			if(document.forms[i].name == formname)
				retVal = i;
		}
		return retVal;
	}
		
	function showNhidePopup(element){
		var layerRef="";
		var styleRef="";
	
		if(NavType == "IE"){
			layerRef = ".all";
			styleRef = ".style";
		}else{
			layerRef = ".layers";
			styleRef = "";
		}
	
		if(NavType == "IE"){
			if(eval("document"+layerRef+"['"+element+"']"+styleRef+".visibility") == "visible"){
				eval("document"+layerRef+"['"+element+"']"+styleRef+".visibility = 'hidden'");
			}	
			else{
				eval("document"+layerRef+"['"+element+"']"+styleRef+".visibility = 'visible'");
			}
		}
		else{
			if(eval("document"+layerRef+"['"+element+"']"+styleRef+".visibility") == "show"){
				eval("document"+layerRef+"['"+element+"']"+styleRef+".visibility = 'hide'");
			}	
			else{
				eval("document"+layerRef+"['"+element+"']"+styleRef+".visibility = 'show'");
			}
		}
	}
	
	/****************************************************************************************************************/
	/* goPage() - a function to send a web browser to a particular page, with a specified page parameter, while 	*/
	/*	maintaining any existing page parameters and not duplicating the new parameter.  This function also uses	*/
	/* function parseQueryString()																					*/
	/* D. McDevitt - 5/13/2002																						*/
	/****************************************************************************************************************/
	function goPage(pname, pval){
		var pageVars = new Array();
		var found = false;
		
		pageVars = parseQueryString();		//get the list of existing page parameters
			
		for(var i in pageVars){				//loop through the list, looking for the parameter we wish to set
			if(i == pname){					//if the parameter is found,
				pageVars[i] = pval;			//set its new value
				found = true;					//flag it as found
			}
		}
		
		if(!found){								//if the new param wasn't in the list
			pageVars.length = pageVars.length+1;	//make the list longer
			pageVars[pname] = pval;					//add parameter to the list
		}
			
		temp = document.location.pathname + "?";
		
		var pCur = 1;									//set current page param to the first in the list
		for(var i in pageVars){							//cycle through the new list of page parameters
			temp = temp + i + "=" + pageVars[i];		//add the current param from the list to the page address string
			if(pCur < pageVars.length)					//if there are still more params to be added
				temp = temp + "&";						//add an & to the end of the string
			pCur++;
		} 
		
		document.location.replace(temp); 				//activate the page 
	}

	// js print screen function 
	function printArticle() {
			if (window.print) {
			setTimeout('window.print();',200);
		}
		else if (agt.indexOf("mac") != -1) {
			alert("Press 'Cmd+p' on your keyboard to print article.");
		}
		else {
			alert("Press 'Ctrl+p' on your keyboard to print article.")
		}
	}

	// JS Clear text input function 
	function clearText(thefield){
		if (thefield.defaultValue == thefield.value )
			thefield.value = ""
    	//else thefield.value = thefield.defaultValue
	} 	
	
	/* checkBadNums - a function to check the value of any form field (ctrl) for characters which will
		cause a problem upon sending through e-mail or to html.  9-11-02 by S. Williams.  Generalized 
		and functionized by D. McDevitt 																*/
	function checkBadNums(ctrl){
		var newBody = ctrl.value
		//-- the following is the current list of BAD ascii codes
	  		badNums = new Array(4);
	   	badNums[0] = 8216;
	   	badNums[1] = 8217;
	   	badNums[2] = 8220;   
	   	badNums[3] = 8221;
	
		for (i = 0; i < ctrl.value.length; i++){   
	     	var c = ctrl.value.charAt(i);
	 		var a = ctrl.value.charCodeAt(i);
	
			for (j=0; j < badNums.length; j++){ // Check that current character.
				if ( a == badNums[j])
					newBody=newBody.replace(c,"'");
			}
		}
		ctrl.value=newBody;
	}
		
	//function to determine if a sepcified year is a leap year.  Added by Dan McDevitt 3-2004
	function isLeapYear(year){
		if(year%4 == 0 && !(year%100 == 0 && year%400 != 0))
			return true;
		else
			return false;
	}
	
	//function to change number to currency format.  Added by Stu Williams 12-2006
	function formatCurrency(num) {
		num = num.toString().replace(/\$|\,/g,'');
		if(isNaN(num))
			num = "0";
			sign = (num == (num = Math.abs(num)));
			num = Math.floor(num*100+0.50000000001);
			cents = num%100;
			num = Math.floor(num/100).toString();
		if(cents<10)
			cents = "0" + cents;
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
			num = num.substring(0,num.length-(4*i+3))+','+
			num.substring(num.length-(4*i+3));
			
		return (((sign)?'':'-') + '$' + num + '.' + cents);
	}	
	
	//function to return the N left most letters in a string.  Added by Stu Williams 1-2007
   function Left(str, n)
        /***
                IN: str - the string we are LEFTing
                    n - the number of characters we want to return

                RETVAL: n characters from the left side of the string
        ***/
        {
                if (n <= 0)     // Invalid bound, return blank string
                        return "";
                else if (n > String(str).length)   // Invalid bound, return
                        return str;                // entire string
                else // Valid bound, return appropriate substring
                        return String(str).substring(0,n);
        }


		
		
		
//function to add bookmark to a browser.  Added by Stu Williams 1-29-2007		
function bookmark(url,title){
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
  window.external.AddFavorite(url,title);
  } else if (navigator.appName == "Netscape") {
    window.sidebar.addPanel(title,url,"");
  } else {
    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
  }
}		