/**
 * Change the number of cars displayed on the quote page
 */
function change_num_cars()
{
	var num_vehicles = document.getElementById('num_vehicles').value;
	for (var i = 1; i < MAX_CARS; i++)
	{
		document.getElementById('car_' + i).style.display = (i > num_vehicles ? 'none' : '');
	}
}

/**
 * Change where the form is submitting to. This is because the form can
 * do three different things. If JavaScript is turned off, the server-side
 * script will redirect us to the right place anyways, but this is niceish :)
 */
function form_action(where)
{
	document.getElementById('quote').action = where + '.php';
	return true;
}

/**
 * Update the "day" box with the day corresponding to the date entered
 */
function update_day()
{
	var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
	//alert(document.getElementById('year').value + '-' + document.getElementById('month').value + '-' + document.getElementById('date').value);
	var myDate = new Date(document.getElementById('year').value, document.getElementById('month').value - 1, document.getElementById('date').value);
	document.getElementById('day').value = days[myDate.getDay()];
}

/**
 * Show the addons text above comments box, depending on if we have any addons
 */
function show_addons_text()
{
	document.getElementById('addons_msg').style.display = 'block';
}

function show_vehicle_text(what)
{
	if (what.value == 'other')
		document.getElementById('other_vehicles_msg').style.display = 'block';
}

/**
 * Validate that the user entered all their details 
 */
function validate()
{
	
}