// JavaScript Document
function validateguestbook()
{
	var OKTOPOST=true;
	var errormessage="Errors in your Guestbook submission:\n\n";
	
	if (form1.NameGB.value=='')
	{
		errormessage = errormessage+"* Please enter your name\n";
		OKTOPOST=false;
	}
	
	if (form1.CommentsGB.value=='')
	{
		errormessage = errormessage+"* Please enter your comments\n";
		OKTOPOST=false;
	}
	
	if (form1.EmailGB.value!='')
	{
		if(checkEmailAddress(form1.EmailGB)!=true)
		{
			errormessage = errormessage+"* Please enter a valid email address\n";
			OKTOPOST=false;
		}
	}
		
	if (OKTOPOST!=true)
	{
		alert (errormessage);
		return false;
	}
}

function checkEmailAddress(field) 
		{
			var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2})|(\..{3,3}))$)\b/gi);
			if (goodEmail)
			{
			   return true;
			} 
			else 
			{
				return false;
			}	
		}

function donate()
{

alert('s')
/*if (document.donate.amount.value.length == 0) 
      {
     // alert("Please check - non numeric value!");
	  return false;
      } 
   else if (IsNumeric(document.donate.amount.value) == false) 
      {
      //alert("Please check - non numeric value!");
	  return false;
      }*/
}


function TestDonate()
{
	//if (document.donate.AMOUNT.value=='')
	//{
		if (IsNumeric(document.donate.AMOUNT.value))
		{
			return true;
		}
		else
		{
			alert('Please enter a valid amount: e.g 23.99')
			return false;
		}
	//}
}

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

