/* begin library.js */

var associate= "textexcavatio-20";

function pageLoadFX()
{
	// nothing yet
}

function writeHeader()
{
	// nothing yet
}

function writeFooter()
{
	/* prevents pages from being framed */
	eliminateFrames();

	var f= "";

	if (navigator.appName == "Microsoft Internet Explorer")
	{
		f += '<p class= \"center\"><span class= \"caption\">BayBeggar 2004, ';
		f += '<a href= \"index.html\" style= \"text-decoration: none\">';
		f += '<code style= \"color: #3300ff\">www.textexcavation.com/baybeggar</code>.';
		f += '<\/a><\/span><\/p>';
	}

	else
	{
		f += '<p class= \"center\"><span class= \"caption\">Bay';
		f += 'Beggar 2004.<\/span><\/p>';
	}

	if (document.all)
	{
		document.all.footer.innerHTML= f;
	}

	else if (document.getElementById)
	{
		document.getElementById('footer').innerHTML= f;
	}
}

function writeEmail()
{
	var e= '';

	e += '<a href= ';
	e += '\"mailto:baybeggar';
	e += '@textexcavation.';
	e += 'com\" onmouseover= \"writeStatus(\'Email: baybeggar@';
	e += 'textexcavation.com.\'); ';
	e += 'return true\" onmouseout= \"writeStatus(\'\'); return true\">Ben C. Smith</a>';

	return e;
}

function writeEmailAddress()
{
	var e= '';

	e += '<a href= ';
	e += '\"mailto:baybeggar';
	e += '@textexcavation.';
	e += 'com\" onmouseover= \"writeStatus(\'Email: baybeggar@';
	e += 'textexcavation.com.\'); ';
	e += 'return true\" onmouseout= \"writeStatus(\'\'); return true\">';
	e += 'baybeggar@textexcavation.com</a>';

	return e;
}

function eliminateFrames()
{
	if (top.location !== self.location)
	{
		top.location.replace(self.location);
	}
}

function writeStatus(message)
{
	window.status= message;
}

function bookMark(x, y)
{
	var bm= "";
	var address= x;
	var name= y;

	bm += '| <a href= ';
	bm += '\"javascript:window.external.AddFavorite';
	bm += '(\'' + address + '\',';
	bm += '\'' + name + '\')">Bookmark</a>. ';

	if (document.all)
	{
		document.all.bookmark.innerHTML= bm;
	}

	else if (document.getElementById)
	{
		document.getElementById('bookmark').innerHTML= bm;
	}
}

function homePageMark(x, y)
{
	var pm= "";
	var address= x;
	var name= y;

	pm += '<p class= \"center\">';

	if (navigator.appName== "Microsoft Internet Explorer")
	{
		pm += 'Set BayBeggar';
		pm += ' as your <a href= \"index.html\" ';
		pm += 'onclick= \"this.style.behavior= ';
		pm += '\'url(#default#homepage)\'; ';
		pm += 'this.setHomePage';
		pm += '(\'' + address + '\'); return false\" ';
		pm += 'onmouseover= \"writeStatus(\'Make this site your homepage.\'); ';
		pm += 'return true\" ';
		pm += 'onmouseout= \"writeStatus(\'\'); ';
		pm += 'return true\">';
		pm += 'homepage<\/a>';
	
		pm += ', or <a href= ';
		pm += '\"javascript:window.external.AddFavorite';
		pm += '(\'' + address + '\',';
		pm += '\'' + name + '\')" ';
		pm += 'onmouseover= \"writeStatus(\'Bookmark this site.\'); return true\" ';
		pm += 'onmouseout= ';
		pm += '\"writeStatus(\'\'); ';
		pm += 'return true\">bookmark<\/a> it.';
	}

	else
	{
		pm += 'Add BayBeggar to your favorites by ';
		pm += 'pressing <i>control</i> plus <i>d</i>.';
	}

	pm += '<\/p>';

	if (document.all)
	{
		document.all.pagemark.innerHTML= pm;
	}

	else if (document.getElementById)
	{
		document.getElementById('pagemark').innerHTML= pm;
	}
}

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 copyText(field)
{
	var tempVal= eval("document." + field);
	tempVal.focus();
	tempVal.select();
	textRange= tempVal.createTextRange();
	textRange.execCommand("Copy");
}

function clearText(textArea)
{
	textArea.value= "";
	var disp= "";

	disp += '<p class= \"center\"><span';
	disp += ' class= \"display\" style= \"text-align: center\"><span class= \"english\">';
	disp += 'Text will be';
	disp += ' displayed in this box for preview.<\/span><\/span><\/p>';

	if (document.all)
	{
		document.all.display.innerHTML= disp;
	}

	else if (document.getElementById)
	{
		document.getElementById('display').innerHTML= disp;
	}
}

function nothing()
{
	// nothing happens
}

function writeIndividualAmazonLink(linktext, 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 += linktext;
	link += '<\/a>';

	return link;
}

function writeQuickAmazonLink(linktext, 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 += 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><\/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 */