// JavaScript Document
function valid() { 
	if (document.ContactUsForm.firstname.value == "")
	  {
		alert("Please fill in the name");
		document.ContactUsForm.firstname.focus();
		return false;
	 }
	if (document.ContactUsForm.lastname.value == "")
	  {
		alert("Please fill in the last name");
		document.ContactUsForm.lastname.focus();
		return false;
	 }
	if (document.ContactUsForm.telephone.value == "")
	  {
		alert("Please fill in the phone");
		document.ContactUsForm.telephone.focus();
		return false;
	 }
	if ( document.ContactUsForm.email.value.indexOf ('@', 0) == -1 || document.ContactUsForm.email.value.indexOf ('.', 0) == -1 ) 
	{
		alert("Please fill in correctly the E-mail");
		document.ContactUsForm.email.focus();
		return false;
	}
	if ( document.ContactUsForm.comment.value == 0)
	{
		alert("Please fill in the notes field");
		document.ContactUsForm.comment.focus();
		return false;
	}

	else document.ContactUsForm.submit();
}


function validDonationForm() { 
	if (document.addform.FullName.value == "")
	  {
		alert("Please fill in the name field");
		document.addform.FullName.focus();
		return false;
	 }
	 
	if (document.addform.Amount.value == "" || !isFloat (document.addform.Amount.value))
	  {
		alert("Please fill in the amount of money");
		document.addform.Amount.focus();
		return false;
	 }
	if ( document.addform.Email.value.indexOf ('@', 0) == -1 || document.addform.Email.value.indexOf ('.', 0) == -1 ) 
	{
		alert("Please fill in correctly the E-mail");
		document.addform.Email.focus();
		return false;
	}
	else document.addform.submit();
}



function isFloat (s)
{
	if ((s.length == 1) && (s ==".")){
		return false;
	}
   var j;

    for (j = 0; j < s.length; j++)
    {   
        var c = s.charAt(j);

        if (!isDigitFloat(c)) return false;
    }
	var ss = s.split('.')
	if (ss.length > 2)
		return false;
    return true;
}


function isDigitFloat (c)
{   return((c >= "0") && (c <= "9") || (c == "."))
}