function TotalForm(orderform) {
	
	country = document.orderform.country.value;
	orderform.countryselect.value = country;
	/* document.getElementById('whatcountry').innerHTML="<h2>All books will be shipped to " + country + "</h2>"; */
	
	if (country=="") {
		orderform.price.value = "0.00";
		orderform.price1.value = "0.00";
		orderform.price2.value = "0.00";
		document.getElementById('price').innerHTML="";
		document.getElementById('price1').innerHTML="";
		document.getElementById('price2').innerHTML="";
		document.getElementById('shipto').innerHTML="";
		document.getElementById('shipto1').innerHTML="";
		document.getElementById('shipto2').innerHTML="";
		document.getElementById("d1").style.display = 'block';
        document.getElementById("d2").style.display = 'none';
        document.getElementById("d3").style.display = 'block';
		document.getElementById("d4").style.display = 'none';
		document.getElementById("d5").style.display = 'none';
	}
	else if (country=="USA") {
 		var price = "60.00";
		var price1 = "75.00"
		var price2 = "75.00"; 
		/* var price = "1.00";
		var price1 = "1.00"
		var price2 = "1.00"; */
        document.getElementById("d3").style.display = 'none';
		document.getElementById("d2").style.display = 'block';
		document.getElementById("d4").style.display = 'block';
		document.getElementById("d5").style.display = 'none';
		dopricesum()

	}
	else if (country=="CAN") {
		var price = "70.00";
		var price1 = "85.00"
		var price2 = "85.00";
        document.getElementById("d3").style.display = 'none';
		document.getElementById("d2").style.display = 'block';
		document.getElementById("d4").style.display = 'none';
		document.getElementById("d5").style.display = 'block';
		dopricesum()
	}

	else {
		var price = "115.00";
		var price1 = "125.00"
		var price2 = "125.00";
        document.getElementById("d3").style.display = 'none';
		document.getElementById("d2").style.display = 'block';
		document.getElementById("d4").style.display = 'none';
		document.getElementById("d5").style.display = 'block';
		dopricesum()
	}

function dopricesum() {
	
		orderform.price.value = price;
		orderform.price1.value = price;
		orderform.price2.value = price;
		document.getElementById('price').innerHTML= "<b>$" + price + " each </b>";
		document.getElementById('price1').innerHTML= "<b>$" + price1 + " each</b>";
		document.getElementById('price2').innerHTML= "<b>$" + price2 + " each</b>";
/* 		document.getElementById('shipto').innerHTML="shipped to " + country;
		document.getElementById('shipto1').innerHTML="shipped to " + country;
		document.getElementById('shipto2').innerHTML="shipped to " + country; */
		
		var qty = document.orderform.qty.value;
		pricetotal = qty * price;
		document.orderform.pricetotal.value = currencyPad(pricetotal,7)
		document.orderform.price.value = currencyPad(price,7)

		var qty1 = document.orderform.qty1.value;
		pricetotal1 = qty1 * price1;
		document.orderform.pricetotal1.value = currencyPad(pricetotal1,7)
		document.orderform.price1.value = currencyPad(price1,7)
		
		var qty2 = document.orderform.qty2.value;
		pricetotal2 = qty2 * price2;
		document.orderform.pricetotal2.value = currencyPad(pricetotal2,7)
		document.orderform.price2.value = currencyPad(price2,7)

		subtotal = (pricetotal *1) + (pricetotal1 *1) + (pricetotal2 *1);
		document.orderform.subtotal.value = currencyPad(subtotal,7)

	}
			/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			//CURRENCYPAD
			function currencyPad(anynum,width) {  //returns number as string in ,xxx.xx format. 
			anynum = "" + eval(anynum)  //evaluate (in case an expression sent) 
				intnum=0 
				if (anynum >= 1) { intnum = parseInt(anynum) } //isolate integer portion 
			intstr = ""+intnum  //add comma in thousands place. 
			if (intnum >= 1000) { 
			intlen = intstr.length 
			temp1=parseInt(""+(intnum/1000)) 
			temp2=intstr.substring(intlen-3,intlen) 
			intstr = temp1+","+temp2 
					} 
			if (intnum >= 1000000) { 
			intlen = intstr.length 
			temp1=parseInt(""+(intnum/1000000)) 
			temp2=intstr.substring(intlen-7,intlen) 
			intstr = temp1+","+temp2         
			} 
			decnum = Math.abs(parseFloat(anynum)-intnum) //isolate decimal portion 
			decnum = decnum * 100 // multiply decimal portion by 100. 
			decstr = "" + Math.abs(Math.round(decnum)) 
			while (decstr.length < 2) { 
			decstr += "0" 
			} 
			retval = intstr + "." + decstr 
			if (intnum < 0) { 
			retval=retval.substring(1,retval.length) 
			retval="("+retval+")"         
			}        
			retval = ""+retval 
			while (retval.length < width){ 
			retval=" "+retval 
			} 
			return retval 
			} 
			/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
			// END CURRENCYPAD
}

 
function checkamount() {
	 subtotal = document.orderform.subtotal.value;
		subtotal = (subtotal * 1)
		if (subtotal =="0.00") {
			alert("Please add a quantity to an item");
		   returnval = false;
		} 
		else { returnval = true; }

	return returnval;

}