/*************************************************************
*  Copyright © iWeBB, 2001-2002                              *
*  Carter BloodCare All rights reserved                      *
**************************************************************/
function dlgn() 
{
  var valid = "0123456789"
  var lenxx ;
  var pyear ;
  var vok  = "Y" ;
  fixfocus  = "N";
  string1 = document.calform.p_zip.value;
  string2 = document.calform.p_zip;
  string3 = document.calform.p_phoneh.value;
  string4 = document.calform.p_phoneh;
  string5 = document.calform.p_dob.value;
  string6 = document.calform.p_dob;
  missinginfo = "";

    lenxx = string1.length;


  if (string1 == "") 
  {
    missinginfo += "\n     -  Home Zip";
	if (fixfocus == "N")
	{
	  document.calform.p_zip.focus();
	   fixfocus = "Y";
	}
  }
  else
  {
    if (lenxx != 5)
    {
	missinginfo += "\n     -  Length of Zip is Invalid";
	if (fixfocus == "N")
	{
	  document.calform.p_zip.focus();
	   fixfocus = "Y";
	}	 		
    }
    else
    {
      for (i=0; i<lenxx; i++) 
      {
	if (valid.indexOf(string1.substring(i, i+1)) == "-1")
	{
	  vok = "N";
	}	
      } 
      if (vok == "N")
      {
	missinginfo += "\n     -  Invalid entry!  Only numbers are accepted for Zip!";
	if (fixfocus == "N")
	{
	  document.calform.p_zip.focus();
  	  fixfocus = "Y";
	}
      }
    }
  }


if (string3 == "") 
  {
    missinginfo += "\n     -  Home Phone";
	if (fixfocus == "N")
	{
	  document.calform.p_phoneh.focus();
	   fixfocus = "Y";
	}
  }
  else
  {
    if ((document.calform.p_phoneh.value != "") && 
        (!checkUSPhone(document.calform.p_phoneh))
       )
     {
      document.calform.p_phoneh.focus();
      return false;
     }
   }



    pyear = document.calform.p_dob.value;	
    lenxx = pyear.length;

if (string5 == "") 
  {
    missinginfo += "\n     -  Date of Birth";
	if (fixfocus == "N")
	{
	  document.calform.p_dob.focus();
	   fixfocus = "Y";
	}
  }
   else
  {
    if ((document.calform.p_dob.value != "") && 
        (!checkDOB(document.calform.p_dob))
       )
     {
      document.calform.p_dob.focus();
      return false;
     }
   }


  if (missinginfo != "") 
  {
    missinginfo ="_____________________________\n" +
    "The following information is missing:\n" +
    missinginfo + "\n_____________________________" +
    "\nPlease re-enter and submit again!";
    alert(missinginfo);
    return false;
  }
  else return true;
}




function rdlgn() 
{
  var valid = "0123456789"
  var lenxx ;
  var pyear ;
  var vok  = "Y" ;
  fixfocus  = "N";
  string1 = document.calform.p_zip.value;
  string2 = document.calform.p_zip;
  string5 = document.calform.p_dob.value;
  string6 = document.calform.p_dob;
  missinginfo = "";

    lenxx = string1.length;


  if (string1 == "") 
  {
    missinginfo += "\n     -  Home Zip";
	if (fixfocus == "N")
	{
	  document.calform.p_zip.focus();
	   fixfocus = "Y";
	}
  }
  else
  {
    if (lenxx != 5)
    {
	missinginfo += "\n     -  Length of Zip is Invalid";
	if (fixfocus == "N")
	{
	  document.calform.p_zip.focus();
	   fixfocus = "Y";
	}	 		
    }
    else
    {
      for (i=0; i<lenxx; i++) 
      {
	if (valid.indexOf(string1.substring(i, i+1)) == "-1")
	{
	  vok = "N";
	}	
      } 
      if (vok == "N")
      {
	missinginfo += "\n     -  Invalid entry!  Only numbers are accepted for Zip!";
	if (fixfocus == "N")
	{
	  document.calform.p_zip.focus();
  	  fixfocus = "Y";
	}
      }
    }
  }


  if (document.calform.p_dcid.value == "")
  {
	missinginfo += "\n     -  Access Code";
	if (fixfocus == "N")
	{
	  document.calform.p_dcid.focus();
  	  fixfocus = "Y";
	}
  }


 pyear = document.calform.p_dob.value;	
    lenxx = pyear.length;

if (string5 == "") 
  {
    missinginfo += "\n     -  Date of Birth";
	if (fixfocus == "N")
	{
	  document.calform.p_dob.focus();
	   fixfocus = "Y";
	}
  }
   else
  {
    if ((document.calform.p_dob.value != "") && 
        (!checkDOB(document.calform.p_dob))
       )
     {
      document.calform.p_dob.focus();
      return false;
     }
   }






  if (missinginfo != "") 
  {
    missinginfo ="_____________________________\n" +
    "The following information is missing:\n" +
    missinginfo + "\n_____________________________" +
    "\nPlease re-enter and submit again!";
    alert(missinginfo);
    return false;
  }
  else return true;
}