function validate()
{
	
	var flag=0;
	var val;
	
	var txt=document.getElementsByTagName('input');
	var sel=document.getElementsByTagName('select');
	var text=document.getElementsByTagName('textarea');

	for(i=0;i<txt.length;i++)
	{
		val=trimString(txt[i].value);
		if(txt[i].className=="chkTxt")
		{
			if((/^[0-9]+$/.test(val)))
			{
				getval="Numerics not allowed here";
				alert(getval);
				txt[i].focus();
				return false;
			}
			if(!(/^[a-zA-Z.,-_ #\/+! \|/]+$/.test(val)))
			{
				getval=txt[i].title;
				alert(getval);
				txt[i].focus();
				return false;
			}
		}
		if(txt[i].className=="chkAlp")
		{
			if(!(/^[a-zA-Z0-9.,-_ #\/+! \|/]+$/.test(val)))
			{
				getval=txt[i].title;
				alert(getval);
				txt[i].focus();
				return false;
			}
		}
		if(txt[i].className=="chkNum")
		{
			if((/^[a-zA-Z]+$/.test(val))) 
			{
				getval="Alphabets not allowed here";
				alert(getval);
				txt[i].focus();
				return false;
			}
			if(!(/^[0-9.]+$/.test(val)))
			{
				getval=txt[i].title;
				alert(getval);
				txt[i].focus();
				return false;
			}
		}
		if(txt[i].className=="chkEmail")
		{
			val=trimString(txt[i].value);

			if(val != "") {
				if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(val)))
				{
					getval=txt[i].title;
					alert(getval);
					txt[i].focus();
					return false;
				}
			}
		}
		if(txt[i].className=="validEmail")
		{
			val1=trimString(txt[i-1].value);
			if(val!=val1)
			{
				getval=txt[i].title;
				alert(getval);
				txt[i].focus();
				return false;
			}
		}
		if(txt[i].className=="chkPass")
		{ 
			if(val=="")
			{
				getval=txt[i].title;
				alert(getval);
				txt[i].focus();
				return false;
			}
		}
		if(txt[i].className=="validPass")
		{
			val1=trimString(txt[i-1].value);
			if(val!=val1)
			{
				getval=txt[i].title;
				alert(getval);
				txt[i].focus();
				return false;
			}
		}
		if(txt[i].className=="chkEmp")
		{
			if(val!="")
			{
				if(!(/^[a-zA-Z0-9.,-_ #\/+! \|/]+$/.test(val)))
				{
					getval=txt[i].title;
					alert(getval);
					txt[i].focus();
					return false;
				}
			}
		}
	}
	for(i=0;i<sel.length;i++)
	{ 
		if(sel[i].className=="chkSel")
		{
			if(sel[i].value=="")
			{
				getval=sel[i].title;
				alert(getval);
				sel[i].focus();
				return false;
			}
		}
	}
	for(i=0;i<text.length;i++)
	{
		val=trimString(text[i].value);
		if(text[i].className=="chkEmp")
		{
			if(text[i].value=="")
			{
				getval=text[i].title;
				alert(getval);
				text[i].focus();
				return false;
			}
		}
	}
	return true;
}
//Trim Functions.......
function trimString(sInString) 
{
	sInString = sInString.replace( /^\s+/g, "" );	// strip leading
	return sInString.replace( /\s+$/g, "" );		// strip trailing
}
