/* Licence:

*   Use this however/wherever you like, just don't blame me if it breaks anything.

*

* Credit:

*   If you're nice, you'll leave this bit:

*

*   Class by Pierre-Alexandre Losson -- http://www.telio.be/blog

*   email : plosson@users.sourceforge.net

*/

function refreshProgress()

{

    UploadMonitor.getUploadInfo(updateProgress);

}

 

function updateProgress(uploadInfo)

{
	//alert(uploadInfo.inProgress);
    if (uploadInfo.inProgress)

    {
        var progressPercent = Math.ceil((uploadInfo.bytesRead / uploadInfo.totalSize) * 100);
        document.getElementById('loadbar').style.width = progressPercent + '%';
        window.setTimeout('refreshProgress()', 1000);
    }

    else

    {

        //document.getElementById('uploadbutton').disabled = false;

        window.setTimeout('refreshProgress()', 500);
    }


    return true;

}

 

function startProgress()

{

    document.getElementById('uploadbutton').disabled = true;
    
    document.getElementById('showUploadBar').style.display = "";

    // wait a little while to make sure the upload has started ..

    window.setTimeout("refreshProgress()", 1500);

    return true;

}

