(function(){function k(l,k){$.cookie(l,k,{domain:".sahibinden.com",path:"/"})}$(function(){function l(a,b){switch(a.suggestionType){case "Category":return a.breadcrumb.push(a.name),a.breadcrumb.join(" \x3e ");case "POI":return a.name.trim()+(b?" - \x3cspan class\x3d'suggestion-address'\x3e"+a.locationData.cityAndTownName+"\x3c/span\x3e":"");case "S360":return a.showingText+(b?'\x3cimg src\x3d"'+a.iconURL+'" /\x3e':"");case "Store":case "Project":return a.name.trim();default:return a.phrase.trim()}}
function p(a,b){var c=0,d=0,h=0,m=!0,k=!1,l=!1,q=!1,n=!1,p=!1;b.forEach(function(a){"Store"==a.value.suggestionType&&c++;"Project"==a.value.suggestionType&&d++;"S360"==a.value.suggestionType&&h++});a.addClass("searchSuggestion");$.each(b,function(b,e){k||"Category"!=e.value.suggestionType?q||"POI"!=e.value.suggestionType?l||"Store"!=e.value.suggestionType?n||"Project"!=e.value.suggestionType?!p&&"Phrase"==e.value.suggestionType&&h&&(b="\x3cspan\x3e"+r.phrase+"\x3c/span\x3e",$('\x3cli class\x3d"categorySeparator"\x3e\x3c/li\x3e').append(b).appendTo(a),
p=m=!0):(b="\x3cspan\x3e"+r.projects+"\x3c/span\x3e",$('\x3cli class\x3d"categorySeparator"\x3e\x3c/li\x3e').append(b).appendTo(a),4<d&&(b="\x3cp\x3e"+_e("search.searchByKeyword.moreThanFiveProjects")+'\x3c/p\x3e\x3cdiv class\x3d"linkWrapper"\x3e\x3cspan class\x3d"show-all-items show-all-projects"\x3e'+_e("search.searchByKeyword.showAllProjects")+"\x3c/span\x3e\x3c/div\x3e",$('\x3cli class\x3d"contentInfo"\x3e\x3c/li\x3e').append(b).appendTo(a)),n=m=!0):(b="\x3cspan\x3e"+r.stores+"\x3c/span\x3e",
$('\x3cli class\x3d"storeSeparator"\x3e\x3c/li\x3e').append(b).appendTo(a),4<c&&(b="\x3cp\x3e"+_e("search.searchByKeyword.moreThanFiveStores")+'\x3c/p\x3e\x3cdiv class\x3d"linkWrapper"\x3e\x3cspan class\x3d"show-all-items show-all-stores"\x3e'+_e("search.searchByKeyword.showAllStores")+"\x3c/span\x3e\x3c/div\x3e",$('\x3cli class\x3d"contentInfo"\x3e\x3c/li\x3e').append(b).appendTo(a)),l=m=!0):(b="\x3cspan\x3e"+r.poi+"\x3c/span\x3e",$('\x3cli class\x3d"categorySeparator"\x3e\x3c/li\x3e').append(b).appendTo(a),
q=m=!0):(b="\x3cspan\x3e"+r.categories+"\x3c/span\x3e",$('\x3cli class\x3d"categorySeparator"\x3e\x3c/li\x3e').append(b).appendTo(a),k=m=!0);if(!(4<c&&"Store"==e.value.suggestionType||4<d&&"Project"==e.value.suggestionType)){b=m;var t=g.val().replace("I","\u0131").toLowerCase().replace(/[\u011fg]/g,"[\u011fg]").replace(/[\u00fcu]/g,"[\u00fcu]").replace(/[\u015fs]/g,"[\u015fs]").replace(/[i\u0131]/g,"[i\u0131]").replace(/[\u00f6o]/g,"[\u00f6o]").replace(/[c\u00e7]/g,"[\u00e7c]"),t=e.label.replace(new RegExp("((^| )"+
t+")","gi"),"\x3cspan\x3e$1\x3c/span\x3e"),f="Category"===e.value.suggestionType?'\x3cspan class\x3d"category-title"\x3e'+e.value.name+"\x3c/span\x3e":"";if(e.value.categoryDetail){for(f=e.value.categoryDetail.defaultIconUrl;f.includes("/");)f=f.replace("/","");f='\x3ca href\x3d"" class\x3d"'+f.substring(0,f.indexOf("."))+'"\x3e'}else f=f?'\x3ca href\x3d"" title\x3d"'+e.label+'"\x3e'+f:'\x3ca href\x3d""\x3e';t=f+t+(e.desc?"\x3cbr/\x3e\x3cem\x3e"+e.desc+"\x3c/em\x3e":"")+"\x3c/a\x3e";f="";switch(e.value.suggestionType){case "Category":case "Project":f=
"searchSuggestionCategory";break;case "Store":f="searchSuggestionStore";break;case "POI":f="searchSuggestionPoi";break;case "S360":f="searchSuggestionS360"}$('\x3cli class\x3d"'+(f+(b?" first-child":""))+'"\x3e\x3c/li\x3e').data("ui-autocomplete-item",e).append(t).appendTo(a);m&&(m=!1)}})}function h(a,b){a=encodeURIComponent(a);a=n.replace("{phrase}",a);b&&(a+="\x26suggestedByAdmin\x3dtrue");window.location.href=a}function c(a){return a.trim().replace("I","\u0131").toLowerCase().replace(/\u011f/g,
"g").replace(/\u00fc/g,"u").replace(/\u015f/g,"s").replace(/\u0131/g,"i").replace(/\u00f6/g,"o").replace(/\u00e7/g,"c").split(/\b\s+/).sort().join("-")}var q="#searchSuggestionLoadingWrapper{position:relative}#searchSuggestionLoading{display:none}.searchSuggestion.ui-autocomplete{font-family:'Lucida Grande',LucidaGrande,Arial,sans-serif;background:0;z-index:9999999!important;position:absolute;top:38px;left:5px;width:384px;border:0;background-color:#fff;box-shadow:1px 1px 4px 1px #666;border-radius:2px}.searchSuggestion.ui-menu .ui-menu-item{display:block;clear:left}.searchSuggestion.ui-menu .ui-menu-item a{font-size:11px;border:0;background:0;font-weight:700;float:none;display:block;color:#999;text-shadow:none;line-height:16px;padding:6px 24px 6px 20px;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.searchSuggestion.ui-menu .ui-menu-item a span:not(.suggestion-address){color:#00339f;font-weight:bold}.searchSuggestion.ui-menu .ui-menu-item a span.suggestion-address{font-size:9px}.searchSuggestion.ui-menu .ui-menu-item a span.category-title{display:block}.searchSuggestion.ui-menu .ui-menu-item a strong{color:#00339f;display:block}.searchSuggestion.ui-menu .ui-menu-item a em{color:#a8a8a8;font-size:10px;font-weight:normal;font-style:normal}.searchSuggestion.ui-menu .ui-menu-item.searchSuggestionS360 a{zoom:1;padding:3px 10px 3px 43px;line-height:22px;position:relative}.searchSuggestion.ui-menu .ui-menu-item.searchSuggestionS360 a:before,.searchSuggestion.ui-menu .ui-menu-item.searchSuggestionS360 a:after{display:table;content:\"\";zoom:1}.searchSuggestion.ui-menu .ui-menu-item.searchSuggestionS360 a:after{clear:both}.searchSuggestion.ui-menu .ui-menu-item.searchSuggestionS360 a img{position:absolute;left:16px;top:5px;width:20px;height:20px}.searchSuggestion.ui-menu .searchSuggestionCategory a{direction:rtl}.searchSuggestion.ui-menu .searchSuggestionStore a{color:#00339f;font-weight:bold}.searchSuggestion.ui-menu .categorySeparator,.searchSuggestion.ui-menu .storeSeparator{position:relative;margin-bottom:10px;top:0;clear:left;border-top:0;text-align:center;border-bottom:1px solid #d8d8d8}.searchSuggestion.ui-menu .categorySeparator span,.searchSuggestion.ui-menu .storeSeparator span{position:relative;padding:0 10px;background-color:#fff;display:inline;font-size:12px;top:6px}.searchSuggestion.ui-menu .contentInfo{padding:15px 24px 15px 14px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;font-size:11px;font-weight:bold}.searchSuggestion.ui-menu .contentInfo .linkWrapper{text-align:right}.searchSuggestion.ui-menu .contentInfo .linkWrapper span{display:inline-block;margin-top:10px;padding:0;cursor:pointer;color:#039}.searchSuggestion.ui-menu .contentInfo .linkWrapper span:hover{text-decoration:underline}.searchSuggestion.ui-menu .noSuggestion{color:#999;font-size:11px;text-align:center;font-style:italic;border-top:0;padding:15px 0}.searchSuggestion.ui-menu .ui-menu-item:first-child,.searchSuggestion.ui-menu .ui-menu-item.first-child{border-top:0}.searchSuggestion.ui-menu .ui-menu-item a.ui-state-focus,.searchSuggestion.ui-menu .ui-menu-item a.ui-state-active{text-decoration:none;background-color:#eee;border-radius:0!important}.ui-helper-hidden-accessible{display:none}.ui-autocomplete{padding:10px 0!important}",
u=-1<q.indexOf("[[INCLUDE"),d=$("meta[http-equiv\x3dContent-Language]").attr("content");null==d&&"undefined"!=typeof documentLanguage&&(d=documentLanguage);null==d&&(d="tr");var n="tr"==d?"/kelime-ile-arama?query_text\x3d{phrase}":"/en/kelime-ile-arama?query_text\x3d{phrase}",w="tr"==d?"/arama/ara?query_text\x3d{phrase}\x26category\x3d{categoryId}":"/search/do?query_text\x3d{phrase}\x26category\x3d{categoryId}",y="tr"==d?"/haritada-emlak-arama?searchPoiItem\x3d{searchPoiItem}\x26category\x3d3518":
"/search-map?searchPoiItem\x3d{searchPoiItem}\x26category\x3d3518",r={categories:"tr"==d?"Kategoriler":"Categories",stores:"tr"==d?"Ma\u011fazalar":"Stores",poi:"tr"==d?"Araman\u0131z\u0131n Yak\u0131n\u0131ndaki Emlak \u0130lanlar\u0131":"Nearby Real Estates",projects:"tr"==d?"Projeler":"Projects",360:"tr"==d?"360 Servisleri":"360 Services",phrase:"tr"==d?"Araman\u0131za Uygun \u00d6neriler":"Phrases"},g=$("#searchText:visible"),v,x=function(a){var b;$("ul.searchSuggestion li a").each(function(){if(c($(this).text())===
a)return b=$(this),!1});return b},d=function(a){var b=c(g.val());if(b)b=x(b),a.preventDefault(),b?b.trigger("click"):(window.setSearchTypeCookie("TEXT","ENTER"),a.target.submit());else return g.hasClass("focused")||(g.focus(),$("#searchSuggestionForm button").attr("disabled","disabled")),a.preventDefault(),!1},z=function(a){var b=c(g.val());0!==b.length&&(b=x(b),a.preventDefault(),b?b.trigger("click"):(window.setSearchTypeCookie("TEXT","ENTER"),h(g.val(),!1)))};0!==g.length&&(g.attr("autocomplete",
"off"),$.ajaxSetup({cache:!1}),g.before('\x3cdiv id\x3d"searchSuggestionLoadingWrapper"\x3e\x3cdiv id\x3d"searchSuggestionLoading"\x3e\x3c/div\x3e\x3c/div\x3e'),u?document.createStyleSheet?document.createStyleSheet("/resources/css/searchSuggestion/searchSuggestion.styl.css"):$("head").append($('\x3clink rel\x3d"stylesheet" type\x3d"text/css" href\x3d"/resources/css/searchSuggestion/searchSuggestion.styl.css"/\x3e')):(u=location.protocol,"https:"==u&&(q=q.replace("http:",u)),$("head").append($('\x3cstyle type\x3d"text/css"\x3e'+
q+"\x3c/style\x3e")),n="https://www.sahibinden.com"+n,w="https://www.sahibinden.com"+w),g.autocomplete({source:function(a,b){$("#searchSuggestionLoading").show();$.ajax({url:"/ajax/search/phrase",dataType:"json",data:{q:a.term,categoryId:0},success:function(a){$("#searchSuggestionLoading").hide();var c=a.phrasesSuggestedByAdmin;v=null;b($.map(a.items,function(a){a.suggestedByAdmin=c;var b=l(a,!0),d;a:switch(a.suggestionType){case "Category":case "Project":d=a.company;break a;default:d=null}return{label:b,
desc:d,value:a}}))}})},minLength:2,delay:500,focus:function(a,b){if(/^key/.test(a.originalEvent.originalEvent.type))return a=b.item.value,g.val(l(a,!1)),v=a,!1},select:function(a,b){a.preventDefault();v=a=b.item.value;switch(a.suggestionType){case "Category":window.setSearchTypeCookie("TEXT","CATEGORY");b=w.replace("{phrase}","").replace("{categoryId}",a.categoryId);window.location.href=b;break;case "Store":window.setSearchTypeCookie("TEXT","STORE");b="https://{url}.sahibinden.com".replace("{url}",
a.url);window.location.href=b;break;case "POI":window.setSearchTypeCookie("TEXT","POINT_OF_INTEREST");b=y.replace("{searchPoiItem}",a.id);window.location.href=b;break;case "Project":window.setSearchTypeCookie("TEXT","PROJECT");b="https://www.sahibinden.com{url}".replace("{url}",a.url);window.location.href=b;break;case "S360":window.setSearchTypeCookie("TEXT","S360");b="https://www.sahibinden.com{url}".replace("{url}",a.url);k("ss-s360-s",a.edrInfo.sourcePage);k("ss-s360-p",a.edrInfo.page);k("ss-s360-a",
a.edrInfo.action);window.location.href=b;break;case "PHRASE":window.setSearchTypeCookie("TEXT","PHRASE");b=n.replace("{url}",a.url);window.location.href=b;break;default:window.setSearchTypeCookie("TEXT",v?"SUGGESTION":"ENTER"),h(a.phrase,a.suggestedByAdmin)}},open:function(){$(".ui-autocomplete").css("z-index",2E4)},close:function(){$(".ui-autocomplete").css("z-index",-1)}}).data("ui-autocomplete")._renderMenu=p,$(g).keyup(function(){c(g.val())?$("#searchSuggestionForm button").removeAttr("disabled"):
$("#searchSuggestionForm button").attr("disabled","disabled")}).focus(function(){c(g.val())?$("#searchSuggestionForm button").removeAttr("disabled"):$("#searchSuggestionForm button").attr("disabled","disabled")}).focusout(function(){$("#searchSuggestionForm button").removeAttr("disabled")}),$("body").on("click",".show-all-items",function(a){a.preventDefault();a=encodeURIComponent(g.val());var b=$(this).hasClass("show-all-stores")?"\x26type\x3dStore":$(this).hasClass("show-all-projects")?"\x26type\x3dProject":
"";window.location.href=n.replace("{phrase}",a)+b}),$("body").on("submit","#searchSuggestionForm",d),$("body").on("click","#searchSuggestionForm button",z))})})();$(function(){function k(h,c,k){h&&c&&(h=h+"/"+c+"/"+(k||window.location.queryString.viewType||"CLASSIC"),c=new Date,c.setTime(c.getTime()+9E5),cookieUtils.setCookie("searchType",h.toUpperCase(),c))}function l(h){var c=h.closest("[data-search-type]").data("searchType")||cookieUtils.readCookie("searchType");h=h.closest("[data-search-view-type]").data("searchViewType");c=(c||"").split("/");k(c[0],c[1],h)}function p(){$("[data-search-type]").find("a, button").click(function(){l($(this))})}window.setSearchTypeCookie=
k;window.setSearchTypeCookieWithElement=l;window.initSearchTypeCookieHandler=p;p()});