function ProgressBar( progressBar ) { progressBar._forceHide = false; progressBar._percent = '0%'; progressBar.reportProgress = function( total ) { //alert( 'reportProgress' ); var divProgress = this.divProgress var spnProgress = this.spnProgress var divProgressBar = this.divProgressBar if( divProgress != null ) { //alert( 'reportProgress: total=' + total ); this._percent = Math.round( total * 100 ) + "%" ; divProgressBar.style.width = this._percent; spnProgress.innerHTML = this._percent; //alert( 'reportProgress Set: total=' + total ); if( total < 1 ) { if( !this._forceHide ) { divProgress.style.display = "block"; this.updateDisplay(); } } else { if( this._autoHide ) { divProgress.style.display = "none"; } this._forceHide = false; } } } progressBar.setTitle = function( title ) { this._title = title; //alert( 'setTitle: this._title=' + this._title ); var spnTitle = this.spnTitle spnTitle.innerHTML = this._title; this.updateDisplay(); } progressBar.hide = function() { var divProgress = this.divProgress divProgress.style.display = "none"; this._forceHide = true; } progressBar.show = function() { var divProgress = this.divProgress divProgress.style.display = "block"; this._forceHide = false; this.updateDisplay(); } progressBar.updateDisplay = function() { // If the width is too small, make the text invisible var divProgress = this.divProgress var spnTitle = this.spnTitle var spnProgress = this.spnProgress var aHide = this.aHide // alert( 'updateDisplay: divProgress, spnTitle, spnProgress, aHide .offsetWidth=' + // divProgress.offsetWidth + ', ' + spnTitle.offsetWidth + ', ' + // spnProgress.offsetWidth + ', ' + aHide.offsetWidth ); if( spnTitle.offsetWidth + spnProgress.offsetWidth + aHide.offsetWidth > divProgress.offsetWidth - 4 ) { // alert( 'updateDisplay: hide spnTitle' ); spnTitle.style.display = "none"; } if( spnProgress.offsetWidth + aHide.offsetWidth > divProgress.offsetWidth - 4 ) { // alert( 'updateDisplay: hide spnProgress' ); spnProgress.style.display = "none"; } } //alert( 'ProgressBar_Init: progressBar.reportProgress=' + progressBar.reportProgress ); }