function checkEmail(objValue){
	if (objValue == "")
		return false;
	if (objValue.charAt(0) == '@')
		return false;
	if (objValue.length < 6)
		return false;
	if (objValue.indexOf("@") == -1)
		return false;
	if (objValue.indexOf(".") == -1)
		return false;
	if (objValue.slice(objValue.indexOf("@")).indexOf(".") == -1)
		return false;
	return true;
}
		
function checkNumPhone(objValue){
	var myobjDato = new String(objValue)

	if (myobjDato == "")			// Comprueba que no está vacio
		return false;
	if (myobjDato.length != 9)		// Comprueba que tenga longitud de nueve
		return false;
	if (isNaN(myobjDato))		// Comprueba si es numérico
		return false;
	if ((myobjDato.substring(0,1) != '9') && (myobjDato.substring(0,1) != '6'))	// Comprueba si empieza por 9 ó 6
		return false;
	return true;
}
		
function enviar_solicitud() {
	var sol_nombre = document.getElementById('sol_nombre').value;
	var sol_tel = document.getElementById('sol_tel').value;
	var sol_email = document.getElementById('sol_email').value;
			
			
			
	if ( sol_nombre == "" || sol_nombre == 'Nombre' ) {
		alert("Por favor, introduzca su nombre");
		document.getElementById('sol_nombre').focus();
	} else if ( sol_tel == "" || sol_tel == 'Teléfono' ) {
		alert("Por favor, introduzca un teléfono de contacto");
		document.getElementById('sol_tel').focus();
	} else if (!checkNumPhone(sol_tel)) {
		alert("Por favor, introduzca un teléfono de contacto válido");
		document.getElementById('sol_tel').focus();
	} else if ( sol_email == "" || sol_email == 'Email' ) {
		alert("Por favor, introduzca un email de contacto");
		document.getElementById('sol_email').focus();
	} else if (!checkEmail(sol_email)) {
		alert("Por favor, introduzca un email de contacto válido");
		document.getElementById('sol_email').focus();
	} else {
		document.getElementById('solicitud').submit();
	}
}
