// JavaScript Document
function nextofPostular()
{
document.getElementById("contentScroll_workwithour").style.display="none";
document.getElementById("buttonPostular").style.display="none";
document.getElementById("passone").style.display="block";
	if (document.getElementById("iscombobox_passone").value=="N")
	{
		xajax_convertInputtoHybridCombox("txt_estadocivil");
		document.getElementById("iscombobox_passone").value="Y";
	}

}
function backPassone()
{
document.getElementById("passone").style.display="none";
document.getElementById("contentScroll_workwithour").style.display="block";
document.getElementById("buttonPostular").style.display="block";
}
function nexttoPassone()
{
	document.getElementById("iscombobox_passtwo").value="N";
	document.getElementById("passone").style.display="none";
	document.getElementById("passtwo").style.display="block";
		if (document.getElementById("iscombobox_passtwo").value=="N")
		{
			//xajax_getDepartment("txt_departamento");
			document.getElementById("iscombobox_passtwo").value="Y";
		}
}
function backPasstwo()
{
document.getElementById("passtwo").style.display="none";
document.getElementById("passone").style.display="block";
}

function nexttoPasstwo()
{
document.getElementById("passtwo").style.display="none";
document.getElementById("passthree").style.display="block";
	if (document.getElementById("iscombobox_passthree").value=="N")
	{
		xajax_convertInputtoHybridCombox("txt_gradoacademico");
		xajax_convertInputtoHybridCombox("txt_carrera");
		xajax_convertInputtoHybridCombox("txt_idioma");
		xajax_convertInputtoHybridCombox("txt_nivel");
		xajax_convertInputtoHybridCombox("txt_duracion");
		xajax_convertInputtoHybridCombox("txt_disponibilidad");
		document.getElementById("iscombobox_passthree").value="Y";
	}

}
function backPassthree()
{
document.getElementById("passthree").style.display="none";
document.getElementById("passtwo").style.display="block";
}
function nexttoPassthree()
{
document.getElementById("passthree").style.display="none";
document.getElementById("passfour").style.display="block";
	if (document.getElementById("iscombobox_passfour").value=="N")
	{
		xajax_convertInputtoHybridCombox("txt_tiempodetrabajo");
		document.getElementById("iscombobox_passfour").value="Y";
	}

}
function backPassfour()
{
document.getElementById("passfour").style.display="none";
document.getElementById("passthree").style.display="block";
}
function backPassthree()
{
document.getElementById("passthree").style.display="none";
document.getElementById("passtwo").style.display="block";
}
function nexttoPassfour()
{
document.getElementById("passfour").style.display="none";
document.getElementById("passfive").style.display="block";
	if (document.getElementById("iscombobox_passfive").value=="N")
	{
		//xajax_convertInputtoHybridCombox("txt_sueldodeseado");
		xajax_getComplexHybridCombox("txt_cinedeseado");
		document.getElementById("iscombobox_passfive").value="Y";
	}

}
function backPassfive()
{
document.getElementById("passfive").style.display="none";
document.getElementById("passfour").style.display="block";
}

function validationPassOne()
{
	if(!validatorObject_core("txt_nombre","V","Nombres","Paso 1")){return;}
	if(!validatorObject_core("txt_nombre","S","Nombres","Paso 1")){return;}
	if(!validatorObject_core("txt_apellido","V","Apellidos","Paso 1")){return;}
	if(!validatorObject_core("txt_apellido","S","Apellidos","Paso 1")){return;}
	//if(!validatorObject_core("txt_dni","V","DNI","Paso 1")){return;}
	//if(!validatorObject_core("txt_dni","N","DNI","Paso 1")){return;}
	//if(!validatorObject_core("txt_dni","L","DNI","Paso 1",8)){return;}
	if(!validarDate()){return;}
	if(!validatorObject_core("txt_edad","V","Edad","Paso 1")){return;}
	if(!validatorObject_core("txt_edad","I","Edad","Paso 1",3,"0","3")){return;}
	if(!validatorObject_core("txt_edad","N","Edad","Paso 1")){return;}
	if(!validatorObject_core("txt_edad","L","Edad","Paso 1",2)){return;}
	if(!validatorObject_core("txt_estadocivil","I","Estado Civil","Paso 1",3,"--Seleccionar--","1")){return;}
	
	var radioHijos = getSelectedRadio(document.forms[0].radiohijos);
	var numeroHijos
	if (radioHijos == 0)
	{	if(!validatorObject_core("txt_cuantos","I","Cuantos Hijos","Paso 1",3,"Nº","2")){return;}
		if(!validatorObject_core("txt_cuantos","I","Cuantos Hijos","Paso 1",3,"0","3")){return;}
		if(!validatorObject_core("txt_cuantos","V","Cuantos Hijos","Paso 1")){return;}
		if(!validatorObject_core("txt_cuantos","N","Cuantos Hijos","Paso 1")){return;}
		numeroHijos=document.getElementById("txt_cuantos").value;	}
	else{numeroHijos="Ninguno";}	
	
	CurriculumVitae[0]=document.getElementById("txt_nombre").value;
	CurriculumVitae[1]=document.getElementById("txt_apellido").value;
	CurriculumVitae[2]=document.getElementById("txt_dni").value;
	CurriculumVitae[3]=getSelectedRadioValue(document.forms[0].radiosexo);
	CurriculumVitae[4]=document.getElementById("txt_fechanacimiento").value;
	CurriculumVitae[5]=document.getElementById("txt_edad").value;
	CurriculumVitae[6]=document.getElementById("txt_estadocivil").value;
	CurriculumVitae[7]=getSelectedRadioValue(document.forms[0].radiohijos);
	CurriculumVitae[8]=numeroHijos;
	nexttoPassone();
}

