


/*
 |----------------------------------------------------------------------------------------------
 | Menu list sub
 |----------------------------------------------------------------------------------------------
*/
$(document).ready(function(){
	$("div.carousel").carousel( {
        autoSlide: true,
        autoSlideInterval: 5000,
		animSpeed: "slow"
		/*loop: true*/
	});
});


/*
 |----------------------------------------------------------------------------------------------
 | Menu list sub
 |----------------------------------------------------------------------------------------------
*/
$(document).ready(function(){
	  $('li.menu_box').mouseover(function(){
		  $(this).children("ul").show();								 
	  });
	  $('li.menu_box').mouseout(function(){
		  $(this).children("ul").hide();								 
	  });

});
/*
 |----------------------------------------------------------------------------------------------
 |  nivoSlider
 |----------------------------------------------------------------------------------------------
*/
$(window).load(function() {
        $('#slider').nivoSlider();
			 effect:'fade'
    });
/*
 |----------------------------------------------------------------------------------------------
 |  loopedslider
 |----------------------------------------------------------------------------------------------
*/

$(document).ready(function(){
			$('#loopedslider').loopedSlider({
				addPagination: true,
				autoStart: 100000,// Speed Default 90000
				hoverPause: true,
				containerClick: false
			});
		});

/*
 |----------------------------------------------------------------------------------------------
 |  calendar
 |----------------------------------------------------------------------------------------------
*/

$(function() {
		$( "#register-datepicker" ).datepicker({
		  duration:"fast",
		  changeMonth: true,
		  changeYear: true,
		  dateFormat: 'dd/mm/yy',
		  minDate: '-100Y',
		  maxDate: 0   
		  });
		  $( "#booking-date" ).datepicker({
		  duration:"fast",
		  changeMonth: true,
		  changeYear: true,
		  dateFormat: 'dd/mm/yy',
		  minDate: 0,
		  maxDate: '+3Y'   
		  });
		  
	});

/*
 |----------------------------------------------------------------------------------------------
 |  box_hover
 |----------------------------------------------------------------------------------------------
*/

$(document).ready(function(){
	$("#accountbox_hover").click(function(){
		  $(".account-show #popup-accountbox").slideToggle("slow")
	});
});

$(document).ready(function(){
						   
	$("#loginbox_hover").click(function(){
		  $(".login-show #popup-loginbox").slideToggle("slow")
	});
	/*$(".login_to_post").click(function(){
		  $(".login-show #popup-loginbox").slideToggle("slow");
	});*/
});


/*
 |----------------------------------------------------------------------------------------------
 |  Clear textfield 
 |----------------------------------------------------------------------------------------------
*/

$(document).ready(function()
	{
		$(".defaultText").focus(function(srcc)
		{
			if ($(this).val() == $(this)[0].title)
			{
				$(this).removeClass("defaultTextActive");
				$(this).val("");
			}
		});
		$(".defaultText").blur(function()
		{
			if ($(this).val() == "")
			{
				$(this).addClass("defaultTextActive");
				$(this).val($(this)[0].title);
			}
		});
		$(".defaultText").blur();		
	});
/*
 |----------------------------------------------------------------------------------------------
 |  Tab menu
 |----------------------------------------------------------------------------------------------
*/


var openWindows = function(URL,winName,features){
			window.open(URL,winName,features);	
		}
		
		$(document).ready(function(){
			//When page loads...
		$(".tab_content").hide(); //Hide all content
		$("div.day_each span:first").addClass("this").show(); //Activate first tab
		$(".tab_content:first").show(); //Show first tab content
		
		 //On Click Event
				$("div.day_each span").click(function() {
					$("div.day_each span").removeClass("this"); //Remove any "active" class
					$(this).addClass("this"); //Add "active" class to selected tab
					$(".tab_content").hide(); //Hide all tab content
			
					var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
					$(activeTab).fadeIn('fast'); //Fade in the active ID content
					return false;
				});
			});
		
		
		
/*
 |----------------------------------------------------------------------------------------------
 | Pretty photo
 |----------------------------------------------------------------------------------------------
*/

(function($) {
	$.fn.pk_improvements = function(options) {
		var defaults = {
			easing: "easeOutQuint",
			speedIn: "fast",
			speedOut: "fast"
		};
	
		var settings = $.extend({}, defaults, options);
		
		return this.each(function () {
			var $root = $(this);
			
			/* PRETTYPHOTO --- theme: light_rounded / dark_rounded / light_square / dark_square */
			
			if($("body").find("a[rel^='prettyPhoto']").length > 1) {
				$("a[rel^='prettyPhoto']").prettyPhoto({
					"default_width": 820,
					"default_height": 500,
					"opacity": 0.80,
					"animationSpeed":'slow',
					"sildeshow":2000,
					"theme": 'dark_rounded'
					
					
						
				});
			}
		});
	}
})(jQuery);

