var as;(function(){window.as={message:{id:"ASLibMessage",stylize:false,style:"### {position: fixed; top: 5px; right: 5px; width: 300px; max-height: 300px; overflow: auto; z-index: 100;} ### p {font: 12px 'Arial', sans-serif; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sGChA6Krbk51cAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAADUlEQVQI12NgYGCoBwAAhACAxkwJbwAAAABJRU5ErkJggg==); color: #fff; margin: 2px 0px; padding: 2px 5px;}### p.error {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sGChEKLxgKTxwAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAADUlEQVQI12OYycBQDwAC6AEZ51MAhAAAAABJRU5ErkJggg==);}### p.information {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sGChELAzPJEr4AAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAADUlEQVQI12NgYJhZDwABtgEZywP5qgAAAABJRU5ErkJggg==);}### p.success {background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sGChEKIIi1Uo0AAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAADUlEQVQI12NgmMlQDwACTwEZQpnJEgAAAABJRU5ErkJggg==);}"},euc:encodeURIComponent,duc:decodeURIComponent,init:function(){var b,a={};if(!(b=as.get(as.message.id))){a.div=as.create("div",{id:as.message.id});as.append(document.body,a.div);b=as.get(as.message.id)}if(as.message.stylize){as.message.style=as.message.style.replace(/###/g,"#"+as.message.id);a.style=as.create("style");as.append(a.style,as.text(as.message.style));as.append(document.head,a.style)}},get:function(b){var a;if(null===(a=document.getElementById(b))){return false}else{return a}},create:function(c,e){var d,b;d=document.createElement(c);if(typeof e==="object"){for(b in e){if(e.hasOwnProperty(b)){d[b]=e[b]}}}return d},text:function(b){var a;a=document.createTextNode(b);return a},append:function(a,b){a.appendChild(b)},prepend:function(a,b){if(a.childNodes.length===0){as.append(a,b)}else{a.insertBefore(b,a.firstChild)}},addClass:function(g,h){var e,d,f=false,c=[];if(/^[_a-zA-Z]+[_a-zA-Z0-9\-]*$/.test(h)&&!(!g)&&null!==g){if(g.className.length!==0){g.className=g.className.replace(/[\t\s]+/g," ");c=g.className.split(" ")}for(e=0,d=c.length;e<d;e++){if(c[e]===h){f=true;break}}if(!f){c.push(h)}g.className=c.join(" ")}},remClass:function(f,g){var e,d,c=[],h=[];if(/^[_a-zA-Z]+[_a-zA-Z0-9\-]*$/.test(g)&&!(!f)&&null!==f){if(f.className.length!==0){f.className=f.className.replace(/[\t\s]+/g," ");c=f.className.split(" ")}for(e=0,d=c.length;e<d;e++){if(c[e]!==g){h.push(c[e])}}f.className=h.join(" ")}},m:function(d,f){var e=as.get(as.message.id),a,b={};switch(f){case"success":case"sucesso":case"1":case 1:a="success";break;case"error":case"erro":case"-1":case -1:a="error";break;case"debug":a="debug";break;case"information":case"informacao":case"0":case 0:a="information";break}b.p=as.create("p",{className:a});as.append(b.p,as.text(d));as.append(e,b.p);e.scrollTop=e.scrollHeight},async:function(d,c,b){try{this.xmlHttp=new XMLHttpRequest()}catch(g){try{this.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(f){try{this.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){as.m("Seu agente de navegação não suporta requisições assíncronas.",-1)}}}this.arquivo=d;this.metodo=c;this.dados=b;this.resposta="";this.json={};var a=this;a.traduzJSON=function(){this.json=JSON.parse(this.resposta);this.m()};a.m=function(){var i,h;if(this.json.mensagem!==null){for(i in this.json.mensagem){if(this.json.mensagem.hasOwnProperty(i)){for(h=0;h<this.json.mensagem[i].length;h++){as.m(this.json.mensagem[i][h],i)}}}}};a.rs0=function(){};a.rs1=function(){};a.rs2=function(){};a.rs3=function(){};a.rs4=function(){};a.s404=function(){as.m("Erro na requisição assíncrona: o arquivo não foi encontrado.",-1)};a.s0=function(){as.m("Erro na requisição assíncrona: offline.",-1)};a.aborta=function(){this.abort()};a.xmlHttp.onreadystatechange=function(){switch(a.xmlHttp.readyState){case 0:a.rs0();break;case 1:a.rs1();break;case 2:a.rs2();break;case 3:a.rs3();break;case 4:switch(parseInt(a.xmlHttp.status,10)){case 0:a.s0();break;case 404:a.s404();break;case 200:a.resposta=a.xmlHttp.responseText;a.rs4();break;default:as.m("Erro na requisição assíncrona: a requisição retornou um código de status "+a.xmlHttp.status+".",-1);break}break}};a.chama=function(){switch(this.metodo){case"post":a.xmlHttp.open(this.metodo,this.arquivo,true);a.xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");a.xmlHttp.send(this.dados);break;case"get":a.xmlHttp.open(this.metodo,this.arquivo+"?"+this.dados,true);a.xmlHttp.send(null);break;default:as.m("Erro na requisição assíncrona: método não reconhecido.",-1);break}}},fila:{iniciada:false,rodando:false,comandos:0,inicio:{},fim:{},comando:[],parametro:[],adiciona:function(b,a){if(!a){a={}}this.comando.push(b);this.parametro.push(a);if(!this.iniciada){this.iniciada=true;this.comandos=0;this.inicio=new Date();this.roda()}},roda:function(){if(this.comando.length>0&&!this.rodando){this.rodando=true;this.comando[0](function(){as.fila.avanca()},this.parametro[0]);this.comandos++}else{if(this.comando.length===0){this.para()}}},avanca:function(){if(this.comando.length>0){this.comando.shift();this.parametro.shift()}if(this.comando.length>0){this.rodando=false;this.roda()}else{this.para()}},para:function(){this.iniciada=false;this.rodando=false;this.fim=new Date()}}}}());
