jQuery(document).ready(function($){
	if ($("#pane1")) {
		$(function(){
			$('#pane1').jScrollPane();
		});		
	}
	
	$(".contact").fancybox({
		'centerOnScroll'	: true,
		'width'						: 464,
		'height'					: 625,
		'padding'					: 0,
		'margin'					: 0,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'titleShow'				: false,
		'type'						: 'iframe'
	});
	
	$(".virtual").fancybox({
		'centerOnScroll'	: true,
		'width'						: 1024,
		'height'					: 644,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'titleShow'				: false,
		'type'						: 'iframe'
	});
	
	$("a[rel*='photos_group']").fancybox(
	{
		'centerOnScroll'	: true,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'titlePosition' 	: 'inside',
		'cyclic'					: true,
		'autoScale'				: true,
		'padding'					: 0,
		'margin' 					: 100,
		'titleFormat'     : function(title, currentArray, currentIndex, currentOpts)
		{
			return '<span id="fancybox-title-over">' + title + '&nbsp;&mdash;&nbsp;(' + (currentIndex + 1) + ' / ' + currentArray.length + ')<span>';
		}
	});
	
	Date.format = 'dd/mm/yyyy';
	$('.date-pick').datePicker({clickInput:true, showYearNavigation:false});
	$('#checkin').bind(
		'dpClosed',
		function(e, selectedDates)
		{
			var d = selectedDates[0];
			if (d) {
				d = new Date(d);
				$('#checkout').dpSetStartDate(d.addDays(1).asString());
			}
		}
	);

	if($(".toggle_container")){	
		$(".toggle_container").hide(); 
		
		$("h2.trigger").toggle(function(){
			$(this).addClass("active");
		}, function () {
			$(this).removeClass("active");
		});
		
		$("h2.trigger").click(function(){
			$(".toggle_container").hide("slow");
			$(this).next(".toggle_container").slideToggle("slow");
		});
		
		if ($("h2.triggerOpened"))
		{
			$("h2.triggerOpened").click();
		}
	}

	if( $("p.typewrite").length ) { $("p.typewrite").jTypeWriter({duration:3}); }

	$("#navigation li a").hover(
		function() {
			if( !$(this).hasClass('active') && !$(this).hasClass('book') && !$(this).hasClass('virtual') )
				$(this).animate({ color: "#fff", backgroundColor: "#8d0000", paddingTop : '45px' }, 300);
			else if( $(this).hasClass('book') || $(this).hasClass('virtual') )
				$(this).animate({ paddingTop : '45px' }, 300);
		},
		function() {
			if( !$(this).hasClass('active') && !$(this).hasClass('book') && !$(this).hasClass('virtual') )
				$(this).animate({ color: "#bbb2a4", backgroundColor: "#bbb2a4", paddingTop : '49px' }, 100);
			else if( $(this).hasClass('book') || $(this).hasClass('virtual') )
				$(this).animate({ paddingTop : '49px' }, 100);
		}
	);

});
