var isIE=$.browser.msie;var isIE6=($.browser.msie&&parseInt($.browser.version.substr(0,1))<7);var filterTimeout=null;var isNewFilter=false;var filtersData="";var selectedFilters="";var allFiltersData="";var addedFilters="";var isLogged=false;var regex_cvextension=/^(doc|docx|pdf|rtf|html)$/;jQuery.extend(jQuery.expr[":"],{focus:function(a){return a==document.activeElement}});$(document).ready(function(){var a=navigator.userAgent.toLowerCase();if(a.search("iphone")>-1||a.search("ipod")>-1||a.search("ipad")>-1||a.search("android")>-1||a.search("blackberry")>-1||a.search("nokia")>-1){if($(".mobile_links").length>0){openDialog("mobile_links",710,320);$(".shade").css("z-index",100);$(".shade").css("opacity",0.75)}}if($(".custselect").length>0){$("select.custselect").selectmenu({style:"dropdown"})}if($(".main_nav").length>0){var b=$(".main_nav a.selected");$(".main_nav a").hover(function(){$(b).removeClass("selected")},function(){});$(".main_nav").hover(function(){},function(){$(b).addClass("selected")})}if($(".rounded").length>0){$(".rounded input").focus(function(){$(this).data("focus",true);$(this).parents(".rounded").addClass("colored")});$(".rounded input").blur(function(){$(this).data("focus",false);$(this).parents(".rounded").removeClass("colored")});$(".rounded .ui-selectmenu").focus(function(){$(this).parents(".rounded").addClass("colored")});$(".rounded .ui-selectmenu").blur(function(){$(this).parents(".rounded").removeClass("colored")});$(".rounded").hover(function(){$(this).addClass("colored")},function(){if(!$(this).find("input").data("focus")){$(this).removeClass("colored")}})}if(isIE){$(".simplesearch, .rounded, .box, .box h3, .results .box, .btn, .box.filter_box h1, .ecom .steps, .tooltip_sectors .tipmid fieldset").each(function(){PIE.attach(this)})}if(isIE6&&$(".result").length>0){var c=parseInt($(".result img").css("max-height"));$(".result").each(function(){if($(this).find("img").height()>c){$(this).find("img").height(c)}})}if($(".jobs_results").length>0){$(".result:not('.posting_standard')").hover(function(){$(this).removeClass("result-state");$(this).addClass("hilite")},function(){$(this).removeClass("hilite");$(this).addClass("result-state")})}if($("#simplesearch").length>0){$("#simplesearch").validate({errorClass:"error_msg",errorElement:"span",rules:{keyword:{required:function(e){return $("#location").val()==""}}},errorPlacement:function(e,f){$(f).parents(".rounded").append(e)}})}if($("#advsearch").length>0){$("#advsearch").validate({errorClass:"error_msg",errorElement:"span",rules:{keyword:{required:function(e){return $("#location").val()==""}}},errorPlacement:function(e,f){$(f).parents(".rounded").append(e)}})}if($("#directorysearch").length>0){$("#directorysearch").validate({errorClass:"error_msg",errorElement:"span",rules:{name:{required:true}}})}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(e,f){$(f).parents("p").append(e);adjustForm()}})}if($("#sendtofriend").length>0){$("#sendtofriend").validate({errorClass:"error_msg",errorElement:"span",rules:{from:{required:true,email:true},to:{required:true,email:true},title:"required",usermessage:"required",telephone:{phoneUK:true,required:false}}})}if($("#contactRecruiter").length>0){$("#contactRecruiter").validate({errorClass:"error_msg",errorElement:"span",rules:{from:{required:true,email:true},title:"required",usermessage:"required",telephone:{phoneUK:true,required:false}}})}if($("#payment").length>0){$("#payment").validate({errorClass:"error_msg",errorElement:"span",rules:{address:"required",postcode:{required:true,postcodeUK:true},paymentType:"required"},messages:{paymentType:"Please choose your payment method type"}})}if($("#cvUploadStep1").length>0){$("#cvUploadStep1").validate({errorClass:"error_msg",errorElement:"span",rules:{address:"required",telephone:{required:true,digits:true},postcode:{required:true,postcodeUK:true},email:{required:true,email:true},terms:"required"},messages:{terms:"You have to accept the terms and conditions to continue",postcode:"Please enter a valid postcode"}})}if($("#cvUploadStep2").length>0){$("#cvUploadStep2").validate({errorClass:"error_msg",errorElement:"span",rules:{title:{minFieldLength:5},summary:"required"},messages:{title:"CV title is required field and should contain more than 5 characters."}})}if($("#cvUploadStep2b").length>0){$("#cvUploadStep2b").validate({errorClass:"error_msg",errorElement:"span",rules:{title:{minFieldLength:5},keywords:{minFieldLength:15},cvDocument:{required:function(e){if(e.id=="updateCV"){return false}return true},accept:"doc|docx|pdf|txt|rtf"},cvFormatCode:{required:true,differentThan:"0"}},messages:{title:"CV title is required field and should contain more than 5 characters.",keywords:"Keywords is required field and should contain more than 3 keywords."}})}if($(".applyOnlineCVUpload").length>0&&$("#cvUploadStep3").length>0){$("#cvUploadStep3").validate({errorClass:"error_msg",errorElement:"span",rules:{jobTypeId:{required:true,differentThan:"0"},salaryFrequencyId:{required:true,differentThan:"0"},workingHoursId:{required:true,differentThan:"0"},industrySectorIds:"required",desiredSalaryMinimum:{digits:true,required:true,differentThan:"0"},desiredSalaryMaximum:{digits:true,greaterThan:"#desiredSalaryMinimum",differentThan:"0"},workWithin:"required",cvStatus:"required",canWorkInUK:"required",desiredLocation:"required"},messages:{industrySectorIds:"You have to choose at least 1 sector"}})}if($("#cvUploadStep3").length>0){$("#cvUploadStep3").validate({errorClass:"error_msg",errorElement:"span",rules:{education:"required"}})}if($("#cvUploadStep4").length>0){$("#cvUploadStep4").validate({errorClass:"error_msg",errorElement:"span",rules:{experience:"required"}})}if($("#cvUploadStep5").length>0){$("#cvUploadStep5").validate({errorClass:"error_msg",errorElement:"span",rules:{skillsInterests:"required"}})}if($("#cvUploadStep6").length>0){$("#cvUploadStep6").validate({errorClass:"error_msg",errorElement:"span",rules:{jobTypeId:{required:true,differentThan:"0"},salaryFrequencyId:{required:true,differentThan:"0"},workingHoursId:{required:true,differentThan:"0"},industrySectorIds:"required",desiredSalaryMinimum:{digits:true,required:true,differentThan:"0"},desiredSalaryMaximum:{digits:true,greaterThan:"#desiredSalaryMinimum",differentThan:"0"},workWithin:"required",cvStatus:"required",canWorkInUK:"required",desiredLocation:"required"},messages:{industrySectorIds:"You have to choose at least 1 sector"}})}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($(".advert").length>0){$(window).scroll(function(){var e=$(window).scrollTop();if($(window).scrollTop()<$(".advert").offset().top){e=$(".advert").offset().top}else{if(e>$(".footer").offset().top-$(".hilitecont").height()-33){e=$(".footer").offset().top-$(".hilitecont").height()-33}}$(".hilitecont").animate({top:e+"px"},{queue:false,duration:1050})})}addDefaultText();if($(".results_header").length>0){fitHeaderToSpace()}rewriteLocation();if($(".filters").length>0){createFiltersFunctionality();allFiltersData=getAllFilters();filtersData=getFormValues()}if($(".popular_searches a").length>10){$(".filters.popular_searches a:not('.more_searches')").each(function(e){if(e>9){$(this).hide()}});$(".popular_searches .more_searches").show();$(".filters .more_searches").click(function(){if($(this).hasClass("less")){$(".popular_searches a:not('.more_searches')").each(function(e){if(e>9){$(this).hide()}});$(this).text($(this).text().replace("Less","More"));$(this).removeClass("less")}else{$(".popular_searches a").show();$(this).text($(this).text().replace("More","Less"));$(this).addClass("less")}})}if($("#locationJobTown").length>0){$("#locationJobTown").blur(function(){searchForLocation("#upload","locationJobTown",false)})}if($(".date-pick").length>0){$(".date-pick").attr("readonly",true);if($(".dp-disabled").length>0){$(".dp-disabled").attr("disabled",true);$(".dp-disabled").parents("p").find("a").addClass("dp-disabled")}else{$(".date-pick").datePicker({clickInput:true})}}var d="location=0,resizable=yes, statusbar=0,scrollbars=1, menubar=0, width=680, height=500";if($(".popup").length>0){$(".popup").click(function(){var f=d;var h=true;if($(this).attr("name").indexOf("calculator")!=-1){f=_POPUP_FEATURES_CALC;h=false}if($(this).attr("name").indexOf("home_calculator")!=-1){f=_POPUP_FEATURES_CALC_HOMES;h=false}if($(this).attr("name").indexOf("salary_calculator")!=-1){f=_POPUP_FEATURES_CALC_HOMES;h=false}if(h&&$.browser.msie){$(this).attr("target","_blank")}else{var e=$(this).attr("href");if(e!="javascript:void(0)"){$(this).attr("popup_url",e);$(this).attr("href","javascript:void(0)")}else{e=$(this).attr("popup_url")}var g=window.open(e,$(this).attr("target")||"_blank",f);g.focus()}})}if($("textarea.tinymce").length>0){$("textarea.tinymce").tinymce({theme:"advanced",theme_advanced_buttons1:"bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect",theme_advanced_buttons2:"undo,redo,|,forecolor,backcolor,|,cut,copy,paste,|,bullist,numlist,|,outdent,indent",theme_advanced_buttons3:"",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_more_colors:false});$("input[type='submit']").click(function(){try{var f=tinyMCE.activeEditor.getContent();escape($("textarea.tinymce").val(f))}catch(e){}})}if($("#receiveNewsletter").length>0){nlWasChecked=($("#receiveNewsletter")[0].checked)}if($(".nlSignup.loggedIn").length>0){$(".nlSignup.loggedIn").click(function(f){f.preventDefault();$link=$(this);function e(i){var h=$(".newsletter .error");if(i&&(/homepage newsletter signup successful/g).test(i)){if(h.length){h.fadeOut()}$link.fadeOut(function(){$('<p class="success">Thank you - you have been signed up!</p>').replaceAll(this).hide().fadeIn()});dcsMultiTrack("DCSext.nlreg","1")}else{if(!h.length){$('<p class="error">Sorry - there\'s been a problem signing you up. Please try again later.</p>').insertAfter($link).hide().fadeIn()}}}function g(){e()}signUpNewsletters($link.attr("url"),e,g)})}});function signUpNewsletters(b,c,a){$.ajax({url:b,data:{context:"homepageNewsletter",receiveNewsletter:"on"},type:"post",dataType:"text",success:c,error:a})}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))}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").show();$(".lcol .btn_apply").each(function(){$(this).parents("div:eq(0)").css("visibility","hidden")});$("#apply_firstname").focus();$(".advert .tooltip").show();scroll(0,105)}function cancelApply(){$(".advert").removeAttr("style");$(".shade").hide();$(".btn_cancelapply").hide();$(".lcol .btn_apply").each(function(){$(this).parents("div:eq(0)").css("visibility","visible")});$(".advert .tooltip").hide()}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 saved 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 saved 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 addDefaultText(){$("input[helpText], textarea[helpText]").blur().bind("focus",function(a){if($(this).val().indexOf($(this).attr("helpText"))>=0){$(this).val("").removeClass("dimmed")}}).bind("blur",function(a){if($(this).val()==""){$(this).val($(this).attr("helpText")).addClass("dimmed")}});$("form").submit(function(){$(this).find("input[helpText]").each(function(){if($(this).val()==$(this).attr("helpText")){$(this).val("")}});$(this).find("textarea[helpText]").each(function(){if($(this).val()==$(this).attr("helpText")){$(this).val("")}})})}function rewriteLocation(){if($("input[name=location]").length>0){if(!$("input[name=location]").hasClass("dimmed")){var a="";var c=$("input[name=location]").val().split(" ");for(var b=0;b<c.length;b++){var d=c[b].toUpperCase().substring(0,1);d+=c[b].toLowerCase().substring(1,c[b].length)+" ";a+=d}$("input[name=location]").val(a.substring(0,a.length-1))}}}function searchFormSubmit(e,d,f,c){$("#"+e).find("input[helpText]").each(function(){if($(this).val()==$(this).attr("helpText")){$(this).val("")}});$("#"+e).find("textarea[helpText]").each(function(){if($(this).val()==$(this).attr("helpText")){$(this).val("")}});if($("#"+e).valid()){if($("#"+d).val()!=""){if($("#"+d).val().length>1){var a=true;if($(".location_search_submit").length>0){$(".btn_search").hide();$(".search_loading").show();$("#"+e+" input[type=text]").attr("disabled","disabled");if($("#areaId").length>0&&$("#areaId").val()!=""&&($("#locationCheck").val().toLowerCase()==$("#"+d).val().toLowerCase())){a=false}if(a){$.ajax({type:"POST",url:searchForLocationURL,data:"location="+$("#"+d).val(),success:function(h){$("#locationsHolder").removeClass("alternativeSitesHolder");if(h.indexOf("alternative_no_locations")==-1){if(h!="fail"){$("#locationsHolder").html("<input name='formId' type='hidden' id='formId' value='"+e+"'/>");$("#locationsHolder").html($("#locationsHolder").html()+"<input name='bSaveAlert' type='hidden' id='bSaveAlert' value='true'/>");$("#locationsHolder").html($("#locationsHolder").html()+h)}else{var g="<h4>You have entered an invalid location. Please amend your search criteria and try again.</h4>";g+="<p><a href=\"javascript:void(0)\" onclick=\"closeDialog('locationsHolder');$('.search_loading').hide();$('.btn_search').show();$('#' + $('#formId').val() + ' input[type=text]').removeAttr('disabled');\" class=\"row_right btn_close\">Close</a></p>";$("#locationsHolder").html(g);$("#locationsHolder").html($("#locationsHolder").html()+"<input name='formId' type='hidden' id='formId' value='"+e+"'/>");openDialog("locationsHolder")}}else{$("#locationsHolder").html("<input name='formId' type='hidden' id='formId' value='"+e+"'/>");$("#locationsHolder").html($("#locationsHolder").html()+h);$("#locationsHolder").addClass("alternativeSitesHolder");openDialog("locationsHolder");$(".alternativeSitesHolder, #shade").click(function(){closeDialog("alternativeSitesHolder");$(".search_loading").hide();$(".btn_search").show();if($("#bMapSearch").length>0){$(".btn_map_search").show()}$("#"+$("#formId").val()+" input[type=text]").removeAttr("disabled")})}}})}else{$("#"+e+" input[type=text]").removeAttr("disabled");$(".requires_login_hidden").click()}}else{$(".btn_search").hide();$(".search_loading").show();$("#"+e+" input[type=text]").attr("disabled","disabled");if($("#areaId").length>0&&$("#areaId").val()!=""&&$("#locationCheck").val().toLowerCase()==$("#"+d).val().toLowerCase()){a=false}if(a){$.ajax({type:"POST",url:searchForLocationURL,data:"location="+$("#"+d).val(),success:function(h){$("#locationsHolder").removeClass("alternativeSitesHolder");if(h.indexOf("alternative_no_locations")==-1){if(h!="fail"){$("#locationsHolder").html("<input name='formId' type='hidden' id='formId' value='"+e+"'/>");$("#locationsHolder").html($("#locationsHolder").html()+h)}else{var g="<h4>You have entered an invalid location. Please amend your search criteria and try again.</h4>";g+="<p><a href=\"javascript:void(0)\" onclick=\"closeDialog('locationsHolder');$('.search_loading').hide();$('.btn_search').show();$('#' + $('#formId').val() + ' input[type=text]').removeAttr('disabled');\" class=\"row_right btn_close\">Close</a></p>";$("#locationsHolder").html(g);$("#locationsHolder").html($("#locationsHolder").html()+"<input name='formId' type='hidden' id='formId' value='"+e+"'/>");openDialog("locationsHolder")}}else{$("#locationsHolder").html("<input name='formId' type='hidden' id='formId' value='"+e+"'/>");$("#locationsHolder").html($("#locationsHolder").html()+h);$("#locationsHolder").addClass("alternativeSitesHolder");openDialog("locationsHolder");$(".alternativeSitesHolder, #shade, .alternativeSitesHolder .close a").click(function(i){closeDialog("alternativeSitesHolder");$(".search_loading").hide();$(".btn_search").show();if($("#bMapSearch").length>0){$(".btn_map_search").show()}$("#"+$("#formId").val()+" input[type=text]").removeAttr("disabled")})}}})}else{$("#"+e+" input[type=text]").removeAttr("disabled");$("#"+e).submit()}}}else{var b="<h4>You have entered an invalid location. Please amend your search criteria and try again.</h4>";if($(".location_search_submit").length>0){b+="<p><a href=\"javascript:void(0)\" onclick=\"closeDialog('locationsHolder');$('.search_loading').hide();$('.btn_search').show();$('#' + $('#formId').val() + ' input[type=text]').removeAttr('disabled');\" class=\"row_right btn_close\">Close</a></p>";$("#locationsHolder").html(b)}else{b+="<p><a href=\"javascript:void(0)\" onclick=\"closeDialog('locationsHolder');$('.search_loading').hide();$('.btn_search').show();if ($('#bMapSearch').length > 0){ $('.btn_map_search').show();}$('#' + $('#formId').val() + ' input[type=text]').removeAttr('disabled');\" class=\"row_right btn_close\">Close</a></p>";$("#locationsHolder").html(b)}$("#locationsHolder").html($("#locationsHolder").html()+"<input name='formId' type='hidden' id='formId' value='"+e+"'/>");openDialog("locationsHolder")}}else{$("#areaId").val("");if($(".requires_login_hidden").length>0){$(".requires_login_hidden").click()}else{$("#"+e).submit()}}}}$(document).ready(function(){$("#simplesearch input[type=text]").keydown(function(a){if(a.keyCode==13){$(this).blur();$("#simplesearch .btn_search").click()}});$("#advsearch input[type=text]").keydown(function(a){if(a.keyCode==13){$(this).blur();$("#advsearch .btn_search").click()}});$("#update input[type=text]").keydown(function(a){if(a.keyCode==13){$("#update .btn_saveadvert").click()}})});function saveAlert(c,b,a,d){$.ajax({type:"POST",url:b,data:c,success:function(f){if($(".save_alert_box").length==0){$(document.body).append('<div class="save_alert_box"></div>')}var e=((a-250)<0?10:(a-250))+"px";$(".save_alert_box").html(f);$(".save_alert_box").css("left",e);$(".save_alert_box").css("top",d+"px");$(".save_alert_box").fadeIn()}})}function saveAlertSubmit(b,a){if($("#alertDescription").val()!=""){$(".save_alert_box").fadeOut();$(".save_alert_link").hide();$(".results_top .waiting").show();$.ajax({type:"POST",url:b,data:"alertId="+a+"&alertDescription="+$("#alertDescription").val()+"&frequency="+$(".alertprompt input:radio:checked").val(),success:function(c){if(c!="fail"){$(".results_top .waiting").hide();$(".save_alert_link").html('<span class="saved">Successfully saved</span>');$(".save_alert_link").show();dcsMultiTrack("DCSext.jobsignup","1","DCSext.intsearch","")}}})}else{$(".alert_name_error").show();$("#alertDescription").addClass("error_msg");$("#alertDescription").focus(function(){$(".alert_name_error").hide();$("#alertDescription").removeClass("error_msg")})}}function saveAdvert(b,a,c){var d="saveAdvertId"+c;$("#"+c).parents(".save_advert_link").attr("id",d);$("#"+d+" .icon_save_ad").hide();$("#"+d+" .waiting").show();$.ajax({type:"POST",url:a,data:"adId="+c,success:function(e){if(e!="fail"){$("#"+d).html('<span class="saved">Successfully saved</span>');$("#"+d).show()}else{$("#"+d).html("Error saving. Try later");$("#"+d).show()}}})}function placeDartAd(a,c){var b=$("#"+a);if(c!=null&&b.css({display:"none"})){b.css({display:"block"})}domWrite(a,c,null);b.addClass("adLoaded");b.removeClass("loadingAd");b.css({visibility:"visible"})}function openDialog(b,c,a){if($.browser.msie&&parseInt($.browser.version)<7){if($("iframe.shade").length==0){$(document.body).append('<IFRAME class="shade">');if($("iframe#rshHistoryFrame").length>0){$("iframe#rshHistoryFrame").attr("src","blank.html")}}if($("iframe#rshHistoryFrame").length>0){$("iframe#rshHistoryFrame").attr("src","blank.html?preview");$("iframe#rshHistoryFrame").attr("class","shade");$("iframe#rshHistoryFrame").css({height:document.body.offsetHeight});$("iframe#rshHistoryFrame").css({width:"100%"});$("iframe#rshHistoryFrame").css({left:"0"});$("iframe#rshHistoryFrame").css({top:"0"});$("iframe#rshHistoryFrame").css({zIndex:"10"})}$(".shade").css("width",$(document).width());$(".shade").css("height",$(document).height());if($("iframe#rshHistoryFrame").length>0){$("iframe#rshHistoryFrame").css({filter:"alpha(opacity=0)"})}}$(".shade").css({filter:"alpha(opacity=20)"});$(".shade").show();if($.browser.msie&&parseInt($.browser.version)<7){$("div.shade").hide()}if(c){$("."+b).width(c)}if(a){$("."+b).height(a)}if(c){$("."+b).css({marginLeft:-c/2})}if(a){$("."+b).css({marginTop:-a/2})}$("."+b).fadeIn("slow")}function closeDialog(a){$("."+a).fadeOut("quick");$(".shade").fadeOut("slow")}function filterResults(){if(!isNewFilter){if($(".reloader").length==0){$(".resultsblock").html("<div class='reloader'></div><div class='reloader_msg'>Please wait. We are filtering your results ...</div>"+$(".resultsblock").html());$(".reloader").css("height",$(".resultsblock").height());$(".reloader").css("visibility","visible");$(".reloader_msg").animate({top:$(window).scrollTop()+"px"},{queue:false,duration:350});$(window).scroll(function(){if($(".reloader_msg").length>0){$(".reloader_msg").animate({top:$(window).scrollTop()+"px"},{queue:false,duration:350})}})}}isNewFilter=true;getFilteredData()}function getFilteredData(){filterTimeout=window.setTimeout(function(){window.clearTimeout(filterTimeout);isNewFilter=false;$.ajax({type:"POST",url:filterResultsURL,data:filtersData+"&addedFilters="+filtersData.substring(filtersData.indexOf("filters")+8,filtersData.length)+allFiltersData+"&selectedFilters="+selectedFilters,success:function(d){if(!isNewFilter){var b=$.xmlDOM(d,function(e){alert("A parse error occurred! "+e)});if($(b).find("filteredresults").length>0){if($(b).find("results").length>0){$(".results_list").html($(b).find("results").text())}if($(b).find("filters").length>0){$(".navigatorFilters").html($(b).find("filters").text())}selectedFilters=filtersData.substring(filtersData.indexOf("filters")+8,filtersData.length);if($(".save_alert_results_link").attr("url").indexOf("&filters")!=-1){$(".save_alert_results_link").attr("url",$(".save_alert_results_link").attr("url").substring(0,$(".save_alert_results_link").attr("url").indexOf("&filters"))+"&filters="+$(b).find("selectedNavigators").text().trim())}else{$(".save_alert_results_link").attr("url",$(".save_alert_results_link").attr("url")+"&filters="+$(b).find("selectedNavigators").text().trim())}createFiltersFunctionality();initSecurityJS();$(".reloader").remove();$(".reloader_msg").remove();$(".result").hover(function(){$(this).removeClass("result-state");$(this).addClass("hilite")},function(){$(this).removeClass("hilite");$(this).addClass("result-state")})}else{var a=selectedFilters.split("-");$(".filter_row a").removeClass("selected");$("#filters_form input[type=checkbox]").attr("checked",false);for(var c=0;c<a.length;c++){$("input[value="+a[c]+"]").attr("checked",true);$("input[value="+a[c]+"]").parent("td").find("a").addClass("selected")}filtersData=filtersData.substring(0,filtersData.indexOf("filters")+8)+selectedFilters;$(".reloader").remove();$(".reloader_msg").remove();alert("Your filtering returned no results. Please try again or amend your search.")}allFiltersData=getAllFilters()}}})},2000)}function extendTimeout(){if(filterTimeout!=null){window.clearTimeout(filterTimeout);filterResults()}}function getAllFilters(){var b="";var a="&allFilters=";$("#filters_form input[type=checkbox]").each(function(){b+=$(this).val()+$(this).attr("count")+"-"});b=b.substr(0,b.length-1);b=a+b;return b}function getFormValues(){var b="";var c="";var a="&filters=";$("#filters_form input").each(function(){if(this.type=="checkbox"){if(this.checked){c+=this.value+"-"}}else{b+=this.name+"="+this.value+"&"}});c=c.substr(0,c.length-1);b=b.substr(0,b.length-1);b=b+a+c;return b}function fitHeaderToSpace(){var c=16;var a=null;for(var b=0;b<8;b++){if($(".results_header").attr("offsetHeight")<$(".results_header").attr("scrollHeight")){a=(parseInt($(".results_header").css("font-size"))-1)>c?(parseInt($(".results_header").css("font-size"))-1):c;$(".results_header").css("font-size",a+"px")}else{break}}$(".results_header").css("visibility","visible")}function clearAllFilters(){filtersData=filtersData.substring(0,filtersData.indexOf("filters=")+8);if(isNewFilter){extendTimeout()}else{filterResults()}}function createFiltersFunctionality(){$(".filter_row a").click(function(){if($(this).hasClass("disabled")){return}$(this).toggleClass("selected");$(this).parents("td").find("input").click();var h=$(this).parents("td").find("input").val();var e=filtersData.substring(filtersData.indexOf("filters=")+8,filtersData.length);var b="";var d="";if(h.substring(h.length-1,h.length)==";"){var f=new RegExp("[=|-]("+h+")")}else{var f=new RegExp("[=|-]("+h+")\\b")}if(!filtersData.match(f)){if((filtersData.lastIndexOf("=")!=(filtersData.length-1))){filtersData+="-"}filtersData+=h}else{if(e.indexOf("-")!=-1){var g=e.split("-");var a=false;for(var c=0;c<g.length;c++){if(g[c]!=h){b+=g[c]+"-"}else{a=true}}if(!a){b+=h+"-"}}else{if(filtersData.match(f)){b+="-"}else{b+=h+"-"}}filtersData=filtersData.substring(0,filtersData.indexOf("filters=")+8)+b.substring(0,b.length-1)}if(isNewFilter){extendTimeout()}else{filterResults()}})}function reloadDartAds(){for(var a in dartAdList){var b=Math.round(Math.random()*10000000000);placeDartAd(a,dartAdList[a].replace(/(ord=[0-9]+)/,"ord="+b))}}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 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><div class="bg_header"></div><span class="collapse">Additional contact information</span><div class="clear"></div></h3><div class="inner">'+g+"</div>");showHideInit()}}})}}function testPaymentBeforeSubmit(){if($("#payment").valid()){$.ajax({type:"POST",url:sUpdateAdressURL+(sUpdateAdressURL.indexOf("?")>0?"&":"?")+"address="+$("#address").val()+"&postcode="+$("#postcode").val(),data:"",success:function(a){if(a=="success"){$("#payment").submit()}}})}}function clearFileInp(c){var b=document.getElementById(c);b.value="";var a=b.cloneNode(false);b.parentNode.replaceChild(a,b)}String.prototype.replaceAll=function(d,b){var a=this.indexOf(d);var e=this;while(a>-1){e=e.replace(d,b);a=e.indexOf(d)}return e};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.ltrim=function(){return this.replace(/^\s+/,"")};String.prototype.rtrim=function(){return this.replace(/\s+$/,"")};function parseQueryString(b,d,f){var a=b.match(/([^?#]*)(#.*)?$/);if(!a){return{}}var e=a[1].split(f||"&");var g={};g[d]={};for(var c=0;c<e.length;c++){pair=e[c].split("=");if(!d||(pair[0].indexOf(d)<0)){continue}pair[0]=pair[0].replace(d+".","");g[d][pair[0]]=decodeURIComponent(pair[1])}return g};
