leaving=true;
function checkStep1(){
  var why = "";

  why += checkFirst(document.getElementById('xfname').value);
  why += checkEmail(document.getElementById('xemail').value);

  if (why != "") {
     alert("Oops! Please fix the errors listed below:\n\n" + why);
     return false;
  }

  leaving=false;
  return true;
}

function checkLogin() {

    var why = "";

    why += checkUserID(document.forms['dologin'].elements['user'].value);
    why += checkPassword(document.forms['dologin'].elements['pass'].value);

    if (why != "") {
       alert("Oops! Please fix the errors listed below:\n\n" + why);
       return false;
    }

    leaving=false;
    return true;
}

function checkFirst (strng) {
     var error = "";
     if (strng == "") { error = "You forgot to enter your First name.\n"; }
     return error;
}

function checkEmail (email) {
  filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  if (email == "" || ! filter.test(email)) {
    return "You did not enter a valid Email address.\n";
  }
  return "";
}

function resend(){
  var resendWin = window.open("sendpass.cgi", "resendWin", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=300,xscreen=0,yscreen=0,top=0,left=0");
}

function showPop(strFile){
  var newWin = window.open(strFile, "newWin", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=400,xscreen=0,yscreen=0,top=0,left=0");
}

function checkUserID (strng) {
     if (strng.length < 5) {
       return "You entered an invalid User ID or Email.\n";
     }
     return "";
}

function checkPassword (strng) {

  if ((strng.length < 4) || (strng.length > 20)) {
    return "You entered an invalid Password.\n";
  }
  return "";
}

function exitPop(strFile){

  if (leaving == 1) {
    var newWin = window.open(strFile, "newWin", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=500,xscreen=0,yscreen=0,top=0,left=0");
  }

}

function getWindowWidth() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return myWidth;
}