  function isValidEmail(theEmail) {
    return (theEmail.indexOf(".") > 0) && (theEmail.indexOf("@") > 0);
  }

  function fValidate1(vHost, vChHost) {  

    var vId, vUrl, vParam

    vId = document.fForm1.vId.value; 
    if (vId == "") {
      alert("Please enter your Email Address.");
      document.fForm1.vId.focus();
      return (false);
    }
    
	  if (!isValidEmail(fForm1.vId.value)) {
      alert("Please enter a valid E-mail Address.");
      fForm1.vId.focus();
      return (false);
    }

    vUrl = "wsDefault.asp";
    vParam = "vFunction=SignIn&vCust=CCHS2956&vId=" + escape(document.fForm1.vId.value);
    vWs = WebService(vUrl, vParam);

    if (vWs == "error") {
      alert("We are unable to provide this service, please contact support.");
      return (false);
    }

    if (vWs == "invalid id") {
      alert("That Email Address is not on file. Please Enroll below.");
      document.fForm1.vId.focus();
      return (false);
    }

    vUrl = "http://" + vHost + "/Default.asp";
    vUrl += "?vCust=CCHS2956";
    vUrl += "&vId=" + vId;
    vUrl += "&vSource=http://" + vChHost + "/GHS_EN/default.asp";

//  alert (vUrl);
    location.href = vUrl;
  }
 



  function fValidate2(vHost, vChHost) {  
    var vUrl, vParam

    var vFirstName = document.fForm2.vFirstName.value; 
    var vLastName  = document.fForm2.vLastName.value; 
    var vId1       = document.fForm2.vId1.value; 
    var vId2       = document.fForm2.vId2.value; 
    var vOrg   	   = document.fForm2.vOrg.value; 
    var vType 	   = document.fForm2.vType.value; 	
  	var vJob1	   = document.fForm2.vJob1.value; 
	var vJob2 	   = document.fForm2.vJob2.value;
    var vProvince  = document.fForm2.vProvince.value;
	var vCountry   = document.fForm2.vCountry.value;


    if (vFirstName == "")  {
      alert("Please enter your First Name.");
      document.fForm2.vFirstName.focus();
      return (false);
    }

    if (vLastName == "")  {
      alert("Please enter your Last Name.");
      document.fForm2.vLastName.focus();
      return (false);
    }
    
    if (vId1 == "")  {
      alert("Please enter your Email Address.");
      document.fForm2.vId1.focus();
      return (false);
    }

	  if (!isValidEmail(fForm2.vId1.value)) {
      alert("Please enter a valid E-mail Address.");
      fForm2.vId1.focus();
      return (false);
    }
 
    if (vId2 == "") {
      alert("Please re-enter your Email Address.");
      document.fForm2.vId2.focus();
      return (false);
    }

    if (!isValidEmail(fForm2.vId2.value)) {
      alert("Please enter a valid E-mail Address.");
      fForm2.vId2.focus();
      return (false);
    }

    if (vId1 != vId2) {
      alert("Please ensure both Email Addresses are the same.");
      document.fForm2.vId1.focus();
      return (false);
    }

	if (vOrg == "")  {
      alert("Please enter your Organization.");
      document.fForm2.vOrg.focus();
      return (false);
    }

    vUrl = "wsDefault.asp";
    vParam = "vFunction=Enroll&vCust=CCHS2956" + "&vId=" + escape(document.fForm2.vId1.value);
    vWs = WebService(vUrl, vParam);

    if (vWs == "error") {
      alert("We are unable to provide this service, please contact support.");
      return (false);
    }

    if (vWs == "invalid cust") {
      alert("The Account Id is invalid - please contact systems.");
      document.fForm2.vId1.focus();
      return (false);
    }

    if (vWs == "invalid id") {
      alert("That Email Address is already on file. If you are already enrolled, then please sign-in above.");
      document.fForm1.vId.focus();
      return;
    }

    vUrl = "http://" + vHost + "/Default.asp";
    vUrl += "?vCust=CCHS2956";
    vUrl += "&vId=" + vId1;
    vUrl += "&vFirstName=" + vFirstName;
    vUrl += "&vLastName=" + vLastName;
    vUrl += "&vEmail=" + vId1;
    vUrl += "&vMemo=" + vOrg + "|" + vType + "|" + vJob1 + "|" + vJob2 + "|" + vProvince + "|" + vCountry;
    vUrl += "&vSource=http://" + vChHost + "/GHS_EN/default.asp";

//  alert (vUrl);
    location.href = vUrl;

 }

