﻿function DeselectSupplement(supplementID, hotelID) {
    var SliderDiv = document.getElementById('SliderDivClientId').value;
    TransitionForCallback(SliderDiv, 'in', 'slider');

    var strUrlParams = 'cb=CallbackSupplementsOnSlider&arg=' + supplementID.toString() + '&SliderDiv=' + SliderDiv + '&HotelPkey=' + hotelID;
    Ajax_Send_W(strUrlParams, AfterCallbackDeselectSupplement);
}

function AfterCallbackDeselectSupplement() {
    var str = Ajax_Receive();

    if (str != null && str != "") {
        var Res = str.split('&|&|&');
        if (Res.length >= 1) {
            var SliderDiv = document.getElementById('SliderDivClientId').value;
            document.getElementById(Res[0]).innerHTML = Res[1];
            tb_init('a.thickboxCalculationOverviewHotelPage');
            TransitionForCallback(SliderDiv, 'out', 'slider');

            if (document.getElementById('hidSuppCheckBoxClientId'))
                document.getElementById(document.getElementById('hidSuppCheckBoxClientId').value).checked = false;
            updateQueryString(Res[3]);
        }
    }
}

function CallbackGetSupplement(HotelID, SuppPkey) {
    var extrasClientId = document.getElementById('ExtrasClientId').value;

    var strUrlParams = 'cb=CallBackGetSupplement&h=' + HotelID + '&SuppPkey=' + SuppPkey +
        '&ExtrasCliendId=' + extrasClientId;

    Ajax_Send_W(strUrlParams, AfterCallbackGetSupplement);
}

function AfterCallbackGetSupplement() {
    var str = Ajax_Receive();
    if (str != "") {
        var Res = str.split('&|&|&');

        if (Res.length >= 1) {
            //alert(Res.length);
            //Res[0],Res[1] - Supplement

            document.getElementById(Res[0]).innerHTML = Res[1];
        }
        return false;
    }
}

function ResizeAndHideSupplementDivs(showMap, selectTab, NrOfTabs) {
    //alert('b');
    if (showMap == 'true') {
        ResetMapToDefaultSupplement();
        setTimeout("ResetMapToDefaultSupplement();", 100);
    }

    //Display the selected tab
    SelectSupplementTabW(selectTab, NrOfTabs);
}



/*Written by Liviu Lica - 2008.09.17*/
/*It changes the name of the first item in the Order By DropDown from Sort to the correct transalation*/
/*Function is called onfocus*/
function showOrderByValues() {
    var ddlOrder = document.getElementById(document.getElementById('hidOrderByDropDownListClientId').value);
    var ddlOrderText = document.getElementById('hidOrderByDropDownListTransaltion').value;

    ddlOrder.options[0].text = ddlOrderText;
    return false;
}

/*Written by Liviu Lica - 2008.09.17*/
/*It changes the name of the first item in the Order By DropDown to Sort, if the user did not filter*/
/*Function is called onblur and when the DropDown is first rendered*/
function showOrderBySortText() {
    if (document.getElementById("hidListSorted")) {
        if (document.getElementById("hidListSorted").value != "true") {
            var ddlOrder = document.getElementById(document.getElementById('hidOrderByDropDownListClientId').value);
            var ddlOrderSort = document.getElementById('hidOrderByDropDownListSortTransaltion').value;
            ddlOrder.options[0].text = ddlOrderSort;
        }
    }
    return false;
}


function launchSupplementsOrderByCallback(OrderBy, calculatingTranslation, h) 
{
    TransitionForCallback('CallbackAllExtrasDiv', 'in', 'ExtrasOverview');

    //Used for te OrderBy drop dwn (check the AllExtrasAndUpgrades Component         
    document.getElementById('hidListSorted').value = 'true';
    Ajax_Send_Supplements_W('OrderBy&type=' + OrderBy.toString() + '&h=' + h.toString(), afterCallbackSupplementsPages);
}

