// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function updateUserData() {
  base_url = Imood.base_url || "http://new.imood.com/";
  $.getJSON(base_url + "callbacks/user_data?callback=?", function(data) {
    if (data.current_user != null) {
      if (data.new_forum_posts > 0) {
        $("#unread_forum_posts").html(data.new_forum_posts + " new");
        $("#unread_forum_posts").css("display", "block");
      }
    }
  });
}

$(document).ready(function() {
  $('.notification').click(function() {
    $(this).slideUp(); return false; 
  });

  if (Imood.current_user) {
    updateUserData();
  }
});


