function validate()
{
    if (!isNaturalNumber(document.byc.c, " for the current price."))
    {
        return false;
    }

    if (!isValueInRange(document.byc.r, 1, 100, " for the Coupon rate."))
    {
        return false;
    }

    if (!isNaturalNumber(document.byc.n, " for the Years to maturity."))
    {
        return false;
    }

    if (!isValueInRange(document.byc.ytm, 1, 100, " for the Yield to maturity."))
    {
        return false;
    }

    return true;
}

function calc1()
{
    var c = document.byc.c.value;
    var p = document.byc.p.value;
    var r = document.byc.r.value;
    var n = document.byc.n.value;
    var y1 = document.byc.ytm.value;
    p = parseFloat((((0.6 * y1 / 100) + 1 / n) * c) / ((r / 100 + 1 / n) - (y1 / 100 * 0.4)));
    document.byc.p.value = round(p, 2);
}

function clean()
{
    document.byc.c.value = "";
    document.byc.p.value = "";
    document.byc.r.value = "";
    document.byc.n.value = "";
    document.byc.ytm.value = "";
}
