// JavaScript Document
var miXMLHttp = false;
//Los navegadores tienen diferentes objetos     
      if (window.XMLHttpRequest) {
        miXMLHttp = new XMLHttpRequest();
      } else if (window.ActiveXObject) {
        miXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }

//La función que me permite traer la información
function mostrarAyuda(str)
{

if (str.length==0)
{ 
document.getElementById("txtTip").innerHTML=""

return
}

if (miXMLHttp==null)
{
alert ("Tu navegador no soporta xmlHttp")
return
} 
//Basado en un ejemplo de w3schools
//Construyo el url para enviarlo
var url="numera.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
miXMLHttp.open("GET",url)
miXMLHttp.send(null)
//Cuando este listo
miXMLHttp.onreadystatechange = function () {
//document.getElementById("txtTip").innerHTML=miXMLHttp.readyState
if (miXMLHttp.readyState==4 || miXMLHttp.readyState=="complete")
{
document.getElementById("txtTip").innerHTML=miXMLHttp.responseText
//alert (miXMLHttp.responseText)
} else {
	
	//obj.innerHTML = "<image src='loading.gif'></img>";
	obj.innerHTML = "Espera";

}

}
//Preparar y enviar

} 

function validaForma2(str)
{

if (str.length==0)
{ 
document.getElementById("resultaforma").innerHTML="NADA"
return
}

if (miXMLHttp==null)
{
alert ("Tu navegador no soporta xmlHttp")
return
} 
//Basado en un ejemplo de w3schools
//Construyo el url para enviarlo
var url="validajaguar.php"
//url=url+"?num="+document.getElementById("numero").value
//url=url+"&nom="+document.getElementById("nombre").value
//url=url+"&men="+document.getElementById("mensaje").value
//url=url+"&cap="+document.getElementById("capta").value
miXMLHttp.open("POST",url)
//miXMLHttp.send("var=kaka")

//Cuando este listo
miXMLHttp.onreadystatechange = function () {
//document.getElementById("txtTip").innerHTML=miXMLHttp.readyState
//alert("Entre aqui2")

miXMLHttp.send("var=kaka")

if (miXMLHttp.readyState==4 || miXMLHttp.readyState=="complete")
{
	document.getElementById("resultaforma").innerHTML=miXMLHttp.responseText;
	//document.getElementById("resultaforma").innerHTML="PS SI NO";
	//document.getElementById("enmodal").innerHTML="SAVED";
	//document.getElementById("forma").innerHTML="ALGO"
	
	//alert (miXMLHttp.responseText)
} 



}
//Preparar y enviar

}


 function traerInformacion(dataSource, divID,idForma)
      {
        
		//EL div que me mandaron
        var obj =$(divID) //document.getElementById(divID);
         //Me permite conectarme al servidor
//new Ajax.Request(dataSource, {method: 'post', parameters : 'var='+str, onSuccess: mifuncion}); 
       
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 




function mifuncion (resp){

   var respuesta = resp.responseText;


    //obj.innerHTML =respuesta;
 obj.update(respuesta);
 refreshimage();
    
        }    

}

function traerInformacion2(dataSource, divID,idForma)
      {
        
		//EL div que me mandaron
        var obj =$(divID) //document.getElementById(divID);
         //Me permite conectarme al servidor
//new Ajax.Request(dataSource, {method: 'post', parameters : 'var='+str, onSuccess: mifuncion}); 
       obj.update("Cargando...");
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 




function mifuncion (resp){

   var respuesta = resp.responseText;

	

    //obj.innerHTML =respuesta;	
	
	if(respuesta=='enviar'){
		 esperar2(true);
		 var nuevoSource = 'jaguarEnviaUp.php';
		 new Ajax.Request(nuevoSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion});
		 
	}else{
		esperar2(false);
		obj.update(respuesta);
		Recaptcha.reload();
	}
	

 refreshimage();
    
        }    

}

function encuestaR(dataSource, divID,idForma)
      {
        
		//EL div que me mandaron
        var obj =$(divID) //document.getElementById(divID);
         //Me permite conectarme al servidor
//new Ajax.Request(dataSource, {method: 'post', parameters : 'var='+str, onSuccess: mifuncion}); 
      
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 




function mifuncion (resp){

   var respuesta = resp.responseText;

	

    //obj.innerHTML =respuesta;	
	
	
		obj.update(respuesta);
		
	
    
        }    

}


function Paso1(dataSource, divID,idForma)
      {
        
		//EL div que me mandaron
        var obj =$(divID) //document.getElementById(divID);
         //Me permite conectarme al servidor
//new Ajax.Request(dataSource, {method: 'post', parameters : 'var='+str, onSuccess: mifuncion}); 
       obj.update("Cargando...");
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 




function mifuncion (resp){

   var respuesta = resp.responseText;

	

    //obj.innerHTML =respuesta;	
	

		obj.update(respuesta);
    
        }    

}