/*
 |----------------------------------------------------------------------------------------------
 | Hover date Box page
 |----------------------------------------------------------------------------------------------
*/

	this.tooltip = function(){
				//alert($.browser);			
				xOffset = 30;
				yOffset = 30;
			$('.hover_box').each(function(i){					
				$(".hover_box").eq(i).hover(function(e){											  
					conn = $(this).next('.date_conn').html();								  
					$(".hover_box").eq(i).append("<div id='hover_boxon'>"+ conn +"</div>");
					if($.browser.msie){	
						$(".hover_box #hover_boxon")
							.css("position","absolute")
							.css("bottom",(-11) + "px")
							.css("left",(-1) + "px")
							.css("z-index","999")
							.fadeIn("slow");	
							//alert("55555");
					} else {
						$(".hover_box #hover_boxon")
							.css("position","absolute")
							.css("bottom",(-11) + "px")
							.css("left",(-1) + "px")
							.css("z-index","999")
							.fadeIn("slow");	
					}
				},
				function(e){
					$(".hover_box #hover_boxon").remove();
				});	
			});
			
			$('.hover_box_in').each(function(i){					
				$(".hover_box_in").eq(i).hover(function(e){											  
					conn = $(this).next('.date_conn').html();								  
					$(".hover_box_in").eq(i).append("<div id='hover_boxon'>"+ conn +"</div>");
					if($.browser.msie){	
						$(".hover_box_in #hover_boxon")
							.css("position","absolute")
							.css("bottom",(-16) + "px")
							.css("left",(-38) + "px")
							.css("z-index","999")
							.fadeIn("slow");	
							//alert("55555");
					} else {
						$(".hover_box_in #hover_boxon")
							.css("position","absolute")
							.css("bottom",(-16) + "px")
							.css("left",(-38) + "px")
							.css("z-index","999")
							.fadeIn("slow");	
					}
				},
				function(e){
					$(".hover_box_in #hover_boxon").remove();
				});	
			});
			
			
			
			
		};
		// starting the script on page load
		$(document).ready(function(){
			tooltip();
		});




/*
 |----------------------------------------------------------------------------------------------
 | Slide Highlight
 |----------------------------------------------------------------------------------------------
*/




$(document).ready(function() {
        //move he last list item before the first item. The purpose of this is if the user clicks to slide left he will be able to see the last item.
        $('.highlight_ul li:first').before($('.highlight_ul li:last')); 
        
        var tid = setInterval(right_1, 3000);
        //when user clicks the image for sliding right        
		
		
		$('.highlight_inner,.right_scroll img,.left_scroll img').hover(function() {
		tid = clearInterval(tid);
		}, function() {
		tid = setInterval(right_1, 3000);
		});
		
		
        $('.right_scroll img').click(right_1);
		
        function right_1(){
        
            //get the width of the items ( i like making the jquery part dynamic, so if you change the width in the css you won't have o change it here too ) '
            var item_width = $('.highlight_ul li').outerWidth();
            
            //calculae the new left indent of the unordered list
            var left_indent = parseInt($('.highlight_ul').css('left')) - item_width;
			          
            //make the sliding effect using jquery's anumate function '
            $('.highlight_ul:not(:animated)').animate({'left' : left_indent},500,function(){    
                
                //get the first list item and put it after the last list item (that's how the infinite effects is made) '
               $('.highlight_ul li:last').after($('.highlight_ul li:first')); 
                
                //and get the left indent to the default -210px
                $('.highlight_ul').css({'left' : '-590px'});
            });
		}
        //when user clicks the image for sliding left
        $('.left_scroll img').click(function(){
            
            var item_width = $('.highlight_ul li').outerWidth();
            
            /* same as for sliding right except that it's current left indent + the item width (for the sliding right it's - item_width) */
            var left_indent = parseInt($('.highlight_ul').css('left')) + item_width;
            
            $('.highlight_ul:not(:animated)').animate({'left' : left_indent},500,function(){    
            
            /* when sliding to left we are moving the last item before the first list item */            
            $('.highlight_ul li:first').before($('.highlight_ul li:last')); 
            
            /* and again, when we make that change we are setting the left indent of our unordered list to the default -210px */
            $('.highlight_ul').css({'left' : '-590px'});
            });
            
            
        });
  });
/*
 |----------------------------------------------------------------------------------------------
 | Slide hotel
 |----------------------------------------------------------------------------------------------
*/

