
// this JS is used by forgot_password.js for validation

function onSub()  // called when enter button is clicked
{
   validate();
   return false;
}


function onLoad1()   // called when onLoad
{
   document.onLoad = document.nam.txt_user_name.focus();
}



function validate(l_int_min_username)  // called when the user submits the forgot_password.jsp page
{
	
    var l_str_user_name = trim(document.nam.txt_user_name.value);  // local variable to store the string
    var l_str_user_mail = trim(document.nam.txt_email_id.value);  // local variable to store the string
	var  flag = false;
	
	if (l_str_user_name.length == 0 && l_str_user_mail.length == 0) // check for length of the string
    {
      alert(TXT_Var13791 );
      
      document.nam.txt_user_name.select();
      document.nam.txt_user_name.focus();    
      return false;
   } // end of check for length if  
   
   if (l_str_user_name.length > 0 && l_str_user_mail.length > 0) // check for length of the string   
   {
	  alert(both_alert);
      document.nam.txt_user_name.select();
      document.nam.txt_user_name.focus();    
	  return false;
    
   }
	if(l_str_user_name.length > 0 )
	{
	   if(checkUserName(document.nam.txt_user_name,l_int_min_username))  // checks for user name   
			flag = true;
	   else
			return false;
	}		
	if(l_str_user_mail.length > 0)
	{
		if(checkEmail(document.nam.txt_email_id)) // checks for email value
			flag = true;	
		else  // if email is not correctly entered	
			return false;
	}		
	if(	flag){
		document.nam.action = "/sebase/password_forgotpasswordsuccess.jsp";
		document.nam.submit();
		return true;	
	}else
		return false;

	
   
}// function is over here.
