function validate_form()
{var Doc = document.frmlogon
 var test
	if(TrimString(Doc.user_name.value)=="")
	{
		alert("Error 1: Please enter your user name.")
		test = "failed"
		Doc.user_name.focus();
		return false
	}

	if(TrimString(Doc.password.value)=="")
	{
		alert("Error 2: Please enter your password.")
		test = "failed"
		Doc.password.focus();
		return false
	}
	
	if(Doc.user_name.value !="")
     {
     	var numaric = Doc.user_name.value;
		for(var j=0; j<numaric.length; j++)
		{
		  var alphaa = numaric.charAt(j);
		  var hh = alphaa.charCodeAt(0);
		  if((hh > 47 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123) || (hh = 32))
		  {
		  }
		  else	
		  {
			 alert("ERROR: Only Alphabets or Numbers are allowed in user name field");
			 Doc.user_name.focus();
			 test="failed";
			 return false;
		  }
		}
	 }
	
	 	if(Doc.password.value !="")
        {
     	var numaric = Doc.password.value;
		for(var j=0; j<numaric.length; j++)
		{
		  var alphaa = numaric.charAt(j);
		  var hh = alphaa.charCodeAt(0);
		  if((hh > 47 && hh<59) || (hh > 64 && hh<91) || (hh > 96 && hh<123) || (hh = 32))
		  {
		  }
		  else	
		  {
			 alert("ERROR: Only Alphabets or Numbers are allowed in password field");
			 Doc.password.focus();
			 test="failed";
			 return false;
		  }
		}
	    }
	 
	 if(test != "failed")
       {
    		Doc.submit();
       }
}

function TrimString(str)
{
	return str.replace(/^\s*|\s*$/g,"");
}