/* Popup message, req. dojo and maybe default.js 
	TEST=["TITLE","MESSAGE"]
	onMouseOver="PopupMsg(this,'TEST')"
	onMouseOut="HIDE('PopupBox',1)"
*/
function wr(TXT){document.write(TXT)}
wr('<STYLE>.hide {display:none;}\n.show {}\n'+
'#PopupBox{position:absolute;z-index:1000;left:0px;top:0px;margin:0px;width:300px;}\n'+
'#PopupBox .popup-bg {overflow:hidden;width:278px;display:block;padding:2px 12px 0 10px;background:url(/manta/images/popup/bg-popup.png) repeat-y;}\n'+
'#PopupBox .popup-top {overflow:hidden;width:300px;height:4px;display:block;font-size:0;line-height:0;background:url(/manta/images/popup/bg-popup-top.png) no-repeat;}\n'+
'#PopupBox .popup-bottom {overflow:hidden;width:300px;height:16px;display:block;font-size:0;line-height:0;background:url(/manta/images/popup/bg-popup-bottom.png) no-repeat;}\n'+
'#PopupBox_Title  {display:block;background:#fffcc8;border:1px solid #afcf89;color:#5d5d6c;\n'+
'font-family:Verdana,Arial,Helvetica,sans-serif;font-size:10px;line-height:13px;font-weight:bold;\n'+
'margin:0px;margin-bottom:5px;padding-top:6px;padding-right:5px;padding-bottom:6px;padding-left:5px;}\n'+
'#PopupBox_Msg  {overflow:hidden;padding:0px;padding-right:5px;padding-left:5px;margin-bottom:10px;font-weight:normal;}\n'+
'#PopupBoxEmpty{position:absolute;left:0px;top:0px;margin:0px;z-index:1000;}\n'+
'</STYLE>\n<div id=PopupBox class=hide onMouseOver=KillTimeout(); onMouseOut="HIDE(this.id,0,1)"><span class=popup-top></span><div class=popup-bg><b id=PopupBox_Title></b><div id=PopupBox_Msg></div></div><span class=popup-bottom></span><img src=/manta/images/dot_clear.gif width=300 height=12 /></div>\n'+
'<div id=PopupBoxEmpty class=hide></div>'
)
//HIDE(\'PopupBox\',1)
function GetObj(ID){return document.getElementById(ID)}
function SHOW(ID){GetObj(ID).className='show'}
function HIDE_0(ID,KILL){if(KILL){KillTimeout()};GetObj(ID).className='hide';}
function HIDE(ID,KILL,DELAY){
	if(KILL){KillTimeout()}
	if(DELAY){myTimeEvt=setTimeout( function(){HIDE(ID)},100) }
	else {GetObj(ID).className='hide'}
}

ready="";
function MSG_Ready(){ready="complete"; return ready;}
dojo.addOnLoad(function(){MSG_Ready()})

function PopupMsg(srcObj,MsgID){
	if(ready=="complete"){
		KillTimeout() // kills prev timeout fxn if under .5 sec
		myTimeEvt=setTimeout(function(){PopupSetup(srcObj,MsgID)},500)
	}
}

function PopupSetup(srcObj,MsgID){
	TITLE=eval(MsgID+'[0]')
	MESSAGE=eval(MsgID+'[1]')
	GetObj('PopupBox_Title').innerHTML=TITLE
	GetObj('PopupBox_Msg').innerHTML=MESSAGE
	SHOW('PopupBox')
	PopHT=GetObj('PopupBox').offsetHeight-12 //+12 for transp gif // position above mouseover text
	PosPopMsg(srcObj,'PopupBox',-25,-PopHT)
}

myTimeEvt="";
function KillTimeout(){if(myTimeEvt != ""){clearTimeout(myTimeEvt)}}

function getAbsolutePosition(element) {
	var r = { x: element.offsetLeft, y: element.offsetTop };
	if (element.offsetParent) {
		var tmp = getAbsolutePosition(element.offsetParent);
		r.x += tmp.x;
		r.y += tmp.y;
	}
	//if(element.id){alert(element.id)}
	return r;
}
function PosPopMsg(srcObj,ID,xLeft,yTop){
	posobj=GetObj(ID)
	if(!xLeft){xLeft=0}
	if(!yTop){yTop=0}
	// get DIV abs pos or mouse pos
	r=getAbsolutePosition(srcObj)
	LTpx=r.x;TPpx=r.y;
	if(isNaN(LTpx)){
		var coords = findCoords(event);
		posobj.style.top = coords[1] + yTop + "px";
		posobj.style.left = coords[0] + xLeft + "px"
	} else {
		posobj.style.top = TPpx + yTop + "px";
		posobj.style.left = LTpx + xLeft + "px"
	}
	//alert('LT:'+LTpx+' TP:'+TPpx)
}