function vfc4(myform)
{
  var TotalError;
  var Errormsg;
  TotalError=0;
  Errormsg=" ";
   //return true;

   if (myform.Contact_FirstName.value == "")
      {
        Errormsg += "First Name" + ", ";
        TotalError = 1;
      }
   if (myform.Contact_LastName.value == "" )
      {
        Errormsg+= "Last Name" + ", ";
        TotalError = 1;
     }
  if (myform.Contact_Phone.value == "" || myform.Contact_Phone.value.length < 10)
      {
        Errormsg+= "Phone" + ", ";
        TotalError = 1; 
      }
  if (myform.Contact_Email.value == "" )
      {
        Errormsg+= "Email" + ", ";
        TotalError = 1; 
      }

 if(!myform.Organization_Location[0].checked && !myform.Organization_Location[1].checked)
      {
        Errormsg+= "Organization Location" + ", ";
        TotalError = 1; 
      }



 if(myform.Organization_Location[0].checked)
    {


  if (myform.FEIN.value == "" || myform.FEIN.value.length < 9 || myform.FEIN.value.length > 11)
      {
        Errormsg+= "FEIN# (i.e 99-999-9999)" + ", ";
        TotalError = 1; 
      }
  

  if (! (myform.FEIN.value == "" || myform.FEIN.value.length < 9 || myform.FEIN.value.length > 11))
      {
	if (!IsNumeric(myform.FEIN.value))
	  {
            Errormsg+= "FEIN# (numbers & '-' only,i.e 99-999-9999)" + ", ";
            TotalError = 1; 
          }

	if (IsNumeric(myform.FEIN.value))
	  {
	  if(extranumbers(myform.FEIN.value))
	    {
              Errormsg+= "FEIN# (i.e 99-999-9999)" + ", ";
              TotalError = 1; 
            }
          }
          	    
   

      }



  if (myform.State_Organized.value == "" )
      {
        Errormsg+= "State where Organized" + ", ";
        TotalError = 1; 
      }     
  if (myform.Contact_StreetAddress.value == "" )
      {
        Errormsg+= "Address" + ", ";
        TotalError = 1; 
      }
  if (myform.Contact_City.value == "" )
      {
        Errormsg+= "City" + ", ";
        TotalError = 1; 
      }
  if (myform.Contact_State.value == "" )
      {
        Errormsg+= "State" + ", ";
        TotalError = 1; 
      }
  if (myform.Contact_ZipCode.value == "" || isNaN(myform.Contact_ZipCode.value)  || myform.Contact_ZipCode.value.length < 5)
      {
        Errormsg+= "Zip" + "";
        TotalError = 1; 
      }
  }
 if(myform.Organization_Location[1].checked)
  {      
  if (myform.Contact_FullStreetAddress.value == "" )
      {
        Errormsg+= "Address" + ", ";
        TotalError = 1; 
      }
  if (myform.Your_passport_no.value == "" )
      {
        Errormsg+= "Passport#" + ", ";
        TotalError = 1; 
      }
  if (myform.Your_passport_country.value == "" )
      {
        Errormsg+= "Origion of Country" + ", ";
        TotalError = 1; 
      }
  }




   if (TotalError != 0)
      {
       alert("Please Enter Valid " + Errormsg);
       return false;
      }
   else
     { 
      return (validEmail(myform.Contact_Email.value,'your'))
      //return true;
     }
}
function validEmail(vEmail,vName)
{
	var i=0;
	var inC = "/:,;,#,~$,%,^,&,*,+,|,[,],{,},`,;,:,(,)";
	var atPos = vEmail.indexOf("@",1);
	var pPos = vEmail.indexOf(".",atPos);
	for (i=0; i<inC.length; i++)
	{ badChar = inC.charAt(i)
		if (vEmail.indexOf(badChar,0) > -1)
		{ alert ("Please enter a valid "+vName+"'s email address.");return false; }
	}
	if (atPos == -1) { alert("Please enter a valid "+vName+"'s email address. (including '@')");return false; }
	if (vEmail.indexOf("@",atPos+1) > -1) { alert("Please enter a valid "+vName+"'s email address (including '@').");return false; }
	if (pPos == -1) { alert("Please enter a valid "+vName+"'s email address. (including '.')");return false; }
	if (pPos+3 > vEmail.length) { alert("Please enter a valid "+vName+"'s email address.('.com', '.net', etc.)");return false; }
}



function IsNumeric(sText)
{
   var ValidChars = "0123456789-";
   var IsNumber=true;
   var Char;
   totalnumbers=11;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
           IsNumber = false;
         }
      }
      
   return IsNumber;
   
}



function extranumbers(sText)
{
   var Char;
   tn=11 - (11-sText.length);
   en=true;

 
   for (i = 0; i < sText.length; i++) 
      { 
      Char = sText.charAt(i); 
      if (isNaN(Char))
         {
          tn--;
         }
      }
   if(tn == 9)
     en=false;
 
   return en;
	
}