function TheFormCheck() 
{
	 var jCol;
     jCol=1;
     if(jCol==1)
	 {
		document.getElementById('fname').style.color = '#000000';
		document.getElementById('lname').style.color = '#000000';
		document.getElementById('DOB').style.color = '#000000';
		document.getElementById('email').style.color = '#000000';
		document.getElementById('gender').style.color = '#000000';
		document.getElementById('addr1').style.color = '#000000';
		document.getElementById('addr2').style.color = '#000000';
		document.getElementById('city').style.color = '#000000';
		document.getElementById('state').style.color = '#000000';
		document.getElementById('zcode').style.color = '#000000';
		document.getElementById('country').style.color = '#000000';
		document.getElementById('phone').style.color = '#000000';
		document.getElementById('mobile').style.color = '#000000';
		document.getElementById('pword1').style.color = '#000000';
		document.getElementById('pword2').style.color = '#000000';
		
	 }
    if (document.TheForm.fname.value=="")
     {
       alert("Sorry, you have to fill YourName");
       if(jCol==1)
       {	
       document.TheForm.fname.focus();
       document.getElementById('fname').style.color = 'red';			
	   }
		return false
     }

    if (document.TheForm.lname.value=="")
     {
       alert("Sorry, you have to fill Lastname");
        if(jCol==1)
       {
       document.TheForm.lname.focus();
       document.getElementById('lname').style.color = 'red';			
	   }
       return false
     }
    
    if (document.TheForm.date.value=="")
     {
       alert("Sorry, you have to fill DOB DATE");
        if(jCol==1)
       {	
       document.TheForm.date.focus();
       document.getElementById('DOB').style.color = 'red';			
	   }
	   return false
     }

    if (document.TheForm.month.value=="")
     {
       alert("Sorry, you have to fill DOB MONTH");
        if(jCol==1)
       {	
       document.TheForm.month.focus();
       document.getElementById('DOB').style.color = 'red';			
	   }
	   return false
     }

    if (document.TheForm.year.value=="")
     {
       alert("Sorry, you have to fill DOB Year");
        if(jCol==1)
       {		
       document.TheForm.year.focus();
       document.getElementById('DOB').style.color = 'red';			
	   }
	   return false
     }
    if (document.TheForm.email.value=="")
     {
       alert("Sorry, you have to fill EmailID");
       	 if(jCol==1)
       {
       document.TheForm.email.focus();
      document.getElementById('email').style.color = 'red';			
	   }
	   return false
     }

  if (document.TheForm.email.value!="") 
     {
     if (document.TheForm.email.value.indexOf("@")==-1 || document.TheForm.email.value.indexOf(".")==-1 || document.TheForm.email           .value.indexOf(" ")!=-1 || document.TheForm.email.value.length<6) 
      {alert("Sorry, your email address is not valid.");
       if(jCol==1)
       {
      document.TheForm.email.focus();
      document.getElementById('email').style.color = 'red';			
	   }
	   return false
       }
     }
 
  if (document.TheForm.addr1.value=="")
   {
     alert("Sorry, you have to fill Address1");	
     if(jCol==1)
       {
        document.TheForm.addr1.focus();
        document.getElementById('addr1').style.color = 'red';			
	   }
	   return false
    }
   if (document.TheForm.addr2.value=="")
    {
      alert("Sorry, you have to fill Address2");
       if(jCol==1)
      {	
      document.TheForm.addr2.focus();
      document.getElementById('addr2').style.color = 'red';			
	  }
	   return false
     }
/*if (document.TheForm.addr3.value=="")
{
alert("Sorry, you have to fill Address3");	
document.TheForm.addr3.focus();return false
}*/
   if (document.TheForm.city.value=="")
     {
      alert("Sorry, you have to fill City");
       if(jCol==1)
       {	
      document.TheForm.city.focus();
      document.getElementById('city').style.color = 'red';			
	  }
	   return false
     }
    if (document.TheForm.state.value=="")
     {
      alert("Sorry, you have to select state");
      if(jCol==1)
      {		
      document.TheForm.state.focus();
      document.getElementById('state').style.color = 'red';			
	  }
	   return false
     }

    if (document.TheForm.zipcode.value=="")
     {
      alert("Sorry, you have to fill zipcode");	
      if(jCol==1)
       {	
        document.TheForm.zipcode.focus();
         document.getElementById('zcode').style.color = 'red';			
	  }
	   return false
     }

    if (document.TheForm.zipcode.value!="")
	 {
		if(!isInteger(document.TheForm.zipcode.value))
		{
		alert("Please enter digits from 0-9 only for Zipcode");
		if(jCol==1)
       {	
		document.TheForm.zipcode.focus();
		  document.getElementById('zcode').style.color = 'red';			
	   }
	   return false
		}
	 }

    if (document.TheForm.country.value=="")
     {
       alert("Sorry, you have to fill Country");
       if(jCol==1)
       {
       document.TheForm.country.focus();
       document.getElementById('country').style.color = 'red';			
	   }
	   return false
     }
     
     //var g = ;
     
	if (
	      ((document.TheForm.ccode1.value !="") && 
	      (document.TheForm.scode1.value !="") &&
	      (document.TheForm.pnumber1.value !=""))  ||
	      ((document.TheForm.mccode1.value !="")	&&
	      (document.TheForm.mnumber1.value !=""))
	    )	
	    {
		if ((document.TheForm.ccode1.value !="") && 
	      (document.TheForm.scode1.value !="") &&
	      (document.TheForm.pnumber1.value !=""))
     	  {
     		if (!isInteger(document.TheForm.ccode1.value))
            {
                 alert("Please enter digits from 0-9 only for the field  Country code");
                 if(jCol==1)
                 {	
                     document.TheForm.ccode1.focus();
                     document.getElementById('phone').style.color = 'red';			
	             }
	             return false
            }
     
            if (!isInteger(document.TheForm.scode1.value))
           {
                alert("Please enter digits from 0-9 only for the field  Area code");
                if(jCol==1)
               {	
                  document.TheForm.scode1.focus();
                  document.getElementById('phone').style.color = 'red';			
	           }
	           return false
          }
      
          if (!isInteger(document.TheForm.pnumber1.value))
          {
              alert("Please enter digits from 0-9 only for the field Phone Number");
              if(jCol==1)
              {		
                 document.TheForm.pnumber1.focus();
                 document.getElementById('phone').style.color = 'red';			
	          }
	         return false
          }
        }
        else if  ((document.TheForm.mccode1.value !="")	&&
	              (document.TheForm.mnumber1.value !=""))
	          {
	      	         if(!isInteger(document.TheForm.mccode1.value))
		              {
		                  alert("Please enter digits from 0-9 only for the field Mobile country code");
		                  if(jCol==1)
                          {	
		                      document.TheForm.mccode1.focus();
		                      document.getElementById('mobile').style.color = 'red';			
	                      }
	                      return false
		               }
	                 if (!isInteger(document.TheForm.mnumber1.value))
                        {
                            alert("Please enter digits from 0-9 only for the field Mobile Number");
                            if(jCol==1)
                            {		
                               document.TheForm.mnumber1.focus();
                               document.getElementById('mobile').style.color = 'red';			
	                        }
	                        return false
                       } 	
     
     
	           }
	  }
     else
     {
     	
     	alert("Sorry, you have to fill either phone or mobile number");
		 if(jCol==1)
       {	
       //document.TheForm.ccode1.focus();
      document.getElementById('phone').style.color = 'red';			
	   }
	   return false
     	
     	
     	
     	
     	
     }
   
	    
  
	 	
	
	 if (document.TheForm.pword1.value=="")
      {
        alert("Sorry, you have to fill Password");
        if(jCol==1)
          {		
        document.TheForm.pword1.focus();
        document.getElementById('pword1').style.color = 'red';			
	    }
	   return false
      }
      if(document.TheForm.pword1.value.length <"6")
       {
    	alert("Your password must be atleast 6 characters and Maximum 9 characters.");
    	 if(jCol==1)
          {	
    	document.TheForm.pword1.focus();
       document.getElementById('pword1').style.color = 'red';			
	    }
	   return false
       }
       
        if(document.TheForm.pword1.value.length >"9")
       {
    	alert("Your password must  Maximum 9 characters.");
    	 if(jCol==1)
          {	
    	document.TheForm.pword1.focus();
      document.getElementById('pword1').style.color = 'red';			
	    }
	   return false
       }
      
      if (document.TheForm.pword2.value=="")
      {
        alert("Sorry, you have to fill Confirm Password");	
         if(jCol==1)
          {	
        document.TheForm.pword2.focus();
        document.getElementById('pword2').style.color = 'red';			
	    }
	   return false
      }
      
      if (document.TheForm.pword2.value!="")
      {
	   if(document.TheForm.pword1.value!=document.TheForm.pword2.value)
	   {
	   	alert("Sorry, your Password and Confirm Password is not same.");
	   	 if(jCol==1)
          {	
          	 document.TheForm.pword2.focus();
           document.getElementById('pword2').style.color = 'red';			
	       }
	   return false
	   }
	  
	
      }
      
     if(document.TheForm.same.checked==true)
      {
      	document.TheForm.addr11.value=document.TheForm.addr1.value;
 		document.TheForm.addr22.value=document.TheForm.addr2.value;
		document.TheForm.city1.value=document.TheForm.city.value;
		document.TheForm.state1.value=document.TheForm.state.value;
		document.TheForm.zipcode1.value=document.TheForm.zipcode.value;
		document.TheForm.country1.value=document.TheForm.country.value;
		document.TheForm.ccode2.value=document.TheForm.ccode1.value;
		document.TheForm.scode2.value=document.TheForm.scode1.value;
		document.TheForm.pnumber2.value=document.TheForm.pnumber1.value;
		document.TheForm.mccode2.value=document.TheForm.mccode1.value;
		document.TheForm.mnumber2.value=document.TheForm.mnumber1.value;
      }
      
      
      
	  
	 function isDigit (c)
      {
		 return ((c >= "0") && (c <= "9"))
      }	
     function isInteger(iNumber)
      {
	    var i;
		for (i=0;i<iNumber.length;i++)
	    {
		var c = iNumber.charAt(i);
	
		if (!isDigit(c))
		{
			return false;
		}
	    }
	
  	return true;
}


}