function refrescaDatos(dataSource, divID,idForma)
      {
        
		
        var obj =$(divID); //document.getElementById(divID);
		 
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 


function mifuncion (resp){

   var respuesta = resp.responseText;

	

    //obj.innerHTML =respuesta;
 obj.update(respuesta);
    
        }    

}

function refrescaDatosC(dataSource, divID, divID2,divID3, pError, idForma) // Funcion para cambiar datos de la cuenta y que cambie tambien lo que muestra
      {
        
		
        var obj =$(divID); //document.getElementById(divID);
		var obj2 = $(divID2);
		var obj3 = $(pError);
		 
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 


function mifuncion (resp){

   var respuesta = resp.responseText;


	
	if(respuesta != "ERROR. Nombre y Apellido son requeridos" && respuesta != "Oye no se como decirte esto pero dejaste el campo vacio" && respuesta != "1, 2, 3, mmmm no no tiene 4 caracteres, por favor pon un usuario de al menos 4 caracteres" && respuesta != "Chin, ya existe uno asi en nuestros usuarios por favor elige otro correo" && respuesta != "El correo tiene que verse mas o menos asi: algo@hotmail.com" && respuesta != "Chin, ya existe uno de esos en nuestros usuarios por favor elige otro usuario" ){
		
		if(respuesta == 'cambiomail'){
		
		var respuesta2 = 'Exito ';
		obj.update(respuesta2);
		obj2.update(respuesta);
		new Effect.Highlight(divID3, { startcolor: '#fcb912',endcolor: '#ffffff' });
		document.location.href='http://www.jaguaryou.com/cierraJag.php';
		
		}else{
		
		var respuesta2 = 'Exito ';
		obj.update(respuesta2);
		obj2.update(respuesta);
		new Effect.Highlight(divID3, { startcolor: '#fcb912',endcolor: '#ffffff' });	
			
		}
		
	}else{

    //obj.innerHTML =respuesta;
	obj3.update(respuesta);
 
 
	}
    
        }    

}

function guardaContacto(dataSource, divID,idForma,idCont)
      {
        
		
        var obj =$(divID); //document.getElementById(divID);
		 
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 


function mifuncion (resp){

   var respuesta = resp.responseText;

		if(respuesta == 1){
		$(idForma).reset();
		obj.update("GUARDADO");
		new Effect.Highlight(divID, { startcolor: '#f4d41e',endcolor: '#ffffff' });
		nuevoContacto('contactosPremium.php','contienecontactos');
		nuevoContacto('gruposPremium.php','gruposaqui');
		$(idCont).fade({ duration: 0.1});
		}else{
		//
		obj.update(respuesta);
		new Effect.Highlight(divID, { startcolor: '#f4d41e',endcolor: '#ffffff' });	
		}
	 

    //obj.innerHTML =respuesta;
 
    
        }    

}

function borraContacto(dataSource, divID,idForma)
      {
        
		
        var obj =$(divID); //document.getElementById(divID);
		 
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 


function mifuncion (resp){

   var respuesta = resp.responseText;

		if(respuesta == 1){
		$(idForma).reset();
		obj.update("BORRADO");
		new Effect.Highlight(divID, { startcolor: '#f4d41e',endcolor: '#ffffff' });
		nuevoContacto('contactosPremium.php','contienecontactos');
		$('quicontact').fade({ duration: 0.1, from: 1, to: 0 });
		obj.update("");
		}else{
		//
		obj.update(respuesta);
		new Effect.Highlight(divID, { startcolor: '#f4d41e',endcolor: '#ffffff' });	
		}
	 

    //obj.innerHTML =respuesta;
 
    
        }    

}

function borraGrupo(dataSource, divID,idForma)
      {
        
		
        var obj =$(divID); //document.getElementById(divID);
		 
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 


function mifuncion (resp){

   var respuesta = resp.responseText;

		if(respuesta == 1){
		$(idForma).reset();
		obj.update("BORRADO");
		new Effect.Highlight(divID, { startcolor: '#f4d41e',endcolor: '#ffffff' });
		nuevoContacto('contactosPremium.php','contienecontactos');
		nuevoContacto('gruposPremium.php','gruposaqui');
		$('quigrupo').fade({ duration: 0.1, from: 1, to: 0 });
		obj.update("");
		}else{
		//
		obj.update(respuesta);
		new Effect.Highlight(divID, { startcolor: '#f4d41e',endcolor: '#ffffff' });	
		}
	 

    //obj.innerHTML =respuesta;
 
    
        }    

}

