function numeralsOnly(evt, notNumberFunction) {
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode :
        ((evt.which) ? evt.which : 0));

	//handle control chars
	if(evt.charCode == 0)
		if((charCode == 8) || (charCode == 46) || (charCode == 13) || (charCode == 9) || ((charCode > 36)&&(charCode < 41)))
			return true;

    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        if(notNumberFunction != null)
		notNumberFunction();

        return false;
    }
    return true;
};

function validateregister(theForm)
{

	if (theForm.yourname.value == "")
	{
	alert("Please enter your name.");
	theForm.yourname.focus();
	return (false);
	}

	if (theForm.companyname.value == "")
	{
	alert("Please enter your company name.");
	theForm.companyname.focus();
	return (false);
	}

	if (theForm.companyaddress.value == "")
	{
	alert("Please enter your company address.");
	theForm.companyaddress.focus();
	return (false);
	}

	if (theForm.telephone.value == "")
	{
	alert("Please enter your telephone number.");
	theForm.telephone.focus();
	return (false);
	}

	if (theForm.email.value == "")
	{
	alert("Please enter your email.");
	theForm.email.focus();
	return (false);
	}

	var checkEmail = "@.";
	var checkStr = theForm.email.value;
	var EmailValid = false;
	var EmailAt = false;
	var EmailPeriod = false;
	for (i = 0;  i < checkStr.length;  i++)
	{
	ch = checkStr.charAt(i);
	for (j = 0;  j < checkEmail.length;  j++)
	{
	if (ch == checkEmail.charAt(j) && ch == "@")
	EmailAt = true;
	if (ch == checkEmail.charAt(j) && ch == ".")
	EmailPeriod = true;
		  if (EmailAt && EmailPeriod)
			break;
		  if (j == checkEmail.length)
			break;
		}
		// if both the @ and . were in the string
	if (EmailAt && EmailPeriod)
	{
			EmailValid = true
			break;
		}
	}
		if (!EmailValid)
		{
		alert("Please enter a valid email address.");
		return false;
		}
		
	if (theForm.password.value == "")
	{
	alert("Please enter a password.");
	theForm.password.focus();
	return (false);
	}

	if (theForm.confpassword.value == "")
	{
	alert("Please confirm your password.");
	theForm.confpassword.focus();
	return (false);
	}

	if (theForm.password.value != theForm.confpassword.value)
	{
	alert("The passwords do not match");
	theForm.confpassword.focus();
	return (false);
	}

	
};

function validateforgot(theForm)
{
	if (theForm.emailaddress.value == "")
	{
	alert("Please enter your email address.");
	theForm.emailaddress.focus();
	return (false);
	}

	var checkEmail = "@.";
	var checkStr = theForm.emailaddress.value;
	var EmailValid = false;
	var EmailAt = false;
	var EmailPeriod = false;
	for (i = 0;  i < checkStr.length;  i++)
	{
	ch = checkStr.charAt(i);
	for (j = 0;  j < checkEmail.length;  j++)
	{
	if (ch == checkEmail.charAt(j) && ch == "@")
	EmailAt = true;
	if (ch == checkEmail.charAt(j) && ch == ".")
	EmailPeriod = true;
		  if (EmailAt && EmailPeriod)
			break;
		  if (j == checkEmail.length)
			break;
		}
		// if both the @ and . were in the string
	if (EmailAt && EmailPeriod)
	{
			EmailValid = true
			break;
		}
	}
		if (!EmailValid)
		{
		alert("Please enter a valid email address.");
		return false;
		}

};
