firefish.Web.WebControls.ffTextBox=function(n){ffControlSystem.baseConstructor(this,firefish.Web.WebControls.ffTextBox,[n])};firefish.Web.WebControls.ffTextBox.prototype={initialise:function(){var i,r,u,n,t;ffControlSystem.callBase(this,firefish.Web.WebControls.ffTextBox,"initialise");this.txtTextBox=this.Element;this.txtTextBox&&(this.txtTextBox.prop("placeholder")&&(i=new Date,ffControlSystem.attachEvent(this.txtTextBox,"focus",function(){var n=new Date,t;n.getTime()-i.getTime()>500&&(i=n,t=this,setTimeout(function(){t.focus()},10))})),r=ffControlSystem.getFunctionDelegate(this,this.onKeyUp),ffControlSystem.attachEvent(this.txtTextBox,"keyup",r),u=ffControlSystem.getFunctionDelegate(this,this.onKeyPress),ffControlSystem.attachEvent(this.txtTextBox,"keypress",u));n=null;n=this.isRequired?ff$(this.txtTextBox).siblings(".characterCountRequired"):ff$(this.txtTextBox).siblings(".characterCount");n&&(n.length==0&&this.txtTextBox?(t=this.txtTextBox.parent(),t&&t.length&&this.showCharacterCount&&(this.lblMaxLength=document.createElement("div"),this.lblMaxLength.className=this.isRequired?"characterCountRequired":"characterCount",t.append(this.lblMaxLength))):this.showCharacterCount||n.hide());this.displayRemainingCharacters();this.enforceInputCapitalisation()},onKeyPress:function(){this.displayRemainingCharacters();this.enforceInputCapitalisation()},onKeyUp:function(){this.displayRemainingCharacters();this.enforceInputCapitalisation()},getChildElement:function(n){var i=null,t=this.get_element(),r;return t&&(r=t.id+"_"+n,i=$get(r,t)),i},displayRemainingCharacters:function(){if(this.lblMaxLength&&this.showCharacterCount&&this.txtTextBox){var n=this.maxLength-this.txtTextBox.val().length;n<0&&(n=0);this.lblMaxLength.innerHTML=n==0?"No characters remaining.":n==1?n+" character remaining.":n+" characters remaining."}},enforceInputCapitalisation:function(){if(this.enforceCapitalisation&&this.txtTextBox){var n=this.txtTextBox.val();n=n.toUpperCase();this.txtTextBox.val(n)}}};ffControlSystem.deriveClass(firefish.Web.WebControls.ffTextBox,firefish.Web.WebControls.WebControl);
firefish.Web.WebControls.ffModalPanel=function(n){ffControlSystem.baseConstructor(this,firefish.Web.WebControls.ffModalPanel,[n])};firefish.Web.WebControls.ffModalPanel.prototype={initialise:function(){ffControlSystem.callBase(this,firefish.Web.WebControls.ffModalPanel,"initialise");this.scrolled=!1;this.baseElement=this.Element;this.background=ff$("#"+this.baseElement.attr("id")+"MdlBckgrnd");this.background.length==0&&(this.windowResizeHandler=ffControlSystem.getFunctionDelegate(this,this.onResize),ffControlSystem.attachEvent(ff$(window),"resize",this.windowResizeHandler),this.windowScrollHandler=ffControlSystem.getFunctionDelegate(this,this.onScroll),ffControlSystem.attachEvent(ff$(window),"scroll",this.windowScrollHandler),this.panelBodyScrollFunction&&(this.panelBodyScrollHdlr=this.getPanelScrollHdlr(),ffControlSystem.attachEvent(ff$(".modalPanel .mdl-body"),"scroll",this.panelBodyScrollHdlr)));this.mdlHideHdlr=ffControlSystem.getFunctionDelegate(this,function(){this.showModalPanel(!1)});this.escHdlr=ffControlSystem.getFunctionDelegate(this,this._escClose);this.allowEscClose&&(ff$.browser.msie&&parseInt(ff$.browser.version)<9&&ffControlSystem.attachEvent(ff$(document.body),"keyup",this.escHdlr),ffControlSystem.attachEvent(ff$(window),"keyup",this.escHdlr));this.domChangedHandler=ffControlSystem.getFunctionDelegate(this,this.doLayout);ffControlSystem.events.domChanged.subscribe(this.domChangedHandler);this.Element.children.length?(this.CloseBtn=this.Element.children().first().find("span.mdl-hdr-btn"),""!=this.titleText&&this.Element.children().first().find("span.mdl-hdr-txt").text(this.titleText)):this.CloseBtn=this.Element.find("span.mdl-hdr-btn");this.CloseBtn.length>0&&ffControlSystem.attachEvent(this.CloseBtn,"click",this.mdlHideHdlr);this.initialiseControls();this.hfShowPanel=this.getChildElement("hfShowPanel");this.hfArgs=this.getChildElement("hfArgs");this.doLayout()},dispose:function(){this.background.remove();ffControlSystem.detachEvent(ff$(window),"scroll",this.windowScrollHandler);ffControlSystem.detachEvent(ff$(window),"resize",this.windowResizeHandler);this.domChangedHandler&&ffControlSystem.events.domChanged.unsubscribe(this.domChangedHandler);this.background=this.windowResizeHandler=this.windowScrollHandler=null;ff$(document.body).css({"margin-right":0,overflow:"visible"})},initialiseControls:function(){var n;this.background.length==0&&(this.background=ff$("<div class='modalBackground' id='"+this.baseElement.attr("id")+"MdlBckgrnd' />").hide().insertAfter(this.Element.parent()));this.modalLevel>1&&(this.background.css("zIndex",parseInt(this.background.css("zIndex")*this.modalLevel)),n=this.baseElement.parent(),n.css("zIndex",parseInt(n.css("zIndex")*this.modalLevel)));this.customZIndex&&this.customZIndex>0&&(this.background.css("zIndex",this.customZIndex-1),n=this.baseElement.parent(),n.css("zIndex",this.customZIndex));this.baseElement.parent().hide()},_escClose:function(n){this.showPanel&&n.which==27&&this.showModalPanel(!1)},onResize:function(){this.doLayout()},onScroll:function(){this.scrolled||(this.scrolled=!0,this.doLayout(),setTimeout(function(){this.scrolled=!1},500))},getPanelScrollHdlr:function(){if(this.panelBodyScrollFunction)return eval("ffControlSystem.getFunctionDelegate(this, "+this.panelBodyScrollFunction+");")},recalculateSize:function(){this.baseElement.parent().height(this.baseElement.parent().find("> *").outerHeight());this.doLayout()},_setBasePosition:function(n,t,i,r){var o,c,f,a,e;if(r<4)if(o=n.outerWidth(),o==0)c=this,window.setTimeout(function(){c._setBasePosition(n,t,i,++r)},200);else{var u=n.find(".mdl-body:first"),v=n.find(".mdl-hdr:first").outerHeight(),l=Math.max(this.Element.height());this.UseOversizeAutoScrolling&&(f=t-v-40,u.css("max-height",f),t<l||this.isPinned&&.84*t<l?(this.isPinned&&(f-=.16*t),f<60&&(f=60),u.get(0).scrollHeight<=t?u.height("").css("overflow","auto").css("overflowX",""):u.height(f).css("overflow","auto").css("overflowX","hidden")):(u.height("").css({overflow:"auto","overflow-x":"hidden"}),a=!!navigator.userAgent.match(/Trident/g)||!!navigator.userAgent.match(/MSIE/g),a&&u.css("padding-right","25px")),i<o&&!this.isPinned?(n.css("right","0px"),u.css("overflowX","auto")):n.css("right",""));ff$.browser.msie&&parseInt(ff$.browser.version)<=7&&(e=n.find("div.mdl-hdr"),e.length>0&&!e.data("widthset")&&e.width(e.parent().width()-6).data("widthset",!0));var y=n.outerHeight(),o=n.outerWidth(),s=(i-o)/2,h=(t-y)/2;h<0&&(h=0);s<0&&(s=0);n.css("left",s);n.css("top",h)}},_getChildrenHeight:function(n){var t=0;return ff$(n).children().each(function(){t+=ff$(this).outerHeight()}),t},doLayout:function(){if(this.showPanel){var t=ff$(window).height(),n=ff$(window).width();this.baseElement.parent().css("top","-1000px");this.baseElement.parent().css("left","-1000px");this.baseElement.parent().css("right","");this.baseElement.parent().show();this._setBasePosition(this.baseElement.parent(),t,n,0);this.hfShowPanel&&this.hfShowPanel.val(!0);window.innerWidth-n&&ff$(document.body).css({"margin-right":window.innerWidth-n});ff$(document.body).css({"margin-right":0,overflow:"hidden"});this.background.show()}else this.baseElement.parent().hide(),this.background||(this.background=ff$("#"+this.baseElement.attr("id")+"MdlBckgrnd")),this.background.hide()},showModalPanel:function(n){this.showPanel=n;this.hfShowPanel&&this.hfShowPanel.val(n);ff$(document.body).css({"margin-right":0,overflow:"visible"});this.doLayout();n||this.Element.trigger("modalClosed");!n&&this.postbackOnClose&&__doPostBack()},setArgs:function(n){this.hfArgs&&this.hfArgs.val(n)}};ffControlSystem.deriveClass(firefish.Web.WebControls.ffModalPanel,firefish.Web.WebControls.WebControl);firefish.Web.WebControls.ffModalPanel.show=function(n,t){var i=ffControlSystem.getControl(n);i&&(i.showModalPanel(!0),t&&i.setArgs(t))};firefish.Web.WebControls.ffModalPanel.hide=function(n){var t=ffControlSystem.getControl(n);t&&t.showModalPanel(!1)};
firefish.Web.WebControls.ffHyperLink=function(n){ffControlSystem.baseConstructor(this,firefish.Web.WebControls.ffHyperLink,[n])};firefish.Web.WebControls.ffHyperLink.prototype={initialise:function(){ffControlSystem.callBase(this,firefish.Web.WebControls.ffHyperLink,"initialise");this.copyIcon=this.Element.siblings(".ff-copyURL__icon");this.copyURLEvnt=ffControlSystem.getFunctionDelegate(this.copyIcon,this._copyURLToClipboard);ffControlSystem.attachEvent(this.copyIcon,"click",this.copyURLEvnt)},dispose:function(){ffControlSystem.detachEvent(this.copyIcon,"click",this.copyURLEvnt)},_copyURLToClipboard:function(){var n=this,t=ff$("<input>");ff$("body").append(t);t.val(n.siblings("a")[0].href).select();document.execCommand("copy");t.remove();n.siblings(".ff-copyURL__notification").toggleClass("ff-copyURL__notification--active");setTimeout(function(){n.siblings(".ff-copyURL__notification").toggleClass("ff-copyURL__notification--active")},1e3)}};ffControlSystem.deriveClass(firefish.Web.WebControls.ffHyperLink,firefish.Web.WebControls.WebControl);
firefish.Web.WebControls.ffEMailTextBox=function(n){ffControlSystem.baseConstructor(this,firefish.Web.WebControls.ffEMailTextBox,[n])};firefish.Web.WebControls.ffEMailTextBox.prototype={initialise:function(){if(ffControlSystem.callBase(this,firefish.Web.WebControls.ffEMailTextBox,"initialise"),this.fiTick=ff$("[id$='fiTickWrapper']"),this.fiError=ff$("[id$='fiErrorWrapper']"),this.saveButtonID!=null&&(this.btnSave=ff$("[id='"+this.saveButtonID+"']"),this.btnSave.prop("disabled",!0)),this.txtEmailTextBox=this.Element,this.txtEmailTextBox){var n=ffControlSystem.getFunctionDelegate(this,this.onBlur);ffControlSystem.attachEvent(this.txtEmailTextBox,"blur",n)}},dispose:function(){},onBlur:function(){this.validateEmail()},_onSuccess:function(n){(n&&(n=ffParseJson(n)),n)&&(n.userExists?this.txtEmailTextBox.attr("isinvalid",!0):this.txtEmailTextBox.attr("isinvalid",!1),firefish.Utilities.Validation.Revalidate(this.Element),firefish.Utilities.Validation.IsControlValid(this.Element)?this.showTick():this.showError())},_onFail:function(){this.handleSaveButton(!1)},showError:function(){this.fiTick.removeClass("show");this.fiTick.addClass("hide");this.fiError.removeClass("hide");this.fiError.addClass("show");this.handleSaveButton(!1)},showTick:function(){this.fiTick.removeClass("hide");this.fiTick.addClass("show");this.fiError.removeClass("show");this.fiError.addClass("hide");this.handleSaveButton(!0)},validateEmail:function(){var i=ffControlSystem.getFunctionDelegate(this,this._onSuccess),r=ffControlSystem.getFunctionDelegate(this,this._onFail),n={UserName:this.Element.val()},t;this.verifyAccount&&(!this.initialEmailAddress||this.initialEmailAddress!=n.UserName)?ffControlSystem.callWebService("/_firefish/Handlers/accountverification.ashx",JSON.stringify(n),i,r):(this.fiTick.removeClass("show"),this.fiTick.addClass("hide"),this.fiError.removeClass("show"),this.fiError.addClass("hide"),firefish.Utilities.Validation.Revalidate(this.Element),t=firefish.Utilities.Validation.IsControlValid(this.Element),this.handleSaveButton(t))},handleSaveButton:function(n){this.btnSave!=null&&this.btnSave.prop("disabled",!n)}};ffControlSystem.deriveClass(firefish.Web.WebControls.ffEMailTextBox,firefish.Web.WebControls.ffTextBox);firefish.Web.WebControls.ffEMailTextBox.Validate=function(n,t){var u=ff$(n),i=ffControlSystem.getControl(u.prop("controltovalidate")),r;i&&i.Element&&(r=!0,i.Element.attr("isinvalid")=="true"&&(r=!1),t.IsValid=r)};
jQuery.noConflict(!0);
