(function(c){var d=c.browser.msie&&parseInt(c.browser.version)==6&&typeof window.XMLHttpRequest!="object",a=null,b=[];c.modal=function(f,e){return c.modal.impl.init(f,e)};c.modal.close=function(){c.modal.impl.close()};c.fn.modal=function(e){return c.modal.impl.init(this,e)};c.modal.defaults={opacity:50,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataCss:{},zIndex:1000,close:true,closeHTML:'<a class="modalCloseImg" title="Close">Close</a>',closeClass:"simplemodal-close",position:null,persist:false,onOpen:null,onShow:null,onClose:null};c.modal.impl={opts:null,dialog:{},init:function(f,e){if(this.dialog.data){return false}a=c.browser.msie&&!c.boxModel;this.opts=c.extend({},c.modal.defaults,e);this.zIndex=this.opts.zIndex;this.occb=false;if(typeof f=="object"){f=f instanceof jQuery?f:c(f);if(f.parent().parent().size()>0){this.dialog.parentNode=f.parent();if(!this.opts.persist){this.dialog.orig=f.clone(true)}}}else{if(typeof f=="string"||typeof f=="number"){f=c("<div/>").html(f)}else{alert("SimpleModal Error: Unsupported data type: "+typeof f);return false}}this.dialog.data=f.addClass("simplemodal-data").css(this.opts.dataCss);f=null;this.create();this.open();if(c.isFunction(this.opts.onShow)){this.opts.onShow.apply(this,[this.dialog])}return this},create:function(){b=this.getDimensions();if(d){this.dialog.iframe=c('<iframe src="javascript:false;"/>').css(c.extend(this.opts.iframeCss,{display:"none",opacity:0,position:"fixed",height:b[0],width:b[1],zIndex:this.opts.zIndex,top:0,left:0})).appendTo("body")}this.dialog.overlay=c("<div/>").attr("id",this.opts.overlayId).addClass("simplemodal-overlay").css(c.extend(this.opts.overlayCss,{display:"none",opacity:this.opts.opacity/100,height:b[0],width:b[1],position:"fixed",left:0,top:0,zIndex:this.opts.zIndex+1})).appendTo("body");this.dialog.container=c("<div/>").attr("id",this.opts.containerId).addClass("simplemodal-container").css(c.extend(this.opts.containerCss,{display:"none",position:"absolute",zIndex:this.opts.zIndex+2})).append(this.opts.close?c(this.opts.closeHTML).addClass(this.opts.closeClass):"").appendTo("body");this.setPosition();if(d||a){this.fixIE()}this.dialog.container.append(this.dialog.data.hide())},bindEvents:function(){var e=this;c("."+this.opts.closeClass).bind("click.simplemodal",function(f){f.preventDefault();e.close()});c(window).bind("resize.simplemodal",function(){b=e.getDimensions();e.setPosition();if(d||a){e.fixIE()}else{e.dialog.iframe&&e.dialog.iframe.css({height:b[0],width:b[1]});e.dialog.overlay.css({height:b[0],width:b[1]})}})},unbindEvents:function(){c("."+this.opts.closeClass).unbind("click.simplemodal");c(window).unbind("resize.simplemodal")},fixIE:function(){var e=this.opts.position;c.each([this.dialog.iframe||null,this.dialog.overlay,this.dialog.container],function(m,u){if(u){var h="document.body.clientHeight",r="document.body.clientWidth",x="document.body.scrollHeight",l="document.body.scrollLeft",t="document.body.scrollTop",p="document.body.scrollWidth",k="document.documentElement.clientHeight",v="document.documentElement.clientWidth",o="document.documentElement.scrollLeft",n="document.documentElement.scrollTop",j=u[0].style;j.position="absolute";if(m<2){j.removeExpression("height");j.removeExpression("width");j.setExpression("height",""+x+" > "+h+" ? "+x+" : "+h+' + "px"');j.setExpression("width",""+p+" > "+r+" ? "+p+" : "+r+' + "px"')}else{var w,g;if(e&&e.constructor==Array){var f=e[0]?typeof e[0]=="number"?e[0].toString():e[0].replace(/px/,""):u.css("top").replace(/px/,"");w=f.indexOf("%")==-1?f+" + (t = "+n+" ? "+n+" : "+t+') + "px"':parseInt(f.replace(/%/,""))+" * (("+k+" || "+h+") / 100) + (t = "+n+" ? "+n+" : "+t+') + "px"';if(e[1]){var q=typeof e[1]=="number"?e[1].toString():e[1].replace(/px/,"");g=q.indexOf("%")==-1?q+" + (t = "+o+" ? "+o+" : "+l+') + "px"':parseInt(q.replace(/%/,""))+" * (("+v+" || "+r+") / 100) + (t = "+o+" ? "+o+" : "+l+') + "px"'}}else{w="("+k+" || "+h+") / 2 - (this.offsetHeight / 2) + (t = "+n+" ? "+n+" : "+t+') + "px"';g="("+v+" || "+r+") / 2 - (this.offsetWidth / 2) + (t = "+o+" ? "+o+" : "+l+') + "px"'}j.removeExpression("top");j.removeExpression("left");j.setExpression("top",w);j.setExpression("left",g)}}})},getDimensions:function(){var e=c(window);var f=c.browser.opera&&c.browser.version>"9.5"&&c.fn.jquery<="1.2.6"?document.documentElement.clientHeight:e.height();return[f,e.width()]},setPosition:function(){var f,h,g=(b[0]/2)-((this.dialog.container.height()||this.dialog.data.height())/2),e=(b[1]/2)-((this.dialog.container.width()||this.dialog.data.width())/2);if(this.opts.position&&this.opts.position.constructor==Array){f=this.opts.position[0]||g;h=this.opts.position[1]||e}else{f=g;h=e}this.dialog.container.css({left:h,top:f})},open:function(){this.dialog.iframe&&this.dialog.iframe.show();if(c.isFunction(this.opts.onOpen)){this.opts.onOpen.apply(this,[this.dialog])}else{this.dialog.overlay.show();this.dialog.container.show();this.dialog.data.show()}this.bindEvents()},close:function(){if(!this.dialog.data){return false}if(c.isFunction(this.opts.onClose)&&!this.occb){this.occb=true;this.opts.onClose.apply(this,[this.dialog])}else{if(this.dialog.parentNode){if(this.opts.persist){this.dialog.data.hide().appendTo(this.dialog.parentNode)}else{this.dialog.data.remove();this.dialog.orig.appendTo(this.dialog.parentNode)}}else{this.dialog.data.remove()}this.dialog.container.remove();this.dialog.overlay.remove();this.dialog.iframe&&this.dialog.iframe.remove();this.dialog={}}this.unbindEvents()}}})(jQuery);if(!this.JSON){JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z"};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}})();var Cwo={that:this,SetSessionCookie:function(b,a){document.cookie=b+"="+a+";path=/"},GetCookieTime:function(b){var a=b.getMonth()+1+"/"+b.getDate()+"/"+b.getFullYear()+" "+b.getHours()+":"+b.getMinutes()+":"+b.getSeconds();return a},RegisterNamespace:function(a){var c=a.split(".");var b=window;for(var d=0;d<c.length;d++){if(typeof b[c[d]]==="undefined"){b[c[d]]=new Object()}b=b[c[d]]}},Collection:function(){this.Items=new Array();this.Item=function(a){return this.Items[a]};this.Add=function(a){this.Items[this.Items.length]=a};this.Remove=function(a){var b=this.IndexOf(a);if(b>-1){this.Items=this.Items.slice(0,b).concat(this.Items.slice(b+1,this.Items.length))}};this.Contains=function(a){if(this.IndexOf(a)>-1){return true}else{return false}};this.IndexOf=function(b){for(var a=0;a<this.Items.length;a++){if(this.Items[a]===b){return a}}return -1};this.Count=function(){return this.Items.length};this.Clear=function(){for(var a=0;a<this.Items.length;a++){this[a]=null}}},LogMIActivity:function(a){if(typeof(_gat)==="object"){var b=_gat._getTracker("UA-8425085-1");if(a===undefined){b._trackPageview()}else{b._trackPageview(a)}}},AjaxCall:function(b,h,e,c,g,d){var a=null;if(g!==null){a=function(k,i){e(k,i);try{Cwo.LogMIActivity(g)}catch(j){}}}else{a=function(j,i){e(j,i)}}this.timeout=Cwo.Common.GetCookie("SessionTimeout");if(this.timeout!==""){this.timeoutdate=new Date(this.timeout);this.currentTime=new Date();if(this.currentTime.getTime()>this.timeoutdate.getTime()){var f=Cwo.Common.GetCookie("PropertywideTrackerID");this.currentTime.setMinutes(this.currentTime.getMinutes()+TrackerSessionTimeoutPeriod);Cwo.SetSessionCookie("SessionTimeout",Cwo.GetCookieTime(this.currentTime));Cwo.AjaxCall("/webservices/UserAccount.asmx/TrackerIDRefresh","{ trackerID:'"+f+"'}",function(){Cwo.AjaxCall(b,h,e,c,g)},null,null)}else{if(h===null){h="{}"}$.ajax({type:"POST",url:b,data:h,contentType:"application/json; charset=utf-8",dataType:"json",success:a,error:function(j,i,k){if(c!==null){c()}else{if(!d){Cwo.Error.Popup("There was a problem","An unknown error occured. There may be a problem connecting to our website. Please wait a few minutes and try again.\n\n"+i+"\n\n"+j.responseText)}}}})}}}};Cwo.RegisterNamespace("Cwo.AutoComplete");Cwo.AutoComplete=function(d,k,b,j,s,u){var i=this;var f="waterMarkOn";var z="demandEntryWaterMarkOn";var y=$("#"+k);var a=$("#"+b);var g=$("#"+j);var n=b;var o=s;var e=u;var h="/webservices/AutoComplete.asmx/Lookup";var w=d;var m=$("#"+w);var q=$("#"+w+" li.Buying a");var x=$("#"+w+" li.Renting a");var v=$("#"+w+" li.FindAnAgent a");i.Visible=false;function r(){g.unbind("click");if(o==="ToLet"){g.bind("click",function(){i.ToLetSearch()});m.removeClass();m.addClass("Renting");$("#HomeSearchPredictiveText").focus()}else{if(o==="FindAnAgent"){g.bind("click",function(){i.AgentSearch()});m.removeClass();m.addClass("FindAnAgent");$("#HomeSearchPredictiveText").focus()}else{if(o==="Promotion"){g.bind("click",function(){i.PromotionSearch()})}else{g.bind("click",function(){i.ForSaleSearch()});m.removeClass();m.addClass("Buying");$("#HomeSearchPredictiveText").focus()}}}}function l(){var A=$("#"+n+" li.Selected");if(A.size()>0){A.next().addClass("Selected")}else{$("#"+n+" li:first").addClass("Selected")}A.removeClass("Selected")}function p(){var A=$("#"+n+" li.Selected");if(A.size()>0){A.prev().addClass("Selected")}else{$("#"+n+" li:last").addClass("Selected")}A.removeClass("Selected")}function t(){var A=$("#"+n+" li.Selected");if(A.size()>0){y.val(A.text());a.empty()}if(o==="ToLet"){i.ToLetSearch()}else{if(o==="Promotion"){i.PromotionSearch()}else{if(o==="FindAnAgent"){i.AgentSearch()}else{i.ForSaleSearch()}}}}function c(){var D=y.val();if(D.length===0){a.empty();if(i.Visible){i.Visible=false;Cwo.Page.EventController.FireEvent("SearchPredictiveBox.VisibilityChange.Invisible")}y.removeClass().addClass(f);return}y.removeClass(f);D=i.RemoveIllegalCharacters(D);var B=i.ValidCharacterCheck(D,D.length);D=D.replace(/['']/g,"\\'");var A=Cwo.Page.AjajCalls.CreateRequest("LocationSuggestion");var C="{'FormValue':'"+D+"'}";new Cwo.AjaxCall(h,C,function(E){i.Updated(E,A)},null,null,true)}this.KeyPressed=function(C){var A=C.keyCode?C.keyCode:C.which?C.which:C.charCode;var B={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};switch(A){case B.UP:p();break;case B.DOWN:l();break;case B.TAB:l();break;case B.RETURN:t();break;case B.ESC:a.empty();break;default:c();break}return};this.Updated=function(F,H){if(Cwo.Page.AjajCalls.IsCurrentSequenceIndex("LocationSuggestion",H)){var E=F.d;var I=y.val().length;var D="";a.empty();for(var A in E){if(E.length!==0){var B=E[A].Value;var G="<em>"+B.substr(0,I)+"</em>"+B.substr(I,B.length-I);var C=encodeURI(E[A].Value);if(o==="ToLet"){D="/rent/search/"+C}else{if(o==="FindAnAgent"){D="/findanagent/"+C;if(e!==null&&e!==""){if(typeof e!=="undefined"){D+="/"+e}}}else{if(o==="Promotion"&&typeof e!=="undefined"){D="/buy/search/"+C+"/p "+e+"/"}else{D="/buy/search/"+C}}}a.append('<li><a href="'+D+'">'+G+"</a></li>")}}if(!i.Visible){i.Visible=true;Cwo.Page.EventController.FireEvent("SearchPredictiveBox.VisibilityChange.Visible")}$("#"+n+" li:last").addClass("Last")}};this.RemoveIllegalCharacters=function(B){var A=new RegExp("\\\\","g");B=B.replace(A,"");B=B.replace(/[#%*{}+@:<>""|?]/g,"");B=B.replace(/[&]/g,"and");return B};this.ValidCharacterCheck=function(E,D){var B="";var C=false;for(var A=0;A<D;A++){B=E.charAt(A);B=B.match("^[a-zA-Z0-9!()-,_;~]$")?C=true:C=false;if(C===true){return true}}return C};this.ChangeSearchType=function(A){o=A;r();c()};this.ForSaleSearch=function(){var B=y.val();B=B.replace(/^\s+|\s+$/g,"");var A=i.RemoveIllegalCharacters(B);if(B.length>0){Cwo.Page.AjajCalls.CreateRequest("LocationSuggestion");window.location="/buy/search/"+encodeURI(A)}else{i.DemandEntry()}};this.ToLetSearch=function(){var B=y.val();B=B.replace(/^\s+|\s+$/g,"");var A=i.RemoveIllegalCharacters(B);if(B.length>0){Cwo.Page.AjajCalls.CreateRequest("LocationSuggestion");window.location="/rent/search/"+encodeURI(A)}else{i.DemandEntry()}};this.AgentSearch=function(){var C=y.val();C=C.replace(/^\s+|\s+$/g,"");var A=i.RemoveIllegalCharacters(C);if(C.length>0){Cwo.Page.AjajCalls.CreateRequest("LocationSuggestion");var B="/findanagent/"+encodeURI(A);if(e!==null&&e!==""){if(typeof e!=="undefined"){B+="/"+e}}window.location=B}else{i.DemandEntry()}};this.PromotionSearch=function(){var B=y.val();B=B.replace(/^\s+|\s+$/g,"");var A=i.RemoveIllegalCharacters(B);if(B.length>0){Cwo.Page.AjajCalls.CreateRequest("LocationSuggestion");window.location="/buy/search/"+encodeURI(A)+"/p "+e+"/"}else{i.DemandEntry()}};this.SetPlace=function(A){y.val(A);y.filter(function(){return A.length===0}).removeClass().addClass(f)};this.DemandEntry=function(){y.removeClass().addClass(z)};$(document).ready(function(){try{if($.browser.opera){y.bind("keypress",function(B){i.KeyPressed(B)})}else{y.bind("keyup",function(B){i.KeyPressed(B)})}if(y.val()===""){y.removeClass().addClass(f)}y.focus(function(){y.filter(function(){return y.val().length===0}).removeClass().addClass(f)}).blur(function(){y.filter(function(){return y.val().length===0}).removeClass().addClass(f)});q.bind("click",function(){i.ChangeSearchType("ForSale")});x.bind("click",function(){i.ChangeSearchType("ToLet")});v.bind("click",function(){i.ChangeSearchType("FindAnAgent")});r()}catch(A){Cwo.Error.TrackError(A)}})};Cwo.RegisterNamespace("Cwo.Common");function DebugObject(a){alert(JSON.stringify(a).replace(/,/g,",\n"))}Cwo.Common.SetCookie=function(c,a){var b=new Date();b.setDate(b.getDate()+365);document.cookie=c+"="+a+";expires="+b.toGMTString()};Cwo.Common.GetCookie=function(c){if(document.cookie.length>0){var b=document.cookie.indexOf(c+"=");if(b!==-1){b=b+c.length+1;var a=document.cookie.indexOf(";",b);if(a===-1){a=document.cookie.length}return decodeURIComponent(document.cookie.substring(b,a))}}return""};function AddCommas(c){c+="";var b=c.split(".");var a=b[0];var e=b.length>1?"."+b[1]:"";var d=/(\d+)(\d{3})/;while(d.test(a)){a=a.replace(d,"$1,$2")}return a+e}function FormatCurrency(c,a){var b=parseFloat(c);if(isNaN(b)){return"NaN"}else{var d=new Number(b);if(a){d=d.toFixed(0)}else{d=d.toFixed(2)}return AddCommas(d)}}function CWOTypeOf(a){var b=typeof a;if(b==="object"){if(a){if(typeof a.length==="number"&&!(a.propertyIsEnumerable("length"))&&typeof a.splice==="function"){b="array"}}else{b="null"}}return b}function Hashtable(){this.length=0;this.Keys=new Array();this.Index=new Array();for(var a=0;a<arguments.length;a+=2){if(typeof(arguments[a+1])!=="undefined"){this.Keys[arguments[a]]=arguments[a+1];this.length++}}this.Remove=function(b){var c;if(typeof(this.Keys[b])!=="undefined"){this.length--;c=this.Keys[b];delete this.Keys[b]}return c};this.GetItemAt=function(b){return this.Keys[this.Index[b]]};this.GetItem=function(b){return this.Keys[b]};this.Add=function(b,c){if(typeof(c)!=="undefined"){if(typeof(this.Keys[b])==="undefined"){this.length++}this.Keys[b]=c;this.Index[this.length-1]=b}return c};this.ContainsKey=function(b){return typeof(this.Keys[b])!=="undefined"}}var CWO_Common_Loaded=true;Cwo.RegisterNamespace("Cwo.Error");Cwo.Error.Popup=function(b,c){var a='<div id="GenericModal">';a+='<div class="Header"></div>';a+='<div class="Heading">';a+="<h2>An error has occurred</h2>";a+='<a href="#Close" class="simplemodal-close">Close</a>';a+="</div>";a+='<div class="Spacer"></div>';a+='<div class="Content">';a+="<div>"+b+"</div>";a+="<div>"+c+"</div>";a+='<div id="ErrorContinue"><a href="#Close" class="simplemodal-close">Continue</a></div>';a+="</div>";a+='<div class="Footer"></div>';a+="</div>";$("#ModalMessage").html(a);$("#BasicModalContent").modal();$(".simplemodal-close").bind("click",function(){$.modal.close()})};Cwo.Error.Modal=function(c){var b=c.GetDataByKey("message");if(b===undefined||b===null){b=""}else{b="<h3>"+b+"</h3>"}var e=c.GetDataByKey("messagedetail");if(e===undefined||e===null){e=""}else{e="<p>"+e+"</p>"}var f=c.GetArrayByKey("formfieldname");var a="";if(f===undefined||f===null||f.length===0){a=""}else{a="<ul>";for(var d=0;d<f.length;d++){a+="<li>"+f[d]+"</li>"}a+="</ul>"}$("div.Error").html(b+e+a).show()};Cwo.Error.Log=function(b,c,d,e){var a="/webservices/ExceptionInterface.asmx";var f={};(typeof(b)!=="undefined")?f.Error=b:f.Error="";(typeof(c)!=="undefined")?f.Url=c:f.Url="";(typeof(d)!=="undefined")?f.Line=d:f.Line="";(typeof(e)!=="undefined")?f.StackTrace=e.toString():f.StackTrace="";f.AppName=navigator.appName;f.AppVersion=navigator.appVersion;f.UserAgent=navigator.userAgent;new Cwo.AjaxCall(a+"/Exception",JSON.stringify(f),function(){},null,null);return true};Cwo.Error.TrackError=function(g){var d=this;var b="",c="",e="";var f={};for(var a in g){if(g.hasOwnProperty(a)){if(a==="message"){d.message=g[a]}if(a==="fileName"||a==="sourceURL"){d.url=g[a]}if(a==="lineNumber"||a==="line"){d.line=g[a]}if(a==="stack"){d.stack=g[a].toString()}}}Cwo.Error.Log(d.message,d.url,d.line,d.stack)};var jQueryBind=jQuery.fn.bind;jQuery.fn.bind=function(b,e,a){if(!a&&e&&typeof e==="function"){a=e;e=null}if(a){var d=a;var c=function(){try{d.apply(this,arguments)}catch(f){Cwo.Error.TrackError(f)}};a=c}return jQueryBind.call(this,b,e,a)};window.onerror=Cwo.Error.Log;Cwo.RegisterNamespace("Cwo.Favourites");Cwo.Favourites.FavouriteButtonHandler=function(b,g,f){var d=this;var i=b;var e=$("#"+g);var k=$("#FavouritesLink");var a=$("#FavouritesLink span");var c="/webservices/Favourites.asmx";var h="";var j=f;this.Add=function(){var l="{ InstructionID:"+i+"}";new Cwo.AjaxCall(c+"/AddFavourite",l,d.Added,null,null)};this.AddTransition=function(){e.effect("transfer",{to:k,className:"ResultsListingTransition"},600,null)};this.Added=function(l){a.text(l.d.FavouriteTotalRowCount)};this.Remove=function(){var l="{ InstructionID:"+i+"}";new Cwo.AjaxCall(c+"/RemoveFavourite",l,d.Removed,null,null)};this.Removed=function(q){$("#ListingContainer"+i).remove();a.text(q.d.FavouriteTotalRowCount);var m=$("#FavouritesTotalCount").text();var n=0;var p=9;var o=0;n=parseFloat((m-1)/p);if(parseFloat(Cwo.Search.Favourites.CurrentPage)===parseFloat(n)+1){o=Cwo.Search.Favourites.CurrentPage-1}else{o=Cwo.Search.Favourites.CurrentPage}var l=$("#HeaderOrderBy option:selected").val();Cwo.Search.Favourites.GetResults(o,l)};if(j==="remove"){e.click(function(){d.Remove()})}else{e.click(function(){d.AddTransition();d.Add()})}};Cwo.Favourites.BindFavouritesListClicks=function(){Cwo.Favourites.BindResultsListClicks("remove")};Cwo.Favourites.BindResultsListClicks=function(a){$(".FavouriteButton").each(function(){var c=$(this).attr("id");var b=c.replace(/[^\d]/g,"");new Cwo.Favourites.FavouriteButtonHandler(b,c,a)})};Cwo.RegisterNamespace("Cwo.Modal");Cwo.RegisterNamespace("Cwo.Validate");Cwo.Modal=function(f,b,i){var g=this;var c=$("#"+f);var e="BasicModalContent";var h=$("#ModalMessage");var a=b;var d="/webservices/Modal.asmx/SubmitModal";this.Close=function(j){$.modal.close()};this.LoadForm=function(j,l){scroll(0,0);$("#ModalMessage").html(j);$(".simplemodal-close").bind("click",function(){g.Close()});if((l!==null)&&(l!==undefined)){for(var m=0;m<l.length;m++){if(l[m].RegularExpression!==null){var k=$("#"+l[m].HtmlControlID);if(!k.is(":checkbox")&&!k.is(":radio")){new Cwo.Validation().Bind(l[m].HtmlControlID,l[m].RegularExpression)}}}}};this.GetData=function(n,m,l){for(var o=0;o<n.length;o++){var k=$("#"+n[o].HtmlControlID);if(k.is(":checkbox")){n[o].Value=k.is(":checked");n[o].RegularExpression=null}else{if(k.is(":radio")){n[o].Value=k.is(":checked");n[o].RegularExpression=null}else{n[o].Value=k.val()}}}if(new Cwo.Validation().ValidateFields(m,n,l)){for(var p=0;p<n.length;p++){n[p].RegularExpression=""}return JSON.stringify(n)}return null};this.Submit=function(m,j){var k='<div id="Header"></div>';k+='<div id="Message">';k+='<a href="#" class="simplemodal-close" title="Cancel">Cancel</a>';k+='<h5><img class="Loading" src="/images/loading.gif" alt="Loading" /></h5>';k+="<h6>Loading...</h6>";k+="</div>";k+='<div id="Footer"></div>';this.LoadForm(k,null);var l="{'Action':'"+m+"','Data':'"+j+"'}";new Cwo.AjaxCall("/webservices/Modal.asmx/SubmitModal",l,g.Response,null,null)};this.Response=function(j){if(j.d.ContentContainer.FormName!==undefined){Cwo.LogMIActivity(location.pathname+"contact/"+j.d.ContentContainer.FormName)}switch(j.d.ContentContainer.Action){case"LoadForm":new Cwo.Modal.Enquiry().Standard(g,j.d.ContentContainer);break;case"CloseModal":g.Close();break;case"Logout":new Cwo.Modal.Security().Logout(g,j.d.ContentContainer);break;case"Login":new Cwo.Modal.Security().Login(g,j.d.ContentContainer);break;case"LoggedIn":new Cwo.Modal.Security().LoggedIn(g,j.d.ContentContainer);break;case"LoginFailed":new Cwo.Modal.Security().LoginFailed(g,j.d);break;case"ForgottenPassword":new Cwo.Modal.Security().ForgottenPassword(g,j.d.ContentContainer);break;case"PasswordReset":new Cwo.Modal.Enquiry().Standard(g,j.d.ContentContainer);break;case"ForgottenPasswordFailed":new Cwo.Modal.Security().ForgottenPasswordFailed(g,j.d.ContentContainer);break;case"Signup":new Cwo.Modal.Security().Signup(g,j.d.ContentContainer);break;case"SignupFailed":new Cwo.Modal.Security().SignupFailed(g,j.d.ContentContainer);break;case"Signedup":new Cwo.Modal.Enquiry().Standard(g,j.d.ContentContainer);break;case"SaveSearchName":new Cwo.Modal.Personalisation().OpenSaveSearchDialogue(g,j.d.ContentContainer);break;case"SearchSaved":new Cwo.Modal.Personalisation().SaveSearchSuccess(g,j.d.ContentContainer,j.d.ErrorMessage);break;case"SaveSearchNameFailed":new Cwo.Modal.Personalisation().SaveSearchNameFailed(g,j.d.ContentContainer,j.d.ErrorMessage);break;case"EnquiryFailed":new Cwo.Modal.Enquiry().Standard(g,j.d.ContentContainer);new Cwo.Validation().ValidateFields("Oops your form had a problem.",j.d.ContentContainer.FormFields,true);break;case"ChangeEmail":new Cwo.Modal.Security().ChangeEmail(g,j.d.ContentContainer);break;case"ChangeEmailThanks":new Cwo.Modal.Enquiry().Standard(g,j.d.ContentContainer);break;case"ChangeEmailFailed":new Cwo.Modal.Security().ChangeEmailFailed(g,j.d.ContentContainer);break;case"ChangePassword":new Cwo.Modal.Security().ChangePassword(g,j.d.ContentContainer);break;case"ChangePasswordThanks":new Cwo.Modal.Enquiry().Standard(g,j.d.ContentContainer);break;case"ChangePasswordFailed":new Cwo.Modal.Security().ChangePasswordFailed(g,j.d.ContentContainer);break;case"FindAnAgent":var k=3;if(a==="BuyChainFreeContact"){k=1}new Cwo.Modal.Enquiry().FindAnAgent(g,j.d.ContentContainer,k);break;default:}};this.ShowErrors=function(j,k){$("#ModalErrorMessage").removeClass().addClass("Error").html("<h6>"+j+"</h6>");if(k!==null){for(var l=0;l<k.length;l++){$("#ModalErrorMessage").append("<p>"+k[l].Message+"</p>")}}};$(document).ready(function(){try{c.click(function(l){l.preventDefault();var k=$("#"+e);k.modal({onOpen:g.Submit(i,a),close:(false)})})}catch(j){Cwo.Error.TrackError(j)}})};Cwo.RegisterNamespace("Cwo.Modal.Enquiry");Cwo.Modal.Enquiry=function(){var b=this;var a=null;this.FormName=null;this.FormFields=null;this.Standard=function(d,c){a=d;this.FormName=c.FormName;this.FormFields=c.FormFields;a.LoadForm(c.Html,this.FormFields);$(".ModalContactButton").bind("click",function(){b.SubmitStandard()})};this.SubmitStandard=function(){var c=a.GetData(this.FormFields,"Oops...we can't submit your form because:",true);if(c!==null){a.Submit("SubmitEnquiryForm",this.FormName+","+c)}};this.FindAnAgent=function(e,c,d){a=e;this.FormName=c.FormName;this.FormFields=c.FormFields;a.LoadForm(c.Html,this.FormFields);$("#"+Cwo.ContactFindAnAgent.ControlIDs.ContactAgentButton).bind("click",function(){b.SubmitFindAnAgent()});Cwo.ContactFindAnAgent.BranchTypeID=d};this.SubmitFindAnAgent=function(){var c=0;var d="[";$("input.select-branch:checked").each(function(e){d+='{"ID":0,"Name":"BranchID","Value":"'+Cwo.ContactFindAnAgent.GetBranchId(this.id)+'","HtmlControlID":null,"IsRequired":false,"RegularExpression":null},';c++});if(c>0){d+=(JSON.stringify(this.FormFields)).substr(1);a.Submit("SubmitFindAnAgentForm",d)}else{alert("Please select a branch from the list.")}}};Cwo.RegisterNamespace("Cwo.Modal.Personalisation");Cwo.Modal.Personalisation=function(){var a=this;var b=null;this.mode="ToLet";if(Cwo.Search.ForSale!==undefined){this.mode="ForSale"}this.criteria=null;if(this.mode==="ToLet"){this.criteria=Cwo.Search.ToLet.Criteria}else{this.criteria=Cwo.Search.ForSale.Criteria}this.OpenSaveSearchDialogue=function(e,c){var f=a.SuggestedSearchName();b=e;var d=Cwo.Page.AjajCalls.CreateRequest("CheckExistsSaved"+a.mode+"Search");Cwo.AjaxCall("/webservices/savesearch.asmx/CheckExistsSaved"+a.mode+"Search",JSON.stringify(a.criteria),function(h,g){if(Cwo.Page.AjajCalls.IsCurrentSequenceIndex("CheckExistsSaved"+a.mode+"Search",d)){if(h.d.Success===true){a.ShowSaveSearchDialogue(e,c,h.d.ErrorMessage)}else{a.ShowSaveSearchDialogue(e,c,null,f)}}else{}},function(h,g,i){a.ShowSaveSearchDialogue(e,c,null,f)})};this.ShowSaveSearchDialogue=function(d,c,e,f){this.FormName=c.FormName;this.FormFields=c.FormFields;b.LoadForm(c.Html,this.FormFields);var g=$("#"+this.FormFields[0].HtmlControlID);if(f!==undefined){g.val(f)}if(e!==undefined&&e!==null){g.val(e);b.ShowErrors('This search is already saved, if you want to change the name do so below and hit "Save Search".',null)}g.focus();g.select();$("#SaveSearchNameButton").bind("click",function(){a.SubmitSaveSearch()})};this.SubmitSaveSearch=function(){a.criteria.SaveSearchName=$("#"+this.FormFields[0].HtmlControlID).val();var c=Cwo.Page.AjajCalls.CreateRequest("Save"+a.mode+"Search");Cwo.AjaxCall("/webservices/savesearch.asmx/Save"+a.mode+"Search",JSON.stringify(a.criteria),function(e,d){if(Cwo.Page.AjajCalls.IsCurrentSequenceIndex("Save"+a.mode+"Search",c)){if(e.d.ErrorMessage!==null){a.SaveSearchFailure(e.d.ErrorMessage)}else{a.SaveSearchSuccess(a.criteria.SaveSearchName)}}else{}},function(e,d,f){a.SaveSearchFailure("Problem Saving Your Search.<br><br>Sorry, we could not save your search at this time - 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.SaveSearchSuccess=function(c){b.Close();$("#GlobalListingToolsContainerOne").after('<div id="SavedSearchNotification"><div class="FadedBackground"><h6>Your search \''+c+"' has been saved.</h6></div></div>");window.setTimeout("$('#SavedSearchNotification').slideUp(800);",4000)};this.SaveSearchFailure=function(c){b.ShowErrors(c,null)};this.SuggestedSearchName=function(){var c=0;var d=0;if(this.mode==="ToLet"){c=Cwo.Search.ToLet.Criteria.RentalPriceMin;d=Cwo.Search.ToLet.Criteria.RentalPriceMax}else{d=Cwo.Search.ForSale.Criteria.AskingPriceMax;d=Cwo.Search.ForSale.Criteria.AskingPriceMax}var e="";e+=a.criteria.SearchString+" ";if(c>0){e+="from "+a.AbbreviatePrice(c)+" to "}else{e+="up to "}e+=a.AbbreviatePrice(d);return e};this.AbbreviatePrice=function(c){c=String(c);if(c.length>3){if(c.substr(c.length-3)==="000"){return c.substr(0,c.length-3)+"k"}}else{return c}}};Cwo.RegisterNamespace("Cwo.Modal.Security");Cwo.Modal.Security=function(){var b=this;var a=null;this.FormName=null;this.FormFields=null;this.Logout=function(d,c){this.FormName=c.FormName;a=d;a.Close=function(){$.modal.close();window.location.reload()};a.LoadForm(c.Html,null);$("#GlobalMainNavigationSignup, #GlobalMainNavigationLogin").parent().show();$("#GlobalMainNavigationProfile, #GlobalMainNavigationLogout").parent().hide();var e=$("#FavouritesLink span");e.text("0")};this.Login=function(d,c){a=d;this.FormName=c.FormName;this.FormFields=c.FormFields;a.LoadForm(c.Html,this.FormFields);$("#LoginButton").bind("click",function(){b.SubmitLogin()})};this.SubmitLogin=function(){var c=a.GetData(this.FormFields,"Oops...we can't find an email with the password you entered.");if(c!==null){a.Submit("SubmitLoginForm",c,false)}};this.LoggedIn=function(d,c){if(c.CookieExpiry!==null){document.cookie=c.CookieName+"="+encodeURIComponent(c.CookieValue)+";expires="+c.CookieExpiry+";path=/"}else{document.cookie=c.CookieName+"="+encodeURIComponent(c.CookieValue)+";path=/"}a=d;a.Close=function(){$.modal.close();window.location.reload()};a.LoadForm(c.Html,null);$("#GlobalMainLoginRegister li.Signup").css("display","none");$("#GlobalMainLoginRegister li.Login").css("display","none");$("#GlobalMainLoginRegister li.Profile").css("display","inline");$("#GlobalMainLoginRegister li.Logout").css("display","inline");var e=$("#FavouritesLink span");e.text(c.FavouritesCount)};this.LoginFailed=function(c,d){b.Login(c,d.ContentContainer);c.ShowErrors(d.ErrorMessage,null)};this.ForgottenPassword=function(d,c){a=d;this.FormName=c.FormName;this.FormFields=c.FormFields;a.LoadForm(c.Html,this.FormFields);$("#ResetPasswordButton").bind("click",function(){b.SubmitForgottenPassword()})};this.ForgottenPasswordFailed=function(d,c){b.ForgottenPassword(d,c);d.ShowErrors("Oops...we can't reset your password",Data.d.ContentContainer.Errors)};this.SubmitForgottenPassword=function(){var c=a.GetData(this.FormFields,"Oops...we can't submit your form because:");if(c!==null){a.Submit("SubmitForgottenPasswordForm",c,true)}};this.Signup=function(d,c){a=d;this.FormName=c.FormName;this.FormFields=c.FormFields;a.LoadForm(c.Html,this.FormFields);$("#SignupButton").bind("click",function(){b.SubmitSignup()});new Cwo.Validation().BindPasswordMatch("SignupFormPassword","SignupFormConfirmPassword");new Cwo.Validation().BindPasswordMatch("SignupFormEmail","SignupFormConfirmEmail")};this.SubmitSignup=function(){var c=a.GetData(this.FormFields,"Oops...we can't submit your form because:");if(c!==null){a.Submit("SubmitSignupForm",c,true)}};this.SignupFailed=function(d,c){b.Signup(d,c);d.ShowErrors("Ooops...we were unable to sign you up because:",c.Errors)};this.ChangeEmail=function(d,c){a=d;this.FormName=c.FormName;this.FormFields=c.FormFields;a.LoadForm(c.Html,this.FormFields);$("#SubmitButton").bind("click",function(){b.SubmitChangeEmail()})};this.SubmitChangeEmail=function(){var c=a.GetData(this.FormFields,"Oops...we can't submit your form because:",true);if(c!==null){a.Submit("SubmitChangeEmailForm",c)}};this.ChangeEmailFailed=function(d,c){b.ChangeEmail(d,c);d.ShowErrors("Oops...we can't change your email, you submitted invalid details",null)};this.ChangePassword=function(d,c){a=d;this.FormName=c.FormName;this.FormFields=c.FormFields;a.LoadForm(c.Html,this.FormFields);$("#SubmitButton").bind("click",function(){b.SubmitChangePassword()})};this.SubmitChangePassword=function(){var c=a.GetData(this.FormFields,"Oops...we can't submit your form because:",true);if(c!==null){a.Submit("SubmitChangePasswordForm",c)}};this.ChangePasswordFailed=function(d,c){b.ChangePassword(d,c);d.ShowErrors("Ooops...we were unable to change your password because:",c.Errors)}};Cwo.RegisterNamespace("Cwo.Page");Cwo.Page.BindPrintButtonClicks=function(a){$("."+a).bind("click",function(b){window.print()})};Cwo.Page.PreloadImage=function(b){var a=new Image();a.src=b};Cwo.Page.Browser=new function(){var a=this;this.IsIE6=false;jQuery.each(jQuery.browser,function(b,c){if((b==="msie")&&(jQuery.browser.version.substr(0,1)==="6")){a.IsIE6=true}})};Cwo.Page.NavigateWithReferrer=function(b){var a=document.createElement("a");if(typeof(a.click)==="undefined"){location.href=b}else{a.href=b;document.body.appendChild(a);a.click()}};Cwo.Page.AjajCalls=new function(){var a=new Object();this.IsCurrentSequenceIndex=function(c,b){if(parseInt(a[c],10)===parseInt(b,10)){return true}return false};this.CreateRequest=function(c){if(a[c]===undefined){a[c]=1}else{var b=a[c];a[c]=b+1}return parseInt(a[c],10)}};Cwo.RegisterNamespace("Cwo.Page.Footer");Cwo.Page.Footer.Current="Closed";Cwo.Page.Footer.Toggle=function(c){var a=$("#LocationGlossary");a.removeClass();var b="Closed";if(Cwo.Page.Footer.Current!==c){b=c}Cwo.Page.Footer.Current=b;a.addClass(b)};Cwo.Page.Footer.Click=new function(){try{$(document).ready(function(){$("#FooterLondonLink").bind("click",function(){Cwo.Page.Footer.Toggle("London")});$("#FooterUKLink").bind("click",function(){Cwo.Page.Footer.Toggle("UK")})})}catch(a){Cwo.Error.TrackError(a)}};Cwo.Page.EventController=new function(){var a=new Cwo.Collection();var b=function(d,c){this.EventName=d;this.Method=c};return{Subscribe:function(d,c){a.Add(new b(d,c))},FireEvent:function(d){for(var c=0;c<a.Count();c++){if(a.Items[c].EventName===d){a.Items[c].Method()}}}}};$(document).ready(function(){try{$("a.Print").bind("click",function(b){window.print();var c=_gat._getTracker("UA-8425085-1");c._trackPageview("/print/"+window.location.href)})}catch(a){Cwo.Error.TrackError(a)}});Cwo.RegisterNamespace("Cwo.Validation");Cwo.Validation=function(){var b=this;var a="url(/images/modal/check-tick.gif) no-repeat top right";var c="url(/images/modal/check-cross.gif) no-repeat top right";this.Bind=function(e,d,f){if((d===null)||(d.length===0)){return}var g=$("#"+e);g.bind("change",function(){b.CheckValid(e,d,f)});g.bind("keyup",function(){b.CheckValid(e,d,f)})};this.BindPasswordMatch=function(e,d){var g=$("#"+e);var f=$("#"+d);g.bind("change",function(){b.PasswordMatch(e,d)});g.bind("keyup",function(){b.PasswordMatch(e,d)});f.bind("change",function(){b.PasswordMatch(e,d)});f.bind("keyup",function(){b.PasswordMatch(e,d)})};this.BindPasswords=function(f,e,d){var h=$("#"+f);var g=$("#"+e);h.bind("change",function(){b.CheckValidPasswords(f,e,d)});h.bind("keyup",function(){b.CheckValidPasswords(f,e,d)});g.bind("change",function(){b.CheckValidPasswords(f,e,d)});g.bind("keyup",function(){b.CheckValidPasswords(f,e,d)})};this.CheckValid=function(e,d,f){var g=$("#"+e);var h=g.val();var i=new RegExp(d,"i");if(f===true){if((h==="")||(i.test(h))){g.css("background",a);return true}else{g.css("background",c);return false}}else{if(i.test(h)){g.css("background",a);return true}else{g.css("background",c);return false}}};this.MakeValid=function(d){var e=$("#"+d);e.css("background",a)};this.PasswordMatch=function(e,d){var g=$("#"+e);var f=$("#"+d);if(g.val()===f.val()){f.css("background",a);return true}else{f.css("background",c);return false}};this.CheckValidPasswords=function(h,e,d){var j=$("#"+h);var i=$("#"+e);var f=new RegExp(d);var g=true;if(j.val().length>0&&f.test(j.val())){j.css("background",a)}else{j.css("background",c);g=false}if(i.val().length>0&&f.test(i.val())){i.css("background",a)}else{i.css("background",c);g=false}if(g){if(j.val()===i.val()){j.css("background",a);i.css("background",a)}else{j.css("background",c);i.css("background",c);g=false}}return g};this.ValidateFields=function(e,h,f){var g=new Array();if((h!==null)&&(h!==undefined)){for(var d=0;d<h.length;d++){if((h[d].RegularExpression===null)||(h[d].RegularExpression.length===0)){continue}var l=new RegExp(h[d].RegularExpression);if((h[d].Value!==null)&&(h[d].Value!==undefined)){var m=$("#"+h[d].HtmlControlID);if(m.is(":checkbox")){alert(m.is(":checked"));h[d].Value=m.is(":checked")}else{h[d].Value=m.val()}}if(!l.test(h[d].Value)){var n=new Object();if(h[d].Name==="Message"){n.Message="Message is limited to 500 characters"}else{if(h[d].Name==="CurrentPassword"){n.Message="Existing Password is invalid"}else{if(h[d].Name==="NewPassword"){n.Message="New Password is invalid"}else{if(h[d].Name==="ConfirmPassword"){n.Message="Re-Entered Password is invalid"}else{n.Message=h[d].Name+" is invalid"}}}}g[g.length]=n}}}var j=false;var k=$("#TabbedFieldSet input[type='checkbox']");if(k.length>0){k.each(function(){if($(this).attr("checked")){j=true}})}else{j=true}if(!j){var n=new Object();n.Message="You must check one of the Service boxes";g[g.length]=n}if(g.length>0){if(f===false){g=null}new Cwo.Modal().ShowErrors(e,g);return false}else{return true}}};