/*
 * jQuery Form Example Plugin 1.5
 * Populate form inputs with example text that disappears on focus.
 *
 * e.g.
 *  $('input#name').example('Bob Smith');
 *  $('input[@title]').example(function() {
 *    return $(this).attr('title');
 *  });
 *  $('textarea#message').example('Type your message here', {
 *    className: 'example_text'
 *  });
 *
 * Copyright (c) Paul Mucur (http://mudge.name), 2007-2011.
 * Dual-licensed under the BSD (BSD-LICENSE.txt) and GPL (GPL-LICENSE.txt)
 * licenses.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
(function(a,b){a.fn.example=function(b,c){var d=a.isFunction(b),e=a.extend({},c,{example:b});return this.each(function(){var b=a(this);if(a.metadata)var c=a.extend({},a.fn.example.defaults,b.metadata(),e);else var c=a.extend({},a.fn.example.defaults,e);a.fn.example.boundClassNames[c.className]||(a(window).bind("unload.example",function(){a("."+c.className).val("")}),a("form").bind("submit.example",function(){a(this).find("."+c.className).val("")}),a.fn.example.boundClassNames[c.className]=!0),!b.attr("value")&&(d||b.val()==c.example)&&b.val(""),b.val()==""&&this!=document.activeElement&&(b.addClass(c.className),b.val(d?c.example.call(this):c.example)),b.bind("focus.example",function(){a(this).is("."+c.className)&&(a(this).val(""),a(this).removeClass(c.className))}),b.bind("change.example",function(){a(this).is("."+c.className)&&a(this).removeClass(c.className)}),b.bind("blur.example",function(){a(this).val()==""&&(a(this).addClass(c.className),a(this).val(d?c.example.call(this):c.example))})})},a.fn.example.defaults={className:"example"},a.fn.example.boundClassNames=[]})(jQuery);

