(function ($) {
	$(document).ready(function() {
		var InteractiveMap = {
			areas: $('.image-map-area'),
				
			initialize: function() {
				// disable clicking on areas
				InteractiveMap.areas.each(function() {
					$(this).click(function(e) {
						return false;
					});
				});
				
				// grab the content
				var $this, popup;
				InteractiveMap.areas.each(function() {
					$this = $(this),
					popup = InteractiveMap.getLabel($this);
					$this.qtip({
						content: popup.html(),
						show: { delay: 0 },
						hide: {
							when: 'mouseout',
							fixed: true
						},
						position: {
							corner: {
								target: 'topLeft',
								tooltip: 'bottomRight'
							}
						},
						style: {
							background: 'black',
							border: {
								width: 1,
								radius: 5,
								color: 'black'
							},
							padding: 5,
							width: 250
						}
					});
				});
			},
			
			getLabel: function(area) {
				var id = $(area).attr('id');
				id = id.split('_');
				
				return $('#' + id[0] + 'Label_' + id[1]);
			}
		}
		
		InteractiveMap.initialize();
	});
})(jQuery);