function goTo (page) {
	if (page != "" ) {
		if (page == "--" ) {
			resetMenu();
		} else {
			window.location.href = page;
		}
	}
	return false;
}


function resetMenu () {
	document.gmenu.page.options[0].selected = true;
}

function doISBN(whatDiv,isbn) {


$(whatDiv).append('Buy the book now from:<BR><form><select name="mypage" onChange="goTo(this.options[this.selectedIndex].value)"><option value="http://www.BuyTheBookLinks.com/amazon.cgi?'+isbn+'">Amazon.Com<option value="http://www.BuyTheBookLinks.com/bn.cgi?'+isbn+'">Barnes and Noble<option value="http://www.BuyTheBookLinks.com/borders.cgi?'+isbn+'">Borders<option value="http://www.BuyTheBookLinks.com/bam.cgi?'+isbn+'">Books-A-Million<option value="http://www.BuyTheBookLinks.com/powells.cgi?'+isbn+'">Powells<option value="--"><option value="http://www.BuyTheBookLinks.com">(about this service)</select><input type="button" VALUE="Go!" onClick="goTo(this.form.mypage.options[this.form.mypage.selectedIndex].value)"></form>')
}

this.btblEnhance = function(){
xOffset = 10;
yOffset = -50;




$("a").hover(function(e){
    if (this.href.toLowerCase().indexOf('buythebooklinks.com')>0) {
	var start=this.href.indexOf('\?');
	var end=this.href.indexOf('+');
	if (end>0)
		{isbn=this.href.substring(start+1,end);}
	else
		{isbn=this.href.substring(start+1);}
	$('#btbl').remove();

	var c="";
	if (this.rel != "")
		c='<img width="100" height="145" align="left" src="'+this.rel+'">'


	$("body").append("<div id='btbl'>"+c+"<div style=\"text-align:right;\"><a href=\"#\" onclick=\"$('#btbl').remove();\"><font color=\"#FF0000\">close</font></a></div></div>")
	doISBN("#btbl",isbn)
	$("#btbl").append('<I><font size="-1">powered by <a href="http://www.BuyTheBookLinks.com">BuyTheBookLinks</a></font>')
	$("#btbl")
		.css("display","none");
	$("#btbl")
		.css("width","300px")
		.css("height","150px")
		.css("border-style","dashed")
		.css("background","#ddeeff")
		.css("position","absolute")
		.css("top",(e.pageY - xOffset) + "px")
		.css("left",(e.pageX + yOffset) + "px")
		.fadeIn("slow");

	}},
	function(){
		window.setTimeout("$('#btbl').remove();",20000);
    });	

};


$(document).ready(function(){
	btblEnhance();
});

