function onLoadForm(){
	
	if (document.inscripcion.matri[0].checked){
		document.getElementById("capa_matrimonio").style.display = "block";
		document.getElementById("capa_solo").style.display = "none";
	}else{
		document.getElementById("capa_matrimonio").style.display = "none";
		document.getElementById("capa_solo").style.display = "block";
	}
	
	if (document.inscripcion.centro[0].checked){
		document.getElementById("capa_orientacion").style.display = "block";
	}else{
		document.getElementById("capa_orientacion").style.display = "none";
	}
	
	if (document.inscripcion.guarde[0].checked){
		document.getElementById("capa_guarde").style.display = "block";
	}else{
		document.getElementById("capa_guarde").style.display = "none";
	}

}

function submit_form(){
	
	ok = true;	
	
	if (document.inscripcion.matri[0].checked){
			document.inscripcion.nombre.value = "";
			document.inscripcion.prim_apellido.value = "";
			document.inscripcion.seg_apellido.value = "";
			if (document.inscripcion.nom_mar.value == "" || document.inscripcion.prim_apell_mar.value == ""){
					alert("Debe especificar el nombre y el primer apellido del marido");
					ok = false;
			}
			if (ok){
				if (document.inscripcion.nom_esposa.value == "" || document.inscripcion.prim_apell_esposa.value == ""){
						alert("Debe especificar el nombre y el primer apellido de la esposa");
						ok = false;
				}	
			}
	}
	
	if (document.inscripcion.matri[1].checked){
			document.inscripcion.nom_mar.value = "";
			document.inscripcion.prim_apell_mar.value = "";
			document.inscripcion.seg_apell_mar.value = "";
			document.inscripcion.nom_esposa.value = "";
			document.inscripcion.prim_apell_esposa.value = "";
			document.inscripcion.seg_apell_esposa.value = "";
			if (document.inscripcion.nombre.value == "" || document.inscripcion.prim_apellido.value == ""){
					alert("Debe especificar su nombre y primer apellido");
					ok = false;
			}
	}
	
	if (ok){
		if (document.inscripcion.dir.value == ""){
				alert("Debe especificar su dirección");
				ok = false;
		}
	}
	if (ok){
		if (document.inscripcion.cp.value == ""){
				alert("Debe especificar el código postal");
				ok = false;
		}
	}
	if (ok){
		if (document.inscripcion.ciudad.value == ""){
				alert("Debe especificar su ciudad");
				ok = false;
		}
	}
	if (ok){
		if (document.inscripcion.provincia.value == ""){
				alert("Debe especificar su provincia");
				ok = false;
		}
	}
	if (ok){
		if (document.inscripcion.pais.value == ""){
				alert("Debe especificar su país");
				ok = false;
		}
	}
	if (ok){
		if (document.inscripcion.email.value == ""){
				alert("Debe especificar una dirección de correo electrónico");
				ok = false;
		}
	}
	if (ok){
		if (document.inscripcion.telefono.value == ""){
				alert("Debe especificar un teléfono de contacto");
				ok = false;
		}
	}
	if (ok){
		if (document.inscripcion.dni.value == ""){
				alert("Debe especificar su DNI o Pasaporte");
				ok = false;
		}
	}
	if (ok){
		if (!document.inscripcion.centro[0].checked && !document.inscripcion.centro[1].checked){
				alert("Debe especificar si pertenece a algún centro de orientación familiar");
				ok = false;
		}else{
			if (document.inscripcion.centro[0].checked){
					if (document.inscripcion.nom_centro.value == ""){
							alert("Debe indicar el nombre del centro de orientación familiar al que pertenece");
							ok = false;
					}		
			}
			if (document.inscripcion.centro[1].checked){
					document.inscripcion.nom_centro.value = "";
			}
		}
	}
	if (ok){
		if (!document.inscripcion.guarde[0].checked && !document.inscripcion.guarde[1].checked){
				alert("Debe especificar si desea servicio de guardería");
				ok = false;
		}else{
			if (document.inscripcion.guarde[0].checked){
					if (document.inscripcion.ninos.value == "" || document.inscripcion.edades.value == ""){
							alert("Debe indicar el número de niños para el servicio de guardería y las edades de los mismos");
							ok = false;
					}		
			}
			if (document.inscripcion.guarde[1].checked){
					document.inscripcion.ninos.value = "";
					document.inscripcion.edades.value = "";
			}
		}
	}
	if (ok){
		if (!document.inscripcion.pago[0].checked && !document.inscripcion.pago[1].checked){
				alert("Debe especificar la forma en que desea pagar la inscripción");
				ok = false;
		}
	}
	
	if (ok){
			document.inscripcion.submit();
	}
	
}
function matrimonio(){
	document.getElementById("capa_matrimonio").style.display = "block";
	document.getElementById("capa_solo").style.display = "none";
	document.inscripcion.nombre.value = "";
	document.inscripcion.prim_apellido.value = "";
	document.inscripcion.seg_apellido.value = "";
}
function solo(){
	document.getElementById("capa_matrimonio").style.display = "none";
	document.getElementById("capa_solo").style.display = "block";
	document.inscripcion.nom_mar.value = "";
	document.inscripcion.prim_apell_mar.value = "";
	document.inscripcion.seg_apell_mar.value = "";
	document.inscripcion.nom_esposa.value = "";
	document.inscripcion.prim_apell_esposa.value = "";
	document.inscripcion.seg_apell_esposa.value = "";
	document.inscripcion.hijos.value = "";
}
function orientasi(){
	document.getElementById("capa_orientacion").style.display = "block";
}
function orientano(){
	document.getElementById("capa_orientacion").style.display = "none";
	document.inscripcion.nom_centro.value = "";
}
function guardesi(){
	document.getElementById("capa_guarde").style.display = "block";
}
function guardeno(){
	document.getElementById("capa_guarde").style.display = "none";
	document.inscripcion.ninos.value = "";
	document.inscripcion.edades.value = "";
}
function validar(){
		if (document.getElementById("clave").value == "bartolo"){
					document.getElementById("titulo").style.display = "block";
					document.getElementById("excel").style.display = "block";
					document.getElementById("listado").style.display = "block";
					document.getElementById("capa_clave").style.display = "none";
		}else{
					alert("Clave incorrecta");
					document.getElementById("clave").value = "";
		}
}
