/// Non-Javascript users see old style 'add to list' link

function create_add_link(isbn)
{
	div_id = "add_"+isbn;
	newLink = '<a style="cursor: pointer" onClick="myRequest.queueGetRequest(\'/cgi-bin/mp3_pop_queue.cgi?isbn='+isbn+'\', document.getElementById(\''+div_id+'\'));"><img src="http://images.booksfree.com/images/redbookicon.gif" alt="Rent" border="0" /></a>';
	document.getElementById(div_id).innerHTML = newLink;
}

//image rollover
function swapimages(which1,what1,which2,what2,which3,what3,which4,what4){
if (document.getElementById(''+which1+'')){
	document.getElementById(''+which1+'').src=''+what1+'';
}
if (document.getElementById(''+which2+'')){
	document.getElementById(''+which2+'').src=''+what2+'';
}
if (document.getElementById(''+which3+'')){
	document.getElementById(''+which3+'').src=''+what3+'';
}
if (document.getElementById(''+which4+'')){
	document.getElementById(''+which4+'').src=''+what4+'';
}
}

// higlight a table row.
function HighlightRowIfChecked(checkBox){
    var bgColor = checkBox.checked ? "#EBDAE7" : "#FFFFFF";
    var el = checkBox.parentNode;
    while(el.tagName.toLowerCase() != "tr"){
        el = el.parentNode;
    }
    el.style.backgroundColor = bgColor;
}

//Contents for romance
var romance=new Array()
romance[0]='<a href="/cgi-bin/mp3_search.cgi?category1=FIC027520&free=free" class="small">Anthologies</a>'
romance[1]='<a href="/cgi-bin/mp3_search.cgi?category1=FIC027080&free=free" class="small">Short Stories</a>'

//Contents for mystery
var mystery=new Array()
mystery[0]='<a href="/cgi-bin/mp3_search.cgi?category1=FIC022031&free=free" class="small">Sherlock Holmes</a>'
mystery[1]='<a href="/cgi-bin/mp3_search.cgi?category1=FIC022050&free=free" class="small">Short Stories</a>'

//Contents for young adult
var young=new Array()
young[0]='<a href="/cgi-bin/mp3_search.cgi?category1=JUV005000&free=free" class="small">Boys &amp; Men</a>'
young[1]='<a href="/cgi-bin/mp3_search.cgi?category1=JUV013&free=free" class="small">Family</a>'
young[2]='<a href="/cgi-bin/mp3_search.cgi?category1=JUV014000&free=free" class="small">Girls &amp; Women</a>'
young[3]='<a href="/cgi-bin/mp3_search.cgi?category1=JUV022&free=free" class="small">Legends, Myths, Fables</a>'
young[4]='<a href="/cgi-bin/mp3_search.cgi?category1=JUV033&free=free" class="small">Religious</a>'
young[5]='<a href="/cgi-bin/mp3_search.cgi?category1=JUV035000&free=free" class="small">School &amp; Education</a>'
young[6]='<a href="/cgi-bin/mp3_search.cgi?category1=JUV038000&free=free" class="small">Short Stories</a>'
young[7]='<a href="/cgi-bin/mp3_search.cgi?category1=JUV039&free=free" class="small">Social Issues</a>'
young[8]='<a href="/cgi-bin/mp3_search.cgi?category=Others&category1=JUV&free=free" class="small">Other</a>'

//Contents for other miscellaneous
var other=new Array()
other[0]='<a href="/cgi-bin/mp3_search.cgi?category1=FIC040000&free=free" class="small">Alternative History</a>'
other[1]='<a href="/cgi-bin/mp3_search.cgi?category1=FIC042&free=free" class="small">Christian</a>'
other[2]='<a href="/cgi-bin/mp3_search.cgi?category1=FIC005&free=free" class="small">Erotica</a>'
other[3]='<a href="/cgi-bin/mp3_search.cgi?category1=FIC024000&free=free" class="small">Occult</a>'
other[4]='<a href="/cgi-bin/mp3_search.cgi?category1=FIC-OTHER&free=free" class="small">Other</a>'

//Contents for biography
var biography=new Array()
biography[0]='<a href="/cgi-bin/mp3_search.cgi?category1=BIO004&free=free" class="small">Composers &amp; Musicians</a>'
biography[1]='<a href="/cgi-bin/mp3_search.cgi?category1=BIO005&free=free" class="small">Entertainment &amp; Performing Arts</a>'
biography[2]='<a href="/cgi-bin/mp3_search.cgi?category1=BIO017&free=free" class="small">Medical</a>'
biography[3]='<a href="/cgi-bin/mp3_search.cgi?category1=BIO010000&free=free" class="small">Political</a>'
biography[4]='<a href="/cgi-bin/mp3_search.cgi?category1=BIO011000&free=free" class="small">Presidents &amp; H.O.S.</a>'
biography[5]='<a href="/cgi-bin/mp3_search.cgi?category1=BIO015&free=free" class="small">Scientists</a>'
biography[6]='<a href="/cgi-bin/mp3_search.cgi?category=Others&category1=BIO&free=free" class="small">Other</a>'

