


$(document).ready( function() {								//When the document is ready
	
	jQuery.preloadImages = function(){
		 for(var i = 0; i<arguments.length; i++)
 		{
    jQuery("<img>").attr("src", arguments[i]);
  }
}

$.preloadImages(
				"/uploads/gtEast_tcm26-8348.gif",
				"/uploads/mid_tcm26-8349.gif",
				"/uploads/northEast_tcm26-8350.gif",
				"/uploads/northIre_tcm26-8351.gif",
				"/uploads/northWest_tcm26-8352.gif",			
				"/uploads/scotNorth_tcm26-8353.gif",			
				"/uploads/scotSouth_tcm26-8354.gif",			
				"/uploads/southCount_tcm26-8355.gif",			
				"/uploads/southWest_tcm26-8356.gif",			
				"/uploads/wales_tcm26-8357.gif",			
				"/uploads/yorkHum_tcm26-8358.gif"				
			);

	
	$('#mapBox3').addClass('js');

//This section deals with the hover effects--------------------------------------------------------------
	
	
 	//$('img#defaultMap').show();							//If Javascript is present show the map
 	
	$('#map_Map area, #mapHolder a').hover( function(){		//Get the areas in the image map and the links in the regions list
		
			var theSrc = $(this).attr('class');				//Get the class of whichever one is hovered
		
			switch(theSrc){
							
			case "gtEast": $('#defaultMap').attr({src: "/uploads/gtEast_tcm26-8348.gif"}); break;
							
			case "mid": $('#defaultMap').attr({src: "/uploads/mid_tcm26-8349.gif"}); break;
							
			case "northEast": $('#defaultMap').attr({src: "/uploads/northEast_tcm26-8350.gif"}); break;
							
			case "northIre": $('#defaultMap').attr({src: "/uploads/northIre_tcm26-8351.gif"}); break;
			
			case "northWest": $('#defaultMap').attr({src: "/uploads/northWest_tcm26-8352.gif"}); break;
			
			case "scotNorth": $('#defaultMap').attr({src: "/uploads/scotNorth_tcm26-8353.gif"}); break;
			
			case "scotSouth": $('#defaultMap').attr({src: "/uploads/scotSouth_tcm26-8354.gif"}); break;
			
			case "southCount": $('#defaultMap').attr({src: "/uploads/southCount_tcm26-8355.gif"}); break;
			
			case "southWest": $('#defaultMap').attr({src: "/uploads/southWest_tcm26-8356.gif"}); break;
			
			case "wales": $('#defaultMap').attr({src: "/uploads/wales_tcm26-8357.gif"}); break;
			
			case "yorkHum": $('#defaultMap').attr({src: "/uploads/yorkHum_tcm26-8358.gif"}); break;
		
				
			}},		
							function(){
			
			$('#defaultMap').attr({src: "/uploads/areamap_tcm26-8347.gif"}); //When hovered out the images src reverts to the default map
			
		}
	)

	
//This section deals with showing the correct details--------------------------------------------------------------

//when clicking on the list-----------------------------

	$('.detailsDivider').hide();
	
	$('#Scotland_North').show();
	
	
	$('#mapHolder a').click( function(){
		
		var showMe = $(this).attr('href');
		
		$('.detailsDivider').hide();
		
		$(showMe).show();		
		
		return false;
	});
	
	
//when clicking on the map-----------------------------
	
	$('#map_Map area').click( function(){
		
		var areaMe = $(this).attr('class');
		
		$('.detailsDivider').hide();
		
		$("div." + areaMe).show();		
		
		return false;
	});

});