
   /*******************

	* Vinay Choukse
	* Added function validate to check all conditions (validation) for 
	* different input forms (registration , create profile & update  profile) for all fields.
	
	********************/


 function validate(FormObject)
 {
   if (FormObject.AgreeToTerms) 
     { 
	   if(FormObject.AgreeToTerms.checked == false)
	   {
	      alert('Kindly check off the Terms of Agreement Box');
	      FormObject.AgreeToTerms.focus();
	      return false;
	   }
	 }  
 	 if (FormObject.MemberPassword2) 
     {    
		   if (FormObject.MemberPassword1.value != FormObject.MemberPassword2.value) 
		   {
		      alert ('Both password fields must be the same.');
		      FormObject.MemberPassword1.value = '';
		      FormObject.MemberPassword2.value = '';
		      FormObject.MemberPassword1.focus();
		      return false;
		   }
      }
 
    if (FormObject.CompanyName) 
     {
	    if  (trim(FormObject.CompanyName.value) == '')
	     {
	      alert ("Please enter: Company Name");
	      FormObject.CompanyName.value='';
	      FormObject.CompanyName.focus();
	      return false;
	     }
      
       if (SpecialCharaterValidation(FormObject.CompanyName.value) == false)
        {
          alert ("Company name has special characters. These are not allowed.\n Please remove them and try again.");
          FormObject.CompanyName.focus();
	       return false;
        }
     
     }
   
   if (FormObject.ContactName) 
	 { 
	   /*if (trim(FormObject.ContactName.value) == "")
	    {
	      alert ("Please enter: Contact Name");
	      FormObject.ContactName.value='';
	      FormObject.ContactName.focus();
	      return false;
	    }
       if (SpecialCharaterValidation(FormObject.ContactName.value) == false)
        {
          alert ("Contact Name has special characters. These are not allowed.\n Please remove them and try again.");
          FormObject.ContactName.focus();
	      return false;
        }*/
     }
 
    if (FormObject.FirstName) 
     {
       if (trim(FormObject.FirstName.value) == "")
	    {
	     alert ("Please enter: First Name");
	     FormObject.FirstName.value='';
	     FormObject.FirstName.focus();
	     return false;
	    }
        if (SpecialCharaterValidation(FormObject.FirstName.value) == false)
        {
          alert ("First Name has special characters. These are not allowed.\n Please remove them and try again.");
          FormObject.FirstName.focus();
	      return false;
        }
     }
   
    if (FormObject.LastName) 
     {
       if (trim(FormObject.LastName.value) == "")
	    {
	     alert ("Please enter: Last Name");
	     FormObject.LastName.value='';
	     FormObject.LastName.focus();
	     return false;
	    }
        if (SpecialCharaterValidation(FormObject.LastName.value) == false)
        {
          alert ("Last Name has special characters. These are not allowed.\n Please remove them and try again.");
          FormObject.LastName.focus();
	      return false;
        }
     }
     
    /*if (trim(FormObject.Phone1.value) == "")
    {
      alert ("Please enter: Phone Number");
      FormObject.Phone1.value='';
      FormObject.Phone1.focus();
      return false;
    }
   
    var iChars = "~!@#$%^&*+=[]\\\';,./{}|\":<>?";
	 for (var i = 0; i < FormObject.Phone1.value.length; i++) 
	   {
	  	 if (iChars.indexOf(FormObject.Phone1.value.charAt(i)) != -1) 
	  	  {
		  	alert ("Phone number has special characters. These are not allowed.\n Please remove them and try again.");
		  	FormObject.Phone1.focus();
		  	return false;
	  	  }
	   }
   
    var re = /[a-zA-Z]/;
    if (re.test(FormObject.Phone1.value) == true)
    {
      alert ("Please enter: valid Phone Number");
      FormObject.Phone1.value='';
      FormObject.Phone1.focus();
      return false;
    }*/
 
  /*if (FormObject.Phone2)
   {
     if (trim(FormObject.Phone2.value) != "")
      {
   	    var iChars = "~!@#$%^&*+=[]\\\';,./{}|\":<>?";
	    for (var i = 0; i < FormObject.Phone2.value.length; i++) 
	     {
	  	  if (iChars.indexOf(FormObject.Phone2.value.charAt(i)) != -1) 
	  	   {
		  	 alert (" Alternate Phone number has special characters. These are not allowed.\n Please remove them and try again.");
		  	 FormObject.Phone2.focus();
		  	 return false;
	  	   }
	     }
      
       var re = /[a-zA-Z]/;
       if (re.test(FormObject.Phone2.value) == true)
        {
          alert ("Please enter: valid alternate Phone Number");
          FormObject.Phone2.value='';
          FormObject.Phone2.focus();
          return false;
        }
     }       
  }*/    
   
   /*if (FormObject.StreetAddress) 
    {
	   if (trim(FormObject.StreetAddress.value) == "")
	   {
	      alert ("Please enter: Street Address");
	      FormObject.StreetAddress.value='';
	      FormObject.StreetAddress.focus();
	      return false;
	   }
    }*/
   /*if (FormObject.City) 
     { 
	   if (trim(FormObject.City.value) == "")
	   {
	      alert ("Please enter: City");
	      FormObject.City.value='';
	      FormObject.City.focus();
	      return false;
	   }
      if (SpecialCharaterValidation(FormObject.City.value) == false)
       {
          alert ("City has special characters. These are not allowed.\n Please remove them and try again.");
          FormObject.City.focus();
	      return false;
       }
     }*/
   /*if (FormObject.Province) 
    {  
	   if (trim(FormObject.Province.value) == "")
	   {
	      alert ("Please enter: Province / State");
	      FormObject.Province.value='';
	      FormObject.Province.focus();
	      return false;
	   }
      if (SpecialCharaterValidation(FormObject.Province.value) == false)
       {
          alert ("Province has special characters. These are not allowed.\n Please remove them and try again.");
          FormObject.Province.focus();
	      return false;
       }
     }*/
 
   /*if (FormObject.CountryNew) 
     {   
	   if (trim(FormObject.CountryNew.value) == "")
	   {
	      alert ("Please enter: Country");
	      FormObject.CountryNew.value='';
	      FormObject.CountryNew.focus();
	      return false;
	   } 
       if (SpecialCharaterValidation(FormObject.CountryNew.value) == false)
       {
          alert ("Country has special characters. These are not allowed.\n Please remove them and try again.");
          FormObject.CountryNew.focus();
	      return false;
       }
     }*/
   
  /*if (FormObject.ZipCode)
   {
    if (trim(FormObject.ZipCode.value) != "")
      {
        if (SpecialCharaterValidation(FormObject.ZipCode.value) == false)
         {
           alert ("Zip Code has special characters. These are not allowed.\n Please remove them and try again.");
           FormObject.ZipCode.focus();
	       return false;
         }     
      }
   }*/ 
   
  /*if (FormObject.Title)
   {
    if (trim(FormObject.Title.value) != "")
      {
        if (SpecialCharaterValidation(FormObject.Title.value) == false)
         {
           alert ("Title has special characters. These are not allowed.\n Please remove them and try again.");
           FormObject.Title.focus();
	       return false;
         }     
      }
   }*/
 
  /*if (FormObject.ZipCode)
   {
    if (trim(FormObject.ZipCode.value) != "")
      {
        if (SpecialCharaterValidation(FormObject.ZipCode.value) == false)
         {
           alert ("Zip Code has special characters. These are not allowed.\n Please remove them and try again.");
           FormObject.ZipCode.focus();
	       return false;
         }     
      }
   }*/    

   if (trim(FormObject.Email.value) == "")
   {
      alert ("Please enter: Email Address/User Name");
      FormObject.Email.value = '';
      FormObject.Email.focus();
      return false;
   } 
   
   if (echeck(trim(FormObject.Email.value)) == false)
   	 {
   	    alert ("Invalid Email ID: Please enter valid Email Address");
   	    FormObject.Email.value = '';
	    FormObject.Email.focus();
	    return false;
     }
            
   if (FormObject.MemberUserName) 
	 {
	   if (trim(FormObject.MemberUserName.value) == "")
	   {
	      alert ("Please re enter: Email Address/User Name");
	      FormObject.MemberUserName.value = '';
	      FormObject.MemberUserName.focus();
	      return false;
	   }
     }
 
 	 if (FormObject.MemberUserName) 
     {  
	   if (FormObject.MemberUserName.value != FormObject.Email.value)
	    {
	      alert ("Both Email Address/User Name fields must be the same.");
	      FormObject.Email.value = '';
		  FormObject.MemberUserName.value = '';
		  FormObject.Email.focus();
	      return false;
	    }
     }

   if (FormObject.MemberPassword1) 
     {
	   
	   if (FormObject.MemberPassword1.value == "") 
	   {
	      alert ('Please enter the password.');
	      FormObject.MemberPassword1.focus();
	      return false;
	   }
	  BlankIndex = " ";
	  if (FormObject.MemberPassword1.value.indexOf(BlankIndex) > -1) 
	   {
	      alert ('Space not allowed in password: Please enter the password.');
	      FormObject.MemberPassword1.value = '';
	      FormObject.MemberPassword1.focus();
	      return false;
	   }
    }
 
   /*if (FormObject.Discount) 
     {
	   if (trim(FormObject.Discount.value) == "") 
	    {
	      alert ('Please enter Discount');
	      FormObject.Discount.value = '';
	      FormObject.Discount.focus();
	      return false;
	    }
	   if  (isNaN(FormObject.Discount.value) || (FormObject.Discount.value < 0 ) || (FormObject.Discount.value > 100)) 
	    {
	      alert ('Please enter valid Discount');
	      FormObject.Discount.value = '';
	      FormObject.Discount.focus();
	      return false;
	    }
     }*/
   
   /*if (FormObject.OfficeLimit) 
     {
	   if (trim(FormObject.OfficeLimit.value) == "") 
	    {
	      alert ('Please enter limit of Office');
	      FormObject.OfficeLimit.value = '';
	      FormObject.OfficeLimit.focus();
	      return false;
	    }
	   if  (isNaN(FormObject.OfficeLimit.value) || (FormObject.OfficeLimit.value < 0 ) || (FormObject.OfficeLimit.value > 100000)) 
	    {
	      alert ('Please enter valid limit of Office between 0 to 99999 only');
	      FormObject.OfficeLimit.value = '';
	      FormObject.OfficeLimit.focus();
	      return false;
	    }
     }*/
    
   /*if (FormObject.EmployeeLimit) 
     {
	   if (trim(FormObject.EmployeeLimit.value) == "")  
	   {
	      alert ('Please enter limit of Employee');
	      FormObject.EmployeeLimit.value = '';
	      FormObject.EmployeeLimit.focus();
	      return false;
	   }
      if ((isNaN(FormObject.EmployeeLimit.value)) || (FormObject.EmployeeLimit.value < 0) || (FormObject.EmployeeLimit.value > 100000))  
	   {
	      alert ('Please enter valid limit of Employee between 0 to 99999 only');
	      FormObject.EmployeeLimit.value = '';
	      FormObject.EmployeeLimit.focus();
	      return false;
	   }
    }*/
     
   /*if (FormObject.CandidateLimit) 
     {
	  if  (trim(FormObject.CandidateLimit.value) == "") 
	    {
	      alert ('Please enter limit of Candidate');
	      FormObject.CandidateLimit.value = '';
	      FormObject.CandidateLimit.focus();
	      return false;
	    }
      if  (isNaN(FormObject.CandidateLimit.value) || (FormObject.CandidateLimit.value < 0) || (FormObject.CandidateLimit.value > 100000)) 
	   {
	      alert ('Please enter valid limit of Candidate between 0 to 99999 only');
	      FormObject.CandidateLimit.value = '';
	      FormObject.CandidateLimit.focus();
	      return false;
	   }
	}*/

    /*if (FormObject.EmployeeRenewal) 
     {
	  if  (trim(FormObject.EmployeeRenewal.value) == "") 
	    {
	      alert ('Please enter limit of Employee Renewal');
	      FormObject.EmployeeRenewal.value = '';
	      FormObject.EmployeeRenewal.focus();
	      return false;
	    }
      if  (isNaN(FormObject.EmployeeRenewal.value) || (FormObject.EmployeeRenewal.value < 0) || (FormObject.EmployeeRenewal.value > 100000)) 
	   {
	      alert ('Please enter valid limit of Employee Renewal between 0 to 99999 only');
	      FormObject.EmployeeRenewal.value = '';
	      FormObject.EmployeeRenewal.focus();
	      return false;
	   }
    }*/

   /*if (FormObject.CandidateRenewal) 
     {
	  if  (trim(FormObject.CandidateRenewal.value) == "") 
	    {
	      alert ('Please enter limit of Candidate Renewal');
	      FormObject.CandidateRenewal.value = '';
	      FormObject.CandidateRenewal.focus();
	      return false;
	    }
      if  (isNaN(FormObject.CandidateRenewal.value) || (FormObject.CandidateRenewal.value < 0) || (FormObject.CandidateRenewal.value > 100000)) 
	   {
	      alert ('Please enter valid limit of Candidate Renewal between 0 to 99999 only');
	      FormObject.CandidateRenewal.value = '';
	      FormObject.CandidateRenewal.focus();
	      return false;
	   }
    }*/
   /*if (FormObject.OfficeInviteLimit) 
     {
	   if (trim(FormObject.OfficeInviteLimit.value) == "") 
	    {
	      alert ('Please enter limit of Office Invitation');
	      FormObject.OfficeInviteLimit.value = '';
	      FormObject.OfficeInviteLimit.focus();
	      return false;
	    }
	   if  (isNaN(FormObject.OfficeInviteLimit.value) || (FormObject.OfficeInviteLimit.value < 0) || (FormObject.OfficeInviteLimit.value > 100000)) 
	    {
	      alert ('Please enter valid limit of Office Invitation between 0 to 99999 only');
	      FormObject.OfficeInviteLimit.value = '';
	      FormObject.OfficeInviteLimit.focus();
	      return false;
	    }
     }*/
    
  /*if (FormObject.EmployeeInviteLimit) 
     {
	   if  (trim(FormObject.EmployeeInviteLimit.value) == "")  
	   {
	      alert ('Please enter limit of Employee Invitation');
	      FormObject.EmployeeInviteLimit.value = '';
	      FormObject.EmployeeInviteLimit.focus();
	      return false;
	   }
      if (isNaN(FormObject.EmployeeInviteLimit.value) || (FormObject.EmployeeInviteLimit.value < 0) || (FormObject.EmployeeInviteLimit.value  > 100000))  
	   {
	      alert ('Please enter valid limit of Employee Invitation between 0 to 99999 only');
	      FormObject.EmployeeInviteLimit.value = '';
	      FormObject.EmployeeInviteLimit.focus();
	      return false;
	   }
    }*/
     
   /*if (FormObject.CandidateInviteLimit) 
     {
	  if  (trim(FormObject.CandidateInviteLimit.value) == "") 
	    {
	      alert ('Please enter limit of Candidate Invitation');
	      FormObject.CandidateInviteLimit.value = '';
	      FormObject.CandidateInviteLimit.focus();
	      return false;
	    }
      if  (isNaN(FormObject.CandidateInviteLimit.value) || (FormObject.CandidateInviteLimit.value < 0) || (FormObject.CandidateInviteLimit.value > 100000)) 
	   {
	      alert ('Please enter valid limit of Candidate Invitation between 0 to 99999 only');
	      FormObject.CandidateInviteLimit.value = '';
	      FormObject.CandidateInviteLimit.focus();
	      return false;
	   }
	}*/

   /*if (FormObject.InviteExpiryInterval) 
     {
	  if  (trim(FormObject.InviteExpiryInterval.value) == "") 
	    {
	      alert ('Please enter Invite Expiry Interval');
	      FormObject.InviteExpiryInterval.value = '';
	      FormObject.InviteExpiryInterval.focus();
	      return false;
	    }
      if  (isNaN(FormObject.InviteExpiryInterval.value) || (FormObject.InviteExpiryInterval.value < 1) || (FormObject.InviteExpiryInterval.value > 100000)) 
	   {
	      alert ('Please enter valid Invite Expiry Interval between 1 to 99999 only');
	      FormObject.InviteExpiryInterval.value = '';
	      FormObject.InviteExpiryInterval.focus();
	      return false;
	   }
	}*/

   /*if (FormObject.CandidateAccessLimit) 
     {
	  if  (trim(FormObject.CandidateAccessLimit.value) == "") 
	    {
	      alert ('Please enter Candidate Access Limit');
	      FormObject.CandidateAccessLimit.value = '';
	      FormObject.CandidateAccessLimit.focus();
	      return false;
	    }
      if  (isNaN(FormObject.CandidateAccessLimit.value) || (FormObject.CandidateAccessLimit.value < 1) || (FormObject.CandidateAccessLimit.value > 100000)) 
	   {
	      alert ('Please enter valid Candidate Access Limit between 1 to 99999 only');
	      FormObject.CandidateAccessLimit.value = '';
	      FormObject.CandidateAccessLimit.focus();
	      return false;
	   }
	}*/

   /*if (FormObject.CandidateActiveInterval) 
     {
	  if  (trim(FormObject.CandidateActiveInterval.value) == "") 
	    {
	      alert ('Please enter Candidate Active Interval');
	      FormObject.CandidateActiveInterval.value = '';
	      FormObject.CandidateActiveInterval.focus();
	      return false;
	    }
      if  (isNaN(FormObject.CandidateActiveInterval.value) || (FormObject.CandidateActiveInterval.value < 1) || (FormObject.CandidateActiveInterval.value > 100000)) 
	   {
	      alert ('Please enter valid Candidate Active Interval between 1 to 99999 only');
	      FormObject.CandidateActiveInterval.value = '';
	      FormObject.CandidateActiveInterval.focus();
	      return false;
	   }
	}*/
  /*if (FormObject.HeardAboutHrim)
   {  
     if (FormObject.HeardAboutHrim.value == "")
	  {
	 	 alert ('Please select refernce');
	     FormObject.HeardAboutHrim.focus();
	     return false;
	  }
   }*/	 

 /*if (FormObject.Other)
   {
     if (FormObject.HeardAboutHrim.value == 3)
      {
	     if (trim(FormObject.Other.value)=="")
		 {
		 	 alert ('Please enter the value of other reference');
		     FormObject.Other.value = '';
		     FormObject.Other.focus();
		     return false;
		 }
      }
   }*/ 
  
 if (FormObject.Confirmation) 
     { 
       var Yes = 'Y';
       if (FormObject.Confirmation.value == Yes)
        {
	       var UserName = FormObject.UserName.value; 
	       if(confirm('Do you want to update the record of user: '+UserName+' ?'))
	         {
	          return true;
	         }
	       else
	         {
	          return false;
	         } 
        }
     }
  
  return true;
}

   /*******************

	* Vinay Choukse
	* Added function SpecialCharaterValidation to check out wheather the string contain spaecial character or not.
	
	********************/

	function SpecialCharaterValidation(val)
 	 {
  	   var iChars = "~!@#$%^*+=[]\\\;/{}|\"<>?";
	   for (var i = 0; i < val.length; i++) 
	    {
	  	 if (iChars.indexOf(val.charAt(i)) != -1) 
	  	  {
		  	return false;
	  	  }
	    }
	   return true; 
     }

   /*******************

	* Vinay Choukse
	* Added function selectChange to disable & enable text field in profile page.
	
	********************/
	
	function selectChange(control)
 	{
	 Office='Office';
	 EMPLOYEE='Employee';
	 CANDIDATE = 'Candidate';
	 if (control.selectuser.value==Office)
	  {
	 	control.CompanyName.readOnly=false;
	 	control.StreetAddress.readOnly=false;
	  	control.City.readOnly=false;
	  	control.Province.readOnly=false;
	  	control.CountryNew.readOnly=false;
	  	control.ZipCode.readOnly=false;
	    control.Website.readOnly=false;
	  	control.Website.style.display="";
	  	control.Title.style.display="";

	    if (control.random.value == 1)
	     {
	      control.CompanyName.value ='';
	      control.CompanyName.style.backgroundColor='';
	      control.City.value ='';
	      control.City.style.backgroundColor='';
	      control.StreetAddress.value ='';
	      control.StreetAddress.style.backgroundColor='';
	      control.Province.value ='';
	      control.Province.style.backgroundColor='';
	      control.CountryNew.value ='';
	      control.CountryNew.style.backgroundColor='';
	      control.ZipCode.value ='';
	      control.ZipCode.style.backgroundColor='';
	      control.Website.value ='';
	      control.Website.style.backgroundColor='';
	     }

	    if (control.random.value == 2)
	     {
	      control.CompanyName.value ='';
	      control.CompanyName.style.backgroundColor='';
	     }
 	   
 	    control.random.value=0;
	    control.pinkField.style.display="none";
	    control.pinkTxt.style.display="none";
	    
	    if (control.Gateway)
	     {
	      control.Gateway.value='off';
	      control.Gateway.disabled = true;
	     }
	    if (control.Plus)
	     {
	       control.Plus.value='off';
	       control.Plus.disabled = true;
	     }
	    if (control.Invite)
	     {
	       control.Invite.value='off';
	       control.Invite.disabled = false;
	     }
	    if (control.Report)
	     {
		    control.Report.value='on';
		    control.Report.disabled = false;
	    }
	  }
	else if (control.selectuser.value == CANDIDATE)
	  {
	   	control.CompanyName.value = control.CompName.value;
	   	control.CompanyName.style.backgroundColor='pink';
	   	control.CompanyName.readOnly=true;
	  	control.StreetAddress.readOnly=false;
	  	control.City.readOnly=false;
	  	control.Province.readOnly=false;
	  	control.CountryNew.readOnly=false;
	  	control.ZipCode.readOnly=false;
	  	control.Website.value = '';
	  	control.Website.style.display="none";
	  	control.Title.value = '';
	  	control.Title.style.display="none";

	    if (control.random.value == 1)
	     {
	      control.City.value ='';
	      control.City.style.backgroundColor='';
	      control.StreetAddress.value ='';
	      control.StreetAddress.style.backgroundColor='';
	      control.Province.value ='';
	      control.Province.style.backgroundColor='';
	      control.CountryNew.value ='';
	      control.CountryNew.style.backgroundColor='';
	      control.ZipCode.value ='';
	      control.ZipCode.style.backgroundColor='';
	      control.Website.value ='';
	      control.Website.style.backgroundColor='';
	     }

	    control.random.value=2;
	    
	    if (control.GrantedVal.value == 13)
	     {
	      control.pinkField.style.display="none";
	      control.pinkTxt.style.display="none";
	     }
	    else
	     {
	      control.pinkField.style.display="";
	      control.pinkTxt.style.display="";
	     }
	    
	    if (control.Gateway)
	     {
	      	control.Gateway.value='off';
	    	control.Gateway.disabled = true;
	     }
        if (control.Plus)
	     {
	       	control.Plus.value='off';
	    	control.Plus.disabled = true;
	     }
	    if (control.Invite)
	     {
	       	control.Invite.value='off';
	    	control.Invite.disabled = true;
	       
	     }
	    if (control.Report)
	     {
	       	control.Report.value='off';
	    	control.Report.disabled = true;
	     }
	    
  }
	else if (control.selectuser.value == EMPLOYEE)
	  {
	   	
	   	control.CompanyName.value = control.CompName.value;
	   	control.CompanyName.style.backgroundColor='pink';
	  	control.CompanyName.readOnly=true;
	    control.StreetAddress.value = control.strt.value;
	    control.StreetAddress.style.backgroundColor='pink';
	  	control.StreetAddress.readOnly=true;
	  	control.City.value = control.cty.value;
	  	control.City.style.backgroundColor='pink';
	  	control.City.readOnly=true;
	  	control.Province.value = control.state.value;
	  	control.Province.style.backgroundColor='pink';
	  	control.Province.readOnly=true;
	  	control.CountryNew.value = control.county.value;
	  	control.CountryNew.style.backgroundColor='pink';
	  	control.CountryNew.readOnly=true;
	  	control.ZipCode.value = control.zipC.value;
	  	control.ZipCode.style.backgroundColor='pink';
	  	control.ZipCode.readOnly=true;
	  	control.Website.value = control.hmlink.value;
	  	control.Website.style.backgroundColor='pink';
	    control.Website.readOnly=true;
	  	control.Title.style.display="";
	    control.Website.style.display="";
	    
	    control.random.value=1;
	    control.pinkField.style.display="";
	    control.pinkTxt.style.display="";
	     
	    if (control.Gateway)
	     {
	      control.Gateway.value='off';
	      control.Gateway.disabled = false;
	     }
	    if (control.Plus)
	     {
	       control.Plus.value='off';
	       control.Plus.disabled = false;
	     }
	    if (control.Invite)
	     {
	       control.Invite.value='off';
	       control.Invite.disabled = false;
	     }
	    if (control.Report)
	     {
		    control.Report.value='off';
		    control.Report.disabled = false;
	    }
		  
	  }  
  }


   /*******************

	* Vinay Choukse
	* Added function checkUsersentInvitation for validation during invitation send to different user.
	
	********************/
	
	function ValidationOfUserInvitation(FormObject, buttonType) 
	{
	 BUSINESS=12;
	 OFFICE=13;
	 Ret = true;
	 
	 len = FormObject.usertype.length;
	 if (len == undefined)
	 {
	   if (FormObject.usertype.checked)
		  {
		    Ret = false; 
		    if (FormObject.usertype.value == BUSINESS)
			   {
			     if (trim(FormObject.companyName.value) == "") 
			      {
			         alert ('Please enter the company name');
			      	 FormObject.companyName.value='';
			      	 FormObject.companyName.focus();
			      	 return false;
			      } 
		         if (SpecialCharaterValidation(FormObject.companyName.value) == false)
		          {
		            alert ("Company name has special characters. These are not allowed.\n Please remove them and try again.");
		            FormObject.companyName.focus();
			        return false;
		          }
			   }
   	       }
	  }
	 else 
	  {	  
		for (counter = 0; counter < len; counter++)
		  {
		   if (FormObject.usertype[counter].checked)
			 {
		      Ret = false; 
			    if (FormObject.usertype[counter].value == OFFICE)
			      {
			        if (trim(FormObject.companyName.value) == "") 
			           {
				         alert ('Please enter: Company name');
				      	 FormObject.companyName.value='';
				      	 FormObject.companyName.focus();
				      	 return false;
			           }
			        if (SpecialCharaterValidation(FormObject.companyName.value) == false)
			          {
			            alert ("Company name has special characters. These are not allowed.\n Please remove them and try again.");
			            FormObject.companyName.focus();
				        return false;
			          }
			      }
			  }
	       }
      	}
	  if (Ret)
		{
		 alert ('Please select user account type');
		 return false;
		} 

      if (trim(FormObject.Email.value) == "")
	   {
	      alert ("Please enter: Email Address");
	      FormObject.Email.value = '';
	      FormObject.Email.focus();
	      return false;
	   }
	if (FormObject.Email.value.indexOf(",") != -1) 
   	   {
   	   	  var EmailArray = FormObject.Email.value.split(",");
  
 	   	  for (i = 0;i <EmailArray.length; i++)
   	   	   {
  	   	     if (echeck(trim(EmailArray[i]))==false)
	          {
		        alert ('Email ID at position ' + (++i) + ' in the email list is invalid. \nPlease enter valid Email Address.');
		        FormObject.Email.focus();
		        return false;
	          }
   	   	   } 
   	   	}
   	  else
   	    {
   	     if (echeck(trim(FormObject.Email.value)) == false)
   	      {
   	       	 alert ("Invalid Email ID: Please enter valid Email Address");
   	       	 FormObject.Email.value = '';
	         FormObject.Email.focus();
	         return false;
    	  }
   	    }
 
 	   if (trim(FormObject.Subject.value) == "")
	   {
	      alert ("Please enter: Subject");
	      FormObject.Subject.value = '';
	      FormObject.Subject.focus();
	      return false;
	   } 
	   if (trim(FormObject.msgtext.value) == "")
	   {
	      alert ("Please enter: Invitation message.");
	      FormObject.msgtext.value = '';
	      FormObject.msgtext.focus();
	      return false;
	   } 
	    FormObject.pressbutton.value = buttonType;
	    return true;
	}

   /*******************

	* Vinay Choukse
	* Added function checkRadioButton to disable & enable text field.
	
	********************/
	
	function checkRadioButton(FormObject) 
	 {
	  OFFICE=13;
	  EMPLOYEE=14;
	  CANDIDATE=15;
	  for (counter = 0; counter < FormObject.usertype.length; counter++)
		  {
		   if (FormObject.usertype[counter].checked)
			 {
		      if (FormObject.usertype[counter].value == OFFICE)
			     {
			       FormObject.companyName.value == '';
			   	   FormObject.companyName.style.display="";	        
			     }
			  if (FormObject.usertype[counter].value == EMPLOYEE)
			     {
			   	   FormObject.companyName.style.display="none";	        
			     }
			  if (FormObject.usertype[counter].value == CANDIDATE)
			     {
			       FormObject.companyName.style.display="none";	        
			     } 
			  }
	       }
  	}

   /*******************

	* Vinay Choukse
	* Added function SecurityAccessValidation to check form validation for Report form.
	
	********************/
	
	function SecurityAccessValidation(FormObject) 
	 {
	  Ret = true;
	 
	  for (counter = 0; counter < FormObject.ReportInvite.length; counter++)
		  {
		   
		    if (FormObject.ReportInvite[counter].checked)
			 {
		       Ret = false; 
		       if ((FormObject.ReportViewing.value != "") && (FormObject.LocationViewing.value != ""))
			     {
			       alert ('Please select only one at the time of security permission.'); 
			       FormObject.reset();
			       return false;       
			     }
			   if ((FormObject.ReportViewing.value == "") && (FormObject.LocationViewing.value == ""))
			     {
			       alert ('Please select either employee or location.'); 
			       return false;       
			     }
			  } 
	        }
  	   if (Ret)
		{
		  alert ('Please select enable or disable permission access');
		  return false;
		} 
  	   return true; 
  	}
	
	
   /*******************

	* Vinay Choukse
	* Added function GatewayPlusAccessValidation to check form validation for Gaterway form.
	
	********************/
	
	function GatewayPlusAccessValidation(FormObject) 
	 {
	  Ret = true;
	   
	  for (counter = 0; counter < FormObject.gatewayPlus.length; counter++)
		  {
		   
		    if (FormObject.gatewayPlus[counter].checked)
			 {
		       Ret = false; 
		       if (FormObject.gatewayPlusReport.value == "") 
			     {
			       alert ('Please select one value in the field.'); 
			       return false;       
			     }
			   } 
	        }
  	   if (Ret)
		{
		  alert ('Please select enable or disable permission access');
		  return false;
		} 
  	   return true; 
  	}  

   /*******************

	* Vinay Choukse
	* Added function trim to check wheather the string contain space only or not.
	
	********************/
	  
    function trim(stringToTrim) 
    {
	 return stringToTrim.replace(/^\s+|\s+$/g,"");
    }

   /*******************

	* Vinay Choukse
	* Added function hidetext to disable & enable text field.
	
	********************/
	
	function hidetext(FormObject)
 	{
	 CANDIDATE = 'Candidate';
	 OFFICE = 'Office';
	 
	 if (FormObject.selectuser.value==CANDIDATE)
	  {
	 	FormObject.Website.value = '';
	    FormObject.Website.style.display="none";
	    FormObject.Title.value = '';
	    FormObject.Title.style.display="none";
	    if (FormObject.Invite)
	     {
	       FormObject.Invite.value='off';
	       FormObject.Invite.disabled = true;
	     }
	    if (FormObject.Report)
	     {
		   FormObject.Report.value='off';
		   FormObject.Report.disabled = true;
	    }
	 }
    else if (FormObject.selectuser.value==OFFICE)
       {
 	    if (FormObject.Gateway)
	     {
 	       FormObject.Gateway.value='off';
	       FormObject.Gateway.disabled = true;
	     } 
 	    if (FormObject.Plus)
	     {
	 	   FormObject.Plus.value='off';
		   FormObject.Plus.disabled = true;
	     }
         FormObject.Invite.value='off';
         FormObject.Invite.disabled = false;
         
 	     FormObject.Report.value='on';
	     FormObject.Report.disabled = false;
               
       }
   }
  
   /*******************

	* Vinay Choukse
	* Added function onSelect to disable & enable text field.
	
	********************/
	
	function onSelect(FormObject)
 	{
	 Other = 3;
	 if (FormObject.HeardAboutHrim.value==Other)
	  {
	 	FormObject.Other.value = '';
	    FormObject.Other.style.display="";
	  }
	 else
	 {
	  	FormObject.Other.value = '';
	  	FormObject.Other.style.display="none";
	 }

  }

   /*******************

	* Vinay Choukse
	* Added function resetAction to perform reset button action for image type button.
	
	********************/
	
	function resetAction(FormObject)
 	{
       FormObject.reset();
       return false;       
 	}

   /*******************

	* Vinay Choukse
	* Added function reLoadPage to reload same page.
	
	********************/
	
	function reLoadPage(FormObject)
 	{
       window.location.reload(true);
       return false;       
 	}


