/*
* donate.js using directone API
*/

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() {	if (document.donateform.Jade_Buddha_General_Donation_value.value > 0) {
		document.donateform.Jade_Buddha_General_Donation_qty.value = "1";
	}
	if (document.donateform.Jade_Buddha_General_Donation_value.value < 1) {
		document.donateform.Jade_Buddha_General_Donation_qty.value = "0";
	}

	document.donateform.Jade_Buddha_General_Donation.value = document.donateform.Jade_Buddha_General_Donation_qty.value + "," + document.donateform.Jade_Buddha_General_Donation_value.value;
	/* calculate subtotal */
	document.donateform.Jade_Buddha_General_Donation_subtotal.value = toDollarsAndCents(document.donateform.Jade_Buddha_General_Donation_qty.value * document.donateform.Jade_Buddha_General_Donation_value.value);
	document.donateform.OrderTotal.value = 0;
	document.donateform.OrderTotal.value = toDollarsAndCents(parseFloat(document.donateform.Jade_Buddha_General_Donation_value.value));
}

