﻿function limitText(limitField, limitCount, limitNum) {
    if (limitField.value.length > limitNum) {
        limitField.value = limitField.value.substring(0, limitNum);
    }
    else {
        limitCount.html(limitNum - limitField.value.length);
    }
}

(function ($) {
    $.fn.fadeBackground = function (activeColor, activeSpeed, defaultColor, defaultSpeed) {
        $(this).hover(function () {
            $(this).stop().animate({ backgroundColor: activeColor }, activeSpeed);
        }, function () {
            $(this).stop().animate({ backgroundColor: defaultColor }, defaultSpeed);
        });
    };
})(jQuery);

(function ($) {
    $.fn.fadeForeground = function (activeColor, activeSpeed, defaultColor, defaultSpeed) {
        $(this).hover(function () {
            $(this).stop().animate({ color: activeColor }, activeSpeed);
        }, function () {
            $(this).stop().animate({ color: defaultColor }, defaultSpeed);
        });
    };
})(jQuery);
