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("Husband’s First Name and Husband’s Name required");
					ok = false;
			}
			if (ok){
				if (document.inscripcion.nom_esposa.value == "" || document.inscripcion.prim_apell_esposa.value == ""){
						alert("Wife’s First Name and Wife’s Name required");
						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("First Name and Name required");
					ok = false;
			}
	}
	
	if (ok){
		if (document.inscripcion.dir.value == ""){
				alert("Address required");
				ok = false;
		}
	}
	if (ok){
		if (document.inscripcion.cp.value == ""){
				alert("Zip Code required");
				ok = false;
		}
	}
	if (ok){
		if (document.inscripcion.ciudad.value == ""){
				alert("City required");
				ok = false;
		}
	}
	if (ok){
		if (document.inscripcion.provincia.value == ""){
				alert("State/Province required");
				ok = false;
		}
	}
	if (ok){
		if (document.inscripcion.pais.value == ""){
				alert("Country required");
				ok = false;
		}
	}
	if (ok){
		if (document.inscripcion.email.value == ""){
				alert("E-mail required");
				ok = false;
		}
	}
	if (ok){
		if (document.inscripcion.telefono.value == ""){
				alert("Phone required");
				ok = false;
		}
	}
	if (ok){
		if (document.inscripcion.dni.value == ""){
				alert("ID/Passport required");
				ok = false;
		}
	}
	if (ok){
		if (!document.inscripcion.centro[0].checked && !document.inscripcion.centro[1].checked){
				alert("You must indicate if you are in contact with some Family Enrichment Center");
				ok = false;
		}else{
			if (document.inscripcion.centro[0].checked){
					if (document.inscripcion.nom_centro.value == ""){
							alert("Name of the Family Enrichment Center required");
							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("You must indicate if you need the Child Care Service");
				ok = false;
		}else{
			if (document.inscripcion.guarde[0].checked){
					if (document.inscripcion.ninos.value == "" || document.inscripcion.edades.value == ""){
							alert("Number of Children and Ages of children for the Child Care Service required");
							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("You must indicate the form of the payment");
				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 = "";
}
