
function IsNumeric(sText)
{
   var ValidChars = "0123456789. ";
   var IsNumber=true;
   var Char;
 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
   { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
      {
         IsNumber = false;
      }
   }
   return IsNumber;
}

function CheckForm() 
{
	var varError;
	var Msg1 = "";
	var Msg2 = "";		
	
	varError = false;
	
	/* Set the colour back in case this is 2nd time */
	document.frmDonation.Name.style.background = '#FFFFFF';
	if (document.frmDonation.Name.value == "") {
	  varError = true;
	  document.frmDonation.Name.style.background = '#FFCC33';
	}	
	/* Set the colour back in case this is 2nd time */
	document.frmDonation.Address1.style.background = '#FFFFFF';
	if (document.frmDonation.Address1.value == "") {
	  varError = true;
	  document.frmDonation.Address1.style.background = '#FFCC33';
	}		
	/* Set the colour back in case this is 2nd time */
	document.frmDonation.City.style.background = '#FFFFFF';
	if (document.frmDonation.City.value == "") {
	  varError = true;
	  document.frmDonation.City.style.background = '#FFCC33';
	}				
	/* Set the colour back in case this is 2nd time */
	document.frmDonation.State.style.background = '#FFFFFF';
	if (document.frmDonation.State.value == "") {
	  varError = true;
	  document.frmDonation.State.style.background = '#FFCC33';  
	}
	/* Set the colour back in case this is 2nd time */
	document.frmDonation.Postcode.style.background = '#FFFFFF';
	if (document.frmDonation.Postcode.value == "") {
	  varError = true;
	  document.frmDonation.Postcode.style.background = '#FFCC33';  
	}
	/* Set the colour back in case this is 2nd time */
	document.frmDonation.Country.style.background = '#FFFFFF';
	if (document.frmDonation.Country.value == "") {
	  varError = true;
	  document.frmDonation.Country.style.background = '#FFCC33';  
	}
	/* Set the colour back in case this is 2nd time */
	document.frmDonation.PhoneHome.style.background = '#FFFFFF';
	if (document.frmDonation.PhoneHome.value == "") {
	  varError = true;
	  document.frmDonation.PhoneHome.style.background = '#FFCC33';  
	}
	/* Set the colour back in case this is 2nd time */
	document.frmDonation.Email.style.background = '#FFFFFF';
	if (document.frmDonation.Email.value == "") {
	  varError = true;
	  document.frmDonation.Email.style.background = '#FFCC33';  
	}
	/* Set the colour back in case this is 2nd time */
	document.frmDonation.cboSource.style.background = '#FFFFFF';
	if (document.frmDonation.cboSource.value == "") {
	  varError = true;
	  document.frmDonation.cboSource.style.background = '#FFCC33';
	  Msg1 = ", How did you hear about us?";			  
	}				
	/* Set the colour back in case this is 2nd time 
	document.frmDonation.cboType.style.background = '#FFFFFF';
	document.frmDonation.TypeOther.style.background = '#FFFFFF';
	if (document.frmDonation.cboType.value == "") {
	  varError = true;
	  document.frmDonation.cboType.style.background = '#FFCC33';  
	  Msg2 = ", Type of Donation";			  
	}	
	else if (document.frmDonation.cboType.value == "Other Area" && document.frmDonation.TypeOther.value == "") {
	  document.frmDonation.TypeOther.style.background = '#FFCC33';
	}*/
	/* Set the colour back in case this is 2nd time */
	document.frmDonation.Amount.style.background = '#FFFFFF';
	if (document.frmDonation.Amount.value == "") {
	  varError = true;
	  document.frmDonation.Amount.style.background = '#FFCC33';  
	}	
	else if (IsNumeric(document.frmDonation.Amount.value) == false) {
	  varError = true;
	  document.frmDonation.Amount.style.background = '#FFCC33';  
	}	
	
	if (varError)
	{
		alert("Please check the highlighted fields");
	}
	else
	{
	  	document.frmDonation.posted.value="yes";
	  	document.frmDonation.submit();		
	}
}	
