    // < ![CDATA[
    // http://bd-things.net/how-to-limit-a-field-with-javascript-prototype-and-display-the-counter/
	/*
	Usage: <input type="text" id="id_textfield" onkeyup="javascript: limit_text(this,10,true);" onkeydown="javascript: limit_text(this,10,true);" />
	limit_text(this,10,true); // this field, no.chars, show counter true or false
	*/
	function limit_text(field, limit, counterDesired) {
        if (counterDesired == null) {
            // if we omit "counterDesired" parameter
            counterDesired = false;
        }

        // get field length
        var length = $F(field).length;

        if (length > limit) {
            // if it's greater than the limit
            // we truncate its content at the limit
            var newFieldContent = $(field).value.substring(0, limit);
            $(field).value = newFieldContent;
        }

        if (counterDesired) {
            length = $F(field).length;
            // if we desire a counter displayed
            if ($($(field).id + '_counter')) {
                // this is if user wants a customized counter
                $($(field).id + '_counter').update(length + " / " + limit);
                // called "[ID_OF_FIELD]_counter"
            } else {
                // default behavior, create a span for the counter
                var counterText = new Element('span', {
                    'id': $(field).id + '_counter'
                });
                counterText.update((length) + "/" + limit);
                // displays  " current length / limit "
                $(field).insert({
                    'after': counterText
                    // we want the counter after the field
                });
            }
        }

    }
    // ]]>
