﻿// jQuery Input Hints plugin
// Copyright (c) 2009 Rob Volk
// http://www.robvolk.com

jQuery.fn.inputHints=function() {
    // hides the input display text stored in the title on focus
    // and sets it on blur if the user hasn't changed it.

    // show the display text
    $(this).each(function(i) {
    	var me = $(this);
    	if(me.attr('value') == '') {
			if(!me.hasClass('hint')) {
				me.addClass('hint');
			}
			me.val(me.attr('title'));
        }
    });

    // hook up the blur & focus
    $(this).focus(function() {
    	var me = $(this);
        if (me.val() == me.attr('title') && me.hasClass('hint')) {
            me.val('');
        	me.removeClass('hint');
        }
    }).blur(function() {
    	var me = $(this);
        if (me.val() == '') {
            me.val(me.attr('title'));
        	me.addClass('hint');
        }
    });
};