function afterCallbackSupplementsPages() {
    //alert('After Callback');
    var str = Ajax_Receive();

    if (str != null && str != "") 
    {
        TransitionForCallback('CallbackAllExtrasDiv', 'out', 'ExtrasOverview');
        document.getElementById('CallbackAllExtrasDiv').innerHTML = str;
        setTimeout("tb_init('a.thickboxSupplementOverviewLinkToDetails');", 50);       
    }
}

function launchSupplementsPageSizeCallback(strPageSize, calculatingTranslation, h) 
{
    TransitionForCallback('CallbackAllExtrasDiv', 'in', 'ExtrasOverview');
    Ajax_Send_Supplements_W('PageSize&ps=' + strPageSize.toString() + '&h=' + h.toString(), afterCallbackSupplementsPages);
}

function afterCallbackChangePageSupplementsPages() {
    var str = Ajax_Receive();

    if (str != null && str != "") {
        TransitionForCallback('CallbackAllExtrasDiv', 'out', 'ExtrasOverview');
        document.getElementById('CallbackAllExtrasDiv').innerHTML = str; 
        setTimeout("tb_init('a.thickboxSupplementOverviewLinkToDetails');", 50);     
    }
}

function launchSupplementsChangePageCallback(changePage, calculatingTranslation, h) 
{
    TransitionForCallback('CallbackAllExtrasDiv', 'in', 'ExtrasOverview');
    Ajax_Send_Supplements_W('ChangePage&cp=' + changePage.toString() + '&h=' + h.toString(), afterCallbackChangePageSupplementsPages);
}

////////////////////////////////Supplement Callback//////////

function AddSupplement(HotelID, SuppPkey, Theme) {    
    var PersonsTextBoxClientID = document.getElementById('hidPersonsTextBoxClientID').value;    
    var NightsTextBoxClientID = document.getElementById('hidNightsTextBoxClientID').value;
    var RoomsTextBoxClientID = document.getElementById('hidRoomsTextBoxClientID').value;
    var HoursTextBoxClientID = document.getElementById('hidHoursTextBoxClientID').value;
    var PiecesTextBoxClientID = document.getElementById('hidPiecesTextBoxClientID').value;
    var DateDropDownListClientID = document.getElementById('hidDateDropDownListClientID').value;
    
    callbackSupplementDetails(
        'Add;true' +
        ';Persons;' + document.getElementById(PersonsTextBoxClientID).value +
        ';Nights;' + document.getElementById(NightsTextBoxClientID).value +
        ';Rooms;' + document.getElementById(RoomsTextBoxClientID).value +
        ';Hours;' + document.getElementById(HoursTextBoxClientID).value +
        ';Pieces;' + document.getElementById(PiecesTextBoxClientID).value +
        ';Date;' + (document.getElementById(DateDropDownListClientID).options.length > 0 ? document.getElementById(DateDropDownListClientID).options[document.getElementById(DateDropDownListClientID).selectedIndex].text : '01-01-2000') +
        ';Add;1;'
        , HotelID.toString()
        , SuppPkey.toString()
        , Theme.toString()
        , 'Add');    
}


