<!--
//Comprobación de fecha
function IsNumeric(valor) 
{ 
var log=valor.length; var sw="S"; 
for (x=0; x<log; x++) 
{ v1=valor.substr(x,1); 
v2 = parseInt(v1); 
//Compruebo si es un valor numérico 
if (isNaN(v2)) { sw= "N";} 
} 
if (sw=="S") {return true;} else {return false; } 
} 

var primerslap=false; 
var segundoslap=false; 
function formateafecha(fecha) 
{ 
var long = fecha.length; 
var dia; 
var mes; 
var ano; 

if ((long>=2) && (primerslap==false)) { dia=fecha.substr(0,2); 
if ((IsNumeric(dia)==true) && (dia<=31) && (dia!="00")) { fecha=fecha.substr(0,2)+"/"+fecha.substr(3,7); primerslap=true; } 
else { fecha=""; primerslap=false;} 
} 
else 
{ dia=fecha.substr(0,1); 
if (IsNumeric(dia)==false) 
{fecha="";} 
if ((long<=2) && (primerslap=true)) {fecha=fecha.substr(0,1); primerslap=false; } 
} 
if ((long>=5) && (segundoslap==false)) 
{ mes=fecha.substr(3,2); 
if ((IsNumeric(mes)==true) &&(mes<=12) && (mes!="00")) { fecha=fecha.substr(0,5)+"/"+fecha.substr(6,4); segundoslap=true; } 
else { fecha=fecha.substr(0,3);; segundoslap=false;} 
} 
else { if ((long<=5) && (segundoslap=true)) { fecha=fecha.substr(0,4); segundoslap=false; } } 
if (long>=7) 
{ 
ano=fecha.substr(6,4);
mes=fecha.substr(3,2);
dia=fecha.substr(0,2);
if (IsNumeric(ano)==false) { fecha=fecha.substr(0,6); } 
else { 	
	if (long==10){ 
		hoy=new Date();
		// La fecha de nacimiento no puede ser posterior a hoy.
		if ((ano==0) || (ano<1900) || (ano>hoy.getFullYear())) { fecha=fecha.substr(0,6); } 
		else 
			if (ano==hoy.getFullYear() && mes>(hoy.getMonth()+1)) { fecha=fecha.substr(0,3); }
			else if (ano==hoy.getFullYear() && mes==(hoy.getMonth()+1) && dia>hoy.getDate()) { fecha=''; }
	} 
}
} 

if (long>=10) 
{ 
fecha=fecha.substr(0,10); 
dia=fecha.substr(0,2); 
mes=fecha.substr(3,2); 
ano=fecha.substr(6,4); 
// Año no bisiesto y es febrero y el dia es mayor a 28 
if ( (ano%4 != 0) && (mes ==02) && (dia > 28) ) { fecha=fecha.substr(0,2)+"/"; } 
} 
return (fecha); 
}

function checkFecha(str)
{
	if (/^[0-9]{2}[\/\.-][0-9]{2}[\/\.-][0-9]{4}$/.test(str)){
	return true;
	}
	return false;
}
//Fin Comprobación de fecha

function checkEmail(str)
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(str)){
		return true;
	}
	return false;
}

function checkCP(str)
{
	if (/^\d{5}$/.test(str)){
		return true;
	}
	return false;
}

function checkNIF(cif) {
	par = 0;
	non = 0;
	letras="ABCDEFGHKLMNPQS";
	let=cif.charAt(0);

	if (!isNaN(let)) {
		nif=cif;
		return validar(nif);
	}

	if (cif.length!=9)
	{
//		alert('El Cif debe tener 9 dígitos')
		return false;
	}

	if (letras.indexOf(let.toUpperCase())==-1)
	{
//		alert("El comienzo del Cif no es válido")
		return false;
	}

	for (zz=2;zz<8;zz+=2)
	{
		par = par+parseInt(cif.charAt(zz));
	}

	for (zz=1;zz<9;zz+=2)
	{
		nn = 2*parseInt(cif.charAt(zz));
		if (nn > 9) nn = 1+(nn-10);
		non = non+nn;
	}

	parcial = par + non;

	control = (10 - ( parcial % 10));

	if (control==10) control=0;

	if (control!=cif.charAt(8)) {
//		alert("El Cif no es válido")
		return false;
	}
	return true;
}

