function ValidateForm(form) {

   if(!validate_required(form.org_name)) { 
      alert('Organization Name is required.\r\nPlease enter the name of your organization and try submitting the form again.') 
      form.org_name.focus(); 
      return false; 
   }
   
   if(!validate_required(form.fname)) { 
      alert('First Name is required.\r\nPlease enter your first name and try submitting the form again.') 
      form.fname.focus(); 
      return false; 
   }
   
   if(!validate_required(form.lname)) { 
      alert('Last Name is required.\r\nPlease enter your last name and try submitting the form again.') 
      form.lname.focus(); 
      return false; 
   }
   
   if(!validate_required(form.email)) { 
      alert('E-mail is required.\r\nPlease enter your e-mail address and try submitting the form again.') 
      form.email.focus(); 
      return false; 
   }
   
	if(!validate_email(form.email)) {
	  alert('Your e-mail doesn\'t appear to be valid.\r\nPlease confirm your e-mail address and try submitting the form again.') 
      form.email.focus(); 
      return false; 
	}
 
   /*if (!IsNumeric(form.account_number.value)) 
   { 
      alert('Please enter only numbers or decimal points in the account field') 
      form.account_number.focus(); 
      return false; 
      } */
 
return true;
}


function validate_email(field) {
	with (field) {
		apos=value.indexOf("@")
		dotpos=value.lastIndexOf(".")
		if (apos<1||dotpos-apos<2) {
			return false;
		}
		else {
			return true;
		}
	}
}

function validate_required(field) {
	with (field) {
		if (value==null||value=="") {
			return false;
		}
		else {
			return true;
		}
	}
}


function textCounter(field,cntfield,maxlimit) {
	if (field.value.length > maxlimit) // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
	// otherwise, update 'characters left' counter
	else
		cntfield.value = maxlimit - field.value.length;
}