/**
 * Namespaced Text Utils
 */
var TextUtils =
{
    /**
     * Limit the characters typed into the text area form
     * @param textAreaId    - DOM id of the text area form to truncate
     * @param counterSpanId - DOM id of the area displaying chars remaining
     * @param maxLimit      - Absolute limit at which to truncate form data
     */
    limitCharacters: function(textAreaId, counterSpanId, maxLimit)
    {
        if (!textAreaId || !counterSpanId || !maxLimit)return;
        var txtAreaElt=$(textAreaId);
        var cntSpanElt=$(counterSpanId);
        if (!txtAreaElt || !cntSpanElt) return;
        var currLen=$F(textAreaId).length;
        if (currLen > maxLimit){
          txtAreaElt.setValue($F(textAreaId).substring(0,maxLimit));
        }else{
          cntSpanElt.update(maxLimit - currLen);
        }
    }

};
