﻿(function ($) {
    $.fn.AutoLabel = function () {
        var enableAutoLabel = function () { var jqLabel = $(this); var jqField = $("#" + jqLabel.attr("for")).attr("_autoLabel", jqLabel.text()); jqField.focus(autoLabelFocus); jqField.blur(autoLabelBlur).blur(); }
        return this.each(enableAutoLabel); ;
    }
    var autoLabelBlur = function () { var sLabel = $(this).attr("_autoLabel"); if (this.value.replace(/\s+/g, "") == "" && sLabel) { this.value = sLabel; } }
    var autoLabelFocus = function () { var sLabel = $(this).attr("_autoLabel").toLowerCase(); if (this.value.toLowerCase() == sLabel) { this.value = ""; } } 
})(jQuery); (function ($) { $.fn.highlight = function () { return this.each(function () { var jqNode = $(this); jqNode.css("background-color", "#fff").animate({ backgroundColor: "yellow" }, 250).animate({ backgroundColor: "white" }, 250, function () { $(this).css("background-color", "transparent") }); }); } })(jQuery); (function ($) {
    $.fn.DefaultValue = function () {
        var enableDefaultValue = function () { var jqField = $(this); jqField.attr("_defaultValue", this.value); jqField.focus(defaultValueFocus); jqField.keyup(defaultValueKeyup); }
        return this.each(enableDefaultValue); ;
    }
    var defaultValueBlur = function () { var sLabel = $(this).attr("_defaultValue"); if (this.value.replace(/\s+/g, "") == "" && sLabel) { this.value = sLabel; } }
    var defaultValueFocus = function () { var sLabel = $(this).attr("_defaultValue").toLowerCase(); if (this.value.toLowerCase() == sLabel) { this.select(); } }
    var defaultValueKeyup = function () { var sLabel = $(this).attr("_defaultValue").toLowerCase(); if (this.value.toLowerCase() == sLabel) { } else { $(this).removeClass("defaultValue"); } } 
})(jQuery);
