$z(document).ready(function(){
		
	//submit booking info to restaurant email	
	$z('#go_book').click(function(){
		var name = $z('[id=name]').val();
		var phone = $z('[id=phone_number]').val();
		var email = $z('[id=email]').val();
		var captcha = $z('[name=osolCatchaTxt]').val();
		var error = '';
		
		if (name == '' || name == 'Your name') 
		{
			error += 'Field "Name" is required.\r\n';
		}
		if (phone == '' || phone == 'Your phone number') 
		{
			error += 'Field "Phone number" is required.\r\n';	
		}
		if (email == '' || email == 'Your email address') 
		{
			error += 'Field "Email address" is required.\r\n';	
		}
		if (captcha == '') 
		{
			error += 'Captcha code is blank.\r\n';	
		}
		if (error != '') {
						alert(error);
						return false;
					} else {
							$z('[id=book_online').submit();
						   }
	});	
	
	//submit guetsbook entry
	$z('#guestbook_submit').click(function(){
		var error = '';
		var name = $z('[id=gbname]').val();
		var location = $z('[id=gbloca]').val();
		var email = $z('[id=gbmail]').val();
		var comment = $z('[id=gbtext]').val();
		if (name == '' || name == 'Enter your name please') 
		{
			error += 'Field "Name" is required.\r\n';
		}
		if (email == '' || email == 'Enter your Email please') 
		{
			error += 'Field "Email address" is required.\r\n';	
		}
		if (location == '' || location == 'Enter your location') 
		{
			error += 'Field "Location" is required.\r\n';	
		}
		if (comment == '' || comment == 'Enter your comment') 
		{
			error += 'Field "Comment" is required.\r\n';	
		}
		
		if (error != '') {
						alert(error);
						return false;
					} else {
							$z('[name=gbookForm').submit();
						   }
	});

	// regular page fading animation
	$z('#show_hide_btn').click(function () 
		{ 
			if( $z('#page_bg').is(':visible') ) {
				$z('#page_bg').customFadeOut();
				$z(this).html('Show');
			}
			else 
			{
				$z('#page_bg').customFadeIn();
				$z(this).html('Hide');
			}
		});
	
	// Menu page animation
	$z('[id=menu_link]').hover(
		function () {
			$z(this).css({
						'border-bottom':'3px solid #7A0E21',
						'border-top':'3px solid #7A0E21',
						"text-decoration":"none"
						});
			$z(this).animate({"padding-bottom":"+=9px","padding-top":"+=9px"}, 300);
		},
		function () {
			$z(this).css({
						'border-bottom':'none',
						'border-top':'none'
						});
			$z(this).animate({"padding-bottom":"-=9px","padding-top":"-=9px"}, 300);
		}
	);
	
	// Subscription page buttons animation
	$z('.acysubbuttons input, .book_btn input').hover(
		function () {
			$z(this).css({
						'border-bottom':'3px solid #7A0E21',
						'border-top':'3px solid #7A0E21'
						});
			$z(this).animate({"padding-bottom":"+=6px","padding-top":"+=6px"}, 300);
		},
		function () {
			$z(this).css({
						'border-bottom':'none',
						'border-top':'none'
						});
			$z(this).animate({"padding-bottom":"-=6px","padding-top":"-=6px"}, 300);
		}
	);
	
	// Recommend friend page buttons animation
	$z('.button_recommend').hover(
		function () {
			$z(this).css({
						'border-bottom':'3px solid #7A0E21',
						'border-top':'3px solid #7A0E21'
						});
			$z(this).animate({"padding-bottom":"+=6px","padding-top":"+=6px"}, 300);
		},
		function () {
			$z(this).css({
						'border-bottom':'none',
						'border-top':'none'
						});
			$z(this).animate({"padding-bottom":"-=6px","padding-top":"-=6px"}, 300);
		}
	);
	
	// Bookmark link
	$z("a#addbookmark").click(function(e){
		e.preventDefault(); // this will prevent the anchor tag from going the user off to the link
		var bookmarkUrl = location.href;
		var bookmarkTitle = document.title;
		if (window.sidebar) { // For Mozilla Firefox Bookmark
			window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");
		} else if( window.external || document.all) { // For IE Favorite
			window.external.AddFavorite( bookmarkUrl, bookmarkTitle);
		} else { // for other browsers which does not support
			 alert('Your browser does not support this bookmark action');
			 return false;
		}
		return true;
	});

});

function addBookmark(obj){
	//For Opera browsers
	if (window.opera && document.createElement) {
		obj.setAttribute('rel','sidebar');
		obj.setAttribute('href',location.href);
		obj.setAttribute('title',document.title);
	}
	else {
			alert("Your browser does not support this bookmark action");
			return false; //IF Opera 6
	}
	return true;
	
}

(function($) {
	$.fn.customFadeIn = function(speed, callback) {
		$(this).fadeIn(speed, function() {
			if(jQuery.browser.msie)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeOut = function(speed, callback) {
		$(this).fadeOut(speed, function() {
			if(jQuery.browser.msie)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
})(jQuery);
