(function($) {
	//public functions
	var methods = {
		init : function(options) {
			var defaults = {};
			
			var opts = $.extend(defaults, options);
			var $t = $(this);
					
			//attatch overmethod to all maplinks
			$t.find("a.mapLink").hover(methods.overLink, methods.outLink)
			//give the hit areas a background color and make them invisible (IE bug fix)
			.not(".mapRegionText").css({backgroundColor:"white",opacity:0.01}); 			
			
			$t.find("div.mapRegionImg").children("img.outline").css({opacity:0.5, zIndex:10})
			.siblings("img.shadow").css({opacity:0, zIndex: 5});			
/*
			$t.find("a.mapRegionText").hover(function(){
				var mapRegionClass = $(this).attr("rel");
				$t.find("a.mapRegionImg."+mapRegionClass).mouseover();
			}, function(){
				var mapRegionClass = $(this).attr("rel");
				$t.find("a.mapRegionImg."+mapRegionClass).mouseout();
			});
*/
			
		},
		overLink : function(){
			$("#content").delay(250);
			var $link = $(this),
			$container = $($link.attr("rel"));
			//show outline up and to the right			
			$container.children("img.outline").clearQueue().animate({
				top : -5,
				left : 5,
				opacity : 1
			}, 250, function(){
				$(this).css("z-index", 50);
			}).css("z-index", 100);
			//fade in shadow
			if(ie8){
				$container.children("img.shadow").show();
			}else{
				$container.children("img.shadow").clearQueue().animate({opacity:1}, 250);
			}
			
		},
		outLink : function(){
			var $link = $(this),
			$container = $($link.attr("rel"));
			//show outline up and to the right
			$container.children("img.outline").clearQueue().animate({
				top : 0,
				left : 0,
				opacity : 0.5
			}, 250, function(){
				$(this).css("z-index", 10);
			});
			//fade in shadow
			if(ie8){
				$container.children("img.shadow").hide();
			}else{
				$container.children("img.shadow").clearQueue().animate({opacity:0}, 250);
			}
			
		}
	}, ie8 = ($.browser.msie && $.browser.version < 9);
		

	/*
		private functions
	*/
	
	$.fn.regionMap = function(method) {
		//Method Calling Login
		if (methods[method]) {
			return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
		} else if (typeof method === 'object' || !method) {
			return methods.init.apply(this, arguments);
		} else {
			$.error('Method ' + method + ' does not exist on jQuery.');
		}
	};
})(jQuery);