function PesonsTextBoxEvent(HotelID, SuppPkey, Theme) {
        
    var PersonsTextBoxClientID = document.getElementById('hidPersonsTextBoxClientID').value;
    var SelectCheckBoxClientID = document.getElementById('hidSelectCheckBoxClientID').value;
    var NightsTextBoxClientID = document.getElementById('hidNightsTextBoxClientID').value;
    var RoomsTextBoxClientID = document.getElementById('hidRoomsTextBoxClientID').value;
    var HoursTextBoxClientID = document.getElementById('hidHoursTextBoxClientID').value;
    var PiecesTextBoxClientID = document.getElementById('hidPiecesTextBoxClientID').value;
    var DateDropDownListClientID = document.getElementById('hidDateDropDownListClientID').value;

    if (document.getElementById(PersonsTextBoxClientID).value != '') {
        callbackSupplementDetails(
            'Persons;true' +
            ';Persons;' + document.getElementById(PersonsTextBoxClientID).value +
            ';Nights;' + document.getElementById(NightsTextBoxClientID).value +
            ';Rooms;' + document.getElementById(RoomsTextBoxClientID).value +
            ';Hours;' + document.getElementById(HoursTextBoxClientID).value +
            ';Pieces;' + document.getElementById(PiecesTextBoxClientID).value +
            ';Date;' + (document.getElementById(DateDropDownListClientID).options.length > 0 ? document.getElementById(DateDropDownListClientID).options[document.getElementById(DateDropDownListClientID).selectedIndex].text : '01-01-2000') +
            ';Booking;1;'
            , HotelID.toString()
            , SuppPkey.toString()
            , Theme.toString()
            , 'Persons');
    }
}


function NightsTextBoxEvent(HotelID, SuppPkey, Theme) {
        
    var PersonsTextBoxClientID = document.getElementById('hidPersonsTextBoxClientID').value;
    var SelectCheckBoxClientID = document.getElementById('hidSelectCheckBoxClientID').value;
    var NightsTextBoxClientID = document.getElementById('hidNightsTextBoxClientID').value;
    var RoomsTextBoxClientID = document.getElementById('hidRoomsTextBoxClientID').value;
    var HoursTextBoxClientID = document.getElementById('hidHoursTextBoxClientID').value;
    var PiecesTextBoxClientID = document.getElementById('hidPiecesTextBoxClientID').value;
    var DateDropDownListClientID = document.getElementById('hidDateDropDownListClientID').value;

    if (document.getElementById(PersonsTextBoxClientID).value != '') {
        callbackSupplementDetails(
            'Nights;true' +
            ';Persons;' + document.getElementById(PersonsTextBoxClientID).value +
            ';Nights;' + document.getElementById(NightsTextBoxClientID).value +
            ';Rooms;' + document.getElementById(RoomsTextBoxClientID).value +
            ';Hours;' + document.getElementById(HoursTextBoxClientID).value +
            ';Pieces;' + document.getElementById(PiecesTextBoxClientID).value +
            ';Date;' + (document.getElementById(DateDropDownListClientID).options.length > 0 ? document.getElementById(DateDropDownListClientID).options[document.getElementById(DateDropDownListClientID).selectedIndex].text : '01-01-2000') +
            ';Booking;1;'
            , HotelID.toString()
            , SuppPkey.toString()
            , Theme.toString()
            , 'Nights');
    }
}


function RoomsTextBoxEvent(HotelID, SuppPkey, Theme, Max) {
        
    var PersonsTextBoxClientID = document.getElementById('hidPersonsTextBoxClientID').value;
    var SelectCheckBoxClientID = document.getElementById('hidSelectCheckBoxClientID').value;
    var NightsTextBoxClientID = document.getElementById('hidNightsTextBoxClientID').value;
    var RoomsTextBoxClientID = document.getElementById('hidRoomsTextBoxClientID').value;
    var HoursTextBoxClientID = document.getElementById('hidHoursTextBoxClientID').value;
    var PiecesTextBoxClientID = document.getElementById('hidPiecesTextBoxClientID').value;
    var DateDropDownListClientID = document.getElementById('hidDateDropDownListClientID').value;

    if (document.getElementById(PersonsTextBoxClientID).value != '') {
        callbackSupplementDetails(
            'Rooms;true' +
            ';Persons;' + document.getElementById(PersonsTextBoxClientID).value +
            ';Nights;' + document.getElementById(NightsTextBoxClientID).value +
            ';Rooms;' + document.getElementById(RoomsTextBoxClientID).value +
            ';Hours;' + document.getElementById(HoursTextBoxClientID).value +
            ';Pieces;' + document.getElementById(PiecesTextBoxClientID).value +
            ';Date;' + (document.getElementById(DateDropDownListClientID).options.length > 0 ? document.getElementById(DateDropDownListClientID).options[document.getElementById(DateDropDownListClientID).selectedIndex].text : '01-01-2000') +
            ';MaxRooms;' + Max.toString() + ';'
            , HotelID.toString()
            , SuppPkey.toString()
            , Theme.toString()
            , 'Rooms');
    }
}

