function fixPlaceholders()
{
  $$('input, textarea').each(
    function(input)
    {
      var placeholder = input.get('title');
      input.erase('title');
      
      //Get the REAL value, instead of the placeholder when shown
      $ext(input,
        {
          getRealValue: function()
          {
            var value = this.getValue();
            if(value == this.fakeplaceholder)
            {
              return '';
            }
            return value;
          }
        }      
      );
      
      //Empty placeholder?
      if(!placeholder)
      {
        input.fakeplaceholder = '';
        return false;
      } 
      
      //Native placeholder-ing in WebKit
      if(Browser.WebKit)
      {
        input.set('placeholder', placeholder);
        input.fakeplaceholder = '';
        return true;
      }
      
      //Functions to show and hide the placeholder
      $ext(input,
        {
          showPlaceholder: function()
          {
            if(this.getValue().blank())
            {
              this.setValue(this.fakeplaceholder);
            }
          },
          
          hidePlaceholder: function()
          {
            if(this.getValue() == this.fakeplaceholder)
            {
              this.setValue('');
            }
          }
        }
      );
      
      //And here are the events related
      input.on(
        {
          focus:  'hidePlaceholder',
          blur:   'showPlaceholder',
          change: 'showPlaceholder'
        }
      );
			    
		  //First time init
      input.fakeplaceholder = placeholder;
      input.showPlaceholder();
    }
  );
}

$(document).on('ready', 
  function() {
    fixPlaceholders();
  }
);  
