//<!-- All JavaScript and HTML copyright The Library Corporation, Inwood, WV -->
	function init(){
		if(document.AquaForm){
			setABfocus();
		}else if(document.LS2Form){
			setLS2focus();
		}else if(document.SearchForm){
			setfocus();
		}
	}
	function smoothToggle(id1, id2)
	{
		var obj1 = document.getElementById(id1);
		var obj2 = document.getElementById(id2);
		if(obj1.style.display=='block')
		{
			obj1.style.display='none';
			obj2.style.display='block';
		}
		else
		{
			obj2.style.display='none';
			obj1.style.display='block';
		}
	}
	
	
	function setABfocus(){
		document.AquaForm.q.focus();
	}

	function setfocus(){
		document.SearchForm.SearchData.focus();
	}
	function setLS2focus(){
		document.LS2Form.term.focus();
	}
	
	
	
	function loadPopup(source)
			{
				document.getElementById('popframe').src=source;
				document.getElementById('popup').style.display="block";
				fitObjectToScreen(document.getElementById('popup'));
				valignObjectToScreen(document.getElementById('popbox'));
			}
	function closePopup()
			{
				document.getElementById('popup').className="closed";
				document.getElementById('popup').style.display="none";
			}
	window.onresize = function(){
		var b = document.getElementById('popbox')
		var c = document.getElementById('popup')
		if(c.style.display=="block")
		{
			fitObjectToScreen(c);
			valignObjectToScreen(b);
		}
	}
	
	function fitObjectToScreen(Obj)
	{
		var w = getWindowSize();
		Obj.style.width = w[0] + "px";
		Obj.style.height = w[1]  + "px";
	}
	if (!window.getComputedStyle) {
		window.getComputedStyle = function(el, pseudo) {
			this.el = el;
			this.getPropertyValue = function(prop) {
				var re = /(\-([a-z]){1})/g;
				if (prop == 'float') prop = 'styleFloat';
				if (re.test(prop)) {
					prop = prop.replace(re, function () {
					return arguments[2].toUpperCase();
					}
				);
			}
			return el.currentStyle[prop] ? el.currentStyle[prop] : null;
			}
			return this;
		}
	}
	function valignObjectToScreen(Obj)
	{
		var w = getWindowSize();
		var y = Obj.style.height;
		if (y == null || y =="")
		{

				y = getComputedStyle(Obj,null).getPropertyValue("height");				
		}
		y1 = y.replace(/px/i, '');
		y2 = w[1];
		//.replace(/px/i, '');
		//(parseInt(Obj.style.height) - parseInt(getWindowSize[1])) / 2;
		m= (parseInt(y2) - parseInt(y1)) / 2 ;
		//alert (y2);
		if (m>0)
			Obj.style.marginTop = m + "px";
	}
		
	function getWindowSize()
	{
			 var myWidth = 0, myHeight = 0;
			if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			myWidth = window.innerWidth;
			myHeight = window.innerHeight;
			} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
			} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
			}
			var r = new Array(myWidth, myHeight)
		 	return(r);
			
	}
	
//<!----- 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"; 
		
  		var ls2searchon = new Image();
  		ls2searchon.src = "images/ls2searchon.gif";
  		var ls2searchoff = new Image();
  		ls2searchoff.src = "images/ls2search.gif";
		
  		var accounton = new Image();
  		accounton.src = "images/accounton.gif";
  		var accountoff = new Image();
  		accountoff.src = "images/account.gif";
		
  		var emaillibon = new Image();
  		emaillibon.src = "images/emaillibon.gif";
  		var emailliboff = new Image();
  		emailliboff.src = "images/emaillib.gif"; 
		
  		var LS2PACon = new Image();
  		LS2PACon.src = "images/LS2PACanim.gif";
  		var LS2PACoff = new Image();
  		LS2PACoff.src = "images/LS2PAC.gif"; */
	}

	function act(imgName) {
  		if (document.images) 
    		document[imgName].src = eval(imgName + "on.src");
			document.getElementById('searcho').innerHTML = document[imgName].alt
	}

	function inact(imgName) {
  		if (document.images)
    		document[imgName].src = eval(imgName + "off.src");
			document.getElementById('searcho').innerHTML = "Search Options"
	}
