function setupBookingForm() {
	// Switch on/off elements that only work with/without javascript.
	$('.no_jquery_hide').show();
	$('.no_jquery_show').hide();

	$('.attendee_input').change(function(){
		var x;
		var data = '';
		var attendees = 0;

		for (x = 1; x <= 5; x++) {
			data = $('#attendee_name_'+x).val();
			data += $('#company_name_'+x).val();
			data += $('#member_non_'+x).val();

			if (data.length > 0) {
				attendees++;
			}
		}

		var price = $('#event_price').val();
		if (price != 0) {
			price = price * attendees;

			var price_vat = price * 1.175;

			$('#total_cost').val('£'+price.toFixed(2));
			$('#total_cost_vat').val('£'+price_vat.toFixed(2));
		} else {
			$('#total_cost').removeAttr('readonly');
			$('#total_cost_vat').removeAttr('readonly');
		}

		$('#total_attendees').val(attendees);
	});

	// Hide the text and bind the onclick event.
	$('#voucher_help').hide();
	$('#voucher').click(voucher_click);
}

function voucher_click() {
	var checked = $('#voucher').attr('checked');
	if (checked) {
		// Hide the other rows.
		$('.voucher_hide_row').fadeOut();

		// Show the helper text.
		$('#voucher_help').fadeIn();

		// Select the cheque payment method for them.
		$('input[name=payment_method][value=cheque]').attr('checked', true);
	} else {
		// Show the other payment methods.
		$('.voucher_hide_row').fadeIn();

		// Hide the helper text.
		$('#voucher_help').fadeOut();
	}
}

