foul.when('~name~','Your name is a required field.');
foul.when('~email~','E-mail is a required field.');
foul.when('~email~ is not email','Please enter a valid e-mail address');
foul.when('~tickets~ is not numeric or ~tables~ is not numeric','Your # of tables or tickets in invalid');
foul.when('~phone_number~','Your phone number is a required field.');
foul.when('~tables~ == zero and ~tickets~ == zero', 'You must purchase at least one ticket OR table to continue.');

function recalculate() {
	$('amount').value = (($('tickets').value * 60.00) + ($('tables').value * 460.00)).toFixed(2);
	$('item_name').value = '2011-2012 Addy Gala Tickets';
	if ($('tickets').value > 0) $('item_name').value = $('item_name').value + ' / ' + $('tickets').value + ' ticket(s)';
	if ($('tables').value > 0) $('item_name').value = $('item_name').value + ' / ' + $('tables').value + ' table(s)';
}

function reservation() {
	recalculate();
	
	if (foul.validate($('ticketfrm')) === true) {
		var ajax = new Ajax.Request('/tools/addy_tickets/save_order.php', { method: 'post', parameters: $('ticketfrm').serialize(true) });
		var t = setTimeout("submit_frm()",1500);	
	} else {
		$('frmsubmit').disabled = false;
		$('frmsubmit').value = "Continue >>";
	}
}

function submit_frm() {
	$('ticketfrm').submit();
}
