Component.UserCommentDeleteLink=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),onCancel:this.onCancel.bindAsEventListener(this)});
},onCancel:function(){},onDelete:function(){new Ajax.Request("/api/v1/users/"+this.element.readAttribute("user")+"/comments/"+this.element.readAttribute("comment")+".json",{parameters:{_method:"delete"},method:"post",onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)});
Tracker.tag("RemoveProfileComment");
},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.FriendSelect=Class.create(Component.Select,{onChange:function(A){if($F(this.element)!=""){document.location=$F(this.element);
}}});
Component.NominateSuperReviewerLink=Class.create(Component.Link,{onClick:function(A){A.stop();
var B="userId=${user.id}&eliteRole=REV";
new Ajax.Request("/elites/action/nominate",{parameters:B,onSuccess:this.onSuccess.bind(this)});
},onSuccess:function(A){window.location.reload(true);
}});
Component.BlockUserLink=Class.create(Component.Link,{onClick:function(A){A.stop();
new View.ConfirmationPopup(this.element,{content:"Are you sure you want to block this member?",onConfirm:this.onBlock.bindAsEventListener(this)});
},onBlock:function(){this.blocked=this.element.readAttribute("blocked");
this.blocker=this.element.readAttribute("blocker");
var A={_format:"json",_method:"post"};
new Ajax.Request("/api/v1/users/"+this.blocked+"/blocks",{parameters:A,method:"post",onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)});
this.element.update("...");
},onSuccess:function(A){this.element.replace("Blocked.");
},onFailure:function(A){this.element.update("Oops, please try again later.");
}});
Component.UnblockUserLink=Class.create(Component.Link,{onClick:function(A){A.stop();
new View.ConfirmationPopup(this.element,{content:"Are you sure you want to unblock this member?",onConfirm:this.onBlock.bindAsEventListener(this)});
},onBlock:function(){this.blocked=this.element.readAttribute("blocked");
this.blocker=this.element.readAttribute("blocker");
var A={_format:"json",_method:"delete"};
new Ajax.Request("/api/v1/users/"+this.blocked+"/blocks/"+this.blocker,{parameters:A,method:"post",onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)});
this.element.update("...");
},onSuccess:function(A){this.element.replace("Unblocked.");
},onFailure:function(A){this.element.update("Oops, please try again later.");
}});
Component.RemoveBuddyLink=Class.create(Component.Link,{onClick:function(A){A.stop();
new View.ConfirmationPopup(this.element,{content:"Are you sure you want to remove this friend?",onConfirm:this.onDelete.bindAsEventListener(this)});
},onDelete:function(){var B=this.element.readAttribute("me");
var A=this.element.readAttribute("friend");
var C={_method:"delete",_format:"json"};
new Ajax.Request("/api/v1/users/"+B+"/friends/"+A,{parameters:C,onSuccess:this.onSuccess.bind(this),onFailure:this.onFailure.bind(this)});
},onSuccess:function(A){this.element.replace("Removed.");
},onFailure:function(A){this.element.replace("Oops, please try again later.");
}});
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.FlashWidget=Class.create(Component.FlashMovieMeeboBarDecoupler);




Component.PeopleSearchForm=Class.create(Component.Form,{onSubmit:function(A){if($("byName").checked){if($F("lastName").length<2){alert("Last name must be at least 2 characters.");
A.stop();
return false;
}if($F("lastName")=="Last Name"){alert("Please provide a valid last name.");
A.stop();
return false;
}$("loginName").value="";
}else{if($("byLogin").checked){if($F("loginName").length<3){alert("Username/email must be at least 3 characters.");
A.stop();
return false;
}$("firstName").value="";
$("lastName").value="";
}}$("submitBtn").disable();
$("submitBtn").value="Please Wait...";
return true;
}});
Component.EmailTextField=Class.create(Component.TextField,{onFocus:function($super,A){$super(A);
$("byLogin").checked="on";
}});
Component.NameTextField=Class.create(Component.TextField,{onFocus:function($super,A){$super(A);
$("byName").checked="on";
},onBlur:function(A){}});
Component.InviteLink=Class.create(Component.Link,{onClick:function(A){A.stop();
var B={inviteSource:this.element.readAttribute("source"),inviteeEmail:this.element.readAttribute("invitee")};
new Ajax.Request("/invite/action/manual/send",{parameters:B,onSuccess:this.onSuccess.bind(this)});
Tracker.tag("AjaxFindUserInvitation");
},onSuccess:function(A){$("inviteLink").hide();
$("inviteSentMessage").show();
}});




