function Validator(theForm)
{
  var error = "";
  if (theForm.email.value == "") {
     error += "You must include an accurate email address for a response. ";
  }
  if ((theForm.email.value.indexOf('@',0) == -1 ||
       theForm.email.value.indexOf ('.',0) == -1) &&
       theForm.email.value != "") {
     error += "Please verify that your email address is valid.";
  }
  if (theForm.title.options[0].selected == true) {
	  error += "Please select a title from the drop-down list. ";
  }
  if (theForm.firstname.value == "") {
    error += "Please give your first name. ";
  }
  if (theForm.lastname.value == "") {
    error += "Please give your last name. ";
  }
  if (theForm.company.value == "") {
	  error += "Please give the name of your company, university or organisation. ";
  }
  if (theForm.address.value == "") {
    error += "Please give the address of your organisation. ";
  }
  if (theForm.telephone.value == "") {
    error += "Please give a telephone number. ";
  }
  if (theForm.car.checked) {
    if (theForm.carreg.value == "") {
      error += "Please provide the registration of your car. ";
    }
  }

  if (error != "") {
	  toggleBox("error",1);
          document.getElementById("error").innerText = error;
    alert(error);
    return (false);
  } else {
    return (true);
  }
  }

function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
	obj.style.visibility = iState ? "visible" : "hidden";
	obj.style.display = iState ? '' : "none";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
}

function checkCar(myField) { 
	if (myField.checked) {
		document.getElementById("carpool").disabled=0;
		document.getElementById("carreg").disabled=0;
		document.getElementById("cardep").style.color = "black";
		} else {
		document.getElementById("carpool").disabled=1;
		document.getElementById("carreg").disabled=1;
		document.getElementById("cardep").style.color = "gray";
	}
}


