// JavaScript Document
$(document).ready(function()
{	
	//var total = $('input[name=sizeprice]:checked').attr('value');
	var total = 0;
	var size = ""; 
	var desc="";
	var price = 0;

	
	function calcTotal()
	{
		$("input[name$='sizeprice']").click(function()
		{
			//This happens for each checked input field
			var bigvar = $('input[name=sizeprice]:checked').val();
			var fsize = bigvar.split("-");
			size = fsize[0];
			desc1 = fsize[1];
			desc2 = fsize[2];
			desc = desc1 + "-" + desc2;
			price = parseFloat(fsize[3]);
			total = price; 
		});
	}

	//This happens when the page loads
	calcTotal();	
		
	$("input:checkbox, input:radio").click(function()
	{
		//total = $('input[name=sizeprice]:checked').attr('value');
		//var bigvar = $('input[name=sizeprice]:checked').attr('value');
		//total=0;
		calcTotal();
		$("#total").html('<table class="ShowOrder" cellpadding="2" cellspacing="0"><tr><th align="center" colspan="3">Your Order So Far</th></th><tr><th>' + size + '</th><th>' + desc + '</td><th>$'+ total.toFixed(2) + '</th></tr></table>')
		
	});
});/**/
