/* JSCmprsd Hash:1c522c033686bf79c97dba0811328a70 */
var updateSubscription=new Class({Implements:[Options,Events],options:{parentId:"answer-subscription-list",buttonIdPostfix:"-btn",buttonClass:"button-orange",eachItemClass:"subscription-item",formClass:"change-subscribe",loadingClass:"loader-arrows-orange",updateFormName:"subscriptionFrequency",currentSubscriptionsClass:"currentsubscription",unsubscribeClass:"unsubscribelink"},initialize:function(A){this.setOptions(A);this.buttons={};this.forms={};this.items={};this.sending={};this.currentSub={};$$("#"+this.options.parentId+" ."+this.options.eachItemClass).each(function(B,D){var C=B.getElement("form."+this.options.formClass);var E=C.id;this.items[E]=B;this.forms[E]=C;this.sending[E]=false;this.currentSub[E]=C.getElement("."+this.options.currentSubscriptionsClass);this.buttons[E]=C.getElement("."+this.options.buttonClass);this.buttons[E].addEvent("click",function(F){F.stop();this.sendData(E)}.bind(this));C.getElement("."+this.options.unsubscribeClass).addEvent("click",function(G){G.stop();var F=this.forms[E].getElement("input[name=submissionType]").setProperty("value","deleteSubscription");this.sendData(E)}.bind(this))}.bind(this))},sendData:function(B){if(!this.sending[B]){this.sending=true;var A=this.forms[B].getElement("input[name=sentVia]");A.setProperty("value","ajax");this.buttons[B].getParent().addClass(this.options.loadingClass);this.forms[B].set("send",{onComplete:function(C){if(C=="updated"){var G=this.forms[B].getElement("select[name="+this.options.updateFormName+"]").value;var E=this.forms[B].getElement("option[id="+G+"]").get("text");this.currentSub[B].set("text",E).setStyle("color","#00aa11");this.currentSub[B].set("morph",{duration:3000}).morph({color:"#666666"});this.buttons[B].getParent().removeClass(this.options.loadingClass)}if(C=="deleted"){this.buttons[B].getParent().removeClass(this.options.loadingClass);var D=this.forms[B].getParent().getParent().getParent().getParent();if(D.hasClass(this.options.eachItemClass)){var F=new Fx.Slide(D,{duration:1200}).slideOut()}}}.bind(this)});this.forms[B].send()}}});