function MultiUpload(defOptions){
	this.prop={
		session_name: '',
		session_id: '',
		input_id: '',
		err_text: 'error',
		form_id: '',
		post_params: {from_uploadify:1},
		uploadify_obj: {
			debug: false,
			method: 'post',
			progressData: 'percentage',
			queueSizeLimit: 50,
			removeCompleted: false,
			removeTimeout: 5,
			width: 300,
			buttonText: '',
			swf: TEMPLATE_PATH+'/js/uploadify/uploadify.swf',
			uploader: '',
			auto: false,
			multi: true,
			fileObjName: 'upload',
			fileTypeExts: '*.*',
			fileSizeLimit: 0,
			overrideEvents: ['onUploadSuccess'],
			onUploadSuccess: function(file, data, resp){
				if(data.substr(0,7) == '<script'){
					$('head').append(data);
				}
				try{
					data = $.parseJSON(data);
				}catch(e){
					var err = (e.message) ? e.message : e.name;
					data = {status: 'error', msg: _self.prop.err_text+' ('+err+')'};
				}
				$('#'+file.id).find('.data').html('<span> - </span><span class="error">'+data.msg+'</span>');
				if(data.status == 'success'){
					setTimeout(function(){$('#'+file.id).fadeOut();}, 3000);
				}
				if(data.status == 'error'){	}
			}
		}
	}
	
	var _self = this;
	
	this.init = function(options){
		_self.prop = $.extend(true, _self.prop, options);
		$('#'+_self.prop.input_id).uploadify(_self.prop.uploadify_obj);
	}
	
	this.startUpload = function(post_params){
		post_params = post_params || {};
		var form_obj = $.extend(true, _self.getFormObj(), post_params);
		$('#'+_self.prop.input_id).uploadify('settings', 'formData', form_obj);
		$('#'+_self.prop.input_id).uploadify('upload','*');
		return _self;
	}

	this.getFormObj = function(){
		if(_self.prop.form_id != ''){
			var form_arr = $('#'+_self.prop.form_id).serializeArray();
			var form_obj = {};
			for(var i in form_arr){
				form_obj[form_arr[i].name] = form_arr[i].value;
			}
		}
		form_obj.session_name = _self.prop.session_name;
		form_obj.session_id = _self.prop.session_id;
		form_obj = $.extend(true, _self.prop.post_params, form_obj);
		return form_obj;
	}
	
	_self.init(defOptions);
}