function Uploader( formPath, labelPath, fileBoxPath, waitBoxPath )
{
    this.form = $(formPath).get(0);
    this.file = $(formPath + ' :file').get(0);

    if( !this.form || !this.file )
        return;
    
    this.label = $(labelPath).get(0);
    this.fileBox = $(fileBoxPath).get(0);
    this.waitBox = $(waitBoxPath).get(0);

    this.checkFile();
}

Uploader.prototype.notifyUploading = function( fileName )
{
    if( this.label && this.fileBox && this.waitBox )
    {
        $(this.label).text('Die Datei \"' + fileName + '\" wird gerade hochgeladen, bitte warten...');
        $(this.fileBox).hide();
        $(this.waitBox).show();
    }
};

Uploader.prototype.checkFile = function()
{
    var submitted = false;
    var fileName = this.file.value;
    if( fileName.length > 0 )
    {
        this.notifyUploading(fileName);
        this.form.submit();
        submitted = true;
    }
    var self = this;
    if( !submitted )
        setTimeout(function(){ self.checkFile(); }, 250);
};
