var AJ = AJ || {};

AJ.placeholders = function() {
	
	function showPlaceholder(input) 
  {    
      //see if there is HTML5 support - if so bail out... no need for the rest
      if ('placeholder' in document.createElement('input')) return;
      
      var placeholderText = input.attr("placeholder");
      if ( input.val() === "" || input.val() === placeholderText ) 
      {input.val(placeholderText);}
  };	
	
	$("input[type=text][placeholder]").each( 
      function() 
      {showPlaceholder($(this));} 
  )
  .blur( 
      function() 
      {showPlaceholder($(this));}
  )
  .focus( 
      function() 
      {
          var input = $(this);
          if (input.val() === input.attr("placeholder")) 
          {input.val("");}
      } 
  );

};

$( function() {AJ.placeholders();} );
