/*

 * Tooltip script 

 * powered by jQuery (http://www.jquery.com)

 * 

 * written by Alen Grakalic (http://cssglobe.com)

 * 

 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery

 *

 */


this.tooltip = function(){	

	/* CONFIG */		

		xOffset = 10;

		yOffset = 20;		

		// these 2 variable determine popup's distance from the cursor

		// you might want to adjust to get the right result		

	/* END CONFIG */		

	$("#product-carousel a").hover(function(e){											  

		this.t = $(this).children('img').attr('alt');

		this.holdingTitle=$(this).attr('title');
		
		$(this).attr('title','');

		$(this).children('img').attr('alt','');

		$("#footer").append("<div id='tooltip'><span class='header'></span><div class='content'>"+ this.t +"</div><span class='footer'></span></div>");

		$("#tooltip")

			.css("top",(e.pageY - xOffset) + "px")

			.css("left",(e.pageX + yOffset) + "px")

			.fadeIn("fast");		

    },

	function(){
		
		$(this).attr('title',this.holdingTitle);
		
		$(this).children('img').attr('alt', this.t);

		this.alt = this.t;		

		$("#tooltip").remove();

    });	

	$("#product-carousel a").mousemove(function(e){

		$("#tooltip")

			.css("top",(e.pageY - xOffset) + "px")

			.css("left",(e.pageX + yOffset) + "px");

	});			
	
	$("#selector img").hover(function(e){											  

		this.t = this.alt;
		
		this.parts=this.t.split('/');

		this.alt = "";									  

		$("#imprint").append("<div id='tooltip'><span class='header'></span><div class='content'>"+ this.parts[0] +"<br />"+this.parts[1]+"</div><span class='footer'></span></div>");

		$("#tooltip")

			.css("top",(e.pageY - xOffset) + "px")

			.css("left",(e.pageX + yOffset) + "px")

			.fadeIn("fast");		

    },

	function(){

		this.alt = this.t;		

		$("#tooltip").remove();

    });	


	$("#selector img").mousemove(function(e){

		$("#tooltip")

			.css("top",(e.pageY - xOffset) + "px")

			.css("left",(e.pageX + yOffset) + "px");

	});

	$("#flash a").mousemove(function(e){

		$("#tooltip")

			.css("top",(e.pageY - xOffset) + "px")

			.css("left",(e.pageX + yOffset) + "px");

	});
	
	 $("#flash a").hover(function(e){											  								  

		$("#imprint").append("<div id='tooltip'><span class='header'></span><div class='content'>Click to view the latest training DVDs</div><span class='footer'></span></div>");

		$("#tooltip")

			.css("top",(e.pageY - xOffset) + "px")

			.css("left",(e.pageX + yOffset) + "px")

			.fadeIn("fast");		

    },

	function(){

		$("#tooltip").remove();

    });	

	$("#flash a").mousemove(function(e){

		$("#tooltip")

			.css("top",(e.pageY - xOffset) + "px")

			.css("left",(e.pageX + yOffset) + "px");

	});

};



