function isEmpty(str)
{
	var ch
	var count
	count=0

	for(i=0;i<str.length;i++)
	{
		ch=str.substring(i,i+1)
		if(ch==" ")
		count = count +1		
	}

	if(str.length==0)
		return true
	else if(count == str.length)
		return true
	else
		return false

}

function deleteall()
{

var ch=false;


	if(!(document.frmMain.chk.length))
		ch=true;
	else
	{

		for(i=0;i<document.frmMain.chk.length;i++)
		{



			if(document.frmMain.chk[i].checked)
			{
				
				ch=true ;
				break ;			
			}
		}
	}


	if(ch==false)
	{
		alert("No value selected for deletion")
		return;	
	}
	else
	{
		document.frmMain.action = "delete.asp";
		document.frmMain.submit()
	}
}


function isDigits(str)
{
	var ch
	var invalid 
	invalid = true

	for(i=0;i<str.length;i++)
	{
		ch=str.substring(i,i+1)
		if(ch <"0" || ch >"9")
			invalid = false		
	}
	
	return !invalid;
}


function email(str)
{
	//var str=new String
	//str=document.frmmain.email.value
	
	var	l=str.length;
	var ch; 
	var check=new Boolean();
	check=false;
	for(var ctr=0;ctr<l;ctr++)
	{	ch=str.charAt(ctr);
		if(ch==''||ch=='!'||ch=='$'||ch=='%'||ch=='&'||ch=='('||ch==')'||ch=='/'||ch=='`'||ch=='~'||ch==';'||ch==':'||ch=='<'||ch==','||ch=='>'||ch=='{'||ch=='}'||ch=='['||ch==']'||ch=='|')	
		{alert("Email Address Entered is Not Valid");
		document.frmmain.email.value="";
		document.frmmain.email.focus();
		return false;
		}//end of if
	}//end of for
	var flag=false;
	var index=0;
	if(str.charAt(0)=='.'||str.charAt(0)=='@'||str.charAt(l-1)=='@'||str.charAt(l-1)=='@'||str.charAt(l-1)=='.')
	{ alert("Email Address Entered is Not Valid");
	  document.frmmain.email.value="";
	  document.frmmain.email.focus ();
	  return false;
	}//end of if
	for(var start=0; start<l; start++)
	{if(str.charAt(start)=='.')//outer if
	 { if(str.charAt(start+1)=='.')//inner if		
		{ alert("Email Address Entered is Not Valid");
		  document.frmmain.email.value="";
		  document.frmmain.email.focus ();
		  return false;
   		}//end of inner if
      }//end of outer if
	}//end of for
	//main for 2
	for(i=0; i<l; i++)
	{ ch=str.charAt(i);
	  if(ch=='@')
	  {	index=i;
		for(var j=i+1; j<l; j++)
		{ if(str.charAt(j)=='@')
		  { alert("Email Address Entered is Not Valid");
			document.frmmain.email.value="";
			document.frmmain.email.focus ();
			return false;
			}//end of if
		}//end of for
			
	    }//end of if(ch=='@")
	
		if(index!=0)//main if
		{if(str.charAt(index+1)=='.')
		 {	alert("Email Address Entered is Not Valid");
			document.frmmain.email.value="";
			document.frmmain.email.focus ();
			return false;
		  }//end of if
		  else
		  {for(var c=index+1; c<l; c++)
		  {if(str.charAt(c)=='.')
			{ flag=true;
			 break;		
			}//end of if
		   }//end of for
		   }//end of else
		  }//end of main if
	}//end of main for 2
	if(!(flag))
	{ alert("Email Address Entered is Not Valid");
	  document.frmmain.email.value="";
	  document.frmmain.email.focus ();
	  return false
	}	
	return true 
}//End of function email

