function ff_psc_amount_validation(element, message)
{
    ff_psc_calculate();
    if (ff_getElementByName('psc_custom_regular').value == '' &&
        ff_getElementByName('psc_custom_large').value == '') {
        ff_validationFocus('psc_custom_regular');
        return message;
    } // if
    return '';
} // ff_psc_amount_validation

function ff_psc_calculate()
{
    var amount = 0;
    var order;
    var count = 0;

    // add base amout of regular size
    order = ff_getElementByName('psc_custom_regular').value;
    if (order != '') {
        order = parseInt(order);
        count += order;
        amount += order * 5.99;
    } // if
 
    // add base amount of large size
    order = ff_getElementByName('psc_custom_large').value;
    if (order != '') {
        order = parseInt(order);
        count += order;
        amount += order * 8.99;
    }

    // count number of adds
    var adds = 0;
    for (var i = 0; i < ff_elements.length; i++)
        if (ff_elements[i][2]=='psc_adds') 
            if (ff_getElementByIndex(i).checked) adds++;
    amount += count * adds * 0.49;

    // show result
    ff_getElementByName('psc_amount').value = Math.round(amount*100)/100;
} // ff_psc_calculate