
function updatePriceTotal() {
	// update the total amount and 
	// aryEventPrices is to tell which total we are calculating
	// 0 - child
	// 1 - adult
	// 2 - conncession
	
	eventID = document.forms['frmPurchase'].cboEvent.value.split('-')[0];
	
	if (!(isNaN(eventID))) {
		aryEventPrices = eval("document.forms['frmPurchase'].cmdAmount_" + eventID + ".value").split(',');

		numChildTixValue = document.forms['frmPurchase'].txtChildTix.value;
		numAdultTixValue = document.forms['frmPurchase'].txtAdultTix.value;
		numConcsTixValue = document.forms['frmPurchase'].txtConcsTix.value;

		//document.forms['frmPurchase'].numAmount.value = FormatNumber(numChildTixValue*aryEventPrices[0])+(numAdultTixValue*aryEventPrices[1])+(numConcsTixValue*aryEventPrices[2]),2);

		document.forms['frmPurchase'].numAmount.value = FormatNumber((numChildTixValue*aryEventPrices[0])+(numAdultTixValue*aryEventPrices[1])+(numConcsTixValue*aryEventPrices[2]),2);
	} else {
		alert('choose an event first');
		document.forms['frmPurchase'].numAmount.value = "0.00";
		document.forms['frmPurchase'].txtChildTix.value = '0';
		document.forms['frmPurchase'].txtAdultTix.value = '0';
		document.forms['frmPurchase'].txtConcsTix.value = '0';
	}
}

function updatePriceDisplay() {	

	eventID = document.forms['frmPurchase'].cboEvent.value.split('-')[0];
	if (!(isNaN(eventID))) {

		aryEventPrices = eval("document.forms['frmPurchase'].cmdAmount_" + eventID + ".value").split(',');
		blnPrevious = false;
		if (aryEventPrices[0] > 0 && aryEventPrices[0] != '') {
			document.all['childRate'].innerHTML = 'Child rate: $' + aryEventPrices[0];
			blnPrevious = true;
		}
		if (aryEventPrices[1] > 0 && aryEventPrices[1] != '') {
			if (blnPrevious) {
				document.all['adultRate'].innerHTML = '&nbsp;';
			} else {
				document.all['adultRate'].innerHTML = '';
			}
			document.all['adultRate'].innerHTML += 'Adult rate: $' + aryEventPrices[1];
			blnPrevious = true;
		}
		if (aryEventPrices[2] > 0 && aryEventPrices[2] != '') {
			if (blnPrevious) {
				document.all['concsRate'].innerHTML = '&nbsp;';
			} else {
				document.all['concsRate'].innerHTML = '';
			}
			document.all['concsRate'].innerHTML += 'Concession rate: $' + aryEventPrices[2];
		}
	} else {
		document.all['childRate'].innerHTML = '';
		document.all['adultRate'].innerHTML = '';
		document.all['concsRate'].innerHTML = '';
	}
}

function FormatNumber(expr, decplaces) {
	var str = "" + Math.round(eval(expr) * Math.pow(10,decplaces));

	while (str.length <= decplaces) {
		str = "0" + str;
	}

	var decpoint = str.length - decplaces;

	return str.substring(0,decpoint) + "." + str.substring(decpoint, str.length);
}