function HoursTextBoxEvent(HotelID, SuppPkey, Theme) {
       
    var PersonsTextBoxClientID = document.getElementById('hidPersonsTextBoxClientID').value;
    var SelectCheckBoxClientID = document.getElementById('hidSelectCheckBoxClientID').value;
    var NightsTextBoxClientID = document.getElementById('hidNightsTextBoxClientID').value;
    var RoomsTextBoxClientID = document.getElementById('hidRoomsTextBoxClientID').value;
    var HoursTextBoxClientID = document.getElementById('hidHoursTextBoxClientID').value;
    var PiecesTextBoxClientID = document.getElementById('hidPiecesTextBoxClientID').value;
    var DateDropDownListClientID = document.getElementById('hidDateDropDownListClientID').value;

    if (document.getElementById(PersonsTextBoxClientID).value != '') {
        callbackSupplementDetails(
            'Hours;true' +
            ';Persons;' + document.getElementById(PersonsTextBoxClientID).value +
            ';Nights;' + document.getElementById(NightsTextBoxClientID).value +
            ';Rooms;' + document.getElementById(RoomsTextBoxClientID).value +
            ';Hours;' + document.getElementById(HoursTextBoxClientID).value +
            ';Pieces;' + document.getElementById(PiecesTextBoxClientID).value +
            ';Date;' + (document.getElementById(DateDropDownListClientID).options.length > 0 ? document.getElementById(DateDropDownListClientID).options[document.getElementById(DateDropDownListClientID).selectedIndex].text : '01-01-2000') +
            ';Booking;1;'
            , HotelID.toString()
            , SuppPkey.toString()
            , Theme.toString()
            , 'Hours');
    }
}

function PiecesTextBoxEvent(HotelID, SuppPkey, Theme) {
        
    var PersonsTextBoxClientID = document.getElementById('hidPersonsTextBoxClientID').value;
    var SelectCheckBoxClientID = document.getElementById('hidSelectCheckBoxClientID').value;
    var NightsTextBoxClientID = document.getElementById('hidNightsTextBoxClientID').value;
    var RoomsTextBoxClientID = document.getElementById('hidRoomsTextBoxClientID').value;
    var HoursTextBoxClientID = document.getElementById('hidHoursTextBoxClientID').value;
    var PiecesTextBoxClientID = document.getElementById('hidPiecesTextBoxClientID').value;
    var DateDropDownListClientID = document.getElementById('hidDateDropDownListClientID').value;

    if (document.getElementById(PersonsTextBoxClientID).value != '') {
        callbackSupplementDetails(
            'Hours;true' +
            ';Persons;' + document.getElementById(PersonsTextBoxClientID).value +
            ';Nights;' + document.getElementById(NightsTextBoxClientID).value +
            ';Rooms;' + document.getElementById(RoomsTextBoxClientID).value +
            ';Hours;' + document.getElementById(HoursTextBoxClientID).value +
            ';Pieces;' + document.getElementById(PiecesTextBoxClientID).value +
            ';Date;' + (document.getElementById(DateDropDownListClientID).options.length > 0 ? document.getElementById(DateDropDownListClientID).options[document.getElementById(DateDropDownListClientID).selectedIndex].text : '01-01-2000') +
            ';Booking;1;'
            , HotelID.toString()
            , SuppPkey.toString()
            , Theme.toString()
            , 'Pieces');
    }
}

