
var private_pBar = new private_ProgressBar();

function ProgressBar(comment) {
  document.write('<span id="progressBar" class="hide">');
  document.write('<table cellpadding="3" class="progressBarFrame">');
  document.write('<tr><td align="center" class="progressBarComment" nowrap><span id="pBar_comment">' + comment + '</span></td></tr>');
  document.write('<tr><td nowrap>');
  document.write('<div class="progressBar">');
  document.write('<span id="progress1">&nbsp;&nbsp;&nbsp;&nbsp;</span>');
  document.write('<span id="progress2">&nbsp;&nbsp;&nbsp;&nbsp;</span>');
  document.write('<span id="progress3">&nbsp;&nbsp;&nbsp;&nbsp;</span>');
  document.write('<span id="progress4">&nbsp;&nbsp;&nbsp;&nbsp;</span>');
  document.write('<span id="progress5">&nbsp;&nbsp;&nbsp;&nbsp;</span>');
  document.write('<span id="progress6">&nbsp;&nbsp;&nbsp;&nbsp;</span>');
  document.write('<span id="progress7">&nbsp;&nbsp;&nbsp;&nbsp;</span>');
  document.write('<span id="progress8">&nbsp;&nbsp;&nbsp;&nbsp;</span>');
  document.write('</div>');
  document.write('</td></tr></table>');
  document.write('</span>');

  return private_pBar;
}

function private_ChangeComment(comment) {
  document.all.pBar_comment.innerHTML = comment;
}

function private_ProgressBar() {

   this.progressEnd = 8;
   this.progressColor = 'blue';
   this.progressInterval = 270;

   this.progressAt = this.progressEnd;
   this.progressTimer;

   this.progress_clear = ProgressBar_progress_clear;
   this.progress_update = ProgressBar_progress_update;
   this.progress_stop = ProgressBar_progress_stop;
   this.makeVisible = ProgressBar_makeVisible;
   this.setComment = private_ChangeComment;
   this.show = showProgressBar;

}

function ProgressBar_progress_clear() {
	for (var i = 1; i <= this.progressEnd; i++) document.getElementById('progress'+i).style.backgroundColor = 'transparent';
	this.progressAt = 0;
}
function ProgressBar_progress_update() {
	this.progressAt++;
	if ( this.progressAt > this.progressEnd ) this.progress_clear();
	else document.getElementById('progress'+this.progressAt).style.backgroundColor = this.progressColor;
	//this.progressTimer = this.progress_update;
}
function ProgressBar_progress_stop() {
	clearTimeout(this.progressTimer);
	this.progress_clear();
}

function ProgressBar_makeVisible() {

	document.all.progressBar.className = 'show';
	//document.all.progressBar.style.left = (document.body.clientWidth/2) - (document.all.progressBar.offsetWidth/2);
	document.all.progressBar.style.left = 0;
	//document.all.progressBar.style.top = document.body.scrollTop+(document.body.clientHeight/2) - (document.all.progressBar.offsetHeight/2);
	document.all.progressBar.style.top = document.body.scrollTop + document.body.clientHeight - document.all.progressBar.offsetHeight;

}

function progressLoop() {
	private_pBar.progress_update();
	private_pBar.progressTimer = window.setTimeout('progressLoop()',private_pBar.progressInterval);
}

function showProgressBar() {
	private_pBar.makeVisible();
	progressLoop();
}

