(function(a){a.fn.addOption=function(){var f=function(k,p,m,q){var n=document.createElement("option");n.value=p,n.text=m;var l=k.options;var o=l.length;if(!k.cache){k.cache={};for(var j=0;j<o;j++){k.cache[l[j].value]=j}}if(typeof k.cache[p]=="undefined"){k.cache[p]=o}k.options[k.cache[p]]=n;if(q){n.selected=true}};var g=arguments;if(g.length==0){return this}var h=true;var b=false;var c,d,e;if(typeof(g[0])=="object"){b=true;c=g[0]}if(g.length>=2){if(typeof(g[1])=="boolean"){h=g[1]}else{if(typeof(g[2])=="boolean"){h=g[2]}}if(!b){d=g[0];e=g[1]}}this.each(function(){if(this.nodeName.toLowerCase()!="select"){return}if(b){for(var i in c){f(this,i,c[i],h)}}else{f(this,d,e,h)}});return this};a.fn.ajaxAddOption=function(h,k,i,f,j){if(typeof(h)!="string"){return this}if(typeof(k)!="object"){k={}}if(typeof(i)!="boolean"){i=true}this.each(function(){var b=this;a.getJSON(h,k,function(c){a(b).addOption(c,i);if(typeof f=="function"){if(typeof j=="object"){f.apply(b,j)}else{f.call(b)}}})});return this};a.fn.removeOption=function(){var h=arguments;if(h.length==0){return this}var g=typeof(h[0]);var l,c;if(g=="string"||g=="object"||g=="function"){l=h[0];if(l.constructor==Array){var f=l.length;for(var m=0;m<f;m++){this.removeOption(l[m],h[1])}return this}}else{if(g=="number"){c=h[0]}else{return this}}this.each(function(){if(this.nodeName.toLowerCase()!="select"){return}if(this.cache){this.cache=null}var b=false;var e=this.options;if(!!l){var d=e.length;for(var i=d-1;i>=0;i--){if(l.constructor==RegExp){if(e[i].value.match(l)){b=true}}else{if(e[i].value==l){b=true}}if(b&&h[1]===true){b=e[i].selected}if(b){e[i]=null}b=false}}else{if(h[1]===true){b=e[c].selected}else{b=true}if(b){this.remove(c)}}});return this};a.fn.sortOptions=function(d){var c=a(this).selectedValues();var b=typeof(d)=="undefined"?true:!!d;this.each(function(){if(this.nodeName.toLowerCase()!="select"){return}var f=this.options;var i=f.length;var h=[];for(var e=0;e<i;e++){h[e]={v:f[e].value,t:f[e].text}}h.sort(function(g,j){o1t=g.t.toLowerCase(),o2t=j.t.toLowerCase();if(o1t==o2t){return 0}if(b){return o1t<o2t?-1:1}else{return o1t>o2t?-1:1}});for(var e=0;e<i;e++){f[e].text=h[e].t;f[e].value=h[e].v}}).selectOptions(c,true);return this};a.fn.selectOptions=function(m,k){var h=m;var l=typeof(m);if(l=="object"&&h.constructor==Array){var c=this;a.each(h,function(){c.selectOptions(this,k)})}var f=k||false;if(l!="string"&&l!="function"&&l!="object"){return this}this.each(function(){if(this.nodeName.toLowerCase()!="select"){return this}var b=this.options;var e=b.length;for(var d=0;d<e;d++){if(h.constructor==RegExp){if(b[d].value.match(h)){b[d].selected=true}else{if(f){b[d].selected=false}}}else{if(b[d].value==h){b[d].selected=true}else{if(f){b[d].selected=false}}}}});return this};a.fn.copyOptions=function(f,e){var c=e||"selected";if(a(f).size()==0){return this}this.each(function(){if(this.nodeName.toLowerCase()!="select"){return this}var b=this.options;var g=b.length;for(var d=0;d<g;d++){if(c=="all"||(c=="selected"&&b[d].selected)){a(f).addOption(b[d].value,b[d].text)}}});return this};a.fn.containsOption=function(m,k){var h=false;var l=m;var c=typeof(l);var f=typeof(k);if(c!="string"&&c!="function"&&c!="object"){return f=="function"?this:h}this.each(function(){if(this.nodeName.toLowerCase()!="select"){return this}if(h&&f!="function"){return false}var b=this.options;var e=b.length;for(var d=0;d<e;d++){if(l.constructor==RegExp){if(b[d].value.match(l)){h=true;if(f=="function"){k.call(b[d],d)}}}else{if(b[d].value==l){h=true;if(f=="function"){k.call(b[d],d)}}}}});return f=="function"?this:h};a.fn.selectedValues=function(){var b=[];this.selectedOptions().each(function(){b[b.length]=this.value});return b};a.fn.selectedTexts=function(){var b=[];this.selectedOptions().each(function(){b[b.length]=this.text});return b};a.fn.selectedOptions=function(){return this.find("option:selected")}})(jQuery);Cwo.RegisterNamespace("Cwo.Search");Cwo.Search.PagingController=function(f,a,d,c,b,e){var g=this;this.RenderButtons=function(k){var p="";var m=isNaN(k)?f():k;var o=c();var l=b();var r=Math.ceil(o/l);var h;scroll(0,0);var q=$("#ResultsListPagingSummary");if(q!==null){var s=Math.ceil(o/l);q.text("Page "+m.toString()+" of "+s)}if(r>1){if(m>1){p+=g.ButtonHtml(m-1,"Prev",m)}for(h=-2;h<3;h++){var j=parseInt(h,10)+parseInt(m,10);if((j>0)&&(j<=r)){p+=g.ButtonHtml(j,j,m)}}if((parseInt(m,10)===1)&&(r>=4)){p+=g.ButtonHtml(parseInt(4,10),parseInt(4,10),m)}if((parseInt(m,10)<3)&&(r>=5)){p+=g.ButtonHtml(parseInt(5,10),parseInt(5,10),m)}if(m<r){p+=g.ButtonHtml(parseInt(1,10)+parseInt(m,10),"Next",m)}}var n=a.length;for(h=0;h<n;h++){$("#"+a[h]).html(p);$("#"+a[h]+" .pagingbutton").bind("click",function(t){var i=$(this).attr("pagenumber");g.RenderButtons(i);d(i)})}};Cwo.Page.EventController.Subscribe(e,this.RenderButtons);this.ButtonHtml=function(j,i,k){if(typeof(i)==="undefined"){i=j}var h=" <li";if((+j)===(+k)){h+=' class="Selected"'}h+='><a class="pagingbutton" pagenumber="'+j+'" a href="#Page '+j+'" title="'+i+'">'+i+"</a></li>";return h}};$(document).ready(function(){var a=$("#ForSaleFilters");if(a){var b=a.find("li.Selected");if(b.length>0){var c=b[b.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.Criteria=new function(){var b=3;var a=0;var c=8;var d=2};Cwo.Search.Favourites.SynchronizeCriteria=function(a,b){Cwo.Search.Favourites.CurrentPage=a;Cwo.Search.Favourites.Criteria.Type=$("input[name=agentType]:checked").val();Cwo.Search.Favourites.Criteria.StartIndex=(a*Cwo.Search.Favourites.ResultsPerPage)-Cwo.Search.Favourites.ResultsPerPage;Cwo.Search.Favourites.Criteria.EndIndex=(a*Cwo.Search.Favourites.ResultsPerPage)-1};Cwo.Search.Favourites.GetResults=function(a,b){Cwo.Search.Favourites.SynchronizeCriteria(a,b);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(d){var b=d.d.ContentContainer.PropertyListings;var h="";var f=new Array();var c='<table id="FavouriteResults" cellpadding="0" cellspacing="0" summary="Favourites">';for(var a=0;a<b.length;a++){f.Address=b[a].Address;f.Description=b[a].Description;f.ID=b[a].InstructionID;f.IsNew=b[a].IsNew;f.PhotoUrl=b[a].MainPhotoUrl.toString();f.FormattedAskingPrice=b[a].Price;f.SummaryAddress=b[a].Summary;f.URLAliasPath=b[a].URLAliasPath;f.Type=b[a].Type;(f.Type===1)?h="ForSale":h="ToLet";f.AdditionalText=b[a].AdditionalText;c+=Cwo.Search.Favourites.GetListHTML(f,h,a)}c+="</table>";$("#FavouriteResults").replaceWith(c);Cwo.Favourites.BindFavouritesListClicks();for(a=0;a<b.length;a++){Cwo.Search.Favourites.BindContactAgentClicks(b[a])}for(a=0;a<b.length;a++){Cwo.Search.Favourites.BindMiniMapClicks(b[a])}var e=$("#FavouritesLink span");e.text(d.d.ContentContainer.TotalRowCount);var g=$("input[name=agentType]:checked").val();if(g==="1"){if(d.d.ContentContainer.TotalRecordsAvailable===1){$(".FavouritesLinkText").text(" For Sale property saved in your favourites")}else{$(".FavouritesLinkText").text(" For Sale properties saved in your favourites")}}else{if(g==="2"){if(d.d.ContentContainer.TotalRecordsAvailable===1){$(".FavouritesLinkText").text(" To Let property saved in your favourites")}else{$(".FavouritesLinkText").text(" To Let properties saved in your favourites")}}else{if(d.d.ContentContainer.TotalRecordsAvailable===1){$(".FavouritesLinkText").text(" property saved in your favourites")}else{$(".FavouritesLinkText").text(" properties saved in your favourites")}}}$(".FavouritesLink span").html(d.d.ContentContainer.TotalRecordsAvailable);Cwo.Search.Favourites.TotalResults=d.d.ContentContainer.TotalRecordsAvailable;if(d.d.ErrorMessage==="NoResults"){$("#"+Cwo.Search.Favourites.NoResults).removeClass().addClass("One")}else{$("#"+Cwo.Search.Favourites.NoResults).removeClass().addClass("Hidden")}Cwo.Page.EventController.FireEvent("Favourites.PostResultSetChange")};Cwo.Search.Favourites.GetListHTML=function(c,b,e){var a="";var d="";if(e===0||e===3||e===6){a+="<tr>"}a+="    <td style='"+((c.AdditionalText!==null&&c.AdditionalText.toString().length>0)?"background-color:#f7fbec":"")+"' class="+b+' id="ListingContainer'+c.ID+'">';a+='       <a class="Remove FavouriteButton" id="FavouriteButton'+c.ID+'" title="Remove Favourite" href="#RemoveFromFavourites">remove</a>';a+='       <a class="Thumbnail" href="'+c.URLAliasPath+'" title="" ><img src='+c.PhotoUrl+' alt="" /></a>';if(c.IsNew){a+='            <span class="IE6New"><img src="/images/icons/results-new.png" class="New" alt="New" /></span>'}if(c.AdditionalText!==null&&c.AdditionalText.toString().length>0){a+='            <span class="IE6New"><img src="/promotions/pricereduced/images/results-listing-item-icon.png" class="New" alt="New" /></span>'}a+='            <div class="Two">';a+='            <div class="PriceWrapper">';if(c.FormattedAskingPrice.indexOf("&pound;")?"Qualifier":""){d="Qualifier"}a+='            <a href="'+c.URLAliasPath+'" title="'+c.FormattedAskingPrice+'"><h2 class="'+d+'">'+c.FormattedAskingPrice+((c.AdditionalText!==null&&c.AdditionalText.toString().length>0)?(" <span>"+c.AdditionalText+"</span></h2>"):"</h2>")+"</a>";a+="            </div>";a+="            <h3>"+c.Address+"</h3>";a+="            <h4>"+c.SummaryAddress+"</h4>";a+="            <p>"+c.Description+"...</p>";a+="            <ul id=PropertyListingButtons"+c.ID+">";a+='                <li class="ReadMore"><a href="'+c.URLAliasPath+'" title="Read More"><span>Read More</span></a></li>';a+='                <li class="MiniMap"><a href="#ShowMiniMap" title="Show Mini Map" id=ShowMiniMap'+c.ID+"><span>Mini Map</span></a></li>";a+='                <li class="ContactAgent"><a href="#" id="ContactAgent'+c.ID+'" title="Contact Agent"><span>Contact Agent</span></a></li>';a+='                <li class="FullMiniMap">';a+='                    <div class="One"></div>';a+='                    <div class="Two">';a+='                        <div class="TwoOne"><h5>'+c.FormattedAskingPrice+"</h5><span>/ "+c.SummaryAddress+'</span><a class="Close" title="Close" id=HideMiniMap'+c.ID+">Close</a></div>";a+='                        <div class="Map" id=Map'+c.ID+"></div>";a+="                    </div>";a+='                    <div class="Three"></div>';a+="                </li>";a+="            </ul>";a+="        </div>";a+="    </td>";if(e===2||e===5||e===8){a+="</tr>"}return a};Cwo.Search.Favourites.BindContactAgentClicks=function(a){new Cwo.Modal("ContactAgent"+a.InstructionID,"InstructionID_"+a.InstructionID+"_ContactAgent","GetEnquiryForm")};Cwo.Search.Favourites.BindMiniMapClicks=function(a){new Cwo.Maps.Mini("FavouritesContentContainer","PropertyListingButtons"+a.InstructionID,a.Latitude,a.Longitude,"Map"+a.InstructionID,"ShowMiniMap"+a.InstructionID,"HideMiniMap"+a.InstructionID)};$(document).ready(function(){Cwo.Search.Favourites.OnStart=function(){Cwo.Search.Favourites.CurrentPage=$("li.Selected .pagingbutton").text()[0];if(typeof(Cwo.Search.Favourites.CurrentPage)==="undefined"){Cwo.Search.Favourites.CurrentPage=1}Cwo.Search.Favourites.TotalResults=$("#FavouritesTotalCount").text();$("#HeaderOrderBy").val(1);$("#FooterOrderBy").val(1);Cwo.Search.Favourites.Criteria.OrderBy=2;$("#rdoSalesAndLettings").attr("checked",true);Cwo.Search.Favourites.ResultsPerPage=9;var c=$("input[name=agentType]:checked").val();if(Cwo.Search.Favourites.TotalResults==="1"){$(".FavouritesLinkText").text(" property saved in your favourites")}else{$(".FavouritesLinkText").text(" properties saved in your favourites")}$("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;$("#HeaderOrderBy").change(function(){Cwo.Search.Favourites.Criteria.OrderBy=$("#HeaderOrderBy option:selected").val();$("#FooterOrderBy").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)});$("#FooterOrderBy").change(function(){Cwo.Search.Favourites.Criteria.OrderBy=$("#FooterOrderBy option:selected").val();$("#HeaderOrderBy").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 b=[Cwo.Search.Favourites.ResultsListPagingTop,Cwo.Search.Favourites.ResultsListPagingBottom];Cwo.Search.Favourites.PagingController=new Cwo.Search.PagingController(Cwo.Search.Favourites.GetCurrentPage,b,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 fsi=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=new Object();this.DidYouMeanExpanded=false;this.FullyQualifiedPlaceName="";this.GetTotalResults=function(){return fsi.TotalResults};this.GetResultsPerPage=function(){return fsi.ResultsPerPage};this.GetCurrentPage=function(){return fsi.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.TenureTypeID=-1;this.PropertyTypeID=-1;this.PromotionID=-1};this.DiscoverSelectedSortOrder=function(){fsi.Criteria.OrderBy=document.getElementById(fsi.ControlIDs.ForSaleListOrderByTop).options[document.getElementById(fsi.ControlIDs.ForSaleListOrderByTop).selectedIndex].value};this.GetAndValidateUserInput=function(){this.ValidatedOK=true;this.ErrorMessage="";var oldRadius=fsi.Criteria.Radius;var newRadius=(+document.getElementById(fsi.ControlIDs.Radius).selectedValue());var promotionControl;fsi.Criteria.SearchString=$("#SearchPredictiveText").val();fsi.Criteria.Radius=(+document.getElementById(fsi.ControlIDs.Radius).selectedValue());fsi.Criteria.BedroomsMin=(+document.getElementById(fsi.ControlIDs.BedroomsMin).selectedValue());fsi.Criteria.BedroomsMax=(+document.getElementById(fsi.ControlIDs.BedroomsMax).selectedValue());fsi.Criteria.AskingPriceMin=(+document.getElementById(fsi.ControlIDs.AskingPriceMin).selectedValue());fsi.Criteria.AskingPriceMax=(+document.getElementById(fsi.ControlIDs.AskingPriceMax).selectedValue());fsi.Criteria.ReceptionsMin=(+document.getElementById(fsi.ControlIDs.ReceptionsMin).selectedValue());fsi.Criteria.ReceptionsMax=(+document.getElementById(fsi.ControlIDs.ReceptionsMax).selectedValue());fsi.Criteria.BathroomsMin=(+document.getElementById(fsi.ControlIDs.BathroomsMin).selectedValue());fsi.Criteria.BathroomsMax=(+document.getElementById(fsi.ControlIDs.BathroomsMax).selectedValue());fsi.Criteria.TenureTypeID=(+document.getElementById(fsi.ControlIDs.TenureTypeID).selectedValue());fsi.Criteria.PropertyTypeID=(+document.getElementById(fsi.ControlIDs.PropertyTypeID).selectedValue());promotionControl=document.getElementById(fsi.ControlIDs.PromotionID);if(promotionControl!==null){fsi.Criteria.PromotionID=promotionControl.selectedValue()}else{fsi.Criteria.PromotionID=0}if(!this.IsMapRendered){fsi.DiscoverSelectedSortOrder()}var validates=true;if(fsi.Criteria.SearchString.length<1){this.ValidatedOK=false;this.ErrorMessage+="Please ensure you enter a location to search in.<br /><br />";validates=false}if((fsi.Criteria.AskingPriceMin)>=(fsi.Criteria.AskingPriceMax)){this.ValidatedOK=false;this.ErrorMessage+="Please choose a maximum price greater than your chosen minimum.<br /><br />";validates=false}if((+fsi.Criteria.BedroomsMin)>(+fsi.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 />";validates=false}if((+fsi.Criteria.ReceptionsMin)>(+fsi.Criteria.ReceptionsMax)){this.ValidatedOK=false;this.ErrorMessage+="Please ensure the selected maximum number of receptions is greater or equal to the minimum.<br /><br />";validates=false}if((+fsi.Criteria.BathroomsMin)>(+fsi.Criteria.BathroomsMax)){this.ValidatedOK=false;this.ErrorMessage+="Please ensure the selected maximum number of bathrooms is greater or equal to the minimum.<br /><br />";validates=false}if(validates){Cwo.Page.EventController.FireEvent("ForSaleFilters.CriteriaChanged");if(oldRadius!==newRadius){Cwo.Page.EventController.FireEvent("ForSaleFilters.RadiusChanged")}}};this.Submit=function(page){fsi.GetAndValidateUserInput();if(fsi.ValidatedOK){fsi.Criteria.CurrentPage=page;if(!fsi.IsMapRendered){fsi.QueryWebService()}}else{new Cwo.Error.Popup("Please check your search criteria",fsi.ErrorMessage)}return false};this.Promotion=function(){var promo="";var promoPatern=/\/p-[a-zA-Z]+/g;if(window.location.href!==null&&window.location.href.match(promoPatern)!==null){var matchArray=window.location.href.match(promoPatern).toString().split(",");if(matchArray.length>0){promo=matchArray[matchArray.length-1].split("-")[1]}}return promo};this.ForSaleListing=function(instructionID,mainphotoUrl,askingprice,summary,description,lat,lon,isNew,summaryaddress,url,isPremiumDisplay,promotions,additionalInformation){this.ID=instructionID;this.PhotoUrl=mainphotoUrl;this.FormattedAskingPrice=askingprice;this.Summary=summary;this.Description=description;this.Latitude=lat;this.Longitude=lon;this.IsNew=isNew;this.SummaryAddress=summaryaddress;this.URL=url;this.IsPremiumDisplay=isPremiumDisplay;this.AdditionalInformation=(additionalInformation!==null)?additionalInformation:"";this.GetListHTML=function(){var result="";if(this.IsPremiumDisplay){result+='<li class="PremiumDisplay">'}else{result+="<li>"}result+='    <div class="One">';result+='     <ul id="MiniIcons">';if(this.IsNew){result+='             <li class="New"><span><img src="/images/icons/results-new.png" alt="New Listing" /></span></li>'}for(var index=0;index<promotions.length;index++){if(promotions[index].ShowListingIcon===true){result+='<li class="ChainFree"><span><img src="'+promotions[index].ListingIconImagePath.toString()+'" alt="'+promotions[index].DisplayName.toString()+'" /></span></li>'}}result+="     </ul>";result+='        <a href="'+this.URL+'" title=""><img src="'+this.PhotoUrl+'" alt="" /></a>';result+='        <div class="Two">';result+='            <a href="'+this.URL+'" title="Read More"><h2>'+this.FormattedAskingPrice+"<span>"+this.AdditionalInformation+"</span></h2>";result+="            <h3>/ "+this.SummaryAddress+"</h3></a>";result+="            <h4>"+this.Summary+"</h4>";result+="            <p>"+this.Description+"...</p>";result+='            <ul id="PropertyListingButtons'+this.ID+'"> ';result+='                <li class="ReadMore"><span><a href="'+this.URL+'" title="Read More">Read More</a></span></li> ';result+='                <li class="ShowMiniMap"><span><a href="#ShowMiniMap" title="Show Mini Map" id="ShowMiniMap'+this.ID+'">Show Mini Map</a></span></li> ';result+='                <li class="Favourite"><span><a href="#AddToFavourites" title="Favourite" class="FavouriteButton" id="AddToFavourites'+this.ID+'">Favourite</a></span></li> ';result+='                <li class="ContactAgent"><span><a href="#ContactAgent" title="Contact Agent" id="ContactAgent'+this.ID+'">Contact Agent</a></span></li>';result+='                <li class="FullMiniMap">';result+='                    <div class="One"></div>';result+='                    <div class="Two">';result+='                        <div class="TwoOne"><h5>'+this.FormattedAskingPrice+"</h5><span>/ "+this.SummaryAddress+'</span><a href="#" class="Close" title="Close" id="HideMiniMap'+this.ID+'">Close</a></div>';result+='                        <div class="Map" id="Map'+this.ID+'"></div>';result+="                    </div>";result+='                    <div class="Three"></div>';result+="                </li>";result+="            </ul>";result+="        </div>";result+="    </div>";result+="</li>";return result}};this.DeserializeForSaleListing=function(data){return new fsi.ForSaleListing(data.InstructionID,data.MainPhotoUrl,data.Price,data.Summary,data.Description,data.Latitude,data.Longitude,data.IsNew,data.Address,data.URLAliasPath,data.IsPremiumDisplay,data.Promotions,data.AdditionalText)};this.ReOrderResults=function(ele){if(!fsi.SuppressFormSubmission){fsi.SuppressFormSubmission=true;var curVal=$("#"+ele.id).selectedValues()[0];$("#"+fsi.ControlIDs.ForSaleListOrderByTop).selectOptions(curVal);$("#"+fsi.ControlIDs.ForSaleListOrderByBottom).selectOptions(curVal);fsi.Criteria.CurrentPage=1;fsi.SuppressFormSubmission=false;fsi.Submit(fsi.Criteria.CurrentPage)}};this.RenderLastFilter=function(){var labelBox=$("li.hideable:last");if(labelBox.hasClass("Selected")){labelBox.removeClass("Last");$("li.hideable:last ul li").addClass("Last")}else{labelBox.addClass("Last")}};Cwo.Page.EventController.Subscribe("ForSaleFilters.PostVisibilityChange",fsi.RenderLastFilter);this.SaveFilterConfiguration=function(){var results="";var numfiltershidden=0;$("#ForSaleFilters .hideable").each(function(){if(!$("#"+this.id).hasClass("Selected")){results+=this.id+" ";numfiltershidden++}});Cwo.Common.SetCookie("ForSaleFilterUnSelected",(numfiltershidden===$("#ForSaleFilters .hideable").length)?"All":results)};Cwo.Page.EventController.Subscribe("ForSaleFilters.PostVisibilityChange",fsi.SaveFilterConfiguration);this.ApplyFilterConfiguration=function(){var filters=$("#ForSaleFilters .hideable");var hiddenfilterlist=Cwo.Common.GetCookie("ForSaleFilterUnSelected");var changeMade=false;if(hiddenfilterlist.length>2){filters.each(function(){if((hiddenfilterlist.indexOf(this.id)>-1)||(hiddenfilterlist==="All")){$("#"+this.id).removeClass("Selected");changeMade=true}});if(changeMade){Cwo.Page.EventController.FireEvent("ForSaleFilters.PostVisibilityChange")}}};this.RenderListingCollection=function(listingCollection){var htmlToAdd="";var numListings=listingCollection.length;for(var i=0;i<numListings;i++){if(!fsi.ResultSet.ContainsKey(listingCollection[i].ID)){fsi.ResultSet.Add(listingCollection[i].ID,listingCollection[i])}htmlToAdd+=listingCollection[i].GetListHTML()}$("#"+fsi.ControlIDs.ResultsList).html(htmlToAdd);Cwo.Favourites.BindResultsListClicks();for(i=0;i<numListings;i++){fsi.BindContactAgentClicks(listingCollection[i]);fsi.BindMiniMapClicks(listingCollection[i])}};this.BindContactAgentClicks=function(listingItem){if(fsi.Promotion().length>0){new Cwo.Modal("ContactAgent"+listingItem.ID,"InstructionID_"+listingItem.ID+"_ContactAgent","GetEnquiryForm")}else{new Cwo.Modal("ContactAgent"+listingItem.ID,"InstructionID_"+listingItem.ID+"_ContactAgent","GetEnquiryForm")}};this.BindMiniMapClicks=function(listingItem){new Cwo.Maps.Mini("GlobalListingResultsContainer","PropertyListingButtons"+listingItem.ID,listingItem.Latitude,listingItem.Longitude,"Map"+listingItem.ID,"ShowMiniMap"+listingItem.ID,"HideMiniMap"+listingItem.ID)};this.ShowPromotionBanner=function(BannerHTML){if(BannerHTML===null){fsi.HidePromotionBanner()}else{BannerHTML=BannerHTML+'<a class="UnfilterPromotions" href="#z">remove filter</a>';$("#"+fsi.ControlIDs.PromotionBanner).html(BannerHTML);fsi.BindPromotionFilterRemoveClick();$("#"+fsi.ControlIDs.PromotionBanner).removeClass("Hidden")}};this.BindPromotionFilterRemoveClick=function(){$("a.UnfilterPromotions").bind("click",function(e){fsi.UnfilterPromotions()})};this.HidePromotionBanner=function(){$("#"+fsi.ControlIDs.PromotionBanner).html("");$("#"+fsi.ControlIDs.PromotionBanner).addClass("Hidden")};this.UnfilterPromotions=function(){fsi.HidePromotionBanner();var dropDown=document.getElementById(fsi.ControlIDs.PromotionID);for(var i=0;i<dropDown.length;i++){if(dropDown.options[i].value==="0"){dropDown.selectedIndex=i}}Cwo.Search.ForSale.Submit(1)};if(Cwo.Page.Browser.IsIE6){fsi.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",fsi.SearchPredictive_Visible);fsi.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",fsi.SearchPredictive_Invisible)}this.QueryWebService=function(){var AjajSequenceIndex=Cwo.Page.AjajCalls.CreateRequest("ForSaleSearch");var thisCall=this;thisCall.previousHTML=$("#"+fsi.ControlIDs.ResultsList).html();$("#Loading").css("height",$("#"+fsi.ControlIDs.MainContent).height()-50);$("#Loading").css("display","block");Cwo.AjaxCall("/webservices/forsalesearch.asmx/GetPropertyListings",JSON.stringify(fsi.Criteria),function(data,status){if(Cwo.Page.AjajCalls.IsCurrentSequenceIndex("ForSaleSearch",AjajSequenceIndex)){fsi.FullyQualifiedPlaceName=data.d.ContentContainer.FullyQualifiedPlaceName;if(data.d.ErrorMessage!==null){if(data.d.ErrorMessage==="LocationNotFound"){$("#LocationNotFoundText").val(fsi.Criteria.SearchString);$("#location").text(fsi.Criteria.SearchString);$("#litLocation").hide();$("#"+fsi.ControlIDs.LocationNotFound).removeClass().addClass("One");$("#"+fsi.ControlIDs.NoResults).removeClass().addClass("Hidden");$("#"+fsi.ControlIDs.PropertyListings).removeClass().addClass("Hidden");$("#"+fsi.ControlIDs.ResultsOnMapButton).removeClass().addClass("Hidden")}else{if(data.d.ErrorMessage==="NoResults"){$("#"+fsi.ControlIDs.LocationNotFound).removeClass().addClass("Hidden");$("#"+fsi.ControlIDs.NoResults).removeClass().addClass("One");$("#"+fsi.ControlIDs.PropertyListings).removeClass().addClass("Hidden");fsi.SetHashURL(data.d.ContentContainer.SearchURL)}}fsi.TotalResults=data.d.ContentContainer.TotalRecordsAvailable;fsi.ShowPromotionBanner(data.d.ContentContainer.PromotionBannerHTML);Cwo.Page.EventController.FireEvent("ForSaleResults.PostResultSetChange")}else{Cwo.LogMIActivity(data.d.ContentContainer.SearchURL);fsi.SetHashURL(data.d.ContentContainer.SearchURL);$("#"+fsi.ControlIDs.ResultsOnMapButton).attr({href:data.d.ContentContainer.SearchURL.replace("/buy/search/","/buy/mapsearch/")});var Instructions=new Array();var instructionInformation=eval(data.d.ContentContainer.PropertyListings);fsi.TotalResults=data.d.ContentContainer.TotalRecordsAvailable;for(var i=0;i<instructionInformation.length;i++){Instructions[Instructions.length]=fsi.DeserializeForSaleListing(instructionInformation[i])}fsi.RenderListingCollection(Instructions);$("#"+fsi.ControlIDs.LocationNotFound).removeClass().addClass("Hidden");$("#"+fsi.ControlIDs.NoResults).removeClass().addClass("Hidden");$("#"+fsi.ControlIDs.PropertyListings).removeClass().addClass("One");fsi.ShowPromotionBanner(data.d.ContentContainer.PromotionBannerHTML);fsi.CurrentPage=fsi.Criteria.CurrentPage;Cwo.Page.EventController.FireEvent("ForSaleResults.PostResultSetChange")}}else{}if(Cwo.Page.AjajCalls.IsCurrentSequenceIndex("ForSaleSearch",AjajSequenceIndex)){$("#Loading").css("display","none")}fsi.LocationString=fsi.Criteria.SearchString;var distance=$("#"+fsi.ControlIDs.Radius+" option:selected").text();var pageSummary="<span>"+fsi.TotalResults+"</span> properties within <span>"+distance+"</span> of <span>"+fsi.FullyQualifiedPlaceName+"</span>";$("#"+fsi.ControlIDs.ResultsListTopSummary).html(pageSummary);$("#"+fsi.ControlIDs.ResultsListBottomSummary).html(pageSummary)},function(xhr,err,ex){$("#"+fsi.ControlIDs.ResultsList).html(thisCall.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(hashURL){window.location.hash="#"+hashURL};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 loadingHTML=$("<div>").append($("#Loading").eq(0).clone()).html();$("#body").html(loadingHTML);$("#body").css("background-position","0px -40px");$("#Loading").css("display","block");var curLoc=window.location;curLoc.href=curLoc.protocol+"//"+curLoc.host+curLoc.hash.substring(1);return true}}}};this.DidYouMeanCollapse=function(){fsi.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(){fsi.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(fsi.DidYouMeanExpanded){fsi.DidYouMeanCollapse()}else{fsi.DidYouMeanExpand()}}};$(document).ready(function(){Cwo.Search.ForSale.OnStart=function(){$("html").bind("click",function(c){(c.target.id==="SearchPredictiveText")?$("#SearchPredictive").css("display","block"):$("#SearchPredictive").css("display","none")});if(!Cwo.Search.ForSale.EnforceHashURL()){$("select").each(function(){this.selectedValue=function(){return this.options[this.selectedIndex].value}});$("a.CorrectTypoError").bind("click",function(f){var c={};c.SearchString=Cwo.Search.ForSale.Criteria.SearchString;c.CorrectedPlaceName=$(this).attr("title");Cwo.AjaxCall("/webservices/TypoCorrectionAudit.asmx/AuditItem",JSON.stringify(c),function(e,d){})});$("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)});$(".reorders-forsalesearch").bind("change",function(c){Cwo.Search.ForSale.ReOrderResults(this)});$("#SaveSearch").bind("click",function(c){Cwo.Search.ForSale.SaveSearch()});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()});if(!this.IsMapRendered){var b=new Array();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()}};if(navigator.userAgent.indexOf("MSIE")>-1){Cwo.Search.ForSale.OnStart();return}try{Cwo.Search.ForSale.OnStart()}catch(a){Cwo.Error.TrackError(a)}});