var menu = {
	"home" : 
	{
		"on" : "images/bt_head_home-over.png", 
		"off": "images/bt_head_home.png"
	},
	"kaiji" : 
	{
		"on" : "images/bt_head_kaiji-over.png", 
		"off": "images/bt_head_kaiji.png"
	},
	"jimu" : 
	{
		"on" : "images/bt_head_jimu-over.png", 
		"off": "images/bt_head_jimu.png"
	},
	"chousa" : 
	{
		"on" : "images/bt_head_chousa-over.png", 
		"off": "images/bt_head_chousa.png"
	},
	"company" : 
	{
		"on" : "images/bt_head_company-over.png", 
		"off": "images/bt_head_company.png"
	},
	"contact" : 
	{
		"on" : "images/bt_head_contact-over.png", 
		"off": "images/bt_head_contact.png"
	}
};

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);
	};
	
});