// Check entries in the New Reports Desired field
function check_RptsWanted(fldEntry) {
    var curEntry = fldEntry.AllTrim();
    if (Empty(curEntry))    {
        return '';
    }
    orderQty = parseInt(curEntry.toString());
    price = 0;
    extras = 0;
    for (var i = 0; i < raPrices.length; i++)   {
        if (raPrices[i].Fld1 == orderQty)    {
            price = raPrices[i].Fld2;
            unitPrice = price / orderQty;
            extras = raPrices[i].Fld3;
            break;
        }
    }
    if (!price) {
        return "Please enter only quantities in the Reports column on the right";
    }
    return "";
}

// Verify their order
function finalValids(frmID)   {
    switch(frmID)  {
    case 'frmOrders':
        var fldRpts = document.getElementById("RptsWanted");
        if (Empty(fldRpts.value))   {
            addClass(fldRpts, "chkReqd");
            validateField(fldRpts);
            return false;
        }
        if (price)  {
            var oQty1     = document.getElementById("Qty1");
            var oPrice1   = document.getElementById("Price1");
            oQty1.value   = 1;
            var cPrice    = formatNum(price, 2, false);
            oPrice1.value = cPrice;
            var fld1Chg   = document.getElementById("item_name_1");
            fld1Chg.value = orderQty + " " + itemName + " for $" + cPrice;
            if (extras == 0)    {
                var fld2Chg = document.getElementById("item_name_2");
                fld2Chg.value = "";
                if (!IsPayPal)  {
                    var fld2Chg = document.getElementById("item_description_2");
                    fld2Chg.value = "";
                }
                var fld2Chg = document.getElementById("Qty2");
                fld2Chg.value = "0";
            } else {
                var oQty2 = document.getElementById("Qty2");
                oQty2.value = extras;
            }
        } else {
            validErrCount = validErrCount + 1;
        }
        break;
    case 'frmSubscr':
        var rptType = getRadioGrpValue("rptType");
        var objCustom = getFormsFieldObject("custom", "frmSubscr")
        var customValue = objCustom.value;
        if (rptType == 'P') {
            document.getElementById("item_name").value =
              "Public NSN Monthly Report Subscription";
            document.getElementById("a3").value = "30.00";
            if (customValue.StrAt("FULMON") > 0) {
                objCustom.value = customValue.StrTran("FULMON", "PUBMON");
            }
        } else if (rptType == 'F') {
            document.getElementById("item_name").value =
              "Full NSN Monthly Report Subscription";
            document.getElementById("a3").value = "100.00";
            if (customValue.StrAt("PUBMON") > 0) {
                objCustom.value = customValue.StrTran("PUBMON", "FULMON");
            }
        } else {        // rptType == 'K'
            document.getElementById("item_name").value =
              "Full NSN Monthly Report Subscription";
            document.getElementById("a3").value = "300.00";
            if (customValue.StrAt("PUBMON") > 0) {
                objCustom.value = customValue.StrTran("PUBMON", "FL2MON");
            }
        }
        break;
    }
}

