function chkMentorApp()
{
   if(document.forms[0].fname.value == "")
   {
      alert('Please fill in your first name.');
      document.forms[0].fname.focus();
      return false;  
   }
   if(document.forms[0].lname.value == "")
   {
      alert('Please fill in your last name.');
      document.forms[0].lname.focus();
      return false;  
   }
   if(document.forms[0].email.value == "")
   {
      alert('Please fill in your email address.');
      document.forms[0].email.focus();
      return false;  
   }
   if(document.forms[0].email.value.length < 6 || 
      document.forms[0].email.value.indexOf("@") == -1 || 
      document.forms[0].email.value.indexOf(".") == -1)
   {
      alert('Email address not valid.');
      document.forms[0].email.focus();
      return false;  
   }
   if(document.forms[0].phone.value == "")
   {
      alert('Please fill in your phone number.');
      document.forms[0].phone.focus();
      return false;  
   }
   var found_it
   for(var i = 0; i < document.forms[0].gender.length; i++)
   { 
      if(document.forms[0].gender[i].checked)
      {
         found_it = document.forms[0].gender[i].value
      } 
   }
   if(!found_it)
   {
      alert("Please specify your gender.")
      document.forms[0].gender[0].focus();
      return false;
   }
   if(document.forms[0].profession.value == "")
   {
      alert('Please fill in your profession.');
      document.forms[0].profession.focus();
      return false;  
   }
   if(document.forms[0].specialization.value == "")
   {
      alert('Please fill in your area of specialization.');
      document.forms[0].specialization.focus();
      return false;  
   }
   if(document.forms[0].work_place.value == "")
   {
      alert('Please fill in your place of work.');
      document.forms[0].work_place.focus();
      return false;  
   }
   if(document.forms[0].job_title.value == "")
   {
      alert('Please fill in your job title.');
      document.forms[0].job_title.focus();
      return false;  
   }
   if(document.forms[0].years_working.value == "")
   {
      alert('Please enter how many years of professional work experience do you have?');
      document.forms[0].years_working.focus();
      return false;  
   }
   if(document.forms[0].education.value == "")
   {
      alert('Please complete the education field.');
      document.forms[0].education.focus();
      return false;  
   }
   if(document.forms[0].resum.value == "")
   {
      alert('Please complete the resume field.');
      document.forms[0].resum.focus();
      return false;  
   }
   if(document.forms[0].read_standards.checked == false)
   {
      alert('Before submitting this form you must acknowledge that you have read and accept\n the Anti-Racism, Anti-Harassment and Anti-Discrimination Standards at Skills for Change ');
      document.forms[0].read_standards.focus();
      return false;  
   }
}

