function submitCompareSavingsForm()
{
	var Counter;
	Counter = 0;

	var boxy = document.getElementsByName("InvestmentAmount");
	switch (RadioSelected())
	{
		case "Isa":
			document.CompareSavingsForm.action = "../isap/IsasResults.asp";
			break;

		case "GuaranteedEquity":
			Counter = Counter + 64;
			break;
			
		case "Pensioners":
			Counter = Counter + 128;
			break;
			
		default:
			break;
	}

	if (Counter == 0)
	{
		if (document.CompareSavingsForm.EasyAccessAccounts.checked)
			Counter = Counter + 1;
		if (document.CompareSavingsForm.NoticeAccounts.checked)
			Counter = Counter + 2;
		if (document.CompareSavingsForm.TermAccounts.checked)
			Counter = Counter + 4;
		if (document.CompareSavingsForm.RegularAccounts.checked)
			Counter = Counter + 8;
		if(document.CompareSavingsForm.ChildrenType)
		{
			var c = document.CompareSavingsForm.ChildrenType;
			for (i = 0;i<c.length;i++)
			{
				if(c[i].checked)
				{
					Counter = Counter + parseInt(c[i].value);
				}
			}
		}
		if (Counter == 0)
		{
			alert("Please select a type of account");
			return false;
		}
	}

	if (isFieldValidAndFocus(document.CompareSavingsForm.InvestmentAmount, 'Currency', false, 'Investment amount'))
	{
		if(document.CompareSavingsForm.InvestmentAmount.value < 1)
		{
			alert("Investment amount must be at least £1");
			return false;
		}
	}
	else
		return false;

	document.CompareSavingsForm.Results.value = Counter;
}

function RadioSelected()
{
	var i = 0;
	while(document.CompareSavingsForm.SavingsType[i])
	{
		if (document.CompareSavingsForm.SavingsType[i].checked)
		{
			return document.CompareSavingsForm.SavingsType[i].value;
		}
		i++;
	}

	return false;
}

function showOptions(showem)
{
	document.getElementById("extraoptions").style.display	= (showem)	? "block" : "none";
	
}

function defaultValues()
{
	document.getElementsByName("TermAccounts")[0].checked = true;
	term();	
}

function MinVal(a)
{
	var boxy = document.getElementsByName("InvestmentAmount")[0]
	if( boxy.value < a ) boxy.value = a ;
}
