﻿//-----------------This script is design and develope by i2eye Interactive---------
                   

// Global Access
 var name = "!@#$%^&*()+=-[]\\\';,/{}~|\":<>?`"; 
 var iPassword = "<>"; 
 var minLength = 5; // Minimum length for password



//----------------------------------------DEFAULT PAGE----------------------------------

//--------------------Function for Already Register User------------

function register_user() 
  {
     if (rUser())
		{
          return true;
      		}
				else
				{
					return false;
				}
	 }


        function rUser() //validation for Already register user
                {
                    
                     if (document.form1.TextBox1.value=="")// Validation for Email-id
                               {
                                           alert("User-Id cannot be left blank.");
                                           document.form1.TextBox1.focus();
                                           return false;
                                    }
                          else
                          {
                                  for (var i = 0; i < document.form1.TextBox1.value.length; i++) 
                                     {
                                         if (iPassword.indexOf(document.form1.TextBox1.value.charAt(i)) != -1) 
                                                {
  	                                                 alert ("Your User-Id contains special symbols < or > are not allowed.");
  	                                                 document.form1.TextBox1.focus();
                                                     return false;
  	                                            }
                                 	}
                         }
                  
                          
                            
                            



//                           var filter  = /^([a-zA-Z0-9_\.])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
//                          
//                           var emailid=document.form1.TextBox1.value;
//                           
//                            if (!filter.test(emailid))
//                                 {
//                                 
//                                  alert("Your email-id contains special symbols or incorrect format.");
//                                  document.form1.TextBox1.focus();
//                                  return false;
//                             
//                                 }
//                                 else
//                                 {
//                                    }

                 
                            if (document.form1.TextBox2.value=="")  //Validation For Password
                           {
                                       alert("Password cannot be left blank.");
                                       document.form1.TextBox2.focus();
                                       return false;
                           }
                   else
                          {
                                  for (var i = 0; i < document.form1.TextBox2.value.length; i++) 
                                     {
                                         if (iPassword.indexOf(document.form1.TextBox2.value.charAt(i)) != -1) 
                                                {
  	                                                 alert ("Password contains special symbols < or > are not allowed.");
  	                                                 document.form1.TextBox2.focus();
                                                     return false;
  	                                            }
                                 	}
                         }
                         
                          
                          
                        
                return true;
    
                }

//------------------------------Function End Here------------------------------------------------


//----------------------------------------Function for New User Register--------------------------

function New_user() 
    {
		if ((newUser()))
	    	{
        		return true;
        		}
			else
		    	{
					return false;
			    	}
	    }
	    


        function newUser() //validation for New user Registration
        {
               
              

    
                        if (document.form1.TextBox3.value=="")// Validation for Email-id
                               {
                                           alert("Email-Id cannot be left blank.");
                                           document.form1.TextBox3.focus();
                                           return false;
                                    }
                  
                          
                            
                            
                           var filter  = /^([a-zA-Z0-9_\.])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
                          
                           var emailid=document.form1.TextBox3.value;
                           
                            if (!filter.test(emailid))  
                                 {
                                alert("Your email-id contains special symbols or incorrect format.");
                                document.form1.TextBox3.focus();
                                return false;

                               
                                 }
                                 else
                                 {
                              
                                    }
                 
 
                  if (document.form1.TextBox4.value=="")  //Validation for First Name
                     {
                                       alert("First Name cannot be left blank.");
                                       document.form1.TextBox4.focus();
                                       return false;
                           }
                   else
                          {
                                  for (var i = 0; i < document.form1.TextBox4.value.length; i++) 
                                     {
                                         if (name.indexOf(document.form1.TextBox4.value.charAt(i)) != -1) 
                                                {
  	                                                 alert ("Special symbols are not allowed.\nPlease remove it and try again.");
  	                                                 document.form1.TextBox4.focus();
                                                    	return false;
  	                                            }
                                 	}
                         }
                         
                         
                         if (document.form1.TextBox5.value=="")  //Validation for Last Name
                           {
                                       alert("Last Name cannot be left blank.");
                                       document.form1.TextBox5.focus();
                                       return false;
                           }
                   else
                          {
                                  for (var i = 0; i < document.form1.TextBox5.value.length; i++) 
                                     {
                                         if (name.indexOf(document.form1.TextBox5.value.charAt(i)) != -1) 
                                                {
  	                                                 alert ("Special symbols are not allowed.\nPlease remove it and try again.");
  	                                                 document.form1.TextBox5.focus();
                                                     return false;
  	                                            }
                                 	}
                               }
                         
               
                         
                         
                         if (document.form1.TextBox6.value=="")  //------Validation For Password
                           {
                                       alert("Password cannot be left blank.");
                                       document.form1.TextBox6.focus();
                                       return false;
                           }
                   else
                          {
                                  for (var i = 0; i < document.form1.TextBox6.value.length; i++) 
                                     {
                                         if (iPassword.indexOf(document.form1.TextBox6.value.charAt(i)) != -1) 
                                                {
  	                                                 alert ("Password contains special symbols < or > are not allowed.");
  	                                                 document.form1.TextBox6.focus();
                                                     return false;
  	                                            }
                                 	}
                         }
                         
                         
                        if (document.form1.TextBox6.value.length < minLength)  //---------check for minimum length
                        {
                            alert('Your Password must be atleast ' + minLength + ' characters long. Try again.');
                            document.form1.TextBox6.focus();
                            return false;
                              }
                         
                          
                         
                       if (document.form1.TextBox7.value=="") //-------- Validation For Alt E-mails   
                           {
                           }
                       else
                        {
                          
                          var filter  = /^([a-zA-Z0-9_\.])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
                          
                          var emailid=document.form1.TextBox7.value;
                           
                            if (!filter.test(emailid))  
                                 {
                                alert("Your email-id contains special symbols or incorrect format.");
                                document.form1.TextBox7.focus();
                                return false;

                               
                                 }
                                 else
                                 {
                              
                                    }
                                    
                              }      
                          
                          if (document.form1.TextBox8.value=="")  //-------Validation for City
                           {
                                      
                           }
                   else
                          {
                                  for (var i = 0; i < document.form1.TextBox8.value.length; i++) 
                                     {
                                         if (name.indexOf(document.form1.TextBox8.value.charAt(i)) != -1) 
                                                {
  	                                                 alert ("Special symbols are not allowed.\nPlease remove it and try again.");
  	                                                 document.form1.TextBox8.focus();
                                                    	return false;
  	                                            }
                                 	}
                         }
                             
                                  
      return true;
}




