function validaSiExisteMail()
{
				
				obt1 = document.getElementById('nombre').value;
				obt2 = document.getElementById('email').value;
				obt3 = document.getElementById('entidad').value;

				$.ajax
				({
					type: "GET",
					contentType: "application/x-www-form-urlencoded",
					url: "ajax/ajaxValidaMail.php",
					data: "mail="+obt2,
					complete: function  (datos)
					{
						var errors = '';
						var status = true;
						obt1 = document.getElementById('nombre').value;
						obt2 = document.getElementById('email').value;
						obt3 = document.getElementById('entidad').value;

						
						var retorno = datos.responseText;
									
						if(retorno == " \r\nverdadero")
						{ 

							errors = errors + " * Existe el mail\n";
							status = false;
							
						}
						
						

						if (obt1 == "")
						{
							errors = errors + " * Falta Nombre  \n";
							status = false;
						}
	
						if(!obt2.match(/^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i))
						{
							errors = errors + " * Escriba un mail valido\n";
							status = false;	
						}
			
						 if(obt3 == "")
						{
							errors = errors + " * Falta Entidad\n";
							status = false;
						}
						if (status != true)
						{
							alert(errors);
						}
						else{document.alta.submit();};
									
					}
				});
				
}
//*************************************************************************************************************************************

//*************************************************************************************************************************************
function validateFormListAdd()
{
	validaSiExisteMail();
}
//*************************************************************************************************************************************

//*************************************************************************************************************************************
function verificaMail()
		{
				
				
				obt2 = document.getElementById('email').value;
				

				$.ajax
				({
					type: "GET",
					contentType: "application/x-www-form-urlencoded",
					url: "ajax/ajaxValidaMail.php",
					data: "mail="+obt2,
					complete: function  (datos)
					{
						var errors = '';
						var status = true;
						obt2 = document.getElementById('email').value;
						var retorno = datos.responseText;									
						if(retorno == " \r\nfalso")
						{ 

							errors = errors + " * No existe el mail\n";
							status = false;
							
						}
						if(!obt2.match(/^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i))
						{
							errors = errors + " * Escriba un mail valido\n";
							status = false;	
						}		
						 
						if (status != true)
						{
							alert(errors);
						}
						else{
						if(confirm('żEsta seguro de dar de baja a '+ obt2 + "?"))
									{
									document.baja.submit();
									}
							}		
						   
									
					}
				});
				
}

//*************************************************************************************************************************************

//*************************************************************************************************************************************

function limpiarLabel(){
var label=document.getElementById("labelMail").value ;
if(label!="Email:")
{
document.getElementById("labelMail").innerHTML = "Email:";
document.getElementById("email").value = "";
}
}
function limpiarTextarea(){
document.getElementById('mensaje').value="";

}

//*************************************************************************************************************************************

//*************************************************************************************************************************************
function validateFormListDelete()
{
		verificaMail();
}
//*************************************************************************************************************************************

//*************************************************************************************************************************************
function validateFormMailContacto()
{
nombre = document.getElementById('nombre').value;
mail = document.getElementById('email').value;
titulo = document.getElementById('titulo').value;
mensaje = document.getElementById('mensaje').value;
var errors = '' ;
var status = true;
if (nombre=="")
{
			errors = errors + " * Falta nombre\n";
			status = false;	

}
if(!mail.match(/^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i))
						{
							errors = errors + " * Escriba un mail valido\n";
							status = false;	
						}		
if (titulo=="")
{
			errors = errors + " * Falta titulo\n";
			status = false;	

}
if (mensaje=="")
{
			errors = errors + " * Falta mensaje\n";
			status = false;	

}
if (status != true)
	{
		alert(errors);
	}
	return status;

}


