// -----------------------------------------------------------------------------

function validatePasswords()
{
  f = document.boform;

  //password1
  if (f.password1.value == "")
  {
    alert("You forgot to fill in the first password");
    return false
  }

  //password2
  if (f.password2.value == "")
  {
    alert("You forgot to fill in the second (verification) password");
    return false
  }

  //password1 (gelijk aan password2?)
  if (f.password1.value != f.password2.value)
  {
    alert("You entered two different passwords");
    return false
  }
}

// -----------------------------------------------------------------------------

function validateAlumniAdd()
{
  f = document.addform;

  //name
  if (f.name.value == "")
  {
    alert("Please enter your name.");
    return false
  }

  //e-mail
  if (f.email.value == "")
  {
    alert("Please enter your e-mail address.");
    return false
  }

  //password1
  if (f.password1.value == "")
  {
    alert("Please enter a password.");
    return false
  }

  //password2
  if (f.password2.value == "")
  {
    alert("Please enter the second password for verification.");
    return false
  }

  //password1 and password2 don't match
  if (f.password1.value != f.password2.value)
  {
    alert("The passwords are different. Please retype the passwords.");
    return false
  }

  return true
}

// -----------------------------------------------------------------------------

function validateChapterAdd()
{
  var f;

  f = document.addchapterform;

  // naam
  if (f.chaptername.value == "")
  {
    alert("U vergat de naam van de chapter in te vullen.");
    return false
  }

  // omschrijving
  if (f.chapterdescription.value == "")
  {
    alert("U vergat een omschrijving van de chapter in te vullen.");
    return false
  }

  return true
}

// -----------------------------------------------------------------------------

function printPagina()
{
  if (window.print) window.print()
}

// -----------------------------------------------------------------------------

function validateConferenceForm()
{
  var f = document.conferenceform;

  // lastname
  if (f.lastname.value == "")
  {
    alert("You forgot to fill out your last name");
    return false
  }

  // firstname
  if (f.firstname.value == "")
  {
    alert("You forgot to fill out your first name");
    return false
  }

  // e-mail
  if (f.email.value == "")
  {
    alert("You forgot to fill out your e-mail address");
    return false
  }

  // organization
  if (f.organization.value == "")
  {
    alert("You forgot to fill out your organization");
    return false
  }

  // position
  if (f.position.value == "")
  {
    alert("You forgot to fill out your position");
    return false
  }

  // address
  if (f.address.value == "")
  {
    alert("You forgot to fill out your address");
    return false
  }

  // city
  if (f.city.value == "")
  {
    alert("You forgot to fill out your city");
    return false
  }

  // postal code
  if (f.postalcode.value == "")
  {
    alert("You forgot to fill out your postal code");
    return false
  }

  // country
  if (f.country.value == "")
  {
    alert("You forgot to fill out your country");
    return false
  }
  
  // hotel? dan ook nights, en startdate (en eigenlijk ook hotel preference!)
  if (f.hotel.checked == true)
  {
    // nights
    if (f.nights.value == "")
    {
      alert("You forgot to fill out the amount of nights");
      return false
    }

    // startdate
    if (f.startdate.value == "")
    {
      alert("You forgot to fill out the startdate");
      return false
    }
  }

  return true
}

// -----------------------------------------------------------------------------

function PopUp(target,width,height)
{
  win=window.open(target,'Conference','width=' + width + ',height=' + height + ',left=100,top=100,location=0,menubar=0,status=0,resizable=0,resizeable=no,scrollbars=no');
	if (!win.opener)win.opener=self;
	if (win.focus)win.focus();
}
window.pup = PopUp;

// -----------------------------------------------------------------------------

function changeParent(pagename)
{
  opener.window.location.href = pagename;
  window.close();
}

// -----------------------------------------------------------------------------

function checkRegister()
{
  var f = document.registerForm;

  if (f.name.value == '')
  {
    alert('Please fill out your name!');
    return false
  }

  if (f.email.value == '')
  {
    alert('Please fill out your email address!');
    return false
  }

  if (f.university.value == '')
  {
    alert('Please fill out your university!');
    return false
  }

  if (f.department.value == '')
  {
    alert('Please fill out your department!');
    return false
  }

  if (f.address.value == '')
  {
    alert('Please fill out your address!');
    return false
  }

  if (f.country.value == '')
  {
    alert('Please fill out your country!');
    return false
  }

  if (f.course.value == '')
  {
    alert('Please fill out your course level!');
    return false
  }

  if (f.students.value == '')
  {
    alert('Please fill out the number of students!');
    return false
  }

  return true
}

// -----------------------------------------------------------------------------