function _getCenterXAlert(pWidth){ lCenter=window.innerWidth/2; return lCenter-(pWidth/2) } function _getCenterYAlert(pHeight){ lCenter=window.innerHeight/2; return lCenter-(pHeight/2) } function _alertClose(){ lColectionDiv=document.getElementsByTagName("div") document.body.removeChild(lColectionDiv[lColectionDiv.length-1]) document.body.removeChild(lColectionDiv[lColectionDiv.length-1]) if (this.after_close) this.after_close(); window.onkeydown=null } function alert(pMsg,pFunction,pAlertType,pTitle){ if (!pTitle) pTitle=".: :."; if (pAlertType=="") pAlertType="ok"; else if (pMsg!="") { if (pMsg.search("Error:")>-1 || pMsg.search("Error :")>-1) pAlertType="error" else if (pMsg.search("Warning")>-1) pAlertType="warning" else pAlertType="ok"; } this.overlay=document.createElement("div") this.overlay.setAttribute("style","background-color:#e6e6e6;opacity:0.5;position:absolute;top:0px;left:0px;width:100%;height:100%") this.overlay.style.height=parent.document.body.scrollHeight+((parent.document.body.scrollHeight-parent.document.body.offsetHeight-1)*5); document.body.appendChild(this.overlay) this.alert_window=document.createElement("div") lHTML="" if (pTitle) { lHTML+="" lHTML+="" lHTML+="" } lHTML+="" lHTML+="" lHTML+="" lHTML+="" lHTML+="" lHTML+="" lHTML+="" lHTML+="
"+pTitle+"
"+pMsg+"

" this.alert_window.innerHTML=lHTML if (!document.getElementById("divAlert")) document.body.appendChild(this.alert_window) this.alert_window.setAttribute("style","position:absolute;top:"+_getCenterYAlert(this.alert_window.offsetHeight)+";left:"+_getCenterXAlert(350)) lInputs=this.alert_window.getElementsByTagName("input") lInputs[lInputs.length-1].close=_alertClose lInputs[lInputs.length-1].alert_window=this lInputs[lInputs.length-1].focus(); if (pFunction) lInputs[lInputs.length-1].after_close=pFunction window.onkeydown=function (event){ if(event.keyCode==9) return false; else return true; }; }