// JavaScript Document
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function jemail(user, domain, suffix, txtDisplay) {
	document.write('<a href="' + 'mailto:' + user + '@' + domain + '.' + suffix + '">' + txtDisplay + '</a>');
}


function CheckForm_App() {if (CheckFormFields_App() == true) {document.getElementById("frmApp").submit();}}
function CheckFormFields_App() {
  var strMsgBody="";
  var strComma="";
  
  if (document.getElementById("LastName").value == "") 
     {alert('Please provide your last name.');
     document.getElementById("LastName").focus();
     return (false);}
  
  if (document.getElementById("FirstName").value == "") 
     {alert('Please provide your first name.');
     document.getElementById("FirstName").focus();
     return (false);}
	 
  if (document.getElementById("HomeAddress").value == "") 
     {alert('Please provide your home address.');
     document.getElementById("HomeAddress").focus();
     return (false);}
  if (document.getElementById("HomeCity").value == "") 
     {alert('Please provide the city of your home address.');
     document.getElementById("HomeCity").focus();
     return (false);}
  if (document.getElementById("HomeState").value == "") 
     {alert('Please provide the state of your home address.');
     document.getElementById("HomeState").focus();
     return (false);}
  if (document.getElementById("HomeZip").value == "") 
     {alert('Please provide the zip code of your home address.');
     document.getElementById("HomeZip").focus();
     return (false);}     
  var checkOK = "0123456789";
  var checkStr = document.getElementById("HomeZip").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 digit characters in the zip code field.");
    document.document.getElementById("HomeZip").focus();
    return (false);
  }

  if (document.getElementById("WorkAddress").value == "") 
     {alert('Please provide your work address.');
     document.getElementById("WorkAddress").focus();
     return (false);}
  if (document.getElementById("WorkCity").value == "") 
     {alert('Please provide the city of your work address.');
     document.getElementById("WorkCity").focus();
     return (false);}
  if (document.getElementById("WorkState").value == "") 
     {alert('Please provide the state of your work address.');
     document.getElementById("WorkState").focus();
     return (false);}
  if (document.getElementById("WorkZip").value == "") 
     {alert('Please provide the zip code of your work address.');
     document.getElementById("WorkZip").focus();
     return (false);}     
  var checkOK = "0123456789";
  var checkStr = document.getElementById("WorkZip").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 digit characters in the zip code field.");
    document.document.getElementById("WorkZip").focus();
    return (false);
  }

  if (document.getElementById("BillingAddress").value == "") 
     {alert('Please provide your billing address.');
     document.getElementById("BillingAddress").focus();
     return (false);}
  if (document.getElementById("BillingCity").value == "") 
     {alert('Please provide the city of your billing address.');
     document.getElementById("BillingCity").focus();
     return (false);}
  if (document.getElementById("BillingState").value == "") 
     {alert('Please provide the state of your billing address.');
     document.getElementById("BillingState").focus();
     return (false);}
  if (document.getElementById("BillingZip").value == "") 
     {alert('Please provide the zip code of your billing address.');
     document.getElementById("BillingZip").focus();
     return (false);}     
  var checkOK = "0123456789";
  var checkStr = document.getElementById("BillingZip").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 digit characters in the zip code field.");
    document.document.getElementById("BillingZip").focus();
    return (false);
  }
  
  
  if (document.getElementById("EmailAddress").value == "") 
     {alert('Please provide your email address.');
     document.getElementById("EmailAddress").focus();
     return (false);}     

  if (document.getElementById("LicenseType").value == "") 
     {alert('Please provide your type of licenses to practice.');
     document.getElementById("LicenseType").focus();
     return (false);}     

  if (document.getElementById("CurrentPractice").value == "") 
     {alert('Please provide your current practice.');
     document.getElementById("CurrentPractice").focus();
     return (false);}     

  if (document.getElementById("PracticeSetting").value == "") 
     {alert('Please provide your practice setting.');
     document.getElementById("PracticeSetting").focus();
     return (false);}     

  if (document.getElementById("CardNum").value == "") 
     {alert('Please provide your credit card number.');
     document.getElementById("CardNum").focus();
     return (false);}     

  if (document.getElementById("CardExpMM").value == "") 
     {alert('Please provide your credit card expiration date.');
     document.getElementById("CardExpMM").focus();
     return (false);}     

  if (document.getElementById("CardExpYY").value == "") 
     {alert('Please provide your credit card expiration date.');
     document.getElementById("CardExpYY").focus();
     return (false);}     

  if (document.getElementById("CardName").value == "") 
     {alert('Please provide the name on your credit card.');
     document.getElementById("CardNum").focus();
     return (false);}
	 
  return (true);
}

function CheckForm_App2(){
	if (CheckFormFields_App2()==true)
		{document.getElementById("frmApp").submit();}
}

function CheckFormFields_App2(){
  if (document.getElementById("LastName").value == "") 
     {alert('Please provide your last name.');
     document.getElementById("LastName").focus();
     return (false);}
  if (document.getElementById("FirstName").value == "") 
     {alert('Please provide your first name.');
     document.getElementById("FirstName").focus();
     return (false);	} 
  if (document.getElementById("BillingAddress").value == "") 
     {alert('Please provide your billing address.');
     document.getElementById("BillingAddress").focus();
     return (false);}
  if (document.getElementById("BillingCity").value == "") 
     {alert('Please provide the city of your billing address.');
     document.getElementById("BillingCity").focus();
     return (false);}



  if (document.getElementById("BillingState").value == "") 
     {alert('Please provide the state of your billing address.');
     document.getElementById("BillingState").focus();
     return (false);}
  if (document.getElementById("BillingZip").value == "") 
     {alert('Please provide the zip code of your billing address.');
     document.getElementById("BillingZip").focus();
     return (false);}     
  if (isNaN(document.getElementById("BillingZip").value) == true) {
     alert("Please enter only digit characters in the zip code field.");
     document.getElementById("BillingZip").focus();
     return (false);}
   if (document.getElementById("EmailAddress").value == "") 
     {alert('Please provide your email address.');
     document.getElementById("EmailAddress").focus();
     return (false);}     
  if (document.getElementById("CardNum").value == "") 
     {alert('Please provide your credit card number.');
     document.getElementById("CardNum").focus();
     return (false);}     
  if (document.getElementById("CardExpMM").value == "") 
     {alert('Please provide your credit card expiration date.');
     document.getElementById("CardExpMM").focus();
     return (false);}     
  if (document.getElementById("CardExpYY").value == "") 
     {alert('Please provide your credit card expiration date.');
     document.getElementById("CardExpYY").focus();
     return (false);}     
  if (document.getElementById("CardName").value == "") 
     {alert('Please provide the name on your credit card.');
     document.getElementById("CardNum").focus();
     return (false);}
  return (true);
}
