var Upload = new Class({
	
	Implements: [Options, Events],
	options:{
		target:null
	},
	
	initialize:function(options) {
		this.setOptions(options);
		debug('Upload:initialize');
		
		this.container = new Element('div').wraps(this.options.target);
		this.container.setStyles({
			position:'relative'
		});
		
				
		this.clone = new Element('input', {
			type: 'text'
		}).inject(this.container);
		this.clone.addClass(this.options.target.get('class')+' upload');

		this.options.target.setStyles({
			position: 'absolute',
			'opacity': 0.001,
			'z-index': 10
		});
				
		this.options.target.addEvent('change', function(e) {
			var paths = this.options.target.get('value').match(/([^\/\\]+\.\w+)$/);
			this.clone.set('value', paths[1]);
		}.bind(this));
		
	}
	
});