function validationPassTwo()
{
//	if(!validatorObject_core("txt_departamento","I","Departamento","Paso 2",3,"---Seleccione Departamento---","1")){return;}
	if(!validatorObject_core("txt_departamento","V","Región","Paso 2")){return;}
//	if(!validatorObject_core("txt_provincia","I","Provincia","Paso 2",3,"---Seleccione Provincia---","1")){return;}
	if(!validatorObject_core("txt_provincia","V","Provincia","Paso 2")){return;}
//	if(!validatorObject_core("txt_distrito","I","Distrito","Paso 2",3,"---Seleccione Distrito---","1")){return;}
	if(!validatorObject_core("txt_provincia","S","Provincia","Paso 2")){return;}

	if(!validatorObject_core("txt_telefono","V","Telefono","Paso 2")){return;}
	if(!validatorObject_core("txt_telefono","N","Telefono","Paso 2")){return;}	
	
	if(!validatorObject_core("txt_celular","N","Celular","Paso 2")){return;}	
	
	if(!validatorObject_core("txt_email","V","Email","Paso 2")){return;}
	if(!validateEmail(document.getElementById("txt_email").value))
	{alert("Error en el paso 2 : El campo Email es incorrecto. Por favor ingrese un Email correcto");return;}
	
	CurriculumVitae[9]=document.getElementById("txt_departamento").value;
	CurriculumVitae[10]=document.getElementById("txt_provincia").value;
	CurriculumVitae[11]=document.getElementById("txt_distrito").value;
	CurriculumVitae[12]=document.getElementById("txt_calle").value;
	CurriculumVitae[13]=document.getElementById("txt_numero").value;
	CurriculumVitae[14]=document.getElementById("txt_referencia").value;
	CurriculumVitae[15]=document.getElementById("txt_telefono").value;
	CurriculumVitae[16]=document.getElementById("txt_celular").value;
	CurriculumVitae[17]=document.getElementById("txt_email").value;
	
	nexttoPasstwo();
}

function validationPassThree()
{
	if(!validatorObject_core("txt_gradoacademico","I","Grado Academico","Paso 3",3,"---Seleccione---","1")){return;}
	if(!validatorObject_core("txt_carrera","I","Carrera","Paso 3",3,"---Seleccione---","1")){return;}
	if(!validatorObject_core("txt_centroestudio","V","Centro de Estudio","Paso 3")){return;}
	//if(!validatorObject_core("txt_idioma","I","Idioma","Paso 3",3,"---Seleccione---","1")){return;}
	//if(!validatorObject_core("txt_nivel","I","Nivel","Paso 3",3,"---Seleccione---","1")){return;}

	CurriculumVitae[18]=document.getElementById("txt_gradoacademico").value;
	CurriculumVitae[19]=document.getElementById("txt_carrera").value;
	CurriculumVitae[20]=document.getElementById("txt_centroestudio").value;
	CurriculumVitae[21]=document.getElementById("txt_idioma").value;
	CurriculumVitae[22]=document.getElementById("txt_nivel").value;
	CurriculumVitae[23]=document.getElementById("txt_duracion").value;
	CurriculumVitae[24]=document.getElementById("txt_disponibilidad").value;

	nexttoPassthree();
}

function validationPassFour()
{
	CurriculumVitae[25]=getSelectedRadioValue(document.forms[0].radioexperiencia);
	CurriculumVitae[26]=document.getElementById("txt_ultimaempresa").value;
	CurriculumVitae[27]=document.getElementById("txt_puestoocupado").value;
	CurriculumVitae[28]=document.getElementById("txt_tiempodetrabajo").value;
	CurriculumVitae[29]=document.getElementById("txt_funcionesdesempenadas").value;	
	nexttoPassfour();
}

function validationPassFive()
{
	/*if(!validatorObject_core("txt_sueldodeseado","N","Sueldo Deseado","Paso 5")){return;}*/
	CurriculumVitae[30]=document.getElementById("txt_sueldodeseado").value;
	CurriculumVitae[31]=document.getElementById("txt_cinedeseado").value;
	CurriculumVitae[32]=document.getElementById("txt_comentarioadicional").value;
	CurriculumVitae[33]=document.getElementById("txt_supply").value;
	
	document.getElementById("passfive").style.display="none";
	document.getElementById("passSave").style.display="block";
	
	var CVtoString=""; 
	for(i=0;i<34;i++)
	{CVtoString=CVtoString+"|"+CurriculumVitae[i];}
	
	//alert(CVtoString);
	
	xajax_saveDataWorkwithOur(CVtoString.substr(1));
	
}

function backPassSave()
{
document.getElementById("passSave").style.display="none";
document.getElementById("passone").style.display="block";
}