function check(FormObject) {
	
	 var checkBoxcount = 0;
 if(FormObject.blackcheckbox.checked == true) {

     checkBoxcount ++;
   } if(FormObject.redcheckbox.checked == true) {

     checkBoxcount ++;
   } if(FormObject.bluecheckbox.checked == true) {

     checkBoxcount ++;
   } if(FormObject.greencheckbox.checked == true) {

     checkBoxcount ++;
   } if(FormObject.yellowcheckbox.checked == true) {

     checkBoxcount ++;
   } if(FormObject.limecheckbox.checked == true) {

     checkBoxcount ++;
   } if(FormObject.graycheckbox.checked == true) {
     checkBoxcount ++;
   }
	  
if (checkBoxcount > 1) {
	if(FormObject.blackcheckbox.checked == true) {
	 FormObject.blackcheckbox.checked = false;
     checkBoxcount ++;
   } if(FormObject.redcheckbox.checked == true) {
   FormObject.redcheckbox.checked = false;
     checkBoxcount ++;
   } if(FormObject.bluecheckbox.checked == true) {
      	 FormObject.bluecheckbox.checked = false;
     checkBoxcount ++;
   } if(FormObject.greencheckbox.checked == true) {
   	 FormObject.greencheckbox.checked = false;
     checkBoxcount ++;
   } if(FormObject.yellowcheckbox.checked == true) {
   FormObject.yellowcheckbox.checked = false;
     checkBoxcount ++;
   } if(FormObject.limecheckbox.checked == true) {
   FormObject.limecheckbox.checked = false;
     checkBoxcount ++;
   } if(FormObject.graycheckbox.checked == true) {
   FormObject.graycheckbox.checked = false;
     checkBoxcount ++;
   }
	alert ("You cannot have more than one color checkbox checked.");
  }	
}

  /*******************

	* jayapraakash
	* Added function validating the survey title and survey question
	
	********************/
	
	function surveyCharaterValidation(val)
 	 {
  	   var iChars = "~$&*[]\\\;{}|\":";
	   for (var i = 0; i < val.length; i++) 
	    {
	  	 if (iChars.indexOf(val.charAt(i)) != -1) 
	  	  {
		  	return false;
	  	  }
	    }
	   return true; 
     }
	