function ponContacto(dataSource,nombre, divID,tel)
      {
        
		
        var obj =$(divID); //document.getElementById(divID);
		
		var nom = nombre.substring(0,7);
		 
		 var eldiv = obj.innerHTML+"<div id='"+dataSource+"' style='padding:3px; background-color:#CCC; margin:3px; width:70px; -webkit-border-radius: 4px; -moz-border-radius: 4px; color:#333; display:none; float:left;'><table><tr><td width='38'>"+nom+"</td><td><a href='#' onclick='quitaContacto(\""+dataSource+"\"); ponEnTel(\"quitarArr.php\",\""+tel+"\"); desPintaContacto(\""+tel+"\"); return false;'><div id=\"elelimina\"></div></a></td></tr></table></div>";

		 obj.update(eldiv);
		 
		 var obj2 =$(dataSource);
		 
		 Effect.Appear(dataSource, { duration: 0.2 });    
       

}

function ponGrupoEnvio(idGrup,nombre, divID)
      {
        
		
        var obj =$(divID); //document.getElementById(divID);
		
		var iid = 'g'+idGrup;
		 
		 var eldiv = obj.innerHTML+"<div id='"+iid+"' style='padding:6px; background-color:#FFF; margin:2px; width:auto; -webkit-border-radius: 4px; -moz-border-radius: 4px; color:#333; display:none; float:left;'>"+nombre+"<a href='#' onclick='quitaContacto(\""+iid+"\"); ponEnTel(\"quitaGrupoArreglo.php\",\""+idGrup+"\"); return false;'> X</a></div>";

		 obj.update(eldiv);
		 
		 var obj2 =$(iid);
		 
		 Effect.Appear(iid, { duration: 0.2 });    
       

}

function ponContactoAg(dataSource,nombre, divID,tel)
      {
        
		
        var obj =$(divID); //document.getElementById(divID);
		var obj3 =$('elavisos2');
		
		var elid = dataSource;
		 
		 var eldiv = obj.innerHTML+"<div id='"+elid+"' style='background-color:#CCC; margin:3px; width:70px; height:27px; padding-top:3px; -webkit-border-radius: 4px; -moz-border-radius: 4px; color:#333; display:none; float:left; font-size:8px;'><table><tr><td width='38'>"+nombre+"</td><td><a href='#' onclick='quitaContacto(\""+elid+"\"); ponEnTel(\"quitarArr.php\",\""+nombre+"\"); return false;'><div id=\"elelimina\"></div></a></td></tr></table></div>";

		var verdadero = IsNumeric(nombre);
		
		var lon = nombre.length;

		 if(verdadero == true){
			 if(lon == 10){
		 
		 
		 obj.update(eldiv);
		 
		 var obj2 =$(dataSource);
		 
		 Effect.Appear(dataSource, { duration: 0.2 });    
			 }else{
				 //obj.update(lon);
				 mimodalSug(true,'avisos2'); 
		ponCarga('elavisos2'); 
		$('avisos2').appear({ duration: 0.3 });
				 obj3.update('Oye te falto completar el numero, tiene que tener 10 digitos');
			 }
       }else{
		   //obj.update("NO");
		   mimodalSug(true,'avisos2'); 
		ponCarga('elavisos2'); 
		$('avisos2').appear({ duration: 0.3 });
		   obj3.update('Mmm igual soy yo pero hasta donde yo sabia, el celular es de solo numeros');
	   }

}

function ponGrupo(dataSource,nombre, divID,idC)
      {
        
		
        var obj =$(divID); //document.getElementById(divID);
		 
		 var eldiv = obj.innerHTML+"<div id='"+dataSource+"' class='nodogc'>"+dataSource+"<a href='#' onclick='quitaGrupo(\""+dataSource+"\",\""+nombre+"\",\"gruposquehay\"); ponEnGrupo(\"borraDegrupo.php\",\""+nombre+"\",\""+idC+"\"); return false;'> -</a></div>";
		 
		 var names = $(divID).childElements();
		 
		 var bandera = 0;
		 
   	names.each(
   
   function(node){ 
   
   		if(node.id == dataSource){
	   	bandera = 1; 
		//obj.update(eldiv+node.id);
	  	 }  
	   
	   }
	   
	   );

   		 
	 
		 if(bandera != 1){

		 /*obj.update(eldiv);
		 
		 var obj2 =$(dataSource);
		 
		 Effect.Appear(dataSource, { duration: 0.2 }); */
		 
		 obj.update(eldiv);
		 }else{
			  Effect.Appear(dataSource, { duration: 0.2 });
		 }
		 
       

}

function quitaContacto(dataSource, divID)
      {
        
		
		 
		 Effect.Fade(dataSource, { duration: 0.2, from: 1, to: 0 });    
       

}

