$(document).ready(function(){
//	new AjaxUpload('#button1', {action: '../../uploadexmple.asp'});
	var TheD = $('#But1').find('#TheFile').attr('id');
	if(TheD !=undefined)
	{
	var button = $('#button1'), interval;
	new AjaxUpload(button,{
		action: '../../uploadexmple.asp', 
		name: 'myfile',
		onSubmit : function(file, ext){
			// change button text, when user selects file			
			button.text('Laster opp');
			
			// 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 = button.text();
				if (text.length < 13){
					button.text(text + '.');					
				} else {
					button.text('Later opp');				
				}
			}, 200);
		},
		onComplete: function(file, response){
			button.text('Last opp');
						
			window.clearInterval(interval);
						
			// enable upload button
			this.enable();
			
			// add file to the list
			$('<li></li>').appendTo('#example1 .files').text(file);
			var TheVal  = $('.TheFiles').val();
			TheVal = TheVal + ',' + file;
			$('.TheFiles').val(TheVal);	
		}
	});
 

	}
});
