Hi there

I have a few js calculations for my html form in my page. (I am using wordpress). All the calculations work etc, but now I would like to copy the code for the next days (it is a conference quotation which can include a calculation for each day). Is there perhaps a better solution to this rather than copying my calculation over and over and just changing the field names ? eg changing to "form.halfday2.value" and "form.halfday3.value" etc

I do not expect anyone to do this for me, I would just like to know whether or not there is a better solution that copying the calculations code for each field

Code:
function doTotal(form) {
    var a = (+form.halfday1.value);
    var b = (+form.fullday1.value);
    var c = (+form.SingleRooms1.value);
    var d = (+form.DoubleRooms1.value);
    


    form.total1.value = (a * 240) + (b* 260) + (+ form.MenuPrice1.value *  form.MealPersons1.value) + (c * 480) + (d * 720) ;
}


var prices = [
    {
        values: [1,2,3,4,5,6,7],
        price: 70
    },
    {
        values: [8,9,10,12],
        price: 85
    },
    {
        values: [11],
        price: 105
    }
];

function calcMenu(form)
{
    var i, searchValue = parseInt(form.MenuNo1.value);
    form.MenuPrice1.value = '';

    for (i in prices)
    {
        if (jQuery.inArray(searchValue, prices[i].values) != -1)
        {
            form.MenuPrice1.value = prices[i].price;
        }
    }
}

function formReset()
{
document.getElementById("quote").reset();
}