<!--

var ua = window.navigator.userAgent
var IEver = 0
var msie = ua.indexOf ( "MSIE " )
if ( msie > 0 )        // is Microsoft Internet Explorer; return version number
{ IEver = parseInt( ua.substring ( msie+5, ua.indexOf ( ".", msie ) ) ) }


var OWPEwin, iWidth, iHeight

iWidth = 1000;
iHeight = 600;

var wFeatures="width="+iWidth+",height="+iHeight+",toolbar=no,location=no,scrollbars=yes,"+
"channelmode=no,directories=no,status=yes,resizable=yes,fullscreen=no,menubar=no,top=0,left=0";

function FullWinLaunch() {

OWPEwin = window.open("Launch_MyResidence.asp","DBWindow",wFeatures)

return false
}

function AddFacility(xVar,PrevText) { var NewName

if (typeof(document.Qform) == "object" && xVar != "SkipNote") {

conf = confirm("                 This will add a new residence in addition to the existing "+
document.Qform.Facility.length+" that you have on file.\n\nIf you just wish to edit "+
"one of your current residences, click 'Cancel' below and then the 'Launch' button.\n\n "+
"                                                    Do you wish to continue?")
if (!conf) { return false }
 }

if (!PrevText) {
NewName = prompt("Please enter the new residence's name:","")
 } else { 
NewName = prompt("Please enter the new residence's name:",PrevText)
 }

if (NewName == null) { return false }
if (NewName == "") { AddFacility("SkipNote"); return false }

if (NewName.length > 60) {alert("Please enter at most 60 characters for your new residence name.")
AddFacility("SkipNote",NewName); return false }

if (NewName.length < 3) {alert("Please enter at least 3 characters for your new residence name.")
AddFacility("SkipNote",NewName); return false }


  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'&-. 0123456789";
  var checkStr = NewName;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
alert("Please enter only letter and digit characters for your new residence name.")
AddFacility("SkipNote",NewName); return false
  }

location = "AddFacility.asp?FacilityName="+escape(NewName)

return false
}



function Form1_Validator(IDform) {

Email = IDform.Email.value

  if (!Email) {
    alert("Please enter your email address for the \"Email\" field.");
    IDform.Email.focus(); return (false) }

if (Email.indexOf("@") < 1 || Email.indexOf(".") < 1) {
alert("The Email address you entered is NOT in a valid format. Please try again.");
IDform.Email.focus(); return (false)
 }

  if (IDform.PID.value == "")
  {
    alert("Please enter your password for the \"Password\" field.");
    IDform.PID.focus();
    return (false);
  }

  if (IDform.PID.value.length < 6)
  {
    alert("Please enter a minimum of 6 characters in the \"Password\" field.");
    IDform.PID.focus();
    return (false);
  }

  if (IDform.PID.value.length > 12)
  {
    alert("Please enter a maximum of 12 characters in the \"Password\" field.");
    IDform.PID.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz0123456789";
  var checkStr = IDform.PID.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
alert("Please enter only letter, digit characters, \"_\", and NO SPACES in the Password field.")
IDform.PID.focus();
return (false);
  }
  return (true);
}



// Begining of Password Interactive helper

function CorrectNowP1()
{
  if (document.IDform.pass1.value)
 {
var AllOK = true;
PassLen = document.IDform.pass1.value.length;

  if (PassLen < 6 || PassLen > 12)
  {
    alert("Please enter between 6 and 12 charaters in the \"Password\" field.");
    AllOK = false;
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz1234567890";
  var checkStr = document.IDform.pass1.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only alpha-numeric (letter and digit) characters without spaces in "+
"the \"Password\" field.");
    document.IDform.pass1.value = "";
    AllOK = false;
  }

  if (AllOK)
  {
  document.IDform.pass2.focus();
  } else {
  document.IDform.pass1.focus();
  return (false);
  }
 }
}

function CorrectNowP2() {
  if (document.IDform.pass2.value) {
  if (document.IDform.pass1.value != document.IDform.pass2.value) {
   alert("The \"Password\" field and the \"Verify Password\" field don't match. "+
"Please re-verify your password.");

var StartOver = confirm("Would you like to reset your original password?");
if (StartOver) {
document.IDform.pass1.value = "";
document.IDform.pass2.value = "";
document.IDform.pass1.focus();
return (false);
} else {
document.IDform.pass2.focus();
return (false);
       }
  }
 }
}
// END of Password Interactive helper



function PassFields_validation(IDform) {

  if (IDform.OldPass.value == "") {
    alert("Please enter your OLD password in the \"Current Password\" field.");
    IDform.OldPass.focus(); return (false) }

  if (IDform.pass1.value == "") {
    alert("Please enter a new password for the \"Password\" field.");
    IDform.pass1.focus(); return (false) }

  if (IDform.pass2.value == "") {
    alert("Please re-enter your new password in the \"Verify Password\" field.");
    IDform.pass2.focus(); return (false) }

  if (IDform.pass1.value != IDform.pass2.value) {
   IDform.pass1.focus(); return (false) }
}


function ChangePass() {
window.open("Pass_Changes.asp","PassWin","width=860,height=600,scrollbars=yes"); return false
}

// -->
