
$(document).ready(function(){var WireComment=function(obj){var cid=obj.id;$(".UpVote",obj).hoverClass("UpVoteHover").attr('title','Click to vote for this comment.').click(function(e){if($.SIL.PleaseLogin(e,"to vote.")){$.getJSON($.SIL.Authority+"/js/sil.ashx/VoteComment?callback=?",{id:cid},function(data,textStatus){if(data.d.Success){$("#"+cid+" .UpVote").addClass("UpVoteOn").unbind('click').attr('title','You have voted for this comment.');$("#"+cid+" .UpVotes").addClass("UpVotesUpdated").text(data.d.NewScore);}
else{$.NotifyError(e,data.d.Error);}});}});$(".Flag",obj).hoverClass("FlagHover").attr('title','Click to flag this comment as offensive or spam.').click(function(e){if($.SIL.PleaseLogin(e,"to report comments.")){if(confirm('Are you sure you want to flag this comment as offensive/spam?')){$.getJSON($.SIL.Authority+"/js/sil.ashx/ReportComment?callback=?",{id:cid},function(data,textStatus){if(data.d.Success===true){$("#"+cid+" .Flag").addClass("FlagOn").unbind('click').attr('title','You have flagged this comment.');}
else{$.NotifyError(e,data.d.Error);}});}}});};$(".SILComments .SILComment").each(function(){WireComment(this);});$(".SILAddComment").each(function(){var c=this;$(".Controls :button.Button",c).attr('title','Click to submit your comment.').click(function(e){if($.SIL.PleaseLogin(e,"to comment.")){var val=$(".CommentText",c).val();if(val.length>300){$.NotifyError(e,"Comments must be less than 300 characters.");}
else if(val.length<=0){$.NotifyError(e,"You must enter comment text.");}
else{var cid=$(".Client",c).val();var nid=$(".Nominee",c).val();if(nid==''){nid='null'}
$.getJSON($.SIL.Authority+"/js/sil.ashx/AddComment?callback=?",{cid:cid,nid:nid,text:val},function(data,textStatus){if(data.d.Success){$(".SILComments .Comments").prepend(data.d.CommentHtml);$(".Controls",c).hide().empty();$(".Success",c).show();$(".SILComments .NoComments").empty();$(data.d.Selector).each(function(){WireComment(this);}).show('highlight',{},1000);}
else{$.NotifyError(e,data.d.Error);}});}}});});});