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(!(/^[a-zA-Z0-9.,-_ #\/+ \|/]+$/.test(val)))
			{
				getval=txt[i].title;
				alert(getval);
				txt[i].focus();
				return false;
			}
		}
		if(txt[i].className=="chkNum")
		{
			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(!(/^\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=="" || val.length<4)
			{
				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=="chkText")
		{
			if(val.length>250 || val.length==0)
			{
				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
}


