$(function() {
    // $('img.husKart').maphilight();
	tooltip();

			//         $('#imgmapdiv area').hover(function(e) {
			// var theTitle = $(this).attr("title");
			// 	
			// if (theTitle) {
			// 	$('#tooltip').fadeIn('fast', function() {
			// 		$('#tooltip').text(theTitle);
			// 	})
			// }
			//         }).mouseout(function(e) {
			//             $('#tooltip').fadeOut('fast');
			// 
			//         }).click(function(e) { e.preventDefault(); });
})

function tooltip() {	
	xOffset = 5;
	yOffset = 190;			// 
		// $("#imgmapdiv area").live("mouseover", function(e){
		// 	if (this.title == '') return;
		// 	
		// 	var el = this;
		// 										  
		// 	el.t = el.title;
		// 	el.title = "";
		// 	if (el.t != "undefined") {
		// 		
		// 		el.theClass = $(this).attr('class');
		// 		
		// 		if ($(this).hasClass('end')) var imgSrc = 'plan1.jpg';
		// 		else var imgSrc = 'plan2.jpg';
		// 		
		// 		// if ($(this).hasClass('left')) xOffset = -450;
		// 		// else xOffset = 'right';
		// 							  
		// 		$("body").append("<p id='tooltip'><img src='/img/" + imgSrc + "'><br>" + el.t +"</p>");
		// 		$("#tooltip")
		// 			.css("top",(e.pageY - yOffset) + "px")
		// 			.css("left",(e.pageX + xOffset) + "px")
		// 			.fadeIn("fast");
		// 	}
		// })
		// .live("mouseout", function(e) {
		// 	this.title = this.t;		
		// 	$("#tooltip").remove();
		// })
		// .click(function(e) { e.preventDefault(); });
		
	$("#imgmapdiv area").hover(function(e){
		if (this.title == '') return;
		
		var el = this;
											  
		el.t = el.title;
		el.title = "";
		if (el.t != "undefined") {
			
			el.theClass = $(this).attr('class');
			
			if ($(this).hasClass('end')) var imgSrc = 'plan1.jpg';
			else var imgSrc = 'plan2.jpg';
			
			// if ($(this).hasClass('left')) xOffset = -450;
			// else xOffset = 'right';
								  
			$("body").append("<p id='tooltip'><img src='/img/" + imgSrc + "'><br>" + el.t +"</p>");
			$("#tooltip")
				.css("top",(e.pageY - yOffset) + "px")
				.css("left",(e.pageX + xOffset) + "px")
				.fadeIn("fast");
		}
	},
	function(e) {
		this.title = this.t;		
		$("#tooltip").remove();
	});


	$("#imgmapdiv area").live("mousemove", function(e){
		// if (leftOrRight == 'left') xOffset = -450;
		
		$("#tooltip")
			.css("top",(e.pageY - yOffset) + "px")
			.css("left",(e.pageX + xOffset) + "px");
	});			
};
    
