/*** Setup Total Value variable ***/
var giftCardTotal = 0.00;
var giftCardGrandTotal = 3.00;
var oldGCustomAmt = 0.00;

function textLimit(field, maxlen) {	
	if (field.value.length > maxlen)
		field.value = field.value.substring(0, maxlen);
} 

$(document).ready(function(){	
	$("#ojas_giftform")[0].reset();
/*** SETUP JQUERY TOGGLES/IMAGE REPLACEMENTS FOR GIFT CARD DIVS ***/
	$("#ojas_dollar").toggle(
			function(){ 
				 $('#ojas_dollar_exp').show('slow');
				 $('#ojas_dollar_img').attr('src','assets/interior-pages/gift/gift-button-dollar-on.gif');
			}, function() { 
				 $('#ojas_dollar_exp').hide('slow');
				 $('#ojas_dollar_img').attr('src','assets/interior-pages/gift/gift-button-dollar-off.gif');
	});
	$("#ojas_dgp").toggle(
			function(){ 
				 $('#ojas_dgp_exp').show('slow');
				 $('#ojas_dgp_img').attr('src','assets/interior-pages/gift/gift-button-package-on.gif');
			}, function() { 
				 $('#ojas_dgp_exp').hide('slow');
				 $('#ojas_dgp_img').attr('src','assets/interior-pages/gift/gift-button-package-off.gif');
	});
	$("#ojas_massage").toggle(
			function(){ 
				 $('#ojas_massage_exp').show('slow');
				 $('#ojas_massage_img').attr('src','assets/interior-pages/gift/gift-button-massage-on.gif');
			}, function() { 
				 $('#ojas_massage_exp').hide('slow');
				 $('#ojas_massage_img').attr('src','assets/interior-pages/gift/gift-button-massage-off.gif');
	});
	$("#ojas_facial").toggle(
			function(){ 
				 $('#ojas_facial_exp').show('slow');
				 $('#ojas_facial_img').attr('src','assets/interior-pages/gift/gift-button-facial-on.gif');
			}, function() { 
				 $('#ojas_facial_exp').hide('slow');
				 $('#ojas_facial_img').attr('src','assets/interior-pages/gift/gift-button-facial-off.gif');
	});
	$("#ojas_yoga").toggle(
			function(){ 
				 $('#ojas_yoga_exp').show('slow');
				 $('#ojas_yoga_img').attr('src','assets/interior-pages/gift/gift-button-class-on.gif');
			}, function() { 
				 $('#ojas_yoga_exp').hide('slow');
				 $('#ojas_yoga_img').attr('src','assets/interior-pages/gift/gift-button-class-off.gif');
	});
	$("#ojas_equip_pilates").toggle(
			function(){ 
				 $('#ojas_equip_pilates_exp').show('slow');
				 $('#ojas_equip_pilates_img').attr('src','assets/interior-pages/gift/gift-button-equip-on.gif');
			}, function() { 
				 $('#ojas_equip_pilates_exp').hide('slow');
				 $('#ojas_equip_pilates_img').attr('src','assets/interior-pages/gift/gift-button-equip-off.gif');
	});
	$("#ojas_acupuncture").toggle(
			function(){ 
				 $('#ojas_acupuncture_exp').show('slow');
				 $('#ojas_acupuncture_img').attr('src','assets/interior-pages/gift/gift-button-acu-on.gif');
			}, function() { 
				 $('#ojas_acupuncture_exp').hide('slow');
				 $('#ojas_acupuncture_img').attr('src','assets/interior-pages/gift/gift-button-acu-off.gif');
	});
	$("#ojas_wellpass").toggle(
			function(){ 
				 $('#ojas_wellpass_exp').show('slow');
				 $('#ojas_wellpass_img').attr('src','assets/interior-pages/gift/gift-button-wellpass-on.gif');
			}, function() { 
				 $('#ojas_wellpass_exp').hide('slow');
				 $('#ojas_wellpass_img').attr('src','assets/interior-pages/gift/gift-button-wellpass-off.gif');
	});
	
	
/*** SETUP FORM VALIDATION ***/
	$.validator.addMethod(
		"notExpiredMonth",
		function(value, element) {
			var d = new Date();		
			var cy = document.ojas_giftform.exp_year.value;
			if (cy > d.getFullYear()) 
				return true;
			else {
				var m = parseInt(value,10) - 1;
				return m > d.getMonth();
			}
		},
		"Card has expired"
	);
	$.validator.addMethod(
		"notExpiredYear",
		function(value, element) {
			var d = new Date();	
			var x = document.getElementsByTagName("label"); 
			var mObj = null;
			for (i=0;i<=x.length;i++) {
				if (x[i] != null)
					if (x[i].getAttribute("for") == "exp_month")
						mObj = x[i];						
			}
			if (value >= d.getFullYear() && mObj != null) {
				if (value > d.getFullYear()) {
					document.ojas_giftform.exp_month.className = "";
					mObj.setAttribute("style","display:none");
				}
				else {						
					var m = parseInt(document.ojas_giftform.exp_month.value,10) - 1;
					if (m > d.getMonth()) {
						document.ojas_giftform.exp_month.className = "";
						mObj.setAttribute("style","display:none");
					}
					else {
						document.ojas_giftform.exp_month.className = "error";
						mObj.setAttribute("style","");
					}
				}
				return true;
			}
			else {
				document.ojas_giftform.exp_month.className = "error";
				return true;
			}
		},
		"Card has expired"
	);

	$("#ojas_giftform").validate({
	   rules: {		 
		 buy_email: {
			 required: true,
			 email: true
		 }, 	
		 confirm_email: {
			 required: true,
			 equalTo: "#buy_email"
		 },
		 card_number: {
		   required: true,
		   creditcard: true		   
		 },
		 recipient_zip: {
			 required: true,
			 digits: true,
			 minlength: 5			 
		 },
		 billing_zip: {
			 required: true,
			 digits: true,
			 minlength: 5			 
		 },
		 security: {
			 required: true,
			 digits: true
		 },
		 how_heard: {
			 required: true
		 },
		 exp_month: {
			 notExpiredMonth: true
		 },
		 exp_year: {
			 notExpiredYear: true
		 },
		 gift_custom_box: {
			  required: "#gift_custom_amount:filled"
		 },
		 gift_custom_amount: {
			  required: "#gift_custom_box:checked"
		 }		
	   },
	   messages: {
	   	 creditcard: {
			 creditcard: "No spaces or dashes in card number"
		 }		 
	   },
	   submitHandler: function(form) {			
			ojas_giftcardsubmit();
			form.submit();
		}
	});
	
	$("#gift_custom_box").click(function() {
	  $("#gift_custom_amount").valid();
	  $('#gift_custom_amount')[0].focus(); 
	});
		
/*** Setup Sub & Grand Total ajax spans ***/
	$('#sub_total').html("0.00");
	$('#grand_total').html("3.00");

/*** Process values when checked/entered ***/
	setupValueChanges(); // Helper function to keep all those click/check functions separate
		
});

