/* begin library.js */

var print= 0;
var spec= 0;
var syn= 0;
var associate= "textexcavatio-20";

function loadPage(title)
{
	var t= title;
	eliminateFrames();
}

function eliminateFrames()
{
	if (top.location !== self.location)
	{
		top.location.replace(self.location);
	}
}

function writeStatus(message)
{
	window.status= message;
}

function getSelectValue(formname, selectname)
{
	var dropDownMenu = document[formname][selectname];
	var selectedItem = dropDownMenu.selectedIndex;
	return dropDownMenu.options[selectedItem].value;
}

function getCheckValue(formname, checkname)
{
	var check= document[formname][checkname];
	var val= "";

	if (check.checked)
	{
		val= "yes";
	}

	else
	{
		val= "no";
	}

	return val;
}

function getOptValue(formname, optname)
{
	var radioButtons = document[formname][optname];
	for (x=0; x<radioButtons.length; x++)
	{
		if (radioButtons[x].checked)
		{
			return radioButtons[x].value;
		}
	}
}

function nothing()
{
	// nothing happens
}

function writeIndividualAmazonLink(linktext, id)
{
	var link= "";

	link += '<a class= \"moderntitle\" ';
	link += 'href= \"http:\/\/www.amazon.com\/exec\/obidos\/ASIN\/';
	link += id + '\/';
	link += associate + '\" ';
	link += 'target= \"_blank\" onmouseout= \"writeStatus(\'\'); return true\" ';
	link += 'onmouseover= \"writeStatus(\'Buy it from Amazon.\'); return true\">';
	link += linktext;
	link += '<\/a>';

	return link;
}

function writeQuickAmazonLink(linktext, id)
{
	var link= "";

	link += '<a class= \"moderntitle\" ';
	link += 'href= \"http:\/\/buybox.amazon.com\/exec\/obidos\/redirect?tag=';
	link += associate;
	link += '&link_code=qcb&creative=23424&camp=2025&path=\/dt\/assoc\/tg\/aa\/xml';
	link += '\/assoc\/-\/';
	link += id + '\/';
	link += associate;
	link += '\/ref%3Dac_bb5_\" onmouseout= \"writeStatus(\'\'); return true\" ';
	link += 'onmouseover= \"writeStatus(\'Buy it from Amazon with Quick-Click.\'); return';
	link += ' true\" ';
	link += 'onclick= \"openAmazonWindow(\'http:\/\/buybox.amazon.com\/exec\/obidos\/';
	link += 'redirect?tag=';
	link += associate;
	link += '&link_code=qcb&creative=23424&camp=2025&path=\/dt\/assoc\/tg\/aa\/xml';
	link += '\/assoc\/-\/';
	link += id + '\/';
	link += associate;
	link += '\/ref%3Dac_bb5_\'); return false\">';
	link += linktext;
	link += '<\/a>';

	return link;
}

function writeIndividualAmazonImageLink(image, id)
{
	var link= "";

	link += '<a href= \"http:\/\/www.amazon.com\/exec\/obidos\/ASIN\/';
	link += id + '\/';
	link += associate + '\" ';
	link += 'target= \"_blank\" onmouseout= \"writeStatus(\'\'); return true\" ';
	link += 'onmouseover= \"writeStatus(\'Buy it from Amazon.\'); return true\">';
	link += '<img src= \"images\/' + image + '\" alt= \"Buy it from Amazon.\" ';
	link += 'border= \"0\" style= \"margin-bottom: 2px\"\/>';
	link += '<\/a>';

	return link;
}

function writeQuickAmazonImageLink(image, id)
{
	var link= "";

	link += '<a href= \"http:\/\/buybox.amazon.com\/exec\/obidos\/redirect?tag=';
	link += associate;
	link += '&link_code=qcb&creative=23424&camp=2025&path=\/dt\/assoc\/tg\/aa\/xml';
	link += '\/assoc\/-\/';
	link += id + '\/';
	link += associate;
	link += '\/ref%3Dac_bb5_\" onmouseout= \"writeStatus(\'\'); return true\" ';
	link += 'onmouseover= \"writeStatus(\'Buy it from Amazon with Quick-Click.\'); return';
	link += ' true\" ';
	link += 'onclick= \"openAmazonWindow(\'http:\/\/buybox.amazon.com\/exec\/obidos\/';
	link += 'redirect?tag=';
	link += associate;
	link += '&link_code=qcb&creative=23424&camp=2025&path=\/dt\/assoc\/tg\/aa\/xml';
	link += '\/assoc\/-\/';
	link += id + '\/';
	link += associate;
	link += '\/ref%3Dac_bb5_\'); return false\">';
	link += '<img src= \"images\/' + image + '\" ';
	link += 'alt= \"Buy it from Amazon with Quick-Click.\" ';
	link += 'border= \"0\" style= \"margin-bottom: 2px\"\/>';
	link += '<\/a>';

	return link;
}

function writeIndividualBookLink(linktext, id)
{
	var link= writeIndividualAmazonLink(linktext, id);
	document.write(link);
}

function writeQuickBookLink(linktext, id)
{
	var link= writeQuickAmazonLink(linktext, id);
	document.write(link);
}

function writeIndividualBookImageLink(image, id)
{
	var link= writeIndividualAmazonImageLink(image, id);
	document.write(link);
}

function writeQuickBookImageLink(image, id)
{
	var link= writeQuickAmazonImageLink(image, id);
	document.write(link);
}

/* put in HTML: <script language= "javascript"
type= "text/javascript"><!--
writeComboBookLink(image, linktext, id, floatpos); //--></script> */

function writeComboBookLink(image, linktext, id, floatpos)
{
	var floatBox= "";

	floatBox += '<div class= \"caption\" style= \"width: 15%; margin: 0px; ';
	floatBox += 'padding: 0px; clear: ' + floatpos + '; float: ' + floatpos + '\" ';
	floatBox += 'border= \"0\">';
	floatBox += writeQuickAmazonImageLink(image, id) + '<br\/>';
	floatBox += writeIndividualAmazonLink(linktext, id) + '<span style= ';
	floatBox += '\"color: #000000\"></span><br\/>&#160;<\/div>';

	/* floatBox += '<table class= \"grid\" style= \"width: 65px; margin: 0px; padding: 0px;';
	floatBox += 'float: ' + floatpos + '\" border= \"0\"><tr class= \"grid\">';
	floatBox += '<td class= \"caption\">';
	floatBox += writeQuickAmazonImageLink(image, id) + '<br\/>';
	floatBox += writeIndividualAmazonLink(linktext, id) + '<\/td><\/tr><\/table>'; */

	document.write(floatBox);
}

function openAmazonWindow(ref)
{
	var amazonwin= window.open(ref,"amazonwindow",
	"location=yes,scrollbars=yes,width=380,height=450,screenX=10,screenY=10,top=10,left=10");
	amazonwin.focus();
}

/* end library.js */
