function showActiveCodes(){
	$('#activeCodes').show('slow');
	$('#completedCodes').hide('slow');
	$('#activeCodesButton').removeClass('matt-button-disabled');
	$('#completedCodesButton').addClass('matt-button-disabled');
	$.cookie('showCompleted', null);
}
function showCompletedCodes(){
	$('#activeCodes').hide('slow');
	$('#completedCodes').show('slow');
	$('#activeCodesButton').addClass('matt-button-disabled');
	$('#completedCodesButton').removeClass('matt-button-disabled');
	$.cookie('showCompleted', '1');
}
function cancelCode(id){
	if(confirm('Are you sure you want to cancel this code?')){
		$('#transactionId').val(id);
		$('#cancelForm').submit();
	}
}
function updateOneOff(){
	var price = $('#oneOffPrice').val();
	var withFees = (price / .971) + .31;
	withFees = withFees.toFixed(2);
	$('#oneOffTotal').html('$' + withFees);
}
function updateMultipleCodes(){
	var price = $('#multipleCodesPrice').val();
	var number = $('#multipleCodesNumber').val();
	if(number == ''){
		number = 1;
	}
	var withFees = (price / .971) + .31;
	withFees = withFees * number;
	withFees = withFees + .01;
	withFees = withFees.toFixed(2);
	$('#multipleCodesTotal').html('$' + withFees);
}
function showCustomClaimCode(){
	$('#customClaimCodeText').hide('slow');
	$('#customClaimCode').show('slow');
}
function updateCode(number){
	$('#transaction' + number).addClass('spinner');
	$('#code' + number).addClass('spinner');
	newcode = $('#claimCode' + number).val();
	$.post("/transactions/update", $("#transaction" + number).serialize(),
		function(data){
			$("#transaction" + number).html(data);
			$('#spinner' + number).hide();
			$('#transaction' + number).show();
			$('#code' + number).html(newcode);
			$('#transaction' + number).removeClass('spinner');
			$('#code' + number).removeClass('spinner');
		}
	);
}
