// JScript File
function email_valid(x)
{
if (x.value.indexOf("@", 0) < 0)
    {
        window.alert("Please enter a valid e-mail address.");
       x.value="";
       x.focus();
        return false;
    }
    if (x.value.indexOf(".", 0) < 0)
    {
        window.alert("Please enter a valid e-mail address.");
        x.value="";
       x.focus();
        return false;
    }
    }
    
    
  function IsNumeric(str)
   //  check for valid numeric strings	
   {
   var strValid = "0123456789.-";
   var strChar;
   var bln = true;
   var len= str.value.length;

   if (len == 0)
   { 
   alert("please enter numeric value");
   return false;
   }

   //  test strString consists of valid characters listed above
   for (i = 0; i < len && bln == true; i++)
      { strchar= str.value.charAt(i);
      if (strValid.indexOf(strchar)== -1)
         { bln= false;
          alert("please enter numeric value");
          //str.value="";
          str.focus();
          
        
                  
         }
      }
      return bln;
   
   }
   
   
   function Nonumeric(str)
   //  check for valid nonnumeric strings	
   { debugger;
   var strValid = "0123456789.-";
   var strChar;
   var bln = true;
   var len= str.value.length;

   if (len == 0)
   { 
   alert("please enter character value");
   return false;
   }

      for (i = 0; i < len && bln == true; i++)
      { strchar= str.value.charAt(i);
      if (strValid.indexOf(strchar)!= -1)
         { bln= false;
          alert("please enter character value");
          //str.value="";
          str.focus();
        
                  
         }
      }
      return bln;
   
   }
   
   
   function charlen(str,min,max)
   //  check for valid char strings	
   { 
   var strValid = "0123456789.-";
   var strChar;
   var bln = true;
   var len= str.value.length;

      
   if ((len<min)||(len>max))
   {
    alert ("Please enter the characters between "+min+" and "+max+"");

    str.value="";
    str.focus();
    return false;
   }
else
{
      for (i = 0; i < len && bln == true; i++)
      { strchar= str.value.charAt(i);
      if (strValid.indexOf(strchar)!= -1)
         { bln= false;
          alert("please enter character value");
          str.value="";
          str.focus();
        
                  
         }
      }
      return bln;
   
   }
   }
   
   function IsNumelen(str, min,max)
   //  check for valid numeric strings	
   {
   var strValid = "0123456789.-";
   var strChar;
   var bln = true;
   var len= str.value.length;

   if (len == 0)
   { 
   alert("please enter numeric value");
   str.focus();
   str.style.backgroundColor="pink";
   return false;
   }

   //  test strString consists of valid characters listed above
   
   if ((len<min)||(len>max))
   {
    alert ("Please enter the numeric value between "+min+" and "+max+" characters");
    str.value="";
    str.focus();
	str.style.backgroundColor="pink";
    return false;
   }
   else
   {
   for (i = 0; i < len && bln == true; i++)
      { strchar= str.value.charAt(i);
      if (strValid.indexOf(strchar)== -1)
         { bln= false;
          alert("please enter numeric value");
          str.value="";
          str.focus();
          str.style.backgroundColor="pink";
         
         }
      }
      }
      return bln;
   
   }
   
function valid(frm)
{ debugger;
var i;
var l= frm.length;
for (i=0; i<l; i++)
{
if (frm.elements[i].value=="")
{
alert("Please Enter field");
frm.elements[i].focus();
return false;
break;
}

}

}

   
 function lenrestriction(val, min,max)
 {
	 var l= val.value.length;
	if(l >= min && l <= max){
		return true;
	}
	else{
		alert("Please enter between " +min+ " and " +max+ " characters");
		//val.focus();
		val.style.backgroundColor="pink";
		return false;
	} 
	 
	 
	 }
	 
	 
	 
	 
	    function IsNumelenn(str, min)
   //  check for valid numeric strings	
   {
   var strValid = "0123456789.-";
   var strChar;
   var bln = true;
   var len= str.value.length;

   if (len == 0)
   { 
   alert("please enter numeric value");
   str.focus();
   str.style.backgroundColor="";
   return false;
   }

   //  test strString consists of valid characters listed above
   
   if(len!=min)
   {
    alert ("Please enter "+min+" numeric values ");
    str.value="";
    str.focus();
	//str.style.backgroundColor="";
    return false;
   }
   else
   {
   for (i = 0; i < len && bln == true; i++)
      { strchar= str.value.charAt(i);
      if (strValid.indexOf(strchar)== -1)
         { bln= false;
          alert("please enter numeric value");
          str.value="";
          str.focus();
         // str.style.backgroundColor="";
         
         }
      }
      }
      return bln;
   
   }
   
    function len(str, min,max)
 
   {
  
   var bln = true;
   var len= str.value.length;

     
   if ((len<min)||(len>max))
   {
    alert ("Please Enter  between "+min+" and "+max+" characters");
    str.value="";
    str.focus();
	return false;
   }
        return bln;
   
   }
   
   
   function compwd(pwd)
   
   {
	   var cpw = document.form.upwdd.value;
	   
	   alert ("+cpw+");
	   alert("+pwd.value+");
	   if (cpw != pwd.value) 
{

alert ("Please re-enter same new password.");
form.upwdd.focus();
return (false);
}
else

{
	return true;
}

	   
	   
	   
 }
 function emailvalidation(entered, alertbox)
{

with (entered)
{
apos=value.indexOf("@");
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2)
{if (alertbox) {alert(alertbox);} return false;}
else {return true;}
}
} 
	 
	 
	 
   
   
   
   
   
   
   
   