<!--
function ValidateFlightSearchForm()
{
	var intInvalid = 0;
	if($('#f_FromCity').val()=='')
	{
		$('#f_FromCity_Auto').attr('style', 'background-color:red;color:#FFFFFF;');
		intInvalid = (intInvalid + 1);
	}
	else
	{
		$('#f_FromCity_Auto').attr('style', 'background-color:#FFFFFF;color:#000000;');
	}

	if($('#f_ToCity').val()=='')
	{
		$('#f_ToCity_Auto').attr('style', 'background-color:red;color:#FFFFFF;');
		intInvalid = (intInvalid + 1);
	}
	else
	{
		$('#f_ToCity_Auto').attr('style', 'background-color:#FFFFFF;color:#000000;');
	}

	if($('#f_DepartureDate').val()=='' || $('#f_DepartureDate').val()=='mm/dd/yyyy')
	{
		$('#f_DepartureDate').attr('style', 'background-color:red;color:#FFFFFF;');
		intInvalid = (intInvalid + 1);
	}
	else
	{
		$('#f_DepartureDate').attr('style', 'background-color:#FFFFFF;color:#000000;');
	}

	if($('input[name=f_TypeOfTrip]').val()=='ROUNDTRIP'){
		if($('#f_ReturnDate').val()=='' || $('#f_ReturnDate').val()=='mm/dd/yyyy')
		{
			$('#f_ReturnDate').attr('style', 'background-color:red;color:#FFFFFF;');
			intInvalid = (intInvalid + 1);
		}
		else
		{
			$('#f_ReturnDate').attr('style', 'background-color:#FFFFFF;color:#000000;');
		}
	}
	

	if(intInvalid > 0)
	{
		alert('Please fill the mandatory data.');
		return false;
	}
}

function ValidateHotelSearchForm()
{
	var intInvalid = 0;
	if($('#h_Destination').val()=='')
	{
		$('#h_Destination_Auto').attr('style', 'background-color:red;color:#FFFFFF;');
		intInvalid = (intInvalid + 1);
	}
	else
	{
		$('#h_Destination_Auto').attr('style', 'background-color:#FFFFFF;color:#000000;');
	}

	if($('#h_CheckInDate').val()=='' || $('#h_CheckInDate').val()=='mm/dd/yyyy')
	{
		$('#h_CheckInDate').attr('style', 'background-color:red;color:#FFFFFF;');
		intInvalid = (intInvalid + 1);
	}
	else
	{
		$('#h_CheckInDate').attr('style', 'background-color:#FFFFFF;color:#000000;');
	}

	if($('#h_CheckOutDate').val()=='' || $('#h_CheckOutDate').val()=='mm/dd/yyyy')
	{
		$('#h_CheckOutDate').attr('style', 'background-color:red;color:#FFFFFF;');
		intInvalid = (intInvalid + 1);
	}
	else
	{
		$('#h_CheckOutDate').attr('style', 'background-color:#FFFFFF;color:#000000;');
	}


	if(intInvalid > 0)
	{
		alert('Please fill the mandatory data.');
		return false;
	}
}

function getAirlineCode(theTagID) {
	var strUrl = "airline_code.php";
	window.open(strUrl, 'AirlineCode', 'toolbar=no,status=no,resizable=no,scrollbars=yes,width=300,height=400,top=100,left=100');
}

function VerifyData()
{
	if (frmSearch.pid.value == "" ){
		alert("Please enter value for the field.");
		frmSearch.pid.focus();
		return false;
	}
	/*if(isNaN(document.frmSearch.pid.value)){
		alert("Please enter a valid Package Id#, no characters allowed.")
		document.frmSearch.pid.focus();
		return false;
	}*/
	return true;
}

