// Global Functions



$(document).ready(function() {
		
//image transition		

$('#slider').jqFancyTransitions({ 
		effect: 'zipper', // wave, zipper, curtain
		width: 940, // width of panel
		height: 330, // height of panel
		strips: 20, // number of strips
		delay: 5000, // delay between images in ms
		stripDelay: 50, // delay beetwen strips in ms
		titleOpacity: 0.7, // opacity of title
		titleSpeed: 1000, // speed of title appereance in ms
		position: 'alternate', // top, bottom, alternate, curtain
		direction: 'fountainAlternate', // left, right, alternate, random, fountain, fountainAlternate
		navigation: false, // prev and next navigation buttons
		links: false // show images as links
});
		

//booking panel toggle

if ($('.booking-form').children().hasClass('error') || $('#booking-form p').hasClass('successText')){
			$('#booking-panel').css({'left':'745px','top':'130px'});
		} else {
			
			$("#booking-panel").animate({'left':'745px'}, 2000,
				function(){
					$("#booking-panel").animate({'top':'30px'},"slow")
				}
			);
			
		}

$("#booking-toggle").click(function(){
		if($(this).hasClass('open')){
			$("#booking-panel").animate({'left':'745px'});
			$(this).removeClass('open');
			
		} else {
			$("#booking-panel").animate({'left':'425px'});
			$(this).addClass('open');
		}
		return false;
});


//image effects - gallery
$('ul.gallery img').css('margin','0px');
$("ul.gallery li").hover(function() {
	$(this).css({'z-index' : '10'}); /*Add a higher z-index value so this image stays on top*/ 
	$(this).find('img').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
		.animate({
			marginTop: '-70px', /* The next 4 lines will vertically align this image */ 
			marginLeft: '-80px',
			top: '50%',
			left: '50%',
			width: '175px', /* Set new width */
			height: '120px', /* Set new height */
			padding: '25px'
		}, 200); /* this value of "200" is the speed of how fast/slow this hover animates */

	} , function() {
	$(this).css({'z-index' : '0'}); /* Set z-index back to 0 */
	$(this).find('img').removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
		.animate({
			marginTop: '0', /* Set alignment back to default */
			marginLeft: '0',
			top: '0',
			left: '0',
			width: '90px', /* Set width back to default */
			height: '60px', /* Set height back to default */
			padding: '0px'
		}, 400);
});
		
		
//buttons		
$('a.opacity').hover(function(){
		$(this).addClass("hovered");
		$('a.opacity:not(.hovered)').children('img').stop().animate({'opacity': 0.5});
	}, function(){
		$(this).removeClass("hovered");
		$('a.opacity:not(.hovered)').children('img').stop().animate({'opacity': 1});
	});		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
});
