function calc()
{
    var capital = parseFloat(document.getElementById("calc_capital").value);
    var rate = parseFloat(document.getElementById("calc_rate").value);
    var period = document.getElementById("calc_period").value;
    var total = capital;
    var periods = 0;
    if(period == "Daily")
        periods = 365;
    else if(period == "Weekly")
        periods = 52;
    else if(period == "Monthly")
        periods = 12;
    for(var i = 0; i < periods; i ++)
        total = total + (total * parseFloat(rate) / 100);
    alert("Balance after 1 year: $" + Math.round(total));
}