function survervalidation(FormObject)
{
 if (FormObject.surveytitle) 
  {
	   if (FormObject.surveytitle.value =='') 
	   {
	      alert ('Please enter survey title.');
	      FormObject.surveytitle.focus();
	      return false;
	   }
	   if (FormObject.surveytitle.value.indexOf('"') != -1) {
	   	  alert ('Double quote is not allowed in survey title.' );
	   	   FormObject.surveytitle.focus();
	   	  return false;
	   }	
	   if (trim(FormObject.surveytitle.value).length ==0 ) {
	    alert ('Please enter survey title.');
	   	   FormObject.surveytitle.focus();
	   	  return false;
	   }
	     if(FormObject.surveytitle.value.length > 50)
		   {
		      alert ("Survey title should be less than 50 characters");
		      FormObject.surveytitle.focus();
		      return false;
		   }
		   if(surveyCharaterValidation(FormObject.surveytitle.value) == false)
		   {
		       alert ("Survey title has special characters. These are not allowed.\n Please remove them and try again.");
               FormObject.surveytitle.focus();
	          return false;
		   
		   }
		   
      }

	   if (FormObject.surveyquestion) 
       {
	   if (FormObject.surveyquestion.value =='') 
	   {
	      alert ('Please enter survey question.');
	      FormObject.surveyquestion.focus();
	      return false;
	   }
	   if (FormObject.surveyquestion.value.indexOf('"') != -1) {
	   	  alert ('Double quote is not allowed in survey question.');
	   	  FormObject.surveyquestion.focus();
	   	  return false;
	   }
	   if (trim(FormObject.surveyquestion.value).length ==0 ) {
	   	  alert ('Please enter survey question.');
	      FormObject.surveyquestion.focus();
	   	  return false;
	   }
	   if(FormObject.surveyquestion.value.length >150)
		{
		      alert ("Survey question should be less than 150 characters");
		      FormObject.surveyquestion.focus();
		      return false;
		}
		 if(surveyCharaterValidation(FormObject.surveyquestion.value) == false)
		   {
		       alert ("Survey question has special characters. These are not allowed.\n Please remove them and try again.");
                FormObject.surveyquestion.focus();
	          return false;
		   
		   }	
   }
   
return true;
}


