﻿// JScript File
function toggleMemberStatus() {
	if($('rbMemberStatus_0').checked){
		$('lCost_0').innerHTML = '$150.00';
		$('lCost_1').innerHTML = '$125.00';
		$('lCost_2').innerHTML = '$60.00';
		$('lCost_3').innerHTML = '$0.00';
		$('lCost_4').innerHTML = '$0.00';
		//$('lCost_5').innerHTML = '$35.00';
	} else {
		$('lCost_0').innerHTML = '$100.00';
		$('lCost_1').innerHTML = '$83.00';
		$('lCost_2').innerHTML = '$40.00';
		$('lCost_3').innerHTML = 'n/a';
		$('lCost_4').innerHTML = 'n/a';
		//$('lCost_5').innerHTML = '$35.00';
	}
	
	if($('rbBarType_0').checked){selectBarType(0);}
	if($('rbBarType_1').checked){selectBarType(1);}
	if($('rbBarType_2').checked){selectBarType(2);}
	if($('rbBarType_3').checked){selectBarType(3);}
	if($('rbBarType_4').checked){selectBarType(4);}
	//if($('rbBarType_5').checked){selectBarType(5);}
}

function selectBarType(id){

	var intContribution = getContribution();
	var intCost = parseNumber($('lCost_' + id).innerHTML, 2);
	
	if(intContribution > 0){
		$('txtContribution').value = '$' + CommaFormatted(formatNumber(intContribution,2));
	} else {
		$('txtContribution').value = '$' + CommaFormatted(formatNumber(parseNumber($('txtContribution').value, 2),2));
	}
	
	$('lTotalCost').innerHTML = '$' + CommaFormatted(formatNumber((intCost + intContribution),2));
	
	$('amount_1').value = intCost;
	$('amount_2').value = intContribution;
	$('total').value = $('lTotalCost').innerHTML;
	
	if($('rbMemberStatus_0').checked){
	$('item_name').value = 'Registration - ' + $('lMemberStatus_0').innerHTML + ' - ' + $('lBarType_' + id).innerHTML
	} else if($('rbMemberStatus_1').checked) {
	$('item_name').value = 'Registration - ' + $('lMemberStatus_1').innerHTML + ' - ' + $('lBarType_' + id).innerHTML
	}
}

function getContribution(){
	if($('cbContribution').checked){
		return parseNumber($('txtContribution').value, 2);
	} else {
		return 0;
	}
}