
// Get default Arrival Date
var arrival = new Date(); // Add 14 days
arrival.setDate(arrival.getDate() + 14);

var month = arrival.getMonth() + 1;
var day = arrival.getDate();
var year = arrival.getFullYear();
var full_arrival_date = month + "/" + day + "/" + year;

// Get default Departure Date
var departure = new Date(); // Add 16 days
departure.setDate(departure.getDate() + 16);


var month_departure = departure.getMonth() + 1;
var day_departure = departure.getDate();
var year_departure = departure.getFullYear();
var full_departure_date = month_departure + "/" + day_departure + "/" + year_departure;

// JavaScript departure flights 
var flight_departure = new Date(); // Add 21 days
flight_departure.setDate(flight_departure.getDate() + 21);


var flight_month_departure = flight_departure.getMonth() + 1;
var flight_day_departure = flight_departure.getDate();
var flight_year_departure = flight_departure.getFullYear();
var flight_departure_date = flight_month_departure + "/" + flight_day_departure + "/" + flight_year_departure;

// If Cookie is not set for (Oneway/RoundTrip/Multidestination) then set default value
function loadDateText() {


//    if (getCookie("OneWay") != '' || getCookie("RoundTrip") != '' || getCookie('MultiDestination') != '') {

//        //do something 
//    }
//    else {
    $('#OnewayRoundtrip').show();
    
    $('#OnewayRoundtrip').load('include/roundtrip.html', function(response, status, xhr) {
            if (status == "success") {
                $("#ReturnFlightTR3").show();
                $("#ReturnFlightTR4").show();
                $("#fromcity").val('Airport or City');
                $("#toCity").val('Airport or City');
                $("#flyDate_from").val(full_arrival_date);
                $("#flyDate_return").val(flight_departure_date);
                $('#SearchTypeRoundTrip').attr("checked", "checked");
                $("#newdiv").show();
                $('#flyDate_from').datePickerMultiMonth(
					{
					    numMonths: 2

					}

				);
                $('#flyDate_return').datePickerMultiMonth(
					{
					    numMonths: 2

					}

				);

            }
        });


//             if (document.forms["AirSearchForm"].flyDate_from != null && document.forms["AirSearchForm"].flyDate_from != 'undefined')
//                 document.forms["AirSearchForm"].flyDate_from.value = full_arrival_date;
//               if (document.forms["AirSearchForm"].flyDate_return != null && document.forms["AirSearchForm"].flyDate_return != 'undefined')
//                 document.forms["AirSearchForm"].flyDate_return.value = flight_departure_date;
        if (document.forms["hotSearch"] != null) {
            document.forms["hotSearch"].flyDate_from.value = full_arrival_date;
            document.forms["hotSearch"].flyDate_return.value = full_departure_date;
            document.forms["hotSearch"].departureMonth.value = month_departure;

            document.forms["hotSearch"].departureMonth.value = month_departure;
            document.forms["hotSearch"].departureDay.value = day_departure;
            document.forms["hotSearch"].COYear.value = year;
            document.forms["hotSearch"].arrivalMonth.value = month;
            document.forms["hotSearch"].arrivalDay.value = day;
        }

//    }
}
