// iw_map.js developed by Ironworks Consulting 8.16.2010

var current_point = "";
var mytimeout;
var shouldSetTimeout = true;

jQuery(document).ready(function() {
// hide all region text
jQuery("#descriptions div.contentSection").hide();
	jQuery('#worldMap [class^=pinpoint] a').click (function(){			
		clearTimeout(mytimeout);
		shouldSetTimeout = false;
		return false;
	});	

	jQuery('#careerMap [class^=pinpoint] a').click (function(){			
		clearTimeout(mytimeout);
		shouldSetTimeout = false;
		return false;
	});	
});// end document read

jQuery(document).ready(function(){
	jQuery("#worldMap").children("p").mouseenter(function(){
		clearTimeout(mytimeout);
		if (current_point != jQuery(this).attr("class")){
			if (current_point != "") hideWorldmap();
			current_point = jQuery(this).attr("class");			
			jQuery("#worldMap #descriptions").removeClass("hideBox");
			jQuery("#" + current_point).show();
			jQuery("#" + current_point).addClass("contentSection")
			jQuery("#worldMap #descriptions").addClass("showBox").fadeIn(800);  
		}
	}).mouseout(function(){
		if (shouldSetTimeout == true){
			mytimeout = setTimeout("hideWorldmapWithFade()", 3000);	
		}else{
			shouldSetTimeout = true;
		}
	});

	jQuery("#descriptions a.close").click(function(){
		hideWorldmapWithFade();
		return false;
	});
});

function hideWorldmapWithFade(){
	jQuery('#descriptions').fadeOut("slow", function(){
		jQuery('#descriptions').addClass('hideBox');
		jQuery('#descriptions').removeClass('showBox');
		jQuery("#descriptions div").hide();
	});
	current_point = "";
}
function hideWorldmap(){
	jQuery("#" + current_point).hide();
	jQuery("#" + current_point).removeClass("contentSection");
	jQuery("#worldMap #descriptions").hide();
	jQuery("#worldMap #descriptions").addClass("hideBox");
	jQuery('#descriptions').removeClass('showBox');
	jQuery('#descriptions div').removeClass("contentSection");
	current_point = "";
}


