﻿function openTBWin(WinTitle, WinUrl, Width, Height, Modal) {
    url = WinUrl + (WinUrl.indexOf("?") >= 0 ? "&" : "?") + "TB_iframe=true&width=" + Width + "&height=" + Height + "&modal=" + Modal;
    $(document).ready(function() { tb_init(); tb_show(WinTitle, url, null); });
}

function check_length(txtBox) {
    var txt;
    var len;
    txt = document.getElementById(txtBox);
    len = document.getElementById('text_num');
    maxLen = 1000; // max number of characters allowed
    if (txt.value.length >= maxLen) {
        // Alert message if maximum limit is reached.
        // If required Alert can be removed.
        var msg = "You have reached your maximum limit of characters allowed";
        alert(msg);
        // Reached the Maximum length so trim the textarea
        txt.value = txt.value.substring(0, maxLen);
    }
    else { // Maximum length not reached so update the value of my_text counter
        len.value = maxLen - txt.value.length;
    }
}