$(document).ready(function() {
	
	var countries = new Array();
	
	countries['norway'] 		= 40;
	countries['sweden'] 		= 72;
	countries['austria'] 		= 333;
	countries['belgium'] 		= 286;
	countries['czech'] 			= 304;
	countries['denmark'] 		= 214;
	countries['estonia'] 		= 192;
	countries['finland'] 		= 55;
	countries['france'] 		= 289;
	countries['greatbritain'] 	= 173;
	countries['greece'] 		= 423;
	countries['hungary'] 		= 337;
	countries['italy'] 			= 355;
	countries['latvia'] 		= 213;
	countries['lithuania'] 		= 231;
	countries['licht'] 			= 284;
	countries['luxembourg'] 	= 250;
	countries['netherlands'] 	= 265;
	countries['poland'] 		= 248;
	countries['portugal'] 		= 367;
	countries['slovakia'] 		= 320;
	countries['slovenia'] 		= 359;
	countries['spain'] 			= 348;
	countries['switzerland'] 	= 341;
	countries['germany'] 		= 251;
	
	//$("#countries .select").addClass("ancher");
	
	$("#countries ul li").hover (
		function() {
		
			$(".selected").css("top", "-8px");
			$(this).parent().find("a").css("color", "#fff");
			$(this).append($(".selected"));
			$(this).find("a").css("color", "#142131");
			
			var country = $(this).attr("id").split("-");
			
			if (country.length>1) {
				$("."+country[0]).stop().css("top", countries[country[0]] + "px");
			}
			
		},
		function() {
		
			$(this).find("a").css("color", "#fff");			
			if( $(".ancher").length == 1 ){
				$(".ancher").append( $(".selected") );
				$(".ancher a").css("color", "#142131");
			} else {
				$(".selected").css("top", "-10000px");
				
			}			
			
			var country = $(this).attr("id").split("-");
			
			if (country.length>1) {
				$("."+country[0]).stop().css("top", "-10000px");
			}
			
		}
	);
	
	$("area").mouseover(function() {
		$("#"+$(this).attr("id")+"-li").mouseover();
	});
	
	$("area").mouseout(function() {
		$("#"+$(this).attr("id")+"-li").mouseout();
	});
	
	//background stretching
	if ($.browser.webkit) {
	
		var bodyHeight = $("body").height();
		var contentHeight = $(".content").height();
		if (bodyHeight > contentHeight)
			$(".bg img").height(bodyHeight)
		else	
			$(".bg img").height(contentHeight)
			
		$(window).resize(function() {
			var bodyHeight = $("body").height();
			var contentHeight = $(".content").height();
			if (bodyHeight > contentHeight)
				$(".bg img").height(bodyHeight)
			else	
				$(".bg img").height(contentHeight)
		});
		
	};	
	
});

