
  /*Start of form validation:*/
  function validateForm(formElement) {
    
    //Team Name
    if (formElement.TEAM.value.length < 3)
      return focusElement(formElement.TEAM,
       'Please enter a team name.');
	  
	//Last Name
    if (formElement.LAST_NAME.value.length < 1)
      return focusElement(formElement.LAST_NAME,
       'Please enter your last name.');
	  
	  
	//First Name
    if (formElement.FIRST_NAME.value.length < 1)
      return focusElement(formElement.FIRST_NAME,
       'Please enter your first name.');
	  
	  
	//Team Name
    if (formElement.ROLE.value.length < 1)
      return focusElement(formElement.ROLE,
       'Please enter your role.');
	  
	  
	//Team Name
    if (formElement.TEL_NUMBER.value.length < 10)
      return focusElement(formElement.TEL_NUMBER,
       'Please enter your phone number.');
	  
	  
	//Team Name
    if (formElement.EMAIL.value.length < 3)
      return focusElement(formElement.EMAIL,
       'Please enter your e-mail');
  
   //passwd confirmation
    //if (formElement.confpass.value != formElement.Passwd.value)
      //return focusElement(formElement.confpass,
       //'Your passwords do not match. Make sure that that your password confirmation matches the one you entered above.');
 
     //hint
    //if (formElement.custom_hint.value.length < 6)
      //return focusElement(formElement.custom_hint,
       //'Please enter a sample hint question.');

     //ans
    //if (formElement.custom_hint_ans.value.length < 1)
      //return focusElement(formElement.custom_hint_ans,
       //'Please enter an answer to your hint question.');



    //If all is OK, return true and let the form submit
    return true;
  }
  /*End of form validation.*/

  /*Below are various functions that can be
   re-used in your own validation scripts:*/
  function focusElement(element, errorMessage) {
    //Tell the user an error has been made
    alert((errorMessage.length > 0) ? errorMessage :
      'You did not enter valid data; Please try again');
    //Select the text in the input box, and focus it (if possible)
    if (element.select) element.select();
    if (element.focus) element.focus();
  
    return false;
  }
  function countSelected(formElement, inputType, inputName) {
    //If there is no input type, make it checkbox
    if (inputType == null) inputType = 'checkbox';
    var returnValue = 0;
    //Loop for all elements in this form
    for (var loopCounter = 0; loopCounter < formElement.length; loopCounter++) {
      //If this element is the wanted type
      var element = formElement.elements[loopCounter];
      if (element.type == inputType && element.checked == true) {
        //If we have the correct control name, increment the count
        if (inputName.length > 0)
          if (element.name == inputName)
            returnValue++;
        else
          returnValue++
      }
    }
    //Return the count
    return returnValue;
  }
  function countSelectedOptions(selectElement) {
    var returnValue = 0;
    //Loop for all options
    for (var loopCounter = 0; loopCounter < selectElement.options.length; loopCounter++)
      if (selectElement.options[loopCounter].selected == true)
        returnValue++;
    return returnValue;
  }
  function validEmail(email) {
    var emailRE = new RegExp(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/);
    return emailRE.test(email);
  }
  /*End of functions.*/