$(document).ready(function(){
	/* example 1 */
	var button = $('#button1'), interval;
	var status = $('#status1'), interval;
	var username = document.getElementById('usernameText').value;
	new Ajax_upload(button,{
		action: 'community.php?page=hoererUpload&name=' + username,
		name: 'userfile',
		onSubmit : function(file, ext){
			// change button text, when user selects file			
			status.text('Uploading');
			
			// If you want to allow uploading only 1 file at time,
			// you can disable upload button
			this.disable();
			
			// Uploding -> Uploading. -> Uploading...
			interval = window.setInterval(function(){
				var text = status.text();
				if (text.length < 13){
					status.text(text + '.');					
				} else {
					status.text('Uploading');				
				}
			}, 200);
		},
		onComplete: function(file, response){
			//alert(response);
			status.text('Datei wurde hochgeladen! Dein Bild wird nun von uns geprueft und wird dann so schnell wie moeglich freigeschaltet!');	
			window.clearInterval(interval);
						
			// enable upload button
			this.enable();						
		}
	});		
});
