
function objetoAjax(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
  		}
	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function makeRequest(url,params) {
  getopost='GET'
  if(params) getopost='POST'

  var ajax = objetoAjax();
  var respuesta = '';
  ajax.open(getopost, url, false);
  ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
  ajax.onreadystatechange = function(){
    if (ajax.readyState==4) {
      if (ajax.status==200) { 
        respuesta=ajax.responseText;
      } else {
         alert("Error al recibir la información!")
      }
    }
  } 
  ajax.send(params); 
  return ajax.responseText;
   
} 

function validar(){
 
  du=document.usuarios;
  err='';
  foc='';
  secciones = document.getElementsByName("chckseccion[]");
  tipos =  document.getElementsByName("chckTipo[]");


  if (!du.nombre.value) { err +='\nFalta poner Nombre'; foc+='nombre '; }
  if (!du.apellido.value) { err+='\nFalta poner el Apellido'; foc+='apellido ' }
  if (!du.correo.value) {
     err+='\nFalta poner el correo'; foc+='correo '
  }else {
    if(!mail(du.correo.value)){ 
      // alert(du.correo.value)
      err+='\nCorreo Incorrecto'; foc+='correo '
    }
  }  
  if (!du.empresa.value) { err+='\nFalta poner el empresa'; foc+='empresa ' }
  if (!du.usuario.value) { err+='\nFalta poner el usuario'; foc+='usuario ' }
  if (!du.clave.value)   { 
     err+='\nFalta poner el contraseña'; 
     foc+='clave ' 
  }
  if (!du.clave.value)   { 
     err+='\nFalta repetir contraseña'; 
     foc+='clave2 ' 
  }
  if (du.clave.value!=du.clave2.value)   {
     err+='\nLas claves tienen que ser identicas'; 
     foc+='clave '
  }
 //if (!du.dato.value)    { err+='\nFalta poner el datos'; foc+='dato ' }

  if (!du.tipo.value)    { err+='\nFalta poner el tipo'; foc+='tipo ' }
  
   n=0; chck = false;
   while(n<secciones.length) {
     if(secciones[n].checked) { chck = true; }
     else {
       var p =  document.getElementById('pagsecc'); 
       p.style.border='solid 1px #FF0000';
     }
     n++;
   }
  if (chck == false) { err +='\nFalta seleccionar al menos una seccion'; }  
  
  /* para tipo de dptos */
    valor_tipos='';
  if(du.tipo.value=="A"){
     x=0; chckt = false; valor_tipos='';
     while(x<tipos.length) {
       if(tipos[x].checked) {
         chckt = true;
         if (valor_tipos) valor_tipos+=',';
         valor_tipos+=tipos[x].value;
       }
       else {
         var p =  document.getElementById('pagtipo'); 
         p.style.border='solid 1px #FF0000';
       }
       x++;
     }
    if (chckt == false) { err +='\nFalta seleccionar al menos un tipo'; } 
 }

 if (!err){ 
     id_admin= du.iduser.value; 
     acciones= du.accion.value; 
     if(acciones=='Insertar') makeRequest('index.php', 'pagina=mantenimiento&seccion=usuarios&accion=guardar_tipo&tipos='+valor_tipos+'&ajax=1'); // POSTenadolo
     else makeRequest('index.php', 'pagina=mantenimiento&seccion=usuarios&accion=update_tipo&id_admin='+id_admin+'&tipos='+valor_tipos+'&ajax=1'); // POSTenadolo
     
     return true;     
  }
  alert(err);
  marca=foc.split(' ');
  for(i = 0; i < marca.length; i++){
    if (marca[i]) document.getElementsByName(marca[i])[0].style.border='solid 1px #FF0000';
  }
  return false; 
}

function validardatos(){
  dd=document.datos;
  err='';
  foc=''; 
  // if (!dd.id.value) { err +='\nFalta poner ID'; foc+='ID '; }
   if (!dd.nombre.value) { err +='\nFalta poner Nombre'; foc+='nombre '; }
   if (!dd.valor.value) { err +='\nFalta poner Valor'; foc+='valor '; }
   if (!dd.grupo.value) { err +='\nFalta grupo Nombre'; foc+='grupo '; }
   if (!dd.posicion.value) { err +='\nFalta grupo Posicion'; foc+='posicion '; }
   if (!err) return true;
   alert(err);
   marca=foc.split(' ');
   for(i = 0; i < marca.length; i++){
     if (marca[i]) document.getElementsByName(marca[i])[0].style.border='solid 1px #FF0000';
   }
   return false;
}