function validar(abc) {
	dni=abc.substring(0,abc.length-1);
	let=abc.charAt(abc.length-1);
	if (!isNaN(let)) {
//		alert('Falta la letra')
		return false;
	}
	else {
		cadena="TRWAGMYFPDXBNJZSQVHLCKET";
		posicion = dni % 23;
		letra = cadena.substring(posicion,posicion+1);
		if (letra!=let.toUpperCase()) {
//			alert("Nif no válido")
			return false;
		}
	}
	return true;
}

function checkURL(value)
{
	var urlregex = /^(http:\/\/)?\w+([\.-]?\w+\.)*\w+([\.-]?\w+)*(\.\w{2,4})+$/;

	if(urlregex.test(value))
	{
		return true;
	}
	return false;
}

function CompruebaCampo(campo) {
	var txt="";
	error=false;

	switch(campo.name) {

		case 'nombre':
		case 'fact_nombre':
		case 'ent_nombre':
		case 'apellidos':
		case 'fact_apellidos':
		case 'ent_apellidos':
		case 'domicilio':
		case 'fact_domicilio':
		case 'ent_domicilio':
		case 'localidad':
		case 'fact_localidad':
		case 'ent_localidad':
		case 'provincia':
		case 'fact_provincia':
		case 'ent_provincia':
		case 'formImagen':
		case 'pregunta':
				// no se hace nada. Simplemente están para que si han dado error por estar vacíos y se rellenan desaparezca el error al cambiar el foco.
		break;

		case 'nacimiento':
			if ( checkFecha(campo.value)==false ) {
				error=true;
				txt="La fecha introducida está incompleta";
			}
		break;

		case 'email':
		case 'val_email':
		case 'val_email2':
		case 'reg_email':
			if (checkEmail(campo.value)==false ) {
				error=true;
				txt="Debes introducir un email válido";
			}
		break;
		
		case 'nif':
		case 'fact_nif':
		case 'ent_nif':
			if (campo.value!='') {
				campo.value=campo.value.replace(/\./gi,"");
				campo.value=campo.value.replace(/-/gi,"");
				campo.value=campo.value.replace(/_/gi,"");
				campo.value=campo.value.toUpperCase();
				if ( checkNIF(campo.value)==false ) {
					error=true;
					txt="Debes introducir un NIF/CIF válido";
				}
			}
		break;

		case 'cp':
		case 'fact_cp':
		case 'ent_cp':
			if ( checkCP(campo.value)==false ) {
				error=true;
				txt="Debes introducir un Código Postal válido";
			}
		break;

		case 'telefono':
		case 'telefono2':
			var temp="";
			var i=0;

			if (campo.value.substr(0,1)=="+") {
				temp="00";
				i=1;
			}

			for(i=i;i<campo.value.length;i++) {
				if ( parseInt( campo.value.substr(i,1) ) >= 0 && parseInt( campo.value.substr(i,1) ) <= 9 ) {
					temp=temp+parseInt(campo.value.substr(i,1));
				}
			}

			campo.value=temp;
			if (campo.value.length>0 && campo.value.length<9) {
				error=true;
				txt="Este campo debe tener nueve caracteres numéricos";
			}
			else {
				if (campo.value.length>9 && campo.value.length<13) {
					error=true;
					txt="Este campo debe tener trece caracteres numéricos";
				}
			}
		break;

		case 'clave':
		case 'clave2':
		case 'val_clave':
		if (campo.value.length<4) {
				error=true;
				txt="Este campo debe tener al menos cuatro caracteres";
			}
		break;
	}

	if (error) {
		campoKO(campo,txt);
		return false;
	}
	else {
		campoOK(campo);
		return true;
	}
}

