// Fire up jQuery
$(document).ready(function(){

	// Navigation
	$("#sub1, #sub2").hover(
		function() {
			$(this).parent().addClass("subHover");
		},
		function() {
			$(this).parent().removeClass("subHover");
		}
	);
	
	$('#navMain ul.sub li a').hover(
		function() {
			$(this).animate({opacity: '0.7'},{duration: 200});
		},
		function() {
			$(this).animate({opacity: '1.0'},{duration: 200});
		}
	);
	
	// New Windows
	$("a[href^='http://']").not("a[href^='http://oyamel.com/']").not("a[href^='http://www.oyamel.com/']").attr("target","_blank");
	$("a[href^='https://']").attr("target","_blank");
	$("#formReservations").attr("target","_blank");
	$("#formContactJoin").attr("target","_blank");
	$("#formJoin").attr("target","_blank");
	
	// Datepicker
	$("#formReservationsDate").datepicker({minDate : 0});
	$("#formPartiesDate").datepicker({minDate : 0, showOn : 'both', buttonImage : 'http://www.zaytinya.com/images/parties/iconCalendar.png', buttonImageOnly: true});
	
	// Home Page
	$("#slides").cycle({fx: "fade", timeout: 10000});
	
	// Menus Page
	$("#scrollContainer").scrollable();
	
	// Shop Page
	$("#items div:even").addClass("left");
	
	// Parties Page
	$("#formPartiesSize").change(function() {
		var selectVal = $(this).val();
		if (selectVal == 11) {
			$("#formPartiesSubmit").hide();
			$(".noSubmit").show();
		} else {
			$(".noSubmit").hide();
			$("#formPartiesSubmit").show();
		}
	});
	
	// FAQ Page
	$("#content.faq dd").hide();
	$("#content.faq dt span").hover(
		function() {
			$(this).addClass("hover");
		},
		function() {
			$(this).removeClass("hover");
		}
	);
	$("#content.faq dt span").click(function() {
		$(this).parent().next("dd").slideToggle("fast");
	});
	var hash = window.location.hash;
	if (hash != false) {
		$("#content.faq dt"+hash).next("dd").show();
	}
	
	// Photos Page
	$("#thumbs div").quickpaginate({ perpage: 24, showcounter: true, pager : $("#pager") });
	$(".photoLink").click(function() {
		var largeImageSrc = $(this).attr("href");
		$("#largeImage").attr({src: largeImageSrc});
		return false;
	});	
	
});
