function initJobs(){if(window.location.hash){var page=parseInt(window.location.hash.substring(1));if(isNaN(page)){return false;}
if(page<0){page=page*-1;}
switchRecent(page);}
checkUnread();$j("#divjobopt a[@rel='read']").click(allRead);$j("#divjobopt a[@rel^='bookmark']").click(setBookmark);$j("#divjobopt a[@rel^='remove']").click(removeJob);$j("#divjobopt a[@rel^='done']").click(doneJob);$j("#divjobopt a[@rel^='hide']").click(hideJob);$j("#divjobopt a[@rel^='edit']").click(editJob);$j(".new-entry-button .submit").click(function(){location.href=rootdir+'/jobs/new';return false;});$j('#editCancel').click(cancelEdit);if($j('#filter-keywords').val()==''){$j('#filter-keywords').val('Stichworte (z.B. Hamburg)').addClass('keywords');}
$j('#filter-keywords').focus(function(){if($j(this).val()=='Stichworte (z.B. Hamburg)'){$j(this).val('').removeClass('keywords');}}).blur(function(){if($j(this).val()==''){$j(this).val('Stichworte (z.B. Hamburg)').addClass('keywords');}});$j('#trainee').bind('check',function(){$j('#durationdiv').fadeOut('fast');}).bind('uncheck',function(){$j('#durationdiv').fadeIn('fast');});if($j('#trainee').is(':checked')){$j('#durationdiv').fadeOut('fast');}
$j('#nocity').bind('check',function(){$j('#citydiv').fadeOut('fast');}).bind('uncheck',function(){$j('#citydiv').fadeIn('fast');});if($j('#nocity').is(':checked')){$j('#citydiv').fadeOut('fast');}
$j('#now').bind('check',function(){$j('#startdiv').fadeOut('fast');}).bind('uncheck',function(){$j('#startdiv').fadeIn('fast');});if($j('#now').is(':checked')){$j('#startdiv').fadeOut('fast');}
$j('#limited').bind('check',function(){$j('#limiteddiv').fadeIn('fast',function(){$j("input[name='durlimit']").focus();});}).bind('uncheck',function(){$j('#limiteddiv').fadeOut('fast');});if($j('#limited').is(':checked')){$j('#limiteddiv').fadeIn('fast');}
$j('#offer').bind('check',streetFadeIn).bind('uncheck',streetFadeOut);if($j('#offer').is(':checked')){streetFadeIn();}
else{streetFadeOut();}
$j('#backButton, #saveButton').click(previewNewJob);$j('#jobprevform').submit(function(){return false;});$j('#jobform').submit(previewNewJob);$j('#jobedit').submit(saveEdit);$j('#sidebar-filter-form').submit(saveJobFilter);bindTitleField();initResizableTextareas();bindCountryChange();bindCountryElseRemove();}
var formerCity=null;function bindCountryChange(){$j('#job-country').bind('change',function(){if($j(this).val()=='else'){$j(this).hide();$j('#else-field').show().find('input').focus();}
return false;});}
function bindCountryElseRemove(){$j('#remove-else').click(function(){$j('#else-field').hide().find('input').val('');$j('#job-country').show().find('option:first').attr('selected','selected');return false;});}
function streetFadeOut(){$j('div.city-hl').text('Ort:');$j('.street-hl').each(function(i,item){$j(item).fadeOut('fast');});$j("input[name='city']").removeClass('city-field').val(formerCity);$j("input[name='zip']").unbind('keyup',liveCitySearch);}
function streetFadeIn(){$j('div.city-hl').text('PLZ & Ort:');$j('.street-hl').each(function(i,item){$j(item).fadeIn('fast');});$j("input[name='city']").addClass('city-field');if(formerCity===null){formerCity=$j("input[name='city']").val();$j("input[name='city']").val('');}
$j("input[name='zip']").bind('keyup',liveCitySearch);}
function liveCitySearch(event){var key=event.keyCode;var zipcode=this.value;var country=$j("#job-country").val();if((country=='DE'&&zipcode.length>=5)||(country!='DE'&&zipcode.length>=5)){$j("input[name='city']").addClass('ajax-loading')
var z=zipcode+' '+country;var file=_f('jobs');$j.post(file,{z:z},function(data){$j("input[name='city']").val(data).removeClass('ajax-loading');});}}
function bindTitleField(){}
function previewNewJob(event){$j('#job-message').fadeOut().css('color','');$j('h6').each(function(){$j(this).css('color','');});var action=event.element().id;var parameters=$j('#jobform').serialize()+'&action='+action;var url=this.action||this.form.action;$j('#previewButton').wait();$j('#backButton').wait();$j('#editSave').wait();$j('#editCancel').deactivate();$j('#saveButton').deactivate();$j.post(url,parameters,function(data){$j.scrollTo('#top','normal');if(typeof(data.errors)!=='undefined'){var errMsg=[];data.errors.each(function(item){errMsg.push(item[0]);$j('#hl'+item[1]).css('color','red');});$j('#job-message').css('color','red').html(errMsg.join('
')).fadeIn();$j('#previewButton').unwait('Weiter');$j('#editSave').unwait('Speichern');$j('#editCancel').activate();}
else{$j('#job-main').html(data.contents);styleCheckboxes();initJobs();}},"json");return false;}
function saveJobFilter(){$j('.filter-msg').remove();var url=this.action;var parameters=$j(this).serialize();Element.hide('filterButton');var fl=setInterval("dotti($('filterLoad'))",100);Element.show('filterLoad');$j.post(url,parameters,function(data){if(data.error==1){$j('#filterButton').after('