var PosWinY;
var PosWinX;

HelpMsg = {
	Init : function(e)
	{
		PosWinY = Event.pointerY(e);
		PosWinX = Event.pointerX(e);
	},
	errors : function(s)
	{
		alert(s);
	},
	ShowMsg: function(help)
	{
		if($('HelpMsg'))
			Loading.close('HelpMsg');

		var d = document.createElement("div");
		d.setAttribute("id", "HelpMsg");
		d.className = "HelpMsg";
		d.style.width = "300px";

		if(PosWinX)
			d.style.left = (PosWinX + 20) + "px";
		else
			d.style.left = document.body.scrollWidth / 2 - 320 + "px";

		if(PosWinY)
			d.style.top = PosWinY + "px";
		else
			d.style.top = 10 + "px";

		var html_code='<table cellpadding="0" cellspacing="0" width="100%">'+
		'<tr><td class="lbb_bg pad_10" valign="top align="justify">'+
		help.replace("'", "'+"+'"'+"'"+'"'+"+'")+
		'</td></tr><tr><td valign="top" class="pad_left_20">'+
		'<img src="/img/think_bottom.gif">'+
		'</td></tr></table>';

		
		d.innerHTML = html_code;
		document.body.appendChild(d);

		Effect.Grow(d);
		//new Draggable('HelpMsg', {} );

	},
	close: function(name)
	{
		if($(name))
		{
			Effect.Shrink($(name));
		}
	}
}


function show_help(element, help)
{
	if (help == undefined)
		help='no text';
	if ((element != undefined) && (help !=''))
	{

		var html_code='<table cellpadding="0" cellspacing="0" width="100%">'+
		'<tr><td class="lbb_bg pad_10" valign="top align="justify">'+
		help.replace("'", "'+"+'"'+"'"+'"'+"+'")+
		'</td></tr><tr><td valign="top" class="pad_left_20">'+
		'<img src="/img/think_bottom.gif">'+
		'</td></tr></table>';
		
		new Tip(element, html_code, {
		  className: 'yellow',
		  hook: {target: 'bottomLeft', tip: 'topRight'},
		  hideOn: { element: 'tip', event: 'mouseout'},
		  offset: {x:0, y:-20},
		  closeButton: false
		});
	}
}

function show_region_help(element, help)
{
	if (help == undefined)
		help='no text';
	if ((element != undefined) && (help !=''))
	{
		var html_code='<table cellpadding="0" cellspacing="0" width="100%"><tr><td valign="top" align="right" width="16" style="padding-top: 15px;"><img src="/img/tip/yellow_think.gif"></td><td valign="top">'+
		'<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr>'+
		'<td valign="bottom" width="8"><img src="/img/tip/yellow_t_l.gif"></td>'+
		'<td width="100%" class="just_yellow"><img src="/img/spacer.gif"></td>'+
		'<td valign="bottom" width="8" align="right"><img src="/img/tip/yellow_t_r.gif"></td>'+
		'</tr><tr><td colspan="3" class="internal"><font class="header_text">'+
		help+
		'</font></td></tr><tr>'+
		'<td valign="top" width="8"><img src="/img/tip/yellow_b_l.gif"></td>'+
		'<td width="100%" class="just_yellow"><img src="/img/spacer.gif"></td>'+
		'<td valign="top" width="8" align="right"><img src="/img/tip/yellow_b_r.gif"></td>'+
		'</tr></table>'+
		'</td></tr></table>';
		new Tip(element, html_code, {
		  className: 'yellow',
		  offset: {x:10, y:-10},
		  closeButton: false
		});
	}
}