function GapFavouriteAuctioneerState(n,t,i){this.url=n,this.className=t,this.text=i}function GapFavouriteAuctioneerHandler(n,t){this.addState=n,this.removeState=t}GapFavouriteAuctioneerHandler.prototype.init=function(n){if(!n){this.useLoginBox(this.addState),this.useLoginBox(this.removeState);return}this.setFavouriteAuctioneerHandlers(this.addState),this.setFavouriteAuctioneerHandlers(this.removeState)},GapFavouriteAuctioneerHandler.prototype.toggleFavouriteAuctioneer=function(n){var t=this;$.each($('[data-gfa-id="'+n+'"]'),function(n,i){var r=$(i);r.unbind("click");var f=r.hasClass(t.addState.className),e=f?t.addState:t.removeState,u=f?t.removeState:t.addState;r.removeClass(e.className),r.addClass(u.className),r.children("span").text(u.text),t.createFavouriteHandler(r,u.url)})},GapFavouriteAuctioneerHandler.prototype.sendGTMEvent=function(n){var t=$(n),i=t.hasClass(this.addState.className);window.dataLayer&&window.dataLayer.push({event:i?"UnfollowedAuctioneer":"FollowedAuctioneer",auctioneerName:$(n).data("gfa-name"),auctioneerId:$(n).data("gfa-id"),catalogueId:$(n).data("gfa-auction-id"),catalogueName:$(n).data("gfa-auction-name")})},GapFavouriteAuctioneerHandler.prototype.createFavouriteHandler=function(n,t){var i=this;$(n).click(function(){var u=$(n).data("gfa-id");return Gap.Common.Ajax.Post(t,{auctioneerId:u},{success:function(){return i.toggleFavouriteAuctioneer(u),i.sendGTMEvent(n),!1}}),!1})},GapFavouriteAuctioneerHandler.prototype.setFavouriteAuctioneerHandlers=function(n){var t=this;$.each($("."+n.className),function(i,r){t.createFavouriteHandler(r,n.url)})},GapFavouriteAuctioneerHandler.prototype.useLoginBox=function(n){$("."+n.className).click(function(){var n=$(this).data("gfa-id");return window.showLoginBoxAuctioneerId(n),!1})}