    function validateAmountInput(evt) {
        var theEvent = evt || window.event;
        var key = theEvent.keyCode || theEvent.which;
        key = String.fromCharCode( key );
        var regex = /[0-9]|\./;
        if( !regex.test(key) ) {
        theEvent.returnValue = false;
        if(theEvent.preventDefault) theEvent.preventDefault();
        }
    }
    function validateAmount(evt) {
        var value = evt.target.value;
        var n = parseFloat(value);
        if (value != '' && (isNaN(n)|| n == 0 || n > {!order.totalSum})) 
                evt.target.value = {!order.totalSum};
    }