var selectedTab = parseInt(window.location.hash.replace("#", ""), 10);

Cufon.replace("h1,h2,#marquee");

jQuery(document).ready(function($) {
	$("#navigation a img").preload({
	   	find: ".png",
	    replace: "_hover.png"
	});

	$("ul.sf-menu").superfish({delay:800, animation:{height:"show"}, autoArrows:false, dropShadows:false}).find("> li").hover(
		function() { $(this).find("img").attr("src", function() { return this.src.replace(".png", "_hover.png"); }); },
		function() { $(this).find("img").attr("src", function() { return this.src.replace("_hover", ""); }); }
	);
	
	if (isNaN(selectedTab) || selectedTab < 0 || selectedTab >= $("#tabs > ul > li").length) selectedTab = 0;

	$("#tabs").tabs({selected: selectedTab, fx: {opacity: "toggle"}});
	
	$("#food-and-wine .sf-menu ul li a, #food-and-wine .tab-link").click(function() {
		window.location.href=this.href;
		window.location.reload(true);
	});
});

