var isLogged=false;var regex_cvextension=/^(doc|docx|pdf|rtf|html)$/;$(document).ready(function(){if(typeof doAutocomplete=="function"&&$("#jobTitle").length>0){doAutocomplete({id:"jobTitle",list:ac_complist},{delay:10,minChars:1,matchSubset:1,maxItemsToShow:15,header:"Search suggestions",closeButton:true,width:250})}if($("#locationJobTown").length>0){$("#locationJobTown").blur(function(){searchForLocation("#upload","locationJobTown",false)})}$("#fullJobDescription").blur(function(){if($("#summaryJobDescription").val()==""){$("#summaryJobDescription").val($("#fullJobDescription").val().substring(0,239))}});if($("#slide_holder").length>0){$("#slide_holder").slideshow({width:530,height:215,pauseSeconds:3,fadeSpeed:0.2,caption:false})}if($("#applynow").length>0){$("#applynow").validate({errorClass:"error_msg",errorElement:"span",rules:{firstname:"required",surname:"required",from:{required:true,email:true},message:"required",canWorkInUK:"required"},errorPlacement:function(a,b){$(b).parents("p").append(a);adjustForm()}})}if($("#simplesearch").length>0){$("#simplesearch").validate({errorClass:"error_msg",errorElement:"span",rules:{keyword:{required:function(a){return $("#location").val()==""}}},errorPlacement:function(a,b){$(b).parents(".rounded").append(a)}})}if($("#advsearch").length>0){$("#advsearch").validate({errorClass:"error_msg",errorElement:"span",rules:{keyword:{required:function(a){return $("#location").val()==""}}},errorPlacement:function(a,b){$(b).parents("span:eq(0)").append(a)}})}if($("#updateAlert").length>0){$("#updateAlert").validate({errorClass:"error_msg",errorElement:"span",rules:{keyword:{required:function(a){return $("#location").val()==""}}}})}if($(".advert").length>0){$(".locatecv, .uploadcv, .terms_conditions").hide();$("input[name='attcv']:not([type=hidden]):eq(0)").click(function(){$(".locatecv, .terms_conditions").hide();if($(".uploadcv").length>0){$(".uploadcv").hide()}$(".cvlist").show()});$("input[name='attcv']:not([type=hidden]):eq(1)").click(function(){$(".cvlist").hide();$(".locatecv").show();if($("iframe.account_box_iframe").length==1){isLogged=($("iframe.account_box_iframe")[0].contentWindow.isLoggedIn)}if(!isLogged){$(".terms_conditions").show()}if($(".uploadcv").length>0){$(".uploadcv").show()}});$("input[name='attcv']:not([type=hidden]):eq(2)").click(function(){$(".cvlist, .locatecv").hide();if($(".uploadcv").length>0){$(".uploadcv").hide()}if(!isLogged){$(".terms_conditions").show()}})}$(".cvlist").show();if($(".advert .rcol .hilitecont").length>0){$(".advert .rcol").css("height",parseInt($(".advert .rcol .hilitecont").height())+20)}if($(".attcv").length>0){$(".attcv").click(function(){$(".apply_error").hide();adjustForm();if(isIE6&&$(".shade").is(":visible")){$(".shade").css("width",$(document).width());$(".shade").css("height",$(document).height())}})}if($(".recruiter_logo").length>0&&jQuery.trim($(".recruiter_logo").html())==""&&jQuery.trim($(".recruiter_links").html())==""){$(".recruiter_logo").parents(".multiv .box").eq(0).hide()}if($(".advert").length>0){$(window).scroll(function(){var a=$(window).scrollTop();if($(window).scrollTop()<$(".advert").offset().top){a=$(".advert").offset().top}else{if(a>$(".footer").offset().top-$(".hilitecont").height()-33){a=$(".footer").offset().top-$(".hilitecont").height()-33}}$(".hilitecont").animate({top:a+"px"},{queue:false,duration:1050})})}});function isScrolledIntoView(c){var e=$(window).scrollTop();var d=e+$(window).height();var a=$(c).offset().top;var b=a+$(c).height();return((b>=e)&&(a<=d)&&(b<=d)&&(a>=e))}$(document).ready(function(){if($("#cvbroadcast").length>0){$("#cvbroadcast").validate({errorClass:"error_msg",errorElement:"span",rules:{attcv:{required:true},firstname:"required",surname:"required",email:{required:true,email:true},phone:{phoneUK:true,required:true},jobTitle:"required",locationJobTown:{enoughLocationCharacters:true,required:function(element){if($("input[name=radioAreaId]").length>0){$("input[name=radioAreaId]").rules("add",{required:true,messages:{required:"Please choose one or amend your search"}})}}},readTerms:"required",message:"required",canWorkInUK:"required"},messages:{attcv:"Please choose from one of the options"}})}if($("#cvbroadcast input.attcv").length>0){setCvFields("#cvId");setCvFields("#cvDocument");$("#cvbroadcast input.attcv").click(function(){eval("choose"+$(this).attr("id").substring(0,$(this).attr("id").indexOf("_"))+"()")})}if($(".cvbroadcast_fields").length>0){$(".cvbroadcast_fields").click(function(){if($(".cvbroadcast_fields input[type=text]").attr("disabled")){$(".apply_error").text("Please note that a CV is mandatory as part of the CV Broadcast process").show();var offset=$(".steps").offset();scroll(0,$(".steps").offset().top)}})}if($("#applynow").length>0){$("input[type=text], textarea").blur(function(){if($(this).attr("id")=="from"){if($(".multiv #applynow").valid()){$(".advert .tooltip").hide()}}})}});function adjustForm(){$(".advert .rcol").css("height",parseInt($(".hilitecont").height())+20);var a=$(window).scrollTop();if($(window).scrollTop()<$(".advert").offset().top){a=$(".advert").offset().top}else{if(a>$(".footer").offset().top-$(".hilitecont").height()-33){a=$(".footer").offset().top-$(".hilitecont").height()-33}}$(".hilitecont").animate({top:a+"px"},{queue:false,duration:550})}var reloader_timeout=null;function focusApplyNowForm(){if(isIE6){$(".shade").css("width",$(document).width());$(".shade").css("height",$(document).height())}$(".shade").show();$(".btn_cancelapply").css("visibility","visible");$(".lcol .btn_apply").hide();$("#apply_firstname").focus();$(".advert .tooltip").show();scroll(0,105)}function cancelApply(){$(".advert").removeAttr("style");$(".shade").hide();$(".btn_cancelapply").css("visibility","hidden");$(".lcol .btn_apply").show();$(".advert .tooltip").hide()}function showHideInit(){$("div.show_hide h3").click(function(){var b=$(this).next();var a=b.siblings("fieldset:visible");if(this.className==""){this.className="collapse"}else{this.className=""}if(a.length){a.slideUp("fast",function(){b.slideToggle("fast")})}else{b.slideToggle("fast")}})}function choosecvId(){var a="#cvId";if($(a+"_radio").length>0){$(a+"_radio").attr("checked","checked")}setCvFields(a)}function choosecvDocument(){var a="#cvDocument";if($(a+"_radio").length>0){$(a+"_radio").attr("checked","checked")}setCvFields(a)}function setCvFields(a){if($(a).length>0&&$(a).val()!=""){$(".cvbroadcast_fields input[type=text]").removeAttr("disabled");$(".cvbroadcast_fields input[type=radio]").removeAttr("disabled");$(".cvbroadcast_fields select").removeAttr("disabled");$(".cvbroadcast_fields").removeAttr("title")}else{$(".cvbroadcast_fields input[type=text]").attr("disabled",true);$(".cvbroadcast_fields input[type=radio]").attr("disabled",true);$(".cvbroadcast_fields select").attr("disabled",true);$(".cvbroadcast_fields").attr("title","Please attach a CV first")}}function validateCv(b,a){if($("input[name='attcv']:checked").val()==2||$("input[name='attcv']:hidden").val()==2){if($("#cvId").length>0){if($("#cvId option:selected").val()==0){$(".apply_error").html("You must select one of your myfish4 CVs.");$(".apply_error").show();$("#cvId").focus(function(){$(".apply_error").hide()});adjustForm();return false}else{if(a){$("input[name='uploadcv']").val("0");if($("#"+b).valid()){$("#"+b).submit()}}}}else{$(".apply_error").html("You have to select one of your myfish4 CVs. If you don't have any, create one or choose one of the other options.");$(".apply_error").show();adjustForm();return false}}else{if($("input[name='attcv']:checked").val()==3||$("input[name='attcv']:hidden").val()==3){if($("#cvDocument").val()!=""){if(a){if($("#"+b).valid()){$("#"+b).submit()}}}else{$(".apply_error").html("You have to select a text file from your computer or choose one of the other options.");$(".apply_error").show();$("#cvDocument").focus(function(){$(".apply_error").hide()});adjustForm();return false}}else{if(a){$("input[name='uploadcv']").val("0");if($("#"+b).valid()){$("#"+b).submit()}}}}return true}function getAdditionalContactInfo(d,f,c,a){var e="";if(d!=""){$.ajax({type:"POST",url:ajaxLoginURL,success:function(g){if(g!="fail"){e=g}}});var b="adId="+d+"&src="+f+"&token="+e;if(a){b+="&bCensored="+a}$.ajax({type:"POST",url:c,data:b,success:function(g){if(g!="fail"){$("#additional_info").html('<h3><span class="collapse">Additional contact information</span></h3><fieldset>'+g+"</fieldset>");showHideInit()}}})}};