function campoKO(campo,txt) {
//alert(campo.name);
	document.getElementById(campo.name).style.background="#FF4957";
	document.getElementById(campo.name).style.color="#FFFFFF";
	document.getElementById(campo.name).style.fontWeight="normal";
	if (typeof(document.getElementById("txt"+campo.name))!="undefined") {
		document.getElementById("txt"+campo.name).innerHTML=txt;
		document.getElementById("txt"+campo.name).style.display="block";
	}
}
function campoOK(campo) {
	if (typeof(campo.name)!="undefined") {
		document.getElementById(campo.name).style.background="#FFFFFF";
		document.getElementById(campo.name).style.color="";
		if (typeof(document.getElementById("txt"+campo.name))!="undefined") {
			document.getElementById("txt"+campo.name).innerHTML="";
			document.getElementById("txt"+campo.name).style.display="none";
		}
	}
}

function validarDatos(thisform) {
	var val_OK=true;
	if (!CompruebaCampo(thisform.val_email)) val_OK=false;
	if (!CompruebaCampo(thisform.val_clave)) val_OK=false;
	if (typeof(thisform.val_email2)!="undefined" && thisform.val_email2.value!='' && !CompruebaCampo(thisform.val_email2)) val_OK=false;
	return val_OK;
}

function validarDatosReg(thisform) {
	if (!CompruebaCampo(thisform.reg_email)) {
		return false;
	}
	return true;
}

function validarMailEuro(numEmail) {
	ok=true;
	campoEmail=document.getElementById('email_'+numEmail);
	campoNombre=document.getElementById('nombre_'+numEmail);
	cargador=document.getElementById('divCargador');
	if (campoNombre.value=="") {
		cargador.style.visibility='hidden';
		alert("Es necesario introducir un nombre. Gracias.");
		campoNombre.select();
		campoNombre.focus();
		ok=false;
	}
	if (ok && campoEmail.value=="") {
		cargador.style.visibility='hidden';
		alert("Introduce un e-mail para verificar si es correcto. Gracias.");
		campoEmail.select();
		campoEmail.focus();
		ok=false;
	}
	if (ok && checkEmail(campoEmail.value)==false ) {
		cargador.style.visibility='hidden';
		alert("El formato del e-mail no es correcto. Comprueba que lo has escrito correctamete. Gracias.");
		campoEmail.select();
		campoEmail.focus();
		ok=false;
	}
	if (ok) {
		for (i=1;i<numEmail;i++) {
			if (document.getElementById('email_'+i).value==campoEmail.value) {
				cargador.style.visibility='hidden';
				alert("Ya has introducido la cuenta "+document.getElementById('email_'+i).value+".");
				campoEmail.select();
				campoEmail.focus();
				ok=false;
				break;
			}
		}
	}
	if (ok) {
		php='../php/valida_email_euro.php?email='+campoEmail.value;
		error=request('',php,false);
		if (error!="") {
			cargador.style.visibility='hidden';
			alert(error);
			campoEmail.select();
			campoEmail.focus();
			ok=false;
		}
	}
	if (ok) {
		total=document.getElementById('validados').innerHTML;
		document.getElementById('validados').innerHTML=parseInt(total)+1;
		document.getElementById('validado_'+numEmail).value=1;
		campoNombre.readOnly=true;
		campoNombre.style.backgroundColor="#FFFFFF";
		campoEmail.readOnly=true;
		campoEmail.style.backgroundColor="#FFFFFF";
		document.getElementById('boton_'+numEmail).innerHTML='';
		if (numEmail<15) {
			siguiente=numEmail+1;
			document.getElementById('nombre_'+siguiente).disabled=false;
			document.getElementById('nombre_'+siguiente).style.backgroundColor="#FFECEC";
			document.getElementById('email_'+siguiente).disabled=false;
			document.getElementById('email_'+siguiente).style.backgroundColor="#FFECEC";
			document.getElementById('validar_'+siguiente).disabled=false;
			document.getElementById('nombre_'+siguiente).focus();
		}
		cargador.style.visibility='hidden';
	}
}

function validarDatosMailEuro(thisform) {
	if (validarDatos(thisform)) {
		if (thisform.nombre_1.value=="" || thisform.email_1.value=="" || thisform.validado_1.value!=1) {
			alert('Para acceder con la promoción tienes que introducir y validar\nlos datos de al menos una cuenta de correo. Gracias.');
			thisform.nombre_1.focus();
			return false;
		}
		else return true;
	}
	else return false;
}

