var FCKeditor=function(b,d,a,c,e){this.InstanceName=b;this.Width=d||"100%";this.Height=a||"200";this.ToolbarSet=c||"Default";this.Value=e||"";this.BasePath=FCKeditor.BasePath;this.CheckBrowser=true;this.DisplayErrors=true;this.Config=new Object();this.OnError=null};FCKeditor.BasePath="/fckeditor/";FCKeditor.MinHeight=200;FCKeditor.MinWidth=750;FCKeditor.prototype.Version="2.6.3";FCKeditor.prototype.VersionBuild="19836";FCKeditor.prototype.Create=function(){document.write(this.CreateHtml())};FCKeditor.prototype.CreateHtml=function(){if(!this.InstanceName||this.InstanceName.length==0){this._ThrowError(701,"You must specify an instance name.");return""}var c="";if(!this.CheckBrowser||this._IsCompatibleBrowser()){c+='<input type="hidden" id="'+this.InstanceName+'" name="'+this.InstanceName+'" value="'+this._HTMLEncode(this.Value)+'" style="display:none" />';c+=this._GetConfigHtml();c+=this._GetIFrameHtml()}else{var b=this.Width.toString().indexOf("%")>0?this.Width:this.Width+"px";var a=this.Height.toString().indexOf("%")>0?this.Height:this.Height+"px";c+='<textarea name="'+this.InstanceName+'" rows="4" cols="40" style="width:'+b+";height:"+a;if(this.TabIndex){c+='" tabindex="'+this.TabIndex}c+='">'+this._HTMLEncode(this.Value)+"</textarea>"}return c};FCKeditor.prototype.ReplaceTextarea=function(){if(!this.CheckBrowser||this._IsCompatibleBrowser()){var c=document.getElementById(this.InstanceName);var b=document.getElementsByName(this.InstanceName);var a=0;while(c||a==0){if(c&&c.tagName.toLowerCase()=="textarea"){break}c=b[a++]}if(!c){alert('Error: The TEXTAREA with id or name set to "'+this.InstanceName+'" was not found');return}c.style.display="none";if(c.tabIndex){this.TabIndex=c.tabIndex}this._InsertHtmlBefore(this._GetConfigHtml(),c);this._InsertHtmlBefore(this._GetIFrameHtml(),c)}};FCKeditor.prototype._InsertHtmlBefore=function(c,b){if(b.insertAdjacentHTML){b.insertAdjacentHTML("beforeBegin",c)}else{var d=document.createRange();d.setStartBefore(b);var a=d.createContextualFragment(c);b.parentNode.insertBefore(a,b)}};FCKeditor.prototype._GetConfigHtml=function(){var a="";for(var b in this.Config){if(a.length>0){a+="&amp;"}a+=encodeURIComponent(b)+"="+encodeURIComponent(this.Config[b])}return'<input type="hidden" id="'+this.InstanceName+'___Config" value="'+a+'" style="display:none" />'};FCKeditor.prototype._GetIFrameHtml=function(){var c="fckeditor.html";try{if((/fcksource=true/i).test(window.top.location.search)){c="fckeditor.original.html"}}catch(b){}var a=this.BasePath+"editor/"+c+"?InstanceName="+encodeURIComponent(this.InstanceName);if(this.ToolbarSet){a+="&amp;Toolbar="+this.ToolbarSet}html='<iframe id="'+this.InstanceName+'___Frame" src="'+a+'" width="'+this.Width+'" height="'+this.Height;if(this.TabIndex){html+='" tabindex="'+this.TabIndex}html+='" frameborder="0" scrolling="no"></iframe>';return html};FCKeditor.prototype._IsCompatibleBrowser=function(){return FCKeditor_IsCompatibleBrowser()};FCKeditor.prototype._ThrowError=function(b,a){this.ErrorNumber=b;this.ErrorDescription=a;if(this.DisplayErrors){document.write('<div style="COLOR: #ff0000">');document.write("[ FCKeditor Error "+this.ErrorNumber+": "+this.ErrorDescription+" ]");document.write("</div>")}if(typeof(this.OnError)=="function"){this.OnError(this,b,a)}};FCKeditor.prototype._HTMLEncode=function(a){if(typeof(a)!="string"){a=a.toString()}a=a.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return a};(function(){var a=function(b){var c=new FCKeditor(b.name);c.Width=Math.max(b.offsetWidth,FCKeditor.MinWidth);c.Height=Math.max(b.offsetHeight,FCKeditor.MinHeight);return c};FCKeditor.ReplaceAllTextareas=function(){var b=document.getElementsByTagName("textarea");for(var e=0;e<b.length;e++){var f=null;var c=b[e];var d=c.name;if(!d||d.length==0){continue}if(typeof arguments[0]=="string"){var g=new RegExp("(?:^| )"+arguments[0]+"(?:$| )");if(!g.test(c.className)){continue}}else{if(typeof arguments[0]=="function"){f=a(c);if(arguments[0](c,f)===false){continue}}}if(!f){f=a(c)}f.ReplaceTextarea()}}})();function FCKeditor_IsCompatibleBrowser(){var sAgent=navigator.userAgent.toLowerCase();if(
/*@cc_on!@*/
false&&sAgent.indexOf("mac")==-1){var sBrowserVersion=navigator.appVersion.match(/MSIE (.\..)/)[1];return(sBrowserVersion>=5.5)}if(navigator.product=="Gecko"&&navigator.productSub>=20030210&&!(typeof(opera)=="object"&&opera.postError)){return true}if(window.opera&&window.opera.version&&parseFloat(window.opera.version())>=9.5){return true}if(sAgent.indexOf(" adobeair/")!=-1){return(sAgent.match(/ adobeair\/(\d+)/)[1]>=1)}if(sAgent.indexOf(" applewebkit/")!=-1){return(sAgent.match(/ applewebkit\/(\d+)/)[1]>=522)}return false}myDeco.characterCounter={init:function(){var a=this;function b(h){var f=$(h.target),d=f.data("max"),c=f.data("counter"),g=f.val(),e=d-g.length;if(e>=0){c.text(e)}else{f.val(g.substring(0,d))}}$("textarea.charcounter").each(function(f,e){e=$(e);var d=parseInt(e.attr("cols")||100)*parseInt(e.attr("rows")||10),c=$("#"+e.identify()+"-character-counter");if(c.size()>0){e.data("max",d).data("counter",c).keyup(b).keyup()}})},initFck:function(a){var d=this,c=$("#"+a.Name),b=c.data("max");function e(h){var i=a.GetData(true),j="",g=0;if(jQuery.browser.msie){j=a.EditorDocument.body.innerText}else{var f=a.EditorDocument.createRange();f.selectNodeContents(a.EditorDocument.body);j=f.toString()}c.val(j);g=b-j.length;if(g>=0){c.data("counter").text(g)}else{a.Commands.GetCommand("Undo").Execute()}}if(c.size()>0){$(a.EditorDocument).keyup(e).keyup()}}};function FCKeditor_OnComplete(a){myDeco.characterCounter.initFck(a)}$(myDeco.characterCounter.init.bind(myDeco.characterCounter));myDeco.bubbles={create:function(d,f){function e(g){$(g.target).closest(".bubble").fadeOut()}var c=d,b=$(document.body).append('<div class="bubble" style="display:none"><div class="rounded"><p>'+f+'</p></div><div class="bubble-tip"></div></div>').children(":last");if(d.is("textarea:hidden")&&d.prev(":first").is("iframe")){c=d.prev(":first")}var a=c.offset();if(d.hasClass("right")){b.addClass("bubble-right").css({left:(a.left-b.outerWidth()-15)+"px",top:a.top+"px"})}else{b.css({left:(a.left+d.outerWidth()+15)+"px",top:a.top+"px"})}if(myDeco.browser.isIE6){b.append(document.createTextNode(" "))}b.click(e).fadeIn();return b}};myDeco.formValidation={init:function(){var a=this;$("form.validate").submit(function(b){return a.validate($(b.target))})},validate:function(c){var a=this,b=false;c.find(".validate").each(function(){var d=$(this),e=a.isInvalid(d);if(d.data("bubble")){d.data("bubble").remove();d.removeData("bubble")}if(e){d.data("bubble",myDeco.bubbles.create(d,e));b=true}});return !b},isInvalid:function(e){var f=e.val();if(e.hasClass("v-required")&&f==""){return"Please ensure each field is complete before you re-submit."}if(e.hasClass("v-required-inbox")&&f==""){return"Oops! You forgot your message!"}if(e.hasClass("v-email")&&!this.validateEmail(f)){return"We'd love you to bend the rules in room design, but not in our forms! Sorry, our system doesn't recognise your email address. Please check and try again."}if(e.hasClass("v-password")&&!this.validatePassword(f)){return"Passwords must be 5-15 characters and may contain numbers, letters and underscores."}if(e.hasClass("v-passwordconfirm")&&!this.validatePasswordConfirm(f)){return"Your passwords must match."}if(e.hasClass("v-date")&&!this.validateDate(f)){return"Must be a valid date of the form dd/mm/yyyy. Eg: 19/09/2007"}if(e.hasClass("v-url")&&!this.validateUrl(f)){return"Please enter a valid url."}var c="v-word-length-",d=e.get(0).className,b=d.indexOf(c);if(b!=-1){var g=d.indexOf(" ",b);if(g==-1){g=d.length}var a=parseInt(d.substr(b+c.length,g));if(!this.validateWordLength(f,a)){return"Oops! Please make sure words in your comment do not exceed "+a+" characters in length."}}if(e.hasClass("v-no-html")&&!this.validateNoHTML(f)){return"Should not contain any HTML-like tags"}return false},validateEmail:function(a){return/^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/.test(a)},validatePassword:function(a){return/^[a-zA-Z]\w{3,14}$/.test(a)},validatePasswordConfirm:function(a){return $("#sign-up-password1, #id_password1").val()==a},validateDate:function(a){return/(((0[13578]|10|12)([-.\/])(0[1-9]|[12][0-9]|3[01])([-.\/])(\d{4}))|((0[469]|11)([-.\/])([0][1-9]|[12][0-9]|30)([-.\/])(\d{4}))|((2)([-.\/])(0[1-9]|1[0-9]|2[0-8])([-.\/])(\d{4}))|((2)(\.|-|\/)(29)([-.\/])([02468][048]00))|((2)([-.\/])(29)([-.\/])([13579][26]00))|((2)([-.\/])(29)([-.\/])([0-9][0-9][0][48]))|((2)([-.\/])(29)([-.\/])([0-9][0-9][2468][048]))|((2)([-.\/])(29)([-.\/])([0-9][0-9][13579][26])))/.test(a)},validateUrl:function(a){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(a)},validateWordLength:function(c,b){var e=c.split(" ");for(var d=0,a=e.length;d<a;d++){if(e[d].length>b){return false}}return true},validateNoHTML:function(a){return !/<[a-zA-Z]+(\s[^>]*)?>/.test(a)}};$(myDeco.formValidation.init.bind(myDeco.formValidation));myDeco.followers={init:function(b){var a=this,c=[];if(b==undefined||typeof b=="function"){b=$(document.body)}if(!myDeco.username){b.find(".follow-switcher").hide();return}b.find(".follow-switcher a.follow, .follow-switcher a.following").click(this._setState.bindAsEventListener(this));b.find(".follower-"+myDeco.userid).hide();b.find(".follow-switcher").each(function(){var d=a._extractUserID(this.className);if(d!=myDeco.userid){c.push(d)}});if(c.length>0){$.ajax({url:myDeco.urls.friendFollow,data:$.param({id:$.unique(c),_nc:new Date().valueOf()}),dataType:"json",type:"get",success:function(d){if(d.success==true){$.each(c,function(g,f){var e=b.find(".follower-"+f+" .following, .follower-"+f+" .follow");if($.inArray(parseInt(f),d.followed_users)!=-1){e.filter(".following").css("display","block")}else{e.filter(".follow").css("display","block")}})}}})}},_setState:function(b,c){var a=$(b.target).closest("a");if(a.hasClass("no-change")){return false}if(!myDeco.username){document.location=myDeco.urls.userLogin+"?next="+encodeURI(document.location);return}var d=this._extractUserID(a.parents(".follow-switcher").attr("class")),c=a.hasClass(".follow");$.ajax({url:myDeco.urls.friendFollow,data:"id="+d+"&action="+(c?"follow":"delete"),dataType:"json",type:"post",success:function(f){if(f.success==true){var e=$(".follower-"+d+" .follow, .follower-"+d+" .following");if(c){e.filter(".follow").hide().end().filter(".following").css("display","block")}else{e.filter(".following").hide().end().filter(".follow").css("display","block")}}}});return false},_extractUserID:function(a){return a.match(/follower\-(\d+)/)[1]}};$(myDeco.followers.init.bind(myDeco.followers));myDeco.closable={_observers:{close:null,toggle:null,beforeClose:[]},init:function(a){if(!this._observers.close){this._observers.close=this._close.bind(this);this._observers.toggle=this._toggle.bind(this)}this.create($(".closable"))},create:function(b){var a=this;b.each(function(f,e){e=$(e);var d=!e.hasClass("no-hide");var c=e.find("a.close-square");if(c.size()==0){c=e.append('<a href="#" class="close-square"'+(d?' style="display:none"':"")+"></a>").find("a.close-square:first")}if(d){e.hover(a._observers.toggle,a._observers.toggle)}c.click(a._observers.close)})},addObserver:function(a){if(typeof a!=="object"){return}if($.isFunction(a.beforeClose)){this._observers.beforeClose.push(a.beforeClose)}},_toggle:function(b){var a=$(b.target).closest(".closable").find("a.close-square:first");b.type=="mouseenter"?a.show():a.hide()},_close:function(e){var b=this,d=$(e.target),c=d.parents(".closable:first"),a=true;$.each(this._observers.beforeClose,function(f,g){if(g(c,b)===false){a=false;return false}});if(a){this.close(c)}return false},close:function(a){a.fadeOut(500,a.remove)}};addLoadEvent(myDeco.closable.init.bind(myDeco.closable));myDeco.forums={defaults:{searchText:"Enter a keyword or phrase"},init:function(){var d=$("#search-threads"),e=$("#search-threads-where"),c=$("#new-thread-form"),b=this;if(myDeco.username){$(".logged-forum-link").each(function(h,j){j=$(j);var g=j.attr("href").split("/"),f=g[g.length-2];j.attr("href",myDeco.urls.forumsUserListView+myDeco.username+"/"+f+"/");if(document.location.pathname.indexOf(j.attr("href"))==0){j.addClass("active");$(".logged-forum-link-text").html(j.html())}});var a=$("#follow-thread");if(a.size()>0){$.ajax({url:a.attr("href"),data:"op=check",dataType:"json",type:"post",success:function(f){if(f.success){b.setFollowStatus(a,f.followed);a.show()}}});a.click(this.toggleFollowing.bindAsEventListener(this))}myDeco.closable.addObserver({beforeClose:function(f){b.updateFollowStatus(f.find("a.close-square").attr("href"),f,false);return false}});$(".rich-editor").each(function(){var f=new FCKeditor($(this).identify());f.ToolbarSet="MyDeco";f.BasePath=myDeco.urls.fckeditor;f.Config.CustomMediaURL=f.BasePath;f.Config.SkinPath=f.BasePath+"editor/skins/office2003/";f.Config.EditorAreaCSS=f.BasePath+"editor/css/fck_editorarea.css";f.ReplaceTextarea()});if(c.size()>0){$(".publish, .preview, .edit").click(function(h){var f=$(h.target).closest("a"),g="publish";if(f.hasClass("preview")){g="preview"}else{if(f.hasClass("edit")){g="edit"}}c.find("input[name=op]").val(g);c.submit();return false})}}d.submit(function(h){if(e.size()>0){var g=e.val(),f=$("#search-threads-query").val();if(g){g=g+"&query="+f}else{g=d.attr("action")+"?query="+f}document.location=g;return false}});e.htmlDropdown();$("#search-query, #search-threads-query").defaultValue(this.defaults.searchText);if(myDeco.browser.isIE6){$(".thread-content img").each(function(g,f){f=$(f);if(f.width()>576){f.width(576)}})}},toggleFollowing:function(b){var a=$(b.target);this.updateFollowStatus(a.attr("href"),a,a.hasClass("follow"));return false},updateFollowStatus:function(c,d,a){var b=this;$.ajax({url:c,data:{op:a?"follow":"unfollow"},dataType:"json",type:"post",success:function(){if(d.hasClass("closable")){if(d.siblings(".closable").size()<=1){var e=document.location+"",f=e.match(/page=(\d+)/);if(f){f=parseInt(f[1]);e=(f>2)?e.replace("page="+f,"page="+(f-1)):e.replace("page="+f,"")}document.location=myDeco.addCacheMissParam(e)}else{myDeco.closable.close(d)}}else{b.setFollowStatus(d,a)}},failure:function(){myDeco.popupForms.alert("An unexpected error occurred. Please try again.")}})},setFollowStatus:function(b,a){if(a){b.text("Stop following this thread").removeClass("follow").addClass("following")}else{b.text("Follow this thread").removeClass("following").addClass("follow")}}};$(myDeco.forums.init.bind(myDeco.forums));