function validateForm(theForm){

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

	var emailID=theForm.email

	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}

	if (theForm.username.value == "")
    {
     alert("Please enter a value for the \" Login Id\" field.");
     theForm.username.focus();
     return (false);
    }

	if(theForm.username.value.length<4)
	{
	 alert(" \" Login Id\" field cannot be less than 4 characters");
     theForm.username.focus();
     return (false);
	}

	if(theForm.username.value.length>10)
	{
	 alert(" \" Login Id\" field cannot be more than 10 characters");
     theForm.username.focus();
     return (false);
	}

	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzƒŠŒŽšœžŸÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþ0123456789-";
  	var checkStr = theForm.username.value;
	valid=checkString(checkOK,checkStr);

	 if(!valid)
	 {
	  alert("Please enter only letters and digit characters in the \"Login Id\" field.");
      theForm.username.focus();
      return (false);
	 }

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

	if(theForm.password.value.length>10)
	{
	 alert(" \" Password\" field cannot be more than 10 characters");
     theForm.password.focus();
     return (false);
	}

	if(theForm.password.value.length<4)
	{
	 alert(" \" Password\" field cannot be less than 4 characters");
     theForm.password.focus();
     return (false);
	}

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

}

function checkString(checkOK,checkStr){
      var allValid=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;
           }
       }
	   return allValid;
	}

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("Invalid E-mail ID")
		   return false
		}

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

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

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

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

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true
	}
