

/*
 * Tooltip script 
 */

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 */		
	$("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";		
	
		if( this.t.indexOf(".pdf")>-1){
				Tb=this.t.split(" - ");
				bul='<img src="Pict/I_File_Pdf.png" align="left" />&nbsp;&nbsp;'+Tb[1]+'<br/><br/><b>'+Tb[0]+"</b><br/>";			
					$("body").append("<p id='tooltip'>"+bul +"</p>");
		}	else{
			Tb=this.t.split(" - ");
			if(Tb.length==2){
					bul=Tb[0]+"<br/><b>"+Tb[1]+"</b>";
			}else if(Tb.length==3){
					bul=Tb[0]+"<br/><b>"+Tb[1]+"</b><br/>"+Tb[2];
			}else{
					bul=Tb[0];
			}
					$("body").append("<p id='tooltip'>"+bul +"</p>");
		}		  

		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("slow");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("a.tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


	
// starting the script on page load
$(document).ready(function(){
	tooltip();
});