<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="login" version="1.0" basedir="" xmlform_type="NORMAL" width="400px" enabletemplate="1">
  <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="text" 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_LANG type="dropdown" sqlconnection="dbarray">
SELECT LANG_ID, LANG_NAME FROM langOptions
  <en><![CDATA[Language]]></en>
</USER_LANG>
  <URL type="hidden"/>
  <LOGIN_VERIFY_MSG type="private" showInTable="0"/>
  <BSUBMIT type="button">
    <en><![CDATA[Login]]></en>
  </BSUBMIT>
  <FORGOT_PASWORD_LINK type="link" link="forgotPassword" onclick="" colAlign="right" colWidth="135" style="display:none;">
    <en><![CDATA[Forgot Password]]></en>
  </FORGOT_PASWORD_LINK>
  <JS type="javascript"><![CDATA[

//validate iframe login
if(inIframe() && (window.location.search.indexOf("inIFrame=1")===-1)) {
  if (PM.Sessions.getCookie('PM-TabPrimary') !== '101010010'
      && (window.location.pathname.indexOf("login/login") !== -1
      || window.location.pathname.indexOf("sysLogin") !== -1)) {
      window.top.location.href = window.location.pathname;
  }
}
function inIframe () {
    try {
        return window.self !== window.top;
    } catch (e) {
        return true;
    }
};

// enable/disable forgot password link
if(flagForgotPassword == 'on' || flagForgotPassword == '1') {
  document.getElementById("form[FORGOT_PASWORD_LINK]").style.display = 'block';//hideRowById('FORGOT_PASWORD_LINK');
}

var panel;

function showGettingStarted() {
  panel = new leimnud.module.panel();
  panel.options = {
    size: {w:620,h:500},
    position: {x:50,y:50,center:true},
    control: {close:true,resize:false},fx:{modal:true},
    statusBar: false,
    fx: {shadow:true,modal:true}
  };
  panel.make();
  panel.loader.show();
  var r = new leimnud.module.rpc.xmlhttp({
    url:"../services/login_getStarted.php",
    method:"POST"
  });
  r.callback = function(rpc) {
    panel.loader.hide();
    panel.addContent(rpc.xmlhttp.responseText);
  };
  r.make();
};

var saveConfig = function() {
  if (document.getElementById("getStarted").checked == true) {
    var oRPC = new leimnud.module.rpc.xmlhttp({
      url: '../login/login_Ajax',
      async: false,
      method: 'POST',
      args: 'function=getStarted_save'
    });
    oRPC.make();
  }
  panel.remove();
}

var dynaformOnload = function() {
  setFocus(getField('USR_USERNAME'));
  if (flagGettingStarted) {
    showGettingStarted();
  }
};

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[BSUBMIT]'), 'click', function() {
  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.login.submit();
  //return true;
}.extend(document.getElementById('form[BSUBMIT]')));

]]></JS>
</dynaForm>
