//You need an anonymous function to wrap around your function to avoid conflict  
(function($){  

	//Attach this new method to jQuery  
	$.fn.extend({   
	
		//This is where you write your plugin's name  
		tooltip: function() {  
		
			//Set the default values, use comma to separate the settings, example:  
			var defaults = {}  
		
			var options =  $.extend(defaults, options);
				
			//Iterate over the current set of matched elements  
			return this.each(function() {  
				var o = options;        
        var obj = $(this);
				var title = obj.attr('title');		
				
				obj.removeAttr('title');  			
				obj.after("<div class='ttdiv'><div>" + title + "</div></div>");
				var ttdiv	= obj.next("div.ttdiv");			
				
				ttdiv.css({
					'display': 'none',
					'position': 'absolute',
					'z-index': '9999'
				});
							
				obj.mouseover(function(e) {
					obj.removeAttr('title');  			
					ttdiv.css({ 
						'top': e.pageY - 5,
						'left': e.pageX + 5,
					});  
					ttdiv.show();  
			
				});
				obj.mousemove(function(e) {  	
					ttdiv.css({ 
						'top': e.pageY - 5,
						'left': e.pageX + 5
					});  
				
				});
				obj.mouseout(function() {  			
					ttdiv.hide();
				});
	
			});  // return this.each(function() {
		}  
	});  

//pass jQuery to the function,   
//So that we will able to use any valid Javascript variable name   
//to replace "$" SIGN. But, we'll stick to $ (I like dollar sign: ) )         
})(jQuery);  
