/*
 Google Maps Functions

*/

var sidebarMarkers = [];
var sidebarCount   = 0;

function showLocation(i) {
        GEvent.trigger(sidebarMarkers[i], "click");
}

function LocationLink(marker) {
        sidebarMarkers[sidebarCount] = marker;
        sidebarCount ++;
}

/*
Adjust Booking iFrame
*/

function adjustBooking(){
  document.getElementById('booking').style.height = document.getElementById('booking').document.getElementByTagName('html').offsetHeight + 'px';
}



/*
function CreateMarker(map="map.",markerId,latitude,htmls) {

point_markerId = new GLatLng(latitude);
icon_markerId = new GIcon(G_DEFAULT_ICON);
marker_markerId = new GMarker(point_markerId, icon_markerId);
map.addOverlay(marker_markerId);
icon_markerId.infoWindowAnchor = new GPoint(0,0);

GEvent.addListener(marker_markerId, "click", function() { marker_markerId.openInfoWindowHtml(htmls); });

LocationLink(marker_markerId);
}

*/





$(document).ready(function() {


/*
if ( $("#arrive").length > 0 ) {
$('#arrive').datePicker({clickInput:true,createButton:false}).val(new Date().asString()).trigger('change');
}

if ( $("#depart").length > 0 ) {
$('#depart').datePicker({clickInput:true,createButton:false}).val(new Date().asString()).trigger('change');
}
  */


if ( $("#arrive").length > 0 ) {
$(function()
{
        $('#arrive, #depart').datePicker({clickInput:true,createButton:false})
        $('#arrive').bind(
                'dpClosed',
                function(e, selectedDates)
                {
                        var d = selectedDates[0];
                        if (d) {
                                d = new Date(d);
                                $('#depart').dpSetStartDate(d.addDays(1).asString());
                        }
                }
        );
        $('#depart').bind(
                'dpClosed',
                function(e, selectedDates)
                {
                        var d = selectedDates[0];
                        if (d) {
                                d = new Date(d);
                                $('#arrive').dpSetEndDate(d.addDays(-1).asString());
                        }
                }
        );
});



var toDay = new Date();
var tomorrow = new Date();
var nextDate = toDay.getDate() + 1;
tomorrow.setDate(nextDate);

document.room_reservations.arrive.value = toDay.getDate() + "." + (toDay.getMonth() + 1) + "." + toDay.getFullYear();
document.room_reservations.depart.value = tomorrow.getDate() + "." + (tomorrow.getMonth() + 1) + "." + tomorrow.getFullYear();
}




/*
news functions
*/
$(".betrieb-front .news-item:hover").css('cursor', 'pointer');

$(".betrieb-front .news-item").click(function() {
                $(".ce_text",this).slideToggle(); return false;
});

/*
presse functions
*/
$(".presse .news-item h3").css('cursor', 'pointer');

$(".presse .news-item h3").click(function() {
                $(this).next(".ce_text").slideToggle(); return false;
});


/*
general accordion
*/
$(".ce_accordion .toggler").click(function() {
                $(".accordion",this).slideToggle(); return false;
});


/*
zoom functions
*/

var options = {
            zoomWidth: 300,
            zoomHeight: 250,
            xOffset: 10,
            yOffset: 0,
            position: "right" //and MORE OPTIONS
};

if ( $("a.planzoom").length > 0 ) {
$("a.planzoom").jqzoom(options);
}





$(".SalesFolderOn").css("display","none");

$(".SalesFolder input").click(function(){

if ($(".SalesFolder input").is(":checked"))
{
        $(".SalesFolderOn").show("fast");
}
else
{
        $(".SalesFolderOn").hide("fast");
}

});






$(function () {
$("#opt_48_1").attr("checked", true);
});




$(function () {
$("a.reservation,a.feedback").addClass("thickbox");
});

/* Blue Monkey Table Reservation */
$("select.LocationPlace").change(onSelectChange);
$(".SmokerOn").css("display","none");

}); /* end of document ready */


 /* Blue Monkey Table Reservation */
function onSelectChange(){
        var selected = $("select.LocationPlace option:selected");

        if(selected.val() == "Thai Heaven"){
               $(".SmokerOn").show("fast");
        }
        else {
               $(".SmokerOn").hide("fast");
        }

}