
jz.StaticDialog=new Array();jz.Dialog=function(idPainel,options){if(jz.StaticDialog[idPainel]){return jz.StaticDialog[idPainel];}
jz.StaticDialog[idPainel]=new function(){var _onChangeFns=null;var _isVisible=false;var $dialog=$('#'+idPainel).dialog(options);var _getInstance=function(){_isVisible=true;return $dialog.show().dialog('open');}
this.isVisible=function(){return _isVisible;}
this.close=function(){this.destroy();}
this.destroy=function(){_getInstance().dialog('close').dialog('destroy');jz.StaticDialog[idPainel]=null;}
this.getDOMElement=function(){return _getInstance();}
this.change=function(fnName,fn){var instance=this;if(typeof fnName!='undefined'&&typeof fn=='function'){_onChangeFns[fnName]=fn;}else{$.each(_onChangeFns,function(i,fn){fn(instance);});}
return this;}
this.unbind=function(){_onChangeFns={};return this;}
this.setHTML=function(html){var phrase=jz.Lang.ts('Aguarde enquanto a página é carregada');var $dialog=_getInstance().scrollTo({top:0,left:0},400);var aguardeBox=$("<DIV id='aguardeBox' >"+phrase+"</DIV>");aguardeBox.css('width','400px').css({left:($dialog.width()-400)/2+'px',top:($dialog.height()-aguardeBox.height())/2+'px'});$dialog.find('p').html('').append(aguardeBox).append(html);this.change();aguardeBox.remove();return this;}};return jz.StaticDialog[idPainel].unbind();}