//****************************************************
// returns the amount in the .99 format
//****************************************************
function cent(amount) {
  amount -= 0;
  return (amount == Math.floor(amount)) ? amount + '.00' : (  (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}

//**********************************************************
// returns a number rounded to 2 decimal places
//**********************************************************
function round(number) {
  var X
  X = (!X ? 2 : X);
  return Math.round(number*Math.pow(10,X))/Math.pow(10,X);
}

function calcPackageFees() {

 if (document.frmPurchase.package[0].checked)
 {
	document.frmPurchase.subtotal.value = "" + cent(150);
 }
 if (document.frmPurchase.package[1].checked)
 {
	document.frmPurchase.subtotal.value = "" + cent(400);
 }
 if (document.frmPurchase.package[2].checked)
 {
	document.frmPurchase.subtotal.value = "" + cent(650);
 } 
 if (document.frmPurchase.package[3].checked)
 {
	document.frmPurchase.subtotal.value = "" + cent(995);
 } 
 if (document.frmPurchase.package[4].checked)
 {
	document.frmPurchase.subtotal.value = "" + cent(2995);
 }  
 if (document.frmPurchase.package[5].checked)
 {
	document.frmPurchase.subtotal.value = "" + cent(4995);
 }   
 TotalCost();
}




//****************************************************************************
// Calculates the total of all conference fees
// Then call the necessary functions to calculate the total cost!
//****************************************************************************
function TotalCost() {
 
 var SubTotal
 var tax
 var Total
 var gst
 gst = 12.0
 
 SubTotal = (document.frmPurchase.subtotal.value - 0) ;
 //document.frmPurchase.subtotal.value = "" + cent(SubTotal);
 
 // figure out the tax
  tax = SubTotal / 100 * gst;
  tax = Math.floor(tax * 1000)/1000;
  document.frmPurchase.gst.value = "" + cent(round(tax));

 //now get the total
 Total = (cent(round(tax))-0) + SubTotal
 document.frmPurchase.total.value = cent(round(Total));
 //document.frmPurchase.total.value = "" + formatCurrency(SubTotal);
}
