/* generic loadhandler script for ezform */
if (typeof loadHandler == "undefined") {
var loadHandler = new Array();
if (typeof window.onload=='function') loadHandler.push(window.onload);
window.onload = function() { for(var i = loadHandler.length-1; i >= 0; i--) { var f = loadHandler[i]; f(); } } }

/* add start function to loadhandler */
function BalloonLoad(csslocation) { loadHandler.push(function() { BalloonInit(csslocation);}) }

var BalloonTimerShow;
var BalloonTimerHide;

function BalloonInit(csslocation) {
/* create balloon element */
if (document.getElementById('BalloonHelp')) { 
/* balloon already exists */ } else {
var ElementToAdd=document.createElement('span');
ElementToAdd.id='BalloonHelp'; 
ElementToAdd.style.zIndex=120;
ElementToAdd.style.display='none';
ElementToAdd.style.position='absolute';
ElementToAdd.style.width=325; ElementToAdd.style.cursor='default';
ElementToAdd.onmouseover=KeepBalloonShown; ElementToAdd.onmouseout=BalloonOut;
document.getElementsByTagName("body").item(0).appendChild(ElementToAdd);
document.getElementById('BalloonHelp').innerHTML='<img id="ezformtooltiplt" style="position: absolute;" src="'+csslocation+'css/ezformtooltiplt.gif" border=0 width=325 height=29><img id="ezformtooltiprt" style="left:0px;" src="'+csslocation+'css/ezformtooltiprt.gif" border=0 width=325 height=29><br><table width=325 cellspacing=0 cellpadding=0 border=0><tr><td width=12 background="'+csslocation+'css/ezformtooltiplm.gif"></td><td bgcolor="#FFFFE7" width=301><font face="verdana" size="1" color="black"><span id="BalloonHelp_text"></span></td><td width=12 background="'+csslocation+'css/ezformtooltiprm.gif"></td></tr></table><img src="'+csslocation+'css/ezformtooltipb.gif" width="325" height="10">';
/* add iframe one level below to cover up select boxes in IE, works only in IE5.5+ */
var ElementToAdd=document.createElement('iframe');
ElementToAdd.id='BalloonHelpIFrame'; 
ElementToAdd.scrolling="no";
ElementToAdd.style.zIndex=119;
ElementToAdd.frameBorder="0";
ElementToAdd.src="javascript:false;" 
ElementToAdd.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';
ElementToAdd.style.display='none';
ElementToAdd.style.position='absolute';
document.getElementsByTagName("body").item(0).appendChild(ElementToAdd);}}

function BalloonHelp(e,helptext) {
BalloonOut();
var docX, docY; 
/* get current scroll position */
evt = e || window.event;
var e = evt; //document.all?window.event:evt; 
if ( e.clientX ) { 
docX = e.clientX + document.body.scrollLeft; 
docY = e.clientY + document.body.scrollTop;}
if (e.pageX) { docX = e.pageX; docY = e.pageY; } 

BalloonTimerShow=setTimeout(function(){BalloonShow(docX,docY,helptext)},800);}

function BalloonOut() {
try {clearTimeout(BalloonTimerShow);} catch(e){}; 
BalloonTimerHide=setTimeout(BalloonHide,400);}

function BalloonHide() {
try {clearTimeout(BalloonTimerHide);} catch(e){};
document.getElementById('BalloonHelp').style.display='none';
document.getElementById('BalloonHelpIFrame').style.display='none';}

function KeepBalloonShown() {
try {clearTimeout(BalloonTimerHide);} catch(e){};
try {clearTimeout(BalloonTimerShow);} catch(e){};
document.getElementById('BalloonHelp').style.display='block';
document.getElementById('BalloonHelpIFrame').style.display='block';}

function BalloonShow(mousex,mousey,helptext) {
try {clearTimeout(BalloonTimerHide);} catch(e){};
try {clearTimeout(BalloonTimerShow);} catch(e){};
var daObj=document.getElementById('BalloonHelp').style;
document.getElementById('BalloonHelp_text').innerHTML=helptext;
if (window.innerWidth) var w=window.innerWidth; else var w=document.body.clientWidth;
if (mousex+325 < w){
document.getElementById('ezformtooltiplt').style.visibility='visible';
document.getElementById('ezformtooltiprt').style.visibility='hidden';
daObj.left=mousex-18; daObj.top=mousey-4;
} else {
document.getElementById('ezformtooltiprt').style.visibility='visible';
document.getElementById('ezformtooltiplt').style.visibility='hidden';
daObj.left=mousex-309; daObj.top=mousey-4;}	
document.getElementById('BalloonHelpIFrame').style.top=parseInt(daObj.top)+19;
document.getElementById('BalloonHelpIFrame').style.left = daObj.left 
document.getElementById('BalloonHelpIFrame').style.width = daObj.width;
document.getElementById('BalloonHelpIFrame').style.height= 33; /* should be offsetheight */
document.getElementById('BalloonHelpIFrame').style.display='block';
document.getElementById('BalloonHelp').style.display='block';
}

