/**
	HTML5 Place Holder
	@author Eric King
	@date 2010-08-02
	
	@use:
		$('input[placeholder]').placeholder();
*/
jQuery.fn.placeholder = function( settings ){
	settings = jQuery.extend( {
		value: ''
	}, settings );

	function supports_input_placeholder() {
		var i = document.createElement('input');
		return 'placeholder' in i;
	}

	if( ! supports_input_placeholder() ){
		return this.each( function(){
			var input = jQuery(this);
			var _value = this.value;
			this.defaultValue = input.attr('placeholder');
			if( _value == '' ){
				this.value = this.defaultValue;
			} else {
				this.value = _value;
			}
			input.focus( function(){
				if( this.value == this.defaultValue ){
					this.value = '';
				}
			} ).blur( function(){
				if( this.value == '' ){
					this.value = this.defaultValue;
				}
			} );
			if( settings.value != '' && _value == '' ){
				//input.val( settings.value );
				this.value = settings.value;
			}
		} );
	}
	return this;
};
