//<!-- All JavaScript and HTML copyright The Library Corporation, Inwood, WV -->
	function init(){
		if(document.AquaForm){
			setABfocus();
			theForm=document.AquaForm;
			theData=document.AquaForm.q;
			document.getElementById("SearchFormType").checked=true;
		}else if(document.SearchForm){
			setfocus();
		}
		if(window.fadeout){
			/*if(myImages.length>1)*/setTimeout('fadeout()',wait);
		}
		if(document.getElementById("clock"))startclock();
	}
	
	function setABfocus(){
		document.AquaForm.q.focus();
	}

	function setfocus(){
		document.SearchForm.SearchData.focus();
	}
	
//<!----- Image Rollover Script ----->
	if (document.images) {
  		var kidscaton = new Image();
  		kidscaton.src = "images/kidscaton.gif";
  		var kidscatoff = new Image();
  		kidscatoff.src = "images/kidscatoff.gif";
  		
  		var myhomepageon = new Image();
  		myhomepageon.src = "images/myhomepageon.gif";
  		var myhomepageoff = new Image();
  		myhomepageoff.src = "images/myhomepageoff.gif";
  		
  		var libhomeon = new Image();
  		libhomeon.src = "images/libhomeon.gif";
  		var libhomeoff = new Image();
  		libhomeoff.src = "images/libhomeoff.gif";
  		
  		var topofpageon = new Image();
  		topofpageon.src = "images/topofpageon.gif";
  		var topofpageoff = new Image();
  		topofpageoff.src = "images/topofpageoff.gif";
  		     
  		var searchon = new Image();
  		searchon.src = "images/searchon.gif";
  		var searchoff = new Image();
  		searchoff.src = "images/search.gif";
  		  
  		var browseon = new Image();
  		browseon.src = "images/browseon.gif";
  		var browseoff = new Image();
  		browseoff.src = "images/browse.gif"; 
		
  		var combinon = new Image();
  		combinon.src = "images/combinon.gif";
  		var combinoff = new Image();
  		combinoff.src = "images/combin.gif";  
		
  		var helpon = new Image();
  		helpon.src = "images/helpon.gif";
  		var helpoff = new Image();
  		helpoff.src = "images/help.gif"; 
	}

	function act(imgName) {
  		if (document.images) 
    		document[imgName].src = eval(imgName + "on.src");
	}

	function inact(imgName) {
  		if (document.images)
    		document[imgName].src = eval(imgName + "off.src");
	}
	
//<!----- Pop Up Window Script -----> itemgroup map popup page
	function ighelp (ig) {
		igwin = window.open(ig,"igpage","width=650,height=450,location=1,toolbar=yes,menubar=1,scrollbars=1,resizable=1,status=1,links=1");
		igwin.focus();
		if (!igwin.opener) {
        	igwin.opener = "self";
     	}
	}
	
