function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
	var pindex = theStr.indexOf(".",index);
	if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

function emailValidator(theForm)
{

  if (theForm.Email.value == "")
  {
	return (false);
  }

  if (!isEmailAddr(theForm.Email.value))
  {
	return (false);
  }

  if (theForm.Email.value.length < 3)
  {
	return (false);
  }
  return (true);
}

function emailValidator2(theForm)
{

  if (theForm.Email2.value == "")
  {
	return (false);
  }

  if (!isEmailAddr(theForm.Email2.value))
  {
	return (false);
  }

  if (theForm.Email2.value.length < 3)
  {
	return (false);
  }
  return (true);
}

function IsNumeric(sText)
{
	var ValidChars = "0123456789.";
	var IsNumber=true;
	var Char;

	for (i = 0; i < sText.length && IsNumber == true; i++)
	{
		Char = sText.charAt(i);
		if (ValidChars.indexOf(Char) == -1)
			IsNumber = false;
	}
	return IsNumber;
}

function valbutton(myradiobutton) {
		myOption = -1;
		for (i=0; i<myradiobutton.length; i++)
		{
			if (myradiobutton[i].checked)
				myOption = i;
		}
		if (myOption == -1)
			return false;
	return true;
}

function ResetForm(which)
{
	var pass=true;
	var first=-1;
	if (document.images)
	{
		for (i=0;i<which.length;i++)
		{
			var tempobj=which.elements[i];
			if (tempobj.type=="text")
			{
				eval(tempobj.value="");
				if (first==-1)
					first=i;
			}
			else if (tempobj.type=="checkbox")
			{
				eval(tempobj.checked=0);
				if (first==-1)
					first=i;
			}
			else if (tempobj.col!="")
			{
				eval(tempobj.value="");
				if (first==-1)
					first=i;
			}
		}
	}
	which.elements[first].focus();
	return false;
}

function isAlphaNumeric(val)
{
   if (val.match(/^[a-zA-Z0-9]+$/))
      return true;
   else
      return false;
}