function SelectCheckBoxTextBoxEvent(HotelID, SuppPkey, Theme) {
        
    var PersonsTextBoxClientID = document.getElementById('hidPersonsTextBoxClientID').value;
    var SelectCheckBoxClientID = document.getElementById('hidSelectCheckBoxClientID').value;
    var NightsTextBoxClientID = document.getElementById('hidNightsTextBoxClientID').value;
    var RoomsTextBoxClientID = document.getElementById('hidRoomsTextBoxClientID').value;
    var HoursTextBoxClientID = document.getElementById('hidHoursTextBoxClientID').value;
    var PiecesTextBoxClientID = document.getElementById('hidPiecesTextBoxClientID').value;
    var DateDropDownListClientID = document.getElementById('hidDateDropDownListClientID').value;

    if (document.getElementById(PersonsTextBoxClientID).value != '') {
        callbackSupplementDetails(
            'Supplement;true' +
            ';Persons;' + document.getElementById(PersonsTextBoxClientID).value +
            ';Nights;' + document.getElementById(NightsTextBoxClientID).value +
            ';Rooms;' + document.getElementById(RoomsTextBoxClientID).value +
            ';Hours;' + document.getElementById(HoursTextBoxClientID).value +
            ';Pieces;' + document.getElementById(PiecesTextBoxClientID).value +
            ';Date;' + (document.getElementById(DateDropDownListClientID).options.length > 0 ? document.getElementById(DateDropDownListClientID).options[document.getElementById(DateDropDownListClientID).selectedIndex].text : '01-01-2000') +
            ';'
            , HotelID.toString()
            , SuppPkey.toString()
            , Theme.toString()
            , 'checkbox');
    }
}

function DateTextBoxEvent(HotelID, SuppPkey, Theme) {
        
    var PersonsTextBoxClientID = document.getElementById('hidPersonsTextBoxClientID').value;
    var SelectCheckBoxClientID = document.getElementById('hidSelectCheckBoxClientID').value;
    var NightsTextBoxClientID = document.getElementById('hidNightsTextBoxClientID').value;
    var RoomsTextBoxClientID = document.getElementById('hidRoomsTextBoxClientID').value;
    var HoursTextBoxClientID = document.getElementById('hidHoursTextBoxClientID').value;
    var PiecesTextBoxClientID = document.getElementById('hidPiecesTextBoxClientID').value;
    var DateDropDownListClientID = document.getElementById('hidDateDropDownListClientID').value;

    if (document.getElementById(PersonsTextBoxClientID).value != '') {
        callbackSupplementDetails(
            'SelectedDate;true' +
            ';Persons;' + document.getElementById(PersonsTextBoxClientID).value +
            ';Nights;' + document.getElementById(NightsTextBoxClientID).value +
            ';Rooms;' + document.getElementById(RoomsTextBoxClientID).value +
            ';Hours;' + document.getElementById(HoursTextBoxClientID).value +
            ';Pieces;' + document.getElementById(PiecesTextBoxClientID).value +
            ';Date;' + (document.getElementById(DateDropDownListClientID).options.length > 0 ? document.getElementById(DateDropDownListClientID).options[document.getElementById(DateDropDownListClientID).selectedIndex].text : '01-01-2000') +
            ';'
            , HotelID.toString()
            , SuppPkey.toString()
            , Theme.toString()
            , 'SelectedDate');
    }
}

function callbackSupplementDetails(eventArgs, h, supp, theme, type) 
{   
    var AddButton = document.getElementById('hidExtrasBookNowDiv').value;    
     
    if (document.getElementById(AddButton).style.display == 'block' && type == 'SelectedDate') 
    {    
        Ajax_Send_Supplements_W('CheckAvailability&supp=' + supp.toString()
                + '&h=' + h.toString()
                + '&theme=' + theme.toString()
                + '&args=' + eventArgs.toString()
                + '&type=' + type.toString()
                , afterCallbackSupplementAvailability);
    }
    else 
    {
        var SliderDiv = document.getElementById('SliderDivClientId').value;

        Ajax_Send_Supplements_W('SupplementDetails&supp=' + supp.toString()
                + '&h=' + h.toString() + '&theme=' + theme.toString()
                + '&args=' + eventArgs.toString()
                + '&type=' + type.toString()
                + '&SliderDivClientID=' + SliderDiv.toString()
                , afterCallbackSupplementDetails);
    }    
}