function quitaGrupo(dataSource,idGrupo, divID,idC)
      {
        
		var obj =$(divID);
		
		var id = dataSource+idGrupo;
		
		var eldiv = obj.innerHTML+"<div id='"+id+"' class='nodogc'>"+dataSource+"<a href='#' onclick='ponGrupo(\""+dataSource+"\",\""+idGrupo+"\",\"areagrupos\",\""+idC+"\"); quitaContacto(\""+id+"\",\""+id+"\"); ponEnGrupo('agregaAgrupo.php',\""+idGrupo+"\",\""+idC+"\"); return false;'>+</a></div>";
		
		
		var names = $(divID).childElements();
		 
		 var bandera = 0;
		 
   	names.each(
   
   function(node){ 
   
   		if(node.id == id){
	   	bandera = 1; 
		//obj.update(eldiv+node.id);
	  	 }  
	   
	   }
	   
	   );

   		 
	 
		 if(bandera != 1){

		 /*obj.update(eldiv);
		 
		 var obj2 =$(dataSource);
		 
		 Effect.Appear(dataSource, { duration: 0.2 }); */
		 
		 obj.update(eldiv);
		 }else{
			 Effect.Appear(id, { from: 0.0, to: 1.0, duration: 0.4 }); 
		 }
		 
		
		
		 
		 Effect.Fade(dataSource, { duration: 0.2, from: 1, to: 0 });
		 
		   
		 
		 //var loqueva = obj.innerHTML+elgrupo;
		 
		// obj.update($loqueva);    
       

}

function nuevoComentario(nm,coment, fbt, idDiv){
	
	var obj =$(idDiv);
	
	if(fbt == 'si'){
		
	var loqueva	= "<tr><td><fb:name uid='"+nm+"' firstnameonly='true' linked='false' /></td></tr><tr><td>"+coment+"</td></tr>"+obj.innerHTML;
		
	}else{
	
	var loqueva = "<tr><td><b>"+nm+"</b></td></tr><tr><td>"+coment+"</td></tr>"+obj.innerHTML;
	
	}
	
	obj.update(loqueva);
	
}

function nuevoContacto(dataSource, divID)
      {
        
		
        var obj =$(divID); //document.getElementById(divID);
		
		new Ajax.Request(dataSource, { onSuccess: mifuncion}); 
			
		 function mifuncion (resp){

   var respuesta = resp.responseText;

	

    //obj.innerHTML =respuesta;
 obj.update(respuesta);
 
 Effect.Appear(divID, { from: 0.0, to: 1.0, duration: 0.4 });  
 
		 }
       

}

function cambiaGrupo(dataSource, divID,idGrupo)
      {
        
		
        var obj =$(divID); //document.getElementById(divID);
		
		var pasa = "idegrup="+idGrupo;
       
		new Ajax.Request(dataSource, { parameters: pasa ,onSuccess: mifuncion});
			
		 function mifuncion (resp){

   var respuesta = resp.responseText;

	

    //obj.innerHTML =respuesta;
	 Effect.Appear(divID, { from: 0.0, to: 1.0, duration: 0.4 });
 obj.update(respuesta);
  
 
		 }
       

}

function impresionGrupo(dataSource, divID,idGrupo)
      {
        
		
        var obj =$(divID); //document.getElementById(divID);
		
		var pasa = "idegrup="+idGrupo;
       
		new Ajax.Request(dataSource, { parameters: pasa ,onSuccess: mifuncion});
			
		 function mifuncion (resp){

   var respuesta = resp.responseText;
	
	var eldiv = obj.innerHTML+respuesta;
	
    //obj.innerHTML =respuesta;
	quitaCarga('dondeec');
	 Effect.Appear(divID, { from: 0.0, to: 1.0, duration: 0.4 });
 	obj.update(eldiv);
	
	ponEnTel('agregaGrupoArreglo.php',idGrupo);
  
 
		 }
       

}

function ponEnGrupo(dataSource,idC,idG)
      {
        
		//EL div que me mandaron
       var obj =$('ressug3');
         //Me permite conectarme al servidor
//new Ajax.Request(dataSource, {method: 'post', parameters : 'var='+str, onSuccess: mifuncion}); 
	//var pasa = "idegrupoal="+idG+"&idcontact="+idC;
	//var pasa = "idcontact="+idC;
      
new Ajax.Request(dataSource, { parameters: { idcontact:idC, idgrupoal:idG }, onSuccess: mifuncion }); 
       function mifuncion (resp){

   var respuesta = resp.responseText;

	

    //obj.innerHTML =respuesta;
	// Effect.Appear(divID, { from: 0.0, to: 1.0, duration: 0.4 });
 obj.update(respuesta);
  
 
		 }

}

function ponEnTel(dataSource,idC)
      {
        
		
       var obj =$('dondetels');
      
      
	  setCookie('trabajando','si',1);
	  
new Ajax.Request(dataSource, { parameters: { idcontact:idC }, onSuccess: mifuncion }); 
       function mifuncion (resp){


	setCookie('trabajando','no',1);
	
   var respuesta = resp.responseText;

 
		 }

}

