function curriculumSetOnsubmit() {
	$("#id_curriculum").submit(function(){
		$(this).ajaxSubmit({
			success: curriculumOK,
			error: curriculumError,
			dataType: 'json',
			beforeSend: curriculumValidarNoVacios,
			iframe: true
		});
		return false;
	});
}
function curriculumValidarNoVacios() {
	var retorno = true;
	var $vacios = $("#id_curriculum .validate-noVacio:input").filter(function(){ return empty($(this).val()); });
	var $fileboxes = $("#id_curriculum .filebox:input").filter(function(){ return empty($(this).val()); });
	if(($vacios.length > 0) || ($fileboxes.length > 0)) {
		var $input = ($vacios.length > 0) ? $vacios.eq(0) : ($fileboxes.length > 0) ? $fileboxes.eq(0) : null;
		var $elemH5 = $input.parents("div.divFormCurr:first").prevAll("h5:first");
		mostrarElementoCurriculum($elemH5.get(0));
		pintar($input.get(0));
		mostrarMsjCurriculum(msgstr[6]);
		retorno = false;
	}
	return retorno;
}
function ordenarFormCurriculum() {
	curriculumSetOnsubmit();
	$("#id_curriculum br").remove();
	formularioSetFocuses("#id_curriculum");
	var $first = $("#id_curriculum h5:first");
	$first.addClass("selected");
	$first.next("div").css("display", "block");
	var $h5s = $("#id_curriculum h5:gt(0)");
	$h5s.next("div").css("display", "none");
	$("#DatosPersonales").addClass("selected");
	$("#id_curriculum h5").click(function(){
		mostrarElementoCurriculum(this);
	});
	ReplaceDatebox();
	$("#ui-datepicker-div").css("z-index","9999");
}
function mostrarElementoCurriculum(elemH5) {
	var $elemH5 = $(elemH5);
	$elemH5.addClass("selected");
	$elemH5.next("div").slideDown();
	var $restH5 = $elemH5.siblings("h5");
	var $restH5selected = $restH5.filter(".selected");
	$restH5selected.next("div").slideUp();
	$restH5selected.removeClass("selected");
}
function mostrarMsjCurriculum(msj, callback) {
	var $span = $("#id_curriculum .msj_curriculum span");
	$span.html(msj);
	$span.fadeIn(1000);
	var func = function() {
		ocultarMsjCurriculum(callback);
	}
	return setTimeout(func, 5000);
}
function ocultarMsjCurriculum(callback) {
	if(typeOf(callback) == "function") {
		var func = function() {
			$span.html("");
			callback();
		}
	}
	else {
		var func = function() {
			$span.html("");
		}
	}
	var $span = $("#id_curriculum .msj_curriculum span");
	$span.fadeOut(1000, func);
}
function curriculumOK(data) {
	var res_id = parseInt(data.res_id);
	if(res_id > 0) {
		mostrarMsjCurriculum(msgstr[7], function(){ $("#cboxClose").click(); });
		$("#id_curriculum").get(0).reset();
		mostrarElementoCurriculum($("#id_curriculum h5:first").get(0));
	}
	else if(res_id == -1) {
		mostrarMsjCurriculum(msgstr[9]);
	}
	else {
		curriculumError();
	}
}
function curriculumError(errorMsg) {
	mostrarMsjCurriculum(msgstr[8]);
}