//CODE FOR MOUSE KEYUP AND AUTO SUBMISSION.
	var isNetscape = false;
	var isIE = false;
	var isWhoKnows = false;

	//This determines which browser the user is using
	if (parseInt(navigator.appVersion) >= 4) 
	{
		if(navigator.appName == "Netscape") 
		{			isNetscape = true;		}
		else if (navigator.appName == "Microsoft Internet Explorer")
		{			isIE = true;       		}
		else
		{			isWhoKnows = true;		}
	}
	//This stuff captures the events of the user

	if(isNetscape) 
	{		document.captureEvents(Event.KEYUP);	}
	document.onkeyup = checkValue

	function checkValue(evt)
	{
		var theButtonPressed;
		if (isNetscape) 
		{
			//alert(evt.target.type);
			if(evt.target.type == "textarea")
			{
				return;
			}
			//if(evt.target.name == "myText"){
			//--> or you can specify the actual name of
			//    the element
			//alert(evt.target.form.name + "from here");
			theButtonPressed = evt.which;
		}
		else if(isIE) 
		{
			//alert(window.event.srcElement.type);
			if (window.event.srcElement.type == "textarea")
			{
				return;
			}		
			//alert(window.event.srcElement.name);
			theButtonPressed = window.event.keyCode;
		}
		else if(isWhoKnows) 
		{
			alert("Please hit the submit button to process form");
		}
		if (theButtonPressed == 13) 
		{
			check();
		}
	}
function check()
{
	var a=document.forms["frmfeedback"]["validate"].value;<!--Number Inserted by User-->
	var b=randomnumber;<!--Auto generate number-->	
	if (isNull(document.frmfeedback.txtName.value))
	{
		alert("Blank not allowed in Name field");
		document.frmfeedback.txtName.select();
		document.frmfeedback.txtName.focus();
		return false;
	}
	if (isNull(document.frmfeedback.txtacomment.value))
	{
		alert("Please enter your Comment");
		document.frmfeedback.txtacomment.focus();
		document.frmfeedback.txtacomment.select();
		return false;
	}
	if (!fnValidateEmailFormat(document.frmfeedback.txtMailID.value))
	{
		alert ("Invalid EMail Id");
		document.frmfeedback.txtMailID.focus();
		return false;
	}
	if (!fnIsSpecialCharacter(document.frmfeedback.txtMailID.value))
	{
		alert("Special Characters are not allowed in Email field");
		document.frmfeedback.txtMailID.select();
		document.frmfeedback.txtMailID.focus();
		return false;
	}
	if(a!=b)<!--Auto generate number verification-->
	{
	 alert("Insert the number");
	 return false;
	}
	document.getElementById("sess").value=randomnumber;
	document.frmfeedback.action=document.frmfeedback.action;
	document.frmfeedback.method="post";
	document.frmfeedback.submit();
	return false;
}
function isNull(strnullcheck)
{
var strindex;
for (strindex=0; strindex < strnullcheck.length; strindex++)
	if (strnullcheck.charAt(strindex) != ' ')
		return false;
		return true;
}
function fnValidateEmailFormat(emailAddress)
{
	var strpart1,strpart2,strpart3;
	strpart1 = (emailAddress.indexOf("@"))
	if(strpart1 > 0)
	{
		strpart2 = (emailAddress.indexOf("."))
		if(strpart2 > 0)
		{
			strpart3 = emailAddress.length-1;
			if (strpart3 > strpart2 && strpart3 > strpart1)
			{
				return true;
			}
			return false;
		}
	}
	return false;
}
function isNull(strnullcheck)
{
var strindex;
for (strindex=0; strindex < strnullcheck.length; strindex++)
	if (strnullcheck.charAt(strindex) != ' ')
		return false;
		return true;
}
function fnIsSpecialCharuser(strspecialcharckeck)
{
	var strchar="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_- ";
	var strindex;
	for(strindex=0; strindex<strspecialcharckeck.length; strindex++)
	{
		if(strchar.indexOf(strspecialcharckeck.charAt(strindex)) == -1)
		{
			return false;
		}
	}
	return true;
}
function fnIsSpecialCharacter(strspecialcharckeck)
{
	var strchar="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-@.";
	var strindex;
	for(strindex=0; strindex<strspecialcharckeck.length; strindex++)
	{
		if(strchar.indexOf(strspecialcharckeck.charAt(strindex)) == -1)
		{
			return false;
		}
	}
	return true;
}
function fnreset()
{
document.frmfeedback.txtName.value = "";
document.frmfeedback.txtacomment.value = "";
document.frmfeedback.txtMailID.value="";
return false;
}
