function nuevoAjax(){var A=false;try{A=new ActiveXObject("Msxml2.XMLHTTP")}catch(C){try{A=new ActiveXObject("Microsoft.XMLHTTP")}catch(B){A=false}}if(!A&&typeof XMLHttpRequest!="undefined"){A=new XMLHttpRequest()}return A}function TTECAjaxItem(C,A,B){this.URL=C;this.Error=false;this.Cargando=false;this.Cargado=false;this.onCargar=B;this.Tag=A;this.Ajax=null}TTECAjaxItem.prototype.Limpiar=function(){this.Error=false;this.Cargando=false;this.Cargado=false;this.Ajax=null};function TTECAjaxLista(){this.Items=new Array();this.TimerId=null;this._abortando=false}TTECAjaxLista.prototype.Abortar=function(){this._abortando=true;window.clearInterval(this.TimerId);this.TimerId=null;for(var A=this.Items.length-1;A>=0;A--){var B=this.Items[A];B.Ajax.abort();B.Cargando=false;B.Cargado=false;B.Error=false;this.Items.remove(A)}this._abortando=false};TTECAjaxLista.prototype.Add=function(A){this.Items.push(A);this.Lanzar(A)};TTECAjaxLista.prototype.Lanzar=function(A){if(A.Ajax!=null){A.Ajax.abort();A.Ajax=null}A.Cargando=true;A.Cargado=false;A.Error=false;A.Ajax=nuevoAjax();if(typeof (A.URL)=="function"){A.Ajax.open("GET",A.URL(A),true)}else{A.Ajax.open("GET",A.URL,true)}A.Ajax.send(null);this.LanzarTimer()};TTECAjaxLista.prototype.LanzarTimer=function(){if(this.TimerId!=null){return }var A=this;if(document.all){this.TimerId=window.setInterval(function(){A._procesar(A)},250)}else{this.TimerId=window.setInterval(this._procesar,250,this)}};TTECAjaxLista.prototype._procesar=function(B){for(var A=B.Items.length-1;A>=0;A--){if(B._abortando){return }var C=B.Items[A];if(C.Ajax.readyState==4){C.Cargando=false;C.Cargado=true;if(C.Ajax.status!=200){C.Error=true}B.Items.remove(A);C.onCargar(C)}}if(B.Items.length==0){window.clearInterval(B.TimerId);B.TimerId=null;return }}
