// JScript source code

var divWidth = 200 ;
var path = 'http://www.soyvisionario.com/visionario/widgets/tip' ;
var close_button = path + '/close_button.png' ;
/*
var unpressed_icon = path+'/help_button.PNG' ;
var pressed_icon = path+'/help_button.pressed.PNG' ;
*/

function showHelpDiv(id)
{
	var tbl = document.getElementById('tbl'+id) ;
	var div = document.getElementById('div'+id) ;
	var hlp = document.getElementById('hlp'+id) ;
	
	hlp.src = pressed_icon ;
	div.style.visibility='visible' ;
/*
	window_width = (window.innerWidth) ? window.innerWidth : document.body.clientWidth;
	divWidth = 200 ;
	divLeft = div.offsetLeft ;
	
//	alert(divLeft.toString() + ', ' + divWidth.toString() + ', ' + window_width.toString()) ;
	if (divLeft + divWidth > window_width)
	{
		div.style.left -= divWidth - window_width;
//		alert("a") ;
	}
*/
}

function hideHelpDiv(id)
{
	var div = document.getElementById('div'+id) ;
	var hlp = document.getElementById('hlp'+id) ;
	
	hlp.src = unpressed_icon ;
	div.style.visibility='hidden' ;
}


function drawHelpIcon(id)
{
	document.write("<img id='hlp"+id+"' src='"+unpressed_icon+"' onmouseover='javascript: showHelpDiv("+id+");' onmouseout='javascript: hideHelpDiv("+id+");'>") ;
}

function drawHelpDiv(id, title, text)
{
/*
	var img = document.getElementById('hlp'+id) ;
	window_width = (window.innerWidth) ? window.innerWidth : document.body.clientWidth;
	divLeft = img.offsetLeft ;

alert(divLeft.toString() + ', ' + divWidth.toString() + ', ' + window_width.toString()) ;

	if (divLeft + divWidth > window_width)
	{
		divLeft -= divWidth - window_width;
		alert("a") ;
	}
*/

	document.write("	<div id='div"+id+"' style='position:absolute; width:"+divWidth.toString()+"; height:0px; margin-right:10px; visibility:hidden; z-index:0' onmouseover='javascript: showHelpDiv("+id+");' onmouseout='javascript: hideHelpDiv("+id+");'>");
	document.write("		<frame>");
	document.write("		<table id='tbl"+id+"' width="+divWidth.toString()+" height=0px cellpadding=0 cellspacing=0 style='border: solid 2px #cfcfad; z-index: 1000'>");
	document.write("			<tr bgcolor=#dfdfbd>");
	document.write("				<td><font face=arial color=#000000 size=2><b>"+title+"</b></font></td>");
//	document.write("				<td onclick='javascript: hideHelpDiv("+id+");' valign=top align=right><img src='"+close_button+"' /></td>");
	document.write("			</tr>");
	document.write("			<tr bgcolor=#ffffff><td colspan=2></br></td></tr>");
	document.write("			<tr bgcolor=#ffffff>");
	document.write("				<td colspan=2>");
	document.write("					<font face=arial color=#555555 size=2>");
	document.write("						"+text+"</br></br>");
	document.write("					</font>");
	document.write("				</td>");
	document.write("			</tr>");
	document.write("		</table>");
	document.write("		</frame>");
	document.write("	</div>");
}

function draw(id,	title, text)
{
	drawHelpIcon(id) ;
	drawHelpDiv(id, title, text) ;
}

function draw(id,	title, text)
{
	drawHelpIcon(id) ;
	drawHelpDiv(id, title, text) ;
}