﻿(function ($) {
    $.fn.StartMessage = function () {
        return this.each(function () {
            $(this).css("color", "#777");
            if ($(this).data("startMsg") == null) {
                $(this).data("startMsg", $(this).val());
                $(this).focus(function () {
                    if ($(this).val() == $(this).data("startMsg")) {
                        $(this).css("color", "#000000");
                        $(this).val('');
                    }
                });

                $(this).blur(function () {
                    if ($(this).val() == '') {
                        $(this).css("color", "#777");
                        $(this).val($(this).data("startMsg"));
                    }
                });
            }
            else {
                $(this).css("color", "#777");
                $(this).val($(this).data("startMsg"));
            }
        });
    };
    $.fn.ValidateStartMessage = function () {
        if ($(this).val() == '' || $(this).val() == $(this).data("startMsg")) {
            return false;
        }
        else {
            return true;
        }
    };
    $.fn.ReturnToStartMessage = function () {
        return this.each(function () {
            $(this).val($(this).data("startMsg"));
        });
    };
})(jQuery);