function validarDatosReg2(thisform) {
	if (!CompruebaCampo(thisform.email)) return false;
	if (!CompruebaCampo(thisform.clave)) return false;
	if (!CompruebaCampo(thisform.clave2)) return false;
	if (thisform.clave.value!="" && thisform.clave2.value!="" && thisform.clave.value!=thisform.clave2.value) {
		thisform.clave.focus();
		campoKO(thisform.clave, "El password y su confirmación no coinciden.");
		return false;
	}
	return true;
}

function validarPregunta(thisform) {
	var val_OK=true;
	if (thisform.nombre.value=="") {
		thisform.nombre.focus();
		campoKO(thisform.nombre, "Debes introducir un Nombre");
		val_OK=false;
	}
	else {
		campoOK(thisform.nombre);
	}
	if (!CompruebaCampo(thisform.email)) val_OK=false;
	if (thisform.pregunta.value=="" || thisform.pregunta.value=='Escribe aquí tu consulta...') {
		thisform.pregunta.focus();
		campoKO(thisform.pregunta, "Debes introducir la consulta que quieres realizar");
		val_OK=false;
	}
	else {
		campoOK(thisform.pregunta);
	}
	if (thisform.formImagen.value=="") {
		if (val_OK) thisform.formImagen.focus();
		campoKO(thisform.formImagen, "Debes introducir el texto de la imagen");
		val_OK=false;
//		mensaje += "\n· Debes introducir el texto de la imagen";
	}
	else {
		campoOK(thisform.formImagen);
	}
	return val_OK;
}

function validarFechas(thisform) {
	var val_OK=true;
	if (thisform.otra.value!='' && thisform.titulo.value=='') {
		alert ("Has de introducir un título para describir la fecha");
		return false;
	}
	if (thisform.nacimiento.value!='' && !checkFecha(thisform.nacimiento.value)) val_OK=false;
	if (thisform.santo.value!='' && !checkFecha(thisform.santo.value)) val_OK=false;
	if (thisform.aniversario.value!='' && !checkFecha(thisform.aniversario.value)) val_OK=false;
	if (thisform.otra.value!='' && !checkFecha(thisform.otra.value)) val_OK=false;
	if (!val_OK) alert ("El formato de las fechas es dd/mm/aaaa.");
	else return val_OK;
}

