function fnValidate()
{

//alert("'" + fnTrim(frmCalculator.AmtFunded.value) + "'");

	//validate amount
	sAmt = fnTrim(frmCalculator.AmtFunded.value);
	if(!fnIsNumeric(sAmt) || sAmt.length == 0 ){
		alert("You have entered an invalid cash amount.");
		frmCalculator.AmtFunded.focus();
		frmCalculator.AmtFunded.select();
		return;
	}
	
	//validate type of case
	if(frmCalculator.CaseType.selectedIndex == 0){
		alert("You must select the type of case you have.");
		frmCalculator.CaseType.focus();
		return;
	}
	
	//validate status
	if(frmCalculator.CaseStatus.selectedIndex == 0){
		alert("You must select the status of your case.");
		frmCalculator.CaseStatus.focus();
		return;
	}	
	
	//validate period
	if(frmCalculator.CaseLength.selectedIndex == 0){
		alert("You must select how many months you estimate it will take to settle your case.");
		frmCalculator.CaseLength.focus()
		return;
	}

	frmCalculator.AmtFunded.value = sAmt;
	frmCalculator.submit();

}//fnValidate

function fnIsNumeric(stringIn)
{

	var ValidChars = "0123456789.,";
	var IsNumber=true;
	var Char;

	for (i = 0; i < stringIn.length && IsNumber == true; i++){		      
		Char = stringIn.charAt(i);	
		if (ValidChars.indexOf(Char) == -1)
			IsNumber = false;	
	}//for	
	return IsNumber;
	
}//fnIsNumeric

function fnTrim(stringIn)
{

	while (stringIn.substring(0,1) == ' ')
		stringIn = stringIn.substring(1,stringIn.length);
	while (stringIn.substring(stringIn.length-1,stringIn.length) == ' ')
		stringIn = stringIn.substring(0,stringIn.length-1);
	return stringIn;

}//fnTrim