/* 
	jQuery plugin to allow input fields to be emptied when they get focus and,
	if necessary, to restore the original content when the user doesn't enter anything.
	
	Parameters:
		- selector: an extra filter that will be applied on the input fields, limiting the ones that are cleared
					e.g. clearFields(selector: '.clean'); will only fire on inputfields that have class "clean"
		- textFields: true/false determines if text fields should be cleared. Default = true
		- textAreas: true/false determines if text areas should be cleared. Default = true
		- passwordFields: true/false determines if password fields should be cleared. Default = true

	Created by Tim De Grande.
	Licensed under GPLv3 (http://www.opensource.org/licenses/gpl-3.0.html)
*/


(function($){$.fn.clearFields=function(m){var y="oldValue";var z="changed";var t="true";var i="input[type=";var j="text]";var c="textarea";var v="password]";var a={'selector':'*','textFields':true,'textAreas':true,'passwordFields':true};var b={c:function(e){if(e.val().trim()==""){e.val(e.attr(y)).removeAttr(y).removeAttr(z);}else{e.attr(z,t);}},d:function(e){if(e.attr(z)!=t){e.attr(y,e.val()).val("");}},k:function(e){if(g!="*"){e=e.filter(g);}e.focus(function(){b.d($(this));}).blur(function(){b.c($(this));});}};var g;return this.each(function(){if(c){a=$.extend(a,m);}var d=a.textFields;var e=a.textAreas;var f=a.passwordFields;if(!(d||e||f)){return;}g=a.selector;if(d){b.k($(this).find(i+j));}if(f){b.k($(this).find(i+v));}if(e){b.k($(this).find(c));}});};})(jQuery);
