function doKeyPress(oControl,e) {
    var iMaxLength = oControl.attributes["maxLength"].value;
    var vText = oControl.value;
    if ((iMaxLength) && (vText.length > iMaxLength - 1)) {
        if (window.event) {
            window.event.returnValue = false;
        }
        else {
            var oRegExp = /([\w]|[\d]|[\s])/;
            return !oRegExp.test(String.fromCharCode(e.which));
        }
    }    
}
function doKeyUp(oControl) {
    if (!window.event) {
        var iMaxLength = oControl.attributes["maxLength"].value;
        var vText = oControl.value;
        if ((iMaxLength) && (vText.length > iMaxLength - 1)) {
            oControl.value = vText.substr(0,iMaxLength);
            return false;
        }
    }
}
function doBeforePaste(oControl){
    var iMaxLength = oControl.attributes["maxLength"].value;
    if(iMaxLength) {
        window.event.returnValue = false;            
    }
}
function doPaste(oControl){
    var iMaxLength = oControl.attributes["maxLength"].value;
    value = oControl.value;
    if(iMaxLength){
        var oTR = oControl.document.selection.createRange();
        var iInsertLength = iMaxLength - value.length + oTR.text.length;
        var sData = window.clipboardData.getData("Text").substr(0,iInsertLength);
        oTR.text = sData;
        window.event.returnValue = false;                    
    }
}   
