/*
Acceptedge autobox plugin -
Used on text inputs with default values. Clears the default value on focus.
Restores the default value on blur if empty or the same
use straight CSS for styling the focus of the text input

*/

jQuery.fn.autobox = function(){
  return this.each(function (){
    var textInput = $(this);
    var defaultVal = textInput.val();
    
    textInput.bind('focus', function(){
      var $this = $(this);
      if($this.val() == defaultVal){
        $this.val('');
      }
    });
      
    textInput.bind('blur', function(){
      var $this = $(this);
      if($this.val() == ''){
        $this.val(defaultVal);
      }
    });
  });
};