function onRefresca(dataSource,divID)
      {
        
		//EL div que me mandaron
       var obj =$(divID);
         //Me permite conectarme al servidor
//new Ajax.Request(dataSource, {method: 'post', parameters : 'var='+str, onSuccess: mifuncion}); 
	//var pasa = "idegrupoal="+idG+"&idcontact="+idC;
	//var pasa = "idcontact="+idC;
      
new Ajax.Request(dataSource, { onSuccess: mifuncion }); 
       function mifuncion (resp){

   var respuesta = resp.responseText;

	

    //obj.innerHTML =respuesta;
	// Effect.Appear(divID, { from: 0.0, to: 1.0, duration: 0.4 });
 obj.update(respuesta);
  
 
		 }

}

function preguntaQuitaContacto(divID,elconta,quien,sucel,idquien){
	var obj =$(divID);
	var obj2 = $(elconta);
	
	var texto = quien+" "+sucel;
	
	obj.value = idquien;
	obj2.update(texto);
	
}

function ponCarga(divID){
	var obj =$(divID);
	var mientras = "<img src='../imagenes/loaderchiquito.gif' alt='loader' />";
	obj.update("cargando..."+mientras);
}

function quitaCarga(divID){
	var obj =$(divID);
	
	obj.update("");
}

function refrescaAV(dataSource, divID,idForma)
      {
        
		
        var obj =$(divID) //document.getElementById(divID);
		obj.update("Cargando...");
		
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 


function mifuncion (resp){

   var respuesta = resp.responseText;

	if(respuesta == 'LISTO'){
		obj.update(respuesta);
		document.location.href='http://www.jaguaryou.com/indexAV.php';
		
	}else{
	

    //obj.innerHTML =respuesta;
 obj.update(respuesta);
	}
    
        }    

}

function preguntaContacto(dataSource, divID,idConta)
      {
        
		//EL div que me mandaron
        var obj =$(divID) //document.getElementById(divID);
         //Me permite conectarme al servidor
		 
//new Ajax.Request(dataSource, {method: 'post', parameters : 'var='+str, onSuccess: mifuncion}); 

var pasa = "idecon="+idConta;
       
new Ajax.Request(dataSource, { parameters: pasa ,onSuccess: mifuncion}); 




function mifuncion (resp){

   var respuesta = resp.responseText;

	

    //obj.innerHTML =respuesta;
 obj.update(respuesta);
 esperar2(false);
    
        }    

}

function refrescaContactos()
      {
        
		//EL div que me mandaron
        var obj =$('contactosaqui') //document.getElementById(divID);
         //Me permite conectarme al servidor
		 
//new Ajax.Request(dataSource, {method: 'post', parameters : 'var='+str, onSuccess: mifuncion}); 
		var dataSource = 'desarrollaContactos.php';
		
		var pasa = 'algo';
       
new Ajax.Request(dataSource, { parameters: pasa ,onSuccess: mifuncion}); 




function mifuncion (resp){

   var respuesta = resp.responseText;

	

    //obj.innerHTML =respuesta;
 obj.update(respuesta);
 //esperar2(false);
    
        }    

}


function traerLogin(dataSource, divID,idForma)
      {
        
		//EL div que me mandaron
        var obj =$(divID) //document.getElementById(divID);
         //Me permite conectarme al servidor
//new Ajax.Request(dataSource, {method: 'post', parameters : 'var='+str, onSuccess: mifuncion}); 
       
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 




function mifuncion (resp){

   var respuesta = resp.responseText;

	var obj2 = $('laform');
   
   	if(respuesta == 'oks'){
		
		obj2.update('Exito');
		obj.update('Tu contrase&ntilde;a se cambio satisfactoriamente');
		
		
	}else{

	if(respuesta == 'listo'){
		document.location.href='http://www.jaguaryou.com/comunidadJaguaryou.php';
	}else{

    //obj.innerHTML =respuesta;
 obj.update(respuesta); 
 
	}
	
	
	
	}
    
        }    

}


function chgContra(dataSource, divID,idForma)
      {
        
		//EL div que me mandaron
        var obj =$(divID) //document.getElementById(divID);
         //Me permite conectarme al servidor
//new Ajax.Request(dataSource, {method: 'post', parameters : 'var='+str, onSuccess: mifuncion}); 
       
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 




function mifuncion (resp){

   var respuesta = resp.responseText;

	
   
   	if(respuesta == 'oks'){
		
	
		obj.update('Tu contrase&ntilde;a se cambio satisfactoriamente');
		
		
	}else{

	if(respuesta == 'listo'){
		document.location.href='http://www.jaguaryou.com/comunidadJaguaryou.php';
	}else{

    //obj.innerHTML =respuesta;
 obj.update(respuesta); 
 
	}
	
	
	
	}
    
        }    

}

