function fValidateUIDStr(xstr) 
{  
 var validChars = "abcdefghijklmnopqrstuvwxyz1234567890._";
	
 for (x=0; x<xstr.length; x++)
 {
  y = xstr.charAt(x);
  if (validChars.indexOf(y) == -1)
  {
   return(false);
  }
 }
 return(true);
}

function fValidatePWStr(xstr) 
{  
 var validChars = "abcdefghijklmnopqrstuvwxyz1234567890";
	
 for (x=0; x<xstr.length; x++)
 {
  y = xstr.charAt(x);
  if (validChars.indexOf(y) == -1)
  {
   return(false);
  }
 }
 return true;
}

function validate_form(frm)
{
 if (frm.uid.value=="") 
 {
  frm.uid.focus();
  alert('Please enter User ID');
  return(false);
 }

 if (frm.pw.value=="") 
 {
  frm.pw.focus();
  alert('Please enter Password');
  return(false);
 }

 if (fValidateUIDStr(frm.uid.value)==false) 
 {
   frm.uid.focus();
   alert('Invalid User ID entered');
   return(false);    
 }

 if (fValidatePWStr(frm.pw.value)==false) 
 {
  frm.pw.focus();
  alert('Invalid Password entered');
  return(false);    
 }
      
 return(true);    
}

function fSetFocus() 
{
 if (document.getElementById) 
 {
   document.getElementById("user").focus();
 }
 else
 {
  if (document.all) 
  {
   document.forms(0).item(0).focus();
  }
 }
}