$(document).ready(function(){
	
	jQuery(document).ready(function() {
		
		jQuery("#map-container AREA").mouseover(function(){
			var regionMap = '.'+$(this).attr('id')+'-map';		
			var regionLink = 'a#'+$(this).attr('id')+'MapLink';
			
			jQuery(regionMap).css('display', 'inline');
			jQuery(regionLink).css('text-decoration', 'underline');
			
		}).mouseout(function(){
			var regionMap = '.'+$(this).attr('id')+'-map';
			var regionLink = 'a#'+$(this).attr('id')+'MapLink';
			
			jQuery(regionLink).css('text-decoration', 'none');
			
			// Check if a click event has occured and only change the Region hover state accodringly
			if (! jQuery(regionMap).hasClass('selected')) {
				jQuery(regionMap).css('display', 'none');
			}
		});

		jQuery("a#northlandMapLink").hover(	function(){jQuery("img.northland-map").css('display', 'inline');}, function(){ jQuery("img.northland-map").css('display', 'none');}	);		
		jQuery("a#aucklandMapLink").hover( function(){ jQuery("img.auckland-map").css('display', 'inline');}, function(){ jQuery("img.auckland-map").css('display', 'none');} );
		jQuery("a#coromandelMapLink").hover( function(){ jQuery("img.coromandel-map").css('display', 'inline');}, function(){ jQuery("img.coromandel-map").css('display', 'none');} );
		jQuery("a#waikatoMapLink").hover( function(){ jQuery("img.waikato-map").css('display', 'inline');}, function(){ jQuery("img.waikato-map").css('display', 'none');} );
		jQuery("a#bay_of_plentyMapLink").hover( function(){ jQuery("img.bay_of_plenty-map").css('display', 'inline');}, function(){ jQuery("img.bay_of_plenty-map").css('display', 'none');} );
		jQuery("a#tairawhitiMapLink").hover( function(){ jQuery("img.tairawhiti-map").css('display', 'inline');}, function(){ jQuery("img.tairawhiti-map").css('display', 'none');} );
		jQuery("a#taranakiMapLink").hover( function(){ jQuery("img.taranaki-map").css('display', 'inline');}, function(){ jQuery("img.taranaki-map").css('display', 'none');} );		
		jQuery("a#hawkes_bayMapLink").hover( function(){ jQuery("img.hawkes_bay-map").css('display', 'inline');}, function(){ jQuery("img.hawkes_bay-map").css('display', 'none');} );
		jQuery("a#wanganui_manawatuMapLink").hover( function(){ jQuery("img.wanganui_manawatu-map").css('display', 'inline');}, function(){ jQuery("img.wanganui_manawatu-map").css('display', 'none');} );		
		jQuery("a#tararuaMapLink").hover( function(){ jQuery("img.tararua-map").css('display', 'inline');}, function(){ jQuery("img.tararua-map").css('display', 'none');} );
		jQuery("a#wairarapaMapLink").hover( function(){ jQuery("img.wairarapa-map").css('display', 'inline');}, function(){ jQuery("img.wairarapa-map").css('display', 'none');} );
		jQuery("a#wellingtonMapLink").hover( function(){ jQuery("img.wellington-map").css('display', 'inline');}, function(){ jQuery("img.wellington-map").css('display', 'none');} );
		jQuery("a#nelson_baysMapLink").hover( function(){ jQuery("img.nelson_bays-map").css('display', 'inline');}, function(){ jQuery("img.nelson_bays-map").css('display', 'none');} );
		jQuery("a#marlboroughMapLink").hover( function(){ jQuery("img.marlborough-map").css('display', 'inline');}, function(){ jQuery("img.marlborough-map").css('display', 'none');} );
		jQuery("a#west_coastMapLink").hover( function(){ jQuery("img.west_coast-map").css('display', 'inline');}, function(){ jQuery("img.west_coast-map").css('display', 'none');} );
		jQuery("a#canterburyMapLink").hover( function(){ jQuery("img.canterbury-map").css('display', 'inline');}, function(){ jQuery("img.canterbury-map").css('display', 'none');} );
		jQuery("a#southlandMapLink").hover( function(){ jQuery("img.southland-map").css('display', 'inline');}, function(){ jQuery("img.southland-map").css('display', 'none');} );
		jQuery("a#otagoMapLink").hover( function(){ jQuery("img.otago-map").css('display', 'inline');}, function(){ jQuery("img.otago-map").css('display', 'none');} );		
	});
		
});
