$(document).ready(function(){
	$(".slideshow-button").show();
	
	$("body #map-ctr").append('<div id="tip"></div>');
	var tooltip = "#tip";
	$("#m_imgmap area").hover(
		function(e){
			e.preventDefault();
			// first of all things change the text so the size changes
			var title = $(this).attr("title");
			$(tooltip).html("<strong>"+title+"</strong>");
			
			var coords = [];
			$($(this).attr("coords").split(",")).each(function(i){coords[i] = parseInt(this);});
			
			// the area
			var width = coords[2] - coords[0];
			var height = coords[3] - coords[1];
			
			// tooltip dimensions
			var offsetLeft = ($(tooltip).width() - width)/2;
			
			// tooltip position
			var left = coords[0] - offsetLeft + "px";
			var top = coords[1] + height + "px";
			
			$("#tip").css({'left': left, 'top': top}).show();
		},
		function(e){
			$(tooltip).hide();
		}
	);
	
	$("a.maplink[rel]").mouseover(
		function(){
			$(".mapimage:visible").hide();
			$("ul#map-menu .active, #map-ctr .active").removeClass("active");
			$(this).addClass("active");
			$($(this).attr("rel")).show();
		}
	);
	
	$('#slideshow').cycle({
		//fx: 'scrollHorz',
		timeout: 0,
		prev: '#slideshow-prev',
		next: '#slideshow-next'
		//pager: '#nav'
	});
});
