progressBar = function(name, oParent, sPrefix){
	this.name	= name;
	this.minValue 	= 0;
	this.maxValue	= 100;
	this.value 	= 0;
	this.oParent	= oParent;
	this.sPrefix	= sPrefix;
	this.width	= 300;
	this.height	= 15;
	this.init();
}

progressBar.prototype = {
	init : function(){
	
		//Container
		this.oProgressBarContainer = document.createElement("div");
		this.oParent.appendChild(this.oProgressBarContainer);		
		this.oProgressBarContainer.id = this.sPrefix + "_progressBarContainer";
		this.oProgressBarContainer.style.position = 'absolute';
		
		//Title
		this.oProgressBarTitle = document.createElement("div");
		this.oProgressBarContainer.appendChild(this.oProgressBarTitle);
		this.oProgressBarTitle.id = this.sPrefix + "_progressBarTitle";
		this.oProgressBarTitle.style.textAlign = 'center';
		this.oProgressBarTitle.style.fontFamily = 'arial, tahoma, helvetica, sans-serif';
		this.oProgressBarTitle.style.fontSize = '14px';
		this.oProgressBarTitle.innerHTML = 'Starting Album Designer...<br/><br/>';
		
		//Border
		this.oProgressBarBorder = document.createElement("div");
		this.oProgressBarContainer.appendChild(this.oProgressBarBorder);
		this.oProgressBarBorder.id = this.sPrefix + "_progressBarBorder";
		this.oProgressBarBorder.style.width = this.width + 'px';
		this.oProgressBarBorder.style.height = this.height + 'px';
		this.oProgressBarBorder.style.border = '2px black inset';
		
		//Bar	
		this.oProgressBarImage = document.createElement("div");
		this.oProgressBarBorder.appendChild(this.oProgressBarImage);
		this.oProgressBarImage.id = this.sPrefix + "_progressBarImage";
		this.oProgressBarImage.style.width = '0%';
		this.oProgressBarImage.style.height = '100%';
		this.oProgressBarImage.style.background ="url('/images/album_designer/ProgressBar.jpg')";
		this.oProgressBarImage.style.backgroundRepeat = 'repeat-x';
		this.oProgressBarImage.style.fontSize = '5px';
				
		//Label
		this.oProgressBarLabel = document.createElement("div");
		this.oProgressBarContainer.appendChild(this.oProgressBarLabel);		
		this.oProgressBarLabel.id = this.sPrefix + "_progressBarLabel";
		this.oProgressBarLabel.style.textAlign = 'center';
		this.oProgressBarLabel.style.fontFamily = 'arial, tahoma, helvetica, sans-serif';
		this.oProgressBarLabel.style.fontSize = '12px';
		this.oProgressBarLabel.innerHTML = "0%";
		this.oProgressBarLabel.style.position = 'absolute';
		this.oProgressBarLabel.style.width = this.width + 'px';
		this.oProgressBarLabel.style.height = this.height + 'px';
		this.oProgressBarLabel.style.top = '35px';
	},
	
	setPositionCenter : function() {
		this.oProgressBarContainer.style.left = parseInt(((this.oParent.offsetWidth - this.width)/2), 10) + 'px';
		this.oProgressBarContainer.style.top = parseInt(((this.oParent.offsetHeight - this.height)/2), 10) + 'px';
	},
	
	getValue : function(){ return this.value; },
	
	setValue : function(value) {
		if (isNaN(value)) { value = 0; }		
		if (value < this.minValue) { value = this.minValue; }
		if (value > this.maxValue) { value = this.maxValue; }
		this.value = value;
		//alert(this.value);
		this.oProgressBarImage.style.width = this.value + '%';
		this.oProgressBarLabel.innerHTML = this.value + '%';
	},
	
	increment : function(iValue) {
		this.value+= iValue;
		this.setValue(this.value);
	}
}

