$(document).ready(function() {

	var hide = false;	

    //**   fade in/out the country list dropdown 
	$("a#cl_dropdown").click(function(){
         if (hide) clearTimeout(hide);
		 $("#cl_dropdown_box").fadeToggle();
     }); 
	
    //**   fade in/out the header country dropdown
	$("#page_top .site_select").click(function(){
         if (hide) clearTimeout(hide);
		 $("#cl_dropdown_box_header").fadeToggle();
     }); 
	
    //**   fade in/out the footer country dropdown
	$("#footer .site_select").click(function(){
         if (hide) clearTimeout(hide);
		 $("#cl_dropdown_box_footer").fadeToggle();
     }); 
	
});


//**   switches the background coordinates for the map (which is what switches the look of the countries on hover 
	function changeMap(xCoor,yCoor) {
		document.getElementById("locationmap").style.backgroundPosition = xCoor+" "+yCoor;
	}



//**   1) hides region box and container (in case already showing another region) 
//**   2) shows the correct background image (for country map on-state)           
//**   3) fades in the the corresponding region into the box on the right
	function showRegion(layer_ref) {
		$('#cl_dropdown_box_right').hide(); // 1)
		$('#cl_dropdown_box_leftbox div').hide(); // 1)
		$('#box_bottom_right').fadeIn(500); // 3)
		$('#region_' + layer_ref).fadeIn(500); // 3)
	}



//**   1) hides language box and container (in case already showing another region's language   
//**   2) fades in the corresponding regions language box                                       
	function showLanguage(layer_ref) {
		$('#cl_dropdown_box_right div').hide(); // 1)
		$('#cl_dropdown_box_right').fadeIn(500); // 2)
		$('#language_'+layer_ref).fadeIn(500); // 2)
	}