// JavaScript Document
// Write email address to the page - hide from bots
function displayEmail(myname,mydom){
	document.write("<b><u><A HREF=\"mailto:" + myname + "@" + mydom + "\">" + myname + "@" + mydom + "</A></u></b>");
}

// Write email address to the page with a Label - hide from bots
function displayEmailLabel(myname,mydom,mylabel){
	document.write("<u><A HREF=\"mailto:" + myname + "@" + mydom + "\">" + mylabel + "</A></u>");
}

// Write email address to the page with a Label & subjesct - hide from bots
function displayEmailnSub(myname,mydom,mylabel,mysubject){
	document.write("<u><A HREF=\"mailto:" + myname + "@" + mydom + "\?subject\=" + mysubject + "\">" + mylabel + "</A></u>");
}

// updated use form to change page without submit.
function gohere(selectedURL) {
	if (selectedURL != "") {top.window.location = selectedURL}
}

// Format price function
function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num)){
		num = "0"
		};
	cents = Math.floor((num * 100 + 0.5) % 100);
	num = Math.floor((num * 100 + 0.5) / 100).toString();
	if(cents < 10) {
		cents = "0" + cents
		};
	for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++){
		num = num.substring(0,num.length - (4 * i + 3))+','+num.substring(num.length-(4 * i + 3));
		};
	return ("$" + num + "." + cents);
}

// Write to form "grandtotalorder" field value
function calcPrice(){
	var oForm = document.drOrderForm;
	var itemQty = eval("parseInt(oForm.book_qty[oForm.book_qty.selectedIndex].value)");
	var itemPrice = eval("parseFloat(oForm.book_value.value)");
	eval("oForm.orderTotal.value = formatCurrency(itemQty*itemPrice)");
	return parseFloat(itemQty*itemPrice);
}
	
	
	
	
	
	