function formatList(){$("#UpdatesListDiv ul li.firstItem").removeClass("firstItem");$("#UpdatesListDiv ul li:first").addClass("firstItem")}
function showLoadingOverWholeWidget(){var a=$("#StoreAndNewsUpdatesContainer").outerHeight(),b=$("#StoreAndNewsUpdatesContainer").outerWidth(),c=$('<div class="updateLockedDivLarge">&nbsp;</div>');c.css("height",a+"px");c.css("width",b+"px");var d=$('<div class="updateLockedContentLargeDiv">Please Wait...</div>');d.css("height",a+"px");d.css("width",b+"px");c.insertBefore("#StoreAndNewsUpdatesContainer");d.insertBefore(c)}
function deleteIconClick(){var a=$(this).parents("li");if(!confirm("Are you sure you want to delete this comment?"))return!1;var b=$("[id$=postid]",a).val();$.ajax({type:"POST",contentType:"application/json; charset=utf-8",cache:!1,url:"/ws/nwws.asmx/DeleteStoreUserUpdate",data:JSON.stringify({id:b}),success:function(){a.remove();formatList()},error:function(){alert("Sorry, but an error occured while deleting this comment.")}});return!1}
function FormatLikes(){$(".thumbsUpCount").each(function(){var a=parseInt($(this).html(),10),b=$(this).parents("li"),c=$(".thumbsUpLink",b).data("thumbsup"),d=$(".thumbIcon",b);c?d.attr("src","/static/img/1320174474_thumb_up.png"):d.attr("src","/static/img/1320174474_thumb_up-bw.png");a>0?$(".thumbsUpCount",b).show():$(".thumbsUpCount",b).hide()})}
function ThumbsUpClicked(){var a=$(this),b=a.data("thumbsup"),c=a.parents("li"),a=$("[id$=postid]",c).val();$.ajax({type:"POST",contentType:"application/json; charset=utf-8",cache:!1,url:"/ws/nwws.asmx/UpdateLikes",data:JSON.stringify({id:a,liked:!b}),success:function(a){a=parseInt(jsonFix(a),10);$(".thumbsUpCount",c).html(a);$(".thumbsUpLink",c).data("thumbsup",!b);FormatLikes()},error:function(){alert("Sorry, but an error occured while thumbs up'ing comment.")}});return!1}
function HideShowDeleted(){var a=$("#ShowDeletedUpdatesCheckbox");a.length!==0&&(a[0].checked?initialStoreAndUserUpdatesLoad?$("#UpdatesListDiv ul li.deleted").show():$("#UpdatesListDiv ul li.deleted").slideDown("slow"):initialStoreAndUserUpdatesLoad?$("#UpdatesListDiv ul li.deleted").hide():$("#UpdatesListDiv ul li.deleted").slideUp("slow"))}
function loadLatestUpdatesComments(){debug.info("loadLatestUpdatesComments");formatList();$("[id$=NewUpdateTextBox]").bind("keydown",function(a){(a.keyCode?a.keyCode:a.which)==13&&eval($(".PostNewsLink").attr("href"))});FormatLikes();$(".thumbsUpLink").click(ThumbsUpClicked);$("#ShowDeletedUpdatesCheckbox").click(HideShowDeleted);HideShowDeleted();$("#UpdatesListDiv abbr.timeago").timeago();$("#UpdatesListDiv ul li").hover(function(){$(".deleteIcon",this).css("visibility","visible")},function(){$(".deleteIcon",
this).css("visibility","hidden")});$(".deleteIcon").click(deleteIconClick);if($("#AddNewUpdateDiv").is(":visible")&&($("#AddNewUpdateDiv textarea").limit("85"),$("#AddNewUpdateDiv").hasClass("locked"))){debug.info("loadLatestUpdatesComments - locked, so adding overlay..");var a=$("#AddNewUpdateDiv").outerHeight(),b=$('<div class="updateLockedDiv">&nbsp;</div>');b.css("height",a-1+"px");b.css("margin-top","1px");var c=$('<div class="updateLockedContentDiv">To comment, please <a href="'+storeAndUserUpdatesControlLoginUrl+
'">login</a>.</div>');c.css("height",a-1+"px");c.css("margin-top","1px");b.insertBefore("#AddNewUpdateDiv");c.insertBefore(b)}initialStoreAndUserUpdatesLoad=!1}function loadLatestUpdatesCommentsReturned(){debug.info("loadLatestUpdatesCommentsReturned");loadLatestUpdatesComments()}function loadLatestUpdatesCommentsUpdating(){debug.info("loadLatestUpdatesCommentsUpdating");showLoadingOverWholeWidget()}var initialStoreAndUserUpdatesLoad=!0;$(document).ready(loadLatestUpdatesComments);
function loadLatestUpdatesCommentsInit(){debug.info("loadLatestUpdatesCommentsInit");Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(loadLatestUpdatesCommentsUpdating);Sys.WebForms.PageRequestManager.getInstance().add_endRequest(loadLatestUpdatesCommentsReturned)}Sys.Application.add_init(loadLatestUpdatesCommentsInit);