//---------------------- Validation For Bug Description---------------

function val_bug() 
    {
		if ((bug_desc()))
	    	{
        		return true;
        		}
			else
		    	{
					return false;
			    	}
	    }

// validation Function for Bug description

function bug_desc()
{
// Validation For Name
var iName = "!@#$%^&*()+=-[]\\\';,/~{}|\":<>?`";

 if (document.form1.TextBox10.value=="")
 {
  alert("Name cannot be left blank");
  document.form1.TextBox10.focus();
  return false;
  }
  else
  {
for (var i = 0; i < document.form1.TextBox10.value.length; i++) 
{
 if (iName.indexOf(document.form1.TextBox10.value.charAt(i)) != -1) 
 {
  	alert ("Special symbols are not allowed.\nPlease remove them and try again.");
    document.form1.TextBox10.focus();
  	return false;
  	}
  	}
}

// Validation For your E-mails Id  
           
         
     if(document.form1.TextBox11.value=="")
      {
                 alert("Email-id cannot be left blank");
                 document.form1.TextBox11.focus();
                return false;
      }
      
     var filter  = /^([a-zA-Z0-9_\.])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
                        
     var emailid=document.form1.TextBox11.value;
                           
     if (!filter.test(emailid))  
                                 {
                                alert("Your email-id contains special symbols or incorrect format.");
                                document.form1.TextBox11.focus();
                                return false;

                               
                                 }
                                 else
                                 {
                              
                                    }
    
    // Validation For Bug Description
           
         
     if(document.form1.TextBox12.value=="")
      {
                 alert("Bug description cannot be left blank");
               document.form1.TextBox12.focus();
                return false;
      }
      else
  {
for (var i = 0; i < document.form1.TextBox12.value.length; i++) 
{
 if (iName.indexOf(document.form1.TextBox12.value.charAt(i)) != -1) 
 {
  	alert ("Special symbols are not allowed.\nPlease remove them and try again.");
  	 document.form1.TextBox12.focus();
  	return false;
  	}
  	}
}
     


return true;
}



//-----------------------------Forgot password

//---------------------- Validation For Forgot password---------------

function forgot() 
    {
		if ((bug_desc()))
	    	{
        		return true;
        		}
			else
		    	{
					return false;
			    	}
	    }

// validation Function for Forgot password

function val_forgot()
{
 if(document.form1.TextBox9.value=="")
      {
                 alert("Email-id cannot be left blank");
                 document.form1.TextBox9.focus();
                return false;
      }
      
     var filter  = /^([a-zA-Z0-9_\.])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
                        
     var emailid=document.form1.TextBox9.value;
                           
     if (!filter.test(emailid))  
       {
           alert("Your email-id contains special symbols or incorrect format.");
           document.form1.TextBox9.focus();
           return false;
                             
           }
            else
               {
                     
                }


}


//-----------------------------Check Email-Id

//---------------------- Validation For Email-Id---------------

function EmailId() 
    {
		if ((email()))
	    	{
        		return true;
        		}
			else
		    	{
					return false;
			    	}
	    }

// validation Function for Forgot password

function email()
{
    
     var filter  = /^([a-zA-Z0-9_\.])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
                        
     var emailid=document.form1.TextBox3.value;
                           
     if (!filter.test(emailid))  
       {
           alert("Your email-id contains special symbols or incorrect format.");
           document.form1.TextBox3.focus();
           return false;
                             
     }
      else{   

return true;
}
}
        