function completa(txt){
   var form = document.FormAjax['emailUsuario'];
   var result = document.getElementById("result");

   txt = txt.replace("~","'");

   form.strsrch.value = txt;
   result.innerHTML = "";
}


function CargarConectados(){
	
	if (!enProceso && http) {
		var url = "/ajax/conectados.asp";	
		http.open("GET", url, true);
		http.onreadystatechange = handleHttpResponse;
		enProceso = true;
		http.send(null);
		mm_enProceso();
	}
}

function CargarDatos(URL){
	
	if (!enProceso && http) {
		var url = URL;	
		http.open("GET", url, true);
		http.onreadystatechange = handleHttpResponse;
		enProceso = true;
		http.send(null);
		mm_enProceso();
	}
}



function handleHttpResponse() {
    if (http.readyState == 4) {
       if (http.status == 200) {
          if (http.responseText.indexOf('invalid') == -1) {
             results = http.responseText.split(",");
            var ShowText = document.getElementById("conectados").innerHTML = results[0];			 
			enProceso = false;
		 	mm_enProceso();
          }
       }
    }
}


function handleHttpResponsePOPuP() {
    if (http.readyState == 4) {
       if (http.status == 200) {
          if (http.responseText.indexOf('invalid') == -1) {
             results = http.responseText.split(",");
			var Mostrar = results[0];
			Tip(Mostrar);
			enProceso = false;
		 	mm_enProceso();
          }
       }
    }
}




function getHTTPObject() {
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
       try {
          xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
          try {
             xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (E) { xmlhttp = false; }
       }
    @else
    xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
       try {
          xmlhttp = new XMLHttpRequest();
       } catch (e) { xmlhttp = false; }
    }
    return xmlhttp;
}

var enProceso = false; // lo usamos para ver si hay un proceso activo
var http = getHTTPObject(); // Creamos el objeto XMLHttpRequest


function mm_enProceso(){
	if(enProceso){
//		alert("cargando");
		document.getElementById("LayerBlock").style.visibility="visible";
		
	} else {
//	alert("Fin carga");
	document.getElementById("LayerBlock").style.visibility="hidden";
 }return;
}