$(document).ready(function() {
        $('.hotel_ul li:first').before($('.hotel_ul li:last')); 
		
		
		var tid = setInterval(right_1, 3000);
        //when user clicks the image for sliding right        
		
		
		$('.hotel_inner,.h_right_scroll img,.h_left_scroll img').hover(function() {
		tid = clearInterval(tid);
		}, function() {
		tid = setInterval(right_1, 3000);
		});
		
		
        $('.h_right_scroll img').click(right_1);
		
        function right_1(){
		
        
            var item_width = $('.hotel_ul li').outerWidth();
            var left_indent = parseInt($('.hotel_ul').css('left')) - item_width;
            $('.hotel_ul:not(:animated)').animate({'left' : left_indent},500,function(){    
               $('.hotel_ul li:last').after($('.hotel_ul li:first')); 
                $('.hotel_ul').css({'left' : '-317px'});
            }); 
        };
        
        $('.h_left_scroll img').click(function(){
            var item_width = $('.hotel_ul li').outerWidth();
            var left_indent = parseInt($('.hotel_ul').css('left')) + item_width;
            $('.hotel_ul:not(:animated)').animate({'left' : left_indent},500,function(){    
            $('.hotel_ul li:first').before($('.hotel_ul li:last')); 
            $('.hotel_ul').css({'left' : '-317px'});
            });
        });
  });


/*
 |----------------------------------------------------------------------------------------------
 | Slide ticket
 |----------------------------------------------------------------------------------------------
*/

$(document).ready(function() {
        $('.ticket_ul li:first').before($('.ticket_ul li:last')); 
		
		var tid = setInterval(right_1, 3000);
        //when user clicks the image for sliding right        
		
		
		$('.ticket_inner,.right_ticket_scroll img,.left_ticket_scroll img').hover(function() {
		tid = clearInterval(tid);
		}, function() {
		tid = setInterval(right_1, 3000);
		});
		
		
        $('.right_ticket_scroll img').click(right_1);
		
        function right_1(){
            var item_width = $('.ticket_ul li').outerWidth();
            var left_indent = parseInt($('.ticket_ul').css('left')) - item_width;
            $('.ticket_ul:not(:animated)').animate({'left' : left_indent},500,function(){    
               $('.ticket_ul li:last').after($('.ticket_ul li:first')); 
                $('.ticket_ul').css({'left' : '-850px'});
            }); 
        };
        
        $('.left_ticket_scroll img').click(function(){
            var item_width = $('.ticket_ul li').outerWidth();
            var left_indent = parseInt($('.ticket_ul').css('left')) + item_width;
            $('.ticket_ul:not(:animated)').animate({'left' : left_indent},500,function(){    
            $('.ticket_ul li:first').before($('.ticket_ul li:last')); 
            $('.ticket_ul').css({'left' : '-850px'});
            });
        });
  });

/*
 |----------------------------------------------------------------------------------------------
 | Slide Index
 |----------------------------------------------------------------------------------------------
*/

$(document).ready(function() {
        $('.carousel_ul li:first').before($('.carousel_ul li:last')); 
        		var tid = setInterval(right_1, 15000);
        //when user clicks the image for sliding right        
		
		
		$('.carousel_inner,.right_scroll img,.left_scroll img').hover(function() {
		tid = clearInterval(tid);
		}, function() {
		tid = setInterval(right_1, 15000);
		});
		
		
        $('.right_scroll img').click(right_1);
		
        function right_1(){
            var item_width = $('.carousel_ul li').outerWidth();
            var left_indent = parseInt($('.carousel_ul').css('left')) - item_width;
            $('.carousel_ul:not(:animated)').animate({'left' : left_indent},500,function(){    
               $('.carousel_ul li:last').after($('.carousel_ul li:first')); 
                $('.carousel_ul').css({'left' : '-317px'});
            }); 
        };
        
        $('.left_scroll img').click(function(){
            var item_width = $('.carousel_ul li').outerWidth();
            var left_indent = parseInt($('.carousel_ul').css('left')) + item_width;
            $('.carousel_ul:not(:animated)').animate({'left' : left_indent},500,function(){    
            $('.carousel_ul li:first').before($('.carousel_ul li:last')); 
            $('.carousel_ul').css({'left' : '-317px'});
            });
        });
  });

/*
 |----------------------------------------------------------------------------------------------
 | Slide Event
 |----------------------------------------------------------------------------------------------
*/

