
lang.alertwin={'es':{cancel:"Cancelar",ok:"Confirmar",no_show:"Favor de no desplegar esta alerta."},'en':{cancel:"Cancel",ok:"Confirm",no_show:"Do not show me this alert again"}};alert_win={};AlertWin=Class.create();AlertWin.prototype={initialize:function(){this.id='alert_win';this.self=$(this.id);this.title=$(this.id+'_title');this.msg=$(this.id+'_msg');this.disable=$(this.id+'_disable');this.cancel=new ButtonComponent(this,this.id+'_cancel','cancel',lang.alertwin[cur_lang].cancel,'');this.confirm=new ButtonComponent(this,this.id+'_confirm','ok',lang.alertwin[cur_lang].ok,'');this.disabled={};this.injectBehaviours();},injectBehaviours:function(){($('alert_win_disable_holder')).appendChild(document.createTextNode(lang.alertwin[cur_lang].no_show));this.disable.onclick=this.disableAlert.bindAsEventListener(this);this.cancel.self.style.display='none';this.confirm.self.style.display='none';},centerPane:function(){this.self.style.visibility='hidden';this.self.style.display='';var w=this.self.offsetWidth;var h=this.self.offsetHeight;var pageScroll=ApexUtil.getPageScroll();var left=((screen_overlay.arrayPageSize[2]-w)/2);var top=((screen_overlay.arrayPageSize[3]-h)/2);this.self.style.top=(top<0)?"0px":(pageScroll[1]+top)+"px";if(console)console.log('top: '+this.self.style.top);this.self.style.left=(top<0)?"0px":left+"px";this.self.style.display='none';this.self.style.visibility='';},show:function(options){if(options){if(!this.disabled[options.id]){this.parent=options.id;screen_overlay.show();screen_overlay.parent=this;this.title.innerHTML=options.title;this.msg.innerHTML=options.msg;if(options.onconfirm){this.confirm.self.style.display='';this.confirm.self.onclick=options.onconfirm;}
if(options.oncancel){this.cancel.self.style.display='';this.cancel.self.onclick=options.oncancel;}
this.centerPane();this.self.style.display='';}else{options.onconfirm();}}},hide:function(){this.confirm.self.style.display='none';this.cancel.self.style.display='none';this.self.style.display='none';},disableAlert:function(e){if(this.parent){this.disabled[this.parent]=this.disable.checked;}}};