var input;
var help_bt;
var help_bt_id;
var help_bt_container;
var tip_content;
var y_offset = 8;
var x_offset = -445;

function helpToolTip(_form_id, _help_bt_id, _tip_content)
{
	input = document.getElementById('query');//document.getElementById(input_id);
	help_bt_id = _help_bt_id;
	tip_content = _tip_content;
	input.onfocus = showHelpBt; 
	input.onblur = hideHelpBt;
	showHelpBt();

		//--- pokaż ikonkę pomocy w textfieldzie ---//
			
	function showHelpBt()
	{
		if(!help_bt_container)
		{
			help_bt_container = document.createElement("div");
			help_bt_container.style.position = 'absolute';
			help_bt_container.style.right = '94px';			
			help_bt_container.style.top = '46px';
			if(navigator.appName=='Microsoft Internet Explorer')
				help_bt_container.style.top = '48px';			
			help_bt_container.style.width = '20px';			
			help_bt_container.style.height = '16px';
			input.parentNode.appendChild(help_bt_container);
		}
		
		if(!document.getElementById(help_bt_id))
		{
			help_bt = document.createElement("a");
			help_bt.id = help_bt_id;
			help_bt.style.position = 'absolute';
			help_bt.style.right = '2px';			
			help_bt.style.top = '0px';			
			help_bt_container.appendChild(help_bt);
			help_bt.onclick = '';
		}
		help_bt.style.display = 'block';
		
		$(help_bt).hover(function(e){	
			offset = $(help_bt).offset();
			start_x = offset.left;
			start_y = offset.top;
			this.t = tip_content;
			this.title = "";
			if(!$("#tooltip").get(0))
				$("body").append("<p id='tooltip'>"+ this.t +"</p>");
			$("#tooltip")
				.css("position","absolute")
				.css("top",(start_y - y_offset) + "px")
				.css("left",(start_x + x_offset) + "px")
				.fadeIn("slow");		
	    },
		function(){
			this.title = this.t;
			$("#tooltip")
				.fadeOut("fast");
				//.remove();
	    });
			
		
	}
	
		//--- ukryj ikonkę pomocy w textfieldzie ---//

	function hideHelpBt()
	{
		if(help_bt = document.getElementById(help_bt_id))
			help_bt.style.display = 'none';		
			//help_bt.parentNode.removeChild(help_bt);
	}

}
