(function($) {
var cache = [];
$.preLoadImages = function() {
var args_len = arguments.length;
for (var i = args_len; i--;) {
var cacheImage = document.createElement('img');
cacheImage.src = arguments[i];
cache.push(cacheImage);
}
}
})(jQuery)
jQuery.preLoadImages('/common/images/hotelsmotels/map2.jpg', '/common/images/hotelsmotels/maplower.jpg', '/common/images/hotelsmotels/mapmid.jpg', '/common/images/hotelsmotels/mapupper.jpg', '/common/images/hotelsmotels/mapislands.jpg');
jQuery(document).ready(function()
{
$('#UpperCape').hide();
$('#MidCape').hide();
$('#LowerCape').hide();
$('#TheIslands').hide();
$('#notFound').hide();
$('area.showUpper').click(function()
	{
	$('.jQueryRestore').attr('src', '/common/images/hotelsmotels/mapupper.jpg')
	$('#imageMap').removeAttr('id');
	$('#customerOfTheMonth').fadeTo('slow', 0.20, function()
		{
		if (jQuery('#UpperCape').length>0)
		{
			if (jQuery('.active').length>0)
			{
			$('.active').slideUp(function()
				{
				$('.active').removeClass(function()
					{
					$('#UpperCape').slideDown(function()
						{
						$(this).addClass('active');
						});
					});
				});
			}
			else
			{
			$('#UpperCape').slideDown(function()
				{
				$(this).addClass('active');
				});
			}
		}
		else
		{
			if (jQuery('.active').length>0)
			{
			$('.active').slideUp(function()
				{
				$('.active').removeClass(function()
					{
					$('#notFound').slideDown(function()
						{
						$(this).addClass('active');
						});
					});
				});
			}
			else
			{
			$('#notFound').slideDown(function()
				{
				$(this).addClass('active');
				});
			}
		}
		});
	return false;
	});
$('area.showMid').click(function()
	{
	$('.jQueryRestore').attr('src', '/common/images/hotelsmotels/mapmid.jpg')
	$('#imageMap').removeAttr('id');
	$('#customerOfTheMonth').fadeTo('slow', 0.20, function()
		{
		if (jQuery('#MidCape').length>0)
		{
			if (jQuery('.active').length>0)
			{
			$('.active').slideUp(function()
				{
				$('.active').removeClass(function()
					{
					$('#MidCape').slideDown(function()
						{
						$(this).addClass('active');
						});
					});
				});
			}
			else
			{
			$('#MidCape').slideDown(function()
				{
				$(this).addClass('active');
				});
			}
		}
		else
		{
			if (jQuery('.active').length>0)
			{
			$('.active').slideUp(function()
				{
				$('.active').removeClass(function()
					{
					$('#notFound').slideDown(function()
						{
						$(this).addClass('active');
						});
					});
				});
			}
			else
			{
			$('#notFound').slideDown(function()
				{
				$(this).addClass('active');
				});
			}
		}
		});
	return false;
	});
$('area.showLower').click(function()
	{
	$('.jQueryRestore').attr('src', '/common/images/hotelsmotels/maplower.jpg')
	$('#imageLower').removeAttr('id');
	$('#customerOfTheMonth').fadeTo('slow', 0.20, function()
		{
		if (jQuery('#LowerCape').length>0)
		{
			if (jQuery('.active').length>0)
			{
			$('.active').slideUp(function()
				{
				$('.active').removeClass(function()
					{
					$('#LowerCape').slideDown(function()
						{
						$(this).addClass('active');
						});
					});
				});
			}
			else
			{
			$('#LowerCape').slideDown(function()
				{
				$(this).addClass('active');
				});
			}
		}
		else
		{
			if (jQuery('.active').length>0)
			{
			$('.active').slideUp(function()
				{
				$('.active').removeClass(function()
					{
					$('#notFound').slideDown(function()
						{
						$(this).addClass('active');
						});
					});
				});
			}
			else
			{
			$('#notFound').slideDown(function()
				{
				$(this).addClass('active');
				});
			}
		}
		});
	return false;
	});
$('area.showIslands').click(function()
	{
	$('.jQueryRestore').attr('src', '/common/images/hotelsmotels/mapislands.jpg')
	$('#imageMap').removeAttr('id');
	$('#customerOfTheMonth').fadeTo('slow', 0.20, function()
		{
		if (jQuery('#TheIslands').length>0)
		{
			if (jQuery('.active').length>0)
			{
			$('.active').slideUp(function()
				{
				$('.active').removeClass(function()
					{
					$('#TheIslands').slideDown(function()
						{
						$(this).addClass('active');
						});
					});
				});
			}
			else
			{
			$('#TheIslands').slideDown(function()
				{
				$(this).addClass('active');
				});
			}
		}
		else
		{
			if (jQuery('.active').length>0)
			{
			$('.active').slideUp(function()
				{
				$('.active').removeClass(function()
					{
					$('#notFound').slideDown(function()
						{
						$(this).addClass('active');
						});
					});
				});
			}
			else
			{
			$('#notFound').slideDown(function()
				{
				$(this).addClass('active');
				});
			}
		}
		});
	return false;
	});
$('.close').click(function()
	{
	$('.jQueryRestore').attr('id', 'imageMap');

	$('.active').slideUp(function()
		{
		$('.active').removeClass(function()
			{
			$('#customerOfTheMonth').fadeTo('slow', 1, function()
				{
				$('.jQueryRestore').attr('src', '/common/images/hotelsmotels/map2.jpg');
				});
			});
		});
	return false;
	});
$('.jQueryRestore').mousemove(function()
	{
		if (jQuery('#imageMap').length>0)
		{
			var islandSettings = {
    		interval: 10,
	    	over: hoverIslands,
	    	out: resetIslands
			};
			var upperSettings = {
    		interval: 10,
	    	over: hoverUpper,
	    	out: resetUpper
			};
			var midSettings = {
	    	interval: 10,
		    over: hoverMid,
    		out: resetMid
			};
			var lowerSettings = {
	    	interval: 10,
    		over: hoverLower,
    		out: resetLower
			};
		}
		else
		{
			var islandSettings = {
    		interval: 100,
	    	over: hoverIslands,
	    	out: resetIslands
			};
			var upperSettings = {
    		interval: 100,
	    	over: hoverUpper,
	    	out: resetUpper
			};
			var midSettings = {
	    	interval: 100,
		    over: hoverMid,
    		out: resetMid
			};
			var lowerSettings = {
	    	interval: 100,
    		over: hoverLower,
    		out: resetLower
			};
		}
	$('area.showIslands').hoverIntent(islandSettings);
	$('area.showUpper').hoverIntent(upperSettings);
	$('area.showMid').hoverIntent(midSettings);
	$('area.showLower').hoverIntent(lowerSettings);
		function hoverIslands()
		{
	$('.jQueryRestore').attr('src', '/common/images/hotelsmotels/mapislands.jpg');
		}
		function resetIslands()
		{
	$('#imageMap').attr('src', '/common/images/hotelsmotels/map2.jpg');
		}
		function hoverUpper()
		{
	$('.jQueryRestore').attr('src', '/common/images/hotelsmotels/mapupper.jpg');
		}
		function resetUpper()
		{
	$('#imageMap').attr('src', '/common/images/hotelsmotels/map2.jpg');
		}
		function hoverMid()
		{
	$('.jQueryRestore').attr('src', '/common/images/hotelsmotels/mapmid.jpg');
		}
		function resetMid()
		{
	$('#imageMap').attr('src', '/common/images/hotelsmotels/map2.jpg');
		}
		function hoverLower()
		{
	$('.jQueryRestore').attr('src', '/common/images/hotelsmotels/maplower.jpg');
		}
		function resetLower()
		{
	$('#imageMap').attr('src', '/common/images/hotelsmotels/map2.jpg');
		}
	});

});
