var countryId = "";
var countryArr = new Array();
countryArr['map_hu'] = {'div':'country_hu', 'icon':'0px'};
countryArr['map_bg'] = {'div':'country_bg', 'icon':'-50px'};
countryArr['map_ro'] = {'div':'country_ro', 'icon':'-100px'};

$(function() {
	$(".map_tooltip").tooltip({
		track: true,
		delay: 0,
		showURL: false,
		fixPNG: true,
		bodyHTML: '<div class="tooltip_flag"></div>',				
		extraClass: "country_tooltip",
		top: 10,
		left: 5
	});
});

$(document).ready(function () {
	
	$("#content_map area").hover(function (e) {
		if(typeof(countryArr[$(this).attr('id')]['div']) != "undefined") {
			$("#content_container").prepend('<div id="'+countryArr[$(this).attr('id')]['div']+'"></div>');
			countryId = "#"+countryArr[$(this).attr('id')]['div'];
			$(countryId).show();
			$("#hover_map").show();	
			$("#hover_map area").hover(function () {
				//nothing to do
			}, function () {
				if(typeof(countryArr[$(this).attr('id')]['div']) != "undefined") {
					$(countryId).hide();
					$(countryId).remove();
					$("#hover_map").hide();					
					countryId = "";
				}
			});					
		}
	});	
	
	$("#hover_map .map_tooltip").hover(function () {
		$("#tooltip .tooltip_flag").css('background-position','0 '+countryArr[$(this).find("area").attr("id")]['icon']);
	});		

});
	
