<!--
function formatNumber(num) {
    num = parseFloat((Math.round(num *100))/100) 
    return num;
}

function format_currency(amt) {
    // convert the form field value to a Number then multiply it by the float variable
    var amt=(amt-0)*1.00;
    // round the result to 2 decimal places 
    amt=((Math.floor(amt*100))/100); 
    // if we try to display the Number value, no trailing zeroes will be displayed, so we convert to a string; the string is what we'll actually display 
    var amtString=amt+"";
    // split the string using the decimal point as a delimiter 
    var amtStringParts=amtString.split(".");
    // if the resulting array is of length 1, then there's no decimal point, so concatenate ".00" to the end of amtString displaying it 
    if(amtStringParts.length==1) 
      amtString+=".00" 
    // otherwise, if the substring following the decimal is of length 1, pad amtString with a single zero 
    else 
      if(amtStringParts[1].length==1) 
        amtString+="0"; 
    return amtString;
}
function calculate_total () 
{
    var SHRMMember = document.getElementById ( 'member_of_shrm' );
    
    var SHRMNumber = document.getElementById ( 'member_number' );
    
    var shrm_discount = document.getElementById ( 'shrm_discount' );
    
    var membership_dues = document.getElementById ( 'membership_dues' );
    
    var processing_fee = document.getElementById ( 'processing_fee' );
    
    var amount_due = document.getElementById ( 'amount_due' );
    
    if ( !SHRMMember || !SHRMNumber || !shrm_discount || !membership_dues || !processing_fee || !amount_due )
    {
        return false;
    }
    
    if ((SHRMMember.value == "Yes") && (SHRMNumber.value != ""))
    {
        shrm_discount.value = format_currency("10.00");
        total = (formatNumber(membership_dues.value) + formatNumber(processing_fee.value) - formatNumber(shrm_discount.value));
    }
    else
    {
        shrm_discount.value = format_currency("0.00");
        total = (formatNumber(membership_dues.value) + formatNumber(processing_fee.value));
    }

    amount_due.value = format_currency(total);
}

function set_price (price_category)
{
    var membership_dues = document.getElementById ( 'membership_dues' );
    
    if ( !membership_dues )
    {
        return false;
    }
    //global variable defined in user.modify.php 
    price = prices[price_category];


    price = format_currency(price);
    
    membership_dues.value = price;
    
    calculate_total();
}
// -->
