function cp_tab_control(){var a=[],b=[];jQuery("ul.tabnavig a").each(function(){window.location.pathname.match(this.pathname)&&(a.push(this),b.push(jQuery(this.hash).get(0)))}),""!==window.location.hash&&window.location.hash.search("block")>=0?(jQuery(b).hide().filter(window.location.hash).show(),jQuery(a).filter(function(a){return jQuery(this).attr("href")===window.location.hash}).addClass("selected"),jQuery("html").scrollTop(jQuery(window.location.hash).parent().position().top)):(jQuery(b).hide().filter(":first").show(),jQuery(a).filter(":first").addClass("selected")),jQuery(a).click(function(){return jQuery(b).hide().filter(this.hash).show(),jQuery(a).removeClass("selected"),jQuery(this).addClass("selected"),!1})}function imagePreview(){var a=10,b=30;jQuery("a.preview").hover(function(c){var d=jQuery(this).find("img").attr("alt");jQuery("body").append("
![]("+jQuery(this).data("rel")+")
"+d+"
"),jQuery("#preview").css("top",c.pageY-a+"px").css("left",c.pageX+b+"px").fadeIn("fast")},function(){jQuery("#preview").remove()}),jQuery("a.preview").mousemove(function(c){jQuery("#preview").css("top",c.pageY-a+"px").css("left",c.pageX+b+"px")})}function unescapeHtml(a){var b=document.createElement("div");b.innerHTML=a;var c=b.childNodes[0].nodeValue;return b.removeChild(b.firstChild),c}function addRemoveCheckboxValues(a,b){var c;a.checked===!0?(c=document.getElementById(b),c.value+=","+a.value,c.value=c.value.replace(/^\,/,"")):(c=document.getElementById(b),c.value=c.value.replace(a.value+",",""),c.value=c.value.replace(a.value,""),c.value=c.value.replace(/\,$/,""))}function trim(a){for(var a=a.replace(/^\s\s*/,""),b=/\s/,c=a.length;b.test(a.charAt(--c)););return a.slice(0,c+1)}function enableNextImage(a,b){jQuery("#upload"+b).removeAttr("disabled")}function cp_currency_position(a){var b=classipress_params.currency_position,c=classipress_params.ad_currency;switch(b){case"left":return c+a;case"left_space":return c+" "+a;case"right":return a+c;default:return a+" "+c}}function cp_show_price_slider(a,b,c,d,e){d=!e&&1e3>=d?b:e&&d>=1e3?1e3:d,jQuery("#slider-range").slider({range:!0,min:a,max:e?1e3:b,step:1,values:[c,d],slide:function(a,b){jQuery("#amount").val(cp_currency_position(b.values[0])+" - "+cp_currency_position(b.values[1]))}}),jQuery("#amount").val(cp_currency_position(jQuery("#slider-range").slider("values",0))+" - "+cp_currency_position(jQuery("#slider-range").slider("values",1)))}function cp_reposition_widgets(){jQuery(window).width()>800?(jQuery(".content_left #welcome_widget").prependTo(".content_right"),jQuery(".content_left #refine_widget").prependTo(".content_right")):(jQuery(".content_right #welcome_widget").prependTo(".content_left"),jQuery(".content_right #refine_widget").prependTo(".content_left"))}function confirmBeforeDeleteAd(){return confirm(classipress_params.text_before_delete_ad)}function cp_handle_form_category_select(){jQuery("#catlvl0").attr("level",0),jQuery(document).on("change","#ad_cat_id",function(){currentLevel=parseInt(jQuery(this).parent().attr("level"),10),cp_get_subcategories(jQuery(this),"catlvl",currentLevel+1,classipress_params.ad_parent_posting),jQuery.each(jQuery(this).parent().parent().children(),function(a,b){currentLevel+10?jQuery("#chosenCategory input:first").val(jQuery(this).val()):jQuery("#catlvl"+(currentLevel-1)+" select").val()>0?jQuery("#chosenCategory input:first").val(jQuery("#catlvl"+(currentLevel-1)+" select").val()):jQuery("#chosenCategory input:first").val("-1")})}function cp_get_subcategories(a,b,c,d){parent_dropdown=jQuery(a).parent(),category_ID=jQuery(a).val(),results_div=b+c,jQuery(parent_dropdown).hasClass("hasChild")||jQuery(parent_dropdown).addClass("hasChild").parent().append(''),jQuery.ajax({type:"POST",url:classipress_params.ajax_url,dataType:"json",data:{action:"dropdown-child-categories",cat_id:category_ID,listing_id:classipress_params.listing_id,level:c},beforeSend:function(){jQuery("#getcat").hide(),jQuery(a).addClass("ui-autocomplete-loading").slideDown("fast")},complete:function(){jQuery(a).removeClass("ui-autocomplete-loading")},error:function(a,b,c){},success:function(e){e.success===!0?(jQuery("#"+results_div).html(e.html).slideDown("fast"),jQuery("#"+results_div+" select").val()&&jQuery("#"+results_div+" select").trigger("change"),1===c?whenEmpty=!1:whenEmpty=!0):(jQuery("#"+results_div).slideUp("fast"),-1===jQuery(a).val()&&2===c?whenEmpty=!1:whenEmpty=!0),"yes"===d&&jQuery("#chosenCategory input:first").val()>0?jQuery("#getcat").fadeIn():whenEmpty&&"whenEmpty"===d&&jQuery("#chosenCategory input:first").val()>0?jQuery("#getcat").fadeIn():jQuery("#"+b+(c-1)).hasClass("childCategory")&&jQuery(a).val()>-1&&"no"===d?jQuery("#getcat").fadeIn():jQuery("#getcat").fadeOut()}})}jQuery(document).ready(function(a){jQuery.isFunction(jQuery.fn.selectBox)&&(jQuery("select").selectBox({menuTransition:"fade",menuSpeed:"fast"}),jQuery(".form_step #ad-categories select").selectBox("destroy"),jQuery(".reports_form select").selectBox("destroy")),jQuery.isFunction(jQuery.fn.tinyNav)&&jQuery(".header_menu_res .menu").tinyNav({active:"current-menu-item",header:classipress_params.text_mobile_navigation,header_href:classipress_params.home_url,indent:"-",excluded:["#adv_categories"]}),jQuery(".img-main img, .post-gallery img").mouseover(function(){jQuery(this).stop().animate({opacity:.6},200)}).mouseout(function(){jQuery(this).stop().animate({opacity:1},200)}),jQuery("#step1 .form_step").length>0&&cp_handle_form_category_select(),imagePreview(),cp_tab_control(),jQuery(window).bind("resize",cp_reposition_widgets),cp_reposition_widgets(),jQuery("#s").autocomplete({source:function(a,b){jQuery.ajax({url:classipress_params.ajax_url,dataType:"json",data:{action:"ajax-tag-search-front",tax:classipress_params.appTaxTag,term:a.term},error:function(a,b,c){},success:function(a){b(jQuery.map(a,function(a){return{term:a,value:unescapeHtml(a.name)}}))}})},minLength:2}),jQuery(".entry-content a, .post a").each(function(a,b){var c=b.href;/\.(jpg|jpeg|png|gif)$/.test(c)&&jQuery(this).has("img").attr("data-rel","colorbox")}),jQuery.isFunction(jQuery.colorbox)&&(jQuery("a[data-rel='colorbox']").colorbox({transition:"fade",rel:"colorbox",current:"",scrolling:!1,slideshow:!1,maxWidth:"100%",maxHeight:"100%",slideshowAuto:!1,title:function(){return jQuery(this).find("img").attr("title")}}),jQuery("#mainImageLink").click(function(){jQuery("#thumb1").click()})),jQuery(document).bind("cbox_open",function(){jQuery("object, embed, iframe").css({visibility:"hidden"})}),jQuery(document).bind("cbox_closed",function(){jQuery("object, embed, iframe").css({visibility:"inherit"})}),jQuery.isFunction(jQuery.fn.validate)&&(jQuery("#your-profile").validate({errorClass:"invalid"}),jQuery(".form_contact").validate({errorClass:"invalid"}),jQuery(".form_step, .form_edit").validate({ignore:".ignore",errorClass:"invalid",errorPlacement:function(a,b){var c=b.hasClass("wp-editor-area");if(c){var d=jQuery("#"+b.attr("id")+"_ifr");jQuery(d).addClass("tinymce-invalid"),jQuery(b).addClass("tinymce-invalid"),jQuery(b).parent().find(".tinymce-invalid").css({border:"1px solid #C00"})}if("checkbox"==b.attr("type")||"radio"==b.attr("type"))b.closest("ol").after(a);else if(jQuery.isFunction(jQuery.fn.selectBox)&&b.is("select"))if(jQuery(window).width()>600){var e=jQuery(b).next();a.insertAfter(e),a.css("display","block")}else a.insertBefore(b);else jQuery(window).width()>600?(a.insertAfter(b),a.css("display","block")):a.insertBefore(b)},highlight:function(a,b,c){jQuery(a).addClass(b).removeClass(c),jQuery(a).parent().find("a.selectBox").addClass(b).removeClass(c).focus(),jQuery(a).parent().find(".tinymce-invalid").css({border:"1px solid #C00"}),jQuery(a).parent().find(".tinymce-invalid").css({"background-color":"#FFEBE8"})},unhighlight:function(a,b,c){jQuery(a).removeClass(b).addClass(c),jQuery(a).parent().find("a.selectBox").removeClass(b).addClass(c),jQuery(a).parent().find(".tinymce-invalid").css({border:"none"})},submitHandler:function(a){setTimeout(function(){var a=jQuery("input[type=submit]").val();jQuery("input[type=submit]").attr("disabled",!0).attr("value",classipress_params.text_processing).data("go_value",a).addClass("clicked")},1),a.submit()}}),jQuery("#commentform").validate({errorClass:"invalid",errorElement:"div",errorPlacement:function(a,b){a.insertAfter(b)}}),jQuery("#commentform").fadeIn()),classipress_params.require_images&&"undefined"!=typeof window.appFileCount&&jQuery("input[type=submit]").on("click",function(){return window.appFileCountBrowser=0,jQuery('input[type="file"]').each(function(){""!=jQuery(this).val()&&(window.appFileCountBrowser+=1)}),0==window.appFileCountBrowser&&0==window.appFileCount?(jQuery("#app-attachment-upload-container .app-attachment-info .required-image").remove(),jQuery("#app-attachment-upload-container .app-attachment-info").append(''+classipress_params.text_require_images+"
"),jQuery("#app-attachment-upload-container .app-attachment-info .required-image").delay(5e3).fadeOut("slow"),!1):void 0}),jQuery.isFunction(jQuery.fn.easyTooltip)&&jQuery("#mainform a").easyTooltip(),jQuery.isFunction(jQuery.fn.footable)&&jQuery(".footable").footable(),jQuery(".edit a.reports_form_link").on("click",function(){return jQuery(this).parent().parent().find(".reports_form").slideToggle(400),!1}),jQuery("#ad_cat_id").val()>0&&jQuery("#ad_cat_id").trigger("change"),a("a.button, a.btn_orange, .subcat-list .cat-item a, .post-meta a, .comment-bubble a, .tagcloud a, a[class*=tag-link], .paging a.page-numbers").addClass("cp-fixed-color"),jQuery(".pages a").addClass("btn_orange"),jQuery(".dynamic-content").on("click",function(){var a=jQuery(this).attr("id"),b="."+a+"-placeholder";if(jQuery(b).length){jQuery(b).append('
');var c={action:"cp_dynamic_content",content:a,security:classipress_params.nonce};jQuery.post(classipress_params.ajax_url,c,function(a){jQuery(b).after(a),jQuery(b).remove()})}}),jQuery(".order-gateway button.button, .order-gateway input[type=submit]").addClass("btn_orange"),jQuery("#critic-review-wrap").addClass("shadowblock"),jQuery("#critic-review-wrap input[type=submit]").addClass("btn_orange"),jQuery("#critic-review-wrap .critic-reviews-title").addClass("dotted")}),window.onpageshow=function(){jQuery("#getcat.clicked").val(jQuery("#getcat.clicked").data("go_value")).attr("disabled",!1).removeClass("clicked")},jQuery.fn.extend({highlight:function(a,b,c){var d=new RegExp("(<[^>]*>)|(\\b"+a.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1")+")",b?"ig":"g");return this.html(this.html().replace(d,function(a,b,d){return"<"===a.charAt(0)?a:''+d+""}))}});