// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

Element.addMethods({
  set_text_input_hint: function(element, hint){
    element = $(element);
    if ((element.value == '') || (element.value == hint)) {
      element.setStyle({color:'#DEDEDE'});
      element.value = hint;
    }
    element.observe('focus', function() {
      if (this.value == hint) {
        this.value = '';
        this.setStyle({color:'#000'});
      }
    });
    element.observe('blur', function() {
      if (this.value == '') {
        this.setStyle({color:'#DEDEDE'});
        this.value = hint;
      }
    });
    element.up('form').observe('submit', function() {
      if (element.value == hint) {
        element.value = '';
      };
    });
    return element;
  }
});
