/*
 * 'Hints' for input boxes. Text is displayed inside input boxes, but
 * disappears when focused.
 *
 * Usage:
 *
 * <input class="hinted" title="Example hint text" ... >
 *
 * CSS:
 * .hintshown
 * {
 *    ... styles to apply when the hints are displayed ...
 * }
 */

$(document).ready(function(event)
{
   $('.hinted').focus(function()
   {
      // See if the input field is the default
      if($(this).val() == $(this).attr('title'))
      { 
         $(this).val('');
         $(this).removeClass('hintshown');
      }
   })
   .blur(function()
   {
      if($(this).val() == '')
      { 
         $(this).val($(this).attr('title'));
         $(this).addClass('hintshown');
      }
   });

   // Apply hints to all elements that have them.
   $('.hinted').blur();
});


