function validate()
{
    if (!isNaturalNumber(document.single.d, " for the Dividend expected a year."))
    {
        return false;
    }

    if (!isNaturalNumber(document.single.p1, " for the Price expected a year hence."))
    {
        return false;
    }

    if (!isValueInRange(document.single.r, 1, 100, " for the Rate of return on the equity share."))
    {
        return false;
    }

    return true;
}

function calc()
{
    var a1 = parseFloat(document.single.d.value);
    var a2 = parseFloat(document.single.p1.value);
    var a3 = parseFloat(document.single.r.value)/100;
    var t2 = [(a1 / (1 + a3)) + (a2 /(1 + a3))];
    document.single.po.value = round(t2, 2);
}

function clean()
{
    document.single.d.value = "";
    document.single.p1.value = "";
    document.single.r.value = "";
    document.single.po.value = "";
}
