var jobOrderPhotosHashes = [];
var jobFilterSliderPricePrecision = 100;
var jobVacancyOrderCatsRoot = [];
var jobVacancyOrderCatsChild = [];
var jobVacancyOrderCatsChildPids = [];
var jobResumeOrderCatsRoot = [[]];
var jobResumeOrderCatsChild = [[]];
var jobResumeOrderCatsChildPids = [[]];
jQuery(function($)
{
if ($("#job-filter").length)
{
$(".workplace li a").click(function(){
if
(
($(".workplace li.active:gt(0)").length == 0 && $(this).attr('rel') == '-1') ||
(!$(".workplace li:eq(0)").hasClass('active') && $(this).attr('rel') != '-1')
)
{
$(this).parent('li').toggleClass('active');
}
else if ($(".workplace li:eq(0)").hasClass('active') && $(this).attr('rel') != '-1')
{
$(".workplace li:eq(0)").removeClass('active');
$(this).parent('li').toggleClass('active');
}
else if ($(".workplace li.active:gt(0)").length != 0 && $(this).attr('rel') == '-1')
{
$(".workplace li:gt(0)").removeClass('active');
$(this).parent('li').toggleClass('active');
}
filterProcess();
return false;
});
$("input[name='type']").change(function(){
$("#page-job-vacancy-advfilter, #page-job-resume-advfilter").hide();
if ($("#job-filter-advanced").val() == '1')
{
if ($("input[name='type']:checked").val() == 0)
{
$("#page-job-vacancy-advfilter").show();
}
else
{
$("#page-job-resume-advfilter").show();
}
}
filterProcess();
});
$("select[name='busyness']").change(function(){
filterProcess();
});
$("select[name='sector']").change(function(){
filterProcess();
});
/*
$("select[name='sector']").change(function(){
$("#speciality_suggest").setOptions(
{
'extraParams':
{
'sector': $("select[name='sector'] :selected").val()
}
}
);
$("input[name='speciality']").val('-1');
$("#speciality_suggest").val('');
filterProcess();
});
*/
$(".dslider#dslider-price").slider({
range: true,
step: 1,
min: 0,
max: jobFilterSliderPricePrecision * 4,
values: [jobFilterSliderPriceImaginaryValue($("input[name='price_min']").val()), jobFilterSliderPriceImaginaryValue($("input[name='price_max']").val())],
change: function(e, ui)
{
dsliderRedrawGauge($(this));
var trueValues = [0, 0];
trueValues[0] = jobFilterSliderPriceTrueValue(ui.values[0]);
trueValues[1] = jobFilterSliderPriceTrueValue(ui.values[1]);
$("input[name='price_min']").val(trueValues[0]);
$("input[name='price_max']").val(trueValues[1]);
$("input[name='price_min_pos']").val(ui.values[0]);
$("input[name='price_max_pos']").val(ui.values[1]);
filterProcess();
}
});
setTimeout(function(){
dsliderRedrawGauge($(".dslider#dslider-price"));
}, 10);
$("input[name='price_min'], input[name='price_max']").change(function(){
$(".dslider#dslider-price").slider("option", "values",
[
jobFilterSliderPriceImaginaryValue(parseInt($("input[name='price_min']").val())),
jobFilterSliderPriceImaginaryValue(parseInt($("input[name='price_max']").val()))
]
);
});
$("#speciality_suggest").autocomplete('/ajax/job.post.filter/', {
minChars: 1,
maxItemsToShow: 6,
mustMatch: 0,
width: 218,
extraParams:
{
'sector': $("select[name='sector'] :selected").val()
}
}).result(function(event, item){
$("input[name='speciality']").val(item[1]);
filterProcess();
}).keyup(function(){
$("input[name='speciality']").val('0');
filterProcess();
});
$(".dslider").each(function(){
$(this).find(".ui-slider-handle:eq(0)").addClass('left');
$(this).find(".ui-slider-handle:eq(1)").addClass('right');
});
filterProcess();
}
/* добавление вакансии */
if ($("#window-job-vacancy-order").length)
{
$("input[name='v_photos']").uploadify({
'uploader' : '/code/js/uploadify.swf',
'script' : '/code/process/uploadPhotos.php',
'buttonImg' : '/i/window-banner-order-browse.gif',
'queueID' : 'photos-queue',
'folder' : 'uploads',
'fileDataName' : 'photos',
'simUploadLimit': 10,
'fileDesc' : 'Точечные изображения',
'fileExt' : '*.jpg;*.jpeg;*.png;*gif',
'auto' : true,
'multi' : true,
'width' : 269,
onComplete : function(event, queueID, fileObj, response, data)
{
if (!$("#photos-desc-vacancy").hasClass('active'))
{
$("#photos-desc-vacancy").addClass('active').html('' + fileObj.name + ' ×
');
}
else
{
$("#photos-desc-vacancy").html($("#photos-desc-vacancy").html() + '' + fileObj.name + ' ×
');
}
jobOrderPhotosHashes.push(response);
hsVacancyReflow();
}
});
$("a[id^=dodel]").click(function() {
id = this.id.substr(6);
$.post('/ajaxmini/delVacancy',{'id': id}, function(data) {
location.href="/job/";
});
});
$("#photos-desc-vacancy span a").live('click', function()
{
var index = $("#photos-desc-vacancy span").index($(this).parent('span'));
$(this).parent('span').slideUp('fast');
jobOrderPhotosHashes.splice(index, 1);
hsVacancyReflow();
return false;
});
$("input[name='work_days_time[]']").each(function(){
//$(this).mask("99", { placeholder: '0' });
$(this).numeric();
});
$("#vacancy_salary_from, #vacancy_salary_to").numeric();
$("#city").autocomplete('/ajax/geo.locality.filter/', {
minChars: 1,
maxItemsToShow: 6,
mustMatch: 0,
width: 305
}).result(function(event, item){
$("input[name='city_id']").val(item[1]);
});
$("#title").autocomplete('/ajax/job.post.filter/', {
minChars: 1,
maxItemsToShow: 6,
mustMatch: 0,
width: 305
}).result(function(event, item){
$("input[name='titleID']").val(item[1]);
});
$("#name").autocomplete('/ajax/org.filter/',
{
minChars: 1,
maxItemsToShow: 20,
mustMatch: 0,
cacheLength: 0,
width: 305
})
.result(function(event, item)
{
$("#nameId").val(item[1]);
});
$("#window-job-vacancy-order .col1 .org-sector-list li a").live('click', function(){
var cat_id = $(this).next('.cat_id').text();
if (jobVacancyOrderCatsRoot.indexOf(cat_id) == -1)
{
jobVacancyOrderCatsRoot.push(cat_id);
$(this).parent('li').addClass('active').parent('ul').parent('td').next('td').children('ul').append('
'+$(this).text()+' ');
jobVacancyOrderCatsChildrenUpdate(jobVacancyOrderCatsRoot);
}
return false;
});
$("#window-job-vacancy-order .col2 .org-sector-list li a").live('click', function(){
if (jobVacancyOrderCatsChild.length >= 5) return false;
var cat_id = $(this).siblings('.cat_id').text();
var pid_id = $(this).siblings('.pid_id').text();
if (jobVacancyOrderCatsChild.indexOf(cat_id) == -1)
{
jobVacancyOrderCatsChild.push(cat_id);
jobVacancyOrderCatsChildPids.push(pid_id);
$(this).parent('li').addClass('active').parent('ul').parent('td').next('td').children('ul').append(''+$(this).text()+' ');
}
return false;
});
$("#window-job-vacancy-order .col1 .org-sector-list-selected li a").live('click', function(){
var index = $("#window-job-vacancy-order .col1 .org-sector-list-selected li").index($(this).parent('li'));
$('#window-job-vacancy-order #cat_id_'+jobVacancyOrderCatsRoot[index]).removeClass('active');
var i = jobVacancyOrderCatsChildPids.indexOf(jobVacancyOrderCatsRoot[index]);
while (i != -1)
{
jobVacancyOrderCatsChildPids.splice(i, 1);
jobVacancyOrderCatsChild.splice(i, 1);
$("#window-job-vacancy-order .col2 .org-sector-list-selected li:eq("+i+")").remove();
$("#window-job-vacancy-order #cat_pid_"+jobVacancyOrderCatsRoot[index]).remove();
i = jobVacancyOrderCatsChildPids.indexOf(jobVacancyOrderCatsRoot[index]);
}
jobVacancyOrderCatsRoot.splice(index, 1);
$(this).parent('li').remove();
jobVacancyOrderCatsChildrenUpdate(jobVacancyOrderCatsRoot);
return false;
});
$("#window-job-vacancy-order .col2 .org-sector-list-selected li a").live('click', function(){
var index = $("#window-job-vacancy-order .col2 .org-sector-list-selected li").index($(this).parent('li'));
$('#window-job-vacancy-order #cat_id_'+jobVacancyOrderCatsChild[index]).removeClass('active');
jobVacancyOrderCatsChild.splice(index, 1);
jobVacancyOrderCatsChildPids.splice(index, 1);
$(this).parent('li').remove();
return false;
});
}
/* ------ */
/* добавление резюме */
if ($("#window-job-resume-order").length)
{
$("#treb_name").autocomplete('/ajax/job.post.filter/',
{
minChars: 1,
maxItemsToShow: 6,
mustMatch: 0,
cacheLength: 0,
width: 305
})
.result(function(event, item)
{
$("input[name='treb_nameID']").val(item[1]);
});
$("input[name='hide_private']").click(function(){
$("#private_data").toggleClass('hidden');
hsResumeReflow();
});
$("input[name='opyt_arbaiten']").click(function(){
if ($(this).is(":checked"))
{
$(".job-resume-opyt-block input").attr("disabled", "disabled");
}
else
{
$(".job-resume-opyt-block input").removeAttr("disabled");
}
});
$("#resume_salary_from, #resume_salary_to").numeric();
$(".doljnost_full").autocomplete('/ajax/job.post.filter/', {
minChars: 1,
maxItemsToShow: 6,
mustMatch: 0,
width: 305
}).result(function(event, item){
$(this).next('input').val(item[1]);
});
$(".corp_full").autocomplete('/ajax/org.filter/', {
minChars: 1,
maxItemsToShow: 6,
mustMatch: 0,
width: 305
}).result(function(event, item){
$(this).next('input').val(item[1]);
});
/*
$("input[name='doljnost_full[]']").each(function(){
$(this).autocomplete('/ajax/job.post.filter/', {
minChars: 1,
maxItemsToShow: 6,
mustMatch: 0,
width: 305
}).result(function(event, item){
$(this).next('input').val(item[1]);
});
});
$("input[name='corp_full[]']").autocomplete('/ajax/org.filter/', {
minChars: 1,
maxItemsToShow: 6,
mustMatch: 0,
width: 305
});
*/
$("input[name='work_days_time[]']").each(function(){
//$(this).mask("99", { placeholder: '0' });
$(this).numeric();
});
$("#city_helper").autocomplete('/ajax/geo.locality.filter/',
{
minChars: 1,
maxItemsToShow: 6,
mustMatch: 1,
width: 305
})
.result(function(event, item)
{
if (typeof(item) != 'undefined')
{
$("input[name='city']").val(item[1]);
}
else
{
$("input[name='city']").val('');
}
});
$(".edu_city_helper").autocomplete('/ajax/geo.locality.filter/', {
minChars: 1,
maxItemsToShow: 6,
mustMatch: 0,
width: 305
})
.result(function(event, item){
$(this).next('input').val(item[1]);
});
$("input[name='c_photos']").uploadify({
'uploader' : '/code/js/uploadify.swf',
'script' : '/code/process/uploadPhotos.php',
'buttonImg' : '/i/window-banner-order-browse.gif',
'queueID' : 'photos-queue',
'folder' : 'uploads',
'fileDataName' : 'photos',
'simUploadLimit': 10,
'fileDesc' : 'Точечные изображения',
'fileExt' : '*.jpg;*.jpeg;*.png;*gif',
'auto' : true,
'multi' : true,
'width' : 269,
onComplete : function(event, queueID, fileObj, response, data)
{
if (!$("#photos-desc").hasClass('active'))
{
$("#photos-desc").addClass('active').html('' + fileObj.name + ' ×
');
}
else
{
$("#photos-desc").html($("#photos-desc").html() + '' + fileObj.name + ' ×
');
}
jobOrderPhotosHashes.push(response);
hsResumeReflow();
}
});
$("#photos-desc span a").live('click', function()
{
var index = $("#photos-desc span").index($(this).parent('span'));
$(this).parent('span').slideUp('fast');
jobOrderPhotosHashes.splice(index, 1);
hsResumeReflow();
return false;
});
$("#window-job-resume-order .opyt-start").click(function(){
if (!$(this).hasClass('active'))
{
$(this).val('').addClass('active');
}
});
$("#window-job-resume-order .col1 .org-sector-list li a").live('click', function(){
var caterID = $("#window-job-resume-order .col1").index($(this).parents('.col1'));
var cat_id = $(this).next('.cat_id').text();
if (jobResumeOrderCatsRoot[caterID].indexOf(cat_id) == -1)
{
jobResumeOrderCatsRoot[caterID].push(cat_id);
$(this).parent('li').addClass('active').parent('ul').parent('td').next('td').children('ul').append(''+$(this).text()+' ');
jobResumeOrderCatsChildrenUpdate(jobResumeOrderCatsRoot[caterID], caterID);
}
return false;
});
$("#window-job-resume-order .col2 .org-sector-list li a").live('click', function(){
var caterID = $("#window-job-resume-order .col2").index($(this).parents('.col2'));
if (jobResumeOrderCatsChild[caterID].length >= 5) return false;
var cat_id = $(this).siblings('.cat_id').text();
var pid_id = $(this).siblings('.pid_id').text();
if (jobResumeOrderCatsChild[caterID].indexOf(cat_id) == -1)
{
jobResumeOrderCatsChild[caterID].push(cat_id);
jobResumeOrderCatsChildPids[caterID].push(pid_id);
$(this).parent('li').addClass('active').parent('ul').parent('td').next('td').children('ul').append(''+$(this).text()+' ');
}
return false;
});
$("#window-job-resume-order .col1 .org-sector-list-selected li a").live('click', function(){
var caterID = $("#window-job-resume-order .col1").index($(this).parents('.col1'));
var index = $("#window-job-resume-order .col1:eq("+caterID+") .org-sector-list-selected li").index($(this).parent('li'));
$('#window-job-resume-order .col1:eq('+caterID+') .cat_id_'+jobResumeOrderCatsRoot[caterID][index]).removeClass('active');
var i = jobResumeOrderCatsChildPids[caterID].indexOf(jobResumeOrderCatsRoot[caterID][index]);
while (i != -1)
{
jobResumeOrderCatsChildPids[caterID].splice(i, 1);
jobResumeOrderCatsChild[caterID].splice(i, 1);
$("#window-job-resume-order .col2:eq("+caterID+") .org-sector-list-selected li:eq("+i+")").remove();
$("#window-job-resume-order .col2:eq("+caterID+") .cat_pid_"+jobResumeOrderCatsRoot[caterID][index]).remove();
i = jobResumeOrderCatsChildPids[caterID].indexOf(jobResumeOrderCatsRoot[caterID][index]);
}
jobResumeOrderCatsRoot[caterID].splice(index, 1);
$(this).parent('li').remove();
jobResumeOrderCatsChildrenUpdate(jobResumeOrderCatsRoot[caterID], caterID);
return false;
});
$("#window-job-resume-order .col2 .org-sector-list-selected li a").live('click', function(){
var caterID = $("#window-job-resume-order .col2").index($(this).parents('.col2'));
var index = $("#window-job-resume-order .col2:eq("+caterID+") .org-sector-list-selected li").index($(this).parent('li'));
$('#window-job-resume-order .col2:eq('+caterID+') .cat_id_'+jobResumeOrderCatsChild[caterID][index]).removeClass('active');
jobResumeOrderCatsChild[caterID].splice(index, 1);
jobResumeOrderCatsChildPids[caterID].splice(index, 1);
$(this).parent('li').remove();
return false;
});
}
/* ------ */
/* расширенный поиск */
$("#page-job-advfilter-link").click(function(){
$("#job-filter-advanced").val('1');
$("#job-filter-minictl").hide();
if ($("input[name='type']:checked").val() == 0)
{
$("#page-job-vacancy-advfilter").show();
}
else
{
$("#page-job-resume-advfilter").show();
}
filterProcess();
return false;
});
/* скрыть расширенный поиск */
$("#page-job-advfilter-link-vacancy-hide").click(function(){
$("#job-filter-advanced").val('0');
$("#job-filter-minictl").show();
$("#page-job-vacancy-advfilter").hide();
filterProcess();
return false;
});
$("#page-job-advfilter-link-resume-hide").click(function(){
$("#job-filter-advanced").val('0');
$("#job-filter-minictl").show();
$("#page-job-resume-advfilter").hide();
filterProcess();
return false;
});
$("#job-filter-wt-0, job-filter-wt-1, job-filter-wt-2, job-filter-wt-3").numeric();
$("#job-filter-company-name").autocomplete('/ajax/org.filter/', {
minChars: 1,
maxItemsToShow: 6,
mustMatch: 0,
cacheLength: 0,
width: 305
}).result(function(event, item){
$("#job-filter-company-id").val(item[1]);
filterProcess();
});
$("#job-filter-city-name").autocomplete('/ajax/geo.locality.filter/', {
minChars: 1,
maxItemsToShow: 6,
mustMatch: 0,
cacheLength: 0,
width: 305
}).result(function(event, item){
$("#job-filter-city-id").val(item[1]);
filterProcess();
});
$("#page-job-advfilter input").change(function(){
filterProcess();
});
if ($("#page-job-resume-advfilter").length)
{
$("#page-job-resume-advfilter input, #page-job-resume-advfilter select").change(function(){
filterProcess();
});
}
if ($("#page-job-vacancy-advfilter").length)
{
$("#page-job-vacancy-advfilter input, #page-job-vacancy-advfilter select").change(function(){
filterProcess();
});
}
/* ------ */
windowJobAllRecaptchaUpdate();
});
function hsResumeReflow()
{
hs.getExpander(document.getElementById("window-job-resume-order")).reflow();
}
function hsVacancyReflow()
{
hs.getExpander(document.getElementById("window-job-vacancy-order")).reflow();
}
function windowJobAllRecaptchaUpdate()
{
if (typeof(Recaptcha) != 'undefined')
{
Recaptcha.reload();
setTimeout(function()
{
$("#recaptcha_image_vacancy").html($("#recaptcha_image").html());
$("#recaptcha_image_resume").html($("#recaptcha_image").html());
$("#recaptcha_challenge_field_vacancy").val($("#recaptcha_challenge_field").val());
$("#recaptcha_challenge_field_resume").val($("#recaptcha_challenge_field").val());
},
500);
}
}
function windowJobVacancyAddShow(sender)
{
return hs.htmlExpand(sender, { contentId: 'window-job-vacancy-order', align: 'center', width: 560 } );
}
function windowJobResumeAddShow(sender)
{
if ($("input[name='opyt_arbaiten']").is(":checked"))
{
$(".job-resume-opyt-block input").attr("disabled", "disabled");
}
else
{
$(".job-resume-opyt-block input").removeAttr("disabled");
}
return hs.htmlExpand(sender, { contentId: 'window-job-resume-order', align: 'center', width: 560 } );
}
function windowJobResumeObrazovanieClone()
{
var clone = $(".job-resume-edu-block:first").clone();
var cloneObrazovanieID = Math.floor(Math.random() * 9999);
clone.find("input[name^='obrazovanie']").each(function()
{
$(this).attr('name', 'obrazovanie[' + cloneObrazovanieID + ']').val('');
});
clone.find("input[name^='edu_spec']").attr('name', 'edu_spec[' + cloneObrazovanieID + ']').val('');
clone.find("input[name^='edu_name']").attr('name', 'edu_name[' + cloneObrazovanieID + ']').val('');
clone.find("input[name^='edu_city']").attr('name', 'edu_city[' + cloneObrazovanieID + ']').val('');
$(".job-resume-edu-block:last").after(clone);
$(".edu_city_helper:last").autocomplete('/ajax/geo.locality.filter/', {
minChars: 1,
maxItemsToShow: 6,
mustMatch: 0,
width: 305
}).result(function(event, item){
$(this).next('input').val(item[1]);
});
hsResumeReflow();
}
function windowJobResumeOpytClone()
{
var clone = $(".job-resume-opyt-block:first").clone();
var cloneID = Math.floor(Math.random() * 9999);
clone.find("input[name^='corp_full']").attr('name', 'corp_full[' + cloneID + ']').val('');
clone.find("input[name^='doljnost_full']").attr('name', 'doljnost_full[' + cloneID + ']').val('');
clone.find("input[name^='doljnost_obyaz']").attr('name', 'doljnost_obyaz[' + cloneID + ']').val('');
clone.find("input[name^='arbaiten_period_years']").attr('name', 'arbaiten_period_years[' + cloneID + ']').val('');
clone.find("input[name^='arbaiten_now']").attr('name', 'arbaiten_now[' + cloneID + ']').val('');
clone.find("input[name^='doljnost_dostijenia']").attr('name', 'doljnost_dostijenia[' + cloneID + ']').val('');
$(".job-resume-opyt-block:last").after(clone);
$("input[name^='corp_full[']").each(function(){
$(this).autocomplete('/ajax/org.filter/', {
minChars: 1,
maxItemsToShow: 6,
mustMatch: 0,
width: 305
});
});
$("input[name^='doljnost_full[']").each(function(){
$(this).autocomplete('/ajax/job.post.filter/', {
minChars: 1,
maxItemsToShow: 6,
mustMatch: 0,
width: 305
});
});
hsResumeReflow();
}
function dsliderRedrawGauge(sender)
{
var lineLeft = 0.0;
sender.siblings('.line').each(function(){
$(this).css('left', (Math.round(lineLeft * 100) / 100) + '%');
lineLeft += 12.5;
});
sender.children('.dslider-gauge').children('.dslider-gauge-fill').css({
'left': sender.children('.ui-slider-handle.left').css('left'),
'width': parseFloat(sender.children('.ui-slider-handle.right').css('left')) - parseFloat(sender.children('.ui-slider-handle.left').css('left')) + '%'
});
}
function filterProcess()
{
var workplace = [];
$(".workplace li.active").each(function(){
workplace.push($(this).children('a').attr('rel'));
});
if (workplace.length == 0)
{
workplace.push(-1);
}
var jobFilterLangs = [];
$("#job-filter-langs tr").each(function(){
var langCheckbox = $(this).find("input[name^='job-filter-languages']:checked");
if (langCheckbox.length)
{
var langLevel = $(this).find("input[name^='job-filter-language_level']:checked");
jobFilterLangs.push([langCheckbox.val(), langLevel.length ? langLevel.val() : '-1']);
}
});
var jobResumeFilterLangs = [];
$("#job-filter-resume-langs tr").each(function(){
var langCheckbox = $(this).find("input[name^='job-filter-resume-languages']:checked");
if (langCheckbox.length)
{
var langLevel = $(this).find("input[name^='job-filter-resume-language_level']:checked");
jobResumeFilterLangs.push([langCheckbox.val(), langLevel.length ? langLevel.val() : '-1']);
}
});
$("#events-filter-count, #filter-count, #advfilter-count, #advfilter-resume-count").html('...');
$.getJSON("/ajax/job.filter.count",
{
'type': $("input[name='type']:checked").val(),
'busyness': $("select[name='busyness'] :selected").val(),
'sector': $("select[name='sector'] :selected").val(),
'speciality': $("#speciality_suggest").val(),
'workplace': workplace.join(','),
'price_min': $("input[name='price_min']").val(),
'price_max': $("input[name='price_max']").val(),
'advanced': $("#job-filter-advanced").val(),
/*
вакансии
*/
'job-filter-city-id': $("#job-filter-city-id").val(),
'job-filter-city-name': $("#job-filter-city-name").val(),
'job-filter-wt-0': $("#job-filter-wt-0").val(),
'job-filter-wt-1': $("#job-filter-wt-1").val(),
'job-filter-wt-2': $("#job-filter-wt-2").val(),
'job-filter-wt-3': $("#job-filter-wt-3").val(),
'job-filter-payment-form': $("input[name='job-filter-payment-form']:checked").map(function(){ return $(this).val(); }).get().join(','),
'job-filter-payment-form-text': $("#job-filter-payment-form-text").val(),
'job-filter-guaranties': $("input[name='job-filter-guaranties']:checked").val(),
'job-filter-obrazovanie': $("input[name='job-filter-obrazovanie']:checked").val(),
'job-filter-znanie_kompa': $("input[name='job-filter-znanie_kompa']:checked").val(),
'job-filter-langs': jobFilterLangs,
'job-filter-vodit_prava_type': $("input[name='job-filter-vodit_prava_type[]']:checked").map(function(){ return $(this).val(); }).get().join(','),
'job-filter-sex': $("input[name='job-filter-sex']:checked").val(),
'job-filter-opyt_arbaiten': $("input[name='job-filter-opyt_arbaiten']:checked").val(),
'job-filter-company-id': $("#job-filter-company-id").val(),
'job-filter-company-name': $("#job-filter-company-name").val(),
/*
резюме
*/
'job-filter-resume-age-from': $("#job-filter-resume-age-from").val(),
'job-filter-resume-age-to': $("#job-filter-resume-age-to").val(),
'job-filter-resume-sex': $("input[name='job-filter-resume-sex']:checked").val(),
'job-filter-resume-obrazovanie': $("input[name='job-filter-resume-obrazovanie']:checked").val(),
'job-filter-resume-znanie_kompa': $("input[name='job-filter-resume-znanie_kompa']:checked").val(),
'job-filter-resume-vodit_prava_type': $("input[name='job-filter-resume-vodit_prava_type[]']:checked").map(function(){ return $(this).val(); }).get().join(','),
'job-filter-resume-wt-0': $("#job-filter-resume-wt-0").val(),
'job-filter-resume-wt-1': $("#job-filter-resume-wt-1").val(),
'job-filter-resume-wt-2': $("#job-filter-resume-wt-2").val(),
'job-filter-resume-wt-3': $("#job-filter-resume-wt-3").val(),
'job-filter-resume-payment-form': $("input[name='job-filter-resume-payment-form']:checked").map(function(){ return $(this).val(); }).get().join(','),
'job-filter-resume-langs': jobResumeFilterLangs,
'job-filter-resume-guaranties': $("input[name='job-filter-resume-guaranties']:checked").val()
}, function(e){
//sidebarMapUpdate('events', 0, e.ids);
$("#events-filter-count, #filter-count, #advfilter-count, #advfilter-resume-count").html(e.count);
if (e.count == 0)
{
$("#filter-count, #advfilter-count, #advfilter-resume-count").parent('.filter-count').addClass('zero');
}
else
{
$("#filter-count, #advfilter-count, #advfilter-resume-count").parent('.filter-count').removeClass('zero');
}
});
}
function jobFilterSubmit(advanced)
{
var workplace = [];
$(".workplace li.active").each(function(){
workplace.push($(this).children('a').attr('rel'));
});
if (workplace.length == 0)
{
workplace.push(-1);
}
var url =
'type=' + $("input[name='type']:checked").val() +
'&busyness=' + $("select[name='busyness'] :selected").val() +
'§or=' + $("select[name='sector'] :selected").val() +
'&speciality=' + $("#speciality_suggest").val() +
'&speciality_suggest=' + $("#speciality_suggest").val() +
'&workplace=' + workplace.join(',') +
'&price_min=' + $("input[name='price_min']").val() +
'&price_max=' + $("input[name='price_max']").val()
;
if (typeof(advanced) != 'undefined' && advanced)
{
//url += '&advanced=1';
// 1
url += '&job-filter-city-id=' + $("#job-filter-city-id").val();
url += '&job-filter-city-name=' + $("#job-filter-city-name").val();
// 2
url += '&job-filter-wt-0=' + $("#job-filter-wt-0").val();
url += '&job-filter-wt-1=' + $("#job-filter-wt-1").val();
url += '&job-filter-wt-2=' + $("#job-filter-wt-2").val();
url += '&job-filter-wt-3=' + $("#job-filter-wt-3").val();
// 3
url += '&job-filter-payment-form=' + $("input[name='job-filter-payment-form']:checked").map(function(){ return $(this).val(); }).get().join(',');
//url += '&job-filter-payment-form-text=' + $("#job-filter-payment-form-text").val();
// 4
if (typeof($("input[name='job-filter-guaranties']:checked").val()) != 'undefined')
url += '&job-filter-guaranties=' + $("input[name='job-filter-guaranties']:checked").val();
// 5
if (typeof($("input[name='job-filter-obrazovanie']:checked").val()) != 'undefined')
url += '&job-filter-obrazovanie=' + $("input[name='job-filter-obrazovanie']:checked").val();
// 6
if (typeof($("input[name='job-filter-znanie_kompa']:checked").val()) != 'undefined')
url += '&job-filter-znanie_kompa=' + $("input[name='job-filter-znanie_kompa']:checked").val();
// 7
var jobFilterLangs = [];
$("#job-filter-langs tr").each(function(){
var langCheckbox = $(this).find("input[name^='job-filter-languages']:checked");
if (langCheckbox.length)
{
var langLevel = $(this).find("input[name^='job-filter-language_level']:checked");
jobFilterLangs.push([langCheckbox.val(), langLevel.length ? langLevel.val() : '-1']);
}
});
for (i in jobFilterLangs)
{
url += '&job-filter-languages['+jobFilterLangs[i][0]+']=' + jobFilterLangs[i][1];
}
// 8
url += '&job-filter-vodit_prava_type=' + $("input[name='job-filter-vodit_prava_type[]']:checked").map(function(){ return $(this).val(); }).get().join(',');
// 9
if (typeof($("input[name='job-filter-sex']:checked").val()) != 'undefined')
url += '&job-filter-sex=' + $("input[name='job-filter-sex']:checked").val();
// 10
if (typeof($("input[name='job-filter-opyt_arbaiten']:checked").val()) != 'undefined')
url += '&job-filter-opyt_arbaiten=' + $("input[name='job-filter-opyt_arbaiten']:checked").val();
// 11
url += '&job-filter-company-id=' + $("#job-filter-company-id").val();
url += '&job-filter-company-name=' + $("#job-filter-company-name").val();
// #1
url += '&job-filter-resume-age-from=' + $("#job-filter-resume-age-from").val();
url += '&job-filter-resume-age-to=' + $("#job-filter-resume-age-to").val();
// #2
if (typeof($("input[name='job-filter-resume-sex']:checked").val()) != 'undefined')
url += '&job-filter-resume-sex=' + $("input[name='job-filter-resume-sex']:checked").val();
// #3
if (typeof($("input[name='job-filter-resume-obrazovanie']:checked").val()) != 'undefined')
url += '&job-filter-resume-obrazovanie=' + $("input[name='job-filter-resume-obrazovanie']:checked").val();
// #4
if (typeof($("input[name='job-filter-resume-znanie_kompa']:checked").val()) != 'undefined')
url += '&job-filter-resume-znanie_kompa=' + $("input[name='job-filter-resume-znanie_kompa']:checked").val();
// #5
url += '&job-filter-resume-vodit_prava_type=' + $("input[name='job-filter-resume-vodit_prava_type[]']:checked").map(function(){ return $(this).val(); }).get().join(',');
// #6
url += '&job-filter-resume-wt-0=' + $("#job-filter-resume-wt-0").val();
url += '&job-filter-resume-wt-1=' + $("#job-filter-resume-wt-1").val();
url += '&job-filter-resume-wt-2=' + $("#job-filter-resume-wt-2").val();
url += '&job-filter-resume-wt-3=' + $("#job-filter-resume-wt-3").val();
// #7
url += '&job-filter-resume-payment-form=' + $("input[name='job-filter-resume-payment-form']:checked").map(function(){ return $(this).val(); }).get().join(',');
// #8
var jobResumeFilterLangs = [];
$("#job-filter-resume-langs tr").each(function(){
var langCheckbox = $(this).find("input[name^='job-filter-resume-languages']:checked");
if (langCheckbox.length)
{
var langLevel = $(this).find("input[name^='job-filter-resume-language_level']:checked");
jobResumeFilterLangs.push([langCheckbox.val(), langLevel.length ? langLevel.val() : '-1']);
}
});
for (i in jobResumeFilterLangs)
{
url += '&job-filter-resume-languages['+jobResumeFilterLangs[i][0]+']=' + jobResumeFilterLangs[i][1];
}
// #9
if (typeof($("input[name='job-filter-resume-guaranties']:checked").val()) != 'undefined')
url += '&job-filter-resume-guaranties=' + $("input[name='job-filter-resume-guaranties']:checked").val();
url += '&advanced=' + $("#job-filter-advanced").val();
}
window.location = '/job/' + ($("input[name='type']:checked").val() == '0' ? 'vacancies' : 'resumes') + '/search/?' + url + '#job-tabs';
}
function delResume(id) {
$.post('/ajaxmini/delResume',{'id': id}, function(data) {
location.href="/job/";
});
}
function jobFilterSliderPriceTrueValue(val)
{
if (val < jobFilterSliderPricePrecision)
{
return Math.floor((val / jobFilterSliderPricePrecision) * 10000);
}
else
if (val < jobFilterSliderPricePrecision * 2)
{
return Math.floor(((val - jobFilterSliderPricePrecision) / jobFilterSliderPricePrecision) * 10000) + 10000;
}
else
if (val < jobFilterSliderPricePrecision * 3)
{
return Math.floor(((val - jobFilterSliderPricePrecision * 2) / jobFilterSliderPricePrecision) * 30000) + 20000;
}
else
{
var retVal = Math.floor(((val - jobFilterSliderPricePrecision * 3) / jobFilterSliderPricePrecision) * 50000) + 50000;
if (retVal == 49555) return 50000
else return retVal;
}
}
function jobFilterSliderPriceImaginaryValue(val)
{
if (val < 10000)
{
return Math.floor((val / 10000) * jobFilterSliderPricePrecision);
}
else
if (val < 20000)
{
return Math.floor(((val - 10000) / 10000) * jobFilterSliderPricePrecision) + jobFilterSliderPricePrecision;
}
else
if (val < 50000)
{
return Math.floor(((val - 20000) / 30000) * jobFilterSliderPricePrecision) + jobFilterSliderPricePrecision * 2;
}
else
{
var retVal = Math.floor(((val - 50000) / 50000) * jobFilterSliderPricePrecision) + jobFilterSliderPricePrecision * 3;
if (retVal == 199) return 200
else return retVal;
}
}
function jobVacancyOrderCatsChildrenUpdate(catsRoot, index)
{
if (typeof(index) == 'undefined') index = 0;
$("#window-job-vacancy-order .col2:eq("+index+") .org-sector-list").html('Загрузка...');
$.getJSON('/ajax/org.job.cats/', { 'pids': catsRoot.join(',') }, function(e){
$("#window-job-vacancy-order .col2:eq("+index+") .org-sector-list").html('');
for (i in e)
{
$("#window-job-vacancy-order .col2:eq("+index+") .org-sector-list").append(''+e[i].sName+'');
for (j in e[i].children)
{
$("#window-job-vacancy-order .col2:eq("+index+") .org-sector-list").append(''+e[i].children[j].sName+''+e[i].children[j].id+''+e[i].id+'');
}
}
});
return false;
}
function jobResumeOrderCatsChildrenUpdate(catsRoot, index)
{
if (typeof(index) == 'undefined') index = 0;
$("#window-job-resume-order .col2:eq("+index+") .org-sector-list").html('Загрузка...');
$.getJSON('/ajax/org.job.cats/', { 'pids': catsRoot.join(',') }, function(e){
$("#window-job-resume-order .col2:eq("+index+") .org-sector-list").html('');
for (i in e)
{
$("#window-job-resume-order .col2:eq("+index+") .org-sector-list").append(''+e[i].sName+'');
for (j in e[i].children)
{
$("#window-job-resume-order .col2:eq("+index+") .org-sector-list").append(''+e[i].children[j].sName+''+e[i].children[j].id+''+e[i].id+'');
if (jobResumeOrderCatsChild[index].indexOf(e[i].children[j].id) != -1)
{
$("#window-job-resume-order .col2:eq("+index+") .org-sector-list li:last").addClass('active');
}
}
}
});
return false;
}
function jobVacancyOrder()
{
$("#window-job-vacancy-popup").html('Загрузка...').fadeIn('fast');
$("input[name='v_photos-hashes']").val('');
$(jobOrderPhotosHashes).each(function(){
$("input[name='v_photos-hashes']").val($("input[name='v_photos-hashes']").val() + this + '|');
});
$("input[name='cats']").val(jobVacancyOrderCatsChild.join(','));
$("input[name='cats_old']").val('');
var cats_old = [];
$("#cats_old a").each(function()
{
cats_old.push($(this).attr('rel'));
});
$("input[name='cats_old']").val(cats_old.join(','));
$("#job-order-vacancy").ajaxSubmit(
{
url: "/ajax/job.vacancy.order",
success: function(e)
{
var data = JSON.parse(e);
if (data.ok)
{
commentWindowCaptchaReload();
countdown = new Date();
countdown.setSeconds(countdown.getSeconds() + 5.5);
$("#window-job-vacancy-popup").html('Спасибо за заявку!' + " ()");
$('#countdown_vacancy').countdown({ until: countdown, onExpiry: function(){
hs.close();
$("#window-job-vacancy-popup").fadeOut('fast');
}, onTick: function(periods){
$("#counter_vacancy").text(periods[6]);
}});
}
else
{
commentWindowCaptchaReload();
$("#window-job-vacancy-popup").html(data.error + " ()");
countdown = new Date();
countdown.setSeconds(countdown.getSeconds() + 5.5);
$('#countdown_vacancy').countdown({ until: countdown, onExpiry: function(){
$("#window-job-vacancy-popup").fadeOut('fast');
}, onTick: function(periods){
$("#counter_vacancy").text(periods[6]);
}});
}
}
});
return false;
}
function jobResumeOrder()
{
$("#window-job-resume-popup").html('Загрузка...').fadeIn('fast');
$("input[name='c_photos-hashes']").val('');
$(jobOrderPhotosHashes).each(function()
{
$("input[name='c_photos-hashes']").val($("input[name='c_photos-hashes']").val() + this + '|');
});
$("#job-order-resume").ajaxSubmit
({
url: "/ajax/job.resume.order",
success: function(e)
{
var data = JSON.parse(e);
if (data.ok)
{
commentWindowCaptchaReload();
$("#window-job-resume-popup").html('Спасибо за заявку!' + " ()");
countdown = new Date();
countdown.setSeconds(countdown.getSeconds() + 5.5);
$('#countdown_resume').countdown({ until: countdown, onExpiry: function(){
hs.close();
$("#window-job-resume-popup").fadeOut('fast');
}, onTick: function(periods){
$("#counter_resume").text(periods[6]);
}});
}
else
{
commentWindowCaptchaReload();
$("#window-job-resume-popup").html(data.error + " ()");
countdown = new Date();
countdown.setSeconds(countdown.getSeconds() + 5.5);
$('#countdown_resume').countdown({ until: countdown, onExpiry: function(){
$("#window-job-resume-popup").fadeOut('fast');
}, onTick: function(periods){
$("#counter_resume").text(periods[6]);
}});
}
}
});
return false;
}
function jobFormCheck()
{
var valid = ($.trim($("input[name='name']").val()) != '');
if (valid)
{
document.event.submit();
}
else
{
alert('Необходимо заполнить обязательные поля.');
}
}