/*
*  jQuery Inactive value plugin
*
*  version 1.0 beta
*  21-Nov-2008
*  Art Deineka
*  requires jQuery
*/

jQuery.fn.inactiveValue = function(userOptions) {
    var options = {
    	inactiveValue: "defaultValue",
    	inactiveColor: "lightgrey"
    	}
    var activeColor = $(this).css('color');
    $.extend(options, userOptions);
    // on init
    if ((this).val() == "")
    {
      $(this).val(options.inactiveValue);
      $(this).css('color',options.inactiveColor);
    }
    // on blur
    $(this).blur(function(){
      var val = $(this).val();
      if ((val == "")||(val == options.inactiveValue))
      {
        $(this).val(options.inactiveValue);
        $(this).css('color',options.inactiveColor);
      }
    })
    // on focus
    $(this).focus(function(){
      if ($(this).val() == options.inactiveValue)
      {
        $(this).val("");
      }
      $(this).css('color',activeColor);
    })
}
