var menu = {
	"header_top" : 
	{
		"on" : "images/header_top_on.png", 
		"off": "images/header_top.png"
	},
	"header_habita" : 
	{
		"on" : "images/header_habita_on.png", 
		"off": "images/header_habita.png"
	},
	"header_200" : 
	{
		"on" : "images/header_200_on.png", 
		"off": "images/header_200.png"
	},
	"header_concept" : 
	{
		"on" : "images/header_concept_on.png", 
		"off": "images/header_concept.png"
	},
		"header_company" : 
	{
		"on" : "images/header_company_on.png", 
		"off": "images/header_company.png"
	},
	"header_contact" : 
	{
		"on" : "images/header_contact_on.png", 
		"off": "images/header_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);
	};
	
});