function pollAccessValidation(FormObject)
{
	var radio_choice = false;
	
	// Loop from zero to the one minus the number of radio button selections
	for (counter = 0; counter < FormObject.vote.length; counter++)
	{
	// If a radio button has been selected it will return true
	// (If not it will return false)
	if (FormObject.vote[counter].checked)
	radio_choice = true; 
	}
	
	if (!radio_choice)
	{
	// If there were no selections made display an alert box 
	alert("Please make a selection!")
	return (false);
	}
	return (true);
}


function gatewayvalidation(FormObject)
{

		 if (FormObject.image_file) 
		  {
			   if (FormObject.image_file.value =='') 
			   {
				  alert ('Please select image file.');
				  FormObject.image_file.focus();
				  return false;
			   }
		   }

		   if (FormObject.audiofile) 
		   {
			   if (FormObject.audiofile.value =='') 
			   {
				  alert ('Please select audio file.');
				  FormObject.audiofile.focus();
				  return false;
			   }
		 }
return true;

}

function checkBGColor(FormObject) {
	 var checkBoxcount = 0;
	 if(FormObject.blackcheckboxbgcolor.checked == true) {
	     checkBoxcount ++;
	   } if(FormObject.redcheckboxbgcolor.checked == true) {
	     checkBoxcount ++;
	   } if(FormObject.bluecheckboxbgcolor.checked == true) {
	     checkBoxcount ++;
	   } if(FormObject.greencheckboxbgcolor.checked == true) {
	     checkBoxcount ++;
	   } if(FormObject.yellowcheckboxbgcolor.checked == true) {
	     checkBoxcount ++;
	   } if(FormObject.graycheckboxbgcolor.checked == true) {
	     checkBoxcount ++;
	   } if(FormObject.limecheckboxbgcolor.checked == true) {
	     checkBoxcount ++;
	 }
	  
	if (checkBoxcount > 1) {
		if(FormObject.blackcheckboxbgcolor.checked == true) {
		 	FormObject.blackcheckboxbgcolor.checked = false;
	   } if(FormObject.redcheckboxbgcolor.checked == true) {
	   		FormObject.redcheckboxbgcolor.checked = false;
	   } if(FormObject.bluecheckboxbgcolor.checked == true) {
	      	 FormObject.bluecheckboxbgcolor.checked = false;
	   } if(FormObject.greencheckboxbgcolor.checked == true) {
	   	 	FormObject.greencheckboxbgcolor.checked = false;
	   } if(FormObject.yellowcheckboxbgcolor.checked == true) {
	   		FormObject.yellowcheckboxbgcolor.checked = false;
	   } if(FormObject.graycheckboxbgcolor.checked == true) {
	   		FormObject.graycheckboxbgcolor.checked = false;
	   } if(FormObject.limecheckboxbgcolor.checked == true) {
	   		FormObject.limecheckboxbgcolor.checked = false;
	   }
		alert ("You cannot have more than one back ground color checkbox checked.");
	}	 
}

	  
/**
* @author nikhil.gumaste
* subject field validation 
*/
function ValidationOfUserInvitationSubject(FormObject, i) {
	
	if (trim(FormObject.Subject.value) == "")
	{
      alert ("Please enter: Subject");
      FormObject.Subject.focus();
      return false;
	} else if (trim(FormObject.msgtext.value) == "") {
		alert ("Please enter: Message");
	    FormObject.msgtext.focus();
	    return false;
	}
	 FormObject.pressbutton.value = i;
	 FormObject.submit();
	 return true;
}

