String.prototype.trim = function () {return this.replace(/^\s*/, "").replace(/\s*$/, "");}

var timeoutObjectsKey = 1;
var timeoutObjects = new Array();
var timeoutInit = function(ob){if(!ob.timeoutObjects)ob.timeoutObjects=timeoutObjectsKey++;timeoutObjects[ob.timeoutObjects]=ob;clearTimeout(ob.timeOut);}
var slideChildren = function(ob, slideRotateSpeed){
	if(!ob) return;
	ob=timeoutObjects[ob];
	if($('.to-slide:visible', $(ob)).size()==1) $('.to-slide:last', $(ob)).fadeIn(slideRotateSpeed, function(){$('.to-slide', $(this).parents('.slides-container')).show();});
	else $('.to-slide:visible:last', $(ob)).fadeOut(slideRotateSpeed);
}
var slideChildrens = function(ob, slideRotateTimeOut, slideRotateSpeed){
	$(ob).each(function(){
		if ($('.to-slide',this).size() > 1){
			$(this).addClass('slides-container');
			$($.makeArray($('.to-slide:hidden', $(ob))).reverse()).each(function(){$(this).show()});//.show();
			$(this).css('height',$(this).height()+'px');
			$('.to-slide',this).css('position','absolute');
			timeoutInit(this);
			setInterval("slideChildren("+this.timeoutObjects+","+slideRotateSpeed+")",slideRotateTimeOut);
		}
	});
}
var mousestopScroll = function(ob){if(!ob || !(ob=timeoutObjects[ob]) || ($('.to-slide',$(ob)).height()<=$(ob).height()))return;if(!ob)return;ob=timeoutObjects[ob];$('.scroll-trigger',$(ob)).fadeIn().stop();}
var mouseoverScroll = function(ob){if(!ob || !(ob=timeoutObjects[ob]) || ($('.to-slide',$(ob)).height()<=$(ob).height()))return;$('.scroll-trigger',$(ob)).fadeIn().fadeTo('fast',0.9);}
var mouseoutScroll = function(ob){if(!ob || !(ob=timeoutObjects[ob]) || ($('.to-slide',$(ob)).height()<=$(ob).height()))return;$('.scroll-trigger',$(ob)).fadeOut();}
var scrollScroll = function(ob,m,s){if(!ob.m) ob.m=0;ob.min = $(ob.parentNode).height()-$(ob).height();if((ob.m==0 && ob.m+m>0)||(ob.min>ob.m+m && ob.m==ob.min))return;if(ob.m+m>0||ob.min>ob.m+m)ob.m=(ob.m+m>0)?0:ob.min;else ob.m+=m;$(ob).stop().animate({top:ob.m},(s?s:'slow'));}

var mouseblockAreaBox = 0;
var mouseblockArea = 0;
var mousestopAreaBox = function(ob){if(!ob || mouseblockArea)return;ob=timeoutObjects[ob];$(ob).stop();}
var mouseoverAreaBox = function(ob){if(!ob || mouseblockArea || !(ob=timeoutObjects[ob]))return;$('.FindAHotel-absolute').show();$(ob).animate({left:0});}
var mouseoutAreaBox = function(ob){if(!ob || mouseblockArea)return;ob=timeoutObjects[ob];$(ob).animate({left:361},function(){if(!mouseblockArea && !mouseblockAreaBox)$('.FindAHotel-absolute').hide();});}
var mousestopArea = function(ob){if(!ob || mouseblockAreaBox)return;ob=timeoutObjects[ob];if(!$(ob).attr('class'))return;$('.'+$(ob).attr('class'),$(ob.parentNode.parentNode.parentNode.parentNode)).stop();}
var mouseoverArea = function(ob){if(!ob || mouseblockAreaBox || !(ob=timeoutObjects[ob]))return;$('.FindAHotel-absolute').show();if(!$(ob).attr('class'))return;$('.'+$(ob).attr('class'),$(ob.parentNode.parentNode.parentNode.parentNode)).css('z-index',1).animate({left:0});}
var mouseoutArea = function(ob){if(!ob || mouseblockAreaBox)return;ob=timeoutObjects[ob];if(!$(ob).attr('class'))return;$('.'+$(ob).attr('class'),$(ob.parentNode.parentNode.parentNode.parentNode)).css('z-index',0).animate({left:361},function(){if(!mouseblockArea && !mouseblockAreaBox)$('.FindAHotel-absolute').hide();});}

var i=0;
var mouseblockDropDownHotelsDD = false;
var mouseblockDropDownHotels = false;
var mousestopDropDownHotelsDD;
var mouseoverDropDownHotelsDD; 
var mouseoutDropDownHotelsDD;
var mousestopDropDownHotels;
var mouseoverDropDownHotels; 
var mouseoutDropDownHotels;

$(document).ready(function(){
	slideChildrens($('.slide-childrens-topimages'),4000,1000);
	
	Galleria.loadTheme('/files/css/themes/classic/galleria.classic.min.js');
	$('#gallery').galleria({
		showImagenav:true,    
		preload: 5,
		dataConfig: function(img) {
            return {
                layer: $(img).next('.layer').html()
            }
        }
    });
	
})