function traerLoginUp(dataSource, divID,idForma)
      {
        
		//EL div que me mandaron
        var obj =$(divID) //document.getElementById(divID);
         //Me permite conectarme al servidor
//new Ajax.Request(dataSource, {method: 'post', parameters : 'var='+str, onSuccess: mifuncion}); 
		obj.update("Cargando...");
		//var obj2 =$('reslog');
       
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 




function mifuncion (resp){

   var respuesta = resp.responseText;
   
   	if(respuesta == 'no1'){
		
		obj.update('Tu usuario no ha sido activado, consulta tu correo para activarlo');
   } 
   
   if(respuesta == 'no2'){
	   obj.update('Usuario o contrase&ntilde;a incorrecto');
   }
   
   if(respuesta != 'no1' && respuesta != 'no2'){
	   obj.update(respuesta);
	   location.reload(true);
   }
  
  }

}


function traerLoginUpre(dataSource, divID,idForma)
      {
        
		//EL div que me mandaron
        var obj =$(divID) //document.getElementById(divID);
         //Me permite conectarme al servidor
//new Ajax.Request(dataSource, {method: 'post', parameters : 'var='+str, onSuccess: mifuncion}); 
		obj.update("Cargando...");
		//var obj2 =$('reslog');
       
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 




function mifuncion (resp){

   var respuesta = resp.responseText;
   
   	if(respuesta == 'no1'){
		
		obj.update('Tu usuario no ha sido activado, consulta tu correo para activarlo');
   } 
   
   if(respuesta == 'no2'){
	   obj.update('Usuario o contrase&ntilde;a incorrecto');
   }
   
   if(respuesta == 'no3'){
	   obj.update('Para poder acceder a los beneficios premium es necesario aceptar los terminos de uso');
   }
   
   if(respuesta != 'no1' && respuesta != 'no2' && respuesta != 'no3'){
	   obj.update('Preparando tu espacio');
	   document.location.href='http://jaguaryou.com/paypal/premium_handler.php';
   }
  
  }

}



function traerLoginBarra(dataSource, divID,idForma)
      {
        
		//EL div que me mandaron
        var obj =$(divID) //document.getElementById(divID);
         //Me permite conectarme al servidor
//new Ajax.Request(dataSource, {method: 'post', parameters : 'var='+str, onSuccess: mifuncion}); 
		obj.update("Cargando...");
		//var obj2 =$('reslog');
       
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 




function mifuncion (resp){

   var respuesta = resp.responseText;
   
   	if(respuesta == 'no1'){
		
		obj.update('Tu usuario no ha sido activado, consulta tu correo para activarlo');
   } 
   
   if(respuesta == 'no2'){
	   obj.update('Usuario o contrase&ntilde;a incorrecto');
   }
   
   if(respuesta != 'no1' && respuesta != 'no2'){
	   
	   if(respuesta == 3){
	   obj.update("Preparando tu espacio");
	   document.location.href='http://jaguaryou.com/group.php';
	   }else{
	   
	   if(respuesta == 1){
	   
	   obj.update("Preparando tu espacio");
	   document.location.href='http://jaguaryou.com/premium.php';
	   
	   }else{
		   
		obj.update("Preparando tu espacio");
		document.location.href='http://jaguaryou.com/gratis.php';   
		   
	   }
	   
	   }
   }
  
  }

}

function refrescaMail(dataSource, divID,idForma)
      {
        
		
        var obj =$(divID) //document.getElementById(divID);
		obj.update("Cargando...");
		
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 


function mifuncion (resp){

   var respuesta = resp.responseText;

	if(respuesta == 'ok'){
		obj.update(respuesta);
		location.reload(true);
		
	}else{
	

    //obj.innerHTML =respuesta;
 obj.update(respuesta);
	}
    
        }    

}

function refrescaPremium(dataSource, divID,idForma)
      {
        var obj =$(divID); //document.getElementById(divID);
		
	var contrabajo = getCookie('trabajando');
	
	if(contrabajo == 'si'){
		setTimeOut("refrescaPremium('"+dataSource+"','"+divID+"','"+idForma+"')",3000);
	}else{
		new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion});
	} 


function mifuncion (resp){

   var respuesta = resp.responseText;

	if(respuesta == 1){

    //obj.innerHTML =respuesta;
 	obj.update("Enviado");
	location.reload(true);
	
	}else{
		obj.update(respuesta);
	}
    
        }    

}


function traerLoginV(dataSource, divID,idForma)
      {
        
		//EL div que me mandaron
        var obj =$(divID) //document.getElementById(divID);
         //Me permite conectarme al servidor
//new Ajax.Request(dataSource, {method: 'post', parameters : 'var='+str, onSuccess: mifuncion}); 

		var obj2 =$('reslog');
       
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 



function mifuncion (resp){

   var respuesta = resp.responseText;
   
   	if(respuesta == 'no1'){
		
		obj2.update('Tu usuario no ha sido activado, consulta tu correo para activarlo');
   } 
   
   if(respuesta == 'no2'){
	   obj2.update('Usuario o contrase&ntilde;a incorrecto');
   }
   
   if(respuesta != 'no1' && respuesta != 'no2'){
	   obj.update(respuesta);
   }
  
  }

}

