/////////////////////////////////////////////
// PROGRESS BAR OBJECT

function progressBar(id){
    var obj = this;

    this.speed = 50;
    this.backgroundPosition = 0;

    this.getProgressBar = function (){
	var element = document.createElement('div');
	element.setAttribute('class', 'progressBar');
	element.setAttribute('id', id);
	element.style.backgroundAttachment = 'fixed';
	element.style.display = 'none'; 
	return element;
    }

    this.start = function(){
	this.bar = document.getElementById(id);
	this.bar.style.display = 'block';
	register(id, bind(obj, 'loop'));
	this.intervalId = setInterval(globalCall(id) + "()", this.speed);
    }

    this.loop = function(){
	this.backgroundPosition++;
	this.bar.style.backgroundPosition = this.backgroundPosition + "px";
    }

    this.stop = function(){
	clearInterval(this.intervalId);
	this.bar.style.display = 'none';
    }
}
