function validateId(strtxt,strtxt1)
{
       if(strtxt.value == "")
		{ 
			alert("Login ID can not be blank !!");
			strtxt.focus();
			return false; 
		}
		 
	  else if(strtxt1.value == "")
		{ 
			alert("Password can not be blank !!");
			strtxt1.focus();
			return false; 
		}
	 return true;	
}

function check_blank(uid,old,new1,con)
{
 if(uid.value == "")
 {
  alert("New User-Id can not be blank");
  uid.focus();
  return(false);
 }
 
 if (isNaN(uid.value.substring(0,1)) == false )
 {

  alert("First character should be an alphabet");
  uid.focus();
  return(false);
 }
 
 if(uid.value.length < 6)
 {
  alert("Minimum 6 characters for the New User-Id ");
  uid.focus();
  return(false);
 }

 if(old.value == "")
 {
  alert("Old Password can not be blank ");
  old.focus();
  return(false);
 }
 
 if(new1.value == "")
 {
  alert("New Password can not be blank ");
  new1.focus();
  return(false);
 }
 
 if (isNaN(new1.value.substring(0,1)) == false )
 {

  alert("First character should be an alphabet");
  new1.focus();
  return(false);
 }
    
 if(new1.value.length < 6)
 {
  alert("Minimum 6 characters for the New Password ");
  new1.focus();
  return(false);
 }

 if(con.value == "")
 {
  alert("Confirm Password can not be blank ");
  con.focus();
  return(false);
 }

 if (isNaN(con.value.substring(0,1)) == false )
 {

  alert("First character should be an alphabet");
  con.focus();
  return(false);
 }
 
 if(con.value.length < 6)
 {
  alert("Minimum 6 characters for the Confirm Password ");
  con.focus();
  return(false);
 }

 return(true);
}

function check_empty(old,new1,con )
{
  
 if(old.value == "")
 {
  alert("Old Password can not be blank ");
  old.focus();
  return(false);
 }
 
 if (isNaN(old.value.substring(0,1)) == false )
 {
  	
  alert("First character should be an alphabet");
  old.focus();
  return(false);
 }
 
 if(old.value.length < 6)
 {
  alert("Minimum 6 characters for the Old Password ");
  old.focus();
  return(false);
 }

 if(new1.value == "")
 {
  alert("New Password can not be blank ");
  new1.focus();
  return(false);
 }
    
 if (isNaN(new1.value.substring(0,1)) == false )
 {

  alert("First character should be an alphabet");
  new1.focus();
  return(false);
 }
    
 if(new1.value.length < 6)
 {
  alert("Minimum 6 characters for the New Password ");
  new1.focus();
  return(false);
 }

 if(con.value == "")
 {
  alert("Confirm Password can not be blank ");
  con.focus();
  return(false);
 }

 if (isNaN(con.value.substring(0,1)) == false )
 {

  alert("First character should be an alphabet");
  con.focus();
  return(false);
 }
 
 	
 if(con.value.length < 6)
 {
  alert("Minimum 6 characters for the Confirm Password ");
  con.focus();
  return(false);
 }
 return(true);
}

function helpmsg(str1)
{
  window.status = str1;
  return true;
}

function validate(strtxt)
 {
      if (strtxt.value == "")
       {
         alert("Email ID cannot be blank");
         strtxt.focus();
         return false;
        }  
       //checks whether the email id has length less than 6 characters   
       else if ((strtxt.value.length)<6)
        {
          alert("Your Email Id must be atleast six characters long");
          strtxt.focus();
          return false;
        }
       //checks whether the email id has length greater than 40 characters    
       else if  ((strtxt.value.length)>40)
        {
          alert("Your Email Id cannot exceed more than 40 characters");
          strtxt.focus();
          return false;
        }  
       //checks whether the first character of the email id entered is an alphabet or not   
       else if  (isNaN(strtxt.value.substring(0,1)) == false)
        {
          alert("The first character should be a alphabet");
          strtxt.focus();
          return false;
        }  
      else
      { 
        var flag;
	    {
	      flag = 0;    
	      //checks whether the @ and . characters are present or not   
	      if (strtxt.value.indexOf("@") == "-1" || strtxt.value.indexOf(".") == "-1" )
           {
              alert("Please enter E-mail address in the correct format name@xxx.xxx");               
              flag = 1;
              strtxt.focus();
              return false;
   		   }
		  else
		  {
			var posfirst,poslast 
			posfirst = strtxt.value.substring(0,1)
			poslast =  strtxt.value.substring((strtxt.value.length),(strtxt.value.length-1))
			
			if( posfirst == "." || poslast == ".")
			{
			  	alert("Invalid Email Id Format !!");                 	    
				flag = 1;
				strtxt.focus();
				return false;
			}
			
		    //checks whether the . is present immediately after the @ character
			firstpos = strtxt.value.indexOf("@");
			secondpos = strtxt.value.indexOf(".");
			if (secondpos == (firstpos +1) || secondpos == (firstpos-1) ) 
			{
				alert("Invalid Email Id Format !!");                 	    
				flag = 1;
				strtxt.focus();
				return false;
			}
		  }	
	      //checks whether any of the invalid characters are entered or not
	      invalidChars = " ^&/:,;!#*";
          for (i=0; i<invalidChars.length; i++)
          {
             badChar = invalidChars.charAt(i)
             var flag1;
             
             if(strtxt.value.indexOf(badChar,0) > -1) 
              {
			     flag1 = 1;
			     flag = 1;
			   }
          }
           
           if (flag1 == 1)
           {
			  alert("Invalid Character entered in E-Mail Id");
			  strtxt.focus();
			  return false;
		   }	
       }
     }
     
     return true;   
   } 
   
function check_valid(fname,mname,lname,ssnno,assno)
{
  if (fname.value == "" )
  {
	alert("Please enter First name");
	fname.focus();
	return false;
  }
	
  if (mname.value == "" )
  {
	alert("Please enter Middle name");
	mname.focus();
	return false;
  }
  
    if (lname.value == "" )
  {
	alert("Please enter Last name");
	lname.focus();
	return false;
  }
  
   if (ssnno.value == "" )
  {
	alert("Please enter Social security Number");
	ssnno.focus();
	return false;
  }
  
  if (assno.value == "" )
  {
	alert("Please enter Assigned Number");
	assno.focus();
	return false;
  }
  
 
 return true;  

}   
   

function Chk_Quote(fld)
{
 if (fld.value != "" )
  {
    var i;
    for(i=0;i<fld.value.length;i++)
	{
	  if (fld.value.substring(i,i+1) ==  "'" )
		{
			alert("Please enter Valid Data");
			fld.focus();
			fld.select();
			return(false);
		 }	
	}	
  }
}

function Chk_numeric(fld)
{
 if (fld.value != "" )
  {
    var i;
	for(i=0;i<fld.value.length;i++)
	{
	  if (isNaN(fld.value.substring(i,1)) ==  true )
		{
			alert("Please enter numeric Data");
			fld.focus();
			return(false);
		 }	
	}	
  }
 return true;
}