function asignae(dataSource,idForma, divID)
      {
        
		//EL div que me mandaron
        var obj =$(divID) //document.getElementById(divID);
         //Me permite conectarme al servidor
//new Ajax.Request(dataSource, {method: 'post', parameters : 'var='+str, onSuccess: mifuncion}); 
       
new Ajax.Request(dataSource, { parameters: $(idForma).serialize(),onSuccess: mifuncion}); 


function mifuncion (resp){

   var respuesta = resp.responseText;

	

   // obj.innerHTML =respuesta;
 obj.update(respuesta);
 //refreshimage();
    
        }    

}

function mimodal(activa){
	var dark=document.getElementById('modo');
	var mensaje=document.getElementById('espera');
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	
	var mimodalTop = arrayPageScroll[1] + 5;

	
	mensaje.style.top = (mimodalTop < 0) ? "0px" : mimodalTop + "px";


	if(activa){
		var totaltama = arrayPageScroll[1] + arrayPageSize[1] + 400;
		dark.style.height = (totaltama + 'px');
		dark.style.display='block';
		mensaje.style.display='block';
	}else{
		dark.style.display='none';
		mensaje.style.display='none';
	}
}

function mimodal2(activa){
	var dark=document.getElementById('modo');
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	
	var mimodalTop = arrayPageScroll[1] + 5;

	if(activa){
		dark.style.height = (arrayPageSize[1] + 'px');
		dark.style.display='block';
		
	}else{
		dark.style.display='none';

	}
}

function mimodalSug(activa,divID){
	var mensaje=document.getElementById(divID);
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	
	var mimodalTop = arrayPageScroll[1] + 5;
	
	var tamano = parseInt(mensaje.style.width);
	
	var mimodalLeft = (arrayPageSize[1] / 2) - (tamano / 2);

	//mensaje.update(mimodalLeft);
	
	mensaje.style.top = (mimodalTop < 0) ? "0px" : mimodalTop + "px";
	
	mensaje.style.left = (mimodalLeft < 0) ? "0px" : mimodalLeft + "px";


	if(activa){
		
	}else{
		
		mensaje.style.display='none';
	}
}


function muestracontacto(activa){
	var dark=document.getElementById('contactob');
	if(activa){
		dark.style.display='block';
	}else{
		dark.style.display='none';
	}
}

function pintaContacto(divID){
	var obj =$(divID);
	obj.style.backgroundColor="#FF791F";
	obj.style.color="#FFFFFF";
}

function desPintaContacto(divID){
	var obj =$(divID);
	obj.style.backgroundColor="#FFFFFF";
	obj.style.color="#333";
}

//LOG IN

function ellogin(dataSource, divID)
      {
        
		//EL div que me mandaron
        var obj =$(divID) //document.getElementById(divID);
         //Me permite conectarme al servidor
//new Ajax.Request(dataSource, {method: 'post', parameters : 'var='+str, onSuccess: mifuncion}); 
       
new Ajax.Request(dataSource, { parameters: $('forma2').serialize(),onSuccess: mifuncion}); 

	var mientras = "<img src='../imagenes/loaderchiquito.gif' width='32' height='32' alt='loader' />";
	
	obj.update(mientras);


function mifuncion (resp){

   var respuesta = resp.responseText;

	if(respuesta == 'exito'){
	
	mimodal(false);
	
	}else{

    //obj.innerHTML =respuesta;
 obj.update(respuesta); 
 
	}
    
        }    

}


function esperar()
      {
        
		//EL div que me mandaron
        var obj =$('info') //document.getElementById(divID);
         //Me permite conectarme al servidor 
		 
		 var dataSource = 'obtenBanner.php';
 
 		new Ajax.Request(dataSource, { onSuccess: mifuncion}); 




function mifuncion (resp){

   var respuesta = resp.responseText;

	

    //obj.innerHTML =respuesta;
 obj.update(respuesta);
    
        }    
 		

    /*var respuesta = "<table align='center' border='0'><tr><td><img src='../imagenes/banner2.png' /></td></tr><tr><td><p>Enviando <img src='../imagenes/ajax-loader.gif' width='32' height='32' alt='loader' /></p></td></tr></table>";*/

	

    //obj.innerHTML =respuesta;
 //obj.update(respuesta); 
    
}

function menuPremium(divID, divID2, divID3){
	
	document.getElementById(divID2).style.backgroundColor = '#F7F7F7';
	document.getElementById(divID3).style.backgroundColor = '#F7F7F7';
	
	//new Effect.Highlight(divID, { startcolor: '#fcb912',endcolor: '#ffd400' });
	
	document.getElementById(divID).style.backgroundColor = '#FFDF9F';
	
}

