Component.FavoriteActorAddLink=Class.create(Component.Link,{onClick:function(A){if(this.added||!currentUser.isLoggedIn()){return true;
}else{A.stop();
this.actor=this.element.readAttribute("actor");
var B="service=addActor&actorId="+this.actor+"&listId=FAV";
new Ajax.Request("/list.sv",{parameters:B,onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)});
this.element.href="/actor-list/favorites";
this.element.update("Saving...");
}},onSuccess:function(A){this.added=true;
this.element.href="/actor-list/favorites";
this.element.update("Saved - View Favorites");
},onFailure:function(){document.location="/actor-list/add?actorId="+this.actor;
}});
Component.ActorCommentDeleteLink=Class.create(Component.Link,{onClick:function(A){A.stop();
new View.ConfirmationPopup(this.element,{content:"Are you sure you want to delete this comment?",onConfirm:this.onDelete.bindAsEventListener(this)});
},onDelete:function(){new Ajax.Request("/api/v1/actors/"+this.element.readAttribute("actor")+"/comments/"+this.element.readAttribute("comment")+".json",{parameters:{_method:"delete"},method:"post",onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)});
},onSuccess:function(A){new Effect.Shrink(this.element.up("li"),{direction:"top-left",duration:0.5});
},onFailure:function(A){new View.ErrorPopup(this.element,{title:"Unexpected Error",content:"Failed to delete the comment."});
}});
Component.ChangeSkinLink=Class.create(Component.Link,{onClick:function(A){A.stop();
var B={skin:this.element.readAttribute("skin")};
new Ajax.Request("/skins/action/change",{parameters:B,onSuccess:this.onSuccess.bind(this)});
},onSuccess:function(A){new View.SuccessPopup(this.element,{title:"Profile Updated.",content:"Click 'ok' to check out your new profile skin.",onClose:this.onClose.bindAsEventListener(this)});
},onClose:function(A){document.location="/profile";
}});
Component.SkinToggle=Class.create(Component,{initialize:function($super,A){$super(A);
this.toggledOn=this.element.readAttribute("toggledOn")=="true";
this.pageName=this.element.readAttribute("pageName");
this.skinLink=decodeURIComponent(this.element.readAttribute("skinLink"));
this.skinLinkElem=$("skinLink");
this.skinCredit=$("skinCredit");
this.element.observe("click",this.onClick.bindAsEventListener(this));
},onClick:function(A){if(!this.toggledOn){this.skinLinkElem=document.createElement("link");
this.skinLinkElem.type="text/css";
this.skinLinkElem.rel="stylesheet";
this.skinLinkElem.href=this.skinLink;
$$("head")[0].appendChild(this.skinLinkElem);
this.element.update("Unskin");
this.skinCredit.show();
this.toggledOn=true;
Tracker.trackEvent(this.pageName,"skin");
}else{if(this.skinLinkElem){this.skinLinkElem.parentNode.removeChild(this.skinLinkElem);
this.element.update("Skin");
this.skinCredit.hide();
this.toggledOn=false;
Tracker.trackEvent(this.pageName,"unskin");
}}}});
Component.SkinQualifier=Class.create(Component.Link,{onClick:function(A){A.stop();
var B="skinId="+this.element.readAttribute("skinId");
if(this.element.readAttribute("alreadyEnabled")=="true"){B+="&skinAction=disableActorSkin";
}else{B+="&skinAction=enableActorSkin";
}new Ajax.Updater(this.element,"/skin.sv",{parameters:B});
}});




