function xbtnAddEvListener(e,ev,fn){if(e.addEventListener)e.addEventListener(ev,fn,false);else if(e.attachEvent)e.attachEvent(ev,fn);}
function xbtnRegister(aa,ba,ca){xbtnAddEvListener(window,"beforeunload",function(){xbtnShowBox(ba);aa.blur();});xbtnAddEvListener(window,"load",function(){xbtnHideBox();});}
function xbtnShowBox(da,ea){var fa=document.getElementById("xbtnBox");if(!fa){fa=document.createElement("div");fa.id="xbtnBox";if(ea){fa.className=ea;}
else{fa.style.backgroundColor="#FF0000";fa.style.color="#FFFFFF";fa.style.padding="5px";fa.style.border="3px solid #FFFFFF";}
document.body.appendChild(fa);}
fa.style.position="absolute";fa.style.zIndex=999;fa.style.top="0px";fa.style.left="0px";fa.innerHTML=da;fa.style.display="";var ga=document.getElementById("xbtnBG");if(!ga){ga=document.createElement("iframe");ga.id="xbtnBG";ga.style.backgroundColor="#808080";ga.style.opacity=.30;ga.style.filter="alpha(opacity="+30+")";ga.scrolling="no";ga.frameBorder="0";document.body.appendChild(ga);}
ga.style.position="absolute";ga.style.zIndex=998;ga.style.top="0px";ga.style.left="0px";ga.style.width="100%";ga.style.height="100%";ga.style.display="";}
function xbtnHideBox(){var ha=document.getElementById("xbtnBox");if(ha)ha.style.display="none";var bg=document.getElementById("xbtnBG");if(bg)bg.style.display="none";}