$(document).ready(function() {

  $('div.registration-forms:eq(0)> div').hide();
  $('div.registration-forms:eq(0)> h3').click(function() {
    $(this).next('div:hidden').slideDown('fast')
    .siblings('div:visible').slideUp('fast');
  });
  
  
  
  
});

$(document).ready(
		function (){
			// update the plug-in version
			$("#idPluginVersion").text($.Calculation.version);

/*			
			$.Calculation.setDefaults({
				onParseError: function(){
					this.css("backgroundColor", "#cc0000")
				}
				, onParseClear: function (){
					this.css("backgroundColor", "");
				}
			});
*/
			
			
			
			$("input[@name^=ralc_item_]").bind("keyup", ralc);
			// run the calculation function now
			ralc();
			
			// bind the recalc function to the quantity fields
			$("input[@name^=qty_item_]").bind("keyup", recalc);
			// run the calculation function now
			recalc();

			

			

		}
	);
	
	function ralc(){
		$("[@id^=ralct_item]").calc(
			// the equation to use for the calculation
			"qty * price",
			// define the variables used in the equation, these can be a jQuery object
			{
				qty: $("input[@name^=ralc_item_]"),
				price: $("[@id^=ralcp_item_]")
			},
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return "$" + s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[@id^=total_item]") selector
				var sum = $this.sum();
				
				$("#ralcgt").text(
					// round the results to 2 digits
					"$" + sum.toFixed(2)
				);
			}
		);
	}
	
		
	function recalc(){
		$("[@id^=total_item]").calc(
			// the equation to use for the calculation
			"qty * price",
			// define the variables used in the equation, these can be a jQuery object
			{
				qty: $("input[@name^=qty_item_]"),
				price: $("[@id^=price_item_]")
			},
			// define the formatting callback, the results of the calculation are passed to this function
			function (s){
				// return the number as a dollar amount
				return "$" + s.toFixed(2);
			},
			// define the finish callback, this runs after the calculation has been complete
			function ($this){
				// sum the total of the $("[@id^=total_item]") selector
				var sum = $this.sum();
				
				$("#grandTotal").text(
					// round the results to 2 digits
					"$" + sum.toFixed(2)
				);
			}
		);
	}
