window.onUnload = function()
{
    //apppends a query string to the href of a link,
    //adding the OAC to all FORMs and LINKs on the page.
    BodyLoadHandler();	
}

// Function Name: onload
// Purpose: preforms init page functionality
// Parameters: None
// Return: None
window.onload = function()
{	
    //apppends a query string to the href of a link,
    //adding the OAC to all FORMs and LINKs on the page.
    BodyLoadHandler();
    
    // gsXXX variables declared and defined at top of resTool.asp, prior
    // to the include declaration for this script	
    initSearchParameters();
	
    document.getElementById("submitReal").style.display = "block";
    document.getElementById("submitFake").style.display = "none";
	
    //sets initial values for gsNumTravelers if no changes are made to default config (1 room, 2 adults, no children)
    RoomValues.createPipeDelimitedStrings();	
}
 
    
// Function Name: initSearchParameters
// Purpose: Grabs parameters that were setup through request variables and configures ResTool
// Parameters: None
// Return: None
function initSearchParameters()
{
    if(gsVacationType == "")
    {
        gsVacationType = CommonResTool.currentComponentOrder;
    }
   
    // OLD
    // populate origin dropdown
    //CommonResTool.initOrigin(gsOrigin, gsVacationType);
    // populate destination dropdown
    //CommonResTool.initDestination(gsDestination);
    
    // NEW
    //CommonResTool.initOriginDestination(gsOrigin, gsDestination, gsVacationType, "hotel");
    
    // prefill departure date text box
    CommonResTool.initDate(gsDepartureDate, "depart");
    // prefill departure date text box
    CommonResTool.initDate(gsReturnDate, "return");
    // populate default number of travelers, or user selections being returned by the booking engine (IF postNumberOfTravelers has value)
    if ( gsNumberOfTravelers != "" )
    {
        CommonResTool.initTravelers(gsNumberOfTravelers, gsAge1, gsAge2, gsAge3, gsAge4);
    }
    // populate promo code (IF postPromotionCode has value) 
    if ( gsPromotionCode != "" )
    {
        CommonResTool.initGenericField(gsPromotionCode, "gsPromotionCode", "text");
    } 
}

