var Profiles=function(){var f=null;var e=null;function h(l){f=l}function i(l){e=l}function b(l){e=l.id;$("#addRemoveMessage").hide();$("#removeFriendButton").show()}function a(){$("#addFriendButton,#removeFriendButton").hide();$("#addRemoveMessage").text("Adding friend...").show();$.post("/friends",{"friend[friend_user_id]":f,authenticity_token:window.authenticityToken},b,"json");return false}function d(l){e=null;$("#addRemoveMessage").hide();$("#addFriendButton").show()}function j(){if(e==null){return false}$("#addFriendButton,#removeFriendButton").hide();$("#addRemoveMessage").text("Removing this friend...").show();$.post("/friends/"+e,{authenticity_token:window.authenticityToken,_method:"delete"},d,"json");return false}function c(){var o=$(this);var m=HM.extractId(o.parents("li:first").attr("id"));var n="/lists/"+m+"/modes/add_all_to_head";var l=$("<span>adding...</span>");o.replaceWith(l);$.post(n,{authenticity_token:window.authenticityToken,_method:"post"},function(){l.replaceWith("added")},"json");return false}function k(){$("#addFriendButton").click(a);$("#removeFriendButton").click(j);$("a.addAllToHead").click(c)}var g={setFriendUserId:h,setFriendId:i,addAllToHead:c,init:k};return g}();