/**
 * jQuery Default Value Plugin v1.0
 * Progressive enhancement technique for inital input field values
 * @param		String
 * @return		Array
 */

(function($) {
	
	$.fn.defaultvalue = function() {
		// Scope
		var elements = this;
		var args = arguments;
		var c = 0;
		
		function reset($this){
		  if($this.val() == "") {
		    $this.val( jQuery.data( $this, 'value')  );
			};
		};
		
		return(
			elements.each(function() {				
				var $this = $(this);
				jQuery.data( $this, 'value', $this.val() );
				
				reset($this);
				
				$this.focus(function() { 
				  if( $this.val() == jQuery.data( $this, 'value') ){
				    $this.val('') 
				  }
				});
				
				$this.blur(function() { reset($this); });				
			})
		);
	}
})(jQuery)