<!-- Hide -*- C++ -*-
// File: bungeeform.js		-*- C++ -*- 
// Created by: Alex Knowles (alex@ed.ac.uk) Fri Nov  1 17:49:35 1996
// Last Modified: Time-stamp: <05 Sep 97 1420 Alex Knowles> 
// RCS $Id: bungeeform.js,v 1.1 2002/03/26 18:03:32 ark Exp $ 

function same_email(form)
{
  form.Email.value=form.email.value;
}

function choose_type( form )
{
  var str=ARKoption_str(form.Type);
  
  if( str == "Other..." ){
    form.othertype.value=prompt("Describe the other bungee type here:","");
  } else {
    form.othertype.value="";
  }
}

function validate(form)
{
  ok=true;
  errorstr="";
  
  if( ARKis_str( form.email.value ) && !ARKis_email( form.email.value ) ){
    ok=false;
    errorstr += "Your Email address does not look correct\n\n";
  }
  
  if( ARKis_str( form.Email.value ) && !ARKis_email( form.Email.value ) ){
    ok=false;
    errorstr += "The Bungee Club's Email address does not look correct\n\n";
  }
  
  if( !ARKis_str( form.Company.value ) ){
    ok=false;
    errorstr += "You must specify a club name\n\n";
  }
  
  if( !ARKis_str( form.Address.value ) ){
    ok=false;
    errorstr += "You must specify a Location\n\n";
  }
  
  if( ARKis_str( form.Height.value ) &&
      !ARKis_num( form.Height.value )){
    ok=false;
    errorstr+="That height doesn't look like a number to me!\n\n";
  }
    
  if( ARKis_str(errorstr) ){
    if( !ok ){
      errorstr += "The form was NOT submitted due to these problems\n";
    } else {
      errorstr += "However form was submitted with these values\n";
    }
    
    alert("The following errors were discovered with the form\n\n" +
	  errorstr);
  }
  
  return ok;
}

// -->

