function checkLength(field, limit) {	
    if (field.value.length > limit) {
        field.value = field.value.substring(0, limit);
    } 
}

