rem: percent = Math.round( (bytes*100)/max ); 
add: percent = parseInt( (bytes*100)/max + .5 ); if ( percent > 100 ) { percent = 100; } 
context: function onProgress( bytes, max ) {    // Check for first time.    if ( !started ) {        // Initialize download start time.        started = true;        startTime = ( new Date() ).getTime();    }    // Get current time.    var now = ( new Date() ).getTime();    // If interval hasn't elapsed, ignore it.    if ( now - lastUpdate < interval         &&         max != "-1"         &&         eval(bytes) < eval(max) ) {        return;    }    // Update this time.    lastUpdate = now;    // Update download rate.    elapsed = now - startTime;    var rate; // bytes/sec    if ( elapsed ) {        rate = ( bytes * 1000 ) / elapsed;    } else {        rate = 0;    }    // Calculate percentage.    var percent;    if ( max != "-1" ) {        percent = Math.round( (bytes*100)/max );        // Advance progress meter.        dialog.progress.setAttribute( "value", percent );    } else {        percent = "??";        // Progress meter should be barber-pole in this case.        dialog.progress.setAttribute( "mode", "undetermined" );    }    // Check if download complete.    if ( !completed ) {        // Update status (nnn of mmm)        var status = "( ";        status += Math.round( bytes/1024 );        status += "K of ";        if ( max != "-1" ) {            status += Math.round( max/1024 );            status += "K bytes ";        } else {            status += "??.?K bytes ";        }        if ( rate ) {            status += "at ";            status += Math.round( (rate*10)/1024 ) / 10;            status += "K bytes/sec )";        } else {            status += ")";        }        // Update status msg.        onStatus( status );    }    // Update percentage label on progress meter.    dialog.progressPercent.childNodes[0].nodeValue = percent + "%";        if ( !completed ) {        // Update time remaining.        if ( rate && max != "-1" ) {            var rem = Math.round( ( max - bytes ) / rate ); // In seconds.            dialog.timeLeft.childNodes[0].nodeValue = formatSeconds( rem );        } else {            dialog.timeLeft.childNodes[0].nodeValue = "??:??:??";        }    } else {        // Clear time remaining field.        dialog.timeLeft.childNodes[0].nodeValue = "";    }}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/f9dafb59ba61ed632492f093d1625eb543b05f14/downloadProgress.js/buggy/xpfe/components/xfer/resources/downloadProgress.js