function validarIncidecia(){ // validación de formulario de incidencias
  //texto= document.getElementById('textoincidencia').innerHTML;

  di=document.incidencias;
  err='';
  foc=''; 
 // correoDestino='';
  // if (!dd.id.value) { err +='\nFalta poner ID'; foc+='ID '; }
   if (!di.cliente.value) { err +='\nFalta poner Cliente'; foc+='cliente '; }
   if (!di.telefono.value) { 
       err +='\nFalta poner Telefono'; foc+='telefono '; 
   }/* else {
       if(!telefono(di.telefono.value)){ 
       // alert(du.correo.value)
       err+='\ntelefono Incorrecto'; foc+='telefono ';
     } 
   }
   if(di.correodestino.value!='' && !mail(di.correodestino.value)){
      err+='\nCorreos destino Incorrecto'; foc+='correodestino ';
   }*/
   if (!di.correo.value) { 
      err +='\nFalta poner correo'; foc+='correo '; 
   }else {
     if(!mail(di.correo.value)){ 
       // alert(du.correo.value)
       err+='\nCorreo Incorrecto'; foc+='correo ';
     }
   }  
   if (!di.version.value) { err +='\nFalta poner version'; foc+='version '; }
   if (!di.asunto.value) { err +='\nFalta poner asunto'; foc+='asunto '; }

   campos = document.getElementsByName("modulo[]");
   n=0; chck = false;
   while(n<campos.length) {
     if(campos[n].checked) { chck = true; }
     n++;
   }
   if (chck == false) { err +='\nFalta seleccionar modulo'; }  
   
   if (!di.textoincidencia.value) {  err +='\nFalta poner incidencia'; foc+='textoincidencia '; } 
   if (!err) return true;
   alert(err);
   marca=foc.split(' ');
   for(i = 0; i < marca.length; i++){
     if (marca[i]) document.getElementsByName(marca[i])[0].style.border='solid 1px #FF0000';
     else{  
        var p = document.getElementById('_modulos'); 
          p.style.color = "#FF0000";
        }
   }
   return false;
}

function validargrupos(){
   dg=document.grupos;
   err='';
   foc=''; 
   // if (!dd.id.value) { err +='\nFalta poner ID'; foc+='ID '; }
   if (!dg.nombre.value) { err +='\nFalta poner Nombre'; foc+='nombre '; }
   if (!err) return true;
   alert(err);
   marca=foc.split(' ');
   for(i = 0; i < marca.length; i++){
     if (marca[i]) document.getElementsByName(marca[i])[0].style.border='solid 1px #FF0000';
   }
   return false;
}

function mail(valor) {
	if (/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9_\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(valor)) return true;
  else return false;
}

/*function telefono(valor) {
  if (/(^[0-9\s\+\-])+$/g.test(valor)) return true;
  else return false;
} */

function eliminar(id,pag,sec){
   if(confirm('Está seguro de eliminar el registro ['+id+']?')){
    location.href='index.php?pagina='+pag+'&accion=Eliminar&seccion='+sec+'&codigo='+id;
    return true;
   }
   else return false; 
}

function modificar(id,pag,sec){
  location.href='index.php?pagina='+pag+'&seccion='+sec+'&codigo='+id+'&accion=Editar';
 // document.datos.accion.value="Modificar"
  return true;
}

function time(){ // de login.php
  setTimeout("tiempo('msg')", 3000);       
} 
function tiempo(nombreid){
  document.getElementById(nombreid).innerHTML="";
}

function select_grupo(pag,sec){
   valor = document.getElementsByName('grupo')[1].options[document.getElementsByName('grupo')[1].selectedIndex].value;
   location.href='index.php?pagina='+pag+'&seccion='+sec+'&grupos='+valor;
} 