$(document).ready(function() {
        $('.show_img_ul li:first').before($('.show_img_ul li:last')); 
        		var tid = setInterval(right_1, 3000);
        //when user clicks the image for sliding right        
		
		
		$('.show_img,.show_img_right,.show_img_left').hover(function() {
		tid = clearInterval(tid);
		}, function() {
		tid = setInterval(right_1, 3000);
		});
		
		
        $('.show_img_right').click(right_1);
		
        function right_1(){
            var item_width = $('.show_img_ul li').outerWidth();
            var left_indent = parseInt($('.show_img_ul').css('left')) - item_width;
            $('.show_img_ul:not(:animated)').animate({'left' : left_indent},500,function(){    
               $('.show_img_ul li:last').after($('.show_img_ul li:first')); 
                $('.show_img_ul').css({'left' : '-530px'});
            }); 
        };
        
        $('.show_img_left').click(function(){
            var item_width = $('.show_img_ul li').outerWidth();
            var left_indent = parseInt($('.show_img_ul').css('left')) + item_width;
            $('.show_img_ul:not(:animated)').animate({'left' : left_indent},500,function(){    
            $('.show_img_ul li:first').before($('.show_img_ul li:last')); 
            $('.show_img_ul').css({'left' : '-530px'});
            });
        });
  });

/*
 |----------------------------------------------------------------------------------------------
 | Banner IMG Slide
 |----------------------------------------------------------------------------------------------
*/

$(document).ready(function() {
	//Set Default State of each portfolio piece
	$(".paging_m").show();
	$(".paging_m a:first").addClass("active");

	//Get size of images, how many there are, then determin the size of the image reel.
	var imageWidth = $(".window").width();
	var imageSum = $(".image_reel img").size();
	var imageReelWidth = imageWidth * imageSum;

	//Adjust the image reel to its new size
	$(".image_reel").css({'width' : imageReelWidth});

	//Paging + Slider Function
	rotate = function(){	
		var triggerID = $active.attr("rel") - 1; //Get number of times to slide
		var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide

		$(".paging_m a").removeClass('active'); //Remove all active class
		$active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)

		//Slider Animation
		$(".image_reel").animate({ 
			left: -image_reelPosition
		}, 500);
	}; 

	//Rotation + Timing Event
	rotateSwitch = function(){		
		play = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds
			$active = $('.paging_m a.active').next();
			if ( $active.length === 0) { //If paging reaches the end...
				$active = $('.paging_m a:first'); //go back to first
			}
			rotate(); //Trigger the paging and slider function
		}, 4000); //Timer speed in milliseconds (3 seconds)
	};

	rotateSwitch(); //Run function on launch

	//On Hover
	$(".image_reel a").hover(function() {
		clearInterval(play); //Stop the rotation
	}, function() {
		rotateSwitch(); //Resume rotation
	});	

	//On Click

	$(".paging_m a").click(function() {	
		$active = $(this); //Activate the clicked paging
		//Reset Timer
		clearInterval(play); //Stop the rotation
		rotate(); //Trigger rotation immediately
		rotateSwitch(); // Resume rotation
		return false; //Prevent browser jump to link anchor
	});	

});


/*
 |----------------------------------------------------------------------------------------------
 | Mega Hover Menu
 |----------------------------------------------------------------------------------------------
*/


$(document).ready(function() {
	
 
	function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show();
			
		//Calculate width of all ul's
		(function($) { 
			jQuery.fn.calcSubWidth = function() {
				rowWidth = 0;
				//Calculate row
				$(this).find("ul").each(function() {					
					rowWidth += $(this).width(); 
				});	
			};
		})(jQuery); 
		
		if ( $(this).find(".row").length > 0 ) { //If row exists...
			var biggestRow = 0;	
			//Calculate each row
			$(this).find(".row").each(function() {							   
				$(this).calcSubWidth();
				//Find biggest row
				if(rowWidth > biggestRow) {
					biggestRow = rowWidth;
				}
			});
			//Set width
			$(this).find(".sub").css({'width' :biggestRow});
			$(this).find(".row:last").css({'margin':'0'});
			
		} else { //If row does not exist...
			
			$(this).calcSubWidth();
			//Set Width
			$(this).find(".sub").css({'width' : rowWidth});
			
		}
	}
	
	function megaHoverOut(){ 
	  $(this).find(".sub").stop().fadeTo('fast', 0, function() {
		  $(this).hide(); 
	  });
	}
 
 
	var config = {    
		 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 0, // number = milliseconds for onMouseOver polling interval    
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
		 timeout: 0, // number = milliseconds delay before onMouseOut    
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};
 
	$("ul#topnav li .sub").css({'opacity':'0'});
	$("ul#topnav li").hoverIntent(config);
 
 
 
});

<!------------------------------------------------------------------------------------------------->

$(document).ready(function(){
	$("a[rel^='prettyPhoto']").prettyPhoto();
});



$(window).load(function(){


$.each($(".center-middle"), function() {
   	$(this).css("margin-top", (   $(this).parent('li').height() - $(this).height() ) / 2  + "px");
	/*$(this).css("margin-left", (   $(this).parent().width() - $(this).width() ) / 2  + "px");*/
	return true;
});
});