function esperar2(activo)
      {
        
	var elbaner=document.getElementById('info');
	var elaviso=document.getElementById('infobanner');
	if(activo){
		elbaner.style.display='block';
		elaviso.style.display='none';
	}else{
		elbaner.style.display='none';
		elaviso.style.display='block';
	} 
    
}


function refreshimage(){

document.getElementById('MyImg').src = document.getElementById('MyImg').src + '#';

}

function muestra(ladiv){
	var dark=document.getElementById(ladiv);
	dark.style.display='block';
}

function oculta(ladiv){
	var dark=document.getElementById(ladiv);
	dark.style.overflow='hidden';
}

function ocultaI(estado){
	if(estado){
	Effect.Fade('instruccion1', { duration: 0.2, from: 1, to: 0 });
	Effect.Fade('instruccion2', { duration: 0.2, from: 1, to: 0 });
	Effect.Fade('instruccion3', { duration: 0.2, from: 1, to: 0 });
	Effect.Fade('instruccion4', { duration: 0.2, from: 1, to: 0 });
	}else{
	Effect.Appear('instruccion1', { from: 0.0, to: 1.0, duration: 0.4 });
	Effect.Appear('instruccion2', { from: 0.0, to: 1.0, duration: 0.4 });
	Effect.Appear('instruccion3', { from: 0.0, to: 1.0, duration: 0.4 });
	Effect.Appear('instruccion4', { from: 0.0, to: 1.0, duration: 0.4 }); 	
	}
}


/***********************************************
* Drop Down Date select script- by JavaScriptKit.com
* This notice MUST stay intact for use
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and more
***********************************************/

var monthtext=['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'];

function populatedropdown(dayfield, monthfield, yearfield){
var today=new Date()
var dayfield=document.getElementById(dayfield)
var monthfield=document.getElementById(monthfield)
var yearfield=document.getElementById(yearfield)
var mes = 1;
var dia = 1;
for (var i=0; i<31; i++){
dayfield.options[i]=new Option(dia, dia)
dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's day
dia+=1
}
for (var m=0; m<12; m++){
monthfield.options[m]=new Option(monthtext[m], mes)
//monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()], today.getMonth(), true, true) //select today's month
mes+=1
}
//var thisyear=today.getFullYear()
var thisyear=2004
/*for (var y=0; y<20; y++){
yearfield.options[y]=new Option(thisyear, thisyear)
thisyear+=1
}*/

for (var y=0; y<80; y++){
yearfield.options[y]=new Option(thisyear, thisyear)
thisyear-=1
}

//yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year

yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true)
}

function showRecaptcha(element, themeName) {
  Recaptcha.create("6LeYMgoAAAAAAG2v6xAMp00gIg1_r007s0evzGCV", element, {
        theme: themeName,
        tabindex: 0,
        callback: Recaptcha.focus_response_field
  });
}

function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}



//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(xScroll,pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

function clearForm(oForm) {
    
  var elements = oForm.elements; 
    
  oForm.reset();

  for(i=0; i<elements.length; i++) {
      
	field_type = elements[i].type.toLowerCase();
	
	switch(field_type) {
	
		case "text": 
		case "password": 
		case "textarea":
	        case "hidden":	
			
			elements[i].value = ""; 
			break;
        
		case "radio":
		case "checkbox":
  			if (elements[i].checked) {
   				elements[i].checked = false; 
			}
			break;

		case "select-one":
		case "select-multi":
            		elements[i].selectedIndex = -1;
			break;

		default: 
			break;
	}
    }
}

function IsNumeric(sText)

{
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }

/***********************************************
* Drop Down Date select script- by JavaScriptKit.com
* This notice MUST stay intact for use
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and more
***********************************************/

var monthtext=['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'];

function populatedropdown(dayfield, monthfield, yearfield){
var today=new Date()
var dayfield=document.getElementById(dayfield)
var monthfield=document.getElementById(monthfield)
var yearfield=document.getElementById(yearfield)
var mes = 1;
var dia = 1;
for (var i=0; i<31; i++){
dayfield.options[i]=new Option(dia, dia)
dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's day
dia+=1
}
for (var m=0; m<12; m++){
monthfield.options[m]=new Option(monthtext[m], mes)
//monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()], today.getMonth(), true, true) //select today's month
mes+=1
}
//var thisyear=today.getFullYear()
var thisyear=2004
/*for (var y=0; y<20; y++){
yearfield.options[y]=new Option(thisyear, thisyear)
thisyear+=1
}*/

for (var y=0; y<80; y++){
yearfield.options[y]=new Option(thisyear, thisyear)
thisyear-=1
}

//yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year

yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true)
}

function setCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toUTCString());
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}

