function enviar(){
	if(document.getElementById("nombre").value=="" ){
		alert("No has introducido tu nombre.");
		return;
	}
	var telefono = document.getElementById("telefono");
	if(telefono.value==""){
		alert("No has introducido el telefono o no es valido.\n\nEl telefono debe estar formado por 9 numeros sin separaciones.");
		return;
	}
	if( (parseFloat(telefono.value) < 1000000) || telefono.value.length != 9 ||
	(telefono.value[0] != 9 && telefono.value[0] != 6 && telefono.value[0] != 8 ) ){
		alert("No has introducido el telefono o no es valido.\n\nEl telefono debe estar formado por 9 numeros sin separaciones.");
		return;
	}
	/* Validacion para los combos */ 
	if(document.getElementById("provinciaid").value=="-1"){
		alert("No has seleccionado tu provincia.");
		return; 
	}

	if(document.getElementById("poblacionid").value=="-1"){
		alert("No has seleccionado tu poblacion.");
		return; 
	}
	if(document.getElementById("codigopostal").value=="-1"){
		alert("No has seleccionado tu Codigo postal.");
		return; 
	}
	if(document.getElementById("edad").value=="-1"){
		alert("No has seleccionado tu edad.");
		return; 
	}
	if(document.getElementById("paisid").value=="-1"){
		alert("No has seleccionado tu nacionalidad.");
		return; 
	}/*else{
		if(document.getElementById("paisid").value != "90"){
			if(document.getElementById("identificacion") != null && document.getElementById("identificacion").value == ""){
				alert("No has introduït el DNI/NIE.");
				return;
			}else{
				var dni = document.getElementById("identificacion").value;
				if(!checkNIF(dni)){
					alert("DNI/NIF incorrectos.");
					return;
				}
			}
		}
	}*/
	if(document.getElementById("estudiosid").value=="-1"){
		alert("No has seleccionado los estudios.");
		return; 
	}
	if(document.getElementById("checkcondicioneslegales").checked == false){
		alert("Debes aceptar las condiciones de la politica de privacidad y aviso legal del servicio. Gracias.");
		return;
	}
	document.getElementById("frmCupon").submit();
}
function checkNIF(nif) {
    if (!nif) return false;
    var letras = 'TRWAGMYFPDXBNJZSQVHLCKE';
    if (nif.length != 9) return false;
    else {
        letra = nif.substr(8, 1);
        letra = letra.toUpperCase();
        dni = nif.substr(0, 8);
        dni = dni.toUpperCase();
        dni = dni.replace('X','0');
        dni = dni.replace('Y','1');
        dni = dni.replace('Z','2');
        dni -= parseInt(dni/23) * 23;
        if (letras.charAt(dni) != letra) return false;
        else return true;
    }
}

