var lang = null;
var MSG = {};
MSG = {
	"es":{
		"MSG_INPUT_TITLE":"Debe ingresar el titulo",
		"MSG_SELECT_CATEGORY":"Debe seleccionar la categoría",
		"MSG_SELECT_JOB_TYPE":"Debe seleccionar el tipo de trabajo",
		"MSG_SELECT_EDUCATION_LEVEL":"Debe seleccionar el nivel de educacion",
		"MSG_SELECT_EXPERIENCE_YEARS":"Debe seleccionar el los años de experiencia",
		"MSG_SELECT_TRAVEL":"Debe seleccionar los viajes",
		"MSG_INPUT_BRIEF_DESCRIPTION":"Debe ingresar la descripción corta",
		"MSG_INPUT_FULL_DESCRIPTION":"Debe ingresar la descripción detallada",
		"MSG_INPUT_FUNCTIONS":"Debe ingresar las funciones",
		"MSG_INPUT_BENEFITS":"Debe ingresar los beneficios",
		"MSG_SELECT_LANGUAGE":"Debe seleccionar el idioma",
		"MSG_SELECT_RESUMES":"Debe seleccionar el idioma de la hoja de vida",
		"MSG_SELECT_COUNTRY":"Debe seleccionar el país",
		"MSG_SELECT_REGION":"Debe seleccionar la región",
		"MSG_INPUT_CITY_TOWN":"Debe ingresar la ciudad / localidad",
		"MSG_INPUT_CONTACT":"Debe ingresar el contacto",
		"MSG_INPUT_PHONE":"Debe ingresar teléfono",
		"MSG_INPUT_WAGE":"Debe ingresar salario",
		"MSG_INPUT_REQUIREMENTS":"Debe ingresar los requerimientos",
		"MSG_BRIEF_DESCRIPTION_CAN_NOT_HAVE_MORE_THAN_500_CHARACTERS":"La descripción corta no puede tener mas de 500 caracteres",
		"MSG_FULL_DESCRIPTION_CAN_NOT_HAVE_MORE_THAN_5000_CHARACTERS":"La descripción detallada no puede tener mas de 5000 caracteres",
		"MSG_FUNCTIONS_CAN_NOT_HAVE_MORE_THAN_250_CHARACTERS":"Las funciones no pueden tener mas de 250 caracteres",
		"MSG_BENEFITS_CAN_NOT_HAVE_MORE_THAN_250_CHARACTERS":"Los beneficios no pueden tener mas de 250 caracteres",
		"MSG_REQUIREMENTS_CAN_NOT_HAVE_MORE_THAN_2500_CHARACTERS":"Los requerimientos no pueden tener mas de 2500 caracteres"
	},
	"en":{
		"MSG_INPUT_TITLE":"You should specify the title",
		"MSG_SELECT_CATEGORY":"You should select the category",
		"MSG_SELECT_JOB_TYPE":"You should select the job type",
		"MSG_SELECT_EDUCATION_LEVEL":"You should select the education level",
		"MSG_SELECT_EXPERIENCE_YEARS":"You should select the experience years",
		"MSG_SELECT_TRAVEL":"You should select the tavel",
		"MSG_INPUT_BRIEF_DESCRIPTION":"You should specify the brief description",
		"MSG_INPUT_FULL_DESCRIPTION":"You should specify the full description",
		"MSG_INPUT_FUNCTIONS":"You should specify the functions",
		"MSG_INPUT_BENEFITS":"You should specify the benefits",
		"MSG_SELECT_LANGUAGE":"You should select the language",
		"MSG_SELECT_RESUMES":"You should select the resumes language",
		"MSG_SELECT_COUNTRY":"You should select the country",
		"MSG_SELECT_REGION":"You should select the State / Region ",
		"MSG_INPUT_CITY_TOWN":"You should specify the City / Town",
		"MSG_INPUT_CONTACT":"You should specify the contact",
		"MSG_INPUT_PHONE":"You should specify the phone",
		"MSG_INPUT_WAGE":"You should specify the wage",
		"MSG_INPUT_REQUIREMENTS":"You should specify the requirements",
		"MSG_BRIEF_DESCRIPTION_CAN_NOT_HAVE_MORE_THAN_500_CHARACTERS":"Brief description field can not have more than 500 characters",
		"MSG_FULL_DESCRIPTION_CAN_NOT_HAVE_MORE_THAN_5000_CHARACTERS":"Full description field can not have more than 5000 characters",
		"MSG_FUNCTIONS_CAN_NOT_HAVE_MORE_THAN_250_CHARACTERS":"Functions field can not have more than 250 characters",
		"MSG_BENEFITS_CAN_NOT_HAVE_MORE_THAN_250_CHARACTERS":"Benefits field can not have more than 250 characters",
		"MSG_REQUIREMENTS_CAN_NOT_HAVE_MORE_THAN_2500_CHARACTERS":"Requirements field can not have more than 2500 characters"
	}
}


