var $hi = jQuery.noConflict();

$hi(document).ready(function(){
	
	function showLocation(id,xpos,ypos,event){
	event.preventDefault();
	
	var box_offs = $hi("#box").offset();
	var box_height = $hi("#box").height();
	$hi("#dot").hide();
	$hi("#linkbox").hide();
	$hi("#linkbox").html("<a href=\""+ $hi(id).attr("href") +"\" target=\"_blank\"><p class=\"linkbox\"><b>"+ $hi(id).html() +"</b><br/>Länk till webbsida.</p></a>");
	$hi("#box").css("height",$hi(window).height()-box_offs.top);
	
	$hi("#karta").animate({ width: "600px", left: 0, top: (box_height / 2)-ypos  }, 600, 
	    function(){
	      var kartpos= $hi("#karta").offset(); 
	      $hi("#dot").css({"left": kartpos.left + xpos, "top":kartpos.top + ypos, "width":"0", "height":"0"});
	       $hi("#linkbox").css({"left": kartpos.left + xpos + 20, "top":kartpos.top + ypos-10});
	      $hi("#linkbox").show();
	      $hi("#dot").show();
	      $hi("#dot").animate({ width:20, height:20,left:kartpos.left + xpos-10,top:kartpos.top + ypos-10}, "fast", function(){ $hi("#linkbox").show();} );
	    }
	  );
	};

$hi("#brewery01").click(function(event){ showLocation("#brewery01",85,1085,event); });
$hi("#brewery02").click(function(event){ showLocation("#brewery02",160,1159,event); });
$hi("#brewery03").click(function(event){ showLocation("#brewery03",302,956,event); });
$hi("#brewery04").click(function(event){ showLocation("#brewery04",56,1010,event); });
$hi("#brewery05").click(function(event){ showLocation("#brewery05",292,920,event); });
$hi("#brewery06").click(function(event){ showLocation("#brewery06",326,689,event); });
$hi("#brewery07").click(function(event){ showLocation("#brewery07",214,600,event); });
$hi("#brewery08").click(function(event){ showLocation("#brewery08",115,1301,event); });
$hi("#brewery09").click(function(event){ showLocation("#brewery09",383,946,event); });
$hi("#brewery10").click(function(event){ showLocation("#brewery10",225,966,event); });
$hi("#brewery11").click(function(event){ showLocation("#brewery11",322,1007,event); });
$hi("#brewery12").click(function(event){ showLocation("#brewery12",358,992,event); });
$hi("#brewery13").click(function(event){ showLocation("#brewery13",73,1098,event); });
$hi("#brewery14").click(function(event){ showLocation("#brewery14",270,860,event); });
$hi("#brewery15").click(function(event){ showLocation("#brewery15",133,1057,event); });
$hi("#brewery16").click(function(event){ showLocation("#brewery16",310,837,event); });
$hi("#brewery17").click(function(event){ showLocation("#brewery17",399,913,event); });
$hi("#brewery18").click(function(event){ showLocation("#brewery18",372,909,event); });
$hi("#brewery19").click(function(event){ showLocation("#brewery19",185,1304,event); });
$hi("#brewery20").click(function(event){ showLocation("#brewery20",275,933,event); });
$hi("#brewery21").click(function(event){ showLocation("#brewery21",289,1196,event); });


});