//<!----- Pop Up Window Script -----> itemgroup map popup page
	function ighelp (ig) {
		igwin = window.open(ig,"igpage","width=650,height=450,directories=no,location=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,status=0,links=0");
		igwin.focus();
		if (!igwin.opener) {
        	igwin.opener = "self";
     	}
	}
	
//<!----- Open Window Script ----->
	function open_window(url) {
		mywin = window.open(url,"win",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,scrollbars=no,status=0,links=0,width=360,height=340');
	}
	
//<!----- 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;
  	}
	
	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);
	var needsIFrame = false
	//if(isIE>0 && isOpera<0){isIE=true}else{isIE=false}
	//alert(is_nav);
	var whoseOpen;
	function showMenu(num){
		var 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);
	}
	
function updateInput(newValue, target)
{
	target.value=newValue
}


	function ahah(url, target) {
  		document.getElementById(target).innerHTML = "<div  align=\"center\"><img src=\"images/ajax/websedit-ag-bar.gif\" alt=\"Loading...\" align=\"center\"></div>";
 		 if (window.XMLHttpRequest) {
    		req = new XMLHttpRequest();
  		} else if (window.ActiveXObject) {
    		req = new ActiveXObject("Microsoft.XMLHTTP");
  		}
  		if (req != undefined) {
    		req.onreadystatechange = function() {ahahDone(url, target);};
    		req.open("GET", url, true);
    		req.send(null);
  		}
	}
	  
	function ahahDone(url, target) {
		if (req.readyState == 4) { // only if req is "loaded"
    		if (req.status == 200) { // only if "OK"
      			document.getElementById(target).innerHTML = req.responseText;
    		} else {
      			document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText+"<br>"+url;
    		}
  		}
	}

	function load(name, div) {
		ahah(name,div);
		return false;
	}
	
function changeBgPosition (targetID, pos)
{
	if (document.getElementById(targetID))
		document.getElementById(targetID).style.backgroundPosition= pos
}



function validateUpdate(whatForm, idToValidate, formAction)
{
	if (document.getElementById(idToValidate).value == "" || document.getElementById(idToValidate).value == null)
	{
		document.getElementById(idToValidate).focus;
		document.getElementById(idToValidate).style.borderColor="red";
		alert("A required field was left blank! Please fill in this field!!!")
		return false;
	}
	else if (formAction == "" || formAction == null)
		return true;
	else
	{
		whatForm.action=formAction;
		whatForm.submit;
		return true;
	}
}
function updateBranchInfo(ajax)
{
	var nocache=Math.random();
	Config = document.getElementById("LS2Config").value
	if (ajax==true)
		{
			if (document.getElementById("dirInfo"))
			{
				if (Config == null || Config == "")
					load("branches.asp?nocache="+nocache, "dirInfo")
				else
					load("branches.asp?Config="+Config+"&ajax=true&nocache="+nocache, "dirInfo")
			}	
		}
	else
	{
		if (document.getElementById("passedSearchTerm"))
			var checker = document.getElementById("passedSearchTerm").value;
		else if (document.getElementById("SearchData"))
			var checker = document.getElementById("SearchData").value;
		else
			var checker = null;
		if (checker == null || checker == "")
			window.location="default.asp?Config="+Config
	}
}

function schoolDispatch(SchoolType, sID)
{
	window.location="school.asp?SchoolType="+SchoolType+"&sID="+sID;
}



<!----- 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"; 
		
		var audioon = new Image();
  		audioon.src = "images/limited/audioon.gif";
  		var audiooff = new Image();
  		audiooff.src = "images/limited/audio.gif";
		
		var bookon = new Image();
  		bookon.src = "images/limited/bookon.gif";
  		var bookoff = new Image();
  		bookoff.src = "images/limited/book.gif";
		
		var movieon = new Image();
  		movieon.src = "images/limited/movieon.gif";
  		var movieoff = new Image();
  		movieoff.src = "images/limited/movie.gif";
		
		var printon = new Image();
  		printon.src = "images/limited/printon.gif";
  		var printoff = new Image();
  		printoff.src = "images/limited/print.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");
	}
	
	
	
