anim_speed = "normal";

(function($){
	$.fn.modalHide = function() {
		return this.each(function() {
			if($.browser.msie) {
				$(this).hide();
			} else {
				$(this).fadeOut(anim_speed);
			}
		});
	};
})(jQuery);

(function($){
	$.fn.modalShow = function() {
		return this.each(function() {
			if($.browser.msie) {
				$(this).show();
			} else {
				$(this).fadeIn(anim_speed);
			}
		});
	};
})(jQuery);

$(document).ready(function()
{
	$('.slideshow').cycle(
	{
		fx: 'fade',
		speed: 1500,
		timeout: 5000,
		prev: '#prev-image',
		next: '#next-image'
	});
	
	$("a.enlarge").fancybox();
	$("a.enlarge-news").fancybox();
	
	$("a.enlarge").hover
	(
		function ()
		{
			$(this).append($("<div class=\"enlargebutton\"><img src=\"/images/enlarge-button.png\" alt=\"Seaton Lane Inn\" /></div>"));
		},
		function ()
		{
			$(this).find("div:last").remove();
		}
	);
	
	$("a.enlarge-news").hover
	(
		function ()
		{
			$(this).append($("<div class=\"enlargebutton-news\"><img src=\"/images/enlarge-button.png\" alt=\"Seaton Lane Inn\" /></div>"));
		},
		function ()
		{
			$(this).find("div:last").remove();
		}
	);
	
	$("#right-book-table").click(function(event){
		event.preventDefault();
		$('#modal-outer').modalShow();
		$('#table-bookings-modal').modalShow();
	});
	
	$("#right-book-room").click(function(event){
		event.preventDefault();
		$('#modal-outer').modalShow();
		$('#room-bookings-modal').modalShow();
	});
	
	$("#newsletter-signup-head").click(function(event){
		event.preventDefault();
		$('#modal-outer').modalShow();
		$('#newsletter-modal').modalShow();
	});
	
	$("#newsletter-signup").click(function(event){
		event.preventDefault();
		$('#modal-outer').modalShow();
		$('#newsletter-modal').modalShow();
	});
	
	$(".modal-close").click(function(event){
		event.preventDefault();
		$('#table-bookings-modal').modalHide();
		$('#room-bookings-modal').modalHide();
		$('#newsletter-modal').modalHide();
		$('#newsletter-modal-thankyou').modalHide();
		$('#modal-outer').modalHide();
	});
	
	$("#modal-outer").click(function(event){
		event.preventDefault();
		$('#table-bookings-modal').modalHide();
		$('#room-bookings-modal').modalHide();
		$('#newsletter-modal').modalHide();
		$('#newsletter-modal-thankyou').modalHide();
		$('#modal-outer').modalHide();
	});
});