// from dabrook.org
$(document).ready(function() 
{     
    var total = 0; 
     
    function calcTotal() 
    { 
        $("input:checked").each(function() 
        { 
            //This happens for each checked input field 
            var value = $(this).attr("value"); 
            total += parseInt(value);  
        }); 
    } 
 
    //This happens when the page loads 
    calcTotal();
    $("fieldset").after('<p class="total">Total: <strong>$' + total + '</strong></p>');
         
    $("input:checkbox").click(function() 
    { 
        total = 0; 
        calcTotal(); 
        $("p.total").html("Total: <strong>$" + total + "</strong>");
		$("input.amt").attr('value', total);
    }); 

});