/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * based on
 * written by Alen Grakalic (http://cssglobe.com)
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 * converted to jQuery method by Vv (vaviloff.ru)
 * 
 * a nice way to init: 

    $(document).ready(function(){
        
        $("a[@title]").simpletip();
        
    });
 
 */
 
  jQuery.fn.simpletip = function (){

	/* CONFIG */		
		xOffset = 5;
		yOffset = 0;
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */	
    $("body").append("<div id='simpletip'><div id='simpletip_txt'></div></div>");
/*    
    $("#simpletip").css({
    	'position' : 'absolute',
    	'border' : '1px solid #333',
    	'background' : '#f7f5d1',
    	'padding' : '2px 5px',
    	'text-align' : 'left',
    	'color' : '#333',
    	'width' : '300px',
    	'font-size' : '11px',
    	'display' : 'none',
    	'font-family': 'Trebuchet MS'
	}); 
*/
    return this.each(function(){
        
        $(this).hover(
            function(e){
    		this.t = this.title;
    		this.title = "";		
    		// this.style.cursor = 'default';

            $("#simpletip_txt").html(this.t);
    		$("#simpletip")
    			.css("top",(e.pageY - yOffset) + "px")
    			.css("left",(e.pageX + xOffset) + "px")
    			.fadeIn(500);
            },
        	function(){
        		this.title = this.t;		
        		$("#simpletip").hide();
            })
        $(this).mousemove(function(e){
    		$("#simpletip")
    			.css("top",(e.pageY - yOffset) + "px")
    			.css("left",(e.pageX + xOffset) + "px");
        });		
    });
 }