function _asignar(idic){
  user = document.getElementsByName('asignar')[0].options[document.getElementsByName('asignar')[0].selectedIndex].value;  // recurso
  est = 'A';
  asu = document.getElementById('asunto').innerHTML;
  t = document.getElementById('textResol').innerHTML; 
   if(user){
     if(confirm("Se va Asignar la Incidencia : " +idic+ " a : "+user)){
//     makeRequest('index.php?pagina=incidencias&seccion=consulta&accion=asignacion&ajax=1&user='+user+'&icid='+idic+'&estado='+est+'&asunto='+asunto+'&texto='+escape(t)); // GETeandolo
       makeRequest('index.php', 'pagina=incidencias&seccion=consulta&action=resolucion&accion=asignacion&ajax=1&user='+user+'&icid='+idic+'&estado='+est+'&asunto='+asu+'&texto='+escape(t)); // POSTenadolo
       document.getElementById('rsptaAsignar').innerHTML = 'la Incidencia se ha Asignado con Exito a :'+user;
       setTimeout("tiempo('rsptaAsignar')", 5000);
       window.location.reload();
     }else{
        document.getElementById('id_asignar').value = '';
     }
   }
} 

function _finalizada(idic,estActual) {
  diashoras = document.getElementById('dh').value;
  time = document.getElementById('tiempo').value;

  if(document.getElementById('tiempo').value!=''){ 
     if(estActual=='P'){
        if(confirm("Desea Finalizar la Incidencia  : " +idic+" ?")){
          location.href='index.php?pagina=incidencias&seccion=consulta&action=resolucion&accion=finalizarCerrar&estado=F&icid='+idic+'&diashoras='+diashoras+'&time='+time;
        }
        else  document.getElementById('finalizar').checked = false;
     }else {
       alert("La incidencia tiene que estar en estado 'En proceso', para poder Finalizarla \n da respuesta a la incidencia");
       document.getElementById('finalizar').checked = false;
        document.getElementById('tiempo').value = '';
     }
  }else{ 
     document.getElementById('finalizar').checked = false; 
     document.getElementById('tiempo').focus();
     alert("campo tiempo empleado vacio");
  } 
}

function _cerrada(idic,estActual){
  if(estActual=='F'){ // incidencia tiene q estar finalizada para poder cerrarla
     if(confirm("Desea Cerrar la Incidencia  : " +idic+" ?")) location.href='index.php?pagina=incidencias&seccion=consulta&accion=finalizarCerrar&estado=C&icid='+idic;
     else  document.getElementById('cerrar').checked = false; 
  }else{
     alert("La incidencia tiene que estar en estado Finalizada, para poder Cerrarla");
      document.getElementById('cerrar').checked = false;
  }
}

function _historificar(idic,estActual){
    if(confirm("Desea Historificar la Incidencia  : " +idic+" ?")) location.href='index.php?pagina=incidencias&seccion=consulta&accion=historificar&estado=H&icid='+idic;
    else  document.getElementById('historificar').checked = false;
}
 
function _habilitar(valor){
  if(valor!=''){
     document.getElementById('finalizar').style.background='#638cb5';
     document.getElementById('finalizar').style.color='white';
     document.getElementById('finalizar').style.border='solid 1px #666666'; 
    document.getElementById('finalizar').disabled=false;
  }else{
     document.getElementById('finalizar').style.background='';
     document.getElementById('finalizar').style.color='#999999';
     document.getElementById('finalizar').style.border='solid 1px #999999'; 
     document.getElementById('finalizar').disabled=true;
    
   }
}  

