this.tooltip = function(){	
	xOffset = 10;
	yOffset = 20;
	defaultWidth = 0;
	$(".tooltip").hover(function(e){											  
		this.t = this.title;
		this.data = this.t.split(';');
		this.title = "";
		this.i_posX = 0;
		
		if (this.data[1] < 1 || this.data[1] == null)
		{
			this.data[1] = defaultWidth;
		}
		$("body").append("<p id='tooltip'>" + this.data[0] + "</p>");
		
		if ($(window).width() - e.pageX > this.data[1])
		{
			this.i_posX = e.pageX + yOffset;
		}
		else
		{
			this.i_posX = e.pageX - yOffset - this.data[1];
		}
		
		$("#tooltip").css("top", (e.pageY - xOffset) + "px");
		$("#tooltip").css("left", this.i_posX + "px");
		if (this.data[1] > 0)
		{
			$("#tooltip").css("width", this.data[1] + "px");
		}
		$("#tooltip").fadeIn("fast");
    },
	function(){
		this.title = this.t;
		$("#tooltip").remove();
    });
	
	$(".tooltip").mousemove(function(e){
		if ($(window).width() - e.pageX > this.data[1])
		{
			$("#tooltip").css("left",(e.pageX + yOffset) + "px");
		}
		else
		{
			$("#tooltip").css("left",(e.pageX - yOffset - this.data[1]) + "px");
		}
		$("#tooltip").css("top",(e.pageY - xOffset) + "px");
	});

	///////////////////////////////////////////////////////////////
	
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");								 
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function(){
		this.title = this.t;	
		$("#preview").remove();
    });
	
	$("a.preview").mousemove(function(e){
		var test = $("preview").height();

		
		
		$("#preview")
			.css("top",(e.pageY - xOffset - test) + "px")
			.css("left",(e.pageX + yOffset) + "px");
			
		
	});			
};


