


jQuery.fn.Autotext = function(elm) {


	if(!elm){
		return this.each(function() {

				jQuery(this).focus(function(){
					if(!jQuery(this).attr('SystemAutoValue')){
						// First time the field gets the focus
						jQuery(this).attr('SystemAutoValue', jQuery(this).attr('value'));
					}
					if(jQuery(this).attr('SystemAutoValue') == jQuery(this).attr('value')){
						jQuery(this).attr('value', '');
					}
					jQuery(this).addClass('SystemWidgetAutoTextSelected');
				});
				
				jQuery(this).blur(function(){
					if(!jQuery(this).attr('value')){
						jQuery(this).attr('value', jQuery(this).attr('SystemAutoValue'));
					}
					jQuery(this).removeClass('SystemWidgetAutoTextSelected');
				});
		});
	}
};