/**
*@author nikhil.gumaste
* dash board messages validation 
*/
function validateDboardMessages(FormObject) {
	if (trim(FormObject.firstMessageText.value) == "") {
		alert ("Please enter the first message");
      	FormObject.firstMessageText.focus();
      	return false;
	} else if (trim(FormObject.secondMessageText.value) == "") {
		alert ("Please enter the second message");
      	FormObject.secondMessageText.focus();
      	return false;
	}

	return true;
}


	
	/*******************

	* Ujwala Sarode
	* Added function for validate number in reports.
	
	********************/ 	 
	function DisplayErrorMSG(FormObject)
	{
	  if(FormObject.noOfRows.value == "")
	  {
		 alert ('Please enter valid number between 10-999 only');
		 FormObject.noOfRows.value = '';
		 FormObject.noOfRows.focus();
		 return false;
	  }
	  
	  if  (isNaN(FormObject.noOfRows.value)) 
	    {
	      alert ('Please enter valid number between 10-999 only');
	      FormObject.noOfRows.value = '';
	      FormObject.noOfRows.focus();
	      return false;
	    }
	       if(FormObject.noOfRows.value.length >= '4')
	       {
	        alert ('Please enter valid number between 10-999 only');
	        FormObject.noOfRows.value = '';
	        FormObject.noOfRows.focus();
	        return false;
	       }
		        if(FormObject.noOfRows.value <= 9)
		        {
		         alert ('Please enter valid number between 10-999 only');
		         FormObject.noOfRows.value = '';
		         FormObject.noOfRows.focus();
		         return false;
		        }
	   return true; 
	} 
	
	function formValidation(FormObject)
	{
		noError = true;
		for (i = 0; i < FormObject.elements.length && noError; i++)
		{
			if(FormObject.elements[i].name=='noOfRows')
			{
				noError= DisplayErrorMSG(FormObject);
			}
			else
			{
				if(FormObject.elements[i].name=='sqlString'||FormObject.elements[i].name=='submit'||FormObject.elements[i].name=='startOfrecords'||FormObject.elements[i].name=='endOfrecords'||FormObject.elements[i].name=='ExtractToExcel'||FormObject.elements[i].name=='submit1'||FormObject.elements[i].name=='ExtractToExcel1')
				{
					//noError= checkdate(FormObject.elements[i].value);
				}
				else
				{
				   if(FormObject.elements[i].value=='')
				   {
				     alert('Date should not be blank.Please enter date in yyyy-mm-dd format.');
				     FormObject.elements[i].value = '';
				     FormObject.elements[i].focus();
				     noError = false;
				   }
				   else
				   {
					   noError = checkdate(FormObject.elements[i].value);
					   if(noError == false)
					   {
					     FormObject.elements[i].value = '';
					     FormObject.elements[i].focus();
					   }
				   }
				}
			}	
		}

		//if(noError)
		  // FormObject.submit();
		  return noError;
	}
	
	function checkdate(input)
	{
	   	var validformat=/^(\d{2}|\d{4})(\/|-|\.)(\d{1,2})\2(\d{2}|\d{4})$/; //Basic check for format validity
		var returnval=false;
		if (!validformat.test(input))
		{
		  alert('Invalid Date Format.Please enter date in yyyy-mm-dd format.');
		}
		else
		{ //Detailed check for valid date ranges
		 
		  var yearfield=input.split("-")[0];
		  var monthfield=input.split("-")[1];
		  var dayfield=input.split("-")[2];
		  var dayobj = new Date(yearfield, monthfield-1, dayfield);
		  if((dayobj.getMonth()+1!=monthfield)||(dayobj.getDate()!=dayfield)||(dayobj.getFullYear()!=yearfield))  
		  {
		     alert('Invalid Day, Month, or Year range detected.Please enter date in yyyy-mm-dd format.');
		  }
		  else 
		  {
		   //alert ('Correct date');
		   returnval=true; 
		  }
		}
		if (returnval==false)
		{ 
		 //input.select();
	    }
		return returnval;
	}
	
	function DisplayediterrorMSG1(FormObject)
	{

	  if(FormObject.gateway_box_other.value=="Select") 
	  {
	    alert ('Please select the field first');
	    FormObject.gateway_box_other.focus();
	    return false;
	  }
	 var TheEditor = FCKeditorAPI.GetInstance('ContentBody');
			var val = TheEditor.GetHTML();
			if (trim(val) == '') {
				alert('Please enter some text in editor.');
				TheEditor.Focus();
				return false;
			} else {
				val = val.replace(/&nbsp;/g,"");
				val = val.replace(/ /g,'');
				var temp='';
				var len=val.length;
				var con='Yes';
				for (var i=0;i<len;i++) {
					if (val.charAt(i)=='<') {
						con='No';
					} 
					if (con=='Yes') {
						temp = temp + val.charAt(i);
					}
					if (val.charAt(i)=='>') {
						con='Yes';
					}
				}
				if (temp == '') {
					alert('Please enter some text in editor.');
					TheEditor.Focus();
					return false;
				}
			}
			return true;
	} 
	
	function DisplayediterrorMSG2(FormObject)
	{
	  if(FormObject.gateway_box_button.value=="Select") 
	  {
	    alert ('Please select the field first');
	    FormObject.gateway_box_button.focus();
	    return false;
	  }
	  if(trim(FormObject.area.value)=='') 
	  {
	    alert ('Please enter some text in textarea');
	    FormObject.area.focus();
	    return false;
	  }
	  return true; 
	} 
	
	function DisplayBAediterrorMSG(FormObject)
	{

	  if(FormObject.text_box.value=="Select") 
	  {
	    alert ('Please select the field first');
	    FormObject.text_box.focus();
	    return false;
	  }
	  if(FormObject.textfield.value=='') 
	  {
	    alert ('Please enter some text in textfield');
	    FormObject.textfield.focus();
	    return false;
	  }
			var TheEditor = FCKeditorAPI.GetInstance('ContentBody');
			var val = TheEditor.GetHTML();
			if (trim(val) == '') {
				alert('Please enter some text in editor.');
				TheEditor.Focus();
				return false;
			} else {
				val = val.replace(/&nbsp;/g,"");
				val = val.replace(/ /g,'');
				var temp='';
				var len=val.length;
				var con='Yes';
				for (var i=0;i<len;i++) {
					if (val.charAt(i)=='<') {
						con='No';
					} 
					if (con=='Yes') {
						temp = temp + val.charAt(i);
					}
					if (val.charAt(i)=='>') {
						con='Yes';
					}
				}
				if (temp == '') {
					alert('Please enter some text in editor.');
					TheEditor.Focus();
					return false;
				}
			}
			return true;
	  } 
	
	function DisplayHAediterrorMSG(FormObject)
	{
      if(FormObject.companyname.value=="SelectCompany") 
	  {
	    alert ('Please select the company field first');
	    FormObject.companyname.focus();
	    return false;
	  }
	  if(FormObject.categoryname.value=="SelectCategory") 
	  {
	    alert ('Please select the category field first');
	    FormObject.categoryname.focus();
	    return false;
	  }
	  if(FormObject.area.value=='') 
	  {
	    alert ('Please enter some text in textArea');
	    FormObject.area.focus();
	    return false;
	  }
	  return true; 
	} 
	
    function DisplayErrorMSGs(FormObject)
	{
	  if(FormObject.testname.value=="") 
	  {
	    alert ('Please enter test name');
	    FormObject.testname.focus();
	    return false;
	  }
	  if(FormObject.TestCourseFile.value=="") 
	  {
	    alert ('Please select file to upload');
	    FormObject.TestCourseFile.focus();
	    return false;
	  }
      return true; 
	}
	
	function PasswordErrorMSG(FormObject)
	{
	  var invalid = " "; 
	  if(FormObject.curPass.value=="") 
	  {
	    alert ('Please enter current password');
	    FormObject.curPass.focus();
	    return false;
	  }
	  if(FormObject.newPass.value=="") 
	  {
	    alert ('Please enter new password');
	    FormObject.newPass.focus();
	    return false;
	  }
	  if (FormObject.newPass.value.indexOf(invalid) > -1)
	  {
		alert("Space not allowed in password: Please enter the password.");
		FormObject.newPass.value ='';
		FormObject.newPass.focus();
		return false;
	  }

	  if(FormObject.curPass.value==FormObject.newPass.value)
	  {
	    alert ('New password should not be same as current password.Please enter another new password');
	    FormObject.newPass.value ='';
	    FormObject.confirmPass.value ='';
	    FormObject.newPass.focus();
	    return false;
	  }
	  
	  if(FormObject.confirmPass.value=="") 
	  {
	    alert ('Please enter confirm password');
	    FormObject.confirmPass.focus();
	    return false;
	  }
	  
	  if(FormObject.confirmPass.value.indexOf(invalid) > -1)
	  {
		alert("Space not allowed in password: Please re enter the confirm password.");
		FormObject.confirmPass.value ='';
		FormObject.confirmPass.focus();
		return false;
	  }
	 
    if(FormObject.newPass.value!=FormObject.confirmPass.value)
	  {
	    alert ('Confirm password should be same as new password.Please enter correct confirm password');
	    FormObject.confirmPass.value ='';
	    FormObject.confirmPass.focus();
	    return false;
	  }
	  if(FormObject.ckbox.value=="") 
	  {
	    alert ('Please check the checkbox');
	    FormObject.ckbox.focus();
	    return false;
	  }
      return true; 
	}  


  	function validateCheckBoxPollAndLogin(selectedCheckBox)
	 {
		if (selectedCheckBox.name == 'poll' || selectedCheckBox.name == 'login') {
			if (!selectedCheckBox.checked) {
				selectedCheckBox.checked = true;
				if (selectedCheckBox.name == 'poll') {
					alert('Poll can\'t be unchecked.');
				} else {
					alert('Login can\'t be unchecked.');
				}
			}
		}
  	 }
	 function checkPollAndLogin()
	 {
	 var pollChkBox = document.getElementById('poll');
	 var loginChkBox = document.getElementById('login');
	 if ((pollChkBox!=null)&&(!pollChkBox.checked))
	 {
		 pollChkBox.checked = true;
	 }
	 if ((loginChkBox!=null)&&(!loginChkBox.checked))
	 {
		 loginChkBox.checked = true;
	 }
	 
	 }


  /* **************
       Swati ghawate
  */
  	function validateContactInfo(FormObject)
  	{
  		 if (FormObject.subject) 
	     {
	       if (trim(FormObject.subject.value) =="")
		    {
		     alert ("Please enter: Subject");
		     FormObject.subject.focus();
		     return false;
		    }
		   if(FormObject.subject.value.length > 100)
		   {
		      alert ("Subject should not be greater than 100 Characters");
		      FormObject.fromName.focus();
		      return false;
		   }
	     }
	   
	    if (FormObject.fromName) 
	     { 
		   if (trim(FormObject.fromName.value) =="")
		   {
		      alert ("Please enter: Name");
		      FormObject.fromName.focus();
		      return false;
		   }
		   if(FormObject.fromName.value.length > 100)
		   {
		      alert ("Name should not be greater than 100 Characters");
		      FormObject.fromName.focus();
		      return false;
		   }
	     }
	
	    
	   /**
	   *@author nikhil.gumaste
	   * validation for special characters and alpha numeric numbers
	   */
	   //alert on finding all letters.
	    var noalpha = "abcdefghijklmnopqrstvuwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
		for (var i = 0; i < FormObject.phone_no.value.length; i++) {
		  	if (noalpha.indexOf(FormObject.phone_no.value.charAt(i)) != -1) {
			  	 alert("Your phone number has Alpha numeric characters. \nThese are not allowed.\n Please remove them and try again.");
			  	 return false;
		  	}
	  	}
	   
	    // alert on finding all special characters.
	    var iChars = "~!@#$%^&*()+=[]\\\';,./{}|\":<>?";
	    for (var i = 0; i < FormObject.phone_no.value.length; i++) {
	  		if (iChars.indexOf(FormObject.phone_no.value.charAt(i)) != -1) {
		  		alert ("Your phone number has special characters. \nThese are not allowed.\n Please remove them and try again.");
		  		return false;
	  		}
	  	}
	   
	   /* 
	   * validation commented for check international phone
		if (checkInternationalPhone(FormObject.phone_no.value)==false){
				alert("Please Enter a Valid Phone Number")
				FormObject.phone_no.value=""
				FormObject.phone_no.focus()
				return false
			}
		*/	
		 if(trim(FormObject.phone_no.value).length > 20)
		   {
		      alert ("Phone number should be less than  20 digit");
		      FormObject.phone_no.focus();
		      return false;
		   }
		  if(trim(FormObject.phone_no.value)>1)
		  {
		   if(trim(FormObject.phone_no.value).length < 6)
		   {
		      alert ("Phone number should be more than  6 digit");
		      FormObject.phone_no.focus();
		      return false;
		   } 
		   }
	   if (trim(FormObject.email.value) =="")
	   {
	      alert ("Please enter: Email address");
	      FormObject.email.value = '';
	      FormObject.email.focus();
	      return false;
	   } 
	  
	  if (trim(FormObject.email.value).length >100)
	   {
	      alert ("Email should not be greater than 100 Characters");
	      FormObject.email.value = '';
	      FormObject.email.focus();
	      return false;
	   } 
	   if ((FormObject.email.value.indexOf("@") == -1) || (FormObject.email.value.indexOf(".") == -1) || (FormObject.email.value.indexOf("@") == 0))
	   {
	      alert ("Invalid email: Please enter valid email address");
	      FormObject.email.value = '';
	      FormObject.email.focus();
	      return false;
	   }
	   
	   if (echeck(FormObject.email.value)==false)
	   {
			alert("Invalid email: Please enter valid email address")
			FormObject.email.value = '';
	        FormObject.email.focus();
			return false;
	   }

	    if (trim(FormObject.message.value) =="")
	   {
	      alert ("Please enter: Message");
	      FormObject.message.value = '';
	      FormObject.message.focus();
	      return false;
	   } 
	  
	    
         return true;   
  	}

  function resetContactInfo(FormObject)
  	{
  				   	
	   FormObject.subject.value="";
	   FormObject.fromName.value="";
	   FormObject.phone_no.value= ""; 
	   FormObject.email.value ="";
	   FormObject.message.value="";
	   return true;   
  	}
  	
  
  function resetContactUser(FormObject)
  	{
  				   	
	   FormObject.subject.value="";
	   FormObject.email.value ="";
	   FormObject.message.value="";
	   return true;   
  	}
  	
  	
  function resetContactBA(FormObject)
  	{
  				   	
	   FormObject.subject.value="";
	   FormObject.searchdropdown.value ="";
	   FormObject.message.value="";
	   return true;   
  	}
  /* **************
       Swati ghawate
  */
  	function validateContactBA(FormObject)
  	{
  		 if (FormObject.subject) 
	     {
	       if (trim(FormObject.subject.value) =="")
		    {
		     alert ("Please enter: Subject");
		     FormObject.subject.focus();
		     return false;
		    }
		   if(FormObject.subject.value.length > 100)
		   {
		      alert ("Subject name length should not be greater than 100 character");
		      FormObject.fromName.focus();
		      return false;
		   }
	     }
	   
	  
	   
	   if(FormObject.searchdropdown.value =="")
	   {
	     alert ("Select the company");
		      FormObject.searchdropdown.focus();
		      return false;
	   }	  
	 
	     if (trim(FormObject.message.value) =="")
	   {
	      alert ("Please enter: Message");
	      FormObject.message.value = '';
	      FormObject.message.focus();
	      return false;
	   } 
	    
         return true;   
  	}


 function validateReplyMessage(FormObject)
 {
  
   if (trim(FormObject.message.value) =="")
	   {
	      alert ("Please enter: Message");
	      FormObject.message.value = '';
	      FormObject.message.focus();
	      return false;
	   } 
 if (trim(FormObject.subject.value) =="")
	   {
	      alert ("Please enter: Subject");
	      FormObject.message.value = '';
	      FormObject.message.focus();
	      return false;
	   }    
         return true;   
 }
 
 /* **************
       Swati ghawate
  */
  	function validateContactUser(FormObject)
  	{
  		
	   
	     if (trim(FormObject.email.value) =="")
	   {
	      alert ("Please enter: Email address");
	      FormObject.email.value = '';
	      FormObject.email.focus();
	      return false;
	   } 
	  
	   if ((FormObject.email.value.indexOf("@") == -1) || (FormObject.email.value.indexOf(".") == -1) || (FormObject.email.value.indexOf("@") == 0))
	   {
	      alert ("Invalid email: Please enter valid email address");
	      FormObject.email.value = '';
	      FormObject.email.focus();
	      return false;
	   }
	   
	   if (echeck(FormObject.email.value)==false)
	   {
			alert("Invalid email: Please enter valid email address")
			FormObject.email.value = '';
	        FormObject.email.focus();
			return false;
	   }
	     if (FormObject.subject) 
	     {
	       if (trim(FormObject.subject.value) =="")
		    {
		     alert ("Please enter: Subject");
		     FormObject.subject.focus();
		     return false;
		    }
		   if(FormObject.subject.value.length > 100)
		   {
		      alert ("Subject name length should not be greater than 100 character");
		      FormObject.fromName.focus();
		      return false;
		   }
	     }
	 
	     if (trim(FormObject.message.value) =="")
	   {
	      alert ("Please enter: Message");
	      FormObject.message.value = '';
	      FormObject.message.focus();
	      return false;
	   } 
         return true;   
  	}
 
  	/******************
  	*ujwala sarode
  	*added function for edit_gateway_content.php
  	******************/
  function setValuesold()
	{ 
	   	var selectedVal = document.editContent.gateway_box_button.value;
		var indexx = selectedVal.indexOf('|&|');
		document.editContent.area.value = selectedVal.substring(0,indexx);
		document.editContent.hiddenArea.value = selectedVal.substring(indexx+3, selectedVal.length);
	}
  	
  	function setValues()
	{
		var selectedVal = document.editContent.gateway_box_other.value;
		var indexx = selectedVal.indexOf('|&|');
		var TheEditor = FCKeditorAPI.GetInstance('ContentBody');
		TheEditor.SetHTML(selectedVal.substring(0,indexx));
        document.editContent.hiddenArea.value = selectedVal.substring(indexx+3, selectedVal.length);
	}
	
	function setBAValues()
	{
		var selectedVal = document.textboxInfo.text_box.value;
		var indexx = selectedVal.indexOf('|&|');
		var TheEditor = FCKeditorAPI.GetInstance('ContentBody');
		TheEditor.SetHTML(selectedVal.substring(0,indexx));
		var indexx1 = selectedVal.indexOf('|#|');
		document.textboxInfo.textfield.value = selectedVal.substring(indexx+3, indexx1);
		document.textboxInfo.hiddenArea.value = selectedVal.substring(indexx1+3, selectedVal.length);
	}
	
	function setHAValues()
	{
		var selectedVal = document.editContent.gateway_text_box.value;
		var indexx = selectedVal.indexOf('|&|');
		var TheEditor = FCKeditorAPI.GetInstance('ContentBody');
		TheEditor.SetHTML(selectedVal.substring(0,indexx));
		var indexx1 = selectedVal.indexOf('|#|');
		document.editContent.textfield.value = selectedVal.substring(indexx+3, indexx1);
		document.editContent.hiddenArea.value = selectedVal.substring(indexx1+3, selectedVal.length);
	}
	/**
	*@author nikhil.gumaste
	* function to set company attributes like category and description.
	*/
	function setCompanyAttributes() {
		var selectedVal = document.Category_Company.companyname.value;
		var indexx = selectedVal.indexOf('|&|');
		var indexx1 = selectedVal.indexOf('|#|');
		document.Category_Company.categoryname.value = selectedVal.substring(0,indexx);
		document.Category_Company.area.value = selectedVal.substring(indexx+3, indexx1);
		
		document.Category_Company.hiddenCompanyName.value = selectedVal.substring(indexx1+3, selectedVal.length);
	}
  	/**
  	* @author nikhil.gumaste
  	* set the category value 
  	*/
  	function setCategoryValues()
	{
		var selectedVal = document.ContentAdministerForm.editCategory.value;
		document.ContentAdministerForm.EditText.value = selectedVal;
	}

  	function validateCheckBoxSelection(selectedCheckBox, currentCheckBox) {

  	var previous = document.getElementsByName(currentCheckBox)[0];
	

  	if (previous.value == '') {
  		previous.value = selectedCheckBox.value;
  	} else {
  		if (selectedCheckBox.checked) {
		  	selectedCheckBox.checked = false;
  			if (currentCheckBox == 'checkboxeditbordertheme') {
  				alert ("Border theme color already selected.");
  			}
  			if (currentCheckBox == 'checkboxeditbackgroundborder') {
  				alert("Background border theme color already selected.");
  			}
  			if (currentCheckBox == 'checkboxpageColor') {
  				alert("Page color already selected.");
  			}
  			if (currentCheckBox == 'checkboxButtonColor') {
  				alert("Button color already selected.");
  			}
  		} else {
  			previous.value = '';
  		}
  	}

  	}
  	
