// JavaScript Document
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)
	  {
	   alert("Invalid E-mail ID");
	   return false;
	  }
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
	{
	   alert("Invalid E-mail ID");
	   return false;	
	 }

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
	{
		alert("Invalid E-mail ID");
		return false;
	}

	 if (str.indexOf(at,(lat+1))!=-1)
	 {
		alert("Invalid E-mail ID");
		return false;
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
	 {
		alert("Invalid E-mail ID");
		return false;
	 }

	 if (str.indexOf(dot,(lat+2))==-1)
	 {
		alert("Invalid E-mail ID");
		return false;
	 }
	
	 if (str.indexOf(" ")!=-1)
	 {
		alert("Invalid E-mail ID");
		return false;
	 }

	 return true	;
}



function num_check(str)
{ 
  var str1=str.value;
   var s,res;
   for(i=0;i<str1.length;i++)
     {
        s=str1.substring(i,i+1);
        if(!((s>='0')&&(s <='9')))
          res=0;
      }
  if(res==0)
   {
     str.value="";
	 str.focus();
   }
   else
return true;
}
 	

 function char_check(str)
 {
   var str1=str.value;
   var s,res;
   for(i=0;i<str1.length;i++)
     {
        s=str1.substring(i,i+1);
        if(!(((s>='A')&&(s<='Z')) ||((s>='a')&&(s <='z')) || (s==' ')||(s=='_')||(s=='-')||(s=='.')))
          {
           str.value="";
	       str.focus();
		   res=0;
 	       return;
		  }
	  }
	  if(res!=0)
	   return true;
	
  }
  
 function city_check(str)
 {
   var str1=str.value;
   var s,res;
   for(i=0;i<str1.length;i++)
     {
        s=str1.substring(i,i+1);
        if(!(((s>='a')&&(s <='z')) || ((s>='A')&&(s<='Z')) ||(s=='_')||(s=='-')||(s=='.')||(s==' ')))
		 {
           str.value="";
	       str.focus();
		   res=0;
		  return;
	    }
      }	
	  if(res!=0)
	   return true;
	
 }
   
   
   function text_check(str)
 {
   var str1=str.value;
   var s,res;
   for(i=0;i<str1.length;i++)
     {
        s=str1.substring(i,i+1);
        if(!(((s>='a')&&(s <='z')) || ((s>='A')&&(s<='Z')) ||(s=='_')||(s=='-')||(s=='.')||(s==' ')||((s>='1')&&(s <='9'))))
		 {
           str.value="";
	       str.focus();
		   res=0;
		  return;
	    }
      }	
	  if(res!=0)
	   return true;
	
 }
function zip_check(str)
 {
   var str1=str.value;
   var s,res;
   for(i=0;i<str1.length;i++)
     {
        s=str1.substring(i,i+1);
        if(!(((s>='a')&&(s <='z')) || ((s>='A')&&(s<='Z')) ||(s=='-')||((s>='0')&&(s <='9'))))
		 {
           str.value="";
	       str.focus();
		   res=0;
		  return;
	    }
      }	
	  if(res!=0)
	   return true;
	
 }
   
function phone_check(str)
{ 
  var str1=str.value;
   var s,res;
   for(i=0;i<str1.length;i++)
     {
        s=str1.substring(i,i+1);
        if(!(((s>='0')&&(s <='9'))||(s==' ')||(s==null)))
          res=0;
      }
  if(res==0)
   {
     str.value="";
	 str.focus();
   }
   else
return true;
}
    