function comprobarDatos(thisform) {
	
	var error=false;
	var mensaje="";
	
	if (thisform.nombre.value=="") {
		if (!error) thisform.nombre.focus();
		campoKO(thisform.nombre, "Debes introducir tu Nombre");
		error=true;
//		mensaje += "\n· Debes introducir tu Nombre";
	}
	else {
		campoOK(thisform.nombre);
	}

	if (thisform.apellidos.value=="") {
		if (!error) thisform.apellidos.focus();
		campoKO(thisform.apellidos, "Debes introducir los Apellidos");
		error=true;
//		mensaje += "\n· Debes introducir tus Apellidos";
	}
	else {
		campoOK(thisform.apellidos);
	}

	if (thisform.id_tipo.value==3) {
		if (thisform.web.value=="") {
			if (!error) thisform.web.focus();
			campoKO(thisform.web, "Debes introducir una dirección web");
			error=true;
//		mensaje += "\n· Debes introducir tus Apellidos";
		}
		else {
			campoOK(thisform.web);
		}
	}

	if (thisform.empresa.value!="" ||
	    thisform.cp.value.substring(0,2)==35 || thisform.cp.value.substring(0,2)==38 || 
		thisform.cp.value.substring(0,2)==51 || thisform.cp.value.substring(0,2)==52) {
		if (thisform.nif.value=="") {
			if (!error) thisform.nif.focus();
			campoKO(thisform.nif, "Debes introducir el NIF/CIF");
			error=true;
//		mensaje += "\n· Debes introducir el NIF/CIF";
		}
		else {
			if (!CompruebaCampo(thisform.nif)) {
				if (!error) thisform.nif.focus();
				error=true;
			}
		}
	}

	if (thisform.sexo.value=="") {
		if (!error) thisform.sexo.focus();
		campoKO(thisform.sexo, "Debes elegir una opción");
		error=true;
//		mensaje += "\n· Debes elegir una opción";
	}
	else {
		campoOK(thisform.sexo);
	}

	if (thisform.domicilio.value=="") {
		if (!error) thisform.domicilio.focus();
		campoKO(thisform.domicilio, "Debes introducir la dirección");
		error=true;
//		mensaje += "\n· Debes introducir la dirección";
	}
	else {
		campoOK(thisform.domicilio);
	}

	if (thisform.localidad.value=="") {
		if (!error) thisform.localidad.focus();
		campoKO(thisform.localidad, "Debes introducir la población");
		error=true;
//		mensaje += "\n· Debes introducir la población";
	}
	else {
		campoOK(thisform.localidad);
	}

	if (thisform.cp.value=="") {
		if (!error) thisform.cp.focus();
		campoKO(thisform.cp, "Debes introducir el Código postal");
		error=true;
//		mensaje += "\n· Debes introducir el Código postal";
	}
	else {
		if (!CompruebaCampo(thisform.cp)) {
			if (!error) thisform.cp.focus();
			error=true;
		}
	}

	if (thisform.provincia.value=="") {
		if (!error) thisform.provincia.focus();
		campoKO(thisform.provincia, "Debes introducir la provincia");
		error=true;
//		mensaje += "\n· Debes introducir la provincia";
	}
	else {
		campoOK(thisform.provincia);
	}

	if (thisform.telefono.value=="" && thisform.telefono2.value=="") {
		if (!error) thisform.telefono.focus();
		campoKO(thisform.telefono, "Debes introducir un número de teléfono");
		error=true;
//		mensaje += "\n· Debes introducir un número de teléfono";
	}
	else {
		if (!CompruebaCampo(thisform.telefono)) {
			if (!error) thisform.telefono.focus();
			error=true;
		}
		if (!CompruebaCampo(thisform.telefono2)) {
			if (!error) thisform.telefono2.focus();
			error=true;
		}
	}

	if (thisform.nacimiento.value=="") {
		if (!error) thisform.nacimiento.focus();
		error=true;
		campoKO(thisform.nacimiento, "Debes introducir tu fecha de cumpleaños");
	}
	else {
		if (!CompruebaCampo(thisform.nacimiento)) {
			if (!error) thisform.nacimiento.focus();
			error=true;
		}
	}

	if (thisform.email.value=="") {
		if (!error) thisform.email.focus();
		error=true;
		campoKO(thisform.email, "Debes introducir un Correo Electrónico");
//		mensaje += "\n· Debes introducir tu Correo Electrónico";
	}
	else {
		if (!CompruebaCampo(thisform.email)) {
			if (!error) thisform.email.focus();
			error=true;
		}
	}

	if (typeof(thisform.clave)!="undefined" && typeof(thisform.clave2)!="undefined") {
		if (thisform.clave.value!="" && thisform.clave2.value!="" && thisform.clave.value!=thisform.clave2.value) {
			if (!error) thisform.clave.focus();
			campoKO(thisform.clave, "El password y su confirmación no coinciden.");
			error=true;
//		mensaje += "\n· El password y su confirmación no coinciden.";
		}
		else {
			if (thisform.clave.value=="") {
				if (!error) thisform.clave.focus();
				campoKO(thisform.clave, "Debes introducir el Password");
				error=true;
//		mensaje += "\n· Debes introducir el Password";
			}
			else {
				if (!CompruebaCampo(thisform.clave)) {
					if (!error) thisform.clave.focus();
					error=true
				}
			}

			if (thisform.clave2.value=="") {
				if (!error) thisform.clave2.focus();
				campoKO(thisform.clave2, "Debes confirmar el Password");
				error=true;
//		mensaje += "\n· Debes confirmar el Password";
			}
			else {
				if (!CompruebaCampo(thisform.clave2)) {
					if (!error) thisform.clave2.focus();
					error=true
				}
			}
		}
	}

	// DIRECCIÓN DE FACTURACIÓN
	if (thisform.fact_pers.checked==false) {
		if (thisform.fact_nombre.value=="") {
			if (!error) thisform.fact_nombre.focus();
			campoKO(thisform.fact_nombre, "Debes introducir un Nombre");
			error=true;
		}
		else {
			campoOK(thisform.fact_nombre);
		}
		if (thisform.fact_apellidos.value=="") {
			if (!error) thisform.fact_apellidos.focus();
			campoKO(thisform.fact_apellidos, "Debes introducir los apellidos");
			error=true;
		}
		else {
			campoOK(thisform.fact_apellidos);
		}
/*		if (thisform.fact_nif.value=="") {
			if (!error) thisform.fact_nif.focus();
			campoKO(thisform.fact_nif, "Debes introducir un NIF/CIF");
			error=true;
		}
		else {
			if (!CompruebaCampo(thisform.fact_nif)) {
				if (!error) thisform.fact_nif.focus();
				error=true;
			}
		}*/
		if (thisform.fact_domicilio.value=="") {
			if (!error) thisform.fact_domicilio.focus();
			campoKO(thisform.fact_domicilio, "Debes introducir una dirección");
			error=true;
		}
		else {
			campoOK(thisform.fact_domicilio);
		}
		if (thisform.fact_localidad.value=="") {
			if (!error) thisform.fact_localidad.focus();
			campoKO(thisform.fact_localidad, "Debes introducir una localidad");
			error=true;
		}
		else {
			campoOK(thisform.fact_localidad);
		}
		if (thisform.fact_cp.value=="") {
			if (!error) thisform.fact_cp.focus();
			campoKO(thisform.fact_cp, "Debes introducir un Código postal");
			error=true;
		}
		else {
			if (!CompruebaCampo(thisform.fact_cp)) {
				if (!error) thisform.fact_cp.focus();
				error=true;
			}
		}
		if (thisform.fact_provincia.value=="") {
			if (!error) thisform.fact_provincia.focus();
			campoKO(thisform.fact_provincia, "Debes introducir una provincia");
			error=true;
		}
		else {
			campoOK(thisform.fact_provincia);
		}
	}

	// DIRECCIÓN DE ENTREGA
	if (!thisform.ent_pers.checked) {
		if (thisform.ent_nombre.value=="") {
			if (!error) thisform.ent_nombre.focus();
			campoKO(thisform.ent_nombre, "Debes introducir un Nombre");
			error=true;
		}
		else {
			campoOK(thisform.ent_nombre);
		}
		if (thisform.ent_apellidos.value=="") {
			if (!error) thisform.ent_apellidos.focus();
			campoKO(thisform.ent_apellidos, "Debes introducir los apellidos");
			error=true;
		}
		else {
			campoOK(thisform.ent_apellidos);
		}
/*		if (thisform.ent_nif.value=="") {
			if (!error) thisform.ent_nif.focus();
			campoKO(thisform.ent_nif, "Debes introducir un NIF/CIF");
			error=true;
		}
		else {
			if (!CompruebaCampo(thisform.ent_nif)) {
				if (!error) thisform.ent_nif.focus();
				error=true;
			}
		}*/
		if (thisform.ent_domicilio.value=="") {
			if (!error) thisform.ent_domicilio.focus();
			campoKO(thisform.ent_domicilio, "Debes introducir una dirección");
			error=true;
		}
		else {
			campoOK(thisform.ent_domicilio);
		}
		if (thisform.ent_localidad.value=="") {
			if (!error) thisform.ent_localidad.focus();
			campoKO(thisform.ent_localidad, "Debes introducir una localidad");
			error=true;
		}
		else {
			campoOK(thisform.ent_localidad);
		}
		if (thisform.ent_cp.value=="") {
			if (!error) thisform.ent_cp.focus();
			campoKO(thisform.ent_cp, "Debes introducir un Código postal");
			error=true;
		}
		else {
			if (!CompruebaCampo(thisform.ent_cp)) {
				if (!error) thisform.ent_cp.focus();
				error=true;
			}
		}
		if (thisform.ent_provincia.value=="") {
			if (!error) thisform.ent_provincia.focus();
			campoKO(thisform.ent_provincia, "Debes introducir una provincia");
			error=true;
		}
		else {
			campoOK(thisform.ent_provincia);
		}
	}

	if (thisform.formImagen.value=="") {
		if (!error) thisform.formImagen.focus();
		campoKO(thisform.formImagen, "Debes introducir el texto de la imagen");
		error=true;
//		mensaje += "\n· Debes introducir el texto de la imagen";
	}
	else {
		campoOK(thisform.formImagen);
	}

	if (error==true) {
//		alert("Por favor revisa el formulario:\n"+mensaje);
		return false
	}
	else {
		return true;
	}
}

