$(document).ready(function (){
			$("#basic_qty").change(function(){
				recalc_tree_of_hope();
			});

			$("#crystal_qty").change(function(){
				recalc_tree_of_hope();
			});
			
			if( $("#crystal_qty").length > 0 ) {
				recalc_tree_of_hope();
			};			
			
			$("#adults_qty").change(function(){
				recalc_biketour();
			});

			$("#students_qty").change(function(){
				recalc_biketour();
			});

			$("#seniors_qty").change(function(){
				recalc_biketour();
			});

			$("#additional_amount").change(function(){
				recalc_biketour();
			});

			if( $("#biketour").length > 0 ){
				recalc_biketour();
			}
});

function recalc_tree_of_hope(){
	total = 0;
	
	total = total + ( $("#basic_qty").val() *  $("#basic_price").val());
	total = total + ( $("#crystal_qty").val() *  $("#crystal_price").val());
	
	totalstr = (total).toFixed(2);
	
	$("#total_display").html("Total $ " + totalstr);
	$("#amount").val(total);
	
};


function recalc_biketour()
{

	var iTotal=0;
	var shirtCost = 0;
	
	iTotal += parseInt($("#small_qty").attr("value")) * shirtCost;
	iTotal += parseInt($("#medium_qty").attr("value")) * shirtCost;
	iTotal += parseInt($("#large_qty").attr("value")) * shirtCost;
	iTotal += parseInt($("#xl_qty").attr("value")) * shirtCost;
	
	if( parseInt($("#adults_qty").attr("value")) < 5 ){
		iTotal += parseInt($("#adults_qty").attr("value")) * 35;
	}else{
		iTotal += parseInt($("#adults_qty").attr("value")) * 25;
	}
	iTotal += parseInt($("#students_qty").attr("value")) * 15;
	iTotal += parseInt($("#seniors_qty").attr("value")) * 15;
	
	iTotal += Number($("#additional_amount").attr("value"));
	iTotal = (iTotal).toFixed(2);
	
	$("#amount").attr("value",iTotal);
	
	return true;
}