function ojas_giftcardsubmit() {
	$('#ojas_total_gift_value').val(giftCardGrandTotal);
}

function setupValueChanges() {
/*** Dollar Amount ***/
	$('#gift_100').click(function() {
	  if ($('#gift_100').is(':checked')) {
		  giftCardTotal += 100.00;
		  giftCardGrandTotal += 100.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 100.00;
		  giftCardGrandTotal -= 100.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	$('#gift_150').click(function() {
	  if ($('#gift_150').is(':checked')) {
		  giftCardTotal += 150.00;
		  giftCardGrandTotal += 150.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 150.00;
		  giftCardGrandTotal -= 150.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	// Gift Card Custom Amount
	$('#gift_custom_box').change(function() {
      // Set temp vars to capture old values
	  oldGCustomAmt = $('#gift_custom_amount').val();
	  if (oldGCustomAmt == "")
		  oldGCustomAmt = 0;  										  
	  if ($('#gift_custom_box').is(':checked')) {
		  giftCardTotal += parseFloat(oldGCustomAmt,10);
		  giftCardGrandTotal += parseFloat(oldGCustomAmt,10);
	  }
	  else {
		  giftCardTotal -= oldGCustomAmt;
		  giftCardGrandTotal -= oldGCustomAmt;
		 
	  }
      if (giftCardTotal == 0)
		$('#sub_total').html("0.00");
	  else
		$('#sub_total').html(giftCardTotal.toFixed(2));
	  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
    });
	$('#gift_custom_amount').click(function() {							
	  // Set temp vars to capture old values
	  oldGCustomAmt = $('#gift_custom_amount').val();
	  if (oldGCustomAmt == "")
		  oldGCustomAmt = 0;      
    });
	$('#gift_custom_amount').focus(function() {						
	  // Set temp vars to capture old values
	  oldGCustomAmt = $('#gift_custom_amount').val();
	  if (oldGCustomAmt == "")
		  oldGCustomAmt = 0;      
    });
	$('#gift_custom_amount').blur(function() {	
      if ($('#gift_custom_box').is(':checked')) {											 
		  if ($('#gift_custom_amount').val() == "") {
			  if (oldGCustomAmt != 0) {
				  giftCardTotal -= oldGCustomAmt * 1.00;
				  giftCardGrandTotal -= oldGCustomAmt * 1.00;
			  }
		  }
		  else {		  
			  giftCardTotal += $('#gift_custom_amount').val() * 1.00;
			  giftCardGrandTotal += $('#gift_custom_amount').val() * 1.00;		  
			  giftCardTotal -= oldGCustomAmt * 1.00;
			  giftCardGrandTotal -= oldGCustomAmt * 1.00;		
		  }
		  if (giftCardTotal == 0)
			$('#sub_total').html("0.00");
		  else
			$('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});
	
/*** Discount Gift Package ***/
	$('#PAC_Inspiration').click(function() {
	  if ($('#PAC_Inspiration').is(':checked')) {
		  giftCardTotal += 149.00;
		  giftCardGrandTotal += 149.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 149.00;
		  giftCardGrandTotal -= 149.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	$('#PAC_Tranquility').click(function() {
	  if ($('#PAC_Tranquility').is(':checked')) {
		  giftCardTotal += 149.00;
		  giftCardGrandTotal += 149.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 149.00;
		  giftCardGrandTotal -= 149.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	$('#PAC_Surrender').click(function() {
	  if ($('#PAC_Surrender').is(':checked')) {
		  giftCardTotal += 199.00;
		  giftCardGrandTotal += 199.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 199.00;
		  giftCardGrandTotal -= 199.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	$('#PAC_Balance').click(function() {
	  if ($('#PAC_Balance').is(':checked')) {
		  giftCardTotal += 199.00;
		  giftCardGrandTotal += 199.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 199.00;
		  giftCardGrandTotal -= 199.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	$('#PAC_Stress_Relief').click(function() {
	  if ($('#PAC_Stress_Relief').is(':checked')) {
		  giftCardTotal += 249.00;
		  giftCardGrandTotal += 249.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 249.00;
		  giftCardGrandTotal -= 249.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	
/*** Massage ***/
	// 60 Min Intro
	$('#MAS_Intro_Massage').click(function() {
	  if ($('#MAS_Intro_Massage').is(':checked')) {
		  giftCardTotal += 60.00;
		  giftCardGrandTotal += 60.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 60.00;
		  giftCardGrandTotal -= 60.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	// 90 Min Intro Massage
	$('#MAS_Intro_90_Massage').click(function() {
	  if ($('#MAS_Intro_90_Massage').is(':checked')) {
		  giftCardTotal += 85.00;
		  giftCardGrandTotal += 85.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 85.00;
		  giftCardGrandTotal -= 85.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	// 60 Min Custom
	$('#MAS_60_Min_Custom').click(function() {	
	  // Set temp vars to capture old values
	  oldMas60Custom = $('#MAS_60_Min_Custom').val();
	  if (oldMas60Custom == "")
		  oldMas60Custom = 0;
    });
	$('#MAS_60_Min_Custom').change(function() {	
	  if ($('#MAS_60_Min_Custom').val() == "") {
		  if (oldMas60Custom != 0) {
			  giftCardTotal -= oldMas60Custom * 90.00;
			  giftCardGrandTotal -= oldMas60Custom * 90.00;
		  }
	  }
	  else {		  
		  giftCardTotal += $('#MAS_60_Min_Custom').val() * 90.00;
		  giftCardGrandTotal += $('#MAS_60_Min_Custom').val() * 90.00;		  
		  giftCardTotal -= oldMas60Custom * 90.00;
		  giftCardGrandTotal -= oldMas60Custom * 90.00;		
	  }
	  if (giftCardTotal == 0)
		$('#sub_total').html("0.00");
	  else
		$('#sub_total').html(giftCardTotal.toFixed(2));
	  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	});
	// 60 Min Ojas
	$('#MAS_60_Min_Ojas').click(function() {	
	  // Set temp vars to capture old values
	  oldMas60Ojas = $('#MAS_60_Min_Ojas').val();
	  if (oldMas60Ojas == "")
		  oldMas60Ojas = 0;
    });
	$('#MAS_60_Min_Ojas').change(function() {	
	  if ($('#MAS_60_Min_Ojas').val() == "") {
		  if (oldMas60Ojas != 0) {
			  giftCardTotal -= oldMas60Ojas * 95.00;
			  giftCardGrandTotal -= oldMas60Ojas * 95.00;
		  }
	  }
	  else {		  
		  giftCardTotal += $('#MAS_60_Min_Ojas').val() * 95.00;
		  giftCardGrandTotal += $('#MAS_60_Min_Ojas').val() * 95.00;		  
		  giftCardTotal -= oldMas60Ojas * 95.00;
		  giftCardGrandTotal -= oldMas60Ojas * 95.00;		
	  }
	  if (giftCardTotal == 0)
		$('#sub_total').html("0.00");
	  else
		$('#sub_total').html(giftCardTotal.toFixed(2));
	  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	});
	// 60 Min Preg
	$('#MAS_60_Min_Preg').click(function() {	
	  // Set temp vars to capture old values
	  oldMas60Preg = $('#MAS_60_Min_Preg').val();
	  if (oldMas60Preg == "")
		  oldMas60Preg = 0;
    });
	$('#MAS_60_Min_Preg').change(function() {	
	  if ($('#MAS_60_Min_Preg').val() == "") {
		  if (oldMas60Preg != 0) {
			  giftCardTotal -= oldMas60Preg * 90.00;
			  giftCardGrandTotal -= oldMas60Preg * 90.00;
		  }
	  }
	  else {		  
		  giftCardTotal += $('#MAS_60_Min_Preg').val() * 90.00;
		  giftCardGrandTotal += $('#MAS_60_Min_Preg').val() * 90.00;		  
		  giftCardTotal -= oldMas60Preg * 90.00;
		  giftCardGrandTotal -= oldMas60Preg * 90.00;		
	  }
	  if (giftCardTotal == 0)
		$('#sub_total').html("0.00");
	  else
		$('#sub_total').html(giftCardTotal.toFixed(2));
	  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	});
	// 90 Min Custom
	$('#MAS_90_Min_Custom').click(function() {	
	  // Set temp vars to capture old values
	  oldMas90Custom = $('#MAS_90_Min_Custom').val();
	  if (oldMas90Custom == "")
		  oldMas90Custom = 0;
    });
	$('#MAS_90_Min_Custom').change(function() {	
	  if ($('#MAS_90_Min_Custom').val() == "") {
		  if (oldMas90Custom != 0) {
			  giftCardTotal -= oldMas90Custom * 115.00;
			  giftCardGrandTotal -= oldMas90Custom * 115.00;
		  }
	  }
	  else {		  
		  giftCardTotal += $('#MAS_90_Min_Custom').val() * 115.00;
		  giftCardGrandTotal += $('#MAS_90_Min_Custom').val() * 115.00;		  
		  giftCardTotal -= oldMas90Custom * 115.00;
		  giftCardGrandTotal -= oldMas90Custom * 115.00;		
	  }
	  if (giftCardTotal == 0)
		$('#sub_total').html("0.00");
	  else
		$('#sub_total').html(giftCardTotal.toFixed(2));
	  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	});
	// 90 Min Ojas
	$('#MAS_90_Min_Ojas').click(function() {	
	  // Set temp vars to capture old values
	  oldMas90Ojas = $('#MAS_90_Min_Ojas').val();
	  if (oldMas90Ojas == "")
		  oldMas90Ojas = 0;
    });
	$('#MAS_90_Min_Ojas').change(function() {	
	  if ($('#MAS_90_Min_Ojas').val() == "") {
		  if (oldMas90Ojas != 0) {
			  giftCardTotal -= oldMas90Ojas * 120.00;
			  giftCardGrandTotal -= oldMas90Ojas * 120.00;
		  }
	  }
	  else {		  
		  giftCardTotal += $('#MAS_90_Min_Ojas').val() * 120.00;
		  giftCardGrandTotal += $('#MAS_90_Min_Ojas').val() * 120.00;		  
		  giftCardTotal -= oldMas90Ojas * 120.00;
		  giftCardGrandTotal -= oldMas90Ojas * 120.00;		
	  }
	  if (giftCardTotal == 0)
		$('#sub_total').html("0.00");
	  else
		$('#sub_total').html(giftCardTotal.toFixed(2));
	  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	});
	// 90 Min Preg
	$('#MAS_90_Min_Preg').click(function() {	
	  // Set temp vars to capture old values
	  oldMas90Preg = $('#MAS_90_Min_Preg').val();
	  if (oldMas90Preg == "")
		  oldMas90Preg = 0;
    });
	$('#MAS_90_Min_Preg').change(function() {	
	  if ($('#MAS_90_Min_Preg').val() == "") {
		  if (oldMas90Preg != 0) {
			  giftCardTotal -= oldMas90Preg * 115.00;
			  giftCardGrandTotal -= oldMas90Preg * 115.00;
		  }
	  }
	  else {		  
		  giftCardTotal += $('#MAS_90_Min_Preg').val() * 115.00;
		  giftCardGrandTotal += $('#MAS_90_Min_Preg').val() * 115.00;		  
		  giftCardTotal -= oldMas90Preg * 115.00;
		  giftCardGrandTotal -= oldMas90Preg * 115.00;		
	  }
	  if (giftCardTotal == 0)
		$('#sub_total').html("0.00");
	  else
		$('#sub_total').html(giftCardTotal.toFixed(2));
	  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	});
	
/*** Organic Facial ***/
	$('#FAC_Intro_Facial').click(function() {
	  if ($('#FAC_Intro_Facial').is(':checked')) {
		  giftCardTotal += 80.00;
		  giftCardGrandTotal += 80.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 80.00;
		  giftCardGrandTotal -= 80.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	// 45 Min Facial
	$('#FAC_45_Min').click(function() {	
	  // Set temp vars to capture old values
	  oldFac45Min = $('#FAC_45_Min').val();
	  if (oldFac45Min == "")
		  oldFac45Min = 0;
    });
	$('#FAC_45_Min').change(function() {	
	  if ($('#FAC_45_Min').val() == "") {
		  if (oldFac45Min != 0) {
			  giftCardTotal -= oldFac45Min * 80.00;
			  giftCardGrandTotal -= oldFac45Min * 80.00;
		  }
	  }
	  else {		  
		  giftCardTotal += $('#FAC_45_Min').val() * 80.00;
		  giftCardGrandTotal += $('#FAC_45_Min').val() * 80.00;		  
		  giftCardTotal -= oldFac45Min * 80.00;
		  giftCardGrandTotal -= oldFac45Min * 80.00;		
	  }
	  if (giftCardTotal == 0)
		$('#sub_total').html("0.00");
	  else
		$('#sub_total').html(giftCardTotal.toFixed(2));
	  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	});
	// 60 Min Facial
	$('#FAC_60_Min').click(function() {	
	  // Set temp vars to capture old values
	  oldFac60Min = $('#FAC_60_Min').val();
	  if (oldFac60Min == "")
		  oldFac60Min = 0;
    });
	$('#FAC_60_Min').change(function() {	
	  if ($('#FAC_60_Min').val() == "") {
		  if (oldFac60Min != 0) {
			  giftCardTotal -= oldFac60Min * 100.00;
			  giftCardGrandTotal -= oldFac60Min * 100.00;
		  }
	  }
	  else {		  
		  giftCardTotal += $('#FAC_60_Min').val() * 100.00;
		  giftCardGrandTotal += $('#FAC_60_Min').val() * 100.00;		  
		  giftCardTotal -= oldFac60Min * 100.00;
		  giftCardGrandTotal -= oldFac60Min * 100.00;		
	  }
	  if (giftCardTotal == 0)
		$('#sub_total').html("0.00");
	  else
		$('#sub_total').html(giftCardTotal.toFixed(2));
	  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	});
	
/*** Yoga or Mat Pilates ***/
	$('#YOG_Intro_Card').click(function() {
	  if ($('#YOG_Intro_Card').is(':checked')) {
		  giftCardTotal += 10.00;
		  giftCardGrandTotal += 10.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 10.00;
		  giftCardGrandTotal -= 10.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	$('#YOG_5_Class_Card').click(function() {
	  if ($('#YOG_5_Class_Card').is(':checked')) {
		  giftCardTotal += 80.00;
		  giftCardGrandTotal += 80.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 80.00;
		  giftCardGrandTotal -= 80.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	$('#YOG_10_Class_Card').click(function() {
	  if ($('#YOG_10_Class_Card').is(':checked')) {
		  giftCardTotal += 140.00;
		  giftCardGrandTotal += 140.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 140.00;
		  giftCardGrandTotal -= 140.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	$('#YOG_20_Class_Card').click(function() {
	  if ($('#YOG_20_Class_Card').is(':checked')) {
		  giftCardTotal += 240.00;
		  giftCardGrandTotal += 240.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 240.00;
		  giftCardGrandTotal -= 240.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	$('#YOG_Intro_Private').click(function() {
	  if ($('#YOG_Intro_Private').is(':checked')) {
		  giftCardTotal += 50.00;
		  giftCardGrandTotal += 50.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 50.00;
		  giftCardGrandTotal -= 50.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	// 60 Min Yoga Private Sessions
	$('#YOG_60_Min_Private').click(function() {	
	  // Set temp vars to capture old values
	  oldYoga60Min = $('#YOG_60_Min_Private').val();
	  if (oldYoga60Min == "")
		  oldYoga60Min = 0;
    });
	$('#YOG_60_Min_Private').change(function() {	
	  if ($('#YOG_60_Min_Private').val() == "") {
		  if (oldYoga60Min != 0) {
			  giftCardTotal -= oldYoga60Min * 80.00;
			  giftCardGrandTotal -= oldYoga60Min * 80.00;
		  }
	  }
	  else {		  
		  giftCardTotal += $('#YOG_60_Min_Private').val() * 80.00;
		  giftCardGrandTotal += $('#YOG_60_Min_Private').val() * 80.00;		  
		  giftCardTotal -= oldYoga60Min * 80.00;
		  giftCardGrandTotal -= oldYoga60Min * 80.00;		
	  }
	  if (giftCardTotal == 0)
		$('#sub_total').html("0.00");
	  else
		$('#sub_total').html(giftCardTotal.toFixed(2));
	  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	});
	
/*** Equipment Pilates ***/
	$('#EQU_Intro').click(function() {
	  if ($('#EQU_Intro').is(':checked')) {
		  giftCardTotal += 60.00;
		  giftCardGrandTotal += 60.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 60.00;
		  giftCardGrandTotal -= 60.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	/*$('#EQU_5_Class').click(function() {
	  if ($('#EQU_5_Class').is(':checked')) {
		  giftCardTotal += 200.00;
		  giftCardGrandTotal += 200.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 200.00;
		  giftCardGrandTotal -= 200.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	
	$('#EQU_10_Class').click(function() {
	  if ($('#EQU_10_Class').is(':checked')) {
		  giftCardTotal += 350.00;
		  giftCardGrandTotal += 350.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 350.00;
		  giftCardGrandTotal -= 350.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});	*/
	// Drop In Card
	$('#EQU_Drop_Class').click(function() {	
	  // Set temp vars to capture old values
	  oldPilatesDropClass = $('#EQU_Drop_Class').val();
	  if (oldPilatesDropClass == "")
		  oldPilatesDropClass = 0;
    });
	$('#EQU_Drop_Class').change(function() {	
	  if ($('#EQU_Drop_Class').val() == "") {
		  if (oldPilatesDropClass != 0) {
			  giftCardTotal -= oldPilatesDropClass * 45.00;
			  giftCardGrandTotal -= oldPilatesDropClass * 45.00;
		  }
	  }
	  else {		  
		  giftCardTotal += $('#EQU_Drop_Class').val() * 45.00;
		  giftCardGrandTotal += $('#EQU_Drop_Class').val() * 45.00;		  
		  giftCardTotal -= oldPilatesDropClass * 45.00;
		  giftCardGrandTotal -= oldPilatesDropClass * 45.00;		
	  }
	  if (giftCardTotal == 0)
		$('#sub_total').html("0.00");
	  else
		$('#sub_total').html(giftCardTotal.toFixed(2));
	  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	});
	// 60 Min Equip Pilates Private Sessions
	$('#EQU_60_Min').click(function() {	
	  // Set temp vars to capture old values
	  oldPilates60Min = $('#EQU_60_Min').val();
	  if (oldPilates60Min == "")
		  oldPilates60Min = 0;
    });
	$('#EQU_60_Min').change(function() {	
	  if ($('#EQU_60_Min').val() == "") {
		  if (oldPilates60Min != 0) {
			  giftCardTotal -= oldPilates60Min * 85.00;
			  giftCardGrandTotal -= oldPilates60Min * 85.00;
		  }
	  }
	  else {		  
		  giftCardTotal += $('#EQU_60_Min').val() * 85.00;
		  giftCardGrandTotal += $('#EQU_60_Min').val() * 85.00;		  
		  giftCardTotal -= oldPilates60Min * 85.00;
		  giftCardGrandTotal -= oldPilates60Min * 85.00;		
	  }
	  if (giftCardTotal == 0)
		$('#sub_total').html("0.00");
	  else
		$('#sub_total').html(giftCardTotal.toFixed(2));
	  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	});
	
/*** Acupuncture ***/
	$('#ACU_Intro_Consultation').click(function() {
	  if ($('#ACU_Intro_Consultation').is(':checked')) {
		  giftCardTotal += 175.00;
		  giftCardGrandTotal += 175.00;
		  $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	  else {
		  giftCardTotal -= 175.00;
		  giftCardGrandTotal -= 175.00;
		  if (giftCardTotal == 0)
		  	$('#sub_total').html("0.00");
		  else
	        $('#sub_total').html(giftCardTotal.toFixed(2));
		  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	  }
	});
	
/*** WellPass ***/
	// 90 Min Wellpass
	$('#MAS_90_Min_Wellpass').click(function() {	
	  // Set temp vars to capture old values
	  oldWellpass90Ojas = $('#MAS_90_Min_Wellpass').val();
	  if (oldWellpass90Ojas == "")
		  oldWellpass90Ojas = 0;
    });
	$('#MAS_90_Min_Wellpass').change(function() {	
	  if ($('#MAS_90_Min_Wellpass').val() == "") {
		  if (oldWellpass90Ojas != 0) {
			  giftCardTotal -= oldWellpass90Ojas * 25.00;
			  giftCardGrandTotal -= oldWellpass90Ojas * 25.00;
		  }
	  }
	  else {		  
		  giftCardTotal += $('#MAS_90_Min_Wellpass').val() * 25.00;
		  giftCardGrandTotal += $('#MAS_90_Min_Wellpass').val() * 25.00;		  
		  giftCardTotal -= oldWellpass90Ojas * 25.00;
		  giftCardGrandTotal -= oldWellpass90Ojas * 25.00;		
	  }
	  if (giftCardTotal == 0)
		$('#sub_total').html("0.00");
	  else
		$('#sub_total').html(giftCardTotal.toFixed(2));
	  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	});
	
	// 60 Min Wellpass
	$('#MAS_60_Min_Wellpass').click(function() {	
	  // Set temp vars to capture old values
	  oldWellpass60Ojas = $('#MAS_60_Min_Wellpass').val();
	  if (oldWellpass60Ojas == "")
		  oldWellpass60Ojas = 0;
    });
	$('#MAS_60_Min_Wellpass').change(function() {	
	  if ($('#MAS_60_Min_Wellpass').val() == "") {
		  if (oldWellpass60Ojas != 0) {
			  giftCardTotal -= oldWellpass60Ojas * 10.00;
			  giftCardGrandTotal -= oldWellpass60Ojas * 10.00;
		  }
	  }
	  else {		  
		  giftCardTotal += $('#MAS_60_Min_Wellpass').val() * 10.00;
		  giftCardGrandTotal += $('#MAS_60_Min_Wellpass').val() * 10.00;		  
		  giftCardTotal -= oldWellpass60Ojas * 10.00;
		  giftCardGrandTotal -= oldWellpass60Ojas * 10.00;		
	  }
	  if (giftCardTotal == 0)
		$('#sub_total').html("0.00");
	  else
		$('#sub_total').html(giftCardTotal.toFixed(2));
	  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	});
	
	// Extra Wellpass
	$('#MAS_Extra_Wellpass').click(function() {	
	  // Set temp vars to capture old values
	  oldWellpassExtraOjas = $('#MAS_Extra_Wellpass').val();
	  if (oldWellpassExtraOjas == "")
		  oldWellpassExtraOjas = 0;
    });
	$('#MAS_Extra_Wellpass').change(function() {	
	  if ($('#MAS_Extra_Wellpass').val() == "") {
		  if (oldWellpassExtraOjas != 0) {
			  giftCardTotal -= oldWellpassExtraOjas * 70.00;
			  giftCardGrandTotal -= oldWellpassExtraOjas * 70.00;
		  }
	  }
	  else {		  
		  giftCardTotal += $('#MAS_Extra_Wellpass').val() * 70.00;
		  giftCardGrandTotal += $('#MAS_Extra_Wellpass').val() * 70.00;		  
		  giftCardTotal -= oldWellpassExtraOjas * 70.00;
		  giftCardGrandTotal -= oldWellpassExtraOjas * 70.00;		
	  }
	  if (giftCardTotal == 0)
		$('#sub_total').html("0.00");
	  else
		$('#sub_total').html(giftCardTotal.toFixed(2));
	  $('#grand_total').html(giftCardGrandTotal.toFixed(2));
	});
}