/* Dynamic label over */
/* 2009.10.07 KJD: Document created */
jQuery.fn.labelOver = function(overClass) {
    return this.each(function(){
        var label = $(this);
        var f = label.attr('for');

        if( f )
		{
			// 2009.08.20 KJD: Only if text or password input
            var input = $('#' + f + "[type='text'], #" + f + "[type='password']" );
			
			if( input.length )
			{
	            this.hide = function()
				{
	                label.css({	'display': 'none' });
	            }
	            
				this.showit = function()
				{
	                if (input.val() == ''){ label.css({'display': 'inline'}) }
	            }
	            
				input.focus(this.hide);
	            input.blur(this.showit);
	            label.addClass(overClass).click(function(){ input.focus() });
	            if (input.val() != '') this.hide();
			}
        }
    })
};