/* 
 * Update data in paticular container
 * Required - container_id, downloader_id, urls
 */

ajax_updater = function(){ // Empty object
    // Occurred at start
    this.start_update = function(){
        $('#'+this.downloader_id).show();
    };
    // Occurred at end
    this.end_update = function(){
        $('#'+this.downloader_id).hide();
    };
    this.update = function(urls, container_id, downloader_id){
        var self = this;
        this.urls = urls;
        this.container_id = container_id;
        this.downloader_id = downloader_id;

        self.start_update();
        $.ajax({
            url: this.urls,
            success: function(data) {
                $('#'+self.container_id).html(data);
            },
            complete: function(){
                self.end_update();
            }
        });
    };
}

function create_and_execute_updater(urls, container_id, downloader_id){
    var obj = new ajax_updater();
    obj.update(urls, container_id, downloader_id);
    return false;
}