function SwitchSearchTabs(tb)
{
	switch(tb)
	{
		case 1:
				$('#FormFlight').hide();
				$('#FormTimeShare').hide();
				$('#FormHotel').show();
				$('#tb1').attr('class', 'tab-hotel-active');
				$('#tb2').attr('class', 'tab-flight');
				$('#tb4').attr('class', 'tab-time-share');
			break;
		case 2:
				$('#FormTimeShare').hide();
				$('#FormHotel').hide();
				$('#FormFlight').show();
				$('#tb2').attr('class', 'tab-flight-active');
				$('#tb1').attr('class', 'tab-hotel');
				$('#tb4').attr('class', 'tab-time-share');
			break;
		case 4:
				$('#FormFlight').hide();
				$('#FormHotel').hide();
				$('#FormTimeShare').show();
				$('#tb4').attr('class', 'tab-time-share-active');
				$('#tb1').attr('class', 'tab-hotel');
				$('#tb2').attr('class', 'tab-flight');
			break;
	}
}

function GetChildrenAges(oid)
{
	var children = $('#h_ChildCount'+oid).val();
	if(children > 0)
	{
		$('#ImgLoader').show();
		$.post('/get_occupancy.php', { action: 'ages', oid: oid, children: children }, function(data) {
		  $('#ListChildrenAges'+oid).html(data);
		  $('#ListChildrenAges'+oid).show();
		  $('#ImgLoader').hide();
		});
	}
}

$(document).ready(function(){
    $('#f_DepartureDate, #f_ReturnDate').datepicker(
    {
        showOn: "both",
        //beforeShow: customRange,
        dateFormat: "mm/dd/yy",
        firstDay: 0,
		minDate: "1",
		maxDate: "+11m",
        changeFirstDay: false
    });
	
	$('#f_DepartureDate').change(function(){
		$('#ImgLoader2').show();
		$.post('/date_add.php', { date: $(this).val(), days: 7 }, function(data) {
			$('#f_ReturnDate').val(data);
			$('#ImgLoader2').hide();
		});
	});
	
	$( "#f_FromCity_Auto" ).autocomplete({
		source: "airports.php",
		minLength: 3,
		select: function( event, ui ) {
			ui.item ? $('#f_FromCity').val(ui.item.id) : $('#f_FromCity').val('');
		}
	});

	$( "#f_ToCity_Auto" ).autocomplete({
		source: "airports.php",
		minLength: 3,
		select: function( event, ui ) {
			ui.item ? $('#f_ToCity').val(ui.item.id) : $('#f_ToCity').val('');
		}
	});
	
	$( "#h_Destination_Auto" ).autocomplete({
		source: "destinations.php",
		minLength: 1,
		select: function( event, ui ) {
			ui.item ? $('#h_Destination').val(ui.item.id) : $('#h_Destination').val('');
		}
	});

	$('#h_CheckInDate , #h_CheckOutDate').datepicker(
	{
		showOn: "both",
		//beforeShow: customRange,
		dateFormat: "mm/dd/yy",
		firstDay: 0,
		minDate: "1",
		maxDate: "+11m",
		changeFirstDay: false
	});

	$('#h_CheckInDate').change(function(){
		$('#ImgLoader').show();
		$.post('/date_add.php', { date: $(this).val(), days: 1 }, function(data) {
		  $('#h_CheckOutDate').val(data);
		  $('#ImgLoader').hide();
		});
	});
	
	$('#h_RoomCount').change(function(){
		var rooms = $(this).val();
		$('#ImgLoader').show();
		$.post('/get_occupancy.php', { action: 'list', rooms: rooms }, function(data) {
		  $('#ListOccupancy').html(data);
		  $('#ImgLoader').hide();
		});
	});

	$('#ts_departure_date').datepicker(
    {
        showOn: "both",
        //beforeShow: customRange,
        dateFormat: "mm/dd/yy",
        firstDay: 0,
		minDate: "1",
		maxDate: "+11m",
        changeFirstDay: false
    });
	
	$.post('/get_ts_destinations.php', function(data) {
	  $('#ts_destination_cont').html(data);
	});

});
//-->

