function checkNumeric(textBox)
{
strValue=textBox.value;
if (strValue.indexOf("0")!=-1)
	{
		alert("Numeric value detected  ")
		textBox.focus();
		return false;
	}
if (strValue.indexOf("1")!=-1)
	{
		alert("Numeric value detected  ")
		textBox.focus();
		return false;
	}
if (strValue.indexOf("2")!=-1)
	{
		alert("Numeric value detected  ")
		textBox.focus();
		return false;
	}
if (strValue.indexOf("3")!=-1)
	{
		alert("Numeric value detected  ")
		textBox.focus();
		return false;
	}
if (strValue.indexOf("4")!=-1)
	{
		alert("Numeric value detected  ")
		textBox.focus();
		return false;
	}
if (strValue.indexOf("5")!=-1)
	{
		alert("Numeric value detected  ")
		textBox.focus();
		return false;
	}
if (strValue.indexOf("6")!=-1)
	{
		alert("Numeric value detected  ")
		textBox.focus();
		return false;
	}
if (strValue.indexOf("7")!=-1)
	{
		alert("Numeric value detected  ")
		textBox.focus();
		return false;
	}
if (strValue.indexOf("8")!=-1)
	{
		alert("Numeric value detected  ")
		textBox.focus();
		return false;
	}
if (strValue.indexOf("9")!=-1)
	{
		alert("Numeric value detected  ")
		textBox.focus();
		return false;
	}
	
}


function checkAll(frm)
{
	c=frm.length;
	for(i=0;i<c;i++)
	{
		obj=frm.elements[i];//form elements collection
		objName=frm.elements[i].name;//name of element in particular
		intl=objName.substr(0,3);
//initial 3 letters determine if this is a text box or select
		tg=frm.elements[i].tagName;
		vl=frm.elements[i].value;//get value of particular element
		
		//if this is a select list box
		if (intl=="sel")
		{	
			//if the string contains "-" at the start and end of the select value
			//it means user has not selected any value from that list box
			if (vl.charAt(0)=="-"&&vl.charAt(vl.length-1)=="-")
			{
				alert("Please select a value for : " + objName.substr(3,objName.length));
				obj.focus();
				return false;
			}
		}
		//we are dealing with a text box
		if (intl=="txt")
		{
			if (vl==null||vl=="")
				{
					//if the text box name contains _ (underscore)
					//it means it contains a range to be checked
					alert("Please enter value for "+objName.substr(3,objName.length));
					frm.elements[i].focus();
					return false;
				}
			
			if (objName.indexOf("_")!=0)
				{
					//this textbox object is to be vaidated
					num=parseInt(vl);
					arr=objName.split("_");
					arr_len=arr.length;
					r1=arr[1];
					r2=arr[2];
					if (num<r1||num>r2)
						{
							alert("Please enter value for "+arr[0].substr(3,objName.length)+" in the range of : "+r1+" to  "+r2);
							frm.elements[i].focus();
							return false;
						}
				}
			//if (objName.indexOf("1x")!=0)
			if (objName.substr((objName.length)-2,2)=="1x")
				{
				//value of this  text box has to be checked
				//against numeric values
				if (checkNumeric(obj)==false)
					{
						alert(obj.name);
						return false;
					}
				}
		}	
		
	}
	return true;
}

function validEmail(str) 
{ 
 var at,dot,flag,asc;
 at = dot = 0;
 flag = 1;
   
 for(i = 0;i<str.length;i++)
 {
  asc = str.charCodeAt(i);
  if(asc == 46)
  {
   dot++;
   continue;
  }
  if(asc == 64)
  {
   at++;
   continue;
  }
  if(!((asc>=65 && asc<=90) || (asc>=97 && asc<=122) || (asc == 95) || (asc>=48 && asc <=57)))
  {
   flag = 0;
   break;
   
  }
 }//end for loop 
 
 /**--------------------check if the last character in email is @ or .(dot)**/
 len = str.length;
 x = str.charAt(len-1);
 y = x.charCodeAt(0);  
 if(y == 46 || y==64)
  return 0;
  
 /**---------------------------------------------------**/  
  if(flag == 0 || dot == 0 || at == 0 || at>1)
  return 0;
  else
  return 1;
  
}//end function  validEmail()
//-------------------------------------------------------------------------------------------





