// JavaScript Document

function validaForm(idioma){
	obj = document.forms["contacto"];
	var errores = new Array();
	if (idioma=="es") {
		with (obj){
				if(nombre.value==""){
					errores.push("- Introduzca su Nombre.");
				}
				if(apellidos.value==""){
					errores.push("- Introduzca sus Apellidos.");
				}
				if(tipo_via.value==""){
					errores.push("- Introduzca el Tipo de vía.");
				}
				if(nombre_via.value==""){
					errores.push("- Introduzca el Nombre de la vía.");
				}
				if(numero.value==""){
					errores.push("- Introduzca el Número de la vía.");
				}
				if(piso.value==""){
					errores.push("- Introduzca el Piso.");
				}
				if(poblacion.value==""){
					errores.push("- Introduzca la Población.");
				}
				if(cp.value==""){
					errores.push("- Introduzca el Código postal.");
				}
				if(cp.value==""){
					errores.push("- Introduzca el Teléfono.");
				}
				if(consulta.value==""){
					errores.push("- Introduzca el motivo de la consulta.");
				}
				if(legal.checked==false){
					errores.push("- Marque la casilla para aceptar las condiciones legales.");
				}
		}

	} else if (idioma=="en") {
		with (obj){
				if(nombre.value==""){
					errores.push("- Enter Name.");
				}
				if(apellidos.value==""){
					errores.push("- Enter Surnames.");
				}
				if(tipo_via.value==""){
					errores.push("- Enter Type of Carriageway.");
				}
				if(nombre_via.value==""){
					errores.push("- Enter Carriageway Name.");
				}
				if(numero.value==""){
					errores.push("- Enter Number.");
				}
				if(piso.value==""){
					errores.push("- Enter Flat.");
				}
				if(poblacion.value==""){
					errores.push("- Enter Town.");
				}
				if(cp.value==""){
					errores.push("- Enter Postcode.");
				}
				if(cp.value==""){
					errores.push("- Enter Telephone.");
				}
				if(consulta.value==""){
					errores.push("- Enter the Subject Matter of your request.");
				}
				if(legal.checked==false){
					errores.push("- Check the \"I have read and accept the legal conditions\" checkbox.");
				}
		}
	}
	
	if (errores.length > 0){
		var mensajes;
		
		if (idioma=="es") mensajes = "Por favor:\n\n";
		else if (idioma=="en") mensajes = "Please:\n\n";
		
		for(var i=0; i<errores.length; i++){
			mensajes += errores[i]+"\n";
		}
		alert(mensajes);
		return false;
	}
}