/**
* Nikhil Gumaste.
* function to validate the check boxes while editing the dash board components.
*/ 	
 function validateDBoardCheckBoxFormOnSubmit(dbaordCheckBoxForm) {
 if (!dbaordCheckBoxForm.messageBoard.checked && !dbaordCheckBoxForm.Invitation.checked && !dbaordCheckBoxForm.learningConsumption.checked &&
 	!dbaordCheckBoxForm.invitationSent.checked && !dbaordCheckBoxForm.Account.checked && !dbaordCheckBoxForm.courseCompletion.checked && 
 	!dbaordCheckBoxForm.pendingInvitations.checked && !dbaordCheckBoxForm.qualityOfLearning.checked && !dbaordCheckBoxForm.learningAssessment.checked && 
 	!dbaordCheckBoxForm.ReportForInvitationsSent.checked && !dbaordCheckBoxForm.ReportForAccounts.checked && !dbaordCheckBoxForm.ReportForCourseCompletions.checked && 
 	!dbaordCheckBoxForm.ReportForInvitationsPending.checked && !dbaordCheckBoxForm.ReportForLoginsLast7Days.checked && !dbaordCheckBoxForm.ReportForQualityofLearning.checked && 
 	!dbaordCheckBoxForm.ReportForLearningAssessment.checked && !dbaordCheckBoxForm.ReportForLearningConsumption.checked) {
    alert("Please select atleast one component, It is mandatory for the user to have dashboard components.");
    return false;
  }

  return true;
}

