﻿// JScript File

function IsValid()
        {
          if(document.getElementById('txtUserName').value=="" || document.getElementById('txtUserName').value=='Your Name')
            {
                alert("Please Enter Your Name");
                document.getElementById('txtUserName').focus();
                return false;
            }
           else  if(document.getElementById('txtUserName').value!="" || document.getElementById('txtUserName').value!='Your Name')
           {
            if(!isValidName1(document.getElementById('txtUserName').value ))
            {
                alert("Please Enter Valid Your Name");
                document.getElementById('txtUserName').focus();
                return false;
            }
           }
           
           if(document.getElementById('txtUserEmailID').value=="" || document.getElementById('txtUserEmailID').value=='Your Email ID')
            {
              alert("Please Enter Your Email ID");
              document.getElementById("txtUserEmailID").focus();
              return false;
            }
            else if(document.getElementById('txtUserEmailID').value!="" || document.getElementById('txtUserEmailID').value!='Your Email ID')
              {
                 
                 if(!isValidEmail(document.getElementById('txtUserEmailID').value))
                 {
                    alert("Please Enter Valid Your Email ID");
                   document.getElementById("txtUserEmailID").focus();
                   return false;

                 }
              
              }
              
              
              
            if((document.getElementById('txtName4').value=="" || document.getElementById('txtName4').value=='Friends Name') &&  (document.getElementById('txtName5').value=="" ||  document.getElementById('txtName5').value=='Friends Name') && (document.getElementById('txtName6').value=="" || document.getElementById('txtName6').value=='Friends Name') && (document.getElementById('txtEmailId4').value=="" || document.getElementById('txtEmailId4').value=='Friends  Email ID') && (document.getElementById('txtEmailId5').value=="" || document.getElementById('txtEmailId5').value=='Friends  Email ID') && (document.getElementById('txtEmailId6').value=="" || document.getElementById('txtEmailId6').value=='Friends  Email ID'))  
            {
               alert("Please Enter At Least One Friends Name And Friends Email ID");
                    document.getElementById('txtName4').focus();
                    return false;
            }
            if(document.getElementById('txtName4').value=="" || document.getElementById('txtName4').value=='Friends Name')
            {
                if(!document.getElementById('txtEmailId4').value=="" || document.getElementById('txtEmailId4').value=='Friends  Email ID')
                {
                    alert("Please Enter Both Friends Name And Friends  Email ID");
                    document.getElementById('txtName4').focus();
                    return false;
                }
            }
            else if(document.getElementById('txtName4').value!="" || document.getElementById('txtName4').value!='Friends Name')
            {
               if(!isValidName1(document.getElementById('txtName4').value))
               {
                    alert("Please Enter Valid Freind's Name");
                    document.getElementById('txtName4').focus();
                    return false;
               }
               if(document.getElementById('txtEmailId4').value=="" || document.getElementById('txtEmailId4').value=='Friends  Email ID')
                {
                     alert("Please Enter Both Friends Name And Friends  Email ID");
                    document.getElementById('txtEmailId4').focus();
                    return false;
                }

                if(!isValidEmail(document.getElementById('txtEmailId4').value))

                {
                    alert("Please Enter Valid Friends  Email ID");
                    document.getElementById('txtEmailId4').focus();
                    return false;
                }
            

            }


           if((document.getElementById('txtName5').value=="" || document.getElementById('txtName5').value=='Friends Name') && (document.getElementById('txtEmailId5').value!="" && document.getElementById('txtEmailId5').value!='Friends  Email ID'))
            {
                  if(!isValidEmail(document.getElementById('txtEmailId5').value))
                {
                   
                    alert("Please Enter Valid Friends Email Id");
                    
                    document.getElementById('txtEmailId5').focus();
                    return false;
                }
                    alert("Please Enter Both Name And Friends  Email ID");
                    document.getElementById('txtName5').focus();
                    return false;
                    
           
            }
            else if((document.getElementById('txtName5').value!="" && document.getElementById('txtName5').value!='Friends Name') && (document.getElementById('txtEmailId5').value=="" || document.getElementById('txtEmailId5').value=='Friends  Email ID'))
            {
                if(!isValidName1(document.getElementById('txtName5').value))
               {
                    alert("Please Enter Valid Freinds Name");
                    
                    document.getElementById('txtName5').focus();
                    return false;
               }
                    alert("Please Enter Both Name And Friends  Email ID");
                    document.getElementById('txtEmailId5').focus();
                    return false;
           
            }
             else if((document.getElementById('txtName5').value!="" && document.getElementById('txtName5').value!='Friends Name') && (document.getElementById('txtEmailId5').value!="" && document.getElementById('txtEmailId5').value!='Friends  Email ID'))
            {
            if(!isValidName1(document.getElementById('txtName5').value))
               {
                    alert("Please Enter Valid Freind's Name");
                    document.getElementById('txtName5').focus();
                    return false;
               }
               
               if(!isValidEmail(document.getElementById('txtEmailId5').value))
                {
                   
                    alert("Please Enter Valid Friends Email Id");
                    
                    document.getElementById('txtEmailId5').focus();
                    return false;
                }
            
            }
            
            
            
             if((document.getElementById('txtName6').value=="" || document.getElementById('txtName6').value=='Friends Name') && (document.getElementById('txtEmailId6').value!="" && document.getElementById('txtEmailId6').value!='Friends  Email ID'))
            {
                  if(!isValidEmail(document.getElementById('txtEmailId6').value))
                {
                   
                    alert("Please Enter Valid Friends Email Id");
                    
                    document.getElementById('txtEmailId6').focus();
                    return false;
                }
                    alert("Please Enter Both Name And Friends  Email ID");
                    document.getElementById('txtName6').focus();
                    return false;
                    
           
            }
            else if((document.getElementById('txtName6').value!="" && document.getElementById('txtName6').value!='Friends Name') && (document.getElementById('txtEmailId6').value=="" || document.getElementById('txtEmailId6').value=='Friends  Email ID'))
            {
                if(!isValidName1(document.getElementById('txtName6').value))
               {
                    alert("Please Enter Valid Freinds Name");

                    document.getElementById('txtName6').focus();
                    return false;
               }
                    alert("Please Enter Both Name And Friends  Email ID");
                    document.getElementById('txtEmailId6').focus();
                    return false;
           
            }
            else if((document.getElementById('txtName6').value!="" && document.getElementById('txtName6').value!='Friends Name') && (document.getElementById('txtEmailId6').value!="" && document.getElementById('txtEmailId6').value!='Friends  Email ID'))
            {
            if(!isValidName1(document.getElementById('txtName6').value))
               {
                    alert("Please Enter Valid Freind's Name");
                    document.getElementById('txtName6').focus();
                    return false;
               }
               
               if(!isValidEmail(document.getElementById('txtEmailId6').value))
                {
                   
                    alert("Please Enter Valid Friends Email Id");
                    
                    document.getElementById('txtEmailId6').focus();
                    return false;
                }
            
            }
            
            
             if((document.getElementById('txtUserEmailID').value!="" && document.getElementById('txtUserEmailID').value!='Your Email ID') && (document.getElementById('txtEmailId4').value!="" && document.getElementById('txtEmailId4').value!='Friends  Email ID') )
            {
                if(document.getElementById('txtUserEmailID').value==document.getElementById('txtEmailId4').value)
                {
                        alert("Your Email ID and Friends Email Is Repeated");
                        document.getElementById('txtEmailId4').focus();
                        return false;
                 }
            }
            
             if((document.getElementById('txtUserEmailID').value!="" && document.getElementById('txtUserEmailID').value!='Your Email ID') && (document.getElementById('txtEmailId4').value!="" && document.getElementById('txtEmailId4').value!='Friends  Email ID'))
            {
                if(document.getElementById('txtUserEmailID').value==document.getElementById('txtEmailId5').value)
                {
                        alert("Your Email ID and Friends Email Is Repeated");
                        document.getElementById('txtEmailId5').focus();
                        return false;
                 }
            }
            
             if((document.getElementById('txtUserEmailID').value!="" && document.getElementById('txtUserEmailID').value!='Your Email ID') && (document.getElementById('txtEmailId4').value!="" && document.getElementById('txtEmailId4').value!='Friends  Email ID') )
            {
                if(document.getElementById('txtUserEmailID').value==document.getElementById('txtEmailId6').value)
                {
                        alert("Your Email ID and Friends Email Is Repeated");
                        document.getElementById('txtEmailId6').focus();
                        return false;
                 }
            }
            
            
             if((document.getElementById('txtEmailId4').value!="" && document.getElementById('txtEmailId4').value!='Friends  Email ID') && (document.getElementById('txtEmailId5').value!="" && document.getElementById('txtEmailId5').value!='Friends  Email ID'))
            {
                if(document.getElementById('txtEmailId4').value==document.getElementById('txtEmailId5').value)
                {
                        alert("Friends Email Is Repeated");
                        document.getElementById('txtEmailId5').focus();
                        return false;
                 }
            }
            if((document.getElementById('txtEmailId4').value!="" && document.getElementById('txtEmailId4').value!='Friends  Email ID') && (document.getElementById('txtEmailId6').value!="" && document.getElementById('txtEmailId6').value!='Friends  Email ID'))
            {
                if(document.getElementById('txtEmailId4').value==document.getElementById('txtEmailId6').value)
                {
                        alert("Friends Email Is Repeated");
                        document.getElementById('txtEmailId6').focus();
                        return false;
                }
            }
             if((document.getElementById('txtEmailId5').value!="" && document.getElementById('txtEmailId5').value!='Friends  Email ID') && (document.getElementById('txtEmailId6').value!="" && document.getElementById('txtEmailId6').value!='Friends  Email ID'))
            {
                if(document.getElementById('txtEmailId5').value==document.getElementById('txtEmailId6').value)
                {
                        alert("Friends Email Is Repeated");
                        document.getElementById('txtEmailId6').focus();
                        return false;
                }
            }
            
            
            return true;

               
           
        }