function enviar(id,estado,tipo,entidad){  //enviar texto resolucion
  
   document.incidencias.textoresolucion.value=document.getElementById('edit').innerHTML   // para el texarea del editor
   di=document.incidencias;
   err='';
   foc=''; 
   textoresol = document.getElementById('textoresolucion').value;
   if(entidad=='0000'){ 
       if(tipo=='A' || tipo=='S'){ // administradores
         if (!di.asignar.value && textoresol!='') {  // no asignado
            if(confirm("\nAun no se ha asignado Recurso  : " +id+" \nDesea responder ?")) {
              if(confirm("\nSe va enviar el Texto de Resolución \nDesea continuar ?")) {
                _enviar(id,estado,tipo,entidad)
              }
            }else 
              foc+='asignar ';
              marca=foc.split(' ');
              for(i = 0; i < marca.length; i++){
              if (marca[i]) document.getElementsByName(marca[i])[0].style.border='solid 1px #FF0000';
            }
            return false;
         }else { //asignado
           if(estado=='T'){
             alert("Antes de enviar debe aprobarse la Incidencia")
           }else{
             if(confirm("\nSe va enviar el Texto de Resolución  \nDesea continuar ?")) {
               _enviar(id,estado,tipo,entidad);
             }
           }
         }
     }else{  // este else se deberia depurar (version antigua)
         if (!di.asignar.value && textoresol!='') { //no asignado
            if(confirm("\nAun no se ha asignado Recurso  : " +id+" \nDesea responder ?")) {
              if(confirm("\nSe va enviar el Texto de Resolución al jefe de Dpto para su aprobación \nDesea continuar?")) {
                _enviar(id,estado,tipo)
              }
            }else 
              foc+='asignar ';
              marca=foc.split(' ');
              for(i = 0; i < marca.length; i++){
              if (marca[i]) document.getElementsByName(marca[i])[0].style.border='solid 1px #FF0000';
            }
            return false;
         }else { //asignado
           if(estado=='P'){
              if(confirm("\nSe va enviar el Texto de Resolución \nDesea continuar ?")) {
               _enviar(id,estado,tipo,entidad);
             }
           }else{
             if(confirm("\nSe va enviar el Texto de Resolución al jefe de Dpto para su aprobación \nDesea continuar ?")) {
               _enviar(id,estado,tipo,entidad);
             }
           }
         }
      }
      
   }else{
     estado = 'P'
      if(confirm("\nSe va enviar el Texto de Resolución \nDesea continuar ?")) {
       _enviar(id,estado,tipo,entidad);
      }
   }
 
}

function _enviar(id,estado,tipo,entidad){
  textoresol = document.getElementById('textoresolucion').value;
  
   if(document.getElementById('id_asignar').value==''){
        usuario =  document.getElementById('user_session').value; // sino esta asignada, se asigna al usuario q inicia sesion;  
   }else usuario ='';
   
    if(textoresol){       
      salida = makeRequest('index.php', 'pagina=incidencias&seccion=consulta&action=resolucion&tipo='+tipo+'&entidad='+entidad+'&accion=Enviar&ajax=1&icid='+id+'&textoresolucion='+encodeURIComponent(textoresol)+'&usuario='+usuario+'&estado='+estado); // POSTenadolo
       if (salida){
        document.getElementById('textoresolucion').value = '';
        //document.getElementById('textInc').innerHTML=salida; 
       }
       //document.getElementById('state').innerHTML = makeRequest('index.php', 'pagina=incidencias&seccion=consulta&accion=act_estados&ajax=1'); // POSTenadolo
       window.location.reload(); // hacer que recarge ajax (obligado por tiempo)
    }
}

function agregarInc(idic,estado){
  document.incidencias.Add_textoIncidecia.value=document.getElementById('edit_add').innerHTML   
  textoIncidencia = document.getElementById("Add_textoIncidecia").value;
  if(textoIncidencia){
     document.getElementById('Add_textoIncidecia').value = '';
     document.getElementById('textResol').innerHTML = makeRequest('index.php', 'pagina=incidencias&seccion=consulta&&action=resolucion&accion=Agregar&ajax=1&icid='+idic+'&Add_textoIncidecia='+escape(textoIncidencia)+'&estado='+estado); // POSTenadolo
     window.location.reload();
  }else{
    alert("Introduzca contenido");
    document.getElementById("Add_textoIncidecia").focus();
  }
  
}

