//Pre load images
var img1 = new Image();
img1.src = "./images/global_map/namerica.jpg"; 
var img2 = new Image();
img2.src = "./images/global_map/samerica.jpg"; 
var img3 = new Image();
img3.src = "./images/global_map/w_euro.jpg"; 
var img4 = new Image();
img4.src = "./images/global_map/ru.jpg"; 
var img5 = new Image();
img5.src = "./images/global_map/ci_ja.jpg"; 
var img6 = new Image();
img6.src = "./images/global_map/africa.jpg"; 
var img7 = new Image();
img7.src = "./images/global_map/asia.jpg"; 
var img8 = new Image();
img8.src = "./images/global_map/austr.jpg"; 

function makeTall() {
			var bg_str = "url('./images/global_map/"+$(this).attr("id")+".jpg') 0 0 no-repeat";
			var label_str_id = "#l_"+$(this).attr("id");
			var ul_id = "#ul_"+$(this).attr("id");
			$(".big_map").css("background", bg_str);
			$(label_str_id).css("color", "#8e0515");
			$(ul_id).css("display", "block");
}

function makeShort() {
			$(".big_map").css("background", "url('./images/global_map/mainmap.jpg') 0 0 no-repeat");
			var label_str_id = "#l_"+$(this).attr("id");
			$(label_str_id).css("color", "#000");
			var ul_id = "#ul_"+$(this).attr("id");
			$(ul_id).css("display", "none");
}

$(document).ready(function() {

	$(".language_box").hover(
	  function () {
		$(".language_box ul").addClass("lang_hover");
	  },
	  function () {
		$(".language_box ul").removeClass("lang_hover");
	  }
	);
	
	var hover_config = {
		sensitivity: 7, // number = sensitivity threshold (must be 1 or higher)
		interval: 50, // number = milliseconds for onMouseOver polling interval
		over: makeTall, // function = onMouseOver callback (REQUIRED)
		timeout: 50, // number = milliseconds delay before onMouseOut
		out: makeShort // function = onMouseOut callback (REQUIRED)
	};
	
	if ($(".map_aria").length !=0) {
		$(".map_aria").hoverIntent( hover_config ); 
	}
	
	if ($("div.gray_logos").length !=0) {
		$("div.gray_logos div.centered_image").each(function(index, item) {
			var m_top = -Math.round($(item).outerHeight()/2)+'px';
			$(item).css('margin-top', m_top);
		}); 	
	}
	

});