function comprobarDatosPromo(thisform) {
	
	var error=false;
	var mensaje="";
	
	if (thisform.nombre.value=="") {
		if (!error) thisform.nombre.focus();
		campoKO(thisform.nombre, "Debes introducir tu Nombre");
		error=true;
//		mensaje += "\n· Debes introducir tu Nombre";
	}
	else {
		campoOK(thisform.nombre);
	}

	if (thisform.apellidos.value=="") {
		if (!error) thisform.apellidos.focus();
		campoKO(thisform.apellidos, "Debes introducir los Apellidos");
		error=true;
//		mensaje += "\n· Debes introducir tus Apellidos";
	}
	else {
		campoOK(thisform.apellidos);
	}

	if (thisform.nacimiento.value=="") {
		if (!error) thisform.nacimiento.focus();
		error=true;
		campoKO(thisform.nacimiento, "Debes introducir tu fecha de cumpleaños");
	}
	else {
		if (!CompruebaCampo(thisform.nacimiento)) {
			if (!error) thisform.nacimiento.focus();
			error=true;
		}
	}

	if (thisform.sexo.value=="") {
		if (!error) thisform.sexo.focus();
		campoKO(thisform.sexo, "Debes elegir una opción");
		error=true;
//		mensaje += "\n· Debes elegir una opción";
	}
	else {
		campoOK(thisform.sexo);
	}

	if (thisform.email.value=="") {
		if (!error) thisform.email.focus();
		error=true;
		campoKO(thisform.email, "Debes introducir un Correo Electrónico");
//		mensaje += "\n· Debes introducir tu Correo Electrónico";
	}
	else {
		if (!CompruebaCampo(thisform.email)) {
			if (!error) thisform.email.focus();
			error=true;
		}
	}

	if (typeof(thisform.clave)!="undefined" && typeof(thisform.clave2)!="undefined") {
		if (thisform.clave.value!="" && thisform.clave2.value!="" && thisform.clave.value!=thisform.clave2.value) {
			if (!error) thisform.clave.focus();
			campoKO(thisform.clave, "El password y su confirmación no coinciden.");
			error=true;
//		mensaje += "\n· El password y su confirmación no coinciden.";
		}
		else {
			if (thisform.clave.value=="") {
				if (!error) thisform.clave.focus();
				campoKO(thisform.clave, "Debes introducir el Password");
				error=true;
//		mensaje += "\n· Debes introducir el Password";
			}
			else {
				if (!CompruebaCampo(thisform.clave)) {
					if (!error) thisform.clave.focus();
					error=true
				}
			}

			if (thisform.clave2.value=="") {
				if (!error) thisform.clave2.focus();
				campoKO(thisform.clave2, "Debes confirmar el Password");
				error=true;
//		mensaje += "\n· Debes confirmar el Password";
			}
			else {
				if (!CompruebaCampo(thisform.clave2)) {
					if (!error) thisform.clave2.focus();
					error=true
				}
			}
		}
	}

	if (thisform.formImagen.value=="") {
		if (!error) thisform.formImagen.focus();
		campoKO(thisform.formImagen, "Debes introducir el texto de la imagen");
		error=true;
//		mensaje += "\n· Debes introducir el texto de la imagen";
	}
	else {
		campoOK(thisform.formImagen);
	}

	if (error==true) {
//		alert("Por favor revisa el formulario:\n"+mensaje);
		return false
	}
	else {
		return true;
	}
}

