$(document).ready(function()
{
	$('#send-button').bind('click', function(event)
	{
		event.preventDefault();
		
		/*___ Form validation ___*/
		if($('#event_fieldset input:checked').val() === undefined)
		{
			alert('Please select which event you wish to attend');
			return false;
		}
		
		if($('#quantity').val() === undefined || $('#quantity').val() == 0)
		{
			alert('Please enter a valid quantity of tickets');
			return false;
		}
		
		if($('#heard_about_event_id').val() === undefined || $('#heard_about_event_id').val() == 0)
		{
			alert('Could you please tell us how you found out about this event');
			$('#heard_about_event_id').focus();
			return false;
		}
		
		// Display values
		$('#event_value').html($('#event_fieldset input:checked').next().find('span.event_name').html());
		$('#date_time_value').html($('#event_fieldset input:checked').next().find('span.event_date_time').html());
		$('#quantity_value').html($('#quantity').val());
		$('#ticket_cost_value').html('$' + $('#ticket_price').val());
		$('#total_cost_value').html('$' + parseInt($('#quantity').val(), 10) * parseInt($('#ticket_price').val(), 10));
		
		$('#confirmed-booking-details').slideDown();
		$('#confirmed-booking-details').ScrollTo(400);

		return false;
	});
});