$(document).ready(function() {

	$("#Map area").hover(function() { showTip(this); }, hideTip);
				  
	function showTip(obj)
	{
		window.clearTimeout(hideTimer);
		var coords = $(obj).attr("coords").split(',');
		$("#tip div").html($("#tip-"+$(obj).attr("id")).html());
		if ($("#tip-"+$(obj).attr("id")).height() < 247)
			$("#tip ul").css({ height : $("#tip-"+$(obj).attr("id")).height() });
		else
			$("#tip ul").css({ height : 247 });
		//if ($("#tip").css("display") == "none")
		$("#tip").css({ display: "block" });
		$("#tip").css({ 
			left: parseInt($("#tip-map").offset().left) + parseInt(coords[0]) + 4 - $("#tip").width()/2,
			top: parseInt($("#tip-map").offset().top) + parseInt(coords[1]) - $("#tip").height() - 33
		});
		$("#tip").animate({ opacity: 0.99 });
	}
	
	var hideTimer;
	function hideTip()
	{
		hideTimer = window.setTimeout('$("#tip").animate({ opacity: 0, top: "-=15px" },"fast", function() { $("#tip").css({ display: "none" }); })',500);
	}

	$('<div id="tip"><div></div></div>').appendTo($("body"));
	$("#tip").hover(function() { window.clearTimeout(hideTimer); }, hideTip);
	$("#tip").css({ opacity: 0 });
	
});