function  update_fechaIni(valor,codigo){
  location.href='index.php?pagina=incidencias&seccion=consulta&accion=updatefechaInicio&action=resolucion&fechaini='+valor+'&icid='+codigo;
}
function  update_fechaFin(valor,codigo){
  location.href='index.php?pagina=incidencias&seccion=consulta&action=resolucion&accion=updatefechaFin&fechafin='+valor+'&icid='+codigo;
}

 function AparecerDesaparecer(modulo) {
   document.getElementById('modulo_'+modulo).style.display=(document.getElementById('modulo_'+modulo).style.display==''?'none':'');
  if (document.getElementById('desplegado_'+modulo)) document.getElementById('desplegado_'+modulo).innerHTML=(document.getElementById('modulo_'+modulo).style.display=='none'?' <font size="-3">ayuda[+]</font> ':' <font size="-3">ayuda[-]</font> ');
 }
 
  function Desplegado(modulo) {
    document.getElementById('modulo_'+modulo).style.display=(document.getElementById('modulo_'+modulo).style.display==''?'none':'');
    if (document.getElementById('desplegado_'+modulo)) document.getElementById('desplegado_'+modulo).innerHTML=(document.getElementById('modulo_'+modulo).style.display=='none'?' <font size="-3">Adjuntar Archivos</font> ':' <font size="-3">Adjuntar Archivos</font> ');
 }
  
 function verEditor(modulo) {
    document.getElementById('modulo_'+modulo).style.display=(document.getElementById('modulo_'+modulo).style.display==''?'none':'');
    if (document.getElementById('desplegado_'+modulo)) document.getElementById('desplegado_'+modulo).innerHTML=(document.getElementById('modulo_'+modulo).style.display=='none'?' <img align="absmiddle" title="ver editor" style="cursor:pointer;" src="imagenes/nover.gif"> ':'<img align="absmiddle" style="cursor:pointer;" title="ocultar editor" src="imagenes/ver.gif">');
 }
  
function SeleccionTipo(a){
  codigo=document.usuarios.iduser.value;
  document.getElementById("SeleccionTipo").innerHTML = makeRequest('index.php', 'pagina=mantenimiento&seccion=usuarios&accion=select_tipo&tipo='+a+'&ajax=1&f=1&codigo='+codigo); // POSTenadolo
 }
 
function verIncidencia(que){
 //document.ver.icid.value=que;
  //document.ver.submit();
   location.href='index.php?pagina=incidencias&seccion=consulta&action=resolucion&icid='+que;
}

function aprobarIncidencia(id){
   if(confirm('Estas seguro de aprobar la incidencia?')){
      location.href='index.php?pagina=incidencias&seccion=consulta&action=resolucion&accion=updateEstado&icid='+id;
    return true;
   }
   else return false; 
}

var salir=true; 
//Esta funcion nos sirve para detectar si esta saliendo

function cambiarvalor(){ 
    salir=false; 
}

function alcerrar(){ // función para Eliminar 
  id = document.getElementById('id_incidencia').value;
  makeRequest('index.php', 'pagina=incidencias&seccion=nuevo&accion=eliminar_fichero&ajax=1&cerrarVentana=1&id_incidencia='+id); // POSTenadolo

} 

function cambiarMenu(m,c){
  //if(confirm('Estas seguro de cambiar en menú?')){
    location.href='index.php?pagina=mantenimiento&seccion=menus&accion=Cambiar_menu&tipoMenu='+m+'&codigo='+c;
    return true;
  // }
   //else return false; 
}

 x=0; y=0;
function movemouse(e) {
  x = document.all ? event.clientX : e.clientX;
  y = document.all ? event.clientY : e.clientY;
  return false;
}
if(!document.all) document.onmousemove=movemouse;

function uploadear(){
  if (document.getElementById('div_uploader')) {
   // document.getElementById("div_uploader").style.left=(ns6 ? x : event.clientX)+document.body.scrollLeft+10;
   // document.getElementById("div_uploader").style.top=(ns6 ? y : event.clientY)+document.body.scrollTop;
    
    document.getElementById("div_uploader").style.left=(x||event.clientX)+document.body.scrollLeft;
    document.getElementById("div_uploader").style.top=(y||event.clientY)+document.body.scrollTop;  
    
    document.getElementById("div_uploader").style.width='220px';
    document.getElementById("div_uploader").style.height='40px';
    document.getElementById("div_uploader").style.display='block';
    
    document.getElementById("div_uploader").style.display=(document.getElementById("div_uploader").style.display==''?'none':'');
    
    
    //document.form_uploader.d.value=lque;
   // setTimeout("document.getElementById('div_uploader').style.display='none';", 10000);
    return false;
  } else {
    return true;
  }
 
}

 function filtracion(){ 
   estatus= document.filtrar._status.value; 
   canal= document.filtrar.canales.value; 
   id_recurso = document.filtrar.ver_recurso.value;
   FechaI = document.filtrar.FechaI.value;
   FechaF = document.filtrar.FechaF.value;
   orden =  document.filtrar.ver_Enviados.value;
    prioridad=document.filtrar.ver_prioridad.value;
   location.href='index.php?pagina=incidencias&seccion=consulta&canal='+canal+'&estatus='+estatus+'&id_recurso='+id_recurso+'&FechaI='+FechaI+'&FechaF='+FechaF+'&orden='+orden+'&prioridad='+prioridad;
   
 }
 