function comprobarDatosContacto(thisform) {
	
	var error=false;
	var mensaje="";
	
	if (thisform.nombre.value=="") {
		if (!error) thisform.nombre.focus();
		campoKO(thisform.nombre, "Debes introducir tu Nombre");
		error=true;
//		mensaje += "\n· Debes introducir tu Nombre";
	}
	else {
		campoOK(thisform.nombre);
	}

	if (thisform.email.value=="") {
		if (!error) thisform.email.focus();
		error=true;
		campoKO(thisform.email, "Debes introducir un Correo Electrónico");
//		mensaje += "\n· Debes introducir tu Correo Electrónico";
	}
	else {
		if (!CompruebaCampo(thisform.email)) {
			if (!error) thisform.email.focus();
			error=true;
		}
	}

	if (thisform.consulta.value=="") {
		if (!error) thisform.consulta.focus();
		campoKO(thisform.consulta, "Debes introducir cuál es el motivo de tu consulta");
		error=true;
//		mensaje += "\n· Debes introducir tu consulta";
	}
	else {
		campoOK(thisform.consulta);
	}

	if (thisform.formImagen.value=="") {
		if (!error) thisform.formImagen.focus();
		campoKO(thisform.formImagen, "Debes introducir el texto de la imagen");
		error=true;
//		mensaje += "\n· Debes introducir el texto de la imagen";
	}
	else {
		campoOK(thisform.formImagen);
	}
	
	if (error==true) {
//		alert("Por favor revisa el formulario:\n"+mensaje);
		return false
	}
	else {
		return true;
	}
}

