;/**
 * As form code for Calypso and Quickbeds is contained with et.calypso.js and et.calypso.js, this 
 * file contains functionality to control the display of these forms as well as activating select boxes 
 * which on change, redirects to a search page for that destination on Quickbeds
 */ 
ET.ACCOMMODATION = 
{
    init: function()
    {
        ET.ACCOMMODATION.formChooserSetup();
        ET.ACCOMMODATION.accommodationContentFormSetup();
        ET.TABS.init($('#holidaysAccomTopPageTabs'));
    },
    
    /**
     * Control showing Last Minute (Quckbeds) or Year-round (Calypso) search forms
     * where clicks for international accommodation take the user to Octpus travel
     */
    formChooserSetup: function()
    {
        $('#ac_ausDestinationsRadio').attr('checked', 'checked');
        $('#ac_lastMinuteRadio').attr('checked', 'checked');

        $('#ac_intDestinationsRadio').bind('click', function()
        {
            window.open('http://www.octopustravel.com/au/Enter.jsp?siteid=holidayau', '_blank');
        });
        
        $('#ac_lastMinuteRadio').bind('click', function()
        {
            $('#cdp_calypsoForm').addClass('hide');
            $('#qb_quickBedsForm').removeClass('hide');
        });
        
        $('#ac_yearRoundRadio').bind('click', function()
        {
            //$('#qb_quickBedsForm').addClass('hide');
            //$('#cdp_calypsoForm').removeClass('hide');
            window.open('http://www.octopustravel.com/au/Enter.jsp?siteid=holidayau', '_blank');
        });   
    },
    
    /**
     * On accomodatio home page, take user to Quickbeds search page for selected destination
     */
    accommodationContentFormSetup: function()
    {
        $(document).ready(function()
        {
            $('#ausHotelsSelect select, #lastminhotel').bind('change', function()
            {
                var destination = $(this).find('option:selected').val();
                if(destination)
                {
                    window.location.href = destination;
                }
            });
        });
    }
};
ET.ACCOMMODATION.init();
