function readyup(){
// Autosuggest 

$().ready(function() {
	
	function log(event, data, formatted) {
		$("<li>").html( !data ? "No match!" : "Selected: " + formatted).appendTo("#suggest2, #suggest1");
	}
	
	function formatItem(row) {
		return row[0] + " (<strong>id: " + row[1] + "</strong>)";
	}
	function formatResult(row) {
		return row[0].replace(/(<.+?>)/gi, '');
	}
	
	$("#suggest2").focus().autocomplete(cities, {
    minChars: 0,
		width: 314,
		matchContains: "word"
	  }
  );
	$("#suggest1").focus().autocomplete(cities, {
    minChars: 0,
		width: 314,
		matchContains: "word"
		}
    );
	
	});
	
// Datepicker	
	
$(document).ready(function() {
	$(function() {$('div.date input, div.date2 input').datepicker({dateFormat: 'd M yy'});}); //Change 'd M yy' for different Date format
});	

// Show Hide

//Hide field after clicking on "One Way"

$().ready(function() {
$("#flighttype_1").click(function(){
  if ( this.checked ) {
    $(".date2").hide("slow");
  } else {
    $(".date2").show("slow");
  }
});

// Show field when "Round trip" is clicked

$("#flighttype_0").click(function(){
  if ( this.checked ) {
    $(".date2").show("slow");
  } else {
    $(".date2").hide("slow");
  }
});

}); 

// 
// Default Values
$().ready(function() {
if ($("#formtype").val() == "air_hotel"){
$(".rooms").show();
  } else {
    $(".rooms").hide();
	}
$("#adults").val(2);
$("#children").val(1);
$("#rooms").val(1);
$("#time1").val(1);
$("#time2").val(1);
$("#length").val(1);
});
// values replace

}
readyup();