/**
* Nikhil Gumaste.
* function to validate the configuration form while configuring the dash board components.
*/ 	
function ValidationForDboardConfiguration(dboardConfigurationForm) {

	if (!dboardConfigurationForm.checkBoxmessage_board.checked && !dboardConfigurationForm.checkBoxinvitation_window.checked &&
		!dboardConfigurationForm.checkBoxsite_activity.checked && !dboardConfigurationForm.checkBoximpact_of_learning.checked &&
		!dboardConfigurationForm.checkBoxreports.checked) {
		alert("It is mandatory to show atleast one dashboard component.");
		return false;
	}
	if (trim(dboardConfigurationForm.textmessage_board.value) == "") {
		alert("Order for message window is mandatory.");
		dboardConfigurationForm.textmessage_board.focus(); 
		return false;
	} else if (trim(dboardConfigurationForm.textinvitation_window.value) == "") {
		alert("Order for invitation window is mandatory.");
		dboardConfigurationForm.textinvitation_window.focus(); 
		return false;
	} else if (trim(dboardConfigurationForm.textsite_activity.value) == "") {
		alert("Order for site activity window is mandatory.");
		dboardConfigurationForm.textsite_activity.focus(); 
		return false;
	} else if (trim(dboardConfigurationForm.textimpact_of_learning.value) == "") {
		alert("Order for impact of learning window is mandatory.");
		dboardConfigurationForm.textimpact_of_learning.focus(); 
		return false;
	} else if (trim(dboardConfigurationForm.textreports.value) == "") {
		alert("Order for reports window is mandatory.");
		dboardConfigurationForm.textreports.focus(); 
		return false;
	} else if (trim(dboardConfigurationForm.textmessage_board.value) < 1 || trim(dboardConfigurationForm.textmessage_board.value) > 5) {
		alert("Order for message window must be between 1 to 5.");
		dboardConfigurationForm.textmessage_board.focus(); 
		return false;
	} else if (dboardConfigurationForm.textinvitation_window.value < 1 || dboardConfigurationForm.textinvitation_window.value > 5) {
		alert("Order for invitation window must be between 1 to 5.");
		dboardConfigurationForm.textinvitation_window.focus(); 
		return false;
	} else if (dboardConfigurationForm.textsite_activity.value < 1 || dboardConfigurationForm.textsite_activity.value > 5) {
		alert("Order for site activity window must be between 1 to 5.");
		dboardConfigurationForm.textsite_activity.focus(); 
		return false;
	} else if (dboardConfigurationForm.textimpact_of_learning.value < 1 || dboardConfigurationForm.textimpact_of_learning.value > 5) {
		alert("Order for impact of learning window must be between 1 to 5.");
		dboardConfigurationForm.textimpact_of_learning.focus(); 
		return false;
	} else if ( dboardConfigurationForm.textreports.value < 1 || dboardConfigurationForm.textreports.value > 5) {
		alert("Order for reports window must be between 1 to 5.");
		dboardConfigurationForm.textreports.focus(); 
		return false;
	}
	
	// initialize an array for order.
	orderArray = new Array(5);
	
	orderArray[0] = dboardConfigurationForm.textmessage_board.value;
	orderArray[1] = dboardConfigurationForm.textinvitation_window.value;
	orderArray[2] = dboardConfigurationForm.textsite_activity.value;
	orderArray[3] = dboardConfigurationForm.textimpact_of_learning.value;
	orderArray[4] = dboardConfigurationForm.textreports.value;
	for(i = 0; i < 5; i++) {
		currElement = orderArray[i];
		for(j = i + 1; j < 5; j++) {
			loopElement = orderArray[j];
			if (currElement == loopElement) {
				alert("Order for dash board components cannot be same.");
				return false;
			}
		}
	}
	
 return true;
}

/*******************

	* Swati ghawate
	* Added function 
	
	********************/
function ValidatePasswordInterval(FormObject)
{
		//to check for enable disable reminder
		var count = -1;
	    for (var j=FormObject.enableDis.length-1; j > -1; j--) {
	        if (FormObject.enableDis[j].checked) {count = j; j = -1;}
	    }
	    if (count > -1) 
	    {
	      if(FormObject.enableDis[count].value=='Ena')
	      {
		    //check for Days or month selected
			var cnt = -1;
		    for (var i=FormObject.dayMonth.length-1; i > -1; i--) {
		        if (FormObject.dayMonth[i].checked) {cnt = i; i = -1;}
		    }
		    if (cnt > -1) 
		    {
		      if(FormObject.dayMonth[cnt].value=='Days')
		      {
		        if  (isNaN(FormObject.noOfDays.value)) 
			    {
			      alert ('Please enter valid number between 1-365 only');
			      FormObject.noOfDays.value = '';
			      FormObject.noOfDays.focus();
			      return false;
			    }
			       if(FormObject.noOfDays.value >365)
			       {
			        alert ('Please enter valid number between 1-365 only');
			        FormObject.noOfDays.value = '';
			        FormObject.noOfDays.focus();
			        return false;
			       }
				 
				  if(FormObject.noOfDays.value <= 0)
				        {
				         alert ('Please enter valid number between 1-365 only');
				         FormObject.noOfDays.value = '';
				         FormObject.noOfDays.focus();
				         return false;
				        }  
			      }
			      
			      if(FormObject.dayMonth[cnt].value=='Month')
		      {
		        if  (isNaN(FormObject.noOfDays.value)) 
			    {
			      alert ('Please enter valid number between 1-12 only');
			      FormObject.noOfDays.value = '';
			      FormObject.noOfDays.focus();
			      return false;
			    }
			       if(FormObject.noOfDays.value >12)
			       {
			        alert ('Please enter valid number between 1-12 only');
			        FormObject.noOfDays.value = '';
			        FormObject.noOfDays.focus();
			        return false;
			       }
				 
				  if(FormObject.noOfDays.value <= 0)
				        {
				         alert ('Please enter valid number between 1-12 only');
				         FormObject.noOfDays.value = '';
				         FormObject.noOfDays.focus();
				         return false;
				        }  
			      }
		    }
		   
	        		
		    
			if(FormObject.noOfDays.value!="")
			{
			    //validate(FormObject.noOfDays.value);
			    var noOfDays;
			    noOfDays=FormObject.noOfDays.value;
				var decPoint = ".";
				var IsDecPoint = false;
				for (i=0; i<noOfDays.length && IsDecPoint == false; i++)
				 {
					Char = noOfDays.charAt(i);
					if (noOfDays.charAt(1) == '.') {
					IsDecPoint = false;
					}
					else {
					IsDecPoint = true;
					}
				}
				if (IsDecPoint == false) {
				alert ('Please enter a whole number.');
				FormObject.noOfDays.value = '';
			    FormObject.noOfDays.focus();
				return false;
				}
				
			}
		}	
	} 	     
   return true;
}


/*******************

	* Swati ghawate
	* Added function 
	
	********************/
