<!--
var numBooks
var numLa
var numGuide
var numIc2mm
var numIc2ti
var numIc2ts
var numIc2tb
var numIc2all
var numFydt
var numSs
var numTRAN
var numMMPC
var numLBP
var numPOL
var totBooks
var totLa
var totGuide
var totIc2mm
var totIc2ti
var totIc2ts
var totIc2tb
var totIc2all
var totFydt
var totSs
var totTRAN
var totMMPC
var totIYH
var totHO
var totLBP
var totPOL

function clearGlobalValues() {
    numBooks=0
    numLa=0
    numGuide=0
    numIc2mm=0
    numIc2ti=0
    numIc2ts=0
    numIc2tb=0
    numIc2all=0
    numFydt=0
    numSs=0
    numTRAN=0
    numMMPC=0
    numIYH=0
    numHO=0
    numLBP=0
    numPOL=0

    totBooks=0
    totLa=0
    totGuide=0
    totIc2mm=0
    totIc2ti=0
    totIc2ts=0
    totIc2tb=0
    totIc2all=0
    totFydt=0
    totSs=0
    totTRAN=0
    totMMPC=0
    totIYH=0
    totHO=0
    totLBP=0
    totPOL=0

}

 function cost(tot) {
 tot = "" + ((Math.round(tot * 100)) / 100);
dec1 = tot.substring(tot.length-3, tot.length-2);
dec2 = tot.substring(tot.length-2, tot.length-1);

if (dec1 != '.') { // adds trailing zeroes if necessary
if (dec2 == '.') tot += "0";
else tot += ".00";
}
return tot
}
function calcTotal() {
clearGlobalValues();
 numLa = document.ltlorder.numberLa.value ;
    if ( isNaN(numLa) ||numLa == "" || numLa == null || numLa == 0 ) {
        totLa=0;
         document.ltlorder.totalLa.value = ""
         document.ltlorder.numberLa.value = ""
        }
    else {totLa = numLa*23.5 ;
         document.ltlorder.totalLa.value = cost(totLa) ;
		  totBooks += totLa;
		  numBooks += numLa*1
        }
		
 numGuide = document.ltlorder.numberGuide.value ;        
    if ( isNaN(numGuide) || numGuide == "" || numGuide == null || numGuide == 0) {
        totGuide=0;
         document.ltlorder.totalGuide.value = ""
         document.ltlorder.numberGuide.value = ""
        }
    else {totGuide = numGuide*7.5 ;
         document.ltlorder.totalGuide.value = cost(totGuide);
		  totBooks += totGuide;
		  numBooks += numGuide*1
        }
		
 numIc2mm = document.ltlorder.numberIc2mm.value         
    if ( isNaN(numIc2mm) ||numIc2mm == "" || numIc2mm == null || numIc2mm == 0) {
        totIc2mm=0;
         document.ltlorder.totalIc2mm.value = ""
         document.ltlorder.numberIc2mm.value = ""
        }
    else {totIc2mm = numIc2mm*19.99 ;
         document.ltlorder.totalIc2mm.value = cost(totIc2mm);
		  totBooks += totIc2mm;
		  numBooks += numIc2mm*1
        }
		
 numIc2ti = document.ltlorder.numberIc2ti.value         
    if ( isNaN(numIc2ti) || numIc2ti == "" || numIc2ti == null || numIc2ti == 0) {
        totIc2ti=0;
         document.ltlorder.totalIc2ti.value = ""
         document.ltlorder.numberIc2ti.value = ""
        }
    else {totIc2ti = numIc2ti*19.99 ;
         document.ltlorder.totalIc2ti.value = cost(totIc2ti);
		  totBooks += totIc2ti;
		  numBooks += numIc2ti*1
        }
		
 numIc2ts = document.ltlorder.numberIc2ts.value         
    if ( isNaN(numIc2ts) || numIc2ts == "" || numIc2ts == null || numIc2ts == 0) {
        totIc2ts=0;
         document.ltlorder.totalIc2ts.value = ""
         document.ltlorder.numberIc2ts.value = ""
        }
    else {totIc2ts = numIc2ts*19.99 ;
         document.ltlorder.totalIc2ts.value = cost(totIc2ts);
		  totBooks += totIc2ts;
		  numBooks += numIc2ts*1
        }
		
 numIc2tb = document.ltlorder.numberIc2tb.value         
    if ( isNaN(numIc2tb) || numIc2tb == "" || numIc2tb == null || numIc2tb == 0) {
        totIc2tb=0;
         document.ltlorder.totalIc2tb.value = ""
         document.ltlorder.numberIc2tb.value = ""
        }
    else {totIc2tb = numIc2tb*21.99 ;
         document.ltlorder.totalIc2tb.value = cost(totIc2tb);
		  totBooks += totIc2tb;
		  numBooks += numIc2tb*1
        }
		
 numIc2all = document.ltlorder.numberIc2all.value         
    if ( isNaN(numIc2all) || numIc2all == "" || numIc2all == null || numIc2all == 0) {
        totIc2all=0;
         document.ltlorder.totalIc2all.value = ""
         document.ltlorder.numberIc2all.value = ""
        }
    else {totIc2all = numIc2all*75.96 ;
         document.ltlorder.totalIc2all.value = cost(totIc2all);
		  totBooks += totIc2all;
		  numBooks += numIc2all*4
        }
		
 numFydt = document.ltlorder.numberFydt.value         
    if ( isNaN(numFydt) || numFydt == "" || numFydt == null || numFydt == 0) {
        totFydt=0;
         document.ltlorder.totalFydt.value = ""
         document.ltlorder.numberFydt.value = ""
        }
    else {totFydt = numFydt*14.99 ;
         document.ltlorder.totalFydt.value = cost(totFydt);
		  totBooks += totFydt;
		  numBooks += numFydt*1
        }
 numSs = document.ltlorder.numberSs.value         
    if ( isNaN(numSs) || numSs == "" || numSs == null || numSs == 0) {
        totSs=0;
         document.ltlorder.totalSs.value = ""
         document.ltlorder.numberSs.value = ""
        }
    else {totSs = numSs*19.99 ;
         document.ltlorder.totalSs.value = cost(totSs);
		  totBooks += totSs;
		  numBooks += numSs*1
        }
 numTRAN = document.ltlorder.numberTRAN.value         
    if ( isNaN(numTRAN) || numTRAN == "" || numTRAN == null || numTRAN == 0) {
        totTRAN=0;
         document.ltlorder.totalTRAN.value = ""
         document.ltlorder.numberTRAN.value = ""
        }
    else {totTRAN = numTRAN*16.99 ;
         document.ltlorder.totalTRAN.value = cost(totTRAN);
		  totBooks += totTRAN;
		  numBooks += numTRAN*1
        }
 numMMPC = document.ltlorder.numberMMPC.value         
    if ( isNaN(numMMPC) || numMMPC == "" || numMMPC == null || numMMPC == 0) {
        totMMPC=0;
         document.ltlorder.totalMMPC.value = ""
         document.ltlorder.numberMMPC.value = ""
        }
    else {totMMPC = numMMPC*24.99 ;
         document.ltlorder.totalMMPC.value = cost(totMMPC);
		  totBooks += totMMPC;
		  numBooks += numMMPC*1
        }
 numIYH = document.ltlorder.numberIYH.value         
    if ( isNaN(numIYH) || numIYH == "" || numIYH == null || numIYH == 0) {
        totIYH=0;
         document.ltlorder.totalIYH.value = ""
         document.ltlorder.numberIYH.value = ""
        }
    else {totIYH = numIYH*20.00 ;
         document.ltlorder.totalIYH.value = cost(totIYH);
		  totBooks += totIYH;
		  numBooks += numIYH*1
        }
 numHO = document.ltlorder.numberHO.value         
    if ( isNaN(numHO) || numHO == "" || numHO == null || numHO == 0) {
        totHO=0;
         document.ltlorder.totalHO.value = ""
         document.ltlorder.numberHO.value = ""
        }
    else {totHO = numHO*20.00 ;
         document.ltlorder.totalHO.value = cost(totHO);
		  totBooks += totHO;
		  numBooks += numHO*1
        }
 numLBP = document.ltlorder.numberLBP.value         
    if ( isNaN(numLBP) || numLBP == "" || numLBP == null || numLBP == 0) {
        totLBP=0;
         document.ltlorder.totalLBP.value = ""
         document.ltlorder.numberLBP.value = ""
        }
    else {totLBP = numLBP*3.99 ;
         document.ltlorder.totalLBP.value = cost(totLBP);
		  totBooks += totLBP;
		  numBooks += numLBP*1
        }
 numPOL = document.ltlorder.numberPOL.value         
    if ( isNaN(numPOL) || numPOL == "" || numPOL == null || numPOL == 0) {
        totPOL=0;
         document.ltlorder.totalPOL.value = ""
         document.ltlorder.numberPOL.value = ""
        }
    else {totPOL = numPOL*14.99 ;
         document.ltlorder.totalPOL.value = cost(totPOL);
		  totBooks += totPOL;
		  numBooks += numPOL*1
        }
		
	if (numBooks > 0 ) {	
 document.ltlorder.totalBooks.value = cost(totBooks);
 }
 else document.ltlorder.totalBooks.value = ""
 if (numBooks > 0 && document.ltlorder.countryDel.value == "UK") {
 document.ltlorder.totalPostage.value = cost(numBooks*0.45 + 2);
 document.ltlorder.totalInvoice.value = cost(totBooks + (numBooks*0.45 + 2))		
}
	else {
			if (document.ltlorder.countryDel.value != "UK")
 document.ltlorder.totalPostage.value = "Call"
 			else {
 document.ltlorder.totalPostage.value = ""
			}
 document.ltlorder.totalInvoice.value = ""
 
 		}		
		
}
function checkpo() {
if  ( (document.ltlorder.purchaseorder.value == "" || document.ltlorder.purchaseorder.value == null) && document.ltlorder.payment.value == "invoice")
	{
alert("please enter official Purchase Order number") ;
document.ltlorder.purchaseorder.focus();
	}
else {
	if (document.ltlorder.payment.value == "cheque")
	alert("please send a cheque with your order, \ndrawn in Pounds Sterling from a UK bank.");
	}
}

