function isEmail(emailaddr)
{
	if (emailaddr.value.indexOf("@") != "-1" &&
		emailaddr.value.indexOf(".") != "-1" &&
		emailaddr.value != "")
	return true;
	else return false;
}



//Member Reg Validation-index.php 
function MemberReg(theForm)
{
  if (theForm.att_type[0].checked == false && theForm.att_type[1].checked == false && theForm.att_type[2].checked == false)
  {
    alert("Please choose the type of registration you wish to complete.");
    return (false);
  }
}

//Member Login-index.php 
function MemberLogin(theForm)
{
  if (theForm.username.value == "" || theForm.username.value.length == 0 )
  {
    alert("You must enter your username.");
    theForm.username.focus();
    return (false);
  }
  if (theForm.password.value == "" || theForm.password.value.length == 0 )
  {
    alert("You must enter your password.");
    theForm.password.focus();
    return (false);
  }
  if (theForm.att_type[0].checked == false && theForm.att_type[1].checked == false && theForm.att_type[2].checked == false)
  {
    alert("Please choose the type of registration you wish to complete.");
    return (false);
  }
}

//New Member-index.php 
function NewMember(theForm)
{
		if (theForm.email == '')
		{
			alert("Please enter your email address.");
			theForm.email.focus();
			return false;
		}
		else
		{
			if (isEmail(theForm.email) == false)
			{
				alert("Please enter a valid email address.");
				theForm.email.focus();
				return false;
			}
		}
	  if (theForm.company.value == "" || theForm.company.value.length == 0 )
	  {
		alert("You must enter your company name.");
		theForm.company.focus();
		return (false);
	  }
}

//Non Member-index.php 
function NonMember(theForm)
{

  if (theForm.att_type[0].checked == false && theForm.att_type[1].checked == false && theForm.att_type[2].checked == false)
  {
    alert("Please choose the type of registration you wish to complete.");
    return (false);
  }	  
}



//Attendee Reg-register.php 
function RegAttendee(theForm)
 {
  if (theForm.first_name.value == "" || theForm.first_name.value.length == 0 )
  {
    alert("You must enter your first name.");
    theForm.first_name.focus();
    return (false);
  }
  if (theForm.last_name.value == "" || theForm.last_name.value.length == 0 )
  {
    alert("You must enter your last name.");
    theForm.last_name.focus();
    return (false);
  }
  if (theForm.badge_name.value == "" || theForm.badge_name.value.length == 0 )
  {
    alert("You must enter your preferred name for you name badge.");
    theForm.badge_name.focus();
    return (false);
  }
  if (theForm.title.value == "" || theForm.title.value.length == 0 )
  {
    alert("You must enter a title.");
    theForm.title.focus();
    return (false);
  }
  if (theForm.company.value == "" || theForm.company.value.length == 0 )
  {
    alert("You must enter a company name.");
    theForm.company.focus();
    return (false);
  }

  if (theForm.company_address.value == "" || theForm.company_address.value.length == 0 || theForm.company_city.value == "" || theForm.company_city.value.length == 0 || theForm.company_state.value == "" || theForm.company_state.value.length == 0 || theForm.company_zip.value == "" || theForm.company_zip.value.length == 0 )
  {
    alert("You must enter your complete address.");
    return (false);
  }
  if (theForm.phone.value == "" || theForm.phone.value.length == 0 )
  {
    alert("You must enter your phone number.");
    theForm.phone.focus();
    return (false);
  }
  if (theForm.email == '')
  {
	alert("Please enter your email address.");
	theForm.email.focus();
	return false;
	}
	else
	{
	if (isEmail(theForm.email) == false)
		{
			alert("Please enter a valid email address.");
			theForm.email.focus();
			return false;
		}
	}
	if (theForm.years_employed.selectedIndex == 0 )
  {
	alert("Please select the number years in your field.");
	return (false);
  }	
  if (theForm.first_time[0].checked == false && theForm.first_time[1].checked == false)
  {
    alert("Please indicate whether or not you are a first time attendee.");
    return (false);
  }
  if (theForm.payby.selectedIndex == 0 )
  {
	alert("You select your payment type.");
	return (false);
  }	

}

