<!--
// To customise your product order form do a search and replace on each product name.
// For example, do a search for each occurence of the word "product_1" and replace
// them with your product name (such as "pair_of_socks"). When the invoice step occurs,
// all underscores (the _ character) get replaced with spaces, so the above product would 
// appear on the invoice presented to the customer as "pair of socks". Replace all occurences 
// of "product_number" (where number is a digit) with meaningful product names.
// Any alphanumeric character can be used, but do not use the hyphen "-" character.
// You must also replace the visible product descriptions without underscores such as "Product 1".

// When your account is activated, change the ACTION from test_payment.pl to make_payment.pl

function toDollarsAndCents(n) {
  var s = "" + Math.round(n * 100) / 100
  var i = s.indexOf('.')
  if (i < 0) return s + ".00"
  var t = s.substring(0, i + 1) + s.substring(i + 1, i + 3)
  if (i + 2 == s.length) t += "0"
  return t
}

function FormatFields()
{

document.form1.Weekend_Pass_Adults.value = document.form1.Weekend_Pass_Adults_qty.value + "," + document.form1.Weekend_Pass_Adults_value.value;
document.form1.Weekend_Pass_Children.value = document.form1.Weekend_Pass_Children_qty.value + "," + document.form1.Weekend_Pass_Children_value.value;
document.form1.Friday_Day_Pass.value = document.form1.Friday_Day_Pass_qty.value + "," + document.form1.Friday_Day_Pass_value.value;
document.form1.Saturday_Day_Pass.value = document.form1.Saturday_Day_Pass_qty.value + "," + document.form1.Saturday_Day_Pass_value.value;
document.form1.Sunday_Day_Pass.value = document.form1.Sunday_Day_Pass_qty.value + "," + document.form1.Sunday_Day_Pass_value.value;
document.form1.Monday_Day_Pass.value = document.form1.Monday_Day_Pass_qty.value + "," + document.form1.Monday_Day_Pass_value.value;
//document.form1.Mens_Shirt.value = document.form1.Mens_Shirt_qty.value + "," + document.form1.Mens_Shirt_value.value;
// document.form1.Womans_Shirt.value = document.form1.Womans_Shirt_qty.value + "," + document.form1.Womans_Shirt_value.value;
document.form1.DVD_Order.value = document.form1.DVD_Order_qty.value + "," + document.form1.DVD_Order_value.value;

document.form1.Digital_Subscriber.value = document.form1.Digital_Subscriber_qty.value + "," + document.form1.Digital_Subscriber_value.value;


document.form1.Weekend_Pass_Adults_subtotal.value = toDollarsAndCents(document.form1.Weekend_Pass_Adults_qty.value * document.form1.Weekend_Pass_Adults_value.value);
document.form1.Weekend_Pass_Children_subtotal.value = toDollarsAndCents(document.form1.Weekend_Pass_Children_qty.value * document.form1.Weekend_Pass_Children_value.value);
document.form1.Friday_Day_Pass_subtotal.value = toDollarsAndCents(document.form1.Friday_Day_Pass_qty.value * document.form1.Friday_Day_Pass_value.value);
document.form1.Saturday_Day_Pass_subtotal.value = toDollarsAndCents(document.form1.Saturday_Day_Pass_qty.value * document.form1.Saturday_Day_Pass_value.value);
document.form1.Sunday_Day_Pass_subtotal.value = toDollarsAndCents(document.form1.Sunday_Day_Pass_qty.value * document.form1.Sunday_Day_Pass_value.value);
document.form1.Monday_Day_Pass_subtotal.value = toDollarsAndCents(document.form1.Monday_Day_Pass_qty.value * document.form1.Monday_Day_Pass_value.value);
// document.form1.Mens_Shirt_subtotal.value = toDollarsAndCents(document.form1.Mens_Shirt_qty.value * document.form1.Mens_Shirt_value.value);
document.form1.DVD_Order_subtotal.value = toDollarsAndCents(document.form1.DVD_Order_qty.value * document.form1.DVD_Order_value.value);
// document.form1.Womans_Shirt_subtotal.value = toDollarsAndCents(document.form1.Womans_Shirt_qty.value * document.form1.Womans_Shirt_value.value);
document.form1.Digital_Subscriber_subtotal.value = toDollarsAndCents(document.form1.Digital_Subscriber_qty.value * document.form1.Digital_Subscriber_value.value);

document.form1.OrderTotal.value = 0;

document.form1.OrderTotal.value = toDollarsAndCents(parseFloat(document.form1.OrderTotal.value)
			 + parseFloat(document.form1.Weekend_Pass_Adults_subtotal.value)
			 + parseFloat(document.form1.Weekend_Pass_Children_subtotal.value)
			 + parseFloat(document.form1.Friday_Day_Pass_subtotal.value)
			 + parseFloat(document.form1.Saturday_Day_Pass_subtotal.value)
			 + parseFloat(document.form1.Sunday_Day_Pass_subtotal.value)
			 + parseFloat(document.form1.Monday_Day_Pass_subtotal.value)
		//	 + parseFloat(document.form1.Mens_Shirt_subtotal.value)
		//	 + parseFloat(document.form1.Womans_Shirt_subtotal.value)
 			 + parseFloat(document.form1.DVD_Order_subtotal.value)
			 + parseFloat(document.form1.Digital_Subscriber_subtotal.value));

}
//-->
