// Reports if all forms have filled out properly.
function formValidate() {
       if ( (isEmail()) && (isFirstname()) && (isLastname()) && (isOrg()) && (isPhone()) && (isCity()) && (isState()) )
document.form.submit();
	return true;
	}
// Checks for extra spaces in the email field
function removeSpaces() {
	var cc=document.form.email.value;
	var hold='';
	for(var i = 0; i <cc.length; i++)
		{
		if(cc.charAt(i) != ' ')
			{
			hold = hold + cc.charAt(i);
			}
		}
	document.form.email.value=hold;
	return true;
}
// Checks the email field
function isEmail()
	{
// Return false if E-mail field is blank.
	if (document.form.email.value == "") 
		{
		alert("\nE-mail Address is a required field.\n\nPlease enter your e-mail address.")
		document.form.email.focus();
		return false; 
		}
// Return false if E-mail field does not contain a '@' and '.' .
	if (document.form.email.value.indexOf ('@',0) == -1 || 
		document.form.email.value.indexOf ('.',0) == -1)
		{
		alert("\nThe E-mail Address must contain a \"@\" and a \".\" \n\nPlease re-enter your e-mail address.")
		document.form.email.select();
		document.form.email.focus();
		return false;
		}
	else  {
		removeSpaces();
		return true;
		}	     
	}
// Checks the First Name field.
function isFirstname()
	{
	var str = document.form.first_name.value;
// Return false if First Name field is blank.
	if (document.form.first_name.value == "") 
		{
		alert("\nFirst Name is a required field.\n\nPlease enter your first name.")
		document.form.first_name.focus();
		return false; 
		}
	if (str.length > 50)
		{
		alert("\nYou have exceeded the 50 character limit.  \n\nPlease re-enter.")  
		document.form.first_name.focus();
		return false; 
		}
// Return false if characters are not a-z, A-Z.
	for (var i = 0; i < str.length; i++) 
		{
		var ch = str.substring(i, i + 1);
		if ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) 
			{
			alert("\nThe First Name field only accepts letters.\n\nPlease re-enter.");
			document.form.first_name.select();
			document.form.first_name.focus();
			return false;
			}
		else  {
			return true;
			}	     
		}       
	}
// Checks the Last Name field.
function isLastname()
	{
	var str = document.form.last_name.value;
// Return false if Last Name field is blank.
	if (document.form.last_name.value == "") 
		{
		alert("\nLast Name is a required field.\n\nPlease enter your last name.")
		document.form.last_name.focus();
		return false; 
		}
// Return false if characters are not a-z, A-Z.
	for (var i = 0; i < str.length; i++) 
		{
		var ch = str.substring(i, i + 1);
		if ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) 
			{
			alert("\nThe Last Name field only accepts letters.\n\nPlease re-enter.");
			document.form.last_name.select();
			document.form.last_name.focus();
			return false;
			}
		else  {
			return true;
			}	     
		}
	}  
// Checks the Job Title field
function isTitle()
   {
// Return false if Job Title field is blank.
   if (document.form.title.value == "") 
      {
       alert("\nTitle is a required field.\n\nPlease enter your title at this organization.")
       document.form.title.focus();
       return false; 
      }
   else  {
      return true;
 		  }	     
   }
// Checks the Name of Organization field
function isOrg()
   {
// Return false if Name of Organization field is blank.
   if (document.form.company.value == "") 
      {
       alert("\nName of Organization is a required field.\n\nPlease enter the name of your organization.")
       document.form.company.focus();
       return false; 
      }
   else  {
      return true;
 		  }	     
   }
// Checks the Phone Number field   
function isPhone()
{
// Return false if phone number field is blank.
   if (document.form.phone.value == "") 
      {
       alert("\nPhone Number is a required field.\n\nPlease enter your phone number at your organization.")
       document.form.phone.focus();
       return false; 
      }
   else  {
      return true;
 		  }	     
   }
// Checks the Address 1 field.
function isAddress()
   {
   strAddress = document.form['00N30000000zKon'].value;
// Return false if Address 1 field is blank.
 if (strAddress == "") {
       alert("\nAddress is a required field.\n\nPlease enter the street address of your organization.")
	   document.form['00N30000000zKon'].focus();
       return false; 
      }
   else  {
      return true;
 		  }	     
   }
// Checks the City field.
function isCity()
   {
   strCity = document.form['00N30000000zLWZ'].value;
// Return false if City field is blank.
 if (strCity == "") {
       alert("\nCity is a required field.\n\nPlease enter the city of your organization.")
       document.form['00N30000000zLWZ'].focus();
       return false; 
      }
   else  {
      return true;
 		  }	     
   }
