// calls login authentication code...
function lgnDo(what,arg) {
  what = what || 'LOGIN';
  switch (what) {
    case 'LOGIN':
      var user=document.getElementById('lgnUser').value;
      if (!user) { alert('Username required!'); return false; };
      var pw=document.getElementById('lgnPW').value;
      if (!pw) { alert('Password required!'); return false; };
      var url=document.getElementById('lgnSite').value+'?login=1&user='+user;
      var pwmd5=hex_md5(pw);
      var salt = hex_md5(new String(Math.random())); salt=salt.substr(0,4); salt=salt.toUpperCase();
      var ticket=salt+hex_md5(salt+pwmd5.toUpperCase());
      url+='&ticket='+ticket.toUpperCase();
      document.getElementById('lgnReply').innnerHTML='Please Wait...';
//      alert("URL:"+url+ \
      simpleAJAX(url,'lgnBox',lgnRedirect);
      break;
    case 'LOGOUT':
      document.getElementById('lgnReply').innnerHTML='Please Wait...';
      var url=document.getElementById('lgnSite').value+'?logout=1';
      simpleAJAX(url,'lgnBox');
      break;
    case 'HINT':
      var hintPage=document.getElementById('lgnSiteReg').value;
      hintPage+='?action=hint'+'&username='+document.getElementById('lgnUser').value;
      window.location=hintPage;
      break;
    case 'NEW':
      var registrationPage=document.getElementById('lgnSiteReg').value;
      window.location=registrationPage;
      break;
    };
  };
function lgnRedirect() {
  var redirectPage=document.getElementById('pageRedirect').value;
  if (redirectPage) { window.location=redirectPage; };
  };
