/**
 * Unobtrusively set up placeholder behaviors on all text inputs for which
 * the title attribute has been set. The title text will be used as the
 * placeholder text.
 * @author Travis Miller
 * @link http://www.electrumdigital.com/2009/10/simulating-html5s-placeholder-attribute-with-jquery/
 */
jQuery( function() {
 
    jQuery("input[type=text][title]")
        .each( function() {
            showPlaceholder( jQuery(this) ); // initialize each control on page load
        } )
        .blur( function() {
            showPlaceholder( jQuery(this) );
        } )
        .focus( function() {
            var jQueryinput = jQuery(this);
            if ( jQueryinput.val() === jQueryinput.attr("title") ) {
                jQueryinput.removeClass("placeholder");
                jQueryinput.val("");
            }
        } );
 
    function showPlaceholder( jQueryinput ) {
        var placeholderText = jQueryinput.attr("title");
        if ( jQueryinput.val() === "" || jQueryinput.val() === placeholderText ) {
            jQueryinput.addClass("placeholder");
            jQueryinput.val(placeholderText);
        }
    };
 
} );
