/**************************************************************************
 *
 * SCRIPT:       validate.js
 * VERSION:      1.0.3
 * COPYRIGHT:    (c) 2006-2010  All Rights Reserved.
 * AUTHOR(S):    Michael Huffman (mhuffman@mindspring.com)
 *
 * DESCRIPTION:  This script...
 *
 * HISTORY:
 * 2007.01.07  MWH  Created script.
 * 2008.01.11  MWH  Updated this for Brickworld '08.
 * 2008.09.15  MWH  Updated this for Brickworld '09.
 * 2009.12.31  MWH  Updated this for Brickworld '10.
 *
 **************************************************************************/

/**************************************************************************
 *
 * FUNCTION:     handleJoin
 *
 * DESCRIPTION:  This method...
 *
 **************************************************************************/

function handleJoin( theForm ) {

  var error = "";

  if ( ! theForm.member_passwd.value ) {
    error += "Password can not be empty.\n";
  }
   
  if ( theForm.member_passwd.value == theForm.member_passwd_2.value ) {
    // do nothing
  } else {
    error += "Passwords do not match.\n";
  }

  if ( ! theForm.member_email.value ) {
    error += "E-mail address can not be empty.\n";
  }

  if ( theForm.member_email.value == theForm.member_email_2.value ) {
    // do nothing
  } else {
    error += "E-mail address do not match.\n";
  }

  if ( ! theForm.city.value ) {
    error += "City can not be empty.\n";
  }

  var myIndex = theForm.member_age_group.options.selectedIndex;

  if ( theForm.member_age_group.options[myIndex].text == 0 ) {
    error += "Age group must be selected.\n";
  }

  if ( ! theForm.seed.value ) {
    error += "You must enter a code.\n";
  }

  if ( error ) {
    alert( error );
    return false;
  } else {
    document.forms[0].submit();
    return true;
  }

}

/**************************************************************************
 *
 * FUNCTION:     handleLegal
 *
 * DESCRIPTION:  This method...
 *
 **************************************************************************/

function handleLegal( theForm ) {

   var message ="By submitting your registration and payment\, you "
          + "signify that you have read\, understand and agree to all "
          + "terms\, regulations and conditions as stated on this "
          + "website.  And that you are at least 18 years old or older. "
          + "Do you agreee?";

   if ( theForm.Attend.checked ) {
      var answer = confirm( message );
      if ( ! answer ) { theForm.Attend.checked = 0; }
   }

}

/**************************************************************************
 *
 * END: validate.js
 *
 **************************************************************************/
