﻿var iName = "!@#$%^&*()+=-[]\\\';,/{}~|\":<>?`"; 

//------------------------------Function for comment
function check_validity() 
		    {
				if ((isname()))
				{
         			
         			
         			return true;
         			       			         			
         			
         			
				}
				else
				{
					return false;
				}
			}
			
			                 	
	function isname()
{
          
            
	                if (document.form1.TextBox2.value=="")
                           {
                                       alert("Comment cannot be left blank.");
                                       document.form1.TextBox2.focus();
                                       return false;
                           }
                   else
                          {
                                  for (var i = 0; i < document.form1.TextBox2.value.length; i++) 
                                     {
                                         if (iName.indexOf(document.form1.TextBox2.value.charAt(i)) != -1) 
                                                {
  	                                                 alert ("Special Symbols are not allowed.\nPlease remove it and try again.");
  	                                                 document.form1.TextBox2.focus();
                                                    	return false;
  	                                            }
                                 	}
                         }
                  return true;
}

//----------------------------------------Function for Already Register User--------------------------

function register_user() 
		    {
				if ((rUser()))
				{
         			
         			
         			return true;
         			       			         			
         			
         			
				}
				else
				{
					return false;
				}
			}


function rUser() //validation for register user
{
      var iPassword = "<>"; 
    
            
	                if (document.form1.TextBox1.value=="")// Function for Username
                           {
                                       alert("Username 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 ("Username contains special Symbols < or > are not allowed.");
  	                                                 document.form1.TextBox1.focus();
                                                    	return false;
  	                                            }
                                 	}
                         }     
                  
                         
                  
                         
                          if (document.form1.TextBox3.value=="") // Function for Password
                           {
                                       alert("Password cannot be left blank.");
                                       document.form1.TextBox3.focus();
                                       return false;
                           }
                   else
                          {
                                  for (var i = 0; i < document.form1.TextBox3.value.length; i++) 
                                     {
                                         if (iPassword.indexOf(document.form1.TextBox3.value.charAt(i)) != -1) 
                                                {
  	                                                 alert ("Password contains special Symbols < or > are not allowed.");
  	                                                 document.form1.TextBox3.focus();
                                                    	return false;
  	                                            }
                                 	}
                         }
                           
                  return true;
}

//---------------------------------------------------------------------------------------------------------

//----------------------------------------Function for New User Register--------------------------

function New_user() 
		    {
				if ((newUser()))
				{
         			
         			
         			return true;
         			       			         			
         			
         			
				}
				else
				{
					return false;
				}
			}


function newUser() //validation for New user Registration
{
      var name = "!@#$%^&*()+=-[]\\\';,/{}~|\":<>?`"; 
      var iPassword = "<>"; 
      var minLength = 5; // Minimum length for password
      var userlength= 3;

    
            
	                if (document.form1.TextBox4.value=="")  //Validation for Name
                           {
                                       alert("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 Username
                           {
                                       alert("Username cannot be left blank.");
                                       document.form1.TextBox5.focus();
                                       return false;
                           }
                   else
                          {
                                  for (var i = 0; i < document.form1.TextBox5.value.length; i++) 
                                     {
                                         if (iName.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;
  	                                            }
                                 	}
                         }
                         
                           // check for minimum length
                        if (document.form1.TextBox5.value.length < userlength) 
                        {
                            alert('Your Username must be atleast ' + userlength + ' characters long. 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;
  	                                            }
                                 	}
                         }
                         
                          // check for minimum length
                        if (document.form1.TextBox6.value.length < minLength) 
                        {
                            alert('Your Password must be atleast ' + minLength + ' characters long. Try again.');
                            document.form1.TextBox6.focus();
                            return false;
                              }
                         
                          
                         
                       if (document.form1.TextBox7.value=="") //-------- Validation For E-mails   
                           {
                                       alert("Email-Id cannot be left blank.");
                                       document.form1.TextBox7.focus();
                                       return false;
                           }
                     
                     
                      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
                                    {
                                        }
                     
                     
                     
                                 
      return true;
}



//----------------------------------------Function for Send mail--------------------------

function sending() 
		    {
				if ((val_send()))
				{
         			
         			
         			return true;
         			       			         			
         			
         			
				}
				else
				{
					return false;
				}
			}


function val_send() //validation for Send to friends
{
      var name = "!@#$%^&*()+=-[]\\\';,/{}~|\":<>?`"; 
     
      var minLength = 5; // Minimum length for password
      

    
            
	                if (document.form1.TextBox8.value=="")  //Validation for Name
                           {
                                       alert("Name cannot be left blank.");
                                       document.form1.TextBox8.focus();
                                       return false;
                           }
                   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;
  	                                            }
                                 	}
                         }
                         
                                         
                                     
                       if (document.form1.TextBox9.value=="") //-------- Validation For E-mails   
                           {
                                       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
                                    {
                                        }
                                                        
                                 
                           if (document.form1.TextBox10.value=="") //-------- Validation For E-mails   
                           {
                                       alert("Email-Id cannot be left blank.");
                                       document.form1.TextBox10.focus();
                                       return false;
                           }
                     
//                          var filter  = /^([a-zA-Z0-9_\.])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
//                          
//                          var emailid=document.form1.TextBox10.value;                          
//      
//                          if (!filter.test(emailid))
//                            {
//                      
//                                alert("Your email-id contains special symbols or incorrect format.");
//                                document.form1.TextBox10.focus();
//                                return false;
//        
//                                }
//                                 else
//                                    {
//                                        }
                             
                                 
                                 
return true;
}                 
                 
                 
  //---------------------------------------------------------------------------------------------

   
   
 function bug() 
		    {
				if ((val_bug()))
				{
         			
         			
         			return true;
         			       			         			
         			
         			
				}
				else
				{
					return false;
				}
			}  
                 
// validation Function for Bug description

function val_bug()
{
// Validation For Name
var iName = "!@#$%^&*()+=-[]\\\';,/~{}|\":<>?`";

 if (document.form1.TextBox12.value=="")
 {
  alert("Name 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;
  	}
  	}
}

// Validation For your E-mails Id  
           
         
     if(document.form1.TextBox13.value=="")
      {
                 alert("Email-id cannot be left blank");
                 document.form1.TextBox13.focus();
                return false;
      }
      
      var filter  = /^([a-zA-Z0-9_\.])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
                          
                          var emailid=document.form1.TextBox13.value;                          
      
                          if (!filter.test(emailid))
                            {
                      
                                alert("Your email-id contains special symbols or incorrect format.");
                                document.form1.TextBox13.focus();
                                return false;
        
                                }
                                 else
                                    {
                                        }
    
    // Validation For Bug Description
           
         
     if(document.form1.TextBox14.value=="")
      {
                 alert("Bug description cannot be left blank");
               document.form1.TextBox14.focus();
                return false;
      }
      else
  {
for (var i = 0; i < document.form1.TextBox14.value.length; i++) 
{
 if (iName.indexOf(document.form1.TextBox14.value.charAt(i)) != -1) 
 {
  	alert ("Special symbols are not allowed.\nPlease remove them and try again.");
  	document.form1.TextBox14.focus();
  	return false;
  	}
  	}
}
     


return true;
}
        