function nuevoAjax()
{ 
	/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
	lo que se puede copiar tal como esta aqui */
	var xmlhttp=false; 
	try 
	{ 
		// Creacion del objeto AJAX para navegadores no IE
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e)
	{ 
		try
		{ 
			// Creacion del objet AJAX para IE 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!="undefined") { xmlhttp=new XMLHttpRequest(); } 

	return xmlhttp; 
}
//========================================================
function Activarlogueo()
{
	var labelRecuperarPass = document.getElementById('recordarpass');
	
	var divMensaje=document.getElementById('cargarfoto');
	var usuario=document.getElementById('usuario');
	var clave=document.getElementById('clave');
	var cargando="Cargando..."
	
	//Desabilitando Campos de Texto...................
	usuario.disabled=true;
	clave.disabled=true;
	
	//Recogiendo Valores de Campos de Texto pta enviarlo por Post...................
	vusuario=usuario.value;
	vclave=clave.value;
	
	//Cambiando Fondo de Campo de Texto....................................
	usuario.value=cargando;
	clave.value=cargando;
	
	var ajax=nuevoAjax();
		ajax.open("POST", "procesos/procesar_logueo.php", true);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send("usuario="+escape(vusuario)+"&clave="+escape(vclave));
		//ajax.send(null);
		
		ajax.onreadystatechange=function()
		{
			if (ajax.readyState==4)
			{
				var patron = /ERROR/;
				if(ajax.responseText.search(patron)!=-1)
				{
						//divMensaje.innerHTML=ajax.responseText;
						usuario.disabled=false;
						clave.disabled=false;
						usuario.value="";
						clave.value="";
						usuario.focus();
						alert('Campos Ususario o Password Incorrectos...!')
				}
				else
				{
						labelRecuperarPass.disabled = true;
						labelRecuperarPass.style.visibility="hidden";
						divMensaje.innerHTML=ajax.responseText;
						usuario.disabled=false;
						clave.disabled=false;
						usuario.value="";
						clave.value="";
						usuario.focus();
						new Effect.BlindDown("divlogueo");
				}
			}
		}
	

	/*
	if(mensaje=="Miguel")
	{
		divMensaje.innerHTML=mensaje;
	}*/
	//document.execCommand("ClearAuthenticationCache");
}
//=========================================================================
function validarSendEmail(id) 
{
	var valor = document.getElementById(id).value;
  if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor))
  {
	   alert("La dirección de email " + valor    + " es INCORRECTA.");
	   //return (false)
	   document.getElementById(id).value="";
	   document.getElementById(id).focus();
  }
}
//============================================================================
function SendEmailFriend()
{
	//var div_contenedor = document.getElementById('contenedor');
	var celda_tunombre = document.getElementById('tunombre').value;
	var celda_amigo = document.getElementById('amigo').value;
	var celda_sendemail = document.getElementById('sendemail').value;
	
	var ajaxSendEmail=nuevoAjax();
		ajaxSendEmail.open("POST", "http://www.flrepresentaciones.com/www/MandarEmail/email_clubwarner.php", true);
		ajaxSendEmail.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajaxSendEmail.send("tunombre="+escape(celda_tunombre)+"&amigo="+escape(celda_amigo)+"&sendemail="+escape(celda_sendemail));
		//ajax.send(null);
		
		ajaxSendEmail.onreadystatechange=function()
		{
			 //div_contenedor.innerHTML=ajaxSendEmail.responseText;
			if (ajaxSendEmail.readyState==4)
			{
				var patron = /ERROR:/;
				if(ajaxSendEmail.responseText.search(patron)!=-1)
				{
						celda_tunombre="";
						celda_amigo="";
						celda_sendemail="";
						document.getElementById('tunombre').focus();
						alert('Campos Ususario o Password Incorrectos...!');
				}
				else
				{
						celda_tunombre="";
						celda_amigo="";
						celda_sendemail="";
						document.getElementById('tunombre').focus();
						alert('Su mensaje ha sido enviado...!');
				}
			}
		}
}
//**********************************************************************************************************************************
function VentanaRecuperarClave()
{
	window.open('recuperar_clave.php','VRecuperarClave','left=520,top=350,width=335,height=219,toolbar=0,resizable=0,status=no,menubar=no');

}
//**************************************************************************
