﻿function TabNext(field, limit, next, evt)
{
    var evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));
    if (charCode > 31 && field.value.length == limit)
    {
        next.focus( );
    }
}
function OnlyNumbers(evt)
{
    var evt = (evt) ? evt : event;
//    var charCode = evt.which || evt.keyCode;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));
    if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;

    return true;
}
function OnCreditCardComboChange(comboId, textBoxId, evt)
{
    var combo = document.getElementById(comboId);
    if(combo != null)
    {
        var textbox = document.getElementById(textBoxId);
        if(textbox != null)
        {
            textbox.value = "";
            if(combo.value == "1" || combo.value == "2" || combo.value == "5" || combo.value == "6")
            {
                textbox.maxLength = 16;
            }
            else if(combo.value == "3")
            {
                textbox.maxLength = 15;
            }
            else if(combo.value == "4")
            {
                textbox.maxLength = 14;
            }
        }
    }
}