function ValidateCandidateInfo(FormObject)
{
		if  (isNaN(FormObject.accessLimit.value)) 
	    {
	      alert ('Please enter valid number between 1-999 only');
	      FormObject.accessLimit.value = '';
	      FormObject.accessLimit.focus();
	      return false;
	    }
	       if(FormObject.accessLimit.value.length >= '4')
	       {
	        alert ('Please enter valid number between 1-999 only');
	        FormObject.accessLimit.value = '';
	        FormObject.accessLimit.focus();
	        return false;
	       }
		  
		if  (isNaN(FormObject.actInterVal.value)) 
	    {
	      alert ('Please enter valid number between 1-999 only');
	      FormObject.actInterVal.value = '';
	      FormObject.actInterVal.focus();
	      return false;
	    }
	       if(FormObject.actInterVal.value.length >= '4')
	       {
	        alert ('Please enter valid number between 1-999 only');
	        FormObject.actInterVal.value = '';
	        FormObject.actInterVal.focus();
	        return false;
	       }
	     if  (FormObject.accessLimit.value <= 0) 
	    {
	      alert ('Please enter valid number between 1-999 only');
	      FormObject.accessLimit.value = '';
	      FormObject.accessLimit.focus();
	      return false;
	    }  
	    
	    if  (FormObject.actInterVal.value <= 0)
	    {
	      alert ('Please enter valid number between 1-999 only');
	      FormObject.actInterVal.value = '';
	      FormObject.actInterVal.focus();
	      return false;
	    }    
	    
	    if(FormObject.accessLimit.value!="")
		{
		    //validate(FormObject.noOfDays.value);
		    var accessLimitlen,accessLimit;
		    accessLimit=FormObject.accessLimit.value;
		    accessLimitlen=FormObject.accessLimit.value.length;
			var decPoint = ".";
			var IsDecPoint = true;
			for (i=0; i<accessLimitlen ; i++)
			 {
				Char = accessLimit.charAt(i);
				if (accessLimit.charAt(i) == '.') {
				IsDecPoint = false;
				}
				
			}
			if (IsDecPoint == false) {
			alert ('Please enter a whole number.');
			FormObject.accessLimit.value = '';
			FormObject.actInterVal.value = '';
		    FormObject.accessLimit.focus();
			return false;
			}
			
		}   
		
		 if(FormObject.actInterVal.value.length!="")
		{
		    //validate(FormObject.noOfDays.value);
		    var actInterVal,actInterValLen;
		    actInterVal=FormObject.actInterVal.value;
		    actInterValLen=FormObject.actInterVal.value.length;
			var decPoint = ".";
			var IsDecPoint = true;
			for (i=0; i<actInterValLen ; i++)
			 {
				Char =actInterVal.charAt(i);
				if (actInterVal.charAt(1) == '.') {
				IsDecPoint = false;
				}
				
			}
			if (IsDecPoint == false) {
			alert ('Please enter a whole number.');
			FormObject.actInterVal.value = '';
		    FormObject.actInterVal.focus();
			return false;
			}
			
		}   
     return true; 
}

/**
*@author nikhil.gumaste
* validate content category fields 
*/
function validateContentCategoryEdit(FormObject) {
	if (trim(FormObject.EditText.value) == "") {
		alert("category cannot be blank");
		FormObject.EditText.focus();
		return false;
	}
	return true;
}


/**
*@author nikhil.gumaste
* validate content category fields 
*/
function validateContentCategoryRemove(FormObject) {
	if (trim(FormObject.removeCategory.value) == "SelectCategory") {
		alert("Select category to remove");
		//FormObject.EditText.focus();
		return false;
	}
	return true;
}

/**
*@author nikhil.gumaste
* validate content category fields
*/
function validateContentCategoryAdd(FormObject) {
	if (trim(FormObject.AddText.value) == "") {
		alert("category cannot be blank");
		FormObject.AddText.focus();
		return false;
	}
	return true;
}

/**
* Swati Ghawate
*/

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		    return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		     return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		     return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		     return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		     return false
		 }
     
         if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(str))){
            return false
         }
 		 return true					
	}
	
	
	
	var cnt = 1 ;
	function bringToFront(obj) {
		obj.style.zIndex = cnt;
		cnt = cnt + 1;
	}
	
	function openViewPagePopup() {
		window_handle=window.open("/newDsn/gateway/view_customize_gateway_page.php?pageName=gateway","Window1","height=800,width=1000,left=1,top=1,menubar=no,toolbar=no,resizable=yes,scrollbars=yes");
		window_handle.focus();
		return false;
	}

	 function deleteLogo(){

	     if( document.getElementById("deleteLogoCheckbox").checked==true)
	     {
		   document.getElementById("logochekbox").value="blank.png";         
		 }
		 else
              document.getElementById("logochekbox").value=""; 
		
	 }
	 
	 /*********
	 
	 Swati
	 */
	 function getEmailID(FormObject)
	 {
	   var email = FormObject.searchdropdown.value;
	   FormObject.email.value = email;
	   FormObject.emailID.value = email;
	 }
	 
	 function DisplayAlertMsg() {
		alert("Url for this link is not exists");
		return false;
	}
	 function GetConfirmation(message)
	 {
	   
	       	//var msg='Are you sure you want to delete record ?';
	       	
			 if(confirm(message))
	         {
	          return true;
	         }
	         else
	         {
	          return false;
	         } 
	 
       
      return true
    }
    
    
    /***
    Swati Ghawate
    */
	    // Declaring required variables
	var digits = "0123456789";
	// non-digit characters which are allowed in phone numbers
	var phoneNumberDelimiters = "()- ";
	// characters which are allowed in international phone numbers
	// (a leading + is OK)
	var validWorldPhoneChars = phoneNumberDelimiters + "+";
	// Minimum no of digits in an international phone no.
	var minDigitsInIPhoneNumber = 10;
		function isInteger(s)
		{   var i;
		    for (i = 0; i < s.length; i++)
		    {   
		        // Check that current character is number.
		        var c = s.charAt(i);
		        if (((c < "0") || (c > "9"))) return false;
		    }
		    // All characters are numbers.
		    return true;
		}
		
		function stripCharsInBag(s, bag)
		{   var i;
		    var returnString = "";
		    // Search through string's characters one by one.
		    // If character is not in bag, append to returnString.
		    for (i = 0; i < s.length; i++)
		    {   
		        // Check that current character isn't whitespace.
		        var c = s.charAt(i);
		        if (bag.indexOf(c) == -1) returnString += c;
		    }
		    return returnString;
		}
		
		function checkInternationalPhone(strPhone){
		s=stripCharsInBag(strPhone,validWorldPhoneChars);
		return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
		}
		
		function validateWelcomeWindowContent() {
			var TheEditor = FCKeditorAPI.GetInstance('ContentBody');
			var val = TheEditor.GetHTML();
			if (trim(val) == '') {
				alert('Please enter some text in welcome editor.');
				TheEditor.Focus();
				return false;
			} else {
				val = val.replace(/&nbsp;/g,"");
				val = val.replace(/ /g,'');
				var temp='';
				var len=val.length;
				var con='Yes';
				for (var i=0;i<len;i++) {
					if (val.charAt(i)=='<') {
						con='No';
					} 
					if (con=='Yes') {
						temp = temp + val.charAt(i);
					}
					if (val.charAt(i)=='>') {
						con='Yes';
					}
				}
				if (temp == '') {
					alert('Please enter some text in welcome editor.');
					TheEditor.Focus();
					return false;
				}
			}
			return true;
		}
		
		function validateFAQContent() {
			var conNam = document.getElementById('conName');
			if (trim(conNam.value) == '') {
				alert('Content name can not be empty.');
				conNam.focus();
				return false;
			}
			
			var TheEditor = FCKeditorAPI.GetInstance('ContentBody');
			var val = TheEditor.GetHTML();
			if (trim(val) == '') {
				alert('Content body can not be made empty.');
				TheEditor.Focus();
				return false;
			} else {
				val = val.replace(/&nbsp;/g,"");
				val = val.replace(/ /g,'');
				var temp='';
				var len=val.length;
				var con='Yes';
				for (var i=0;i<len;i++) {
					if (val.charAt(i)=='<') {
						con='No';
					} 
					if (con=='Yes') {
						temp = temp + val.charAt(i);
					}
					if (val.charAt(i)=='>') {
						con='Yes';
					}
				}
				if (temp == '') {
					alert('Content body can not be made empty.');
					TheEditor.Focus();
					return false;
				}
			}
			return true;
		}
		
		function resetFAQContent( FormObject) {
			   FormObject.UserType.value="";
	   FormObject.fromName.value="";
	   FormObject.ContentBody.value= ""; 
	   FormObject.conName.value ="";
	   
	   return true;   
		}
		function trimFckContent() {
		
		}
			
		
		//swati
		
		
			
			
function deleteCompanyLogo()
{
   if(confirm('Are you sure you want to delete this logo?')==true) 
   {
    document.DeleteCompanyLogo.submit();         
   }else
   {
     document.DeleteCompanyLogo.deleteLogoCheckbox.checked=false;
   }
   
		

}

function deleteAudioFile()
{
	if(confirm('Are you sure want to delete this audio?')==true) 
   {
    document.DeleteAudioForm.submit();         
   }else
   {
     document.DeleteAudioForm.deleteAudioCheckbox.checked=false;
   }			
			
	}

	function valdateNewWebUser(FormObject) {
		if (trim(FormObject.FirstName.value)=='') {
			alert('Please enter first name.');
			FormObject.FirstName.value='';
	        FormObject.FirstName.focus();
			return false;
		}
		if (trim(FormObject.LastName.value)=='') {
			alert('Please enter last name.');
			FormObject.LastName.value='';
	        FormObject.LastName.focus();
			return false;
		}
		if (trim(FormObject.EmailID.value)=='') {
			alert('Please enter email address.');
			FormObject.EmailID.value='';
	        FormObject.EmailID.focus();
			return false;
		}
		if (trim(FormObject.ContactNumber.value)=='') {
			alert('Please enter phone number.');
			FormObject.ContactNumber.value='';
	        FormObject.ContactNumber.focus();
			return false;
		}
		 var iChars = "~!@#$%^&*+=[]\\\';,./{}|\":<>?";
	 for (var i = 0; i < FormObject.ContactNumber.value.length; i++) 
	   {
	  	 if (iChars.indexOf(FormObject.ContactNumber.value.charAt(i)) != -1) 
	  	  {
		  	alert ("Phone number has special characters. These are not allowed.\n Please remove them and try again.");
		  	FormObject.ContactNumber.focus();
		  	return false;
	  	  }
	   }
   
    var re = /[a-zA-Z]/;
    if (re.test(FormObject.ContactNumber.value) == true)
    {
      alert ("Please enter valid phone number.");
      FormObject.ContactNumber.value='';
      FormObject.ContactNumber.focus();
      return false;
    }
   
   if (echeck(trim(FormObject.EmailID.value)) == false)
   	 {
   	    alert ("Invalid email address. Please enter valid email address.");
   	    FormObject.EmailID.value = '';
	    FormObject.EmailID.focus();
	    return false;
     }
		return true;
	}
			