//<!----- Open Window Script ----->
	function open_window(url,width,height) {
		mywin = window.open(url,"win",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,scrollable=yes,width='+width+',height='+height);
	}
	
//<!----- Search Script ----->
	var QtSubmittedForm = false;
	var QsLastSearchData = "";

	function AllowSearch(){
		var s_thisSearchData = document.SearchForm.SearchData.value;

		if (QtSubmittedForm == true && s_thisSearchData == QsLastSearchData){
			return false;
		}else{
			QtSubmittedForm = true;
			QsLastSearchData = s_thisSearchData;
			return true;
		}
	}

	function SubmitSearch(){
		if (AllowSearch())
			document.SearchForm.submit();
	}

	function DataChange(){
		QtSubmittedForm = false;
	}
	
	var theForm;
	var theData;
	function ChangeForm(val){
		theForm.style.display='none';
		if(val==1){
			theForm=document.AquaForm;
			theData=theForm.q;
			theData.value=document.SearchForm.SearchData.value;
		}else{
			theForm=document.SearchForm;
			theData=theForm.SearchData;
			theData.value=document.AquaForm.q.value;
		}
		theForm.style.display='block';
	}
	
	function Search(Term){
		if(Term!=""){
			xmlRequest("search.asp?SearchTerm="+Term);
		}else{
			alert("Please enter a search term/s.");
		}
		return false;
	}
	function SearchPop(Term){
		theData.value=Term;
		Search(Term);
	}
	
	var formRequester = null;

	function xmlRequest(url){
		// Try to setup XMLHTTPREquest catching any errors
		try{
			formRequester = new XMLHttpRequest();
		}catch (error){
			try{
				formRequester = new ActiveXObject("Microsoft.XMLHTTP");
			}catch (error){
				formRequester = null;
				return false;
			}
		}
		// Set the listener for callback
		formRequester.onreadystatechange = onreadystatechangeForm;
		// Make the call
		formRequester.open("GET", url);
		formRequester.send(null);
		
		//document.body.style.cursor = "wait";
		return true;
	}
	
	function onreadystatechangeForm(){	
		// If XMLHR object has finished retrieving the data
		if (formRequester.readyState == 4){
			// If the data was retrieved successfully
			try{
				if (formRequester.status == 200){
					if(formRequester.responseText==""){
						theForm.submit();
					}else{
						alert("You have entered an illegal Search term.  Please make another search.");
						theData.value="";
					}
				}else if (formRequester.status != 0){// IE returns a status code of 0 on some occasions, so ignore this case
					alert("There was an error while retrieving the URL: " + formRequester.statusText + formRequester.status + formRequester.responseText);
				}else{
					alert("An error has occured during your searh.");
				}
			}catch (error){
				// An Error occurred in transit.  Attempt to submit form as a backup
				//alert(error);
				//document.SearchForm.submit();	
			}
		}
		return true;
	}
//<!----- Aquabrowser Script -----> builds keyword, title, subject and author searches for elementary schools
	function encodeit(searchstring){
   		var toreturn;
   		toreturn="";
   		temp=searchstring.split(" ");
    	for(x=0;x<temp.length;x++){
        	toreturn=toreturn+temp[x];
          	if(x!=temp.length-1){toreturn=toreturn+"+";}
     	} 
		return toreturn;
  	}
	
	var agt=navigator.userAgent.toLowerCase();
	var isOpera=agt.indexOf("opera");
	var isIE=agt.indexOf("msie");
	var isIE7=agt.indexOf("msie 7");
 	var is_nav  = ((agt.indexOf('firefox')==-1) && (agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
	var needsIFrame=(isIE>0) && (isIE7==-1) && (isOpera==-1);
	//if(isIE>0 && isOpera<0){isIE=true}else{isIE=false}
	//alert(is_nav);
	var whoseOpen;
	function showMenu(num){
		whoseOpen=num;
		document.getElementById('menu'+num).style.visibility='visible';
		if(needsIFrame){
			document.getElementById('menu'+num).style.width='180px';
			document.getElementById('imenu'+num).style.display='block';
		}else if(is_nav){
			document.getElementById('menu'+num).style.width='180px';
		}
	}
	
	var whoseClosing;
	function hideMenu(num){
		whoseClosing=num;
		document.getElementById('menu'+num).style.visibility='hidden';
		if(needsIFrame){
			document.getElementById('imenu'+num).style.display='none';
		}
	}
	
	
	function startclock(){
		var thetime=new Date();

		var nhours=thetime.getHours();
		var nmins=thetime.getMinutes();
		var nsecn=thetime.getSeconds();
		var nday=thetime.getDay();
		var nmonth=thetime.getMonth();
		var ntoday=thetime.getDate();
		var nyear=thetime.getYear();
		var AorP=" ";

		if (nhours>=12)
    		AorP="P.M.";
		else
    		AorP="A.M.";
	
		if (nhours>=13)
    		nhours-=12;

		if (nhours==0)
   			nhours=12;
	
		if (nsecn<10)
 			nsecn="0"+nsecn;

		if (nmins<10)
		 	nmins="0"+nmins;

		switch(nday){
			case 0:
				nday="Sunday";
				break;
			case 1:
				nday="Monday";
				break;
			case 2:
				nday="Tuesday";
				break;
			case 3:
				nday="Wednesday";
				break;
			case 4:
				nday="Thursday";
				break;
			case 5:
				nday="Friday";
				break;
			case 6:
				nday="Saturday";
				break;
		}
	
		nmonth+=1;

		if (nyear<=99)
			nyear= "19"+nyear;

		if ((nyear>99) && (nyear<2000))
	 		nyear+=1900;

		document.getElementById("clock").innerHTML=nday+", "+nmonth+"/"+ntoday+"/"+nyear+"<br/>"+nhours+": "+nmins+": "+nsecn+" "+AorP;

		setTimeout('startclock()',1000);
	} 