<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="sysLogin" version="1.0" basedir="" xmlform_type="NORMAL" width="400px">
  <TITLE type="title">
    <en><![CDATA[Login]]></en>
  </TITLE>
  <USR_USERNAME type="text" size="30" maxlength="50" validate="Any" autocomplete="0">
    <en><![CDATA[User]]></en>
  </USR_USERNAME>
  <USR_PASSWORD type="hidden" size="30" maxlength="32" autocomplete="0">
    <en><![CDATA[Password]]></en>
  </USR_PASSWORD>
  <USR_PASSWORD_MASK type="password" size="30" maxlength="32" autocomplete="0">
    <en><![CDATA[Password]]></en>
  </USR_PASSWORD_MASK>
  <USER_ENV type="text" size="30" maxlength="50" autocomplete="0">
    <en><![CDATA[Workspace]]></en>
  </USER_ENV>
  <USER_LANG type="dropdown" sqlconnection="dbarray">
SELECT LANG_ID, LANG_NAME FROM langOptions
<en><![CDATA[Language]]></en>
</USER_LANG>
  <BSUBMIT type="button">
    <en><![CDATA[Login]]></en>
  </BSUBMIT>
  <JS type="javascript"><![CDATA[


setFocus (getField ('USR_USERNAME'));

leimnud.event.add(document.getElementById('form[USR_PASSWORD_MASK]'), 'keypress', function(event) {
  var key;
  if(window.event)
    key = window.event.keyCode;     //IE
  else
    key = event.which;     //firefox
  if(key == 13) {
    document.getElementById('form[BSUBMIT]').click();
    return true;
  } else {
    return true;
  }
});

leimnud.event.add(document.getElementById('form[USER_ENV]'), 'keypress', function(event) {
  var key;
  if(window.event)
    key = window.event.keyCode;     //IE
  else
    key = event.which;     //firefox
  if(key == 13) {
    document.getElementById('form[BSUBMIT]').click();
    return true;
  } else {
    return true;
  }
});

leimnud.event.add(document.getElementById('form[BSUBMIT]'), 'click', function() {
    createCookie("pm_sys_sys", "{\"sys_sys\": \"" + getField("USER_ENV").value + "\"}", 365);

    /*
    var client = getBrowserClient();
    if (client.browser == "msie" || client.browser == "safari"){
        document.sysLogin.submit();
    }
    */

    document.getElementById('form[USR_PASSWORD]').value = document.getElementById('form[USR_PASSWORD_MASK]').value;
    document.getElementById('form[USR_PASSWORD_MASK]').value = '';
    document.getElementById('form[USR_PASSWORD_MASK]').setAttribute('type', 'text');
    document.sysLogin.submit();
}.extend(document.getElementById('form[BSUBMIT]')));

try{
    var s = new String(readCookie("pm_sys_sys"));
    var obj = eval("(" + s + ")");

    if (obj != null) {
        getField("USER_ENV").value = obj.sys_sys;
    }
} catch(e){}

]]></JS>
</dynaForm>

