// JavaScript Document
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){
		   alert("Please enter a valid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Please enter a valid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Please enter a valid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Please enter a valid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Please enter a valid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Please enter a valid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Please enter a valid E-mail ID")
		    return false
		 }
    return 1;
 							
	}

//modified on 04-06-2009

function FrontPage_Form2_Validator(theForm)
{
  /*
  if (theForm.Name.value == "")
  {
    alert("Please enter a value for the \"First Name\" field.");
    theForm.Name.focus();
    return (false);
  }

  if (theForm.Name.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"First Name\" field.");
    theForm.Name.focus();
    return (false);
  }

  if (theForm.Name.value.length > 100)
  {
    alert("Please enter at most 100 characters in the \"First Name\" field.");
    theForm.Name.focus();
    return (false);
  }
  */
  if (theForm.Email.value == "")
  {
    alert("Please enter a value for the \"E-mail Address\" field.");
    theForm.Email.focus();
    return (false);
  }

  if (theForm.Email.value.length < 5)
  {
    alert("Please enter at least 5 characters in the \"E-mail Address\" field.");
    theForm.Email.focus();
    return (false);
  }

  if (theForm.Email.value.length > 100)
  {
    alert("Please enter at most 100 characters in the \"E-mail Address\" field.");
    theForm.Email.focus();
    return (false);
  }

  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ0123456789-@-_.";
  var checkStr = theForm.Email.value;
  var allValid = true;
  var validGroups = 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)
    {
      allValid = false;
      break;
    }
  }
  if (!allValid)
  {
    alert("Please enter only letter, digit and \"@-_.\" characters in the \"E-mail Address\" field.");
    theForm.Email.focus();
    return (false);
  }

//Check if Email is valid or not
  var email_flg	=	echeck(theForm.Email.value);
  if(email_flg==0)
  	{
	theForm.Email.value="";
	theForm.Email.focus();
	return (false);
	}


  /*
  if (theForm.Country.value == "")
  {
    alert("Please enter a value for the \"Country\" field.");
    theForm.Country.focus();
    return (false);
  }

  if (theForm.Country.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Country\" field.");
    theForm.Country.focus();
    return (false);
  }

  if (theForm.Country.value.length > 100)
  {
    alert("Please enter at most 100 characters in the \"Country\" field.");
    theForm.Country.focus();
    return (false);
  }

  if (theForm.Industry.value == "")
  {
    alert("Please enter a value for the \"Industry/Business Type\" field.");
    theForm.Industry.focus();
    return (false);
  }

  if (theForm.Industry.value.length < 1)
  {
    alert("Please enter at least 1 characters in the \"Industry/Business Type\" field.");
    theForm.Industry.focus();
    return (false);
  }

  if (theForm.Industry.value.length > 100)
  {
    alert("Please enter at most 100 characters in the \"Industry/Business Type\" field.");
    theForm.Industry.focus();
    return (false);
  }
  */
  return (true);
}
