<!--
function openWindow(url,x,y,screenX,screenY,top,left) {
mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=' + x + ',height=' + y + ',screenX=' + screenX + ',screenY=' + screenY + ',top=' + top + ',left=' + left);
//window.location.href='thankyou.html';
mywin.focus();
}

function closewindow()
{
  window.close();
}

function printpage() 
{
  window.print();  
}

// used by CheckForm()
function fixElement( element, message ) {
  alert( message );
  element.focus();
}

function CheckSignupForm( form ) {
  // assume form is incomplete
  var passed = false;
  if ( form.name.value == "" ) fixElement(form.name, "Please include your name.");
  else if ( form.email.value == "" ) fixElement(form.email, "Please include your email.");
  else passed = true;
  return passed;
}

function CheckDemoForm( form ) {
  // assume form is incomplete
  var passed = false;
  if ( form.name.value == "" ) fixElement(form.name, "Please include your name.");
  else if ( form.email.value == "" ) fixElement(form.email, "Please include your email.");
  else if ( form.phone.value == "" ) fixElement(form.email, "Please include your phone number.");
  else if ( form.products.value == "" ) fixElement(form.email, "Please list the product(s) you're interested in.");
  else passed = true;
  return passed;
}

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 @ with in 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;
}

  function isNumberValid( Form, error ) {
    if( isEmpty( Form, error ) ) return false;
    for (i=0; i<Form.value.length; i++){
      if( Form.value.charAt(i) < "0" ) {
        alert( error );
        highlight( Form );
        return false;
      }
      if( Form.value.charAt(i) > "9" ) {
        alert( error );
        highlight( Form );
        return false;
      }
    }
    return true;
  }
  
  function validateUSPhone( strValue ) {
  /************************************************
  DESCRIPTION: Validates that a string contains valid
    US phone pattern.
    Ex. (999) 999-9999 or (999)999-9999
  
  PARAMETERS:
     strValue - String to be tested for validity
  
  RETURNS:
     True if valid, otherwise false.
  *************************************************/
    var objRegExp  = /^\([1-9]\d{2}\)\s?\d{3}\-\d{4}$/;
  
    //check for valid us phone with or without space between
    //area code
    return objRegExp.test(strValue);
  }

  
//-->