function goStepTwo() {
	var s = "";
	var j = 0;
	
	if( document.form.categoria.selectedIndex == 0 ) { s = s + MSG[lang]['MSG_SELECT_CATEGORY'] + "\n"; }
	if( trim(document.form.titulo.value) == 0 ) { s = s + MSG[lang]['MSG_INPUT_TITLE'] + "\n"; }
	if( document.form.trabajo.selectedIndex == 0 ) { s = s + MSG[lang]['MSG_SELECT_JOB_TYPE'] + "\n"; }
	
	if( document.form.educacion.selectedIndex == 0 ) { s = s + MSG[lang]['MSG_SELECT_EDUCATION_LEVEL'] + "\n"; }
	if( document.form.experiencia.selectedIndex == 0 ) { s = s + MSG[lang]['MSG_SELECT_EXPERIENCE_YEARS'] + "\n"; }
	if( document.form.viajes.selectedIndex == 0 ) { s = s + MSG[lang]['MSG_SELECT_TRAVEL'] + "\n"; }
	if( trim(document.form.funciones.value) == 0 ) { s = s + MSG[lang]['MSG_INPUT_FUNCTIONS'] + "\n"; }
	// if( trim(document.form.beneficios.value) == 0 ) { s = s + MSG[lang]['MSG_INPUT_BENEFITS'] + "\n"; }
	if( trim(document.form.funciones.value).length > 250 ) { s = s + MSG[lang]['MSG_FUNCTIONS_CAN_NOT_HAVE_MORE_THAN_250_CHARACTERS'] + "\n"; }
	if( trim(document.form.beneficios.value).length > 250 ) { s = s + MSG[lang]['MSG_BENEFITS_CAN_NOT_HAVE_MORE_THAN_250_CHARACTERS'] + "\n"; }
	
	
	for( i=0; i<document.form.lengua.length; i++ ){
		if( document.form.lengua.options[i].selected == true ) {
			j++;
		}
	}
	if( j == 0 ) { s = s + MSG[lang]['MSG_SELECT_LANGUAGE'] + "\n"; }
	j = 0;
	for( i=0; i<document.form.curriculum.length; i++ ){
		if( document.form.curriculum.options[i].selected == true ) {
			j++;
		}
	}
	if( j == 0 ) { s = s + MSG[lang]['MSG_SELECT_RESUMES'] + "\n"; }
	
	if( s != "" ) {
		alert(s);
		return false;
	}
	
	document.getElementById("miperfilbloquegen").style.display="none";
	document.getElementById("miperfilbloquegen-2").style.display="";
}

function backStepOne() {
	document.getElementById("miperfilbloquegen").style.display="";
	document.getElementById("miperfilbloquegen-2").style.display="none";
}

function goSave() {
	var space = "";
	var s = "";
	$("descripcion").value = tinyMCE.get("descripcion").getContent();
	$("requerimientos").value = tinyMCE.get("requerimientos").getContent();
	if( document.form.pais.selectedIndex == 0 ) { s = s + MSG[lang]['MSG_SELECT_COUNTRY'] + "\n"; }
	if (document.form.region.length > 1 ) {
		if( document.form.region.selectedIndex == 0 ) { s = s + MSG[lang]['MSG_SELECT_REGION'] + "\n"; }
	}
	if( trim(document.form.ciudad.value) == 0 ) { s = s + MSG[lang]['MSG_INPUT_CITY_TOWN'] + "\n"; }
	if( trim(document.form.contacto.value) == 0 ) { s = s + MSG[lang]['MSG_INPUT_CONTACT'] + "\n"; }
	if( trim(document.form.telefono.value) == 0 ) { s = s + MSG[lang]['MSG_INPUT_PHONE'] + "\n"; }
	
	if( trim(document.form.s_descripcion.value) == 0 ) { s = s + MSG[lang]['MSG_INPUT_BRIEF_DESCRIPTION'] + "\n"; }
	if( trim(document.form.descripcion.value) == 0 ) { s = s + MSG[lang]['MSG_INPUT_FULL_DESCRIPTION'] + "\n"; }
	// if( trim(document.form.requerimientos.value) == 0 ) { s = s + MSG[lang]['MSG_INPUT_REQUIREMENTS'] + "\n"; }
	if( trim(document.form.s_descripcion.value).length > 500 ) { s = s + MSG[lang]['MSG_BRIEF_DESCRIPTION_CAN_NOT_HAVE_MORE_THAN_500_CHARACTERS'] + "\n"; }
	if( trim(document.form.descripcion.value).length > 5000 ) { s = s + MSG[lang]['MSG_FULL_DESCRIPTION_CAN_NOT_HAVE_MORE_THAN_5000_CHARACTERS'] + "\n"; }
	if( trim(document.form.requerimientos.value).length > 2500 ) { s = s + MSG[lang]['MSG_REQUIREMENTS_CAN_NOT_HAVE_MORE_THAN_2500_CHARACTERS'] + "\n"; }
	if( s != "" ) {
		alert(s);
		return false;
	}
	document.form.MM_insert.value=1;
	document.form.submit();
}

