firefish.Web.WebControls.ffDropDownList=function(n){ffControlSystem.baseConstructor(this,firefish.Web.WebControls.ffDropDownList,[n])};firefish.Web.WebControls.ffDropDownList.showLoading=function(n,t){n.prop("disabled",!0);n.find("option").remove().end().append('<option value="'+t+'">loading...<\/option>').val(t)};firefish.Web.WebControls.ffDropDownList.populateDropDownWithOptions=function(n,t,i,r,u,f,e,o){if(n){i||(i="");u||(u="");firefish.Web.WebControls.ffDropDownList.showLoading(n,r);var s="{'parentListName':'"+t+"', 'parentListSelectedItem':'"+i+"', 'parentListArgs':'"+u+"'}",h=ffControlSystem.getFunctionDelegate(this,function(t){firefish.Web.WebControls.ffDropDownList._onSuccess(t,n,r,f,e)}),c=ffControlSystem.getFunctionDelegate(this,function(t){firefish.Web.WebControls.ffDropDownList._onError(t,n,f,r,o)});ffControlSystem.callWebService("/ffControlUtilities.ashx/datalist",s,h,c)}};firefish.Web.WebControls.ffDropDownList._onSuccess=function(n,t,i,r,u){var f=null;try{f=ffParseJson(n)}catch(e){}f==null&&(f=n);firefish.Web.WebControls.ffDropDownList._convertJsonToOptions(f,t,i,r);u&&u.apply(this,[f,t])};firefish.Web.WebControls.ffDropDownList._onError=function(n,t,i,r,u){t.find("option").remove().end().append('<option value="'+i+'">Error populating dropdown<\/option>').val(i).attr("title","There was an error populating this dropdown. Please try again.");u&&u.apply(this,[n,t])};firefish.Web.WebControls.ffDropDownList._convertJsonToOptions=function(n,t,i,r){var o="",s=!1,e,u,f;for(r&&(o+='<option value="'+i+'">'+r+"<\/option>"),u=0;u<n.length;u++)o+=n[u].DisplayName?'<option value="'+n[u].ID+'">'+n[u].DisplayName+"<\/option>":'<option value="'+n[u].ID+'">'+n[u].Text+"<\/option>",s=!0;if(t.find("option").remove().end().append(o).prop("disabled",!1).val(i),s){if(t.prop("disabled",!1),t.length&&(e=t[0].Validators,e&&e.length))for(u=0;u<e.length;++u)f=e[u],f&&f.ddDisabled&&(f.ddDisabled=!1,f.enabled=!0)}else if(t.prop("disabled",!0),t.length&&(e=t[0].Validators,e&&e.length))for(u=0;u<e.length;++u)f=e[u],f&&(f.isvalid=!0,f.ddDisabled=!0,f.enabled=!1,ValidatorUpdateDisplay(f))};firefish.Web.WebControls.ffDropDownList.prototype={initialise:function(){var t,n,i,r;ffControlSystem.callBase(this,firefish.Web.WebControls.ffDropDownList,"initialise");this.childDropdown=ff$("#"+ff$.escape(this.childDropdownID));this.changeHndlr=ffControlSystem.getFunctionDelegate(this,this._onChange);this.docEle=ff$(document);this.emptyValue="-1";this.isGuid&&(this.emptyValue="00000000-0000-0000-0000-000000000000");t=this.emptyValue;this.asyncArgs||(this.asyncArgs="");n=this.Element.val();i=[];n!=t&&this.childDropdown&&this.childDropdown.length&&(this.childDropdown.find("option").map(function(n,r){var u=ff$(r).val();u!=t&&i.push({ID:ff$(r).val(),DisplayName:ff$(r).text()})}),r=n,this.parentListName&&(r=this.parentListName+"_"+n),this.docEle.data("'ddl"+r+"'",i));ffControlSystem.attachEvent(this.Element,"change",this.changeHndlr)},dispose:function(){ffControlSystem.detachEvent(this.Element,"change",this.changeHndlr)},_onChange:function(){var n,t,i,r,u;if(this.useAsync)if(n=this.Element.val(),n==this.emptyValue)this.childDropdown.find("option").remove().end().append('<option value="'+this.emptyValue+'">'+this.childBlankItemText+"<\/option>").val(this.emptyValue);else{if(t=n,this.parentListName&&(t=this.parentListName+"_"+n),this.docEle.data("'ddl"+t+"'")){i=null;this.childHasBlankItem&&(i=this.childBlankItemText);firefish.Web.WebControls.ffDropDownList._convertJsonToOptions(this.docEle.data("'ddl"+t+"'"),this.childDropdown,this.emptyValue,i);return}r=ffControlSystem.getFunctionDelegate(this,this.onSuccess);u=ffControlSystem.getFunctionDelegate(this,this.onError);firefish.Web.WebControls.ffDropDownList.populateDropDownWithOptions(this.childDropdown,this.parentListName,n,this.emptyValue,this.asyncArgs,this.childBlankItemText,r,u)}else firefish.Web.WebControls.ffDropDownList.showLoading(this.childDropdown,this.dropDown)},onSuccess:function(n){var t=this.Element.val();this.parentListName&&(t=this.parentListName+"_"+t);this.docEle.data("'ddl"+t+"'",n)},onError:function(){}};ffControlSystem.deriveClass(firefish.Web.WebControls.ffDropDownList,firefish.Web.WebControls.WebControl);
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()},onKeyPress:function(){this.displayRemainingCharacters()},onKeyUp:function(){this.displayRemainingCharacters()},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."}}};ffControlSystem.deriveClass(firefish.Web.WebControls.ffTextBox,firefish.Web.WebControls.WebControl);
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.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 c,o,l,s,h,f,v,e;if(r<4)if(c=n.outerHeight(),o=n.outerWidth(),o==0)l=this,window.setTimeout(function(){l._setBasePosition(n,t,i,++r)},200);else{s=(i-o)/2;h=(t-c)/2;h<0&&(h=0);s<0&&(s=0);n.css("left",s);n.css("top",h);var u=n.find(".mdl-body:first"),y=n.find(".mdl-hdr:first").outerHeight(),a=Math.max(this.Element.height());this.UseOversizeAutoScrolling&&(f=t-y-40,u.css("max-height",f),t<a||this.isPinned&&.84*t<a?(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"}),v=!!navigator.userAgent.match(/Trident/g)||!!navigator.userAgent.match(/MSIE/g),v&&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))}},_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.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);
