// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

// Namespace holder for the objects that belong to the "parking" application.
var ParkingFriend = {};

/**
 * Changes the drop-down for the arrival flight airline 
 * to be the same value as the departure airline.
 */
ParkingFriend.changeAirline = function(el)
{
	$('airport_booking_arrival_airline_id').selectedIndex = el.selectedIndex;
};

ParkingFriend.changeDay = function(el)
{
  var val = el.selectedIndex;
  $('day_end').selectedIndex = (val == 10) ? val : val + 1;
};

/**
 * Used by the <LI> elements in the navigation bar, so that
 * they can also be used (and not only the <A> element in them)
 */
ParkingFriend.navigateTo = function(url)
{
	location.href = url;
};

/**
 * Enables and disables the "Book!" button depending on whether the
 * user has read or not the terms and conditions.
 */
ParkingFriend.toggleBookButton = function()
{
	var checked = $('terms_read').checked;
	$('book_button').disabled = (checked) ? "" : "disabled";
	$('book_button').className = (checked) ? "" : "disabled";
};