function afterCallbackSupplementAvailability() {
    var str = Ajax_Receive();

    if ((str != null) && (str != "")) {
        //alert('After Callback= ' + str);
        document.getElementById(document.getElementById('hidIsAvailableCheckBoxID').value).checked = str;
        if (str == 'true') {
            //alert('true');
            document.getElementById(document.getElementById('hidIsAvailableLabelID').value).style.display = 'block';
            document.getElementById(document.getElementById('hidIsNotAvailableLabelID').value).style.display = 'none';
        }
        else {
            //alert('false');
            document.getElementById(document.getElementById('hidIsAvailableLabelID').value).style.display = 'none';
            document.getElementById(document.getElementById('hidIsNotAvailableLabelID').value).style.display = 'block';
        }
    }

    //alert('aici5');   
}

function afterCallbackSupplementDetails() {
    //alert('After Callback');
    var str = Ajax_Receive();
    //alert('aici');

    if ((str != null) && (str != "")) {
        var param = str.split('&|&|&');
        //alert(param.length);

        //alert('aici3');
        if ((param[1] != null) && (param[2] != "")) 
        {
            //alert(param[2]); 
            if (param[1] == 'true') {
                //alert('TRUE');
                document.getElementById(document.getElementById('hidSuppCheckBoxClientId').value).checked = true;
            }
            else {
                //alert('FALSE');
                document.getElementById(document.getElementById('hidSuppCheckBoxClientId').value).checked = false;
            }        
        }

        if ((param[0] != null) && (param[0] != "")) 
        {           
            var current_QueryString = location.href.toString();
            var index = current_QueryString.lastIndexOf('/') + 1;
            current_QueryString = current_QueryString.substring(index + 30, location.href.toString().length);


            // warnings[0] - holds the warning messages
            // warnings[1] - indicates if there are any messages related to the trave details filled in on Hotel Page

            var warnings = param[0].split('#')

            if (warnings[0] == "OK") 
            {
                ExtrasShowBookOrRemoveButton('remove');
                ExtrasDetailsMessage('show');

                if ((param[3] != null) && (param[4] != "")) {
                    //alert(param[3]);
                    //alert(param[4]);
                    document.getElementById(param[3]).innerHTML = param[4];
                }

                //alert('a');
                if ((param[5] != null) && (param[6] != null)) {
                    //alert(param[6]);
                    updateQueryString(param[6]);
                }

                tb_init('a.thickboxCalculationOverviewHotelPage');
                //alert('Supplement Was Added');
                return false;
            }
            else 
            {
                if ((warnings[1] != null) && (warnings[1] != '')) {
                    //alert(warnings[1]);
                    if (warnings[1] == 'false') //It means we have to tell the user to go to Hotel Page - show popup
                    {
                        alert(warnings[0])                       
                    }
                    else {
                        //alert('22');   
                        alert(warnings[0]); //Just show the warnings as these don't concern the hotel Page                                              
                    }
                }
                else
                    alert(param[0]); //Just show what you have

                return false;
            }
        }
    }
}

function callbackCheckData() {
    //alert('aici');
    var hotelID = (document.getElementById('hidHotelID').value).toString();
    var suppID = (document.getElementById('hidSuppID').value).toString();
    var ddlID;
    var ddlDate;

    try {
        ddlID = document.getElementById('hidDateDropDownID').value;
        ddlDate = (document.getElementById(ddlID).options.length > 0 ? document.getElementById(ddlID).options[document.getElementById(ddlID).selectedIndex].text : '01-01-2000').toString();
    }
    catch (ex) { ddlDate = '01-01-2000' }

    Ajax_Send_Supplements_W('CheckData' + '&h=' + hotelID + '&supp=' + suppID + '&date=' + ddlDate
                , afterCallbackCheckData);
}