function searchEmpleo() {
	document.formSearch.MM_search.value=1;
	document.formSearch.submit();
}

function hideCountry(i) {
	if ( i > 0 ) {
		load_region(i);
		document.getElementById('ch_pais').style.display='none';
		document.getElementById('estado_region').style.display='';
		document.getElementById('ch_region').style.display='';
	}
}
function showCountry() {
	document.getElementById('ch_pais').style.display='';
	document.getElementById('estado_region').style.display='none';
	document.getElementById('ch_region').style.display='none';
	document.getElementById('region').options[0].selected=true;
}

/*

// Busquedas en los formularios
function searchEvento() {
	if( document.formSearch.hasta.value < document.formSearch.desde.value ) {
		alert(MSG[lang]['MSG_END_DATE_CAN_NOT_BE_LESS_THAN_START_DATE']);
		return false;
	}
	document.formSearch.MM_search.value=1;
	document.formSearch.submit();
}
function cleanForm() {
	document.formSearch.pais.selectedIndex = 0;
	document.formSearch.categoria.selectedIndex = 0;
	document.formSearch.lenguaje.selectedIndex = 0;
	document.formSearch.tema.value = "";
	document.formSearch.desde.value = "";
	document.formSearch.hasta.value = "";
	document.formSearch.zip.value = "";
	document.formSearch.ciudad.value = "";
	document.formSearch.miciudad.checked = false;
}


function goEdit() {
	var s = "";
	if( trim(document.form.organizador.value).length == 0 ) { s = s + MSG[lang]['MSG_INPUT_HOST_NAME'] + "\n"; }
	if( trim(document.form.organizador.value).length > 300 ) { s = s + MSG[lang]['MSG_HOST_CAN_NOT_HAVE_MORE_THAN_300_CHARACTERS'] + "\n"; }
	if( trim(document.form.limit_f.value) == 0 ) { s = s + MSG[lang]['MSG_SELECT_LIMIT_DATE'] + "\n"; }
	if( document.form.lenguaje.selectedIndex == 0 ) { s = s + MSG[lang]['MSG_SELECT_LANGUAGE'] + "\n"; }
	if( document.form.limit_f.value < document.form.f_base.value  ) { s = s + MSG[lang]['MSG_LIMIT_DATE_CAN_NOT_BE_LESS_THAN_CURRENT_DATE'] + "\n"; }
	if( document.form.limit_f.value > document.form.fin_f.value  ) { s = s + MSG[lang]['MSG_LIMIT_DATE_CAN_NOT_BE_GREATER_THAN_END_DATE'] + "\n"; }
	j=0;
	for( i=0; i<document.form.asistir.length; i++ ){
		if( document.form.asistir[i].checked == false ) {
			j++;
		}
	}
	if( j ==  document.form.asistir.length ) { s = s + MSG[lang]['MSG_SPECIFY_YOUR_PARTICIPATION'] + "\n"; }
	j=0;
	for( i=0; i<document.form.ver_lista.length; i++ ){
		if( document.form.ver_lista[i].checked == false ) {
			j++;
		}
	}
	if( j ==  document.form.ver_lista.length ) { s = s + MSG[lang]['MSG_SPECIFY_WHO_CAN_SEE_THE_LIST'] + "\n"; }
	j=0;
	for( i=0; i<document.form.rsvp.length; i++ ){
		if( document.form.rsvp[i].checked == false ) {
			j++;
		}
	}
	if( j ==  document.form.rsvp.length ) { s = s + MSG[lang]['MSG_SPECIFY_IF_RSVP_IS_REQUIRED'] + "\n"; }
	if( s != "" ) {
		alert(s);
		return false;
	}
	document.form.MM_update.value=1;
	document.form.submit();
}

*/

