var App=App||{};App.i18n=App.i18n||{};(function(){App.getParam=function(name){var regex=new RegExp("[?|&]"+name+"="+"([^&;]+?)(&|#|;|$)"),parentWindow=window.parent===window.top?window.parent:window.parent.parent,results=null;try{results=regex.exec(parentWindow.location.search)}catch(e){}if(results&&results[1]){return decodeURIComponent(results[1])}return null};App.flow=function(state,data,topFrame){var flowEngineUrl=App.frontEndBucket.protocol+"://flow."+App.brand.domain+"/"+state;$.ajax(flowEngineUrl,{async:true,data:data,dataType:"jsonp",success:function(response){var redirectUrl=response.url;if(topFrame){window.top.location.href=redirectUrl;return}window.location.href=redirectUrl}})};App.t=function(key,fallback){var $lib=$||bk$,translateIt=App.getParam("translate"),base=fallback||"",parts,section,args,translated,values="DEFAULT",keypart,thisTrans;if(key){parts=key.split(".");section=parts.shift();keypart=parts.join(".")}if(typeof App.i18n[section]!=="undefined"&&typeof App.i18n[section][keypart]!=="undefined"){if(App.i18n[section][keypart].length>0){base=App.i18n[section][keypart]}}args=[].slice.call(arguments,1);args=$lib.map(args,function(n){return n});translated=base.replace(/%([0-9]+)/g,function(match,found,offset,original){return args[found]!==undefined?args[found]:""});if(translateIt==="debugvalues"){thisTrans=App.i18n[section]!==undefined&&App.i18n[section][keypart]!==undefined?App.i18n[section][keypart]:undefined;if(thisTrans===""){values="MASTER"}else if(thisTrans){values="TRANSLATED"}return values}else if(translateIt==="debugkeys"){return key}return translated};App.formatUrl=function(string){if(typeof string==="string"){string=string.replace(/[^a-zA-Z0-9 -]/g,"").replace(/\s+/g,"-").toLowerCase();return string.charAt(string.length-1)==="-"?string.substring(0,string.length-1):string}};App.formatBlogDate=function(iso_date,lang){var locale=lang||App.user.languageCode,formatted;if(typeof iso_date!=="string"){return false}formatted=moment(iso_date).lang(locale).format("DD MMMM YYYY");return formatted};App.getPHPDate=function(format,date){var d=new Date(date);if(typeof format!=="string"){format="c"}return d.format(format)};App.render=function(templateName,callback){var constructor=window[templateName];if(typeof constructor==="function"){callback(generateTemplateCallbackClosure(constructor))}else{loadTemplateFromServer(templateName,function(constructor){if(typeof constructor!=="function"){throw new Error("Failed to load template: "+templateName)}callback(generateTemplateCallbackClosure(constructor))})}};App.templateQueues={};function generateTemplateCallbackClosure(templateConstructor){return function(parameters){return Twig.render(templateConstructor,parameters)}}function loadTemplateFromServer(templateName,callback){if(typeof App.templateQueues[templateName]==="undefined"){App.templateQueues[templateName]=[callback];sendTemplateRequest(templateName)}else{App.templateQueues[templateName].push(callback)}}function sendTemplateRequest(templateName){var templateUrl=App.assetBaseUrl()+"/twig-templates/"+templateName;$.ajax({url:templateUrl,cache:false,dataType:"script",success:function(){processTemplateQueue(templateName)}})}function processTemplateQueue(templateName){var constructor=window[templateName];while(App.templateQueues[templateName].length>0){App.templateQueues[templateName].shift()(constructor)}}App.getErrorsFromResponse=function(response){var phraseAppNameSpace="global_v7.errors.",errorMessages=[],responseObj;if(response.responseText){responseObj=jQuery.parseJSON(response.responseText);if(responseObj.messageTemplates){$.each(responseObj.messageTemplates,function(field,errorTemplates){$.each(errorTemplates.templates,function(type,template){var replacements=[],args=[phraseAppNameSpace+type,template],message,messageObj={};if(errorTemplates.values){$.each(errorTemplates.values[type],function(i,stringValue){replacements.push(stringValue)})}args=args.concat(replacements);message=App.t.apply(App,args);messageObj.field=field;messageObj.message=message;errorMessages.push(messageObj)})})}}return errorMessages};App.mixpanelTrack=function(trackName,mpVars){var deferred=jQuery?jQuery.Deferred():bk$.Deferred(),mixpanelEnv,userRef,userEmail,subscriptionPackageRef,mixpanelUserId,baseObject,tracker;try{if(App&&App.frontEndBucket&&App.frontEndBucket.mixpanelToken){baseObject=App;tracker=mixpanel}else if(window.parent&&window.parent.App&&window.parent.App.frontEndBucket&&window.parent.App.frontEndBucket.mixpanelToken){baseObject=window.parent.App;tracker=window.parent.mixpanel}else{return deferred.resolve()}}catch(err){return deferred.resolve()}mixpanelEnv=baseObject.frontEndBucket.mixpanelEnv;userRef=baseObject.user.ref;userEmail=baseObject.user.email;subscriptionPackageRef=baseObject.user.subscriptionPackageRef;mixpanelUserId=mixpanelEnv+"-"+userRef;if(baseObject.hasOwnProperty("brand")&&baseObject.brand.capabilities.mixPanelTracking==="0"){return deferred.resolve()}if(mixpanelEnv!==undefined&&mixpanelEnv&&userEmail.match(/@basekit\.com$/i)===null){tracker.register({userRef:userRef,primaryDomain:getSitePrimaryDomain(),subscriptionPackageRef:subscriptionPackageRef,env:mixpanelEnv,brand:baseObject.brand.name});tracker.identify(mixpanelUserId);tracker.track(trackName,mpVars,function(){deferred.resolve()})}else{return deferred.resolve()}return deferred.promise()};App.stripUrlScheme=function(url){if(typeof url==="string"){return url.replace(/^http:/,"")}else{return url}};App.getPort=function(){var port="",parts=window.location.href.split(":"),lastPart,https=window.location.href.substr(0,5)==="https";if(parts.length===3){lastPart=parts[2].replace(/[^0-9]/,"");if(!https&&lastPart!=="80"){port=lastPart}else if(https&&lastPart!=="443"){port=lastPart}}return port};App.assetBaseUrl=function(protocol){var port;if(protocol==="//"){return"//"+App.frontEndBucket.assetDomain+"/"+App.frontEndBucket.assetVersion}if(typeof protocol==="undefined"){protocol=App.frontEndBucket.protocol}port=App.getPort();return protocol+"://"+App.frontEndBucket.assetDomain+(port!==""?":"+port:"")+"/"+App.frontEndBucket.assetVersion};function getSitePrimaryDomain(){var primaryDomain="";if(window.Editor){primaryDomain=Editor.Site.primaryDomain}else if(window.parent.Editor){primaryDomain=window.parent.Editor.Site.primaryDomain}else if(window.App){if(window.App.site&&window.App.site.primaryDomain){primaryDomain=window.App.site.primaryDomain.domainName}}else if(window.parent.App){if(window.parent.App.site&&window.parent.App.site.primaryDomain){primaryDomain=window.parent.App.site.primaryDomain.domainName}}return primaryDomain}})();BaseKit={Util:{},Widget:{},Globals:{},Panels:{},Settings:{},siteLibraryProvider:function(){return window.parent}};if(typeof Marionette!=="undefined"){BaseKit.App=new Marionette.Application}BaseKit.Util.extend=function(plugin,methods){if(typeof bk$==="object"){bk$.extend(true,plugin.prototype,methods)}else{$.extend(true,plugin.prototype,methods)}};BaseKit.Util.handleMobileWebkit=function($selector){var ua=navigator.userAgent,isAndroidChrome=new RegExp(" AppleWebKit/").test(ua)&&new RegExp(" Android").test(ua)&&new RegExp(" Mobile").test(ua),isWebKitMobile=new RegExp(" AppleWebKit/").test(ua)&&new RegExp(" Mobile/").test(ua);if(!isWebKitMobile&&!isAndroidChrome){return}$selector.addClass("mobile-webkit")};BaseKit.Util.expandException=function(exception){var error=null,prop=null,expanded="";for(prop in exception){if(exception.hasOwnProperty(prop)){expanded+="property: "+prop+" value: ["+exception[prop]+"]\n"}}expanded+=" value: ["+exception.toString()+"]";return expanded};BaseKit.Util.debug=false;BaseKit.Util.waitsFor=function(testMethod,callbackSuccess,callbackFail,timeoutMS){var clock=-10,intervalPeriod=10,interval=null,result=false;if(typeof testMethod!=="function"){if(BaseKit.Util.debug===true){console.log("-> typeof testMethod: "+typeof testMethod)}throw new Error("waitsFor: testMethod is not a function")}if(typeof timeoutMS!=="number"||timeoutMS<=10||timeoutMS>9e4){if(BaseKit.Util.debug===true){console.log("-> typeof timeoutMS: "+typeof timeoutMS);console.log("-> range[10ms-90000ms] timeoutMS: "+timeoutMS)}throw new Error("waitsFor: timeoutMS is not valid; range[10ms-90000ms]")}if(typeof callbackSuccess!=="function"){if(BaseKit.Util.debug===true){console.log("-> typeof callbackSuccess: "+typeof callbackSuccess)}throw new Error("waitsFor: callbackSuccess is not a function")}if(typeof callbackFail!=="function"){if(BaseKit.Util.debug===true){console.log("-> typeof callbackFail: "+typeof callbackSuccess)}throw new Error("waitsFor: callbackFail is not a function")}interval=setInterval(function(){clock+=intervalPeriod;if(clock>=timeoutMS){clearInterval(interval);if(BaseKit.Util.debug===true){console.log("timeout exceeded after: "+clock+"ms >="+timeoutMS+"ms")}return callbackFail()}try{result=testMethod();if(BaseKit.Util.debug===true){console.log("test called; result = "+result)}}catch(exception){if(BaseKit.Util.debug===true){console.log("test crashed after "+clock+"ms")}clearInterval(interval);result=false;throw new Error("waitsFor: testMethod bombed!\n"+BaseKit.Util.expandException(exception))}if(result===true){if(BaseKit.Util.debug===true){console.log("test returned succeeded after: "+clock+"ms")}clearInterval(interval);return callbackSuccess()}return true},intervalPeriod)};String.prototype.ucfirst=function(){var f=this.charAt(0).toUpperCase();return f+this.substr(1)};String.prototype.toCamelCase=function(){return this.replace(/(\.[a-z])/g,function(txt){return txt.toUpperCase().replace(".","")})};String.prototype.toWidgetTitleCase=function(){return this.replace("."," ").replace(/\w\S*/g,function(txt){return txt.charAt(0).toUpperCase()+txt.substr(1).toLowerCase()}).replace(" ",".")};(function(){Date.shortMonths=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Date.longMonths=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.shortDays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];Date.longDays=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];var replaceChars={d:function(){return(this.getDate()<10?"0":"")+this.getDate()},D:function(){return Date.shortDays[this.getDay()]},j:function(){return this.getDate()},l:function(){return Date.longDays[this.getDay()]},N:function(){return this.getDay()===0?7:this.getDay()},S:function(){return this.getDate()%10===1&&this.getDate()!==11?"st":this.getDate()%10===2&&this.getDate()!==12?"nd":this.getDate()%10===3&&this.getDate()!==13?"rd":"th"},w:function(){return this.getDay()},z:function(){var d=new Date(this.getFullYear(),0,1);return Math.ceil((this-d)/864e5)},W:function(){var target=new Date(this.valueOf());var dayNr=(this.getDay()+6)%7;target.setDate(target.getDate()-dayNr+3);var firstThursday=target.valueOf();target.setMonth(0,1);if(target.getDay()!==4){target.setMonth(0,1+(4-target.getDay()+7)%7)}return 1+Math.ceil((firstThursday-target)/6048e5)},F:function(){return Date.longMonths[this.getMonth()]},m:function(){return(this.getMonth()<9?"0":"")+(this.getMonth()+1)},M:function(){return Date.shortMonths[this.getMonth()]},n:function(){return this.getMonth()+1},t:function(){var d=new Date;return new Date(d.getFullYear(),d.getMonth(),0).getDate()},L:function(){var year=this.getFullYear();return year%400===0||year%100!==0&&year%4===0},o:function(){var d=new Date(this.valueOf());d.setDate(d.getDate()-(this.getDay()+6)%7+3);return d.getFullYear()},Y:function(){return this.getFullYear()},y:function(){return(""+this.getFullYear()).substr(2)},a:function(){return this.getHours()<12?"am":"pm"},A:function(){return this.getHours()<12?"AM":"PM"},B:function(){return Math.floor(((this.getUTCHours()+1)%24+this.getUTCMinutes()/60+this.getUTCSeconds()/3600)*1e3/24)},g:function(){return this.getHours()%12||12},G:function(){return this.getHours()},h:function(){return((this.getHours()%12||12)<10?"0":"")+(this.getHours()%12||12)},H:function(){return(this.getHours()<10?"0":"")+this.getHours()},i:function(){return(this.getMinutes()<10?"0":"")+this.getMinutes()},s:function(){return(this.getSeconds()<10?"0":"")+this.getSeconds()},u:function(){var m=this.getMilliseconds();return(m<10?"00":m<100?"0":"")+m},e:function(){return"Not Yet Supported"},I:function(){var DST=null;for(var i=0;i<12;i+=1){var d=new Date(this.getFullYear(),i,1);var offset=d.getTimezoneOffset();if(DST===null){DST=offset}else if(offsetDST){break}}return this.getTimezoneOffset()===DST|0},O:function(){return(-this.getTimezoneOffset()<0?"-":"+")+(Math.abs(this.getTimezoneOffset()/60)<10?"0":"")+Math.abs(this.getTimezoneOffset()/60)+"00"},P:function(){return(-this.getTimezoneOffset()<0?"-":"+")+(Math.abs(this.getTimezoneOffset()/60)<10?"0":"")+Math.abs(this.getTimezoneOffset()/60)+":00"},T:function(){return this.toTimeString().replace(/^.+ \(?([^\)]+)\)?$/,"$1")},Z:function(){return-this.getTimezoneOffset()*60},c:function(){return this.format("Y-m-d\\TH:i:sP")},r:function(){return this.toString()},U:function(){return this.getTime()/1e3}};Date.prototype.format=function(format){var date=this;return format.replace(/(\\?)(.)/g,function(_,esc,chr){return esc===""&&replaceChars[chr]?replaceChars[chr].call(date):chr})}}).call(this);(function(){var e=void 0,g=!0,i=null,l=!1;function m(a){return function(){return this[a]}}var n,p=this;function q(a,b,c){a=a.split(".");c=c||p;!(a[0]in c)&&c.execScript&&c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)!a.length&&b!==e?c[d]=b:c=c[d]?c[d]:c[d]={}}function r(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function s(a){return"array"==r(a)}function t(a){return"string"==typeof a}function u(a){var b=typeof a;return"object"==b&&a!=i||"function"==b}var v="closure_uid_"+Math.floor(2147483648*Math.random()).toString(36),w=0;function x(a,b,c){return a.call.apply(a.bind,arguments)}function y(a,b,c){if(!a)throw Error();if(2/g,E=/\"/g,F=/[&<>\"]/,G={"\x00":"\\0","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"," ":"\\x0B",'"':'\\"',"\\":"\\\\"},H={"'":"\\'"};function I(a,b){a!=i&&this.append.apply(this,arguments)}I.prototype.b="";I.prototype.append=function(a,b,c){this.b+=a;if(b!=i)for(var d=1;dc?Math.max(0,a.length+c):c;if(t(a))return!t(b)||1!=b.length?-1:a.indexOf(b,c);for(;c(){}^$=!|:-]/g,"\\$&")}function X(a){this.env_=a;this.c=[];this.m={}}n=X.prototype;n.s=m("c");n.C=function(a){this.c=a};n.K=function(a){this.m=a};n.getParent=function(a){a=this.getParent_(a);return l===a?l:this.env_.d(a)};n.B=function(a,b,c){if(a in this.m){var d=new I;this.m[a](d,b,c||{});return d.toString()}d=this.getParent(b);if(l!==d)return d.k(a,b,c);throw Error("The template '"+this.o()+"' has no parent, and no trait defining the block '"+a+"'.")};n.k=function(a,b,c){if(c&&a in c){var d=new I,f=c[a];delete c[a];f(d,b,c);return d.toString()}if(a in this.c)return d=new I,this.c[a](d,b,c||i),d.toString();d=this.getParent(b);return l!==d?d.k(a,b,c):""};n.j=function(a,b){var c=new I;this.render_(c,a||{},b||{});return c.toString()};n.q=function(a,b,c,d){if(!a["get"+b])throw Error("The macro "+b+" is not defined in "+a.o()+".");if(d===e)return a["get"+b].apply(a,c);throw Error("Positional arguments, or default values in macro arguments are not supported, yet.")};function Y(a){this.r=a}Y.prototype.toString=m("r");function Z(a,b,c,d,f){if(f&&b instanceof Y)return b.toString();b=b==i?"":String(b);if(ca===c){a=String(b);if(a.quote)b=a.quote();else{b=['"'];for(c=0;ck))if(h in H)h=H[h];else if(h in G)h=H[h]=G[h];else{k=h;j=h.charCodeAt(0);if(31j)k=h;else{if(256>j){if(k="\\x",16>j||256j&&(k+="0");k+=j.toString(16).toUpperCase()}h=H[h]=k}j=h}d[f]=j}b.push('"');b=b.join("")}return b.substring(1,b.length-1)}if(!c||da===c)return a=b,F.test(a)&&(-1!=a.indexOf("&")&&(a=a.replace(B,"&")),-1!=a.indexOf("<")&&(a=a.replace(C,"<")),-1!=a.indexOf(">")&&(a=a.replace(D,">")),-1!=a.indexOf('"')&&(a=a.replace(E,"""))),a;if(ea===c)return encodeURIComponent(b);throw Error("The type '"+c+"' is not supported.")}var da="html",ca="js",ea="url";function $(){this.a={};this.g={};this.h={};this.l={};this.f={};this.e={};this.p=l;this.L="UTF-8"}n=$.prototype;n.j=function(a,b){var c=this.d(a);return c.j.call(c,U({},this.e,b||{}))};n.filter=function(a,b,c){if(!(a in this.g))throw Error("The filter '"+a+"' does not exist.");return this.g[a].apply(i,Array.prototype.slice.call(arguments,1))};n.w=function(a,b,c){if(!(a in this.h))throw Error("The function '"+a+"' does not exist.");return this.h[a].apply(i,Array.prototype.slice.call(arguments,1))};n.test=function(a,b,c){if(!(a in this.l))throw Error("The test '"+a+"' does not exist.");return this.l[a].apply(i,Array.prototype.slice.call(arguments,1))};n.escape=function(a,b,c,d){return Z(0,a,b,0,d)};n.z=function(a,b,c){var d=this.d(a),f=d["get"+b];if(!f)throw Error("The macro '"+b+"' does not exist on template '"+d.o()+"'.");return f.apply(d,Array.prototype.slice.call(arguments,2)).toString()};n.F=function(a,b){this.g[a]=b};n.G=function(a,b){this.h[a]=b};n.J=function(a,b){this.l[a]=b};n.I=function(a){this.e=a};n.H=function(a,b){this.e[a]=b};n.u=m("e");n.i=function(){this.p=g;J(this.a,function(a){a.i()},this)};n.v=function(a){return a in this.a};n.getExtension=function(a){if(!(a in this.a))throw Error('The "'+a+'" extension is not enabled.');return this.a[a]};n.n=function(a){this.a[a.getName()]=a};n.A=function(a){delete this.a[a]};n.D=function(a){J(a,function(a){this.n(a)})};n.t=m("a");n.d=function(a){var b=a[v]||(a[v]=++w);if(b in this.f)return this.f[b];l===this.p&&this.i();a=new a(this);return this.f[b]=a};window.Twig=new $;A("goog.provide",function(a){q(a)});A("goog.require",function(){});A("twig.attr",function(a,b,c,d,f){d=d||"any";f=f!==e?f:l;if(!u(a)&&!s(a))return f?l:i;if(b in a){if("array"!==d&&"function"==r(a[b]))return f?g:a[b].apply(a,c||[]);if("method"!==d)return f?g:a[b]}if("array"===d||s(a))return f?l:i;var b=b.toLowerCase(),h="get"+b,k="is"+b,j;a:{b=function(a,b){b=b.toLowerCase();return b===h||b===k};for(j in a)if(b.call(e,0,j))break a;j=e}return j&&"function"==r(a[j])?f?g:a[j].apply(a,c||[]):f?l:i});A("twig.bind",ba);A("twig.inherits",function(a,b){function c(){}c.prototype=b.prototype;a.M=b.prototype;a.prototype=new c});A("twig.extend",U);A("twig.spaceless",function(a){return a.replace(/>[\s\xa0]+<").replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")});A("twig.range",function(a,b){for(var c=[];a<=b;a+=1)c.push(a);return c});A("twig.contains",function(a,b){var c;if(s(a))c=0<=P(a,b);else if(t(a))c=-1!=a.indexOf(b)&&(""!==b||""===a);else a:{for(c in a)if(a[c]==b){c=g;break a}c=l}return c});A("twig.countable",S);A("twig.count",T);A("twig.forEach",V);A("twig.empty",R);A("twig.createObj",function(a){for(var b={},c=0;c")});A("twig.filter.abs",function(a){return Math.abs(a)});A("twig.filter.title",function(a,b){return b.split(" ").map(function(a){return a.charAt(0).toUpperCase()+a.substr(1).toLowerCase()}).join(" ")});A("twig.filter.trim",function(a,b){var c="\n ";b&&(c=W(b));a=a.replace(RegExp("^["+c+"]+"),"");return a=a.replace(RegExp("["+c+"]+$"),"")});A("twig.filter.json_encode",function(a){return JSON.stringify(a)});A("twig.filter.last",function(a,b){if(s(b))return b[b.length-1];if(u(b)){var c=Object.keys(b);return b[c[c.length-1]]}return t(b)?b.charAt(b.length-1):""});A("twig.filter.reverse",function(a,b){if(s(b))return b.reverse();if(u(b)){for(var c={},d=L(b).reverse(),f=0;f'+Q+"")}E=E||function(Q){return{ajax:Q.ajax,$:function(Z){return Q(Z)[0]},replaceWith:function(Z,ad){var ac=Q(Z)[0];var ab=ac.nextSibling,aa=ac.parentNode;Q(ac).remove();if(ab){Q(ab).before(ad)}else{Q(aa).append(ad)}},onLoad:function(Z){Q(Z)},copyAttrs:function(af,ab){var ad=Q(ab),aa=af.attributes;for(var ac=0,Z=aa.length;ac","no element in writen markup with id "+Z.id);return}P(Z.el.childNodes,function(ab){aa.appendChild(ab)});if(aa.contentWindow){a.setTimeout(function(){Z.el.contentWindow.document.copyTo(aa.contentWindow.document)},1)}E.copyAttrs(Z.el,aa)})}function s(Z,Q){if(Q&&Q[Z]===false){return false}return Q&&Q[Z]||o[Z]}function x(Z,ai){var ae=[],ad=s("proxyGetElementById",ai),ag=s("writeOnGetElementById",ai),Q={write:j.write,writeln:j.writeln,finish:function(){},out:""};Z.state=Q;j.write=ah;j.writeln=aa;if(ad||ag){Q.getEl=j.getElementById;j.getElementById=ab;if(ag){findEl=af}else{findEl=ac;Q.finish=function(){I(ae)}}}function ah(aj){Q.out+=aj}function aa(aj){Q.out+=aj+"\n"}function ac(ak){var aj=j.createElement("div");ae.push({id:ak,el:aj});aj.contentWindow={document:new M};return aj}function af(al){var aj=E.$(Z.target);var ak=j.createElement("div");aj.parentNode.insertBefore(ak,aj);E.replaceWith(ak,Q.out);Q.out="";return e?Q.getEl.call(j,al):Q.getEl(al)}function ab(ak){var aj=e?Q.getEl.call(j,ak):Q.getEl(ak);return aj||findEl(ak)}return Q}function V(Q){j.write=Q.write;j.writeln=Q.writeln;if(Q.getEl){j.getElementById=Q.getEl}return Q.out}function N(Q){return Q&&Q.replace(/^\s*\s*$/,"")}function b(){}function d(Z,Q){console.error("Error",Q,"executing code:",Z)}var l=v(a.console&&console.error)?d:b;function S(aa,Z,Q){var ab=x(Z,Q);try{A(N(aa))}catch(ac){l(aa,ac)}finally{V(ab)}return ab}function O(Z){var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(Z);return Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)}function T(Q){return new RegExp(Q+"=(?:([\"'])([\\s\\S]*?)\\1|([^\\s>]+))","i")}function k(Q){var Z=T(Q);return function(aa){var ab=Z.exec(aa)||[];return ab[2]||ab[3]}}var r=/()([\s\S]*?)<\/script>/gi,n=T("src"),X=k("src"),q=k("type"),Y=k("language"),C="__document_write_ajax_callbacks__",B="__document_write_ajax_div-",g="window['"+C+"']['%d']();",m=a[C]={},w='",H=0;function c(){return(++H).toString()}function G(Z,aa){var Q;if(v(Z)){Q=Z;Z=null}Z=Z||{};Q=Q||Z&&Z.done;Z.done=aa?function(){aa(Q)}:Q;return Z}var z=new i;var y=[];var f=window._debugWriteCapture?function(){}:function(Q,aa,Z){y.push({type:Q,src:aa,data:Z})};var K=window._debugWriteCapture?function(){}:function(){y.push(arguments)};function W(Q){var Z=c();m[Z]=function(){Q();delete m[Z]};return Z}function J(Q){return w.replace(/%d/,W(Q))}function R(ac,ag,aa,ae){var ad=aa&&new i(aa)||z;ag=G(ag);var ab=s("done",ag);var Q="";var Z=s("fixUrls",ag);if(!v(Z)){Z=function(ah){return ah}}if(v(ab)){Q=J(function(){ad.push(ab)})}return ac.replace(r,af)+Q;function af(aj,av,ai){var an=X(av),am=q(av)||"",aB=Y(av)||"",aA=!am&&!aB||am.toLowerCase().indexOf("javascript")!==-1||aB.toLowerCase().indexOf("javascript")!==-1;f("replace",an,aj);if(!aA){return aj}var aw=W(ap),ao=B+aw,au,al={target:"#"+ao,parent:ae};function ap(){ad.push(au)}if(an){an=Z(an);av=av.replace(n,"");if(O(an)){au=az}else{if(s("asyncAll",ag)){au=ay()}else{au=at}}}else{au=ax}function ax(){ah(ai)}function at(){E.ajax({url:an,type:"GET",dataType:"text",async:false,success:function(aC){ah(aC)}})}function ak(aE,aC,aD){l("",aD);ad.resume()}function aq(){return J(function(){ad.resume()})}function ay(){var aE,aD;function aC(aG,aF){if(!aE){aD=aG;return}try{ah(aG,aq())}catch(aH){l(aG,aH)}}E.ajax({url:an,type:"GET",dataType:"text",async:true,success:aC,error:ak});return function(){aE=true;if(aD){ah(aD)}else{ad.pause()}}}function az(aC){var aE=x(al,ag);ad.pause();f("pause",an);E.ajax({url:an,type:"GET",dataType:"script",success:aD,error:ak});function aD(aH,aG,aF){f("out",an,aE.out);ar(V(aE),J(aE.finish)+aq());f("resume",an)}}function ah(aD,aC){var aE=S(aD,al,ag);aC=J(aE.finish)+(aC||"");ar(aE.out,aC)}function ar(aD,aC){E.replaceWith(al.target,R(aD,null,ad,al)+(aC||""))}return''+av+g.replace(/%d/,aw)+""}}function F(Z,aa){var Q=z;P(Z,function(ab){Q.push(ac);function ac(){ab.action(R(ab.html,ab.options,Q),ab)}});if(aa){Q.push(aa)}}function U(Q){var Z=Q;while(Z&&Z.nodeType===1){Q=Z;Z=Z.lastChild;while(Z&&Z.nodeType!==1){Z=Z.previousSibling}}return Q}function h(Q){var aa=j.write,ad=j.writeln,Z,ab=[];j.writeln=function(ae){j.write(ae+"\n")};var ac;j.write=function(af){ var ae=U(j.body);if(ae!==Z){Z=ae;ab.push(ac={el:ae,out:[]})}ac.out.push(af)};E.onLoad(function(){var ah,ak,af,aj,ai;Q=G(Q);ai=Q.done;Q.done=function(){j.write=aa;j.writeln=ad;if(ai){ai()}};for(var ag=0,ae=ab.length;ag";E.replaceWith(aa.firstChild,R(ab,Z))},load:function(Q,aa,Z){E.ajax({url:aa,dataType:"text",type:"GET",success:function(ab){o.html(Q,ab,Z)}})},autoAsync:h,sanitize:R,sanitizeSerial:F}})(this.writeCaptureSupport,this);(function(g,d,n){var c={html:h};g.each(["append","prepend","after","before","wrap","wrapAll","replaceWith","wrapInner"],function(){c[this]=i(this)});function a(q){return Object.prototype.toString.call(q)=="[object String]"}function p(u,t,s,r){if(arguments.length==0){return o.call(this)}var q=c[u];if(u=="load"){return l.call(this,t,s,r)}if(!q){j(u)}return b.call(this,t,s,q)}g.fn.writeCapture=p;var k="__writeCaptureJsProxied-fghebd__";function o(){if(this[k]){return this}var r=this;function q(){var t=this,s=false;this[k]=true;g.each(c,function(v){var u=r[v];if(!u){return}t[v]=function(y,x,w){if(!s&&a(y)){try{s=true;return p.call(t,v,y,x,w)}finally{s=false}}return u.apply(t,arguments)}});this.pushStack=function(){return o.call(r.pushStack.apply(t,arguments))};this.endCapture=function(){return r}}q.prototype=r;return new q}function b(t,s,u){var q,r=this;if(s&&s.done){q=s.done;delete s.done}else{if(g.isFunction(s)){q=s;s=null}}d.sanitizeSerial(g.map(this,function(v){return{html:t,options:s,action:function(w){u.call(v,w)}}}),q&&function(){q.call(r)}||q);return this}function h(q){g(this).html(q)}function i(q){return function(r){g(this)[q](r)}}function l(t,s,v){var r=this,q,u=t.indexOf(" ");if(u>=0){q=t.slice(u,t.length);t=t.slice(0,u)}if(g.isFunction(v)){s=s||{};s.done=v}return g.ajax({url:t,type:s&&s.type||"GET",dataType:"html",data:s&&s.params,complete:f(r,s,q)})}function f(r,s,q){return function(u,t){if(t=="success"||t=="notmodified"){var v=m(u.responseText,q);b.call(r,v,s,h)}}}var e=/jquery-writeCapture-script-placeholder-(\d+)-wc/g;function m(s,r){if(!r||!s){return s}var t=0,q={};return g("
").append(s.replace(//g,function(u){q[t]=u;return"jquery-writeCapture-script-placeholder-"+t++ +"-wc"})).find(r).html().replace(e,function(u,v){return q[v]})}function j(q){throw"invalid method parameter "+q}g.writeCapture=d})(jQuery,writeCapture.noConflict());(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,g=e.filter,d=e.every,m=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,w=Object.keys,_=i.bind,j=function(n){return n instanceof j?n:this instanceof j?void(this._wrapped=n):new j(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):n._=j,j.VERSION="1.6.0";var A=j.each=j.forEach=function(n,t,e){if(null==n)return n;if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a=j.keys(n),u=0,i=a.length;i>u;u++)if(t.call(e,n[a[u]],a[u],n)===r)return;return n};j.map=j.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var O="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=j.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(O);return r},j.reduceRight=j.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=j.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=j.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(O);return r},j.find=j.detect=function(n,t,r){var e;return k(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},j.filter=j.select=function(n,t,r){var e=[];return null==n?e:g&&n.filter===g?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},j.reject=function(n,t,r){return j.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},j.every=j.all=function(n,t,e){t||(t=j.identity);var u=!0;return null==n?u:d&&n.every===d?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var k=j.some=j.any=function(n,t,e){t||(t=j.identity);var u=!1;return null==n?u:m&&n.some===m?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};j.contains=j.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:k(n,function(n){return n===t})},j.invoke=function(n,t){var r=o.call(arguments,2),e=j.isFunction(t);return j.map(n,function(n){return(e?t:n[t]).apply(n,r)})},j.pluck=function(n,t){return j.map(n,j.property(t))},j.where=function(n,t){return j.filter(n,j.matches(t))},j.findWhere=function(n,t){return j.find(n,j.matches(t))},j.max=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.max.apply(Math,n);var e=-1/0,u=-1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;o>u&&(e=n,u=o)}),e},j.min=function(n,t,r){if(!t&&j.isArray(n)&&n[0]===+n[0]&&n.length<65535)return Math.min.apply(Math,n);var e=1/0,u=1/0;return A(n,function(n,i,a){var o=t?t.call(r,n,i,a):n;u>o&&(e=n,u=o)}),e},j.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=j.random(r++),e[r-1]=e[t],e[t]=n}),e},j.sample=function(n,t,r){return null==t||r?(n.length!==+n.length&&(n=j.values(n)),n[j.random(n.length-1)]):j.shuffle(n).slice(0,Math.max(0,t))};var E=function(n){return null==n?j.identity:j.isFunction(n)?n:j.property(n)};j.sortBy=function(n,t,r){return t=E(t),j.pluck(j.map(n,function(n,e,u){return{value:n,index:e,criteria:t.call(r,n,e,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.index-t.index}),"value")};var F=function(n){return function(t,r,e){var u={};return r=E(r),A(t,function(i,a){var o=r.call(e,i,a,t);n(u,o,i)}),u}};j.groupBy=F(function(n,t,r){j.has(n,t)?n[t].push(r):n[t]=[r]}),j.indexBy=F(function(n,t,r){n[t]=r}),j.countBy=F(function(n,t){j.has(n,t)?n[t]++:n[t]=1}),j.sortedIndex=function(n,t,r,e){r=E(r);for(var u=r.call(e,t),i=0,a=n.length;a>i;){var o=i+a>>>1;r.call(e,n[o])t?[]:o.call(n,0,t)},j.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},j.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},j.rest=j.tail=j.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},j.compact=function(n){return j.filter(n,j.identity)};var M=function(n,t,r){return t&&j.every(n,j.isArray)?c.apply(r,n):(A(n,function(n){j.isArray(n)||j.isArguments(n)?t?a.apply(r,n):M(n,t,r):r.push(n)}),r)};j.flatten=function(n,t){return M(n,t,[])},j.without=function(n){return j.difference(n,o.call(arguments,1))},j.partition=function(n,t){var r=[],e=[];return A(n,function(n){(t(n)?r:e).push(n)}),[r,e]},j.uniq=j.unique=function(n,t,r,e){j.isFunction(t)&&(e=r,r=t,t=!1);var u=r?j.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:j.contains(a,r))||(a.push(r),i.push(n[e]))}),i},j.union=function(){return j.uniq(j.flatten(arguments,!0))},j.intersection=function(n){var t=o.call(arguments,1);return j.filter(j.uniq(n),function(n){return j.every(t,function(t){return j.contains(t,n)})})},j.difference=function(n){var t=c.apply(e,o.call(arguments,1));return j.filter(n,function(n){return!j.contains(t,n)})},j.zip=function(){for(var n=j.max(j.pluck(arguments,"length").concat(0)),t=new Array(n),r=0;n>r;r++)t[r]=j.pluck(arguments,""+r);return t},j.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},j.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=j.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},j.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},j.range=function(n,t,r){arguments.length<=1&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=new Array(e);e>u;)i[u++]=n,n+=r;return i};var R=function(){};j.bind=function(n,t){var r,e;if(_&&n.bind===_)return _.apply(n,o.call(arguments,1));if(!j.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));R.prototype=n.prototype;var u=new R;R.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},j.partial=function(n){var t=o.call(arguments,1);return function(){for(var r=0,e=t.slice(),u=0,i=e.length;i>u;u++)e[u]===j&&(e[u]=arguments[r++]);for(;r=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u),e=u=null):a||r.trailing===!1||(a=setTimeout(c,f)),i}},j.debounce=function(n,t,r){var e,u,i,a,o,c=function(){var l=j.now()-a;t>l?e=setTimeout(c,t-l):(e=null,r||(o=n.apply(i,u),i=u=null))};return function(){i=this,u=arguments,a=j.now();var l=r&&!e;return e||(e=setTimeout(c,t)),l&&(o=n.apply(i,u),i=u=null),o}},j.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},j.wrap=function(n,t){return j.partial(t,n)},j.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},j.after=function(n,t){return function(){return--n<1?t.apply(this,arguments):void 0}},j.keys=function(n){if(!j.isObject(n))return[];if(w)return w(n);var t=[];for(var r in n)j.has(n,r)&&t.push(r);return t},j.values=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=n[t[u]];return e},j.pairs=function(n){for(var t=j.keys(n),r=t.length,e=new Array(r),u=0;r>u;u++)e[u]=[t[u],n[t[u]]];return e},j.invert=function(n){for(var t={},r=j.keys(n),e=0,u=r.length;u>e;e++)t[n[r[e]]]=r[e];return t},j.functions=j.methods=function(n){var t=[];for(var r in n)j.isFunction(n[r])&&t.push(r);return t.sort()},j.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},j.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},j.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)j.contains(r,u)||(t[u]=n[u]);return t},j.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},j.clone=function(n){return j.isObject(n)?j.isArray(n)?n.slice():j.extend({},n):n},j.tap=function(n,t){return t(n),n};var S=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof j&&(n=n._wrapped),t instanceof j&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==String(t);case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;var a=n.constructor,o=t.constructor;if(a!==o&&!(j.isFunction(a)&&a instanceof a&&j.isFunction(o)&&o instanceof o)&&"constructor"in n&&"constructor"in t)return!1;r.push(n),e.push(t);var c=0,f=!0;if("[object Array]"==u){if(c=n.length,f=c==t.length)for(;c--&&(f=S(n[c],t[c],r,e)););}else{for(var s in n)if(j.has(n,s)&&(c++,!(f=j.has(t,s)&&S(n[s],t[s],r,e))))break;if(f){for(s in t)if(j.has(t,s)&&!c--)break;f=!c}}return r.pop(),e.pop(),f};j.isEqual=function(n,t){return S(n,t,[],[])},j.isEmpty=function(n){if(null==n)return!0;if(j.isArray(n)||j.isString(n))return 0===n.length;for(var t in n)if(j.has(n,t))return!1;return!0},j.isElement=function(n){return!(!n||1!==n.nodeType)},j.isArray=x||function(n){return"[object Array]"==l.call(n)},j.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){j["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),j.isArguments(arguments)||(j.isArguments=function(n){return!(!n||!j.has(n,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(n){return"function"==typeof n}),j.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},j.isNaN=function(n){return j.isNumber(n)&&n!=+n},j.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},j.isNull=function(n){return null===n},j.isUndefined=function(n){return n===void 0},j.has=function(n,t){return f.call(n,t)},j.noConflict=function(){return n._=t,this},j.identity=function(n){return n},j.constant=function(n){return function(){return n}},j.property=function(n){return function(t){return t[n]}},j.matches=function(n){return function(t){if(t===n)return!0;for(var r in n)if(n[r]!==t[r])return!1;return!0}},j.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},j.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))},j.now=Date.now||function(){return(new Date).getTime()};var T={escape:{"&":"&","<":"<",">":">",'"':""","'":"'"}};T.unescape=j.invert(T.escape);var I={escape:new RegExp("["+j.keys(T.escape).join("")+"]","g"),unescape:new RegExp("("+j.keys(T.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(n){j[n]=function(t){return null==t?"":(""+t).replace(I[n],function(t){return T[n][t]})}}),j.result=function(n,t){if(null==n)return void 0;var r=n[t];return j.isFunction(r)?r.call(n):r},j.mixin=function(n){A(j.functions(n),function(t){var r=j[t]=n[t];j.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),z.call(this,r.apply(j,n))}})};var N=0;j.uniqueId=function(n){var t=++N+"";return n?n+t:t},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},D=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(n,t,r){var e;r=j.defaults({},r,j.templateSettings);var u=new RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(D,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=new Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,j);var c=function(n){return e.call(this,n,j)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},j.chain=function(n){return j(n).chain()};var z=function(n){return this._chain?j(n).chain():n};j.mixin(j),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];j.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],z.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];j.prototype[n]=function(){return z.call(this,t.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}}),"function"==typeof define&&define.amd&&define("underscore",[],function(){return j})}).call(this);var Globals={hooks:{lock:{type:null,on:false},queue:[],ready:{}},addHook:function(hook,scope,callback,id){if(hook&&typeof hook==="string"&&callback&&typeof callback==="function"){id=id&&typeof id==="string"?id:null;if(!Globals.hooks.ready[hook]){Globals.hooks.ready[hook]=[]}if(id!==null){Globals.removeHook(hook,id)}Globals.hooks.ready[hook].push({scope:scope,id:id,callback:callback});bk$.each(Globals.hooks.queue,function(index,queue){if(queue.hook===hook){Globals.notifyHooks(queue.hook,queue.args);Globals.hooks.queue.splice(index,1)}})}},notifyHooks:function(hook,args,lock){var queueUp=true;if(!hook||typeof hook!=="string"){return}if(Globals.hooks.lock.on===true&&Globals.hooks.lock.type===hook){return}if(lock===true){Globals.hooks.lock.on=true;Globals.hooks.lock.type=hook}if(Globals.hooks.ready[hook]){bk$.each(Globals.hooks.ready[hook],function(index,object){if(typeof object.callback==="function"){object.callback.apply(object.scope,args?[args]:null)}})}else{bk$.each(Globals.hooks.queue,function(index,queue){if(queue.hook===hook){queueUp=false}});if(queueUp===true){Globals.hooks.queue.push({hook:hook,args:args||null})}}if(Globals.hooks.lock.type===hook){Globals.hooks.lock=false}},removeHook:function(hook,id){if(!hook||typeof hook!=="string"){return}var index=0,hooks=null;id=id&&typeof id==="string"?id:null;if(Globals.hooks.ready[hook]&&id!==null){hooks=Globals.hooks.ready[hook];for(index=hooks.length-1;index>=0;index-=1){if(typeof hooks[index]==="object"&&hooks[index].id===id){hooks.splice(index,1)}}}if(Globals.hooks.ready[hook]&&id===null){delete Globals.hooks.ready[hook]}}};var Site={Dom:{},Globals:{},PageTree:null,Images:{data:null,total:null,all:null},Page:{current:{},set:function(page){if(page&&typeof page==="object"){App.session.set("pageRef",page.ref);this.current=page;if(Editor.Instances.Events.toolbar!==undefined){Editor.Instances.Events.toolbar.trigger("showUndoRedo")}}},get:function(){return this.current},Zones:{},Widgets:{},Globals:{}},Presets:{presets:null,dumbSet:function(presets,callback){if(presets&&typeof presets==="object"){var that=this;bk$.extend(true,that.presets,presets);if(callback&&typeof callback==="function"){callback()}}},set:function(presets,callback){if("sass"===Editor.Site.Theme.current.preprocessor){Editor.Site.Dom.updatePresetsRecompileCss(presets);return}if(presets&&typeof presets==="object"){var that=this,data={values:presets};bk$.extend(true,that.presets,presets);window.parent.$.ajax({type:"PUT",dataType:"json",contentType:"application/json",processData:false,url:"/api/sites/"+App.session.get("siteRef")+"/preset-attributes",data:JSON.stringify(data)}).done(function(response,status,jqXHR){if(callback&&typeof callback==="function"){callback()}}).fail(function(response){App.Errors.throwError(response.status,response,"")})}},get:function(preset){var data=null;if(this.presets===null){throw new Error("Error: presets are null")}if(!preset){data=this.presets}else if(this.presets[preset]!==null&&this.presets[preset]!==undefined){data=this.presets[preset]}return data},getValueFromLessVar:function(key){var i=0,tries=4,value=null,matches=null,percentage=0,color=null,colorRegex=/^(\bdarken|lighten\b)\((@[a-z0-9\-]+)\s?,\s?([0-9]+%)\)/;try{while(i<=tries&&value===null){i+=1;if(!this.presets||typeof this.presets[key]==="undefined"){throw new Error("Unable to get preset attribute, missing presets")}value=this.presets[key];if(this.presets[key].indexOf("@")>-1){matches=this.presets[key].match(colorRegex);if(matches!==null&&matches[3]&&typeof less!=="undefined"){percentage=parseInt(matches[3],10);color=this.getValueFromLessVar(matches[2]).replace("#","");switch(matches[1]){case"lighten":value=Editor.ColorSwatch.lighten(color,percentage,true);break;case"darken":value=Editor.ColorSwatch.darken(color,percentage,true);break}}else{value=this.getValueFromLessVar(this.presets[key])}}}return value}catch(e){throw new Error("Unable to get preset attribute")}}},Settings:{assettabs:["images"]},Theme:{current:null,set:function(themeRef,previous){var location=window.location;if(themeRef&&typeof themeRef==="number"){if(previous&&previous===true){this.previous=themeRef}Editor.ColorSwatch.current=null;Editor.FontSwatch.current=null;this.current.ref=themeRef;window.location=location}},get:function(){return this.current}},Background:{previous:null,current:null,set:function(styles,previous){if(styles&&typeof styles==="object"){if(previous&&previous===true){this.previous=bk$.extend(true,{},styles)}this.current=styles}},get:function(){if(this.current===null){var styles={siteBackgroundColor:Editor.Site.Presets.get("@siteBackgroundColor"),siteBackgroundGradientType:Editor.Site.Presets.get("@siteBackgroundGradientType"),siteBackgroundGradientFrom:Editor.Site.Presets.get("@siteBackgroundGradientFrom"),siteBackgroundGradientTo:Editor.Site.Presets.get("@siteBackgroundGradientTo"),siteBackgroundImageScale:Editor.Site.Presets.get("@siteBackgroundImageScale"),siteBackgroundImage:Editor.Site.Presets.get("@siteBackgroundImage"),siteBackgroundPositionX:Editor.Site.Presets.get("@siteBackgroundPositionX"),siteBackgroundPositionY:Editor.Site.Presets.get("@siteBackgroundPositionY"),siteBackgroundRepeat:Editor.Site.Presets.get("@siteBackgroundRepeat"),type:Editor.Site.Globals.backgroundtype||"solidcolor"};this.set(styles,true)}return this.current},save:function(styles){var presets={};if(this.isValidBackground(styles)){this.previous=bk$.extend(true,{},this.current);this.set(styles);presets={"@siteBackgroundColor":styles.siteBackgroundColor,"@siteBackgroundGradientType":styles.siteBackgroundGradientType,"@siteBackgroundGradientFrom":styles.siteBackgroundGradientFrom,"@siteBackgroundGradientTo":styles.siteBackgroundGradientTo,"@siteBackgroundImageScale":styles.siteBackgroundImageScale,"@siteBackgroundImage":styles.siteBackgroundImage,"@siteBackgroundPositionX":styles.siteBackgroundPositionX,"@siteBackgroundPositionY":styles.siteBackgroundPositionY,"@siteBackgroundRepeat":styles.siteBackgroundRepeat};Editor.Site.Dom.replaceVars(presets,"page-styles");Editor.Site.Presets.set(presets,function(){Editor.Site.Dom.RefreshCSS()})}else{throw new Error("cannot update background, background not valid")}},isValidBackground:function(values){if(typeof values!=="object"){return false}if(typeof values.type==="undefined"||values.type.toString().length===0){return false}switch(values.type){case"solidcolor":if(typeof values.siteBackgroundColor==="undefined"||values.siteBackgroundColor.toString().length===0||typeof values.siteBackgroundColor!=="string"){return false}break;case"gradient":if(typeof values.siteBackgroundGradientType==="undefined"||values.siteBackgroundGradientType.toString().length===0||typeof values.siteBackgroundGradientType!=="string"){return false}if(typeof values.siteBackgroundGradientFrom==="undefined"||values.siteBackgroundGradientFrom.toString().length===0||typeof values.siteBackgroundGradientFrom!=="string"){return false}if(typeof values.siteBackgroundGradientTo==="undefined"||values.siteBackgroundGradientTo.toString().length===0||typeof values.siteBackgroundGradientTo!=="string"){return false}break;case"image":if(typeof values.siteBackgroundImageScale==="undefined"||values.siteBackgroundImageScale.toString().length===0||typeof values.siteBackgroundImageScale!=="string"){return false}if(typeof values.siteBackgroundImage==="undefined"||values.siteBackgroundImage.toString().length===0||typeof values.siteBackgroundImage!=="string"){return false}if(typeof values.siteBackgroundPositionX==="undefined"||values.siteBackgroundPositionX.toString().length===0||typeof values.siteBackgroundPositionX!=="string"){return false}if(typeof values.siteBackgroundPositionY==="undefined"||values.siteBackgroundPositionY.toString().length===0||typeof values.siteBackgroundPositionY!=="string"){return false}if(typeof values.siteBackgroundRepeat==="undefined"||values.siteBackgroundRepeat.toString().length===0||typeof values.siteBackgroundRepeat!=="string"){return false}break}return true}}};var pageMethods={load:function(){var that=this,zones=[],widgetIds=[],columnsWidgetIds=[],widgetKey=null,zoneKey=null,zoneName=null,el=null,patten=/\-widgets\_\_{1}/i,preZoneExtend=null,zoneOb=null,widgets=null,innerWidgetKey=null,parts=null,columnName=null,parentName=null,columns=null,columnKey=null,columnZoneName=null,innerColumnWidgetKey=null,innerColumnEl=null;if(Server.componentTree===undefined||Server.componentTree===null){throw new Error("Server.componentTree not available")}if(Server.componentTree.page===undefined||Server.componentTree.page===null){throw new Error("Page structure not available")}Site.Page.current=Server.page;zones=Server.componentTree.page;preZoneExtend=bk$.extend(true,{},Site.Page.Zones);this.zoneNames=[];Site.Page.Zones["page-zones__template"]={};this._initialisePageWidgets();for(zoneKey in zones){if(zones.hasOwnProperty(zoneKey)){widgetIds=[];el=bk$("#"+zoneKey);zoneName=zoneKey.replace("page-zones__","");el.data("componentType","core.zone");that.Zones["zone-"+zoneName]={};that.zoneNames.push("zone-"+zoneName);bk$.extend(true,that.Zones["zone-"+zoneName],preZoneExtend);for(widgetKey in zones[zoneKey]){if(zones[zoneKey].hasOwnProperty(widgetKey)&&patten.test(widgetKey)){widgetIds.push(widgetKey)}}that.Zones["zone-"+zoneName].setZoneId(zoneKey);that.Zones["zone-"+zoneName].setZoneName(zoneName);that.Zones["zone-"+zoneName].setWidgets(widgetIds);zoneOb=null;zoneOb=that.Zones["zone-"+zoneName].load();el.data("bkob",zoneOb);widgets=zones[zoneKey];for(innerWidgetKey in widgets){if(widgets.hasOwnProperty(innerWidgetKey)){parts=innerWidgetKey.split("__");columnName=parts[parts.length-1];if(columnName.indexOf("responsivecolumns")!==-1){parentName=parts[parts.length-1];columns=widgets[innerWidgetKey];for(columnKey in columns){if(columns.hasOwnProperty(columnKey)){columnsWidgetIds=[];parts=columnKey.split("__");columnName=parts[parts.length-1];columnZoneName=parentName+"-zones__"+columnName;that.Zones["zone-"+columnZoneName]={};that.zoneNames.push("zone-"+columnZoneName);bk$.extend(true,that.Zones["zone-"+columnZoneName],preZoneExtend);for(innerColumnWidgetKey in columns[columnKey]){if(columns[columnKey].hasOwnProperty(innerColumnWidgetKey)&&patten.test(innerColumnWidgetKey)){columnsWidgetIds.push(innerColumnWidgetKey)}}that.Zones["zone-"+columnZoneName].setZoneId(columnKey);that.Zones["zone-"+columnZoneName].setZoneName(columnZoneName);that.Zones["zone-"+columnZoneName].setWidgets(columnsWidgetIds);zoneOb=null;zoneOb=that.Zones["zone-"+columnZoneName].load();innerColumnEl=bk$("#"+zoneKey+"-widgets__"+columnZoneName);innerColumnEl.data("componentType","core.zone");innerColumnEl.data("parentName",zoneName);innerColumnEl.data("bkob",zoneOb)}}}}}}}this.loadThemeAndAssets()},loadThemeAndAssets:function(){Site.Images.all=[];if(Server.plugins&&Server.plugins.hasOwnProperty("assets")&&Server.plugins.assets){if(Server.plugins.assets.hasOwnProperty("images")&&Server.plugins.assets.images){bk$.each(Server.plugins.assets.images,function(index,el){Site.Images.all.push(el)})}}if(Server.app.mode==="edit"){Site.Theme.current={ref:Server.templateData.templateRef,widgetPresets:Server.templateData.widgetPresets,pageTypes:Server.templateData.pageTypes,templateAssetDomain:Server.templateData.assetDomain+"/"+Server.templateData.templateFolder,templateCommonAssetDomain:Server.templateData.assetDomain+"/common",colorSwatchEnabled:Server.templateData.colorSwatchEnabled,fontSwatchEnabled:Server.templateData.fontSwatchEnabled,images:Server.templateData.images,isCustom:Server.templateData.isCustom,source:Server.templateData.source,preprocessor:Server.templateData.preprocessor}}},_initialisePageWidgets:function(){for(var widgetKey in Server.components){if(Server.components.hasOwnProperty(widgetKey)){if(/page\-zones\_\_template\-widgets\_\_/i.test(widgetKey)){Site.Page.initialiseWidget(widgetKey)}}}},getZones:function(){var that=this,arrayZoneObjects=[];bk$.each(that.zoneNames,function(index,name){if(typeof that.Zones[name]==="object"){arrayZoneObjects.push(that.Zones[name])}});return arrayZoneObjects},initialiseWidget:function(key){var el=bk$("#"+key),plugin=null,widget=null;if(Server.components[key]===undefined){throw new Error("Widget properties not found:"+key)}widget=Server.components[key];plugin=("basekit."+widget.type).toCamelCase();switch(widget.type){case"widget.content":case"widget.content.h1":case"widget.content.h2":case"widget.content.h3":case"widget.content.h4":case"widget.content.numberlist":case"widget.content.bulletlist":case"widget.content.link":plugin="basekitWidgetContent";el["basekitWidgetContent"](widget);break;default:el[plugin](widget);break}el.data({componentType:widget.type,widgetName:widget.name})}};bk$.extend(true,Site.Page,pageMethods);var zoneMethods={id:null,name:null,pageRef:null,representingLIRef:null,type:null,widgets:[],load:function(zoneProperities){zoneProperities=zoneProperities||(Server.components[this.id]||null);if(zoneProperities===null){throw new Error("Zone properties not found:"+this.id)}if(zoneProperities.pageRef>0){this.pageRef=parseInt(zoneProperities.pageRef,10)}else{this.pageRef=0;throw new Error("Zone Page Ref is null:"+this.id)}if(zoneProperities.data!==undefined&&zoneProperities.data.libraryItemRef!==undefined&&zoneProperities.data.libraryItemRef>0){this.representingLIRef=parseInt(zoneProperities.data.libraryItemRef,10);this.type="template"}else{this.representingLIRef=0;this.type="page"}bk$.each(this.widgets,function(i,key){Site.Page.initialiseWidget(key)});return this},getWidgets:function(){return this.widgets},getWidget:function(id){var widgetEl=null;if(typeof id!=="string"){throw new Error("id (string) is required")}bk$.each(this.widgets,function(i,key){if(key===id){widgetEl=bk$("#"+id)}});return widgetEl},setWidgets:function(widgets){var that=this,el=null;this.widgets=widgets;bk$.each(this.widgets,function(index,widgetId){el=bk$("#"+widgetId);el.data("parentName",that.name)})},setZoneId:function(id){this.id=id},setZoneName:function(name){this.name=name},getParentWidgetEl:function(){return bk$("#"+this.id).parents(".widget")}};bk$.extend(true,Site.Page.Zones,zoneMethods);var ProfileMethods={get:function(key){var property="";try{if(this.profile&&this.profile[key]!==null&&this.profile[key]!==undefined){property=this.profile[key]}return property}catch(exception){throw new Error("Unable to get profile property "+key,exception.message)}}};bk$.extend(true,Profile,ProfileMethods);(function(App,cookieWarningUrl,undefined){var setText=function(ele,text){if(typeof ele.textContent==="string"){ele.textContent=text}else{ele.innerText=text}};if(cookieWarningUrl===""){return false}if(!/(^|;\s?)bk-cookie-warning=/.test(document.cookie)){ document.cookie="bk-cookie-warning=true; max-age=315360000";var cookieWarningContainer=document.createElement("div"),cookieWarningParagraph=document.createElement("p"),cookieWarningLink=document.createElement("a"),cookieWarningCloseButton=document.createElement("a"),removeWarning=function(e){e.preventDefault();cookieWarningContainer.parentNode.removeChild(cookieWarningContainer)},clickWarning=function(e){removeWarning(e);window.open(cookieWarningUrl)};cookieWarningLink.href=cookieWarningUrl;setText(cookieWarningLink,App.t("cookie.link_text","Find out more."));if(cookieWarningLink.addEventListener){cookieWarningLink.addEventListener("click",clickWarning,false)}else{cookieWarningLink.attachEvent("onclick",clickWarning)}cookieWarningCloseButton.className="bk-cookie-close-button";cookieWarningCloseButton.innerHTML="✕";cookieWarningCloseButton.href="#null";if(cookieWarningCloseButton.addEventListener){cookieWarningCloseButton.addEventListener("click",removeWarning,false)}else{cookieWarningCloseButton.attachEvent("onclick",removeWarning)}setText(cookieWarningParagraph,App.t("cookie.warning_text","This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies."));cookieWarningParagraph.innerHTML+=" ";cookieWarningParagraph.appendChild(cookieWarningLink);cookieWarningContainer.className="bk-cookie-container";cookieWarningContainer.appendChild(cookieWarningParagraph);cookieWarningContainer.appendChild(cookieWarningCloseButton);document.body.appendChild(cookieWarningContainer)}})(App,Server.cookieWarningUrl);(function(){bk$.fn.extend({getParentId:function(){var self=bk$(this),parentId=self.parent().attr("id");return parentId},getRect:function(){var el=bk$(this).first(),rect=null;if(!el.is(":visible")){return null}rect=el.offset();rect.right=rect.left+el.outerWidth();rect.bottom=rect.top+el.outerHeight();return rect},compare:function(selector){return bk$(this).get(0)===bk$(selector).get(0)}})})();(function(){BaseKit.Component=function(scope,args,options){$lib=typeof bk$==="function"?bk$:$;if(options===null){return scope}scope.self=scope.el=$lib(args[0]);scope.scope=scope;$lib.extend(true,scope,{renderTemplate:function(templateId,values,postRender,doRender,callback,doEvents){var content=null,templateName=null;if(typeof templateId!=="string"){throw new Error("renderTemplate first parameter error: expecting twig template name")}if(typeof values!=="object"){throw new Error("renderTemplate second parameter error: expecting object")}postRender=typeof postRender==="boolean"&&postRender===true?true:false;doRender=typeof doRender==="boolean"&&doRender===false?false:true;doEvents=typeof doEvents==="boolean"&&doEvents===false?false:true;if(typeof App==="object"&&typeof App.render==="function"){templateName=templateId.replace(/\./g,"_");App.render(templateName,function(tpl){if(typeof tpl==="function"){if(values!==null&&typeof values==="object"){content=tpl(values)}else if(typeof values==="boolean"){postRender=values;content=tpl()}else{content=tpl()}if(doRender===true){$lib(scope.el).html(content)}if(postRender===true&&typeof scope.postRender==="function"){scope.postRender(content)}if(doEvents===true&&typeof scope.attachEvents==="function"){scope.attachEvents()}if(callback&&typeof callback==="function"){callback.call(scope,content)}}return content})}}});$lib.extend(true,scope,{postRender:function(content){if(typeof this.renderFinish==="function"){var that=this,lastLength=0,strikes=0;BaseKit.Util.waitsFor(function(){var loadingHTML=$lib(scope.el).html(),expectedHTML=typeof content==="object"?$lib(content).html().toString():content,loadingLength=0,expectedLength=0;if(loadingHTML===null||loadingHTML.replace===undefined){return false}loadingLength=loadingHTML.replace(/\s/g,"").length;expectedLength=expectedHTML.replace(/\s/g,"").length;if(loadingLength!==expectedLength){if(loadingLength===lastLength){strikes+=1}lastLength=loadingLength;if(strikes===3){return true}return false}else{return true}},function(){lastLength=0;strikes=0;that.renderFinish(content)},function(){lastLength=0;strikes=0;throw new Error("Editor Window unaccessable")},250)}}});if(options.methods!==null){$lib.extend(true,scope,options.methods)}if(typeof scope.construct==="function"){scope.construct.apply(scope,args)}if(typeof scope.editorConstruct==="function"){scope.editorConstruct.apply(scope,args)}return scope}})();(function(){BaseKit.WidgetCore=function(scope,args,options){var o=new BaseKit.Component(scope,args,{methods:{construct:function(){scope.properties={type:"",uniqueHTMLId:"",styles:{},temporary:{},data:{},changed:{}};if(options.methods!==null){bk$.extend(true,scope,options.methods)}if(typeof options.properties==="object"){bk$.extend(true,scope.properties.data,options.properties)}if(args[1]&&typeof args[1]==="object"){bk$.extend(true,scope.properties,args[1])}if(typeof scope.construct==="function"){scope.construct.apply(scope,args)}},get:function(name){var property=null;try{if(scope.properties.temporary&&scope.properties.temporary[name]!==undefined){property=scope.properties.temporary[name]}else if(this.properties.changed[name]&&this.properties.changed[name]!==undefined){property=this.properties.changed[name]}else if(this.properties.data[name]&&this.properties.data[name]!==undefined){property=this.properties.data[name]}else if(this.properties[name]&&this.properties[name]!==undefined){property=this.properties[name]}else if(this[name]&&this[name]!==undefined){property=this[name]}return property}catch(exception){throw new Error("Unable to get property",exception.message)}},set:function(name,value,temporary){try{temporary=temporary||false;if(temporary===true){scope.properties.temporary[name]=value}}catch(exception){throw new Error("Unsable to set property",exception.message)}},rerender:function(){var properties=this.getProperties("current"),pluginName=null;properties.plugins={};properties.app={};if(typeof Server!=="undefined"&&Server.hasOwnProperty("plugins")){for(pluginName in Server.plugins){if(Server.plugins.hasOwnProperty(pluginName)){if(properties.plugins.hasOwnProperty(pluginName)){throw new Error("Plugin name conflicts")}else{properties.plugins[pluginName]=bk$.extend(true,{},Server.plugins[pluginName])}}}}if(typeof Server!=="undefined"&&Server.hasOwnProperty("app")){bk$.extend(properties.app,{mode:Server.app.mode})}if(properties.profile!==undefined){bk$.extend(true,properties.profile,Profile.profile)}else{properties.profile=Profile.profile}if(Server.hasOwnProperty("requestBase")&&Server.requestBase!=="undefined"){properties.requestBase=Server.requestBase}this.el.html("");this.renderTemplate(properties.type,properties,true)},getProperties:function(type){var properties=scope.properties;if(type&&type==="current"){properties=bk$.extend(true,{},scope.properties);properties.data=bk$.extend(true,properties.data,properties.changed);properties.data=bk$.extend(true,properties.data,properties.temporary)}return properties},getErrorsFromResponse:function(response){var errors=[],responseObj;if(response.responseText){responseObj=bk$.parseJSON(response.responseText);if(responseObj.messageTemplates){bk$.each(responseObj.messageTemplates,function(field,errorTemplates){bk$.each(errorTemplates.templates,function(type,template){errors.push({field:field,type:type})})})}}return errors},getRegistrationMessageAndFieldFromErrors:function(errors){var message=null,field=null;bk$.each(errors,function(i,value){if(value.field==="email"&&value.type==="duplicateEmail"){field="email";message=App.t("global_v7.error_registration.duplicate_email","It looks like that email is already in use. Are you sure you don’t already have an account?");return false}if(value.field==="email"){field="email";message=App.t("global_v7.error_registration.incorrect_email_format","Please enter a valid email address.");return false}if(value.field==="password"){field="password";message=App.t("global_v7.error_registration.invalid_password","Please provide a password greater than 7 characters but less than 19.");return false}if(value.field==="firstName"){field="firstName";message=App.t("global_v7.error_registration.empty_firstname","Please provide your first name");return false}if(value.field==="lastName"){field="lastName";message=App.t("global_v7.error_registration.empty_lastname","Please provide your last name");return false}});return{message:message,field:field}}}})}})();(function(){BaseKit.Widget.Advancedcontactform=null;BaseKit.Widget.AdvancedcontactformProperties={email:"profile",text:App.t("widgets.advancedcontactform.default_button_text","Send"),formTitle:App.t("widgets.advancedcontactform.default_title","Contact Form"),fieldType:"singleline",fields:0};BaseKit.Widget.AdvancedcontactformMethods={construct:function(el,options){this.load()},load:function(){this.attachEvents()},attachEvents:function(){var thisEl=bk$(this.el),url="/_bk/advanced-contactform",data={},emailRegex=/.+@.+/;thisEl.find(".js-form").on("submit",function(e){var fail=false;e.preventDefault();data=this.generateFieldsData(thisEl,this);if(thisEl.find(".overlay").length>0){thisEl.find(".overlay").removeClass("fail success")}this.removeMessage();this.showMessageBox();if(!data.emailFrom.length){this.showMessage(App.t("widgets.form.empty_email","Please enter an email address."),"fail");fail=true}if(!emailRegex.test(data.emailFrom)&&!fail){this.showMessage(App.t("widgets.form.invalid_email","Please enter a valid email address."),"fail");fail=true}if(fail===true){this.enableForm();return}bk$.ajax({url:url,type:"POST",data:data,success:function(){if(this.get("goalUrl")){window.location=this.get("goalUrl")}else{this.showMessage(App.t("widgets.form.success","Message sent successfully."),"success");this.removeMessageBox()}}.bind(this),error:function(){this.showMessage(App.t("widgets.form.failed","Submit failed."),"fail");this.removeMessageBox()}})}.bind(this))},enableForm:function(){bk$(this.el).find("form").removeClass("submitting")},showMessage:function(message,className){var thisEl=bk$(this.el);if(!message){return}if(thisEl.find(".message-box").length>0){thisEl.find(".message-box").remove()}thisEl.find(".overlay").addClass(className).append('
'+message+"
")},removeMessage:function(){bk$(this.el).find(".overlay .message-box").remove()},showMessageBox:function(){var thisEl=bk$(this.el),overlay=bk$('
'),formEl=null;if(thisEl.find(".overlay").length===0){thisEl.append(overlay)}formEl=thisEl.find("form");if(formEl.length>0){formEl.addClass("submitting")}},removeMessageBox:function(){var thisEl=bk$(this.el),t=null,formEl=thisEl.find("form");if(formEl.length>0){formEl.removeClass("submitting")}thisEl.find(".js-email-input").val("");thisEl.find(".js-singleline-input").val("");thisEl.find(".js-input-checkbox").removeAttr("checked");thisEl.find(".js-input-radio").removeAttr("checked");t=setTimeout(function(){clearTimeout(t);thisEl.find(".overlay").fadeOut(function(){bk$(this).remove()})},1e4)},generateFieldsData:function(thisEl,that){var properties=that.getProperties("saved").data,data={emailFrom:thisEl.find(".js-email-input").val(),useProfile:that.get("email")==="profile"?1:0,formTitle:that.get("formTitle"),widgetId:thisEl.attr("id"),hostname:window.location.hostname,siteRef:App.session.get("siteRef")},group,parentName;Object.keys(properties).forEach(function(propertyName){if(properties[propertyName]!==""){if(propertyName.indexOf("multiline")===0||propertyName.indexOf("singleline")===0){data[that.get(propertyName)]=thisEl.find(".js-input-"+propertyName).val()}else if(propertyName.indexOf("checkbox")===0){if(propertyName.indexOf("option")!==-1){group=propertyName.split("_");parentName=group[0]+"_"+group[1];data[that.get(parentName)+"-"+that.get(propertyName)]=thisEl.find(".js-input-"+propertyName).prop("checked")?1:0}}else if(propertyName.indexOf("dropdown")===0&&propertyName.indexOf("option")===-1){data[that.get(propertyName)]=thisEl.find(".js-input-"+propertyName).val()}else if(propertyName.indexOf("radiobutton")===0){if(propertyName.indexOf("option")!==-1){group=propertyName.split("_");parentName=group[0]+"_"+group[1];data[that.get(parentName)+"-"+that.get(propertyName)]=thisEl.find(".js-input-"+propertyName).prop("checked")?1:0}}}});return data}};BaseKit.Widget.Advancedcontactform=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.AdvancedcontactformProperties,methods:BaseKit.Widget.AdvancedcontactformMethods})};bk$.fn.basekitWidgetAdvancedcontactform=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Advancedcontactform(el,options))})}})();(function(){BaseKit.Widget.BlogpostProperties={};BaseKit.Widget.BlogpostMethods={construct:function(el,options){this.options=options;this.load()},load:function(){if(Server.app.mode==="published"){this.attachPopupEvents()}},attachPopupEvents:function(){var thisEl=bk$(this.el),specs="menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600",currentUrl=encodeURIComponent(window.location.href),blogSummary=Server.plugins.blog&&Server.plugins.blog.posts?Server.plugins.blog.posts[0].summary:"";thisEl.find(".js-facebook-btn").on("click",function(){window.open("https://www.facebook.com/sharer/sharer.php?u="+currentUrl,"",specs)});thisEl.find(".js-twitter-btn").on("click",function(){window.open("https://twitter.com/share?text="+blogSummary+"&url="+currentUrl,"",specs)});thisEl.find(".js-googleplus-btn").on("click",function(){window.open("https://plus.google.com/share?url="+currentUrl,"",specs)})}};BaseKit.Widget.Blogpost=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.BlogpostProperties,methods:BaseKit.Widget.BlogpostMethods})};bk$.fn.basekitWidgetBlogpost=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Blogpost(el,options))})}})();(function(){BaseKit.Widget.Blogpostlist=null;BaseKit.Widget.BlogpostlistProperties={postDisplayType:"summary"};BaseKit.Widget.BlogpostlistMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Blogpostlist=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.BlogpostlistProperties,methods:BaseKit.Widget.BlogpostlistMethods})};bk$.fn.basekitWidgetBlogpostlist=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Blogpostlist(el,options))})}})();(function(){BaseKit.Widget.Blogsearch={};BaseKit.Widget.BlogsearchProperties={};BaseKit.Widget.BlogsearchMethods={construct:function(el,options){this.options=options;this.load()},load:function(){this.attachEvents()},attachEvents:function(){var that=this;bk$(this.el).find(".js-blogsearch-form").on("submit",function(evt){that.submitSearch(evt)})},submitSearch:function(evt){var value=bk$(this.el).find(".js-blogsearch-input").val();evt.preventDefault();if(!value.length){return}window.location.href=Server.plugins.blog.searchUrl+encodeURIComponent(value)}};BaseKit.Widget.Blogsearch=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.BlogsearchProperties,methods:BaseKit.Widget.BlogsearchMethods})};bk$.fn.basekitWidgetBlogsearch=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Blogsearch(el,options))})}})();(function(){BaseKit.Widget.ButtonProperties={action:"none",text:App.t("widgets.button.default_text","Button"),url:"",target:"New",align:""};BaseKit.Widget.ButtonMethods={construct:function(el,options){this.options=options;this.load()},load:function(){this.attachEvents()},attachEvents:function(){var that=this,url=null,action=null,target=null;bk$(this.el).find(".js-btn").on("click",function(e){action=that.get("action");url=that.get("url");target=that.get("target");if(action!=="none"&&action!==null){if(target!=="_blank"){window.location=url}else{window.open(url)}}})}};BaseKit.Widget.Button=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.ButtonProperties,methods:BaseKit.Widget.ButtonMethods})};bk$.fn.basekitWidgetButton=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Button(el,options))})}})();(function(){BaseKit.Widget.BuynowProperties={showNames:0,buttonText:""};BaseKit.Widget.BuynowMethods={construct:function(el,options){this.options=options;this.load()},load:function(){this.attachEvents();this.loadPaymentAndPackage()},loadPaymentAndPackage:function(){var that=this,t=null;t=setTimeout(function(){clearTimeout(t);that.loadPackageInfo();that.loadBrandPaymentMethods()},200)},attachEvents:function(){this.toggleShowHidePassword();this.buttonClickEvent();this.inputEvents();this.checkFieldsForSubmit();this.selectPaymentPeriodEvent()},inputEvents:function(){var that=this;this.el.find("input").off("keyup").on("keyup",function(){that.checkFieldsForSubmit();that.clearErrorMessages()})},checkFieldsForSubmit:function(){var empty=false,thisEl=this.el;thisEl.find("input").each(function(){if(bk$(this).val().length===0){empty=true}});if(empty){thisEl.find(".js-buynow-make-payment-btn").attr("disabled","disabled")}else{thisEl.find(".js-buynow-make-payment-btn").removeAttr("disabled")}},clearErrorMessages:function(){this.el.find(".errors").each(function(){bk$(this).empty()})},buttonClickEvent:function(){var that=this,thisEl=bk$(this.el),button=thisEl.find(".js-buynow-make-payment-btn"),submitData={};thisEl.find("form").on("submit",function(e){var onSuccess;e.preventDefault();onSuccess=function(response){submitData={email:thisEl.find(".js-input-buynow-email").val(),firstName:thisEl.find(".js-input-buynow-first-name").val(),lastName:thisEl.find(".js-input-buynow-last-name").val(),password:thisEl.find(".js-input-password").val(),brandRef:that.get("brandRef"),currencyRef:App.getParam("currencyRef")||that.get("currencyRef"),paymentMethodRef:thisEl.find(".js-widget-buynow-paymentmethods input:checked").val(),packageRef:App.getParam("packageRef")||thisEl.find(".widget-buynow-package-name").attr("data-ref"),billingPeriodMonths:thisEl.find(".js-input-payment-period-annually").is(":checked")?12:1,newsletter:thisEl.find(".js-input-buynow-newsletter").is(":checked")?false:true,auth_token:response.token,languageCode:App.session.get("languageCode")};bk$.ajax({type:"POST",url:"/_bk/user-registration",data:submitData,async:false,beforeSend:function(){that.showMessageBox(App.t("widgets.buynow.processing","Creating your account...please wait"));button.addClass("spinner").attr("disabled","disabled")}}).done(function(response){document.location=response.url}).fail(function(response){if(response.status===503){that.showText(false,App.t("widgets.userregistration.error.maintenance","We’re temporarily offline for maintenance; this is usually pretty quick, so check back soon. We apologise for the inconvenience."));return}var errors=that.getErrorsFromResponse(response),message=that.getRegistrationMessageAndFieldFromErrors(errors).message,field=that.getRegistrationMessageAndFieldFromErrors(errors).field;if(message){thisEl.find(".filed-error-"+field).text(message)}else{that.showText(false,App.t("widgets.buynow.failed","Sorry we were unable to create your account. Please contact support."))}}).always(function(){button.removeClass("spinner");that.removeMessageBox()})};bk$.ajax({type:"POST",url:"/_bk/auth-token",success:onSuccess})})},selectPaymentPeriodEvent:function(){var thisEl=bk$(this.el),price=null,that=this;thisEl.find('input[name="paymentPeriod"]').on("change",function(){price=that.loadPackageInfo(false).price;thisEl.find(".js-buynow-package-price").text(price)})},loadBrandPaymentMethods:function(){var that=this;bk$.ajax({type:"POST",url:"/_bk/brand-payment-methods",data:{brandRef:this.get("brandRef")},async:false,beforeSend:function(){bk$(that.el).find(".js-widget-buynow-paymentmethods").html(""+App.t("widgets.buynow.retrieving_paymentmethods","Waiting for the paymentmethods")+"");that.showMessageBox()}}).done(function(response){that.set("paymentMethods",response.paymentMethods,true);that.rerender()}).fail(function(response){var message=App.t("widgets.buynow.paymentmethods_fail","Failed to get payment methods");if(response.status===503&&bk$(that.el).find(".js-maintenance").length){return}if(response.status===503){message=App.t("widgets.buynow.error.maintenance","We’re temporarily offline for maintenance; this is usually pretty quick, so check back soon. We apologise for the inconvenience.")}that.showText(true,message)}).always(function(){that.removeMessageBox()})},showText:function(isSuccess,message){var thisEl=bk$(this.el),className=null;if(thisEl.find(".message-box").length>0){thisEl.find(".message-box").remove()}if(isSuccess){className="success"}else{className="fail"}thisEl.find(".overlay").addClass(className).append('
'+message+"
")},showMessageBox:function(message){var thisEl=bk$(this.el),msg=message||"",overlay=bk$('
'+msg+"
");if(thisEl.find(".overlay").length===0){thisEl.append(overlay)}},removeMessageBox:function(){var thisEl=bk$(this.el),t=null;t=setTimeout(function(){clearTimeout(t);thisEl.find(".overlay").fadeOut(function(){thisEl.find(".email, .message").val("");bk$(this).remove()})},3e3)},loadPackageInfo:function(doRerender){var that=this,thisEl=bk$(this.el),packageData={},data={brandRef:this.get("brandRef"),currencyRef:this.get("currencyRef"),billingPeriodMonths:thisEl.find(".js-input-payment-period-monthly").is(":checked")?1:12,languageCode:App.session.get("languageCode")};if(App.getParam("packageRef")!==null){data.packageRef=App.getParam("packageRef")}if(App.getParam("currencyRef")!==null){data.currencyRef=App.getParam("currencyRef")}bk$.ajax({type:"POST",url:"/_bk/get-package",data:data,async:false,beforeSend:function(){if(doRerender!==false){bk$(that.el).find(".js-buynow-package").html(""+App.t("widgets.buynow.retrieving_package","Waiting for the package inforamtion")+"");that.showMessageBox()}}}).done(function(response){if(!bk$.isEmptyObject(response)){packageData={name:response.name,ref:response.ref};if(response.prices&&response.prices.length>0){bk$.each(response.prices,function(index,value){packageData.price=this.price;packageData.formattedPrice=this.formattedPrice})}}that.set("packageData",packageData,true);if(doRerender!==false){that.rerender()}}).fail(function(response){var message=App.t("widgets.buynow.packageinfo_fail","Failed to get package methods");if(response.status===503&&bk$(that.el).find(".js-maintenance").length){return}if(response.status===503){message=App.t("widgets.buynow.error.maintenance","We’re temporarily offline for maintenance; this is usually pretty quick, so check back soon. We apologise for the inconvenience.")}that.showText(true,message)}).always(function(){that.removeMessageBox()});return packageData},toggleShowHidePassword:function(){var thisEl=bk$(this.el),passwordInputEl=thisEl.find(".password");thisEl.find(".js-password-mask-toggle-btn").on("click",function(){if(passwordInputEl[0].type==="password"){passwordInputEl[0].type="text";passwordInputEl.attr("autocapitalize","off").attr("autocorrect","off").attr("spellcheck","false");bk$(this).text(App.t("widgets.buynow.hide","Hide"))}else{passwordInputEl[0].type="password";passwordInputEl.removeAttr("autocapitalize").removeAttr("autocorrect").removeAttr("spellcheck");bk$(this).text(App.t("widgets.buynow.show","Show"))}})}};BaseKit.Widget.Buynow=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.BuynowProperties,methods:BaseKit.Widget.BuynowMethods})};bk$.fn.basekitWidgetBuynow=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Buynow(el,options))})}})();(function(){BaseKit.Widget.Clicktocall=null;BaseKit.Widget.ClicktocallProperties={phone:"profile",align:"",phoneText:App.t("widgets.clicktocall.default_text","Click to call")};BaseKit.Widget.ClicktocallMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Clicktocall=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.ClicktocallProperties,methods:BaseKit.Widget.ClicktocallMethods})};bk$.fn.basekitWidgetClicktocall=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Clicktocall(el,options))})}})();(function(){BaseKit.Widget.CompanyaddressProperties={};BaseKit.Widget.CompanyaddressMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Companyaddress=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.CompanyaddressProperties,methods:BaseKit.Widget.CompanyaddressMethods})};bk$.fn.basekitWidgetCompanyaddress=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Companyaddress(el,options))})}})();(function(){BaseKit.Widget.CompanyheaderProperties={showLogo:1,showText:1};BaseKit.Widget.CompanyheaderMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Companyheader=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.CompanyheaderProperties,methods:BaseKit.Widget.CompanyheaderMethods})};bk$.fn.basekitWidgetCompanyheader=function(options){this.each(function(index,el){var obj=null;obj=new BaseKit.Widget.Companyheader(el,options);bk$(el).data("bkob",obj)})}})();(function(){BaseKit.Widget.Companyname=null;BaseKit.Widget.CompanynameProperties={business:"profile"};BaseKit.Widget.CompanynameMethods={construct:function(el,options){this.options=options}};BaseKit.Widget.Companyname=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.CompanynameProperties,methods:BaseKit.Widget.CompanynameMethods})};bk$.fn.basekitWidgetCompanyname=function(options){this.each(function(index,el){var obj=null;obj=new BaseKit.Widget.Companyname(el,options);bk$(el).data("bkob",obj)})}})();(function(){BaseKit.Widget.Contactform=null;BaseKit.Widget.ContactformProperties={email:"profile",text:App.t("widgets.contactform.default_button_text","Send"),formTitle:App.t("widgets.contactform.default_title","Contact Form")};BaseKit.Widget.ContactformMethods={construct:function(el,options){this.load()},load:function(){this.attachEvents()},attachEvents:function(){var that=this,thisEl=bk$(this.el),url="/_bk/submit-form",data={},emailRegex=/.+@.+/;thisEl.find(".js-form").on("submit",function(e){var fail=false;e.preventDefault();data={emailFrom:thisEl.find(".js-email-input").val(),message:thisEl.find(".js-message-input").val(),useProfile:that.get("email")==="profile"?1:0,formTitle:that.get("formTitle"),widgetId:thisEl.attr("id"),hostname:window.location.hostname,siteRef:App.session.get("siteRef")};if(thisEl.find(".overlay").length>0){thisEl.find(".overlay").removeClass("fail success")}that.removeMessage();that.showMessageBox();if(!data.emailFrom.length){that.showMessage(App.t("widgets.form.empty_email","Please enter an email address."),"fail");fail=true}if(!data.message.length&&!fail){that.showMessage(App.t("widgets.form.empty_message","Please enter a message."),"fail");fail=true}if(!emailRegex.test(data.emailFrom)&&!fail){that.showMessage(App.t("widgets.form.invalid_email","Please enter a valid email address."),"fail");fail=true}if(fail===true){that.enableForm();return}bk$.ajax({url:url,type:"POST",data:data,success:function(){if(that.get("goalUrl")){window.location=that.get("goalUrl")}else{that.showMessage(App.t("widgets.form.success","Message sent successfully."),"success");that.removeMessageBox()}},error:function(){that.showMessage(App.t("widgets.form.failed","Submit failed."),"fail");that.removeMessageBox()}})})},enableForm:function(){bk$(this.el).find("form").removeClass("submitting")},showMessage:function(message,className){var thisEl=bk$(this.el);if(!message){return}if(thisEl.find(".message-box").length>0){thisEl.find(".message-box").remove()}thisEl.find(".overlay").addClass(className).append('
'+message+"
")},removeMessage:function(){bk$(this.el).find(".overlay .message-box").remove()},showMessageBox:function(){var thisEl=bk$(this.el),overlay=bk$('
'),formEl=null;if(thisEl.find(".overlay").length===0){thisEl.append(overlay)}formEl=thisEl.find("form");if(formEl.length>0){formEl.addClass("submitting")}},removeMessageBox:function(){var thisEl=bk$(this.el),t=null,formEl=null;formEl=thisEl.find("form");if(formEl.length>0){formEl.removeClass("submitting")}thisEl.find(".js-email-input, .js-message-input").val("");t=setTimeout(function(){clearTimeout(t);thisEl.find(".overlay").fadeOut(function(){bk$(this).remove()})},1e4)}};BaseKit.Widget.Contactform=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.ContactformProperties,methods:BaseKit.Widget.ContactformMethods})};bk$.fn.basekitWidgetContactform=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Contactform(el,options))})}})();(function(){BaseKit.Widget.Content=null;BaseKit.Widget.ContentProperties={lines:"all",content:""};BaseKit.Widget.ContentMethods={construct:function(el,options){this.load()},load:function(){if(this.get("ref")!==null){this.showLines(this.get("lines"))}},renderFinish:function(){this.showLines(this.get("lines"))},showLines:function(lines){if(typeof lines!=="undefined"){var contentEl=bk$(this.el).find(".js-text-content"),contentElHeight=null,newheight=null;contentEl.height("auto");contentElHeight=contentEl.height();switch(lines){case"one":newheight=contentElHeight*25/100;this.expandText(newheight,contentElHeight);contentEl.css("overflow","hidden");break;case"two":newheight=contentElHeight*50/100;this.expandText(newheight,contentElHeight);contentEl.css("overflow","hidden");break;case"all":newheight="auto";break}contentEl.height(newheight)}},expandText:function(newheight,fullheight){if(typeof newheight!=="undefined"&&typeof fullheight!=="undefined"){var thisEl=bk$(this.el),expandSpan=thisEl.find("span.expand"),contentTextEl=thisEl.find(".js-text-content"),h=null;expandSpan.bind("click",function(){if(contentTextEl.height()===parseInt(fullheight,10)){thisEl.find(".more").show();thisEl.find(".less").hide();h=newheight}else{thisEl.find(".more").hide();thisEl.find(".less").show();h=fullheight}contentTextEl.stop().animate({height:h},500)})}}};BaseKit.Widget.Content=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.ContentProperties,methods:BaseKit.Widget.ContentMethods})};bk$.fn.basekitWidgetContent=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Content(el,options))})}})();(function(){BaseKit.Widget.Disqus={};BaseKit.Widget.DisqusProperties={};BaseKit.Widget.DisqusMethods={construct:function(el,options){this.options=options}};BaseKit.Widget.Disqus=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.DisqusProperties,methods:BaseKit.Widget.DisqusMethods})};bk$.fn.basekitWidgetDisqus=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Disqus(el,options))})}})();(function(){BaseKit.Widget.Donation={};BaseKit.Widget.DonationProperties={orgType:"otherorgs"};BaseKit.Widget.DonationMethods={construct:function(el,options){}};BaseKit.Widget.Donation=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.DonationProperties,methods:BaseKit.Widget.DonationMethods})};bk$.fn.basekitWidgetDonation=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Donation(el,options))})}})();(function(){BaseKit.Widget.DropboxProperties={iconColor:"black",text:App.t("widgets.dropbox.default_text","Download"),align:"",showFileName:0};BaseKit.Widget.DropboxMethods={construct:function(el,options){this.options=options;this.load()},load:function(){this.attachEvents()},attachEvents:function(){var that=this;bk$(this.el).find(".js-link-btn").on("click",function(e){var link=bk$(this).data("link"); if(link===undefined||link.length===0){alert(App.t("widgets.dropbox.no_file_added","No file added"))}else{window.open(link)}})}};BaseKit.Widget.Dropbox=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.DropboxProperties,methods:BaseKit.Widget.DropboxMethods})};bk$.fn.basekitWidgetDropbox=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Dropbox(el,options))})}})();(function(){BaseKit.Widget.Ecombasket=null;BaseKit.Widget.EcombasketProperties={};BaseKit.Widget.EcombasketMethods={construct:function(el,options){this.options=options;if(!Server.plugins.ecommerce){return}this.load()},load:function(){var that=this;Globals.addHook("ecom.basket.changed",this,function(cart){that.updateBasket(cart)});this.attachEvents()},attachEvents:function(){var that=this,thisEl=bk$(this.el);thisEl.find(".js-pull").on("click",function(){thisEl.toggleClass("show-content");bk$(document).on("click.ecombasket",function(evt){if(!bk$(evt.target).closest(".ecombasket").length){thisEl.toggleClass("show-content");bk$(document).off("click.ecombasket")}})});thisEl.find(".js-remove").on("click",function(e){that.removeItem(bk$(e.target).attr("data-ref"))})},updateBasket:function(cart){this.set("items",cart.items,true);this.set("itemCount",cart.itemCount,true);this.set("subTotal",cart.subTotal,true);this.set("subTotalInclTax",cart.subTotalInclTax,true);this.rerender()},removeItem:function(ref){bk$.ajax({method:"POST",url:"/store/cart/remove-item",data:{productVariantRef:ref}}).done(function(response){Globals.notifyHooks("ecom.basket.changed",response)})}};BaseKit.Widget.Ecombasket=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.EcombasketProperties,methods:BaseKit.Widget.EcombasketMethods})};bk$.fn.basekitWidgetEcombasket=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Ecombasket(el,options))})}})();(function(){BaseKit.Widget.Ecombasketsummary=null;BaseKit.Widget.EcombasketsummaryProperties={sitePrimaryDomain:Server.app.mode!=="edit"?Server.desktopSite.getPrimaryDomain():null};BaseKit.Widget.EcombasketsummaryMethods={construct:function(el,options){this.options=options;if(!Server.plugins.ecommerce){return}this.load()},load:function(){var that=this;Globals.addHook("ecom.basket.changed",this,function(cart){that.updateBasketSummary(cart)});this.attachEvents();this.set("emptyItems",this.getEmptyItems(Server.plugins.ecommerce.cart.items),true)},attachEvents:function(){var that=this;bk$(this.el).find(".js-add").off("click").on("click",function(e){that.addItem(bk$(this).data("ref"))});bk$(this.el).find(".js-remove").off("click").on("click",function(e){that.removeItem(bk$(this).data("ref"))})},updateBasketSummary:function(cart){cart.items=_.union(cart.items,this.get("emptyItems"));this.set("items",cart.items,true);this.set("itemCount",cart.itemCount,true);this.set("subTotal",cart.subTotal,true);this.set("subTotalInclTax",cart.subTotalInclTax,true);this.rerender()},removeItem:function(ref){var that=this;bk$.ajax({method:"POST",url:"/store/cart/remove-item",data:{productVariantRef:ref}}).done(function(response){that.removeEmptyItem(ref);Globals.notifyHooks("ecom.basket.changed",response)})},addItem:function(ref){bk$(this.el).find(".js-add").attr("disabled",true);bk$.ajax({method:"POST",url:"/store/cart/add-item",data:{productVariantRef:ref}}).done(function(response){Globals.notifyHooks("ecom.basket.changed",response)})},removeEmptyItem:function(ref){var emptyItems=_.filter(this.get("emptyItems"),function(item){return item.ref!==ref});this.set("emptyItems",emptyItems,true)},getEmptyItems:function(items){return _.filter(items,function(item){return item.quantity===0})}};BaseKit.Widget.Ecombasketsummary=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.EcombasketsummaryProperties,methods:BaseKit.Widget.EcombasketsummaryMethods})};bk$.fn.basekitWidgetEcombasketsummary=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Ecombasketsummary(el,options))})}})();(function(){BaseKit.Widget.Ecomcategorieslist=null;BaseKit.Widget.EcomcategorieslistProperties={title:App.t("widgets.ecomcategorieslist.default_title","Categories"),showCount:true};BaseKit.Widget.EcomcategorieslistMethods={construct:function(el,options){}};BaseKit.Widget.Ecomcategorieslist=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.EcomcategorieslistProperties,methods:BaseKit.Widget.EcomcategorieslistMethods})};bk$.fn.basekitWidgetEcomcategorieslist=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Ecomcategorieslist(el,options))})}})();(function(){BaseKit.Widget.Ecomconfirmation=null;BaseKit.Widget.EcomconfirmationProperties={};BaseKit.Widget.EcomconfirmationMethods={construct:function(el,options){this.options=options;this.load()},load:function(){this.clearCart()},clearCart:function(){window.localStorage.removeItem("cart")}};BaseKit.Widget.Ecomconfirmation=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.EcomconfirmationProperties,methods:BaseKit.Widget.EcomconfirmationMethods})};bk$.fn.basekitWidgetEcomconfirmation=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Ecomconfirmation(el,options))})}})();(function(){BaseKit.Widget.Ecomfeaturedproducts=null;BaseKit.Widget.EcomfeaturedproductsProperties={limit:"20"};BaseKit.Widget.EcomfeaturedproductsMethods={construct:function(el,options){this.options=options}};BaseKit.Widget.Ecomfeaturedproducts=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.EcomfeaturedproductsProperties,methods:BaseKit.Widget.EcomfeaturedproductsMethods})};bk$.fn.basekitWidgetEcomfeaturedproducts=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Ecomfeaturedproducts(el,options))})}})();(function(){BaseKit.Widget.Ecomlegal=null;BaseKit.Widget.EcomlegalProperties={};BaseKit.Widget.EcomlegalMethods={construct:function(el,options){this.options=options}};BaseKit.Widget.Ecomlegal=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.EcomlegalProperties,methods:BaseKit.Widget.EcomlegalMethods})};bk$.fn.basekitWidgetEcomlegal=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Ecomlegal(el,options))})}})();(function(){BaseKit.Widget.Ecomproduct=null;BaseKit.Widget.EcomproductProperties={};BaseKit.Widget.EcomproductMethods={construct:function(el,options){this.options=options;this.animating=false;this.animationTimeout=null;if(!Server.plugins.ecommerce){return}this.load()},load:function(){this.set("translations",{"Add to cart":App.t("widgets.ecomproduct.add-to-cart","Add to cart"),Added:App.t("widgets.ecomproduct.added","Added")},true);if(!bk$(this.el).find('[name="product"]').length){return}var product=JSON.parse(bk$(this.el).find('[name="product"]').val());this.set("product",product,true);this.set("variants",product.variants,true);this.set("options",product.options,true);this.set("selectedVariant",product.defaultVariant,true);this.attachEvents()},attachEvents:function(){bk$(this.el).find(".js-option").on("change",this.dropdownChanged.bind(this));bk$(this.el).find(".js-ecom-product-add-to-cart-btn").on("click",this.addToCartButtonClicked.bind(this));Globals.addHook("ecom.basket.changed",this,this.handleCartChange);this.previewImageEvent()},previewImageEvent:function(){var thisEl=bk$(this.el),previewWrapper=thisEl.find(".js-ecom-product-preview-image-wrap"),previewImg=thisEl.find(".js-ecom-product-preview-image");thisEl.find(".js-ecom-product-image-wrap").on("click",function(){var src=bk$(this).find("img").attr("src");previewImg.attr("src",src);previewWrapper.attr("data-image-href",src);previewWrapper.css("background-image","url("+src+")");return false})},getCurrentOptionChoices:function(){var choices={};bk$(this.el).find(".js-option").each(function(i,option){choices[this.name]=parseInt(this.value,10)});return choices},dropdownChanged:function(event){var optionRef=parseInt(event.target.name,10),optionValueRef=parseInt(event.target.value,10);this.selectVariant(optionRef,optionValueRef);this.rerender()},handleCartChange:function(data){var that=this,cartItem=null,selectedVariant=null;_.each(that.get("variants"),function(variant){variant.cartQuantity=0;cartItem=_.findWhere(data.items,{ref:variant.ref});if(!cartItem){return}variant.cartQuantity=cartItem.quantity});selectedVariant=_.findWhere(this.get("variants"),{ref:this.get("selectedVariant").ref});that.set("selectedVariant",selectedVariant,true);if(this.animating===true){return}this.rerender()},selectVariant:function(optionRef,optionValueRef){var variant=this.findVariantWithOptionValues(this.getCurrentOptionChoices()),option;this.set("selectedVariant",variant,true);option=_.findWhere(this.get("options"),{ref:optionRef});option.selectedValue=optionValueRef},findVariantWithOptionValues:function(optionValuePairs){var that=this,variant=_.find(this.get("variants"),function(variant){var matches=true,option;if(variant.ref===that.get("product").primaryVariantRef){return false}_.each(optionValuePairs,function(value,key){option=_.findWhere(variant.options,{ref:parseInt(key,10)});if(option.value.ref!==value){matches=false}});return matches});if(variant){return variant}return null},addToCartButtonClicked:function(event){this.showAddingState();this.addToCart(this.get("selectedVariant").ref);return false},addToCart:function(variantRef){var cart=null,that=this;bk$.ajax({method:"POST",url:"/store/cart/add-item",data:{productVariantRef:variantRef}}).done(function(response){that.showAddedState();Globals.notifyHooks("ecom.basket.changed",response)}).fail(function(response){if(response.status===404&&(bk$("body").hasClass("in-tdk")||bk$("body").hasClass("min-tdk"))){that.showAddedState()}});return false},showAddingState:function(){var addButton=bk$(this.el).find(".js-ecom-product-add-to-cart-btn");this.animating=true;addButton.attr("disabled","disabled").addClass("submitting")},showAddedState:function(){var that=this,addButton=bk$(this.el).find(".js-ecom-product-add-to-cart-btn");addButton.removeClass("submitting").addClass("added").find(".text").text(this.get("translations")["Added"]);if(null!==this.animationTimeout){clearTimeout(this.animationTimeout)}this.animationTimeout=setTimeout(function(){that.animating=false;that.rerender()},500)}};BaseKit.Widget.Ecomproduct=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.EcomproductProperties,methods:BaseKit.Widget.EcomproductMethods})};bk$.fn.basekitWidgetEcomproduct=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Ecomproduct(el,options))})}})();(function(){BaseKit.Widget.Ecomproductslist=null;BaseKit.Widget.EcomproductslistProperties={productFiltering:1};BaseKit.Widget.EcomproductslistMethods={construct:function(el,options){this.options=options;this.load()},load:function(){this.attachEvents()},attachEvents:function(){var displayControl=bk$(this.el).find(".js-display-control"),form=bk$(this.el).find(".js-productlist-display-form");displayControl.on("change",function(){bk$(this).parents(".js-productlist-display-form").submit()});form.on("submit",function(e){var orderBy=bk$(e.currentTarget).find('[name="productlist-sort"] option[value="score-desc"]'),search=bk$(e.currentTarget).find('[name="productlist-search"]');if(!orderBy.length&&search.val()&&search.val().length){bk$(e.currentTarget).find('[name="productlist-sort"]').append('');bk$(e.currentTarget).find('[name="productlist-sort"]').val("score-desc")}})}};BaseKit.Widget.Ecomproductslist=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.EcomproductslistProperties,methods:BaseKit.Widget.EcomproductslistMethods})};bk$.fn.basekitWidgetEcomproductslist=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Ecomproductslist(el,options))})}})();(function(){BaseKit.Widget.EmbedProperties={};BaseKit.Widget.EmbedMethods={construct:function(el,options){this.options=options;this.load()},load:function(){var thisEl=bk$(this.el),code=this.get("code");if(typeof code!=="undefined"&&code!==null&&code.length>0){thisEl.find(".js-default").hide();if(this.get("debugMode")!==true){thisEl.find(".js-content").show().writeCapture().html(code,{proxyGetElementById:true,writeOnGetElementById:true})}}else{thisEl.find(".js-default").show();thisEl.find(".js-content").hide()}}};BaseKit.Widget.Embed=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.EmbedProperties,methods:BaseKit.Widget.EmbedMethods})};bk$.fn.basekitWidgetEmbed=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Embed(el,options))})}})();(function(){BaseKit.Widget.Extendednavigation=null;BaseKit.Widget.ExtendednavigationProperties={align:"center"};BaseKit.Widget.ExtendednavigationMethods={construct:function(el,options){this.load()},load:function(){this.attachEvents()},attachEvents:function(){this.menuDropdownEvent()},menuDropdownEvent:function(){var that=this,thisEl=bk$(this.el),pullEl=thisEl.find(".js-pull"),menuEl=thisEl.find(".js-menu-list");pullEl.off("click").on("click",function(e){e.preventDefault();if(!bk$("body").hasClass("edit")){menuEl.toggleClass("open")}})}};BaseKit.Widget.Extendednavigation=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.ExtendednavigationProperties,methods:BaseKit.Widget.ExtendednavigationMethods})};bk$.fn.basekitWidgetExtendednavigation=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Extendednavigation(el,options))})}})();(function(){BaseKit.Widget.Facebookcomments=null;BaseKit.Widget.FacebookcommentsProperties={numPosts:5,colorScheme:"light",orderBy:"social"};BaseKit.Widget.FacebookcommentsMethods={construct:function(el,options){this.load()},load:function(){if(typeof FB!=="undefined"){FB.XFBML.parse()}}};BaseKit.Widget.Facebookcomments=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.FacebookcommentsProperties,methods:BaseKit.Widget.FacebookcommentsMethods})};bk$.fn.basekitWidgetFacebookcomments=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Facebookcomments(el,options))});if(!document.getElementById("fb-root")){var fbDiv=document.createElement("div");fbDiv.setAttribute("id","fb-root");document.body.appendChild(fbDiv)}if(typeof FB==="undefined"){window.fbAsyncInit=function(){FB.init({appId:null,xfbml:true,version:"v2.0",status:false,cookie:false});FB.XFBML.parse(document.getElementById("fb-comments"))};(function(){var e=document.createElement("script");e.src=document.location.protocol+"//connect.facebook.net/en_US/sdk.js";e.async=true;document.getElementById("fb-root").appendChild(e)})()}else{FB.XFBML.parse(document.getElementById("fb-comments"))}}})();(function(){BaseKit.Widget.Facebooklike=null;BaseKit.Widget.FacebooklikeProperties={showFaces:true,action:"like",colorscheme:"light",layout:"standard",height:"80",font:"arial",locale:"en_US"};BaseKit.Widget.FacebooklikeMethods={construct:function(el,options){this.options=options;this.load()},load:function(){this.attachEvents()},attachEvents:function(){var that=this}};BaseKit.Widget.Facebooklike=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.FacebooklikeProperties,methods:BaseKit.Widget.FacebooklikeMethods})};bk$.fn.basekitWidgetFacebooklike=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Facebooklike(el,options))})}})();(function(){BaseKit.Widget.Feature=null;BaseKit.Widget.FeatureProperties={bgImg:"",header:App.t("widgets.feature.header_default","My great company"),strapline:App.t("widgets.feature.strapline_default","My strap line goes here"),url:"",action:"none",buttonText:App.t("widgets.feature.button_text","button text"),target:"New",showBtn:true};BaseKit.Widget.FeatureMethods={construct:function(el,options){this.load()},load:function(){this.attachEvents()},attachEvents:function(){var that=this,url=null,action=null,target=null;bk$(this.el).find(".js-feature-btn").on("click",function(e){action=that.get("action");url=that.get("url");target=that.get("target");if(action!=="none"&&action!==null){if(target!=="_blank"){window.location=url}else{window.open(url)}}})}};BaseKit.Widget.Feature=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.FeatureProperties,methods:BaseKit.Widget.FeatureMethods})};bk$.fn.basekitWidgetFeature=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Feature(el,options))})}})();(function(){BaseKit.Widget.Fonectacontactform=null;BaseKit.Widget.FonectacontactformProperties={email:"profile",text:App.t("widgets.fonectacontactform.default_button_text","Send"),marketingText:App.t("widgets.fonectacontactform.default_marketing_text","<>"),formTitle:App.t("widgets.fonectacontactform.default_title","Contact Form")};BaseKit.Widget.FonectacontactformMethods={construct:function(el,options){this.load()},load:function(){this.attachEvents()},attachEvents:function(){var that=this,thisEl=bk$(this.el),url="/_bk/fonecta-crm",requestBody={},emailRegex=/.+@.+/;thisEl.find("form").on("submit",function(e){e.preventDefault();requestBody={siteRef:App.session.get("siteRef"),email:thisEl.find(".js-email-input").val(),name:thisEl.find(".js-name-input").val(),phone:thisEl.find(".js-phone-input").val(),message:thisEl.find(".js-message-textarea").val(),product:thisEl.find(".js-product-input").val(),marketingPermissionEmail:thisEl.find(".js-marketing-email-permission").prop("checked")?1:0,marketingPermissionPhone:thisEl.find(".js-marketing-phone-permission").prop("checked")?1:0,languageCode:App.session.get("languageCode")};if(thisEl.find(".overlay").length>0){thisEl.find(".overlay").removeClass("fail success")}that.removeMessage();that.showMessageBox();if(!requestBody.email.length){that.showMessage(App.t("widgets.form.empty_email","Please enter an email address."),"fail");return}if(!requestBody.message.length){that.showMessage(App.t("widgets.form.empty_message","Please enter a message."),"fail");return}if(!emailRegex.test(requestBody.email)){that.showMessage(App.t("widgets.form.invalid_email","Please enter a valid email address."),"fail");return}bk$.ajax({url:url,type:"POST",data:requestBody,success:this._postSubmit.bind(this),error:this._postSubmit.bind(this)})}.bind(this));this.setupPopupEvent()},_postSubmit:function(){if(this.get("goalUrl")){window.location=this.get("goalUrl")}else{this.showMessage(App.t("widgets.form.success","Message sent successfully."),"success");this.removeMessageBox()}},setupPopupEvent:function(){bk$(this.el).find(".js-legal-popup").on("click",this.openPopup.bind(this));bk$(this.el).find(".js-legal-popuop-close, .js-legal-popuop-close-icon").on("click",this.hidePopup.bind(this));bk$(window).on("resize.fonectacontactform",this.positionPopup.bind(this))},openPopup:function(){this.positionPopup();bk$(this.el).find(".js-legal").removeAttr("hidden")},positionPopup:function(){var windowWidth=window.innerWidth,windowHeight=window.innerHeight;bk$(this.el).find(".js-legal-content").css({width:windowWidth-70});bk$(this.el).find(".js-legal-inner").css({height:windowHeight-120})},hidePopup:function(){bk$(this.el).find(".js-legal").attr("hidden",true)},showMessage:function(message,className){var thisEl=bk$(this.el);if(!message){return}if(thisEl.find(".message-box").length>0){thisEl.find(".message-box").remove()}thisEl.find(".overlay").addClass(className).append('
'+message+"
")},removeMessage:function(){bk$(this.el).find(".overlay .message-box").remove()},showMessageBox:function(){var thisEl=bk$(this.el),overlay=bk$('
'),formEl=null;if(thisEl.find(".overlay").length===0){thisEl.append(overlay)}formEl=thisEl.find("form");if(formEl.length>0){formEl.addClass("submitting")}},removeMessageBox:function(){var thisEl=bk$(this.el),timeout=null,formEl=null;formEl=thisEl.find("form");if(formEl.length>0){formEl.removeClass("submitting")}thisEl.find(".js-email-input, .js-name-input, .js-phone-input, .js-product-input, .js-message-textarea").val("");timeout=setTimeout(function(){clearTimeout(timeout);thisEl.find(".overlay").fadeOut(function(){bk$(this).remove()})},1e4)}};BaseKit.Widget.Fonectacontactform=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.FonectacontactformProperties,methods:BaseKit.Widget.FonectacontactformMethods})};bk$.fn.basekitWidgetFonectacontactform=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Fonectacontactform(el,options))})}})();(function(){BaseKit.Widget.Fonectamap={};BaseKit.Widget.FonectamapProperties={zoom:12,zoomControl:true,height:200,markerPath:"/apps/images/mobile/widgets/fonectamapmarker.png"};BaseKit.Widget.FonectamapMethods={construct:function(el,options){this.fonectamap=null;this.mapViewId="mapView"+Date.now();if(Site.Page.Globals.fonectamapsAPILoaded===undefined||Site.Page.Globals.fonectamapsAPILoaded===null){Site.Page.Globals.fonectamapsAPILoaded=false}this.load()},load:function(){var that=this,script;bk$(this.el).find(".js-fonectamap").attr("id",this.mapViewId);if(Site.Page.Globals.fonectamapsAPILoaded===false&&bk$("#fonectamaps-widget-script").length===0){script=document.createElement("script");script.type="text/javascript";script.id="fonectamaps-widget-script";script.src="https://kartta.fonecta.fi/js3/scripts/oym-https-1.6.1.js";script.addEventListener("load",function(){Site.Page.Globals.fonectamapsAPILoaded=true;that.loadMap()});document.head.appendChild(script)}else{this.isMapReady()}},isMapReady:function(){var that=this;if(Site.Page.Globals.fonectamapsAPILoaded===false){setTimeout(function(){that.isMapReady()},10)}else{this.loadMap()}},loadMap:function(){com.oym.load("dhtml","onModulesLoaded",this)},onModulesLoaded:function(){com.oym.geokit.REFFERER="&Referer=https://*.omakotisivu.fi&fc=1";var that=this,userAddress=Profile.get("address")+" "+Profile.get("address1")+" "+Profile.get("postalcode"),request=new com.oym.geokit.FreeFormRequest(userAddress,"FI"),conf=new com.oym.geokit.Config("FO1349G5NGDTJ52H913SFRK63998");try{conf.setBaseUrl("kartta.fonecta.fi/oym");conf.setProtocol("https");conf.setCustomHosts(["t1-","t2-","t3-","t4-"]);this.fonectamap=new com.oym.geokit.GeoKit(conf);this.fonectamap.executeRequest(request,function(geoResult){that.setMapPosition(geoResult);that.renderMap()},this)}catch(e){console.log(e)}},setMapPosition:function(address){this.setLatLng(address);this.mapPosition=new com.oym.geokit.Position(com.oym.geokit.COORDINATE_SYSTEM.WGS84,this.get("mapLongitude"),this.get("mapLatitude"))},setLatLng:function(address){var position=null;if(address&&address.isError!==true){position=address[0].getPosition();this.isGeoResultFound=true;this.set("mapLatitude",position.getLatitude(),true);this.set("mapLongitude",position.getLongitude(),true)}else{this.isGeoResultFound=false;this.set("mapLatitude","",true);this.set("mapLongitude","",true)}},renderMap:function(){var mapConf=new com.oym.geokit.MapConfig(["RM"]);mapConf.setCenter(this.mapPosition);mapConf.setZoomLevel(parseInt(this.get("zoom"),10));bk$(this.el).height(this.get("height"));this.fonectamap.startMapView(mapConf,this.mapViewId);this.fonectamap.unregisterEvent("onMapViewLoaded");this.fonectamap.registerEvent("onMapViewLoaded",this.onMapViewLoaded,this)},onMapViewLoaded:function(){this.setUpControls();if(this.isGeoResultFound){this.setMapMarkerOverlay()}},setUpControls:function(){this.fonectamap.showZoomSlider();this.fonectamap.showMapTypeChooser();this.fonectamap.showScalebar()},setMapMarkerOverlay:function(){var icon=null,marker=null;if(this.fonectamap!==null&&Site.Page.Globals.fonectamapsAPILoaded===true){icon=new com.oym.geokit.MarkerIcon(new com.oym.geokit.Size(27,48),new com.oym.geokit.PixelPosition(0,0),App.session.get("assetBaseUrl")+this.get("markerPath"));marker=new com.oym.geokit.Marker(this.mapPosition,icon);this.fonectamap.removeAllOverlays();this.fonectamap.addOverlay(marker)}},resetMap:function(positionChanged){if(positionChanged){this.resetMapPosition()}else{this.updateMapView()}},resetMapPosition:function(){var that=this,userAddress=Profile.get("address")+" "+Profile.get("address1")+" "+Profile.get("postalcode"),request=new com.oym.geokit.FreeFormRequest(userAddress,"FI"),hasGeoResultFound=this.isGeoResultFound;this.fonectamap.executeRequest(request,function(geoResult){that.setMapPosition(geoResult);if(hasGeoResultFound){that.updateMapView()}else{that.renderMap()}},this)},updateMapView:function(){this.fonectamap.setCenter(this.mapPosition);this.fonectamap.setZoomLevel(parseInt(this.get("zoom"),10));bk$(this.el).height(this.get("height"));if(this.isGeoResultFound){this.setMapMarkerOverlay()}this.fonectamap.updateView()}};BaseKit.Widget.Fonectamap=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.FonectamapProperties,methods:BaseKit.Widget.FonectamapMethods})};bk$.fn.basekitWidgetFonectamap=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Fonectamap(el,options))})}})();(function(){BaseKit.Widget.ForgottenpasswordProperties={passwordResetPage:"home",label:App.t("widgets.forgottenpassword.email","Email"),text:App.t("widgets.forgottenpassword.button_text","Send")};BaseKit.Widget.ForgottenpasswordMethods={construct:function(el,options){this.load()},load:function(){this.attachEvents()},attachEvents:function(){var that=this,thisEl=bk$(this.el),user;thisEl.find("form").on("submit",function(e){e.preventDefault();var data={passwordResetPage:that.get("passwordResetPage")};if(thisEl.find("input.js-username-input").length){data.username=thisEl.find("input.js-username-input").val()}else{data.email=thisEl.find("input[type='email']").val()}if(data.username===0&&data.email===0){return}bk$.ajax({type:"POST",url:"_bk/auth-token",async:false}).done(function(response){data.token=response.token;bk$.ajax({url:"_bk/forgotten-password",type:"POST",data:data,beforeSend:function(){that.showMessageBox()}}).always(function(){that.removeMessageBox()}).done(function(response){var message=App.t("widgets.forgottenpassword.success","Reset password email sent successfully.");that.showText(true,message)}).fail(function(response){var errors=App.getErrorsFromResponse(response),message=null;if(response.status===503){that.showText(false,App.t("widgets.forgottenpassword.error.maintenance","We’re temporarily offline for maintenance; this is usually pretty quick, so check back soon. We apologise for the inconvenience."));return}bk$.each(errors,function(i,value){if(value.field==="email"){message=value.message;return}});if(message){that.showText(false,message)}else{that.showText(false,App.t("widgets.forgottenpassword.failed","Submit failed."))}})}).fail(function(response){var message=App.t("widgets.forgottenpassword.auth_fail","Failed to get authentication token");that.showText(true,message)})})},showText:function(isSuccess,message){var thisEl=bk$(this.el),className=null;if(thisEl.find(".message-box").length>0){thisEl.find(".message-box").remove()}if(isSuccess){className="success"}else{className="fail"}thisEl.find(".overlay").addClass(className).append('
'+message+"
")},showMessageBox:function(){var thisEl=bk$(this.el),overlay=bk$('
');if(thisEl.find(".overlay").length===0){thisEl.append(overlay)}},removeMessageBox:function(){var thisEl=bk$(this.el),t=null;t=setTimeout(function(){clearTimeout(t);thisEl.find(".overlay").fadeOut(function(){thisEl.find(".js-email, .message").val("");bk$(this).remove()})},3e3)}};BaseKit.Widget.Forgottenpassword=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.ForgottenpasswordProperties,methods:BaseKit.Widget.ForgottenpasswordMethods})};bk$.fn.basekitWidgetForgottenpassword=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Forgottenpassword(el,options))})}})();(function(){BaseKit.Widget.Gallery=null;BaseKit.Widget.GalleryProperties={widgetType:"widget.gallery",imageScale:"original",showTitle:1,showDescription:1,albumRef:0,images:[]};BaseKit.Widget.GalleryMethods={construct:function(el,options){this.load()},load:function(){}};BaseKit.Widget.Gallery=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.GalleryProperties,methods:BaseKit.Widget.GalleryMethods})};bk$.fn.basekitWidgetGallery=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Gallery(el,options))})}})();(function(){BaseKit.Widget.Image=null;BaseKit.Widget.ImageProperties={description:"",linkUrl:"none",target:"none",action:"none",scale:"original",imageWidth:"auto",alt:"",title:"",widgetType:"widget.image",align:null};BaseKit.Widget.ImageMethods={construct:function(el,options){this.load()},load:function(){}};BaseKit.Widget.Image=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.ImageProperties,methods:BaseKit.Widget.ImageMethods})};bk$.fn.basekitWidgetImage=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Image(el,options))})}})();(function(){BaseKit.Widget.Line=null;BaseKit.Widget.LineProperties={thickness:"inherit",padding:"inherit",length:"inherit",align:""};BaseKit.Widget.LineMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Line=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.LineProperties,methods:BaseKit.Widget.LineMethods})};bk$.fn.basekitWidgetLine=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Line(el,options))})}})();(function(){BaseKit.Widget.Linkedincompanyprofile={};BaseKit.Widget.LinkedincompanyprofileProperties={linkedinID:"",source:"companyName"};BaseKit.Widget.LinkedincompanyprofileMethods={construct:function(el,options){this.options=options;if(Site.Page.Globals.linkinInAPILoaded===undefined||Site.Page.Globals.linkinInAPILoaded===null){Site.Page.Globals.linkinInAPILoaded=false}this.load()},load:function(){var that=this;if(Site.Page.Globals.linkinInAPILoaded===false&&bk$("#linkedin-script").length===0){bk$.getScript("//platform.linkedin.com/in.js",function(){bk$(this).attr("id","linkedin-script");Site.Page.Globals.linkinInAPILoaded=true})}else{this.rebuild()}},attachEvents:function(){this.rebuild()},rebuild:function(){if(IN&&typeof IN.parse==="function"){IN.parse()}}};BaseKit.Widget.Linkedincompanyprofile=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.LinkedincompanyprofileProperties,methods:BaseKit.Widget.LinkedincompanyprofileMethods})};bk$.fn.basekitWidgetLinkedincompanyprofile=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Linkedincompanyprofile(el,options))})}})();(function(){BaseKit.Widget.Linkedinprofile={};BaseKit.Widget.LinkedinprofileProperties={};BaseKit.Widget.LinkedinprofileMethods={construct:function(el,options){this.options=options;if(Site.Page.Globals.linkinInAPILoaded===undefined||Site.Page.Globals.linkinInAPILoaded===null){Site.Page.Globals.linkinInAPILoaded=false}this.load()},load:function(){var that=this;if(Site.Page.Globals.linkinInAPILoaded===false&&bk$("#linkinedin-widget-script").length===0){bk$.getScript("//platform.linkedin.com/in.js?suppressWarnings=true",function(){bk$(this).attr("id","linkinedin-widget-script");Site.Page.Globals.linkinInAPILoaded=true})}else{this.rebuild()}},attachEvents:function(){this.rebuild()},rebuild:function(){if(IN&&typeof IN.parse==="function"){IN.parse()}}};BaseKit.Widget.Linkedinprofile=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.LinkedinprofileProperties, methods:BaseKit.Widget.LinkedinprofileMethods})};bk$.fn.basekitWidgetLinkedinprofile=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Linkedinprofile(el,options))})}})();(function(){BaseKit.Widget.Logo=null;BaseKit.Widget.LogoProperties={};BaseKit.Widget.LogoMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Logo=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.LogoProperties,methods:BaseKit.Widget.LogoMethods})};bk$.fn.basekitWidgetLogo=function(options){this.each(function(index,el){var obj=null;obj=new BaseKit.Widget.Logo(el,options);bk$(el).data("bkob",obj)})}})();(function(){BaseKit.Widget.Map={};BaseKit.Widget.MapProperties={zoom:12,zoomControl:true,height:150,address:"profile",markerPath:"/apps/images/mobile/map-marker.png"};BaseKit.Widget.MapMethods={construct:function(el,options){this.gmap=null;this.marker=null;if(window.mapReady===undefined){window.mapReady=function(){Site.Page.Globals.mapsAPILoaded=true}}if(Site.Page.Globals.mapsAPILoaded===undefined||Site.Page.Globals.mapsAPILoaded===null){Site.Page.Globals.mapsAPILoaded=false}this.load()},load:function(){var t=false,that=this,script;this.onResize=function(){if(t!==false){clearTimeout(t)}t=setTimeout(function(){that.resetMap()},300)};bk$(window).on("resize.map",this.onResize);if(Site.Page.Globals.mapsAPILoaded===false&&bk$("#gmaps-widget-script").length===0){script=document.createElement("script");script.type="text/javascript";script.id="gmaps-widget-script";script.src="https://maps.google.com/maps/api/js?sensor=false&callback=mapReady&language="+App.session.get("languageCode");document.body.appendChild(script)}this.isMapReady()},getProfileAddress:function(){return[Profile.get("address"),Profile.get("address1"),Profile.get("address2"),Profile.get("postalcode")].filter(function(element,index){if(typeof element==="string"){return!!element.trim()}return false}).join(", ")},isMapReady:function(){var that=this;if(Site.Page.Globals.mapsAPILoaded===false){setTimeout(function(){that.isMapReady()},100)}else{this.findAndSetAddress({source:"profile",value:this.getProfileAddress()},this.setupMap,this)}},setupMap:function(){var mapOptions={zoom:parseInt(this.get("zoom"),10),center:new google.maps.LatLng(parseFloat(this.get("mapLatitude"),10),parseFloat(this.get("mapLongitude"),10)),scaleControl:false,mapTypeControl:false,overviewMapControl:false,zoomControl:!!this.get("zoomControl"),zoomControlOptions:{style:google.maps.ZoomControlStyle.DEFAULT},panControl:false,mapTypeId:google.maps.MapTypeId.ROADMAP};bk$(this.el).find(".js-map").height(this.get("height"));this.gmap=new google.maps.Map(bk$(this.el).find(".js-map").get(0),mapOptions);this.resetMap()},resetMap:function(){if(this.gmap!==null&&Site.Page.Globals.mapsAPILoaded===true){if(this.get("mapLatitude")===null||this.get("mapLongitude")===null){this.findAndSetAddress({source:"profile",value:this.getProfileAddress()},this.loadMap,this)}else{this.loadMap()}}},loadMap:function(){var newCenter=null;bk$(this.el).find(".js-map").height(this.get("height"));newCenter=new google.maps.LatLng(parseFloat(this.get("mapLatitude"),10),parseFloat(this.get("mapLongitude"),10));this.gmap.setZoom(parseInt(this.get("zoom"),10));this.gmap.setCenter(newCenter);this.createMapMarker(parseFloat(this.get("mapLatitude"),10),parseFloat(this.get("mapLongitude"),10),false)},createMapMarker:function(latitude,longitude,draggable){var icon=new google.maps.MarkerImage(App.session.get("assetBaseUrl")+this.get("markerPath"),new google.maps.Size(32,32),null,new google.maps.Point(16,32),new google.maps.Size(32,32));if(this.marker===null){this.marker=new google.maps.Marker({icon:icon,bouncy:true,draggable:false,autoPan:true,position:new google.maps.LatLng(latitude,longitude)});this.marker.setMap(this.gmap)}else{this.marker.setMap(null);this.marker.draggable=draggable||false;this.marker.setPosition(new google.maps.LatLng(latitude,longitude));this.marker.setMap(this.gmap)}},findAndSetAddress:function(address,callback,scope){if(typeof address==="undefined"||typeof address!=="object"){throw new Error("findAddress param address error")}if(typeof scope==="undefined"||typeof scope!=="object"){throw new Error("findAddress scope callback error")}var that=this,geoOptions={address:null,region:"ISO 3166-1"},results={};if(!this.geocoder){this.geocoder=new google.maps.Geocoder}geoOptions.address=address.value||"";this.geocoder.geocode(geoOptions,function(result,status){if(status===google.maps.GeocoderStatus.OK&&result.length){results={latitude:result[0].geometry.location.lat(),longitude:result[0].geometry.location.lng()}}results.address="profile";results.postalcode=address.value;that.setAddress(results);if(typeof callback==="function"){callback.apply(scope,[results])}else if(typeof callback==="object"){bk$.each(callback,function(i,afunc){if(typeof afunc==="function"){afunc.apply(scope,[results])}})}})},setAddress:function(results){if(typeof results==="undefined"||typeof results!=="object"){throw new Error("settingsPostFindAddress parameter error: expecting a object")}this.set("mapLatitude",results.latitude,true);this.set("mapLongitude",results.longitude,true)}};BaseKit.Widget.Map=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.MapProperties,methods:BaseKit.Widget.MapMethods})};bk$.fn.basekitWidgetMap=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Map(el,options))})}})();(function(){BaseKit.Widget.MenuProperties={};BaseKit.Widget.MenuMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Menu=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.MenuProperties,methods:BaseKit.Widget.MenuMethods})};bk$.fn.basekitWidgetMenu=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Menu(el,options))})}})();(function(){BaseKit.Widget.MenusectionsProperties={};BaseKit.Widget.MenusectionsMethods={construct:function(el,options){this.options=options;this.load()},load:function(){this.attachEvents()},attachEvents:function(){var that=this,thisEl=bk$(this.el),anchorEl=thisEl.find(".js-menu-section-list a"),menuEl=bk$(document).find(".widget.menu");anchorEl.on("click.selectSection",function(e){if(menuEl.length>0){that.updateMenuSectionClass(bk$(this).attr("href"))}});this.menuDropdownEvent()},updateMenuSectionClass:function(sectionId){var menuEl=bk$(document).find(".widget.menu"),sectionEls=menuEl.find(".main");if(sectionEls.length>0){bk$.each(sectionEls,function(index,item){bk$(item).removeClass("selected")})}menuEl.find(sectionId).addClass("selected")},menuDropdownEvent:function(){var that=this,thisEl=bk$(this.el),pullEl=thisEl.find(".js-menu-pull"),menuListEl=thisEl.find(".js-menu-section-list");pullEl.off("click").on("click",function(e){e.preventDefault();if(!bk$("body").hasClass("edit")){if(menuListEl.is(":visible")){menuListEl.hide()}else{menuListEl.show()}}});this.menuToggle();bk$(window).on("resize orientationchange",function(){that.menuToggle()})},menuToggle:function(){var w=bk$(window).width(),menuListEl=bk$(this.el).find(".js-menu-section-list");if(w>320&&menuListEl.is(":hidden")){menuListEl.removeAttr("style")}}};BaseKit.Widget.Menusections=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.MenusectionsProperties,methods:BaseKit.Widget.MenusectionsMethods})};bk$.fn.basekitWidgetMenusections=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Menusections(el,options))})}})();(function(){BaseKit.Widget.Navigation=null;BaseKit.Widget.NavigationProperties={align:"center"};BaseKit.Widget.NavigationMethods={construct:function(el,options){this.load()},load:function(){this.attachEvents()},attachEvents:function(){this.menuDropdownEvent()},menuDropdownEvent:function(){var thisEl=bk$(this.el),pullEl=thisEl.find(".js-pull"),menuEl=thisEl.find(".js-menu-list");pullEl.off("click").on("click",function(e){e.preventDefault();if(!bk$("body").hasClass("edit")){menuEl.toggleClass("open")}})}};BaseKit.Widget.Navigation=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.NavigationProperties,methods:BaseKit.Widget.NavigationMethods})};bk$.fn.basekitWidgetNavigation=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Navigation(el,options))})}})();(function(){BaseKit.Widget.Pagetitle=null;BaseKit.Widget.PagetitleProperties={title:""};BaseKit.Widget.PagetitleMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Pagetitle=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.PagetitleProperties,methods:BaseKit.Widget.PagetitleMethods})};bk$.fn.basekitWidgetPagetitle=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Pagetitle(el,options))})}})();(function(){BaseKit.Widget.Parkinglogin=null;BaseKit.Widget.ParkingloginProperties={};BaseKit.Widget.ParkingloginMethods={construct:function(el,options){this.options=options}};BaseKit.Widget.Parkinglogin=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.ParkingloginProperties,methods:BaseKit.Widget.ParkingloginMethods})};bk$.fn.basekitWidgetParkinglogin=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Parkinglogin(el,options))})}})();(function(){BaseKit.Widget.Paypalbuynow=null;BaseKit.Widget.PaypalbuynowProperties={paypalbuynow_text:App.t("widgets.paypalbuynow.text","Buy Now"),paypalbuynow_productname:App.t("widgets.paypalbuynow.productname_default","My awesome product"),paypalbuynow_productprice:0,paypalbuynow_shipping:0,align:"widget-align-left"};BaseKit.Widget.PaypalbuynowMethods={construct:function(el,options){this.options=options}};BaseKit.Widget.Paypalbuynow=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.PaypalbuynowProperties,methods:BaseKit.Widget.PaypalbuynowMethods})};bk$.fn.basekitWidgetPaypalbuynow=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Paypalbuynow(el,options))})}})();(function(){BaseKit.Widget.ProfileProperties={profileType:"twitter",address:"profile",address1:"profile",address2:"profile",country:"profile",addressPostalCode:"profile",email:"profile",headline:"profile",strapline:"profile",companydescription:"profile",phone:"profile",business:"profile",copyright:"profile",twitter:"profile",refreshtime:"1800000",defaultTwitter:"BaseKit",mapZoom:12,mapHeight:150,mapAddress:"profile",formText:App.t("widgets.contactform.default_button_text","Send"),formTitle:App.t("widgets.contactform.default_title","Contact Form"),socialIconsLinkedin:"profile",socialIconsTwitter:"profile",socialIconsFacebook:"profile",socialIconsRss:"profile",socialIconsGoogleplus:"profile",socialIconsYoutube:"profile"};BaseKit.Widget.ProfileMethods={construct:function(el,options){this.options=options;this.load()},load:function(){this.attachProfileEvents()},attachProfileEvents:function(){switch(this.get("profileType")){case"twitter":this.initialTwitter();break;case"map":this.initialMap();break;case"form":this.initialForm();break;default:break}},initialForm:function(){var that=this,thisEl=bk$(this.el),url="/_bk/submit-form",data={};thisEl.find("form").on("submit",function(e){e.preventDefault();data={emailFrom:thisEl.find(".js-email").val(),message:"",useProfile:1,formTitle:that.get("formTitle"),widgetId:thisEl.attr("id")};if(thisEl.find(".overlay").length>0){thisEl.find(".overlay").removeClass("fail success")}bk$.ajax({url:url,type:"POST",data:data,beforeSend:function(){that.showMessageBox()},success:function(){if(that.get("goalUrl")){window.location=that.get("goalUrl")}else{that.showText(true);that.removeMessageBox()}},error:function(){that.showText();that.removeMessageBox()}})})},showText:function(isSuccess){var message=null,thisEl=bk$(this.el),className=null;if(thisEl.find(".message-box").length>0){thisEl.find(".message-box").remove()}if(isSuccess){message=App.t("widgets.form.success","Message sent successfully.");className="success"}else{message=App.t("widgets.form.failed","Submit failed.");className="fail"}thisEl.find(".overlay").addClass(className).append('
'+message+"
")},showMessageBox:function(){var thisEl=bk$(this.el),overlay=bk$('
'),formEl=thisEl.find("form");if(thisEl.find(".overlay").length===0){thisEl.append(overlay)}if(formEl.length>0){formEl.addClass("submitting")}},removeMessageBox:function(){var thisEl=bk$(this.el),t=null,formEl=thisEl.find("form");if(formEl.length>0){formEl.removeClass("submitting")}thisEl.find(".js-email").val("");t=setTimeout(function(){clearTimeout(t);thisEl.find(".overlay").fadeOut(function(){bk$(this).remove()})},3e3)},initialMap:function(){this.gmap=null;this.marker=null;if(window.mapReady===undefined){window.mapReady=function(){Site.Page.Globals.mapsAPILoaded=true}}if(Site.Page.Globals.mapsAPILoaded===undefined||Site.Page.Globals.mapsAPILoaded===null){Site.Page.Globals.mapsAPILoaded=false}this.loadProfileMap()},loadProfileMap:function(){var script;if(Site.Page.Globals.mapsAPILoaded===false&&bk$("#gmaps-widget-script").length===0){script=document.createElement("script");script.type="text/javascript";script.id="gmaps-widget-script";script.src="https://maps.google.com/maps/api/js?sensor=false&callback=mapReady&language="+App.session.get("languageCode");document.body.appendChild(script)}this.isMapReady()},isMapReady:function(){var that=this;if(Site.Page.Globals.mapsAPILoaded===false){setTimeout(function(){that.isMapReady()},100)}else{this.findAndSetAddress({source:"profile",value:Profile.get("postalcode")},this.setupMap,this)}},setupMap:function(){var mapOptions={zoom:parseInt(this.get("mapZoom"),10),center:new google.maps.LatLng(parseFloat(this.get("mapLatitude"),10),parseFloat(this.get("mapLongitude"),10)),scaleControl:false,mapTypeControl:false,overviewMapControl:false,zoomControl:false,panControl:false,mapTypeId:google.maps.MapTypeId.ROADMAP};bk$(this.el).find(".js-map").height(this.get("mapHeight"));this.gmap=new google.maps.Map(bk$(this.el).find(".js-map").get(0),mapOptions);this.resetMap()},resetMap:function(){if(this.gmap!==null&&Site.Page.Globals.mapsAPILoaded===true){if(this.get("mapLatitude")===null||this.get("mapLongitude")===null){this.findAndSetAddress({source:"profile",value:this.profile.get("postalcode")},this.loadMap,this)}else{this.loadMap()}}},loadMap:function(){var newCenter=null;bk$(this.el).find(".js-map").height(this.get("mapHeight"));newCenter=new google.maps.LatLng(parseFloat(this.get("mapLatitude"),10),parseFloat(this.get("mapLongitude"),10));this.gmap.setZoom(parseInt(this.get("mapZoom"),10));this.gmap.setCenter(newCenter);this.createMapMarker(parseFloat(this.get("mapLatitude"),10),parseFloat(this.get("mapLongitude"),10),false)},createMapMarker:function(latitude,longitude,draggable){var icon=new google.maps.MarkerImage(App.session.get("assetBaseUrl")+"/apps/images/mobile/map-marker.png",new google.maps.Size(32,32),null,new google.maps.Point(16,32),new google.maps.Size(32,32));if(this.marker===null){this.marker=new google.maps.Marker({icon:icon,bouncy:true,draggable:false,autoPan:true,position:new google.maps.LatLng(latitude,longitude)});this.marker.setMap(this.gmap)}else{this.marker.setMap(null);this.marker.draggable=draggable||false;this.marker.setPosition(new google.maps.LatLng(latitude,longitude));this.marker.setMap(this.gmap)}},findAndSetAddress:function(address,callback,scope){if(typeof address==="undefined"||typeof address!=="object"){throw new Error("findAddress param address error")}if(typeof scope==="undefined"||typeof scope!=="object"){throw new Error("findAddress scope callback error")}var that=this,geoOptions={address:null,region:"ISO 3166-1"},results={};if(!this.geocoder){this.geocoder=new google.maps.Geocoder}geoOptions.address=address.value||"";this.geocoder.geocode(geoOptions,function(result,status){if(status===google.maps.GeocoderStatus.OK&&result.length){results={latitude:result[0].geometry.location.lat(),longitude:result[0].geometry.location.lng()}}results.address="profile";results.postalcode=address.value;that.setAddress(results);if(typeof callback==="function"){callback.apply(scope,[results])}})},setAddress:function(results){if(typeof results==="undefined"||typeof results!=="object"){throw new Error("settingsPostFindAddress parameter error: expecting a object")}this.set("mapLatitude",results.latitude,true);this.set("mapLongitude",results.longitude,true)},initialTwitter:function(){this.refreshTimeline();this.getAndUpdateTweet()},refreshTimeline:function(){var that=this,refreshtime=this.get("refreshtime")>0?parseInt(this.get("refreshtime"),10):18e5;if(this.refreshInterval!==""){window.clearInterval(this.refreshInterval);this.refreshInterval=""}this.refreshInterval=window.setInterval(function(){try{that.getAndUpdateTweet()}catch(err){clearInterval(that.refreshInterval);console.log(err)}},refreshtime)},getAndUpdateTweet:function(){var that=this,url="/_bk/fetch-feed",createdDate=null,tweetData=[],data={count:1,includeRts:true,searchKey:this.get("twitter")==="profile"?Profile.get("twitter"):this.get("twitter"),searchType:"username"};if(this.get("twitter")==="profile"&&(Profile.get("twitter")===null||Profile.get("twitter").length===0)||(this.get("twitter")===null||this.get("twitter").length===0)){data.searchKey=this.get("defaultTwitter")}bk$.ajax({url:url,type:"POST",data:data}).done(function(response,status){if(status==="success"){bk$.each(response,function(){createdDate=this.created_at;createdDate=createdDate.split(" ");tweetData.push({screenName:this.user.screen_name,createdAt:createdDate[2]+" "+createdDate[1]+" "+createdDate[5],fullName:this.user.name,imageUrl:this.user.profile_image_url,source:this.source,text:this.text})});that.set("tweets",tweetData,true);that.rerender()}}).fail(function(){that.set("tweets",[],true);that.el.find(".js-twitter").html("

No tweets found!

")})}};BaseKit.Widget.Profile=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.ProfileProperties,methods:BaseKit.Widget.ProfileMethods})};bk$.fn.basekitWidgetProfile=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Profile(el,options))})}})();(function(){BaseKit.Widget.Redirecttodesktop=null;BaseKit.Widget.RedirecttodesktopProperties={text:App.t("widgets.redirecttodesktop.default_text","Switch to desktop"),url:""};BaseKit.Widget.RedirecttodesktopMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Redirecttodesktop=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.RedirecttodesktopProperties,methods:BaseKit.Widget.RedirecttodesktopMethods})};bk$.fn.basekitWidgetRedirecttodesktop=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Redirecttodesktop(el,options))})}})();(function(){BaseKit.Widget.Resetpassword=null;BaseKit.Widget.ResetpasswordProperties={text:App.t("widgets.resetpassword.save_new_password","Save"),label:App.t("widgets.resetpassword.new_password","Choose your new password")};BaseKit.Widget.ResetpasswordMethods={construct:function(el,options){this.load()},load:function(){this.attachEvents()},attachEvents:function(){var that=this,thisEl=bk$(this.el);this.toggleShowHidePassword();thisEl.find("form").on("submit",function(e){e.preventDefault();if(thisEl.find(".js-password").val().length===0){return}bk$.ajax({type:"POST",url:"_bk/auth-token",async:false}).done(function(response){var data={hash:App.getParam("h"),password:thisEl.find(".js-password").val(),token:response.token};bk$.ajax({url:"_bk/reset-password",type:"POST",data:data,beforeSend:function(){that.showMessageBox()}}).always(function(){that.removeMessageBox()}).done(function(response){var message=App.t("widgets.resetpassword.success","Password successfully changed."),onTimeout;onTimeout=function(){window.location=that.get("completionPage")};that.showText(true,message);setTimeout(onTimeout,2e3)}).fail(function(response){var errors=App.getErrorsFromResponse(response),message=null;if(response.status===503){that.showText(false,App.t("widgets.resetpassword.error.maintenance","We’re temporarily offline for maintenance; this is usually pretty quick, so check back soon. We apologise for the inconvenience."));return}bk$.each(errors,function(i,value){if(value.field==="hash"){message=value.message;return}});if(message){that.showText(false,message)}else{that.showText(false,App.t("widgets.resetpassword.failed","Submit failed."))}})}).fail(function(response){var message=App.t("widgets.resetpassword.auth_fail","Failed to get authentication token");that.showText(true,message)})})},toggleShowHidePassword:function(){var thisEl=bk$(this.el),passwordInputEl=thisEl.find(".js-password");thisEl.find(".js-password-mask-toggle").on("click",function(){if(passwordInputEl[0].type==="password"){passwordInputEl[0].type="text";passwordInputEl.attr("autocapitalize","off").attr("autocorrect","off").attr("spellcheck","false");bk$(this).text(App.t("widgets.resetpassword.hide","Hide"))}else{passwordInputEl[0].type="password";passwordInputEl.removeAttr("autocapitalize").removeAttr("autocorrect").removeAttr("spellcheck");bk$(this).text(App.t("widgets.resetpassword.show","Show"))}})},showText:function(isSuccess,message){var thisEl=bk$(this.el),className=null;if(thisEl.find(".message-box").length>0){thisEl.find(".message-box").remove()}if(isSuccess){className="success"}else{className="fail"}thisEl.find(".overlay").addClass(className).append('
'+message+"
")},showMessageBox:function(){var thisEl=bk$(this.el),overlay=bk$('
');if(thisEl.find(".overlay").length===0){thisEl.append(overlay)}},removeMessageBox:function(){var thisEl=bk$(this.el),t=null;t=setTimeout(function(){clearTimeout(t);thisEl.find(".overlay").fadeOut(function(){thisEl.find(".email, .message").val("");bk$(this).remove()})},3e3)}};BaseKit.Widget.Resetpassword=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.ResetpasswordProperties,methods:BaseKit.Widget.ResetpasswordMethods})};bk$.fn.basekitWidgetResetpassword=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Resetpassword(el,options))})}})();(function(){BaseKit.Widget.Responsivecolumns=null;BaseKit.Widget.ResponsivecolumnsProperties={selectable:0,isEmpty:1,columns:0};BaseKit.Widget.ResponsivecolumnsMethods={construct:function(el,options){this.load()},load:function(){this.hideEmptyColumns()},hideEmptyColumns:function(){if(!bk$("body").hasClass("edit")&&this.get("isEmpty")&&this.get("isEmpty")==="1"){bk$(this.el).find(".js-tip-message, .js-select-columns-num").hide()}}};BaseKit.Widget.Responsivecolumns=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.ResponsivecolumnsProperties,methods:BaseKit.Widget.ResponsivecolumnsMethods})};bk$.fn.basekitWidgetResponsivecolumns=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Responsivecolumns(el,options))})}})();(function(){BaseKit.Widget.Responsiveslideshow=null;BaseKit.Widget.ResponsiveslideshowProperties={aspect:75,crop:0,scale:"zoom",duration:3,transSpeed:1e3,transType:"fade",showButtons:true,showBullets:true,allowPause:false,allowLoop:true,showTitle:1,showDescription:1,albumRef:0,images:[]};BaseKit.Widget.ResponsiveslideshowMethods={construct:function(el,options){this.load();this.paused=false;this.stopSlide=false},load:function(){var editor=bk$("body").hasClass("edit"),albumArray=this.get("albumRef")>0?Server.plugins.assets.albums[this.get("albumRef")]:this.get("images");if(albumArray&&albumArray.length>0||this.properties.changed.album){this.attachEvents()}if(!editor){this.startSlideShow(0)}},attachEvents:function(){var that=this,ref=bk$(this).data("ref"),thisEl=bk$(this.el),imageArray=this.get("albumRef")>0?Server.plugins.assets.albums[this.get("albumRef")]:this.get("images");if(imageArray&&imageArray.length===1){thisEl.find(".js-btn-play").hide();thisEl.find(".js-btn-prev").hide();thisEl.find(".js-btn-next").hide();return}thisEl.find(".js-btn-play").on("click",function(){ref=bk$(this).data("ref");if(bk$(this).hasClass("pause")){that.pauseSlideShow();return}if(bk$(this).attr("disabled")==="disabled"){return}that.playSlideShow(ref)});thisEl.find(".js-slide-ctrl").on("click",function(){ref=bk$(this).data("ref");that.handleSlideNavigation(ref)})},handleSlideNavigation:function(ref){var that=this,duration=Math.round(this.get("duration")*1e3),timer;this.stopSlideShow();this.setSlide(ref);timer=setTimeout(function(){that.startSlideShow(ref)},duration);bk$(".js-slide-ctrl").on("click",function(){clearTimeout(timer)})},startSlideShow:function(ref){if(bk$("body").hasClass("edit")){return}this.stopSlide=false;this.setNextSlide(ref)},stopSlideShow:function(){var elAll=bk$(this.el).find(".js-responsiveslideshow-image-item");elAll.stop(true,true);this.stopSlide=true},setSlide:function(ref){var thisEl=bk$(this.el),currentSlide=thisEl.find(".js-responsiveslideshow-image-item.current"),newSlide=thisEl.find('.js-responsiveslideshow-image-item[data-ref="'+ref+'"]'),newImage=newSlide.find(".js-responsiveslideshow-image");currentSlide.removeClass("current");newSlide.addClass("current");thisEl.find(".js-responsiveslideshow-image-item").removeAttr("style");this.setSlideInfo(ref)},setSlideInfo:function(ref){var el=bk$(this.el),imageArray=this.get("albumRef")>0?Server.plugins.assets.albums[this.get("albumRef")]:this.get("images"),lastImg=imageArray.length-1,next=ref+1,prev=ref-1;if(next===imageArray.length){next=0}if(ref===0){prev=lastImg}el.find(".js-dot").removeClass("selected");el.find(".js-dot[data-ref="+ref+"]").addClass("selected");el.find(".js-btn-prev").data("ref",prev);el.find(".js-btn-next").data("ref",next);el.find(".js-btn-play").data("ref",ref);if(prev===lastImg&&!this.get("allowLoop")){el.find(".js-btn-prev").addClass("disabled").attr("disabled",true)}else{el.find(".js-btn-prev").removeClass("disabled").removeAttr("disabled")}if(next===0&&!this.get("allowLoop")){el.find(".js-btn-next").addClass("disabled").attr("disabled",true)}else{el.find(".js-btn-next").removeClass("disabled").removeAttr("disabled")}},playSlideShow:function(ref){bk$(this.el).find(".js-btn-play").addClass("pause");this.stopSlide=false;this.paused=false;this.setNextSlide(ref)},pauseSlideShow:function(){bk$(this.el).find(".js-btn-play").removeClass("pause");this.stopSlide=true;this.paused=true},setNextSlide:function(currentSlide){var that=this,duration=this.get("duration")*1e3,imageArray=this.get("albumRef")>0?Server.plugins.assets.albums[this.get("albumRef")]:this.get("images"),lastImg=imageArray.length-1,t=null;if(this.stopSlide||this.paused||currentSlide===lastImg&&!this.get("allowLoop")){return}t=setTimeout(function(){clearTimeout(t);that.animate(currentSlide)},duration)},animate:function(slideFromRef,slideToRef){var that=this,thisEl=bk$(this.el),timing=parseInt(this.get("transSpeed"),10),elEffect=this.get("transType"),elOut,elIn,t,elInImg,next=slideFromRef+1,imageArray=this.get("albumRef")>0?Server.plugins.assets.albums[this.get("albumRef")]:this.get("images");if(this.stopSlide||this.paused){return}if(next===imageArray.length){next=0}slideToRef=slideToRef||next;elOut=thisEl.find(".js-responsiveslideshow-image-item[data-ref="+slideFromRef+"]");elIn=thisEl.find(".js-responsiveslideshow-image-item[data-ref="+slideToRef+"]");elInImg=bk$(elIn).find(".js-responsiveslideshow-image");function callbackOut(){that.setSlideInfo(slideToRef)}function callbackIn(){that.setNextSlide(slideToRef)}switch(elEffect){case"fade":timing=timing/2;elOut.fadeOut(timing,callbackOut);t=setTimeout(function(){clearTimeout(t);elIn.fadeIn(timing,callbackIn).addClass("current");elOut.removeClass("current")},timing);break;case"dissolve":callbackOut();elOut.fadeOut(timing);elIn.fadeIn(timing,callbackIn);t=setTimeout(function(){clearTimeout(t);elOut.removeClass("current");elIn.addClass("current")},timing);break;default:callbackOut();elOut.removeClass("current");elIn.addClass("current");callbackIn();break}}};BaseKit.Widget.Responsiveslideshow=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.ResponsiveslideshowProperties,methods:BaseKit.Widget.ResponsiveslideshowMethods})};bk$.fn.basekitWidgetResponsiveslideshow=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Responsiveslideshow(el,options))})}})();(function(){BaseKit.Widget.Signupform=null;BaseKit.Widget.SignupformProperties={email:"profile",label:App.t("widgets.signupform.email","Your email"),text:App.t("widgets.signupform.default_button_text","Send"),formTitle:App.t("widgets.signupform.default_title","Signup Form")};BaseKit.Widget.SignupformMethods={construct:function(el,options){this.load()},load:function(){this.attachEvents()},attachEvents:function(){var that=this,thisEl=bk$(this.el),url="/_bk/submit-form",data={};thisEl.find("form").on("submit",function(e){e.preventDefault();data={emailFrom:thisEl.find(".js-email").val(),useProfile:that.get("email")==="profile"?1:0,widgetId:thisEl.attr("id"),formTitle:that.get("formTitle")};bk$.ajax({url:url,type:"POST",data:data,beforeSend:function(){that.showMessageBox()},success:function(){if(that.get("goalUrl")){window.location=that.get("goalUrl")}else{that.showText(true);that.removeMessageBox()}},error:function(){that.showText();that.removeMessageBox()}})})},showText:function(isSuccess){var message=null,thisEl=bk$(this.el),className=null;if(thisEl.find(".message-box").length>0){thisEl.find(".message-box").remove()}if(isSuccess){message=App.t("widgets.form.success","Message sent successfully.");className="success"}else{message=App.t("widgets.form.failed","Submit failed.");className="fail"}thisEl.find(".overlay").addClass(className).append('
'+message+"
")},showMessageBox:function(){var thisEl=bk$(this.el),overlay=bk$('
'),formEl=thisEl.find("form");if(thisEl.find(".overlay").length===0){thisEl.append(overlay)}if(formEl.length>0){formEl.addClass("submitting")}},removeMessageBox:function(){var thisEl=bk$(this.el),t=null,formEl=thisEl.find("form");if(formEl.length>0){formEl.removeClass("submitting")}thisEl.find(".email").val("");t=setTimeout(function(){clearTimeout(t);thisEl.find(".overlay").fadeOut(function(){bk$(this).remove()})},3e3)}};BaseKit.Widget.Signupform=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.SignupformProperties,methods:BaseKit.Widget.SignupformMethods})};bk$.fn.basekitWidgetSignupform=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Signupform(el,options))})}})();(function(){BaseKit.Widget.Socialicons={};BaseKit.Widget.SocialiconsProperties={align:"",googleplus:"profile",linkedin:"profile",facebook:"profile",twitter:"profile",youtube:"profile",rss:"profile"};BaseKit.Widget.SocialiconsMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Socialicons=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.SocialiconsProperties,methods:BaseKit.Widget.SocialiconsMethods})};bk$.fn.basekitWidgetSocialicons=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Socialicons(el,options))})}})();(function(){BaseKit.Widget.Soundcloud={};BaseKit.Widget.SoundcloudProperties={};BaseKit.Widget.SoundcloudMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Soundcloud=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.SoundcloudProperties,methods:BaseKit.Widget.SoundcloudMethods })};bk$.fn.basekitWidgetSoundcloud=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Soundcloud(el,options))})}})();(function(){BaseKit.Widget.Space={};BaseKit.Widget.SpaceProperties={height:"50"};BaseKit.Widget.SpaceMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Space=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.SpaceProperties,methods:BaseKit.Widget.SpaceMethods})};bk$.fn.basekitWidgetSpace=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Space(el,options))})}})();(function(){BaseKit.Widget.Tweet=null;BaseKit.Widget.TweetProperties={linkText:App.t("widgets.tweet.default_link_text","Tweet"),align:""};BaseKit.Widget.TweetMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Tweet=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.TweetProperties,methods:BaseKit.Widget.TweetMethods})};bk$.fn.basekitWidgetTweet=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Tweet(el,options))})}})();(function(){BaseKit.Widget.Twitter=null;BaseKit.Widget.TwitterProperties={count:"3",refreshTime:"1800000",includeRts:"1",searchKey:"profile",searchType:"username",defaultSearchKey:"basekit"};BaseKit.Widget.TwitterMethods={construct:function(){this.refreshInterval="";this.load()},load:function(){this.refreshTimeline();this.getUpdateTwitterFeed()},refreshTimeline:function(){var that=this,refreshTime=this.get("refreshTime")>0?parseInt(this.get("refreshTime"),10):18e5;if(this.refreshInterval!==""){window.clearInterval(this.refreshInterval);this.refreshInterval=""}this.refreshInterval=window.setInterval(function(){try{that.getUpdateTwitterFeed()}catch(err){clearInterval(that.refreshInterval);console.log(err)}},refreshTime)},getUpdateTwitterFeed:function(){var that=this,url="/_bk/fetch-feed",createdDate=null,tweetData=[],data={count:this.get("count")>0?this.get("count"):3,includeRts:this.get("includeRts")!==null?this.get("includeRts"):true,searchKey:this.get("searchType")==="username"?Profile.get("twitter"):this.get("searchKey"),searchType:this.get("searchType")};if(this.get("searchKey")==="profile"&&(Profile.get("twitter")===null||Profile.get("twitter").length===0)||(this.get("searchKey")===null||this.get("searchKey").length===0)){data.searchKey=this.get("defaultSearchKey")}bk$.ajax({url:url,type:"POST",data:data,beforeSend:function(){that.el.find(".js-twitter").html("
  • "+App.t("widgets.twitter.retrieving_tweets","Retrieving Tweets")+"
  • ")}}).done(function(response,status){bk$.each(response,function(){createdDate=this.created_at;createdDate=createdDate.split(" ");tweetData.push({screenName:this.user.screen_name,createdAt:createdDate[2]+" "+createdDate[1]+" "+createdDate[5],fullName:this.user.name,imageUrl:this.user.profile_image_url,source:this.source,text:this.text,retweetUser:this.retweetUser})});that.set("tweets",tweetData,true);that.rerender()}).fail(function(){that.set("tweets",[],true);that.rerender()})}};BaseKit.Widget.Twitter=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.TwitterProperties,methods:BaseKit.Widget.TwitterMethods})};bk$.fn.basekitWidgetTwitter=function(options){this.each(function(){bk$(this).data("bkob",new BaseKit.Widget.Twitter(this,options))})}})();(function(){BaseKit.Widget.Userlogin=null;BaseKit.Widget.UserloginProperties={align:"",email:"profile",text:App.t("widgets.userlogin.default_button_text","Login"),allowPersistentLogin:true};BaseKit.Widget.UserloginMethods={construct:function(el,options){this.load()},load:function(){var persist=window.localStorage.getItem("bk.widgets.login.persist");if(bk$(this.el).find(".js-persist-login").length&&persist==="false"){bk$(this.el).find(".js-persist-login").prop("checked",false)}this.attachEvents()},showOverlay:function(message){message=message||"message";var thisEl=bk$(this.el),overlayEl=thisEl.find(".js-overlay");overlayEl.find(".message").html(message).end().show();bk$(this.el).find("form button.js-userloginbtn").attr("disabled",true)},hideOverlay:function(){var thisEl=bk$(this.el),overlayEl=thisEl.find(".js-overlay");overlayEl.hide().find(".js-message").empty();thisEl.find("form button.js-userloginbtn").attr("disabled",false)},attachEvents:function(){var that=this,thisEl=bk$(this.el),persistEl=thisEl.find(".js-persist-login"),errors=[],postData={};thisEl.find("form").on("submit",function(e){e.preventDefault();that.hideOverlay();errors=[];postData={password:thisEl.find("input[type='password']").val(),auth_token:null};if(thisEl.find("input.js-username-input").length){postData.username=thisEl.find("input.js-username-input").val()}else{postData.email=thisEl.find("input[type='email']").val()}if(persistEl.length){that.storePersistPreference(persistEl.is(":checked"));if(persistEl.is(":checked")){postData.persistLogin=true}}thisEl.find("p.error").empty().hide();if(postData.password!==undefined){if(postData.password.trim().length===0){errors.push({element:"password",error:App.t("widgets.userlogin.error.missing_password","Please provide a password.")})}else if(postData.password.trim().length<7){errors.push({element:"password",error:App.t("widgets.userlogin.error.invalid_password_min","Please provide a password greater than 7 characters.")})}}if(postData.email!==undefined){if(postData.email.trim().length<5&&postData.email.indexOf("@")===-1){errors.push({element:"email",error:App.t("widgets.userlogin.error.wrong_email_format","Please enter an email address.")})}}if(postData.username!==undefined){if(postData.username.trim().length===0){errors.push({element:"username",error:App.t("widgets.userlogin.error.missing_username","Please enter a username.")})}}bk$.each(errors,function(){var element=thisEl.find("p.error."+this.element);if(element.length){element.html(this.error).show()}});if(!errors.length){bk$.ajax({url:"/_bk/auth-token",type:"POST",processData:false}).done(function(response,status,jqXHR){if(response.token!==undefined){postData.auth_token=response.token;that.login(postData)}})}})},login:function(postData){var that=this,thisEl=bk$(this.el);bk$.ajax({url:"/_bk/user-login",type:"POST",data:postData,beforeSend:function(){var message=App.t("widgets.userlogin.login_process","Logging into your account, Please wait...");that.showOverlay(message)}}).always(function(){that.hideOverlay()}).done(function(response,status,jqXHR){var error,redirect="";if(status==="success"&&response.url!==undefined){if(App.getParam("r")!==null){if(response.url.indexOf("?")>=0){redirect="&r="+App.getParam("r")}else{redirect="?r="+App.getParam("r")}}document.location=response.url+redirect}else{error=App.t("widgets.userlogin.error.unknown_error","An unknown error has occurred, please try again");thisEl.find("p.js-error.js-submission").html(error).show()}}).fail(function(response){var error,apiErrors;if(response.status===503){error=App.t("widgets.userlogin.error.maintenance","We’re temporarily offline for maintenance; this is usually pretty quick, so check back soon. We apologise for the inconvenience.");console.log(error);thisEl.find(".js-error.js-submission").text(error).show();return}apiErrors=that.formatResponseErrors(response);thisEl.find("p.js-error.js-submission").html(apiErrors).show()})},storePersistPreference:function(value){try{window.localStorage.setItem("bk.widgets.login.persist",value)}catch(e){}},formatResponseErrors:function(response){var errors=[];if(response.responseJSON===undefined||response.responseJSON===null){return errors}response=typeof response.responseJSON==="object"?response.responseJSON:bk$.parseJSON(response.responseJSON);if(response.messageTemplates){bk$.each(response.messageTemplates,function(type,properties){bk$.each(properties.templates,function(template,value){var args=["widget.userregistration.js-error.js-"+template.toLowerCase(),value];errors.push(App.t.apply(App,args))})})}else{errors.push(App.t("widgets.userlogin.error.unknown_error","An unknown error has occurred, please try again."))}return errors.join("")}};BaseKit.Widget.Userlogin=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.UserloginProperties,methods:BaseKit.Widget.UserloginMethods})};bk$.fn.basekitWidgetUserlogin=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Userlogin(el,options))})}})();(function(){BaseKit.Widget.Userregistration=null;BaseKit.Widget.UserregistrationProperties={align:"",email:"profile",text:App.t("widgets.userregistration.default_button_text","Register")};BaseKit.Widget.UserregistrationMethods={construct:function(el,options){this.load()},load:function(){this.attachEvents()},showOverlay:function(message){message=message||"message";var thisEl=bk$(this.el),overlayEl=thisEl.find(".js-overlay");overlayEl.find(".js-message").html(message).end().show();thisEl.find("form button.js-registerbtn").attr("disabled",true)},hideOverlay:function(){var thisEl=bk$(this.el),overlayEl=thisEl.find(".js-overlay");overlayEl.hide().find(".js-message").empty();thisEl.find("form button.js-registerbtn").attr("disabled",false)},attachEvents:function(){var that=this,thisEl=bk$(this.el),errors=[],postData={};thisEl.find("form").on("submit",function(e){e.preventDefault();that.hideOverlay();errors=[];postData={brandRef:App.session.get("brandRef"),brandDomain:App.session.get("domain"),email:thisEl.find("input[type='email']").val(),password:thisEl.find("input[type='password']").val(),widgetId:thisEl.attr("id"),languageCode:App.session.get("languageCode"),auth_token:null};thisEl.find("p.js-error").empty().hide();if(postData.password!==undefined&&postData.password.trim().length<7){errors.push({element:"password",error:App.t("widgets.userregistration.error.invalid_password_min","Please provide a password greater than 7 characters.")})}if(postData.email!==undefined&&postData.email.trim().length<5&&postData.email.indexOf("@")===-1){errors.push({element:"email",error:App.t("widgets.userregistration.error.wrong_email_format","Please enter an email address.")})}bk$.each(errors,function(){var element=thisEl.find("p.js-error.js-"+this.element);if(element.length){element.html(this.error).show()}});if(!errors.length){bk$.ajax({url:"/_bk/auth-token",type:"POST",processData:false}).done(function(response,status,jqXHR){if(response.token!==undefined){postData.auth_token=response.token;that.createAccount(postData)}})}})},createAccount:function(postData){var that=this,thisEl=bk$(this.el);bk$.ajax({url:"/_bk/user-registration",type:"POST",data:postData,beforeSend:function(){var message=App.t("widgets.userregistration.creating_account","Creating your account, Please wait...");that.showOverlay(message)}}).always(function(){that.hideOverlay()}).done(function(response,status,jqXHR){if(status==="success"&&response.url!==undefined){document.location=response.url}else{var error=App.t("widgets.userregistration.error.unknown_error","An unknown error has occurred, please try again");thisEl.find("p.js-error.js-submission").html(error).show()}}).fail(function(response){var error,apiErrors;if(response.status===503){error=App.t("widgets.userregistration.error.maintenance","We’re temporarily offline for maintenance; this is usually pretty quick, so check back soon. We apologise for the inconvenience.");thisEl.find(".js-error.js-submission").text(error).show();return}apiErrors=that.formatResponseErrors(response);thisEl.find("p.js-error.js-submission").html(apiErrors).show()})},formatResponseErrors:function(response){var errors=[];if(response.responseJSON===undefined||response.responseJSON===null){return errors}response=typeof response.responseJSON==="object"?response.responseJSON:bk$.parseJSON(response.responseJSON);if(response.messageTemplates){bk$.each(response.messageTemplates,function(type,properties){if(type==="email"){return}bk$.each(properties.templates,function(template,value){var args=["widgets.userregistration.error."+template.toLowerCase(),value];errors.push(App.t.apply(App,args))})})}else{errors.push(App.t("widgets.userregistration.error.unknown_error","An unknown error has occurred, please try again."))}return errors.join("")}};BaseKit.Widget.Userregistration=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.UserregistrationProperties,methods:BaseKit.Widget.UserregistrationMethods})};bk$.fn.basekitWidgetUserregistration=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Userregistration(el,options))})}})();(function(){BaseKit.Widget.Yelpreview=null;BaseKit.Widget.YelpreviewProperties={title:App.t("widgets.yelpreview.title","Yelp reviews"),reviews:""};BaseKit.Widget.YelpreviewMethods={construct:function(){this.load()},load:function(){this.getUpdateReviews()},getUpdateReviews:function(){var businessId=Profile.get("yelpbusinessid");if(!businessId){this.set("reviews",[],true);this.rerender();return}var that=this,url="/_bk/fetch-yelp-reviews",data={businessID:businessId};bk$.ajax({url:url,type:"POST",data:data,beforeSend:function(){that.el.find(".js-yelpreview").html("
  • "+App.t("widgets.yelp.retrieving_reviews","Retrieving Reviews")+"
  • ")}}).done(function(response,status){if(response.reviews&&response.reviews.length){that.set("reviews",response,true)}that.rerender()}).fail(function(response){if(response.status===404&&(bk$("body").hasClass("in-tdk")||bk$("body").hasClass("min-tdk"))){that.rerender();return}that.set("reviews",[],true);that.rerender()})}};BaseKit.Widget.Yelpreview=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.YelpreviewProperties,methods:BaseKit.Widget.YelpreviewMethods})};bk$.fn.basekitWidgetYelpreview=function(options){this.each(function(){bk$(this).data("bkob",new BaseKit.Widget.Yelpreview(this,options))})}})();(function(){BaseKit.Widget.Youtube={};BaseKit.Widget.YoutubeProperties={userInput:"",videoId:""};BaseKit.Widget.YoutubeMethods={construct:function(el,options){this.options=options;this.load()},load:function(){}};BaseKit.Widget.Youtube=function(){var o=new BaseKit.WidgetCore(this,arguments,{properties:BaseKit.Widget.YoutubeProperties,methods:BaseKit.Widget.YoutubeMethods})};bk$.fn.basekitWidgetYoutube=function(options){this.each(function(index,el){bk$(el).data("bkob",new BaseKit.Widget.Youtube(el,options))})}})();(function(window,beaconEnabled,beaconUrl,start,sampleMax){function track(){var profile={},end=Date.now(),timing=null,navigation=null,params=[],gif=null;if(typeof beaconEnabled==="undefined"||beaconEnabled&&beaconEnabled!==1){return}if(typeof beaconUrl==="undefined"||typeof beaconUrl!=="string"){throw new Error("BaseKit_Performance: beaconUrl undefined or not a string.")}if(typeof sampleMax==="undefined"){throw new Error("BaseKit_Performance: sampleMax undefined.")}if(Math.ceil(Math.random()*sampleMax)!==1){return}if(start&&end){profile.jsPageLoadEstimate=end-start}setTimeout(function(){if(window.performance&&window.performance.timing&&window.performance.navigation){timing=window.performance.timing;navigation=window.performance.navigation;if(timing.navigationStart===0){return}profile.pageLoad=timing.loadEventEnd-timing.responseEnd;profile.firstByte=timing.responseStart-timing.navigationStart;profile.userTime=timing.loadEventEnd-timing.navigationStart;profile.networkLatency=timing.responseEnd-timing.fetchStart;profile.dns=timing.domainLookupEnd-timing.domainLookupStart;profile.connection=timing.connectEnd-timing.connectStart;profile.redirects=navigation.redirectCount}for(prop in profile){params.push(prop+"="+profile[prop])}params=params.join("&");if(params!==""){gif=document.createElement("img");gif.src=beaconUrl+"?"+params}},0)}if(window.addEventListener){window.addEventListener("load",track,false)}else if(window.attachEvent){window.attachEvent("onload",track)}})(window,window.BaseKit_Performance_enabled,window.BaseKit_Performance_beaconUrl,window.BaseKit_Performance_start,window.BaseKit_Performance_sampleMax);