var ErrorMessage=""; // Global Error Message var for Form Checking


function addresscheck(EmailAddress)
  {
  var n=0; // variable used for subscripting
  var At=false; //variable used to flag presence of the @ character
  var LowerCaseEmailAddress=EmailAddress.toLowerCase();
  if (EmailAddress != LowerCaseEmailAddress) {ErrorMessage=ErrorMessage+'Please use all lower case letters\n';}
  if (EmailAddress == 'mybox@mymailserver.com') {ErrorMessage=ErrorMessage+'mybox@mymailserver.com is not your email address\n';}
  if (EmailAddress.length<6) {ErrorMessage=ErrorMessage+'Email address entered is too short to be valid\n';}
  for (n=0;n<=EmailAddress.length;n++)
    {
    var C=EmailAddress.charAt(n); //assignment done so that a one character variable could be used in if statements
    if ( (C=='<') || (C=='>') || (C=='/') || (C=='\\') || (C=='(') || (C==')') || (C==';') )
      { ErrorMessage=ErrorMessage+' Special character '+C+' is not allowed in an email address\n'}
    if (C=='@') {At=true;}
    if (C==' ') {ErrorMessage=ErrorMessage+'A blank was found before, after or embedded in the email address. Blanks are not allowed in an email address\n';}
    }
  if (At==false) {ErrorMessage=ErrorMessage+'The email address must contain an @ character between the box and mail server names\n';}
  if (ErrorMessage.length > 0)
    {
//    window.alert(ErrorMessage);
    return false;
    }
  else {return true;}
  }

function openWindow(location)
  {
  if (this.screen)
    {
    windowWidth = this.screen.width / 2;
    windowHeight = this.screen.height / 2;
    }
  else
    {
    windowWidth = 350;
    windowHeight = 350;
    }

  windowHandle=window.open(location,"outsideLocation","toolbar=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=" + windowWidth + ",height=" + windowHeight);
  return(false);
  }

function changeClass(oElement, sClass)
  {
  oElement.className = sClass;
  }
