
function objetus(file) {

	xmlhttp=false;

	this.AjaxFailedAlert = "Debe habilitar javascript en su navegador para apreciar la funcionabilidad de este sitio.\n";

	this.requestFile = file;

	this.encodeURIString = true;

	this.execute = false;

	if (window.XMLHttpRequest) {
	
		this.xmlhttp = new XMLHttpRequest();

	if (this.xmlhttp.overrideMimeType) {

		this.xmlhttp.overrideMimeType('text/xml');

	  }

    }

	else if(window.ActiveXObject) { // IE

		try { this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
	     
		catch(e){

				 try {	this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } 
				 
				 catch (e) { this.xmlhttp = null; }

				}

	   if(!this.xmlhttp && typeof XMLHttpRequest!='undefined') {

		  this.xmlhttp = new XMLHttpRequest();

	   if (!this.xmlhttp){  this.failed = true;	}

      }
   } return this.xmlhttp ;

}

function snt(_pag_,get,post,capa){
	
	ajax=objetus(_pag_);

	if(post!=""){ ajax.open("POST", _pag_+"?"+post,true); } 
	else
	    { ajax.open("GET", _pag_+"?"+get,true); }

		  ajax.onreadystatechange=function() {

		  if(ajax.readyState==1){
             
			 //document.getElementById(capa).innerHTML = "<img src='images/loadingcircle.gif' align='center'>";
			 
  		  }

      	  if (ajax.readyState==4) {
            
			  if(ajax.status==200)
			    {   
				 
				    document.getElementById(capa).innerHTML = ajax.responseText; }

			  else if(ajax.status==404)

					{ capa.innerHTML = "La direccion no existe"; }

		     else { capa.innerHTML = "Error: ".ajax.status; }

         }
 }

	if(post!=""){

		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send(post);

	} else { ajax.send(null); }

}