ControladorAjax=function ControladorAjax(A,B,E,C,D){if(A.toUpperCase()=="XML"){this._respuestaXml=true;
}else{this._respuestaXml=false;}if(D){this._objeto=D;}else{this._objeto=null;}this._urlBase=B;
this._funcionDestino=C;this._idCarga=E;this._anteriorXml=null;this._efectosVisuales=true;
this._tipoEfecto=0;this._funcionHtml=null;this._asincrono=true;};ControladorAjax_Xml=function(A,D,B,C){return new ControladorAjax("xml",A,D,B,C);
};ControladorAjax_Html=function(B,E,A,C){var D=new ControladorAjax("html",B,E,A);
D._funcionHtml=C;return D;};ControladorAjax.prototype.activarEfectosVisuales=function(){this._efectosVisuales=true;
};ControladorAjax.prototype.setTipoEfecto=function(A){this._tipoEfecto=A;};ControladorAjax.prototype.setAsincrono=function(A){this._asincrono=A;
};ControladorAjax.prototype.desactivarEfectosVisuales=function(){this._efectosVisuales=false;
};ControladorAjax.prototype.lanzarPeticion=function(A){if(this._respuestaXml){this._lanzarPeticionXml(A);
}else{this._lanzarPeticionHtml(A);}};ControladorAjax.prototype.obtenerUltimoXml=function(){if(this._anteriorXml){return this._anteriorXml.cloneNode(true);
}else{return null;}};ControladorAjax.prototype.procesarXml=function(A){this._procesarXml(A);
};ControladorAjax.prototype._lanzarPeticionXml=function(B,C){var G="";var F="";var E=this._urlBase;
if(escape(E).search("&#63;")){F="&";}else{F="?";}var A="";if(C){A=F+"sol="+C;}if(!B||B.length==0){utlFinal=E+A;
}else{G=E+F+B+A;}var D=this;$.ajax({url:G,cache:false,dataType:"xml",async:D._asincrono,processData:false,beforeSend:function(){var H=document.getElementById(D._idCarga);
H.style.visibility="visible";},success:function(I){var H=document.getElementById(D._idCarga);
H.style.visibility="hidden";D._anteriorXml=I;D._procesarXml(I);},error:function(I,K,J){var H=document.getElementById(D._idCarga);
H.style.visibility="hidden";alert("El servidor ha devuelto un error: "+K);}});};ControladorAjax.prototype._lanzarPeticionHtml=function(A){var E="";
var D="";var C=this._urlBase;if(escape(C).search("&#63;")){D="&";}else{D="?";}if(!A||A.length==0){E=C;
}else{E=C+D+A;}var B=this;$.ajax({url:E,cache:false,dataType:"html",async:true,processData:false,beforeSend:function(){var F=document.getElementById(B._idCarga);
F.style.visibility="visible";},success:function(G){var F=document.getElementById(B._idCarga);
F.style.visibility="hidden";if(B._funcionDestino){var H=document.getElementById(B._funcionDestino);
H.innerHTML=G;}if(B._efectosVisuales){if(B._tipoEfecto!=2){$("#"+B._funcionDestino).hide();
$("#"+B._funcionDestino).slideDown("fast");}else{$("#"+B._funcionDestino).hide();
$("#"+B._funcionDestino).fadeIn("fast");}}else{$("#"+B._funcionDestino).show();}if(B._funcionHtml!=null){B._funcionHtml(G);
}},error:function(F,H,G){alert("Error. El servidor no responde: "+H);}});};ControladorAjax.prototype._procesarXml=function(A){var B=A.getElementsByTagName("consulta")[0].attributes.getNamedItem("destino").value;
if(!B){alert("ERROR: La respuesta XML del servidor esta vacía o no es válida.");return ;
}this._funcionDestino(A,this._objeto);};