// JavaScript Document
function validate(obj)
{
	if(trim(obj.txtQName.value)=="")
	{
		alert("Please Enter Name");
		obj.txtQName.focus();
		return false;
	}
	if(trim(obj.txtQEmail.value)=="")
	{
		alert("Please Enter Email Address");
		obj.txtQEmail.focus();
		return false;
	}
	//alert(trim(obj.txtLEmail.value));
	if(trim(obj.txtQEmail.value)!="")
	{
		if(!ChkEmail("frmQuick","txtQEmail"))
		{	
			return false;
		}
	}
	if(trim(obj.textQRequirement.value)=="")
	{
		alert("Please enter requirement");
		obj.textQRequirement.focus();
		return false;
	}
	if(trim(obj.txtText.value)=="")
	{
		alert("Please enter text");
		obj.txtText.focus();
		return false;
	}

}
function trim(str)
{
   return str.replace(/^\s+|\s+$/g,''); 
}
function ChkEmail(frmQuick,fldnm)
{
	var FormName;
	var FldName;
	FormName=frmQuick;
	FldName=fldnm;
	//var str=eval("document."+FormName+"."+FldName+".value");
	var str=document.frmQuick.txtQEmail.value;
		
if (!str=="")
{
	if (str.indexOf("@",1) == -1)
	{
		alert("That is not a valid Email address. Please enter again.");
		eval("document."+FormName+"."+FldName+".focus()");
		eval("document."+FormName+"."+FldName+".select()");
		return false;
	}
	if (str.indexOf("@",1)== 0)
	{
		alert("That is not a valid Email address. Please enter again.");
		eval("document."+FormName+"."+FldName+".focus()");
		eval("document."+FormName+"."+FldName+".select()");
		return false;
	}
	if (str.indexOf(".")== 0)
	{
		alert("That is not a valid Email address. Please enter again.");
		eval("document."+FormName+"."+FldName+".focus()");
		eval("document."+FormName+"."+FldName+".select()");
		return false;
	}
	if (str.indexOf(".",1) == -1)
	{
		alert("That is not a valid Email address. Please enter again.");
		eval("document."+FormName+"."+FldName+".focus()");
		eval("document."+FormName+"."+FldName+".select()");
		return false;
	}

	// extra validation
	var posat=str.indexOf("@");
	var posdot=str.indexOf(".");
	var rposdot=str.lastIndexOf(".");
	if(rposdot==posdot)
	if((posdot < posat) || (posdot-posat < 3))
	{
		alert("That is not a valid Email address. Please enter again.");
		eval("document."+FormName+"."+FldName+".focus()");
		eval("document."+FormName+"."+FldName+".select()");
		return false;
	}
	if(str.charAt(str.length-1)==".")
	{
		alert("That is not a valid Email address. Please enter again.");
		eval("document."+FormName+"."+FldName+".focus()");
		eval("document."+FormName+"."+FldName+".select()");
		return false;
	}
	if(str.charAt(str.length-1)=="@")
	{
		alert("That is not a valid Email address. Please enter again.");
		eval("document."+FormName+"."+FldName+".focus()");
		eval("document."+FormName+"."+FldName+".select()");
		return false;
	}
	var j=0;
	for( var i=0;i<str.length;i++)
	{
		if(str.charAt(i)=="@")
		j++;
	}
	if(j > 1)
	{
	alert("That is not a valid Email address. Please enter again.");
	eval("document."+FormName+"."+FldName+".focus()");
	eval("document."+FormName+"."+FldName+".select()");
	return false;
	}
}
return true;
}