//<!-- All JavaScript and HTML copyright The Library Corporation, Inwood, WV -->
	function init(){
		if(document.AquaForm){
			setABfocus();
		}else if(document.SearchForm){
			setfocus();
		}
		//if(document.search){alert("yup");}
	}
	
//<!----- 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,w,h) {
		mywin = window.open(url,"win",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,scrollable=yes,width='+w+',height='+h+'');
	}
	
//<!----- 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;
	}
	
//<!----- 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;
  	}
// builds LS querystring
	function buildQueryString(){
		var targetLocation="http://<%=Domain%>/tlcScripts/interpac.dll?Search&Config=<%=Config%>&LimitsId=0&StartIndex=0&ItemsPerPage=10&SearchType=1&Branch=0&SearchField=<%=SearchField%>";
		var toFind=document.AquaForm.q.value;
		if (toFind <= "What are you searching for?"){
			toFind = toFind.replace("What are you searching for?","")
		}
		toFind = escape(toFind);
		targetLocation+="&SearchData=";
		targetLocation+=toFind;

		if (toFind>"") return window.location=targetLocation;
	}
// AquaBrowser Build Querystring
	function buildAquaQueryString(){
		var AquatargetLocation="http://<%=AquaBrowserURL%>";
		var toFind=document.AquaForm.q.value;
		if (toFind == "What are you searching for?"){
			toFind = toFind.replace("What are you searching for?","")
		}
		toFind = toFind.replace("&","");
		toFind = toFind.replace("  "," ")
		toFind = escape(toFind);

		if (toFind == ""){
			return false;
		}else{ 
			AquatargetLocation+="/?q=";
			AquatargetLocation+=toFind;
			return document.AquaForm.action=AquatargetLocation;
		}
	}

	function buildEspanolQueryString() {
		var EspanolTarget="http://<%=AquabrowserURL %>?uilang=es";
		var toFind=document.AquaForm.q.value
		toFind = toFind.replace("¿Para qué usted está buscando?","");
		toFind = toFind.replace("&","");
		toFind = toFind.replace("  "," ");
		toFind = escape(toFind);
		if (toFind <=""){
			EspanolTarget=EspanolTarget;
		}else{
			EspanolTarget+="&q="
			EspanolTarget+=toFind;
		}
		window.location=(EspanolTarget);
	}

	function setABfocus(){
		document.AquaForm.q.focus();
	}

	function setfocus(){
		document.SearchForm.SearchData.focus();
	}