﻿//*************************************************************************************
// File     : HotelPopup.js
// Version  : 1.2
// Requires : prototype.js
// Author   : Rusty Swanye (rusty@mindfly.com), Wilfried Mack, Kyle Weems
// Origin   : mindfly.com
// Modified : August 18, 2008
// Purpose  : Functions for use with the Hotel Popup.
//*************************************************************************************

// Global variables
var poppedMap = "";


function showAmenityRateBlock(div_id, map_info)
{
    div = document.getElementById(div_id);
    if(div.style.display == 'none')
    {
        div.style.display = '';
        poppedMap = map_info;
    }
    else
    {
        div.style.display = 'none';
    }
    
    // Set up the gallery for the popup.
    if ($$('div#' + div_id + ' .popupImage')[0]) {
        $$('div#' + div_id + " .popupMainImage")[0].src = $$('div#' + div_id + ' .popupImage')[0].src;
        var popupImages = $$('div#' + div_id + ' .popupImage');
        for (i = 0; i < popupImages.length; i++) {
            var thisImage = popupImages[i];
            Event.observe(thisImage, 'click', function(event) {
                var element = Event.element(event);
                parentElements = element.ancestors();
                siblingElements = parentElements[0].childElements();
                siblingElements[0].src = element.src;
            }); 
        }

    }
    else {
        $$('div#' + div_id + " .popupMainImage")[0].setStyle({ display: 'none' });
    }
    
} // end of function showAmenityRateBlock()


function closeMapDiv()
{
    div = document.getElementById('mapPlaceholder');
    if(div.style.display == 'none')
    {
        div.style.display = '';
    }
    else
    {
        div.style.display = 'none';
    }
} // end of function closeMapDiv()