/* AUTOMATED FILE. DO NOT EDIT. */
function DropDown2(){this.dropDown=function(){$(document).on("mouseover",".company-leader .user-connect",function(){var o=$(this),n=o.attr("rel"),e={confirmation:{remove:'<li class="remove user-option confirmation" style="">Reject Connection</a>'},pending:{remove:'<li class="remove user-option pending" id="'+n+'" style="">Cancel Request</a>'},connected:{remove:'<li class="remove user-option connected" id="'+n+'" style="">Remove Connection</a>'}},s=1;o.hasClass("confirm")?option_html=e.confirmation.remove:o.hasClass("pending")?option_html=e.pending.remove:o.hasClass("following")?option_html=e.connected.remove:(s=0,option_html=null),$(document).on("click","#"+n,function(){var n=o.attr("rel");$(this);return"1"==s&&(!$(this).hasClass("remove")&&$(this).hasClass("confirm")?$.ajax({url:"/user/toggleUserConnection",type:"post",data:{confirm_id:n},success:function(n){o.html("Connected "),o.removeClass("pending confirm"),o.addClass("following")}}):$(this).hasClass("remove")?$.ajax({url:"/user/unfollowFollowee",type:"post",data:{remove_id:n},success:function(n){o.html("Add Connection <span>+</span>"),o.removeClass("following pending confirm"),o.unbind("mouseover")}}):$(this).hasClass("confirmation")&&$.ajax({url:"/user/toggleUserConnection",type:"post",data:{to_user_id:n},success:function(n){return"2"==n?(window.location="/user/signup",!1):(o.html("Connected"),void o.addClass("following"))}})),!1}),1==s&&($(this).siblings(".user-options").html(option_html),$(this).siblings(".user-options").fadeTo(100,1),$(this).siblings(".user-option").fadeTo(100,1))}),this.fadeOut},this.fadeOut=function(){$(document).on("mouseleave",".user-options",function(){$(".user-options").stop().fadeTo(100,0,function(){$(".user-options").hide()})})}}$(document).ready(function(){var o=new DropDown2;o.dropDown(),o.fadeOut(),$(document).on("click",".user-connect",function(){var n=$(this),e=0;(n.hasClass("pending")||n.hasClass("following")||n.hasClass("confirm"))&&(e=1);var s=$(n).attr("rel");return 0===e?$.ajax({url:"/user/toggleUserConnection",type:"post",data:{to_user_id:s},success:function(e){return"2"==e?(window.location="/user/signup",!1):(n.html("Pending"),n.addClass("pending"),o.dropDown(),o.fadeOut(),void 0)}}):1===e&&$.ajax({url:"/user/toggleUserConnection",type:"post",data:{to_user_id:s},success:function(e){return"2"==e?(window.location="/user/signup",!1):void(0!=e&&(n.html("Connected"),n.removeClass("confirm"),n.addClass("following"),o.dropDown(),o.fadeOut()))}}),!1})});