/* Copyright (c) 2008 Kean Loong Tan http://www.gimiti.com/kltan
 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * Copyright notice and license must remain intact for legal use
 * jHelpertip
 * Version: 1.0 (Jun 2, 2008)
 * Requires: jQuery 1.2+
 */
(function($) {
	$.fn.jHelperTip = function(options) {
		var getData = function(obj, e)
		{
			getPosition(e);
			$("#jHelperTipContainer").html("<img src='/img/ajax-loader3.gif' alt='' />").show();
			$.ajax({
				type: "GET",
				url: "/jx/dream.php",
				data: options.data,
				success: function(msg)
				{
					$("#jHelperTipContainer").html(msg);
				},
				error: function(msg)
				{
					$("#jHelperTipContainer").empty();
					$("#jHelperTipContainer").hide();
				}
			});
			
		};
		
		var getPosition = function(e)
		{
			var top = e.pageY + 3;
			var left = e.pageX + 10;
			$("#jHelperTipContainer").css({
				top: top,
				left: left
			});
			$("#jHelperTipContainer").show();
		};

		$(this).bind("mouseover", function(e)
		{
			e.preventDefault();
			getData(this, e);
			return false;
		});
		$(this).bind("mousemove", function(e)
		{
			getPosition(e);
			return false;
		});
		$(this).bind("mouseout", function(e)
		{
			$("#jHelperTipContainer").empty();
			$("#jHelperTipContainer").hide();
			return false;
		});
	};
})(jQuery);

