﻿/*******************************************************************************
TITLE: 			Smart Input Plugin
	
AUTHOR:			Shaun Crittenden
	
VERSION:		1.0
	
REQUIRES:		jQuery v1.3.2
	
EXPECTS:		Selector for text input element

DESCRIPTION:	
	
*******************************************************************************/

(function ($) {
    $.fn.extend({
        smartInput: function () {

            return this.each(function () {

                // VARIABLES
                var $textInput = $(this);
                var defaultValue = $textInput.val();

                // EVENT LISTENERS
                $textInput.focus(function () {
                    if ($textInput.val() == defaultValue || $textInput.val() == "Enter #") {
                        $(this).val('');
                    }
                }).blur(function () {
                    if ($(this).val() == "") {
                        $textInput.val("Enter #");
                    }
                });

            });
        }
    });
})(jQuery);