function afterCallbackCheckData() {
    //alert('After afterCallbackCheckData');
    var str = Ajax_Receive();
    //alert('str - ' + str);
    if ((str != null) && (str != "")) {
        //alert('str - ' + str);
        // warnings[0] - holds the warning messages
        // warnings[1] - indicates if there are any messages related to the trave details filled in on Hotel Page

        //var warnings = param[0].split('#')   
        var warnings = str.split('#')

        if (warnings[0] == "OK") {
            ExtrasShowBookOrRemoveButton('remove');
            ExtrasDetailsMessage('show');
            return false;
        }
        else {
            if ((warnings[1] != null) && (warnings[1] != '')) {
                //alert(warnings[1]);
                if (warnings[1] == 'false') //It means we have to tell the user to go to Hotel Page - show popup
                {
                    alert(warnings[0]);
                }
                else {
                    alert(warnings[0]); //Just show the warnings as these don't concern the hotel Page                                              
                }
            }
            else
                alert(str); //Just show what you have

            return false;
        }
    }
}

function ClickSupplement(HotelID) {
    //alert('ClickSupplement');
    var check = eval(document.getElementById(document.getElementById('hidSuppCheckBoxClientId').value).checked);

    if (check)
        callbackCheckData();
    else
        document.getElementById(document.getElementById('hidSuppCheckBoxClientId').value).click();
}

function ExtrasShowBookOrRemoveButton(button)
{
    var AddButton = document.getElementById('hidExtrasBookNowDiv').value;
    var RemoveButton = document.getElementById('hidExtrasRemoveSupplementDiv').value;

    //alert(AddButton);
    //alert(RemoveButton);
    
    if (button == 'add')
    {
        document.getElementById(AddButton).style.display = 'block';
        document.getElementById(RemoveButton).style.display = 'none';
    }

    if (button == 'remove')
    {
        //alert(button);
        document.getElementById(AddButton).style.display = 'none';
        document.getElementById(RemoveButton).style.display = 'block';
    }
    
    return false;
}

function ExtrasDetailsMessage(dirrection) 
{
    //alert(dirrection);
    var MessageDivId = 'ExtrasDetailsMessageDiv';

    var sPath = '';
    var sPage = '';

    try {
        sPath = window.location.pathname;
        sPage = sPath.substring(sPath.lastIndexOf('/') + 1).replace(".aspx", "");
        if (sPage == null)
            sPage = '';

        //alert(sPage);
    }
    catch (ex) { }

    if (sPage.indexOf('BookExtrasOverviewW') >= 0)
        MessageDivId = 'ExtrasDetailsBS2PageMessageDiv';
    
    
    if (dirrection == 'show') 
    {
        
        document.getElementById('ExtrasDetailsContentDiv').style.display = 'none';
        document.getElementById(MessageDivId).style.display = 'block';       
    }
    
    if (dirrection == 'hide') 
    {
        document.getElementById('ExtrasDetailsContentDiv').style.display = 'block';
        document.getElementById(MessageDivId).style.display = 'none';
    }

    return false;
}

var PageSelected = "GoOverview";

function GoToPage(HotelID) 
{
    var current_QueryString = unescape(location.search.substr(1));
    //var theHash = window.location.hash;
    // current_QueryString = current_QueryString.substring(index + 30, location.href.toString().length);
    //alert(current_QueryString+theHash);

    if (PageSelected == "GoOverview") {
        $('#GoToSupplementOverviewPageLink').click();
        //location.href = 'ExtrasAndUpgrades.aspx?' + current_QueryString
    }
    else if (PageSelected == "GoBooking") {
        Callback_GoToBS1(HotelID);
        //location.href = 'BookNeededDataW.aspx?' + current_QueryString + theHash;
    }
    else if (PageSelected == "GoHotel") 
    {
        tb_remove();
    }
}


