function addLoadEvent(func) { 
	var oldonload = window.onload; 
	if (typeof window.onload != 'function') { 
		window.onload = func; 
	} else { 
		window.onload = function() { 
			oldonload(); 
			func(); 
		} 
	} 
} 
//<!-- All JavaScript and HTML copyright The Library Corporation, Inwood, WV -->
	addLoadEvent(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 $(id){
		return document.getElementById(id);
	}
	
	function setABfocus(){
		document.AquaForm.q.focus();
	}

	function setfocus(){
		document.SearchForm.SearchData.focus();
	}
	
//<!----- Image Rollover Script ----->
var Rollovers = {
	buttons:[],
	
	add: function(img){
		this.buttons.push(img);
		
		img.onmouseover = function(){Rollovers.over(this);};
		img.onmouseout = function(){Rollovers.out(this);};
		img.onload = null;
		
		this.buttons[this.buttons.indexOf(img)].off = new Image();
		this.buttons[this.buttons.indexOf(img)].off.src = img.src;
		this.buttons[this.buttons.indexOf(img)].on = new Image();
		this.buttons[this.buttons.indexOf(img)].on.onerror = function(){Rollovers.remove(img);}
		this.buttons[this.buttons.indexOf(img)].on.src = img.src.replace(/.gif/,"on.gif");
	},
	
	remove: function(img){
		this.buttons.splice(this.buttons.indexOf(img),1);
		img.onmouseover=null;
		img.onmouseout=null;
	},
	
	over: function(img){
		img.src = this.buttons[this.buttons.indexOf(img)].on.src;
	},
	
	out: function(img){
		img.src = this.buttons[this.buttons.indexOf(img)].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 = 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")!=-1) ? true : false;
	var isIE7=(agt.indexOf("msie 7")!=-1) ? true : false;
 	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) && (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);
	} 

var SlideShow = {
	ID: null,
	Name: null,
	speed: 1,
	wait: 3000,
	imageNumber: 1,
	imageOpacity: 100,
	amount: 5,
	captions: true,
	
	myImages: [],
	myCaptions: [],
	
	Create: function(ID,Name,Speed,Delay,Cap){
		this.ID=ID;
		this.Name=Name;
		this.speed=Speed;
		this.wait=Delay;
		this.captions=Cap;
		
		var i1 = document.createElement("div");
		i1.id="imageone"+this.ID;
		i1.style.position="absolute";
		i1.style.height="100%";
		i1.style.width="100%";
		i1.style.zIndex=2;
		i1.style.top="0px";
		i1.style.left="0px";
		i1.style.background = "#000 top left no-repeat";
		document.getElementById(this.ID).appendChild(i1);
		
		var i2 = document.createElement("div");
		i2.id="imagetwo"+this.ID;
		i2.style.position="absolute";
		i2.style.height="100%";
		i2.style.width="100%";
		i2.style.zIndex=1;
		i2.style.top="0px";
		i2.style.left="0px";
		i2.style.background = "#000 top left no-repeat";
		document.getElementById(this.ID).appendChild(i2);
		
		if(this.captions){
			var c = document.createElement("div");
			c.id="captions";
			c.innerHTML = "<table id=\"captionwrapone"+this.ID+"\" class=\"captionwrapone\"><tr><td><span class=\"caption\" id=\"captionone"+this.ID+"\"></span></td></tr></table>"+
						  "<table id=\"captionwraptwo"+this.ID+"\" class=\"captionwraptwo\"><tr><td><span class=\"caption\" id=\"captiontwo"+this.ID+"\"></span></td></tr></table>"+
						   "<div id=\"shade\"></div>";
			document.getElementById(this.ID).appendChild(c);
		}
	},
	
	AddImage: function(Name,Caption){
		this.myImages[this.myImages.length] = new Image();
		this.myImages[this.myImages.length-1].src="uploads/"+Name;
		if(this.captions) this.myCaptions[this.myCaptions.length]=Caption;
	},
	
	Start: function(){
		document.getElementById("imageone"+this.ID).style.backgroundImage="url('"+this.myImages[0].src+"')";
		document.getElementById("imagetwo"+this.ID).style.backgroundImage="url('"+this.myImages[1].src+"')";
		if(this.captions){
			document.getElementById("captions").style.display="block";
		 	document.getElementById("captionone"+this.ID).innerHTML=this.myCaptions[0];
			document.getElementById("captiontwo"+this.ID).innerHTML=this.myCaptions[1];
		}
		
		//eval('setTimeout("s'+this.ID+'.fadeout()",'+this.wait+')');
		setTimeout("SlideShow.fadeout()",this.wait);
	},
	
	fadeout: function(){
		this.imageOpacity=this.imageOpacity-this.amount;
		if(this.imageOpacity>0){
			this.myOpacity=this.imageOpacity/100;
		}else{
			this.imageOpacity=0;
			this.myOpacity=0;
		}
		if(this.captions) document.getElementById("captionwraptwo"+this.ID).style.display="block";
		if(isIE){
			document.getElementById("imageone"+this.ID).style.filter="alpha(opacity="+(this.myOpacity*100)+")";
			if(this.captions) document.getElementById("captionwrapone"+this.ID).style.filter="alpha(opacity="+(this.myOpacity*100)+")";
			if(this.captions) document.getElementById("captionwraptwo"+this.ID).style.filter="alpha(opacity="+(100-(this.myOpacity*100))+")";
		}else{
			document.getElementById("imageone"+this.ID).style.opacity=this.myOpacity;
			if(this.captions) document.getElementById("captionwrapone"+this.ID).style.opacity=this.myOpacity;
			if(this.captions) document.getElementById("captionwraptwo"+this.ID).style.opacity=1-this.myOpacity;
		}
		
		if(this.imageOpacity>0){
			//eval('setTimeout("s'+this.ID+'.fadeout()",'+this.speed+')');
			setTimeout("SlideShow.fadeout()",this.speed);
		}else{
			this.imageOpacity=100;
			this.changeimage();
			if(this.captions) this.changecaption();
			setTimeout("SlideShow.fadeout()",this.wait);
		}
	},
	
	changeimage: function(){
		document.getElementById("imageone"+this.ID).style.backgroundImage=document.getElementById("imagetwo"+this.ID).style.backgroundImage;
		if(isIE)
			document.getElementById("imageone"+this.ID).style.filter="alpha(opacity="+(100)+")";
		else
			document.getElementById("imageone"+this.ID).style.opacity=1;
			
		this.imageNumber++;
		if(this.imageNumber>=this.myImages.length){this.imageNumber=0;}
		document.getElementById("imagetwo"+this.ID).style.backgroundImage="url("+this.myImages[this.imageNumber].src+")";
			//if(this.captions) document.getElementById("captiontwo"+this.ID).innerHTML=this.myCaptions[this.imageNumber]
			//eval('setTimeout("s'+this.ID+'.fadeout()",'+this.wait+')');
	},
	
	changecaption: function(){
		document.getElementById("captionone"+this.ID).innerHTML=document.getElementById("captiontwo"+this.ID).innerHTML;
		
		if(isIE){
			document.getElementById("captionwrapone"+this.ID).style.filter="alpha(opacity="+(100)+")";
			document.getElementById("captionwraptwo"+this.ID).style.filter="alpha(opacity="+(0)+")";
		}else{
			document.getElementById("captionwrapone"+this.ID).style.opacity=1;
			document.getElementById("captionwraptwo"+this.ID).style.opacity=0;
		}
		document.getElementById("captionwraptwo"+this.ID).style.display="none";
		document.getElementById("captiontwo"+this.ID).innerHTML=this.myCaptions[this.imageNumber];
	},
	
	fadein: function(){//This function is now deprecated
		this.imageOpacity=this.imageOpacity+this.amount;
		if(this.imageOpacity>0 && this.imageOpacity<100){
			this.myOpacity=this.imageOpacity/100;
		}else if(this.imageOpacity>=100){
			this.imageOpacity=100;
			this.myOpacity=1;
		}else{
			this.myOpacity=0
		}
		if(isIE){
			document.getElementById("imageone"+this.ID).style.filter="alpha(opacity="+(this.myOpacity*100)+")";
			if(this.captions) document.getElementById("caption"+this.ID).style.filter="alpha(opacity="+(this.myOpacity*100)+")";
		}else{
			document.getElementById("imageone"+this.ID).style.opacity=this.myOpacity;
			if(this.captions) document.getElementById("caption"+this.ID).style.opacity=this.myOpacity;
		}
		if(this.imageOpacity<100){
			//eval('setTimeout("s'+this.ID+'.fadein()",'+this.speed+')');
			setTimeout("SlideShow.fadein()",this.speed);
		}else{
			var i=this.imageNumber+1;
			if(i>=this.myImages.length){i=0;}
			document.getElementById("imagetwo"+this.ID).style.backgroundImage="url("+this.myImages[i].src+")";
			//setTimeout('fadeout()',wait);
			//eval('setTimeout("s'+this.ID+'.fadeout()",'+this.wait+')');
			setTimeout("SlideShow.fadeout()",this.wait);
		}
	}
}
/*Events Scroller*/
var Events = new Array();
		
Array.prototype.create = function(el,sc){
	this.scrolling=false;
	this.id=el;
	this.sc=(sc != null) ? sc : true;
	this.speed=1;
	this.pause=1;
	this.delay=1000;
	
	this.ref=document.getElementById(this.id);
	if(this.sc){
		this.ref.style.overflow="hidden";
		if(isIE){
			this.ref.attachEvent("onmouseover",function(){Events.speed=0;});
			this.ref.attachEvent("onmouseout",function(){Events.speed=1;});
		}else{
			this.ref.addEventListener("mouseover",function(){Events.speed=0;},false);
			this.ref.addEventListener("mouseout",function(){Events.speed=1;},false);
		}
	}else{
		this.ref.style.overflow="auto";
		this.ref.style.overflowX="hidden";
	}
}

Array.prototype.remove = function(el){
	$(el).parentNode.parentNode.removeChild($(el).parentNode);
}

Array.prototype.add = function(obj){
	this[this.length] = obj;
	
	var v1 = document.createElement("div");
	v1.className="newspost";
	v1.align="left";
	v1.style.position="absolute";
	v1.style.margin="1%";
	
	var v2 = document.createElement("div");
	v2.className="header";
	v2.appendChild(document.createTextNode(obj.title));
	
	var v3 = document.createElement("span");
	v3.className="date";
	v3.appendChild(document.createTextNode("Posted: " + obj.date));
	
	var v4 = document.createElement("div");
	v4.className="postbody";
	v4.innerHTML=obj.body;
	
	v1.appendChild(v2);
	//Removed at customers request.
	//v1.appendChild(v3); 
	v1.appendChild(v4);
	
	this.ref.appendChild(v1);
	//obj.ref=this.ref.lastChild;
	obj.ref=v1;
	obj.height=obj.ref.clientHeight;
	obj.top = (this.length > 1) ? this[this.length-2].top + this[this.length-2].height : 0;
	
	obj.ref.style.top = obj.top + "px";
	
	if(this.sc)
		this.scroll();
}

Array.prototype.scroll = function(){
	if(this.length>1 && !this.scrolling){
		if(this.ref.scrollHeight>this.ref.clientHeight){
			setTimeout('lefttime=setInterval("scrollevents()",30)', this.delay);
			this.scrolling=true;
		}
	}
}

function scrollevents(){
	for(var i=0; i<Events.length; i++){ 
		Events[i].scroll();
	}
}

function Event(title, body, date){
	this.ref = null;
	this.title = title;
	this.body = body;
	this.date = date;
	this.height=null;
	this.top=null;
	this.startIndex = Events.length;
	
	this.scroll = function(){
		if((this.height + this.top) > 0){
			this.top = this.top - Events.speed;
		}else{
			if(Events.length==1){
				this.top = this.ref.parentNode.clientHeight;
			}else{
				Events.push(Events.shift());
				var t = Events[Events.length-2].top + Events[Events.length-2].height;
				this.top = (t > this.ref.parentNode.clientHeight) ? t : this.ref.parentNode.clientHeight;
				if(this.startIndex==0) this.top+=this.ref.parentNode.clientHeight/2;
			}
		}
		this.ref.style.top = this.top + "px";
	}
}

function addProvider(url,adult) {
	if (adult == "true") {
		var confirmAdult = confirm("This search plugin points to a website which may contain adult content. By clicking 'OK' you confirm you are old enough and it is legal in your country of residence to view this type of content.")
		if (!confirmAdult) {
			return;
		}
	}
	try {
		window.external.AddSearchProvider(url);
	} catch (e) {
		alert("You need to be using IE7 or Firefox2 to add a search engine\r\nYou can also install search plugins by using the drop down menu to the right of the search box.");
		return;
	}
}

var ProgressBar = function(a,b,c,d,e,f){
	this.bg = (a != null) ? a : "#000000";
	this.border = (b != null) ? b : "#999999";
	this.color = (c != null) ? c : "#ffffff";
	this.message = (d != null) ? d : "LOADING";
	this.bar = (e != null) ? e : "#000066";
	this.barbg = (f != null) ? f : "transparent";
	this.op = 100;
	
	this.create = function(el){
		this.p = el;
		
		//Create a cover pane to hide jacket loading
		this.L=document.createElement("div");
		this.L.style.position="relative";
		this.L.style.top="0px";
		this.L.style.left="0px";
		this.L.style.width="100%";
		this.L.style.height="100%";
		this.L.style.zIndex="11";
		this.L.style.backgroundColor=this.bg;
		
		//Create a progressbar for loading
		var pb=document.createElement("div");
		pb.style.position="absolute";
		pb.style.height="20px";
		pb.style.width="70%";
		pb.style.left="50%";
		pb.style.marginLeft="-35%";
		pb.style.top="50%";
		pb.style.marginTop="-11px";
		pb.style.border="1px solid " + this.border;
		pb.style.textAlign="center";
		pb.style.lineHeight="20px";
		pb.style.color=this.color;
		pb.style.backgroundColor=this.barbg;
		pb.innerHTML="<span style='position:relative; z-index:2;'>" +this.message+ "</span>"
		
		//Create a slider to dispaly laoding
		this.progress=document.createElement("div");
		this.progress.style.position="absolute";
		this.progress.style.left="0px";
		this.progress.style.top="0px";
		this.progress.style.zIndex="1";
		this.progress.style.height="100%";
		this.progress.style.width="0px";
		this.progress.style.backgroundColor=this.bar;
		
		pb.appendChild(this.progress);
		this.L.appendChild(pb);
		
		//return L;
		this.p.appendChild(this.L);
		
		if(isIE7){
		//IE7 does not calculate percent margins correctly when the width is also a percent.  need to calculate based on actual size;
			pb.style.marginLeft = -(pb.clientWidth/2) +"px";
		}
	};
	
	this.update = function(percent){
		try{
			this.progress.style.width = percent + "%";
		}catch(e){
			//IE incorrectly passes the percent value, calculating it as Infinity when coming back via a history call
			//This is most likely due to IE image caching bug.  Page must be reloaded for SpotLight lists to work properly.
			// window.location.reload(false);
			alert(percent);
		}
	};
	
	this.remove = function(){
		if(isIE){
			this.L.style.filter="alpha(opacity="+ this.op +")";
			//this.pb.style.filter="alpha(opacity="+ this.op +")";
		}else{
			this.L.style.opacity=this.op/100;
			//this.pb.style.opacity=this.op/100;
		}
		if(this.op==0){
			//this.ref.removeChild(this.pb);
			this.p.removeChild(this.L);
		}else{
			this.op-=5;
			setTimeout("HotLists.pb.remove()",30);
		}
	};
}


/*SpotLight Books */
var HotLists = {
	speed: 5,
	pause: 1,
	delay: 30,
	scrollID: 0,
	lists: [],
	currentList: null,
	loaded: 0,
	pb: null,
	progress: null,
	lc: 0,
	tc: 0,
	op: 100,
	
	create: function(el){
		this.id=el;
		this.ref=document.getElementById(this.id);
		
		var h1=document.createElement("div");
		h1.className="handle";
		h1.id="handleL";
		h1.onmouseover = this.scrollLeft;
		h1.onmouseout = this.killScroll;
		
		var h2=document.createElement("div");
		h2.className="handle";
		h2.id="handleR";
		h2.onmouseover = this.scrollRight;
		h2.onmouseout = this.killScroll;
		
		this.pb = new ProgressBar(null,"#4F020C",null,"LOADING","#840414",null);
		
		//this.ref.appendChild(L);
		//this.ref.appendChild(this.pb.create());
		this.pb.create(this.ref);
		this.ref.appendChild(h1);
		this.ref.appendChild(h2);
	},
	
	add: function(obj){
		this.lists.push(obj);
		if(this.lists.length>1)$("spotlighttabs").style.display="block";
		var l = document.createElement("button");
		//l.onclick=BindArguments(HotLists.change,obj);//BindArguments(obj.onclick,obj);
		l.onclick=function(){HotLists.change(obj);};//BindArguments(obj.onclick,obj);
		l.appendChild(document.createTextNode(obj.name));
		$("spotlighttabs").appendChild(l);
		$("spotlighttabs").appendChild(document.createTextNode(" "));
		obj.tab = l;
		
		return obj;
	},
	
	remove: function(obj){
		return this.lists.splice(this.lists.indexOf(obj),1);
	},
	
	load: function(){
		//Count Total Books To Load
		for(var i=0; i<this.lists.length; i++){
			this.tc += this.lists[i].books.length;
		}
		//Start Loading Lists
		for(var i=0; i<this.lists.length; i++){
			this.lists[i].load();
		}
	},
	
	updateprogress: function(n){
		this.lc+=n;
		this.progress = Math.round((this.lc/this.tc)*100);
		this.pb.update(this.progress);
	},
	
	change: function(l){
		this.currentList.hide();
		this.currentList=l;
		this.currentList.show();
	},
	
	onloaded: function(){
		if(this.lc==this.tc){
			this.currentList=this.lists[0];
			this.currentList.show();
			this.pb.remove();
		}
	},
	
	loading: function(){
		this.loaded++;
		if(this.loaded == this.lists.length){
			this.onloaded();
		}
	},
	
	scrollLeft: function(){
		HotLists.scrollID=setInterval("HotLists.currentList.scroll(0)",HotLists.delay);
	},
	
	scrollRight: function(){
		HotLists.scrollID=setInterval("HotLists.currentList.scroll(1)",HotLists.delay);
	},
	
	killScroll: function(){
		clearInterval(HotLists.scrollID);
	},
	
	appendChild: function(c){
		this.ref.appendChild(c);
	},
	
	crap: function(){
		this.tc--;
	}
};

var List = function(x,n,r){
	this.name=x;
	this.count=n;
	this.removenojacket=r;
	this.loaded=0;
	this.books=[];
	this.tab=null;
	
	this.ref=document.createElement("div");
	this.ref.className="booklist";
	
	HotLists.appendChild(this.ref);
	
	this.add = function(obj){
		this.books.push(obj);
		//alert(this.books.length);
		obj.create();
	};
	
	this.load = function(){
		//Load Books
		for(var j=0; j<this.books.length; j++){
			
			this.ref.appendChild(this.books[j].load());
		}
	};
	
	this.updateload = function(n){
		this.loaded+=n;
		//alert(this.loaded + " of " + this.books.length);
		HotLists.updateprogress(n);
		//Check if List is Loaded
		if(this.loaded == this.books.length)
			//alert(this.books.length);
			this.setup();
		//Check to see if ALL ListsLoaded
		HotLists.onloaded();
	};
	
	this.remove = function(obj){
		HotLists.tc--;
		this.books.splice(this.books.indexOf(obj),1);
	};
	
	this.setup = function(){
		for(var i=0; i<this.books.length; i++){ 
			this.books[i].setpos(this,i);
		}
		//alert(this.books.length);
		this.width = this.books[this.books.length-1].left + this.books[this.books.length-1].width;
		this.view = this.ref.parentNode.clientWidth;
		//this.ref.style.left = (this.view - this.width)/2 + "px";
		this.ref.style.marginLeft = -(this.width)/2 + "px";
		this.ref.style.display = "none";
	};
	
	this.scroll = function(d){
		if(this.books.length * 60 > this.ref.parentNode.clientWidth){
			for(var i=0; i<this.books.length; i++){ 
				this.books[i].scroll(this,d);
			}
		}
	};
	
	this.hide = function(){
		this.ref.style.display="none";
		this.tab.className="";
	};
	
	this.show = function(){
		this.ref.style.display="block";
		this.tab.className="on";
	};
};

var Book = function(t,a,d,i,p){
	this.title = t;
	this.author = a;
	this.date = d;
	this.isbn = i;
	this.ref=null;
	this.left=null;
	this.width=null;
	this.height=null;
	this.parent=p;
	this.url="hottitles.asp?loc=2&isbn="+this.isbn+"&author="+this.author+"&title="+this.title;
	
	this.create = function(){
		var book=document.createElement("img");
		this.ref=book;
		
		book.style.position="absolute";
		book.style.margin="2px 0";
		book.style.cursor="pointer";
		if(!this.parent.removenojacket) book.style.background="transparent url('images/nobook.gif') center center no-repeat";
		
		book.alt=this.title;
		book.title=this.title;
		
		book.onclick=BindArguments(this.onclick,this);
		book.onmouseover=BindArguments(this.onmouseover,this);
		book.onmouseout=BindArguments(this.onmouseout,this);
		//book.onerror=function(e){alert(e);}
		book.onload=BindArguments(this.onload,this);
	}
	
	this.load = function(){
		this.ref.src="http://content.tlcdelivers.com/tlccontent?customerid=999&requesttype=bookjacket-sm&isbn="+this.isbn;
		return this.ref;
	}
	
	this.scroll = function(L,d){
		if(d==0){//Scroll Left
			if(this.left > -(this.width)){
				this.left = this.left - HotLists.speed;
			}else{
				//if(Events.length==1){
					//this.top = this.ref.parentNode.clientHeight;
				//}else{
					L.books.push(L.books.shift());
					var I=L.books.indexOf(this);
					var l=L.books[I-1].left + L.books[I-1].width + L.books[I-1].margin;
					this.left = (l > this.ref.parentNode.clientWidth) ? l : this.ref.parentNode.clientWidth;
					//this.top = (l > this.ref.parentNode.clientWidth) ? l : this.ref.parentNode.clientWidth;
				//}
			}
		}else{//Sccroll Right
			if(this.left < (L.width - this.width - this.margin)){
				this.left = this.left + HotLists.speed;
			}else{
				//if(Events.length==1){
					//this.top = this.ref.parentNode.clientHeight;
				//}else{
					L.books.unshift(L.books.pop());
					var I=L.books.indexOf(this);
					var l=L.books[I+1].left - this.width - this.margin;
					this.left = (l <  -(this.width)) ? l : -(this.width);
					//this.top = (l > this.ref.parentNode.clientWidth) ? l : this.ref.parentNode.clientWidth;
				//}
			}
		}
		this.ref.style.left = this.left + "px";
	}
	
	this.onclick = function(b){
		/*var msg = "Title: " + b.title +"\r\n"+
				  "Author: " + b.author +"\r\n"+
				  "Date: " + b.date +"\r\n"+
				  "ISBN: " + b.isbn +"\r\n"+
				  "Width: " + b.width +"\r\n"+
				  "Height: " + b.height +"\r\n"+
				  "Left: " + b.left +"\r\n"+
				  "REF: " + b.ref +"\r\n";
		alert(msg);
		*/
		window.location.href=b.url;
	};
	
	this.onmouseover = function(b){
		if(isIE){
			b.ref.style.filter="alpha(opacity=100)";
		}else{
			b.ref.style.opacity="1";
		}
	};
	
	this.onmouseout = function(b){
		if(isIE){
			b.ref.style.filter="alpha(opacity=75)";
		}else{
			b.ref.style.opacity=".75";
		}
	};
	
	this.onload = function(b){
		try{//Added Try statement to catch IE onload errors.  IE has bugs when using cached images.
			//b.width = b.ref.clientWidth;
			//b.height = b.ref.clientHeight;
			b.width = b.ref.width;
			b.height = b.ref.height;
			b.margin = 2;
			//alert("loading:" + this.title);
			//Remove any books with no jackets
			if(b.width <= 1 && b.parent.removenojacket){
				//b.parent.remove(b);
				//Notify parent of load
				//b.parent.updateload(0);
				throw "No Book Jacket"
			}else{
				//Force Jacket Height to 94 px
				if(b.height!=94){
					b.ref.style.height="94px";
					b.width = b.ref.clientWidth;
					b.height = b.ref.clientHeight;
				}
				if(document.all){
					b.ref.style.filter="alpha(opacity=75)";
				}else{
					b.ref.style.opacity=".75";
				}
				//Notify parent of load
				b.parent.updateload(1);
			}
		}catch(e){
			b.parent.remove(b);
			//Notify parent of load
			b.parent.updateload(0);
		}
	};
	
	this.setpos = function(L,I){
		this.left = (I > 0) ? L.books[I-1].left + L.books[I-1].width + L.books[I-1].margin : 0;
		
		this.ref.style.left = this.left + "px";
	};
};


function BindArguments(fn)
{
  var args = [];
  for (var n = 1; n < arguments.length; n++)
    args.push(arguments[n]);
  return function () { return fn.apply(this, args); };
}








if (!Array.prototype.indexOf)
	Array.prototype.indexOf = function(item, startIndex) {
		var len = this.length;
		if (startIndex == null)
			startIndex = 0;
		else if (startIndex < 0) {
			startIndex += len;
			if (startIndex < 0)
				startIndex = 0;
		}
		for (var i = startIndex; i < len; i++) {
			var val = this[i] || this.charAt && this.charAt(i);
			if (val == item)
				return i;
		}
		return -1;
	};
	
function loadjacket(who){
	if(who.value.length==10 || who.value.length==13){
		$("libchoicejacket").src="http://content.tlcdelivers.com/tlccontent?customerid=999&requesttype=bookjacket-md&isbn="+who.value;
	}
}