var counter= 0;
$(document).ready(
  function() {
    var action= function() {
      $.ajax(
        {
          async: false,
          type: "POST",
          dataType: "json",
          url: "./admin/modules/clients/get_client.php",
          data: "number=" + counter + "&not_id=" + $('#not_id').attr("value"),
          success: function(msg) {
            $("#client_image").animate(
              {opacity: 0},
              1500,
              function() {
                $("#client_image").attr("src", "." + msg.image.url);
                $("#client_image").preload();
                $("#client_url").attr("href", msg.image.link);
                $('#not_id').attr("value", msg.image.id)
                $("#client_image").animate(
                  {opacity: 1},
                  1500,
                  function() {
                    setTimeout(action, 5000);
                    counter++;
                  }
                );
              }
            );
          }
        }
      );
    }
    setTimeout(action, 5000);
  }
);


