function check_job_status() {
    var obj = $(".progress");
    if (obj.length > 0) {
        var id = obj.attr('id');
        obj.html('<img src="/static/images/ajax-loader.gif"/>');
        $.get('/jobs/status/'+id+'/', {},
              function(data) {
                  obj.animate({
                    'width': data.progress+'%',
                  }, 3000, function() {
                    obj.html(data.progress);
                      if (data.status != 'FINISHED') {
                        setTimeout("check_job_status()", 5000);
                      }
                      else {
                        obj.html('<img src="/static/images/ok.png"/>');
                      }
                  });
              },
              "json");
    }
}

$(document).ready(function(){
    setTimeout("check_job_status()", 5000);
});
