
function digitvalidation(entered, min, max, alertbox, datatype)
{
with (entered)
{
checkvalue=parseFloat(value);
if (datatype)
{smalldatatype=datatype.toLowerCase();
if (smalldatatype.charAt(0)=="i") 
{checkvalue=parseInt(value); if (value.indexOf(".")!=-1) {checkvalue=checkvalue+1}};
}
if ((parseFloat(min)==min && value.length<min) || (parseFloat(max)==max && value.length>max) || value!=checkvalue)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}


function ValidateForm(theForm) {

		if (theForm.FirstName.value == "") {
			alert("Please enter your first name");
			theForm.FirstName.focus();
			return (false);
		}

		if (theForm.LastName.value == "") {
			alert("Please enter your last name");
			theForm.LastName.focus();
			return (false);
		}
		
		if (theForm.TitleID.value == "") {
			alert("Please select your Title");
			theForm.TitleID.focus();
			return (false);
		}
		
		if (theForm.email.value == "") {
			alert("Please enter your Email address");
			theForm.email.focus();
			return (false);
		}
		
		if (theForm.Organization.value == "") {
			alert("Please enter your organization's name");
			theForm.Organization.focus();
			return (false);
		}

		if (theForm.Address.value == "") {
			alert("Please enter your address");
			theForm.Address.focus();
			return (false);
		}	

		if (theForm.City.value == "") {
			alert("Please enter your city's name");
			theForm.City.focus();
			return (false);
		}

		if (theForm.StateID.value == "") {
			alert("Please select your state");
			theForm.StateID.focus();
			return (false);
		}
		
		if (theForm.CountryID.value == "") {
			alert("Please select your Country");
			theForm.CountryID.focus();
			return (false);
		}

		if (theForm.Zip.value == "") {
			alert("Please enter your ZIP code");
			theForm.Zip.focus();
			return (false);
		}
		
		if (theForm.PhoneNumber1.value == "") {
			alert("Please enter your Phone number");
			theForm.PhoneNumber1.focus();
			return (false);
		}
		
		if (theForm.Tell1ID.value == "") {
			alert("Please select type of phone number");
			theForm.Tell1ID.focus();
			return (false);
		}
		
		if (theForm.BestTimeID.value == "") {
			alert("Please select a time to call");
			theForm.BestTimeID.focus();
			return (false);
		}
		
		if (theForm.GroupCatID.value == "") {
			alert("Please select your type of organization");
			theForm.GroupCatID.focus();
			return (false);
		}
		
		if (theForm.GroupTypeID.value == "") {
			alert("Please select your type of activity or group");
			theForm.GroupTypeID.focus();
			return (false);
		}

		if (digitvalidation(theForm.Participants,0,5000,"Please enter the nuber of people that will participate in the fundraiser","I")==false) 
		{theForm.Participants.focus(); 
		return false;};

		if (theForm.FundRoleID.value == "") {
			alert("Please select your fundraising role");
			theForm.FundRoleID.focus();
			return (false);
		}
		
		if (theForm.SampleColor.value == "") {
			alert("Please select a sample color");
			theForm.SampleColor.focus();
			return (false);
		}
		
		if (theForm.FundGoal.value == "") {
			alert("Please enter your fundraising goal");
			theForm.FundGoal.focus();
			return (false);
		}

		theForm.Organization.value = theForm.Organization.value.toUpperCase();
		theForm.FirstName.value = theForm.FirstName.value.toUpperCase();
		theForm.LastName.value = theForm.LastName.value.toUpperCase();
		theForm.Address.value = theForm.Address.value.toUpperCase();
		theForm.City.value = theForm.City.value.toUpperCase();
		theForm.Zip.value = theForm.Zip.value.toUpperCase();
		return (true);
}