function SWFUploader(file_types, file_types_description, file_queue_limit, callback, thumbnail_width, thumbnail_height, triggers_on_event){
	// SWFUpload instance
	
	this.uploader;
	this.progress_target = 'uploadProgressHolder';
	this.upload_url = upload_url;
	this.session_id = session_id;

	this.flash_url = root_url+'_includes/SWFUpload/swf/swfupload.swf';
	this.file_types = file_types;
	this.file_types_description = file_types_description;
	this.file_upload_limit = swfupload_file_upload_limit;
	this.file_queue_limit = file_queue_limit;
	this.debug = swfupload_debug;
	this.thumbnail_width = parseInt(thumbnail_width);
	this.thumbnail_height = parseInt(thumbnail_height);	
	this.callback = callback;
	this.triggers_on_event = triggers_on_event;
	this.file_size_limit = swfupload_file_size_limit;
	
	this.eventHandler;
	var scope = this;
	
	this.uploadSuccess = function(successful, XMLDocument, fileObj, server_data){
		try{
			var successful = jQuery('status', XMLDocument).attr('successful');
			var thumbnail_possible = jQuery('status', XMLDocument).attr('thumbnail_possible');
			var info = jQuery('info', XMLDocument);	
			var url = jQuery('url', info);	
			
			if(successful === 'true'){
				if((scope.thumbnail_width > 0 || scope.thumbnail_height > 0) && thumbnail_possible === 'true'){
					var filename = jQuery(info).attr('filename');
					
					var img_preloader = new Image();
					jQuery(img_preloader).hide();
					
					var thumb_url = thumb_nail_url+filename+'&w='+scope.thumbnail_width;
					
					jQuery(img_preloader).load(function () {
						scope.callback(true, XMLDocument, info, this, fileObj);
					}).error(function () {
						scope.callback(false, XMLDocument, info, this, fileObj);
						// notify the user that the image could not be loaded
						alert("swfuploader: det gick inte att hämta tumnageln.");
					}).attr('src', thumb_url);
					
					//scope.callback(true, XMLDocument, info, this, fileObj);
				}else{
					scope.callback(true, XMLDocument, info, null, fileObj);
				}
			}else{
				scope.callback(false, XMLDocument, info, null, fileObj);
			}
		}catch(ex){
			scope.callback(false, XMLDocument, info, null, fileObj);
			if(true || scope.debug) alert("Fel:"+ex);	
		}
	}
	try{
		// Set uploadSuccess trigger if missing
		if(this.triggers_on_event == undefined)
			this.triggers_on_event = new Object();
		if(this.triggers_on_event.uploadSuccess == undefined)
			this.triggers_on_event.uploadSuccess = this.uploadSuccess;
			
		this.uploader = new SWFUpload({
			// Backend Settings
			upload_url: this.upload_url,	// Relative to the SWF file (or you can use absolute paths)
			post_params: {"PHPSESSID" : this.session_id, 'user_id' : user_id},
		
			// File Upload Settings
			file_size_limit : this.file_size_limit, 
			file_types : this.file_types,
			file_types_description : this.file_types_description,
			file_upload_limit : this.file_upload_limit,
			file_queue_limit : this.file_queue_limit,
		
			// Event Handler Settings (all my handlers are in the handler.js file)			
			swfupload_loaded_handler : swfUploadLoaded,
			file_queued_handler : fileQueued,
			file_queue_error_handler : fileQueueError,
			file_dialog_complete_handler : fileDialogComplete,
			upload_start_handler : uploadStart,
			upload_progress_handler : uploadProgress,
			upload_error_handler : uploadError,
			upload_success_handler : uploadSuccess,
			upload_complete_handler : uploadComplete,
			queue_complete_handler : queueComplete,
		
			// Flash Settings
			flash_url : this.flash_url,	// Relative to this file (or you can use absolute paths)
			
			swfupload_element_id : "flashUI1",		// Setting from graceful degradation plugin
			degraded_element_id : "degradedUI1",	// Setting from graceful degradation plugin
		
			custom_settings : {
				progressTarget : this.progress_target,
				cancelButtonId : "upload_cancel",
				callback : this.uploadSuccess,
				triggers_on_event : this.triggers_on_event
			},					
			
			// Button Settings
			button_placeholder_id : "btnBrowse",
			
			
			// Debug Settings
			debug: this.debug
		});	
	}catch(ex){
		 if(this.debug) alert("Fel:"+ex);			
	}
}
