function BackToTop(){$("body, html").animate({scrollTop:0},500)}function replaceAll(n,t,i){return n==undefined?null:n.replace(new RegExp(escapeRegExp(t),"g"),i)}function escapeRegExp(n){return n.replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1")}function HaveImagesUrl(n){document.cookie="HaveImageId="+n+";path=/;";var t=document.URL;t=t.replace(new RegExp("/p([0-9]+)"),"");location.href=t}function ArrangeUrl(n){document.cookie="ArrangeId="+n+";path=/;";var t=document.URL;t=t.replace(new RegExp("/p([0-9]+)"),"");location.href=t}function ListReviewSortUrl(n){document.cookie="SortId="+n+";path=/;";var t=document.URL;t=t.replace(new RegExp("/p([0-9]+)"),"");location.href=t}function ShowCity(n){$(n).parent().find(".ul-parent").is(":visible")?$(n).parent().find(".ul-parent").hide():$(n).parent().find(".ul-parent").show();$(document).mouseup(function(t){var i=$(n);i.is(t.target)||i.has(t.target).length!==0||$(n).parent().find(".ul-parent").hide()})}function ShowAdvanceSearch(n){$("#advancesearch").is(":visible")?($(n).text("Pencarian Lanjutan"),$("#advancesearch").hide(),$("button#search").parent().addClass("mg-right-10"),$(n).parent().removeClass("w--100")):($(n).text("Kembali"),$("#advancesearch").show(),$("button#search").parent().removeClass("mg-right-10"),$(n).parent().addClass("w--100"))}function ShowAuto(n,t){$(".title-tabs li span").removeClass("active");$(n).addClass("active");t==1?($("#auto_hot").hide(),$("#auto_foryou").show()):($("#auto_foryou").hide(),$("#auto_hot").show())}function PostUrlMesage(n){$.ajax({type:"POST",url:n,beforeSend:function(){Loading()},success:function(n){n.Error?CreateMessageError(n.Title):CreateMessageSucces(n.Title)},error:function(){alert("Error occured.please try again")},complete:function(){Loaded()}})}function postUrl(n){$.ajax({type:"POST",cache:!1,url:n,beforeSend:function(){Loading()},success:function(n){n.Error?MessageError(n.Title):(Search(1),MessageError("Deactivated successfully"));Loaded()}})}function CreateMessageSucces(n,t){t==1?MessageRedirect(n):t==2?MessageError(n):t==3&&MessageEmailRedirect(n)}function CreateMessageError(n){var t=$("#lblMessage");t.html('
<\/div>');NoScroll()}function Loaded(){$("#loadding").empty();AutoScroll()}function ReloadPage(n){var t="";t+=' '+n+"<\/p>";t+=" <\/div>";t+=" <\/div>";t+=" <\/div>";$("#popup").html(t);NoScroll()}function ReloadPagePopup(n){var t="";t+='
')},success:function(t){switch($(n).attr("rel")){case"brand":t!=""&&$("#mnBrand").html(t).bxhScroll();break;case"model":t!=""&&$("#mnModel").html(t).bxhScroll();break;case"version":t!=""&&$("#mnVersion").html(t);break;case"region":t!=""&&$("#mnRegion").html(t);break;case"city":t!=""&&$("#mnProvince").html(t);break;case"secondhand":t!=""&&$("#mnSecondHand").html(t);break;case"transmission":t!=""&&$("#mnTransmission").html(t);break;case"color":t!=""&&$("#mnColor").html(t);break;case"type":t!=""&&$("#mnType").html(t)}return}})}}function search_detail(){var i=/\d+/g,n=$("#max_price .active").length>0?$("#max_price .active").attr("rel"):"",r=$("#min_price .active").length>0?$("#min_price .active").attr("rel"):"",t=$("#max_km .active").length>0?$("#max_km .active").attr("rel"):"",u=$("#min_km .active").length>0?$("#min_km .active").attr("rel"):"",f=$("#max_year .active").length>0?$("#max_year .active").attr("rel"):"",e=$("#min_year .active").length>0?$("#min_year .active").attr("rel"):"";n.indexOf("mgt")>-1&&(r=n.match(i).join([]),n="");t.indexOf("mgt")>-1&&(u=t.match(i).join([]),t="");$.ajax({type:"POST",cache:!1,url:"/Product/GetLinkSearch/",data:JSON.stringify({CityId:$("#CityID").val(),CityAlias:$("#CityAlias").val(),RegionAlias:$("#RegionAlias").val(),BrandId:$("#BrandID").val(),BrandAlias:$("#BrandAlias").val(),ModelId:$("#ModelID").val(),ModelAlias:$("#ModelAlias").val(),VersionId:$("#VersionID").val(),VersionAlias:$("#VersionAlias").val(),TypeId:$("#TypeId").val(),TypeName:$("#TypeName").val(),TypeCode:$("#TypeAlias").val(),MinYear:e,MaxYear:f,SecondHandId:$("#SecondHandId").val(),SecondHandName:$("#SecondHandName").val(),SecondHandCode:$("#SecondHandCode").val(),ColorId:$("#ColorId").val(),ColorCode:$("#ColorCode").val(),TransmissionId:$("#TransmissionId").val(),TransmissionCode:$("#TransmissionCode").val(),MinPrice:r,MaxPrice:n,NumOfKmMin:u,NumOfKmMax:t}),beforeSend:function(){},success:function(n){location.href=n;return}})}function Showdropdown(n,t){$(n).next().is(":visible")?($(n).next().hide(),$(n).parent().removeClass("show"),$(n).next().getNiceScroll().remove(),SetValue(n,t)):($(n).next().show(),$(n).parent().addClass("show"),$(n).next().bxhScroll());$(document).mouseup(function(i){var r=$(n);r.is(i.target)||r.parent().has(i.target).length!==0||($(n).next().hide(),$(n).parent().removeClass("show"),SetValue(n,t))})}function SetValue(n,t){var r=$(n).parent().find(".min").text(),i=$(n).parent().find(".max").text(),u="";if(i.indexOf(">")>-1){u=i;$(n).find(".text_value").text(u);return}u=r!=""&&i!=""?r+" - "+i:r==""&&i!=""?"< "+i:r!=""&&i==""?"> "+r:t;$(n).find(".text_value").text(u)}function myObject(n){var t;$(n).parent().hasClass("open")?($(n).parent().removeClass("open").addClass("close"),t=$(n).next().attr("id"),t!=undefined&&(t=="mnRegion"||t=="mnBrand"||t=="mnProvince"||t=="mnModel")&&($("#"+t).getNiceScroll().remove(),$("#mnBrand, #mnRegion,#mnModel").getNiceScroll().resize())):($(n).parent().addClass("open"),t=$(n).next().attr("id"),t!=undefined&&(t=="mnRegion"||t=="mnBrand"||t=="mnProvince"||t=="mnModel")&&($("#"+t).bxhScroll(),$("#mnBrand, #mnRegion,#mnModel").getNiceScroll().resize()),$(n).next().find('li:first .dropdown-select input[type="hidden"]').val()=="0"&&$(n).next().find("li:first .bxh-dropdowlist-text input").focus())}function showOption(n){$(n).parent().hasClass("open")?($(n).hasClass("label_year")&&$("#mnYear .open .dropdown-menu").getNiceScroll().remove(),$(n).parent().addClass("close").removeClass("open")):($(n).parent().addClass("open"),$(n).hasClass("label_year")&&$("#mnYear .open .dropdown-menu").bxhScroll())}function ShowPhone(){$("#showPhone").show()}function ClosePhone(){$("#showPhone").hide()}function validateRegister(){$("input#chkAgree:checked").length>0&&$("#btnRegister").click()}function InitForm(){$("button[type=reset],input[type=reset]").click(function(){$(".field-validation-error").empty()});$("button[type=submit],input[type=submit]").click(function(){var r,n,i,t;if($(this).attr("id")=="btnPost")if(ValidatePost()){if($("#CityID").val()==0)return!1;for(r=$("#CountTech").val(),n="",i=0;i'+n+"<\/p>";t+=" <\/div>";t+=" <\/div>";$("#popup").html(t);NoScroll()}function MessageErrorDate(n){var t="";t+='
'+n+"<\/p>";t+=" <\/div>";t+=" <\/div>";$("#popup").html(t);NoScroll()}function MessageSuccessPosted(n){var t="",i,r;n==1?(i="Berhasil perbarui data",r="Berhasil memperbarui. Perubahan Anda akan diproses dalam waktu 24 jam"):n==2&&(i="Berhasil memuat iklan",r="Terima kasih telah menggunakan layanan kami! Iklan Anda akan diceck dan hasilnya akan dikirim ke email Anda dalam waktu 24 jam");t+='
'+r+"<\/p>";t+=' Kembali ke halaman rumah<\/a>';t+=" <\/div>";t+=" <\/div>";$("#popup").html(t);NoScroll()}function MessageRedirect(n){var t="";t+='