/*
function antesdecerrar(){
  id = document.getElementById('id_incidencia').value;
  if(salir==true){
    // if(confirm('se van a eliminar los fichero adjuntos')){
       makeRequest('index.php', 'pagina=incidencias&seccion=nuevo&accion=eliminar_fichero&ajax=1&cerrarVentana=1&id_incidencia='+id); // POSTenadolo
      // return true;
    // }
   //  else return false; 
  }
} 
*/

function cambiaestilo1(valor){  
   if(document.getElementById("MsgMuyAlta").style.border!=''){
      document.getElementById("MsgMuyAlta").style.border='';

      document.getElementById("MsgMuyAlta").style.padding='';
      document.getElementById("MsgMuyAlta").style.background='';
       document.getElementById("MsgMuyAlta").style.padding='10px 10px 6px 6px';
      document.getElementById("MsgMuyAlta").style.width='20px';
      document.getElementById("MsgMuyAlta").style.height='30px';
      document.getElementById("msgPri").value='';
   }else{ 
      document.getElementById("MsgMuyAlta").style.border='solid 1px #83AADA';
      document.getElementById("MsgMuyAlta").style.width='20px';
      document.getElementById("MsgMuyAlta").style.height='30px';
      document.getElementById("MsgAlta").style.width='20px';
      document.getElementById("MsgAlta").style.height='30px';
      document.getElementById("MsgMuyAlta").style.padding='10px 10px 6px 6px';
      document.getElementById("MsgMuyAlta").style.background='#DDECFE';

      document.incidencias.MsgPriority.value=valor;

      document.getElementById("MsgAlta").style.border='';
      document.getElementById("MsgAlta").style.background='';
      document.getElementById("MsgAlta").style.padding='10px 10px 6px 6px';
   }
   
}

function cambiaestilo2(valor){  
   if(document.getElementById("MsgAlta").style.border!=''){
      document.getElementById("MsgAlta").style.border='';
      //document.getElementById("MsgAlta").style.width='';
      //document.getElementById("MsgAlta").style.height='';
      document.getElementById("MsgAlta").style.background='';
      document.getElementById("MsgAlta").style.padding='10px 10px 6px 6px';
       document.getElementById("MsgAlta").style.width='20px';
      document.getElementById("MsgAlta").style.height='30px';
       
      document.getElementById("msgPri").value='';
   }else{ 
      document.getElementById("MsgAlta").style.border='solid 1px #83AADA';
      document.getElementById("MsgAlta").style.width='20px';
      document.getElementById("MsgAlta").style.height='30px';
      document.getElementById("MsgMuyAlta").style.width='20px';
      document.getElementById("MsgMuyAlta").style.height='30px';
  
      document.getElementById("MsgAlta").style.padding='10px 10px 6px 6px';
      document.getElementById("MsgAlta").style.background='#DDECFE';
      document.getElementById("msgPri").value='';
      document.incidencias.MsgPriority.value=valor;

      document.getElementById("MsgMuyAlta").style.border='';
      document.getElementById("MsgMuyAlta").style.background='';
      document.getElementById("MsgMuyAlta").style.padding='10px 10px 6px 6px';
   }
     
}

//autosugerencia
function ver_datos(){
  mail=document.consultas.correo.value; 
  document.getElementById('pon_monbres').innerHTML = makeRequest('index.php?pagina=Consultas&seccion=entradas&accion=pon_datos&correo='+mail).responseText;  //mostrado
 } 




/*
function ponTooltip(){ 
  //alert("funciona");
   //alert("pon")  
  t=setTimeout("Tooltip(t);", 4000);
  alert(t)
  // clearTimeout(T);
}


function Tooltip(t){ 
  //alert("funciona");
   alert(t)  
  // setTimeout("ponTooltip();", 4000);
  
   clearTimeout(t);
}

*/