function chkReferralForm()
{
   if(document.forms[0].ref_org.value == "")
   {
      alert('Please fill in the name of the referring organization.');
      document.forms[0].ref_org.focus();
      return false;  
   }
   if(document.forms[0].counsellor_fname.value == "")
   {
      alert('Please fill in counselor\'s first name.');
      document.forms[0].counsellor_fname.focus();
      return false;  
   }
   if(document.forms[0].counsellor_lname.value == "")
   {
      alert('Please fill in counsellor\'s last name.');
      document.forms[0].counsellor_lname.focus();
      return false;  
   }
   if(document.forms[0].counsellor_email.value == "")
   {
      alert('Please fill in counsellor\'s email address.');
      document.forms[0].counsellor_email.focus();
      return false;  
   }
   if(document.forms[0].counsellor_email.value.length < 6 || 
      document.forms[0].counsellor_email.value.indexOf("@") == -1 || 
      document.forms[0].counsellor_email.value.indexOf(".") == -1)
   {
      alert('Counsellor\'s email address not valid.');
      document.forms[0].counsellor_email.focus();
      return false;  
   }
   if(document.forms[0].counsellor_phone.value == "")
   {
      alert('Please fill in counsellor\'s phone number.');
      document.forms[0].counsellor_phone.focus();
      return false;  
   }

   if(document.forms[0].fname.value == "")
   {
      alert('Please fill in client\'s first name.');
      document.forms[0].fname.focus();
      return false;  
   }
   if(document.forms[0].lname.value == "")
   {
      alert('Please fill in client\'s last name.');
      document.forms[0].lname.focus();
      return false;  
   }
   if(document.forms[0].email.value == "")
   {
      alert('Please fill in client\'s email address.');
      document.forms[0].email.focus();
      return false;  
   }
   if(document.forms[0].email.value.length < 6 || 
      document.forms[0].email.value.indexOf("@") == -1 || 
      document.forms[0].email.value.indexOf(".") == -1)
   {
      alert('Client\'s email address not valid.');
      document.forms[0].email.focus();
      return false;  
   }
   if(document.forms[0].phone.value == "")
   {
      alert('Please fill in client\'s phone number.');
      document.forms[0].phone.focus();
      return false;  
   }
   var found_it
   for(var i = 0; i < document.forms[0].gender.length; i++)
   { 
      if(document.forms[0].gender[i].checked)
      {
         found_it = document.forms[0].gender[i].value
      } 
   }
   if(!found_it)
   {
      alert("Please specify client\'s gender.")
      document.forms[0].gender[0].focus();
      return false;
   }
   if(document.forms[0].profession.value == "")
   {
      alert('Please fill in client\'s profession.');
      document.forms[0].profession.focus();
      return false;  
   }
   if(document.forms[0].specialization.value == "")
   {
      alert('Please fill in client\'s area of specialization.');
      document.forms[0].specialization.focus();
      return false;  
   }
   if(document.forms[0].country_origin.value == "")
   {
      alert('Please fill in client\'s country of origin.');
      document.forms[0].country_origin.focus();
      return false;  
   }
   if(document.forms[0].stay_length.value == "")
   {
      alert('Please fill in client\'s length of stay in Canada.');
      document.forms[0].stay_length.focus();
      return false;  
   }
   if(document.forms[0].english_level.value == "")
   {
      alert('Please select client\'s level of english.');
      document.forms[0].english_level.focus();
      return false;  
   }
   if(document.forms[0].emp_prep_course.value == "")
   {
      alert('Please complete the name of client\'s employment preparation course.');
      document.forms[0].emp_prep_course.focus();
      return false;  
   }
   if(document.forms[0].prog_understanding.value == "")
   {
      alert('Please complete client\'s understanding of program requirements.');
      document.forms[0].prog_understanding.focus();
      return false;  
   }
}

function chkMenteeApp()
{
   if(document.forms[0].years_working.value == "")
   {
      alert('Please enter how many years of professional work experience do you have?');
      document.forms[0].years_working.focus();
      return false;  
   }
   if(document.forms[0].education.value == "")
   {
      alert('Please complete the education field.');
      document.forms[0].education.focus();
      return false;  
   }
   if(document.forms[0].resum.value == "")
   {
      alert('Please complete the resume field.');
      document.forms[0].resum.focus();
      return false;  
   }
   if(document.forms[0].why_join.value == "")
   {
      alert('Please describe, why do you want to join our Mentoring Program.');
      document.forms[0].why_join.focus();
      return false;  
   }
   if(document.forms[0].read_standards.checked == false)
   {
      alert('Before submitting this form you must acknowledge that you have read and accept\n the Anti-Racism, Anti-Harassment and Anti-Discrimination Standards at Skills for Change ');
      document.forms[0].read_standards.focus();
      return false;  
   }
}

function chkForum()
{
   if(document.topics.title.value == "")
   {
     alert("Please fill in the title field.");
     document.topics.title.focus();
     return false;
   }
   if(document.topics.entry.value == "")
   {
      alert("Please fill in the message field.");
      document.topics.entry.focus();
      return false;
   }
}

function chkReply()
  {
   if(document.replies.entry.value == "")
    {
     alert("Did you forget to type in your message?");
     document.replies.entry.focus();
     return false;
    }
  }

function confirmDel()
{
   return confirm("Are you sure you want to delete this record?");
}

function confirmUnmatch()
{
   return confirm("Are you sure you want to unmatch this mentee?");
}

function toggle(targetId)
{
   if (document.getElementById)
   {
      target = document.getElementById( targetId );
      if (target.style.display == "none")
      {
         target.style.display = "";
      } 
      else 
      {
         target.style.display = "none";
      }
   }
}