//Exhibitor Reg-register.php 
function RegExhibitor(theForm)
 {
  if (theForm.company.value == "" || theForm.company.value.length == 0 )
  {
    alert("You must enter a company.");
    theForm.company.focus();
    return (false);
  }

  if (theForm.company_address.value == "" || theForm.company_address.value.length == 0 || theForm.company_city.value == "" || theForm.company_city.value.length == 0 || theForm.company_state.value == "" || theForm.company_state.value.length == 0 || theForm.company_zip.value == "" || theForm.company_zip.value.length == 0 )
  {
    alert("You must enter your complete address.");
    return (false);
  }
  if (theForm.phone.value == "" || theForm.phone.value.length == 0 )
  {
    alert("You must enter your phone number.");
    theForm.phone.focus();
    return (false);
  }
  if (theForm.email == '')
  {
	alert("Please enter your email address.");
	theForm.email.focus();
	return false;
	}
	else
	{
	if (isEmail(theForm.email) == false)
		{
			alert("Please enter a valid email address.");
			theForm.email.focus();
			return false;
		}
	}
	if (theForm.company_contact.value == "" || theForm.company_contact.value.length == 0 )
	  {
		alert("You must enter a company contact.");
		theForm.company_contact.focus();
    	return (false);
  	}
	if (theForm.title.value == "" || theForm.title.value.length == 0 )
	  {
		alert("You must enter a company contact's title.");
		theForm.title.focus();
    	return (false);
  	}
  if (theForm.clause1.checked == false || theForm.clause.checked == false)
  {
    alert("Please agree to both Exhibitor Clauses.");
    return (false);
  }
  if (theForm.badge_name_a1.value == "" || theForm.badge_name_a1.value.length == 0 || theForm.email_a1.value == "" || theForm.email_a1.value.length == 0 || theForm.badge_name_a2.value == "" || theForm.badge_name_a2.value.length == 0 || theForm.email_a2.value == "" || theForm.email_a2.value.length == 0)
  {
    alert("Please enter the information for your two conference attendees.");
    return (false);
  }

  if (theForm.payby.selectedIndex == 0 )
  {
	alert("You select your payment type.");
	return (false);
  }

}

//Speaker Reg-register.php 
function RegSpeaker(theForm)
 {
  if (theForm.first_name.value == "" || theForm.first_name.value.length == 0 )
  {
    alert("You must enter your first name.");
    theForm.first_name.focus();
    return (false);
  }
  if (theForm.last_name.value == "" || theForm.last_name.value.length == 0 )
  {
    alert("You must enter your last name.");
    theForm.last_name.focus();
    return (false);
  }
  if (theForm.badge_name.value == "" || theForm.badge_name.value.length == 0 )
  {
    alert("You must enter your preferred name for you name badge.");
    theForm.badge_name.focus();
    return (false);
  }
  if (theForm.title.value == "" || theForm.title.value.length == 0 )
  {
    alert("You must enter a title.");
    theForm.title.focus();
    return (false);
  }
  if (theForm.company.value == "" || theForm.company.value.length == 0 )
  {
    alert("You must enter a company name.");
    theForm.company.focus();
    return (false);
  }

  if (theForm.company_address.value == "" || theForm.company_address.value.length == 0 || theForm.company_city.value == "" || theForm.company_city.value.length == 0 || theForm.company_state.value == "" || theForm.company_state.value.length == 0 || theForm.company_zip.value == "" || theForm.company_zip.value.length == 0 )
  {
    alert("You must enter your complete address.");
    return (false);
  }
  if (theForm.phone.value == "" || theForm.phone.value.length == 0 )
  {
    alert("You must enter your phone number.");
    theForm.phone.focus();
    return (false);
  }
  if (theForm.email == '')
  {
	alert("Please enter your email address.");
	theForm.email.focus();
	return false;
	}
	else
	{
	if (isEmail(theForm.email) == false)
		{
			alert("Please enter a valid email address.");
			theForm.email.focus();
			return false;
		}
	}
	if (theForm.years_employed.selectedIndex == 0 )
  {
	alert("Please select the number years in your field.");
	return (false);
  }	
  if (theForm.first_time[0].checked == false && theForm.first_time[1].checked == false)
  {
    alert("Please indicate whether or not you are a first time attendee.");
    return (false);
  }

}
//New Member Company/Type-join.php 
function CompanyChoose(theForm)
 {
 
var validated = 0;

for (i = 0; i < theForm.existing_company.length; i++)
	{
		if (theForm.existing_company[i].checked)
		validated = 1; 
	} 

if (validated == false)
  	{
  		alert("Please select your company or none of the above");
		return (false);
	}
	
if (validated == true) {	
		if (validated == "2")
			{
				if (theForm.mem_type[0].checked == false && theForm.mem_type[1].checked == false)
				{
				alert("You select the appropriate membership type.");
				return (false);
				}	
			}
 }

}

//New Member No Company-join.php
function NoCompany(theForm)
 {
		if (theForm.mem_type[0].checked == false && theForm.mem_type[1].checked == false)
		{
		alert("Please select the appropriate membership type.");
		return (false);
  		}
 }
 
