var FbFileUpload = FbFileElement.extend({
	initialize: function(element, options) {
		this.parent(element, options);
		this.plugin = 'fabrikfileupload';
		this.setOptions(element, options);
		this.toppath = this.options.dir;
		if (this.options.folderSelect == 1 && this.options.editable == 1) {
			this.ajaxFolder();
		}
	},
	
	cloned: function() {
		//replaced cloned image with default image
		if($type(this.element.findClassUp('fabrikElement')) === false) {
			return;
		}
		var i = this.element.findClassUp('fabrikElement').getElement('img');
		if(i) {
			i.src = this.options.liveSite + '/' + this.options.defaultImage;
		}
	},
	
	decloned: function(groupid)
	{
		var f = $('form_' + this.form.id);
		var i = f.getElement('input[name=fabrik_deletedimages['+groupid+']');
		if($type(i) == false) {
			new Element('input', {'type':'hidden','name':'fabrik_fileupload_deletedfile['+groupid+'][]', 'value':this.options.value}).injectInside(f)
		}
	},
	
	update: function(val) {
		if(this.element) {
			var i = this.element.getElement('img');
			if($type(i) !== false) {
				i.src = val;
			}
		}
	}
});