$(function(){
  var hoverFunc = function(){$(this).toggleClass("hovered")};
  // langBar
  $("#langBar").hover(hoverFunc, hoverFunc); 
  
  $(".tabsHome").tabs();
  $('#container-1').tabs();
  $(".topics").tabs();
  
  // expand class
  $(".drop").parent("li").addClass("expand");


  var h = $("#topMenu .sep:first").parent().height();
  $("#topMenu .sep").height(h);
})

$(function() {
    var HotelTab = $('div.tabs > div');
    HotelTab.hide().filter(':first').show();

    $('div.tabs ul.HotelTab a').click(function() {
        HotelTab.hide();
        HotelTab.filter(this.hash).show();
        $('div.tabs ul.HotelTab a').removeClass('selected');
        $(this).addClass('selected');
        return false;
    }).filter(':first').click();

    var HotelTAbNav = $('div#first > div');
    HotelTAbNav.hide().filter(':#HotelTabNavMenu1').show();

    $('div#first ul.HotelTAbNav a').click(function() {
        HotelTAbNav.hide();
        HotelTAbNav.filter(this.hash).show();
        $('div#first ul.HotelTAbNav a').removeClass('selected');
        $(this).addClass('selected');
        return false;
    }).filter(':#HotelTabNavMenu1').click();

    var HotelRoomInfo = $('div#HotelTabNavMenu2 > div');
    HotelRoomInfo.hide().filter(':#HotelRoomNavMenu1').show();

    $('div#HotelTabNavMenu2 ul.HotelRoomInfo a').click(function() {
        HotelRoomInfo.hide();
        HotelRoomInfo.filter(this.hash).show();
        $('div#HotelTabNavMenu2 ul.HotelRoomInfo a').removeClass('selected');
        $(this).addClass('selected');
        return false;
    }).filter(':#HotelTabNavMenu2').click();

    var HotelTabPVM = $('div#HotelTabNavMenu1 .HotelLeft > div');
    HotelTabPVM.hide().filter(':#HotelTabActivite').show();

    $('div#HotelTabNavMenu1 ul.HotelTabPVM a').click(function() {
        HotelTabPVM.hide();
        HotelTabPVM.filter(this.hash).show();
        $('div#HotelTabNavMenu1  ul.HotelTabPVM a').removeClass('selected');
        $(this).addClass('selected');
        $('.HotelInfoRight').show();
        $('.HotelLeft').show();
        $('.HotelInfoLeft').show();
        return false;
    }).filter(':#HotelTabPhoto').click();
    $('.HotelInfoRight').show();
    $('.HotelInfoLeft').show();
    $('.HotelLeft').show();
    $('.HotelInfoLeft').show();


});

$(function() {
    $('.bubbleInfo').each(function() {
        var distance = 10;
        var time = 250;
        var hideDelay = 500;

        var hideDelayTimer = null;

        var beingShown = false;
        var shown = false;
        var trigger = $('.trigger', this);
        var info = $('.popup', this).css('opacity', 0);

        $([trigger.get(0), info.get(0)]).mouseover(function() {
            if (hideDelayTimer) clearTimeout(hideDelayTimer);
            if (beingShown || shown) {
                // don't trigger the animation again
                return;
            } else {
                // reset position of info box
                beingShown = true;

                info.css({
                    top: -200,
                    left: -177,
                    display: 'block'
                }).animate({
                    top: '-=' + distance + 'px',
                    opacity: 1
                }, time, 'swing', function() {
                    beingShown = false;
                    shown = true;
                });
            }

            return false;
        }).mouseout(function() {
            if (hideDelayTimer) clearTimeout(hideDelayTimer);
            hideDelayTimer = setTimeout(function() {
                hideDelayTimer = null;
                info.animate({
                    top: '-=' + distance + 'px',
                    opacity: 0
                }, time, 'swing', function() {
                    shown = false;
                    info.css('display', 'none');
                });

            }, hideDelay);

            return false;
        });
    });
});


$(document).ready(function() {
	return;
	var hotelId = "<%= hotelId %>";
	try {
		if (GBrowserIsCompatible()) {
			map = new GMap2(document.getElementById("HotelTabMap"));
			map.addControl(new GLargeMapControl());
			map.addControl(new GMapTypeControl());
			map.setCenter(new GLatLng(20, 0), 13);
			map.enableScrollWheelZoom();
			map.enableDoubleClickZoom();
			GEvent.addListener(map, "click", function(overlay, newPoint) {
				map.panTo(newPoint);
			});

			var url = 'Themes/Detur/GoogleMap/GetHotels.aspx';
			if (hotelId != null)
				url += '?HotelId=' + hotelId;

			$.get(url, function(result) {
				getHotelLocations(result);
				processLocations();
				map.checkResize();
				zoomShowAll();
			});
		}
		$('.HotelTabPVM').bind('tabsshow', function(event, ui) {
			if ($('#HotelTabMap').is(':visible')) {
				map.checkResize();
				map.panTo(point);
			}
		});
	} catch (Error) { }
});

//Jqtransform ie 7 validation bug'ını düzeltmek için hack.
$(document).ready(function () {
	$("form").submit(function () {
		$("button").each(function () {
			//$(this).val(htmlEncode($(this).val()));
			$(this).val('');
			$(this).hide();
		});
	});
});

function htmlEncode(value) {
	return $('<div/>').text(value).html();
}

function htmlDecode(text) {
	return $('<div/>').html(text).text();
}
