//<!-- All JavaScript and HTML copyright The Library Corporation, Inwood, WV -->
	//window.onload = function(){
		//addShadows();
		
		//if(window.fadeout){
			/*if(myImages.length>1)*///setTimeout('fadeout()',wait);
		//}
		//if(document.getElementById("clock"))startclock();
		
		//if(document.AquaForm){
			//setABfocus();
		//}else if(document.SearchForm){
			//setfocus();
		//}
	//}
	
	//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) {
		mywin = window.open(url,"win",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,scrollable=yes,width=360,height=340');
	}
	
//<!----- Search Script ----->
	var QtSubmittedForm = true;
	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;
		}*/
		return true;
	}

	function SubmitSearch(){
		if (AllowSearch())
			document.SearchForm.submit();
	}

	//function DataChange(){
	//	QtSubmittedForm = false;
	//}
	
	function checkData(who){
		//if(who.value=="Search..."){
		//	who.className = "input"
		//	who.value=""
		//}else 
		if(who.value==""){
			who.className = "input faded";
			who.value = "Find Books, Movies, and More";
		}else{
			who.className = "input";
		}
		QtSubmittedForm = (who.value=="Find Books, Movies, and More") ? true : 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")==-1) ? false : true;
	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);
	}
	
	
	
	function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\\\s)"+searchClass+"(\\\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}
	function $(id){
				return document.getElementById(id);
			}

			
var ElementOpener = function(el,handle){
	this.el=el;
	this.handle=handle;
	this.to=null;
	this.opt=1;
	
	this.onclick=function(){
		alert(this.opt);
		this.opt=(this.to==null) ? 1 : -1;
		this.show();
		
	};
	
	this.show=function(){
		clearTimeout(this.to);
		this.el.style.display="block";
		
		var boxheight=this.el.scrollHeight;
		this.el.style.height = getHeight(this.el) + (5 * this.opt) + "px";
		if((this.opt==1 && getHeight(this.el)<boxheight) || (this.opt==-1 && getHeight(this.el)>0)){
			//this.to=setTimeout("show($('"+ this.el.id +"'),"+opt+",$('"+w.id+"'))",5);
			this.to=setTimeout("this.show()",5);
		}else if(opt==-1 && getHeight(who)<=0){
			this.el.style.display="none";
			//window.onclick=null;
		}else{
			//window.onclick=BindArguments(hide,who,w);
			//window.onclick=function(){hide(who,w);};
		}
	}
};

































			function show(what,who){
				//who.innerHTML="(-)";
				//alert('g');
				who.onclick=function(){hide(what,who);};
				highlight(what,1,who);
				//window.onclick=function(){hide(what,who);};
			}
			function hide(what,who){
				//who.innerHTML="(+)";
				//window.onclick=null;
				//alert('g');
				who.onclick=function(){show(what,who);};
				highlight(what,-1,who)
			}
			var to;
			//var boxheight=100;
			function highlight(who,opt,w){
				clearTimeout(to);
				who.style.display="block";
				//alert(who);
				var boxheight=who.scrollHeight;
				who.style.height = getHeight(who) + (5 * opt) + "px";
				if((opt==1 && getHeight(who)<boxheight) || (opt==-1 && getHeight(who)>0)){
					to=setTimeout("highlight($('"+ who.id +"'),"+opt+",$('"+w.id+"'))",5);
				}else if(opt==-1 && getHeight(who)<=0){
					who.style.display="none";
					window.onclick=null;
				}else{
					//window.onclick=BindArguments(hide,who,w);
					window.onclick=function(){hide(who,w);};
				}
			}
			function getHeight(who){
				return who.offsetHeight-2;
			}
			
			function changeSearchType(who){
				$('typedrop').style.backgroundImage='url(images/icons/'+who.className+'on.gif)';
				var val;
				switch(who.className){
					case "titles":
						val=1;
						break;
					case "authors":
						val=2;
						break;
					case "subjects":
						val=4;
						break;
					case "notes":
						val=8;
						break;
					case "publishers":
						val=262144;
						break;
					case "series":
						val=7864320;
						break;
					default :
						val=16777216;
				}
				document.SearchForm.SearchField.value=val;
			}
			
			
		function setOpacity(el,val){
			if(isIE){
				el.style.filter="alpha(opacity="+val+")";
			}else{
				el.style.opacity = val/100;
			}
		}
function BindArguments(fn)
{
  var args = [];
  for (var n = 1; n < arguments.length; n++)
    args.push(arguments[n]);
  return function () { return fn.apply(this, args); };
}
var Quotations = {
	ID: null,
	Name: null,
	speed: 2,
	wait: 6000,
	quoteNumber: 0,
	Opacity: 100,
	amount: 5,
	currentquote: null,
	myQuotes: [],
	
	Create: function(ID,Name,Speed,Delay){
		this.ID=ID;
		this.Name=Name;
		this.speed=Speed;
		this.wait=Delay;
		this.Opacity=100;
	},
	
	AddQuote: function(q,a){
		this.myQuotes[this.myQuotes.length]=q+"<span>"+a+"</span>";
	},
	
	Start: function(){
		this.changequote();
		if(this.myQuotes.length>1)
			setTimeout("Quotations.fadeout()",this.wait);
	},
	
	fadeout: function(){
		this.Opacity=this.Opacity-this.amount;
		
		if(!isIE) setOpacity($("quotations"),this.Opacity);

		if(this.Opacity>0){
			setTimeout("Quotations.fadeout()",this.speed);
		}else{
			this.changequote();
			Quotations.fadein();
		}
	},
	
	changequote: function(){
		this.quoteNumber=Math.floor(Math.random()*this.myQuotes.length)
		if(this.currentquote!=null){
			this.myQuotes.push(this.currentquote);
		}
		
		this.currentquote = this.myQuotes.slice(this.quoteNumber,this.quoteNumber+1);
		
		if(this.quoteNumber>=this.myQuotes.length){this.quoteNumber=0;}
		$(this.ID).innerHTML=""
		
		var q=document.createElement("span");
		q.innerHTML=this.myQuotes[this.quoteNumber];
		
		$(this.ID).appendChild(q);
	},
	
	fadein: function(){
		this.Opacity=this.Opacity+this.amount;

		if(!isIE) setOpacity($("quotations"),this.Opacity);//IE cannot properly render text with a filter applied

		if(this.Opacity<100){
			setTimeout("Quotations.fadein()",this.speed);
		}else{
			setTimeout("Quotations.fadeout()",this.wait);
		}
	}
}