<!--

//--- no menubar etc.
function openWindow(url,x,y) {
  mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + x + ',height=' + y + ',screenX=50,screenY=50,top=50,left=50');
  mywin.focus();
}

function closewindow() {
  window.close();
}

function printWindow() {
   if (window.print)
     {
     window.print();
     }

function openWindow(url,x,y) {
  mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + x + ',height=' + y + '');
}

}

function DisplayForm( Form ) {
  j = Form.elements.length;
  var s = new String;
  for(i=0;i<j;i++) s = s + i + ', ' + Form.elements[i].name + ': ' + Form.elements[i].value + '\n';
  s = s + 'Action: ' + Form.action + '\n';
  alert(s);
}


function highlight( Form ){
  Form.focus();
  Form.select();
}

function isEmpty( Form, error ) {
  if( Form.value == "" ) {
    alert( error );
    highlight( Form );
    return true;
  }
  if( Form.value == " " ) {
    alert( description );
    highlight( Form );
    return true;
  }
  return false;
}

function isEmailValid( Form, error ) {
  if( isEmpty( Form, error ) ) return false;
  badKeys = " /:;$%^&*()!|\~`=+'><"       // a list of invalid email characters
  for( i=0; i<badKeys.length; i++ ) {     // look for invalid characters
    badChar = badKeys.charAt(i);
    if (Form.value.indexOf(badChar, 0) > -1) {
      alert( "There is an invalid character in the email address. Please try again." );
      highlight( Form );
      return false;
    }
  }
  atPos = Form.value.indexOf("@", 0)      // must have a @
  if( atPos == -1 ) {
    alert( "There must be a @ within your customer's email address. Please try again." );
    highlight( Form );
    return false;
  }
  if( atPos < 1 ) {                       // "@" cannot be the first character of the email address
  alert( "The @ character can not be your first character within the email address. Please try again." );
    highlight( Form );
    return false;
  }
  if( Form.value.indexOf("@", atPos+1) != -1){  // only one @
    alert( "Only one @ within the email address is allowed. Please try again." );
    highlight( Form );
    return false;
  }
  periodPos = Form.value.indexOf(".", atPos)
  if( periodPos <= atPos + 2 ) {          // at least one char after the "."
    alert( "Invalid email address. There should be at least 2 characters after the period. Please try again." );
    highlight( Form );
    return false;
  }
  if (periodPos < atPos + 1){             // at least one character between the "@" and the "."
    alert( "There should be at least one '.' after the @ symbol in the email address. Please try again." );
    highlight( Form );
    return false;
  }
  return true;
}


//-->