//New Member Regular-application.php
function NewMemberReg(theForm)
 {
 
  if (theForm.mr[0].checked == false && theForm.mr[1].checked == false && theForm.mr[2].checked == false)
  {
    alert("Please select either Mr, Ms or Mrs");
    return (false);
  }
  if (theForm.fname.value == "" || theForm.fname.value.length == 0 )
  {
    alert("You must enter your first name.");
    theForm.fname.focus();
    return (false);
  }
  if (theForm.lname.value == "" || theForm.lname.value.length == 0 )
  {
    alert("You must enter your last name.");
    theForm.lname.focus();
    return (false);
  }
  if (theForm.title.value == "" || theForm.title.value.length == 0 )
  {
    alert("You must enter your title.");
    theForm.title.focus();
    return (false);
  }
  if (theForm.password.value == "" || theForm.password.value.length == 0 )
  {
    alert("You must choose a password.");
    theForm.password.focus();
    return (false);
  }
  if (theForm.verify.value != theForm.password.value)
  {
    alert("Your password and verify password do not match.");
    theForm.password.focus();
    return (false);
  }
  if (theForm.address1.value == "" || theForm.address1.value.length == 0 || theForm.city.value == "" || theForm.city.value.length == 0 || theForm.state.value == "" || theForm.state.value.length == 0 || theForm.zip.value == "" || theForm.zip.value.length == 0 )
  {
    alert("You must enter your complete address.");
    return (false);
  }
  if (theForm.bphone.value == "" || theForm.bphone.value.length == 0 )
  {
    alert("You must enter your phone number.");
    theForm.bphone.focus();
    return (false);
  }
  if (theForm.codeagree.checked == false )
  {
    alert("You must agree to abide by the Code of Ethics.");
    return (false);
  }
  
  if (theForm.job_class.value == "" || theForm.job_class.value.length == 0 )
  {
    alert("Please enter your job class.");
    theForm.job_class.focus();
    return (false);
  }
  if (theForm.num_locations.value == "" || theForm.num_locations.value.length == 0 )
  {
    alert("Please enter the number of locations.");
    theForm.num_locations.focus();
    return (false);
  }
  
  if (theForm.num_brands.value == "" || theForm.num_brands.value.length == 0 )
  {
    alert("Please enter the number of brands.");
    theForm.num_brands.focus();
    return (false);
  }
  
  if (theForm.biz_type.value == "" || theForm.biz_type.value.length == 0 )
  {
    alert("Please enter your business type.");
    theForm.biz_type.focus();
    return (false);
  }
  
  if (theForm.location_type.value == "" || theForm.location_type.value.length == 0 )
  {
    alert("Please enter your location type.");
    theForm.location_type.focus();
    return (false);
  }
  
  if (theForm.unit_size.value == "" || theForm.unit_size.value.length == 0 )
  {
    alert("Please enter your unit size.");
    theForm.unit_size.focus();
    return (false);
  }  
  
  return (true);
}

//New Member Affiliate-application.php
function NewMemberAff(theForm)
 {
 
  if (theForm.mr[0].checked == false && theForm.mr[1].checked == false && theForm.mr[2].checked == false)
  {
    alert("Please select either Mr, Ms or Mrs");
    return (false);
  }
  if (theForm.fname.value == "" || theForm.fname.value.length == 0 )
  {
    alert("You must enter your first name.");
    theForm.fname.focus();
    return (false);
  }
  if (theForm.lname.value == "" || theForm.lname.value.length == 0 )
  {
    alert("You must enter your last name.");
    theForm.lname.focus();
    return (false);
  }
  if (theForm.title.value == "" || theForm.title.value.length == 0 )
  {
    alert("You must enter your title.");
    theForm.title.focus();
    return (false);
  }
  if (theForm.password.value == "" || theForm.password.value.length == 0 )
  {
    alert("You must choose a password.");
    theForm.password.focus();
    return (false);
  }
  if (theForm.verify.value != theForm.password.value)
  {
    alert("Your password and verify password do not match.");
    theForm.password.focus();
    return (false);
  }
  if (theForm.address1.value == "" || theForm.address1.value.length == 0 || theForm.city.value == "" || theForm.city.value.length == 0 || theForm.state.value == "" || theForm.state.value.length == 0 || theForm.zip.value == "" || theForm.zip.value.length == 0 )
  {
    alert("You must enter your complete address.");
    return (false);
  }
  if (theForm.bphone.value == "" || theForm.bphone.value.length == 0 )
  {
    alert("You must enter your phone number.");
    theForm.bphone.focus();
    return (false);
  }
  if (theForm.codeagree.checked == false )
  {
    alert("You must agree to abide by the Code of Ethics.");
    return (false);
  }
  
  if (theForm.job_class.value == "" || theForm.job_class.value.length == 0 )
  {
    alert("Please enter your job class.");
    theForm.job_class.focus();
    return (false);
  }
  
  if (theForm.profile.value == "" || theForm.profile.value.length == 0 )
  {
    alert("Please enter your company profile.");
    theForm.profile.focus();
    return (false);
  }
  
  return (true);
}

//courses.php 
function Courses(theForm)
{

  if (theForm.session1.value == "")
  {
    alert("Please make a selection for Session I.");
    return (false);
  }	
  
  if (theForm.session2.checked == false)
  {
    alert("Please make a selection for Session II.");
    return (false);
  }
    return (true);
}