if(typeof(Meetup.UI)=="undefined"){Meetup.UI={}}Meetup.DomDeco.InterestWidget=function(){bindMethods(this)};Meetup.DomDeco.InterestWidget.prototype={decorate:function(el){if(!el){return false}this.interestEl=el;this.topicId=el.id.split("_")[1];this.addInterestEl=getFirstElementByTagAndClassName("A","addInterestButton",this.interestEl);this.removeInterestEl=A({href:"JAVASCRIPT:void(0)","class":"removeInterestButton"},Meetup.Copy.undo);this.successFrameEl=DIV({"class":"successFrame"},DIV({"class":"successFrameBody"},DIV({"class":"successFrameMsg"},IMG({src:"http://img1.meetupstatic.com/img/575886983968160155/thirdparty/fff/silk/tick.png","class":"D_icon"})," "+Meetup.Copy.okYouSignedUp+" ",SPAN({"class":"D_less"},"(",this.removeInterestEl,")"))));appendChildNodes(this.interestEl,this.successFrameEl);connect(this.addInterestEl,"onclick",this.addInterest);connect(this.removeInterestEl,"onclick",this.removeInterest)},addInterest:function(e){e.stop();var d=doSimpleXMLHttpRequest("/api/",{method:"addAlertTopic",arg_topicId:this.topicId,arg_memberId:memberId,arg_source:"SEARCH"});var succeed=function(req){this.setState("added")};var fail=function(req){Log.error("interestwidget: fail topic add")};d.addCallbacks(bind(succeed,this),bind(fail,this))},removeInterest:function(e){e.stop();var d=doSimpleXMLHttpRequest("/api/",{method:"removeAlertTopic",arg_topicId:this.topicId,arg_memberId:memberId});var succeed=function(req){this.setState("removed")};var fail=function(req){Log.error("interestwidget: fail topic removal")};d.addCallbacks(bind(succeed,this),bind(fail,this))},setState:function(state){if(state==this.state){return false}this.state=state;if(state=="added"){var dim=getElementDimensions(this.interestEl);setStyle(this.successFrameEl,{display:"block",top:dim.h+"px"});setStyle(this.successFrameEl.firstChild,{height:dim.h+"px",width:dim.w+"px"});opt={top:0,time:0.5,transition:"easeOutElastic"};var thisTween=Meetup.Tweener.addTween(this.successFrameEl,opt)}else{if(state=="removed"){var dim=getElementDimensions(this.interestEl);opt={top:dim.h,time:0.25,transition:"easeInCubic"};var thisTween=Meetup.Tweener.addTween(this.successFrameEl,opt)}}},interestEl:null,addInterestEl:null,removeInterestEl:null,successFrameEl:null,topicId:null,state:null};Meetup.DomDeco.FakeInterestWidget=function(){bindMethods(this)};Meetup.DomDeco.FakeInterestWidget.prototype={decorate:function(el){this.interestEl=el;this.addInterestEl=getFirstElementByTagAndClassName("A","addInterestButton",this.interestEl);var msg=SPAN();msg.innerHTML=" "+Meetup.Copy.holdOnJustASec;this.successFrameEl=DIV({"class":"successFrame"},DIV({"class":"successFrameBody"},DIV({"class":"successFrameMsg"},IMG({src:"http://img1.meetupstatic.com/img/6273355246387699870/thirdparty/fff/silk/hourglass.png","class":"D_icon"}),msg)));appendChildNodes(this.interestEl,this.successFrameEl);connect(this.addInterestEl,"onclick",this.addInterest)},addInterest:function(e){e.stop();var thisHref=e.src().href;var dim=getElementDimensions(this.interestEl);setStyle(this.successFrameEl,{display:"block",top:dim.h+"px"});setStyle(this.successFrameEl.firstChild,{height:dim.h+"px",width:dim.w+"px"});opt={top:0,time:0.5,transition:"easeOutElastic",onComplete:function(){window.location=thisHref}};var thisTween=Meetup.Tweener.addTween(this.successFrameEl,opt)},interestEl:null,addInterestEl:null,removeInterestEl:null,successFrameEl:null};
