function info_Validator(theForm)
{
  if (!ValidName(theForm)) {return (false);}
  if (!ValidEmail(theForm)) {return (false);}
}


function ValidPhone(theForm)
{
  if (theForm.Phone.value == "")
  {
    alert("Please enter Your Telephone Number.");
    theForm.phone.focus();
    return (false);
  } else { return (true); }
}

function ValidDate(theForm)
{
  if (theForm.date.value == "" || theForm.Date.value.length < 8)
  {
    alert("Please enter a valid Date for the Class.");
    theForm.Date.focus();
    return (false);
  } else { return (true); }
}

function ValidName(theForm)
{
  if (theForm.realname.value == "")
  {
    alert("Please enter Your Name.");
    theForm.realname.focus();
    return (false);
  } else { return (true); }
}

function ValidEmail(theForm)
{
  if (theForm.email.value == "" || theForm.email.value < 7 || !EmailChrs(theForm.email.value) || !echeck(theForm.email.value) )
  {
    alert("Please enter a valid Email Address.");
    theForm.email.focus();
    return (false);
  } else { return (true); }
}

function echeck(str) {

	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   return false
	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	    return false
	}
	if (str.indexOf(at,(lat+1))!=-1){
	    return false
	}
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	    return false
	}
	if (str.indexOf(dot,(lat+2))==-1){
	    return false
	}
	if (str.indexOf(" ")!=-1){
	   return false
	}
	
	var last3 = str.split(".");
	var llc = last3[1].toLowerCase();
	if (llc == "com") {
		return true
	}
	if (llc == "net") {
		return true
	}
	if (llc == "org") {
		return true
	}
	if (llc == "gov") {
		return true
	}
	if (llc == "edu") {
		return true
	}
	if (llc == "biz") {
		return true
	}

	return false					
}

function ValChars(checkStr)
{
  var checkOK = ".,-ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ \t\r\n\f";
  var status = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      status = false;
      break;
    }
  }
  return (status);
}

function EmailChrs(checkStr)
{
	var chr1 = /@/;
	var chr2 = /./;
	var matchPos1 = checkStr.search(chr1);

	if(checkStr.search(chr1) != -1 && checkStr.search(chr2) != -1)
	{
		return (true); 
	}
	else
	{
		return (false);	
	}
}

function Numeric(checkStr)
{
  var checkOK = "0123456789";
  var status = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      status = false;
      break;
    }
  }
  return (status);
}
