var TAB_NAMES=new Array("flight-finder-tab","car-finder-tab","hotel-finder-tab","vacation-finder-tab");

/////////////////////////////////////////////////////////////
// Reload calendar for the flight form , and set the tab
/////////////////////////////////////////////////////////////
function reloadFlights() {
    CAL_FORM="flight-finder-form";
    LEAVING_YEAR="leaving-year";
    LEAVING_MONTH="leaving-month";
    LEAVING_DAY="leaving-day";
    LEAVING_DATE="leaving-date";
    LEAVING_TIME="leaving-time";
    RETURNING_YEAR="returning-year";
    RETURNING_MONTH="returning-month";
    RETURNING_DAY="returning-day";
    RETURNING_DATE="returning-date";
    RETURNING_TIME="returning-time";
    document.getElementById("flightBookingTab").value="flight";
}

/////////////////////////////////////////////////////////////
// Reload calendar for the car form, and set the tab
/////////////////////////////////////////////////////////////
function reloadCars() {
	CAL_FORM="car-finder-form";
	LEAVING_YEAR="pickup-year";
	LEAVING_MONTH="pickup-month";
	LEAVING_DAY="pickup-day";
	RETURNING_YEAR="dropoff-year";
	RETURNING_MONTH="dropoff-month";
	RETURNING_DAY="dropoff-day";
	document.getElementById("carBookingTab").value="car";
}

/////////////////////////////////////////////////////////////
// Reload calendar for the hotel form, and set the tab
/////////////////////////////////////////////////////////////
function reloadHotels() {
	CAL_FORM="hotel-finder-form";
	LEAVING_YEAR="check-in-year";
	LEAVING_MONTH="check-in-month";
	LEAVING_DAY="check-in-day";
	RETURNING_YEAR="check-out-year";
	RETURNING_MONTH="check-out-month";
	RETURNING_DAY="check-out-day";
	document.getElementById("hotelBookingTab").value="hotel";
}

/////////////////////////////////////////////////////////////
// Reload calendar for the vacation form, and set the tab
/////////////////////////////////////////////////////////////
function reloadVacations() {
	CAL_FORM="vacation-finder-form";
	LEAVING_YEAR="vacation-leaving-year";
	LEAVING_MONTH="vacation-leaving-month";
	LEAVING_DAY="vacation-leaving-day";
	RETURNING_YEAR="vacation-returning-year";
	RETURNING_MONTH="vacation-returning-month";
	RETURNING_DAY="vacation-returning-day";
	document.getElementById("vacationBookingTab").value="vacation";
}

// Added by GAVS - 30Sep08 - ski.com - Start
/////////////////////////////////////////////////////////////
// Load the Ski page in the current window, replacing f9 page
/////////////////////////////////////////////////////////////
function reloadSki() {
    window.location.href =  "http://www.frontierskivacations.com";       
}
// Added by GAVS - 30Sep08 - ski.com - End

/////////////////////////////////////////////////////////////
// Show the console form by the given name
/////////////////////////////////////////////////////////////
function showConsoleFormNamed(form_name) {
    if (form_name && form_name != 'null') {
        // Display content.
        var flight_finder_ads = document.getElementById('flight-finder-buckets');
        var full_form_name = form_name + '-console';
        var console = document.getElementById('console');
        var items = console.getElementsByTagName("div");

        /**
         * Added By: Billy Bacon
         * Date: 10-May-2007
         * Minor hack :-) put in place here so that we can re-use the flight finder
         * widget form. Hide the Flight Finder ads to the right of the widget when the
         * Flight Finder tab is active, otherwise hide the ads.
         */
        if(form_name == 'flight-finder') {
           flight_finder_ads.style.display = "block";
           flight_finder_ads.visibility = "visible";
        } else {
           flight_finder_ads.style.display = "none";
           flight_finder_ads.visibility = "hidden";
        }

        for(i=0;i<items.length;i++){
            var form_obj = items[i];
            if (form_obj.className == "console-form-container") {
                if (form_obj.id == full_form_name) {
                    form_obj.style.display = "block";
                    form_obj.style.visibility = "visible";
                } else {
                    form_obj.style.display = "none";
                    form_obj.style.visibility = "hidden";
                }
            }
        }

        // Select tab.
        var tab_name = form_name + "-tab";
        for(i=0;i<TAB_NAMES.length;i++){
            var tab = TAB_NAMES[i];
            var element = document.getElementById(tab);
            if (element == null) {
                continue;
            }
            if (tab == tab_name) {
                element.style.visibility="hidden";
            } else {
                document.getElementById(tab).style.visibility="visible";
            }
        }
    }
}
