// JavaScript Document
// start billing to shipping address function
function billtoship()
{

if (document.theForm.scheck.checked)
{
document.theForm.Billing_Name.value=document.theForm.Name.value;
document.theForm.Billing_Company.value=document.theForm.Company.value;
document.theForm.Billing_Address.value=document.theForm.Address.value;
document.theForm.Billing_City.value=document.theForm.City.value;
document.theForm.Billing_State.value=document.theForm.State.value;
document.theForm.Billing_Zip.value=document.theForm.Zip.value;
document.theForm.Billing_Phone.value=document.theForm.Phone.value;
}


else
{
document.theForm.Billing_Name.value="";
document.theForm.Billing_Company.value="";
document.theForm.Billing_Address.value="";
document.theForm.Billing_City.value="";
document.theForm.Billing_State.value="";
document.theForm.Billing_Zip.value="";
document.theForm.Billing_Phone.value="";
}

}
// end billing to shipping address function
// calculate amount for attendees
function totalnumber() {

	    if ((document.theForm.attendee_no.value == '') || (isNaN(document.theForm.attendee_no.value))){
            alert("Please enter valid no of attendees");
			document.theForm.total_amount.value =0;
			} // fix for Opera.
 
	document.theForm.total_amount.value = (595 * document.theForm.attendee_no.value);
}

// calculate amount for attendees
function totalamountoak() {

	    if ((document.theForm.oak_quantity.value == '') || (isNaN(document.theForm.oak_quantity.value))){
			document.theForm.oak_quantity.value =0;
			} // fix for Opera.
			var sub_total1= cent(Math.round(39.95 * document.theForm.oak_quantity.value*Math.pow(10,2))/Math.pow(10,2));
			document.theForm.total_oak.value= sub_total1 ;
			  
			
		   if ((document.theForm.pump_quantity.value == '') || (isNaN(document.theForm.pump_quantity.value))){
			document.theForm.pump_quantity.value =0;
			} // fix for Opera.
			
			var sub_total2= (30.00 * document.theForm.pump_quantity.value);
 			
			document.theForm.total_pump.value= sub_total2 ;
			
	document.theForm.total_amount.value = ((sub_total1 - 0.0) + (sub_total2 - 0.0));
}

function cent(amount) {
     return (amount == Math.floor(amount)) ? amount + '.00' : (  (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}