// Check the State/Province drop down field
function isState()
{
strState = document.form['00N30000000zLXN'].selectedIndex;
// Check the State/Province drop down field first drop down is selected, if so, invalid selection
if (strState == 0)
	{
	alert("\nState is a required field.\n\nPlease select a State or Province where your organization resides.\n\nIf you live outside of the US or Canada, please choose Not Applicable.");
    document.form['00N30000000zLXN'].focus();
	return (false);
	}
 else  {
      return true;
 		  }	     
} 
// Checks the ZipPostal Code field.
function isZip()
   {
   strZip = document.form['00N30000000zLXc'].value;
// Return false if Zip field is blank.
 if (strZip == "") {
       alert("\nZip/Postal Code is a required field.\n\nPlease enter the zip or postal code of your organization.")
	          document.form['00N30000000zLXc'].focus();
       return false; 
      }
   else  {
      return true;
 		  }	     
   }
// Checks the "Please indicate the date, city, and state of the two-day Benevon Workshop your organization most recently attended" field
function isWorkshopAttended()
   {
   strWorkshopAttended = document.form['00N30000000z7RS'].value;
// Return false if field is blank.
 if (strWorkshopAttended == "") {
       alert("\nPlease indicate the date, city, and state of the two-day Benevon Workshop your organization most recently attended.")
       document.form['00N30000000z7RS'].focus();
       return false; 
      }
   else  {
      return true;
 		  }	     
   }
// Checks the "Role they will be in implementing the model at this organization following the workshop"
function isRole()
   {
// Return false no boxes checked.
if (!document.form['00N300000017c0q'][0].checked &&
!document.form['00N300000017c0q'][1].checked &&
!document.form['00N300000017c0q'][2].checked &&
!document.form['00N300000017c0q'][3].checked &&
!document.form['00N300000017c0q'][4].checked &&
!document.form['00N300000017c0q'][5].checked &&
!document.form['00N300000017c0q'][6].checked &&
!document.form['00N300000017c0q'][7].checked &&
!document.form['00N300000017c0q'][8].checked)
{
    alert("\nPlease indicate the Role(s) you fill in the organization.")
    document.form['00N300000017c0q'].focus();
	return false;
}
   else  {
      return true;
 		  }	     
   }
// Checks the Media Format drop down field
function isMediaFormat()
{
strMediaFormat = document.form['00N30000000x4Ek'].selectedIndex;
// Check the Media drop down field
if (strMediaFormat == 0)
	{
	alert("\nWe will be providing your team with some complimentary audio/visual materials at the workshop.\n\nPlease select your preferred format, DVD, VHS, or PAL.");
    document.form['00N30000000x4Ek'].focus();
	return (false);
	}
 else  {
      return true;
 		  }	     
}
// Checks the "Total Organizational Budget" field 
function isOrgBudget()
{
// Return false if phone number field is blank.
   if (document.form.revenue.value == "") 
      {
       alert("\nTotal Organization Budget is a required field.\n\nPlease enter a number. Do not enter commas or other text.")
       document.form.revenue.focus();
       return false; 
      }
   else  {
      return true;
 		  }	     
   }
// Checks the "Total Org Budget" field
function isOrgIncome()
   {
   strOrgIncome = document.form['00N30000000x4F8'].value;
// Return false if "Total Org Budget" field is blank.
 if (strOrgIncome == "") {
       alert("\nOrganization Income is a required field.\n\nPlease enter your total income budgeted from private fundraising sources, including foundations, corporations, and individuals.")
       document.form['00N30000000x4F8'].focus();
       return false; 
      }
   else  {
      return true;
 		  }	     
   }
// Checks the "Orgs work and mission" field
function isOrgMission()
   {
   strOrgMission = document.form['00N30000000wHCe'].value;
// Return false if "Total Org Budget" field is blank.
 if (strOrgMission == "") {
       alert("\nOrganization's work and mission is a required field.\n\nPlease briefly describe your organization's work and mission.")
       document.form['00N30000000wHCe'].focus();
       return false; 
      }
   else  {
      return true;
 		  }	     
   }
// Checks the "Do you approve the workshop registration policy?"
function isRegPolicy()
   {
   strRegPolicy = document.form['00N30000000x4Fw'][0].checked;
// Return false if field is blank.
 if (strRegPolicy == false) {
       alert("\nPlease indicate if you approve the workshop registration policy. No applications will be accepted without this approval.")
       return false; 
      }
   else  {
      return true;
 		  }	     
   }

/* Shows how many characters can be entered into text field - mission statements */
maxL=500;
var bName = navigator.appName;
function taLimit(taObj) {
	if (taObj.value.length==maxL) return false;
	return true;
}

function taCount(taObj,Cnt) { 
	objCnt=createObject(Cnt);
	objVal=taObj.value;
	if (objVal.length>maxL) objVal=objVal.substring(0,maxL);
	if (objCnt) {
		if(bName == "Netscape"){	
			objCnt.textContent=maxL-objVal.length;}
		else{objCnt.innerText=maxL-objVal.length;}
	}
	return true;
}
function createObject(objId) {
	if (document.getElementById) return document.getElementById(objId);
	else if (document.layers) return eval("document." + objId);
	else if (document.all) return eval("document.all." + objId);
	else return eval("document." + objId);
}