function validate() { 
if  (document.ltlorder.email.value == "" || document.ltlorder.email.value == null)
{
alert("please enter your email address") ;
document.ltlorder.email.focus();
return false
}
else return true
}

function copyAddDel(){
if(document.ltlorder.addressCopyDel.checked)
{

document.ltlorder.nameDel.value = document.ltlorder.nameInv.value ;
document.ltlorder.addressDel.value = document.ltlorder.addressInv.value ;
document.ltlorder.postCodeDel.value = document.ltlorder.postCodeInv.value ;
document.ltlorder.countryDel.value = document.ltlorder.countryInv.value ;

}
}

function copyAddCard(){
if(document.ltlorder.addressCopyCard[0].checked)
{
document.ltlorder.addressCard.value = document.ltlorder.addressInv.value ;
document.ltlorder.postCodeCard.value = document.ltlorder.postCodeInv.value ;
}
else if(document.ltlorder.addressCopyCard[1].checked)
{
document.ltlorder.addressCard.value = document.ltlorder.addressDel.value ;
document.ltlorder.postCodeCard.value = document.ltlorder.postCodeDel.value ;
}

}
function formCheck(formobj){
	var fieldRequired = Array("nameInv", "addressInv", "postCodeInv", "addressDel", "postCodeDel", "phonedel", "email","payment");
	var fieldDescription = Array("Invoice Name", "Invoice address", "Invoice post code", "Delivery address", "Delivery post code", "Contact Tel","Email Address", "Payment method");
	var alertMsg = "Please complete the following fields:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}
//-->		 