jQuery(document).ready(function ($) {
//   Ajax Loading Bar
  $("#loading-bar").ajaxStart(function(){
    $(this).show();
  });
  $("#loading-bar").ajaxStop(function(){
    $(this).hide();
  });

  // Follow / Unsubscribe
  $("#follow-blog").click(function () {
    var parent    = $(this).parent();
    var status    = $(this).attr("rel");
    var followers = parseInt($("#followers").html());

    $.post(route_follow_blog, {
      id:     blog_id,
      format: "raw"
    }, function (response) {
      if (response.status == 1)
      {
        if (status == 1)
        {
          $("#follow-info").html(txt_you_are_following_this_blog);
          $("#follow-blog").attr("rel", 0).html(txt_unsubscribe);
          followers++;
        }
        else
        {
          $("#follow-info").html("");
          $("#follow-blog").attr("rel", 1).html(txt_follow_this_blog);
          followers--;
        }

        $("#followers").html(followers);
      }
    }, "json");

    return false;
  });
});