//Contents for business
var business=new Array()
business[0]='<a href="/cgi-bin/mp3_search.cgi?category1=BUS007&free=free" class="small">Business Communication</a>'
business[1]='<a href="/cgi-bin/mp3_search.cgi?category=Career&category1=BUS&free=free" class="small">Careers</a>'
business[2]='<a href="/cgi-bin/mp3_search.cgi?category1=BUS025000&free=free" class="small">Entrepreneurship</a>'
business[3]='<a href="/cgi-bin/mp3_search.cgi?category1=BUS036000&free=free" class="small">Investments &amp; Securities</a>'
business[4]='<a href="/cgi-bin/mp3_search.cgi?category=Others&category1=BUS&free=free" class="small">Other</a>'

//Contents for history
var histories=new Array()
histories[0]='<a href="/cgi-bin/mp3_search.cgi?category=Middle&category1=HIS&free=free" class="small">Middle East</a>'
histories[1]='<a href="/cgi-bin/mp3_search.cgi?category1=HIS037060&free=free" class="small">U.S. 19th Century</a>'
histories[2]='<a href="/cgi-bin/mp3_search.cgi?category1=HIS037080&free=free" class="small">U.S. 21st Century</a>'
histories[3]='<a href="/cgi-bin/mp3_search.cgi?category=Others&category1=HIS&free=free" class="small">Other</a>'

//Contents for nonfiction miscellaneous
var misc=new Array()
misc[0]='<a href="/cgi-bin/mp3_search.cgi?category1=LAN&free=free" class="small">Language Arts &amp; Disciplines</a>'
misc[1]='<a href="/cgi-bin/mp3_search.cgi?category1=LAW&free=free" class="small">Law</a>'
misc[2]='<a href="/cgi-bin/mp3_search.cgi?category1=LCO&free=free" class="small">Literary Collections</a>'
misc[3]='<a href="/cgi-bin/mp3_search.cgi?category1=LIT&free=free" class="small">Literary Criticism</a>'
misc[4]='<a href="/cgi-bin/mp3_search.cgi?category1=MED&free=free" class="small">Medical</a>'
misc[5]='<a href="/cgi-bin/mp3_search.cgi?category1=MUS&free=free" class="small">Music</a>'
misc[6]='<a href="/cgi-bin/mp3_search.cgi?category1=OCC&free=free" class="small">Occult</a>'
misc[7]='<a href="/cgi-bin/mp3_search.cgi?category1=PER&free=free" class="small">Performing Arts</a>'
misc[8]='<a href="/cgi-bin/mp3_search.cgi?category1=PSY&free=free" class="small">Psychology</a>'
misc[9]='<a href="/cgi-bin/mp3_search.cgi?category1=REF&free=free" class="small">Reference</a>'
misc[10]='<a href="/cgi-bin/mp3_search.cgi?category1=STU&free=free" class="small">Study Aids</a>'
misc[11]='<a href="/cgi-bin/mp3_search.cgi?category1=TEC&free=free" class="small">Technology &amp; Engineering</a>'
misc[12]='<a href="/cgi-bin/mp3_search.cgi?category1=NON-OTHER&free=free" class="small">Other</a>'
	
var menuwidth='100px' //default menu width
var menubgcolor='#DDFFFF'  //menu bgcolor #F6F6F6
var disappeardelay=200  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="browsemenudiv" style="visibility:hidden;width:'+menuwidth+'; background: transparent; background-color: #FFFFFF; opacity: .95; filter:alpha(opacity=95);" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype, dropobj){
var totaloffset=(offsettype=="left")? what.offsetLeft-dropobj.offsetWidth-4 : what.offsetTop-what.offsetHeight-4;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
//edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
edgeoffset=dropmenuobj.contentmeasure-(windowedge-dropmenuobj.x-5)
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
//edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight-11
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("browsemenudiv") : browsemenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left", dropmenuobj)
dropmenuobj.y=getposOffset(obj, "top", dropmenuobj)
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

// search stuff

function textClear (input) { if ( input.value == input.defaultValue ) { input.value = ""; } }
function textRestore (input) { if ( input.value == "" ) { input.value = input.defaultValue;	} }


function JSFX_FloatTopDiv(div_name)
{
}