function validaConjuntosGratis(thisform) {
	var error=false;
	var mensaje="";
			
	if (thisform.nombre.value=="") {
		if (!error) thisform.nombre.focus();
		campoKO(thisform.nombre, "Debes introducir tu Nombre");
		error=true;
//		mensaje += "\n· Debes introducir tu Nombre";
	}
	else {
		campoOK(thisform.nombre);
	}

	if (thisform.localidad.value=="") {
		if (!error) thisform.localidad.focus();
		campoKO(thisform.localidad, "Debes introducir una Localidad");
		error=true;
//		mensaje += "\n· Debes introducir el texto de la imagen";
	}
	else {
		campoOK(thisform.localidad);
	}
	
	if (thisform.email.value=="") {
		if (!error) thisform.email.focus();
		error=true;
		campoKO(thisform.email, "Debes introducir un Correo Electrónico");
//		mensaje += "\n· Debes introducir tu Correo Electrónico";
	}
	else {
		if (!CompruebaCampo(thisform.email)) {
			if (!error) thisform.email.focus();
			error=true;
		}
	}
	
	if (thisform.telefono.value=="") {
		if (!error) thisform.telefono.focus();
		campoKO(thisform.telefono, "Debes introducir un número de teléfono");
		error=true;
//		mensaje += "\n· Debes introducir un número de teléfono";
	}
	else {
		if (!CompruebaCampo(thisform.telefono)) {
			if (!error) thisform.telefono.focus();
			error=true;
		}
	}

	if (thisform.formImagen.value=="") {
		if (!error) thisform.formImagen.focus();
		campoKO(thisform.formImagen, "Debes introducir el texto de la imagen");
		error=true;
//		mensaje += "\n· Debes introducir el texto de la imagen";
	}
	else {
		campoOK(thisform.formImagen);
	}
	
	if (error==true) {
//		alert("Por favor revisa el formulario:\n"+mensaje);
		return false
	}
	else {
		return true;
	}
}

function validaFormFaq() {
		if (!checkEmail(document.frmDatosFaq.email.value) || document.frmDatosFaq.nombre.value == "" || document.frmDatosFaq.consulta.value == "" || document.frmDatosFaq.formImagen.value == "") {
			alert('Por favor, rellena correctamente todos los campos del formulario de consulta.');
			return false;
		} else {
			return true;	
		}
}

function validaCodigoTarjeta() {
		if (document.formTarjeta.codigoTarjeta.value == "") {
			alert('Por favor, introduce el código de tu tarjeta regalo.');
			return false;
		} else {
			return true;	
		}
}
//-->
