function setInvestmentAmount(checkGroup)
{
	var boxy = document.getElementsByName("InvestmentAmount")[0];
	var bitTotal = reCalculateResult();
	if ( (bitTotal & 1) == 1)
	{
		document.CurrentAccounts.InvestmentAmount.value = SCurrentAccount;
	}

	if ( (bitTotal & 2) == 2)
	{
		document.CurrentAccounts.InvestmentAmount.value = SPackagedAccount;
	}

	if ( (bitTotal & 4) == 4)
	{
		document.CurrentAccounts.InvestmentAmount.value = SBasicBankAccount;
	}

	if ( (bitTotal & 8) == 8)
	{
		document.CurrentAccounts.InvestmentAmount.value = SStudentAccount;
	}
	
	if ( (bitTotal & 18) == 18)
	{
		document.CurrentAccounts.InvestmentAmount.value = SGraduateAccount;
	}

	if ( (bitTotal & 32) == 32)
	{
		document.CurrentAccounts.InvestmentAmount.value = SForeignCurrencyAccount;
	}
}

function reCalculateResult()
{
	var Counter = 0;
	if (document.CurrentAccounts.CurrentAccounts.checked) {
		Counter = Counter + 1;
	}
	if (document.CurrentAccounts.Package.checked) {
		Counter = Counter + 2;
	}
	if (document.CurrentAccounts.UniversalAccounts.checked) {
		Counter = Counter + 4;
	}
	if (document.CurrentAccounts.StudentAccounts.checked) {
		Counter = Counter + 8;
	}
	if (document.CurrentAccounts.GraduateAccounts.checked) {
		Counter = Counter + 16;
	}
	if (document.CurrentAccounts.Foreign.checked) {
		Counter = Counter + 32;
	}
	return Counter;
}

function submitCompareCurrentAccountsForm() {
	var counter = 0;
	var check = 0;

    counter += (document.CurrentAccounts.CurrentAccounts.checked) ? 1 : 0;
    counter += (document.CurrentAccounts.UniversalAccounts.checked) ? 2 : 0;
    counter += (document.CurrentAccounts.StudentAccounts.checked) ? 4 : 0;
    counter += (document.CurrentAccounts.GraduateAccounts.checked) ? 8: 0;
    counter += (document.CurrentAccounts.Foreign.checked) ? 16: 0;
    counter += (document.CurrentAccounts.Package.checked) ? 32 : 0;
	
	if (counter == 0) {
		alert("Please select a type of account");
		return false;
		}
	document.CurrentAccounts.Results.value = counter;

	if (!isFieldValidAndFocus(document.CurrentAccounts.InvestmentAmount, 'IntegerAllowNegative', false, 'Typical balance amount'))
	{
		return false;
	}

	return true;
}
