// JavaScript Document

var ProgressBar = Class.create();
ProgressBar.prototype = {
	_id : 'progress',
	_width : '100%',
	_height : '10px',
	_color : '#A1002A',
	_source : "",
	initialize: function(id) {
		_id = id;
		
	},
	render: function(elementid) {
		_source = "<div id='progress_" + this._id + "' style='text-align:left;width:" + this._width + ";border:1px solid " + this._color + ";visibility:hidden;'>\r\n" +
		"<table id='progressbar_"+this._id+"' width='0' height='"+this._height+"' bgcolor='#A1002A' border='0'>\r\n" +
			"<tr><td align='left' style='height: "+this._height+"px; font-size:9px; color:white;' id='progressmessage_"+this._id+"'></td></tr>" +
		"</table>" +
		"</div>";
		$(elementid).innerHTML = _source;
	},
	update: function(pct) {
		$('progressbar_'+this._id).setAttribute("width", pct + "%") ;
		$('progressmessage_'+this._id).innerHTML = pct + "%";
	},
	show: function() {
		$('progress_'+this._id).style.visibility = 'visible';
	},
	hide: function() {
		$('progress_'+this._id).style.visibility = 'hidden';
	},
	setMessage: function(msg) {
		$('progressmessage_'+this._id).innerHTML = msg;	
	},
	getId: function() {
		return this._id;
	},
	stop: function() {
		if (this.stopCallback != "undefined") {
			this.stopCallback();	
		}
	},
	stopCallback: function() {
		
	}
	
};
