// JavaScript Document

//FUNCION PARA ENVIAR EL FORMULARIO

function envia_aform() {
	document.formulario.submit() 
}

// SCRIPST PASO 1 - DATOS GENERALES E INFORMACION PERSONAL

function toggleOtherNacionalidad(chosen) {
  
 
 if (chosen == 2){
			  document.formulario.numPasaporte.style.visibility = 'hidden';
			  document.formulario.anosResid.style.visibility = 'hidden';
			  document.formulario.nacionalidadOtro.style.visibility = 'hidden';
			  document.getElementById('np').style.display = 'none';
			  document.getElementById('dn').style.display = 'none';
			  document.getElementById('ar').style.display = 'none';
		}else{
				if (chosen == ''){
					  document.formulario.numPasaporte.style.visibility = 'hidden';
					  document.formulario.anosResid.style.visibility = 'hidden';
					  document.formulario.nacionalidadOtro.style.visibility = 'hidden';
					  document.getElementById('np').style.display = 'none';
					  document.getElementById('dn').style.display = 'none';
					  document.getElementById('ar').style.display = 'none';
				}else{
					  document.formulario.numPasaporte.style.visibility = 'visible';
					  document.formulario.anosResid.style.visibility = 'visible';
					  document.formulario.nacionalidadOtro.style.visibility = 'visible';
					  document.getElementById('np').style.display = 'block';
					  document.getElementById('dn').style.display = 'block';
					  document.getElementById('ar').style.display = 'block';
					
				
				}
			
        }




}


// SCRIPTS PASO 2 - DATOS ECONOMICOS
function toggleOther(chosen) {
if (chosen == 'SI') {
  document.formulario.cityBorn.style.visibility = 'visible';
} else {
  document.formulario.cityBorn.style.visibility = 'hidden';
  //document.formulario.other.value = '';
}
}



function toggleOtherPago(chosen) {
//if (chosen == 'Beca' || chosen == 'Cr&eacute;dito educativo') {
if (chosen == 'Beca') {
  document.getElementById('beca').style.display = 'block';

} else {
  document.getElementById('beca').style.display = 'none';

}

if (chosen == 'Recursos Propios') {
  document.getElementById('beca').style.display = 'none';
  document.getElementById('fhelp').style.display = 'none';

} else {
  document.getElementById('beca').style.display = 'block';

} 

if (chosen == 'Ayuda Familiar') {
  document.getElementById('fhelp').style.display = 'block';
    document.getElementById('beca').style.display = 'none';

} else {
  document.getElementById('fhelp').style.display = 'none';
  

}


if (chosen == 'NoSelected') {
  document.getElementById('fhelp').style.display = 'none';
    document.getElementById('beca').style.display = 'none';

} 

}

function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}

// FIN SCRIPTS PASO 2 - DATOS ECONOMICOS


//VALIDACION PASO 1

function validPhase2 () {


		if (document.formulario.recinto.value == '' || 
			document.formulario.carrera.value == '' ||
			document.formulario.periodo.value == '' ||
			document.formulario.tanda.value == '' 
//			document.formulario.papellido.value == '' ||
//			document.formulario.pnombre.value == '' ||
//			document.formulario.cedula.value == '' ||
//			document.formulario.sexo.value == '' ||
//			document.formulario.estadoC.value == '' ||
//			document.formulario.Nacionalidad.value == '' ||
//			document.formulario.rango.value == '' ||
//			document.formulario.cityBorn.value == '' ||
//			document.formulario.cityBorn.value == '' ||
//			document.formulario.provinciaNac.value == '' ||
//			document.formulario.sectorNac.value == '' ||
//			document.formulario.calle.value == '' ||
//			document.formulario.provinciaNacx.value == '' ||
//			document.formulario.sectorNacx.value == '' ||
//			document.formulario.telefonoNumber.value == '' ||
//			document.formulario.telefonoAreaCode.value == '' 
		)
		{
			$('#paso-1').validationEngine({returnIsValid:true});
		}


          else
				{
					$('#container-1').tabs('enable', 1);
					$('#container-1').tabs('select', 1);
				}
		}
