Cwo.RegisterNamespace("Cwo.Search");Cwo.Search.PagingController=function(c,e,d,f,a,g){var b=this;this.RenderButtons=function(j){var t="",o=isNaN(j)?c():j,r=f(),l=a(),s=Math.ceil(r/l),q,p=Math.ceil(r/l);scroll(0,0);if(p>0){var k=$("#ResultsListPagingSummary");if(k.length){k.text("Page "+o.toString()+" of "+p)}else{var n=$(".ResultsListPagingSummary");if(n.length){$.each(n,function(u,i){$(i).text("Page "+o.toString()+" of "+p)})}}}if(s>1){if(o>1){t+=b.ButtonHtml(o-1,"Prev",o)}for(q=-2;q<3;q++){var h=parseInt(q,10)+parseInt(o,10);if((h>0)&&(h<=s)){t+=b.ButtonHtml(h,h,o)}}if((parseInt(o,10)===1)&&(s>=4)){t+=b.ButtonHtml(parseInt(4,10),parseInt(4,10),o)}if((parseInt(o,10)<3)&&(s>=5)){t+=b.ButtonHtml(parseInt(5,10),parseInt(5,10),o)}if(o<s){t+=b.ButtonHtml(parseInt(1,10)+parseInt(o,10),"Next",o)}}var m=e.length;for(q=0;q<m;q++){$("#"+e[q]).html(t);$("#"+e[q]+" .pagingbutton").bind("click",function(i){var u=$(this).attr("pagenumber");b.RenderButtons(u);d(u)})}};Cwo.Page.EventController.Subscribe(g,this.RenderButtons);this.ButtonHtml=function(k,j,h){if(typeof(j)==="undefined"){j=k}var i=" <li";if((+k)===(+h)){i+=' class="Selected"'}i+='><a class="pagingbutton" pagenumber="'+k+'" a href="#Page '+k+'" title="'+j+'">'+j+"</a></li>";return i}};$(document).ready(function(){var b=$("#ForSaleFilters");if(b){var a=b.find("li.Selected");if(a.length>0){var c=a[a.length-1];$(c).find("li").addClass("Last")}}});Cwo.RegisterNamespace("Cwo.Search.Favourites");Cwo.Search.Favourites.GetTotalResults=function(){return Cwo.Search.Favourites.TotalResults};Cwo.Search.Favourites.GetResultsPerPage=function(){return Cwo.Search.Favourites.ResultsPerPage};Cwo.Search.Favourites.GetCurrentPage=function(){return Cwo.Search.Favourites.CurrentPage};Cwo.Search.Favourites.GetResultsTemplate=function(){return _template};Cwo.Search.Favourites.Criteria=new function(){var b=3,a=0,d=8,c=2};Cwo.Search.Favourites.SynchronizeCriteria=function(b,a){$("[id$='_selectedPage']").val(b);Cwo.Search.Favourites.CurrentPage=b;Cwo.Search.Favourites.Criteria.Type=3;Cwo.Search.Favourites.Criteria.StartIndex=(b*Cwo.Search.Favourites.ResultsPerPage)-Cwo.Search.Favourites.ResultsPerPage;Cwo.Search.Favourites.Criteria.EndIndex=(b*Cwo.Search.Favourites.ResultsPerPage)-1};Cwo.Search.Favourites.GetResults=function(b,c){var a=$("#FavouriteResults").height()+180;$(".ResultsLoading").removeClass("Hidden").height(a);Cwo.Search.Favourites.SynchronizeCriteria(b,c);Cwo.Search.Favourites.TotalResults=$("#FavouritesTotalCount").text();new Cwo.AjaxCall("/webservices/Favourites.asmx/GetPropertyListings",JSON.stringify(Cwo.Search.Favourites.Criteria),Cwo.Search.Favourites.ReturnedResults,null,null)};Cwo.Search.Favourites.ReturnedResults=function(c){var b=c.d.ContentContainer.PropertySearchListings,h="",d=new Array(),e='<ul id="FavouriteResults" class="Results">';if(b.length===0){$(".FavouritesResults").addClass("NoResults");$(".Filters").addClass("Hidden")}var f=Cwo.Search.Favourites.GetResultsTemplate();for(var g=0;g<b.length;g++){e+=Cwo.Search.Favourites.GetListHTML(b[g],f)}e+="</ul>";$("#FavouriteResults").replaceWith(e);Cwo.Favourites.BindFavouritesListClicks();for(g=0;g<b.length;g++){Cwo.Search.Favourites.BindContactAgentClicks(b[g])}for(g=0;g<b.length;g++){Cwo.Search.Favourites.BindMiniMapClicks(b[g])}var a=$("#FavouritesLink span");a.text(c.d.ContentContainer.TotalRowCount);if(c.d.ContentContainer.TotalRecordsAvailable===1){$(".FavouritesLinkText").text(" property saved in your favourites")}else{$(".FavouritesLinkText").text(" properties saved in your favourites")}$(".FavouritesLink span").html(c.d.ContentContainer.TotalRecordsAvailable);Cwo.Search.Favourites.TotalResults=c.d.ContentContainer.TotalRecordsAvailable;if(c.d.ErrorMessage==="NoResults"){$("#"+Cwo.Search.Favourites.NoResults).removeClass().addClass("One")}else{$("#"+Cwo.Search.Favourites.NoResults).removeClass().addClass("Hidden")}Cwo.Page.EventController.FireEvent("Favourites.PostResultSetChange");new Cwo.MyPropertywide("FavouriteResults",Cwo.MyPropertywideListType.Type.Favourites);$(".ResultsLoading").addClass("Hidden")};Cwo.Search.Favourites.GetListHTML=function(a,b){$.each(a,function(d,c){b=Cwo.Search.Favourites.ReplaceTemplateContext("\\$"+d+"\\$",c,b)});return b};Cwo.Search.Favourites.ReplaceTemplateContext=function(c,d,b){var a=new RegExp(c,"g");b=b.replace(a,d);return b};Cwo.Search.Favourites.BindContactAgentClicks=function(a){new Cwo.Form("ContactAgent"+a.InstructionId,162,false,null,"PropertyID:"+a.InstructionId)};Cwo.Search.Favourites.BindMiniMapClicks=function(b){var a=false;if(b.IsRooftopLatLongAvailable=="True"){a=true}new Cwo.Maps.Mini("FavouritesContentContainer","PropertyListingButtons"+b.InstructionId,b.Latitude,b.Longitude,"Map"+b.InstructionId,"ShowMiniMap"+b.InstructionId,"HideMiniMap"+b.InstructionId,null,a)};$(document).ready(function(){Cwo.Search.Favourites.OnStart=function(){var b=$("[id$='_selectedPage']").val();Cwo.Search.Favourites.CurrentPage=$("[id$='_selectedPage']").val();Cwo.Search.Favourites.TotalResults=$("#FavouritesTotalCount").text();$("#SortByTop").val(1);$("#SortByBottom").val(1);Cwo.Search.Favourites.Criteria.OrderBy=2;$("#rdoSalesAndLettings").attr("checked",true);Cwo.Search.Favourites.ResultsPerPage=9;if(Cwo.Search.Favourites.TotalResults==="1"){$(".FavouritesLinkText").text(" property saved in your favourites")}else{$(".FavouritesLinkText").text(" properties saved in your favourites")}if(b>1){Cwo.Search.Favourites.GetResults(Cwo.Search.Favourites.CurrentPage,Cwo.Search.Favourites.Criteria.OrderBy)}$("input[name=agentType]").click(function(){Cwo.Search.Favourites.CurrentPage=1;Cwo.Search.Favourites.GetResults(Cwo.Search.Favourites.CurrentPage,Cwo.Search.Favourites.Criteria.OrderBy)});var d=1;$("#SortByTop").change(function(){Cwo.Search.Favourites.Criteria.OrderBy=$("#SortByTop option:selected").val();$("#SortByBottom").val(Cwo.Search.Favourites.Criteria.OrderBy);(Cwo.Search.Favourites.Criteria.OrderBy==="1")?Cwo.Search.Favourites.Criteria.OrderBy=2:Cwo.Search.Favourites.Criteria.OrderBy=1;Cwo.Search.Favourites.GetResults(Cwo.Search.Favourites.CurrentPage,Cwo.Search.Favourites.Criteria.OrderBy)});$("#SortByBottom").change(function(){Cwo.Search.Favourites.Criteria.OrderBy=$("#SortByBottom option:selected").val();$("#SortByTop").val(Cwo.Search.Favourites.Criteria.OrderBy);(Cwo.Search.Favourites.Criteria.OrderBy==="1")?Cwo.Search.Favourites.Criteria.OrderBy=2:Cwo.Search.Favourites.Criteria.OrderBy=1;Cwo.Search.Favourites.GetResults(Cwo.Search.Favourites.CurrentPage,Cwo.Search.Favourites.Criteria.OrderBy)});var c=[Cwo.Search.Favourites.ResultsListPagingTop,Cwo.Search.Favourites.ResultsListPagingBottom];Cwo.Search.Favourites.PagingController=new Cwo.Search.PagingController(Cwo.Search.Favourites.GetCurrentPage,c,Cwo.Search.Favourites.GetResults,Cwo.Search.Favourites.GetTotalResults,Cwo.Search.Favourites.GetResultsPerPage,"Favourites.PostResultSetChange");Cwo.Search.Favourites.PagingController.RenderButtons()};if(navigator.userAgent.indexOf("MSIE")>-1){Cwo.Search.Favourites.OnStart();return}try{Cwo.Search.Favourites.OnStart()}catch(a){Cwo.Error.TrackError(a)}});Cwo.RegisterNamespace("Cwo.Search.ForSale");Cwo.Search.ForSale=new function(){var a=this;this.ResultSet=new Hashtable();this.TotalResults=0;this.LocationString="";this.CurrentPage=1;this.ResultsPerPage=10;this.NewInstructionThresholdDays=8;this.SuppressFormSubmission=false;this.IsMapRendered=false;this.ControlIDs={};this.DidYouMeanExpanded=false;this.FullyQualifiedPlaceName="";this.SearchPropertyTypeText="properties";this.Template="";this.GetTotalResults=function(){return a.TotalResults};this.GetResultsPerPage=function(){return a.ResultsPerPage};this.GetCurrentPage=function(){return a.CurrentPage};this.Criteria=new function(){this.SearchString=$("#SearchPredictiveText").val();this.AskingPriceMin=50000;this.AskingPriceMax=300000;this.BedroomsMin=0;this.BedroomsMax=99;this.ReceptionsMin=0;this.ReceptionsMax=99;this.BathroomsMin=0;this.BathroomsMax=99;this.OrderBy="Default";this.CurrentPage=1;this.ResultsPageSize=10;this.Latitude="0.00";this.Longitude="0.00";this.Radius=5;this.PropertyTypeID=-1;this.PromotionID=-1};this.DiscoverSelectedSortOrder=function(){a.Criteria.OrderBy=document.getElementById(a.ControlIDs.ForSaleListOrderByTop).options[document.getElementById(a.ControlIDs.ForSaleListOrderByTop).selectedIndex].value};this.GetAndValidateUserInput=function(){this.ValidatedOK=true;this.ErrorMessage="";var e=a.Criteria.Radius,d=0,c=true;a.Criteria.SearchString=$("#SearchPredictiveText").val();a.Criteria.Radius=$("#RadiusSlider").slider("value");a.Criteria.BedroomsMin=(+document.getElementById(a.ControlIDs.BedroomsMin).selectedValue());a.Criteria.BedroomsMax=(+document.getElementById(a.ControlIDs.BedroomsMax).selectedValue());a.Criteria.AskingPriceMin=(+document.getElementById(a.ControlIDs.AskingPriceMin).selectedValue());a.Criteria.AskingPriceMax=(+document.getElementById(a.ControlIDs.AskingPriceMax).selectedValue());a.Criteria.ReceptionsMin=(+document.getElementById(a.ControlIDs.ReceptionsMin).selectedValue());a.Criteria.ReceptionsMax=(+document.getElementById(a.ControlIDs.ReceptionsMax).selectedValue());a.Criteria.BathroomsMin=(+document.getElementById(a.ControlIDs.BathroomsMin).selectedValue());a.Criteria.BathroomsMax=(+document.getElementById(a.ControlIDs.BathroomsMax).selectedValue());a.Criteria.PropertyTypeID=(+document.getElementById(a.ControlIDs.PropertyTypeID).selectedValue());a.Criteria.PromotionID=(+document.getElementById(a.ControlIDs.PromotionID).selectedValue());var b=document.getElementById(a.ControlIDs.PromotionID);if(b!==null){a.Criteria.PromotionID=b.selectedValue()}else{a.Criteria.PromotionID=0}if(!this.IsMapRendered){a.DiscoverSelectedSortOrder()}if(a.Criteria.SearchString.length<1){this.ValidatedOK=false;this.ErrorMessage+="Please ensure you enter a location to search in.<br /><br />";c=false}if((a.Criteria.AskingPriceMin)>(a.Criteria.AskingPriceMax)){this.ValidatedOK=false;this.ErrorMessage+="Please choose a maximum price greater than your chosen minimum.<br /><br />";c=false}if((+a.Criteria.BedroomsMin)>(+a.Criteria.BedroomsMax)){this.ValidatedOK=false;this.ErrorMessage+="Please ensure the selected maximum number of bedrooms is greater than or equal to the minimum.<br /><br />";c=false}if((+a.Criteria.ReceptionsMin)>(+a.Criteria.ReceptionsMax)){this.ValidatedOK=false;this.ErrorMessage+="Please ensure the selected maximum number of receptions is greater or equal to the minimum.<br /><br />";c=false}if((+a.Criteria.BathroomsMin)>(+a.Criteria.BathroomsMax)){this.ValidatedOK=false;this.ErrorMessage+="Please ensure the selected maximum number of bathrooms is greater or equal to the minimum.<br /><br />";c=false}if(c){Cwo.Page.EventController.FireEvent("ForSaleFilters.CriteriaChanged")}};this.Submit=function(b){Cwo.Search.ForSale.Criteria.CurrentPage=b;a.GetAndValidateUserInput();if(a.ValidatedOK){a.Criteria.CurrentPage=b;if(!a.IsMapRendered){a.QueryWebService()}}else{new Cwo.Error.Popup("Please check your search criteria",a.ErrorMessage)}return false};this.Promotion=function(){var d="",b=/\/p-[a-zA-Z]+/g,c;if(window.location.href!==null&&window.location.href.match(b)!==null){c=window.location.href.match(b).toString().split(",");if(c.length>0){d=c[c.length-1].split("-")[1]}}return d};this.SearchResult=function(b){this.ID=b.InstructionId;this.Latitude=b.Latitude;this.Longitude=b.Longitude;var c=a.Template;if(b.IsRooftopLatLongAvailable==="True"){this.IsRooftopLatLongAvailable=true}else{this.IsRooftopLatLongAvailable=false}$.each(b,function(e,d){c=a.ReplaceTemplateContext("\\$"+e+"\\$",d,c)});this.GetListHTML=function(){return c}};this.ReplaceTemplateContext=function(d,e,c){var b=new RegExp(d,"g");c=c.replace(b,e);return c};this.DeserializeForSaleListing=function(b){return new a.SearchResult(b)};this.ReOrderResults=function(c){if(!a.SuppressFormSubmission){a.SuppressFormSubmission=true;var b=$("#"+c.id).val();$("#"+a.ControlIDs.ForSaleListOrderByTop).val(b);$("#"+a.ControlIDs.ForSaleListOrderByBottom).val(b);a.Criteria.CurrentPage=1;a.SuppressFormSubmission=false;a.Submit(a.Criteria.CurrentPage)}};this.RenderLastFilter=function(){var b=$("li.hideable:last");if(b.hasClass("Selected")){b.removeClass("Last");$("li.hideable:last ul li").addClass("Last")}else{b.addClass("Last")}};Cwo.Page.EventController.Subscribe("ForSaleFilters.PostVisibilityChange",a.RenderLastFilter);this.SaveFilterConfiguration=function(){var b="";var c=0;$("#ForSaleFilters .hideable").each(function(){if(!$("#"+this.id).hasClass("Selected")){b+=this.id+" ";c++}});Cwo.Common.SetCookie("ForSaleFilterUnSelected",(c===$("#ForSaleFilters .hideable").length)?"All":b)};Cwo.Page.EventController.Subscribe("ForSaleFilters.PostVisibilityChange",a.SaveFilterConfiguration);this.ApplyFilterConfiguration=function(){var d=$("#ForSaleFilters .hideable"),c=Cwo.Common.GetCookie("ForSaleFilterUnSelected"),b=false;if(c.length>2){d.each(function(){if((c.indexOf(this.id)>-1)||(c==="All")){$("#"+this.id).removeClass("Selected");b=true}});if(b){Cwo.Page.EventController.FireEvent("ForSaleFilters.PostVisibilityChange")}}};this.RenderListingCollection=function(e){var c="<ul>",b=e.length,d;for(d=0;d<b;d+=1){if(!a.ResultSet.ContainsKey(e[d].ID)){a.ResultSet.Add(e[d].ID,e[d])}c+=e[d].GetListHTML()}c+="</ul>";$("#"+a.ControlIDs.ResultsList).html(c);Cwo.Favourites.BindResultsListClicks();for(d=0;d<b;d+=1){a.BindContactAgentClicks(e[d]);a.BindMiniMapClicks(e[d])}};this.BindContactAgentClicks=function(b){if(a.Promotion().length>0){new Cwo.Form("ContactAgent"+b.ID,24,false,null,"PropertyID:"+b.ID+",Promotion:"+a.Promotion())}else{new Cwo.Form("ContactAgent"+b.ID,24,false,null,"PropertyID:"+b.ID)}};this.BindMiniMapClicks=function(b){new Cwo.Maps.Mini("GlobalListingResultsContainer","PropertyListingButtons"+b.ID,b.Latitude,b.Longitude,"Map"+b.ID,"ShowMiniMap"+b.ID,"HideMiniMap"+b.ID,null,b.IsRooftopLatLongAvailable)};this.ShowPromotionBanner=function(b){if(b===null){a.HidePromotionBanner()}else{b=b+'<a class="UnfilterPromotions" href="#z">remove filter</a>';$("#"+a.ControlIDs.PromotionBanner).html(b);a.BindPromotionFilterRemoveClick();$("#"+a.ControlIDs.PromotionBanner).removeClass("Hidden")}};this.BindPromotionFilterRemoveClick=function(){$("a.UnfilterPromotions").bind("click",function(b){a.UnfilterPromotions()})};this.HidePromotionBanner=function(){$("#"+a.ControlIDs.PromotionBanner).html("");$("#"+a.ControlIDs.PromotionBanner).addClass("Hidden")};this.UnfilterPromotions=function(){a.HidePromotionBanner();var c=document.getElementById(a.ControlIDs.PromotionID);for(var b=0;b<c.length;b++){if(c.options[b].value==="0"){c.selectedIndex=b}}Cwo.Search.ForSale.Submit(1)};if(Cwo.Page.Browser.IsIE6){a.SearchPredictive_Visible=function(){$("#GlobalFilterContainer ul li ul li ul li select").css("display","none");$("#GlobalFilterContainer ul li ul li ul li span").css("display","none")};Cwo.Page.EventController.Subscribe("SearchPredictiveBox.VisibilityChange.Visible",a.SearchPredictive_Visible);a.SearchPredictive_Invisible=function(){$("#GlobalFilterContainer ul li ul li ul li select").css("display","block");$("#GlobalFilterContainer ul li ul li ul li span").css("display","inline")};Cwo.Page.EventController.Subscribe("SearchPredictiveBox.VisibilityChange.Invisible",a.SearchPredictive_Invisible)}this.QueryWebService=function(){var c=Cwo.Page.AjajCalls.CreateRequest("ForSaleSearch"),b=this;b.previousHTML=$("#"+a.ControlIDs.ResultsList).html();$("#Loading").css("height",$("#"+a.ControlIDs.MainContent).height()-50);$("#Loading").css("display","block");Cwo.AjaxCall("/webservices/forsalesearch.asmx/GetPropertyListings",JSON.stringify(a.Criteria),function(e,j){document.title=e.d.ContentContainer.PageTitle;if(e.d.ContentContainer.TotalRecordsAvailable>0){$(".RSSFeed").parent().removeClass("Hidden");$(".RSSFeed").attr("href",e.d.ContentContainer.RssURL)}else{$(".RSSFeed").parent().addClass("Hidden")}if(e.d.ContentContainer.TotalRecordsAvailable<1){$("#Loading").css("display","none")}if(Cwo.Page.AjajCalls.IsCurrentSequenceIndex("ForSaleSearch",c)){a.FullyQualifiedPlaceName=e.d.ContentContainer.FullyQualifiedPlaceName;a.SearchPropertyTypeText=e.d.ContentContainer.SearchPropertyTypeText;var h=e.d.ContentContainer.NearbyPlacesHtml;if(h!==null&&h.length>0){$("#NearbyPlacesContainer").html(h)}if(e.d.ErrorMessage!==null){if(e.d.ErrorMessage==="LocationNotFound"){$("#"+a.ControlIDs.LocationNotFound).removeClass().addClass("One");$("#"+a.ControlIDs.NoResults).removeClass().addClass("Hidden");$("#"+a.ControlIDs.PropertyListings).removeClass().addClass("Hidden");$("#"+a.ControlIDs.ResultsOnMapButton).removeClass().addClass("Hidden")}else{if(e.d.ErrorMessage==="NoResults"){$("#"+a.ControlIDs.LocationNotFound).removeClass().addClass("Hidden");$("#"+a.ControlIDs.NoResults).removeClass().addClass("One");$("#"+a.ControlIDs.PropertyListings).removeClass().addClass("Hidden");a.SetHashURL(e.d.ContentContainer.SearchURL)}}a.TotalResults=e.d.ContentContainer.TotalRecordsAvailable;a.ShowPromotionBanner(e.d.ContentContainer.PromotionBannerHTML);Cwo.Page.EventController.FireEvent("ForSaleResults.PostResultSetChange")}else{Cwo.LogMIActivity(e.d.ContentContainer.SearchURL);a.SetHashURL(e.d.ContentContainer.SearchURL);var d=new Array();var k=e.d.ContentContainer.PropertySearchListings;a.TotalResults=e.d.ContentContainer.TotalRecordsAvailable;for(var l=0;l<k.length;l++){d[d.length]=a.DeserializeForSaleListing(k[l])}a.RenderListingCollection(d);$("#"+a.ControlIDs.LocationNotFound).removeClass().addClass("Hidden");$("#"+a.ControlIDs.NoResults).removeClass().addClass("Hidden");$("#"+a.ControlIDs.PropertyListings).removeClass().addClass("One");a.ShowPromotionBanner(e.d.ContentContainer.PromotionBannerHTML);a.CurrentPage=a.Criteria.CurrentPage;Cwo.Page.EventController.FireEvent("ForSaleResults.PostResultSetChange")}}if(e.d.ContentContainer.SearchURL!==null){$("#"+a.ControlIDs.ResultsOnMapButton).attr({href:e.d.ContentContainer.SearchURL.replace("/buy/search/","/buy/mapsearch/")})}if(Cwo.Page.AjajCalls.IsCurrentSequenceIndex("ForSaleSearch",c)){$("#Loading").css("display","none")}a.LocationString=a.Criteria.SearchString;var m=$("#RadiusSlider").slider("value"),g=(+m===1)?"mile":"miles",f;if(m===0){f="<span>"+a.TotalResults+"</span> "+a.SearchPropertyTypeText+" in <span>"+a.FullyQualifiedPlaceName+"</span>"}else{f="<span>"+a.TotalResults+"</span> "+a.SearchPropertyTypeText+" within <span>"+m+" "+g+"</span> of <span>"+a.FullyQualifiedPlaceName+"</span>"}$("#"+a.ControlIDs.ResultsListTopSummary).html(f);$("#"+a.ControlIDs.ResultsListBottomSummary).html(f)},function(f,d,e){$("#"+a.ControlIDs.ResultsList).html(b.previousHTML);new Cwo.Error.Popup("Problem fetching list of properties.","Sorry, we could not retrieve any results for your search - this could be a problem with your internet connection, or a problem with our website.<br><br>If you attempt to search again and receive the same error, please wait a few minutes and try again.")})};this.SetHashURL=function(b){window.location.hash="#"+b};this.EnforceHashURL=function(){if(window.location.hash.length>13){if(window.location.hash.substr(0,13)==="#/buy/search/"){if(window.location.hash!==("#"+window.location.pathname)){var c=$("<div>").append($("#Loading").eq(0).clone()).html(),b=window.location;$("#body").html(c);$("#body").css("background-position","0px -40px");$("#Loading").css("display","block");b.href=b.protocol+"//"+b.host+b.hash.substring(1);return true}}}};this.DidYouMeanCollapse=function(){a.DidYouMeanExpanded=false;window.setTimeout('$("#" + ctrls.DidYouMeanButton).removeClass("Selected");',300);$("#"+Cwo.Search.ForSale.ControlIDs.DidYouMeanWrapper).slideUp(400);window.setTimeout('$("#" + Cwo.Search.ForSale.ControlIDs.DidYouMeanButton).removeClass("DidYouMeanButtonSelected");',300)};this.DidYouMeanExpand=function(){a.DidYouMeanExpanded=true;$("#"+Cwo.Search.ForSale.ControlIDs.DidYouMeanButton).addClass("DidYouMeanButtonSelected");$("#"+Cwo.Search.ForSale.ControlIDs.DidYouMeanWrapper).css("display","none").removeClass("Hidden").slideDown(400);$("#"+Cwo.Search.ForSale.ControlIDs.DidYouMeanButton).addClass("Selected")};this.DidYouMeanClick=function(){if(a.DidYouMeanExpanded){a.DidYouMeanCollapse()}else{a.DidYouMeanExpand()}}};$(document).ready(function(){Cwo.Search.ForSale.OnStart=function(){$("html").bind("click",function(d){var c=(d.target.id==="SearchPredictiveText")?"block":"none";$("#SearchPredictive").css("display",c)});if(!Cwo.Search.ForSale.EnforceHashURL()){$("select").each(function(){this.selectedValue=function(){return this.options[this.selectedIndex].value}});$("a.CorrectTypoError").bind("click",function(c){var f={};f.SearchString=Cwo.Search.ForSale.Criteria.SearchString;f.CorrectedPlaceName=$(this).attr("title");Cwo.AjaxCall("/webservices/TypoCorrectionAudit.asmx/AuditItem",JSON.stringify(f),function(d,e){})});$("li.hideable a").bind("click",function(c){$(this).parent().toggleClass("Selected");Cwo.Page.EventController.FireEvent("ForSaleFilters.PostVisibilityChange")});$("#ExpandAllFilters").bind("click",function(c){$("li.hideable a").parent().addClass("Selected");Cwo.Page.EventController.FireEvent("ForSaleFilters.PostVisibilityChange")});$("#CloseAllFilters").bind("click",function(c){$("li.hideable a").parent().removeClass("Selected");Cwo.Page.EventController.FireEvent("ForSaleFilters.PostVisibilityChange")});$(".submits-forsalesearch").bind("change",function(c){Cwo.Search.ForSale.Submit(1)});$(".submits-search-resultslist").bind("change",function(c){Cwo.Search.ForSale.Submit(1)});$(".reorders-search-resultslist").bind("change",function(c){Cwo.Search.ForSale.ReOrderResults(this)});Cwo.Search.ForSale.BindPromotionFilterRemoveClick();$("#"+Cwo.Search.ForSale.ControlIDs.DidYouMeanButton).bind("click",function(c){Cwo.Search.ForSale.DidYouMeanClick()});$("#DidYouMeanHideButton").bind("click",function(c){Cwo.Search.ForSale.DidYouMeanCollapse()});$(".inner-photo-wrap img").live("click",function(c){Cwo.LogMIActivity(window.location.href+"ImageClicked")});$(".prop-button-wrapper .photo-no").live("click",function(c){Cwo.LogMIActivity(window.location.href+"PhotoBtn")});$(".ReadMore").live("click",function(c){Cwo.LogMIActivity(window.location.href+"ReadMoreBtn")});$(".prop-button-wrapper .ShowMiniMap").live("click",function(c){Cwo.LogMIActivity(window.location.href+"ShowMiniMapBtn")});$(".Favourite").live("click",function(c){Cwo.LogMIActivity(window.location.href+"AddToFavouritesBtn")});$(".ContactAgent").live("click",function(c){Cwo.LogMIActivity(window.location.href+"ContactAgentBtn")});if(!this.IsMapRendered){var b=[];b[0]=Cwo.Search.ForSale.ControlIDs.ResultsListPagingTop;b[1]=Cwo.Search.ForSale.ControlIDs.ResultsListPagingBottom;Cwo.Search.ForSale.PagingController=new Cwo.Search.PagingController(Cwo.Search.ForSale.GetCurrentPage,b,Cwo.Search.ForSale.Submit,Cwo.Search.ForSale.GetTotalResults,Cwo.Search.ForSale.GetResultsPerPage,"ForSaleResults.PostResultSetChange");Cwo.Search.ForSale.PagingController.RenderButtons()}Cwo.Search.ForSale.ApplyFilterConfiguration();Cwo.Search.ForSale.GetAndValidateUserInput();$(function(){function c(f,h,e){var g=$("#RadiusLabel"),d=$("#SliderDynamicLabel");g.html('<span class="Title">'+Cwo.Search.ForSale.Criteria.SearchString+'</span><span class="Distance">+ '+f+" "+((+f>1)?"</span>":"</span>"));d.html(f);if(f>0){$("#RadiusLabel").removeClass("NoDistance")}else{$("#RadiusLabel").addClass("NoDistance")}if(h){d.show()}else{d.hide()}if(e){Cwo.Search.ForSale.Submit(1)}}$("#RadiusSlider").slider({range:"min",value:$("#SliderValuePreLoad").html(),min:0,max:30,animate:false,start:function(e,d){c(d.value,true)},stop:function(e,d){c(d.value,false,true)},slide:function(e,d){c(d.value,true)}});$("#RadiusSlider .ui-slider-handle").append('<span id="SliderDynamicLabel"></span>');c($("#RadiusSlider").slider("value"),false)})}};if(window.navigator.userAgent.indexOf("MSIE")>-1){Cwo.Search.ForSale.OnStart();return}try{Cwo.Search.ForSale.OnStart()}catch(a){Cwo.Error.TrackError(a)}});
