/*
 * jQuery inputfile plugin 0.1
 * requires jquery 1.2.6 ( only tested with this one)
 *
 * http://wnas.nl/
 *
 * Copyright (c) 2008 Wilfred Nas
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */

/*

	to intiate the  function do
	jQuery('foobar').inputfile();
	
	NOTE  the input type file has to have an unique id.
	
	it first add's a class to the input file (style / hide with css)
	then we create a div with an input and a span (span for button)
	on change we set the value of file in the text...
	
	DONE
*/



jQuery.fn.inputfile = function (){
	this.addClass('hidden');
	var file_id = this.attr('id');
	var file_val = this.attr('title');
	this.after('<div class="fakefile"><input type="text" class="fakefile ' + file_id + '" /><div class="btn">' + file_val + '</div></div>');
	this.change(function () {
		var val = jQuery(this).val();
		jQuery('.'+file_id).val(val);
	});
};

