function comprobar() 
{
	var f = document.getElementById("frmReg");
	var ok;
	ok = true;
	if ((ok)&&(f.email.value=="")) {
		alert("Introduzca correctamente el email / Enter email correctly / Introduza correctamente o email");
		ok = false;
		f.email.focus();
	}
	if ((ok)&&(formatoEmail(f.email.value) == false))
	{
		alert("El email no es válido / This email is not valid / O email non é válido");
		ok = false;
		f.email.focus();
	}
	
	if((ok)&&(!f.condiciones.checked)){
		alert("Debes aceptar las condiciones.");
		ok = false;
	}

	return ok;
}

function enviar() 
{
	var f = document.getElementById("frmReg");
	
	if (comprobar()) {
		f.submit();
	}		
}

function focusEmail(input){
	 if(input.value=='Introduce o teu email' || input.value=='Introduce tu email'){
 		input.value='';
	 }
}

function AbrirCondiciones(ruta){
		ventana_secundaria = window.open(ruta,"condicioneslegales","width=570,height=375,menubar=no");
	}

function formatoEmail(valor) {
		if (valor.length>0){
			if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(valor)){
				return (true);
			}
			else{
				return (false);
			}
		}else return (true);
	}