function setFilterKeys(n,t,i){var r=typeof t=="undefined"?0:t,u=typeof t=="undefined"?!1:i;$(n).each(function(n,t){var i=$('[data-row-filter="'+t+'"]'),r;u&&(i=$('[data-row-filter*="'+t+'"]'));r=$(i).length;r>0&&$('.filter > ul li[data-key="'+t+'"]').removeClass("disabled")});$(".filter > ul li:not(.disabled)").on("click",filterData);$(".filter > ul li:not(.disabled)").length>=2&&($(".filter > ul li:not(.disabled)").length>r?$(".filter > ul li:not(.disabled)")[r].click():$(".filter > ul li:not(.disabled)")[0].click())}function friendlyDates(){$(".moment-from-now").each(function(){this.innerHTML=moment().diff(moment(this.innerHTML,"YYYY/MM/DD HH:mm"),"days")>0?moment(this.innerHTML,"YYYY/MM/DD HH:mm").format("DD/MM/YYYY"):moment(this.innerHTML,"YYYY/MM/DD HH:mm").fromNow();$(this).removeClass("moment-from-now")})}function loadYouTubeVids(){for(var i=document.getElementsByClassName("youtube-player"),t,n=0;n<i.length;n++)t=document.createElement("div"),t.innerHTML=labnolThumb(i[n].dataset.id),t.onclick=labnolIframe,i[n].appendChild(t)}function labnolThumb(n){return'<img class="youtube-thumb" src="//i.ytimg.com/vi/'+n+'/hqdefault.jpg"><div class="play-button"><\/div>'}function labnolIframe(){var n=document.createElement("iframe");n.setAttribute("src","//www.youtube.com/embed/"+this.parentNode.dataset.id+"?autoplay=1&autohide=2&border=0&wmode=opaque&enablejsapi=1&controls=1&showinfo=0");n.setAttribute("frameborder","0");n.setAttribute("id","youtube-iframe");n.setAttribute("allowfullscreen","allowfullscreen");this.parentNode.replaceChild(n,this)}function removeMinAdHeight(){setTimeout(function(){$(".ad-height-fix").removeClass("ad-height-fix")},1e3)}function debounce(n,t){var i;return function(){for(var e,u=arguments.length,f=Array(u),r=0;r<u;r++)f[r]=arguments[r];e=this;clearTimeout(i);i=setTimeout(function(){return n.apply(e,f)},t)}}function CsLogger(n){function c(n,t){var i=!0;return(n==undefined||n=="")&&(console.error("csLogger | string:type is not supplied or empty"),i=!1),(t==undefined||t=="")&&(console.error("csLogger | object:data is not supplied, you must provide either basic string value or an object."),i=!1),i}function l(n){switch(n){case t.text:return"<span class='log-icon text'>Te<\/span>";case t.object:return"<span class='log-icon object'>Ob<\/span>";case t.info:return"<span class='log-icon info'>In<\/span>";case t.warning:return"<span class='log-icon warning'>Wr<\/span>";case t.error:return"<span class='log-icon error'>Er<\/span>";case t.event:return"<span class='log-icon event'>Ev<\/span>"}}function u(n,i,r){var f,o,u;h===!0&&(f=$(e),f.length?(o=n==t.object?JSON.stringify(r):r,u="<div class='entry'>{0}{1}{2}<\/div>",u=u.replace("{0}","<span class='ns'>"+i+"<\/span>").replace("{1}",l(n)).replace("{2}","<span class='content'>"+o+"<\/span>"),f.prepend(u)):console.log("Element "+e+" does not exist."))}function f(n){if(s===!0)if(localStorage!=null&&typeof localStorage=="object"){var i="csLogger",r=(new Date).toISOString(),t=JSON.parse(localStorage.getItem(i));t==null&&(t=[]);t.push({timestamp:r,content:n});localStorage.setItem(i,JSON.stringify(t))}else console.log("localStorage object unavailable.")}function r(n,r){if(c(n,r)&&o){var e="%c"+i+" | ",s="color:#888; font-weight:bold;",h="color:#000;",l=(new Date).toISOString();switch(n){case t.text:console.log(e+"%c"+r,s,h);f(r);u(n,i,r);break;case t.object:console.log(r);f(JSON.stringify(r));u(n,i,r);break;case t.info:console.info(e+"%c"+r,s,h);f(r);u(n,i,r);break;case t.warning:console.warn(e+"%c"+r,s,h);f(r);u(n,i,r);break;case t.error:console.error(e+"%c"+r,s,"color:red;");f(r);u(n,i,r);break;case t.event:console.info(e+"%c[event] "+r,s,"color:#009900;");f(r);u(n,i,r)}}}var i=n,o=!1,s=!1,h=!1,e="",t={text:"msg",object:"obj",info:"info",warning:"warning",error:"error",event:"event"};this.enable=function(){o=!0};this.enableLocalStorage=function(){s=!0};this.enableLogToElement=function(n){e=n;h=!0};this.clearLocalStorage=function(){localStorage.clear()};this.obj=function(n,i){r(t.info,n);r(t.object,i)};this.log=function(n){r(t.text,n)};this.warning=function(n){r(t.warning,n)};this.info=function(n){r(t.info,n)};this.error=function(n){r(t.error,n)};this.event=function(n){r(t.event,n)}}var filterData=function(){var t=$(this),n=t.html().trim(),u=t.closest(".filter").attr("data-multiSelect"),e=t.closest(".filter").attr("data-multiValues"),i=n,r,f;typeof u=="undefined"&&(u=!1);n=="All"||n=="All Time"?($(".ShowingSelectedValue").text(n),$("[data-row-filter]:not(.filter-non-counting)").show(),$(".filter ul li.selected").removeClass("selected"),t.addClass("selected"),$(".filter-collapse.collapse.in").length>0&&$('[data-target=".filter-collapse"]').click()):(r=0,$("[data-row-filter]").hide(),u?(i="",$(".filter-all").removeClass("selected"),t.toggleClass("selected"),$(".filter ul li.selected").each(function(){var n=$(this).html().trim();r+=$('[data-row-filter="'+n+'"]:not(.filter-non-counting)').length;i==""?(i=n,f=1):(f+=1,i=f+" selected");$('[data-row-filter="'+n+'"]:not(.filter-non-counting)').show()})):($(".filter li").removeClass("selected"),t.addClass("selected"),e?(r+=$('[data-row-filter*="'+n+'"]:not(.filter-non-counting)').length,$('[data-row-filter*="'+n+'"]').show()):(r+=$('[data-row-filter="'+n+'"]:not(.filter-non-counting)').length,$('[data-row-filter="'+n+'"]').show())),$(".ShowingSelectedValue").html(i+" - "+r+" Results"),$(".collapse.in.score-collapse").removeClass("in"),$(".filter-collapse.collapse.in").length>0&&!u&&$('[data-target=".filter-collapse"]').click())};String.prototype.endsWith||(String.prototype.endsWith=function(n,t){var i=this.toString(),r;return(typeof t!="number"||!isFinite(t)||Math.floor(t)!==t||t>i.length)&&(t=i.length),t-=n.length,r=i.indexOf(n,t),r!==-1&&r===t});String.prototype.includes||(String.prototype.includes=function(n,t){"use strict";return typeof t!="number"&&(t=0),t+n.length>this.length?!1:this.indexOf(n,t)!==-1});$.fn.isOnScreen=function(){var i=$(window),t={top:i.scrollTop(),left:i.scrollLeft()},n;return(t.right=t.left+i.width(),t.bottom=t.top+i.height(),n=this.offset(),n!=null)?(n.right=n.left+this.outerWidth(),n.bottom=n.top+this.outerHeight(),!(t.right<n.left||t.left>n.right||t.bottom<n.top||t.top>n.bottom)):!1};$(".collapse").on("show.bs.collapse",function(n){$(n.target).prev().find(".fa-chevron-down").removeClass("fa-chevron-down").addClass("fa-chevron-up")});$(".collapse").on("hidden.bs.collapse",function(n){$(n.target).prev().find(".fa-chevron-up").removeClass("fa-chevron-up").addClass("fa-chevron-down")});(function(n,t,i){function u(n){if(n==i||n==null)return r.error("Exception: The parameter {"+n+"} is missing."),!1}function e(n,i){var u=n.find(">.splash.done:first"),r;u.length&&u.fadeOut();r=n.find(".splash.queued:first");r.length?(r.fadeIn().removeClass("queued").addClass("done"),setTimeout(function(){e(n,i)},i)):n.fadeOut("slow",function(){t(document).trigger(f+".splash.completed")})}var f="csUtilities",r=new CsLogger(f);n.enableLogging=function(){r.enable()};n.iOS=function(){var n=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"];if(!!navigator.platform)while(n.length)if(navigator.platform===n.pop())return!0;return!1};n.getBaseUri=function(){var n=location.href.split("/"),t=n[0],i=n[2];return t+"//"+i};n.isGoNative=function(){return navigator.userAgent?!0:!1};n.isSafari=function(){return navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&!navigator.userAgent.match("CriOS")};n.getCookies=function(){var t,i,n,u;for(r.log("getCookies()"),t=document.cookie.split(";").sort(),i=[],n=0;n<t.length;n++)u=t[n].split("="),i.push({cookieName:u[0],cookieValue:u[1]});return r.log("/getCookies()"),i};n.getCookie=function(n){var u,f,i,t;for(r.log("getCookie()"),u=n+"=",f=document.cookie.split(";"),i=0;i<f.length;i++){for(t=f[i];t.charAt(0)===" ";)t=t.substring(1);if(t.indexOf(u)===0)return t.substring(u.length,t.length)}return r.log("/getCookie()"),""};n.setGlobalCookie=function(n,t,i){var u,f;r.log("setGlobalCookie()");u=new Date;u.setDate(u.getDate()+i);f=escape(t)+(i==null?"":"; expires="+u.toUTCString())+"; path=/";r.log("setting cookie:"+n+"="+f);document.cookie=n+"="+f;r.log("/setGlobalCookie()")};n.clearCookie=function(t){r.log("clearCookie()");n.setGlobalCookie(t,"",-1);r.log("/clearCookie()")};n.getHashtagsFrom=function(n){for(var r=/(?:^|\W)#(\w+)(?!\w)/g,t,i=[];t=r.exec(n);)i.push(t[1]);return i};n.getCaretPosition=function(n){var u=document.getElementById(n),o=0,h=u.ownerDocument||u.document,v=h.defaultView||h.parentWindow,s,c,l,w,a,y,f,t,e,p;for(typeof v.getSelection!="undefined"?(s=v.getSelection(),s.rangeCount>0&&(c=v.getSelection().getRangeAt(0),l=c.cloneRange(),l.selectNodeContents(u),l.setEnd(c.endContainer,c.endOffset),o=l.toString().length)):(s=h.selection)&&s.type!="Control"&&(w=s.createRange(),a=h.body.createTextRange(),a.moveToElementText(u),a.setEndPoint("EndToEnd",w),o=a.text.length),y=0,f=0,t=0;t<u.childNodes.length;t++)if(r.log("loop: "+t.toString()),e=u.childNodes[t],e.innerText==i?(r.log("\thtml: false"),r.log("\tnodeLegnth: "+e.length),f+=e.length):(r.log("\thtml: true"),r.log("\tnodeLegnth: "+e.innerHTML.length),f+=e.innerHTML.length),f>o){r.log("\ttargetNode: "+t);y=t;break}return r.log("nodeContentLength: "+f),p={node:y,relativeOffset:f-o,offset:o},r.log(p),p};n.setCaretPosition=function(n,t,i){u(n);u(t);u(i);var e=document.getElementById(n),r=document.createRange(),f=window.getSelection();r.setStart(e.childNodes[t],i);r.collapse(!0);f.removeAllRanges();f.addRange(r)};n.splash=function(n){t(n+">.splash").addClass("queued");t(n).fadeIn(function(){e(t(n),2500)})};n.popupWindow=function(n,t,r,u){var f=window.screenLeft!=i?window.screenLeft:screen.left,e=window.screenTop!=i?window.screenTop:screen.top,o=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,s=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,h=o/2-r/2+f,c=s/2-u/2+e,l=window.open(n,t,"scrollbars=yes, width="+r+", height="+u+", top="+c+", left="+h);window.focus&&l.focus()};n.getShareObject=function(n,i,r,u){t.ajax({url:"/Api/GetShareObject",type:"GET",data:{type:r,date:i,itemId:n},success:function(n){if(n.Success)u.onSuccess(n);else u.onError(n)}})};n.SendEventToEmailClient=function(t){n.getShareObject(t.itemId,t.date,6,{onSuccess:function(n){n.Success&&(t.previewContent=n.Payload);var i=n.Payload.MailTo;window.location.href=i},onError:function(){bootler.notify({type:"error",containerType:"right",msg:"Sorry a problem has occured getting the event."})}})}})(window.csUtilities=window.csUtilities||{},jQuery),function(n,t){function y(n){i.log("validating options...");i.obj("options",n);return(typeof n.appId=="undefined"||n.appId=="")&&(i.log("defaulting appId"),n.addId=o),a()==!1&&i.error("google tag is not available."),!0}function p(n,t){var r="";if(n=="home"&&(r="HDIDtimeline"),n=="booking"&&(r="HDIDbooking"),n=="handicaps"&&(r="HDIDhandicap"),n=="oom"&&(r="HDIDorderofmerit"),n=="prostatecanceruk"&&(r="HDIDpcuk"),n=="forums"&&(r="HDIDforum"),n=="friends"&&(r="HDIDfriends"),n=="profile"&&(r="HDIDprofile"),n=="notifications"&&(r="HDIDnotifications"),n=="directory"&&(r="HDIDclub"),n=="my")switch(t){case"result":case"results":case"competitionresults":r="HDIDresults";break;case"statistics":r="HDIDstats";break;case"handicaplist":r="HDIDhandicap";break;case"club":r="HDIDclub";break;case"orderofmerits":r="HDIDorderofmerit";break;case"eclectics":r="HDIDeclectics";break;case"fixtures":r="HDIDfixtures";break;case"news":r="HDIDnews"}return i.log("pageName: "+r),r}function w(){r="div-gpt-ad-1501232203947-0";s="TestHDIDLeaderboard";u="div-gpt-ad-1498729558041-0";h="TestHDIDSkin";c="div-gpt-ad-1501232624046-";l="TestHDIDMPU"}function a(){var n=!1;return window.googletag&&googletag.apiReady&&(n=!0),n}function f(n,t,r,u,f){i.log("defineGoogleTagSlot("+n+"|"+t+"|"+r+"|"+u+"|"+f+")");return googletag.defineSlot("/"+o+"/"+n,t,u).setCollapseEmptyDiv(!0).defineSizeMapping(r).setTargeting("PageName",f).addService(googletag.pubads())}function e(n,t,i){var r;switch(n){case"skin":return defaultSize=[[1,1]],r=googletag.sizeMapping().addSize([1280,320],[[1,1]]).addSize([0,0],[]).build(),f(h,defaultSize,r,t,i);case"leaderboard-top":return defaultSize=[[970,250]],r=googletag.sizeMapping().addSize([320,320],[[300,250],[320,100],[300,70],[320,50]]).addSize([750,320],[[700,50],[728,90]]).addSize([1e3,320],[[900,100]]).addSize([1024,320],[[970,250],[900,100]]).addSize([0,0],[[320,100],[300,70],[320,50]]).build(),f(s,defaultSize,r,t,i);case"timeline-mpu":return defaultSize=[[300,600],[300,250]],r=googletag.sizeMapping().addSize([0,0],[[300,600],[300,250]]).build(),f(l,defaultSize,r,t,i)}}function b(n,t){return"<div id='"+n+"' class='"+t+" gtp-mpu' style='text-align:center;'>                <script type='text/javascript'>                    googletag.cmd.push(function() { googletag.display('"+n+"'); });                <\/script>            <\/div>"}function k(n,t){var i=!0;return n=="my"&&t=="statistics"?i=!1:n=="oom"&&t=="index"?i=!1:n=="account"&&t=="login"?i=!1:n=="prostatecanceruk"&&(t=="index"||t=="leaderboard"||t=="termsandregs")&&(i=!1),i}function d(n,t){switch(n){case"top":var i=e("leaderboard-top",r,t);return googletag.display(r),i}}function g(n,t){switch(n){default:var i=e("skin",u,t);return googletag.display(u),i}}function v(n,i){var u,f,r,o,s;if(!a()){u="google tags not initialised or not found.";console.log(u);throw u;}switch(n){case"timeline":(typeof i=="undefined"||i=="")&&(i="HDIDtimeline");f="panel-mpu-timeline";r=t(document).find("#timeline .panel-mpu[data-init='0']");r.length&&(o=t("."+f).length,s=r.first().parent().parent().parent(),r.each(function(){var n=t(this),r=c+o.toString();googletag.cmd.push(function(){e("timeline-mpu",r,i)});n.addClass(f).find(".panel-body").append(b(r,"timeline-mpu"));n.attr("data-init",1)}))}}function nt(){t("body>#skin-container, #skin-left, #skin-right").remove()}var i=new CsLogger("csAdverts"),o="4798724",r="div-gpt-ad-1465554341160-0",s="HDIDLeaderboardTop",u="div-gpt-ad-1498225907624-0",h="HDIDSkin",c="div-gpt-ad-1465554694938-",l="HDIDMPUTop";n.enableLogging=function(){i.enable()};n.init=function(n){var o,f,e,s,r,u;if(typeof n.debug!="undefined"&&(n.debug===!0||n.debug==="true")&&(i.enable(),i.enableLogToElement("#log-window"),i.log("logging enabled."),w()),o=y(n),o){(typeof n.pageName=="undefined"||n.pageName=="")&&(n.pageName=p(n.controller,n.action));googletag.cmd.push(function(){googletag.pubads().enableSingleRequest();googletag.pubads().enableAsyncRendering();googletag.enableServices();typeof n.skin!="undefined"&&k(n.controller,n.action)&&(f=g(n.skin,n.pageName));typeof n.leaderboard!="undefined"&&(e=d(n.leaderboard,n.pageName));typeof n.mpus!="undefined"&&v(n.mpus,n.pageName)});googletag.pubads().addEventListener("slotRenderEnded",function(){});r=!1;u=250;t(window).resize(function(){s=new Date;r===!1&&(r=!0,setTimeout(h,u))});function h(){if(new Date-s<u)setTimeout(h,u);else{r=!1;var n=[];typeof e!="undefined"&&n.push(e);typeof f!="undefined"&&(n.push(f),nt());googletag.pubads().refresh(n)}}}else i.error("Option validation error, initialise stopped.")};n.initMpus=function(n,t){v(n,t)}}(window.csAdverts=window.csAdverts||{},jQuery),function(n){function r(n){if(n.find("li > a[href^='#']:first").length)return n.find("a[href^='#']:first").attr("href");throw"The specified tab does not contain a valid tab link.";}function u(n,t){return location.hash!==""?location.hash:t.defaultTab!=null&&t.defaultTab!=""?t.defaultTab:r(n)}function t(n,t){n.find("a[href='"+t+"']").tab("show")}function f(t){t.find("a[data-toggle='tab']").on("click",function(){var t=n(this).attr("href").substr(1);history.pushState?history.pushState(null,null,"#"+t):(scrollV=document.body.scrollTop,scrollH=document.body.scrollLeft,location.hash="#"+t,document.body.scrollTop=scrollV,document.body.scrollLeft=scrollH)})}function e(t,i){t.find("a[data-toggle='tab']").on("show.bs.tab",function(t){var f,r,u;if(i.loader&&i.loader.length)for(f=n(t.target).attr("href"),r=0;r<i.loader.length;r++)i.loader[r].hash==f&&(u=i.loader[r],(u.tabShow!=undefined||u.tabShow!=null)&&u.tabShow())})}function o(t,i){t.find("a[data-toggle='tab']").on("shown.bs.tab",function(t){var f,r,u;if(i.loader&&i.loader.length)for(f=n(t.target).attr("href"),r=0;r<i.loader.length;r++)i.loader[r].hash==f&&(u=i.loader[r],(u.tabShown!=undefined||u.tabShown!=null)&&u.tabShown())})}function s(i){n(window).on("hashchange",function(){window.location.hash!==""&&t(i,location.hash)})}var i=function(t,i){var r=t;this._defaults={defaultTab:null};this._options=n.extend(!0,{},this._defaults,i)};n.fn.csTabs=function(r){var l=typeof r=="string"?r:undefined,a,v,h,c;if(l){a=[];function y(){var t=n(this),i=t.data("csTabs");a.push(i)}this.each(y);v=arguments.length>1?Array.prototype.slice.call(arguments,1):undefined;h=[];function p(n){var t=a[n],i;if(!t){console.warn("$.csTabs not instantiated yet");console.info(this);h.push(undefined);return}typeof t[l]=="function"?(i=t[l].apply(t,v),h.push(i)):console.warn("Method '"+l+"' not defined in this plugin.")}return this.each(p),h.length>1?h:h[0]}c=typeof r=="object"?r:{};function w(){var r=n(this),l=new i(r,c),h;r.data("csTabs",l);h=u(r,c);f(r,c);e(r,c);o(r,c);s(r);t(r,h)}return this.each(w)}}(jQuery),function(n){function i(t,i){t.find(".controls>.btn-next").on("click",function(r){r.preventDefault();t.trigger("csWizard.next");!r.isDefaultPrevented()&&i.autoStep&&(t.csWizard("moveToStep",n(this).attr("data-step")),t.csWizard("scrollToTop"))});t.find(".controls>.btn-back").on("click",function(r){r.preventDefault();t.trigger("csWizard.back");!r.isDefaultPrevented()&&i.autoStep&&(t.csWizard("moveToStep",n(this).attr("data-step")),t.csWizard("scrollToTop"))});t.find(".controls>.btn-save").on("click",function(n){n.preventDefault();t.trigger("csWizard.save")})}function r(t,i){if(i.showPager){var r=1,f="",u="",e="<div class='page' data-page='{0}' title='{1}'><span class='step-no'>{2}<\/span><span class='title'>{3}<\/span><\/div>";t.find(".steps .step").each(function(){var t=n(this).attr("data-step"),i=n(this).attr("data-title");u+=e.replace("{0}",t).replace("{2}",t).replace("{1}",i).replace("{3}",i);n(this).hasClass("active")&&(r=t,f=i)});t.find(".step-pager").html(u);t.find(".step-pager .page[data-page='"+r+"']").addClass("active")}}var t=function(t,i){var r=t;this._defaults={enableLogging:!1,autoStep:!0,showPager:!0};this._options=n.extend(!0,{},this._defaults,i);this.getCurrentStep=function(){return parseInt(r.find(".step.active").attr("data-step"))};this.getTotalSteps=function(){return r.find(".step").length};this.moveToStep=function(n){r.find(".step-pager .page.active").removeClass("active");r.find(".step-pager .page[data-page='"+n+"']").addClass("active");r.find(".steps .step.active").removeClass("active");r.find(".steps .step[data-step='"+n+"']").addClass("active");this.updateControls();r.trigger("csWizard.step.ready")};this.nextStep=function(){var n=this.getCurrentStep()+1;n<=this.getTotalSteps()?this.moveToStep(n):console.error("Can't go any fruther!")};this.backStep=function(){var n=this.getCurrentStep()-1;n>0?this.moveToStep(n):console.error("Can't go back any further!")};this.scrollTo=function(t){if(r.find(t).length){var i=r.find(t)[0].offsetTop;n("body").animate({scrollTop:i+"px"})}else console.error("scrollTo(): Cannot find specified element.")};this.scrollToTop=function(){n("body").scrollTop(r[0].offsetTop)};this.enableNext=function(n){n?r.find(".btn-next").prop("disabled",!1):r.find(".btn-next").prop("disabled",!0)};this.updateControls=function(){var n=r.find(".btn-next"),t=r.find(".btn-back"),f=r.find(".btn-save"),i=this.getCurrentStep(),u=i+1,e=i-1;u>0&&u<=this.getTotalSteps()?(n.show(),n.attr("data-step",u)):n.hide();e>0?(t.show(),t.attr("data-step",e)):t.hide();i==this.getTotalSteps()?f.show():f.hide()};this.enableSave=function(n){n?r.find(".btn-save").prop("disabled",!1):r.find(".btn-save").prop("disabled",!0)}};n.fn.csWizard=function(u){var e=typeof u=="string"?u:undefined,o,s,f,h;if(e){o=[];function c(){var t=n(this),i=t.data("csWizard");o.push(i)}this.each(c);s=arguments.length>1?Array.prototype.slice.call(arguments,1):undefined;f=[];function l(n){var t=o[n],i;if(!t){console.warn("$.csWizard not instantiated yet");console.info(this);f.push(undefined);return}typeof t[e]=="function"?(i=t[e].apply(t,s),f.push(i)):console.warn("Method '"+e+"' not defined in this plugin.")}return this.each(l),f.length>1?f:f[0]}h=typeof u=="object"?u:undefined;function a(){var u=n(this),f=new t(u,h);u.data("csWizard",f);i(u,f._options);r(u,f._options);f.updateControls()}return this.each(a)}}(jQuery),function(n){function t(n){var i="<div class='link' {0}>{1}<\/div>",t;switch(n){case 1:t=i;break;case 2:t="<div class='link-disabled' {0}>{1}<\/div>";break;default:t=i}return t}function e(t,r){var f=t.attr("id"),u=n("#"+f);t.find(".filter>.link").on("click",function(i){var u,r,f;i.preventDefault();u=n(this).attr("data-letter");n(this).hasClass("active")||n(this).addClass("active").siblings(".link").removeClass("active");r=t.find(".result-set>.link[data-letter='"+u+"']:first");r.offset()!=null&&r.offset!==undefined&&(f=r[0].offsetTop-t.find(".result-set")[0].offsetTop,t.find(".result-set").animate({scrollTop:f+"px"}));t.trigger("csSelector.filter.selected")});u.on("click",".result-set>.link",function(u){u.preventDefault();var f={selected:n(this)};n(this).hasClass("active")||n(this).addClass("active").siblings(".link").removeClass("active");i(t,n(this).text());r.collapseOnSelect&&(t.find(".result-set").slideUp(),t.find(".review").slideDown());t.trigger("csSelector.result.selected",f)});u.on("click",".result-set>.link-disabled",function(i){i.preventDefault();var r={selected:n(this)};t.trigger("csSelector.disabled.selected",r)})}function o(t,i){if(i.showAlphabetList){var r=Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"),u="<span class='link' title='scroll to this' data-letter='{0}'>{1}<\/span>";n(r).each(function(){var i=u.replace("{0}",n(this)[0]).replace("{1}",n(this)[0]);t.find(".filter").append(i)})}}function s(t,i){var r="Enter search terms here",u;typeof i.searchPlaceholderText=="string"&&(r=i.searchPlaceholderText);u=n("<div class='search'>   <input type='text' placeholder='"+r+"'><\/input><\/div>");u.insertAfter(t.find(".filter"))}function i(n,t){var i="<b>"+t+"<\/b>";n.find(".review>.msg").html(i)}function r(t,i){var r=i.toLowerCase();t.find(".result-set>.link").each(function(){r!=n(this).text().toLowerCase().substr(0,r.length)?n(this).hide():n(this).show()})}function u(n){n.csSelector("clearSearchBox");r(n,"");n.find(".result-set").slideDown();n.find(".result-set > .active").removeClass("active");n.find(".review").slideUp();n.find(".search > input").focus();n.trigger("csSelector.result.selectedReset")}function h(n){n.find(".review>.change-link").on("click",function(t){t.preventDefault();u(n)})}function c(t){var i;t.find(".search > input").on("keyup",function(){var u=n(this).val();i&&clearTimeout(i);i=setTimeout(function(){r(t,u)},500)});t.find(".search > input").on("keypress",function(){event.keyCode==13&&event.preventDefault()})}var f=function(r,f){var e=r;this._defaults={enableLogging:!1,showAlphabetFilter:!0,autoScroll:!0,message:"",jumboMessage:"",collapseOnSelect:!0,showAlphabetList:!0};this._options=n.extend(!0,{},this._defaults,f);this.getSelected=function(){return e.find(".result-set>.link.active:first")};this.clearResults=function(){e.find(".result-set").empty();e.find(".review").hide();i(e,"")};this.setMessage=function(n){e.find(".message").html(n).show()};this.clearMessage=function(){e.find(".message").hide().html()};this.setJumboMessage=function(n){e.find(".result-set").hide();e.find(".message").addClass("jumbo").html(n).show()};this.clearJumboMessage=function(){e.find(".message").removeClass("jumbo").hide().html();e.find(".result-set").show()};this.clearSearchBox=function(){e.find(".search>input").val("")};this.addLink=function(n,i,r){var u=t(1),f;n&&(u=t(2));f=u.replace("{0}",i).replace("{1}",r);e.find(".result-set").append(f)};this.selectReset=function(){u(e)}};n.fn.csSelector=function(t){var r=typeof t=="string"?t:undefined,u,l,i,a;if(r){u=[];function v(){var t=n(this),i=t.data("csSelector");u.push(i)}this.each(v);l=arguments.length>1?Array.prototype.slice.call(arguments,1):undefined;i=[];function y(n){var t=u[n],f;if(!t){console.warn("$.csSelector not instantiated yet");console.info(this);i.push(undefined);return}typeof t[r]=="function"?(f=t[r].apply(t,l),i.push(f)):console.warn("Method '"+r+"' not defined in this plugin.")}return this.each(y),i.length>1?i:i[0]}a=typeof t=="object"?t:undefined;function p(){var t=n(this),i=new f(t,a);t.data("csSelector",i);i._options.showAlphabetFilter?(o(t,i._options),s(t,i._options)):n(".filter",t).addClass("hidden");h(t);e(t,i._options);c(t);i._options.message!=""?t.csSelector("setMessage",i._options.message):t.csSelector("clearMessage");i._options.jumboMessage!=""?t.csSelector("setJumboMessage",i._options.jumboMessage):t.csSelector("clearJumboMessage")}return this.each(p)}}(jQuery),function(n){n.fn.resetValidation=function(){var n=this.closest("form");return n.validate().resetForm(),n.find("[data-valmsg-summary=true]").removeClass("validation-summary-errors").addClass("validation-summary-valid").find("ul").empty(),n.find("[data-valmsg-replace]").removeClass("field-validation-error").addClass("field-validation-valid").empty(),n}}(jQuery),function(n,t,i){function c(n,o){var a,c,v,l,y,p;r.log("buildNotification() started.");a="";r.log("containerType = "+o.containerType);switch(o.containerType){case u.top.name:a=u.top.html;break;case u.topPush.name:a=u.topPush.html;break;case u.bottom.name:a=u.bottom.html;break;case u.right.name:a=u.right.html;break;default:a=u.top.html}r.log("containerHtml = "+a);c="";r.log("alertType = "+o.type);switch(o.type){case f.info.name:c=f.info.html;break;case f.warning.name:c=f.warning.html;break;case f.success.name:c=f.success.html;break;case f.error.name:c=f.error.html;break;default:c=f.info.html}if(v="",o.textAlign===i)o.textAlign=e.left.name;else switch(o.textAlign){case e.center.name:v=e.center.cssClass;break;case e.right.name:v=e.right.cssClass;break;default:v=e.left.cssClass}return c=t(c).addClass(v),r.log("alertHtml = "+c[0].outerHTML),l="",r.log("inputType = "+n),n===s.prompt.name?(l=o.closeName===i||o.closeName.length<=0?t("<div class='btlr-controls'><\/div>").wrapInner(t(h.ok.html)):t("<div class='btlr-controls'><\/div>").wrapInner(t(h.okCustom.html).append(o.closeName)),l=l[0].outerHTML):o.closeable&&((o.closeName===i||o.closeName.length<=0)&&(o.closeName="&times;"),l=t(h.close.html).append(o.closeName),l=l[0].outerHTML),r.log("inputHtml = "+l+" (if empty means auto-dimiss)"),y="",p=t(c).append(o.msg).append(l),y=t(a).wrapInner(t(p)),r.log("buildNotification() ended."),y}function l(n,r,f){f==i&&(f=1e3);switch(n){case u.top.name:t("body").append(r);t(r).animate({top:"0px"},f,function(){});break;case u.topPush.name:t("body").prepend(r).css({"margin-top":"-"+t(r).height()+"px"});t("body").animate({"margin-top":"0px"},f,function(){});break;case u.bottom.name:t("body").append(r);t(r).animate({bottom:"0px"},f,function(){});break;case u.right.name:t("body").find(".btlr-right").length&&t(".btlr-right").each(function(){t(this).animate({bottom:"+="+(t(this).height()+5)+"px"},500)});t("body").append(r);t(r).animate({right:"15px"},f-400,function(){});default:t(r).fadeIn()}}function y(n,r,f){f==i&&(f=300);switch(r){case u.right.name:n.animate({right:"-400px"},f,function(){n.find(".alert").alert("close");t(this).remove()});break;default:n.slideUp(f,function(){n.find(".alert").alert("close");t(this).remove()})}}function a(n,u,f){if(r.log("bindDismissEvent()"),f.onDismiss!==i){r.log("onDismiss event connected with close.bs.alert");n.on("close.bs.alert",function(){r.log("alert closed.");f.onDismiss()})}u===s.prompt.name||f.autoDismiss&&window.setTimeout(function(){y(n,f.containerType)},f.autoDismissDelay);t(document).on("close.bs.alert",function(n){r.log("removing parent element");t(n.target).parent().remove()});r.log("bindDismissEvent() ended")}function v(n,t){return(r.obj("validationOptions()",t),n===s.prompt.name&&t.autoDismiss===!0)?(r.error("You specified a prompt with autoDismiss = true, this may pose a usability problem, if you wish to use auto-dismiss, please use a notification (.notify()) instead."),!1):t.closeable===!1&&t.autoDismiss===!1?(r.error("The settnigs you entered does not allow the alert to be removed from DOM, it needs to be either closeable or auto-dismiss-able"),!1):(r.log("bindDismissEvent() ended"),!0)}var r=new CsLogger("bootler"),o="btlr-container",u={top:{name:"top",html:"<div id='"+o+"' class='btlr-top btlr-slide-down'><\/div>"},topPush:{name:"topPush",html:"<div id='"+o+"' class='btlr-top-push'><\/div>"},bottom:{name:"bottom",html:"<div id='"+o+"' class='btlr-bottom btlr-slide-up'><\/div>"},right:{name:"right",html:"<div id='"+o+"' class='btlr-right btlr-slide-left'><\/div>"}},s={prompt:{name:"prompt"},notification:{name:"notification"}},f={info:{name:"info",html:"<div class='alert alert-info fade in' role='alert'><\/div>"},warning:{name:"warning",html:"<div class='alert alert-warning fade in' role='alert'><\/div>"},success:{name:"success",html:"<div class='alert alert-success fade in' role='alert'><\/div>"},error:{name:"error",html:"<div class='alert alert-danger fade in' role='alert'><\/div>"}},h={close:{name:"close",html:"<a href='#' class='close' data-dismiss='alert' aria-label='close'><\/a>"},ok:{name:"ok",html:"<a href='#' class='close btlr-btn btlr-btn-ok' data-dismiss='alert' aria-label='close'>OK<\/a>"},okCustom:{name:"ok",html:"<a href='#' class='close btlr-btn btlr-btn-ok' data-dismiss='alert' aria-label='close'><\/a>"}},e={left:{name:"left",cssClass:"text-left"},center:{name:"center",cssClass:"text-center"},right:{name:"right",cssClass:"text-right"}};n.enableLogging=function(){r.enable()};n.init=function(){};n.prompt=function(n){var t="prompt",i;v(t,n)&&(i=c(t,n),a(i,t,n),l(n.containerType,i))};n.notify=function(n){var t,u;r.log("notify()");t="notification";v(t,n)&&(n.autoDismiss===i&&(r.log("setting auto dismiss = true"),n.autoDismiss=!0),(n.autoDismissDelay===i||n.autoDismissDelay<=0)&&(r.log("timeout value = default"),n.autoDismissDelay=5e3),u=c(t,n),a(u,t,n),l(n.containerType,u))}}(window.bootler=window.bootler||{},jQuery),function(n,t,i){function c(n,r){u.event(n);r!=i?t(document).trigger(n,r):t(document).trigger(n)}function y(n,t){u.info("bindOnShow()");n.on("show.bs.modal",function(){u.log("shown event firing");typeof t.onModalShow=="function"&&(u.log("onModalShow available, binding."),t.onModalShow())});u.info("/bindOnShow()")}function p(n,i){u.info("bindOnShown()");n.on("shown.bs.modal",function(){typeof i.onModalShown=="function"&&(u.log("onModalShown available, binding."),i.onModalShown());i.containerType===f.textInput.name&&t(r.textInput.selector).focus()});u.info("/bindOnShown()")}function w(n,i){u.info("bindConfirm()");n.find(r.confirmButton.selector).on("click",function(e){e.preventDefault();n.removeClass("active").addClass("inactive");var o="";if(i.containerType===f.textInput.name&&t(r.textInput.selector).length&&(o=t(r.textInput.selector).val(),u.log(o)),typeof i.onConfirm=="function"){t(r.container.inactive).modal("hide");u.log("hiding modal");i.onConfirm(o);u.log("firing onConfirm")}else u.error("there is no onConfirm function defined.")});u.info("/bindConfirm()")}function b(n){u.info("bindOnHidden()");n.on("hidden.bs.modal",function(){u.log("hidden triggered");n.remove();u.log("modal element removed")});u.info("/bindOnHidden()")}function l(n){var u=!0,i=t(r.textInputCounter.selector).find(".counter-val"),f=n-t(r.textInput.selector).val().length;return f<0?(u=!1,i.addClass("invalid")):i.removeClass("invalid"),i.html(f),u}function a(n){var i=t(r.confirmButton.selector);n?i.removeAttr("disabled"):i.attr("disabled","disabled")}function v(n){n.length?t(r.textInputValMsg.selector).show().html(n):t(r.textInputValMsg.selector).html("").hide()}function k(){c(h.textInputStart)}function d(){var n=t(r.textInput.selector).val();c(h.textInputComplete,n)}function g(n,e){var h,c,o,s;if(u.log("bindModalEvents()"),y(n,e),p(n,e),w(n,e),b(n,e),e.containerType===f.textInput.name){c=2e3;o=t(r.textInput.selector);o.unbind();s=e.inputLimit!=i&&e.inputLimit>0;s&&(t(r.textInputCounter.selector).find(".counter-val").html(e.inputLimit),t(r.textInputCounter.selector).show());e.inputBoxMessage!=i&&e.inputBoxMessage.length&&(o.val(e.inputBoxMessage),l(e.inputLimit));o.on("keydown keypress input paste",function(){if(k(),s){var n=l(e.inputLimit);n?(a(!0),v("")):(a(!1),v("You have reached the input limit of "+e.inputLimit+" characters, please review your input and try again."))}});o.on("keyup",function(){clearTimeout(h);h=setTimeout(d,c)})}u.log("/bindModalEvents()")}function o(n){var s,h,o,c,l,a;u.log("building modal");s="";h="";u.obj("printing options",n);o="";switch(n.containerType){case f.standard.name:o=t(f.standard.html);break;case f.textInput.name:o=t(f.textInput.html);break;case f.sealed.name:o=t(f.sealed.html);break;case f.loader.name:o=t(f.loader.html);break;default:u.error("Container type ["+n.containerType+"] not found.")}if(c="",n.containerType!==f.loader.name)switch(n.inputType){case e.okCancel.name:s="Confirm";h="Please confirm";c=n.confirmButtonName!==i?t(e.okCancel.html.replace("OK",n.confirmButtonName)):t(e.okCancel.html);break;case e.ok.name:s="Confirm";h="Please confirm";c=n.confirmButtonName!==i?t(e.ok.html.replace("OK",n.confirmButtonName)):t(e.ok.html);break;case e.confirmDelete.name:s="Confirm Delete";h="Are you sure you want to delete?";c=t(e.confirmDelete.html);break;default:u.error("Input type ["+n.inputType+"] not found.")}else s="Loading...",h="Please wait a few moments whilst we process your request...";n.modalTitle===i&&(n.modalTitle=s);n.modalMessage===i&&(n.modalMessage=h);o.find(".modal-dialog .modal-content .modal-header .modal-title").append(n.modalTitle);n.containerType===f.textInput.name&&(n.inputLimit!=i&&n.inputLimit>0&&o.find(".modal-dialog .modal-content .modal-body").append(r.textInputValMsg.html).append(r.textInputCounter.html),l="",typeof n.placeholderText=="string"&&(l=n.placeholderText),o.find(".modal-dialog .modal-content .modal-body").append(e.textInput.html.replace("{{placeholderText}}",l)));o.find(".modal-dialog .modal-content .modal-body").append(n.modalMessage);o.find(".modal-dialog .modal-content .modal-footer").append(c);t("body").append(o);u.log("modal appended to DOM.");a=t(r.container.active);g(a,n);a.modal({backdrop:"static",keyboard:!1});u.log("modal shown")}var s="mootler",u=new CsLogger(s),r={container:{id:"mtlr-modal",selector:"#mtlr-modal.active",active:"#mtlr-modal.active",inactive:"#mtlr-modal.inactive"},confirmButton:{id:"mtlr-confirm",selector:"#mtlr-confirm"},cancelButton:{id:"mtlr-cancel",selector:"#mtlr-cancel"},textInput:{id:"mtlr-txt-input",selector:"#mtlr-txt-input"},textInputCounter:{id:"mtlr-txt-input-counter",selector:"#mtlr-txt-input-counter",html:"<div id='mtlr-txt-input-counter' style='display:none;'>Count: <span class='counter-val'>0<\/span><\/div>"},textInputValMsg:{id:"mtlr-txt-input-val-msg",selector:"#mtlr-txt-input-val-msg",html:"<div id='mtlr-txt-input-val-msg' style='display:none;'><\/div>"}},f={standard:{name:"standard",html:"<div id='"+r.container.id+"' class='mtlr mtlr-standard-modal modal fade active' role='dialog' aria-hidden='true'><div class='modal-dialog'><div class='modal-content'><div class='modal-header'><button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;<\/button><div class='modal-title'><\/div><\/div><div class='modal-body'><\/div><div class='modal-footer'><\/div><\/div><\/div><\/div>"},sealed:{name:"sealed",html:"<div id='"+r.container.id+"' class='mtlr mtlr-sealed-modal modal fade active' role='dialog' aria-hidden='true'><div class='modal-dialog'><div class='modal-content'><div class='modal-header'><div class='modal-title'><\/div><\/div><div class='modal-body'><\/div><div class='modal-footer'><\/div><\/div><\/div><\/div>"},textInput:{name:"textInput",html:"<div id='"+r.container.id+"' class='mtlr mtlr-txt-input-modal modal fade active' role='dialog' aria-hidden='true'><div class='modal-dialog'><div class='modal-content'><div class='modal-header'><button type='button' class='close' data-dismiss='modal' aria-hidden='true'>&times;<\/button><div class='modal-title'><\/div><\/div><div class='modal-body'><\/div><div class='modal-preview'><\/div><div class='modal-footer'><\/div><\/div><\/div><\/div>"},loader:{name:"loader",html:"<div id='"+r.container.id+"' class='mtlr mtlr-loading-modal modal fade active' role='dialog' aria-hidden='true'><div class='modal-dialog'><div class='modal-content'><div class='modal-header'><div class='modal-title'><i class='fa fa-circle-o-notch fa-lg fa-spin'><\/i><\/div><\/div><div class='modal-body'><\/div><div class='modal-footer' style='display:none;'><\/div><\/div><\/div><\/div>"},injectedLoader:{name:"injectedLoader",className:"mtlr-inject-loader",html:"<div id='"+r.container.id+"' class='mtlr mtlr-inject-loader clear-both active'><i class='fa fa-circle-o-notch fa-spin {{1}}'><\/i> <span>{{0}}<\/span><\/div>"}},e={okCancel:{name:"okCancel",html:"<button type='button' class='btn btn-success' id='"+r.confirmButton.id+"'>OK<\/button><button type='button' class='btn btn-default' id='"+r.cancelButton.id+"' data-dismiss='modal'>Cancel<\/button>"},ok:{name:"ok",html:"<div type='button' class='btn btn-info' id='"+r.confirmButton.id+"' data-dismiss='modal'>OK<\/div>"},confirmDelete:{name:"confirmDelete",html:"<button type='button' class='btn btn-default' id='"+r.cancelButton.id+"' data-dismiss='modal'>Cancel<\/button><button type='button' class='btn btn-danger' id='"+r.confirmButton.id+"'>Delete<\/button>"},textInput:{name:"textInput",html:"<textarea class='form-control' id='"+r.textInput.id+"' placeholder='{{placeholderText}}'><\/textarea>"}},h={textInputStart:s+".textInput.start",textInputComplete:s+".textInput.complete"};n.enableLogging=function(){u.enable()};n.init=function(){};n.modal=function(n){o(n)};n.okCancel=function(n){n.containerType=f.standard.name;n.inputType=e.okCancel.name;o(n)};n.ok=function(n){n.containerType=f.sealed.name;n.inputType=e.ok.name;o(n)};n.confirmDelete=function(n){n.containerType=f.standard.name;n.inputType=e.confirmDelete.name;o(n)};n.textInput=function(n){n.containerType=f.textInput.name;n.inputType=e.okCancel.name;o(n)};n.loader=function(n){(n===i||n==null)&&(n={});n.containerType=f.loader.name;o(n)};n.closeLoader=function(){t(r.container.id+".mtlr-loading-modal").modal("hide")};n.injectLoader=function(n,r,u){var e=f.injectedLoader.html;r==i&&(r="");e=e.replace("{{0}}",r);u==i&&(e="");e=e.replace("{{1}}",u);t(n).prepend(e)};n.closeInjectedLoader=function(){console.log("#"+r.container.id+"."+f.injectedLoader.className);t("#"+r.container.id+"."+f.injectedLoader.className).remove()}}(window.mootler=window.mootler||{},jQuery),function(n,t,i){function u(n,t){if(s)switch(n){case r.text:console.log("formby | "+t);break;case r.object:console.log("formby | object data output:");console.log(t);break;case r.info:console.info("formby | "+t);break;case r.warning:console.warn("formby | "+t);break;case r.error:console.error("formby | "+t)}}function c(n,t){var i={};return i.ObjectId=n,i.Data=t,i}function l(n,t){return{Name:n,Value:t}}function a(n){var i=[];return n.find(f.input).each(function(){var n=t(this).attr(e.dataName),r=t(this).val(),u=l(n,r);i.push(u)}),i}function v(n){n.find(f.input).each(function(){var r=t(this).val(),n;t(this).attr(e.dataOldValue,r);t(this).prop("disabled",!1);n=t(this).attr(e.dataAltInput);n!==i&&n!=""&&(t(n).show(),t(this).hide())})}function y(n){n.find(f.input).each(function(){t(this).prop("disabled",!0);var n=t(this).attr(e.dataAltInput);n!==i&&n!=""&&(t(t(this).attr(e.dataAltInput)).hide(),t(this).show())})}function h(n){n.find(".field-validation-error").addClass("field-validation-valid").removeClass(".field-validation-error").find("span").remove()}function p(n){u(r.info,"binding edit event...");n.find(f.edit).on("click",function(){v(n);t(this).hide();n.find(f.save).show();n.find(f.cancel).show();n.find(f.input+":first").focus()});u(r.info,"edit event bound.")}function w(n,o){u(r.info,"binding cancel event...");n.find(f.cancel).on("click",function(){n.find(f.input).each(function(){var r=t(this).attr(e.dataOldValue),n;t(this).val(r);t(this).removeAttr(e.dataOldValue);t(this).prop("disabled",!0);n=t(this).attr(e.dataAltInput);n!==i&&n!=""&&(t(n).hide(),t(this).show())});t(this).hide();n.find(f.save).hide();n.find(f.edit).show();o!=i&&o();h(n)});u(r.info,"cancel event bound.")}function b(n,t,i,o){u(r.info,"binding onSave event...");n.find(f.save).on("click",function(){if(t()==!0){h(n);y(n);var l=a(n),s=c(n.attr(e.dataObjectId),l);u(r.info,"model looks good, invoking onSave()");u(r.object,s);o(s);n.find(f.save).hide();n.find(f.cancel).hide();n.find(f.edit).show()}else u(r.error,"Validator returns the form as invalid."),i()});u(r.info,"onSave bound.")}function k(n,t){u(r.info,"binding onSaveSuccess event...");n.on(o.saveSuccess,function(n,i){t(i)});u(r.info,"onSaveSuccess bound.")}function d(n,t){u(r.info,"binding onSaveFailed event...");n.on(o.saveFailed,function(i,r){tt(n);t(r)});u(r.info,"onSaveFailed bound.")}function g(n){var t=!0,c=n.find(f.save),o,s,h;return c.length<=0?(u(r.error,"No save ("+f.save+") element defined in this form."),t=!1):u(r.info,f.save+" element found."),o=n.find(f.edit),o.length<=0?(u(r.error,"No edit ("+f.edit+") element defined in this form."),t=!1):u(r.info,f.edit+" element found."),s=n.find(f.cancel),s.length<=0?(u(r.error,"No cancel ("+f.cancel+") element defined in this form."),t=!1):u(r.info,f.cancel+" element found."),h=n.attr(e.dataObjectId),h==i&&(t=!1,u(r.error,"The attribute "+e.dataObjectId+" is missing in the form.")),t}function nt(n){var t=!0;return n.validator==i&&(t=!1,u(r.error,"No validator function provided.")),n.onInvalid==i&&(t=!1,u(r.error,"No onInvalid callbacks provided.")),n.onCancelled==i&&u(r.warning,"No onCancelled (optional) callbacks provided."),n.onSave==i&&(t=!1,u(r.error,"No onSave callbacks defined.")),n.onSaveSuccess==i&&(t=!1,u(r.error,"No onSaveSuccess callbacks defined.")),n.onSaveFailed==i&&(t=!1,u(r.error,"No onSaveFailed callbacks defined.")),t}function tt(n){n.find(f.input).each(function(){t(this).val(t(this).attr(e.dataOldValue));t(this).removeAttr(e.dataOldValue)})}var s=!1,r={text:"msg",object:"obj",info:"info",warning:"warning",error:"error"},e={dataName:"name",dataValue:"value",dataForm:"data-form",dataFormTarget:"data-form-target",dataOldValue:"data-o-val",dataAltInput:"data-alt-input",dataObjectId:"data-object-id"},f={edit:".data-edit",cancel:".data-cancel",save:".data-save",input:".data-input",validationMsg:".data-val-msg"},o={saveSuccess:"formby.saveSuccess",saveFailed:"formby.saveFailed"};n.init=function(n,t){s=t.enableLogging!=i?t.enableLogging:!1;var f=!1,e=!1;n!=i?(f=g(n),e=nt(t)):u(r.error,"The form is not a valid object.");f&&e?(p(n),w(n,t.onCancelled),b(n,t.validator,t.onInvalid,t.onSave),k(n,t.onSaveSuccess),d(n,t.onSaveFailed)):(f||u(r.error,"The form is not correctly structured, please review the log output."),e||u(r.error,"Some callbacks may be missing, please review the log output."))};n.trigger=function(n,t,i){switch(t){case o.saveSuccess:n.trigger(o.saveSuccess,i);break;case o.saveFailed:n.trigger(o.saveFailed,i)}u(r.info,"event: "+t+" triggered!")}}(window.formby=window.formby||{},jQuery),function(n,t){function f(){return i.log("checkEnabled()"),o?!0:(mootler.ok({modalTitle:"<i class='fa fa-info-circle'><\/i> This feature is currently unavailable.",modalMessage:"Integration with Twitter on HowDidiDo is not currently supported on the device you are on, but our team is working hard to bring this to you as soon as possible! <br/><br/>Be sure to keep watching this space <i class='fa fa-smile-o'><\/i>",confirmButtonName:"OK"}),!1)}function l(n,i){t.ajax({url:"/Api/SocialMediaCheck",data:{type:3},type:"GET",success:function(t){if(t.Success&&t.Payload==="true")if(typeof n=="function")n(t);else return!0;else if(typeof i=="function")i(t);else return!1}})}function e(n){var t="Oops! An unexpected error occurred :( please try again later.";if(n.Failures!=null)switch(n.Failures[0].Message){case r.timelineEventNotShareable:t="This event is not currently shareable.";break;case r.timelineEventNotFound:t="Event could not be found or has been deleted.";break;case r.tweetLimitExceeded:t="Your tweet has exceeded the allowed character limit.";break;case r.accessTokenRequired:case r.accessTokenExpired:t=n.Failures[0].Message}return t}function s(n){var t="/profile/BeginTwitterAuthAsync";typeof n.itemId!="undefined"&&typeof n.date!="undefined"&&(t+="?dt="+n.date+"&eid="+n.itemId);csUtilities.popupWindow(t,"twitterAuthWindow",600,600)}function h(n,t){var u=e(n),f="",o=!0;switch(u){case r.accessTokenRequired:f="To enable Twitter sharing, we will need a <b>one-time<\/b> authorisation by you logging into your Twitter account. Follow these steps:<br/><br/><ol>   <li class='p-b'>click the <b>OK<\/b> button, and the Twitter authorisation screen will appear.<\/li>   <li class='p-b'>click on the <b>Authorise app<\/b> button. This will bring you back to HowDidiDo automatically.<\/li>   <li class='p-b'>Tweet away!<\/li><\/ol>We will not be able to see, or store your Twitter account details, and you can revoke this authorisation at anytime you want, from either HowDidiDo or in your Twitter account settings.";break;case r.accessTokenExpired:f="It seems that your Twitter setting has expired, to continue tweeting from HowDidiDo, please reauthenticate with Twitter again. Click OK to begin authorisation process.";break;default:o=!1}if(o)mootler.okCancel({modalTitle:"Authorisation Required",modalMessage:f,confirmButtonName:"OK",onConfirm:function(){s(t)}});else if(t.onError==null)bootler.notify({type:"error",containerType:"right",msg:e(u),closeable:!0,autoDismiss:!0});else{i.log("onError()");t.onError(u)}}function a(n,t){if(bootler.notify({type:"success",containerType:"right",msg:"Done! The tweet is on its way to your Twitter feed! Fancy tweeting some more? ",closeable:!0,autoDismiss:!0}),n.onSuccess!=null){i.log("onSuccess()");n.onSuccess(t)}}function v(n,t){i.error("Tweet failed");i.obj("data",t);h(t,n)}function y(){t(document).on("mootler.textInput.start",function(){t(u.divAddInput.selector).html("<i class='fa fa-spin fa-circle-o-notch'><\/i> detecting hashtags...").fadeIn()});t(document).on("mootler.textInput.complete",function(n,i){for(var f=csUtilities.getHashtagsFrom(i),e="",r=0;r<f.length;r++)e+="<mark class='hash'>#{0}<\/mark> ".replace("{0}",f[r]);t(u.divAddInput.selector).html(e).fadeIn()})}function p(n,r){i.log(r);t.ajax({url:"/API/Tweet",data:{itemId:n.itemId,message:r,date:n.date,url:n.url},type:"POST",success:function(t){t.Success?a(n,t):v(n,t)}})}function c(n,i){var r="<i class='fa fa-info-circle'><\/i> <b>Why 106 characters?<\/b> <br/>Your tweet automatically includes <mark class='hash'>#HowDidiDo<\/mark>and a <mark class='url'>URL<\/mark> at the end. Together they take up 34 characters out of the available 140 characters.";typeof n.modalMessage=="string"&&n.modalMessage.length>0&&(r=n.modalMessage+"<br/><br/>"+r);mootler.textInput({modalTitle:"<i class='fa fa-twitter'><\/i> Send a tweet",modalMessage:r,placeholderText:"Compose your tweet",confirmButtonName:"Tweet!",inputBoxMessage:i,inputLimit:106,onModalShow:function(){t(u.divAddInput.html).insertAfter(t("#mtlr-txt-input"));y()},onConfirm:function(t){p(n,t)}})}var i=new CsLogger("csTwitter"),u={divAddInput:{id:"tw-div-add-input",selector:"#tw-div-add-input",html:"<div id='tw-div-add-input' class='form-control'><\/div>"}},r={accessTokenRequired:"twitter_access_token_required",accessTokenExpired:"twitter_access_token_expired",tweetLimitExceeded:"twitter_tweet_limit_exceeded",timelineEventNotFound:"timeline_event_not_found",timelineEventNotShareable:"timeline_event_not_shareable"},o=!1;n.enableLogging=function(){i.enable();i.enableLogToElement("#log-window");i.log("logging enabled.")};n.init=function(n){i.log("init()");o=n;i.log("/init()")};n.disconnect=function(n){f()&&(i.log("disconnect()"),t.ajax({url:"/Api/ClearTwitterSettings",type:"POST",success:function(t){if(t.Success){if(i.log("settings cleared"),n!=null&&n.onSuccess!=null){i.log("onSuccess()");n.onSuccess(t)}}else if(i.obj("error clearing login",t),n!=null&&n.onSuccess!=null){i.log("onError()");n.onError(t)}}}),i.log("/disconnect()"))};n.connect=function(n){f()&&((typeof n=="undefined"||n==null)&&(n={}),s(n))};n.tweet=function(n){if(f()){if(i.log("tweet()"),n==null){i.error("No arguments supplied.");return}if(n.itemId==null){i.error("You must provide an item ID.");return}if(n.date==null||n.date===""){i.warning("You did not supply a date, defaulting to today's date.");var t=new Date,r=t.toISOString().slice(0,10);n.date=r}l(function(){n.preview==!0||n.preview==="true"?csUtilities.getShareObject(n.itemId,n.date,3,{onSuccess:function(t){i.obj("event object returned.",t);c(n,t.Payload.Message)},onError:function(n){var t=e(n);bootler.notify({type:"error",containerType:"right",msg:t,closeable:!0,autoDismiss:!0});i.obj("error",n)}}):c(n,"")},function(t){h(t,n)});i.log("/share()")}}}(window.csTwitter=window.csTwitter||{},jQuery);!function(){"use strict";function n(r){if(!r)throw new Error("No options passed to Waypoint constructor");if(!r.element)throw new Error("No element option passed to Waypoint constructor");if(!r.handler)throw new Error("No handler option passed to Waypoint constructor");this.key="waypoint-"+i;this.options=n.Adapter.extend({},n.defaults,r);this.element=this.options.element;this.adapter=new n.Adapter(this.element);this.callback=r.handler;this.axis=this.options.horizontal?"horizontal":"vertical";this.enabled=this.options.enabled;this.triggerPoint=null;this.group=n.Group.findOrCreate({name:this.options.group,axis:this.axis});this.context=n.Context.findOrCreateByElement(this.options.context);n.offsetAliases[this.options.offset]&&(this.options.offset=n.offsetAliases[this.options.offset]);this.group.add(this);this.context.add(this);t[this.key]=this;i+=1}var i=0,t={};n.prototype.queueTrigger=function(n){this.group.queueTrigger(this,n)};n.prototype.trigger=function(n){this.enabled&&this.callback&&this.callback.apply(this,n)};n.prototype.destroy=function(){this.context.remove(this);this.group.remove(this);delete t[this.key]};n.prototype.disable=function(){return this.enabled=!1,this};n.prototype.enable=function(){return this.context.refresh(),this.enabled=!0,this};n.prototype.next=function(){return this.group.next(this)};n.prototype.previous=function(){return this.group.previous(this)};n.invokeAll=function(n){var r=[],u,i,f;for(u in t)r.push(t[u]);for(i=0,f=r.length;f>i;i++)r[i][n]()};n.destroyAll=function(){n.invokeAll("destroy")};n.disableAll=function(){n.invokeAll("disable")};n.enableAll=function(){n.invokeAll("enable")};n.refreshAll=function(){n.Context.refreshAll()};n.viewportHeight=function(){return window.innerHeight||document.documentElement.clientHeight};n.viewportWidth=function(){return document.documentElement.clientWidth};n.adapters=[];n.defaults={context:window,continuous:!0,enabled:!0,group:"default",horizontal:!1,offset:0};n.offsetAliases={"bottom-in-view":function(){return this.context.innerHeight()-this.adapter.outerHeight()},"right-in-view":function(){return this.context.innerWidth()-this.adapter.outerWidth()}};window.Waypoint=n}(),function(){"use strict";function f(n){window.setTimeout(n,1e3/60)}function n(n){this.element=n;this.Adapter=t.Adapter;this.adapter=new this.Adapter(n);this.key="waypoint-context-"+r;this.didScroll=!1;this.didResize=!1;this.oldScroll={x:this.adapter.scrollLeft(),y:this.adapter.scrollTop()};this.waypoints={vertical:{},horizontal:{}};n.waypointContextKey=this.key;i[n.waypointContextKey]=this;r+=1;this.createThrottledScrollHandler();this.createThrottledResizeHandler()}var r=0,i={},t=window.Waypoint,u=window.onload;n.prototype.add=function(n){var t=n.options.horizontal?"horizontal":"vertical";this.waypoints[t][n.key]=n;this.refresh()};n.prototype.checkEmpty=function(){var n=this.Adapter.isEmptyObject(this.waypoints.horizontal),t=this.Adapter.isEmptyObject(this.waypoints.vertical);n&&t&&(this.adapter.off(".waypoints"),delete i[this.key])};n.prototype.createThrottledResizeHandler=function(){function i(){n.handleResize();n.didResize=!1}var n=this;this.adapter.on("resize.waypoints",function(){n.didResize||(n.didResize=!0,t.requestAnimationFrame(i))})};n.prototype.createThrottledScrollHandler=function(){function i(){n.handleScroll();n.didScroll=!1}var n=this;this.adapter.on("scroll.waypoints",function(){(!n.didScroll||t.isTouch)&&(n.didScroll=!0,t.requestAnimationFrame(i))})};n.prototype.handleResize=function(){t.Context.refreshAll()};n.prototype.handleScroll=function(){var u={},i={horizontal:{newScroll:this.adapter.scrollLeft(),oldScroll:this.oldScroll.x,forward:"right",backward:"left"},vertical:{newScroll:this.adapter.scrollTop(),oldScroll:this.oldScroll.y,forward:"down",backward:"up"}},r,f,s;for(r in i){var n=i[r],h=n.newScroll>n.oldScroll,c=h?n.forward:n.backward;for(f in this.waypoints[r]){var t=this.waypoints[r][f],e=n.oldScroll<t.triggerPoint,o=n.newScroll>=t.triggerPoint,l=e&&o,a=!e&&!o;(l||a)&&(t.queueTrigger(c),u[t.group.id]=t.group)}}for(s in u)u[s].flushTriggers();this.oldScroll={x:i.horizontal.newScroll,y:i.vertical.newScroll}};n.prototype.innerHeight=function(){return this.element==this.element.window?t.viewportHeight():this.adapter.innerHeight()};n.prototype.remove=function(n){delete this.waypoints[n.axis][n.key];this.checkEmpty()};n.prototype.innerWidth=function(){return this.element==this.element.window?t.viewportWidth():this.adapter.innerWidth()};n.prototype.destroy=function(){var t=[],i,r,n,u;for(i in this.waypoints)for(r in this.waypoints[i])t.push(this.waypoints[i][r]);for(n=0,u=t.length;u>n;n++)t[n].destroy()};n.prototype.refresh=function(){var o,u=this.element==this.element.window,l=u?void 0:this.adapter.offset(),f={},e,i,a;this.handleScroll();o={horizontal:{contextOffset:u?0:l.left,contextScroll:u?0:this.oldScroll.x,contextDimension:this.innerWidth(),oldScroll:this.oldScroll.x,forward:"right",backward:"left",offsetProp:"left"},vertical:{contextOffset:u?0:l.top,contextScroll:u?0:this.oldScroll.y,contextDimension:this.innerHeight(),oldScroll:this.oldScroll.y,forward:"down",backward:"up",offsetProp:"top"}};for(e in o){i=o[e];for(a in this.waypoints[e]){var v,s,h,y,p,n=this.waypoints[e][a],r=n.options.offset,w=n.triggerPoint,b=0,c=null==w;n.element!==n.element.window&&(b=n.adapter.offset()[i.offsetProp]);"function"==typeof r?r=r.apply(n):"string"==typeof r&&(r=parseFloat(r),n.options.offset.indexOf("%")>-1&&(r=Math.ceil(i.contextDimension*r/100)));v=i.contextScroll-i.contextOffset;n.triggerPoint=b+v-r;s=w<i.oldScroll;h=n.triggerPoint>=i.oldScroll;y=s&&h;p=!s&&!h;!c&&y?(n.queueTrigger(i.backward),f[n.group.id]=n.group):!c&&p?(n.queueTrigger(i.forward),f[n.group.id]=n.group):c&&i.oldScroll>=n.triggerPoint&&(n.queueTrigger(i.forward),f[n.group.id]=n.group)}}return t.requestAnimationFrame(function(){for(var n in f)f[n].flushTriggers()}),this};n.findOrCreateByElement=function(t){return n.findByElement(t)||new n(t)};n.refreshAll=function(){for(var n in i)i[n].refresh()};n.findByElement=function(n){return i[n.waypointContextKey]};window.onload=function(){u&&u();n.refreshAll()};t.requestAnimationFrame=function(n){var t=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||f;t.call(window,n)};t.Context=n}(),function(){"use strict";function i(n,t){return n.triggerPoint-t.triggerPoint}function u(n,t){return t.triggerPoint-n.triggerPoint}function n(n){this.name=n.name;this.axis=n.axis;this.id=this.name+"-"+this.axis;this.waypoints=[];this.clearTriggerQueues();r[this.axis][this.name]=this}var r={vertical:{},horizontal:{}},t=window.Waypoint;n.prototype.add=function(n){this.waypoints.push(n)};n.prototype.clearTriggerQueues=function(){this.triggerQueues={up:[],down:[],left:[],right:[]}};n.prototype.flushTriggers=function(){var n,t,e,r,o,f;for(n in this.triggerQueues)for(t=this.triggerQueues[n],e="up"===n||"left"===n,t.sort(e?u:i),r=0,o=t.length;o>r;r+=1)f=t[r],(f.options.continuous||r===t.length-1)&&f.trigger([n]);this.clearTriggerQueues()};n.prototype.next=function(n){this.waypoints.sort(i);var r=t.Adapter.inArray(n,this.waypoints),u=r===this.waypoints.length-1;return u?null:this.waypoints[r+1]};n.prototype.previous=function(n){this.waypoints.sort(i);var r=t.Adapter.inArray(n,this.waypoints);return r?this.waypoints[r-1]:null};n.prototype.queueTrigger=function(n,t){this.triggerQueues[t].push(n)};n.prototype.remove=function(n){var i=t.Adapter.inArray(n,this.waypoints);i>-1&&this.waypoints.splice(i,1)};n.prototype.first=function(){return this.waypoints[0]};n.prototype.last=function(){return this.waypoints[this.waypoints.length-1]};n.findOrCreate=function(t){return r[t.axis][t.name]||new n(t)};t.Group=n}(),function(){"use strict";function n(n){this.$element=t(n)}var t=window.jQuery,i=window.Waypoint;t.each(["innerHeight","innerWidth","off","offset","on","outerHeight","outerWidth","scrollLeft","scrollTop"],function(t,i){n.prototype[i]=function(){var n=Array.prototype.slice.call(arguments);return this.$element[i].apply(this.$element,n)}});t.each(["extend","inArray","isEmptyObject"],function(i,r){n[r]=t[r]});i.adapters.push({name:"jquery",Adapter:n});i.Adapter=n}(),function(){"use strict";function n(n){return function(){var r=[],i=arguments[0];return n.isFunction(arguments[0])&&(i=n.extend({},arguments[1]),i.handler=arguments[0]),this.each(function(){var u=n.extend({},i,{element:this});"string"==typeof u.context&&(u.context=n(this).closest(u.context)[0]);r.push(new t(u))}),r}}var t=window.Waypoint;window.jQuery&&(window.jQuery.fn.waypoint=n(window.jQuery));window.Zepto&&(window.Zepto.fn.waypoint=n(window.Zepto))}();!function(){"use strict";function n(r){this.options=t.extend({},i.defaults,n.defaults,r);this.element=this.options.element;this.$element=t(this.element);this.createWrapper();this.createWaypoint()}var t=window.jQuery,i=window.Waypoint;n.prototype.createWaypoint=function(){var n=this.options.handler;this.waypoint=new i(t.extend({},this.options,{element:this.wrapper,handler:t.proxy(function(t){var i=this.options.direction.indexOf(t)>-1,r=i?this.$element.outerHeight(!0):"";this.$wrapper.height(r);this.$element.toggleClass(this.options.stuckClass,i);n&&n.call(this,t)},this)}))};n.prototype.createWrapper=function(){this.options.wrapper&&this.$element.wrap(this.options.wrapper);this.$wrapper=this.$element.parent();this.wrapper=this.$wrapper[0]};n.prototype.destroy=function(){this.$element.parent()[0]===this.wrapper&&(this.waypoint.destroy(),this.$element.removeClass(this.options.stuckClass),this.options.wrapper&&this.$element.unwrap())};n.defaults={wrapper:'<div class="sticky-wrapper" />',stuckClass:"stuck",direction:"down right"};i.Sticky=n}();!function(){"use strict";function t(r){this.options=n.extend({},t.defaults,r);this.container=this.options.element;"auto"!==this.options.container&&(this.container=this.options.container);this.$container=n(this.container);this.$more=n(this.options.more);this.$more.length&&(this.setupHandler(),this.waypoint=new i(this.options))}var n=window.jQuery,i=window.Waypoint;t.prototype.setupHandler=function(){this.options.handler=n.proxy(function(){this.options.onBeforePageLoad();this.destroy();this.$container.addClass(this.options.loadingClass);n.get(n(this.options.more).attr("href"),n.proxy(function(t){var u=n(n.parseHTML(t)),r=u.find(this.options.more),f=u.find(this.options.items);f.length||(f=u.filter(this.options.items));this.$container.append(f);this.$container.removeClass(this.options.loadingClass);r.length||(r=u.filter(this.options.more));r.length?(this.$more.replaceWith(r),this.$more=r,this.waypoint=new i(this.options)):this.$more.remove();this.options.onAfterPageLoad(f)},this))},this)};t.prototype.destroy=function(){this.waypoint&&this.waypoint.destroy()};t.defaults={container:"auto",items:".infinite-item",more:".infinite-more-link",offset:"bottom-in-view",loadingClass:"infinite-loading",onBeforePageLoad:n.noop,onAfterPageLoad:n.noop};i.Infinite=t}()