// JavaScript Document
//**********************************************************************************************************
// funcion que verifica los campos de cliente.php, impidiendo el paso si no se han especificado los campos *
//**********************************************************************************************************
function verificar_mail(texto, mail, asunto)
{
	var vtexto=obtener_valor_txt(texto);
	var vmail=obtener_valor_txt(mail);
	var vasunto=obtener_valor_txt(asunto);

	var verifica=false;
	if (vtexto=="" && vmail=="" && vasunto=="")
	{
		verifica=false;
		alert("Debe introducir su e-mail, el asunto y el texto del mensaje");
	}
	else
	{
		if (vmail=="" && vtexto!="" && vasunto!="")
		{
			verifica=false;
			alert("Debe introducir su e-mail");
		}
		if (vmail!="" && vtexto=="" && vasunto!="")
		{
			verifica=false;
			alert("Debe rellenar el cuerpo del mensaje");
		}
		if (vmail!="" && vtexto!="" && vasunto=="")
		{
			verifica=false;
			alert("Debe introducir el asunto del mensaje");
		}
		if (vmail!="" && vtexto=="" && vasunto=="")
		{
			verifica=false;
			alert("Debe introducir el asunto y el cuerpo del mensaje");
		}
		if (vmail=="" && vtexto!="" && vasunto=="")
		{
			verifica=false;
			alert("Debe introducir su e-mail y el asunto del mensaje");
		}
		if (vmail=="" && vtexto=="" && vasunto!="")
		{
			verifica=false;
			alert("Debe introducir su e-mail y el cuerpo del mensaje");
		}
		if (vmail!="" && vtexto!="" && vasunto!="")
		{
			verifica=true;
		}
	}
	return verifica;
}


//*****************************************************
// función que obtiene el valor de un campo de texto  *
//*****************************************************
function obtener_valor_txt(txtname)
{
	var txtvalor = document.getElementById(txtname);
	var texto = txtvalor.value;
	return texto;
}


