var htmlReady = 0 ;
var UserAgent = navigator.userAgent ;
var AppVersion = (((navigator.appVersion.split('; '))[1].split(' '))[1]) ;
function setHtmlReady()
{
    htmlReady =1 ;
}
function setHTML(strURL)
{
    var oIFRAME = document.all.if1 ;
    oIFRAME.src = strURL ;
//    oIFRAME.attachEvent("onload", setHtmlReady) ;
    htmlReady =1 ;
}
function getHTML()
{
    return document.all.if1.contentWindow.document.body.innerHTML ;
}
function showBaloon(url, e, t)
{
    if (UserAgent.indexOf("MSIE") < 0 || AppVersion < 5) return ;
    if (!t) t=0 ;
    document.all.sl_Div.innerHTML = "<p>&nbsp;</p>" ;
    setHTML(url) ;
    setTimeout("realShowBaloon("+e.x+","+e.y+", "+t+");", 500) ;
    return ;
}
function realShowBaloon(x,y,t)
{
    var realWidth = document.body.clientWidth - 148 ;
    var meanWidth = realWidth / 2 ;
    var divWidth = document.all.sl_Div.scrollWidth ;
    var messageHtml ;
				    
    if (UserAgent.indexOf("MSIE") < 0 || AppVersion < 5) return ;
						
    if (htmlReady)
    {
		messageHtml = getHTML() ;
		if (t == 1)
			guide = "" + messageHtml;
		else
			guide = "" + "<table width=460 cellpadding=0 cellspacing=1 border=0 bgcolor=#cccccc><tr><td>"+
				"<table width=100% cellpadding=0 cellspacing=0 border=0 bgcolor=#ffffff><tr><td height=20></td></tr>"+
				"<tr><td>"+ messageHtml + "</td><td width=34 nowrap></td></tr>"+
				"<tr><td height=20></td></tr></table></td></tr></table>" ;

		if (divWidth < 250)
			divWidth = 250 ;

		if (x < meanWidth)
			document.all.sl_Div.style.left = x + document.body.scrollLeft +10;
		else
			document.all.sl_Div.style.left = x + document.body.scrollLeft - divWidth +10;

		document.all.sl_Div.innerHTML = guide ;

		if(y+document.all.sl_Div.clientHeight <= document.body.clientHeight)
			document.all.sl_Div.style.top = y + document.body.scrollTop - 10	;
		else
			document.all.sl_Div.style.top = document.body.clientHeight - document.all.sl_Div.clientHeight + document.body.scrollTop - 10;
    }
    else {	
		setTimeout("realShowBaloon("+x+","+y+", "+t+");", 500) ;
    }
    return ;
}
function moveBaloon(e)
{
    var realWidth = document.body.clientWidth - 148 ;
    var meanWidth = realWidth / 2 ;
    var divWidth = document.all.sl_Div.scrollWidth ;
	
    if (divWidth < 250)
	divWidth = 250 ;

    if (e.x < meanWidth)
	document.all.sl_Div.style.left = e.x + document.body.scrollLeft +10;
    else
	document.all.sl_Div.style.left = e.x + document.body.scrollLeft - divWidth +10;

    if(e.y+document.all.sl_Div.clientHeight <= document.body.clientHeight)
		document.all.sl_Div.style.top = e.y + document.body.scrollTop - 10;
    else
		document.all.sl_Div.style.top = document.body.clientHeight - document.all.sl_Div.clientHeight + document.body.scrollTop - 10;

	if (htmlReady)
	document.all.sl_Div.style.visibility = "visible" ;

				
    return ;
}
function hideBaloon()
{
    document.all.sl_Div.style.visibility = "hidden" ;
    htmlReady = 0 ;
    return ;
}




