function maps_init() {
	$("#sverige area").each(function(i) {
		var n = parseInt($(this).attr("alt"));
		$(this)
			.mouseover(function() {
				showMap(n);
			})
			.mouseout(function() {
				hideMap();
			})
			.click(function() {
				showLocation(n);
			});
		$($("#map a.l")[i])
			.mouseover(function() {
				showMap(n);
			})
			.mouseout(function() {
				hideMap();
			})
			.click(function() {
				showLocation(n);
			});
	});
	$("#map a.l_0").click(function() {
		showLocation(0);
	});
	var image = new Array();
	for(var i = 0; i < 23; i++) {
		image[i] = new Image();
		image[i].src = "images/map/map("+(i+1)+").png";
	}
	var i = location.href.indexOf("#");
	if (i > 0) {
		var arg = location.href.substring(i);
		showLocation(parseInt(arg.substring(1)));
	} else {
		showLocation(0);
	}
}
function showMap(i) {
	$("#map img").attr("src", "images/map/map("+i+").png");
	$("#map a.l_"+i).addClass("jaune");
}
function hideMap() {
	$("#map img").attr("src", "images/map/map.png");
	$("#map a").removeClass("jaune");
}
function showLocation(i) {
	$("#locations div.l").hide();
	$("#locations div.l.l_"+i).show();
}
if(typeof($) != 'undefined')
	$(document).ready(maps_init);
	
// 	var coords = [
// 		['Norrbotten',		'128,116,115,121,67,87,79,59,75,55,88,35,93,37,96,33,96,19,113,24,116,20,116,7,122,7,132,15,159,34,167,69,175,98,154,101,153,109,142,119'],
// 		['Västerbotten',	'72,90,115,122,129,116,145,124,148,143,143,162,127,174,110,160,98,161,86,155,55,128,61,102,58,95'],
// 		['Jämtland',		'54,126,71,142,78,174,91,188,83,197,62,204,69,212,66,222,60,232,48,234,40,230,35,224,24,217,25,178,38,154,50,157,55,146,48,137,53,126'],
// 		['Västernorrland',	'73,147,95,161,108,160,124,172,100,220,69,215,64,205,81,198,90,186,80,175,73,146'],
// 		['Gävleborg',		'67,216,97,220,97,233,99,275,90,277,83,270,82,260,68,240,58,237,68,224,67,217'],
// 		['Dalarna',			'22,217,26,218,39,230,57,236,65,240,80,257,80,269,89,277,81,280,72,277,70,284,53,280,29,252,30,242,21,232,23,215'],
// 		['Värmland',		'26,253,53,282,52,312,43,304,34,308,36,318,20,307,12,310,10,299,25,277,22,253,29,253'],
// 		['Örebro',			'53,282,67,285,72,313,70,318,60,324,56,320,50,312'],
// 		['Västmanland',		'65,288,72,279,80,281,93,274,93,294,80,304,73,303,70,289'],
// 		['Uppsala',			'104,267,106,267,118,279,103,290,101,292,94,294,95,275'],
// 		['Stockholm',		'122,279,127,289,127,304,108,318,103,292,114,282,120,282'],
// 		['Södermanland',	'91,298,102,300,106,315,93,327,77,315,81,308,84,303,92,299'],
// 		['Skaraborg',		'24,335,36,323,50,314,60,326,56,338,46,352,44,345,30,342,23,334'],
// 		['Östergötland',	'76,317,92,329,92,341,83,338,80,347,72,353,65,353,65,342,58,341,63,326'],
// 		['Göteborg',		'8,322,12,332,16,336,18,357,12,360,9,352,0,348,0,336,6,334'],
// 		['Älvsborg',		'10,310,18,310,30,314,21,330,29,343,38,347,45,352,42,363,33,371,23,367,19,353,19,334,12,328,10,319'],
// 		['Jönköping',		'34,373,44,363,46,353,58,342,63,343,64,353,75,358,76,368,64,371,36,382,34,372'],
// 		['Kalmar',			'75,353,82,349,83,340,91,343,92,364,106,379,97,405,83,399,74,394,74,388,79,384,79,377,74,373,76,355'],
// 		['Gotland',			'121,350,131,349,140,366,138,374,126,375,120,385,116,365'],
// 		['Halland',			'19,359,21,367,33,373,37,395,34,397,15,390,12,382,20,374,12,363,19,358'],
// 		['Kronoberg',		'37,383,70,371,78,378,77,383,71,394,61,401,55,395,37,397,37,384'],
// 		['Blekinge',		'59,404,66,399,75,396,83,402,79,411,71,416,58,410,56,399'],
// 		['Skåne',			'32,431,53,431,55,420,58,410,56,396,30,397,23,398,28,411,31,428']
// 	];

