var menu = {
	"home" : 
	{
		"on" : "images/top-over.gif", 
		"off": "images/top.gif"
	},
	"wa" : 
	{
		"on" : "images/whywashington-over.gif", 
		"off": "images/whywashington.gif"
	},
	"winery" : 
	{
		"on" : "images/wineries-over.gif", 
		"off": "images/wineries.gif"
	},
	"wine" : 
	{
		"on" : "images/wine-over.gif", 
		"off": "images/wine.gif"
	},
	"restaurant" : 
	{
		"on" : "images/restaurant-over.gif", 
		"off": "images/restaurant.gif"
	},
	"online" : 
	{
		"on" : "images/onlinestore-over.gif", 
		"off": "images/onlinestore.gif"
	},
	"company" : 
	{
		"on" : "images/company-over.gif", 
		"off": "images/company.gif"
	},
	"recruit" : 
	{
		"on" : "images/recruit-over.gif", 
		"off": "images/recruit.gif"
	},
	
	
	
	"en" : 
	{
		"on" : "images/english-over.gif", 
		"off": "images/english.gif"
	},
	"home_en" : 
	{
		"on" : "images/top-over_english.gif", 
		"off": "images/top_english.gif"
	},
	"wa_en" : 
	{
		"on" : "images/whywashington-over_en.gif", 
		"off": "images/whywashington_en.gif"
	},
	"winery_en" : 
	{
		"on" : "images/wineries-over_english.gif", 
		"off": "images/wineries_english.gif"
	},
	"wine_en" : 
	{
		"on" : "images/wine-over_english.gif", 
		"off": "images/wine_english.gif"
	},
	"restaurant_en" : 
	{
		"on" : "images/restaurant-over_en.gif", 
		"off": "images/restaurant_en.gif"
	},
	"online_en" : 
	{
		"on" : "images/onlinestore-over_en.gif", 
		"off": "images/onlinestore_en.gif"
	},
	"company_en" : 
	{
		"on" : "images/company-over_english.gif", 
		"off": "images/company_english.gif"
	},
	"jp" : 
	{
		"on" : "images/japanese-over.gif", 
		"off": "images/japanese.gif"
	}
};

var preloads = [];

$(document).ready(function(){
	
	$(".nav")
	.superfish({
		animation : { opacity:"show",height:"show", delay:0, speed:"fast"}
	})
	.find(">li:has(ul)")
		.mouseover(function(){
			$("ul", this).bgIframe({opacity:false});
		})
		.find("a")
			.focus(function(){
				$("ul", $(".nav>li:has(ul)")).bgIframe({opacity:false});
			});
	
	
	for(var id in menu)
	{
		var selector  = "#" + id;
		$(selector + "> img").attr({ src: eval("menu."+id+".off") });
		
		$(selector)
		.hover(
			function() {
				$("img", this).attr({ src: eval("menu."+this.id+".on") });
			},
			function() {
				$("img", this).attr({ src: eval("menu."+this.id+".off") });
			}
		);
		
		var image = new Image();
		image.src = eval("menu."+id+".on");
		preloads.push(image);
	};
	
});
