//==========================================================================
// Function: validateSubscriptionCareForm(this)
// Description : Validates email form to make sure required fields entered
// usage: <form action="/cgi-bin/dbform.cgi" method="POST" onsubmit="return checkform(this);">
// note: June 30, 2001
// Author: Ivan Svetic - D.J.'s Micro-Info Inc. (www.deejays.com)


function checkform ( form )
{
   			
	  if (form.Arrangement[0].selected) {
        alert( "WORK ARRANGEMENT is a required field.  Please select a Work Arrangement from the drop down list." );
        form.Arrangement.focus();
        return false ;
  }
  
  if (form.Job_Category[0].selected) {
        alert( "JOB CATEGORY is a required field.  Please select a Job Category from the drop down list." );
        form.Job_Category.focus();
        return false ;
  }
  
  if (form.Job_Title.value == "") {
        alert( "JOB TITLE is a required field.  Please re-submit the form including the job title." );
        form.Job_Title.focus();
        return false ;
    }	
    
    if (form.Location.value == "") {
        alert( "LOCATION is a required field.  Please re-submit the form including the job location." );
        form.Location.focus();
        return false ;
    }	
    
    if (form.Job_Description.value == "") {
        alert( "JOB DESCRIPTION is a required field.  Please re-submit the form including the job description." );
        form.Job_Description.focus();
        return false ;
    }	
    
    if (form.Job_StartDate.value == "") {
        alert( "JOB START DATE is a required field.  Please re-submit the form including the job start date." );
        form.Job_StartDate.focus();
        return false ;
    }	
    
    if (form.Organization_Name.value == "") {
        alert( "ORGANIZATION NAME is a required field.  Please re-submit the form including the organization Name." );
        form.Organization_Name.focus();
        return false ;
    }	
  
  
  if (form.Contact_Name.value == "") {
        alert( "CONTACT NAME is a required field.  Please re-submit the form including your Contact Name." );
        form.Contact_Name.focus();
        return false ;
    }	
	
	if (form.Contact_Phone.value == "") {
        alert( "CONTACT PHONE is a required field.  Please re-submit the form including your phone number." );
        form.Contact_Phone.focus();
        return false ;
    }	
	
	 if (form.Email.value == "" || form.Email.value == null) {
        alert( "CONTACT EMAIL is a required field.  Please re-submit the form including your Email address." );
        form.Email.focus();
        return false ;
    }
	
	// test if valid email address, must have @ and .
	var checkEmail = "@.";
	var checkStr = form.Email.value;
	var EmailValid = false;
	var EmailAt = false;
	var EmailPeriod = false;
	
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkEmail.length;  j++)
		{
			if (ch == checkEmail.charAt(j) && ch == "@")
				EmailAt = true;
			if (ch == checkEmail.charAt(j) && ch == ".")
				EmailPeriod = true;
	  		if (EmailAt && EmailPeriod)
				break;
	  		if (j == checkEmail.length)
				break;
		}
	
	// if both the @ and . were in the string
	if (EmailAt && EmailPeriod)
	{
		EmailValid = true
		break;
	}
	}

	if (!EmailValid)
	{
		alert("The \"email\" field must contain an \"@\" and a \".\".");
		form.Email.focus();
		return false;
	}	
	 
	 
	return true ;
}

//===========================================================================
