function goHist(a) 
{
   history.go(a);
}


function chkname()
{
 var ch=0;
 name=new String();
 name=document.Form1.Name.value;
 
 if (name.length==0)
  alert ("Please enter your Name")
 else
 {
  u=0;
  for (i=0;i<name.length;i++)
  {
   if ((name.charCodeAt(i) >= 64 && name.charCodeAt(i) <= 90)||(name.charCodeAt(i) >= 97 && name.charCodeAt(i) <= 122)||(name.charCodeAt(i)==46)||(name.charCodeAt(i)==32)||(name.charCodeAt(i)==39))
   {
   }
   else
   {
    u=u+1;
   }
  }
  if (u>0)
  {
   alert ("Invalid Name");
  }
  else
  {
   chksurname()
  }
 } 
}


function chksurname()
{
 var ch=0;
 surname=new String();
 surname=document.Form1.SurName.value;
 
 if (surname.length==0)
  alert ("Please enter your Surname")
 else
 {
  u=0;
  for (i=0;i<surname.length;i++)
  {
   if ((surname.charCodeAt(i) >= 64 && surname.charCodeAt(i) <= 90)||(surname.charCodeAt(i) >= 97 && surname.charCodeAt(i) <= 122)||(surname.charCodeAt(i)==46)||(surname.charCodeAt(i)==32)||(surname.charCodeAt(i)==39))
   {
   }
   else
   {
    u=u+1;
   }
  }
  if (u>0)
  {
   alert ("Invalid Surname");
  }
  else
  {
   chkemail()
  }
 } 
}


function chkemail()
{
 mail=new String();
 mail=document.Form1.Email.value
 
 if (mail.length<1)
   alert ("Please enter your email Address")
 else
  {
   at_pos=mail.indexOf("@")
   dot_pos=mail.indexOf(".")
   if(at_pos<1 || dot_pos<1)
   alert("Missing '@' and '.' in email address.")
   
 else
  {
   u=0;
   p=0;
   for(var i=0;i<mail.length;i++)
   {
    if ((mail.charCodeAt(i) >= 64 && mail.charCodeAt(i) <= 90)||(mail.charCodeAt(i) >= 97 && mail.charCodeAt(i) <= 122)||(mail.charCodeAt(i) >= 48 && mail.charCodeAt(i) <= 57)||(mail.charCodeAt(i)==95)||(mail.charCodeAt(i)==46))
	{
	 if(mail.charAt(i)=="@")
	  p=p+1
	}
	else
	{
	 u=u+1
	}
   }
   if (p>1)
    alert ("Email must have only one '@'")
   if (u>0)
	 alert ("Special Characters are not allowed")
	if (p==1 && u==0)
			document.Form1.submit();
  }
 }	
}
