http://url5476.avetta.com/ls/click?upn=N4NbDryoRsL3bIx-2FGKTHLo2mkDy8D3Ex4NJimTawdEMPhBHcsYYQaD6jJRx4pN3BUMnJ_FTup1fG3uYZOkQN7iBhklC2W9qXSkyymN77lbWCBnEjV-2FAbIgF8bWC7Vip5ykUxWzIyGqtIfhbOyRu9uZajoHmrOt-2BK4U-2FDuKfvEBwQkXRRbTX-2BVC73D7-2F4kV4Xqp8pBGklfY1nlg77b0Sh5TrjJUJchwO-2B0-2FsG6j4mQiE4TJY-2FMUINEo37RytxOx8uwDXyfdGDu3OJk3CqXROOhLeOanArpdnW9TowPfjcMMBwYvhU-3D

Last Checked: Sep 16, 2020, 12:12 EDT

IP Address: 167.89.115.56
ASN #: AS11377 SENDGRID, US
Location: Data unavailable.
URL Reputation:
  • Unknown This URL is not identified as malicious in the PhishTank Database.
  • Unknown PhishCheck thinks this URL is likely not a phish.
  • Warning OpenPhish: URL found in feed.

Other submissions on 167.89.115.56:

  • http://url5135.softwareadvisoryservice.uk/wf/click?upn=ugZAjhWfJUALIQOFQjqp7TzmMitquDBj45A6szbmf18hu-2F-2BsBEY9D6StoTiDqVGCqiOhNbZmELeS2qWhbbr1zQ4FhRPn72eGLMUNSjxiff16VHnKQoOfvoCSCOyCH-2BXU_JC09-2BmCpkp1e9bp1vk9wx-2Fe-2B4polEey-2FeZ-2BUKTvcNP9CrACPzeKTShhc8pbpa-2Fhe8IGgjmF6b8vGqy1SPXCMiU8IqjJTqfEVniCiBcyNXXgm7K4d5wW3LSVwcZFDiDS799ruVl0f-2BJ-2BmWMaMNEpc22PUd3uCfIkD-2BBTeL0SvWwAxhILxgu-2FPtrGLY32N7ghBathR7TiRR8wnEdUE27y5QyYqFsNBk-2BVoQU4RIx4IaHdAJEjpF5o7NOwJ7vwauzf7t0FvyGwYcgJhAVxAeLX4SsRh4gvhBuuYdtVwX0ASp02B-2FZea-2B8m5jBodnw9AuHCJmoZd2DPOh9j0i0la-2FF4babh9SxHIzYagEzAZHDoxSdWKRLLdz00JsRAJu-2FYKIqFYbqJu6N0ASEBv1ziiXSWdixqQhohJZiTY3yA3oaSWrJmhq71kjivLarm8w9fp9G0tb4dgQy0Oyjt-2FSA1j2WihH40yUhShNr8kXoMo9NaVGcZMFyipOlcNgPvggc5UEoqIg1Lmog4y6k0CTHq2uG0xassVPzRRLD5N6TJyjpk6g8oYqdJtwr1cfGPe4DDxKzXkNvcvsdoQhPgW57LV0VCqZ9A0OEI7EZn-2BHqDaQ36mXIsJWyk-2B4DPOHRl4IV0FE5eT

  • http://url5135.softwareadvisoryservice.uk/wf/click?upn=ugZAjhWfJUALIQOFQjqp7TzmMitquDBj45A6szbmf18hu-2F-2BsBEY9D6StoTiDqVGCDhVrM2BiSmtw6D4Pl-2FxhHwxRklf9BtjKm8S4bVvLTJ000cC9Y0mNsx-2B8WfQ1euno_JC09-2BmCpkp1e9bp1vk9wx-2Fe-2B4polEey-2FeZ-2BUKTvcNP9CrACPzeKTShhc8pbpa-2Fhe8IGgjmF6b8vGqy1SPXCMiU8IqjJTqfEVniCiBcyNXXgm7K4d5wW3LSVwcZFDiDS799ruVl0f-2BJ-2BmWMaMNEpc22PUd3uCfIkD-2BBTeL0SvWwAxhILxgu-2FPtrGLY32N7ghBathR7TiRR8wnEdUE27y5QyYqFsNBk-2BVoQU4RIx4IaHdAJEjpF5o7NOwJ7vwauzf7t0FvyGwYcgJhAVxAeLX4SsRh4gvhBuuYdtVwX0ASp02B-2FZea-2B8m5jBodnw9AuHCJmoZd2DPOh9j0i0la-2FF4babh9SxHIzYagEzAZHDoxSdWKRLLdz00JsRAJu-2FYKIqFYbqJu6N0ASEBv1ziiXSWdixqQhohJZiTY3yA3oaSWrJmhq71kjivLarm8w9fp9G0tYuL0ltlVNML7nIdVa28iTRe-2FCOOdzz9EscEBH009RpNTNxv4PtpvIU1B8bnu5YElcfVDQca4Nqc90TvS9bnOWBvVAM388deWVzD-2FAxhQ-2B-2BhGySN2Oi8rU-2BzbcWObffxY9S8SZj5aqrAz-2BKZv7E8Z9S0nzoY-2BYru8U8uQardHUDMC0jM9ZJ2gWc0qB27nS2yT

  • http://url651.microsoftsaccount.com/wf/click-3Fupn=zuuJ89wZNTSAzY30OMNfTvcXXDRLoksLVKvBrRxjg0K2tn4T8b-2Fn9duYCLeGqTcA_3xNGkJz1GPMEBxsF7Q1dMxbiD4-2F2qP5DCXPTcFKTiB8r0BkM9idT01-2FccoP0JtdDFUond7e0FM7mher8gyr-2BCwb22vtEjIOfEkTOwMKNtOxE0kJ98dNY8jjYHVUkB-2BZtLyqy-2Bu-2FxFOFYNeO8za6ItsiGv19eZRmkPjhvYHmiFTGIJybVDYvKsFKyuvhkxGtrG0zI2OUFseln5dXDztsp-2BlCtGzST-2BMZlfm2O7MfAOxdwj2ESp5eUOqmM0NlZWK-2FqnoGICWnXHvb47C-2BoLfIhjMXKmNpu8OPEzGq4dhYb6IeGqu9JGOlspVtxXaJ2xNOkpVAkPRa8zLGaTGblp1lLM8UpGB4gA71XosAjGgSRz1waHd-2B17QgTAv2vvC-2BTY86pQfafyInFZEmMTz-2Fh7y7-2B4wBjZzCQq3OaSvpqAzWA-2Fi2RFqUMl3o0dYX12GP0nxVWevS-2BCfXihmijXcV5P4c1oZeY97Naq3bEBSSE6o1pkEDBQDrYsnucYjVY6ZCv2A5Ctx2xnkMb-2F1zFf09Ts6qSvo-2Bk7-2Bk9M8Z6umABps4HcGQQrGAZxAfvBtX8A3BrgCkSUx-2FlqKQavwgFaccWpQ-2BhHQ==

  • http://click.tipclub.com/mps2/c/FQE/j74HAA/t.2x0/U4yNJ3e3S1KOG24hfdus9A/h0/gSK52gOnJTQlq-2BN9fXqwN7kxAHsPAokPixa-2BZVEOpQXpO90p7V1ZfF3gxo9gd3DWVK-2FBh0MLRbMcA6LxEhQYpw-3D-3D/xfI_

  • http://url9325.mastersacts.com/

  • http://gslink.flexera.com/wf/click

  • http://click.sc.spectrumemails.com/wf/click?upn=yOp70IfmTZmnMNC9eBPeaoJLtrKDfx-

  • http://url6668.werunedm.com/ls/click?upn=5u-2B0werWCcs3nJbF2vMGNBIPYkxgpNxhXLXCtX-2FeE0T3ACP2NDt1ZXwZlSRtdZBsKGiZ0-2B4Z2BFqINLUiiemvpeFOgilHfeVOFZZoCDAhKM-3D_oVc_zepFDDo4As796boj89EmUZsMIn9TATgensIuOvR6GmX3GP0aMI1E0bBYZaI-2Fc5ysePtoWCpmz3zo-2BxAC1zEGMLHrDSURScf4-2FtSk0Rilk1ChbBPoKzdeIkvDpcJ51YmYKCC67guY7jennT-2FBWmyr92erjzJa10Z7B-2Fn76LWIk3xMY5ZDT6NfxTr0AwU6KX5BkPUXdkriYFgKCh7STb7K1vPW-2F74yG3J-2B9lEyjz5l45qtwr12WBjdFWd5-2BWDC6NxHoUJq4xl1BPneB1a8NIq1K4C0U-2F9akjEnoMkEmTxTdVv-2FfTRKiLIupdrL9utQ6NqBBEASoWEMSxO-2FXY7DIvZbLAvTM0u-2Bkkzot29kj3fP2g-2FvGyD2k-2BDymDkdpz5AI9Dz1-2B6jRT2Bj9JiaNo7X5RMgxBLA4t7as17dS2HL8uJ8tD7AJj9FX89BzldEwXZEuP9Ow5Vlwe4gH8VwY5Wv-2BN1L2MR5HEcOGE-2FSd10MyYYuP56u1vlqJN8G-2FkZWLluylNDOsh41u37jjmsQArLL3Ie4NkSEND96Qg0-2BeRIUdbaU7NdWR77XD-2Bw-2FxSHxc6NTH-2ByMI4QtI3GDBdSEILPDIMMBJfGeOgEjWpgBLdb7wUOwJDE3bUMR7URz7uJUun1CPfk

  • http://email.so-li.cn/wf/unsubscribe?upn=UZ-2Fw3Bg8EOda-2F-2BSazO07kcDzbw4kxVJ3WbsE6Qn27KYMQdlvXpzl5ljJP3NrfQh5QooGhK-2FLQtJO-2F0TPJwd9nBN3UTWmyiyuTOXvWaomnfoc32mJFs-2B1Yu0tEHc5ox7lIY0T5p7iq-2BLjRjJ17vJaTppTehzmDzDty-2BlhMkFHdHHgYlvLxf-2FxH4lbzssdb2S8T-2Bi4gFLsgvrYNV422f3yIfeLO8-2BRKtFRF0y-2Fj52RXjM-3D

  • http://url8475.gift.sendoso.com/ls/click?upn=rL9FSCnIQp4ZQY-2BfG3-2B8B4VORKd7RNELrAVoG27mBYLCll62yqoCAP7hoTqpvqk22vrEadt-2BcAeuZLr1I1e1OEIRanf-2FwCahRh3t3oCsZTd3BtAMAcBQPyqwuR-2FbBy4RwcQ5_hJmnWXfrDPHf2x1x78Gw2wlRtbNT9ABcKGTGVL03bs-2BKF-2FW9EbpsziuL8O8Q3lO4LhIjb-2F29csffnL9xozz2IRZIlTyA0yYXB8zPEdkY1cETmJA4-2BjpAAiU-2B1Xv4bIc-2Bj3ZZOJmgO2s4-2FNCpZrq-2B57f5eIj3IHJEFvaUDsDrPdDsRQxYhcjqZaoLy0FeclGp9wSDqC4FqpmnY-2FkU6mQnkMIanxnyBEv84tLBRcKYKBk-3D

Other submissions on avetta.com:

  • https://app.avetta.com/login

Previous checks:

                               Domain Name: AVETTA.COM
Registry Domain ID: 126087604_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.godaddy.com
Registrar URL: http://www.godaddy.com
Updated Date: 2020-07-31T15:59:35Z
Creation Date: 2004-07-30T22:36:58Z
Registrar Registration Expiration Date: 2021-07-30T22:36:58Z
Registrar: GoDaddy.com, LLC
Registrar IANA ID: 146
Registrar Abuse Contact Email: abuse@godaddy.com
Registrar Abuse Contact Phone: +1.4806242505
Domain Status: clientTransferProhibited http://www.icann.org/epp#clientTransferProhibited
Domain Status: clientUpdateProhibited http://www.icann.org/epp#clientUpdateProhibited
Domain Status: clientRenewProhibited http://www.icann.org/epp#clientRenewProhibited
Domain Status: clientDeleteProhibited http://www.icann.org/epp#clientDeleteProhibited
Registrant Organization: Avetta, LLC
Registrant State/Province: Utah
Registrant Country: US
Registrant Email: Select Contact Domain Holder link at https://www.godaddy.com/whois/results.aspx?domain=AVETTA.COM
Admin Email: Select Contact Domain Holder link at https://www.godaddy.com/whois/results.aspx?domain=AVETTA.COM
Tech Email: Select Contact Domain Holder link at https://www.godaddy.com/whois/results.aspx?domain=AVETTA.COM
Name Server: DARWIN.NS.CLOUDFLARE.COM
Name Server: DOLLY.NS.CLOUDFLARE.COM
DNSSEC: unsigned
URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/
>>> Last update of WHOIS database: 2020-09-16T16:00:00Z <<<

For more information on Whois status codes, please visit https://www.icann.org/resources/pages/epp-status-codes-2014-06-16-en

TERMS OF USE: The data contained in this registrar's Whois database, while believed by the 
registrar to be reliable, is provided "as is" with no guarantee or warranties regarding its
accuracy. This information is provided for the sole purpose of assisting you in obtaining 
information about domain name registration records. Any use of this data for any other purpose 
is expressly forbidden without the prior written permission of this registrar. By submitting 
an inquiry, you agree to these terms and limitations of warranty. In particular, you agree not 
to use this data to allow, enable, or otherwise support the dissemination or collection of this 
data, in part or in its entirety, for any purpose, such as transmission by e-mail, telephone, 
postal mail, facsimile or other means of mass unsolicited, commercial advertising or solicitations 
of any kind, including spam. You further agree not to use this data to enable high volume, automated 
or robotic electronic processes designed to collect or compile this data for any purpose, including 
mining this data for your own personal or commercial purposes. Failure to comply with these terms 
may result in termination of access to the Whois database. These terms may be subject to modification 
at any time without notice.

                             
  • GET
    HTTP/1.1
    302 Found

    http://url5476.avetta.com/ls/click?upn=N4NbDryoRsL3bIx-2FGKTHLo2mkDy8D3Ex4NJimTawdEMPhBHcsYYQaD6jJRx4pN3BUMnJ_FTup1fG3uYZOkQN7iBhklC2W9qXSkyymN77lbWCBnEjV-2FAbIgF8bWC7Vip5ykUxWzIyGqtIfhbOyRu9uZajoHmrOt-2BK4U-2FDuKfvEBwQkXRRbTX-2BVC73D7-2F4kV4Xqp8pBGklfY1nlg77b0Sh5TrjJUJchwO-2B0-2FsG6j4mQiE4TJY-2FMUINEo37RytxOx8uwDXyfdGDu3OJk3CqXROOhLeOanArpdnW9TowPfjcMMBwYvhU-3D

  • GET
    HTTP/1.1
    302 Redirect

    https://worker.avetta.com/

  • GET
    HTTP/1.1
    200 OK

    https://worker.avetta.com/index.pl?pg=Login

  • GET
    HTTP/1.1
    200 OK

    https://worker.avetta.com/sys/images/logos/avetta-logo.png

  • GET
    HTTP/1.1
    200 OK

    https://worker.avetta.com/sys/images/scheme/hdr_line.png?1561042754

  • GET
    HTTP/1.1
    200 OK

    https://worker.avetta.com/site/images/scheme/busy.gif?1561042752

  • GET
    HTTP/1.1
    200 OK

    https://worker.avetta.com/favicon.ico

  • POST
    HTTP/1.1
    200 OK

    https://worker.avetta.com/index.pl?pg=Login&cmd=LoadNews&ctype=text/xml&cid=0&SESSIONID=MBO5671BC1F

  • http://url5476.avetta.com/ls/click?upn=N4NbDryoRsL3bIx-2FGKTHLo2mkDy8D3Ex4NJimTawdEMPhBHcsYYQaD6jJRx4pN3BUMnJ_FTup1fG3uYZOkQN7iBhklC2W9qXSkyymN77lbWCBnEjV-2FAbIgF8bWC7Vip5ykUxWzIyGqtIfhbOyRu9uZajoHmrOt-2BK4U-2FDuKfvEBwQkXRRbTX-2BVC73D7-2F4kV4Xqp8pBGklfY1nlg77b0Sh5TrjJUJchwO-2B0-2FsG6j4mQiE4TJY-2FMUINEo37RytxOx8uwDXyfdGDu3OJk3CqXROOhLeOanArpdnW9TowPfjcMMBwYvhU-3D https://worker.avetta.com
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us"><head>
<title>Worker Management - Login</title>
<base href="https://worker.avetta.com/">
<meta name="CGI.PM" content="4.30">
<meta name="DBATTEMPS" content="1">
<meta name="DBCHARMAX" content="16000">
<meta name="DBCONTIME" content="0.052983">
<meta name="DBDRIVER" content="ADO">
<meta name="DBI.PM" content="1.636">
<meta name="DBREV" content="5.0.11">
<meta name="DBTYPE" content="MSSQL">
<meta name="GENERATED" content="Wed Sep 16 16:12:24 2020">
<meta name="GENERATOR" content="Perl 5.016003">
<meta name="PAGEID" content="Login">
<meta name="PLREV" content="05.00.04-94">
<meta name="charset" content="utf8">
<link href="https://worker.avetta.com/favicon.ico" rel="icon" type="image/ico">
<meta content="IE=EmulateIE10" http-equiv="X-UA-Compatible">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body charset="utf-8" onload="Window.Load();" onunload="Window.Unload();">
<style>
/** HTML5 Boilerplate **/
article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; }
audio, canvas, video { display: inline-block; display: inline; zoom: 1; }
audio:not([controls]) { display: none; }
[hidden] { display: none; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
html, button, input, select, textarea { font-family: sans-serif; color: #222; }
body { margin: 0; font-size: 1em; line-height: 1.4; }

::-moz-selection { background: #fe57a1; color: #fff; text-shadow: none; }
::selection { background: #fe57a1; color: #fff; text-shadow: none; }

a { color: #00e; }
a:visited { color: #551a8b; }
a:hover { color: #06e; }
a:focus { outline: thin dotted; }
a:hover, a:active { outline: 0; }
abbr[title] { border-bottom: 1px dotted; }
b, strong { font-weight: bold; }
blockquote { margin: 1em 40px; }
dfn { font-style: italic; }
hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; }
ins { background: #ff9; color: #000; text-decoration: none; }
mark { background: #ff0; color: #000; font-style: italic; font-weight: bold; }
pre, code, kbd, samp { font-family: monospace, serif; _font-family: 'courier new', monospace; font-size: 1em; }
pre { white-space: pre; white-space: pre-wrap; word-wrap: break-word; }

q { quotes: none; }
q:before, q:after { content: ""; content: none; }
small { font-size: 85%; }
sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; }
sup { top: -0.5em; }
sub { bottom: -0.25em; }

ul, ol { margin: 1em 0; padding: 0 0 0 40px; }
dd { margin: 0 0 0 40px; }
nav ul, nav ol { list-style: none; list-style-image: none; margin: 0; padding: 0; }

img { border: 0; -ms-interpolation-mode: bicubic; vertical-align: middle; }
svg:not(:root) { overflow: hidden; }
figure { margin: 0; }

form { margin: 0; }
fieldset { border: 0; margin: 0; padding: 0; }

label { cursor: pointer; }
legend { border: 0; margin-left: -7px; padding: 0; white-space: normal; }
button, input, select, textarea { font-size: 100%; margin: 0; vertical-align: baseline; vertical-align: middle; }
button, input { line-height: normal; }
button, input[type="button"], input[type="reset"], input[type="submit"] { cursor: pointer; -webkit-appearance: button; overflow: visible; }
button[disabled], input[disabled] { cursor: default; }
input[type="checkbox"], input[type="radio"] { box-sizing: border-box; padding: 0; width: 13px; height: 13px; }
input[type="search"] { -webkit-appearance: textfield; -moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box; }
input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
button::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0; }
textarea { overflow: auto; vertical-align: top; resize: vertical; }
input:valid, textarea:valid {  }
input:invalid, textarea:invalid { }

table { border-collapse: collapse; border-spacing: 0; }
td { vertical-align: top; }

h1 { display: block; font-size: 2em;    margin: 0.67em 0px; font-weight: bold; }
h2 { display: block; font-size: 1.5em;  margin: 0.83em 0px; font-weight: bold; }
h3 { display: block; font-size: 1.17em; margin: 1em 0px;    font-weight: bold; }
h4 { display: block; font-size: 1em;    margin: 1.33em 0px; font-weight: bold; }
h5 { display: block; font-size: .83em;  margin: 1.67em 0px; font-weight: bold; }
h6 { display: block; font-size: .67em;  margin: 2.33em 0px; font-weight: bold; }

.chromeframe { margin: 0.2em 0; background: #ccc; color: black; padding: 0.2em 0; }

@media only screen and (min-width: 35em) {}

.ir { display: block; border: 0; text-indent: -999em; overflow: hidden; background-color: transparent; background-repeat: no-repeat; text-align: left; direction: ltr; line-height: 0; }
.ir br { display: none; }
.hidden { display: none !important; visibility: hidden; }
.visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
.visuallyhidden.focusable:active, .visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; }
.invisible { visibility: hidden; }
.clearfix:before, .clearfix:after { content: ""; display: table; }
.clearfix:after { clear: both; }
.clearfix { zoom: 1; }
.pull-left { float: left !important; }
.pull-right { float: right !important; }

@media print {
  background: transparent !important; color: black !important; box-shadow:none !important; text-shadow: none !important; filter:none !important; -ms-filter: none !important;
  a, a:visited { text-decoration: underline; }
  a[href]:after { content: " (" attr(href) ")"; }
  abbr[title]:after { content: " (" attr(title) ")"; }
  .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after { content: ""; }
  pre, blockquote { border: 1px solid #999; page-break-inside: avoid; }
  thead { display: table-header-group; }
  tr, img { page-break-inside: avoid; }
  img { max-width: 100% !important; }
  @page { margin: 0.5cm; }
  p, h2, h3 { orphans: 3; widows: 3; }
  h2, h3 { page-break-after: avoid; }
}
.w3-left{float:left!important}.w3-right{float:right!important}
.w3-image{max-width:100%;height:auto;max-height:100%}
.w3-responsive{overflow-x:auto}
.w3-container:after,.w3-panel:after,.w3-row:after,.w3-row-padding:after,.w3-topnav:after,.w3-clear:after,.w3-btn-group:before,.w3-btn-group:after,.w3-btn-bar:before,.w3-btn-bar:after{content:"";display:table;clear:both}
w3-row-padding,.w3-row-padding>.w3-half,.w3-row-padding>.w3-third,.w3-row-padding>.w3-twothird,.w3-row-padding>.w3-threequarter,.w3-row-padding>.w3-quarter,.w3-row-padding>.w3-col{padding:0 5px}
.w3-col,.w3-half,.w3-third,.w3-twothird,.w3-threequarter,.w3-quarter{float:left;width:100%}
.w3-col.s1{width:8.33333%}
.w3-col.s2{width:16.66666%}
.w3-col.s3{width:24.99999%}
.w3-col.s4{width:33.33333%}
.w3-col.s5{width:41.66666%}
.w3-col.s6{width:49.99999%}
.w3-col.s7{width:58.33333%}
.w3-col.s8{width:66.66666%}
.w3-col.s9{width:74.99999%}
.w3-col.s10{width:83.33333%}
.w3-col.s11{width:91.66666%}
.w3-col.s12,.w3-half,.w3-third,.w3-twothird,.w3-threequarter,.w3-quarter{width:99.99999%}
@media only screen and (min-width: 601px ){
.w3-col.m1{width:8.33333%}
.w3-col.m2{width:16.66666%}
.w3-col.m3,.w3-quarter{width:24.99999%}
.w3-col.m4,.w3-third{width:33.33333%}
.w3-col.m5{width:41.66666%}
.w3-col.m6,.w3-half{width:49.99999%}
.w3-col.m7{width:58.33333%}
.w3-col.m8,.w3-twothird{width:66.66666%}
.w3-col.m9,.w3-threequarter{width:74.99999%}
.w3-col.m10{width:83.33333%}
.w3-col.m11{width:91.66666%}
.w3-col.m12{width:99.99999%}}
@media only screen and ( min-width: 993px ){
.w3-col.l1{width:8.33333%}
.w3-col.l2{width:16.66666%}
.w3-col.l3,.w3-quarter{width:24.99999%}
.w3-col.l4,.w3-third{width:33.33333%}
.w3-col.l5{width:41.66666%}
.w3-col.l6,.w3-half{width:49.99999%}
.w3-col.l7{width:58.33333%}
.w3-col.l8,.w3-twothird{width:66.66666%}
.w3-col.l9,.w3-threequarter{width:74.99999%}
.w3-col.l10{width:83.33333%}
.w3-col.l11{width:91.66666%}
.w3-col.l12{width:99.99999%}}
.w3-content{max-width:980px;margin:auto}
.w3-rest{overflow:hidden}
.w3-hide{display:none!important}.w3-show-block,.w3-show{display:block!important}.w3-show-inline-block{display:inline-block!important}
@media ( max-width: 600px ){.w3-hide-small{display:none!important}}
@media ( max-width: 992px ) and ( min-width: 993px ){.w3-hide-medium{display:none!important}}
@media ( min-width: 993px ){.w3-hide-large{display:none!important}}

/* complete page */
.page-container
{
  margin-left: auto;
  margin-right: auto;
  /* max-width: 980px; */
}

.page-header
{
}

.page-header a
{
  color: inherit;
}

/* contains actionmenu and content */
.page-body
{
  display: table;
  height: 100%;
  width: 100%;
}

.page-actionmenu
{
  display: table-cell;
  padding-left: 5px;
  padding-right: 0px;
  padding-top: 65px;
  position: relative;
  vertical-align: top;
  width: 11em;
}

.page-content
{
  display: table-cell;
  padding-left: 10px;
}

.page-content .page-title
{
  background-color: #F5F7FA;
  color: #112B54;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 25px;
  margin: 0px;
  padding: 5px 0px 5px 10px;
  text-align: left;
}

.page-content .page-bookmark
{
  line-height: 30px;
  min-height: 30px;
  padding-left: 10px;
}

.page-bookmark
{
  width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

.page-content .page-data
{
  padding-left: 5px;
}

.page-footer
{
  font-size: .9rem;
}

.information-box
{
  background-color: gray;
  border: 1px ridge #AAA;
  color: white;
  font-family: verdana, serif;
  font-size: larger;
  font-weight: 600;
  position: absolute;
  margin-left: auto;
  margin-right: auto;
  opacity: 0;
  filter: alpha(opacity=0);
  padding: 5px 20px;
  top: 0px;
  z-index: 5;
}

.error-message
{
  background-color: #FF0000;
  color: #FFFFFF;
  font-size: 1rem;
  font-weight: 700;
  padding: 5px;
  text-align: center;
}

.help-message
{
  font-size: 110%;
  margin: 10px 50px;
  text-align: left;
  color: #E64126;
  border: 1px solid lightgray;
  padding: 4px;
}

/***** OSI Defaulting style *****/

*
{
  box-sizing: border-box;
}

fieldset
{
  border: 1px solid #7D7D7D;
  padding-bottom: 5px;
}

legend
{
  margin-left: 5px;
}

/* Prevent display shift when changing tabs */
html
{
  overflow-y: scroll;
  font-size: 8pt;
}

body
{
  font-family: Verdana, arial, sans-serif;
  font-style: normal;
  text-align: left;
  color: #112B54;
  background-color: #F5F7FA;
  background-attachment: fixed;
  margin: 0pt;
  padding: 5px 0px;
}

table
{
  border-collapse: collapse;
  vertical-align: top;
  border: 0px solid black;
  text-align: left;
  padding: 0px;
  width: 100%;
}

th
{
  background-color: #F5F7FA;
  color: #112B54;
  border: 1px solid #112B54;
  font-weight: 700;
  white-space: nowrap;
  padding: 0px;
  height: 15px;
}

td
{
  vertical-align: top;
  text-align: left;
  padding: 0px;
  margin: 0px;
}

caption
{
}

.TableHTML
{
  margin-top: 10px;
}

.TableHTML table th
{
	white-space: normal;
}

.TableHTML table td
{
	overflow: hidden;
}

.TableHTML table caption div
{
  font-weight: bold;
/*  background-color: #F5F7FA;
  color: #112B54; */
  text-align: left;
/*  border: 1px solid #112B54;
  border-bottom: 0px; */
  padding: 2px;
}

pre
{
  font-size: 8pt;
}

table.striped > tbody > tr:nth-child(odd) > td
{
	background-color: #F5F7FA;
}

table.striped > tbody > tr:nth-child(even) > td
{
	background-color: #FFFFFF;
}

.h0
{
  background-color: #FFFFFF;
}

.h1
{
  background-color: #F5F7FA;
}

img
{
  border: 0px;
  vertical-align: middle;
}

img.link
{
  cursor: pointer;
}

img.logo
{
  height: 50px;
}

img.busy_image
{
  display: inline;
  cursor: wait;
  width: 75px;
  height: 75px;
}

a
{
  color: #2D67C5;
}

a.nonlink
{
  text-decoration: none;
}

th a
{
  color: #112B54;
}

/* container */
.cell
{
  padding: 0px;
  vertical-align: top;
}

/* header div */
.cell-title
{
  background-color: #0D2242;
  background-image: url( 'sys/images/scheme/hdr_line.png' );
  background-position: center;
  background-repeat: repeat-x;
  color: #FCFCFC;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0px;
  overflow: auto;
  padding: 3px 5px;
}

.cell-title > span,
.cell-title .cell-actions
{
  background-color: #0D2242;
  background-image: none;
  display: inline-block;
  padding: 0px 5px;
}

/* header anchor */
.cell-title a
{
  text-decoration: none;
  background-color: #0D2242;
  color: #FCFCFC;
  font-size: 100%;
}

.cell-title img[draggable]
{
	cursor: move;
	float: right;
	height: 15px;
}

.cell-actions
{
	float: right;
}

.cell_title
{
  font-size: 110%;
  font-weight: 700;
  background-color: #0D2242;
  color: #FCFCFC;
  padding: 3px 5px;
  margin: 5px 2px 0px;
  overflow: auto;
}

.cell_title td,
.cell_title table td,
.cell_title div
{
  vertical-align: middle;
}

.cell_title hr
{
  color: #FCFCFC;
  height: 1px;
}

.cell_content
{
  margin: 0px 2px;
}

.cell_floor
{
  margin: 0px 2px;
  background-color: #0D2242;
  overflow: auto;
}

div.homepage
{
  border: 1px solid #0D2242;
  max-height: 200px;
  overflow-x: visible;
  overflow-y: auto;
}

div.homepage th,
div.homepage td
{
  padding: 2px 2px;
  text-align: left;
}

.dateform
{
  text-align: left;
  color: #E64126;
}

.navigation
{
  text-align: center;
}

.center
{
  white-space: nowrap;
  text-align: center;
}

.right
{
  white-space: nowrap;
  text-align: right;
}

.nodisplay
{
  display: none;
}

.hidden
{
  width: 1px;
  height: 1px;
  visibility: hidden;
}

.popup_form
{
  text-align: center;
  font-weight: 500;
}

/* PRE-DELETE BOX */

.cell-predelete
{
	max-height: 600px;
	max-width: 600px;
	min-height: 100px;
	min-width: 300px;
	padding: 5px;
}

.cell-predelete > .cell-body table th
{
	border: none;
	border-bottom: 1px solid #000;
}

/**** FORM ************************************************/
form
{
  margin: 0px;
  padding: 0px;
}

.form_row_header
{
	background-color: #F5F7FA;
	color: #112B54;
	padding: .5em;
	font-weight: 600;
	min-height: 20px;
	margin-bottom: 5px;
}

.form_row_instructions
{
	color: #E64126;
	padding: .25em 0em .5em .5em;
}

.form_row_fixed
{
	display: table;
	width: 100%;
	text-align: left;
}

.form_row_fixed.striped > div.form_row:nth-child(odd)
{
	background-color: #F5F7FA;
}

.form_row_fixed > div.form_row
{
	display: table-row;
}

.form_row_fixed > div.form_row > div.form_cell
{
	display: table-cell;
	border-right: 5px solid transparent;
	padding: 2px;
}

.form_row_fixed > div.form_row > div.form_cell_header,
.form_row_fixed > div.form_row > div.form_cell.item_header
{
	display: table-cell;
	background-color: #F5F7FA;
	border-right: 5px solid transparent;
	color: #112B54;
	padding: 2px 2px 2px 5px;
	font-size: 1.25em;
	font-weight: 600;
}

.form_row_fixed > div.form_row > div.form_cell > div.form_cell_label,
.form_row_fixed > div.form_row > div.form_cell > div.form_cell_data
{
	display: table-cell;
}

.form_row_float
{
	width: 100%;
	display: table;
	text-align: left;
}

.form_row_float > div.form_col
{
	vertical-align:top;
	display: table-cell;
	width: 100%;
	height: 100%;
}

.form_row_float > table > tbody > tr > td
{
	padding: 0px;
}

.form_row_float > div.form_col > div.form_cell_header,
.form_row_float > table > tbody > tr > td > div.form_cell_header,
.form_row_float > div.form_col > div.form_cell.item_header,
.form_row_float > table > tbody > tr > td > div.form_cell.item_header
{
	background-color: #F5F7FA;
	color: #112B54;
	padding: 2px 2px 2px 5px;
	width: 100%;
	display: block;
	font-size: 1.25em;
	font-weight: 600;
}

.form_row_float > div.form_col > div.form_row,
.form_row_float > table > tbody > tr > td > div.form_row
{
	display: table;
}

.form_row_float > div.form_col > div.form_cell,
.form_row_float > table > tbody > tr > td > div.form_cell
{
	display: table-row;
	border-bottom: 5px solid transparent;
	width: 100%;
}

.form_row_float > div.form_col > div.form_cell.block,
.form_row_float > table > tbody > tr > td > div.form_cell.block
{
	display: table;
	margin-bottom: 5px;
	width: 100%;
}

.form_row_float > div.form_col > div.form_cell > div.form_cell_label,
.form_row_float > div.form_col > div.form_cell > div.form_cell_label_required,
.form_row_float > table > tbody > tr > td > div.form_cell > div.form_cell_label,
.form_row_float > table > tbody > tr > td > div.form_cell > div.form_cell_label_required,
.form_row_float > div.form_col > div.form_cell > div.form_cell_data,
.form_row_float > table > tbody > tr > td > div.form_cell > div.form_cell_data
{
	display: table-cell;
}

.form_cell_label,
.form_cell_label_required
{
	white-space: nowrap;
	padding-left: 2px;
	padding-right: 5px;
	min-width: 150px;
}

.form_cell_label_required
{
	font-weight: 800;
}

.form_drag_box_active
{
	background-color: #F5F7FA;
}

th.form_cell_header
{
  height: 1.5em;
  font-size: 1em;
  padding-top: .5em;
  padding-left: .5em;
}

div.form_table
{
  font-size: 8pt;
  border: 0px solid #F5F7FA;
  overflow: hidden;
}

div.form_table td
{
  vertical-align: top;
  padding: 2px 2px;
}

div.form_table th
{
  border: 0px;
  font-weight: 700;
  background-color: #F5F7FA;
  color: #112B54;
  vertical-align: top;
  padding-bottom: 6px;
}

div.form_instructions
{
  font-size: 110%;
  text-align: left;
  color: #E64126;
  border: 1px solid lightgray;
  padding: 4px;
  display: block;
}

div.build_field_uploader
{
  display:          inline-block;
  text-align:       center;
}

div.build_field_uploader hr
{
  width:     100%;
  height:    1px;
  border-style: solid;
  color:     #F5F7FA;
}


/** BAD FIELD **/
.bad
{
  background-color: #FF0000;
  border-style: solid;
  color: #FFFFFF;
}

span.bad.inactive
{
	background-color: #FF0000 !important;
	border: 1px solid #FFFFFF !important;
}

.label
{
  white-space: nowrap;
}

.required
{
  font-weight: 700;
}

.inputhelp
{
  text-align: left;
  color: #E64126;
}

.note
{
  color: #112B54;
  background-color: #CCD3DF;
}

/**** CELL FILES ******************************************/
.cell_files_items li
{
  overflow: hidden;
  white-space: nowrap;
  list-style-type: none;
  margin-left: -30px;
  border-bottom: 1px solid #F5F7FA;
  padding-bottom: 4px;
  padding-top: 4px;
}

@media print
{
  .cell_actionmenu, .cell_header, .cell_footer
  {
    display: none;
  }

  a[href^="http://"]:after
  {
    content: " (" attr(href) ")";
    font-size: 70%;
  }

  a[href^="https://"]:after
  {
    content: " (" attr(href) ")";
    font-size: 70%;
  }
}

/**** CHECKBOX LIST ***************************************/
ul.cbdiv
{
  list-style: none;
  margin: 0px;
  border-width: 0px;
  padding: 0px;
  text-align: left;
}

ul.cbdiv2
{
  list-style: none;
  margin: 0px 0px 0px 12px;
  border-width: 0px;
  padding: 0px;
  text-align: left;
}

ul.cbdiv li
{
  white-space: nowrap;
}

ul.cbdiv li a
{
  text-decoration: none;
}

ul.cbdiv li a:link
{
  background-color: #F5F7FA;
  color: #112B54;
}

ul.cbdiv li a:hover
{
  background-color: #F5F7FA;
  color: #112B54;
}

ul.cbdiv li.cbdiv_nav
{
  background-color: #F5F7FA;
  border: 1px solid #112B54;
  text-align: center;
  color: #112B54;
  padding: 2px;
  width: 100%;
}

ul.cbdiv li.cbdiv_nav a:link
{
  background-color: #FFFFFF;
  padding: 1px;
  color: #112B54;
}

ul.cbdiv li.cbdiv_nav a:hover
{
  background-color: #F5F7FA;
  padding: 1px;
  color: #112B54;
}

select.combolist
{
  position: absolute;
  display: none;
  border: 1px solid black;
  background-color: white;
  width: 0px;
}

select.combolist option
{
}

select.combolist option.nav
{
  background-color: #F5F7FA;
  color: #112B54;
}

.popupwindow
{
  position: absolute;
  display: block;
  z-Index: 10;
  width: 100%;
  left: 0;
  top: 0;
  background-color: #656565;
  opacity: .80;
}

.popupdiv
{
  position: absolute;
  overflow: auto;
  display: block;
  z-Index: 250;  /* popupdiv needs to be in front due to changelog */
  border: 2px solid #AAA;
  background-color: #F5F7FA;
  padding: 4px;
}

.popupdiv table
{
  background-color: #FFF;
  color: #000;
  padding: 2px;
}

.debug_window
{
  background-color: #EEE;
  color: #000;
  border: 3px solid silver;
  display: block;
  font-family: sans-serif;
  font-size: 8pt;
  position: absolute;
  z-index: 100;
  left: 0px;
  top: 0px;
  overflow: auto;
}

div.busy_screen
{
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0px;
  left: 0px;
  bottom: 0px;
  cursor: wait;
  text-align: center;
  vertical-align: text-bottom;
  z-index : 200;
}

div.dialog_screen
{
  position: fixed;
  top: 0px;
  left: 0px;
}

div.dialog_win
{
  background-color: #F5F7FA;
  color: #112B54;
  border: 1px solid #F5F7FA;
  padding-bottom: 40px;
  overflow: hidden;
}

div.dialog_header
{
  background-color: #F5F7FA;
  color: #112B54;
  border: 0px solid #F5F7FA;
  min-height: 25px;
  padding: 2px;
}

div.dialog_hdr_title
{
  display: block;
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-weight: 600;
}

div.dialog_footer
{
  position: relative;
  display: block;
  overflow: visible;
  width: 100%;
  min-height: 25px;
  background-color: #F5F7FA;
  color: #112B54;
  text-align: left;
  padding: 0px;
  margin: 0px;
  bottom: 0px;
  left: 0px;
}

div.dialog_footer > div.dialog_status > table > tbody > tr > th.navigation
{
  border: none !important;
  padding: 2px;
}

div.dialog_status
{
  position: relative;
  display: block;
  z-index: 1;
  width: 100%;
  height: 100%;
}

div.dialog_ftr_resize
{
  background-repeat: no-repeat;
  position: absolute;
  display: block;
  z-index: 2;
  bottom: 0px;
  right: 0px;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/**** REPORTS *********************************************/
table.ReportMenu
{
  width: 700px;
}

table.ReportMenu td div
{
  font-weight: 700;
  font-size: larger;
  padding: 5px 10px;
  color: #9DACC4;
  background-color: #0D2242;
  white-space: nowrap;
  letter-spacing: 1px;
}

ul.ReportList
{
  font-size: larger;
  list-style-type: none;
  padding: 0px;
}

table.TableHTML th, table.TableHTML td
{
  border: 1px solid #000;
  border-collapse: collapse;
  margin: 0px;
  padding: 2px;
}

/**** SEARCH DIALOG ***************************************/
.intellisearch
{
  border: 1px solid black;
  margin: 2px;
  width: 20em;
}

.search_cell
{
  background-color: #F5F7FA;
  color: #112B54;
}

.search_cell #cell_search_filter_form
{
  /*background-color: #F5F7FA;*/
  padding: 5px 0 5px 0;
  white-space: nowrap;
}

.search_cell #cell_search_count
{
  width: 100%;
}

.search_cell #cell_search_navigation
{
  width: 100%;
  text-align: center;
}

.search_cell #cell_search_window
{
  height: 400px;
  overflow: auto;
}

.search_cell #cell_search_dialog_list
{
  height: 280px;
  overflow: auto;
}

.search_cell a, .search_cell #cell_search_dialog_list a, .search_cell #cell_search_page_list a
{
  text-decoration: none;
}

.search_select:hover
{
  background-color: black;
  color: white;
  padding: 2px;
  border: 1px white solid;
  border-radius: 5px;
}

.search_cell_filters
{
  width:auto;
}

.search_cell_filters tr td
{
  padding: 2px;
  margin:5px;
  border:1px solid #F5F7FA;
}

.search_cell_header_row
{
  background-color: #F5F7FA;
}

.search_cell_header_row td, .search_cell_header_row td a
{
  color: #112B54;
}

.search_label
{
  display: inline;
  cursor: pointer;
  color: #2D67C5;
  text-decoration: underline;
}

.important
{
  font-style: italic;
  padding: 2px;
  text-decoration: underline;
}

.grp_inactive
{
  font-style: italic;
}

div.onoff
{
  border: 1px solid #808080;
  height: auto;
}

div.onoff input
{
  width: 50%;
  height: 20px;
  overflow: hidden;
  border: 0px;
  margin: 0px;
}

div.onoff .active
{
  background-color: #00CC99;
  color: #FFFFFF;
}

div.onoff .inactive
{
  background-color: #E0E0E0;
  color: #A0A0A0;
}

.active
{
  font-weight: 900;
}

/**** TAB BAR *********************************************/
table.tab_bar
{
  width: 99%;
  margin: 0px;
  margin-bottom: 5px;
  padding: 1px;
  padding-bottom: 2px;
  border: 0px solid #CCD3DF;
  border-bottom-width: 3px;
}

table.tab_bar tr td
{
  margin: 0px;
  padding: 1px 1px;
  padding-bottom: 0px;
  vertical-align: bottom;
}

table.tab_bar tr td div
{
  border: 0px solid #EDF0F5;
  margin: 0px 2px;
  padding: 2px 5px 2px 5px;
  cursor: pointer;
  text-align: center;
  letter-spacing: 1px;
  width:95%;
}

.tab0
{
  font-weight: 500;
  background-color: #EDF0F5;
  color: #112B54;
  white-space: nowrap;
}

.tab1
{
  font-weight: 900;
  background-color: #CCD3DF;
  color: #112B54;
  white-space: nowrap;
}

/**** PAGING BAR ******************************************/
table.paging_bar
{
  display: inline;
  text-align: center;
  width: auto;
  margin: 2px;
}

table.paging_bar td
{
  padding: 2px;
  white-space: nowrap;
  vertical-align: middle;
}

table.paging_bar input[type=button]
{
  margin: 2px;
  border: 0px;
  padding: 0px 3px;
  font-weight: 900;
  background-color: transparent;
}

table.paging_bar div#paging_button
{
  padding: 0px;
  text-align:center;
}

span.link
{
  cursor: pointer;
}

/**** DRAG LIST ******************************************/
div#drag_container
{
  margin: 0px;
  padding: 0px 0px 5px 0px;

}

div.drag
{
  border-width: 1px 1px 0px 1px;
  border-color: #000;
  border-style: solid;
  padding: 5px 0px;

  cursor: move;
}

div.drag:hover:not(#dragBufferBottom)
{
  cursor: move;
}

div.nodrag
{
  border-width: 1px; /* 1px 0px 1px; */
  border-color: #000;
  border-style: solid;
  padding: 5px 0px;
  cursor: auto;
}

div.drag, div.drag span
{
  /* Disable text selection*/
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

div.drag img
{
  float: right;
  vertical-align: top;
  padding: 0px 3px;
  cursor: pointer;
}

ul.uep
{
  list-style-type: none;
  list-style-image: none;
  padding: 0px 5px 5px 5px;
}

ul.uep ul
{
  list-style-type: none;
  list-style-image: none;
  padding: 0px 5px 5px 20px;
}

ul.uep ul ul
{
  list-style-type: none;
  list-style-image: none;
  padding: 0px 0px 5px 20px;
}

::-ms-clear
{
  display: none;
}

::-ms-reveal
{
  display: none;
}

::-ms-expand
{
  display: none;
}

.rounded_top
{
    border-radius:         5px 5px 0px 0px;
    -moz-border-radius:    5px 5px 0px 0px;
    -webkit-border-radius: 5px 5px 0px 0px;
}

.rounded_bottom
{
    border-radius:         0px 0px 5px 5px;
    -moz-border-radius:    0px 0px 5px 5px;
    -webkit-border-radius: 0px 0px 5px 5px;
}

.rounded_top_bottom
{
    border-radius:         5px;
    -moz-border-radius:    5px;
    -webkit-border-radius: 5px;
}

.rounded_big_top
{
    border-radius:         10px 10px 0px 0px;
    -moz-border-radius:    10px 10px 0px 0px;
    -webkit-border-radius: 10px 10px 0px 0px;
}

.rounded_big_bottom
{
    border-radius:         0px 0px 10px 10px;
    -moz-border-radius:    0px 0px 10px 10px;
    -webkit-border-radius: 0px 0px 10px 10px;
}

.rounded_big_top_bottom
{
    border-radius:         10px;
    -moz-border-radius:    10px;
    -webkit-border-radius: 10px;
}


div#dragBufferTop
{
  border: 1px dashed #CCC;
  border-bottom: none !important;
  height: 12px !important;
  min-height: 5px !important;
}

div#dragBufferBottom
{
  background-color: #F5F7FA !important;
  height:5px;
  border: 0px solid #444;
  border-top: none;

}

.hidden
{
  display: none;
}

/**********************************************************
  Rating System
**********************************************************/
.ratingtype_741
{
  color: #00cc00;
  font-weight: 800;
}

.ratingtype_742
{
  color: #ffaa33;
  font-weight: 800;
}

.ratingtype_743
{
  color: #ff3300;
  font-weight: 800;
}

i[onclick], img[onclick], tr[onclick], th[onclick], td[onclick], div[onclick], span[onclick]
{
	cursor: pointer;
}

*[draggable]
{
	cursor: move;
}

/**********************************************************
  Build Field
**********************************************************/
.bf_search
{
	display: inline-block;
	border-radius: 1em;
	border: 1px solid;
	padding-left: 1em;
	padding-right: 1em;
	background-color: #F5F7FA;
	color: #112B54;
}

.bf_search input,
.bf_search img,
.bf_search input:active,
.bf_search img:active,
.bf_search input:focus,
.bf_search img:focus
{
	border: 0px;
	background-color: #F5F7FA;
	color: #112B54;
}

.bf_search input + img
{
	visibility: hidden;
}

.bf_search input.isactive + img
{
	visibility: visible !important;
}

.sort.ascend::after
{
	position: absolute;
	content: url(https://worker.avetta.com/site/images/scheme/sortascend.png?1561042752);
}

.sort.descend::after
{
	position: absolute;
	content: url(https://worker.avetta.com/site/images/scheme/sortdescend.png?1561042752);
}

.sort::after
{
	content: url(https://worker.avetta.com/sys/images/scheme/blank.gif?1561042754);
}

.sort
{
	vertical-align: top;
	font-style: oblique;
}

.card
{
    margin-top:26px;
    border-radius: .375rem;
    background-color: #fff;
    -webkit-box-shadow: 0 5px 15px 0 rgba(0,0,0,.07), 0 15px 35px 0 rgba(49,105,193,.1);
    box-shadow: 0 5px 15px 0 rgba(0,0,0,.07), 0 15px 35px 0 rgba(49,105,193,.1);
    background-clip: border-box;
    margin-bottom: 1rem;
    overflow: hidden;
    padding: 0.5rem 2rem 2rem 2rem;
}


input, select, button, textarea
{
  border: 1px solid;
  padding: 3px;
}

span.inactive
{
  background-color: #f2f2f2;
  border: 1px solid;
  display: inline-block;
  margin-right: 5px;
  max-width: 350px;
  min-height: 2em;
  min-width: 110px;
  overflow: hidden;
  padding: 3px;
  vertical-align: middle;
  white-space:nowrap;
}

input[disabled],
select[disabled]:not([readonly]),
textarea[disabled]
{
	color: #7F8A8A;
	padding-top: 2px;
	padding-bottom: 2px;
	border: 0px;
	background-color: transparent;
	text-overflow: ellipsis;
}

input:focus,
textarea:focus
{
	border-color: blue;
	box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset, 0px 0px 8px rgba(102, 175, 233, 0.6);
}

input[type=file]
{
  width:0px;
  height:10px;
  position:absolute;
  transparency;
  opacity: 0.0;
  filter:alpha(opacity=0);
  overflow: hidden;
}

input[type=checkbox],
input[type=radio]
{
  border-width: 0px;
  margin-right: 5px;
}

input[type=button], button
{
  border: 2px outset silver;
}

.button
{
  background-color: #F5F7FA;
  color: #112B54;
  border-color: #F5F7FA;
}

button.link, input.link, a.link, div.link
{
  border: 0px;
  background-color: transparent;
  color: #000000;
  margin: 0px;
  padding: 0px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
}
.status-general,
.status-general2,
.status-worker
{
	padding-bottom: 40px;
}

.status-general table,
.status-general table th,
.status-general table td,
.status-general2 table,
.status-general2 table th,
.status-general2 table td,
.status-worker table,
.status-worker table th,
.status-worker table td
{
	border-width: 0px !important;
}

.status-general table th.table-message,
.status-general2 table th.table-message,
.status-worker table th.table-message
{
	font-weight: 700 !important;
	padding: 15px 0;
}

.status-general table th,
.status-general2 table th,
.status-worker table th
{
	font-weight: 700 !important;
	padding: 0px 5px 15px 5px !important;
	text-align: center;
}

.status-general table td,
.status-general2 table td,
.status-worker table td
{
	padding: 0px 5px;
}

.status-general table th[class$="0"],
.status-general2 table th[class$="1"],
.status-worker table th.workers_col_0,
.status-worker table th.workers_col_1,
.status-worker table th.workers_col_2,
.status-worker table th.workers_col_3
{
	text-align: left;
	width: auto !important;
}

.status-general table th,
.status-general2 table th,
.status-worker table th.workers_col_4
{
	width: 60px !important;
}

.status-general2 table td .skittle
{
	padding: 0 20px !important;
	text-align: center;
}

.grp-connection-connect-status-icon
{
	background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABDCAYAAADUHfiHAAAACXBIWXMAABYlAAAWJQFJUiTwAAA4LmlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxMzIgNzkuMTU5Mjg0LCAyMDE2LzA0LzE5LTEzOjEzOjQwICAgICAgICAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIKICAgICAgICAgICAgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIgogICAgICAgICAgICB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIKICAgICAgICAgICAgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOmV4aWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20vZXhpZi8xLjAvIj4KICAgICAgICAgPHhtcDpDcmVhdG9yVG9vbD5BZG9iZSBQaG90b3Nob3AgQ0MgMjAxNS41IChNYWNpbnRvc2gpPC94bXA6Q3JlYXRvclRvb2w+CiAgICAgICAgIDx4bXA6Q3JlYXRlRGF0ZT4yMDE2LTEwLTI0VDEwOjQ5OjA4LTA3OjAwPC94bXA6Q3JlYXRlRGF0ZT4KICAgICAgICAgPHhtcDpNb2RpZnlEYXRlPjIwMTYtMTAtMjZUMTU6NTk6MzktMDc6MDA8L3htcDpNb2RpZnlEYXRlPgogICAgICAgICA8eG1wOk1ldGFkYXRhRGF0ZT4yMDE2LTEwLTI2VDE1OjU5OjM5LTA3OjAwPC94bXA6TWV0YWRhdGFEYXRlPgogICAgICAgICA8ZGM6Zm9ybWF0PmltYWdlL3BuZzwvZGM6Zm9ybWF0PgogICAgICAgICA8cGhvdG9zaG9wOkNvbG9yTW9kZT4zPC9waG90b3Nob3A6Q29sb3JNb2RlPgogICAgICAgICA8eG1wTU06SW5zdGFuY2VJRD54bXAuaWlkOjNlYjE0Nzc0LTE0MDktNDM5Mi04YjBjLThlOTM3OWY3ZjQ3MDwveG1wTU06SW5zdGFuY2VJRD4KICAgICAgICAgPHhtcE1NOkRvY3VtZW50SUQ+eG1wLmRpZDozZWIxNDc3NC0xNDA5LTQzOTItOGIwYy04ZTkzNzlmN2Y0NzA8L3htcE1NOkRvY3VtZW50SUQ+CiAgICAgICAgIDx4bXBNTTpPcmlnaW5hbERvY3VtZW50SUQ+eG1wLmRpZDozZWIxNDc3NC0xNDA5LTQzOTItOGIwYy04ZTkzNzlmN2Y0NzA8L3htcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD4KICAgICAgICAgPHhtcE1NOkhpc3Rvcnk+CiAgICAgICAgICAgIDxyZGY6U2VxPgogICAgICAgICAgICAgICA8cmRmOmxpIHJkZjpwYXJzZVR5cGU9IlJlc291cmNlIj4KICAgICAgICAgICAgICAgICAgPHN0RXZ0OmFjdGlvbj5jcmVhdGVkPC9zdEV2dDphY3Rpb24+CiAgICAgICAgICAgICAgICAgIDxzdEV2dDppbnN0YW5jZUlEPnhtcC5paWQ6M2ViMTQ3NzQtMTQwOS00MzkyLThiMGMtOGU5Mzc5ZjdmNDcwPC9zdEV2dDppbnN0YW5jZUlEPgogICAgICAgICAgICAgICAgICA8c3RFdnQ6d2hlbj4yMDE2LTEwLTI0VDEwOjQ5OjA4LTA3OjAwPC9zdEV2dDp3aGVuPgogICAgICAgICAgICAgICAgICA8c3RFdnQ6c29mdHdhcmVBZ2VudD5BZG9iZSBQaG90b3Nob3AgQ0MgMjAxNS41IChNYWNpbnRvc2gpPC9zdEV2dDpzb2Z0d2FyZUFnZW50PgogICAgICAgICAgICAgICA8L3JkZjpsaT4KICAgICAgICAgICAgPC9yZGY6U2VxPgogICAgICAgICA8L3htcE1NOkhpc3Rvcnk+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgICAgIDx0aWZmOlhSZXNvbHV0aW9uPjE0NDAwMDAvMTAwMDA8L3RpZmY6WFJlc29sdXRpb24+CiAgICAgICAgIDx0aWZmOllSZXNvbHV0aW9uPjE0NDAwMDAvMTAwMDA8L3RpZmY6WVJlc29sdXRpb24+CiAgICAgICAgIDx0aWZmOlJlc29sdXRpb25Vbml0PjI8L3RpZmY6UmVzb2x1dGlvblVuaXQ+CiAgICAgICAgIDxleGlmOkNvbG9yU3BhY2U+NjU1MzU8L2V4aWY6Q29sb3JTcGFjZT4KICAgICAgICAgPGV4aWY6UGl4ZWxYRGltZW5zaW9uPjc1PC9leGlmOlBpeGVsWERpbWVuc2lvbj4KICAgICAgICAgPGV4aWY6UGl4ZWxZRGltZW5zaW9uPjY3PC9leGlmOlBpeGVsWURpbWVuc2lvbj4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgIDwvcmRmOlJERj4KPC94OnhtcG1ldGE+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgCjw/eHBhY2tldCBlbmQ9InciPz66bBISAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAs0SURBVHja7Jx7bFvVHce/516/8rTdPGmgdhsGtIQmpWUVbNQuTV9oW1ImhNCkARrapP3Rptq0ISQWTwytmzRmhKaOFTZ32pjYtFENVVQTUHdqyujUkk5DPArFaQkl0DZOAm1j33t+++M+fO7DjlMalhAf6cjX19bN9aef3+/8zvFxGRGh0sprUgVBBVYFVgWWS1vWvzxSgVUmqPaVre9s2be5qwJritbQVve8xyfLXOVPV2CVaJ2PrOhrXFS/FAAkWVq6Zd/mxGy6PzZb6qxl/csjkY6mtwN1Po/tpcXPbno+UzFLaOHW2mdcQAFAqhKGQrvh4a67mhcHVxd5ObZl3+a+Ciy9tbaHfzfFWxJb9m2OzntYqx9b/XTtgkDVFG8LAkjOe1gfZsZyZb61p/f5zb3zGlZm8MPBM6fGS76HyOypr+3dHJrPOWvwjYPDU4LiWg8SUWo+w8KZk+Ow2yXYpHUOEBE4oef2v2+Kz1dYGQAQ7bLZBCLSOjegIbVpz6bQvINF+89lDLuyI+dtNpFhkw7NtCxChMS8DEMwBiYxnDjygc0miDaZr3Ht/Lb1f90Yn3ewmMSOgTGcev0szo9NFrNJsI7AicD5Z1t7zRZYWSYxMMbw1ivvl7KpYJzWO9c+szExv8JQYmYffuMczo/nStlkNY7QH/vTxq7PDaxvP7bi6SlSVppJWt5iEsM7R06XsgnEoUHjpnXJzwWsOx/q2L7i5rq7dx5ekyhpFivAOn18FBcmcqVsso+YsS/9YUPfnIZ1dXck1Lm6bof+tH/n4TXRUjkLrBCO7w5+MJVN9hEzcfPvN0TnLKyv3t20p6HZ6xNOpYrE4aAZhrphIyeyyE2qpWyyJH9OCBKf2YXCGYO1ddfK26+5oTpmOx3beXhNn4tZABMSvQ7s/TfPTmWTBSInxG767YbeOQdrQZP3j8UW8uzhyCSWERO8EZKnj5+DklNL2eQYMYkotfLJ9aE5A+ueHZ1PtSz0FbvhINkW8ib/NpyBbpcITFU4Tr99Dry0Tbp9ZAwCQaKZCccZgXX05YlrJy/yoksunNDz+L/W9NpD0Z7kITGMvDsKJc+nssk+CPR0PrE+PidgXfhEVY4OTDjOc8EElSP1y4E1ISHJH9OAwUzyhl0fnhgtbhMvVlIgdcPO7tBcyFnRIwPjMOwSpy2qMHqpQjHJJJa1WCUA+2hoFPkcd7eJnCWFPhBEiF/elYmZghWZvMhxdGDCBKUKH0glQCUC53TPjgO3xsUw1KxCISQZg8oJZ05mLTZxKr5AKAwE25Y+3h2f7bAAAEcGxnH+ArdaJXxgDRpSD++/NQTG0larrMn+3HDWOu1xt8kxANBlnApddlhXd0fMPDF5kePVQxNC6BFUIgMSVC13RVSOPrEgFa0y4KkqITsyUY5NZlgaKxPXJLsTsxKWB+jyAvAC8AF47dC4ntDJgFPoBWj91y6urrHnKnuyP3sqW65NQi4jcE797Y+u65p1sHxE8BKZj7ig4virE3abHNDiN4W2uFolFVZSlbyKj0fPj5RhkzAQFEbHWQfLMEp8fD09ZpQLBWg2eLKM9lXX11nNYgXDDIBn3xtt4eXZZDMQndGfr+v7v8H66KmWD9S9zZapi08IQ6MrWQUnj31cGOIdoaiF6LIl1air9cC9hNASvppXoeTU58q0yb7imrhqx7roZw7r+E9b0gtaqcW+kuAFQmIYGo9D6azFqEIeIxOaLDPc0lVfsIrZwlKfbJ8bHv1nmTbZVlzpU31Je0mw3nyk5fYly8lYUYipe5vvNWEROcLQC0AdUzB2cvJYwSgy6y+jKwQ0hry4Jlql3Zkj4TMwBkyen+zgHLvLtEnPaWa1H1v4yG33fmawmq7EM7ZTSXVvc0gPw6g9DA1ow/84+7bFpiLJfuniGvi8kiaTxSwjNNFFhESZNjmrfUKy5eHbQjMOK/Noy1PBRqq1zo4RhKqFo1eHZdqlh6GXCOrIZKNK2K0SoHCtG2GpCMAkGVhxXa0Bxpn0Get8q++FDBEOlGmTvTa7pIXCacHa2bEw2hKh+6yzY4AUBlJYj/KXll4xT3mJHHapHAmliFGidY1hH1oafMJoCEviD227Ps4JiWnYZOvU09i/tncmzUqdfZ8x3SZA0UBBAZAHSGHJsB8N3iIlhA+IJb9yMKNyzS6jdFCMZC8+J2DZkhp4PJIZgsw8ZGCMxU9878U0EQ6UaZPeSV9I1MIx/NDa0GWH9evlV/RBotiRFyRABSjPNFB50yxAQeSOTt5hT+5ih2ZXymmULdlzzaTIwoBzCsQAMHQB2hcV5a5EcOdAMK09E2XBeuLG1hBkSjCJcDoDTJzRbRLNUjSA3VcTrm/iZhjaS4jvxNuiT2w5mFY5DqicoAhGFSwrgGxt8KG+xm0TswZr6IcvpjmnAyXWtew22fIattU9uDZ++cySKMUkCjKJAIlwNM1EmwqWKQCpDN+8Caj3FrUrCgAqUcJukhF+BWAEhQPRtgBkmTmWgcLbO6L6elnCYhMvaZPbt0WpywLrN6ubeplEPQYoJhGOv0ZQL2LECEEhZwF5YIEXWLvEWTrojyEA2H3nQFrhOGC3yQ5KK1YlNIZ9Re0afvCltDkyil+XFbfJuu+LEKn+QTzxqWDtuqUxxDSrNFCy3iWCBPaAI2cJx+uXAItqbSOj1s3Zv2VkJDHRkwNg4wI/An7ZFRYAcI7kNG2y57R+//fjXZcMi0mUgERBE5QEQAM35LvvdIoUNmRAMvOXcPz1ZZLDLq9w/T9/Y0DPXQWbipmmcKC5OWC/RTPXjPzopT3EaWgaNrlsPildexWFdXBd2/0hj7RNm8CSAQlM6xkAgIKUAYbyDPbj5gDD2kWSvZq3/OuphIRbohdzl2Gc7JFQX28Jx5jtm6NEcZvIzSbr8g6nTs/2WN+0YbXL/l91eqvtkHRwGAQAyrMk5dmYHZKR9KEAq1oYGn0Qw9BS1zx3TyF3WUxSraCM8zV1Psiewm2Ht3eY8M/8eH+KE4bcbSq2MU7c0gRwjgTbGouWDeu/G65KB5jka5S8+ILXr0FiEMFlACCwfTgLBUnKC+GXt46SPs6wKSI7ErzTLttoKOQwhay1VygccM1bFrvKt8kcCPQeLLYnwwHr3xva7mpjflPvpXI1qmVJsAuARIPmzeVZEgrGipUSUIAr/BJWNMhGKHba/+YL9x9KKxxDisUoshil6DYAgM8vo6rG68hbAJD9iWaXq028iE1UWBczwpttjd07JaxW5ntSmCDDqzKsolot/JjVLACoeui9LCksZSkfjGMB2o1hD8IeZknwYlO4ZpdmlDPRO/YABP2QJOYwS6vqKeE+H7TZJMBzaUm2NRYqCus/G698thZyLQiAqn1g5IGGnBftakCfmxG+tX80Y7lsHklL+WALRS0cgS+GPfASYdetrY6K+dB3D6VUTkMWUPoHdB+pGYJaODpM/XhHOkWEocJ8sIhNxUEBcIajCevwxoVfvoL7ewwrkAMoD1BOe37dJzWaFRIds1+1esepDPLY7WaWmPDbfDIWBWTIU9hlGDXVj2wDVR4EqjwIb++Iu2wVSFj3R5Rlk731sK2xXgesJtX3nCfPGHRApAPTwDF4JyWszNYDDBnXDR8KS7hMrB2WrarxoVZmy9yu8eq2l1N5FSN8Gr9Erg/5IcvSJmcoYg9xjE3TJteVFiMcJQB4pXvhz0I5T4jyOiQTFANyTDvOAS3jfrSPVU24XbH28aHMmQl+zC0URcu8KsMKv/++Ync2eVGZ1qKcLEuoq/fd4bjOL9JZIkpegk1u4fgAMIt+UD4XWuW/V6nAqsCqwKrA+py2/w0ALVO3fiEX38AAAAAASUVORK5CYII=) 50%/37px auto no-repeat;
	background-size: contain;
	height: 24px;
/*	width: 100%; */
}
/*!
 * Cropper.js v1.0.0-rc.2
 * https://github.com/fengyuanchen/cropperjs
 *
 * Copyright (c) 2017 Fengyuan Chen
 * Released under the MIT license
 *
 * Date: 2017-05-30T05:02:48.005Z
 */

.cropper-container{font-size:0;line-height:0;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;direction:ltr;-ms-touch-action:none;touch-action:none}.cropper-container img{display:block;min-width:0!important;max-width:none!important;min-height:0!important;max-height:none!important;width:100%;height:100%;image-orientation:0deg}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal,.cropper-wrap-box{position:absolute;top:0;right:0;bottom:0;left:0}.cropper-wrap-box{overflow:hidden}.cropper-drag-box{opacity:0;background-color:#fff}.cropper-modal{opacity:.5;background-color:#000}.cropper-view-box{display:block;overflow:hidden;width:100%;height:100%;outline:1px solid #39f;outline-color:rgba(51,153,255,.75)}.cropper-dashed{position:absolute;display:block;opacity:.5;border:0 dashed #eee}.cropper-dashed.dashed-h{top:33.33333%;left:0;width:100%;height:33.33333%;border-top-width:1px;border-bottom-width:1px}.cropper-dashed.dashed-v{top:0;left:33.33333%;width:33.33333%;height:100%;border-right-width:1px;border-left-width:1px}.cropper-center{position:absolute;top:50%;left:50%;display:block;width:0;height:0;opacity:.75}.cropper-center:after,.cropper-center:before{position:absolute;display:block;content:" ";background-color:#eee}.cropper-center:before{top:0;left:-3px;width:7px;height:1px}.cropper-center:after{top:-3px;left:0;width:1px;height:7px}.cropper-face,.cropper-line,.cropper-point{position:absolute;display:block;width:100%;height:100%;opacity:.1}.cropper-face{top:0;left:0;background-color:#fff}.cropper-line{background-color:#39f}.cropper-line.line-e{top:0;right:-3px;width:5px;cursor:e-resize}.cropper-line.line-n{top:-3px;left:0;height:5px;cursor:n-resize}.cropper-line.line-w{top:0;left:-3px;width:5px;cursor:w-resize}.cropper-line.line-s{bottom:-3px;left:0;height:5px;cursor:s-resize}.cropper-point{width:5px;height:5px;opacity:.75;background-color:#39f}.cropper-point.point-e{top:50%;right:-3px;margin-top:-3px;cursor:e-resize}.cropper-point.point-n{top:-3px;left:50%;margin-left:-3px;cursor:n-resize}.cropper-point.point-w{top:50%;left:-3px;margin-top:-3px;cursor:w-resize}.cropper-point.point-s{bottom:-3px;left:50%;margin-left:-3px;cursor:s-resize}.cropper-point.point-ne{top:-3px;right:-3px;cursor:ne-resize}.cropper-point.point-nw{top:-3px;left:-3px;cursor:nw-resize}.cropper-point.point-sw{bottom:-3px;left:-3px;cursor:sw-resize}.cropper-point.point-se{right:-3px;bottom:-3px;width:20px;height:20px;cursor:se-resize;opacity:1}@media (min-width:768px){.cropper-point.point-se{width:15px;height:15px}}@media (min-width:992px){.cropper-point.point-se{width:10px;height:10px}}@media (min-width:1200px){.cropper-point.point-se{width:5px;height:5px;opacity:.75}}.cropper-point.point-se:before{position:absolute;right:-50%;bottom:-50%;display:block;width:200%;height:200%;content:" ";opacity:0;background-color:#39f}.cropper-invisible{opacity:0}.cropper-bg{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC")}.cropper-hide{position:absolute;display:block;width:0;height:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}
.date_container
{
	margin: 0px;
	margin-right: -1em;
	padding: 0px;
	white-space: nowrap;
	display: inline-block;
}

.date_input
{
	padding-right: 1.5em;
}

.date_button
{
	position: relative;
	left: -1.8em;
	top: 0px;
	width: 1.5em;
	cursor: default;
	color: #fff;
	padding: 2px;
}

.date_selector
{
	font-size: 100%;
	padding: 5px;
	background: #eee;
	border: 1px solid blue;
	cursor: default;
	box-shadow: 4px 4px #222;
	z-index: 20;
	display: block;
	position: absolute;
}

.dialog_win .date_selector
{
	position: relative !important;
}

.date_selector_onbottom
{
	border-radius: 0px 15px 15px 15px;
}

.date_selector_ontop
{
	border-radius: 15px 15px 15px 0px;
}

.date_selector th
{
	font-weight: normal;
}

.date_selector td[id^="date_button"]
{
	text-align: center;
	cursor: pointer;
	border: 0px solid black;
}

.date_selector td[id^="date_button"]:hover
{
	color: white;
}

.date_selector #date_current
{
	width: 100%;
	text-align: center;
}

.date_selector #date_actions
{
	text-align: center;
}

.date_calendar
{
	border-collapse: collapse;
	border: 1px solid #000;
	margin: 0px;
	padding: 0px;
}

.date_selector #date_label
{
	background: #eee;
	font-size: 75%;
	text-align: center;
	border: 1px solid #000;
}

.date_calendar td[id^="date_day"]
{
	padding: 5px;
	text-align: right;
	color: black;
	background: white;
	cursor: pointer;
	border: 1px solid #000;
}

.date_calendar td[id^="date_day"]:hover
{
	background: yellow;
	color: black;
}

.date_calendar td.date_othermonth
{
	background: #ddd;
}

.date_calendar td.date_today
{
	background: blue;
	color: white;
}

.date_calendar td.date_disabled,
.date_calendar td.date_disabled:hover
{
	background: gray;
	color: silver;
	cursor: not-allowed;
}

.date_range
{
	background: white;
	border: 1px solid black;
	height: 13em;
	margin: 0px;
	padding: 0px;
	list-style-type: none;
	overflow-y: scroll;
	overflow-x: hidden;
	text-align: left;
}

.date_range li
{
	padding: 0.1em 0.5em;
}

.date_range li.range_selected
{
	background: blue;
	color: white;
}

.date_range li:hover
{
	background: yellow;
	color: black;
}

.date_range:focus
{
	border: 1px solid black;
}

.ugm_sel_comp0, 
.ugm_sel_comp1
{
  border:1px solid gray;
  border-radius:  5px;
  padding:        5px;
  margin-bottom:  2px;
  margin-left:    5px;
  margin-right:   5px;
  cursor:         pointer;
}

.ugm_sel_comp0
{
  background-color: #F5F7FA;
}

.ugm_sel_comp0 ul
{
	list-style-type: none;
	margin: .25em !important;
	padding-left: 10px !important;
}

.ugm_sel_comp1
{
  background-color: #FFFFFF;
}

.ugm_cel_comp : hover
{
  background-color: #F5F7FA;
  color: #112B54;
}

.fld_grp_srch_match
{
  color: #E64126;
}

.fld_grp_window_btn
{
  padding-left: 3px;
  padding-right: 3px;
  text-align: center;
  border: 1px solid #F5F7FA ! important;
  border-radius: 2px ! important;
  background-color: #F5F7FA;
  color: #112B54;
}

.fld_grp_window_hidestate
{
  display: block;
  overflow: hidden;
  width: 100%;
  height: 1px;
  border: 1px solid #F5F7FA;
  margin-top: 2px;
}

.fld_grp_window_label_inactive
{
  color: #888888;
  font-style: italic;
}

.fld-grp-loading
{
	font-size: 110%;
	font-weight: 700;
	height: 200px;
	min-height: 200px;
}

.field-group-search
{
	padding-bottom: 5px;
}

#field_group_body
{
	height: 400px;
	overflow-y: auto;
}
.small
{
 width: 100px;
}

.round
{
 border-radius: 50%;
}

.square100
{
 width: 100px;
 height: 100px;
}

.rounded
{
 border-radius:25%
}

.fld_img_profile
{
	width: 5em;
	height: 5em;
	border-radius: 50%;
	border:1px solid #112B54;
}

.fld_img_profile_large
{
	width: 10em;
	height: 10em;
	border-radius: 50%;
	border:1px solid #112B54;
}

img.link[src*="calendar"],
img.link[src*="search"]
{
  margin-left: 5px;
}
.popcal, .popcal *
{
  font-family: sans-serif;
/*  font-size: 8pt;*/
}

.popcal
{
  width: auto;
  border: 2px ridge silver;
}

.popcal td
{
  border: 1px solid black;
}

.popcal .caldate
{
  text-align: center;
  background-color: #DDD;
}

.popcal .calgoto
{
  cursor: pointer;
  text-align: center;
  background-color: #DDD;
}

.popcal .calday
{
  cursor: pointer;
  height: 1em;
  width: 1.5em;
  text-align: right;
  padding: 2px 3px;
  background-color: silver;
  color: black;
}

.popcal .calmonth
{
  background-color: #EEE;
  color: black;
}

.popcal .calselected
{
  background-color: #FFF;
  color: black;
  font-weight: bold;
}

.popcal .calhighlight
{
  background-color: yellow;
}

.popcal .caldisabled
{
  background-color: gray;
  color: silver;
}

.popcal .caltoday
{
  font-style: italic;
  background-color: lightgreen;
}

span.popcal
{
  background-color: #f2f2f2;
  border: 1px solid;
  display: inline-block;
  font-weight: 500;
  min-height: 2em;
  padding: 3px;
  vertical-align: middle;
  width: 7em;
}
.popcode
{
  border: 2px ridge silver;
  background-color: #F5F7FA;
  color: #112B54
  overflow: visible;
  padding: 2px;
}

#PopCodeSelect
{
  border: 1px solid black;
  background-color: #F5F7FA;
  color: #112B54
  overflow: visible;
  padding: 2px;
}

#PopCodeSelect div
{
  cursor: pointer;
  background-color: #F5F7FA;
  border: 0px;
  color: #112B54
}

#PopCodeSelect div.highlight
{
  background-color: #F5F7FA;
  border: 1px dashed silver;
}
/*
.popcal, .popcal *
{
  font-family: sans-serif;

}

.popcal
{
  width: auto;
  border: 2px ridge silver;
}

.popcal td
{
  border: 1px solid black;
}

.popcal .caldate
{
  text-align: center;
  background-color: #DDD;
}

.popcal .calgoto
{
  cursor: pointer;
  text-align: center;
  background-color: #DDD;
}

.popcal .calday
{
  cursor: pointer;
  height: 1em;
  width: 1.5em;
  text-align: right;
  padding: 2px 3px;
  background-color: silver;
  color: black;
}

.popcal .calmonth
{
  background-color: #EEE;
  color: black;
}

.popcal .calselected
{
  background-color: #FFF;
  color: black;
  font-weight: bold;
}

.popcal .calhighlight
{
  background-color: yellow;
}

.popcal .caldisabled
{
  background-color: gray;
  color: silver;
}

.popcal .caltoday
{
  font-style: italic;
  background-color: lightgreen;
}

span.popcal
{
  font-weight: 500;
  border: 1px solid;
  background-color: #f2f2f2;
  width: 7em;
  height: 1.18em;
  padding: .1em;
  vertical-align: middle;
  display: inline-block;
}
*/.popcolor, .popcolor *
{
	font-family: sans-serif;
/*	font-size: 9pt;*/
}

.popcolor
{
	border: 2px ridge silver;
  width: auto;
}

.popcolor td
{
	text-align: center;
	border: 1px solid black;
}

.popcolor #title
{
	background-color: #DDD;
}

.popcolor #color
{
	cursor: pointer;
	height: 8px;
	width: 8px;
    font-size: 8px;
	padding: 1px 1px;
	background-color: silver;
	color: black;
}

.popcolor #color.highlight
{
  border-color: yellow;
}
.field_interval
{
	display: block;
	border: 1px solid #112B54;
	background-color: #F5F7FA;
	padding: 5px;
	margin-top: 5px;
}

.field_interval_pattern
{
	display: block;
}

.field_interval_menu
{
	display: inline-block;
	vertical-align: top;
}

.field_interval_settings
{
	display: inline-block;
	vertical-align: top;
}

.field_interval_duration
{
	display: block;
	border-top: 10px solid #F5F7FA;
}

.interval_display
{
	display:inline-block;
	min-width:200px;
	cursor:pointer;
	color: #2D67C5;
	text-decoration: underline;
}

.interval_display:hover
{
}/*
<link rel="stylesheet" type="text/css" href="http://localhost:8080/EG-original.css?ver=2.0">
<link rel="stylesheet" type="text/css" href="http://localhost:8080/EG-upgrade.css?ver=1.0" />
*/

@import url('https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,400,400i,600,600i');

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  -ms-overflow-style: scrollbar;
  -webkit-tap-highlight-color: transparent;
}

@-ms-viewport {
  width: device-width;
}

body {
  font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  padding: 0;
  font-size: 16px;
  line-height: 1.5;
}

::-moz-selection { background: #CCD3DF; color: inherit; text-shadow: none; }
::selection { background: #CCD3DF; color: inherit; text-shadow: none; }

/* Typography */
div.form_table {
  font-size: inherit;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 auto 0.5rem;
  font-family: inherit;
  font-weight: 600;
  line-height: 1.25;
  color: inherit;
}
h1 { font-size: 1.875rem; font-weight: 300; }
h2 { font-size: 1.5rem; font-weight: 400; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
.search_select,
.cel_ugs_secblockhdr { font-weight: 600 !important; }

h1, h2, h3, h4, h5, h6 {
  line-height: 1.25;
}

p {
  line-height: 1.5;
  font-size: 1rem;
}

small,
p.small {
   font-size: 0.875rem;
}

b, strong { font-weight: 600 !important; }

a,
a:visited {
  text-decoration: none;
  color: #2D67C5;
  -webkit-transition: all 0.2s ease-in-out;
  -o-transition: all 0.2s ease-in-out;
  transition: all 0.2s ease-in-out;
}

a:focus,
a:active,
a:hover {
  outline: none;
}

a:hover,
a:active {
  color: #193F7A;
}

/* Grid */
.col-6 {
  width: 50%;
  display: -webkit-inline-flex;
  display: -ms-inline-flex;
  display: inline-flex;
}

table.col-6 {
  float: right;
  display: table;
}

/* LOGIN */
.page-login .page-content {
  width: calc(250px + 4rem);
  text-align: center;
  float: left;
  margin-left: calc(50% - 157px);
  margin-top: 3rem;
  background-color: #fff;
  border-radius: 6px;
  -webkit-box-shadow: 0 2px 4px 0 rgba(0,0,0,0.07), 0 10px 25px 0 rgba(49,105,193,0.1);
  box-shadow: 0 2px 4px 0 rgba(0,0,0,0.07), 0 10px 25px 0 rgba(49,105,193,0.1);
}

.page-login .app-header {
  padding-bottom: 25px;
  padding-left: 25px;
}

.page-login .page_login input[type=text],
.page-login .page_login input[type=password] {
  width: 250px;
}

.page-login table.page_login {
  width: 100%;
}

table.page_login tr td {
  display: block;
  text-align: left !important;
}

.page-login .page_login input[type=submit],
.page-login .page_login input[type=submit]:active {
  margin-top: 1rem;
  color: #fff;
  background-color: #0DB14B;
  border-color: #0DB14B !important;
  width: 100%;
}

.page-login .page_login input[type=submit]:hover,
.page-login .page_login input[type=submit]:focus {
  background-color: #07632A;
  border-color: #07632A !important;
}

/*.page-login .page_login input[type=button] {
  margin-left: 100px;
} */

/* APP HEADER */
.app-header {
  background-color: #0D2242;
  border-bottom: 1px solid #193F7A;
  color: #9DACC4;
}

.app-header td.logo {
  padding-top: 10px;
}

.app-header img.logo {
  height: auto;
  margin-left: 10px;
  margin-top: 10px;
}

.page-header hr {
  display: none;
}

/* Header Navigation */
td.navigation {
  padding-right: 1.5rem;
  padding-bottom: 0.5rem;
  font-size: 0.875rem;

}

.app-navigation > .dropmenu {
  border: none !important;
}

.app-header td.navigation table {

}

.app-header td.navigation table td {
  padding-bottom: 0;
}

.app-header td.navigation table a {
  color: #9DACC4;
  text-decoration: none;
}

.app-header td.navigation table a:hover {
  color: #fcfcfc;
}

.app-header td.navigation select {
  width: auto;
}

/* APP NAVIGATION */
#dropmenu_frame {
  padding-left: 1rem;
  border-bottom: 1px solid #193F7A !important;
}

.app-navigation {
  background-color: #112B54;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
  height: auto !important;
}

/* Navigation Menu */
.app-navigation > .dropmenu, .app-navigation > .dropmenu li {
  background-color: transparent;
}

.app-navigation > .dropmenu {
  border: none;
}

#dropmenu_list li {
  border-width: 0px !important;
}

.app-navigation > .dropmenu li {
  border: none;
  color: #F5F7FA;
}

.app-navigation .dropmenu .title,
.app-navigation .dropmenu .title:active,
.app-navigation .dropmenu .title:visited {
  font-size: 0.938rem !important;
  letter-spacing: 0px !important;
  padding: 7px 20px !important;
  color: #F5F7FA;
  background-color: #1A3F7A;
  border-radius: 30px;
  margin-right: 10px;
  text-transform: uppercase;
  -webkit-transition: all 0.2s ease-in-out;
  -o-transition: all 0.2s ease-in-out;
  transition: all 0.2s ease-in-out;
  cursor: pointer;
}
.app-navigation .dropmenu .title:hover,
.app-navigation .dropmenu .title:focus {
  color: #FCFCFC;
  background-color: #2D67C5 !important;
}

/* Submenu */
.app-navigation > .dropmenu ul {
  border: none !important;
  -webkit-box-shadow: 0 2px 4px 0 rgba(0,0,0,0.07), 0 10px 25px 0 rgba(49,105,193,0.1);
  box-shadow: 0 2px 4px 0 rgba(0,0,0,0.07), 0 10px 25px 0 rgba(49,105,193,0.1);
  border-radius: 5px;
  overflow: hidden;
}

.app-navigation > .dropmenu ul.submenu,
#dropmenu_list ul.submenu li {
  background-color: #ffffff;
  min-width: 200px;
}

#dropmenu_list ul.submenu li:not(:last-child) {
  border-bottom: 1px solid #DADFE6 !important;
  border-bottom-width: 1px !important
}

.app-navigation > .dropmenu ul.submenu a,
.app-navigation > .dropmenu ul.submenu a:active,
.app-navigation > .dropmenu ul.submenu a:visited {
  text-decoration: none;
  padding: 10px 20px;
  color: #626B7A;
  background-color: transparent;
  border-radius: 0px;
  margin-right: 0px;
  font-weight: 400;
  text-transform: capitalize;
  font-size: 15px;
  letter-spacing: 0px;
}

.app-navigation > .dropmenu ul.submenu a:hover,
.app-navigation > .dropmenu ul.submenu a:focus {
  color: #2D67C5;
  background-color: #F5F7FA;
  font-weight: 600;
}

/* Left Col: Action Menu */
.page-actionmenu {
    background-color: #0D2242;
    color: #9DACC4;
    padding-left: 0;
    width: 11em !important;
}

.cell-actionmenu ul {
  width: 100%;
}

ul.actionmenu li div#title {
  letter-spacing: 0px !important;
  padding: 5px 15px !important;
  border-top-width: 0px !important;
  border-bottom: 1px solid #112B54 !important;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  margin-bottom: 5px;
}

ul.actionmenu li div#links {
  margin-bottom: 30px;
  padding: 0px !important;
  background-color: transparent;
  color: inherit;
}

.cell-actionmenu ul {
  padding: 0;
  margin: 0px;
}

.cell-actionmenu a {
  color: #9DACC4;
}

ul.actionmenu li div#links li {
  white-space: normal;
  padding: 0;
  margin: 2px auto;
}

ul.actionmenu li div#links li:hover {
  background-color: transparent;
  color: inherit;
}

ul.actionmenu li div#links a {
  padding: 2px 15px;
}

ul.actionmenu li div#links a:hover {
  background-color: #2D67C5;
  color: #FCFCFC;
}

ul.actionmenu ul li img {
  margin-right: -10px;
  margin-left: 10px;
/*  z-index: 9999; */
  position: relative;
}

/* ul.actionmenu #Widgets_UL li:last-child:after {
  content: "Remove";
} */

/* Page Content */
.page-content {
  padding: 2rem;
}

.page-content .page-title {
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
  padding: 0;
  margin-bottom: 0.5rem;
  background-color: transparent;
}

.page-content .page-title .sep {
  color: #626B7A;
  padding: 0 .5rem;
  text-align: center;
}

.page-content .page-bookmark {
  line-height: 1.5;
  padding-left: 0;
  min-height: auto;
  margin-bottom: 1.5rem;
  color: #818DA1;
}

.page-content .page-data {
  padding: 0;
}

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
  /* IE10+ CSS styles go here */
  .page-data table th,
  .dialog_win table th {
    text-align: left;
  }
}

/* Search */
#search_header {
  display: none;
}

.search_cell #cell_search_filter_form {
  padding: 0;
}

#cell_search_filter_form table td:last-child {
/*  display: none; */
}

.search_cell #cell_search_count {
  margin: 1rem auto 2rem;
}

.search_cell #cell_search_count input,
#cell_reference_count input {
  background-color: transparent;
  border: none;
  padding: 0 0 4px;
}

.bf_search {
  padding-left: 0.25rem;
  background-color: rgba(161, 190, 230, 0.15);
  border-radius: 2rem;
  border: 1px solid rgba(45, 103, 197, 0.0);
  -webkit-transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
  transition: border-color .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
  -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
  transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
  transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
  color: #818DA1;
}

.bf_search input,
.bf_search img {
  background-color: transparent;
  font-size: 16px;
  font-weight: 400;
}

.bf_search input::placeholder {
  font-weight: 400;
}

.bf_search input:focus::placeholder {
  font-weight: 400;
  opacity: 0.5;
}

.bf_search:hover {
  background-color: #FCFCFC;
  border: 1px solid rgba(157, 172, 196, 1.0);
}

.bf_search input:focus < div.bf_search {
  background-color: #FCFCFC;
  border: 1px solid rgba(45, 103, 197, 1.0);
  -webkit-box-shadow: 0 2px 4px 0 rgba(0,0,0,0.07), 0 10px 25px 0 rgba(49,105,193,0.1);
  box-shadow: 0 2px 4px 0 rgba(0,0,0,0.07), 0 10px 25px 0 rgba(49,105,193,0.1);
}


.bf_search input:active,
.bf_search img:active,
.bf_search input:focus,
.bf_search img:focus {
  background-color: transparent;
  border: none;
  -webkit-box-shadow: none;
  box-shadow: none;
  border-radius: 0;
}

.sort {
  font-style: normal;
}

.sort::after {
  margin-left: 0.25rem;
}

/* Grid */
.w3-col.s12 { width: 100%; }

/* Tables */
.search_cell_header_row {
  background-color: transparent;
}

.search_cell_header_row td {
  padding-bottom: 0.75rem !important;
  color: #112B54;
  border: none !important;
  font-weight: 600 !important;
}

.page-data table th,
.dialog_win table th {
  background-color: transparent;
  color: #112B54;
  border: none !important;
  font-weight: 600;
  white-space: nowrap;
  padding: 0px;
  /* height: auto; */
}

#cell_search_filter_form .right {
  vertical-align: middle;
}

/* div.form_table td {
  padding: 2px 2px 1rem;
} */

/* .page-data th,
.dialog_screen td {
  padding: 0.75rem !important;
  vertical-align: top;
  border-top: 1px solid #DADFE6;
}

.dialog_screen .table tr:first-child td {
  border-top: none;
} */

/* Main Content */
#container.form_table {
  overflow: visible;
}

#cell_credituser table:not(.tab_bar),
#cell_credituser table td:not(.tab_bar) {
  border: none;
}

.page-data .class3 {
  margin: 1.5rem auto;
}

/* .page-data .class2 table {
  border-radius: 0.375rem;
  border: none;
  background-color: white;
  -webkit-box-shadow: 0 5px 15px 0 rgba(0,0,0,0.07), 0 15px 35px 0 rgba(49,105,193,0.10);
  box-shadow: 0 5px 15px 0 rgba(0,0,0,0.07), 0 15px 35px 0 rgba(49,105,193,0.10);
  overflow: hidden;
}

.page-data .class2 table table {
  background-color: transparent;
  -webkit-box-shadow: none;
  box-shadow: none;
  border-radius: 0;
} */

/* .page-data .class2 table {
  margin-top: 1.25rem;
  margin-bottom: 2rem;
} */

.page-data .class2 table td {
  /* padding: 2rem !important;
  padding-top: 1rem !important;
  padding-bottom: 1rem !important; */
}

.page-data .class2 table table td {
  /* padding: 0 1rem !important; */
}

.page-data .h0 {
  background-color: #F5F7FA;
}

.page-data .h1 {
  background-color: white;
}

.page-data .class2 table td img.link {
  padding: 0;
}

#UsrImageURL_0_img,
.fld_img_profile {
  background-color: #2D67C4;
  background-image: url('site/images/scheme/avatar-bg.png');
  background-position: center center;
  background-repeat: no-repeat;
  background-size: contain;
  border-radius: 50%;
  overflow: hidden;
  border: none;
}

#header_profile_image img {
  border-radius: 50%;
  width: 64px !important;
  height: 64px;
  overflow: hidden;
  margin-top: 0.5rem;
}

/* Tabs */
table.tab_bar {
  width: 100%;
  margin-bottom: 1.5rem;
  padding: 0;
}

table.tab_bar td {
  width: auto;
}

table.tab_bar tr td {
  padding: 0px 3px;
}

table.tab_bar tr td div {
  border-radius: 5px 5px 0px 0px;
}

table.tab_bar tr td div {
  letter-spacing: 0px;
  padding: 5px 2px;
  font-size: 15px;
  width: 100%;
}

.tab_bar tr td div.tab0,
.tab_bar tr td div.tab1 {
  border-bottom: none;
}

.tab_bar .tab1 {
  font-weight: 600;
  cursor: default;
}

.tab_bar .tab0 {
  color: #818DA1;
  -webkit-transition: all 0.2s ease-in-out;
  -o-transition: all 0.2s ease-in-out;
  transition: all 0.2s ease-in-out;
  border: 1px solid #CCD3DF;
  border-bottom-width: 0px;
}

.tab_bar .tab0:hover {
  color: #2D67C5;
  background-color: #fcfcfc;
}

/* Footer */
.page-footer { display: none; }

div.form_table #brick {
  margin-bottom: 2rem;
}

/* Form Fields */
input, select, textarea, span.popcal, span.link {
  font-family: inherit;
  color: #112B54;
  background-color: #fcfcfc;
  font-weight: 400;
  border-color: #DADFE6;
  border-radius: 0.25rem;
  padding-top: calc(0.5rem + 1px);
  padding-bottom: calc(0.5rem + 1px);
  padding-left: calc(0.75rem + 1px);
  padding-right: calc(0.75rem + 1px);
  transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
  outline: none;
  box-sizing: border-box;
}

.intellisearch {
  border-color: #DADFE6;
  margin: 0;
  margin-right: 10px;
  width: 30%;
}

select.intellisearch {
  width: 15%;
  vertical-align: top !important;
}

#Page_Users_ShowInvite select {
  width: 350px;
}

input:hover, select:hover, textarea:hover, span.link:hover {
  border-color: #9DACC4;
}

input:focus, select:focus, textarea:focus, span.link:focus {
  color: #0D2242;
  border-color: #2D67C5;
  -webkit-box-shadow: 0 2px 4px 0 rgba(0,0,0,0.07), 0 10px 25px 0 rgba(49,105,193,0.1);
  box-shadow: 0 2px 4px 0 rgba(0,0,0,0.07), 0 10px 25px 0 rgba(49,105,193,0.1);
}

input::-webkit-input-placeholder,
select::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
  color: #818DA1;
  font-weight: 300;
  /* display: block; */
  opacity: 1;
  /* z-index: 50000; */
}

input::-moz-placeholder,
select::-moz-placeholder,
textarea::-moz-placeholder {
  color: #818DA1;
  font-weight: 300;
  /* display: block; */
  opacity: 1;
  /* z-index: 50000; */
}

input:-ms-input-placeholder,
select:-ms-input-placeholder,
textarea:-ms-input-placeholder {
  color: #818DA1;
  font-weight: 300;
  /* display: block; */
  opacity: 1;
  /* z-index: 50000; */
}

input::placeholder,
select::placeholder,
textarea::placeholder {
  color: #818DA1;
  font-weight: 300;
  /* display: block; */
  opacity: 1;
  /* z-index: 50000; */
}

select {
  height: calc(2.25rem + 4px);
  vertical-align: middle;
  padding: .375rem 1.75rem .375rem .75rem !important;
  background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23343a40' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E") no-repeat right .75rem center;
  background-size: 8px 10px;
  -webkit-appearance: none;
  -moz-appearance: none;
  -ms-appearance: none;
  appearance: none;
}

select::-ms-expand {
  display: none;
}

.app-header select {
  height: auto;
}

select.combolist {
  height: auto;
}

input[type=checkbox]:hover, input[type=radio]:hover,
input[type=checkbox]:focus, input[type=radio]:focus,
input[type=checkbox]:active, input[type=radio]:active {
  box-shadow: none;
  -webkit-box-shadow: none;
}

input:disabled,
input[readonly],
select:disabled,
select[readonly],
textarea:disabled,
textarea[readonly] {
  background-color: #E1E6ED;
}

input[type=button]:disabled {
  background-color: #9DACC4;
  color: #fcfcfc;
  cursor: not-allowed;
  border-color: #9DACC4 !important;
}

input[type=button]:disabled:hover {
  background-color: #9DACC4;
  color: #fcfcfc;
  cursor: not-allowed;
  border-color: #9DACC4 !important;
}

/* label {
  position: relative;
  display: block;
  padding-left: 1.25rem;
} */

.required {
  font-weight: 600;
}

span.popcal {
  width: 10%;
}

/* Buttons */
.btn {
  border-radius: 5rem;
  text-transform: uppercase;
  padding-left: 1rem;
  padding-right: 1rem;
  display: inline-block;
}

.btn + .btn,
input[type=button] + input[type=button] {
  margin-left: 0.5rem;
}

.btn-primary {
  background-color: #0DB14B;
  border-color: #0DB14B;
  color: #fcfcfc;
  text-transform: uppercase;
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: #07632A;
  border-color: #07632A;
  color: #fcfcfc;
}

input[type=button],
input[type=submit],
.btn,
.search_cell .right a,
input[type=button]:active,
input[type=submit]:active,
.btn:active,
.search_cell .right a:active {
  font-family: inherit;
  padding: 0.625rem 1rem;
  -ms-align-items: center;
  align-items: center;
  justify-content: center;
  border-radius: 1.5rem !important;
  /* border: 2px solid transparent; */
  cursor: pointer;
  outline: none;
  box-shadow: none;
  text-decoration: none;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: middle;
  position: relative;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1;
  /* height: auto;
  width: auto; */
  box-sizing: border-box;
  -webkit-transition: all 0.2s ease-in-out;
  -o-transition: all 0.2s ease-in-out;
  transition: all 0.2s ease-in-out;
  -webkit-appearance: none;
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;

  /* secondary class styles */
  background-color: transparent;
  border: 2px solid #2D67C5 !important;
  color: #2D67C5;
}

input[type=button]:hover,
input[type=submit]:hover,
.btn:hover,
.search_cell .right a:hover,
input[type=button]:focus,
input[type=submit]:focus,
.btn:focus,
.search_cell .right a:focus {
  background-color: #2D67C5;
  color: #fcfcfc;
}

/* .btn-secondary,
.btn-secondary:active,
.search_cell input[type=submit],
.search_cell input[type=submit]:active,
.search_cell .right a,
.search_cell .right a:active,
.dialog_status input[type=button],
.dialog_status input[type=button]:active,
.page-data table th.navigation input[type=button],
.page-data table th.navigation input[type=button]:active {
  background-color: transparent;
  border: 2px solid #2D67C5 !important;
  color: #2D67C5;
} */

/* .btn-secondary:hover,
.btn-secondary:focus,
.search_cell input[type=submit]:hover,
.search_cell input[type=submit]:focus,
.search_cell .right a:hover,
.search_cell .right a:focus,
.dialog_status input[type=button]:hover,
.dialog_status input[type=button]:focus,
.page-data table th.navigation input[type=button]:hover,
.page-data table th.navigation input[type=button]:focus {
  background-color: #2D67C5;
  color: #fcfcfc;
} */

.btn,
.search_cell .right a,
.btn:active,
.search_cell .right a:active {
  padding-top: calc(0.625rem - 2px);
  padding-bottom: calc(0.625rem - 2px);
  padding-left: calc(1rem - 2px);
  padding-right: calc(1rem - 2px);
}

img.link {
  padding: 5px;
  box-sizing: border-box;
}

.navigation img.link {
  padding: 10px 4px;
}

.navigation > img.link + img.link {
  margin-right: -14px;
}

a.search_select,
a.search_select:active {

}

a.search_select:hover,
a.search_select:focus {
  background: none;
  color: #193F7A;
  padding: 0;
  border: none;
}

/* Text Colors */
/*.text-primary {
  color: #2D67C5 !important;
}*/

.text-muted,
.dateform,
.UsrTitleID a,
.inputhelp {
  color: #818DA1;
}

#page_login_error {
  color: #E54126;
}




/* .img-sort {
  margin-left: 0.5rem;
}

.page-data .table-content {
  margin: 1rem;
  margin-right: 0;
  margin-bottom: 0.75rem;
} */

.UsrTitleID {
  font-weight: normal !important;
}

.UsrTitleID a {

}

/**/
.form {
  background-color: #E1E6ED;
  border-top: 1px solid #CCD3DF;
}

.form-group label {
  font-weight: 600;
}

/* Badges and Pills */
.badge {
  background-color: #2D67C5;
  border-radius: 3px;
  padding: 0.25rem 0.5rem;
  font-size: 14px;
  font-weight: 400;
  color: #fcfcfc;
  margin-left: 0;
}

a.badge:hover {
  color: #fcfcfc;
}

.badge + .badge {
  margin-left: 0.25rem;
}

.badge.pill {
  border-radius: 2rem;
  padding: 0.25rem 0.625rem;
}

.badge.primary {
  background-color: #2D67C5;
}

.badge.info {
  background-color: #00C0F3;
}

.badge.danger {
  background-color: #E54126;
}

.badge.warning {
  background-color: #FAA61A;
}

.badge.success {
  background-color: #8DC63F;
}

.badge.accent {
  background-color: #6873E9;
}

.badge.muted {
  background-color: #9DACC4;
}

/* Pagination */
table.paging_bar {
  display: inline-block;
  margin: 0rem auto 2rem;
  float: right;
}

.widget table.paging_bar {
  margin: 0 auto;
}

table.paging_bar td {
  color: #9DACC4;
  text-align: center;
}

body .widget table.paging_bar td {
  padding-top: 0;
  padding-bottom: 0;
}

table.paging_bar td:first-child,
table.paging_bar td:last-child {
  display: none;
}

table.paging_bar td input[type=text] {
  width: 40%;
  margin-left: 0.25rem;
  margin-right: 0.25rem;
}

table.paging_bar div#paging_button input {
  border-radius: 30px;
  width: 40px;
  height: 40px;
  background-color: #fcfcfc;
  -webkit-transition: all 0.2s ease-in-out;
  -o-transition: all 0.2s ease-in-out;
  transition: all 0.2s ease-in-out;
  padding: 0.5rem;
}

table.paging_bar div#paging_button input:hover {
  background-color: #EDF0F5;
  -webkit-box-shadow: 0 5px 15px 0 rgba(0,0,0,0.07), 0 15px 35px 0 rgba(49,105,193,0.10);
  box-shadow: 0 5px 15px 0 rgba(0,0,0,0.07), 0 15px 35px 0 rgba(49,105,193,0.10);
}


/* Tags */
.tag {
  background-color: #E1E6ED;
  border-radius: 3rem;
  padding: 0.5rem 1rem 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 400;
  color: #112B54;
  float: left;
}

.tag {
  margin-right: 0.25rem;
  margin-bottom: 0.25em;
}

.tag a, .tag button {
  cursor: pointer;
  -webkit-transition: all 0.2s ease-in-out;
  -o-transition: all 0.2s ease-in-out;
  transition: all 0.2s ease-in-out;
  margin-right: 0.5rem;
  margin-left: 0.25rem;
}

table.tag {
  width: auto !important;
}

table.tag td {
  padding: 0.75rem !important;
  vertical-align: middle !important;
}

table.tag td:first-child {
  padding-right: 0 !important;
}

table.tag td:last-child {
  padding-right: 1rem !important;
}

table.tag td.form_cell_label {
  width: auto;
  padding-left: 0.25rem !important;
  padding-right: 0.25rem !important;
}

th.form_cell_label {
  font-size: 1.25em;
  padding-left: 0;
  letter-spacing: 0;
}

/* Modals */
div.dialog_screen,
div.busy_screen,
.popupwindow {
  background-image: none !important;
  background-color: rgba(17,43,84,0.9);
}

div.dialog_win,
.popupdiv {
  background-color: #F5F7FA;
  border: none !important;
  border-radius: 0.5rem;
  -webkit-box-shadow: 0 5px 15px 0 rgba(0,0,0,0.07), 0 15px 35px 0 rgba(49,105,193,0.10);
  box-shadow: 0 5px 15px 0 rgba(0,0,0,0.07), 0 15px 35px 0 rgba(49,105,193,0.10);
  height: auto !important;
  padding: 0;
}

.popupdiv {
  min-height: 50px;
}

div.dialog_header {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: start;
  -ms-flex-align: start;
  align-items: flex-start;
  -webkit-box-pack: justify;
  -ms-flex-pack: justify;
  justify-content: space-between;
  padding: 2rem;
  border: none !important;
  border-top-left-radius: .3rem;
  border-top-right-radius: .3rem;
  background-color: transparent !important;
  height: auto;
}

div.dialog_hdr_title,
.popupdiv #predelete_body table th {
  font-size: 1.25rem;
  margin: 0 auto;
  font-family: inherit;
  font-weight: 600;
  line-height: 1.25;
  color: inherit;
}

.popupdiv table {
  background-color: transparent;
}

.popupdiv #predelete_body table th {
  border: none;
  background-color: transparent;
  height: auto;
}

body .popupdiv #predelete_body table.popup_form {
  background-color: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  font-weight: inherit;
  margin-top: 2rem;
}

img#1_img_minimize {
  display: none;
}

.dialog_header + div {
  padding: 0 2rem 2rem;
}

div.dialog_footer {
  padding: 1rem 2rem;
  border-top: 1px solid #DADFE6;
  background-color: transparent !important;
  text-align: right;
  height: auto;
  position: relative;
}

div.dialog_status {
  position: relative;
  text-align: right;
}

div.dialog_status center {
  text-align: right;
}

div.dialog_win #ToDoListDiv select {
  width: 15%;
}

div.dialog_win #ToDoListDiv th {
  padding-bottom: 1rem;
}

div.dialog_win #ToDoListDiv tr td:first-child {
  width: 100px;
}

div.dialog_win #ToDoListDiv tr td:last-child {
  width: 120px;
}

/* div.dialog_win #ToDoListDiv tr td:nth-child(2), */
/* div.dialog_win #ToDoListDiv tr th:nth-child(2) { */
  /* display: none; */
/* } */

div.dialog_win #ToDoListDiv tr td span {
  margin-right: 1rem;
  color: #6873E9;
}

#events_detail_form_tab_1 table {
  width: 100% !important;
}

#events_detail_form_tab_1 table,
#events_detail_form_tab_1 div.form_table td {
  border: none;
}

/* ALERTS */
/* Inline */
.error-message {
  background-color: #E54126;
  color: #fcfcfc;
  font-weight: 600;
  line-height: 1.5;
  padding: .75rem 1.25rem;
}

.help-message {
  background-color: #00C0F3;
  color: #fcfcfc;
  font-size: inherit;
  font-weight: 600;
  line-height: 1.5;
  padding: .75rem 1.25rem;
  text-align: center;
  margin: 0 auto;
  border: none;
}

/* Task Style */
body #grpinfinviteurl {
  font-size: 1rem;
  background-color: #fcfcfc;
  color: #0D2242;
  border: 1px solid #DADFE6;
  border-radius: .375rem;
  padding: .75rem 1.25rem;
  box-shadow: inset 5px 0px 0px #E54126;
  -webkit-box-shadow: inset 5px 0px 0px #E54126;
}

div.form_instructions {
  font-size: 1rem;
  color: #0D2242;
  border-bottom: 1px solid #DADFE6;
  border: none;
}

/* div.form_instructions,
body #grpinfinviteurl {
  font-size: 1rem;
  background-color: #fcfcfc;
  color: #0D2242;
  border: 1px solid #DADFE6;
  border-radius: .375rem;
  padding: .75rem 1.25rem;
  box-shadow: inset 5px 0px 0px #E54126;
  -webkit-box-shadow: inset 5px 0px 0px #E54126;
} */

body #grpinfinviteurl {
  box-shadow: none;
  -webkit-box-shadow: none;
}

/* div.form_instructions {
  margin-bottom: 1.5rem;
} */

/* Toasts */
.information-box {
  border-radius: 0.375rem;
  border: none;
  -webkit-box-shadow: 0 4px 16px 0 rgba(0,0,0,0.75), 0 16px 32px 0 rgba(49,105,193,0.25);
  box-shadow: 0 4px 16px 0 rgba(0,0,0,0.75), 0 16px 32px 0 rgba(49,105,193,0.25);
  max-width: 30rem;
  background-color: #fcfcfc;
  color: #112B54;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  padding: .75rem 1.25rem;
  top: 1rem;
}

/* SPECIFIC SITE STYLES */
/* Lesson Builder */
#drag_container div.drag:last-child {
  margin-bottom: 0;
}

div#dragBufferTop {
  border: none
}

div#dragBufferBottom {
  -webkit-box-shadow: none;
  box-shadow: none;
  background-color: transparent !important;
}

div.drag {
  padding: 1.25rem 1.875rem;
  border-radius: 0.375rem;
  -webkit-box-shadow: 0 2px 6px 0 rgba(0,0,0,.07), 0 8px 24px 0 rgba(49,105,193,.1);
  box-shadow: 0 2px 6px 0 rgba(0,0,0,.07), 0 8px 24px 0 rgba(49,105,193,.1);
  background-color: #fff;
  margin-bottom: 0.5rem;
  border: 1px solid #DADFE6;
}

body div.drag img {
  height: auto;
}

/* Dashboard Widgets */
#widgets_left .form_cell,
#widgets_right .form_cell {

}

#widgets_left .widget,
#widgets_right .widget,
#TODO {
  border-radius: .375rem;
  background-color: #fff;
  -webkit-box-shadow: 0 5px 15px 0 rgba(0,0,0,.07), 0 15px 35px 0 rgba(49,105,193,.1);
  box-shadow: 0 5px 15px 0 rgba(0,0,0,.07), 0 15px 35px 0 rgba(49,105,193,.1);
  background-clip: border-box;
  margin-bottom: 1rem;
  overflow: hidden;
}

#TODO {
  margin-bottom: calc(1rem + 10px);
}

#widgets_left .widget .cell-title,
#widgets_right .widget .cell-title,
#TODO .cell-title,
.cell-curriculagroupmembership .cell-title,
.cell-curricularolemembership .cell-title {
  background-image: none !important;
  background-color: transparent;
  border-radius: calc(.25rem - 1px) calc(.25rem - 1px) 0 0;
  padding: 1rem 2rem;
  font-size: 1.5rem;
  line-height: 1.5;
  font-weight: 400;
  color: #112B54;
  margin-bottom: 0;
}

.cell-curriculagroupmembership .cell-title,
.cell-curricularolemembership .cell-title {
  padding-left: 0;
  padding-right: 0;
}

#widgets_left .cell-title > span,
#widgets_left .cell-title .cell-actions,
#widgets_right .cell-title > span,
#widgets_right .cell-title .cell-actions,
#TODO .cell-title > span,
#TODO .cell-title .cell-actions,
.cell-curriculagroupmembership .cell-title > span,
.cell-curricularolemembership .cell-title > span {
  background-color: transparent;
  padding: 0;
}

#widgets_left .cell-title a,
#widgets_right .cell-title a,
#TODO .cell-title a,
.cell-curriculagroupmembership .cell-title {
  background-color: transparent;
}

.widget .form_cell_header,
#TODO .widget .form_cell_header {
  background-color: #fff;
}

#widgets_left .cell-body,
#widgets_right .cell-body,
#TODO .cell-body {
  border-top: 1px solid #DADFE6;
  padding: 0.5rem 0 2rem;
  margin: 0 2rem;
}

.widget div.form_table td,
.widget div.form_table th,
#TODO #ToDoListDiv td,
#TODO #ToDoListDiv th {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

#TODO .cell-body th a {
  background-color: transparent;
  color: inherit;
}

/* Sites */
.ugm_sel_comp0 {
  background-color: #fff;
}
.ugm_sel_comp0, .ugm_sel_comp1 {
  border-radius: 0.375rem;
  border: 1px solid #DADFE6;
  margin: 0 auto 0.25rem;
}

/* Completion Status */
body #Page_Status_PrimaryHeader table tr th {
  color: inherit !important;
  font-weight: 600 !important;
  font-size: 1.25rem !important;
}

body table.page_status_list tr td {
  font-size: 1rem;
  color: inherit;
  font-weight: 600;
}

#Page_Status_CompanyList table td,
#Page_Status_ConnectionList table td,
#Page_Status_MembershipList table td,
#Page_Status_RoleList table td,
#Page_Status_UserList table td {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

#Page_Status_CompanyList table td:first-child,
#Page_Status_ConnectionList table td:first-child,
#Page_Status_MembershipList table td:first-child,
#Page_Status_RoleList table td:first-child,
#Page_Status_UserList table td:first-child,
#Page_Status_CompanyList table tr th:first-child,
#Page_Status_ConnectionList table tr th:first-child,
#Page_Status_MembershipList table tr th:first-child,
#Page_Status_RoleList table tr th:first-child,
#Page_Status_UserList table tr th:first-child,
table.page_status_list tr td:first-child {
  padding-left: 0.75rem;
}

body .completion_section_header,
body .completion_section_header p {
  font-size: 1.25rem;
  color: inherit;
  font-weight: 600;
}

body .list_row {
  -webkit-transition: all 0.2s ease-in-out;
  -o-transition: all 0.2s ease-in-out;
  transition: all 0.2s ease-in-out;
}

body .list_row:hover {
  background-color: #fff !important;
  -webkit-box-shadow:inset 0 0 0 1px #2D67C5;
  box-shadow:inset 0 0 0 1px #2D67C5;
}

body a.list_value:hover {
  background-color: #DADFE6;
  border-radius: 0.375rem;
}

body .asn {
  border-top: none;
  border-bottom: 1px solid #DADFE6;
  background-color: #fcfcfc;
  font-weight: 600;
  font-size: 1.125rem;
  padding: 0.75rem 0.25rem !important;
}

body img.skittle {
  height: auto;
}

/* HIERARCHY VIEW */
#group_tree legend {
  font-weight: 600;
  font-size: 1.125rem;
  text-transform: uppercase;
  margin-left: 0.6rem;
}

#group_tree fieldset {
  border: 1px solid #DADFE6;
  border-radius: 0.25rem;
  padding: 1rem 1rem 1rem 0.35rem;
}

#group_tree ul.tree li {
  font-weight: 600;
  padding-left: 0.65rem;
}

#group_tree ul.tree li > ul.tree li {
  font-weight: 400;
}

#group_tree ul.tree li > ul.tree li:before {
  content: "\21B3";
  color: #818DA1;
  padding-right: 0.25rem;
}

.page-credit .search_cell .search_buttons_top {
  display: none;
}

#cell_curriculumgroupmembership_container {
  max-width: 100% !important;
}

/* Printable Badge */
#BADGE {
  border: 1px solid #EDF0F5;
  border-radius: 0;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

#PUNCH {
  border: 1px dashed #EDF0F5;
  margin-bottom: 0.175in;
}

#ID_IMG {
  border: 1px solid #EDF0F5;
}

#ID_NAME {
  margin-bottom: 0.05in;
  color: #112B54;
}

#ID_COMP {
  font-size: 1.125em;
  margin-bottom: 0.25in;
  color: #9DACC4;
}

#QR_CODE img {
  border: 1px solid #EDF0F5;
  background-color: #fff;
}

#PROVIDER {
  font-weight: 600;
  color: #2D67C5;
}

/* padding: 2rem!important; may need to move to an interior div or table */
table.page_login
{
  width: 500px;
}

table.page_login,
table.page_login tr td
{
  padding: 3px 3px 3px 0px;
}
.app-navigation
{
  background-color: #0D2242;
}

/* UL */
.app-navigation > .dropmenu
{
  border: 1px solid gray;
  width: 100%;
}

/* UL & LI */
.app-navigation > .dropmenu,
.app-navigation > .dropmenu li
{
  background-color: #0D2242;
  float: left;
  list-style: none;
  margin: 0px;
  padding: 0px;
}

/* ALL LIs */
.app-navigation > .dropmenu li
{
  border: 1px solid gray;
  color: #9DACC4;
  display: block;
}

/* ALL LINKS */
.app-navigation .dropmenu .title
{
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 4px 20px;
}

.app-navigation .dropmenu .title:hover
{
  background-color: #3678B0;
  color: #FFFFFF;
}

/* SUB LIST */
.app-navigation > .dropmenu ul
{
  z-index: 110;
  position: absolute;
  border: 2px outset;
  margin: 0px;
  padding: 0px;
}

.app-navigation > .dropmenu ul > li
{
  float: none;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 1px;
}

.app-navigation > .dropmenu ul > li a,
.app-navigation > .dropmenu ul > li a:visited,
.app-navigation > .dropmenu ul > li a:active
{
  color: #9DACC4;
  display: block;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 4px 20px;
  text-decoration: none;
}

.app-navigation > .dropmenu ul > li a:hover
{
  background-color: #3678B0;
  color: #FFFFFF;
}

.app-header
{
  margin: 0px;
  padding: 0px;
}

.app-header > table
{
}

.app-header > table .logo
{
}

.app-header > table .logo *
{
  font-size: larger;
  font-weight: 700;
  text-decoration: none;
}

.app-header > table .navigation td
{
  padding: 5px;
  text-align: right;
}

.cell-footer
{
}

.cell-footer table
{
}

.cell-footer table td
{
  margin: auto;
  padding: 3px;
  border: 0px solid black;
  text-align: center;
}

.cell-footer iframe
{
  height: 300px;
  width: 75%;
}
</style>
<script>var OSI_var = true;

var Constants = {};

Constants.KeyCode =
{
	BackSpace: 8,
	Tab: 9,
	Enter: 13,
	Shift: 16,
	Escape: 27,
	SpaceBar: 32,
	LeftArrow: 37,
	UpArrow: 38,
	RightArrow: 39,
	DownArrow: 40,
	Insert: 45
};

window.onerror = function( amsg, aurl, aline, acolumn, aerrorObj )
{
  if (amsg.indexOf('Script error.') > -1 && aline == 0) {
	return;
  }
  
  alert(
    "Scripting Error..." +
    "\nMessage: " + amsg +
    "\nURL: " + aurl +
    "\nLine: " + aline + 
	"\n Column: " + acolumn + 
	"\n StackTrace: "+  aerrorObj);
  return( false );
};

/**
 * Polyfill for Array.prototype.forEach().
 *
 * Added in JavaScript 1.6 and is unsupported in IE until IE 9.
 *
 * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
 */
if( !Array.prototype.forEach )
{
    Array.prototype.forEach = function( callback, thisArg )
    {
        "use strict";
        if( this === undefined || this === null )
        {
            throw new TypeError('"this" is null or not defined');
        }
        var t = Object( this );
        var length = t.length >>> 0; // Hack to convert object.length to a UInt32
        if( typeof callback !== "function" )
        {
            throw new TypeError('"callback" is not a function');
        }
        var thisArg = arguments.length >= 2 ? arguments[1] : undefined;
        for (var i = 0; i < length; ++i)
        {
            if( i in t )
            {
                callback.call(thisArg, t[i], i, t);
            }
        }
    };
}

Array.prototype.Has = function( data )
{
	return( this.indexOf( data ) > -1 );
};

/** PolyFill to add classList to elements. IE8 */
(function ()
{
	if( typeof window.Element === "undefined" || "classList" in document.documentElement )
		return;

	var push = Array.prototype.push;
	var splice = Array.prototype.splice;
	var join = Array.prototype.join;

	function DOMTokenList( el )
	{
		this.el = el;

		// The className needs to be trimmed and split on whitespace to retrieve a list of classes.
		var classes = el.className.replace(/^\s+|\s+$/g,'').split(/\s+/);

		for( var i = 0; i < classes.length; i++ )
			push.call(this, classes[i]);
	};

	DOMTokenList.prototype =
	{
		add : function( token )
		{
			if( this.contains( token ) )
				return;

			push.call( this, token );
			this.el.className = this.toString();
		},

		contains : function( token )
		{
			return this.el.className.indexOf( token ) != -1;
		},

		item : function( index )
		{
			return this[index] || null;
		},

		remove : function( token )
		{
			if( !this.contains( token ) )
				return;

			for( var i = 0; i < this.length; i++ )
			{
				if( this[i] == token )
					break;
			}

			splice.call( this, i, 1 );
			this.el.className = this.toString();
		},

		toString : function()
		{
			return join.call( this, ' ' );
		},

		toggle : function( token )
		{
			if( !this.contains( token ) )
			{
				this.add( token );
			}
			else
			{
				this.remove( token );
			}

			return this.contains( token );
		}
	};

	window.DOMTokenList = DOMTokenList;

	window.DefineElementGetter = function( obj, prop, getter )
	{
		if( Object.defineProperty )
		{
			Object.defineProperty( obj, prop, { get : getter } );
		}
		else
		{
			obj.__defineGetter__( prop, getter );
		}
	};

	window.DefineElementGetter( Element.prototype, 'classList', function()
	{
		return new DOMTokenList( this );
	});
})();

// ADDS FUNCTION TO REGEXP
RegExp.Escape = function( s )
{
	return s.replace( /([^\s\w\d])/g, '\\$1' );
};

function ExpandString( s, data )
{
	if( !s || !data )
		return;

	for( var key in data )
	{
		if( /^\d$/.test( key ) )
			s = s.replace( new RegExp( "%" + key + "(\\D|$)", 'g' ), data[key] + "$1" );

		s = s.replace( new RegExp( "#" + key + "#", 'g' ), data[key] );
	}

	return s;
};

var URL =
{
  // set this so URL.Base knows exactly where the web site is.
  BaseURL : '',
  sPage   : '',

  // returns array of split URL ..
  // 0 = scheme://[/]
  // 1 = server[:port]
  // 2 = /path/file.ext
  // 3 = query string
  // 4 = bookmark
  Parse : function( s )
  {
    // query and bookmark do not include ?#
    var v = /^([A-Za-z]*:[\/]{2,3})?([^\/:]*:?\d*[^\/]?)?(\/[^\?\#]*)?\??([^#]*)?\#?(.*$)?/;
    // query and bookmark include ? #
    //var v = /^([A-Za-z]*:[\/]{2,3})?([^\/:]*:?\d*[^\/]?)?(\/[^\?\#]*)?(\?[^#]*)?(\#.*$)?/;
    // port is seperate
    //var v = /^([A-Za-z]*:[\/]{2,3})?([^\/:]*):?(\d+)?(\/[^\?\#]*)?\??([^#]*)?\#?(.*$)?/;
    var a = v.exec( s );
    if( a )
    {
      a.shift();
      a.scheme  = a[0];
      a.host    = a[1];
      a.path    = a[2];
      a.query   = a[3];
      a.anchor  = a[4];
    }
    return( a );
  },

  Build : function( a )
  {
    s = a[0] + a[1] + a[2];
    if( a[3] )
      s += "?" + a[3];
    if( a[4] )
      s += "#" + a[4];
    return( s );
  },

  Relative : function( s )
  {
    var a = this.Parse( window.location );

    if( !a )
      return( s );

    // get up to last slash
    a.path = a.path.substr( 0, a.path.lastIndexOf( '/' ) );

    return( a.scheme + a.host + a.path + "/" + Format.LTrim( s, "\/" ) );
  },

  Base : function ( sExtra, oParams )
  {
    var s = null;
    if( !this.BaseURL.length )
    {
      var a = this.Parse( window.location );
      var i = a.path.lastIndexOf( '/' );
      if( i >= 0 )
        s = Format.RTrim( a.scheme + a.host + a.path.substr( 0, i ), "\/" );
    }
    else
    {
      s = Format.RTrim( this.BaseURL, "\/" );
    }

    if( s )
    {
      if( sExtra && typeof( sExtra ) == "string" )
        s += "/" + Format.LTrim( sExtra, "\/" );
      if( oParams && typeof( oParams ) == 'object' )
      {
        s += ( s.indexOf( '?' ) == -1 ) ? "?" : "&";
        s += NVP.ToString( oParams );
      }
      s = Format.RTrim( s, "\/\?\&" );
    }

    return( s );
  },

  Self : function( oParams )
  {
    var s = window.location;
    var a = this.Parse( s );
    if( a )
      s = this.Base( a.path.substr( a.path.lastIndexOf( '/' ) ), oParams );
    return( s );
  },

  Action : function( oParams )
  {
    var oQuery = [];
    var a = this.Parse( window.location );
    if( a )
    {
      var q = NVP.ToObject( a.query );
      if( q.pg )
        oQuery.pg = q.pg;
      if( q.cmd )
        oQuery.cmd = q.cmd;
    }

    if( oParams && typeof( oParams ) == 'object' )
    {
      for( var o in oParams )
        oQuery[o] = oParams[o];
    }

    return( this.Self( oQuery ) );
  },

  Page : function( sPg, sCmd, oParams )
  {
    var oQuery = { pg : sPg };

    if( sCmd && typeof( sCmd ) == "string" )
      oQuery.cmd = sCmd;

    if( oParams && typeof( oParams ) == 'object' )
    {
      for( var o in oParams )
        oQuery[o] = oParams[o];
    }

    return( this.Base( this.sPage, oQuery ) );
  },

  Data : function( sDir, nID, sExtra, oParams )
  {
    var s = null;
    var a = /(\d{3})(\d{3})(\d{3})(\d{3})/;
    var r = a.exec( Format.ID( nID ) );
    if( r )
    {
      r.shift();
      if( !sExtra || typeof( sExtra ) != "string" )
        sExtra = "";
      s = this.Base( "/dat/" + sDir + "/" + r.join("/") + "/" + Format.LTrim( sExtra, "\/" ), oParams );
    }
    return( s );
  }
};

var Cookie =
{
  Get : function( name )
  {
    var search = name + "=";
    var offset = 0;
    var end = 0;
    var retval = "";
    if( document.cookie.length > 0 )
    {
      offset = document.cookie.indexOf( search );
      if( offset != -1 )
      {
        end = document.cookie.indexOf(";",offset);
        if( end == -1 )
          end = document.cookie.length;
        offset += search.length;
        retval = document.cookie.substring(offset,end);
      }
    }
    return( unescape( retval ) );
  },

  Set : function( name, value, expires )
  {
    var sCookie = name + "=" + escape( value );

    sCookie += ";path=/";

    if( expires )
    {
      // 3439 - Found isNaN returning false on dt object, switched to typeof
      if( typeof( expires ) == 'object' )
      {
        sCookie += ";expires=" + expires.toUTCString();
      }
      else if( parseInt( expires ) )
      {
        var dt = new Date();
        dt.setMinutes( dt.getMinutes() + parseInt( expires ) );

        sCookie += ";expires=" + dt.toUTCString();
      }
    }

    document.cookie = sCookie;
  },

  GetNVP : function( name, key )
  {
    return( NVP.Get( this.Get( name ), key ) );
  },

  SetNVP : function( name, key, value, expires )
  {
    this.Set( name, NVP.Set( this.Get( name ), key, value ), expires );
  }
};

var NVP =
{
  Get : function( str, key )
  {
    var obj = this.ToObject( str );
    return( obj[key] );
  },

  Set : function( str, key, val, dup )
  {
    var obj = this.ToObject( str );

    if( typeof( obj[key] ) == 'undefined' || !dup )
    {
      obj[key] = val;
    }
    else if( dup )
    {
      if( typeof( obj[key] ) != 'object' )
        obj[key] = [ obj[key] ];
      obj[key][obj[key].length] = val;
    }

    return( this.ToString( obj ) );
  },

  ToObject : function( str , del)
  {
    var obj = {};
    var nvp = [];

  if( !del )
      del = "&";

    if( str && str.length )
      nvp = str.split( del );

    for( var i = 0; i < nvp.length; i++ )
    {
      var kv = nvp[i].split( "=" );

      if( typeof( obj[kv[0]] ) != 'undefined' )
      {
        if( typeof( obj[kv[0]] ) != 'object' )
          obj[kv[0]] = [ obj[kv[0]] ];

        obj[kv[0]][obj[kv[0]].length] = unescape( kv[1] );
      }
      else
      {
        obj[kv[0]] = unescape( kv[1] );
      }
    }

    return( obj );
  },

  ToString : function( obj, del )
  {
    var nvp   = [];

    if( !del )
      del = "&";

    for( var k in obj )
    {
      if( k == "_children" )
        continue;

      if( typeof( obj[k] ) == 'object' )
      {
        obj[k] = ( obj[k].length ) ? obj[k] : [ obj[k] ];

        for( var i = 0; i < obj[k].length; i++ )
          nvp[nvp.length] = k + "=" + this.PrepValue( obj[k][i] );
      }
      else
      {
        nvp[nvp.length] = k + "=" + this.PrepValue( obj[k] );
      }
    }

    return( nvp.join( del ) );
  },


  PrepValue : function( v )
  {
    if( typeof( v ) != 'string' )
      return( v );

    var s = "";

    for( var n = 0; n < v.length; n++)
    {
      var c = v.charCodeAt(n);
      if( c < 128 && v.charAt(n) != '+' )
      {
        s += String.fromCharCode(c);
      }
      else if( v.charAt(n) == '+' )
      {
        s += ( '%2B' );
      }
      else
      {
        s += ( '&#' + c + ';' );
      }
    }

    return( escape( s ) );
  }
};

var INI =
{
  FixValue : function( value, prms )
  {
    if(typeof(value) != 'string')
      return;

    value = Format.Trim( value );
    value = value.replace(/\r/g, '');      // remove carriage returns
    value = value.replace(/\n/g, /~~/);   // change line feeds

    return( value );
  },

  GetKeyValue : function( line )
  {
    var key;
    var value = null;

    line = Format.RTrim( line );

    var patterns =
    [
      [ /x00/,  "" ],
      [ /~~/,   /\n/ ],
      [ /^;.*/, "" ],
      [ /; .*/, "" ],
      [ /^\s+/, "" ],
      [ /\s+$/, "" ]
    ];

    for( var i = 0; i < patterns.length; i++ )
      line = line.replace( patterns[i][0], patterns[i][1] );

    if( line.length )
    {
      if( line.match(/^\[/) && line.match(/\]/) )
      {
        line = line.replace(/^\[\s*|\s*\]/g,"");
        key = line.toUpperCase();
      }
      else if( line.match(/=/) )
      {
        tmp = line.split( /\s*=\s*/, 2 );
        key = tmp[0];
        value = tmp[1];
        if( value == null )
          value='';
      }
    }

    if( value )
      value = unescape(value.replace(/\+g/, " "));

    return( { 'key' : key, 'val' : value  } );

  },
  Read : function(ini, noerror)
  {
    if(!ini)
    {
      if(noerror)
        return;
    else
      alert("INI data is empty!");
    }

    var tmphash = {};

    var section = '';

    //Need to fix replace params, also need basepath/url
    var prms =
    {
      "<BASEPATH>" : 'BasePath',
      "<BASEURL>"  : 'BaseURL'
    };

    var inilist = ini.split( "\n" );


    //For each line, find group and sub groups
    for( var i=0; i < inilist.length; i++ )
    {
      tmp = INI.GetKeyValue( inilist[ i ] );

      if( tmp.val != null )
      {
        //Not functional
        //value = ReplaceParams( value, prms );

        if( section )
          tmphash[section][tmp.key] = tmp.val;
        else
          tmphash[tmp.key] = tmp.val;
      }
      else if( tmp.key )
      {
        section = tmp.key;

        if( !tmphash[section] )
          tmphash[section] = {};
      }
    }

    return( tmphash );
  },

  Write : function( data, ini, overwrite )
  {
    if( !data )
      return;

    if( !ini )
      ini = new String();

    var tmphash = Value.Copy( data );
    var lines = [];

    //Need basepath and baseurl
    var prms =
    {
      BasePath : "<BASEPATH>",
      BaseURL  : "<BASEURL>"
    };

    if( !overwrite )
    {
      var inilist = ini.split( "\n" );

      for( i=0; i<inilist.length; i++ )
      {
        var line = inilist[i];

        var tmp = INI.GetKeyValue( line );

        if( tmp.key )
        {
          if( tmp.val )
          {
            if( section )
            {
              if( !tmphash[section] || !tmphash[section][tmp.key] )
              {
                lines.push( tmp.key + " = " + tmp.val );
                  continue;
              }

              tmp.val = tmphash[section][tmp.key];
              delete tmphash[section][tmp.key];
            }
            else
            {
              if( !tmphash[tmp.key] )
                continue;

              tmp.val = tmphash[tmp.key];
              delete tmphash[tmp.key];
            }
            line = tmp.key + " = " + INI.FixValue( tmp.val, prms );
          }
          else
          {
            newkeys = ( section ) ? tmphash[section] : tmphash;

            for( newkey in newkeys )
            {
              if( Is.Hash( newkeys[newkey] ) )
                continue;

              lines.push( newkey + " = " + INI.FixValue( newkeys[newkey], prms ) );
              delete newkeys[newkey];
            }

            if( tmphash[section] )
              delete tmphash[section];

             var section = tmp.key;
          }
        }

        if( line )
          lines.push( line );
      }

      // check remaining entries for last section
      newkeys = ( section ) ? tmphash[section] : tmphash;

      for( newkey in newkeys )
      {
        if( Is.Hash( newkeys[newkey] ) )
          continue;

        lines.push( newkey + " = " + INI.FixValue( newkeys[newkey], prms ) );
        delete newkeys[newkey];
      }

      if( tmphash[section] )
        delete tmphash[section];
    }

    //add new root values
    for( var key in tmphash )
    {
      if( Is.Hash( tmphash[key] ) )
        continue;

      lines.push( key + " = " + INI.FixValue( tmphash[key], prms ) );
    }

    //add new section values
    for( section in tmphash )
    {
      if(!Is.Hash( tmphash[section] ) )
        continue;

      lines.push( "\n["+section+"]" );

      for( var key in tmphash[section] )
      {
        if( key == '_children' )
          continue;


        lines.push( key + " = " + INI.FixValue( tmphash[section][key], prms ) );
      }
    }

    return( lines.join( "\n" ) );
  }
};

// Is.?????? validation routines
var Is =
{
  // empty or null
  Empty : function( v )
  {
    if( v == null || v.length == 0 )
      return( true );

    return( false );
  },

  Zero : function( v )
  {
    if( v == null || v.length == 0 || parseInt( v ) == 0 )
      return( true );

    return( false );
  },

  Float : function( s )
  {
    return( !isNaN( parseFloat( s ) ) );
  },

  Integer : function( s )
  {
    return( !isNaN( parseInt( s ) ) );
  },

  InRange : function( n, low, high )
  {
    return( ( ( n >= low ) && ( n <= high ) ) );
  },

  Hex : function( s )
  {
    var v = /^(0x|#)?[0-9A-Fa-f]+$/;
    return( v.test( s ) );
  },

  // address@server.somewhere
  // var v = /^\S+\@\S+\.\S+$/;
  EmailAddress : function( s, bMultiple )
  {
    var emails = ( bMultiple ) ? s.split( /[,|;]/ ) : [ s ];

    for( var i = 0; i < emails.length; i++ )
    {
      if( emails[i].search( /^([^ ,:;]+)\@([^ ,:;]+)\.([^ ,:;]+)$/ ) )
        return( false );
    }

    return( true );
  },

  // 12345[-1234]
  ZipCode : function( s )
  {
    var v = /^\d{5}-?(\d{4})?$/;
    return( v.test( s ) );
  },

  // 123[-/.]456[-/.]7890
  PhoneNumber : function( s )
  {
    var v = /^\d{3}[-\/\.]?\d{3}[-\/\.]?\d{4}$/;
    return( v.test( s ) );
  },

  DatePart : function( s )
  {
    var v = /^.[\sLyYoFMmntWCdDjlNwzSaABGghHisITPOZecrU\.\/\\\(\)#_-]+$/;
    return( v.test( s ) );
  },

  State : function( s )
  {
    var v = /^(A[LKZR]|C[AOT]|D[EC]|FL|GA|HI|I[DLNA]|K[SY]|LA|M[EDAINSOT]|N[EVHJMYCD]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[TA]|W[AVIY])$/;
    return( v.test( s.toUpperCase() ) );
  },

  CreditCard : function( s )
  {
    var rc = false;
    var v = /^(\d)(\d+)$/;
    if( v.test( s ) )
    {
      switch( parseInt( RegExp.$1 ) )
      {
        case 3: // amex
          rc = ( RegExp.$2.length >= 14 && RegExp.$2.length <= 18 );
          break;

        case 4: // visa
        case 5: // mc
        case 6: // discover
          rc = ( RegExp.$2.length >= 15 && RegExp.$2.length <= 18 );
          break;
      }
    }
    return( rc );
  },

  Matches : function( s, p )
  {
    var v = new RegExp( p );
    return( v.test( s ) );
  },

  InputField : function( fm, fldname )
  {
    with( fm )
    {
      for( var f = 0; f < elements.length; f++ )
      {
        if( elements[f].name == fldname )
          return( true );
      }
    }

    return( false );
  },

  DateTime : function( szDateTime, nCheck ) // nCheck: 0 = Nothing, 1 = No Past Dates
  {
    if( typeof( szDateTime ) == 'object' )
      szDateTime = szDateTime.toString();

    var dt = Date.Parse( szDateTime );
    var dtcheck = new Date();
    nCheck = parseInt( nCheck );

    if( dt )
    {
      switch( nCheck )
      {
        case 1: // past
          if( dt.GetLongDate() < dtcheck.GetLongDate() )
            dt = null;
          break;

        case 2: // future
          if( dt.GetLongDate() > dtcheck.GetLongDate() )
            dt = null;
          break;

        default:
          break;
      }
    }

    return( ( dt != null ) && ( ( Date.ParseParts & ( Date.cPartDate | Date.cPartTime ) ) == ( Date.cPartDate | Date.cPartTime ) ) );
  },

  Date : function( szDate, nCheck ) // nCheck: 0 = Nothing, 1 = No Past Dates, 2 = No Future Dates
  {
    if( typeof( szDate ) == 'object' )
      szDate = szDate.toString();

    var dt = Date.Parse( szDate );
    // since this is a date check with no time, use 00:00:00 for the time
    var dtcheck = new Date();
    dtcheck = new Date(dtcheck.getFullYear(),dtcheck.getMonth(), dtcheck.getDate());

    if( dt )
    {
      switch( nCheck )
      {
        case '1': // past
          if( dt.GetLongDate() < dtcheck.GetLongDate() )
            dt = null;
          else if( dt.GetPart( 'Y' ) > ( parseInt( dtcheck.GetPart( 'Y' ) ) + 100 ) && ( dt.GetPart( 'Y' ) != 9999 ) ) // too far future 3650
            dt = null;
          break;

        case '2': // future
          if( dt.GetLongDate() > dtcheck.GetLongDate() )
            dt = null;
          else if( dt.GetPart( 'Y' ) < 1800 ) // too far past
            dt = null;
          break;

        default:
          if( dt.GetPart( 'Y' ) > ( parseInt( dtcheck.GetPart( 'Y' ) ) + 100 ) && ( dt.GetPart( 'Y' ) != 9999 ) ) // 3650 too far future
            dt = null;
          else if( dt.GetPart( 'Y' ) < 1800 ) // too far past
            dt = null;
          break;
      }
    }

    return( ( dt != null ) && ( ( Date.ParseParts & Date.cPartDate ) == Date.cPartDate ) );
  },

  Time : function( szTime )
  {
    var dt = Date.Parse( szTime );

    return( ( dt != null ) && ( ( Date.ParseParts & Date.cPartTime ) == Date.cPartTime ) );
  },

  sFreqDone : 'Done',
  sFreqOnce : 'Once',

  Freq : function( sz )
  {
    if( !isNaN( parseInt( sz ) ) && parseInt( sz ) > -2 )
      return( true );

    if( sz.toUpperCase() == Is.sFreqDone.toUpperCase() || sz.toUpperCase() == Is.sFreqOnce.toUpperCase() )
      return( true );

    return( false );
  },

  /* TEST IF VALID COLOR, RETURNS T|F */
  Color : function( sColor )
  {
    var oDiv = document.createElement( 'div' );
    var sClr = '';
    var aTst = [ '#000', '#000000', 'rgb(0, 0, 0)', 'black' ];

    // IF SET TO BLACK, RETURN TRUE
    for( var i = 0; i < aTst.length; i++ )
    {
      if( sColor == aTst[i] )
        return( true );
    }

    if( oDiv )
    {
      // SET A DEFAULT
      oDiv.style.color = "#000";

      try //IE THROWS AN ERROR INSTEAD OF DEFAULTING THE STYLE
      {
        oDiv.style.color = sColor;
        oDiv.style.display = 'none';
        document.body.appendChild( oDiv );
        sClr = GetStyle( oDiv, 'color' );
      }
      catch( e )
      {
        return( false );
      }

      document.body.removeChild( oDiv );

      for( var i = 0; i < aTst.length; i++ )
      {
        if( sClr == aTst[i] )
          return( false );
      }

      return( true );
    }
  }, // Color

  URL : function( sURL )
  {
    var v = new RegExp( /^http[s]?:\/\// );
    return( v.test( sURL ) );
  },

  Hash : function(o)
  {
    return( typeof( o ) == "object" && !Is.Array(o) );
  },

  Array : function(o)
  {
    if( o.constructor.toString().indexOf('Array') == -1 )
      return( false );
    else
      return( true );
  }
};

var Format =
{
  _hexletters : "0123456789ABCDEF",

  HexDec : function( x )
  {
    var n = 0;
    x = x.toString().toUpperCase();
    for( var c = 0; c < x.length; c++ )
    {
      var i = this._hexletters.indexOf( x.charAt( c ) );
      if( i == -1 )
        break;

      n = n << 4;
      n = n + i;
    }

    return( n );
  },

  DecHex : function( n )
  {
    var x = "";

    n = parseInt( n );

    if( !isNaN( n ) )
    {
      while( n )
      {
        var i = n & 15;
        x = this._hexletters.charAt( i ) + x;
        n >>= 4;
      }
    }

    return( x );
  },

  Phone : function( p, s )
  {
    var r = p;
    var v = /^(\d{3})[-\/\.]?(\d{3})[-\/\.]?(\d{4})$/;
    if( v.test( p ) )
    {
      if( Is.Empty( s ) )
        s = '';
        r = this.PadLeft( RegExp.$1, 3, 0 ) + s +
        this.PadLeft( RegExp.$2, 3, 0 ) + s +
        this.PadLeft( RegExp.$3, 4, 0 );
    }
    return( r );
  },

  ZipCode : function( p, s )
  {
    var r = p;
    var v = /^(\d{5})-?(\d{4})?$/;
    if( v.test( p ) )
    {
      if( Is.Empty( s ) )
        s = '';

      r = this.PadLeft( RegExp.$1, 5, 0 );

      if( RegExp.$2.length )
        r += s + this.PadLeft( RegExp.$2, 4, 0 );
    }
    return( r );
  },

  FileName : function( sName )
  {
    sName = sName.replace( new RegExp( "[\+%#()\\[\\]]", "g" ), "" );
    return( sName );
  },

  Float : function( f, d )
  {
    var re = new RegExp( /^([+-]?\d+)?\.?(\d+)?$/ );

    if( !re.test( f.toString() ) )
      return( f );

    if( d <= 0 )
      return( Math.round( f ).toString() );

    var num = RegExp.$1.toString();
    var dec = RegExp.$2.toString();

    // are there enough decimals ?
    if( dec.length < d )
      dec = this.PadRight( dec, d, '0' );

    f = Math.round( num + dec.substr( 0, d ) + '.' + dec.substr( d ) ).toString();

    num = this.PadLeft( f.substr( 0, f.length - d ), 1, '0' );

    dec = this.PadRight( f.substr( f.length - d ), d, '0' );

    return( num + '.' + dec );
  },

  PadLeft : function( sz, cnt, ch )
  {
    if( cnt == null || cnt == 0 )
      return( sz );
    if( ch == null || ch == "" )
      ch = " ";
    var retval = "" + sz;
    while( retval.length < cnt )
      retval = ch + retval;
    return( retval );
  },

  PadRight : function( sz, cnt, ch )
  {
    if( cnt == null || cnt == 0 )
      return( sz );
    if( ch == null || ch == "" )
      ch = " ";
    var retval = "" + sz;
    while( retval.length < cnt )
      retval = retval + ch;
    return( retval );
  },

  LTrim : function( sz, chars )
  {
    if( sz != null )
    {
      if( !chars )
        chars = "\\s";
      sz = sz.replace( new RegExp( "^[" + chars + "]+" ), "" );
    }
    return( sz );
  },

  RTrim : function( sz, chars )
  {
    if( sz != null )
    {
      if( !chars )
        chars = "\\s";
      sz = sz.replace( new RegExp( "[" + chars + "]+$" ), "" );
    }
    return( sz );
  },

  Trim : function( sz, chars )
  {
    if( sz != null )
    {
      sz = this.LTrim( sz, chars );
      sz = this.RTrim( sz, chars );
    }
    return( sz );
  },

  Duration : function ( nSeconds )
  {
    var dt = {};
    var sz = '';

    // clear negs
    if( nSeconds < 0 )
    {
      sz = '-';
      nSeconds *= -1;
    }

    // clear days
    if( nSeconds >= 86400 )
    {
      dt.day = Math.floor( nSeconds / 86400 );
      nSeconds -= ( dt.day * 86400 );
      sz += this.PadLeft( dt.day, 2, '0' ) + ' ';
    }

    // clear hours
    if( nSeconds >= 3600 )
    {
      dt.hour = Math.floor( nSeconds / 3600 );
      nSeconds -= ( dt.hour * 3600 );
      sz += this.PadLeft( dt.hour, 2, '0' ) + ':';
    }
    else
    {
      if( dt.day )
        sz += '00:';
    }

    // clear minutes
    if( nSeconds >= 60 )
    {
      dt.minute = Math.floor( nSeconds / 60 );
      nSeconds -= ( dt.minute * 60 );
      sz += this.PadLeft( dt.minute, 2, '0' ) + ':';
    }
    else
    {
      sz += '00:';
    }

    sz += this.PadLeft( nSeconds, 2, '0' );

    return( sz );
  },

  sDate       : "Y-m-d",
  sTime       : "H:i",
  sDateTime   : "Y-m-d H:i",

  Date : function( szDate )
  {
    var dt = Date.Parse( szDate );

    if( dt )
      szDate = dt.Format( Date.DT_FMT );

    return( szDate );
  },

  Time : function( szTime )
  {
    var dt = Date.Parse( szTime );

    if( dt )
      szTime = dt.Format( Date.TM_FMT );

    return( szTime );
  },

  DateTime : function( szDateTime )
  {
    var dt = Date.Parse( szDateTime );

    if( dt )
      szDateTime = dt.Format( Date.DTTM_FMT );

    return( szDateTime );
  },

  Timespan : function( nSeconds )
  {
    var dt = new Date( 1970, 0, 1, 0, 0, 0 );
    dt.setSeconds( nSeconds );
    dt.Format( 'H:i:s' );
    return( Format.PadLeft( ( dt.DayOfYear() - 1 ) * 24 + parseInt( dt.GetPart( 'H' ) ), 2, '0' ) + dt.Format( ":i:s" ) );
  },

  ID : function( nID )
  {
    return( isNaN( nID ) ? nID : this.PadLeft( "" + nID, 12, "0" ) );
  },

  Size : function( nSize )
  {
    var sSuffix = "BKMGT";
    var nSuffix = 0;
    while( nSize >= 1024 )
    {
      nSuffix++;
      nSize /= 1024;
    }
    return( this.Float( nSize, ( nSuffix ) ? 1 : 0 ) + sSuffix.charAt( nSuffix ) + (( nSuffix ) ? "B" : "") );
  },

  Parse : function( format )
  {
    var result = "";
    var argn = 1;
    var arg;
    var re = /%(0)?([\d-]+)?\.?([\d]+)?([cdfxs])/;

    // 0 = full match
    // 1 = 0 or undefined
    // 2 = width
    // 3 = precision
    // 4 = dxfs
    // index = position found
    // input = string

    while( true )
    {
      var match = re.exec( format );

      if( !match )
      {
        result += format;
        break;
      }

      if( typeof( match[1] ) == "undefined" )
        match[1] = ' ';

      arg = arguments[argn++];

      switch( match[4] )
      {
        case 'c':
          if( arg.length )
            arg = arg.charAt(0);
          break;
        case 'd':
          arg = parseInt( arg );
          if( match[2] )
            arg = this.PadLeft( arg, match[2], match[1] );
          break;

        case 'f':
          arg = parseFloat( arg );
          if( match[3] )
            arg = this.Float( arg, match[3] );
          if( match[2] )
            arg = this.PadLeft( arg, match[2], match[1] );
          break;

        case 'x':
          arg = this.DecHex( arg );
          if( match[2] )
            arg = this.PadLeft( arg, match[2], match[1] );
          break;

        case 's':
          if( match[3] )
            arg = arg.substr( 0, match[3] );
          if( match[2] > 0 )
            arg = this.PadLeft( arg, match[2], match[1] );
          else if( match[2] < 0 )
            arg = this.PadRight( arg, Math.abs( match[2] ), match[1] );
          break;
      }

      result += format.substr( 0, match.index ) + arg.toString();

      format = format.substr( match.index + match[0].length );
    }

    return( result );
  },

  Suffix : function( d )
  {
      var a = [ "th", "st", "nd", "rd"  ];
      var s = a[0];
      var hund = ( d % 100 ); // 0-99
      var ten = ( d % 10 );   // 0-9
      if( !(hund >= 11 && hund <=13)  && ten < 4 )
          s = a[ten];
      return( s );
  },

  BinToStr : function( n )
  {
    var str = '';

    n = parseInt( n );

    for( var i = 31; i >= 0; i-- )
    {
      str += (( n & ( 1 << i ) ) ? '1' : '0' );
    }

    return( str );
  },

  StrToBin : function( s )
  {
    s = s.toString();
    var ttl  = 0;

    for( var i = 0; i < s.length; i++ )
    {
      if( s[( s.length - i - 1 )] == '1' )
        ttl |= ( 1 << i );
    }

    return( ttl );
  }
};

Date.prototype.IsLeapYear = function()
{
  var nYear = this.getFullYear();
  return((( nYear & 3 ) == 0 &&
      ((( nYear % 400 ) == 0 ) ^
      (( nYear % 100 ) != 0 ))) ? true : false );
};

Date.prototype.GetTimeZone = function( separate )
{
  if( typeof( separate ) == "undefined" )
    separate = "";

  var tz = this.getTimezoneOffset() * -1 ;
  var sign = (tz > 0 ) ? "+" : "-";
  tz = Math.abs( tz );
  return( Format.Parse( "%c%02d%c%02d", sign, tz / 60, separate, tz % 60 ) );
};

Date.prototype.DayOfYear = function()
{
  var dayNumber = 0;

  for( var nMonth = 0; nMonth < this.getMonth(); nMonth++ )
    dayNumber += Date.Months.Days[nMonth];

  dayNumber += this.getDate();

  if( ( this.getMonth() + 1 ) == 2 && this.IsLeapYear() )
    dayNumber++;

  return( dayNumber );
};

Date.prototype.GetMonthName = function( bLong )
{
  if( !Date.Months.Init )
  {
    var dt = new Date( 2009, 0, 1 );
    var aDate;

    for( var nMonth = 0; nMonth < 12; nMonth++ )
    {
      dt.setMonth( nMonth );

      aDate = dt.toLocaleString().split( /[\s,]+/ );

      for( var a = 1; a < aDate.length; a++ )
      {
        var t = /^\D+$/;
        if( t.test( aDate[a] ) )
        {
          Date.Months.Long[nMonth] = aDate[a];
          Date.Months.Short[nMonth] = aDate[a].substr( 0, 3 );
          break;
        }
      }
    }

    Date.Months.Init = true;
  }

  return( Date.Months[( bLong ) ? "Long" : "Short"][this.getMonth()] );
};

Date.prototype.GetWeekdayName = function( bLong )
{
  if( !Date.Weekdays.Init )
  {
    var dt = new Date( 2009, 0, 1 );
    var aDate;

    // back up to previous sunday
    dt.setDate( dt.getDate() - dt.getDay() );

    for( var nDOW = 0; nDOW < 7; nDOW++ )
    {
      aDate = dt.toLocaleString().split( /[\s,]+/ );
      Date.Weekdays.Long[nDOW] = aDate[0];
      Date.Weekdays.Short[nDOW] = aDate[0].substr( 0, 3 );
      dt.setDate( dt.getDate() + 1 );
    }

    Date.Weekdays.Init = true;
  }

  return( Date.Weekdays[( bLong ) ? "Long" : "Short"][this.getDay()] );
};

Date.Months =
{
  Init  : true,
  Long  : ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
  Short : ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
  Days  : [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
};

Date.Weekdays =
{
  Init  : true,
  Long  : ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ],
  Short : ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ]
};

Date.cSecondsMinute  = 60;
Date.cMinutesHour    = 60;
Date.cSecondsHour    = Date.cSecondsMinute * Date.cMinutesHour;
Date.cHoursDay       = 24;
Date.cMinutesDay     = Date.cMinutesHour * Date.cHoursDay;
Date.cSecondsDay     = Date.cSecondsHour * Date.cHoursDay;
Date.cMonthsYear     = 12;
Date.cDaysWeek       = 7;
Date.cDaysYear       = 365;
Date.cDays4Years     = ( Date.cDaysYear * 4 ) + 1;
Date.cDays100Years   = ( Date.cDays4Years * 25 ) - 1;
Date.cDays400Years   = ( Date.cDays100Years * 4 ) + 1;
Date.cDaysTo1970     = 719162;
Date.SIDate          = false;
Date.DT_FMT          = 'Y-m-d';
Date.TM_FMT          = 'H:i';
Date.DTTM_FMT        = 'Y-m-d H:i';

Date.cszTimeZone =
{
  Init: false,
  sz  :
  [
    [ 0, "gmt" ],       // Greenwich Mean
    //[ 0, "ut" ],        // Universal (Coordinated)
    //[ 0, "utc" ],
    //[ 0, "wet" ],       // Western European
    [ -1 * 60, "wat" ],     // West Africa
    [ -2 * 60, "at" ],      // Azores
    // For completeness.  BST is also British Summer, and GST is also Guam Standard.
      //[ -3 * 60, "bst" ],   // Brazil Standard
      //[ -3 * 60, "gst" ],   // Greenland Standard
      //[ -3 * 60 -30, "nft" ], // Newfoundland
      //[ -3 * 60 -30, "nst" ], // Newfoundland Standard
    [ -4 * 60, "ast", "adt" ],      // Atlantic Standard
    [ -5 * 60, "est", "edt" ],      // Eastern Standard
    [ -6 * 60, "cst", "cdt" ],      // Central Standard
    [ -7 * 60, "mst", "mdt" ],      // Mountain Standard
    [ -8 * 60, "pst", "pdt" ],      // Pacific Standard
    [ -9 * 60, "yst", "ydt" ],      // Yukon Standard
    [ -10 * 60, "hst","hdt" ],    // Hawaii Standard
    //[ -10 * 60, "cat" ],    // Central Alaska
    //[ -10 * 60, "ahst" ],   // Alaska-Hawaii Standard
    [ -11 * 60, "nt" ],     // Nome
    [ -12 * 60, "idlw" ],   // International Date Line West
    [ +1  * 60, "cet", "cedt" ],    // Central European
    //[ +1  * 60, "met" ],    // Middle European
    //[ +1  * 60, "mewt" ],   // Middle European Winter
    //[ +1  * 60, "swt" ],    // Swedish Winter
    //[ +1  * 60, "fwt" ],    // French Winter
    [ +2  * 60, "eet", "eedt" ],    // Eastern Europe, USSR Zone 1
    [ +3  * 60, "bt" ],     // Baghdad, USSR Zone 2
    //[ +3  * 60 + 30, "it" ],  // Iran
    [ +4  * 60, "zp4" ],      // USSR Zone 3
    [ +5  * 60, "zp5" ],      // USSR Zone 4
    [ +5  * 60 + 30, "ist" ], // Indian Standard
    [ +6  * 60, "zp6" ],      // USSR Zone 5
      // For completeness.  NST is also Newfoundland Stanard, and SST is also Swedish Summer.
    [ +6  * 60 + 30, "nst" ],  // North Sumatra
    //[ +7  * 60, "sst" ],    // South Sumatra, USSR Zone 6
    [ +7  * 60, "wast", "wadt" ],       // West Australian Standard
      //[ +7  * 60 + 30, "jt" ],  // Java (3pm in Cronusland!)
    [ +8  * 60, "cct" ],        // China Coast, USSR Zone 7
    [ +9  * 60, "jst" ],    // Japan Standard, USSR Zone 8
      //[ +9  * 60 +30, "cast" ], // Central Australian Standard
    [ +10 * 60, "east", "eadt" ],       // Eastern Australian Standard
    //[ +10 * 60, "gst" ],        // Guam Standard, USSR Zone 9
    [ +12 * 60, "nzt", "ndzt" ]        // New Zealand
    //[ +12 * 60, "nzst" ],       // New Zealand Standard
    //[ +12 * 60, "idle" ]       // International Date Line East
  ]
};

Date.prototype.GetTZO = function()
{
  return( -this.getTimezoneOffset() );  // comes reversed -- positives should be negs
};

Date.prototype.IsDST = function()
{
  var dt = new Date(this);
  var tz = dt.getTimezoneOffset();
  dt.setMonth(0);             // Jan is always standard time, so compare the curent time
  return( tz != dt.getTimezoneOffset() ); // to the same time in Jan; if not equal, it's DST
};

Date.prototype.GetTimeZoneSZ = function()
{
  if(!Date.cszTimeZone.Init)  // if init is still false, then haven't built out the object so do that first
  {
    for( var i = 0; i < Date.cszTimeZone.sz.length; i++ )
      Date.cszTimeZone[Date.cszTimeZone.sz[i][0]] = Date.cszTimeZone.sz[i];

    Date.cszTimeZone.Init = true;     // mark as done
  }

  var tzo = this.GetTZO();    // invert the time offset

  if(this.IsDST())        // if it is daylight savings time, subtract 60 mins from value
    tzo -= 60;

  var tz = "";
  var tzinfo = Date.cszTimeZone[tzo];  // retreive the code from the array for that time offset

  if(!tzinfo)              // If empty, then add offset from GMT to the string
    tz = Format.Parse("GMT%c%02d:%02d", (tzo>0) ? "+" : "-", tzo / 60, tzo % 60 );
  else
  {
    if(this.IsDST() && tzinfo.length == 3)        // if it is daylight savings time, get correct abbrev.
      tz = tzinfo[2];
    else
      tz = tzinfo[1];
  }

  return( tz.toUpperCase() );    // show in upper case
};

Date.prototype.GetLongTime = function()
{
  var totalSecs = 0;

  // hours
  totalSecs += ( this.getHours() * Date.cSecondsHour );
  // minutes
  totalSecs += ( this.getMinutes()  * Date.cSecondsMinute );
  // seconds
  totalSecs += ( this.getSeconds() );

  return( totalSecs );
};

Date.prototype.GetLongDate = function()
{
  return( parseInt( parseInt( this.getTime() / 1000 ) / 86400) );
};

Date.prototype.DayOfWeek = function( bISO )
{
  return( ( bISO ) ? ( ( this.getDay() + 6 ) % 7 ) : this.getDay() );
};

Date.FirstWeekdayOfYear = function( year, bISO )
{
  var dt = new Date( year, 0, ( bISO ) ? 4 : 1 );

  dt.setDate( dt.getDate() - dt.DayOfWeek( bISO ) );

  return( dt );
};

Date.prototype.WeekOfYear = function( bISO )
{
  var fdoy = Date.FirstWeekdayOfYear( this.getFullYear(), bISO );

  if( bISO )
  {
    var ndoy = Date.FirstWeekdayOfYear( this.getFullYear() + 1, bISO );
    if( fdoy.GetLongDate() > this.GetLongDate())
      fdoy = Date.FirstWeekdayOfYear( this.getFullYear() - 1, bISO );
    else if( this.GetLongDate() > ndoy.GetLongDate() )
      fdoy = ndoy;
  }

  return( parseInt(( this.GetLongDate() - fdoy.GetLongDate() ) / 7) + 1 );
};

Date.prototype.ISOYear = function()
{
  var year  = this.getFullYear();
  var month = this.getMonth();

  // check Jan and Dec for possible values
  if( month == 0 || month == 11 )
  {
    // get the ISO week of the year
    var woy = this.WeekOfYear( true );

    // if week 1 and in Dec then use next year
    if( woy == 1 && month == 11 )
      year++;

    // if last week(s) and in Jan then use previous year
    if( woy >= 52 && month == 0 )
      year--;
  }

  return( year );
};

Date.prototype.GetPart = function( p )
{
  switch( p )
  {
    // Year
    // Whether it's a leap year
    case 'L': return( this.IsLeapYear() ? 1 : 0 );
    // A two digit representation of a year
    case 'y': return( Format.Parse( "%02d", this.getFullYear() % 100 ) );
    // A full numeric representation of a year, 4 digits
    case 'Y': return( Format.Parse( "%04d", this.getFullYear() ) );

    // Month
    // Numeric representation of a month, with leading zeros
    case 'm': return( Format.Parse( "%02d", this.getMonth() + 1 ) );
    // Numeric representation of a month, without leading zeros
    case 'n': return( this.getMonth() + 1 );
    // A full textual representation of a month, such as January or March
    case 'F': return( this.GetMonthName( true ) );
    // A short textual representation of a month, three letters
    case 'M': return( this.GetMonthName( false ) );

    // Number of days in the given month
    // Need to see if Feb and a leap year
    case 't': return( Date.Months.Days[this.getMonth()] + (( this.IsLeapYear() && this.getMonth() == 1) ? 1 : 0)  );

    // Day
    // Day of the month, 2 digits with leading zeros
    case 'd': return( Format.Parse( "%02d", this.getDate() ) );
    // A textual representation of a day, three letters
    case 'D': return( this.GetWeekdayName( false ) );
    // Day of the month without leading zeros
    case 'j': return( this.getDate() );
    // A full textual representation of the day of the week
    case 'l': return( this.GetWeekdayName( true ) );
    // ISO-8601 numeric representation of the day of the week 1 - Mon, 7 - Sun
    case 'N': return( this.DayOfWeek( true ) + 1 );
    // English ordinal suffix for the day of the month, 2 chars, st, nd, rd or th
    case 'S': return( Format.Suffix( this.getDate() ) );
    // Numeric representation of the day of the week 0 - Sun, 6 - Sat
    case 'w': return( this.DayOfWeek( false ) );
    // The day of the year ( starting from 0 - 365 )
    case 'z': return( this.DayOfYear() - 1 );

    // Time
    // Lowercase Ante meridiem and Post meridiem
    case 'a': return( ( this.getHours() < 12 ) ? "am" : "pm" );
    // Uppercase Ante meridiem and Post meridiem
    case 'A': return( ( this.getHours() < 12 ) ? "AM" : "PM" );
    // Swatch Internet time
    case 'B': return( Format.Parse( "%03d",(( (this.GetLongTime()+ (this.getTimezoneOffset() * 60) + Date.cSecondsHour)% Date.cSecondsDay ) / Date.cSecondsDay ) * 1000));

    // 24-hour format of an hour without leading zeros
    case 'G': return( this.getHours() );
    // 12-hour format of an hour without leading zeros
    case 'g': return(( ( this.getHours() + 11) % 12 ) + 1 );
    // 12-hour format of an hour with leading zeros
    case 'h': return( Format.Parse( "%02d", this.GetPart( 'g' ) ) );
    // 24-hour format of an hour with leading zeros
    case 'H': return( Format.Parse( "%02d", this.getHours() ) );
    // Minutes with leading zeros
    case 'i': return( Format.Parse( "%02d", this.getMinutes() ) );
    // Seconds, with leading zeros
    case 's': return( Format.Parse( "%02d", this.getSeconds() ) );

    // Timezones
    // Whether or not the date is in daylight saving time
    case 'I': return( this.IsDST() ? 1 : 0  );
    // Timezone abbreviation
    case 'T': return( this.GetTimeZoneSZ());
    // Difference to Greenwich time (GMT) with colon between hours and minutes
    case 'P': return( this.GetTimeZone( ":" ) );
    // Difference to Greenwich time (GMT) in hours
    case 'O': return( this.GetTimeZone() );
    // Timezone offset in seconds.
    case 'Z': return( this.GetTZO() * Date.cSecondsMinute );
    // Timezone identifier
    case 'e': return( this.GetTimeZoneSZ() );

    // PRE FORMATTED
    // ISO-8601
    case 'c': return( this.Format( "Y-m-d\\TH:i:sP" ));
    // RFC2822
    // case 'r': return(  );
    case 'r': return( this.Format( "D, d M Y H:i:s O" ));
    // Timestamp
    case 'U': return( parseInt(this.getTime()  / 1000 ) );

    // ISO Year
    case 'o': return( this.ISOYear() );

    // ISO Week of the year
    case 'W': return( Format.Parse( "%02d", this.WeekOfYear( true ) ) );
    // Calendar Week of year; Not ISO
    case 'C': return( this.WeekOfYear( false ) );
  }

  return( p );
};

Date.prototype.Format = function( format )
{
  var result = "";

  for( var i = 0; i < format.length; i++ )
  {
    if( format.charAt( i ) == '\\' )
      result += format.charAt( ++i );
    else
      result += this.GetPart( format.charAt( i ) );
  }

  return( result );
};

Date.Compare = function (dateA, dateB)
{
  // compare UTC epoch milliseconds
  var cmp = dateA.getTime() - dateB.getTime();
  return (cmp > 0) ? -1 : (cmp < 0) ? 1: 0;
};

Date.cPartDate = 0x01;
Date.cPartTime = 0x02;
Date.ParseParts = 0;

Date.Parse = function( sz )
{
  var re, dt, tm, rc = [ 1900, 1, 1, 0, 0, 0 ];
  var months = Date.Months.Short.join( "|" );
  var tests = // pattern, year, month, day
  [
    // yyyy/mm/dd
    [ "^(\\d{4})[^\\w:](\\d{1,2})[^\\w:](\\d{1,2})", 1, 2, 3 ],
    // mm/dd/yy[yy] or dd/mm/yy[yy]
    [ "^(\\d{1,2})[^\\w:](\\d{1,2})[^\\w:](\\d{1,4})", 3, ( Date.SIDate ) ? 2 : 1, ( Date.SIDate ) ? 1 : 2 ],
    // dd mon year
    [ "^(\\d{1,2})[^\\w:]+(" + months + ")\\w*[^\\w:]+(\\d{2,4})", 3, 2, 1 ],
    // mon dd year
    [ "^(" + months + ")\\w*[^\\w:]+(\\d{1,2})[^\\w:]+(\\d{2,4})", 3, 1, 2 ]
  ];

  Date.ParseParts = 0;

  for( var t = 0; t < tests.length; t++ )
  {
    re = new RegExp( tests[t][0], "i" );
    if( ( dt = re.exec( sz ) ) != null )
    {
      for( var r = 0; r < 3; r++ )
      {
        var szdt = dt[tests[t][r+1]];
        if( r == 1 && isNaN( parseInt( szdt ) )  ) // ascii month
        {
          for( var m = 0; m < 12; m++ )
          {
            if( szdt.toUpperCase() == Date.Months.Short[m].toUpperCase() )
            {
              rc[r] = m + 1;
              break;
            }
          }
        }
        else
        {
          rc[r] = parseInt( szdt.replace( /^0+(\d)/, "$1" ) ); // remove leading zeros and assign
        }
      }

      if( rc[0] < 100 )
      {
        var now = new Date();
        rc[0] += parseInt( now.getFullYear() / 100 ) * 100;

        if( ( now.getFullYear() - rc[0] ) > 20 )
          rc[0] += 100;

        if( rc[0] - 20 > now.getFullYear() )
          rc[0] -= 100;
      }

      // validation
      Date.ParseParts |= Date.cPartDate;
      break;
    }
  }

  // 10:21[:21][[A|M]P]
  re = new RegExp( "(\\d{1,2}):(\\d{1,2}):?(\\d{1,2})?\\s*([AP]M)?$", "i" );
  if( ( tm = re.exec( sz ) ) != null )
  {
    for( var r = 0; r < 3 && tm[r+1]; r++ ) // remove leading zeros and assign
      rc[r+3] = parseInt( tm[r+1].replace( /^0+(\d)/, "$1" ) );

    if( tm[4] ) // am|pm
      rc[3] = ( rc[3] % 12 ) + ( tm[4].toLowerCase() == 'pm' ? 12: 0 );

    // validation
    Date.ParseParts |= Date.cPartTime;
  }

  return( ( Date.ParseParts ) ? new Date( rc[0], rc[1] - 1, rc[2], rc[3], rc[4], rc[5] ) : null );
};

var Form =
{
  IsModified : function( oForm, aIgnoreFields )
  {
    var b = false;
    var oInput;

    for( var f = 0; b == false && f < oForm.elements.length; f++ )
    {
      oInput = oForm.elements[f];

      if( aIgnoreFields && aIgnoreFields.length )
      {
        var bSkip = false;
        for( var i = 0; i < aIgnoreFields.length; i++ )
        {
          var re = new RegExp( aIgnoreFields[i] );
          if( re.test( oInput.name ) )
          {
            bSkip = true;
            break;
          }
        }

        if( bSkip )
          continue;
      }

      switch( oInput.type )
      {
        case "textarea":
          if( typeof( CKEDITOR ) != 'undefined' )
          {
            if( CKEDITOR.instances[oInput.id] )
            {
              b = CKEDITOR.instances[oInput.id].checkDirty();
            }
            break;
          }
        case "hidden":
        case "text":
        case "password":
          b = ( oInput.value != oInput.defaultValue );
          break;

        case "radio":
        case "checkbox":
          b = ( oInput.checked != oInput.defaultChecked );
          break;

        case "select-one":
          if( oInput.options.length )
            b = !oInput.options[oInput.selectedIndex].defaultSelected;
          break;

        case "select":
        case "select-multiple":
          for( var o = 0; b == false && o < oInput.options.length; o++ )
            b = ( oInput.options[o].selected != oInput.options[o].defaultSelected );
          break;

        case "submit":
        case "button":
        case "reset":
          // don't check these
          break;

        default:
          break;
      } // Switch
    }

    return( b );
  },

  MakeGetURL : function( oForm )
  {
    var url = '';

    for( var f = 0; f < oForm.elements.length; f++ )
    {
      oInput = oForm.elements[f];
      switch( oInput.type )
      {
        case "hidden":
        case "text":
        case "textarea":
        case "password":
          url = NVP.Set( url, oInput.name , oInput.value, true );
          break;

        case "radio":
        case "checkbox":
          if( oInput.checked )
            url = NVP.Set( url, oInput.name , oInput.value, true );
          break;

        case "select-one":
          url = NVP.Set( url , oInput.name , oInput.value, true );
          break;

        case "select":
        case "select-multiple":
          for( var o = 0; o < oInput.options.length; o++ )
          {
            if( oInput.options[o].selected )
              url = NVP.Set( url , oInput.name , oInput.options[o].value, true );
          }
          break;

        case "submit":
        case "button":
        case "reset":
          // don't check these
          break;

        default:
          break;
      }
    }

    return( url );
  },

  GetFieldValue : function( flds )
  {
    var vals = [];
    // check for array and convert if needed, but not select list
    if( (flds.length && flds.type ) || !flds.length )
      flds = [ flds ];

    for( var i = 0; i < flds.length; i++ )
    {
      switch( flds[i].type )
      {
        case 'text':
        case 'textarea':
        case 'hidden':
        case 'password':
          vals.push( flds[i].value );
          break;
        case 'select':
        case 'select-one':
          vals.push( flds[i].options[flds[i].options.selectedIndex].value );
          break;
        case 'select-multiple':
          var list = [];
          for( var opt = 0; opt < flds[i].options.length; opt++ )
          {
            if( flds[i].options[opt].selected == true )
              list.push( flds[i].options[opt].value );
          }
          vals.push( [ list ] );
          break;
        case 'checkbox':
        case 'radio':

          if( flds[i].checked == true )
            vals.push( flds[i].value );
          break;
      }
    }

    if( vals.length > 1 )
      return( vals );

    return( vals[0] );
  },

  SetFieldValue : function( fld, val )
  {
    if( fld.length && !fld.type )
    {
      if( typeof( val ) == 'string' )
        val = val.split( ',' );

      for( var i = 0; i < fld.length; i++ )
      {
        switch( fld[i].type )
        {
          case 'checkbox':
          case 'radio':
            this.SetFieldValue( fld[i], val );
            break;
          case 'select-multiple':
            this.SetFieldValue( fld[i], val );
            break;
          default:
            if( val.length == fld.length )
              this.SetFieldValue( fld[i], val[i] );
            else
              this.SetFieldvalue( fld[i], val );
            break;
        }
      }
      return( true );
    }

    switch( fld.type )
    {
      case 'text':
      case 'hidden':
      case 'password':
              fld.value = val.toString();   // if an array makes it this var, it should be a string
              break;
      case 'textarea':
              fld.value = val.toString();   // if an array makes it this var, it should be a string
              var pattern = new RegExp( 'ckeditor' );
              if( pattern.test(fld.id) )
              {
                CKEDITOR.instances[fld.id].setData( val.toString() );
              }
              break;
      case 'select':
      case 'select-one':
              var bFound = false;
              for( var opt = 0; opt < fld.options.length; opt++ )
              {
                if( fld.options[opt].value == val )
                {
                  fld.selectedIndex = opt;
                  bFound = true;
                }
              }

              if( !bFound )
                return( false );
              break;

      case 'select-multiple':
              var bFound = false;
              if( typeof( val ) != 'object' )
                val = val.split( ',' );
              for( var opt = 0; opt < fld.options.length; opt++ )
              {
                fld.options[opt].selected = false;
                for( var v = 0; v < val.length; v++ )
                {
                  if( fld.options[opt].value == val[v] )
                  {
                    fld.options[opt].selected = true;
                    bFound = true;
                  }
                }
              }

              if( !bFound )
                return( false );
              break;

      case 'checkbox':
      case 'radio':
              if( typeof( val ) == 'string' )
                val = val.split( ',' );
              if( val.length == 1 )
                fld.checked = ( ( val[0].toString() == "true" ) || ( val[0] == fld.value ) ) ? true : false;
              else
              {
                // if parsing a val array true false is excluded
                fld.checked = false;
                for( var v = 0; v < val.length; v++ )
                {
                  if( fld.value == val[v] )
                  {
                    fld.checked = true;
                    break;
                  }
                }
              }
              break;
    } // endSwitch

    return( true );
  },

  DisableFields : function( bDisable, fm, aTypes, aNames )
  {
    if( aTypes != null && aTypes.length )
    {
      for( var f = 0; f < fm.elements.length; f++ )
      {
        for( var t = 0; t < aTypes.length; t++ )
        {
          if( fm.elements[f].type == aTypes[t] )
            fm.elements[f].disabled = bDisable;
        }
      }
    }

    if( aNames != null && aNames.length )
    {
      for( var f = 0; f < fm.elements.length; f++ )
      {
        for( var t = 0; t < aNames.length; t++ )
        {
          if( fm.elements[f].name == aNames[t] )
            fm.elements[f].disabled = bDisable;
        }
      }
    }
  },

  sFieldRequiredError       : "Field '#0#' is a required field",
  sFieldBadValueError       : "Field '#0#' has an incorrect value.",
  sFieldEqualFieldError     : "Field '#0#' has a different value than field #1#",
  sFieldNotEqualFieldError  : "Field '#0#' has the same value as field #1#",
  sFieldContainFieldError   : "Field '#0#' has part of field #1# value",
  sFieldMinimumError        : "Field '#0#' has a minimum value of #1#",
  sFieldMaximumError        : "Field '#0#' has a maximum value of #1#",
  sFieldMinlengthError      : "Field '#0#' has a minimum length of #1#",
  sFieldMaxlengthError      : "Field '#0#' has a maximum length of #1#",
  sFieldRangeError          : "Field '#0#' has a range of #1# to #2#",
  sFieldDateRangeError      : "Date selections are out of range. Be sure the From date is earlier than the To date.",

  // array of [ field, check, name, custom error message ]
  CheckFields : function( flds, bTrueFalse )
  {
    var bError = false;
    var aMessages = [];

    if( typeof( CKEDITOR ) != 'undefined' )
    {
      for( var instanceName in CKEDITOR.instances )
      {
        if( !document.getElementById( instanceName ) )
        {
          CKEDITOR.instances[instanceName].destroy(true);
          continue;
        }

        if( CKEDITOR.instances[instanceName].checkDirty() )
          CKEDITOR.instances[instanceName].updateElement();
      }
    }

    // check the fields backwards so the focus is at the first bad entry
    for( var f = flds.length-1; f >= 0; f-- )
    {
      var fld = flds[f][0]; // object

      if( !fld )
        continue;

      if( ( fld.length && fld.type ) || !fld.length )
        fld = [ fld ];

      var chk = flds[f][1].split( "," );
      var bBad = false;
      var nam = ( flds[f][2] ? flds[f][2] : fld.name );
      var msg = ParamString( this.sFieldBadValueError, nam );

      for( var i = 0; i < fld.length; i++ )
      {
        var bad = false;

        // trim everything coming in
        if( fld[i].type != 'file' )
        fld[i].value = Format.Trim( fld[i].value );

        if( Browser.IsIE() && Browser.GetVersion() < 9 )
        {
          fld[i].value = fld[i].value.replace( /\r\n/g, "\n" );
          fld[i].value = fld[i].value.replace( /\n\r/g, "\n" );
          fld[i].value = fld[i].value.replace( /\s\s/g, " " );
        }

        // check all options from here out...
        for( var c = 0; c < chk.length && !bad; c++ )
        {
          var opts = chk[c].split( ":" );
          var not = false;
          var opt = false;
          var cmp = '';
          var eva = false;
          var contain = false;

          for( var o = 0; o < opts[0].length; o++ )
          {
            switch( opts[0].charAt( o ) )
            {
              case '?': // optional
                opt = true;
                break;

              case '!': // not
                not = true;
                break;

              case '=': // compare to another field, for verification purposes
                cmp += '=';
                break;

              case '<': // compare to another field, for verification purposes
                cmp += '<';
                break;

              case '>': // compare to another field, for verification purposes
                cmp += '>';
                break;

              case '&': // continuation .. if eval is false then check stops
                eva = true;
                break;

              case '~': // contain ... like perl's =~
                contain = true;
                break;

              default:
                opts[0] = opts[0].substr( o );
                o = opts[0].length + 10;
                break;
            }
          }

          // optional and nothing in there
          if( opt && !fld[i].value.length )
          {
            bad = not = false;
            continue;
          }

          // required fields only below

          // equals another field?
          if( !bad && cmp.length )
          {
            var val1 = fld[i].value;
            var val2 = opts[0]; // fld[i].form[opts[0]].value;
            if( typeof( fld[i].form[val2] ) != 'undefined' )
              val2 = fld[i].form[val2].value;
            var dt1 = Date.Parse( val1 );
            var dt2 = Date.Parse( val2 );
            if( cmp == '=' )
              cmp += '=';
            if( dt1 && dt2 )
            {
              val1 = dt1.Format( "YmdHis" );
              val2 = dt2.Format( "YmdHis" );
            }
            else // 11345
            {
              if( !/^\d+(\.\d+)?$/.test( val1 ) )
                val1 = "'" + escape( val1 ) + "'";
              if( !/^\d+(\.\d+)?$/.test( val2 ) )
                val2 = "'" + escape( val2 ) + "'";
            }

            bad = !eval( val1 + cmp + val2 ); //4295

            if( not )
              bad = !bad;

            if( bad )
            {
              var str = "";
              switch( cmp )
              {
                case '==': str = this.sFieldEqualFieldError; break;
                case '!=': str = this.sFieldNotEqualFieldError; break;
                default: str = this.sFieldBadValueError; break;
              }
              msg = ParamString( str, nam, fld[i].form[opts[0]].name );
            }
          }

          // contains another field?
          if( !bad && contain )
          {
            bad = ( fld[i].value.toLowerCase().indexOf( fld[i].form[opts[0]].value.toLowerCase() ) != -1 );
            if( not )
              bad = !bad;

            if( bad )
              msg = ParamString( this.sFieldContainFieldError, nam, fld[i].form[opts[0]].name );
          }

          // evaluation to continue
          if( !bad && eva )
          {
            var v = opts[0].split( /(\!|\=|\.)/ );

            for( var e = 0; e < v.length; e++ )
            {
              if( !v[e].length || Is.Integer(v[e]) )
                continue;

              var aidx = "";
              var r = /(\w+)(\[\])?(\[\d+\])?/;
              if( r.test( v[e] ) )
              {
                v[e] = RegExp.$1 + RegExp.$2;
                aidx = RegExp.$3;
              }

              if( Is.InputField( fld[i].form, v[e] ) )
                opts[0] = opts[0].replace( v[e] + aidx, "fld[i].form['" + v[e] + "']" + aidx );
            }

            if( !eval( opts[0] ) )
              break;
          }

          if( !bad )
          {
            switch( opts[0].toLowerCase() )
            {
              // checks
              case 'checked':
                bad = !fld[i].checked;
                break;

              case 'numeric':
                bad = !Is.Matches( fld[i].value, "^\\d+$" );
                break;

              case 'email':
                opts[1] = opts[1] || 0;
                bad = !Is.EmailAddress( fld[i].value, opts[1] );
                break;

              case 'creditcard':
                bad = !Is.CreditCard( fld[i].value );
                break;

              case 'zipcode':
                bad = !Is.ZipCode( fld[i].value );
                if( !bad && opts[1] != null )
                  fld[i].value = Format.ZipCode( fld[i].value, opts[1] );
                break;

              case 'phone':
                bad = !Is.PhoneNumber( fld[i].value );
                if( !bad && opts[1] != null )
                  fld[i].value = Format.Phone( fld[i].value, opts[1] );
                break;

              case 'empty':
                bad = !Is.Empty( fld[i].value );
                msg = ParamString( this.sFieldRequiredError, nam, opts[1] );
                break;

              case 'zero':
                bad = !Is.Zero( fld[i].value );
                break;

              case 'float':
                bad = !Is.Float( fld[i].value );

                if( !bad && !isNaN( parseInt( opts[1] ) ) )
                {
                  bad = ( parseFloat( fld[i].value ) < parseFloat( opts[1] ) );
                  msg = ParamString( this.sFieldMinimumError, nam, opts[1] );
                }

                if( !bad && !isNaN( parseInt( opts[2] ) ) )
                {
                  bad = ( parseFloat( fld[i].value ) > parseFloat( opts[2] ) );
                  msg = ParamString( this.sFieldMaximumError, nam, opts[2] );
                }

                if( !bad && !isNaN( parseInt( opts[3] ) ) )
                  fld[i].value = Format.Float( parseFloat( fld[i].value ), parseInt( opts[3] ) );
                break;

              case 'integer':
                bad = !Is.Integer( fld[i].value );

                if( !bad && !isNaN( parseInt( opts[1] ) ) )
                {
                  bad = ( parseInt( fld[i].value ) < parseInt( opts[1] ) );
                  msg = ParamString( this.sFieldMinimumError, nam, opts[1] );
                }

                if( !bad && !isNaN( parseInt( opts[2] ) ) )
                {
                  bad = ( parseInt( fld[i].value ) > parseInt( opts[2] ) );
                  msg = ParamString( this.sFieldMaximumError, nam, opts[2] );
                }

                if( !bad )
                  fld[i].value = parseInt( fld[i].value );
                break;

              case 'datepart':
                bad = !Is.DatePart( fld[i].value );
                break;

              case 'state':
                bad = !Is.State( fld[i].value );
                break;

              case 'minlength':
                if( !isNaN( parseInt( opts[1] ) ) )
                  bad = ( fld[i].value.length < parseInt( opts[1] ) );
                msg = ParamString( this.sFieldMinlengthError, nam, opts[1] );
                break;

              case 'maxlength':
                if( !isNaN( parseInt( opts[1] ) ) )
                  bad = ( fld[i].value.length > parseInt( opts[1] ) );

                msg = ParamString( this.sFieldMaxlengthError, nam, opts[1] );
                break;

              // modifications ...
              case 'upper':
                fld[i].value = fld[i].value.toUpperCase();
                break;

              case 'lower':
                fld[i].value = fld[i].value.toLowerCase();
                break;

              case 'trim':
                fld[i].value = Format.Trim( fld[i].value );
                break;

              case 'eval':
                bad = eval( opts[1] );
                break;

              case 'matches':
                if( opts[1] )
                  bad = !Is.Matches( fld[i].value, opts[1] );
                break;

              case 'date':
                bad = !Is.Date( fld[i].value, opts[1] ); // opts[1] 0, 1 or 2 = none, past, future
                if( !bad )
                  fld[i].value = Format.Date( fld[i].value );
                break;

              case 'time':
                bad = !Is.Time( fld[i].value );
                if( !bad )
                  fld[i].value = Format.Time( fld[i].value );
                break;

              case 'datetime':
                bad = !Is.DateTime( fld[i].value, opts[1] );
                if( !bad )
                  fld[i].value = Format.DateTime( fld[i].value );
                break;

              case 'daterange':
                // get field b
                var _nam  = fld[i].name.substr( 2 );
                    _nam  = 'db' + _nam;
                // gather objs a and b
                var objs  = document.getElementsByName( fld[i].name );
                var objs2 = document.getElementsByName( _nam );

                // match a
                var idx   = 0;
                for( var z = 0; z < objs.length; z++ )
                {
                  if( objs[z] == fld )
                  {
                    idx = z;
                    break;
                  }
                }

                // do checking
                if( fld[i].value && objs2[idx].value )
                {
                  var da = Date.Parse( fld[i].value );
                  var db = Date.Parse( objs2[idx].value );
                  if( da.GetPart( 'U' ) > db.GetPart( 'U' ) )
                  {
                    msg = this.sFieldDateRangeError;
                    bad = true;
                  }
                }

                break;

              default:
                continue;
            } // switch
          }

          if( not )
            bad = !bad;
        } // for chks

        DropClass( fld[i], 'bad' );

		var objs = FindObjects( fld[i], 'lnk' );
		if( objs && objs.lnk )
		{
			DropClass( objs.lnk, 'bad' );
		}

        if( ( typeof( CKEDITOR ) != 'undefined' ) && fld[i].id && CKEDITOR.instances[fld[i].id] ) // 4648
        {
          try
          {
            CKEDITOR.instances[fld[i].id].setUiColor( 'null' );
          }
          catch ( err )
          {
          }
        }

		if( bad )
        {
			if( objs && objs.lnk )
			{
				AddClass( objs.lnk, 'bad' );
			}

		  AddClass( fld[i], 'bad' );

          if( ( typeof( CKEDITOR ) != 'undefined' ) && fld[i].id && CKEDITOR.instances[fld[i].id] )
            CKEDITOR.instances[fld[i].id].setUiColor( '#FF0000' );

          try
          {
            if( !Is.Empty( fld[i].select ) )
              fld[i].select();
            if( !Is.Empty( fld[i].focus ) )
              fld[i].focus();
          }
          catch( e )
          {
          }
        }

        bError |= bad;
        bBad   |= bad;
      } // fld

      if( bBad )
        aMessages.push( (typeof flds[f][3] !== 'undefined') ? flds[f][3] : msg );

    } // flds

    if( !bTrueFalse && bError && aMessages.length )
      alert( aMessages.reverse().join("\n") );

    return( bError );
  }, // CheckFields

  ClearFields : function( fm )
  {
    for( i = 0; i < fm.elements.length; i++ )
    {
      switch( fm.elements[i].type )
      {
        case 'text':
        case 'textarea':
        case 'hidden':
        case 'password':
          fm.elements[i].value = '';
          break;
        case 'select-one':
          fm.elements[i].selectedIndex = -1;
          break;
        case 'checkbox':
        case 'radio':
          fm.elements[i].checked = 0;
          break;
      }
    }
  },

  Reset : function( fm )
  {
    return( 1 );
  },

  Submit : function( fm, args )
  {
    var bOk = true;

    if( typeof( fm ) == 'string' )
      fm = document[fm];

    if( typeof( FormOnSubmit ) == 'function' )
      bOk = FormOnSubmit( fm, args );
    else if( typeof( fm.onsubmit ) == 'function' )
      bOk = fm.onsubmit();

    if( bOk )
      fm.submit();

    return( false );
  },


  /*
    Thckct #10698, and This function is from Carl.
    opts =
    {
      form = form object to post
      url  = url to post to [optional]
      OnProgress = function to call on progress
      OnComplete = function to call on completion
    }
  */
  Send : function( opts )
  {
    if( typeof( FormData ) != 'undefined' ) // IE 10, FF, Safari, Chrome
    {
      var oData = new FormData( opts.form );
      var oReq  = new XMLHttpRequest();
      var n = 0;

      if( AJAX.AppendToURL )
      {
        opts.url += ( opts.url.indexOf( '?' ) > 0 ) ? ( '&' + AJAX.AppendToURL ) : ( '?' + AJAX.AppendToURL );
      }

      oReq.open( "POST", opts.url, true );

      oReq.onload = function( e )
      {
        var evt = ( e ) ? e : window.event;
        var response;

        if( evt.target.responseXML )
          response = DomNodeToObject( evt.target.responseXML.documentElement );
        else
          response = evt.target.responseText;

        if( evt.target.status == 200 )
        {
          if( typeof( opts.OnComplete ) == 'function' )
            opts.OnComplete( { form: opts.form, response: response } );
        }
        else
        {
          alert( "Error " + evt.target.status + " occurred sending your form." );
        }
      };

      oReq.upload.onprogress = function( e )
      {
        var evt = ( e ) ? e : window.event;
        var p = { position: 'position', totalSize: 'totalSize' };

        if( typeof( evt.loaded ) != 'undefined' && typeof( evt.total ) != 'undefined' )
          p = { position: 'loaded', totalSize: 'total' };

        var prx = parseInt( ( evt[p.position] / evt[p.totalSize] ) * 100 );
        if( n != prx )
        {
          n = prx;
          if( typeof( opts.OnProgress ) == 'function' )
            opts.OnProgress( { percent: prx, position: evt[p.position], totalSize: evt[p.totalSize] } );
        }
      };

      oReq.send( oData );
    }
    else // <= IE9 and non-supporting FormData
    {
      if( typeof( document.uploadiframe ) == 'undefined' )
      {
        var iframe = document.createElement( 'iframe' );

        iframe.name = 'uploadiframe';
        iframe.style.display = 'none';
        iframe.onload = function( e )
        {
          var evt = ( e ) ? e : window.event;
          var response;

          if( document.uploadiframe.document.body )
            response = document.uploadiframe.document.body.innerHTML;
          else
            response = DomNodeToObject( document.uploadiframe.document.documentElement );

          if( typeof( opts.OnComplete ) == 'function' )
            opts.OnComplete( { form: opts.form, response: response } );
        };

        document.body.appendChild( iframe );
      }

      with( opts.form )
      {
        var old_action = action;
        var old_target = target;
        action = opts.url;
        method = 'post';
        target = 'uploadiframe';
        enctype = 'multipart/form-data';
        submit();
        action = old_action;
        target = old_target;
      }
    }
  },

  Allow : function( ev )
  {
    ev.preventDefault();
  },

  Normal : function( ev )
  {
    var obj = ev.target;
    while ( obj )
    {
      if( obj.classList && obj.classList.contains( 'form_drag_box' ) )
      {
        obj.classList.remove( 'form_drag_box_active' );
        break;
      }
      obj = obj.parentNode;
    }
  },

  Highlight : function( ev )
  {
    var obj = ev.target;
    while ( obj )
    {
      if( obj.classList && obj.classList.contains( 'form_drag_box' ) )
      {
        obj.classList.add( 'form_drag_box_active' );
        break;
      }
      obj = obj.parentNode;
    }
  },

  DragStart : function( ev )
  {
    ev.dataTransfer.setData( "text", ev.target.id );
  },

  Drop : function( ev )
  {
    ev.preventDefault();
    var data = ev.dataTransfer.getData( "text" );
    var elem = document.getElementById(data);
    if( !elem ) return;
    var form_cell_item = ev.target;
    var appended = false;
    while ( form_cell_item )
    {
      if( form_cell_item.classList.contains( 'form_cell' ) )
      {
        form_cell_item.parentNode.insertBefore( elem, form_cell_item );
        appended = true;
      }
      else if( form_cell_item.classList.contains( 'form_drag_box' ) )
      {
        form_cell_item.classList.remove( 'form_drag_box_active' );
        if( !appended )
        {
          form_cell_item.appendChild( elem );
        }
        break;
      }
      form_cell_item = form_cell_item.parentNode;
    }
  }
}; // Form

var Value =
{
  Min : function( v )
  {
    var r = v;
    for( var i = 0; i < arguments.length; i++ )
    {
      if( r > arguments[i] )
        r = arguments[i];
    }
    return( r );
  },

  Max : function( v )
  {
    var r = v;
    for( var i = 0; i < arguments.length; i++ )
    {
      if( r < arguments[i] )
        r = arguments[i];
    }
    return( r );
  },

  Fit : function( v, a, b )
  {
    return( ( v < a ) ? a : ( v > b ) ? b : v );
  },

  Length : function( obj )
  {
    return( ( typeof(obj.form) == 'undefined' && obj.length ) ? obj.length : ( ( obj ) ? 1 : null ) );
  },

  Object : function ( obj, idx )
  {
    if( typeof(obj.form) == 'undefined' && obj.length )
    {
      if( idx >=0 && idx < obj.length )
        return( obj[idx] );
    }
    else if( idx == 0 )
    {
      return( obj );
    }

    return( null );
  },

  // make a copy of the object
  Copy : function( obj )
  {
    var dst = new Object();

    for( p in obj )
    {
      if( typeof( obj[p] ) == 'function' )
        dst[p] = eval( obj[p] );
      else if( typeof( obj[p] ) == 'object' )
        dst[p] = Value.Copy( obj[p] );
      else
        dst[p] = obj[p];
    }

    return( dst );
  }
};

var Browser =
{
  _Init : false,
  _Make : 'unknown',
  _Version : 0.0,

  Init : function()
  {
    if( Browser._Init )
      return;

    var re = /(MSIE|FireFox|Safari|Opera|Chrome).?([\d\.]+)/i;

    if( re.test( navigator.userAgent ) )
    {
      Browser._Make = RegExp.$1.toLowerCase();
      Browser._Version = RegExp.$2;
    }
    Browser._Init = true;
  },

  IsIE : function()
  {
    Browser.Init();

    return( ( Browser._Make == 'msie' ) ? true : false );
  },

  IsFF : function()
  {
    Browser.Init();

    return( ( Browser._Make == 'firefox' ) ? true : false );
  },

  IsSafari : function()
  {
    Browser.Init();

    return( ( Browser._Make == 'safari' ) ? true : false );
  },

  IsChrome : function()
  {
    Browser.Init();

    return( ( Browser._Make == 'chrome' ) ? true : false );
  },

  IsOpera : function()
  {
    Browser.Init();

    return( ( Browser._Make == 'opera' ) ? true : false );
  },

  GetMake : function()
  {
    Browser.Init();
    return( Browser._Make );
  },

  GetVersion : function()
  {
    Browser.Init();

    return( Browser._Version );
  }
};

var LargeText =
{
  Check : function()
  {
    var lnks = document.getElementsByName( "largetext" );

    for( var i = 0; i < lnks.length; i++ )
    {
      var txt = document.getElementById( "text_" + lnks[i].id );
      if( !txt.innerHTML.length || !txt.style.height || txt.scrollHeight <= parseInt( txt.style.height ) )
      {
        lnks[i].style.display = "none";
        txt.style.height = "auto";
        txt.style.overflow = "visible";
      }
      else
      {
        lnks[i].style.display = "block";
        txt.style.height = "150px";
      }
    }
  },

  Expand : function( lnk )
  {
    var txt = document.getElementById( "text_" + lnk.id );
    lnk.style.display = "none";
    txt.style.height = "auto";
    txt.style.overflow = "visible";
  }
};

var PopUP =
{
  Load: function( url, data, busy )
  {
    var a = new AJAX();
    a.URL = url;
    a.Method = 'POST';
    a.Data = data;
    if( busy && busy.length ) a.Busy = busy;
    a.OnComplete = function( oRequest, lnk )
    {
      PopUP.Open( oRequest.responseText );
    };
    a.Send();
  },

  Open: function( html )
  {
    var rctWin = Screen.GetWindowRectangle();
    // mask
    var oDiv = document.createElement( 'div' );
    // popup window
    var oDiv2 = null;

    if( typeof( html ) == 'string' )
    {
      oDiv2 = document.createElement( 'div' );
      oDiv2.innerHTML = html;
    }
    else
      oDiv2 = html;

    oDiv2.id = 'popupdiv';
    oDiv2.className = 'popupdiv';
    document.body.appendChild( oDiv2 );
    oDiv2.style.left = ( ( rctWin.width / 2 ) - ( oDiv2.clientWidth / 2 ) + rctWin.left ) + "px";
    oDiv2.style.top = ( ( rctWin.height / 2 ) - ( oDiv2.clientHeight / 2 ) + rctWin.top ) + "px";

    if( oDiv )
    {
      oDiv.id = 'popupwindow';
      oDiv.className = 'popupwindow';
      oDiv.style.height = oDiv.style.bottom = ( rctWin.height + rctWin.top ) + 'px';
      oDiv.style.width = oDiv.style.right   = ( ( rctWin.width + rctWin.left ) + 'px' );
      document.body.appendChild( oDiv );
    }
  },

  Create: function( url, sName, busy )
  {
    var a = new AJAX( { AbortInterval: false } );
    a.URL = url;
    a.Method = 'POST';
    a.Data = sName;
    if( typeof( busy ) != 'undefined' )
      a.Busy = busy;
    a.OnComplete = function( oRequest, sID )
    {
		var cType = oRequest.getResponseHeader( "Content-Type" );

		var rctWin = Screen.GetWindowRectangle();

		var html = '';

		if( cType.indexOf( 'text/xml' ) > -1 )
		{
			var obj = false;
			try
			{
				obj = DomNodeToObject( oRequest.responseXML.documentElement );

				html = obj.html;

				if( obj.onload )
					eval( obj.onload );
			}
			catch(e)
			{
			}
		}
		else
		{
			html = oRequest.responseText;
		}

		// mask
		var oDiv = document.createElement( 'div' );

		// popup window
		var oDiv2 = document.createElement( 'div' );

		if( oDiv2 )
		{
			oDiv2.id = 'popupdiv';
			oDiv2.className = 'popupdiv';
			document.body.appendChild( oDiv2 );
			oDiv2.innerHTML = html;
			oDiv2.style.left = ( ( rctWin.width / 2 ) - ( oDiv2.clientWidth / 2 ) + rctWin.left ) + "px";
			oDiv2.style.top = ( ( rctWin.height / 2 ) - ( oDiv2.clientHeight / 2 ) + rctWin.top ) + "px";
		}

		if( oDiv )
		{
			oDiv.id = 'popupwindow';
			oDiv.className = 'popupwindow';
			oDiv.style.height = oDiv.style.bottom = ( ( window.scrollMaxY ) ? // IF NOT IE ADD FOR SCROLL
			  ( window.scrollMaxY - window.scrollY ) : 0 ) + ( rctWin.height + rctWin.top ) + 'px';
			oDiv.style.width = oDiv.style.right = ( rctWin.width + rctWin.left ) + 'px';
			document.body.appendChild( oDiv );
		}

		if( sID )
		{
			var oInp = document.getElementById( sID );
			if( oInp )
			  oInp.focus();
			else
			{
			  for( var f = document.forms.length - 1; f >= 0; f-- )
			  {
				if( document.forms[f].elements[sID] )
				{
				  document.forms[f].elements[sID].focus();
				  break;
				}
			  }
			}
		}
	};
	a.Send();
  },

  Update : function( html )
  {
      var rctWin = Screen.GetWindowRectangle();
      var oDiv2 = PopUP.GetDiv();
          oDiv2.innerHTML = html;
          oDiv2.style.left = ( ( rctWin.width / 2 ) - ( oDiv2.clientWidth / 2 ) + rctWin.left ) + "px";
          oDiv2.style.top = ( ( rctWin.height / 2 ) - ( oDiv2.clientHeight / 2 ) + rctWin.top ) + "px";
  },

  GetDiv : function()
  {
    return( document.getElementById( 'popupdiv' ) );
  },

  Destroy: function()
  {
    var aNames = [ 'popupwindow', 'popupdiv' ];

    for( var i = 0; i < aNames.length; i++ )
    {
      var oDiv = document.getElementById( aNames[i] );
      if( oDiv )
        document.body.removeChild( oDiv );
    }
  }
};

var Debug =
{
  _width : 200,
  _height : 150,
  _onscroll : null,
  _onresize : null,
  _line : 1,

  GetWindow : function()
  {
    return( document.getElementById('debug_window') );
  },

  Position : function()
  {
    var dbg = Debug.GetWindow();

    if( dbg )
    {
      with( document )
      {
        var wid = ( window.innerWidth ) ? window.innerWidth : documentElement.clientWidth;
        var hgt = ( window.innerHeight ) ? window.innerHeight : documentElement.clientHeight;
        var scrollTop = (documentElement.scrollTop) ? documentElement.scrollTop : body.scrollTop;
        var scrollLeft = (documentElement.scrollLeft) ? documentElement.scrollLeft : body.scrollLeft;
      }

      dbg.style.left = ( wid - Debug._width + scrollLeft - 25 ) + 'px';
      dbg.style.top = ( hgt - Debug._height + scrollTop - 25 ) + 'px';
    }
  },

  Open : function()
  {
    var dbg = Debug.GetWindow();

    if( !dbg )
    {
      // popup window
      dbg = document.createElement( 'div' );
      if( dbg )
      {
        dbg.id = 'debug_window';
        dbg.className = 'debug_window';
        dbg.style.width = this._width + 'px';
        dbg.style.height = this._height + 'px';
        dbg.innerHTML = '';

        document.body.appendChild( dbg );
      }

      Debug.Position();

      Debug._line = 1;
      Debug._onscroll = window.onscroll;
      Debug._onresize = window.onresize;

      window.onscroll = function( e ) { Debug.Position(); if( Debug._onscroll ) Debug._onscroll(); };
      window.onresize = function( e ) { Debug.Position(); if( Debug._onresize ) Debug._onresize(); };
    }

    return( dbg );
  },

  Print : function( /* uses argument list, takes one or more items to print */ )
  {
    var dbg = Debug.Open();

    if( dbg )
    {
      for( var i = 0; i < arguments.length; i++ )
      {
        var o = arguments[i];

        switch( typeof( o ) )
        {
          case 'undefined':
            break;

          case 'object':
            var a = [];
            for( p in o )
            {
              if( typeof( o[p] ) != "function" )
                a[a.length] = ( p + ": " + o[p] );
            }
            o = a.join(", ");
            break;

          default:
            break;
        }

        dbg.innerHTML += ( Debug._line++ ) + ": " + o + '<br />';
      }

      dbg.scrollTop = dbg.scrollHeight;
    }
  },

  Clear : function()
  {
    var dbg = Debug.GetWindow();

    if( dbg )
      dbg.innerHTML = '';
  },

  Close : function()
  {
    var dbg = Debug.GetWindow();
    if( dbg )
      document.body.removeChild( dbg );

    if( Debug._onscroll )
      window.onscroll = Debug._onscroll;

    if( Debug._onresize )
      window.onresize = Debug._onresize;
  }
};

// Cancels bubble trough on event
Event.prototype.Cancel = function()
{
	if( this.preventDefault )
		this.preventDefault();

	if( this.stopPropagation )
		this.stopPropagation();

	this.cancelBubble = true;
	this.returnValue = false;

	return false;
};

Event.Get = function( e )
{
	var evt = e || window.event;

	// ie6-8
	evt.which  = evt.which || evt.keyCode;
	evt.target = evt.target || evt.srcElement;
	evt.relatedTarget = evt.relatedTarget || ( ( evt.type == "mouseover" ) ? evt.fromElement : evt.toElement );

	return evt;
};

Event.Kill = function( e )
{
	var evt = Event.Get( e );
	return evt.Cancel();
};

var Screen =
{
  MouseX : 0, // actual window position, scroll + pos
  MouseY : 0,
  X      : 0, // just position on screen
  Y      : 0,

  SetMousePosition : function( e )
  {
    var evt = ( e ) ? e : window.event;

    Screen.MouseX = Screen.pointerX(e);
    Screen.MouseY = Screen.pointerY(e);
    Screen.X      = evt.clientX;
    Screen.Y      = evt.clientY;
  },

  pointerX : function(event)
  {
    event = event || window.event;
    var docElement = document.documentElement,
     body = document.body || { scrollLeft: 0 };

    return( event.pageX || ( event.clientX + (docElement.scrollLeft || body.scrollLeft) - ( docElement.clientLeft || 0 ) ) );
  },

  pointerY : function(event)
  {
    event = event || window.event;
    var docElement = document.documentElement,
     body = document.body || { scrollTop: 0 };

    return( event.pageY || ( event.clientY + ( docElement.scrollTop || body.scrollTop ) - (docElement.clientTop || 0 ) ) );
  },

  GetMousePosition : function()
  {
    return( { x: this.MouseX, y: this.MouseY } );
  },

  GetScreenPosition : function()
  {
    return( { x: this.X, y: this.Y } );
  },

  MouseInitialize : function()
  {
    if( !Browser.IsIE() )
    {
      window.captureEvents( Event.MOUSEMOVE | Event.KEYPRESS );
      window.onmousemove = Screen.SetMousePosition;
    }
    else
    {
      document.onmousemove = Screen.SetMousePosition;
    }
  },

  GetWindowRectangle : function()
  {
    with( document )
    {
      var nleft = ( documentElement.scrollLeft ) ? documentElement.scrollLeft : body.scrollLeft;
      var ntop = ( documentElement.scrollTop ) ? documentElement.scrollTop : body.scrollTop;
      var nwidth = ( window.innerWidth ) ? window.innerWidth : documentElement.clientWidth;
      var nheight = ( window.innerHeight ) ? window.innerHeight : documentElement.clientHeight;
    }

    return( new Rectangle( nleft, ntop, nwidth, nheight ) );
  }
};

var ComboBox =
{
  sCfmAdd : "#0# is not in the list, Are you sure you want to add it?",

  // variables
  _SEL    : [],           // holds the suggest boxes, allows for only 1 open at a time
  URL     : '',           // ajax url for calls
  onset   : null,
  oInput  : null,         // text box for displaying
  oInpDef : null,
  oSelect : null,         // suggest select box
  oBox    : null,         // holds dimensions for select box
  oHidden : null,         // hidden field to hold value
  oHidDef : null,
  oForm   : null,         // form
  oImage  : null,         // dropdown image if there
  bSame   : 0,            // if hidden field is same as txt box
  TAG     : null,         // which tag is asked for
  IF      : null,         // extended interface { obj }
  _Params   : null,       // if array of fieldnames, include on verify, fetch, search
  suggestTimer : null,
  bShow   : false,

  Debug : function( msg ) // use to debug
  {
    if( false && this.oSelect )
      Debug.Print( msg + '__' + this.bShow );
  }, // Debug

  Locate : function( e )  // oinput focus calls this, sets object
  {
    var evt = ( e ) ? e : window.event;
    var obj = ( evt.target ) ? evt.target : evt.srcElement;

    // IF SAME, DON'T RELOAD
    if( this.oInput && ( obj == this.oInput ) )
    {
      this.Debug( 'TRUE' );
      this.bShow = true;
      return( false );
    }

    var oFound    = FindObjects( obj, 'txt,sel,img' );

    this.oInput   = ( oFound ) ? oFound.txt : null;
    this.oForm    = ( this.oInput ) ? this.oInput.form : null;
    this.oSelect  = ( oFound ) ? oFound.sel : null;
    this.oHidden  = ( oFound ) ? oFound.base : null;
    this.oImage   = ( oFound && oFound.img ) ? oFound.img : null;

    // collect the suggest boxes
    if( !ArrayHas( this._SEL, this.oSelect ) )
      this._SEL.push( this.oSelect );

    var oPrms     = eval( '(' + this.oHidden.title + ')' );
    this.onset    = ( oPrms.onset ) ? eval( oPrms.onset ) : null;
    this.URL      = ( oPrms.url ) ? oPrms.url : null;                     // ajax url
    this.bSame    = ( eval( oPrms.same ) ) ? 1 : 0;                       // if hidden field is same as txt box
    this.TAG      = ( oPrms.tag ) ? oPrms.tag.toUpperCase() : 'SELECT';   // tag asked for, used to decide which sub functions to use
    this.NiL      = ( oPrms.NiL ) ? oPrms.NiL : 'A';                      // Not in List var, [A]llow, [P]rompt, [D]eny
    this.IF       = ( oPrms.iface ) ? eval( oPrms.iface ) : null;         // interface
    this._Params  = ( oPrms.param ) ? oPrms.param.toString() : null;      // list of csv names, pulls from page on every ajax request
    this.oBox     = GetAbsolutePosition( this.oInput );
    this.Debug( 'TRUE' );
    this.bShow    = true;

    this.oInpDef = this.oInput.defaultValue;
    this.oHidDef = this.oHidden.defaultValue;

    this.SetPosition();
    this.SetImage();
    this.SetAttributes();
  }, // Locate

  SetImage : function()   // SetImage : set style on oImage
  {
    if( this.oImage )     // set height, scale image
    {
      this.oImage.style.display = 'inline';
      this.oImage.style.height  = this.oBox.height + 'px';
      this.oImage.style.top     = this.oBox.top + 'px';
      this.oImage.style.left    = this.oBox.left + this.oBox.width - this.oImage.width + 'px';
      this.oImage.style.right   = parseInt( this.oBox.left + this.oBox.width ) + 'px';
      this.oImage.style.cursor  = 'pointer';
    }
  }, // SetImage

  SetPosition : function()    // SetPosition : sets the select style to position under the input/text
  {
    if( this.oSelect )
    {
      // close all other suggest boxes
      for( var i = 0; i < this._SEL.length; i++ )
      {
        if( this.oSelect != this._SEL[i] )
          this._SEL[i].style.display = 'none';
      }

      this.oSelect.style.zIndex = '10';
      this.oSelect.style.left   = this.oBox.left + 'px';
      this.oSelect.style.top    = parseInt( this.oBox.top + this.oBox.height - 2 ) + 'px';
      this.oSelect.style.right  = parseInt( this.oBox.left + this.oBox.width ) + 'px';
      this.oSelect.style.width  = this.oBox.width + 'px';
    }
  }, // SetPosition

  BuildAjaxCall : function( prms, returnReference )   // BuildAjaxCall : builds ajax call
  {
    clearTimeout( this.suggestTimer );

    var params = '';

    if( this._Params )
    {
      var aPars = this._Params.split( ',' );

      for( var i = 0; i < aPars.length; i++ )
      {
        var inp = this.oForm[aPars[i]];
        if( inp )
          params = NVP.Set( params, inp.name, inp.value );
      }
    }

    for( var k in prms )
      params = NVP.Set( params, k, prms[k] );

    var a = new AJAX();
    a.URL = this.URL;
    a.Params = params;
    a.Data   = this.oSelect;
    a.Method = 'POST';
    a.OnComplete = returnReference;
    a.Send();

    this.Debug( 'BuildAjaxCall' );
  }, // BuildAjaxCall

  Hide : function( caller )   // Hide : hides suggest box
  {
    this.Debug( 'Hide: ' + caller + ' -- ' );
    this.bShow = false;

    // if same and boolean to check is true, set hidden to input
    if( this.bSame )
      this.oHidden.value = this.oInput.value;

    setTimeout( 'ComboBox._Hide();', 300 );
  }, // Hide

  _Hide : function()
  {
    this.Debug( '_Hide:' );

    if( !this.bShow )
    {
      this.oSelect.style.display = 'none';
      this.CheckInList();
      clearTimeout( this.suggestTimer );
    }
  },

  CheckInList : function()    // Handles onBlur, checks NiL
  {
    if( ( this.oHidden.value == this.oHidDef ) && ( this.oInput.value != this.oInpDef ) )
    {
      switch( this.NiL )
      {
        case 'A':
        case 'P':
          this.oHidden.value  = '';
          if( this.oInput.value == '' )
          {
          }
          else if( confirm( ParamString( ComboBox.sCfmAdd, this.oInput.value ) ) )
          {
            this.oHidden.value = -1;
            break;
          }
        case 'D':
          this.oInput.value   = this.oInpDef;
          this.oHidden.value  = this.oHidDef;
          break;
      }
    }
  }, // CheckInList

  Set : function( hValue, iValue )    // Set : sets the hidden field value and input/text field value then runs hide
  {
    this.Debug( 'Set' );
    this.oHidden.value = hValue;

    if( this.oHidDef != hValue )
    {
      if( this.oHidden.onchange )
        this.oHidden.onchange();
    }

    this.oHidDef = hValue;

    if( iValue )
    {
      this.oInpDef = iValue;
      this.oInput.value = iValue;
    }

    this.bShow = false;
    this._Hide();

    if( this.onset )
      this.onset( this.oHidden );
  }, // Set

  CheckFill : function()
  {
    if( this.IF && typeof( this.IF.CheckFill ) == 'function' )
      this.IF.CheckFill();
  }, // CheckFill

  FocusSuggest : function()
  {
    this.bShow = true;
    this.oSelect.focus();
    if( this.IF && typeof( this.IF.OnFocusSuggest ) == 'function' )
      this.IF.OnFocusSuggest();
  }, // FocusSuggest

  FocusInput : function()
  {
    this.bShow = true;
    this.oInput.focus();
  }, // FocusInput

  Suggest : function( e )   // Suggest : as type in text field, populate suggest box
  {
    var evt = ( e ) ? e : window.event;
    var key = ( evt.keyCode ) ? evt.keyCode : evt.which;

    this.bShow = true;

    // if down arrow, select first option in select box
    if( key == 40 && this.oSelect.style.display != 'none' )
    {
      this.FocusSuggest();
      if( this.TAG == 'SELECT' )
        this.oSelect.options[0].selected = true;
      return;
    }

    // if down arrow wasn't pressed, submit ajax call to fetch for search
    // only do something if there is a value in the input
    if( this.oInput.value.length )
    {
      if( this.suggestTimer )
        clearTimeout( this.suggestTimer );

      this.Debug( 'Suggest' );

      this.suggestTimer = setTimeout( function() {
          ComboBox.BuildAjaxCall( { search : ComboBox.oInput.value }, ComboBox.Response ); }, 1000 );
    }
  }, // Suggest

  ShowAll : function( evt )   // ShowAll : calls 'search' with value of '*'
  {
    this.Locate( evt );

    if( this.oSelect.style.display != 'none' )
    {
      this._Hide();
      return;
    }

    this.Debug( 'ShowAll' );
    this.FocusInput();
    this.BuildAjaxCall({ search:'*' }, ComboBox.ShowAllResponse );
  }, // ShowAll

  ShowAllResponse : function( oRequest, oSel )
  {
    ComboBox.Response( oRequest, oSel, 1 );
  }, // ShowAllResponse

  Response : function( oRequest, oSel, bAll )   // Response : ajax response to suggest
  {
    // hides if on new select,
    // but what about if not on a select ...shouldn't show any
    if( ( oSel != ComboBox.oSelect ) || !ComboBox.bShow )
    {
      oSel.style.display = 'none';
      return( false );
    }

    ComboBox.SetPosition();

    if( ComboBox.IF && typeof( ComboBox.IF.OnResponse ) == 'function' )
      ComboBox.IF.OnResponse( oRequest, bAll );
  }, // Response

  SetAttributes : function()
  {
    if( this.IF && typeof( this.IF.OnSetAttributes ) == 'function' )
      this.IF.OnSetAttributes();
  }, // SetAttributes

  Action : function( elem, e )
  {
    if( this.IF && typeof( this.IF.OnAction ) == 'function' )
      this.IF.OnAction( elem, e );
  } // Action
};

var CBSelect =
{
  defaultSize : 5,

  CheckFill : function()
  {
    ComboBox.Debug( 'CBSelect CheckFill' );

    if( !ComboBox.oSelect || !ComboBox.oSelect.options.length || ComboBox.bShow )
      return;

    var val = '';
    var txt = '';

    for( var i = 0; i < ComboBox.oSelect.options.length; i++ )
    {
      if( ComboBox.oInput.value.toLowerCase() == ComboBox.oSelect.options[i].text.toLowerCase() )
      {
        txt = ComboBox.oSelect.options[i].text;
        val = ( ComboBox.bSame ) ? ComboBox.oSelect.options[i].text : ComboBox.oSelect.options[i].value;
        ComboBox.Debug( 'CF = ' + txt + '__' + val );
        break;
      }
    }

    ComboBox.Set( val, txt );
  }, // CheckFill

  OnSetAttributes : function( sz )
  {
    ComboBox.oSelect.style.zIndex = 5;
    ComboBox.oSelect.size = ( sz ) ? sz : this.defaultSize;
    ComboBox.oSelect.onkeyup = function( event )
    {
      ComboBox.oSelect.focus();
      ComboBox.Action( ComboBox.oSelect, event );
    };

    ComboBox.oSelect.onclick = function( event )
    {
      ComboBox.Action( ComboBox.oSelect, event );
    };
  }, // OnSetAttributes

  // OnAction : function to handle events on the select box
  OnAction : function( elem , e )
  {
    var evt = ( e ) ? e : window.event;
    var key = ( evt.keyCode ) ? evt.keyCode : evt.which;

    if( elem.options[elem.options.length-1].selected && key == 40 )
    {
      if( elem.last )
      {
        elem.selectedIndex = 0;
        return;
      }
      else
      {
        elem.last = true;
        return;
      }
    }
    else
    {
      elem.last = false;
    }

    // if enter / return was pressed
    if( key == 13 || evt.type == "click" )
    {
      if( elem.options.length && elem.selectedIndex >= 0 )
      {
        var val = ( ComboBox.bSame == 1 ) ?
          elem.options[elem.selectedIndex].text : elem.options[elem.selectedIndex].value;

        ComboBox.Set( val, elem.options[elem.selectedIndex].text );
      }
      else
      {
        ComboBox.Hide( 'OnAction' );
      }
    }

    // up arrow
    if( key == 38 )
    {
      if( elem.options[0].isSelected )
        ComboBox.FocusInput();

      for( var i = 0; i < elem.options.length; i++ )
      {
        if( elem.options[i].selected )
        {
          elem.options[i].isSelected = 1;
          break;
        }
      }
    }
  },

  OnResponse : function( oRequest, showAll )
  {
    // boolean to keep from popping up empty search box
    var bFirst = true;

    var cType = oRequest.getResponseHeader( "Content-Type" ).toLowerCase();

    if( cType.indexOf( "text/xml" ) > -1 )
    {
      var root = oRequest.responseXML.documentElement;

      if( root )
      {
        var keys = root.getElementsByTagName( 'key' );
        var values = root.getElementsByTagName( 'value' );

        if( keys && values )
        {
          for( var i = 0; i < keys.length; i++ )
          {
            if( bFirst )
            {
              ComboBox.Debug( 'OnResponse - Was First' );
              ComboBox.bShow = true;
              ComboBox.oSelect.style.display = 'block';
              ComboBox.oSelect.options.length = 0;
              ComboBox.oSelect.size = this.defaultSize;
              bFirst = false;
            }

            var bSel = ( ComboBox.oInput.value == values.item(i).firstChild.data ) ? true : false;
            var opt_val = Entities.Decode( unescape( values.item(i).firstChild.data ) );
            var opt_key = ( keys.item(i).firstChild ) ? keys.item(i).firstChild.data : '';
            var opt = new Option( opt_val, opt_key, false, bSel );
            ComboBox.oSelect.options[ComboBox.oSelect.length] = opt;
          }
        }
        else
        {
          ComboBox.oSelect.options.length = 0;
        }

        // if no options came back, "still set to first run" , then hide cuz empty
        if( bFirst )
        {
          ComboBox.Hide( 'OnResponse' );
        }
      }
      else
      {
        ComboBox.Hide( 'OnResponse' );
      }
    }
  }
};

var CBDiv =
{
  // TestSize : sets the width of the div
  TestSize : function()
  {
    ComboBox.Debug('TestSize ' + ComboBox.TAG.toUpperCase() );

    if( ComboBox.TAG.toUpperCase() == 'SELECT' )
      return;

    ComboBox.oSelect.style.width = ComboBox.oBox.width + 'px';

    if( ComboBox.oSelect.clientWidth < ComboBox.oSelect.scrollWidth )
    {
      var scrollwidth = ComboBox.oSelect.scrollWidth - ComboBox.oSelect.clientWidth;
      ComboBox.oSelect.style.width = ComboBox.oBox.width + scrollwidth + "px";
    }
  },

  // OnSetAttributes : set style on the select div
  OnSetAttributes : function()
  {
    ComboBox.oSelect.onmouseup = function( event )
    {
      ComboBox.Debug( 'onMouseUp' );
      CBDiv.TestSize();
      ComboBox.FocusInput();
    };
    ComboBox.oSelect.onscroll = function( event )
    {
      ComboBox.FocusInput();
    };
    ComboBox.oSelect.style.height = '100px';
    ComboBox.oSelect.style.overflow = 'auto';
  },

  // OnResponse : handles the response XML on the div
  OnResponse : function( oRequest, showAll )
  {
    ComboBox.Debug( 'OnResponse - Div' );

    var cType = oRequest.getResponseHeader( "Content-Type" ).toLowerCase();

    if( cType.indexOf( "text/xml" ) > -1 )
    {
      var obj = DomNodeToObject( oRequest.responseXML.documentElement );
      if( obj )
      {
        if( obj.html && !obj.html.length )
        {
          ComboBox.Debug( 'No ResponseText XML' );
          if( ComboBox.oSelect.style.display != 'none' )
          {
            ComboBox.Debug( 'No ResponseText XML - Display' );
            ComboBox.Hide( 1, 'OnResponse - No XML' );
          }
        }
        else if( ComboBox.oSelect.style.display == 'none' )
        {
          ComboBox.oSelect.style.display = 'block';
        }

        ComboBox.oSelect.innerHTML = obj.html;
        setTimeout( "CBDiv.TestSize();", 500 );
      }
    }
    else
    {
      if( !oRequest.responseText.length )
      {
        ComboBox.Debug( 'No ResponseText' );
        if( ComboBox.oSelect.style.display != 'none' )
        {
          ComboBox.Debug( 'No ResponseText - Display' );
          ComboBox.Hide( 1, 'OnResponse - NoText' );
        }
      }
      else if( ComboBox.oSelect.style.display == 'none' )
      {
        ComboBox.oSelect.style.display = 'block';
      }

      ComboBox.oSelect.innerHTML = oRequest.responseText;
    }
  }
};

/**** LOOSE FUNCTIONS BELOW **************************************************/

function ParamString( s )
{
  for( var i = 1; i < arguments.length; i++ )
  {
    var rep = "#" + (i-1) + "#";
    var tmp = s.replace( rep, arguments[i] );
    while( s != tmp )
    {
      s = tmp;
      tmp = s.replace( rep, arguments[i] );
    }

    tmp = s.replace( "%" + (i-1), arguments[i] );
    while( s != tmp )
    {
      s = tmp;
      tmp = s.replace( "%" + (i-1), arguments[i] );
    }
  }

  return( s );
};

function ListProps( o, print )
{
  var a = [];
  for( p in o )
  {
    if( typeof( o[p] ) != "function" )
      a[a.length] = ( p + " = " + o[p] );
  }
  return( a.join( ( print ) ? ',' : "\r\n" ) );
};

function ListAllProps( o )
{
  var a = [];

  for( p in o )
  {
    var data = "";

    switch( typeof( o[p] ) )
    {
      case 'function':
        continue;

      case 'object':
        data = ( p + " = { " + ListAllProps( o[p] ) + " }" );
        break;

      default:
        data = ( p + " = " + o[p] );
    }

    a[a.length] = data;
  }

  return( a.join("\r\n") );
};

function Style_CSStoJS( name )
{
  return( name.replace( /-([a-z])/g,
    function( $0, $1 )
    {
      return( $1.toUpperCase() )
    }
    ) );
};

function Style_JStoCSS( name )
{
  return( name.replace( /([A-Z])/g,
    function( $0, $1 )
    {
      return( "-" + $1.toLowerCase() )
    }
  ) );
};

function GetStyle( elem, prop )
{
  var CSSprop = undefined;
  if( window.getComputedStyle ) // FF & OPERA
  {
    var oStyle = window.getComputedStyle(elem,null);
    if( oStyle )
      CSSprop = oStyle.getPropertyValue(Style_JStoCSS(prop));
  }
  else if(elem.currentStyle) // IE
  {
    CSSprop = elem.currentStyle[Style_CSStoJS(prop)];
  }

  return( CSSprop );
};

function Rectangle( left, top, width, height )
{
  this.type   = 'Rectangle';
  this.left   = left;
  this.top    = top;
  this.width  = width;
  this.height = height;
};

function GetAbsolutePosition( obj, noabs )
{
  var rct = new Rectangle( 0, 0, obj.offsetWidth, obj.offsetHeight );
  if( typeof( obj.clientX ) != "undefined" && typeof( obj.clientY ) != "undefined" )
  {
    rct.left = obj.clientX;
    rct.top = obj.clientY;
  }
  else
  {
    var parray = [ 'fixed', 'absolute' ];
    while( obj && ( noabs || !ArrayHas( parray, GetStyle( obj, "position" ) ) ) )
    {
      rct.top   += parseInt( obj.offsetTop );
      rct.left  += parseInt( obj.offsetLeft );

      var oPar = obj.parentNode;

      /* THIS NO WORKIE
      // Added Safari check because it was returning the wrong position to the file uploader -- kpc
      if( oPar && oPar.tagName && oPar.tagName.toLowerCase() != 'html' && !Browser.IsSafari )
      {
        rct.top   -= parseInt( obj.parentNode.scrollTop );
        rct.left  -= parseInt( obj.parentNode.scrollLeft );
      }
      */

      obj = obj.offsetParent;
    }
  }

  rct.bottom  = rct.top + rct.height;
  rct.right   = rct.left + rct.width;

  return( rct );
};

function CallUploader( sBasename, oOptions )
{
  var oFileTransfer = GetFileTransfer( sBasename );
  DoFileUpload( oFileTransfer, sBasename, oOptions );
  MoveUploader( oFileTransfer, sBasename, oOptions );
};

function GetFileTransfer( sBasename )
{
  var oFileTransfer = window.FileTransfer[sBasename + "_js"];

  if( !oFileTransfer )
    oFileTransfer = new FileTransfer( sBasename + "_js", sBasename + "_swf" );

  return( oFileTransfer );
};

function MoveUploader( oFileTransfer, sBasename, oOptions )
{
  var sSWF  = sBasename + '_swf';
  var oSWF  = (( document[sSWF] ) ? document[sSWF] : window[sSWF] );
  var oTgt  = document.getElementById( sBasename + '_lnk' );
  var rct   = GetAbsolutePosition( oTgt );
  oSWF.style.zIndex = 10;
  oSWF.style.left   = ( rct.left - 3 ) + 'px';
  oSWF.style.top    = ( rct.top - 3 ) + 'px';
  if( !oOptions.debug )
  {
    oSWF.style.width  = rct.width + 'px';
    oSWF.style.height = rct.height + 'px';
    oSWF.style.right  = rct.right + 'px';
    oSWF.style.bottom = rct.bottom + 'px';
  }
};

function DoFileUpload( oFileTransfer, sBasename, oOptions )
{
  if( oFileTransfer.GetFileCount() && oFileTransfer.GetFile( 0 ).status < 5 )
    return;

  // function defs
  oFileTransfer.OnOpen = function( oFR )
  {
    if( oFR.Options.target == 'showbusy' )
      SetCursor( 'wait' );
    else
    {
      var oLnk = document.getElementById( oFR.ID + "_lnk" );
      var oTxt = document.getElementById( oFR.ID + "_txt" );
      var oBar = document.getElementById( oFR.ID + "_bar" );
      if( !oFR.Options.target )
        oFR.Options.target = oFR.ID + "_lnk";

      var oTgt = document.getElementById( oFR.Options.target );
      if( !oTgt )
        oTgt = oLnk;

      var oRct = GetAbsolutePosition( oTgt );

      oTxt.innerHTML = "0%";

      // target is same as link
      if( ( oLnk.tagName.toLowerCase() != 'img' || oRct.width < 50 ) && oLnk == oTgt )
      {
        // set height to match
        oTxt.style.height = oRct.height + "px";
      }
      // different .. position in center of target
      else
      {
        oRct.left += 5;
        oRct.width -= 12;
        oRct.top += ( (oRct.height/2) - (parseInt(oTxt.style.height)/2) ); //offsetHeight
      }
      // adjust font size to maximum?
      oTxt.style.fontSize = ( parseInt( oTxt.style.height ) - 8 ) + "px";

      oTxt.style.left = oRct.left + "px";
      oTxt.style.top = oRct.top + "px";
      oTxt.style.width = oRct.width + "px";
      oTxt.style.display = "inline";

      oBar.style.left = ( oRct.left + 1 ) + "px";
      oBar.style.top = (( parseInt( oTxt.style.top ) + parseInt( oTxt.style.height ) ) - ( parseInt( oBar.style.height ) ) ) + "px";
      oBar.style.width = "0px";
      oBar.style.display = "inline";

      oLnk.disabled = true;
    }
  };

  oFileTransfer.OnOverallProgress = function( oFR, nSent, nTotal )
  {
    if( oFR.Options.target == "showbusy" )
      SetCursor( 'wait' );
    else
    {
      var oTxt = document.getElementById( oFR.ID + "_txt" );
      var oBar = document.getElementById( oFR.ID + "_bar" );
      var nPct = ( nSent / nTotal );
      if( oTxt )
        oTxt.innerHTML = parseInt( nPct * 100 ) + "%";
      if( oBar )
        oBar.style.width = parseInt( nPct * ( oTxt.offsetWidth - 2 )) + "px";

      if( oFR.Options.onprogress )
        eval( oFR.Options.onprogress + "( this, oFR, nSent, nTotal )" );
    }
  };

  oFileTransfer.OnOverallComplete = function( oFR, sError )
  {
    if( oFR.Options.target == "showbusy" )
      SetCursor();
    else
    {
      var oLnk = document.getElementById( oFR.ID + "_lnk" );
      var oTxt = document.getElementById( oFR.ID + "_txt" );
      var oBar = document.getElementById( oFR.ID + "_bar" );
      if( oTxt ) oTxt.style.display = "none";
      if( oBar ) oBar.style.display = "none";
      if( oBar ) oBar.style.width = '0px';
      if( oLnk ) oLnk.disabled = false;
    }

    if( sError && sError.length )
    {
      alert( sError );
      return;
    }
  };

  // IF URL IS SET, USE IT, CREATED TO FIX FF 302 ERROR, PASSED IN.
  if( oOptions.URL )
    oFileTransfer.Set( "URL", unescape( oOptions.URL ) );

//  oOptions.SESSIONID = Cookie.GetNVP( 'MBO5.CLIENT', 'SESSIONID' );
//  oFileTransfer.Set( "URL", URL.Page( 'FileTransfer', 'Default', oOptions ) );

  // working code ..
  oFileTransfer.Options = oOptions;
  oFileTransfer.ID = sBasename;
  oFileTransfer.AutoUpload = true;
  oFileTransfer.MaxSize = 100 * 1024 * 1024;
  oFileTransfer.oURL = URL.Parse( oFileTransfer.Get( "URL" ) );
  oFileTransfer.oURL.query = NVP.ToObject( oFileTransfer.oURL.query );
  oFileTransfer.FileMask  = GetFileMask( oOptions.ext || oOptions.type );
  oFileTransfer.MultiFile = oOptions.multifile;
  oFileTransfer.Debug     = ( oOptions.debug ) ? 1 : 0;

  oFileTransfer.SetAll();
};

// pass the responseXML.documentElement.parentNode to this to retreive the entire structure
function DomNodeToObject( node )
{
  var obj = {};

  for( var child = node.firstChild; child; child = child.nextSibling )
  {
    var value = '';

    if( child.nodeType == 3 && child.nodeName.charAt(0) == '#' )
      continue;

    // if( child.nodeValue )
    if( child.nodeType == 3 )
    {
      value = unescape( child.nodeValue );
    }
    // else if( child.firstChild )
    else if( child.childNodes.length )
    {
      var bText = true;

      // check all children for type Text
      for( var i = 0; i < child.childNodes.length && bText; i++ )
      {
        bText = ( child.childNodes[i].nodeType == 3 );
        value += unescape( child.childNodes[i].nodeValue );
      }

      if( !bText )
        value = DomNodeToObject( child );
    }

    if( obj[child.nodeName] )
    {
      if( typeof( obj[child.nodeName] ) != 'object' || !obj[child.nodeName].length )
        obj[child.nodeName] = [ obj[child.nodeName] ];
      obj[child.nodeName][obj[child.nodeName].length] = value;
    }
    else
    {
      obj[child.nodeName] = value;
    }
  }

  return( obj );
};


function FindChildElements( obj, prop, test )
{
  var children = [];

  if( typeof( test ) != 'object' || !/RegExp/.test( test.constructor.toString() ) )
    test = new RegExp( '^' + RegExp.Escape( test ) + '$' );
    // Does not work unless test is a RegExp because RegExp.Escape is not defined

  for( var i = 0; obj && i < obj.childNodes.length; i++ )
  {
    if( test.test( obj.childNodes[i][prop] ) )
      children.push( obj.childNodes[i] );

    var moreChildren = FindChildElements( obj.childNodes[i], prop, test );

    if( moreChildren.length )
    {
      for( var c = 0; c < moreChildren.length; c++ )
        children.push( moreChildren[c] );
    }
  }

  return( children );
};

function GetChildElementByProperty( oParent, sProp, sName )
{
  try
  {
    var oNode = null;
    for( var i = 0; !oNode && i < oParent.childNodes.length; i++ )
    {
      if( oParent.childNodes[i][sProp] == sName )
        oNode = oParent.childNodes[i];
      else
        oNode = this.GetChildElementByProperty( oParent.childNodes[i], sProp, sName );
    }
    return( oNode );
  }
  catch( e )
  {
    alert( "Failed Child Elem: " + e );
  }
};

function FindParentElement2( obj, prop, test )
{
	if( typeof( test ) != 'object' || !/RegExp/.test( test.constructor.toString() ) )
		test = new RegExp( '^' + RegExp.Escape( test ) + '$' );

	while( obj )
	{
		if( obj[prop] && test.test( obj[prop] ) )
			break;

		obj = obj.parentNode;
	}

	return obj;
};

function FindParentElement( oChild, sProp, sData )
{
	try
	{
		if( !( sData instanceof RegExp ) )
		{
			sData = "\/\^" + sData + "\$\/";
			sData =  new RegExp( sData );
		}

		var oNode = oChild.parentNode;

		while( oNode && sData.test(oNode[sProp]) )
		{
			oNode = oNode.parentNode;
		}

		return( oNode );
	}
	catch( e )
	{
		alert( "Failed Parent: " + e );
	}
};

function GetElementsByClassName( obj, classname, tagname )
{
  var re = new RegExp( classname );

  if( tagname )
  {
    var items = obj.getElementsByTagName( tagname );
    var a = [];
    for( var i = 0; i < items.length; i++ )
      if( items[i].className && re.test( items[i].className ) )
        a[a.length] = items[i];

    return( a );
  }
  else
  {
    if( obj.getElementsByClassName )
      return( obj.getElementsByClassName( classname ) );

    var objs = [];
    var node = document.body;

    while( node )
    {
      if( node.hasChildNodes() )
      {
        var newNodes = GetElementsByClassName( node.firstChild, classname );
        for( var i = 0; i < newNodes.length; i++ )
          objs[objs.length] = newNodes[i];
      }

      if( node.className && node.className == classname )
        objs[objs.length] = node;

      node = node.nextSibling;
    }

    return( objs );
  }

  return( false );
};

function GetElementsById( id, optObj )
{
  var objs = [];

  var node = ( optObj ) ? optObj : document.body;

  while( node )
  {
    if( node.hasChildNodes() )
    {
      var newNodes = GetElementsById( id, node.firstChild );
      for( var i = 0; i < newNodes.length; i++ )
        objs[objs.length] = newNodes[i];
    }

    if( node.id && node.id == id )
      objs[objs.length] = node;

    node = node.nextSibling;
  }

  return( objs );
};

function GetElementsByTagName( tag, optObj )
{
  var objs = [];

  var node = ( optObj ) ? optObj : document.body;

  while( node )
  {
    if( node.hasChildNodes() )
    {
      var newNodes = GetElementsById( tag, node.firstChild );
      for( var i = 0; i < newNodes.length; i++ )
        objs[objs.length] = newNodes[i];
    }

    if( node.tagName && node.tagName == tag )
      objs[objs.length] = node;

    node = node.nextSibling;
  }

  return( objs );
};

function GetObjectByIndex( name, idx )
{
  var obj = null;
  var objs = document.getElementsByName( name );
  if( !objs || !objs.length )
    objs = GetElementsById( name );
  if( objs )
    obj = objs[idx];
  return( obj );
};

function GetObjects( obj, sfx )
{
	"use strict";

	// Cache for previous find
	var objects;

	// Default lookup
	if( !sfx )
		sfx = "instance,container,input,button,list";

	// Look for container
	if( obj = FindParentElement2( obj, 'id', /_container(\[\])?$/ ) )
	{
		if( !objects || objects.container != obj )
			objects = FindObjects( obj, sfx );
	}
	else
		objects = null;

	return objects;
};

function FindObjects( obj, refs )
{
  var idx = 0;
  var found = {};

  if( obj.name )
  {
    if( obj.form )
    {
      var objs = document.getElementsByName( obj.name );
      if( objs.length && !objs.type )
        idx = IndexOf( obj, objs );
    }
    else
    {
      var objs = document.getElementsByName( obj.name );
      if( objs.length > 1 )
        idx = IndexOf( obj, objs );
    }
  }
  else if( obj.id )
  {
    var objs = GetElementsById( obj.id );
    if( objs.length > 1 )
      idx = IndexOf( obj, objs );
  }
  else
  {
    return( found );
  }

  var base = "";
  refs = refs.split(",");
  var name = ( obj.name ) ? obj.name : obj.id;
  var brackets = ( name.substr( name.length - 2 ) == "[]" ) ? "[]" : "";

  // determine if this is the base or ext.
  if( name.lastIndexOf( '_' ) >= 0 )
  {
    var ext = Format.RTrim( name.substr( name.lastIndexOf( '_' ) + 1 ), "[]" ); // "lnk"
    if( ArrayHas( refs, ext ) )
    {
      base = name.substr( 0, name.lastIndexOf( '_' ) ) + brackets; // "_lnk"
      found[ext] = obj;
      found['base'] = GetObjectByIndex( base, idx );
    }
  }

  if( !found['base'] )
  {
    base = name;
    found['base'] = obj;
  }

  for( var i = 0; i < refs.length; i++ )
  {
    if( typeof( found[refs[i]] ) == 'undefined' )
      found[refs[i]] = GetObjectByIndex( Format.RTrim( base, "[]" ) + "_" + refs[i] + brackets, idx );
  }

  return( found );
};

function FindObjects2( obj, refs )
{
	var findIt = function( obj, name )
	{
		var it = FindChildElements( obj, 'name', name );
		if( !it || !it.length )
			it = FindChildElements( obj, 'id', name );

		if( it )
		{
			if( it.length == 0 )
				it = null;
			else if( it.length == 1 )
				it = it[0];
		}

		return it;
	};

	var parseName = function( name )
	{
		var parts = { base: name, node: '', brackets: '' };

		// base_node[] .. split things up a bit
		if( /([^\[\]]*_)?([^_\[\]]*)(\[\])?$/.test( name ) )
		{
			parts.base = RegExp.$1;
			parts.node = RegExp.$2;
			parts.brackets = RegExp.$3;
		}

		return parts;
	};

	var refs = refs.split( ',' );
	var name = ( ( typeof( obj.name ) != 'undefined' && obj.name.length ) ? obj.name : obj.id );
	var parts = parseName( name );
	var found = {};

	// node is base
	if( !parts.base.length )
	{
		parts.base = parts.node;
		parts.node = '';
		found['base'] = obj;
	}

	// child
	if( parts.node.length && refs.Has( parts.node ) )
	{
		found[parts.node] = obj;
	}

	// if container .. find it for searching
	if( refs.Has( 'container' ) )
	{
		if( typeof( found['container'] ) != 'undefined' )
		{
			obj = found['container'];
		}
		else
		{
			var ctr = FindParentElement( obj, 'id', /_container(\[\])?$/ );
			if( ctr )
			{
				obj = found['container'] = ctr;
				parts = parseName( obj.id );
			}
		}
	}

	// look for base ..
	if( !found['base'] )
		found['base'] = findIt( obj, Format.RTrim( parts.base, '_' ) + parts.brackets );

	for( var i = 0; i < refs.length; i++ )
	{
		if( typeof( found[refs[i]] ) != 'undefined' )
			continue;

		found[refs[i]] = findIt( obj, parts.base + refs[i] + parts.brackets );
	}

	return found;
};

function IndexOf( obj, objs )
{
  var idx = -1;

  for( var i = 0; idx == -1 && i < objs.length; i++ )
  {
    if( objs[i] == obj )
      idx = i;
  }

  return( idx );
};

function ArrayHas( array, data )
{
  if( typeof( array ) != 'object' )
    return( false );

  if( IndexOf( data, array ) > -1  )
    return( true );

  return( false );
};

function SetOpacity (obj, nVal)
{
  if( typeof( obj.style.filter ) != 'undefined')
  {
    obj.style.filter = 'alpha(opacity=' + nVal * 10 + ')';
  }

  if( typeof( obj.style.opacity ) != 'undefined')
  {
    obj.style.opacity = nVal / 10;
  }
};

function SetCursor( type )
{
  if( !type )
    type = 'auto';

  document.body.style.cursor = type;
};

function SetStatus( status )
{
    parent.status = unescape(status);
    return( true );
};

function HasClass( obj, classname )
{
  if( !obj || !obj.className )
    return;
  // split class name list on object.
  var names = obj.className.split(' ');
  return ( ArrayHas( names, classname ) );
};

function AddClass( obj,classname )
{
  if( !obj )
    return;

  // split class name list on object.
  var names = obj.className.split(' ');

  if( ArrayHas( names, classname ) )
    return;

  names.push( classname );

  obj.className = names.join(' ');
};

function DropClass( obj, classname )
{
  if( !obj )
    return;

  var names   = [];
  var update  = [];

  // split class name list on object.
  if( obj.className.length )
    names = obj.className.split(' ');

  for( var i = 0; i < names.length; i++ )
  {
    if( names[i] != classname )
      update[update.length] = names[i];
  }

  obj.className = update.join(' ');
};

function LoadCSS( cssFile, cssMedia )
{
  var headID = document.getElementsByTagName("head")[0];
  var cssNode = document.createElement('link');
  if( !cssMedia )
  cssMedia = 'screen';
  cssNode.type = 'text/css';
  cssNode.rel = 'stylesheet';
  cssNode.href = cssFile;
  cssNode.media = cssMedia;
  headID.appendChild(cssNode);
};

function LoadJS( jsFile )
{
  var headID = document.getElementsByTagName("head")[0];
  var newScript = document.createElement('script');
  newScript.type = 'text/javascript';
  newScript.src = jsFile;
  headID.appendChild(newScript);
  return newScript;
};

function TestParent()
{
  var bUS = true;

  try
  {
    if( parent.window.opener && !parent.window.opener.closed && parent.window.opener.OSI_var )
      return( true );

    if( !window.opener || window.opener.closed )
      return( false );

    window.opener.OSI_var;
  }
  catch( e )
  {
    bUS = false;
  }

  return( bUS );
};

function FireEvent( elem, type )
{
  if( !elem ) return;
  if ( "createEvent" in document )
  {
    var evt = document.createEvent("HTMLEvents");
    evt.initEvent( type, false, true);
    elem.dispatchEvent(evt);
  }
  else
  {
    elem.fireEvent( "on" + type );
  }
}

function StripTags( s )
{
	return s.replace( /<\/?.*?>/g, '' );
};

/**
 * Allows calling a namespaced function via a string.
 * Example: ( "My.Namespace.functionName", window, arguments );
 */
function ExecuteFunctionByName( functionName, context, args )
{
	// What was passed in
	var args = Array.prototype.slice.call( arguments ).splice( 2 );
	// var args = Array.prototype.slice.call(arguments, 2);

	// Split namespace up
	var namespaces = functionName.split( "." );

	// Function name is on end, pop it off
	var func = namespaces.pop();

	// Build Call
	for( var i = 0; i < namespaces.length; i++ )
		context = context[namespaces[i]];

	return context[func].apply( context, args );
};
var cgi =
{
  _no_value: [ 'nowrap', 'selected', 'multiple', 'disabled', 'checked' , 'readonly', 'defer', 'required' ],

  _no_close: [ 'br', 'hr', 'link', 'option', 'frame', 'input', 'base', 'meta' ],

  _init: function()
  {
    var tags =
    [
      'a','abbr','acronym','address','applet','area',
      'b','base','basefont','bdo','big','blockquote','body','br','button',
      'caption','center','cite','code','col','colgroup',
      'dd','del','dfn','dir','div','dl','dt',
      'em',
      'fieldset','font','form','frame','frameset',
      'h1','h2','h3','h4','h5','h6','head','hr','html',
      'i','iframe','img','input','ins','isindex',
      'kbd',
      'label','legend','li','link',
      'map','menu','meta',
      'noframes','noscript',
      'object','ol','optgroup','option',
      'p','param','pre',
      'q',
      's','samp','script','select','small','span','strike','strong','style','sub','sup',
      'table','tbody','td','textarea','tfoot','th','thead','title','tr','tt',
      'u','ul',
      'var'
    ];

    for( var i = 0; i < tags.length; i++ )
      cgi._create_func( tags[i] );
  },

  _create_func: function( tag )
  {
    cgi[ tag ]          = function() { return( cgi._tag( tag, 0, arguments ) ); };
    cgi[ tag + '_beg' ] = function() { return( cgi._tag( tag, 1, arguments ) ); };
    cgi[ tag + '_end' ] = function() { return( cgi._tag( tag, 2, arguments ) ); };
  },

  _tag: function( tag, typ, args )
  {
    var arg = 0;
    var html = '';
    var options = '';

    // assemble options for tag if needed
    if( args[arg] && typeof( args[arg] ) == 'object' )
    {
      var opts = args[arg++];

      for( p in opts )
      {
        if( cgi._no_value.indexOf( p ) != -1 )
        {
          if( opts[p] )
            options += ' ' + p;
        }
        else
        {
          options += ' ' + p + "=\"" + Entities.Encode( opts[p] ) + "\"";
        }
      }
    }

    // process tag and extra data
    do
    {
      if( typeof( args[arg] ) == 'object' && args[arg].length )
      {
        for( var a = 0; a < args[arg].length; a++ )
          html += cgi._create_tag( tag, typ, options, args[arg][a] );
      }
      else
      {
        html += cgi._create_tag( tag, typ, options, args[arg] );
      }

      arg++;
    }
    while( arg < args.length )

    return( html );
  },

  _create_tag: function( tag, typ, options, data )
  {
    var i = 0;
    var sz = "";

    if( typ == 0 || typ == 1 )
    {
      sz += '<' + tag;
      if( typeof( options ) != 'undefined' )
        sz += options;
			sz += (( cgi._no_close.indexOf( tag ) != -1) ? ' />' : '>' );
      if( typeof( data ) != 'undefined' )
        sz += data;
    }

    if( ( typ == 0 || typ == 2 ) && (cgi._no_close.indexOf( tag ) == -1) )
      sz += "<\/" + tag + ">";

    return( sz );
  },

	comment: function( arg )
	{
		return( "<!-- " + arg + " -->" );
	}

};

cgi._init();

Control_Date =
{
  _instances : {},
  _objects : null,
  _selector : null,
  _id : null,


  Init : function( instance, options )
  {
    if( options.min && typeof( options.min ) == 'string' )
      options.min = Date.Parse( options.min );
    if( options.max && typeof( options.max ) == 'string' )
      options.max = Date.Parse( options.max );
    if ( options.resize )
    {
      options.resize = options.resize;
    }
    Control_Date._instances[instance] = options;
  },

	GetObjects : function( obj )
	{
		var objects = false;

		if( obj = FindParentElement( obj, 'id', /_container\$/ ) )
		{
			if( Control_Date._objects && Control_Date._objects.container == obj )
			{
				objects = Control_Date._objects;
			}
			else
			{
				objects = FindObjects( obj, "instance,container,button" );
				objects.options = Control_Date._instances[objects.instance.innerHTML];
			}
		}

		if( objects )
		{
			objects.datetime = Date.Parse( objects.base.value );
			if( !objects.datetime )
				objects.datetime = new Date();
		}

		Control_Date._objects = objects;
		Control_Date._id = objects.base.id;
		return( objects );
	},

  Cancel : function( evt )
  {
    if( evt.preventDefault ) evt.preventDefault();
    if( evt.stopPropagation ) evt.stopPropagation();
    evt.cancelBubble = true;
    evt.returnValue = false;
  },

	ButtonMouse : function( e )
	{
		var evt = Event.Get( e );
		var _objects = Control_Date._objects;
		var objects = Control_Date.GetObjects( evt.target );

		objects.focused = 'input';

		switch( evt.type )
		{
		  case 'mousedown':
			if( _objects != objects )
				objects.base.focus();
		    break;

		  case 'mouseup':
			break;

		  case 'click':
			objects.base.focus();
			Control_Date.OpenSelector( objects );
			break;
		}
	},

  InputFocus : function( e )
  {
    var evt = ( e ) ? e : window.event;
    var objects = Control_Date.GetObjects( evt.target );

    switch( evt.type )
    {
      case 'focus':
        objects.focused = 'input';
        break;

      case 'blur':
        if( objects.focused == 'input' )
        {
          Control_Date.SetValue( objects, objects.base.value );
          Control_Date.CloseSelector();
        }
        else
        {
          objects.base.focus();
        }

        objects.focused = 'input';

				break;
    }
  },

  funcs :
  {
    Y : function( dt, inc ) { dt.setFullYear( dt.getFullYear() + inc ); },
    y : function( dt, inc ) { dt.setFullYear( dt.getFullYear() + inc ); },
    m : function( dt, inc ) { dt.setMonth( dt.getMonth() + inc ); },
    M : function( dt, inc ) { dt.setMonth( dt.getMonth() + inc ); },
    d : function( dt, inc ) { dt.setDate( dt.getDate() + inc ); },
    H : function( dt, inc ) { dt.setHours( dt.getHours() + inc ); },
    h : function( dt, inc ) { dt.setHours( dt.getHours() + inc ); },
    i : function( dt, inc ) { dt.setMinutes( dt.getMinutes() + inc ); },
    s : function( dt, inc ) { dt.setSeconds( dt.getSeconds() + inc ); },
    A : function( dt, inc ) { dt.setHours( dt.getHours() + parseInt( inc * 12 ) ); },
    a : function( dt, inc ) { dt.setHours( dt.getHours() + parseInt( inc * 12 ) ); }
  },

  InputKey : function( e )
  {
    var evt = ( e ) ? e : window.event;
    var objects = Control_Date.GetObjects( evt.target );

    if( evt.type == 'keydown' )
    {
      // enter
      if( evt.keyCode == 13 )
      {
        if( Control_Date._selector )
        {
          Control_Date.CloseSelector();
          Control_Date.Cancel( evt );
        }
      }
      // tab
      else if( evt.keyCode == 9 )
      {
        if( evt.target.selectionEnd - evt.target.selectionStart == evt.target.value.length ||
            evt.target.selectionEnd - evt.target.selectionStart == 0 )
          return( false );

        var info = Control_Date.ParseDate( evt.target.value, objects.options.format, evt.target.selectionStart );
        if( info )
        {
          var moved = false;
          if( evt.shiftKey )
          {
            if( info.where > 0 )
            {
              moved = true;
              info = Control_Date.ParseDate( evt.target.value, objects.options.format, evt.target.selectionStart - 1 );
            }
          }
          else
          {
            if( info.where < 2 )
            {
              moved = true;
              info = Control_Date.ParseDate( evt.target.value, objects.options.format, evt.target.selectionStart + info.value.length + 1 );
            }
          }

          if( info && moved )
          {
            evt.target.selectionStart = info.start;
            evt.target.selectionEnd = info.start + info.value.length;
            Control_Date.UpdateCalendar();
            Control_Date.Cancel( evt );
          }
        }
      }
      // escape
      else if( evt.keyCode == 27 )
      {
        Control_Date.CloseSelector();
        Control_Date.Cancel( evt );
      }
      // ctrl+down
      else if( ( evt.altKey && evt.keyCode == 40 ) )
      {
        Control_Date.OpenSelector( objects );
        Control_Date.Cancel( evt );
      }
      // up down
      else if( ( evt.keyCode == 38 || evt.keyCode == 40 ) )
      {
        if( !Control_Date._selector )
        {
          Control_Date.OpenSelector( objects );
        }
        else
        {
          var info = Control_Date.ParseDate( evt.target.value, objects.options.format, evt.target.selectionStart );
          if( info )
          {
            var offset = parseInt( 39 - evt.keyCode );

            if( Control_Date.funcs[info.part] )
            {
              Control_Date.funcs[info.part]( info.dt, offset );
              Control_Date.SetValue( objects, info.dt );
              evt.target.selectionStart = info.start;
              evt.target.selectionEnd = info.start + info.value.length;
            }
          }
        }

        Control_Date.Cancel( evt );
      }

      return( false );
    }
  },

  CloseSelector : function()
  {
    with( Control_Date )
    {
      if( _selector )
      {
        _selector.parentNode.removeChild( _selector );
        //document.body.removeChild( _selector );
        _selector = null;
      }
    }
  },

	OpenSelector : function( objects )
	{
		var what =
		{
		  year:   /[Yy]/.test( objects.options.format ),
		  month:  /[MmF]/.test( objects.options.format ),
		  day:    /[dj]/.test( objects.options.format ),
		  hour:   /[Hh]/.test( objects.options.format ),
		  minute: /[i]/.test( objects.options.format ),
		  second: /[s]/.test( objects.options.format ),
		  ampm:   /[Aa]/.test( objects.options.format )
		};

/*
        Calendar        Yr    Mon   Day   Hrs   Min   Sec   A/P
 ____________________   ___   ___   ___   ___   ___   ___   ___
|__|__|__|__|__|__|__| |___| |___| |___| |___| |___| |___| |___|
|__|__|__|__|__|__|__| |___| |___| |___| |___| |___| |___| |___|
|__|__|__|__|__|__|__| |___| |___| |___| |___| |___| |___| |___|
|__|__|__|__|__|__|__| |___| |___| |___| |___| |___| |___| |___|
|__|__|__|__|__|__|__| |___| |___| |___| |___| |___| |___| |___|
|__|__|__|__|__|__|__| |___| |___| |___| |___| |___| |___| |___|
|__|__|__|__|__|__|__| |___| |___| |___| |___| |___| |___| |___|

*/

		Control_Date.CloseSelector();

		var labels = [], columns = [];

		if( what.year && what.month && what.day )
		{
		  labels[labels.length] =
			cgi.table(
			  {
				width: '100%'
			  },
			  cgi.tr(
				{
				},
				cgi.td(
				  {
					id: 'date_button_prev',
					onclick: 'Control_Date.CalendarEvent(event);'
				  },
				  '&#9668;'
				) +
				cgi.td(
				  {
					id: 'date_current'
				  },
				  objects.datetime.Format( 'F Y' )
				) +
				cgi.td(
				  {
					id: 'date_button_next',
					onclick: 'Control_Date.CalendarEvent(event);'
				  },
				  '&#9658;'
				)
			  )
			);

		  columns[columns.length] = Control_Date.CreateCalendar( objects );

		  what.year = what.month = what.day = false;
		}

		for( var p in what )
		{
			if( !what[p] )
				continue;

			var values = [];
			var selected = '';

			switch( p )
			{
				case 'year':
					selected = objects.datetime.getFullYear();
					for( var i = 1900; i < 2032; i++ )
					values.push( i );
					break;

				case 'month':
					if( false && /[M]/.test( objects.options.format ) )
					{
					selected = objects.datetime.GetPart('M');
					values = Date.Months.Short;
					}
					else
					{
					selected = objects.datetime.getMonth() + 1;
					for( var i = 1; i <= 12; i++ )
					values.push( Format.PadLeft( i, 2, "0" ) );
					}
					break;

				case 'day':
					selected = objects.datetime.getDate();
					for( var i = 1; i <= 31; i++ )
					values.push( Format.PadLeft( i, 2, "0" ) );
					break;

				case 'hour':
					selected = objects.datetime.getHours();
					var h24 = /[H]/.test( objects.options.format );
					for( var i = (( h24 ) ? 0 : 1); i <= (( h24 ) ? 23 : 12); i++ )
					values.push( Format.PadLeft( i, 2, "0" ) );
					break;

				case 'minute':
					selected = objects.datetime.getMinutes();
					for( var i = 0; i <= 59; i++ )
					values.push( Format.PadLeft( i, 2, "0" ) );
					break;

				case 'second':
					selected = objects.datetime.getSeconds();
					for( var i = 0; i <= 59; i++ )
					values.push( Format.PadLeft( i, 2, "0" ) );
					break;

				case 'ampm':
					if( /[A]/.test( objects.options.format ) )
					values = [ 'AM', 'PM' ];
					else
					values = [ 'am', 'pm' ];
					break;
			}

		  labels[labels.length] = p.charAt(0).toUpperCase();

		  columns[columns.length] = Control_Date.CreateRange( p, values.reverse(), selected );
		}

		var out =
		  cgi.table(
			{
			  onclick: 'Control_Date.SelectorEvent(event);',
			  onmousedown: 'Control_Date.SelectorEvent(event);',
			  onmouseup: 'Control_Date.SelectorEvent(event);'
			},
			cgi.tr( cgi.th( {}, labels ) ) +
			cgi.tr( cgi.td( {}, columns ) ) +
			cgi.tr(
			  cgi.td(
				{ id: 'date_actions', colspan: columns.length.toString() },
				cgi.button( { type: 'button', onclick: 'Control_Date.SelectToday(event)' }, 'Today' ) +
				cgi.button( { type: 'button', onclick: 'Control_Date.CloseSelector()' }, 'Close' )
			  )
			)
		  );

		with( Control_Date )
		{
		  var rct   = GetAbsolutePosition( objects.base ); // true
		  var div  = document.createElement('div');
		  div.id = 'date_selector';
		  div.className = 'date_selector date_selector_onbottom';
		  div.innerHTML = out;
		  div.onclick = Control_Date.SelectorEvent;
		  div.onmousedown = Control_Date.SelectorEvent;
		  div.onmouseup = Control_Date.SelectorEvent;
		  objects.container.appendChild( div );
		  var cal_pos = GetAbsolutePosition( div, true );
		  var scr_pos = Screen.GetWindowRectangle();

		  if( cal_pos.top + cal_pos.height > scr_pos.top + scr_pos.height )
		  {
			div.style.top = ( rct.top - cal_pos.height - 4 ) + 'px';
			div.className = 'date_selector date_selector_ontop';
		  }

		  _selector = div;

		  UpdateCalendar();

		  var cal = document.getElementById( 'date_calendar' );
		  var rct;
		  if( cal )
			rct = GetAbsolutePosition( cal );

		  var ranges = FindChildElements( _selector, 'className', /date_range/ );

		  for( var r = 0; ranges && r < ranges.length; r++ )
		  {
			if( cal )
			  ranges[r].style.height = ( rct.height - 2 ) + 'px';
			var items = ranges[r].getElementsByTagName( 'li' );
			var width = -1;
			for( var i = 0; items && i < items.length; i++ )
			  width = Value.Max( width, items[i].offsetWidth );
			var factor = ( Browser.IsIE() ) ? 35 : 20;
			if( width > 0 )
			  ranges[r].style.width = ( width + factor ) + 'px';
		  }
		}
	},

  SelectToday : function( e )
  {
    var evt = ( e ) ? e : window.event;
    var objects = Control_Date._objects;

    objects.datetime = new Date();
    objects.base.value = objects.datetime.Format( objects.options.format );

    Control_Date.UpdateCalendar( true );
  },

  CreateCalendar : function( objects )
  {
    var out = '';

    out +=
      cgi.table_beg(
        {
          id: 'date_calendar',
          'class': 'date_calendar'
        }
      );

    out +=
      cgi.tr(
        cgi.td( { id: 'date_label' }, Date.Weekdays.Short )
      );

    for( var r = 0; r < 6; r++ )
    {
      out +=
        cgi.tr_beg();

      for( var c = 0; c < 7; c++ )
      {
        var n = ( ( r*7 ) + c );
        out +=
          cgi.td(
            {
              id: 'date_day_' + n,
              // onmousedown: 'Control_Date.CalendarEvent(event);',
              // onmouseup: 'Control_Date.CalendarEvent(event);',
              onclick: 'Control_Date.CalendarEvent(event);'
            },
            n
          );
      }
      out +=
        cgi.tr_end();
    }

    out +=
      cgi.table_end();

    return( out );
  },

  UpdateCalendar : function( useObject )
  {
    if( !Control_Date._selector )
      return;

    var objects = Control_Date._objects;
    var current = document.getElementById( 'date_current' );
    var dt = new Date( ( !useObject && current && current.datetime ) ? current.datetime : objects.datetime );

    dt.setDate( 1 );
    dt.setHours( 0 );
    dt.setMinutes( 0 );
    dt.setSeconds( 0 );

    var YM = dt.Format('Ym');

    if( current )
    {
      current.datetime = new Date( dt );
      current.innerHTML = dt.Format( 'F Y' );
    }

    dt.setDate( dt.getDate() - dt.DayOfWeek() );

    for( var n = 0; n < (6*7); n++ )
    {
      var o = document.getElementById( 'date_day_' + n );
      if( o )
      {
        o.innerHTML = dt.getDate();
        o.title = dt.Format( 'Y-m-d' );
        o.datetime = new Date( dt );
        o.className = '';
        if( dt.Format( 'Ym' ) != YM )
          o.className = 'date_othermonth';
        if( dt.Format('Ymd') == objects.datetime.Format('Ymd') )
          o.className = 'date_today';
        if( ( objects.options.min && dt < objects.options.min ) ||
            ( objects.options.max && dt > objects.options.max ) )
          o.className = 'date_disabled';
      }
      dt.setDate( dt.getDate() + 1 );
    }

    var ranges = FindChildElements( Control_Date._selector, 'className', /date_range/ );

    for( var i = 0; i < ranges.length; i++ )
    {
      var value = null;

      /date_range_(.*)/.test( ranges[i].id );
      switch( RegExp.$1 )
      {
        case 'year':
          if( /([Yy])/.test( objects.options.format ) )
            value = objects.datetime.GetPart(RegExp.$1);
          break;
        case 'month':
          if( /([FMmn])/.test( objects.options.format ) )
            value = objects.datetime.GetPart(RegExp.$1);
          break;
        case 'day':
          if( /([dj])/.test( objects.options.format ) )
            value = objects.datetime.GetPart(RegExp.$1);
          break;
        case 'hour':
          if( /([GHgh])/.test( objects.options.format ) )
            value = objects.datetime.GetPart(RegExp.$1);
          break;
        case 'minute':
          value = objects.datetime.GetPart('i');
          break;
        case 'second':
          value = objects.datetime.GetPart('s');
          break;
        case 'ampm':
          if( /([Aa])/.test( objects.options.format ) )
            value = objects.datetime.GetPart(RegExp.$1);
          break;
      }

      if( value != null )
      {
        var children = ranges[i].getElementsByTagName( 'li' );
        var rct_child;
        var rct_parent = GetAbsolutePosition( ranges[i] );

        for( var o = 0; o < children.length; o++ )
        {
          children[o].className = '';
          if( children[o].innerHTML == value )
          {
            children[o].className = 'range_selected';
            rct_child = GetAbsolutePosition( children[o] );
            if( rct_child.top - ranges[i].scrollTop < rct_parent.top )
              ranges[i].scrollTop = ( rct_child.top - rct_parent.top );
            if( rct_child.top + rct_child.height - ranges[i].scrollTop > rct_parent.top + rct_parent.height )
              ranges[i].scrollTop = ( ( rct_child.top + rct_child.height ) - ( rct_parent.top + rct_parent.height ) );
          }
        }
      }
    }
  },

  CreateRange : function( part, values, selected )
  {
    var out = '';

    out +=
      cgi.ul(
        {
          'class': 'date_range',
          id: 'date_range_' + part,
          onmousedown: 'Control_Date.RangeEvent(event);',
          onmouseup: 'Control_Date.RangeEvent(event);',
          onclick: 'Control_Date.RangeEvent(event);',
        },
        cgi.li(
          {
            id: 'date_range_item_' + part,
          },
          values
        )
      );

    return( out );
  },

  RangeEvent : function( e )
  {
    var evt = ( e ) ? e : window.event;
    var objects = Control_Date._objects;

    var part = (/([^_]*)$/.exec( evt.target.id ))[1];

    switch( evt.type )
    {
      case 'mouseup':
        objects.base.focus();
        break;

      case 'mousedown':
        objects.focused = 'range';
        //objects.base.blur();
        break;

      case 'click':
        objects.base.focus();
        if( evt.target.tagName.toLowerCase() != 'li' )
          break;
        var value = evt.target.innerHTML;
        if( !value.length )
          break;
        var dt = new Date( objects.datetime );
        switch( part )
        {
          case 'year':
            dt.setFullYear( value );
            break;
          case 'month':
            dt.setMonth( parseInt( value ) - 1 );
            break;
          case 'day':
            dt.setDate( parseInt( value ) );
            break;
          case 'hour':
            if( /[h]/.test( objects.options.format ) )
              value = ( parseInt( value ) % 12 ) + ( ( dt.getHours() > 11 ) ? 12: 0 );
            dt.setHours( parseInt( value ) );
            break;
          case 'minute':
            dt.setMinutes( parseInt( value ) );
            break;
          case 'second':
            dt.setSeconds( parseInt( value ) );
            break;
          case 'ampm':
            switch( value.toLowerCase() )
            {
              case 'am':
                if( dt.getHours() >= 12 )
                  dt.setHours( dt.getHours() - 12 );
                break;
              case 'pm':
                if( dt.getHours() < 12 )
                  dt.setHours( dt.getHours() + 12 );
                break;
            }
            break;
        }
        Control_Date.SetValue( objects, dt );
        break;
    }

    Control_Date.Cancel( evt );

    //Debug.Print( [ 'RangeEvent', evt.type, part ] );
  },

  CalendarEvent : function( e )
  {
    var evt = ( e ) ? e : window.event;
    var objects = Control_Date._objects;

    switch( evt.type )
    {
      case 'mousedown':
        break;

      case 'mouseup':
        break;

      case 'click':
        //objects.base.focus();
        var data = /^date_([^_]*)_(.*)/.exec( evt.target.id );
        switch( data[1] )
        {
          case 'day':
            var dt = new Date( evt.target.datetime );
            dt.setHours( objects.datetime.getHours() );
            dt.setMinutes( objects.datetime.getMinutes() );
            dt.setSeconds( objects.datetime.getSeconds() );
            Control_Date.SetValue( objects, dt );
            break;

          case 'button':
            var current = document.getElementById( 'date_current' );
            current.datetime.setMonth( current.datetime.getMonth() + ( data[2] == 'next' ? 1 : -1 ) );
            Control_Date.UpdateCalendar();
            break;
        }
        break;

    }

    //Debug.Print( [ 'CalendarEvent', evt.type, objects.focused ] );

  },

  SelectorEvent : function( e )
  {
    var evt = ( e ) ? e : window.event;
    var objects = Control_Date._objects;

    switch( evt.type )
    {
      case 'mouseup':
      case 'mousedown':
      case 'click':
        objects.base.focus();
        break;
    }

    Control_Date.Cancel( evt );

    //Debug.Print( [ 'SelectorEvent', evt.type, objects.focused ] );

  },

	SetValue : function( objects, dt )
	{
		if( typeof( dt ) == 'string' )
			dt = Date.Parse( dt );

		if( dt && dt.Format )
		{
			if( objects.options.min && dt < objects.options.min )
				dt = objects.options.min;

			if( objects.options.max && dt > objects.options.max )
				dt = objects.options.max;

			objects.datetime = dt;
			objects.base.value = dt.Format( objects.options.format );

			if (objects.options.resize)
			{
				objects.base.size = objects.base.value.length;
			}

			Control_Date.UpdateCalendar( true );
		}

		if( typeof( objects.base.onchange ) == 'function' )
		{
			objects.base.onchange( objects.base );
			console.log("SetValue");
		}

		return dt;
	},

  ParseDate : function( dt, fmt, pos )
  {
    if( typeof( dt ) == 'string' )
      dt = Date.Parse( dt );

    if( !dt )
      return( null );

    var re = new RegExp( fmt.replace( /\./g, '\\.' ).replace( /\w/g, '(.*)' ) );
    var af = re.exec( fmt );
    var ad = re.exec( dt.Format( fmt ) );
	var start = 0;

    for( var i = 1; i < af.length; i++ )
    {
      if( pos < start + ad[i].length + 1 )
        return(
          {
            part: af[i],
            value: ad[i],
            start: start,
            dt: dt,
            where: ( ( i == 1 ) ? 0 : ( i == ad.length - 1 ) ? 2 : 1 )
          }
        );

      start += ad[i].length + 1;
    }

    return( null );
  }

};


function AJAX( opts )
{
	// PREDEFINED PARAMS
	this.type   = 'AJAX';
	this.Method = 'GET';
	this.URL    = '';
	this.Async  = true;
	this.Params = '';

	// OnFuncs
	this.OnChange   = function() {};
	this.OnComplete = function() {};
	this.OnError =
		function( oRequest, oData )
		{
		  try
		  {
			// 4454
			if( oRequest.status < 300 || oRequest.status > 600 )
				return;

			alert(
			  [
				"AJAX Error:",
				oRequest.status + " " + oRequest.statusText,
				"Object: " + me.RequestName,
				"Method: " + me.Method,
				"URL: " + me.URL,
				"Async: " + me.Async,
				"Length: " + this.Params.length
			  ].join("\n")
			);
		  }
		  catch( e )
		  {
		  }
		};
	this.Busy       = function( b ) {};
	this.OnTimeout  = null;
	this.Timeout    = 0;
	this.Data       = null;
	this.AbortTimeout   = null;
	this.AbortInterval  = 60000; // UPDATED TO 1 MIN
	this.RequestName = "XMLHttpRequest";

	// IF PASSED ANY PARAMS, OVERRIDE DEFAULTS
	for( p in opts )
	{
		// IF EXISTS
		if( typeof( this[p] ) != 'undefined' )
			this[p] = opts[p];
	}

	// LOCAL
	var oRequest = null;

	// NEED THIS TO HOLD A REFERENCE TO THIS OBJECT.
	var me = this;

	if( window.XMLHttpRequest )
	{
		oRequest = new XMLHttpRequest();
	}
	else if( window.ActiveXObject )
	{
		var XMLHttpVersions =
		[
			'MSXML2.XMLHTTP.6.0',
			'MSXML2.XMLHTTP.5.0',
			'MSXML2.XMLHTTP.4.0',
			'MSXML2.XMLHTTP.3.0',
			'MSXML2.XMLHTTP',
			'Microsoft.XMLHTTP'
		];

		for( var i = 0; i < XMLHttpVersions.length && !oRequest; i++ )
		{
			try
			{
				oRequest = new ActiveXObject(XMLHttpVersions[i]);
				this.RequestName = XMLHttpVersions[i];
			}
			catch(e)
			{
			}
		}
	}

	this.IsValid = function()
	{
		return( oRequest != null );
	};

	this.Finish = function( oRequest, oData )
	{
		if( me.Async )
		{
			if( oRequest.readyState == 4 )
			{
				if( oRequest.status == 200 )
				{
					this.Clear();
					me.OnComplete( oRequest, oData );

					if( me.OnTimeout && me.Timeout )
						setTimeout( me.OnTimeout, me.Timeout );

				}
				else
				{
					this.Clear();
					me.OnError( oRequest, oData );
				}
			}
		}
		else
		{
			me.OnComplete( oRequest, oData );
			this.Clear();
		}
	};

	// CLEAR VARS, AND DELETE
	this.Clear = function()
	{
		me.Busy( false );

		if( document && document.body )
			document.body.style.cursor = 'auto';

		clearTimeout( me.AbortTimeout );

		oRequest = null;

		delete me;
	};

	this.Send = function()
	{
		if( AJAX.AppendToURL )
			this.URL += ( this.URL.indexOf( '?' ) > 0 ) ? ( '&' + AJAX.AppendToURL ) : ( '?' + AJAX.AppendToURL );

		oRequest.open( this.Method, this.URL, this.Async );

		switch( this.Method.toUpperCase() )
		{
			case "POST":
				if( !( this.Params instanceof FormData ) )
					oRequest.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
				break;

			case "GET":
				default:
				break;
		}

		oRequest.onreadystatechange = function( oEvent )
		{
			if( oEvent.target.readyState == 4 )
				me.Finish( oEvent.target, me.Data );
		};

		this.Busy( true );

		if( this.AbortInterval )
			this.AbortTimeout = setTimeout( function() { me.Busy( false ); oRequest.abort(); }, this.AbortInterval );

		oRequest.send( this.Params );
	};

	this.SetTimeout = function( afnOnTimeout, anTimeout )
	{
		this.OnTimeout = afnOnTimeout;
		this.Timeout  = anTimeout;
	};
};

/*********************************************************/
function CellAjax( xmlCell, fm, action, fields, fOnError )
{
  var o;
  var a = new AJAX();
  a.URL = URL.Page( "AJAX", "Cell", { cell: xmlCell } );

  var params = ( fm ) ? Form.MakeGetURL( fm ) : "";
  params = NVP.Set( params , "act" , action );

  o = document.getElementById( xmlCell + "_title" );
  if( o && o.className.length )
    params = NVP.Set( params, "cell_class_title", o.className );

  o = document.getElementById( xmlCell + "_content" );
  if( o && o.className.length )
    params = NVP.Set( params, "cell_class_content", o.className );

  if( fields )
  {
    for( field in fields )
      params = NVP.Set( params, field, fields[field] );
  }

  if( fOnError )
    a.OnError = fOnError;

  a.Params = params;
  a.Method = "POST";
  a.OnComplete = AjaxResponse;
  a.Data = xmlCell;
  a.Busy = Busy.Run;
  a.Send();
};

/*********************************************************/
function DivAjax( div, url )
{
  var a = new AJAX();
  a.URL = url;
  a.Method = "POST";
  a.OnComplete = AjaxResponse;
  a.Data = div;
  a.Send();
};

/*********************************************************/
function AjaxResponse( oRequest, sID )
{
  var cType = oRequest.getResponseHeader( "Content-Type" );

  try
  {
    if( cType.indexOf( "text/xml" ) > -1 )
    {
      AjaxXMLResponse( oRequest, sID );
    }
    else
    {
      var txt = oRequest.responseText;
      if( txt )
      {
        if( txt.substr( 0, 5 ) == "ERROR" )
          alert( txt );
        else
        {
          var o = document.getElementById( sID );
          if( o )
          {
            o.innerHTML = txt;
          }
        }
      }
    }
  }
  catch( err )
  {
    if( false )
      Debug.Print( err );
  }

  InitializeFCK();
};

/*********************************************************/
function AjaxXMLResponse( oRequest, oData )
{
  if( oRequest.responseXML )
  {
    var obj = false;
    try
    {
      obj = DomNodeToObject( oRequest.responseXML.documentElement );
    }
    catch( e )
    {
      alert( oRequest.responseText );
    }

    if( obj )
    {
      if( obj.error && obj.error > 0 )
        return( alert( obj.error_msg ) );

      var box = document.getElementById( oData );
      if( box )
      {
        // added this, because I was getting error in IE if I returned using HashToXML
        if( obj.root )
          box.innerHTML = obj.root.html;
        else
          box.innerHTML = obj.html;
      }
      if( obj.root )
        eval( obj.root.js );
      else
        eval( obj.js );
    }

    InitializeFCK();
    return( obj );
  }
};

function AjaxXMLResponseObject( oRequest, oData )
{
  if( oRequest.responseXML )
  {
    var obj = false;
    try
    {
      obj = DomNodeToObject( oRequest.responseXML.documentElement );
    }
    catch( e )
    {
      alert( oRequest.responseText );
    }

    if( obj )
    {
      if( obj.root ) obj = obj.root;
      if( obj.error && obj.error > 0 )
        return( alert( obj.error_msg ) );
      if( obj.jsonload )
        eval( obj.jsonload );
    }
    return( obj );
  }
};

/*********************************************************/
function InitializeFCK()
{
  var fck = GetElementsById( 'fck_init' );
  for( var i = 0; i < fck.length; i++ )
  {
    eval( fck[i].innerHTML );
  }
};
var	UTF8 =
{
	// public method for url encoding
	Encode : function (string)
	{
		string = string.replace(/\r\n/g,"\n");

    var	utftext	= "";

		for	(var n = 0;	n <	string.length; n++)
		{
			var	c =	string.charCodeAt(n);

			if (c <	128)
			{
				utftext	+= String.fromCharCode(c);
			}
			else if((c > 127) && (c	< 2048))
			{
				utftext	+= String.fromCharCode((c >> 6)	| 192);
				utftext	+= String.fromCharCode((c &	63)	| 128);
			}
			else
			{
				utftext	+= String.fromCharCode((c >> 12) | 224);
				utftext	+= String.fromCharCode(((c >> 6) & 63) | 128);
				utftext	+= String.fromCharCode((c &	63)	| 128);
			}
		}

		return( utftext );
	},

	// public method for url decoding
	Decode : function (utftext)
	{
		var	string = "";
		var	i =	0;
		var	c =	c1 = c2	= 0;

		while (	i <	utftext.length )
		{
			c =	utftext.charCodeAt(i);

			if (c <	128)
			{
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c	< 224))
			{
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c &	31)	<< 6) |	(c2	& 63));
				i += 2;
			}
			else
			{
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c &	15)	<< 12) | ((c2 &	63)	<< 6) |	(c3	& 63));
				i += 3;
			}
		}

		return( string );
	}
};

/**
*
*  Base64 encode / decode
*
**/

var	Base64 =
{
	// private property
	_keyStr	: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",

	// public method for encoding
	Encode : function (input)
	{
		var	output = "";
		var	chr1, chr2,	chr3, enc1,	enc2, enc3,	enc4;
		var	i =	0;

		input =	UTF8.Encode(input);

		while (i < input.length)
		{
			chr1 = input.charCodeAt(i++);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);

			enc1 = chr1	>> 2;
			enc2 = ((chr1 &	3) << 4) | (chr2 >>	4);
			enc3 = ((chr2 &	15)	<< 2) |	(chr3 >> 6);
			enc4 = chr3	& 63;

			if (isNaN(chr2))
			{
				enc3 = enc4	= 64;
			}
			else if (isNaN(chr3))
			{
				enc4 = 64;
			}

			output = output	+
			this._keyStr.charAt(enc1) +	this._keyStr.charAt(enc2) +
			this._keyStr.charAt(enc3) +	this._keyStr.charAt(enc4);

		}

		return( output );
	},

	// public method for decoding
	Decode : function (input)
	{
		var	output = "";
		var	chr1, chr2,	chr3;
		var	enc1, enc2,	enc3, enc4;
		var	i =	0;

		input =	input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

		while( i < input.length )
		{
			enc1 = this._keyStr.indexOf(input.charAt(i++));
			enc2 = this._keyStr.indexOf(input.charAt(i++));
			enc3 = this._keyStr.indexOf(input.charAt(i++));
			enc4 = this._keyStr.indexOf(input.charAt(i++));

			chr1 = (enc1 <<	2) | (enc2 >> 4);
			chr2 = ((enc2 &	15)	<< 4) |	(enc3 >> 2);
			chr3 = ((enc3 &	3) << 6) | enc4;

			output = output	+ String.fromCharCode(chr1);

			if (enc3 !=	64)
			{
				output = output	+ String.fromCharCode(chr2);
			}
			if (enc4 !=	64)
			{
				output = output	+ String.fromCharCode(chr3);
			}

		}

		output = UTF8.Decode(output);

		return( output );
	}
};

var MD5 = function(string)
{
  function RotateLeft(lValue, iShiftBits)
	{
    return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits));
  };

  function AddUnsigned(lX,lY)
	{
    var lX4,lY4,lX8,lY8,lResult;
    lX8 = (lX & 0x80000000);
    lY8 = (lY & 0x80000000);
    lX4 = (lX & 0x40000000);
    lY4 = (lY & 0x40000000);
    lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF);
    if (lX4 & lY4)
		{
      return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
    }
    if (lX4 | lY4)
		{
      if (lResult & 0x40000000)
			{
        return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
      }
			else
			{
        return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
      }
    }
		else
		{
      return (lResult ^ lX8 ^ lY8);
    }
  };

  function F(x,y,z) { return (x & y) | ((~x) & z); };
  function G(x,y,z) { return (x & z) | (y & (~z)); };
  function H(x,y,z) { return (x ^ y ^ z); };
  function I(x,y,z) { return (y ^ (x | (~z))); };

  function FF(a,b,c,d,x,s,ac)
	{
    a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac));
    return AddUnsigned(RotateLeft(a, s), b);
  };

  function GG(a,b,c,d,x,s,ac)
	{
    a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac));
    return AddUnsigned(RotateLeft(a, s), b);
  };

  function HH(a,b,c,d,x,s,ac)
	{
    a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac));
    return AddUnsigned(RotateLeft(a, s), b);
  };

  function II(a,b,c,d,x,s,ac)
	{
    a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac));
    return AddUnsigned(RotateLeft(a, s), b);
  };

  function ConvertToWordArray(string)
	{
    var lWordCount;
    var lMessageLength = string.length;
    var lNumberOfWords_temp1=lMessageLength + 8;
    var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64;
    var lNumberOfWords = (lNumberOfWords_temp2+1)*16;
    var lWordArray=Array(lNumberOfWords-1);
    var lBytePosition = 0;
    var lByteCount = 0;
    while ( lByteCount < lMessageLength )
    {
      lWordCount = (lByteCount-(lByteCount % 4))/4;
      lBytePosition = (lByteCount % 4)*8;
      lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount)<<lBytePosition));
      lByteCount++;
    }
    lWordCount = (lByteCount-(lByteCount % 4))/4;
    lBytePosition = (lByteCount % 4)*8;
    lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80<<lBytePosition);
    lWordArray[lNumberOfWords-2] = lMessageLength<<3;
    lWordArray[lNumberOfWords-1] = lMessageLength>>>29;
    return lWordArray;
  };

  function WordToHex(lValue)
	{
    var WordToHexValue="",WordToHexValue_temp="",lByte,lCount;
    for (lCount = 0;lCount<=3;lCount++)
		{
      lByte = (lValue>>>(lCount*8)) & 255;
      WordToHexValue_temp = "0" + lByte.toString(16);
      WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2);
    }
    return WordToHexValue;
  };

  var x=Array();
  var k,AA,BB,CC,DD,a,b,c,d;
  var S11=7, S12=12, S13=17, S14=22;
  var S21=5, S22=9 , S23=14, S24=20;
  var S31=4, S32=11, S33=16, S34=23;
  var S41=6, S42=10, S43=15, S44=21;

  string = UTF8.Encode(string);

  x = ConvertToWordArray(string);

  a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476;

  for (k=0;k<x.length;k+=16)
	{
    AA=a; BB=b; CC=c; DD=d;
    a=FF(a,b,c,d,x[k+0], S11,0xD76AA478);
    d=FF(d,a,b,c,x[k+1], S12,0xE8C7B756);
    c=FF(c,d,a,b,x[k+2], S13,0x242070DB);
    b=FF(b,c,d,a,x[k+3], S14,0xC1BDCEEE);
    a=FF(a,b,c,d,x[k+4], S11,0xF57C0FAF);
    d=FF(d,a,b,c,x[k+5], S12,0x4787C62A);
    c=FF(c,d,a,b,x[k+6], S13,0xA8304613);
    b=FF(b,c,d,a,x[k+7], S14,0xFD469501);
    a=FF(a,b,c,d,x[k+8], S11,0x698098D8);
    d=FF(d,a,b,c,x[k+9], S12,0x8B44F7AF);
    c=FF(c,d,a,b,x[k+10],S13,0xFFFF5BB1);
    b=FF(b,c,d,a,x[k+11],S14,0x895CD7BE);
    a=FF(a,b,c,d,x[k+12],S11,0x6B901122);
    d=FF(d,a,b,c,x[k+13],S12,0xFD987193);
    c=FF(c,d,a,b,x[k+14],S13,0xA679438E);
    b=FF(b,c,d,a,x[k+15],S14,0x49B40821);
    a=GG(a,b,c,d,x[k+1], S21,0xF61E2562);
    d=GG(d,a,b,c,x[k+6], S22,0xC040B340);
    c=GG(c,d,a,b,x[k+11],S23,0x265E5A51);
    b=GG(b,c,d,a,x[k+0], S24,0xE9B6C7AA);
    a=GG(a,b,c,d,x[k+5], S21,0xD62F105D);
    d=GG(d,a,b,c,x[k+10],S22,0x2441453);
    c=GG(c,d,a,b,x[k+15],S23,0xD8A1E681);
    b=GG(b,c,d,a,x[k+4], S24,0xE7D3FBC8);
    a=GG(a,b,c,d,x[k+9], S21,0x21E1CDE6);
    d=GG(d,a,b,c,x[k+14],S22,0xC33707D6);
    c=GG(c,d,a,b,x[k+3], S23,0xF4D50D87);
    b=GG(b,c,d,a,x[k+8], S24,0x455A14ED);
    a=GG(a,b,c,d,x[k+13],S21,0xA9E3E905);
    d=GG(d,a,b,c,x[k+2], S22,0xFCEFA3F8);
    c=GG(c,d,a,b,x[k+7], S23,0x676F02D9);
    b=GG(b,c,d,a,x[k+12],S24,0x8D2A4C8A);
    a=HH(a,b,c,d,x[k+5], S31,0xFFFA3942);
    d=HH(d,a,b,c,x[k+8], S32,0x8771F681);
    c=HH(c,d,a,b,x[k+11],S33,0x6D9D6122);
    b=HH(b,c,d,a,x[k+14],S34,0xFDE5380C);
    a=HH(a,b,c,d,x[k+1], S31,0xA4BEEA44);
    d=HH(d,a,b,c,x[k+4], S32,0x4BDECFA9);
    c=HH(c,d,a,b,x[k+7], S33,0xF6BB4B60);
    b=HH(b,c,d,a,x[k+10],S34,0xBEBFBC70);
    a=HH(a,b,c,d,x[k+13],S31,0x289B7EC6);
    d=HH(d,a,b,c,x[k+0], S32,0xEAA127FA);
    c=HH(c,d,a,b,x[k+3], S33,0xD4EF3085);
    b=HH(b,c,d,a,x[k+6], S34,0x4881D05);
    a=HH(a,b,c,d,x[k+9], S31,0xD9D4D039);
    d=HH(d,a,b,c,x[k+12],S32,0xE6DB99E5);
    c=HH(c,d,a,b,x[k+15],S33,0x1FA27CF8);
    b=HH(b,c,d,a,x[k+2], S34,0xC4AC5665);
    a=II(a,b,c,d,x[k+0], S41,0xF4292244);
    d=II(d,a,b,c,x[k+7], S42,0x432AFF97);
    c=II(c,d,a,b,x[k+14],S43,0xAB9423A7);
    b=II(b,c,d,a,x[k+5], S44,0xFC93A039);
    a=II(a,b,c,d,x[k+12],S41,0x655B59C3);
    d=II(d,a,b,c,x[k+3], S42,0x8F0CCC92);
    c=II(c,d,a,b,x[k+10],S43,0xFFEFF47D);
    b=II(b,c,d,a,x[k+1], S44,0x85845DD1);
    a=II(a,b,c,d,x[k+8], S41,0x6FA87E4F);
    d=II(d,a,b,c,x[k+15],S42,0xFE2CE6E0);
    c=II(c,d,a,b,x[k+6], S43,0xA3014314);
    b=II(b,c,d,a,x[k+13],S44,0x4E0811A1);
    a=II(a,b,c,d,x[k+4], S41,0xF7537E82);
    d=II(d,a,b,c,x[k+11],S42,0xBD3AF235);
    c=II(c,d,a,b,x[k+2], S43,0x2AD7D2BB);
    b=II(b,c,d,a,x[k+9], S44,0xEB86D391);
    a=AddUnsigned(a,AA);
    b=AddUnsigned(b,BB);
    c=AddUnsigned(c,CC);
    d=AddUnsigned(d,DD);
  }

  var temp = WordToHex(a)+WordToHex(b)+WordToHex(c)+WordToHex(d);

  return( temp.toLowerCase() );
};

function Encrypt( sz )
{
  var szRet = '';

  for( i = 0; i < sz.length; i++ )
    szRet += String.fromCharCode(sz.charCodeAt(i)+96);

  return( szRet );
};

function Decrypt( sz )
{
    var szRet = '';

    for( i = 0; i < sz.length; i++ )
      szRet += String.fromCharCode(sz.charCodeAt(i)-96);

    return( szRet );
};

///////////////////////////////////////////////////////////////////////////////
// CRCC16 / CRC32 function

function CRC16UPD(c, crc)
{
  var x;
  c <<= 8;
  for( x = 0; x < 8; x++ )
  {
    if((crc ^ c) & 0x8000)
      crc = (crc << 1) ^ 0x1021;
    else
      crc = (crc << 1);

    c = (c << 1) & 0xFFFF;
    crc = crc & 0xFFFF;
  }

  return( crc )
};

function CRC16STR(s, seed, upper)
{
  var i, crc;

  if( upper )
    s = s.toUpperCase();

  crc = seed;

  for( i = 0; i < s.length; i++ )
    crc = CRC16UPD(s.charCodeAt(i), crc);

  return( crc >= (1<<15) ? crc - (1<<16) : crc );
};

var crc32tab = new Array(
0, 1996959894, -301047508, -1727442502, 124634137, 1886057615, -379345611, -1637575261,
249268274, 2044508324, -522852066, -1747789432, 162941995, 2125561021, -407360249, -1866523247,
498536548, 1789927666, -205950648, -2067906082, 450548861, 1843258603, -187386543, -2083289657,
325883990, 1684777152, -43845254, -1973040660, 335633487, 1661365465, -99664541, -1928851979,
997073096, 1281953886, -715111964, -1570279054, 1006888145, 1258607687, -770865667, -1526024853,
901097722, 1119000684, -608450090, -1396901568, 853044451, 1172266101, -589951537, -1412350631,
651767980, 1373503546, -925412992, -1076862698, 565507253, 1454621731, -809855591, -1195530993,
671266974, 1594198024, -972236366, -1324619484, 795835527, 1483230225, -1050600021, -1234817731,
1994146192, 31158534, -1731059524, -271249366, 1907459465, 112637215, -1614814043, -390540237,
2013776290, 251722036, -1777751922, -519137256, 2137656763, 141376813, -1855689577, -429695999,
1802195444, 476864866, -2056965928, -228458418, 1812370925, 453092731, -2113342271, -183516073,
1706088902, 314042704, -1950435094, -54949764, 1658658271, 366619977, -1932296973, -69972891,
1303535960, 984961486, -1547960204, -725929758, 1256170817, 1037604311, -1529756563, -740887301,
1131014506, 879679996, -1385723834, -631195440, 1141124467, 855842277, -1442165665, -586318647,
1342533948, 654459306, -1106571248, -921952122, 1466479909, 544179635, -1184443383, -832445281,
1591671054, 702138776, -1328506846, -942167884, 1504918807, 783551873, -1212326853, -1061524307,
-306674912, -1698712650, 62317068, 1957810842, -355121351, -1647151185, 81470997, 1943803523,
-480048366, -1805370492, 225274430, 2053790376, -468791541, -1828061283, 167816743, 2097651377,
-267414716, -2029476910, 503444072, 1762050814, -144550051, -2140837941, 426522225, 1852507879,
-19653770, -1982649376, 282753626, 1742555852, -105259153, -1900089351, 397917763, 1622183637,
-690576408, -1580100738, 953729732, 1340076626, -776247311, -1497606297, 1068828381, 1219638859,
-670225446, -1358292148, 906185462, 1090812512, -547295293, -1469587627, 829329135, 1181335161,
-882789492, -1134132454, 628085408, 1382605366, -871598187, -1156888829, 570562233, 1426400815,
-977650754, -1296233688, 733239954, 1555261956, -1026031705, -1244606671, 752459403, 1541320221,
-1687895376, -328994266, 1969922972, 40735498, -1677130071, -351390145, 1913087877, 83908371,
-1782625662, -491226604, 2075208622, 213261112, -1831694693, -438977011, 2094854071, 198958881,
-2032938284, -237706686, 1759359992, 534414190, -2118248755, -155638181, 1873836001, 414664567,
-2012718362, -15766928, 1711684554, 285281116, -1889165569, -127750551, 1634467795, 376229701,
-1609899400, -686959890, 1308918612, 956543938, -1486412191, -799009033, 1231636301, 1047427035,
-1362007478, -640263460, 1088359270, 936918000, -1447252397, -558129467, 1202900863, 817233897,
-1111625188, -893730166, 1404277552, 615818150, -1160759803, -841546093, 1423857449, 601450431,
-1285129682, -1000256840, 1567103746, 711928724, -1274298825, -1022587231, 1510334235, 755167117);

function CRC32UPD(c, crc)
{
  return( crc32tab[((crc & 0xFFFF) ^ c) & 0xFF] ^ ((crc >> 8) & 0x00FFFFFF) );
};

function CRC32STR( str, upper )
{
  var crc = -1;

  if( upper )
    str = str.toUpperCase();

  for( i = 0; i < str.length; i++ )
    crc = CRC32UPD( str.charCodeAt(i), crc );

 return( crc );
};

var Entities =
{
  _Chars :
  [
    [ "&amp;", "&" ],
    [ "&lt;", "<" ],
    [ "&gt;", ">" ],
    [ "&quot;", '"' ]
  ],

  ReplaceChar : function( sMatch )
  {
    for( var i = 0; i < this._Chars.length; i++ )
    {
      if( this._Chars[i][1] == sMatch )
        return( this._Chars[i][0] );
    }

    return( sMatch );
  },

  Encode : function( str )
  {
    str = str.replace( /([^\x01-\x7f])/g, function( $0, $1 ) {
                                                  return( ( "&#" + $1.charCodeAt(0) + ";" ) ); } );

    str = str.replace( /(([<>\"&])(?!#))/g, function( $0, $1 ) {
                                                  return( Entities.ReplaceChar( $1 ) ); } );
    return( str );
  },

  Decode : function( str )
  {
    for( var i = 0; i < this._Chars.length; i++ )
      str = str.replace( this._Chars[i][0], this._Chars[i][1] );

    str = str.replace( /(&#(\d+);)/g, function( $0, $1, $2 ) {
                                        return( String.fromCharCode( $2 ) ); } );
    return( str );
  }
};
function SetRule( cssrule, properties )
{
  for( var s = 0; s < document.styleSheets.length; s++ )
  {
    var sheet = document.styleSheets[s];

    if( !sheet )
      continue;

    var rules = ( sheet.rules ) ? sheet.rules : sheet.cssRules;

    if( !rules )
      continue;

    var rule = null;

    for( var r = 0; r < rules.length; r++ )
    {
      if( !rules.item( r ).selectorText )
        continue;

      if( rules.item( r ).selectorText.toLowerCase() == cssrule.toLowerCase() )
      {
        rule = rules.item( r );
        break;
      }
    }

    if( !rule )
      continue;

    var style = rule.style;

    if( !style )
      continue;

    for( p = 0; p < properties.length; p++ )
      eval( "style." + properties[p][0] + "='" + properties[p][1] + "'" );
  }
};

function FixBrowsers()
{
  switch( Browser.GetMake() )
  {
    case 'msie':
      break;

    case 'safari':
      SetRule( 'input.file',
        [
          [ 'width', '80px' ],
          [ 'color', 'black' ],
          [ 'borderColor', 'black' ]
        ]
      );
      break;

    case 'opera':
      SetRule( 'input.file',
        [
          [ 'width', '95px' ],
          [ 'color', 'black' ],
          [ 'borderColor', 'black' ]
        ]
      );
      break;

    case 'firefox':
      break;
  }
};

FixBrowsers();

///////////////////////////////////////////////////////////////////////////////
// GetOS: returns long value containing the OS in the high side and version in
// the low side bits
// Possible OS values in high side bits
// Windows 95   0x00010000
// Windows 98   0x00020000
// Windows NT   0x00040000 ( use low side to determine Win2000 .. NT v5
// Macintosh    0x00100000
// Others ?     0

var osVersion = 0x0000FFFF;
var osWin95   = 0x00010000;
var osWin98   = 0x00020000;
var osWinNT   = 0x00040000;
var osMac     = 0x00100000;

function GetOS()
{
  var os = 0;
  var i = navigator.appVersion.search(/Win/i);

  if( i < 0 )
  {
    if( navigator.appVersion.search(/Macintosh/i) >= 0 )
      os = osMac;
    return( os );
  }

  var s = navigator.appVersion.substr( i );
  var a = s.split( /[ \t();:{}]/ );

  if( a.length < 2 )
    return( 0 );

  switch( a[0] )
  {
    case 'Win95':
      os = osWin95;
      break;

    case 'Win98':
      os = osWin98;
      break;

    case 'WinNT':
      os = ( osWinNT | 4 );
      break;

    case 'Windows':
      switch( a[1] )
      {
        case '95':
          os = osWin95;
          break;
        case '98':
          os = osWin98;
          break;
        case 'NT':
          os = osWinNT;
          i = parseFloat( a[2] ) * 10;
          if( !i )
            i = 40;
          os |= i;
          break;
      }
      break;

    default:
      break;
  }

  return( os );
};
var bDebug = false;

function checkTables()
{
};

// Parses URL and replaces parameters with correct paths. Also makes
// complete path for browser or redirect
function ParseURL( str, grp ) // REV 001
{
  str = Format.Trim( str );

  if( str == null || grp == null || !str.length )
    return( null );

  var grppath = '';

  // create group pathname if needed
  if( parseInt(grp) > 1 )
    grppath = "/g" + Format.PadLeft( grp, 7, "0" );

  str = str.replace( /<GRP_HOME>/g, URL.Relative("home/" + grppath) );
  str = str.replace( /<GRP_RUN>/g, URL.Relative("home/" + grppath + "/run") );
  str = str.replace( /<GRP_DNLD>/g, URL.Relative("home/" + grppath + "/download") );
  str = str.replace( /^SPLITVIEW:/gi, URL.Relative("sys/html/splitview.htm?") );
  str = str.replace( /^LOADER:/gi, URL.Relative("sys/html/loader.htm?") );

  // does it start with a valid protocol ??
  if( !str.match( /^(http:|https:|ftp:|file:|.:|\\\\)/ ) )
  {
    // setting the URL relative to the current window location.
    str = URL.Relative( str );
  }

  return( str );
}; // ParseURL

///////////////////////////////////////////////////////////////////////////////
/// Window Functions
///////////////////////////////////////////////////////////////////////////////
var Window =
{
  // ALL WINDOWS THAT HAVE BEEN OPENED
  _Collection : [],
  // POSSIBLE POINTER TO FUNCTION FOR WHEN THE WINDOW CLOSES
  OnUnload    : null,
  // SET TO TRUE FOR WHEN WINDOW IS LOADED
  bLoaded     : false,
  // USED FOR CALENDAR WINDOW
  _DateField  : null,

  ViewWidth   : 0,
  ViewHeight  : 0,

  Help : function( name )
  {
    if( !name )
      name = 'contents.htm';
    var url = URL.Relative( '/sys/help/' + name + '.htm' );
    this.Open( url, 'mbolhelp', { width: 850, height: 650 } );
  }, // Help

  Test : function( loc )
  {
    this.Open( loc, 'mbotest', { width: 700, height: 500 } );
  }, // Test

  AdminSupport : function( loc )
  {
    this.Open( loc, 'mboladmin', { width: 850, height: 650 } );
  }, // AdminSupport

  Open : function( sLocation, sName, opts )
  {
    if( !sName )
      sName = 'window';

    if( typeof( opts ) == 'undefined' )
    {
      opts = {};
      opts.fullscreen = 1;
    }

    // replace \ with \\, ' with \'
    sLocation = sLocation.replace( /\\/g, "\\\\" );
//    sLocation = sLocation.replace( /\'/g, "\\\'" );

    // prefix name and lowercase
    sName = ( ( sName.substr( 0, 4 ) != 'mbo_' ) ? 'mbo_' : '' ) + sName.toLowerCase();
    var prms = {};

    if( opts.fullscreen )
    {
      prms = opts;
    }
    else
    {
      if( opts.newwindow )
      {
        opts = { toolbar: 1, scrollbars: 1, menubar: 1, status: 1, width: screen.availWidth, height: screen.availHeight };
      }

      // start params for window
      var width = ( opts.width ) ? opts.width : 600;
      var height = ( opts.height ) ? opts.height : 400;
      var x = ( screen.availWidth - width ) / 2;
      var y = ( screen.availHeight - height ) / 2;

      prms =
      {
        screenx : x,
        screeny : y,
        left    : x,
        top     : y,
        resizable : ( opts.resizable ) ? opts.resizable : 1,
        toolbar   : ( opts.toolbar ) ? opts.toolbar : 0,
        scrollbars : ( opts.scrollbars ) ? opts.scrollbars : 1,
        menubar : ( opts.menubar ) ? opts.menubar : 0,
        status  : ( opts.status ) ? opts.status : 0
      };

      if( width > 0 )
        prms.width = width;

      if( height > 0 )
        prms.height = height;
    }

    sName = sName.replace( / /g, '' );

    if( !window[sName] || window[sName].closed )
      window[sName] = window.open( sLocation, sName, ListProps( prms, true ) );
    else
      window[sName].location = sLocation;

    if( window[sName] && !window[sName].closed )
      window[sName].focus();

    this._Collection[this._Collection.length] = window[sName];
  }, // Open

  Close : function( sName )
  {
    if( Browser.IsIE() )
      return;

    var oWindow = null;

    if( sName )
    {
      sName = ( ( sName.substr( 0, 4 ) != 'mbo_' ) ? 'mbo_' : '' ) + sName.toLowerCase();
      oWindow = window[sName];
    }
    else
    {
      oWindow = window;
    }

    if( oWindow && !oWindow.closed )
      oWindow.close();
  }, // Close

  Unload : function()
  {
    this.bLoaded = false;

    // 11956
    if( typeof( WindowOnUnload ) == 'function' )
      WindowOnUnload();

    for( var i = 0; i < this._Collection.length; i++ )
    {
      var w = this._Collection[i];

      if( w && !w.closed && w.name && w.name != 'mbo_download' )
        w.close();
    }

    if( this.OnUnload && typeof( this.OnUnload ) == 'function' )
      this.OnUnload();
  }, // Unload

  Load : function()
  {
    FadeInfoBox();

    // CAPTURE SCREEN SIZE AND VIEWING SIZE #4490
    Window.ViewWidth = window.innerWidth || document.body.clientWidth;
    Window.ViewHeight = window.innerHeight || document.body.clientHeight;

    Cookie.SetNVP( "MBO5.CLIENT", 'Screen', screen.width + ' x ' + screen.height );
    Cookie.SetNVP( "MBO5.CLIENT", 'View', Window.ViewWidth + ' x ' + Window.ViewHeight );

    if( typeof( WindowOnLoad ) == 'function' )
      WindowOnLoad();
  }
};

function FadeInfoBox()
{
  var div = document.getElementById( 'information_box' );

  if( div )
  {
    // IE10 DOES NOT SUPPORT filters.alpha
    // CAN NOT CHECK FOR VERSION 10 DUE TO COMPATABLITY MODE
    if( typeof( div.filters ) != 'undefined' )
    {
      if( div.filters.alpha.opacity > 0 )
      {
        div.filters.alpha.opacity -= 1;
        setTimeout( "FadeInfoBox();", 100 );
      }
    }
    else
    {
      if( div.style.opacity > 0 )
      {
        div.style.opacity -= 0.01;
        setTimeout( "FadeInfoBox();", 100 );
      }
    }
  }
};

function FillInfoBox( txt )
{
  var div = document.getElementById( 'information_box' );

  if( div )
  {
    div.innerHTML = txt;

    // CENTER THE BOX
    var div_rect = GetAbsolutePosition( div );
    var d = parseInt( div_rect.width ) / 2;
    var s = parseInt( Screen.GetWindowRectangle().width ) / 2;
    div.style.left = ( s - d ) + 'px';

    // IE10 DOES NOT SUPPORT filters.alpha
    if( typeof( div.filters ) != 'undefined' )
    {
      div.filters.alpha.opacity = 100;
    }
    else
    {
      div.style.opacity = 1;
    }

    FadeInfoBox();
  }
};

function Launch( cmd, val, val2 )
{
  // IF CMD COMES IN AS NUMBER, FROM CELL_REFERENCE, IT WILL BE AN EVENT
  if( !isNaN( cmd ) )
  {
    val = cmd;
    cmd = 'EVENT';
  }

  switch( cmd )
  {
    case 'EVENT':
      location.replace( URL.Page( 'Launch', 'Default', { EvtID: val } ) );
      break;
    case 'CLASS':
      cmd = 'CLASS_LAUNCH,' + val;
      fm.action = URL.Page( 'ClassLaunch', cmd );
      break;
  }
};

///////////////////////////////////////////////////////////////////////////////
/// Window Functions END
///////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////
/// Search List Functions
///////////////////////////////////////////////////////////////////////////////
function TestURL( fld, grp )
{
  var script_extn = "pl";
  var loc = null;
  fld = document.entryForm[fld];
  if( !fld )
    return;
  loc = unescape(fld.value);
  cmp = document.entryForm[grp + 'CompID'];
  grp = document.entryForm[grp + 'GrpID'];
  cmp = ( cmp ) ? cmp.value : false;
  grp = ( grp ) ? grp.value : false;

  // should this test now, or continue?
  //if( loc.match( /^lmscript:/ ) )
  //  loc = URL.Page( 'Launch', 'Redirect', {EvtID : 0, EvtPath : escape(loc)} );

  if( cmp )
    loc = ParseURL( loc, cmp );

  if( !cmp && grp )
    loc = ParseURL( loc, grp );

  if( loc )
    Window.Test( URL.Page( 'Launch', 'Redirect', {EvtID : 0, EvtPath : escape(loc)} ) );
};

///////////////////////////////////////////////////////////////////////////////
/// Saving Data Functions
///////////////////////////////////////////////////////////////////////////////
var GrpMap =
{
  _lastgrp: 0,
  _lastaction: '',

  UpdateGroup : function( grpid, action )
  {
    GrpMap._lastgrp = grpid;
    GrpMap._lastaction = action;
    var a    = new AJAX();
    a.URL    = URL.Page( 'AJAX', 'Cell', { cell: 'GrpMap', act: action, GrpID: grpid } );
    a.Method = "POST";
    a.Params = Form.MakeGetURL( document.grpmap_form );
    a.Data   = 'grpmap_' + grpid;
    a.OnComplete = AjaxResponse;
    a.Send();
  },

  Search : function( form )
  {
    var a = new AJAX();
    a.URL = form.action;
    a.Method = 'POST';
    a.Params = Form.MakeGetURL( form );
    a.OnComplete = AjaxResponse;
    a.Data = form.parentNode.id;
    a.Busy = Busy.Run;
    a.Send();
    return( false );
  },

  Refresh : function()
  {
    if( GrpMap._lastaction )
    {
      GrpMap.UpdateGroup( GrpMap._lastgrp, GrpMap._lastaction );
    }
    else
    {
      // REFRESH ENTIRE GROUPTREE
      var a = new AJAX();
      a.URL = URL.Page( 'AJAX', 'Cell', { cell: 'GrpMap', act: 'GroupTree' } );
      a.Data = 'grptree_div';
      a.Method = 'POST';
      a.Params = Form.MakeGetURL( document.grpmap_form );
      a.OnComplete = AjaxResponse;
      a.Send();
    }
    return( true );
  },

  Open : function( params )
  {
    if( params.FIELD )
    {
      var fld = document.getElementById( params.FIELD );
      var flds = FindObjects( fld, 'txt' );
      if( flds.base.value ) params.SELECTED = flds.base.value;
    }
    params.ctype = 'text/xml';
    params.cell = 'GrpMap';
    params.act = 'GroupSearch';
    var page_url = URL.Page( 'AJAX', 'Cell', params );
    Dialog.Init({ title :     'Group Select',
                  url :       page_url,
                  scrolling : true,
                  status :    '',
                  width :     450,
                  height :    400 });
  },
  Select : function( val, txt )
  {
    var form = document.grpmap_form;
    var fld = document.getElementById( form.FIELD.value );
    var flds = FindObjects( fld, 'txt' );
    flds.base.value = val;
    if( flds.txt )
      flds.txt.innerHTML = txt;
    if( form.window_id.value ) Dialog.Close( form.window_id.value );
    // This part is being used to set the sticky group
    if( flds.base.onchange ) flds.base.onchange();
  }
};

function GroupFieldUpdate( div, url )
{
  var a     = new AJAX();
  a.URL     = url;
  a.Method  = "POST";
  a.OnComplete = AjaxResponse;
  a.Data    = div;
  a.Send();
};

function GroupFieldSearch( btn )
{
  var form = btn.form;
  var a = new AJAX();
  a.URL = form.action;
  a.Method = "POST";
  a.Params = Form.MakeGetURL( form );
  a.OnComplete = AjaxResponse;
  a.Data = form.parentNode.id;
  a.Send();
};

function GroupFieldSelect( val, txt )
{
  var form = document.fieldgroupid_window_form;
  var hfld = document.getElementById( 'groupfield_' + form.id.value );
  var tfld = document.getElementById( 'groupfield_txt_' + form.id.value );
  hfld.value = val;
  tfld.innerHTML = txt;
  if( form.WINDOW.value )
  {
    Dialog.Close( form.WINDOW.value );
  }
  if( hfld.onchange && hfld.value != hfld.defaultValue )
  {
    hfld.onchange();
  }
};

function StickGroup( grpid )
{
  var a = new AJAX();
  a.URL = URL.Page( 'AJAX', 'Page', { page : 'Groups', command : 'StickGroup', GrpID : grpid } );
  a.OnError = function( oRequest )
  {
    alert( 'Failed to set sticky group' );
  };
  a.OnComplete = function( oRequest )
  {
    if( oRequest.responseText != 'false' )
      window.location.reload();
  };
  a.Send();
};

function SetFKValue( id, val, txt )
{
  var fld = document.getElementById( id );
  if( !fld ) return;
      fld.value = val;
  var span = document.getElementById( id + '_lnk' );
  if( !span ) return;
      span.innerHTML = txt;
};

function DateFieldEditCheck( fld )
{
  if( !fld.value ) return( true );
  var ok = Is.Date( fld.value );

  if( !ok ) fld.value = fld.defaultValue;
  else if( fld.value ) fld.value = Format.Date(fld.value);                     //14036

};

// 14036
function TimeFieldEditCheck( fld )
{
  if( !fld.value ) return( true );
  var ok = Is.Time( fld.value );
  if( !ok ) fld.value = fld.defaultValue;
  else if( fld.value )
  {
    fld.value = Format.Time(fld.value);
  }
};

function DateTimeFieldUpdate( id )
{
  var fld = document.getElementById( id );
  var date = document.getElementById( id + '_dsp' );
  var time = document.getElementById( id + '_time' );

  var datetime = Date.Parse( fld.value );
  var today = new Date();
  var fmt = ( Date.DTTM_FMT ) ? Date.DTTM_FMT : 'Y-m-d H:i';
  if( date.value )
  {
    DateFieldEditCheck( date );
    var ndate = Date.Parse( date.value );
    if( ndate )
    {
      if( datetime )
        datetime = Date.Parse( ndate.Format( 'Y-m-d' ) + ' ' + datetime.Format( 'H:i' ) );
      else
        datetime = ndate;
    }
  }


  //14036
  if( time.value )
  {
    TimeFieldEditCheck( time )
  }


  var ntime = Date.Parse( today.Format( 'Y-m-d' ) + ' ' + time.value );
  if( ntime )
  {
    if( datetime )
      datetime = Date.Parse( datetime.Format( 'Y-m-d' ) + ' ' + ntime.Format( 'H:i' ) );
    else
      datetime = ntime;
  }
  fld.value = datetime.Format( fmt );
};

function DateTimeFieldSupplyTime (id)
{
  // PopCal.Open events update the hidden id = 'id' field directly, without calling
  // DateTimeFieldUpdate - This catches those changes and supplies a default time value,
  // given by the caller, or 00:00

  var time = document.getElementById( id + '_time' );
  if (!time.value)
  {
    var t = new Date();
    var defTime = undefined;

    if (time.name.match(/BegDate/))
      defTime = document.getElementById('hDefBegTime');
    else if (time.name.match(/EndDate/))
      defTime = document.getElementById('hDefEndTime');
    else
      defTime = t;

    if (defTime && defTime.value)
      t = Date.Parse(t.Format("Y-m-d") + ' ' + defTime.value);

    time.value = t.Format( "h:i A" );
    document.getElementById( id ).value += ' ' + t.Format( "H:i" );
  }
};

function DateRangeFieldUpdate( fldname )
{
  var rng_div = document.getElementById( fldname + '_rng' );
  var rel_div = document.getElementById( fldname + '_rel' );
  var view_fld = document.getElementsByName( fldname + '_view' );
  var dir_fld = document.getElementsByName( fldname + '_rel_dir' );
  var num_fld = document.getElementsByName( fldname + '_rel_num' );
  var typ_fld = document.getElementsByName( fldname + '_rel_typ' );
  var hid_fld = document.getElementsByName( 'dr' + fldname );

  if( view_fld[0].value == 'rel' )
  {
    rng_div.style.display = 'none';
    rel_div.style.display = 'inline';
    if( !hid_fld[0].value.length )
    {
      hid_fld[0].value = 'm,3';
      // fix fields based on value
      var data = hid_fld[0].value.split( ',' );
      var dir = ( data[1] < 0 ) ? -1 : ( data[1] > 0 ) ? 1 : 0;
      var num = parseInt( data[1] );
      if( !num ) num = 0;
      Form.SetFieldValue( typ_fld[0], data[0] );
      Form.SetFieldValue( dir_fld[0], dir );
      Form.SetFieldValue( num_fld[0], num );
    }
    else
    {
      var typ = typ_fld[0].value;
      var num = num_fld[0].value * dir_fld[0].value;
      hid_fld[0].value = typ + ',' + num;
    }

    if( dir_fld[0].value != 0 )
      num_fld[0].style.display = 'inline';
    else
      num_fld[0].style.display = 'none';

    var aflds = document.getElementsByName( 'da' + fldname );
    var bflds = document.getElementsByName( 'db' + fldname );
    aflds[0].value = '';
    bflds[0].value = '';
  }
  else
  {
    rng_div.style.display = 'inline';
    rel_div.style.display = 'none';
    hid_fld[0].value = '';

    //#14965
    var afld = document.getElementById( 'da' + fldname + '_dsp' );
    var bfld = document.getElementById( 'db' + fldname + '_dsp' );
    if( afld ) afld.innerHTML = '';
    if( bfld ) bfld.innerHTML = '';
  }
};

var Files =
{
  fcount    : 1,
  oIdx      : {},
  transfer  : null,
  table     : null,
  name      : null,

  Init : function( name, prms )
  {
	var table = document.getElementById( name + '_tbl' );
    Files.transfer = GetFileTransfer( name );
    if( Files.transfer.GetFileCount() && Files.transfer.GetFile( 0 ).status < 5 ) return;
    Files.transfer.OnOpen = Files.OnOpen;
    Files.transfer.OnOverallProgress = Files.OnOverallProgress;
    Files.transfer.OnComplete = Files.OnComplete;
    Files.transfer.OnOverallComplete = Files.OnOverallComplete;
    Files.transfer.Options = prms;
    Files.transfer.ID = name;
    Files.transfer.AutoUpload = true;
    Files.transfer.MaxSize = 80 * 1024 * 1024;
    Files.transfer.oURL = URL.Parse( Files.transfer.Get( "URL" ) );
    Files.transfer.oURL.query = NVP.ToObject( Files.transfer.oURL.query );
    Files.transfer.FileMask  = GetFileMask( prms.ext || prms.type );
    Files.transfer.MultiFile = prms.multifile;
    Files.transfer.MaxThreads = 1;
    Files.transfer.SetAll();
    MoveUploader( Files.transfer, name, prms );
  },

  OnOpen : function( oFR )
  {
    var files = GetElementsById( oFR.ID + '_file' );
    for( var i = 0; i < files.length; i++ )
    {
      if( files[i].innerHTML == oFR.name )
      {
        Files.oIdx[oFR.name] = i;
      }
    }
    var table = document.getElementById( oFR.ID + '_tbl' );
    if( !Files.oIdx[oFR.name] )
    {
      Files.oIdx[oFR.name] = table.rows.length;
      var row = table.insertRow(table.rows.length);
      for( var i = 0; i < table.rows[0].cells.length; i++ )
      {
        var cell = row.insertCell(row.cells.length);
        cell.innerHTML = table.rows[0].cells[i].innerHTML;
      }
    }
    var files = GetElementsById( oFR.ID + '_file' );
    var obars = GetElementsById( oFR.ID + '_obar' );
    obars[Files.oIdx[oFR.name]].style.display = 'block';
    files[Files.oIdx[oFR.name]].innerHTML = Format.FileName( oFR.name );
  },

  OnOverallProgress : function( oFR, nSent, nTotal )
  {
    var nPct = ( nSent / nTotal ) * 100;
    var ibars = GetElementsById( oFR.ID + '_ibar' );
    ibars[Files.oIdx[oFR.name]].style.width = nPct + '%';
  },

  OnComplete : function( oFR, sError )
  {
    if( sError )
      return( alert( sError ) );
    var idfield = document.getElementsByName( oFR.ID + '_id' );
    var filecellid = idfield[0].value;
    var params = NVP.ToString( { ID: filecellid, FILENAME: Format.FileName( oFR.name ) } );
    var a = new AJAX();
    a.Async = false;
    a.URL = URL.Page( 'AJAX', 'Cell', {ctype : 'text/xml', cell : 'Files', act : 'GetFileData'} );
    a.Method = 'POST';
    a.Params = params;
    a.Data = oFR;
    a.OnComplete = function( oResponse, oData )
    {
      var obj = false;
      try
      {
        obj = DomNodeToObject( oResponse.responseXML.documentElement );
      }
      catch ( e )
      {
        alert( oResponse.responseText );
      }

      var fileid   = ( obj ) ? obj.id : false;
      var fileurl  = ( obj ) ? obj.url : 'javascript:void(0);';
      var filename = ( obj ) ? obj.name : oFR.name;

      var rmov  = document.getElementsByName( oFR.ID + '_rm' );
      if( rmov )
      {
        rmov[Files.oIdx[oFR.name]].onclick = function()
        {
          Files.RemoveUpload( rmov[Files.oIdx[oFR.name]], filecellid, fileid, oFR.name );
        };
      }

      var obars = GetElementsById( oFR.ID + '_obar' );
      if( obars )
        obars[Files.oIdx[oFR.name]].style.display = 'none';

      var files = GetElementsById( oFR.ID + '_file' );
      if( files )
      {
        files[Files.oIdx[oFR.name]].href = fileurl;
        files[Files.oIdx[oFR.name]].innerHTML = filename;
      }
    };
    a.Send();
  },

  OnOverallComplete : function( oFR, sError )
  {
    var files = GetElementsById( oFR.ID + '_file' );
        files[Files.oIdx[oFR.name]].href = "javascript:void(0);";
        files[Files.oIdx[oFR.name]].innerHTML = Format.FileName( oFR.name );
    var obars = GetElementsById( oFR.ID + '_obar' );
        obars[Files.oIdx[oFR.name]].style.display = 'none';
    var uploaded = document.getElementById( oFR.ID + "Uploaded" );
    if( uploaded )
    {
      var filelist = ( uploaded.value ) ? uploaded.value.split( ',' ) : [];
      if( !ArrayHas( filelist, oFR.name ) )
        filelist[filelist.length] = oFR.name;
      uploaded.value = filelist.toString();
    }
    MoveUploader( oFR, oFR.ID, oFR.Options );
  },

  RemoveUpload : function( x, cellid, fileid, filename )
  {
    var table = document.getElementById( x.name.substring( 0, x.name.indexOf( '_rm' ) ) + '_tbl' );
    var list = document.getElementsByName( x.name );
    delete( Files.oIdx[filename] );
    for( var i = 0; i < list.length; i++ )
    {
      if( list[i] == x )
      {
        table.deleteRow( i );
      }
    }
    var uploaded = document.getElementById( x.name.substring( 0, x.name.indexOf( '_rm' ) ) + 'Uploaded' );
    if( uploaded )
    {
      var filelist = ( uploaded.value ) ? uploaded.value.split( ',' ) : new Array();
      for( var i = ( filelist.length - 1 ); i >= 0; i-- )
      {
        if( filelist[i] == filename )
        {
          filelist.splice( i, 1 );
        }
      }
      uploaded.value = filelist.toString();
    }

    var params = NVP.Set( '', 'FILEID', fileid );
        params = NVP.Set( params, 'ID', cellid );

    var a = new AJAX();
    a.URL = URL.Page( 'AJAX', 'Cell', {ctype : 'text/xml', cell : 'Files', act : 'Remove'} );
    a.Method = 'POST';
    a.Params = params;
    a.OnComplete = function( oResponse, oData ) {};
    a.Data = null;
    a.Send();
  }
};

function UploadComplete( oFT, oFR )
{
  // if error in uploader ( status == 5 ), quit
  if( oFR.status < 6 )
    return;

  var basename = oFT.ID;

  // set the field value -- IMPORTANT
  var flds     = [ '_fld', '_upl' ];
  for( var i = 0; i < flds.length; i++ )
  {
    var oDiv = document.getElementById( basename + flds[i] );
    if( oDiv )
      oDiv.value = oFR.name;
  }

  // IF PASSED A FORM NAME, USE AJAX TO AUTO COMPLETE THE UPLOAD rlr - 1/13/2011
  if( oFT.Options.formname.length )
  {
    var fm    = document[oFT.Options.formname];
    var a     = new AJAX( { AbortInterval : false } );
    a.URL     = fm.action;
    a.Params  = Form.MakeGetURL( fm );
    a.Method  = 'POST';
    a.Busy    = Busy.Run;
    a.OnComplete = function( oRequest, oData )
    {
      var body = oData.parentNode;
      var win = oData.WINDOW.value;
      if( oData.WINDOW ) // dialog box
      {
        var obj = false;
        try
        {
          obj = DomNodeToObject( oRequest.responseXML );
        }
        catch ( error )
        {
          alert( oRequest.responseText );
        }
        if( obj && obj.root )
        {
          if( obj.root.html ) body.innerHTML = obj.root.html;
          if( obj.root.title ) Dialog.SetTitle( win, obj.root.title );
          if( obj.root.status ) Dialog.SetStatus( win, obj.root.status );
        }
        else
        {
          body.innerHTML = oRequest.responseText;
        }
      }
      else
      {
        body.innerHTML = oRequest.responseText;
      }
    };
    a.Data = fm;
    a.Send();

    return( false );
  }

  var spn = document.getElementById( basename + "_spn" );
  if( spn )
      spn.innerHTML = oFR.name;

  var lnk = document.getElementById( basename + "_lnk" );
  var img = document.getElementById( basename + "_thumb" );

  var dstfile  = oFR.Options.dsturl + "/";
      dstfile += NVP.Get( URL.Parse( oFR.URL ).query, 'dstfile' ) || oFR.name;

  // test if actual image was uploaded - prevent loading red x
  if( ( lnk && lnk.src ) && ( oFR.Options.ext == 'image' ) || ( oFR.Options.ext == 'gif' ) )
  {
    var old_src = lnk.src;

    lnk.src = dstfile;
    lnk.onerror = function()
    {
      lnk.src = old_src;
    };
  }
  else if( img && oFR.Options.ext == 'image' )
    img.src = dstfile;

  var view = document.getElementById( basename + "_view" );
  var aViewable = [ '.jpg', '.jpeg', '.gif', '.png', '.bmp', '.txt', '.csv' ];
  if( view )
  {
    if( ArrayHas( aViewable, oFR.type ) )
    {
      view.style.display = ( dstfile.length ) ? 'inline' : 'none';
      view.href = dstfile;
    }
    else
    {
      view.style.display = 'none';
      view.href = "javascript:void(0);";
    }
  }
};

function UnlinkDoc( sBasename )
{
  var objs = FindObjects( document.getElementById( sBasename ), "fld,lnk,upl,del,thumb,view,spn" );
  if( objs.del )
    objs.del.value = ( objs.fld ) ? objs.fld.value : 1;
  if( objs.fld )
    objs.fld.value = '';
  if( objs.upl )
    objs.upl.value = '';
  if( objs.thumb )
    objs._thumb.src = gbl_img_noimage;
  if( objs.view )
    objs.view.style.display = 'none';
  if( objs.spn )
    objs.spn.innerHTML = sNoneSelected;
};

var Busy =
{
  Run  : function( b )
  {
    if( b )
      Busy.Open();
    else
      Busy.Close();
  }, // Busy.Run

  Open : function()
  {

    var win = Screen.GetWindowRectangle();

    // mask
    var screen  = document.createElement( 'div' );
    screen.id = 'busy_screen';
    screen.name = 'busy_screen';
    screen.className = 'busy_screen';
    screen.style.backgroundImage = 'url(' + SchemeImageURL( "screen.gif" ) + ')';
    document.body.appendChild( screen );

    screen.style.height = win.height + 'px';
    screen.style.left = win.left + 'px';
    screen.style.width = win.width + 'px';
    screen.style.left = win.left + 'px';
    screen.style.top = win.top + 'px';

    //Spinner
    var oSpin = document.createElement( 'div' );
        oSpin.innerHTML = "<img src='" + gbl_img_busy + "' alt='Busy...' />";
        oSpin.id = 'busy_div';
        oSpin.className = 'popupdiv';
        document.body.appendChild( oSpin );

    var win = Screen.GetWindowRectangle();
        oSpin.style.left = ( ( win.left + win.width / 2 ) - ( oSpin.offsetWidth / 2 )) + 'px';
        oSpin.style.top = ( ( win.top + win.height / 2 ) - ( oSpin.offsetHeight / 2 )) + 'px';
  }, // Busy.Open

  Close : function()
  {
    var aNames = [ 'busy_screen', 'busy_div' ];
    for( var i = 0; i < aNames.length; i++ )
    {
      var oDiv = document.getElementById( aNames[i] );
      if( oDiv )
        document.body.removeChild( oDiv );
    }
  }
};

function form_floatheader( div )
{
	var id = div.id;
	var hdr = document.getElementById( id + "_header" );
  var flt = document.getElementById( id + "_header_float" );
  if( flt )
  {
    return false;
  }

  if( !hdr ) return;

  var rect = GetAbsolutePosition( hdr );
  flt = hdr.cloneNode( true );
  flt.id += '_float';
  flt.style.position = 'absolute';
  flt.style.top = rect['top'] + 'px';
  flt.style.left = rect['left'] + 'px';
  flt.style.width = rect['width'] + 'px';
  flt.style.height = rect['height'] + 'px';
  div.appendChild( flt );
};

var Dialogboxes = [];
var Dialog_MoveItem = null;
var Dialog_ResizeItem = null;

var Dialog =
{
  oTitle      : null,
  oStatus     : null,
  oBody       : null,
  id          : '',
  title       : '',
  url         : '',
  status      : '',
  resize      : 0,
  scrolling   : 0,
  MoveOffX    : 0,
  MoveOffY    : 0,
  img_close     : '',
  img_minimize  : '',
  img_resize    : '',
  img_screenbg  : '',
  container     : '',

  _GetWindow : function( id )
  {
    return( document.getElementById( id + '_window' ) );
  },

  Init : function( o )
  {
    if( !o )
      return;

    var rctWin = Screen.GetWindowRectangle();

    this.id         = ( Dialogboxes.length ) ? Dialogboxes.length : 1;
    this.title      = o.title;
    this.url        = o.url;
    this.status     = o.status;
    this.resize     = o.resize;
    this.confirm    = o.confirm;
    this.onclose    = o.onclose;
    this.onresize   = o.onresize;
    this.width      = ( o.width && o.width < rctWin.width ) ? o.width : ( rctWin.width * .8 );
    this.height     = ( o.height && o.height < rctWin.height ) ? o.height : ( rctWin.height * .8 );
    this.top        = ( parseInt( o.top ) && parseInt( o.top ) != 'NaN' ) ?
                        parseInt( o.top )
                      : ( o.height && ( ( ( parseInt( rctWin.height ) - parseInt( this.height ) ) / 2 ) > 0 ) ) ?
                        ( ( parseInt( rctWin.height ) - parseInt( this.height ) ) / 2 )
                        : 10;
    this.left       = ( parseInt( o.left ) && parseInt( o.left ) != 'NaN' ) ?
                        parseInt( o.left )
                      : ( this.width ) ?
                        ( ( parseInt( rctWin.width ) - parseInt( this.width ) ) / 2 )
                        : 10;
    this.scrolling  = ( o.scrolling ) ? o.scrolling : 0;
    this.container  = ( o.container ) ? o.container : false;
    this.fitcontent = ( o.fitcontent ) ? o.fitcontent : false;

    this.img_close     = SchemeImageURL( 'close.png' );
    this.img_minimize  = SchemeImageURL( 'minus.gif' );
    this.img_resize    = SchemeImageURL( 'resize.gif' );
    this.img_screenbg  = SchemeImageURL( 'screen.gif' );

    this._Load();

    Dialogboxes[ this.id ] = {};
    for( p in Dialog )
    {
      if( typeof( this[p] ) != 'function' )
        Dialogboxes[this.id][p] = this[p];
    }

    if( this.url.length )
    {
      var oBody = document.getElementById( this.id + '_body' );
      if( oBody )
        oBody.innerHTML = '<center>LOADING ...</center><center><img src="'+ gbl_img_busy +'" /></center>';

      Dialogboxes[this.id].GetContent = Dialog.GetContent;
	  Dialog.GetContent();
    }

    if( this.title && this.title.length )
      this.SetTitle( this.id, this.title );

    if( this.status && this.status.length )
      this.SetStatus( this.id, this.status );

    return( this.id );
  },

  PostForm : function( id, fn )
  {
    var form = document[fn];
    if( !form ) return;
    var ok = true;
    try
    {
      ok = form.onsubmit();
    }
    catch ( e )
    {
      // assume no onsubmit
    }

    if( ok )
    {
      var oBody = document.getElementById( id + '_body' );
      var isXML = ( form.action.indexOf( 'text/xml' ) > 0 ) ? true : false;
      var params = Form.MakeGetURL( form );
          params = NVP.Set( params, 'window_id', id );
      var a = new AJAX();
      a.URL = form.action;
      a.Method = 'POST';
      a.Params = params;
      a.OnComplete = function( oRequest, oData )
      {
        if( oRequest.responseXML )
        {
          var obj = AjaxXMLResponse( oRequest, oData + '_body' );
          if( obj )
          {
            if( obj.status )
            {
              Dialog.SetStatus( oData, obj.status );
            }
          }
        }
        else AjaxResponse( oRequest, oData + '_body' );
        Dialog._FitContent( oData );
        InitializeFCK();
        oBody.focus();
      };
      a.Data = id;
      a.Busy = Busy.Run;
      a.Send();
    }
  },

  GetContent : function()
  {
    var url = this.url + ( ( this.url.indexOf( '?' ) ) ? '&window_id=' + this.id : '?window_id=' + this.id );
    var a = new AJAX( { AbortInterval: false } );
    a.URL = url;
    //a.Params = NVP.Set( '', 'window_id', this.id );
    a.Method = 'GET';
    a.Data = this.id;
    a.OnComplete = Dialog.Update;
    a.Send();
  },

  Update : function( oRequest, me )
  {
    var oBody = document.getElementById( me + '_body' );
    var sContentType = oRequest.getResponseHeader( 'Content-Type' );
	
	if( sContentType.search( 'text/xml' ) > -1 )
    {
      var obj = AjaxXMLResponseObject(oRequest);

	  if( obj )
      {
        if( obj.html )
        {
          if( oBody )
          {
            oBody.innerHTML = obj.html;
            if( Dialogboxes[me].onresize )
            {
              var re = new RegExp( /\(.+?\)/ );
              if( re.test( Dialogboxes[me].onresize ) )
              {
                eval( Dialogboxes[me].onresize );
              }
              else
              {
                eval( Dialogboxes[me].onresize + "(Dialogboxes['"+me+"'])" );
              }
            }
          }
        }

        if( obj.title )
        {
          Dialog.SetTitle( me, obj.title );
        }

        if( obj.status )
        {
          Dialog.SetStatus( me, obj.status );
        }

        if( !( Dialogboxes[me].width || Dialogboxes[me].height ) || Dialogboxes[me].fitcontent )
        {
          Dialog._FitContent( me );
        }
		
		var script = null;
		
		if( obj.jsfile )
        {
			
          try
          {
            script = LoadJS(obj.jsfile );
          }
          catch ( err )
          {
          }
        }
		
		if( obj.jscript )
        {
			
          try
          {
			if(script == null)
			{
			  eval( obj.jscript );
			}
			else{
				script.onload = function() { eval( obj.jscript ); };
			}
          }
          catch ( err )
          {
          }
        }
      }
    }
    else
    {
      oBody.innerHTML = oRequest.responseText;
      if( Dialogboxes[me].onresize )
      {
        var re = new RegExp( /\(.+?\)/ );
        if( re.test( Dialogboxes[me].onresize ) )
        {
          eval( Dialogboxes[me].onresize );
        }
        else
        {
          eval( Dialogboxes[me].onresize + "(Dialogboxes['"+me+"'])" );
        }
      }
      InitializeFCK();
      oBody.focus();
    }
  },

  _FitContent : function( id, shrink )
  {
    var oBody   = Dialogboxes[id].oBody; // body inside oWindow
    var oWindow = this._GetWindow( id ); // the container

    var oHeader = GetAbsolutePosition( Dialogboxes[id].oTitle.parentNode );
    var oFooter = GetAbsolutePosition( Dialogboxes[id].oStatus.parentNode );

    var height_bar = oHeader.height + oFooter.height;

    if( shrink )
    {
      oBody.style.height = '10px';
    }

    var cwidth = ( oBody ) ? oBody.scrollWidth : 0;
    var overflow = ( cwidth + Dialogboxes[id].left ) - window.innerWidth;
    if( overflow > 0 )
      cwidth -= overflow;

    if( oWindow )
    {
      oWindow.style.width = ( cwidth + 20 ) + 'px';
      if( oBody.scrollHeight )
      {
        var height_limit = ( parseInt( window.innerHeight ) * .90 ) - height_bar;
        var height = parseInt( oBody.scrollHeight );
        if( height_limit < height ) height = height_limit;

        var winHeight = ( height + height_bar );

        var rctWin = Screen.GetWindowRectangle();
        var ntop = ( height && ( ( ( parseInt( rctWin.height ) - winHeight ) / 2 ) > 0 ) ) ?
                            ( ( parseInt( rctWin.height ) - winHeight ) / 2 ) + 'px'
                            : '10px';

        oWindow.style.top = ntop;
        Dialogboxes[id].top = parseInt( ntop );


        oWindow.style.height = winHeight + 'px';
        oBody.style.height = height + 'px';
        if( Dialogboxes[id].onresize )
        {
          var re = new RegExp( /\(.+?\)/ );
          if( re.test( Dialogboxes[id].onresize ) )
          {
            eval( Dialogboxes[id].onresize );
          }
          else
          {
            eval( Dialogboxes[id].onresize + '(Dialogboxes["' + id + '"])' );
          }
        }
      }
    }
  },

  Close : function( id, bNoConfirm )
  {
    this.id = null;
    if( !Dialogboxes[id] )
      return;

    if( Dialogboxes[id].confirm )
    {
      var oBody = document.getElementById( id + '_body' );
      var form = oBody.getElementsByTagName( 'FORM' );
      if( form && !bNoConfirm )
      {
        if( Form.IsModified( form[0] ) )
        {
          var ok = eval( Dialogboxes[id].confirm + '(form[0])' );
          if( !ok ) return;
        }
      }

    }
    if( Dialogboxes[id].onclose )
    {
      var re = new RegExp( /\(.+?\)/ );
      if( re.test( Dialogboxes[id].onclose ) )
      {
        eval( Dialogboxes[id].onclose );
      }
      else
      {
        eval( Dialogboxes[id].onclose + '()' );
      }
    }
    var oWindow = document.getElementById( this.id + '_window' );
    if( oWindow )
      Dialogboxes[id].container.removeChild( oWindow );
    if( Dialogboxes[id].container.id == ( id + '_screen' ) )
      document.body.removeChild( Dialogboxes[id].container );

  },

  Minimize : function( id )
  {
    if( !Dialogboxes[id] ) return;
    var oWindow = document.getElementById( id + '_window' );
    var oHeader = document.getElementById( id + '_header' );
    var oBody   = document.getElementById( id + '_body' );
    var oFooter = document.getElementById( id + '_footer' );
    if( oBody.style.display == "block" )
    {
      Dialogboxes[id].saveHeight  = oWindow.style.height;
      oWindow.style.height      = oHeader.style.height;
      oBody.style.display       = "none";
      oFooter.style.display     = "none";
    }
    else
    {
      oWindow.style.height      = Dialogboxes[id].saveHeight;
      oBody.style.display       = "block";
      oFooter.style.display     = "block";
    }
  },

  SetContent : function( id, html )
  {
    if( !Dialogboxes[id] ) return;
    Dialogboxes[id].oBody.innerHTML = html;
    if( Dialogboxes[id].onresize )
    {
      var re = new RegExp( /\(.+?\)/ );
      if( re.test( Dialogboxes[id].onresize ) )
      {
        eval( Dialogboxes[id].onresize );
      }
      else
      {
        eval( Dialogboxes[id].onresize + '(Dialogboxes[id])' );
      }
    }
  },

  SetTitle : function( id, html, err )
  {
    if( !Dialogboxes[id] ) return;
    Dialogboxes[id].oTitle.innerHTML = html;
    if( err )
      AddClass( Dialogboxes[id].oTitle, "bad" );
    else
      DropClass( Dialogboxes[id].oTitle, "bad" );
  },

  SetStatus : function( id, html, err )
  {
    if( !Dialogboxes[id] ) return;
    Dialogboxes[id].oStatus.innerHTML = html;
    if( err )
      AddClass( Dialogboxes[id].oFooter, "bad" );
    else
      DropClass( Dialogboxes[id].oFooter, "bad" );
  },

  StartMove : function( id, x, y )
  {
    var oWindow = Dialog._GetWindow( id );
    if( Dialogboxes[id] )
    {
      if( !Browser.IsIE() )
      {
        document.addEventListener( 'mousemove', Dialog.Move, false ) ;
        document.addEventListener( 'mouseup', Dialog.EndMove, false ) ;
      }
      else
      {
        document.attachEvent( 'onmousemove', Dialog.Move );
        document.attachEvent( 'onmouseup', Dialog.EndMove );
      }
      Dialogboxes[id].MoveOffX = ( x - Dialogboxes[id].left );
      Dialogboxes[id].MoveOffY = ( y - Dialogboxes[id].top );
      Dialog_MoveItem = id;
    }
  },

  Move : function(event)
  {
    if( !event ) event = window.event;
    if( !event ) return;
    if( Dialog_MoveItem == null || !Dialogboxes[Dialog_MoveItem] ) Dialog.EndMove();
    Dialogboxes[Dialog_MoveItem].top = ( event.clientY - Dialogboxes[Dialog_MoveItem].MoveOffY );
    Dialogboxes[Dialog_MoveItem].left = ( event.clientX - Dialogboxes[Dialog_MoveItem].MoveOffX );

    var oWindow = Dialog._GetWindow( Dialog_MoveItem );
    oWindow.style.top = Dialogboxes[Dialog_MoveItem].top + 'px';
    oWindow.style.left = Dialogboxes[Dialog_MoveItem].left + 'px';
  },

  EndMove : function()
  {
    if( !Browser.IsIE() )
    {
      if( Dialog_MoveItem == null ) return;
      document.removeEventListener( 'mousemove', Dialog.Move, false ) ;
    }
    else
    {
      document.detachEvent( 'onmousemove', Dialog.Move );
      document.detachEvent( 'onmouseup', Dialog.EndMove );
    }
    Dialog_MoveItem = null;
  },

  StartResize : function( id )
  {
    var oWindow = Dialog._GetWindow( id );

    SetOpacity(oWindow.children[1], 3); // children[1] is guaranteed to exist by _Load
    Screen.MouseInitialize();
    if( Dialogboxes[id] )
    {
      var rect = GetAbsolutePosition( oWindow );
      if( !Browser.IsIE() )
      {

        document.addEventListener( 'mousemove', Dialog.Resize, false );
        document.addEventListener( 'mouseup', Dialog.EndResize, false );
      }
      else
      {
        document.attachEvent( 'onmousemove', Dialog.Resize );
        document.attachEvent( 'onmouseup', Dialog.EndResize );
      }
      scrollOffsetY = ( window.pageYOffset ) ? window.pageYOffset : document.body.scrollTop;
      scrollOffsetX = ( window.pageXOffset ) ? window.pageXOffset : document.body.scrollLeft;

      Dialogboxes[id].resize_top = ( Dialogboxes[id].top - scrollOffsetY );
      Dialogboxes[id].resize_left = ( Dialogboxes[id].left - scrollOffsetX );
      Dialog_ResizeItem = id;
    }
  },

  Resize : function(event)
  {
    if( !event ) event = window.event;
    if( !event ) return;
    if( Dialog_ResizeItem == null || !Dialogboxes[Dialog_ResizeItem] ) Dialog.EndResize();

    var oWindow = Dialog._GetWindow( Dialog_ResizeItem );
    var oMouse = Screen.GetScreenPosition();
    var wid = ( oMouse.x - Dialogboxes[Dialog_ResizeItem].left );
    var hit = ( oMouse.y - Dialogboxes[Dialog_ResizeItem].top );
        wid = ( wid > 30 ) ? wid : 30;
        hit = ( hit > 30 ) ? hit : 30;
    oWindow.style.width = wid + 'px';
    oWindow.style.height = hit + 'px';

    var oHeader = GetAbsolutePosition( Dialogboxes[Dialog_ResizeItem].oTitle.parentNode );
    var oFooter = GetAbsolutePosition( Dialogboxes[Dialog_ResizeItem].oStatus.parentNode );

    var height_bar = oHeader.height + oFooter.height;

    oWindow.firstChild.nextSibling.style.height = ( hit - height_bar ) + 'px';
    return false;
  },

  EndResize : function()
  {
    if( !Browser.IsIE() )
    {
      if( Dialog_ResizeItem == null ) return;
      document.removeEventListener( 'mousemove', Dialog.Resize, false ) ;
    }
    else
    {
      document.detachEvent( 'onmousemove', Dialog.Resize );
      document.detachEvent( 'onmouseup', Dialog.EndResize );
    }
    if( Dialogboxes[Dialog_ResizeItem].onresize )
    {
      var re = new RegExp( /\(.+?\)/ );
      if( re.test( Dialogboxes[Dialog_ResizeItem].onresize ) )
      {
        eval( Dialogboxes[Dialog_ResizeItem].onresize );
      }
      else
      {
        eval( Dialogboxes[Dialog_ResizeItem].onresize + '(Dialogboxes[Dialog_ResizeItem])' );
      }
    }

    SetOpacity(Dialog._GetWindow( Dialog_ResizeItem ).children[1], 10); // children[1] is guaranteed to exist by _Load
    Dialog_ResizeItem = null;
  },

  Print : function()
  {
    var win = Window.Open(); // 8254 - switch from using window.open directly.

    if( win )
    {
      win.document.open();
      win.document.write( this.oBody.innerHTML );
      win.document.close();
    }
  },

  _Load : function()
  {
    document.body.ondragstart = "return false";
    document.body.onselectstart = "return false";

    var screen  = document.createElement( 'div' );
    with( screen )
    {
      id                    = this.id + '_screen';
      name                  = this.id + '_screen';
      className             = 'dialog_screen';
      style.width           = '100%';
      style.zIndex          = 100;      // cover over most things
      style.height          = ( ( document.height ) ? document.height + 'px' : '200%' );
      style.backgroundImage = "url(" + this.img_screenbg + ")";
    }

    var new_win = document.createElement( 'div' );
    with( new_win )
    {
      className             = 'dialog_win';
      style.position        = 'fixed';
      style.display         = 'block';
      style.width           = ( this.width ) ? this.width + 'px' : "100px";
      style.height          = ( this.height ) ? this.height + 'px' : "100px";
      style.top             = this.top + 'px';
      style.left            = this.left + 'px';
      id                    = this.id + '_window';
      name                  = this.id + '_window';
    }

    var header = document.createElement( 'div' );
    with( header )
    {
      id                    = this.id + '_header';
      name                  = this.id + '_header';
      className             = 'dialog_header';
      onmousedown           = function( event )
                              {
                                if( !event )
                                  event = window.event;
                                var x = event.clientX;
                                var y = event.clientY;
                                var id = this.id.substring( 0, this.id.indexOf('_') );
                                Dialog.StartMove( id, x, y );
                              };
    }

    var header_title = document.createElement( 'div' );
        header_title.id        = this.id + '_header_title';
        header_title.name      = this.id + '_header_title';
        header_title.className = 'dialog_hdr_title';
    this.oTitle = header_title;

    var header_buttons = document.createElement( 'div' );
        header_buttons.style.position           = "absolute";
        header_buttons.style.display            = "block";
        header_buttons.style.right              = "1px";
        header_buttons.style.top                = "1px";

    var header_minimize = document.createElement( 'img' );
        header_minimize.src                     = this.img_minimize;
        header_minimize.id                      = this.id + '_img_minimize';
        header_minimize.onclick                 = function(){
                                                    var id = this.id.substring( 0, this.id.indexOf( '_' ) );
                                                    Dialog.Minimize( id ); };
        header_minimize.style.zindex            = 2;
        header_minimize.style.cursor            = "pointer";

    var header_close = document.createElement( 'img' );
        header_close.src                        = this.img_close;
        header_close.id                         = this.id + '_img_close';
        header_close.onclick                    = function(){
                                                  var id = this.id.substring( 0, this.id.indexOf( '_' ) );
                                                  Dialog.Close( id ); };
        header_close.style.zindex               = 2;
        header_close.style.cursor               = "pointer";

    var body = document.createElement( 'div' );
        body.style.width                        = "100%";
        body.style.overflow                     = ( this.scrolling ) ? "auto" : "hidden";
        body.style.display                      = "block";
        body.style.height                       = ( this.height - 50 ) + 'px';
        body.id                                 = this.id + '_body';
        body.name                               = this.id + '_body';
    this.oBody = body;

    var footer = document.createElement( 'div' );
    with( footer )
    {
      className = 'dialog_footer';
      id        = this.id + '_footer';
      name      = this.id + '_footer';
    };

    var footer_status = document.createElement( 'div' );
    with( footer_status )
    {
      className = 'dialog_status';
      id        = this.id + '_status';
      name      = this.id + '_status';
    };
    this.oStatus = footer_status;

    if( this.resize )
    {
      var footer_resize = document.createElement( 'div' );
      with( footer_resize )
      {
        className               = 'dialog_ftr_resize';
        style.backgroundImage   = "url(" + this.img_resize + ")";
        id                      = this.id + '_footerResize';
        name                    = this.id + '_footerResize';
        style.cursor            = 'se-resize';
        onmousedown             = function( event )
                                  {
                                    if( !Browser.IsIE() && event.preventDefault )
                                      event.preventDefault();

                                    var id = this.id.substring( 0, this.id.indexOf('_') );
                                    Dialog.StartResize( id );
                                  };
      };
    }

    header.appendChild( header_title );
    header_buttons.appendChild( header_minimize );
    header_buttons.appendChild( header_close );
    header.appendChild( header_buttons );
    footer.appendChild( footer_status );
    if( this.resize )
      footer.appendChild( footer_resize );
    new_win.appendChild( header );
    new_win.appendChild( body );
    new_win.appendChild( footer );
    if( this.container )
    {
      try
      {
        this.container.appendChild( new_win );
      }
      catch ( err )
      {
        this.container = false;
      }
    }
    if( !this.container )
    {
      screen.appendChild( new_win );
      document.body.appendChild( screen );
      this.container = document.getElementById( this.id + '_screen' );
    }
  }
};

var mbTimeout = 0;
var mbLastX = 0;
var mbLastY = 0;
var mbLastKeyDown = 0;
var mbType  = null;
var mbLastType = null;
var mbString = '';
var mbHiddenField = 'hidden';

function SetWinStateHandler()
{
  if (mbTimeout == 0) return;
  // VisAPI
  if (mbHiddenField in document)
    document.addEventListener("visibilitychange", ToggleWinState);
  else if ((mbHiddenField = "mozHidden") in document)
    document.addEventListener("mozvisibilitychange", ToggleWinState);
  else if ((mbHiddenField = "webkitHidden") in document)
    document.addEventListener("webkitvisibilitychange", ToggleWinState);
  else if ((mbHiddenField = "msHidden") in document)
    document.addEventListener("msvisibilitychange", ToggleWinState);

  // IE 9-
  else if ("onfocusin" in document)
    document.onfocusin = document.onfocusout = ToggleWinState;

  // All others:
  else
    window.onpageshow = window.onpagehide = window.onfocus = window.onblur = ToggleWinState;

  // Compensate for background tabs with wrong class
  if (document[mbHiddenField])
  {
    DropClass(document.body, 'activeWin');
    AddClass(document.body, 'inactiveWin');
  }

  // Either starts the timer on focus or stops it on blur
  ResetWindowTimer();
};

function ToggleWinState (evt)
{
  if (mbTimeout == 0) return;

  var current = document.body.className;
  var update = false;
  var v = "activeWin", h = "inactiveWin",
      map =
      {
        focus:v, focusin:v, pageshow:v, blur:h, focusout:h, pagehide:h
      };

  evt = evt || window.event;

  if (evt.type in map)
  {
    var className = map[evt.type];
    DropClass(document.body, v);
    DropClass(document.body, h);
    AddClass(document.body, className);
    if (className == h)
      update = true;

  }
  else if (evt.type == 'visibilitychange')
  {
    DropClass(document.body, v);
    DropClass(document.body, h);

    if (document[mbHiddenField])
    {
      AddClass(document.body, h);
      update = true;
    }
    else
      AddClass(document.body, v);
  }

  // Update the timeout file when a user switches tabs/windows
  if (update)
    UpdateLastActive();

  // Logout on activate if the timeout has passed
  else if (current.match(h)) // was hidden, becoming visible
  {
    var ts = (new Date()).getTime();

    var last = Cookie.GetNVP('MBO5.CLIENT', 'SessionLastActive');
    var off  = Cookie.GetNVP('MBO5.CLIENT', 'TimeoutDisabled');

    if ( ( last && off == false && ((ts - last) > (mbTimeout * 60 * 1000))) || Cookie.GetNVP( "MBO5.CLIENT",'LoggingOut') === 1 )
      Logout( true );
  }

  // Either starts the timer on focus or stops it on blur
  ResetWindowTimer();
};

function ToArray( obj )
{
	var array = [];
	// iterate backwards ensuring that length is an UInt32
	for( var i = obj.length - 1; i >= 0; i-- )
	{ 
		array[i] = obj[i];
	}
	return array;
}

function UpdateLastActive(closing)
{
  if (typeof closing == 'undefined')
    closing = false;
  // If closing a background tab, or currently logging out, do not update

  if ((closing && document[mbHiddenField]) || Cookie.GetNVP( "MBO5.CLIENT",'LoggingOut') === 1 )
    return;

  Cookie.SetNVP( "MBO5.CLIENT",'SessionLastActive', (new Date()).getTime());
};

function ResetWindowTimer()
{
  if( !parent || parent.closed )
    return;

  if( parent.windowTimer )
    clearTimeout( parent.windowTimer );

  parent.windowTimer = null;

  if ( mbTimeout > 0 && !parent.document.body.className.match(/inactiveWin/) && Cookie.GetNVP('MBO5.CLIENT', 'TimeoutDisabled') != '1' )
    parent.windowTimer = window.setTimeout( "Logout( true );", (mbTimeout * 60 * 1000));
};

function ProcessEvent( e )
{
  var nKeyDown = 0;
  var currentX = undefined;
  var currentY = undefined;

  // Populate vars
  if( !Browser.IsIE() )
  {
    if( e )
    {
      mbType  = e.type;

      if( mbType == 'mousemove' )
      {
        if( Browser.GetVersion() < 5 )
        {
          currentX = e.x;
          currentY = e.y;
        }
        else
        {
          currentX = e.screenX;
          currentY = e.screenY;
        }
      }
      else if( mbType ==  'click' )
      {
      }
      else if( mbType == 'keypress' )
      {
        nKeyDown = e.which;
      }
    }
  }
  else
  {
    if( window.event )
    {
      e = window.event;
      mbType  = e.type;
      if( mbType == 'mousemove' )
      {
        currentX = (e.screenX - window.screenLeft)+window.document.documentElement.scrollLeft;
        currentY = (e.screenY - window.screenTop)+window.document.documentElement.scrollTop;
      }
      else if( mbType ==  'click' )
      {
      }
      else if( mbType == 'keypress' )
      {
        nKeyDown = e.keyCode;
      }
    }
  }


  // 11956 prevent constant mousemove resets in Chrome
  if ( e && e.type == 'mousemove' )
  {
    if ( currentX  == mbLastX && currentY == mbLastY )
    {
      mbLastX = currentX;
      mbLastY = currentY;
      return;
    }
  } // 11956

  if( mbTimeout > 0 )
  {
    ResetWindowTimer();

    // REV 002 .. check parent window if there is one
    if( TestParent() && window.opener.windowTimer )
      window.opener.ResetWindowTimer();
  }

  if( nKeyDown )
  {
    mbLastKeyDown = nKeyDown;
    if( nKeyDown == 13 )
    {
      ProcessCommand( mbString );
      mbString = '';
    }
    else
    {
      mbString += String.fromCharCode( nKeyDown );
    }
  }

  if( bDebug )
    SetStatus( "TYPE=" + mbType + " COMMAND=" + mbString + " X=" + mbLastX + " Y=" + mbLastY );

  mbLastX = currentX;
  mbLastY = currentY;
};

function SetProgramTimeout( timeout )
{
  // capture events
  if( !Browser.IsIE() )
  {
    window.captureEvents( Event.MOUSEMOVE | Event.KEYPRESS );
    window.onmousemove = ProcessEvent;
    window.onkeypress = ProcessEvent;
    window.onclick = ProcessEvent;
  }
  else if( Browser.IsIE() )
  {
    document.onmousemove = ProcessEvent;
    document.onkeypress = ProcessEvent;
    document.onclick = ProcessEvent;
  }

  mbTimeout = 0;

  if( parseInt( timeout ) > 0 )
  {
    mbTimeout = timeout;

    Cookie.SetNVP('MBO5.CLIENT', 'LoggingOut', 0);
    Cookie.SetNVP('MBO5.CLIENT', 'TimeoutDisabled', 0);

    UpdateLastActive();

    ProcessEvent();
  }
};

function Logout( inactivity )
{

  var done = false;
  while (!done)
  {

    document.body.style.cursor = 'wait';
    var mask = document.createElement('div');
    mask.id = 'mask';
    mask.className = 'popupwindow';
    mask.style.height = '100%';
    mask.style.bottom = '0px';
    document.body.appendChild(mask);

    done = true;
  }

  Cookie.SetNVP( "MBO5.CLIENT",'LoggingOut', 1);
  Cookie.SetNVP( "MBO5.CLIENT",'TimeoutDisabled', 0);

  if (!inactivity)
    location.replace( URL.Page( 'Home', 'Logout' ) );
  else
    location.replace( URL.Page( 'Home', 'Logout', {timeout : 1} ) );
};

function ProcessCommand( s )
{
  var i = s.indexOf( '=' );

  if( i < 1 )
    i = s.length;

  var cmd = s.substr( 0, i ).toLowerCase();
  var val = s.substr( i + 1 );

  switch( cmd )
  {
    case "debug":
        Cookie.SetNVP( "MBO5.CLIENT", cmd, parseInt( val ) );
        bDebug = ( val ) ? true : false;
        break;
    case "qcon":
        Cookie.SetNVP( "MBO5.CLIENT", cmd, parseInt( val ) );
        break;
    case "showlangkeys":
    case "keys":
        Cookie.SetNVP( "MBO5.CLIENT", "showlangkeys", parseInt( val ) );
        break;
    case "showcookie":
    case "cookie":
        if( bDebug )
          alert( val + ":\n" + Cookie.Get( val ) );
        break;
    case "runscript":
        if( bDebug )
          eval( prompt( "Enter Script To Run:", "" ) );
        break;
  }
};

var List =
{
  Suffix : '',

  SetSuffix : function( suffix )
    {
      this.Suffix = suffix;
    },

  GetSuffix : function()
    {
      return( this.Suffix );
    },

  CheckBox : function( field )
    {
      var fm = field.form;
      if( !fm.CHECKED ) return;
      var items = fm.CHECKED.value.split(',');
      if( field.checked == false )
      {
        for( var i = 0; i < items.length; i++ )
        {
          if( items[i] == field.value )
          {
            items.splice( i, 1 );
          }
        }
      }
      fm.CHECKED.value = items.join(',');
    },

  CheckBoxes : function( field, name )
    {
      var fm = field.form;
      var boxes = fm[name];
      if( !boxes ) return;
      if( boxes.length )
      {
        for( var i = 0; i < boxes.length; i++ )
        {
          if( boxes[i].checked != field.checked )
          {
            boxes[i].checked = field.checked;
            if( field.checked == false ) List.CheckBox( boxes[i] );
          }
        }
      }
      else
      {
        boxes.checked = field.checked;
      }
    },

  PageGoto : function( field, num, bJump ) // called by the PageGoto field
    {
      var fm = field.form;
      if( num )
        fm.list_page.value = ( bJump ) ? num : parseInt( fm.list_page.value ) + parseInt( num );
      if( fm.list_page.value < 1 )
        fm.list_page.value = 1;
      this.GetData( fm );

      return false;
    },

  GetData : function( form )
    {
      if( !form ) return;
      var params = Form.MakeGetURL( form );
          params = NVP.Set( params, 'Suffix', this.Suffix );
      var a = new AJAX();
      a.URL = form.action;
      a.Method = 'POST';
      a.Params = params;
      a.OnComplete =
        function( oRequest, oData )
        {
          if( oData )
          {
            var obj = null;
            var sContentType = oRequest.getResponseHeader( 'Content-Type' );
            if( sContentType.search( 'text/xml' ) > -1 )
            {
              try
              {
                obj = DomNodeToObject( oRequest.responseXML.documentElement );
              }
              catch ( err )
              {
                alert( oRequest.responseText );
              }

				if( obj != null )
				{
					oData.innerHTML = obj.html;
				}

              if( obj.jscript )
              {
                try
                {
                  eval( obj.jscript );
                }
                catch ( err )
                {
                }
              }
            }
            else
            {
              oData.innerHTML = oRequest.responseText;
            }
          }
          else
          {
            alert( 'Cannot find cell '+this.Data );
          }
        };
      a.Data = form.parentNode;
      a.Busy = Busy.Run;
      a.Send();
    }
};

/*********************************************************/
var PreDeleteMboObject =
{
  _func: null,
  _var : null,

  // Confirmation popup, with dependencies if any
  Confirm : function( id, val, pFunc, vPrm )
  {
    var params = { cell: 'PreDelete', act: 'Confirm', ID: id, Value: val };

    if( pFunc && typeof( pFunc ) == 'function' )
      PreDeleteMboObject._func = pFunc;

    if( vPrm )
    {
      PreDeleteMboObject._var = vPrm;
      for( p in vPrm )
        params[p] = vPrm[p];
    }


    PopUP.Create(
      URL.Page( 'AJAX', 'Cell', params ), 'confirm', Busy.Run );
  },

  // Level2 popup if ChgLogType = Prompt
  Level2 : function( fm, specialcase )
  {
    Form.DisableFields( true, fm, [ 'submit', 'button' ] );

    if( fm.CatTitleSelect && !specialcase )
    {
      if( !fm.confirm_message || confirm( fm.confirm_message.value ) )
      {
        fm.ValueNew.value = fm.CatTitleSelect.options[ fm.CatTitleSelect.selectedIndex ].value;
      }
      else
      {
        PopUP.Destroy();
        return;
      }
    }

    if( 0 && bCHGLOGPROMPT )
    {
      var params = Form.MakeGetURL( fm );
          params = NVP.Set( params, 'SpecialCase', specialcase );
      var a = new AJAX( { AbortInterval: false } );
      a.URL = URL.Page( 'AJAX', 'Cell', { cell: 'PreDelete', act: 'Level2' } );
      a.Method = 'POST';
      a.OnComplete = function( oRequest, oData )
      {
        PopUP.Update( oRequest.responseText );
      };
      a.Params = params;
      a.Data = 'popupdiv';
      a.Busy = Busy.Run;
      a.Send();
    }
    else
    {
      this.DeleteDivAjax( fm, specialcase );
    }
  },

  // Verify they entered a ChgLog Reason if Level2
  Verify : function( fm )
  {
    var fields =
    [
      [ fm.ChgLogReason, '!empty', "Reason" ],
      [ fm.UsrLoginID,   '!empty', "LoginID" ],
      [ fm.UsrPassword,  '!empty', "Password" ]
    ];
    var bError = Form.CheckFields( fields );
    var pass = CRC32STR( fm.UsrPassword.value, true );
    if( !bError )
    {
      if( fm.DBUsrLoginID.value == fm.UsrLoginID.value.toUpperCase() && fm.DBUsrPassword.value == pass )
      {
        fm.UsrPassword.value = pass;
        Form.DisableFields( true, fm, [ 'submit', 'button' ] );
        this.DeleteDivAjax( fm, fm.SpecialCase.value );
      }
      else
      {
        alert( 'Incorrect LoginID or Password entered' );
        fm.UsrPassword.value = '';
        bError = 1;
        return( bError );
      }
    }
    else
      return( bError );
  },

  // Delete
  DeleteDivAjax : function( fm, specialcase )
  {
    var sReturnPage = '';
    var itemcount = fm.elements['ItemCount'].value;
    if( itemcount > 1000 )
      alert( 'This delete may take several minutes, please wait.' ) ;

    // Because database deletes may take more than 10 seconds
    var params = Form.MakeGetURL( fm );
        params = NVP.Set( params, 'SpecialCase', specialcase );
    var a = new AJAX( { AbortInterval: false } );
    a.URL = URL.Page( 'AJAX', 'Cell', { cell: 'PreDelete', act: 'Delete', ctype: 'text/xml' } );
    a.Method = 'POST';
    a.OnComplete =
      function( oRequest, oData )
      {
        try
        {
          var obj = DomNodeToObject( oRequest.responseXML.documentElement );
          if( obj )
          {
            if( obj.error )
            {
              alert( obj.error );
              // re-enable the buttons
              Form.DisableFields( false, fm, [ 'submit', 'button' ] );
              var o = document.getElementById( oData );
              if( o && obj.html )
                o.innerHTML = obj.html;
            }
            else
            {
              PopUP.Destroy();

              sReturnPage = obj.returnpage;

              if( typeof( PreDeleteMboObject._func ) == 'function' )
              {
                sReturnPage = PreDeleteMboObject._func( PreDeleteMboObject._var );
                PreDeleteMboObject._var = null;
              }

              if( sReturnPage )
                location.replace( sReturnPage );
            }
          }
        }
        catch( e )
        {
          if( sReturnPage )
            location.assign( sReturnPage );
          else
            alert( oRequest.responseText );
        }
      };
    a.Params = params;
    a.Data = 'popupdiv';
    a.Busy = Busy.Run;
    a.Send();
  }
};

/*********************************************************/
// fCheck      = function to call check values and onsubmit
// fPre        = function to set values and submit
// displayname = the display name of the item
var PreUpdateMboObject =
{
  _prefunc: null,
  _displayname: null,

  // Check fields
  Check : function( fCheck, fPre, displayname )
  {
    var bOk = true;

    var re = new RegExp( /\(.+?\)/ );

    if( fCheck && !re.test( fCheck ) )
      fCheck += '()';

    if( fPre && !re.test( fPre ) )
      fPre += '()';

    PreUpdateMboObject._prefunc = fPre;
    PreUpdateMboObject._displayname = displayname;

    if( fCheck )
      bOk = eval( fCheck );

    if( bOk )
    {
      if( 0 && bCHGLOG )
        this.Prep();
      else
        PreUpdateMboObject.Pre();
    }
  },

  // Run their Pre function
  Pre:  function()
  {
    if( PreUpdateMboObject._prefunc )
      eval( PreUpdateMboObject._prefunc );
  },

  // Prep before checking Level2
  Prep : function()
  {
    var a = new AJAX();
    a.URL = URL.Page( 'AJAX', 'Cell', { cell: 'PreUpdate', act: 'Prep' } );
    a.Method = 'POST';
    a.OnComplete = PreUpdateMboObject.Level2;
    a.Busy = Busy.Run;
    a.Send();
  },

  // Level2 popup if ChgLogType = Prompt
  Level2 : function()
  {
    if( bCHGLOGPROMPT )
    {
      PopUP.Create(
        URL.Page( 'AJAX', 'Cell', { cell: 'PreUpdate', act: 'Level2', displayname: PreUpdateMboObject._displayname } ),
        'ChgLogReason',
        Busy.Run );
    }
    else
    {
      // Run their pre-update routine
      var bOk = true;
      PreUpdateMboObject.Pre();
    }
  },

  // Verify they entered a ChgLog Response if Level2
  Verify : function( fm )
  {
    var resp   = fm.ChgLogReason.value;
    var fields =
    [
      [ fm.ChgLogReason, '!empty', 'Reason' ],
      [ fm.UsrLoginID,   '!empty', 'LoginID' ],
      [ fm.UsrPassword,  '!empty', 'Password' ]
    ];
    var bError = Form.CheckFields( fields );
    var pass = CRC32STR( fm.UsrPassword.value, true );
    if( !bError )
    {
      if( fm.DBUsrLoginID.value == fm.UsrLoginID.value.toUpperCase() && fm.DBUsrPassword.value == pass )
      {
        fm.UsrPassword.value = pass;
        Form.DisableFields( true, fm, [ 'submit', 'button' ] );

        // make sure in session before save happens
        var a    = new AJAX();
        a.Async  = false;
        a.URL    = URL.Page( 'AJAX', 'Cell', { cell: 'PreUpdate', act: 'UpdateChgLog' } );
        a.Method = 'POST';
        a.Params = NVP.Set( '', 'ChgLogReason', resp );
        a.Busy   = Busy.Run;
        a.OnComplete = function( oRequest )
        { // NOTHING TO DO!!
        };
        a.Send();

        // Run their pre-update routine
        PreUpdateMboObject.Pre();

        // Done
        PopUP.Destroy();
      }
      else
      {
        alert( 'Incorrect LoginID or Password entered' );
        fm.UsrPassword.value = '';
        bError = 1;
        return( bError );
      }
    }
    else
      return( bError );
  }
};

/*********************************************************/
function doHref( url, grp, flg )
{
  var temp = ParseURL( url, grp );
  if( temp )
  {
    if( flg )
      document.location.href = temp;
    else
      Window.Open( temp, 'news', 'width=640,height=480,resizable=1,scrollbars=1,menubar=1,toolbar=1' );
  }
};

/*********************************************************/
Form.SetOnOff = function( btn, val )
{
  var oFound = FindObjects( btn, 'btn1,btn0' );
  if( oFound.btn0 == btn )
  {
    oFound.base.value = 0;
    oFound.btn0.className = "active";
    oFound.btn1.className = "inactive";
  }
  if( oFound.btn1 == btn )
  {
    oFound.base.value = 1;
    oFound.btn0.className = "inactive";
    oFound.btn1.className = "active";
  }
  if( val ) oFound.base.value = val;
};

Form.OpenTabByIndex = function ( idx, id )
{
  var tabs = GetElementsById( id );
  tabs[idx].onclick();
};

Form.OpenTab = function( btn, pFunc )
{
  var tabs = GetElementsById( btn.id );
  var sFormName = btn.id.substr( 0, btn.id.lastIndexOf( '_btns' ) );
  var nIndex = 0;

  for( var i = 0; i < tabs.length; i++ )
  {
    var div = document.getElementById( sFormName + "_tab_" + i );
    if( div )
    {
      if( tabs[i] != btn )
      {
        div.style.display = 'none';
        DropClass( tabs[i], 'tab1' );
        AddClass( tabs[i], 'tab0' );
      }
      else
      {
        nIndex = i;
        div.style.display = 'block';
        DropClass( tabs[i], 'tab0' );
        AddClass( tabs[i], 'tab1' );

        if (document[sFormName][sFormName + '_opentab']){
          document[sFormName][sFormName + '_opentab'].value = i;
        }
      }
    }
  }

  if( pFunc && typeof( pFunc ) == 'function' )
    pFunc( tabs, nIndex );
};

var MsgBox =
{
  // TYPE VALUES
  btnOk:                0,
  btnOkCancel:          1,
  btnAbortRetryIgnore:  2,
  btnYesNoCancel:       3,
  btnYesNo:             4,

  // RETURN VALUES
  rcOk:     1,
  rcCancel: 2,
  rcAbort:  3,
  rcRetry:  4,
  rcIgnore: 5,
  rcYes:    6,
  rcNo:     7,

  // TEXT VALUE
  sOk:     'Ok',
  sCancel: 'Cancel',
  sAbort:  'Abort',
  sRetry:  'Retry',
  sIgnore: 'Ignore',
  sYes:    'Yes',
  sNo:     'No',

  // HOLD RETURN VALUE TO TEXT
  btnList : [],

  // FUNCTION CALL ON RETURN
  _pReturnFunc : function() {},
  _pReturnParams : {},

  Open : function( msg, opts, pFunc, pParams )
  {
    opts = parseInt( opts ) || 0;

    if( typeof( pFunc ) == 'function' )
      this._pReturnFunc = pFunc;

    if( typeof( pParams ) != 'undefined' )
      this._pReturnParams = pParams;

    var oDiv = document.createElement( 'div' );
    oDiv.style.width = '380px';
    oDiv.style.backgroundColor = '#FFF';

    var oTxt = document.createElement( 'div' );
    oTxt.innerHTML = '<p style="text-align:center;">' + msg + '</p>';

    var oBtn = MsgBox.CreateButtonBar( opts );

    oDiv.appendChild( oTxt );
    oDiv.appendChild( oBtn );

    PopUP.Open( oDiv );

    // FOCUS FIRST BUTTON
    if( oBtn )
      oBtn.firstChild.focus();
  },

  Return : function( v )
  {
    PopUP.Destroy();
    MsgBox._pReturnFunc( v, MsgBox._pReturnParams );
  },

  CreateButton : function( btnV )
  {
    var oBtn = document.createElement( 'input' );
    if( !oBtn )
      return( false );

    oBtn.type = 'button';
    oBtn.style.minWidth = '75px';
    oBtn.style.margin = '0px 2px';
    oBtn.onclick = function()
    {
      MsgBox.Return( btnV[0] );
    };
    oBtn.value = btnV[1];
    return( oBtn );
  },

  CreateButtonBar : function( n )
  {
    if( !MsgBox.btnList.length )
    {
      MsgBox.btnList =
      [
        [ [ MsgBox.rcOk, MsgBox.sOk ] ],
        [ [ MsgBox.rcOk, MsgBox.sOk ], [ MsgBox.rcCancel, MsgBox.sCancel ] ],
        [ [ MsgBox.rcAbort, MsgBox.sAbort ], [ MsgBox.rcRetry, MsgBox.sRetry ], [ MsgBox.rcIgnore, MsgBox.sIgnore ] ],
        [ [ MsgBox.rcYes, MsgBox.sYes ], [ MsgBox.rcNo, MsgBox.sNo ], [ MsgBox.rcCancel, MsgBox.sCancel ] ],
        [ [ MsgBox.rcYes, MsgBox.sYes ], [ MsgBox.rcNo, MsgBox.sNo ] ]
      ];
    }

    var oDiv = document.createElement( 'div' );
    oDiv.style.textAlign = 'center';

    for( var i = 0; i < this.btnList[n].length; i++ )
      oDiv.appendChild( this.CreateButton( this.btnList[n][i] ) );

    return( oDiv );
  }
};

var SchemeImageList = {};

function SchemeImageURL( image, fromSite )
{
  fromSite = fromSite || false;

  var icon = image;
  if( /\./.test( icon ) ) icon = icon.substring( 0, icon.lastIndexOf( '.' ) );
  if( SchemeImageList[icon] )
  {
    return( SchemeImageList[icon] );
  }

  return( fromSite ? URL.Base( "site/images/scheme/" + image ) : URL.Base( "sys/images/scheme/" + image ) );
};

/*********************************************************/
function UpdateGroupMap( div, url )
{
  var a = new AJAX();
  a.URL = url;
  a.Method = "POST";
  a.OnComplete = function( xmlRequest, div )
  {
    var o = document.getElementById( div );
    if( o )
    {
      o.innerHTML = xmlRequest.responseText;
      setTimeout( "CBDiv.TestSize();", 500 );
    }
  };
  a.Data = div;
  a.Send();
};

/*********************************************************/
function PageGroupMap( url )
{
  var div = ComboBox.id + "_div";
  var a = new AJAX();
  a.URL = url;
  a.Method = "POST";
  a.OnComplete = function( xmlRequest, div )
  {
    var obj = DomNodeToObject( xmlRequest.responseXML.documentElement );
    var o = document.getElementById( div );
    if( o && obj )
    {
      o.innerHTML = obj.html;
      try
      {
        o.scrollTop = 0;
      }
      catch(e)
      {
      }

      setTimeout( "CBDiv.TestSize();", 500 );
      ComboBox.bShow = true;
    }
  };
  a.Data = div;
  a.Send();
};

function SortColumn( n )
{
  var frm = null;
  try
  {
    frm = window.opener.document.ReportForm;
  }
  catch( e )
  {
  }

  if( frm )
  {
    if( ( frm.sortcolumn.value == n ) && ( frm.sortorder.value == 1 ) )
      frm.sortorder.value = 2;
    else if( ( frm.sortcolumn.value == n ) && ( frm.sortorder.value == 2 ) )
      frm.sortorder.value = 1;
    else
    {
      frm.sortcolumn.value = n;
      frm.sortorder.value  = 1;
    }

    frm.submit();
  }
  else
  {
    if( Dialog.id )
    {
      var o = URL.Parse( Dialog.url );
      var nvp = NVP.ToObject( o.query );
      o[3] = NVP.Set( o.query, 'sortcolumn', n );
      o[3] = NVP.Set( o[3], 'sortorder', ( ( nvp.sortorder && ( nvp.sortcolumn == n ) && nvp.sortorder == 1 ) ? 2 : 1 ) );
      var sURL = URL.Build( o );

      Dialog.url = sURL;
      Dialog.GetContent();
    }
    else
    {
      var o = URL.Parse( window.location.href );
      var nvp = NVP.ToObject( o.query );
      o[3] = NVP.Set( o.query, 'sortcolumn', n );
      o[3] = NVP.Set( o[3], 'sortorder', ( ( nvp.sortorder && ( nvp.sortcolumn == n ) && nvp.sortorder == 1 ) ? 2 : 1 ) );
      var sURL = URL.Build( o );
      window.location.assign( sURL );
    }
  }

  return( false );
};

function search_field_check( fld )
{
  if( fld.value.length )
  {
    fld.classList.add( 'isactive' );
  }
  else
  {
    fld.classList.remove( 'isactive' );
  }
};

/********* LOAD VARIABLES AND SUBROUTINE *****************/

function Init()
{
  // Set Lang Str
  Dialog.img_close      = SchemeImageURL( "hdr_close.png" );
  Dialog.img_minimize   = SchemeImageURL( "hdr_min.png" );
  Dialog.img_resize     = SchemeImageURL( "resize.gif" );
  Dialog.img_screenbg   = SchemeImageURL( "screen.gif" );
};

Init();

/*
#########################################################
# Revision History
# init   date   rev-bld modifications
# ---- -------- ------- -------------------------------------
# kpc  08/02/11 501     Added DateFieldEditCheck
# kpc  08/08/11 501     Added Fix for scroll offset on Dialog Resize
# kjh  08/30/11 501-096 Changed Window.Help, removed bkmk
# kpc  02/13/12 502-073 Fixed ParseURL to handle urls with different protocols
# kpc  04/27/12 502-123 #83 modified UnlinkDoc to set the span back to noneselected (default text in buildfield);
# rlr  08/21/12 502-153 #1266 Added error handling for Cell::Files. Returns error on zero byte file.
# rlr  01/16/13 503-184 #2357&&2715 Fixed fade on info box for IE10
# rlr  07/25/13 503     #3689 Fixed IE10 check for alpha property
# mrl  13/02/20 1152    icons where not loading properly
*/

var Page = ( function( $ )
{
	"use strict";

	$.Help = function( pg, cmd )
	{
		var url_pagehelp = URL.Page( 'Help', 'Default', { 'page' : pg, 'command' : cmd } );
		Window.Open( url_pagehelp, 'HELP', { 'width' : ( parseInt( dsp_tbl_width ) + 50 ), 'height' : 500 });
	};

	return $;
})( {} );Field_File =
{
  _instances : {},
  _sent : '',

  /* CONTROL ATTRIBUTES
  FileName
  FileDestination - WHERE IS IT GOING
  FileLocation    - WHERE IS IT NOW
  Status (UPLOAD:UNLINK:NEUTRAL)
  */

  /*-------------------------------------------------------
    Initialize:
  ---------------------------------------------------------
  -------------------------------------------------------*/
  Initialize : function( fld )
  {
    var inst = fld.id.substr( 0, fld.id.lastIndexOf( '_' ) );

    if( !Field_File._instances[inst] )
    {
      Field_File._instances[inst] = {};
    }

    var container = document.getElementById( inst + '_container' );
    Field_File._instances[inst]['container'] = container;
    var controls = Field_File.GetControls( container );
    if( controls['upl'] )
    {
      var rect = GetAbsolutePosition( controls['upl'] );
      controls['upl'].style.height = rect.height + 'px';
      controls['upl'].style.width = rect.width + 'px';
    }
  },

  /*-------------------------------------------------------
    Click
  ---------------------------------------------------------
  elem - document element.  This is either an image, form
  field, span, etc.  This function passes the click event
  to the file field.
  -------------------------------------------------------*/
  Click : function( elem )
  {
    Field_File.Initialize( elem );
    var inst = elem.id.substr( 0, elem.id.lastIndexOf( '_' ) );
    var controls = Field_File.GetControls( Field_File.GetInstance(inst)['container'] );
    controls['base'].click();
  },

  /*-------------------------------------------------------
    MoveUploader
  ---------------------------------------------------------
  elem - document element.  This is either an image, form
  field, span, etc.  This function moves the File field on
  top of the element
  -------------------------------------------------------*/
  MoveUploader : function( elem )
  {
    Field_File.Initialize( elem );
    var inst = elem.id.substr( 0, elem.id.lastIndexOf( '_' ) );
    var controls = Field_File.GetControls( Field_File.GetInstance(inst)['container'] );

    var rect = GetAbsolutePosition( elem );
    if( controls['base'] )
    {
      controls['base'].style.position = 'absolute';
      controls['base'].style.top = ( rect.top - 3 ) + 'px';
      controls['base'].style.left = ( rect.left - 3 ) + 'px';
      controls['base'].style.width = ( rect.width + 6 ) + 'px';
      controls['base'].style.height = ( rect.height + 6 ) + 'px';
    }
  },

  /*-------------------------------------------------------
    RebuildUploader
  ---------------------------------------------------------
  inst - the instance id for the field
  -------------------------------------------------------*/
  RebuildUploader : function( inst )
  {
    var controls = Field_File.GetControls( Field_File.GetInstance(inst)['container'] );
    if( controls['base'] )
    {
      var new_file = document.createElement( 'INPUT' );
          new_file.type     = controls['base'].type;
          new_file.name     = controls['base'].name;
          new_file.id       = controls['base'].id;
          new_file.form     = controls['base'].form;
          new_file.style    = controls['base'].style;
          new_file.onchange = controls['base'].onchange;
          new_file.accept   = controls['base'].accept;
          new_file.title    = controls['base'].title;
      var container = controls['base'].parentNode;
      container.insertBefore( new_file, controls['base'] );
      container.removeChild( controls['base'] );
      controls['base'] = new_file;
    }
  },

	/*-------------------------------------------------------
	 * SendFile:
	 * ------------------------------------------------------
	 * filefield - This is the file field object on the page.
	 * -----------------------------------------------------*/
	SendFile : function( filefield )
	{
		var inst = filefield.id;
		var params = Field_File.GetInstance( inst );
			params['ctype']     = 'text/xml';
			params['cell']      = 'FieldFileUpload';
			params['action']    = 'Show';
			params['field']     = filefield.name;
			params['instance']  = inst;

		var form_opts =
		{
			'form': filefield.form,
			'url':  URL.Page( 'AJAX', 'Cell', params ),
			'OnComplete': Field_File.OnComplete,
			'OnProgress': Field_File.OnProgress
		};

		Form.Send( form_opts );

		Field_File._sent = inst;

		Field_File.OnStart( inst );
  },

	/*-------------------------------------------------------
	CropAction: opens the crop dialog triggered by the crop button
	---------------------------------------------------------
	* inst - control id
  * src - url of the image to be cropped
	-------------------------------------------------------*/
  CropAction : function(inst, url)
  {
    var params = Field_File.GetInstance( inst );
			params['ctype']     = 'text/xml';
			params['cell']      = 'FieldFileUpload';
			params['action']    = 'PrepareCrop';
      params['instance']  = inst;
    if(params['location']){
      var data = {};
      data['response'] = {
        path: params['location'],
        instance:inst
      };
      Field_File.OnComplete(data, false);
      return;
    }
    var a = new AJAX();
    a.Method = 'POST';
    a.URL = URL.Page( 'AJAX', 'Cell', params ),
    a.Params = NVP.ToString({'location':url});
    a.OnComplete = function( oRequest, oData )
    {
      var obj = AjaxXMLResponse( oRequest, oData + '_body' );
      var data = {};
      data['response'] = obj;
      Field_File.OnComplete(data, false);
    };
    a.Send();
  },

	/*-------------------------------------------------------
	OnChange:
	---------------------------------------------------------
	filefield - This is the file field object on the page.
	If the field is set to Auto-Post, the form will be
	posted with the field instance data in the form action GET
	-------------------------------------------------------*/
	OnChange : function( filefield )
	{
    var inst = filefield.id;
    
    var objInstance = Field_File.GetInstance(inst);

    var error = Field_File.CheckFileType( objInstance );

		if( error )
		{
		  alert( error );
		  var controls = Field_File.GetControls( objInstance['container'] );
		  controls['base'].value = '';
		  return;
    }

		if( objInstance['autopost'] && filefield.value )
		{      
		  Field_File.SendFile( filefield );
		}
		else
		{
      var controls = Field_File.GetControls( objInstance['container'] );
      
			controls['upload'].value = Field_File.ParseFilePath( filefield.value )['name'];

      controls['unlink'].value = 0;
      Field_File.UpdateControl( objInstance);
		}

		if( objInstance['onchange'] )
		{
		  if( objInstance['onchange'].indexOf( '(' ) > 1 )
			  eval( Field_File.GetInstance(inst)['onchange'] );
		  else
			  eval( Field_File.GetInstance(inst)['onchange'] + '();' );
		}
	},

	OnStart : function( inst )
	{
		Busy.Run( true );

    var controls = Field_File.GetControls( Field_File.GetInstance(inst)['container'] );
    $crop = (Field_File.GetInstance(inst)['Crop'])? Field_File.GetInstance(inst)['Crop'] : 0;
    // do not show loading animation over the name field when using crop
		if( controls['nam'] && !$crop )
		{
		  controls['nam'].style.backgroundColor = Field_File.GetInstance(inst)['loading_bg_color'];
		  controls['nam'].style.color           = Field_File.GetInstance(inst)['loading_txt_color'];
		  controls['nam'].innerHTML             = Field_File.GetInstance(inst)['loading_txt'];
		}

		if( controls['img'] && !$crop)
		{
		  controls['img'].src = gbl_img_busy;
		}

		if( controls['upl'] && ( !controls['nam'] && !controls['img'] ) )
		{
		  controls['upl'].title = controls['upl'].src;
		  controls['upl'].src = gbl_img_busy;
		}
	},

	OnComplete : function( data, skipCrop )
	{
    var inst = data['response']['instance'];
    var canCrop = Field_File.GetInstance(inst)['Crop'];
    Busy.Run();
    if( data['response']['error'] )
		{
      alert( 'ERROR: ' + data['response']['error'] );
      Busy.Run();
			return;
		}
    Field_File.RebuildUploader(inst);
    if(canCrop && !skipCrop){
      Field_File.showCropDialog(inst, data['response']['path']);
      return;
    }
		Field_File.GetInstance(inst)['location'] = data['response']['path'];

		var controls = Field_File.GetControls( Field_File.GetInstance(inst)['container'] );

    controls['upload'].value = Field_File.ParseFilePath( data['response']['path'] )['name'];


		controls['unlink'].value = 0;

		if( controls['nam'] )
		{
		  controls['nam'].style.backgroundColor = '';
		  controls['nam'].style.color = '';
		}

		if( controls['upl'] )
		{
		  if( controls['upl'].src == gbl_img_busy )
		  {
			controls['upl'].src = controls['upl'].title;
		  }
		}

		Field_File.UpdateControl( Field_File.GetInstance(inst) );

		if( Field_File.GetInstance(inst)['oncomplete'] )
		{
		  if( Field_File.GetInstance(inst)['oncomplete'].indexOf( '(' ) > 1 )
			eval( Field_File.GetInstance(inst)['oncomplete'] );
		  else
			eval( Field_File.GetInstance(inst)['oncomplete'] + '("' + inst + '","' + controls['upload'].value + '");' );
    }
    Field_File.showDeleteButton(inst);
	},

  /*-------------------------------------------------------
    OnProgress
  ---------------------------------------------------------
  data -
  -------------------------------------------------------*/
  OnProgess : function( data )
  {
    //alert( 'onprogress:' + data );
  },

  /*-------------------------------------------------------
    OnRequestDelete:
  ---------------------------------------------------------
  -------------------------------------------------------*/
  OnRequestDelete : function( inst, defaultImage )
  {
    Field_File.GetInstance(inst)['location'] = '';
    var controls = Field_File.GetControls( Field_File.GetInstance(inst)['container'] );
    if(controls['unlink'])
      controls['unlink'].value = 1;
    else
      document.getElementById(inst+'_unlink').value = 1;
    controls['upload'].value = '';
    controls['base'].value = '';

	if( controls['nam'] )
    {
      if( controls['nam'].form ) controls['nam'].value = '';
      else controls['nam'].innerHTML = controls['nam'].getAttribute('data-empty-text');
    }

	if( controls['img'] )
		controls['img'].src = defaultImage;

	Field_File.hideCropButton(inst);
  },

  /*-------------------------------------------------------
    ClearField:
  ---------------------------------------------------------
  -------------------------------------------------------*/
  ClearField : function( inst )
  {
    var controls = Field_File.GetControls( Field_File.GetInstance(inst)['container'] );
    controls['unlink'].value = 0;
    controls['upload'].value = '';
    controls['base'].value = '';
    if( controls['nam'] )
    {
      if( controls['nam'].form ) controls['nam'].value = '';
      else controls['nam'].innerHTML = '';
    }
  },

  /*-------------------------------------------------------
    OnRequestDownload
  ---------------------------------------------------------
  -------------------------------------------------------*/
  OnRequestDownload : function( inst )
  {
    var loc = Field_File.GetInstance(inst)['location'];
    if( loc )
    {
      Window.Open( loc, '_file', {} );
    }
  },

	GetInstance : function( inst )
	{
		if( !Field_File._instances[inst] || !Field_File._instances[inst]['container'] || !Field_File._instances[inst]['location'] )
		{
			Field_File.Initialize( document.getElementById( inst + '_upl' ) );
		}

		return Field_File._instances[inst];
	},

	GetControls : function( src )
	{
		var controls = FindObjects( src, 'img,aud,upload,unlink,upl,dln,rem,nam,list,container' );

		/* CONTROLS
		   base   = File Field
		   img    = Image Stamp
		   aud    = Audio Player
		   status = Hidden Status Field
		   upl    = Upload Button
		   dnl    = Download Button
		   rem    = Remove File Button
		   name   = File Name
		*/

		return controls;
	},

  /*-------------------------------------------------------
    UpdateControl
  ---------------------------------------------------------
  -------------------------------------------------------*/
  UpdateControl : function( instance )
  {
    var controls = Field_File.GetControls( instance['container'] );

    var blankimg = '';
    var blankaud = '';

    if( controls['img'] )
    {
      controls['img'].src = ( instance['location'] ) ? instance['location']+'?t='+new Date().getTime() : blankimg;
    }
    if( controls['aud'] ) controls['aud'].src = ( instance['location'] ) ? instance['location'] : blankaud;
    if( controls['dln'] ) controls['dln'].style['display'] = ( instance['location'] ) ? 'inline' : 'none';
    if( controls['nam'] )
    {
    var filename = (controls['upload'].value) ? controls['upload'].value :  document.getElementsByName(instance['name'])[0].value;
		if( controls['nam'].form )
			controls['nam'].value = filename;
		else
			controls['nam'].innerHTML = filename;

		Field_File.Initialize( controls['upl'] );
    }
    controls['status'] = instance['status'];
  },

	ParseFilePath : function( path )
	{
    path = path.replace( /\\/g, '/' );
    //remove additional arguments before the file name
    parts = path.split('?');
    path = parts[0];


		var file = new Object();

		var parts = path.split( '/' );
			file['name'] = Format.FileName( parts.pop() );
			file['path'] = parts.join( '/' );
			file['ext']  = file['name'].substr( ( file['name'].lastIndexOf( '.' ) + 1 ) ).toUpperCase();

		return file;
	},

  /*-------------------------------------------------------
    DropFileFromList
  ---------------------------------------------------------
  -------------------------------------------------------*/
  DropFileFromList : function( inst, fileid )
  {
    var params = NVP.Set( '', 'cell', 'Files' );
        params = NVP.Set( params, 'action', 'Remove' );
        params = NVP.Set( params, 'ctype', 'text/xml' );
        params = NVP.Set( params, 'FILEID', fileid );
        params = NVP.Set( params, 'ID', Field_File.GetInstance(inst)['id'] );
    var processbar = document.getElementById( inst + '_process' );
    if( processbar ) processbar.style['display'] = 'inline';
    var a = new AJAX();
    a.Method = 'POST';
    a.URL    = URL.Page( 'AJAX', 'Cell' );
    a.Params = params;
    a.OnComplete = function( oRequest, oData )
    {
      var obj = false;
      try
      {
        obj = DomNodeToObject( oRequest.responseXML );
      }
      catch ( error )
      {
        alert( oRequest.responseText );
      }
      if( obj.root ) obj = obj.root;
      if( parseInt( obj.success ) )
      {
        var list = document.getElementById( oData + '_list' );
        if( !list ) return;
        var items = list.getElementsByTagName( 'li' );
        for( var i = 0; i < items.length; i++ )
        {
          if( items[i].id == ( 'cell_files_item_' + obj.fileid ) )
          {
            list.removeChild( items[i] );
          }
        }
      }
      else
      {
        if( obj.message ) alert( obj.message );
      }
      var processbar = document.getElementById( oData + '_process' );
      if( processbar ) processbar.style['display'] = 'none';
    };
    a.Data = inst;
    a.Send();
  },

  /*-------------------------------------------------------
    AddFileToList
  ---------------------------------------------------------
  -------------------------------------------------------*/
  AddFileToList : function( inst, filename )
  {
    var params = NVP.Set( '', 'cell', 'Files' );
        params = NVP.Set( params, 'action', 'Add' );
        params = NVP.Set( params, 'ctype', 'text/xml' );
        params = NVP.Set( params, 'FileName', filename );
        params = NVP.Set( params, 'ID', Field_File.GetInstance(inst)['id'] );
    var processbar = document.getElementById( inst + '_process' );
    if( processbar ) processbar.style['display'] = 'block';
    else alert( inst + '_process' );
    var a = new AJAX();
    a.Method = 'POST';
    a.URL    = URL.Page( 'AJAX', 'Cell' );
    a.Params = params;
    a.OnComplete = function( oRequest, oData )
    {
      var obj = false;
      var processbar = document.getElementById( oData + '_process' );
      try
      {
        obj = DomNodeToObject( oRequest.responseXML );
      }
      catch ( error )
      {
        alert( oRequest.responseText );
      }
      if( obj.root ) obj = obj.root;
      if( parseInt( obj.success ) )
      {
        var list = document.getElementById( oData + '_list' );
        if( !list ) return;
        var filepath = Field_File.GetInstance( oData )['location'];
        var li = document.createElement( 'LI' );
            li.id        = 'cell_files_item_' + obj.fileid;
        var link = document.createElement( 'A' );
            link.href = filepath;
            link.target = '_new';
            link.innerHTML = filename;
        var del = document.createElement( 'IMG' );
            del.src             = URL.Base( 'sys/images/scheme/delete.gif' );
            del.onclick         = function(){ Field_File.DropFileFromList( oData, obj.fileid ); };
            del.style['float']  = 'right';
        li.appendChild( link );
        li.appendChild( del );
        list.insertBefore( li, processbar );
        //list.appendChild( li );
      }
      else
      {
        if( obj.message ) alert( obj.message );
      }
    if( processbar ) processbar.style['display'] = 'none';
    };
    a.Data = inst;
    a.Send();
  },

	CheckFileType : function( instance )
	{
		var controls = Field_File.GetControls( instance['container'] );

		var ext = Field_File.ParseFilePath( controls['base'].value )['ext'];

		var exttype = ( instance['filetype'] ) ? instance['filetype'].toLowerCase() : false;

		if( !exttype && ext.search( /exe/i ) > -1 )
		{
		  var bad = /exe/i;

		  if( !bad.test( ext ) )
			  return gbl_msg_fileexterr;
		}

		var pattern = null;
		var error = '452';

		switch( exttype )
		{
		  case 'anything' :
			return( 0 );
			break;

		  case 'multimedia' :
			pattern = /gif|jpg|jpeg|png|bmp|swf|mov|mpeg|avi|wmv|mp4/i;
			error = ParamString( gbl_msg_fileexterrus, '.gif, .jpg, .jpeg, .png, .bmp, .swf, .mov, .mpeg, .avi, .wmv, .mp4' );
			break;

		  case 'image' :
			pattern = /gif|jpg|jpeg|png|bmp/i;
			error = ParamString( gbl_msg_fileexterrus, '.gif, .jpg, .jpeg, .png, .bmp' );
			break;

		  case 'gif' :
			pattern = /gif/i;
			error = ParamString( gbl_msg_fileexterrus, '.gif' );
			break;

		  case 'audio' :
			pattern = /mp3|mp4|m4a/i;
			error = ParamString( gbl_msg_fileexterrus, '.mp3, .mp4, .m4a' );
			break;

		  case 'music' :
			pattern = /midi|mid/i;
			error = ParamString( gbl_msg_fileexterrus, '.midi, .mid' );
			break;

		  case 'compressed' :
			pattern = /zip|tar|gz/i;
			error = ParamString( gbl_msg_fileexterrus, '.zip, .tar, .gz' );
			break;

		  case 'scorm' :
			pattern = /zip/i;
			error = ParamString( gbl_msg_fileexterrus, '.zip' );
			break;

		  case 'records' :
			pattern = /txt|csv/i;
			error = ParamString( gbl_msg_fileexterrus, '.txt, .csv' );
			break;

		  case 'terms' :
			pattern = /t3/i;
			error = ParamString( gbl_msg_fileexterrus, '.t3' );
			break;

		  case 'question' :
			pattern = /qst|txt/i;
			error = ParamString( gbl_msg_fileexterrus, '.qst, .txt' );
			break;
		}

		if( pattern && !pattern.test( ext ) )
			return( error );

		return 0;
  },
  /*-------------------------------------------------------
	 * showCropDialog: shows the crop dialog
	 * ------------------------------------------------------
	 * inst - control id
   * src - url of the image to be cropped
	 * -----------------------------------------------------*/
  showCropDialog:function(inst, src)
  {
    var openurl = URL.Page( 'AJAX', 'Cell', { cell    : 'FieldFileUpload',
                                              action     : 'ShowCropDialog',
                                              ctype   : 'text/xml',
                                              instance : inst,
                                              src : src
                                            });

    Dialog.Init({ width       : 500,
      height      : 570,
      left        : 0,
      scrolling   : 1,
      top         : 0,
      fitcontent  : 1,
      status      : '',
      url         : openurl});
  },
  initCropper: function(inst){
    var image = document.getElementById( inst+'_cropper' );
		_cropper = new Cropper( image, {rotatable:true, aspectRatio: 1} );
  },
  rotate: function(angle){
    _cropper.rotate(angle);
  },

  /*-------------------------------------------------------
	 * crop: sends information to backend to crop the image
	 * ------------------------------------------------------
	 * inst - control id
   * dialogId - cropper dialog id
	 * -----------------------------------------------------*/
	crop : function( inst, dialogId )
	{
    var params = Field_File.GetInstance( inst );
			params['ctype']     = 'text/xml';
			params['cell']      = 'FieldFileUpload';
			params['action']    = 'Crop';
      params['instance']  = inst;
      //params['location'] = document.getElementById( inst+'_cropper' ).src
    var a = new AJAX();
    a.Method = 'POST';
    a.URL = URL.Page( 'AJAX', 'Cell', params ),
    obj3 = _cropper.getData( true );
    obj3.location = decodeURIComponent(document.getElementById( inst+'_cropper' ).src);
    a.Params = NVP.ToString(  obj3 );
    //a.Params['location'] = document.getElementById( inst+'_cropper' ).src;
    a.OnComplete = function( oRequest, oData )
    {
      var obj = AjaxXMLResponse( oRequest, oData + '_body' );
      var data = {};
      data['response'] = obj;
      Field_File.OnComplete(data, true);
      Busy.Run();
      //show crop and delete buttons after a successful upload
      Field_File.showCropButton(inst);
      Field_File.showDeleteButton(inst);
    };
    //close dialog and show loader
    Dialog.Close(dialogId);
    Busy.Run(true);
    //send image to crop
    a.Send();
  },
  showCropButton : function(inst){
    if(document.getElementById(inst+'_crop_button'))
      document.getElementById(inst+'_crop_button').style.display = '';
  },
  hideCropButton : function(inst){
    if(document.getElementById(inst+'_crop_button'))
      document.getElementById(inst+'_crop_button').style.display = 'none';
  },
  showDeleteButton : function(inst){
    if(document.getElementById(inst+'_rem'))
      document.getElementById(inst+'_rem').style.display = '';
  },
  hideDeleteButton : function(inst){
    if(document.getElementById(inst+'_rem'))
      document.getElementById(inst+'_rem').style.display = 'none';
  },
};
var Field_Group = ( function( $ )
{
	var _sLoadingText = '';

	var bUpdating = false;

	$.field_groups = {};

	// Creates hash of ids to titles
	$.AddGroup = function( grpid, grptitle )
	{
		$.field_groups[grpid] = grptitle;
	};

	// Opens dialog box to show group selector
	$.Open = function( prms )
	{
		var fld = document.getElementById( prms['FIELD'] );
		prms['GRPID']   = ( fld ) ? fld.value : 0;
		prms['cell']    = 'FieldGroup';
		prms['ctype']   = 'text/xml';
		prms['action']  = 'Show';
		
		var page_url = URL.Page( 'AJAX', 'Cell', prms );

		Dialog.Init( {
			title       : '',
			url         : page_url,
			width       : '600',
			height      : '500',
			status      : '',
			resize      : 1,
			scrolling   : 1,
			fitcontent  : 1 } );
	};

	$.Expand = function( evt, grpid, all )
	{
		evt = Event.Get( evt );

		var fld = $.GetField( evt.target.id );
		var div = document.getElementById( fld['base'] + '_sub_' + grpid );
		var div_e = document.getElementById( fld['base'] + '_e_' + grpid );
		var div_c = document.getElementById( fld['base'] + '_c_' + grpid );

		if( !div )
			return;

		if( div_e.getAttribute( 'expanded' ) )
		{
			DropClass( div, 'hidden' );
			AddClass( div_e, 'hidden' );
			DropClass( div_c, 'hidden' );
			return;
		}

		var a = new AJAX();
		a.URL = URL.Page( 'AJAX', 'Cell', { cell : 'FieldGroup', action : ( ( all ) ? 'ExpandAll' : 'Expand' ), ctype : 'text/xml', GrpID : grpid } );
		a.Method = 'POST';
		a.Data = div;
		a.Params = Form.MakeGetURL( fld['form'] );
		a.OnComplete = function( oRequest, oDiv )
		{
			var obj = {};

			try
			{
				obj = DomNodeToObject( oRequest.responseXML );
			}
			catch( e )
			{
				alert( oRequest.responseText );
			}

			if( obj )
			{
				if( obj.root )
					obj = obj.root;

				if( oDiv )
				{
					DropClass( oDiv, 'hidden' );
					oDiv.innerHTML = obj.html;
				}

				div_e.setAttribute( 'expanded', 1 );
				AddClass( div_e, 'hidden' );
				DropClass( div_c, 'hidden' );

				if( obj.groups )
				{
					var grpids = obj.groups.split( ',' );
					for ( var i = 0; i < grpids.length; i++ )
					{
						$.field_groups[grpids[i]] = obj.group_data['grp' + grpids[i]];
					}
				}

				if( obj.jscript )
				{
					eval( obj.jscript );
				}
			}
		};
		a.Send();

		evt.Cancel();
	};

	$.Collapse = function( evt, grpid )
	{
		evt = Event.Get( evt );

		var fld = $.GetField( evt.target.id );

		var div = document.getElementById( fld['base'] + '_sub_' + grpid );
		AddClass( div, 'hidden' );

		var div_e = document.getElementById( fld['base'] + '_e_' + grpid );
		var div_c = document.getElementById( fld['base'] + '_c_' + grpid );
		DropClass( div_e, 'hidden' );
		AddClass( div_c, 'hidden' );

		evt.Cancel();
	};

	$.SelectGroup = function( elem, grpid )
	{
		var fld = $.GetField( elem.id );

		if( fld['form'] )
		{
			var grptitle = ( typeof( $.field_groups[grpid] ) == 'object' ) ? $.field_groups[grpid].grptitle : $.field_groups[grpid];
			
			if( fld['btn'] )
				fld['btn'].value = grptitle;

			if( fld['txt'] )
				fld['txt'].innerHTML = grptitle.replace( /\\/g, '' );

			//if( fld['lnk'] ) fld['lnk'].innerHTML = grptitle;

			if( fld['fld'] )
			{
				fld['fld'].value = grpid;
				if( fld['fld'].onchange )
				{
					fld['fld'].onchange();
				}
			}
			
			if( fld['cmb'] )
			{
				var bolFound = false;
				
				for ( var intIndex = 0, intLen = fld['cmb'].options.length; intIndex < intLen; intIndex++ ) 
				{
					opt = fld['cmb'].options[intIndex];
					if ( opt.value == grpid ) {
						opt.selected = true;
						bolFound = true;
						break;
					}
				}
				
				if( !bolFound )
				{
					var option = document.createElement("option");
					option.selected = 'selected';
					option.text = grptitle.replace( /\\/g, '' );
					option.value = grpid;
					option.setAttribute( 'data-other', 1 );
					fld['cmb'].add( option, fld['cmb'].options.length -1 );
				}

				if( fld['cmb'].onchange )
				{
					fld['cmb'].onchange();
				}
			}

			if( fld['form']['SELECT'] )
			{
				eval( fld['form']['SELECT'].value + "( grpid, grptitle, fld['form'].name );" );
			}

			if( fld['form']['AUTOCLOSE'].value == 1 )
			{
				if( fld['win'] )
					Dialog.Close( fld['win'] );
			}	
			
		}
	};

	$.GetField = function( id )
	{
		var parts = id.split( '_' );
		var base  = parts[0] + '_' + parts[1] + '_';

//		if( parts[2] )
//			base += '_' + parts[2];

		var obj = {};
		obj['base'] = base;
		obj['form'] = document['field_group_' + base + '_form'];

		if( obj['form'] )
		{
		  obj['fld'] = document.getElementById( obj['form'].FIELD.value );
		  obj['lnk'] = document.getElementById( obj['form'].FIELD.value + '_lnk' );
		  obj['txt'] = document.getElementById( obj['form'].FIELD.value + '_txt' );
		  obj['btn'] = document.getElementById( obj['form'].FIELD.value + '_btn' );
		  obj['win'] = obj['form'].window_id.value;
		  obj['cmb'] = document.getElementById(parts[0]);
		}
		else
		{
		}

		return obj;
	};

	$.Search = function( evt )
	{
		var fld = '';

		if( typeof( evt ) == 'string' )
		{
			fld = $.GetField( evt );
		}
		else
		{
			evt = Event.Get( evt );
			evt.Cancel();

			fld = $.GetField( evt.target.id );
		}

		fld['form'].OFFSET.value = 0;

		Dialog.PostForm( fld['form'].window_id.value, fld['form'].name );
	};

	$.Init = function( sFormName, json, sLoadingText )
	{
		if( sLoadingText )
			_sLoadingText = sLoadingText;

		if( json )
		{
			for( var key in json )
			{
				if( parseInt( key ).toString().length )
				{
					$.AddGroup( key, json[key] );
				}
			}
		}

		if( !sFormName )
			return;

		var elem = document.getElementsByClassName( 'dialog_win' );
		if( elem[0] )
		{
			var oBody = document.getElementById( 'field_group_body' );

			if( oBody )
			{
				oBody.addEventListener( "scroll", function() {

					if( bUpdating )
					{
						return;
					}

					if( oBody.offsetHeight + oBody.scrollTop + 300 >= oBody.scrollHeight )
					{
						if( document.forms[sFormName].PREV_OFFSET.value == document.forms[sFormName].OFFSET.value )
							return;

						bUpdating = true;

						var oLoadingDiv = null;

						var a = new AJAX();
						a.Method = 'POST';
						a.URL = URL.Page( 'AJAX', 'Cell', { cell: 'FieldGroup', action: 'UpdateScroll', ctype: 'text/xml' } );
						a.Busy = function( b )
						{
							if( b )
							{
								var d = document.createElement( 'div' );
								d.classList.add( 'fld-grp-loading' );
								d.innerHTML = _sLoadingText;
								oLoadingDiv = oBody.appendChild( d );
							}
							else
								oBody.removeChild( oLoadingDiv );
						};
						a.Params = Form.MakeGetURL( document.forms[sFormName] );
						a.OnComplete = function( oRequest )
						{
							bUpdating = false;

							var obj;

							try
							{
								obj = DomNodeToObject( oRequest.responseXML );
							}
							catch( e )
							{
								return;
								alert( oRequest.responseText );
							}

							if( obj.root )
							{
								obj = obj.root;
								oBody.innerHTML += obj.html;

								document.forms[sFormName].PREV_OFFSET.value = document.forms[sFormName].OFFSET.value;
								document.forms[sFormName].OFFSET.value = parseInt( obj.offset );
							}

							if( obj.jscript )
							{
								eval( obj.jscript );
							}
						};
						a.Send();
					}
				}, true );
			}
		}
	};

	return $;
})( {} );
function FileTransfer( sJSName, oSWF )
{
  // defaults
/*
  Debug      = 0;
  URL        = "";
  OnSelect   = "";
  OnCancel   = "";
  OnOpen     = "";
  OnProgress = "";
  OnOverallProgress  = "";
  OnComplete         = "";
  OnOverallComplete  = "";
  OnError    = "";
  MaxSize    = 80 * 1024 * 1024;
  AutoUpload = true;
  MaxThreads = 2;
  FileMask   = [];
  MultiFile  = 0;
  JSName     = '';
*/

  // javascript variable name of the field name
  this.JSName     = sJSName;

  if( typeof( this.JSName ) != "string" || this.JSName.length == 0 )
  {
    var dt = new Date();
    this.JSName = "ft_" + dt.getTime();
  }

  // id/name of SWF or Object
  this.SWF = oSWF;

  this.GetApp = function()
  {
    try
    {
      if( typeof( this.SWF ) == "string" )
        return( ( document[this.SWF] ) ? document[this.SWF] : window[this.SWF] );
      else
        return( this.SWF );
    }
    catch( e )
    {
      this.Alert( e );
      return( null );
    }
  };

  this.Alert = function( s )
  {
    if( this.Debug )
      alert( this.JSName + ": " + s.message );
  };

  this.Browse = function( aFilter, bList )
  {
    try
    {
      //this.SetAll();
      //this.GetApp().App_Browse( aFilter, bList );
      alert( "Function not implemented!" );
    }
    catch( e )
    {
      this.Alert( e );
    }
  };

  this.Cancel = function()
  {
    try
    {
      this.SetAll();
      this.GetApp().App_Cancel();
    }
    catch( e )
    {
      this.Alert( e );
    }
  };

  this.Upload = function( sURL, n )
  {
    try
    {
      this.SetAll();
      this.GetApp().App_Upload( sURL, n );
    }
    catch( e )
    {
      this.Alert( e );
    }
  };

  this.Download = function( sURL, sName )
  {
    try
    {
      this.SetAll();
      this.GetApp().App_Download( sURL, sName );
    }
    catch( e )
    {
      this.Alert( e );
    }
  };

  this.GetFile = function( f )
  {
    try
    {
      return( this.GetApp().App_GetFile( f ) );
    }
    catch( e )
    {
      this.Alert( e );
    }
  };

  this.GetFileCount = function()
  {
    try
    {
      return( this.GetApp().App_GetFileCount() );
    }
    catch( e )
    {
      this.Alert( e );
    }
  };

  this.Get = function( p )
  {
    try
    {
      return( this.GetApp().App_Get( p ) );
    }
    catch( e )
    {
      this.Alert( e );
    }
  };

  this.Set = function( p, v )
  {
    try
    {
      this.GetApp().App_Set( p, v );
    }
    catch( e )
    {
      this.Alert( e );
    }
  };

  this.SetAll = function()
  {
    for( p in this )
    {
      if( p.charAt(0) == '_' )
        continue;

      switch( typeof( this[p] ) )
      {
        case 'function':
          if( p.substr( 0, 2 ) == "On" )
          {
            this.Set( p, "window.FileTransfer." + this.JSName + "." + p );
          }
          break;

        case 'boolean':
          this.Set( p, ( this[p] ) ? 1 : 0 );
          break;

        case 'string':
        case 'number':
        case 'object':
        default:
          this.Set( p, this[p] );
          break;
      }
    }
  };

  this.Clear = function()
  {
    try
    {
      this.GetApp().App_Clear();
    }
    catch( e )
    {
      this.Alert( e );
    }
  };

  this.OnError = function( o )
  {
    var msg = o.source + " -- " + o.extra;
    switch( o.source )
    {
      case "oListener.onHTTPError":
        switch( o.extra )
        {
          case 421: msg = "Invalid or missing data"; break;
          case 422: msg = "Database Error"; break;
          case 451: msg = "Must be logged in"; break;
          case 452: msg = "Unable to save file"; break;
          case 453: msg = "Unable to resize image"; break;
          case 454: msg = "Unsupported image type"; break;
          case 455: msg = "Could not create image"; break;
          case 456: msg = "Wrong image size uploaded"; break;
          case 460: msg = "Unsupported audio file"; break;
          case 461: msg = "Unsupported mime type"; break;
          case 499: // file too large
            msg = ParamString( "#0# is too large (#1#). Maximum size allowed is #2#.",
              o.file.name, Format.Size( o.file.size ), Format.Size( o.file.MaxSize ) );
            break;
        }
        break;

      case "oListener.onIOError":
        msg = "Network Connection error, please try again.";
        break;

      default:
        break;
    }

    this.OnComplete( o.file, msg );
  };

  this.OnSelect = function( o )
  {
    if( this.Options.onselect )
      eval( this.Options.onselect + "( this, o )" );
  };

  this.OnCancel = function( o )
  {
    if( this.Options.oncancel )
      eval( this.Options.oncancel + "( this, o )" );
  };

  this.OnOpen = function( o )
  {
    if( this.Options.onopen )
      eval( this.Options.onopen + "( this, o )" );
  };

  this.OnProgress = function( o, nBytesLoaded, nBytesTotal )
  {
  };

  this.OnOverallProgress = function( o, nBytesSent, nBytesSize )
  {
  };

  this.OnComplete = function( o, sErrorMessage )
  {
    o.name = Format.FileName( o.name );

    if( sErrorMessage )
    { // this craziness is for Safari 5 on Winblows,
      window.focus();
      setTimeout( "alert( '" + sErrorMessage + "' );", 1500 );
    }

    if( this.Options.oncomplete )
      eval( this.Options.oncomplete + "( this, o )" );
  };

  if( window.FileTransfer == 'undefined' )
    window.FileTransfer = {};

  window.FileTransfer[this.JSName] = this;
};

function GetFileMask( type )
{
  var oMask = [];

  switch( type )
  {
    case 'image':
      oMask[oMask.length] = { description: "Image Files", extension: "*.gif;*.jpg;*.jpeg;*.png;*.bmp" };
      break;
    case 'gif':
      oMask[oMask.length] = { description: "Gif Files", extension: "*.gif;" };
      break;
    case 'audio':
      oMask[oMask.length] = { description: "MP3/MP4 Files", extension: "*.mp3;*.mp4;*.m4a" };
      break;
    case 'music':
      oMask[oMask.length] = { description: "Midi Files", extension: "*.midi;*.mid" };
      break;
    case 'compressed':
      oMask[oMask.length] = { description: "Compressed Files", extension: "*.zip;*.tar" };
      break;
    case 'scorm':
      oMask[oMask.length] = { description: "SCORM Files", extension: "*.zip" };
      break;
    case 'records':
      oMask[oMask.length] = { description: "Record Files", extension: "*.txt;*.csv" };
      break;
    case 'terms':
      oMask[oMask.length] = { description: "TERMS Records", extension: "*.t3" };
      break;
    case 'question':
      oMask[oMask.length] = { description: "Question Files", extension: "*.qst;*.txt" };
      break;
    case 'multimedia':
      oMask[oMask.length] = { description: "Multimedia Files", extension: "*.gif;*.jpg;*.jpeg;*.png;*.bmp;*.swf;*.mov;*.mpeg;*.avi;*.wmv;*.mp4" };
      break;
  }

  oMask[oMask.length] = { description: 'All Files', extension: '*.*' };

  return( oMask );
};
var cell_search =
{
	PageGoto : function( field, num, bJump ) // called by the PageGoto field
	{
		var fm = field.form;

		if( num )
			fm.list_page.value = ( bJump ) ? num : parseInt( fm.list_page.value ) + parseInt( num );

		if( fm.list_page.value < 1 )
			fm.list_page.value = 1;

		if( isNaN( fm.list_page.value ) )
			fm.list_page.value = 1;

		this.GetData( fm );
	}, // PageGoto

	ResizeList : function( obj ) // no work in ff
	{
		var oBody   = document.getElementById( obj.id + '_body' );
		var oSearch = false;

		try
		{
			oSearch = oBody.firstChild;
		}
		catch ( e )
		{
		}

		if( oSearch )
		{
			var oFilter = GetElementsByClassName( oSearch, 'class1', 'div' );
			var oList   = GetElementsByClassName( oSearch, 'class2', 'div' );
			var hBody   = oBody.offsetHeight;
			var hFilter = oFilter[0].offsetHeight;
			// var wBody   = oBody.offsetWidth;
			var hList   = ( hBody - hFilter );
			oList[0].style.overflow = 'auto';
			oList[0].style.height = hList + 'px';
			oList[0].style.width = '100%'; // wBody + 'px';
			oFilter[0].style.width = '100%'; // wBody + 'px';
		}
	}, // ResizeList

  CheckAll : function( form )
    {
      var fields = form.items;
      if( form.INTELLISEARCH && form.INTELLISEARCH.defaultValue != form.INTELLISEARCH.value )
        form.INTELLISEARCH.value = form.INTELLISEARCH.defaultValue;
      if( fields && fields.length )
      {
        for( var i = 0; i < fields.length; i++ )
        {
          if( !fields[i].checked )
            fields[i].checked = true;
        }
      }
      else if( fields )
      {
        if( !fields.checked )
          fields.checked = true;
      }

      var params = Form.MakeGetURL( form );
          params = NVP.Set( params, 'ctype', 'text/xml' );
          params = NVP.Set( params, 'cell', 'Search' );
          params = NVP.Set( params, 'act', 'CheckAll' );
      var a = new AJAX();
      a.URL = URL.Page( 'AJAX', 'Cell' );
      a.Method = 'POST';
      a.Params = params;
      a.OnComplete = function( oRequest, oData )
      {
        var obj = false;
        try
        {
          obj = DomNodeToObject( oRequest.responseXML );
        }
        catch ( err )
        {
          alert( 'cell_search.CheckAll: ' + oRequest.responseText );
        }
        if( obj )
        {
          var form = document[oData];
          form.CHECKED_COUNT.value = ( obj.root.count ) ? obj.root.count : 0;
        }
      };
      a.Data = form.name;
      a.Busy = function( b )
        {
          var fm = document[a.Data];
          cell_search.Busy( b, fm.parentNode.id );
        };
      a.Send();
    }, // CheckAll

  UnCheckAll : function( form )
    {
      var fields = form.items;
      if( fields && fields.length )
      {
        for( var i = 0; i < fields.length; i++ )
        {
          if( fields[i].checked )
            fields[i].checked = false;
        }
      }
      else if( fields )
      {
        if( fields.checked )
          fields.checked = false;
      }

      var params = Form.MakeGetURL( form );
          params = NVP.Set( params, 'ctype', 'text/xml' );
          params = NVP.Set( params, 'cell', 'Search' );
          params = NVP.Set( params, 'act', 'UnCheckAll' );

      var a = new AJAX();
      a.URL = URL.Page( 'AJAX', 'Cell' );
      a.Method = 'POST';
      a.Params = params;
      a.OnComplete = function( oRequest, oData )
      {
        var obj = false;
        try
        {
          obj = DomNodeToObject( oRequest.responseXML );
        }
        catch ( err )
        {
          alert( 'cell_search.CheckAll: ' + oRequest.responseText );
        }
        if( obj )
        {
          var form = document[oData];
          form.CHECKED_COUNT.value = ( obj.root.count ) ? obj.root.count : 0;
        }
      };
      a.Data = form.name;
      a.Busy = function( b )
        {
          var fm = document[a.Data];
          cell_search.Busy( b, fm.parentNode.id );
        };
      a.Send();
    }, // UnCheckAll

  Check : function( field )
    {
      var form = field.form;
      if( field.name == 'all' )
      {
        if( field.checked ) this.CheckAll( form );
        else this.UnCheckAll( form );
      }
      else
      {
        var count = parseInt( form.CHECKED_COUNT.value );
        var uc = form.UNCHECK.value.split( ',' );
        if( field.checked )
        {
          form.CHECKED_COUNT.value = ( count + 1 );
          if( ArrayHas( uc, field.value ) )
          {
            var na = new Array();
            for( var i = 0; i < uc.length; i++ )
            {
              if( uc[i] != field.value )
                na[na.length] = uc[i];
            }
            uc = na;
          }
        }
        else
        {
          form.CHECKED_COUNT.value = ( count - 1 );
          form.all.checked = false;
          var uc = form.UNCHECK.value.split( ',' );
          if( ! ArrayHas( uc, field.value ) )
            uc[uc.length] = field.value;
        }
        form.UNCHECK.value = uc.toString();
      }
    }, // Check

  ReOrder : function( fieldName, formName )
    {
      var fm = document[formName];

			if( !fm )
				return;

      if( fm.ORDERBY.value == fieldName )
      {
        if( fm.ORDERTYPE.value == 'ASC' )
          fm.ORDERTYPE.value = 'DESC';
        else
          fm.ORDERTYPE.value = 'ASC';
      }
      else
      {
        fm.ORDERTYPE.value = 'ASC'; // 11223 Default to ASC
        fm.ORDERBY.value = fieldName;
      }
      this.GetData( fm );
    }, // ReOrder

  GetFilter : function( field, opts )
    {
			if( !opts )
				opts = { connections: 0 };

      var fm = field.form;
      var ok = true;
      var filters = fm.FILTER.value.split( ',' );
      var name = field.options[field.selectedIndex].value;
      if ( name == 0 ) return;
      field.disabled = true;
      for( var i=0; i<filters.length; i++ )
      {
        // if( filters[i] == name ) return;
      }

      var a = new AJAX();
      a.URL = URL.Action({ pg : 'AJAX', cmd : 'Cell', cell : 'Search', act : 'FilterGet', ctype : 'text/xml', fieldname : name, st : fm.ST.value, sr : fm.SR.value, connections : opts.connections });
      a.Method = 'POST';
      a.OnComplete = function( oRequest, oData )
      {
        if( oRequest.responseXML )
        {
          var obj = null;
          try
          {
            obj = DomNodeToObject( oRequest.responseXML.documentElement );
          }
          catch ( error )
          {
            alert( 'GetFilter: \n\n' + oRequest.responseText );
          }
          if( obj )
          {
            var div = document.getElementById( 'AddFilter_div' );
            div.innerHTML = obj.html;

            // check for any initialization code that should be
            // executed for the new filters.
            var nodesThatNeedInitialization = ToArray( div.querySelectorAll( "[data-initialization]" ) );
			nodesThatNeedInitialization.forEach( function( item ){ if( item && item.value && item.value != 0 ){ item.value = 0; } eval( item.getAttribute( "data-initialization" ) ); } );
          }
        }
      };
      a.Send();
    }, // GetFilter

  QuickFilter : function( name, value, formName )
    {
      var form = document[formName];

			if( !form )
				return;

      var field = form[name];

      if( field )
      {
        if( !field.length )
        {
          field.value = value;
        }
      }
      else
      {
        var field = document.createElement( "input" );
        field.setAttribute( "type", "hidden" );
        field.setAttribute( "name", name );
        field.setAttribute( "value", value );
        form.appendChild( field );
      }

      form.FILTERTYPE.value = 'ADVANCED';
      if( form.FILTER.value.length )
      {
        var filters = form.FILTER.value.split( ',' );
        if( !ArrayHas( filters, name ) ) filters[filters.length] = name;
        form.FILTER.value = filters.toString();
      }
      else
      {
        form.FILTER.value = name;
      }

      cell_search.GetData( form );
    }, // QuickFilter

  AddFilter : function( field, verifHandler )
    {
      var fm = field.form;
      var ok = true;
      var name = fm.AddFilter.options[fm.AddFilter.selectedIndex].value;

      // Verify the filter

      if (!verifHandler)
        verifHandler = cell_search.VerifyAddFilter;
      if (verifHandler && !verifHandler(name))
          return;

      var filters = fm.FILTER.value.split( ',' );
      // if( !eval( "fm."+name ) ) return;
      var infilter = false;
      for( var i=0; i<filters.length; i++ )
      {
        if( filters[i] == '' )
        {
          filters.splice( i, 1 );
        }
        if( filters[i] == name ) infilter = true;
      }
      if( !infilter ) filters[filters.length] = name;
      fm.FILTER.value = filters.toString();
      this.GetData( fm, true );
    },

  AddFilterOnEnter : function(evt, obj)
  {
    evt = evt || window.event;
    if (evt.keyCode == 13)
      cell_search.AddFilter( obj );
  }, // AddFilterOnEnter

  DropFilter : function( formname, fieldId )
    {
      var fm = document[formname];
      var fl = document.getElementById( fieldId );
      var fl2 = false;
      if( !fl )
      {
        fl  = document.getElementById( 'a' + fieldId );
        fl2 = document.getElementById( 'b' + fieldId );
      }
      if( !fl )
      {
        fl  = document.getElementById( 'da' + fieldId );
        fl2 = document.getElementById( 'db' + fieldId );
      }
      if( fl )
      {
        fl.value = '';
        fl.name = 'dropme_' + fl.name;
      }
      if( fl2 )
      {
        fl2.value = '';
        fl2.name = 'dropme_' + fl2.name;
      }

      this.GetData( fm, true );
    }, // DropFilter

  AddToFavorites: function( formname )
    {
      var title = prompt( 'Favorite Title' );
      if( !title || title.length <= 0 ) return;
      var form = document[formname];
      var params = Form.MakeGetURL( form );
          params = NVP.Set( params, 'ctype', 'text/xml' );
          params = NVP.Set( params, 'cell', 'Search' );
          params = NVP.Set( params, 'act', 'AddToFavorites' );
          params = NVP.Set( params, 'FavTitle', title );
      var a = new AJAX();
      a.URL = URL.Page( 'AJAX', 'Cell' );
      a.Params = params;
      a.Method = 'POST';
      a.OnComplete = function( oRequest, oData )
        {
          var form = document[oData];
          if( !form ) return;
          var label = ( form.LABEL ) ? form.LABEL.value : 0;

          if( form.POSTSAVE.value )
          {
            var re = new RegExp( /\(.+?\)/ );
            if( re.test( form.POSTSAVE.value ) )
            {
              eval( form.POSTSAVE.value );
            }
            else
            {
              eval( form.POSTSAVE.value + "( form )" );
            }
          }

          var obj = false;
          try
          {
            obj = DomNodeToObject( oRequest.responseXML.documentElement );
          }
          catch ( error )
          {
            alert( oRequest.responseText );
          }
          if( obj && label )
          {
            var h = document.getElementById( label );
            if( h ) h.value = obj.count;
            var l = document.getElementById( label + "_txt" );
            if( l )
            {
              l.value = obj.label;
              if( l.onchange ) l.onchange();
            }
            var b = document.getElementById( label + "_btn" );
            if( b ) b.value = obj.label;
          }
          if( form.WINDOW && !form.NOCLOSE.value ) // This is a dialog window
          {
            Dialog.Close( form.WINDOW.value );
          }
        };
      a.Data = formname;
      a.Send();
    }, // AddToFavorites

  AddToSearch : function( formname, required )
    {
      var form = document[formname];

      if( required && form.CHECKED_COUNT.value <= 0 )
      {
        alert( cel_search_msg_noselecteditems );
        return;
      }

      var params = Form.MakeGetURL( form );
          params = NVP.Set( params, 'ctype', 'text/xml' );
          params = NVP.Set( params, 'cell', 'Search' );
          params = NVP.Set( params, 'act', 'AddToSearch' );

      var a = new AJAX();
      a.URL = URL.Page( 'AJAX', 'Cell' );
      a.Params = params;
      a.Method = 'POST';
      a.OnComplete = function( oRequest, oData )
        {
          var form = document[oData];
          if( !form ) return;
          var label = ( form.LABEL ) ? form.LABEL.value : 0;

          if( form.POSTSAVE.value )
          {
            var re = new RegExp( /\(.+?\)/ );
            if( re.test( form.POSTSAVE.value ) )
            {
              eval( form.POSTSAVE.value );
            }
            else
            {
              eval( form.POSTSAVE.value + "( form )" );
            }
          }

          var obj = false;
          try
          {
            obj = DomNodeToObject( oRequest.responseXML.documentElement );
          }
          catch ( err )
          {
            alert( 'AddToSearch: \n\n' + oRequest.responseText );
          }

          if( obj && label )
          {
            var h = document.getElementById( label );
            if( h ) h.value = obj.count;
            var l = document.getElementById( label + "_txt" );
            if( l )
            {
              l.value = obj.label;
              if( l.onchange ) l.onchange();
            }
            var b = document.getElementById( label + "_btn" );
            if( b ) b.value = obj.label;
          }
          if( form.WINDOW && !form.NOCLOSE.value ) // This is a dialog window
          {
            Dialog.Close( form.WINDOW.value );
          }
        };
      a.Data = formname;
      a.Send();
    }, // AddToSearch

  AddFavoritesToSearch : function( favid, formname )
    {
      var form = document[formname];
      var params = Form.MakeGetURL( form );
          params = NVP.Set( params, 'ctype', 'text/xml' );
          params = NVP.Set( params, 'cell', 'Search' );
          params = NVP.Set( params, 'act', 'AddFavoritesToSearch' );
          params = NVP.Set( params, 'FavID', favid );

      var a = new AJAX();
      a.URL = URL.Page( 'AJAX', 'Cell' );
      a.Params = params;
      a.Method = 'POST';
      a.OnComplete = function( oRequest, oData )
        {
          var form = document[oData];
          if( !form ) return;
          var label = ( form.LABEL ) ? form.LABEL.value : 0;
          var obj = false;
          try
          {
            obj = DomNodeToObject( oRequest.responseXML.documentElement );
          }
          catch ( error )
          {
            alert( 'Favorites: \n\n' + oRequest.responseText );
          }

          if( obj && label )
          {
            var h = document.getElementById( label );
            if( h ) h.value = obj.count;
            var l = document.getElementById( label + "_txt" );
            if( l )
            {
              l.value = obj.label;
              if( l.onchange ) l.onchange();
            }
            var b = document.getElementById( label + "_btn" );
            if( b ) b.value = obj.label;
          }
          if( form.WINDOW && !form.NOCLOSE.value ) // This is a dialog window
          {
            Dialog.Close( form.WINDOW.value );
          }
        };
      a.Data = formname;
      a.Send();
    }, // AddFavoritesToSearch

  AdvancedSearch: function( name )
    {
      var fm = document[name];
      var sdiv = document.getElementById( name + '_Simple' );
      var adiv = document.getElementById( name + '_Advanced' );
      sdiv.style.display = 'none';
      adiv.style.display = 'block';
      fm.FILTERTYPE.value = 'ADVANCED';
      cell_search.GetData( fm, true );
    }, // AdvancedSearch

  SimpleSearch: function( name )
    {
      var fm = document[name];
      var sdiv = document.getElementById( name + '_Simple' );
      var adiv = document.getElementById( name + '_Advanced' );
      sdiv.style.display = 'block';
      adiv.style.display = 'none';
      fm.FILTERTYPE.value = 'SIMPLE';

      cell_search.GetData( fm, true );
    }, // SimpleSearch

  CancelSearch : function( formname ) // cancel needs to be used to clear the +200 from the search table
    {
      var form = document[formname];
      if( form.WINDOW )
      {
        Dialog.Close( form.WINDOW.value );
      }
    }, // CancelSearch

  SelectItem : function( id, formName )
    {
      var form = document[formName];

      var params = Form.MakeGetURL( form );
          params = NVP.Set( params, 'ID', id );
          params = NVP.Set( params, 'ctype', 'text/xml' );
          params = NVP.Set( params, 'cell', 'Search' );
          params = NVP.Set( params, 'act', 'GetDisplayName' );

      var a = new AJAX();
      a.URL = URL.Page( 'AJAX', 'Cell' );
      a.Params = params;
      a.Method = 'POST';
      a.OnComplete =
        function( oRequest, oData )
        {
          var obj = null;
          try
          {
            obj = DomNodeToObject( oRequest.responseXML.documentElement );
          }
          catch ( err )
          {
            return;
          }
          var fm  = document[oData];
          var lb  = ( fm.LABEL ) ? fm.LABEL.value : false;
          var win = ( fm.WINDOW ) ? fm.WINDOW.value : false;
          if( lb )
          {
            var h = document.getElementById( lb );

            if( h )
						{
							h.value = id;

							if( h.onchange )
								h.onchange();
						}

            var t = document.getElementById( lb + "_txt" );
            if( t )
            {
              t.value = obj.html;
              if( t.onchange ) t.onchange();
            }
            else
            {
              var l = document.getElementById( lb + "_lnk" );
              var b = document.getElementById( lb + "_btn" );
              if( l ) l.innerHTML = obj.html;
              else if( b ) b.value = obj.html;
            }
          }

          if( fm.POSTSAVE.value )
          {
            var re = new RegExp( /\(.+?\)/ );
            if( re.test( fm.POSTSAVE.value ) )
            {
              eval( fm.POSTSAVE.value );
            }
            else
            {
              eval( fm.POSTSAVE.value + '( ' + id + ', "' + obj.html + '" )' );
            }
          }
          if( win && !fm.NOCLOSE.value ) Dialog.Close( win ); // This is a dialog window
          // if( win ) Dialog.Close( win );

        };
      a.Data = formName;
      a.Busy = function( b )
        {
          cell_search.Busy( b, form.parentNode.id );
        };

      a.Send();
    }, // SelectItem

  ShowSelected : function( formname )
    {
      var form = document[formname];
      form.SHOWSELECTED.value = 1;
      if( form.INTELLISEARCH )
      {
        form.INTELLISEARCH.value = '';
        form.INTELLISEARCH.defaultValue = '';
      }
      if( form.all ) form.all.checked = true;
      this.GetData( form );
      var btnsa = document.getElementById( 'btnsa' );
      var btnss = document.getElementById( 'btnss' );
      DropClass( btnsa, 'nodisplay' );
      AddClass( btnss, 'nodisplay' );
    }, // ShowSelected

  ShowAll : function( formname )
    {
      var form = document[formname];
      form.SHOWSELECTED.value = 0;
      if( form.all ) form.all.checked = false;
      this.GetData( form );
      var btnsa = document.getElementById( 'btnsa' );
      var btnss = document.getElementById( 'btnss' );
      DropClass( btnss, 'nodisplay' );
      AddClass( btnsa, 'nodisplay' );
    }, // ShowAll

  GetData : function( form, research )
    {
      if( !form ) return;

      if( research || ( form.INTELLISEARCH && form.INTELLISEARCH.value != form.INTELLISEARCH.defaultValue ) )
      {
        if( form.all ) form.all.checked = false;
        form.SHOWSELECTED.value = 0;
        var btnsa = document.getElementById( 'btnsa' );
        var btnss = document.getElementById( 'btnss' );
        if( btnss ) DropClass( btnss, 'nodisplay' );
        if( btnsa ) AddClass( btnsa, 'nodisplay' );
      }

      var params = Form.MakeGetURL( form );

      var a = new AJAX();
      a.URL = form.action;
      a.Params = params;
      a.Method = 'POST';
      a.OnComplete =
        function( oRequest, oData )
        {
          var o = document.getElementById( oData );
          if( o )
          {
            var obj = null;
            try
            {
              obj = DomNodeToObject( oRequest.responseXML.documentElement );
            }
            catch ( error )
            {
              alert( 'GetData: \n\n' + oRequest.responseText );
            }

            if( obj )
            {
              o.innerHTML = obj.html;
              if( obj['window'] )
              {
                cell_search.ResizeList( Dialogboxes[obj['window']] );
              }
              var fields = document.getElementsByName( 'INTELLISEARCH' );
              if( fields[0] )
              {
                try // 7232
                {
                  fields[0].focus(); // 2031
                }
                catch ( error )
                {
                }
              }

              if( obj.jscript )
              {
                try
                {
                  eval( obj.jscript );
                }
                catch ( err )
                {
                  alert( 'ERROR: SEARCH (694)' );
                }
              }
            }
          }
          else
          {
            // alert( 'Cannot find cell '+oData );
          }
        };
      a.Data = form.parentNode.id;
      a.Busy = function( b )
        {
          cell_search.Busy( b, a.Data );
        };
      a.Send();
      return( false );
    }, // GetData

  Busy : function( on, id )
    {
      if (typeof Busy.Run != 'undefined')
        Busy.Run( on );
    }, // cell_search.Busy

  Prompt : function( formname, url )
    {
      var form = document[formname];
      var body = form.parentNode;
      var winid = form.WINDOW.value;
      var screen = document.createElement( 'DIV' );
          screen.style.position = 'absolute';
          screen.style.top = '20px';
          screen.style.left = '0px';
          screen.style.width = '100%';
          screen.style.height = '100%';
          screen.style.display = 'block';
          screen.style.backgroundImage = 'url(' + SchemeImageURL( "screen.gif" ) + ')';
          screen.id = winid + '_prompt';
      var box = GetAbsolutePosition( body );
      var popup = new Object();
          popup.width = parseInt( box.width * .8 );
          popup.height = 200;
          popup.top = parseInt( ( box.height - 200 ) * .5 );
          popup.left = parseInt( box.width * .1 );
          popup.html = '<center>LOADING ...</center><center><img src="'+ gbl_img_busy +'" /></center>';
      var message = document.createElement( 'DIV' );
          message.style.position = 'absolute';
          message.style.top = popup.top + 'px';
          message.style.left = popup.left + 'px';
          message.style.width = popup.width + 'px';
          message.style.height = popup.height + 'px';
          message.className = 'dialog_win';
      var message_header = document.createElement( 'DIV' );
          message_header.style.width = '100%';
          message_header.style.height = '20px';
          message_header.style.textAlign = 'right';
          message_header.className = 'dialog_header';
      var message_close = document.createElement( 'img' );
          message_close.src = SchemeImageURL( "hdr_close.png" );
          message_close.onclick = function(){ cell_search.PromptClose( winid ); };
          message_close.style.cursor = "pointer";
          message_close.style.marginRight = '0px';
      var message_body = document.createElement( 'DIV' );
          message_body.style.width = '100%';
          message_body.style.height = '180px';
          message_body.innerHTML = popup.html;
          message_body.id = winid + '_prompt_body';

      message_header.appendChild( message_close );
      message.appendChild( message_header );
      message.appendChild( message_body );
      screen.appendChild( message );
      body.appendChild( screen );

      if( url )
      {
        var params = Form.MakeGetURL( form );
        var a = new AJAX();
        a.URL = url;
        a.Method = 'POST';
        a.Params = params;
        a.OnComplete = AjaxResponse;
        a.Data = winid + '_prompt_body';
        a.Send();
      }
    }, // Prompt

  PromptClose : function( winid )
    {
      var prompt = document.getElementById( winid + '_prompt' );
      if( !prompt ) return;
      var body = prompt.parentNode;
      body.removeChild( prompt );
    }, // PromptClose

  Clear : function( prms )
    {
      var params = NVP.Set( '', 'TARGET', prms.target );
          params = NVP.Set( params, 'LABEL', prms.label );
          params = NVP.Set( params, 'NONESELECTED', prms.noneselected );
          params = NVP.Set( params, 'ST', prms.st );
          params = NVP.Set( params, 'SR', prms.sr );
          params = NVP.Set( params, 'ctype', 'text/xml' );
          params = NVP.Set( params, 'cell', 'Search' );
          params = NVP.Set( params, 'act', 'ClearSearch' );

      var a = new AJAX();
      a.URL = URL.Page( 'AJAX', 'Cell' );
      a.Params = params;
      a.Method = 'POST';
      a.OnComplete = function( oRequest, oData )
      {
        var obj = false;
        try
        {
          obj = DomNodeToObject( oRequest.responseXML.documentElement );
        }
        catch ( err )
        {
          alert( 'AddToSearch: \n\n' + oRequest.responseText );
        }

        if( obj && oData )
        {
          var h = document.getElementById( oData );
          if( h ) h.value = obj.count;
          var l = document.getElementById( oData + "_txt" );
          if( l )
          {
            l.value = obj.label;
            if( l.onchange ) l.onchange();
          }
          var b = document.getElementById( oData + "_btn" );
          if( b ) b.value = obj.label;
        }
      };
      a.Data = prms.label;
      a.Send();
    }, // Clear

/*////////////////////////
//    VerifyAddFilter
*////////////////////////

  VerifyAddFilter : function (fldName)
  {
    if (fldName.match(/Date/))
    {
      var rng = document.getElementById(fldName + "_rng");
      var rel = document.getElementById(fldName + "_rel");

      if (rng.style.display == "inline")
      {
        var dateA = GetChildElementByProperty(rng, "name", 'da' + fldName );
        var dateB = GetChildElementByProperty(rng, "name", 'db' + fldName );
        return !Form.CheckFields([[dateA, 'date', 'From: Date'], [dateB, '?>=' + 'da' + fldName, 'To: Date']]);
      }
      else if (rel.style.display == "inline")
      {
        var numFld = GetChildElementByProperty(rel, "name", fldName + "_rel_num");
        if (numFld.style.display == "inline")
          return !Form.CheckFields([[numFld, 'numeric', 'Range Value'], [numFld, '>0', 'Range Value']]);
      }
      else
      {
        return false;
      }
    }

    // More verifiers here

    // All unchecked filters; return true
    return true;
  } // VerifyAddFilter
}; // End cell_search

this.scrollbar_timer = null;
this.scrollbar_id = null;

function scroll_left( id )
{
  if( !id ) id = this.scrollbar_id;
  if( !id ) return;
  if( id && ( id != this.scrollbar_id ) ) scroll_stop( id );
  var content = document.getElementById( id );
  if( !content ) return;
  content.style.left = ( parseInt( content.style.left ) + 300 ) + "px";
  this.scrollbar_timer = setTimeout( 'scroll_left()', 500 );
}

function scroll_stop()
{
  if( this.scrollbar_timer != null ) return;
  clearTimeout( this.scrollbar_timer );
  this.scrollbar_timer = null;
  this.scrollbar_id = null;
}

function scroll_right( id )
{
  if( !id ) id = this.scrollbar_id;
  if( !id ) return;
  if( id && ( id != this.scrollbar_id ) ) scroll_stop( id );
  var content = document.getElementById( id );
  if( !content ) return;
  content.style.left = ( parseInt( content.style.left ) - 300 ) + "px";
  this.scrollbar_timer = setTimeout( 'scroll_right()', 500 );
};
var PopCal =
{
  _debug : false,   // turn on to see useless messages
  _div : null,      // holds calendar
  _timer : null,    // timer for checking
  _focused : 0,     // focus counter
  _date : null,     // the actual date
  _caldate : null,  // beginning of calendar date
  _objects : { base : null, dsp : null, lnk: null },  // objects that may be needed
  _saved_handlers : { base: {}, dsp: {}, lnk: {} },    // saved event handlers
  _lastobj : null,
  _inopen : 0,      // used in Open ..
  _options : { empty: false, allow: 0 },    // empty: t/f, allow: 0/1/2 ( 0=any, 1=nopast, 2=nofuture )
  _watch : Array(),
  _watchtimer : null,
  _goto : { timer: null, hits: 0, gofast: 6, slowMS: 200, fastMS: 75 },

  Open : function( e, opts )
  {
    with( PopCal )
    {
      _options = { empty: false, allow: 0 };  // set defaults
      Debug( "_inopen: " + _inopen );
      if( _inopen )
        return;

      _inopen = 1;

      if( opts )
      {
        for( k in _options )
        {
          if( typeof( _options[k] ) != 'undefined' && typeof( opts[k] ) != 'undefined' )
            _options[k] = opts[k];
        }
      }

      var evt = ( e ) ? e : window.event;
      var obj = ( evt.target ) ? evt.target : evt.srcElement;
      var found = FindObjects( obj, "lnk,dsp" );

      if( !found.dsp )
        found.dsp = found.base;

      if( !found.lnk )
        found.lnk = found.base;

      if( _div )
      {
        Debug( "Existing calendar" );
        if( obj == _lastobj )
        {
          Debug( "Closing same.." );
          _inopen = 0;
          Close();
          return;
        }
        for( o in _objects )
        {
          if( obj == _objects[o] )
          {
            _lastobj = obj;
            _inopen = 0;
            return;
          }
        }
        Close();
      }

      _lastobj = obj;
      _objects = found;
      _focused = 0;

      if( found.base.disabled )
      {
        _inopen = 0;
        return;
      }

      if( typeof( _objects.dsp ) == 'object' )
      {
        if( typeof( _objects.dsp.type ) != 'undefined' )
        {
          if( _objects.dsp.type == 'text' )
          {
            _saved_handlers.dsp.onblur = _objects.dsp.onblur;
            _saved_handlers.dsp.onfocus = _objects.dsp.onfocus;
            _objects.dsp.onblur = _objects.dsp.onfocus = _InputEvent;
            if( _objects.dsp.focus )
              _objects.dsp.focus();
            if( _objects.dsp.select )
              _objects.dsp.select();
            if( obj == _objects.dsp ) // onfocus doesn't fire if object was focused .. check
              _focused++;
          }
        }
      }

      if( _objects.dsp )
      {
        _saved_handlers.dsp.onmouseover = _objects.dsp.onmouseover;
        _saved_handlers.dsp.onmouseout = _objects.dsp.onmouseout;
        _objects.dsp.onmouseover = _objects.dsp.onmouseout = _MouseEvent;
        if( obj == _objects.dsp )
          _focused++;
      }

      if( _objects.lnk != _objects.dsp )
      {
        _saved_handlers.lnk.onmouseover = _objects.lnk.onmouseover;
        _saved_handlers.lnk.onmouseout = _objects.lnk.onmouseout;
        _objects.lnk.onmouseover = _objects.lnk.onmouseout = _MouseEvent;
        if( obj == _objects.lnk )
          _focused++;
      }

      _date = Date.Parse( GetValue( _objects.base ) );

      if( !_date )
        _date = new Date();

      _caldate = new Date( _date );

      _caldate.setDate( 1 );

      Debug( _objects );

      // the calendar
      var rct = GetAbsolutePosition( _objects.dsp, true );

      // 3438 Positioning error
      var fixed = _objects.dsp;
      while( fixed )
      {
        if( GetStyle( fixed, "position" ) == 'fixed' )
          break;
        fixed = fixed.offsetParent;
      }

      _div = document.createElement('DIV');
      _div.style.position = (( fixed ) ? 'fixed' : 'absolute' );
      _div.style.zIndex = 400;
      _div.style.top = ( rct.bottom + "px" );
      _div.style.left = ( rct.left + "px" );
      _div.innerHTML = _CreateHTML();
      _div.style.display = "block";
      document.body.appendChild( _div );
      var cal_pos = GetAbsolutePosition( _div, true );
      var screen_btm = window.innerHeight || document.documentElement.clientHeight;
      screen_btm += window.pageYOffset || document.body.scrollTop;

      if( screen_btm < cal_pos.bottom )
        _div.style.top = ( rct.top - cal_pos.height - 20 ) + 'px';

      _Draw();
      _timer = setTimeout( "PopCal._Close()", 5000 );

      _inopen = 0;
    }
  },

  Close : function()
  {
    with( PopCal )
    {
      Debug( "Close" );

      clearTimeout( _timer );

      if( _div )
        document.body.removeChild( _div );
      _div = null;

      for( o in _saved_handlers )
      {
        if( !_objects[o] )
          continue;

        for( h in _saved_handlers[o] )
        {
          if( _saved_handlers[o][h] )
            _objects[o][h] = _saved_handlers[o][h];
        }
      }

      for( o in _objects )
        _objects[o] = null;
      _timer = null;
      _focused = 0;
    }
  },

  GetValue : function( obj, raw )
  {
    var value = '';

    if( typeof( obj ) == 'object' )
    {
      if( typeof( obj.type ) != 'undefined' )
        value = obj.value;
      else
        value = obj.innerHTML;
    }

    if( !raw && value.length && ( value = Date.Parse( value ) ) )
      value = value.Format( "Y-m-d" );

    return( value );
  },

  SetValue : function( obj, value )
  {
    if( typeof( obj ) == 'object' )
    {
      if( typeof( obj.type ) != 'undefined' )
      {
        obj.value = value;
        if( typeof( obj.onchange ) == 'function' )
          obj.onchange();
      }
      else
        obj.innerHTML = value;
    }
  },

  Clear : function()
  {
    with( PopCal )
    {
      SetValue( _objects.base, '' );
      if( _objects.base != _objects.dsp )
        SetValue( _objects.dsp, '' ); // No Date
      Close();
    }
  },

  OnLoad : function( e )
  {
    var evt = ( e ) ? e : window.event;
    var obj = ( evt.target ) ? evt.target : evt.srcElement;

    var found = FindObjects( obj, "lnk,dsp" );

    with( PopCal )
    {
      if( found.base != found.dsp )
      {
        _watch.push( { dsp: found.dsp, base: found.base } );
        if( !_watchtimer )
          _watchtimer = setTimeout( 'PopCal.UpdateWatch()', 500 );
      }
    }
  },

  UpdateWatch : function()
  {
    with( PopCal )
    {
      var watch = [];

      _watchtimer = null;

      for( var i = 0; i < _watch.length; i++ )
        watch.push( _watch[i] );

      _watch.length = 0;

      for( var i = 0; i < watch.length; i++ )
      {
        if( GetValue( watch[i].dsp ) != GetValue( watch[i].base ) )
          SetValue( watch[i].dsp, watch[i].base.value );
      }

      if( _watch.length )
          _watchtimer = setTimeout( 'PopCal.UpdateWatch()', 500 );
    }
  },

  Debug : function( s, now )
  {
    if( PopCal._debug || now )
      Debug.Print( s );
  },

  _CreateHTML : function()
  {
    PopCal.Debug( "_CreateHTML" );
    var html = "";
    var hlight = "onmouseover='PopCal._Highlight(event)' onmouseout='PopCal._Highlight(event)'";

    html +=
      "<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=1 ID=popcal class=popcal onmouseout='PopCal._GoToClickCancel(event)'>";

    html +=
      "<TR>" +
        "<TD " + hlight + " colspan=7 id='caldate' class='caldate'></TD>" +
      "</TR>";

    html +=
      "<TR>" +
        "<TD " + hlight + " class='calgoto' onmouseup='PopCal._GoToClickCancel(event)' onmousedown='PopCal._GoToClick(event,-12)'>&lt;&lt;</TD>" +
        "<TD " + hlight + " class='calgoto' onmouseup='PopCal._GoToClickCancel(event)' onmousedown='PopCal._GoToClick(event,-1)'>&lt;</TD>" +
        "<TD " + hlight + " class='calgoto' COLSPAN=3 onclick='PopCal._GoToClick(event,0)'>Today</TD>" +
        "<TD " + hlight + " class='calgoto' onmouseup='PopCal._GoToClickCancel(event)' onmousedown='PopCal._GoToClick(event,1)'>&gt;</TD>" +
        "<TD " + hlight + " class='calgoto' onmouseup='PopCal._GoToClickCancel(event)' onmousedown='PopCal._GoToClick(event,12)'>&gt;&gt;</TD>" +
      "</TR>";

    for( var r = 0; r < 6; r++ )
    {
      html +=
        "<TR>";
      for( var c = 0; c < 7; c++ )
      {
        var n = ((r*7)+c);
        html +=
          "<TD " + hlight + " onclick='PopCal._DayClick(event)' class='calday' id='calday_" + n + "'>" + n + "</TD>";
      }
      html +=
        "</TR>";
    }

    if( PopCal._options.empty )
    {
      html +=
        "<TR>" +
          "<TD " + hlight + " colspan=7 class='calgoto' onclick='PopCal.Clear();'>Clear Date</TD>" +
        "</TR>";
    }

    html +=
      "</TABLE>";

    return( html );
  },

  _ChangeClass : function( obj, className, bAdd )
  {
    if( bAdd )
    {
      if( obj.className.indexOf( className ) == -1 )
        obj.className += " " + className;
    }
    else
      obj.className = obj.className.replace( className, "" );
  },

  _Draw : function()
  {
    with( PopCal )
    {
      Debug( "_Draw" );
      var dtNow = new Date();
      var dt = new Date( _caldate );
      dt.setDate( dt.getDate() - dt.DayOfWeek() );
      for( var n = 0; n < (6*7); n++ )
      {
        var o = document.getElementById( 'calday_' + n );
        if( o )
        {
          o.innerHTML = dt.getDate();
          o.dayvalue = dt.getTime();
          var disabled = false;
          switch( parseInt( _options.allow ) )
          {
            case 1: // no past dates
              disabled = dt.Format( "Ymd" ) < dtNow.Format( "Ymd" );
              break;
            case 2: // no future dates
              disabled = dt.Format( "Ymd" ) > dtNow.Format( "Ymd" );
              break;
            default:
              break;
          }
          _ChangeClass( o, 'calmonth', dt.Format( "Ym" ) == _caldate.Format( "Ym" ) );
          _ChangeClass( o, 'caldisabled', disabled );
          _ChangeClass( o, 'calselected', dt.Format( "Ymd" ) == _date.Format( "Ymd" ) );
          _ChangeClass( o, 'caltoday', dt.Format( "Ymd" ) == dtNow.Format( "Ymd" ) );
        }
        dt.setDate( dt.getDate() + 1 );
      }
      var cd = document.getElementById( 'caldate' );
      if( cd )
        cd.innerHTML = _caldate.Format( "F Y" );
    }
  },

  _Close : function()
  {
    with( PopCal )
    {
      Debug( "_Close" );
      clearTimeout( _timer );

      if( _focused <= 0 )
        Close();
      else
        _timer = setTimeout( "PopCal._Close()", 2000 );
    }
  },

  _Highlight : function( e )
  {
    var evt = ( e ) ? e : window.event;
    var obj = ( evt.target ) ? evt.target : evt.srcElement;

    with( PopCal )
    {
      Debug( "_Highlight: " + evt.type + " : " + obj.id );
      clearTimeout( _timer );

      _timer = setTimeout( "PopCal._Close()", 2000 );

      switch( evt.type )
      {
        case 'mouseout':
          if( _focused > 0 )
            _focused--;
          if( obj.id != 'caldate' )
            obj.className = obj.className.replace( /highlight/gi, "" );
          break;
        case 'mouseover':
          _focused++;
          if( obj.id != 'caldate' )
            obj.className += " calhighlight";
          break;
      }
    }
  },

  _SetDateValue : function( dt )
  {
    with( PopCal )
    {
      var fmt = ( Date.DT_FMT ) ? Date.DT_FMT : "Y-m-d";
      if( _objects.base != _objects.dsp )
      {
        var basefmt = "Y-m-d";
        var baseobj = Date.Parse( GetValue( _objects.base, true ) );
        if( baseobj )
        {
          var h = baseobj.getHours();
          var i = baseobj.getMinutes();
          var s = baseobj.getSeconds();
          if( h || i || s )
          {
            dt.setHours( h );
            dt.setMinutes( i );
            dt.setSeconds( s );
            basefmt += " H:i";
          }
        }
        SetValue( _objects.base, dt.Format( basefmt ) );
        SetValue( _objects.dsp, dt.Format( fmt ) );
      }
      else
      {
        SetValue( _objects.base, dt.Format( fmt ) );
      }
    }
  },

  _GoToClickCancel : function( e )
  {
    //var evt = ( e ) ? e : window.event;
    //var obj = ( evt.target ) ? evt.target : evt.srcElement;
    with( PopCal )
    {
      _goto.hits = 0;
      clearTimeout( _goto.timer );
      _goto.timer = null;
    }
  },

  _GoToClick : function( e, where )
  {
    //var evt = ( e ) ? e : window.event;
    //var obj = ( evt.target ) ? evt.target : evt.srcElement;

    with( PopCal )
    {
      Debug( "_GoToClick" );
      if( !where ) // Today
      {
        var dt = new Date();
        _SetDateValue( dt );
        Close();
      }
      else
      {
        _caldate.setMonth( _caldate.getMonth() + where );
        _Draw();
        _objects.dsp.focus();
        clearTimeout( _goto.timer );
        _goto.timer = setTimeout( "PopCal._GoToClick( null, " + where + ");", ( _goto.hits++ > _goto.gofast ) ? _goto.fastMS : _goto.slowMS );
      }
    }
  },

  _DayClick : function( e )
  {
    var evt = ( e ) ? e : window.event;
    var obj = ( evt.target ) ? evt.target : evt.srcElement;

    with( PopCal )
    {
      /*
      var idx = parseInt( obj.id.substr( 7 ) );
      var dt = new Date( _caldate );
        Debug( "_DayClick: " + idx );
        dt.setDate( dt.getDate() - dt.DayOfWeek() );
        dt.setDate( dt.getDate() + idx );
      */
      if( obj.className.indexOf( 'caldisabled' ) == -1 )
      {
        var dt = new Date( obj.dayvalue );
        _SetDateValue( dt );
        Close();
      }
    }
  },

  _MouseEvent : function( e )
  {
    var evt = ( e ) ? e : window.event;

    var obj = ( evt.target ) ? evt.target : evt.srcElement;

    with( PopCal )
    {
      Debug( "_MouseEvent: " + evt.type );
      clearTimeout( _timer );

      _timer = setTimeout( "PopCal._Close()", 2000 );

      switch( evt.type )
      {
        case 'mouseout':
          if( _focused > 0 )
            _focused--;
          break;
        case 'mouseover':
          _focused++;
          break;
      }

      _ExecuteSavedHandler( obj, evt.type, evt );
    }
  },

  _InputEvent : function( e )
  {
    var evt = ( e ) ? e : window.event;
    var obj = ( evt.target ) ? evt.target : evt.srcElement;

    with( PopCal )
    {
      Debug( "_InputEvent: " + evt.type );
      switch( evt.type )
      {
        case 'blur':
          if( _focused > 0 )
            _focused--;
          clearTimeout( _timer );
          _timer = setTimeout( "PopCal._Close()", 250 );
          break;

        case 'focus':
          _focused++;
          break;
      }

      _ExecuteSavedHandler( obj, evt.type, evt );
    }
  },

  _ExecuteSavedHandler : function( obj, evttype, oEvent )
  {
    if( evttype == 'mouseover' || evttype == 'mouseout' )
      return;

    with( PopCal )
    {
      for( o in _objects )
      {
        if( _objects[o] == obj )
        {
          if( _saved_handlers[o]["on" + evttype] )
            _saved_handlers[o]["on" + evttype]( oEvent );
          break;
        }
      }
    }
  }
};var PopCode =
{
  Scheme      : false,  // The javascript object from the xml file
  Collections : {},     // The Section Items
  Sections    : [],     // The Code Sections
  Field       : {},     // The Related Form Field
  Delimiter   : false,  // The Delimiter Definition
  StartX      : 0,
  StartY      : 0,
  Timer       : false,
  SearchFilter: false,
  Init : function( fld, url, searchfilter )
  {
    with( PopCode )
    {
      Field = fld;
      if( !Field.onfocus )
        Field.onfocus = function(){ PopCode.Field.isfocused = true; };
      if( !Field.onblur )
        Field.onblur = function(){ PopCode.Field.isfocused = false; };
      Field.onfocus();
      SearchFilter = searchfilter;

      var rect = GetAbsolutePosition( Field, true );
      StartX = rect.left;
      StartY = ( rect.top + rect.height );

      var now = new Date();
      var a = new AJAX();
      a.URL = url;
      a.Method = 'GET';
      a.OnComplete = function( oRequest, oData )
      {
        try
        {
          Scheme = DomNodeToObject( oRequest.responseXML );
        }
        catch ( e )
        {
          alert( oRequest.responseText );
        }
        if( Scheme )
        {
          if( Scheme.root.delimiter ) Delimiter = Scheme.root.delimiter;
          _ParseCollections();
          _ParseFieldValue();
          _ParseSections();
          _Open();
          _ResetTimer();
        }
      };
      a.Data = false;
      a.Send();
    }
  },
  _Open : function()
  {
    with( PopCode )
    {
      var div = document.getElementById( Field.name + '_PopCode' );
      if( !div )
      {
        div = document.createElement( 'DIV' );
        div.className = 'popcode';
        div.style.position = 'absolute';
        div.style.top = StartY + 'px';
        div.style.left = StartX + 'px';
        div.id = Field.name + '_PopCode';
        document.body.appendChild( div );
      };
      var html = '<form name="PopCodeForm" onsubmit="return( false );">';
      for ( var i = 0; i < Sections.length; i++ )
      {
        html += Sections[i]['field'];
      };
      html += '<input type="button" value="ok" onclick="PopCode.SaveAndClose();" />';
      html += '</form>';
      div.innerHTML = html;
    }
  },
  _ResetTimer : function()
  {
    with( PopCode )
    {
      if( Field.isfocused )
      {
        Timer = setTimeout( 'PopCode._ResetTimer()', 5000 );
      }
      else
      {
        Close();
      }
    };
  },
  SaveAndClose : function()
  {
    with( PopCode )
    {
      clearTimeout( Timer );
      var code = '';
      var incomplete = false;
      for( var i = 0; i < document.PopCodeForm.elements.length; i++ )
      {
        if( document.PopCodeForm.elements[i].type != 'button' )
        {
          if( !document.PopCodeForm.elements[i].value.length )
          {
            if( SearchFilter )
              code += '*';
            else
              incomplete = true;
          }
          else
          {
            if( document.PopCodeForm.elements[i].value.indexOf( '#' ) >= 0 && SearchFilter )
              code += '*';
            else
              code += document.PopCodeForm.elements[i].value;
          }
        }
      }
      if( incomplete )
      {
        Field.focus();
        Field.onfocus();
        _ResetTimer();
      }
      else
      {
        var newcode = ( Field.value ) ? false : true;
        for ( var i = 0; i < Field.value.length; i++ )
        {
          if( ( Field.value.charAt(i) != code.charAt(i) ) && ( code.charAt(i) != '#' ) )
            newcode = true;
        }
        if( newcode )
        {
          var isdefault = ( Field.defaultValue ) ? true : false;
          for ( var i = 0; i < Field.defaultValue.length; i++ )
          {
            if( ( Field.defaultValue.charAt(i) != code.charAt(i) ) && ( code.charAt(i) != '#' ) )
              isdefault = false;
          }
          if( isdefault )
          {
            Field.value = Field.defaultValue;
            var nfv = document.getElementById( Field.id + '_new' );
            nfv.value = 0;
          }
          else
          {
            Field.value = code;
            var nfv = document.getElementById( Field.id + '_new' );
            nfv.value = 1;
          }
        }
        Close();
      }
    };
  },
  Close : function()
  {
    with( PopCode )
    {
      clearTimeout( Timer );
      var sel = document.getElementById( 'PopCodeSelect' );
      if( sel ) document.body.removeChild( sel );
      var div = document.getElementById( Field.name + '_PopCode' );
      if( div ) document.body.removeChild( div );
    };
  },
  _ParseSections : function()
  {
    with( PopCode )
    {
      Sections = [];
      if( Scheme.root.sections )
      {
        var regex = '';
        if( !Scheme.root.sections.section.length ) Scheme.root.sections.section = [ Scheme.root.sections.section ];

        for ( var i = 0; i < Scheme.root.sections.section.length; i++ )
        {
          switch( Scheme.root.sections.section[i]['type'] )
          {
            case "text":
              Sections[i] = { label : Scheme.root.sections.section[i]['title'],
                              field : _BuildField( Scheme.root.sections.section[i], Scheme.root.sections.section[i]['default'] ) };
              if( Scheme.root.sections.section[i]['id'] )
              {
                Sections[i].id = Scheme.root.sections.section[i]['id'];
              }
              break;
            case "delimiter":
              Sections[i] = { label : 'Delimiter', field : ( Delimiter + '<INPUT TYPE="hidden" VALUE="'+Delimiter+'" OVERRIDE=1 />' ) };
              break;
            case "sequence":
              var fieldtext = '';
              for( var y = 0; y < Scheme.root.sections.section[i]['limit']['length']; y++ )
              {
                fieldtext += '#';
              }
              Sections[i] = { label : 'Sequence', field : ( fieldtext + '<INPUT TYPE="hidden" VALUE="'+fieldtext+'" OVERRIDE=1 />' ) };
              break;
          }
        }
      }
    };
  },
  _BuildField : function( obj, val )
  {
    with( PopCode )
    {
      var fld = {};
      fld.name      = 'PopCode_' + obj['id'];
      fld.size      = ( obj['limit'] && obj['limit']['length'] ) ? obj['limit']['length'] : 3;
      fld.maxlength = ( obj['limit'] && obj['limit']['length'] ) ? obj['limit']['length'] : 3;
      fld.value     = ( val ) ? val : "";
      fld.override  = 1;
      if( Collections[obj['id']] )
        fld.onclick = "PopCode._BuildSectionSelect( this, '" + obj['id'] + "');";
      var html = '<INPUT ';
      for ( n in fld )
      {
        html += n + ' = "' + fld[n] + '" ';
      }
      html += '>';
      /*
      if( obj['id'] && Collections[obj['id']] )
      {
        var size = ( Collections[obj['id']].length >= 5 ) ? 5 : Collections[obj['id']].length;
        html += '<SELECT name ="' + fld.name + '_sel" size=' + size + ' multiple=1>';
        for( var i = 0; i < Collections[obj['id']].length; i++ )
        {
          html += '<OPTION value="' + Collections[obj['id']][i]['value'] + '">' + Collections[obj['id']][i]['value'] + ' :: ' + Collections[obj['id']][i]['label'] + '</OPTION> ';
        }
        html += '</SELECT>';
      }
      */
      return( html );
    };
  },
  _BuildSectionSelect : function( fld, id )
  {
    with( PopCode )
    {
      Field.focus();
      Field.onfocus();
      var rect = GetAbsolutePosition( fld, true );
      var sel = document.getElementById( 'PopCodeSelect' );
      if( sel ) document.body.removeChild( sel );
      sel = document.createElement( 'DIV' );
      sel.name = 'PopCodeSelect';
      sel.id = 'PopCodeSelect';
      sel.style.position = 'absolute';
      sel.style.top = rect.top + rect.height + 'px';
      sel.style.left = rect.left + 'px';

      var html = '';

      for( var i = 0; i < Collections[id].length; i++ )
      {
        html += '<DIV onmouseover="AddClass( this, \'highlight\' );" onmouseout="DropClass( this, \'highlight\' );" onclick="PopCode._SetSectionValue( \''+fld.name+'\', \''+Collections[id][i]['value']+'\' );">' +
                Collections[id][i]['value'] + ' - ' + Collections[id][i]['label'] + '</DIV>';
        /*
        var opt = document.createElement( 'DIV' );
        opt.innerHTML = Collections[id][i]['value'] + ' - ' + Collections[id][i]['label'];
        opt.style.cursor = 'pointer';
        opt.style.backgroundColor = 'white';
        opt.style.border = '1px solid black';
        opt.onclick = 'PopCode._SetSectionValue(event)';
        sel.appendChild( opt );
        */
      }
      document.body.appendChild( sel );
      sel.innerHTML = html;
    };
  },
  _SetSectionValue : function( fldname, val )
  {
    with( PopCode )
    {
      Field.focus();
      Field.onfocus();
      document.PopCodeForm[fldname].value = val;
      document.body.removeChild( document.getElementById( 'PopCodeSelect' ) );
    };
  },
  _ParseCollections : function()
  {
    with( PopCode )
    {
      if( Scheme.root.items )
      {
        Collections = {};
        for( var i = 0; i< Scheme.root.items.item.length; i++ )
        {
          var section = Scheme.root.items.item[i]['section'];
          if( !Collections[section] )
            Collections[section] = new Array();
          Collections[section].push( {  value : Scheme.root.items.item[i]['value'],
                                        label : Scheme.root.items.item[i]['label'],
                                        desc  : Scheme.root.items.item[i]['desc'] } );
        }
      }
    };
  },
  _ParseFieldValue : function()
  {
    with( PopCode )
    {
      if( !Field.value ) return;
      var flditem = Field.value.split( Delimiter );
      if( Scheme.root.sections )
      {
        for ( var i = 0; i < Scheme.root.sections.section.length; i++ )
        {
          if( Scheme.root.sections.section[i]['type'] == 'text' && flditem.length )
          {
            var defval = flditem.shift();
            if( Scheme.root.sections.section[(i-1)] && Scheme.root.sections.section[(i-1)]['type'] == 'sequence' )
            {
              defval = defval.substring( Scheme.root.sections.section[(i-1)]['limit']['length'] );
            }
            if( Scheme.root.sections.section[(i+1)] && Scheme.root.sections.section[(i+1)]['type'] == 'sequence' )
            {
              defval = defval.substring( 0, ( defval.length - Scheme.root.sections.section[(i+1)]['limit']['length'] ) );
            }
            Scheme.root.sections.section[i]['default'] = defval;
          }
        }
      }
    };
  }
};var CGI = ( function()
{
  function RADIO_BUTTON( attr )
  {
    var field = document.createElement( 'SPAN' );
    var input = document.createElement( 'INPUT' );

    with( input )
    {
      type      = 'radio';
      name      = attr['name'];
      value     = attr['value'];
      id        = attr['id'];
    }
    if( attr['checked'] )
    {
      input.checked = 'true';
    }
    if( attr['onmouseup' ] )
    {
      input.addEventListener( 'mouseup', function(){ eval( attr['onmouseup'] ) }, true );
    }
    if( attr['onclick' ] )
    {
      input.addEventListener( 'click', function(){ eval( attr['onclick'] ) }, true );
    }
    field.appendChild( input );
    if( attr['label'] )
    {
      var label = document.createElement( 'LABEL' );
      label.id = 'lbl_' + attr['id'];
      label.htmlFor = attr['id'];
      label.innerHTML = attr['label'];
      if( attr['onmouseup' ] )
      {
        label.addEventListener( 'mouseup', function(){ eval( attr['onmouseup'] ) }, true );
      }
      if( attr['onclick' ] )
      {
        label.addEventListener( 'click', function(){ eval( attr['onclick'] ) }, true );
      }
      field.appendChild( label );
    }
    return( field );
  };

  function CHECKBOX( attr )
  {
    var field = document.createElement( 'SPAN' );
    var input = document.createElement( 'INPUT' );

    with( input )
    {
      type      = 'checkbox';
      name      = attr['name'];
      value     = attr['value'];
      id        = attr['id'];
    }
    if( attr['checked'] )
    {
      input.checked = 'true';
    }
    if( attr['onmouseup' ] )
    {
      input.addEventListener( 'click', function(){ eval( attr['onmouseup'] ) }, false );
    }
    field.appendChild( input );
    if( attr['label'] )
    {
      var label = document.createElement( 'LABEL' );
      label.htmlFor = attr['id'];
      label.innerHTML = attr['label'];
      field.appendChild( label );
    }
    return( field );
  };

  function TEXT_FIELD( attr )
  {
    var field = document.createElement( 'INPUT' );
    with( field )
    {
      type  = 'text';
      name  = attr['name'];
      id    = attr['id'];
      value = attr['value'];
      size  = attr['size'];
    }
    for ( var k in attr )
    {
      if( k.substring( 0,2 ) == 'on' )
      {
        field.addEventListener( k.substring( 2 ), function(){ eval( attr[k] ) }, true );
      }
    }
    return( field );
  };

  function BR()
  {
    return( document.createElement( 'BR' ) );
  };

  function SELECT_BOX( attr )
  {
    var field = document.createElement( 'SELECT' );
    with( field )
    {
      name  = attr['name'];
      id    = attr['id'];
    }
    for ( var k in attr )
    {
      if( k.substring( 0,2 ) == 'on' )
      {
        field.addEventListener( k.substring( 2 ), function(){ eval( attr[k] ) }, true );
      }
    }
    for( var i = 0; i < attr['options'].length; i++ )
    {
      var opt = document.createElement( 'OPTION' );
      opt.value = attr['options'][i][0];
      opt.innerHTML = attr['options'][i][1];
      if( attr['value'] && attr['value'] == opt.value )
      {
        opt.default = 1;
        field.selectedIndex = i;
      }
      field.add( opt );
    }
    return( field );
  };

  function TEXT_STRING( text )
  {
    var str = document.createTextNode( text );
    return( str );
  };

  return( { 'RADIO'     : RADIO_BUTTON,
            'CHECKBOX'  : CHECKBOX,
            'BR'        : BR,
            'TEXT'      : TEXT_FIELD,
            'SELECT'    : SELECT_BOX,
            'STRING'    : TEXT_STRING } );
})();

var Field_Interval = ( function()
{
  var pattern   = [];
  var duration  = [];
  function Open( inst ) // public function
  {
    var popup = document.getElementById( inst + '_window' );
    if( popup.style.display == 'block' )
    {
      popup.style.display = 'none';
      return;
    }

    popup.style.display = 'block';

    popup.innerHTML = '';
    var base  = document.getElementById( inst + '_value' );
    var temp  = base.value.split( ':' );
    pattern   = temp[0].split( ',' );
    duration  = ( temp[1] ) ? temp[1].split( ',' ) : 1;
    var div_control = document.createElement( 'div' );
    with( div_control )
    {
      className = 'field_interval_control';
    }

    var div_pattern = document.createElement( 'div' );
    with( div_pattern )
    {
      className = 'field_interval_pattern';
    }
    div_pattern.appendChild( BuildMenu( inst ) );
    div_pattern.appendChild( BuildSettings( inst ) );
    popup.appendChild( div_pattern );
    popup.appendChild( BuildDuration( inst ) );
  };

  function Close( id )
  {
    var popup = document.getElementById( inst + '_window' );
    popup.style.display = 'none';
  };

  function BuildMenu ( inst ) // private function
  {
    var menu = document.createElement( 'DIV' );
    with( menu )
    {
      className = 'field_interval_menu';
      id = inst + '_menu';
    }
    menu.appendChild( CGI.RADIO( { 'name'       : 'menu',
                                   'id'         : inst + '_menuo',
                                   'label'      : 'Once',
                                   'value'      : 'o',
                                   'checked'    : (( pattern[0] == 'o' ) ? true : false ),
                                   'onmouseup'  : 'Field_Interval.Menu( this );'  } ) );
    menu.appendChild( CGI.BR() );
    menu.appendChild( CGI.RADIO( { 'name'       : 'menu',
                                   'id'         : inst + '_menut',
                                   'label'      : 'Time',
                                   'value'      : 't',
                                   'checked'    : (( pattern[0] == 't' ) ? true : false ),
                                   'onmouseup'  : 'Field_Interval.Menu( this );'  } ) );
    menu.appendChild( CGI.BR() );
    menu.appendChild( CGI.RADIO( { 'name'       : 'menu',
                                   'id'         : inst + '_menud',
                                   'label'      : 'Daily',
                                   'value'      : 'd',
                                   'checked'    : (( pattern[0] == 'd' ) ? true : false ),
                                   'onmouseup'  : 'Field_Interval.Menu( this );'  } ) );
    menu.appendChild( CGI.BR() );
    menu.appendChild( CGI.RADIO( { 'name'       : 'menu',
                                   'id'         : inst + '_menuw',
                                   'label'      : 'Weekly',
                                   'value'      : 'w',
                                   'checked'    : (( pattern[0] == 'w' ) ? true : false ),
                                   'onmouseup'  : 'Field_Interval.Menu( this );'  } ) );
    menu.appendChild( CGI.BR() );
    menu.appendChild( CGI.RADIO( { 'name'       : 'menu',
                                   'id'         : inst + '_menum',
                                   'label'      : 'Monthly',
                                   'value'      : 'm',
                                   'checked'    : (( pattern[0] == 'm' ) ? true : false ),
                                   'onmouseup'  : 'Field_Interval.Menu( this );'  } ) );
    menu.appendChild( CGI.BR() );
    menu.appendChild( CGI.RADIO( { 'name'       : 'menu',
                                   'id'         : inst + '_menuy',
                                   'label'      : 'Yearly',
                                   'value'      : 'y',
                                   'checked'    : (( pattern[0] == 'y' ) ? true : false ),
                                   'onmouseup'  : 'Field_Interval.Menu( this );'  } ) );
    return( menu );
  };

  function BuildSettings ( inst ) // private function
  {
    var form = document.createElement( 'DIV' );
    with( form )
    {
      className = 'field_interval_settings';
      innerHTML = '<center>No Settings Yet</center>';
      id = inst + '_settings';
    }

    if( pattern[0] )
    {
      form.innerHTML = '';
      switch ( pattern[0] )
      {
        case 'o' :
          form.innerHTML = BuildSettingsOnce( inst );
        break;
        case 't' :
          form.appendChild( BuildSettingsTime( inst ) );
        break;
        case 'd' :
          form.appendChild( BuildSettingsDaily( inst ) );
        break;
        case 'w' :
          form.appendChild( BuildSettingsWeekly( inst ) );
        break;
        case 'm' :
          form.appendChild( BuildSettingsMonthly( inst ) );
        break;
        case 'y' :
          form.appendChild( BuildSettingsYearly( inst ) );
        break;
      }
    }
    return( form );
  };

  function BuildDuration ( inst ) // private function
  {
    var dur = document.createElement( 'DIV' );
    with( dur )
    {
      className = 'field_interval_duration';
      id = inst + '_duration';
    }

    if( !duration[0] ) duration[0] = 1;

    var prm0 = CGI.RADIO({  'name'      : inst + '_duropt',
                            'id'        : inst + '_duropt1',
                            'checked'   : (( duration[0] == 1 ) ? true : false ),
                            'onclick'   : 'Field_Interval.Update( this );' });

    var prm1 = CGI.RADIO({  'name'      : inst + '_duropt',
                            'id'        : inst + '_duropt2',
                            'checked'   : (( duration[0] == 2 ) ? true : false ),
                            'onclick'   : 'Field_Interval.Update( this );' });

    var prm2 = CGI.RADIO({  'name'      : inst + '_duropt',
                            'id'        : inst + '_duropt3',
                            'checked'   : (( duration[0] == 3 ) ? true : false ),
                            'onclick'   : 'Field_Interval.Update( this );' });

    var prm11 = CGI.TEXT({  'name'     : inst + '_duropt2n',
                            'id'       : inst + '_duropt2n',
                            'size'     : '10',
                            'value'    : (( duration[0] == 2 ) ? duration[1] : 0 ),
                            'onkeyup' : 'Field_Interval.Update( this );' });

    var prm21 = CGI.TEXT({  'name'     : inst + '_duropt3d',
                            'id'       : inst + '_duropt3d',
                            'size'     : '10',
                            'value'    : (( duration[0] == 3 ) ? duration[1] : '' ),
                            'onblur'   : 'Field_Interval.Update( this );' });


    var table = document.createElement( 'TABLE' );

    var tr0  = table.insertRow(0);
    var td00 = tr0.insertCell(0);
        td00.appendChild( prm0 );
    var td01 = tr0.insertCell(1);
        td01.appendChild( CGI.STRING( FLD_LBL_INTERVAL_DUROPT1 ) );

    var tr1  = table.insertRow(1);
    var td10 = tr1.insertCell(0);
        td10.appendChild( prm1 );
    var td11 = tr1.insertCell(1);
        td11.appendChild( ParamStringToDom( FLD_LBL_INTERVAL_DUROPT2, prm11 ) );

    var tr2  = table.insertRow(2);
    var td20 = tr2.insertCell(0);
        td20.appendChild( prm2 );
    var td21 = tr2.insertCell(1);
        td21.appendChild( ParamStringToDom( FLD_LBL_INTERVAL_DUROPT3, prm21 ) );

    dur.appendChild( table );

    return( dur );
  };

  function Menu( fld ) // public function
  {
    if( fld.id.substring( 0, fld.id.indexOf( '_' ) ) == 'lbl' )
    {
      fld = document.getElementById( fld.id.substring( ( fld.id.indexOf( '_' ) + 1 ) ) );
    }
    var inst = fld.id.substring( 0, fld.id.lastIndexOf( '_' ) );
    var menu = fld.value;
    pattern = [menu];
    switch ( menu )
    {
      case 'o' :
        document.getElementById( inst + '_settings' ).innerHTML = BuildSettingsOnce( inst );
      break;
      case 't' :
        document.getElementById( inst + '_settings' ).innerHTML = '';
        document.getElementById( inst + '_settings' ).appendChild( BuildSettingsTime( inst ) );
      break;
      case 'd' :
        document.getElementById( inst + '_settings' ).innerHTML = '';
        document.getElementById( inst + '_settings' ).appendChild( BuildSettingsDaily( inst ) );
      break;
      case 'w' :
        document.getElementById( inst + '_settings' ).innerHTML = '';
        document.getElementById( inst + '_settings' ).appendChild( BuildSettingsWeekly( inst ) );
      break;
      case 'm' :
        document.getElementById( inst + '_settings' ).innerHTML = '';
        document.getElementById( inst + '_settings' ).appendChild( BuildSettingsMonthly( inst ) );
      break;
      case 'y' :
        document.getElementById( inst + '_settings' ).innerHTML = '';
        document.getElementById( inst + '_settings' ).appendChild( BuildSettingsYearly( inst ) );
      break;
    }
    Field_Interval.Update( fld );
  };

  function Update( fld, setval ) // public function
  {
    var inst = fld.id.substring( 0, fld.id.lastIndexOf( '_' ) );
    var name = fld.id.substring( ( fld.id.lastIndexOf( '_' ) + 1 ) );
    var text = '';
    switch ( pattern[0] )
    {
      case 'o':
        text += FLD_LBL_INTERVAL_ONCE;
      break;
      case 't':;
        if( !pattern[1] ) pattern[1] = 1;
        if( !pattern[2] ) pattern[2] = 0;
        if( name == 'hours' )
        {
          if( fld.value )
          {
            fld.value = parseInt( fld.value );
            if( !Is.Integer( fld.value ) )
            {
              fld.value = 1;
            }
            pattern[1] = fld.value;
          }
        }
        if( name == 'minutes' )
        {
          if( fld.value )
          {
            fld.value = parseInt( fld.value );
            if( !Is.Integer( fld.value ) )
            {
              fld.value = 1;
            }
            pattern[2] = fld.value;
          }
        }

        text += ParamString( FLD_LBL_INTERVAL_TIME, pattern[2], pattern[1] );
      break;
      case 'd':
        if( !pattern[1] ) pattern[1] = 1;
        if( name == 'days' )
        {
          if( fld.value )
          {
            fld.value = parseInt( fld.value );
            if( !Is.Integer( fld.value ) )
            {
              fld.value = 1;
            }
            pattern[1] = fld.value;
          }
        }
        text += ParamString( FLD_LBL_INTERVAL_DAYS, pattern[1] );
      break;
      case 'w':
        if( !pattern[1] ) pattern[1] = 1;
        if( !pattern[2] ) pattern[2] = '12345';
        if( name == 'weeks' )
        {
          if( fld.value )
          {
            fld.value = parseInt( fld.value );
            if( !Is.Integer( fld.value ) )
            {
              fld.value = 1;
            }
            pattern[1] = fld.value;
          }
        }
        if( name.substring( 0,3 ) == 'wkd' )
        {
          if( !fld.checked )
          {
            if( pattern[2].length > 1 )
              pattern[2] = pattern[2].replace( fld.value, '' );
          }
          else
          {
            var tmp = pattern[2].split('');
            if( ! ArrayHas( tmp, fld.value ) )
            {
                tmp.push( fld.value );
                tmp = tmp.sort();
            }
            pattern[2] = tmp.join('');
          }
        }
        var days = pattern[2].split('');
        for( var di = 0; di < days.length; di++ )
        {
          var chkbox = document.getElementById( inst + '_wkd' + days[di] );
          chkbox.checked = true;
          days[di] = Date.Weekdays.Long[days[di]];
        }
        text += ParamString( FLD_LBL_INTERVAL_WEEK, pattern[1], days.join( ', ' ) );
      break;
      case 'm':
        var opt = ( /mopt/.test( name ) ) ? name.substring( 4,5 ) : '1';
        pattern[1] = opt;
        pattern = pattern.slice( 0,2 );
        if( name == 'mopt1d' || name == 'mopt1m' || name == 'mopt2m' )
        {
          if( fld.value )
          {
            fld.value = parseInt( fld.value );
            if( !Is.Integer( fld.value ) )
            {
              fld.value = 1;
            }
          }
        }
        switch ( opt )
        {
          case '1':
            document.getElementById( inst + '_mopt1' ).checked = true;
            pattern[2] = ( Form.GetFieldValue ( document.getElementById( inst + '_mopt1d' ) ) ) ? Form.GetFieldValue ( document.getElementById( inst + '_mopt1d' ) ) : 1;
            pattern[3] = ( Form.GetFieldValue ( document.getElementById( inst + '_mopt1m' ) ) ) ? Form.GetFieldValue ( document.getElementById( inst + '_mopt1m' ) ) : 1;
            text += ParamString( FLD_LBL_INTERVAL_MONTHOPT1, pattern[2], pattern[3] );

          break;
          case '2':
            document.getElementById( inst + '_mopt2' ).checked = true;
            pattern[2] = Form.GetFieldValue ( document.getElementById( inst + '_mopt2c' ) );
            pattern[3] = Form.GetFieldValue ( document.getElementById( inst + '_mopt2d' ) );

            var count_fld = document.getElementById( inst + '_mopt2c' );
            var day_fld = document.getElementById( inst + '_mopt2d' );

            pattern[4] = ( Form.GetFieldValue ( document.getElementById( inst + '_mopt2m' ) ) ) ? Form.GetFieldValue ( document.getElementById( inst + '_mopt2m' ) ) : 1;
            text += ParamString( FLD_LBL_INTERVAL_MONTHOPT2, count_fld[count_fld.selectedIndex].text, day_fld[day_fld.selectedIndex].text, pattern[4] );
          break;
        }
      break;
      case 'y':
        var opt = ( /yopt/.test( name ) ) ? name.substring( 4,5 ) : '1';
        pattern[1] = opt;
        pattern = pattern.slice( 0,2 );
        if( name == 'yopt1d' )
        {
          if( fld.value )
          {
            fld.value = parseInt( fld.value );
            if( !Is.Integer( fld.value ) )
            {
              fld.value = 1;
            }
          }
        }
        switch ( opt )
        {
          case '1':
            document.getElementById( inst + '_yopt1' ).checked = true;
            pattern[2] = Form.GetFieldValue ( document.getElementById( inst + '_yopt1m' ) );
            var month_fld = document.getElementById( inst + '_yopt1m' );
            pattern[3] = ( Form.GetFieldValue ( document.getElementById( inst + '_yopt1d' ) ) ) ? Form.GetFieldValue ( document.getElementById( inst + '_yopt1d' ) ) : 1;
            text += ParamString( FLD_LBL_INTERVAL_YEAROPT1, month_fld[month_fld.selectedIndex].text, pattern[3]);
          break;
          case '2':
            document.getElementById( inst + '_yopt2' ).checked = true;
            pattern[2] = Form.GetFieldValue ( document.getElementById( inst + '_yopt2c' ) );
            pattern[3] = Form.GetFieldValue ( document.getElementById( inst + '_yopt2d' ) );
            pattern[4] = Form.GetFieldValue ( document.getElementById( inst + '_yopt2m' ) );
            var count_fld = document.getElementById( inst + '_yopt2c' );
            var day_fld = document.getElementById( inst + '_yopt2d' );
            var month_fld = document.getElementById( inst + '_yopt2m' );
            text += ParamString( FLD_LBL_INTERVAL_YEAROPT2, count_fld[count_fld.selectedIndex].text, day_fld[day_fld.selectedIndex].text, month_fld[month_fld.selectedIndex].text );
          break;
        }
      break;
    }

    var duropt1 = document.getElementById( inst + '_duropt1' );
    if( duropt1.checked )
    {
      duration = [ 1 ];
      text += ' ' + FLD_LBL_INTERVAL_DUROPT1;
    }
    var duropt2 = document.getElementById( inst + '_duropt2' );
    if( duropt2.checked )
    {
      duration[0] = 2;
      if( Form.GetFieldValue ( document.getElementById( inst + '_duropt2n' ) ) )
      {
        if( !Is.Integer( Form.GetFieldValue ( document.getElementById( inst + '_duropt2n' ) ) ) )
        {
          Form.SetFieldValue ( document.getElementById( inst + '_duropt2n' ), 1 );
        }
        else
        {
          Form.SetFieldValue ( document.getElementById( inst + '_duropt2n' ), parseInt( Form.GetFieldValue ( document.getElementById( inst + '_duropt2n' ) ) ) );
        }
        duration[1] = Form.GetFieldValue ( document.getElementById( inst + '_duropt2n' ) );
      }

      text += ' ' + ParamString( FLD_LBL_INTERVAL_DUROPT2, duration[1] );
    }
    var duropt3 = document.getElementById( inst + '_duropt3' );
    if( duropt3.checked )
    {
      duration[0] = 3;
      var date = Form.GetFieldValue ( document.getElementById( inst + '_duropt3d' ) );
      if( date && Is.Date( date ) )
      {
        date = Date.Parse( date ).Format( 'Y-m-d' );
      }
      else
      {
        date = new Date().Format( 'Y-m-d' );
        Form.SetFieldValue( document.getElementById( inst + '_duropt3d' ), date );
      }
      duration[1] = date;
      text += ' ' + ParamString( FLD_LBL_INTERVAL_DUROPT3, duration[1] );
    }

    var base = document.getElementById( inst + '_value' );
    var txtf = document.getElementById( inst + '_disp' );
        base.value = pattern.join(',') + ':' + duration.join(',');
        txtf.innerHTML = text;
  };

  function BuildSettingsOnce( inst ) // private function
  {
    return( FLD_LBL_INTERVAL_ONCE );
  };

  function BuildSettingsTime( inst ) // private function
  {
    var prm0 = CGI.TEXT({ 'name'     : inst + '_hours',
                          'id'       : inst + '_hours',
                          'size'     : '5',
                          'value'    : (( pattern[1] ) ? pattern[1] : 1 ),
                          'onkeyup' : 'Field_Interval.Update( this );' });

    var prm1 = CGI.TEXT({ 'name'     : inst + '_minutes',
                          'id'       : inst + '_minutes',
                          'size'     : '5',
                          'value'    : (( pattern[2] ) ? pattern[2] : 0 ),
                          'onkeyup' : 'Field_Interval.Update( this );' });

    return( ParamStringToDom( FLD_LBL_INTERVAL_TIME, prm1, prm0 ) );
  };

  function BuildSettingsDaily( inst ) // private function
  {
    var prm0 = CGI.TEXT({ 'name'     : inst + '_days',
                          'id'       : inst + '_days',
                          'size'     : '10',
                          'value'    : (( pattern[1] ) ? pattern[1] : 1 ),
                          'onkeyup' : 'Field_Interval.Update( this );' });

    return( ParamStringToDom( FLD_LBL_INTERVAL_DAYS, prm0 ) );
  };

  function BuildSettingsWeekly( inst ) // private function
  {
    var prm0 = CGI.TEXT({ 'name'     : inst + '_weeks',
                          'id'       : inst + '_weeks',
                          'size'     : '10',
                          'value'    : (( pattern[1] ) ? pattern[1] : 1 ),
                          'onkeyup' : 'Field_Interval.Update( this );' });

    var prm1 = document.createElement( 'TABLE' );
    var tr1  = prm1.insertRow(0);
    var td10 = tr1.insertCell(0);
        td10.appendChild( CGI.CHECKBOX({  'name'      : inst + '_wkd0',
                                          'id'        : inst + '_wkd0',
                                          'value'     : 0,
                                          'label'     : 'SU',
                                          'checked'   : (( pattern[2] ) ? ( pattern[2].match('0') ) ? true : false : false ),
                                          'onmouseup' : 'Field_Interval.Update( this );' }) );
    var td11 = tr1.insertCell(1);
        td11.appendChild( CGI.CHECKBOX({  'name'      : inst + '_wkd1',
                                          'id'        : inst + '_wkd1',
                                          'value'     : 1,
                                          'label'     : 'MO',
                                          'checked'   : (( pattern[2] ) ? ( pattern[2].match('1') ) ? true : false : true ),
                                          'onmouseup' : 'Field_Interval.Update( this );' }) );
    var td12 = tr1.insertCell(2);
        td12.appendChild( CGI.CHECKBOX({  'name'      : inst + '_wkd2',
                                          'id'        : inst + '_wkd2',
                                          'value'     : 2,
                                          'label'     : 'TU',
                                          'checked'   : (( pattern[2] ) ? ( pattern[2].match('2') ) ? true : false : true ),
                                          'onmouseup' : 'Field_Interval.Update( this );' }) );
    var td13 = tr1.insertCell(3);
        td13.appendChild( CGI.CHECKBOX({  'name'      : inst + '_wkd3',
                                          'id'        : inst + '_wkd3',
                                          'value'     : 3,
                                          'label'     : 'WE',
                                          'checked'   : (( pattern[2] ) ? ( pattern[2].match('3') ) ? true : false : true ),
                                          'onmouseup' : 'Field_Interval.Update( this );' }) );
    var td14 = tr1.insertCell(4);
        td14.appendChild( CGI.CHECKBOX({  'name'      : inst + '_wkd4',
                                          'id'        : inst + '_wkd4',
                                          'value'     : 4,
                                          'label'     : 'TH',
                                          'checked'   : (( pattern[2] ) ? ( pattern[2].match('4') ) ? true : false : true ),
                                          'onmouseup' : 'Field_Interval.Update( this );' }) );
    var td15 = tr1.insertCell(5);
        td15.appendChild( CGI.CHECKBOX({  'name'      : inst + '_wkd5',
                                          'id'        : inst + '_wkd5',
                                          'value'     : 5,
                                          'label'     : 'FR',
                                          'checked'   : (( pattern[2] ) ? ( pattern[2].match('5') ) ? true : false : true ),
                                          'onmouseup' : 'Field_Interval.Update( this );' }) );
    var td16 = tr1.insertCell(6);
        td16.appendChild( CGI.CHECKBOX({  'name'      : inst + '_wkd6',
                                          'id'        : inst + '_wkd6',
                                          'value'     : 6,
                                          'label'     : 'SA',
                                          'checked'   : (( pattern[2] ) ? ( pattern[2].match('6') ) ? true : false : false ),
                                          'onmouseup' : 'Field_Interval.Update( this );' }) );
    return( ParamStringToDom( FLD_LBL_INTERVAL_WEEK, prm0, prm1 ) );
  };

  function BuildSettingsMonthly( inst ) // private function
  {
    if( !pattern[1] ) pattern[1] = 1;

    var prm0 = CGI.RADIO({  'name'      : inst + '_mopt',
                            'id'        : inst + '_mopt1',
                            'checked'   : (( pattern[1] == 1 ) ? true : false ),
                            'onmouseup' : 'Field_Interval.Update( this );' });
    var prm1 = CGI.TEXT({   'name'     : inst + '_mopt1d',
                            'id'       : inst + '_mopt1d',
                            'size'     : '10',
                            'value'    : (( pattern[1] == 1 ) ? ( pattern[2] ) ? pattern[2] : 1 : 1 ),
                            'onkeyup' : 'Field_Interval.Update( this );' });
    var prm2 = CGI.TEXT({   'name'     : inst + '_mopt1m',
                            'id'       : inst + '_mopt1m',
                            'size'     : '10',
                            'value'    : (( pattern[1] == 1 ) ? ( pattern[3] ) ? pattern[3] : 1 : 1 ),
                            'onkeyup' : 'Field_Interval.Update( this );' });

    var prm4 = CGI.RADIO({  'name'      : inst + '_mopt',
                            'id'        : inst + '_mopt2',
                            'checked'   : (( pattern[1] == 2 ) ? true : false ),
                            'onmouseup' : 'Field_Interval.Update( this );' });
    var prm5 = CGI.SELECT({ 'name'     : inst + '_mopt2c',
                            'id'       : inst + '_mopt2c',
                            'options'  : _GetOrdOptions(),
                            'value'    : (( pattern[1] == 2 ) ? ( pattern[2] ) ? pattern[2] : 1 : 1 ),
                            'onchange' : 'Field_Interval.Update( this );' });
    var prm6 = CGI.SELECT({ 'name'     : inst + '_mopt2d',
                            'id'       : inst + '_mopt2d',
                            'options'  : _GetDayOptions(),
                            'value'    : (( pattern[1] == 2 ) ? ( pattern[3] ) ? pattern[3] : 1 : 1 ),
                            'onchange' : 'Field_Interval.Update( this );' });
    var prm7 = CGI.TEXT({   'name'     : inst + '_mopt2m',
                            'id'       : inst + '_mopt2m',
                            'size'     : '10',
                            'value'    : (( pattern[1] == 2 ) ? ( pattern[4] ) ? pattern[4] : 1 : 1 ),
                            'onkeyup' : 'Field_Interval.Update( this );' });

    var table = document.createElement( 'TABLE' );
    var tr0   = table.insertRow(0);
    var tr1   = table.insertRow(1);
    var td00  = tr0.insertCell(0);
        td00.appendChild( prm0 );

    var td01  = tr0.insertCell(1);
        td01.appendChild( ParamStringToDom( FLD_LBL_INTERVAL_MONTHOPT1, prm1, prm2 ) );

    var td10  = tr1.insertCell(0);
        td10.appendChild( prm4 );

    var td11  = tr1.insertCell(1);
        td11.appendChild( ParamStringToDom( FLD_LBL_INTERVAL_MONTHOPT2, prm5, prm6, prm7 ) );

    return( table );
  };

  function BuildSettingsYearly( inst ) // private function
  {
    if( !pattern[1] ) pattern[1] = 1;
    var prm0 = CGI.RADIO({  'name'      : inst + '_yopt',
                            'id'        : inst + '_yopt1',
                            'checked'   : (( pattern[1] == 1 ) ? true : false ),
                            'onmouseup' : 'Field_Interval.Update( this );' });

    var prm1 = CGI.SELECT({ 'name'     : inst + '_yopt1m',
                            'id'       : inst + '_yopt1m',
                            'options'  : _GetMonthOptions(),
                            'value'    : (( pattern[1] == 1 ) ? ( pattern[2] ) ? pattern[2] : 1 : 1 ),
                            'onchange' : 'Field_Interval.Update( this );' });

    var prm2 = CGI.TEXT({   'name'     : inst + '_yopt1d',
                            'id'       : inst + '_yopt1d',
                            'size'     : '10',
                            'value'    : (( pattern[1] == 1 ) ? ( pattern[3] ) ? pattern[3] : 1 : 1 ),
                            'onkeyup' : 'Field_Interval.Update( this );' });

    var prm3 = CGI.RADIO({  'name'      : inst + '_yopt',
                            'id'        : inst + '_yopt2',
                            'checked'   : (( pattern[1] == 2 ) ? true : false ),
                            'onmouseup' : 'Field_Interval.Update( this );' });

    var prm4 = CGI.SELECT({ 'name'     : inst + '_yopt2c',
                            'id'       : inst + '_yopt2c',
                            'options'  : _GetOrdOptions(),
                            'value'    : (( pattern[1] == 2 ) ? ( pattern[2] ) ? pattern[2] : 1 : 1 ),
                            'onchange' : 'Field_Interval.Update( this );' });

    var prm5 = CGI.SELECT({ 'name'     : inst + '_yopt2d',
                            'id'       : inst + '_yopt2d',
                            'options'  : _GetDayOptions(),
                            'value'    : (( pattern[1] == 2 ) ? ( pattern[3] ) ? pattern[3] : 1 : 1 ),
                            'onchange' : 'Field_Interval.Update( this );' });

    var prm6 = CGI.SELECT({ 'name'     : inst + '_yopt2m',
                            'id'       : inst + '_yopt2m',
                            'options'  : _GetMonthOptions(),
                            'value'    : (( pattern[1] == 2 ) ? ( pattern[4] ) ? pattern[4] : 1 : 1 ),
                            'onchange' : 'Field_Interval.Update( this );' });

    var table = document.createElement( 'TABLE' );
    var tr0   = table.insertRow(0);
    var tr1   = table.insertRow(1);
    var td00  = tr0.insertCell(0);
        td00.appendChild( prm0 );

    var td01  = tr0.insertCell(1);
        td01.appendChild( ParamStringToDom( FLD_LBL_INTERVAL_YEAROPT1, prm1, prm2 ) );

    var td10  = tr1.insertCell(0);
        td10.appendChild( prm3 );

    var td11  = tr1.insertCell(1);
        td11.appendChild( ParamStringToDom( FLD_LBL_INTERVAL_YEAROPT2, prm4, prm5, prm6 ) );

    return( table );
  };

  function _GetMonthOptions()
  {
    var opt = [];
    for ( var i = 0; i < 12; i++ )
    {
      opt.push( [ ( i + 1 ), Date.Months.Long[ i ] ] );
    }
    return opt;
  };

  function _GetDayOptions()
  {
    var opt = [];
    for ( var i = 0; i < 7; i++ )
    {
      opt.push( [ i, Date.Weekdays.Long[ i ] ] );
    }
    opt.push( [ 7, 'day' ] );
    opt.push( [ 8, 'weekday' ] );
    return opt;
  };

  function _GetOrdOptions()
  {
    var opt = [];
    opt.push( [ '1', 'first' ] );
    opt.push( [ '2', 'second' ] );
    opt.push( [ '3', 'third' ] );
    opt.push( [ '4', 'fourth' ] );
    opt.push( [ 'l', 'last' ] );
    return opt;
  };

  return( { 'Open'    : Open,
            'Menu'    : Menu,
            'Close'   : Close,
            'Update'  : Update } );
})();


var Field_Interval_win = ( function()
{
  function Menu( fld )
  {
    var a = new AJAX();
    a.URL = URL.Page( 'AJAX', 'Cell', { 'cell' : 'FieldInterval', 'action' : 'GetSettings', 'menu' : fld.value, 'ctype' : 'text/xml' } );
    a.OnComplete = AjaxXMLResponse;
    a.Data = 'field_interval_settings';
    a.Send();
  };

  return( { 'Menu' : Menu } );
})();


function ParamStringToDom( s )
{
  var text = s + "";
  var div = document.createElement( 'DIV' );
  for( var i = 0;i < s.length; i++ )
  {
    if( text.indexOf( '%', i ) > i )
    {
      div.appendChild( CGI.STRING( text.substring( i, text.indexOf( '%', i ) ) ) );
      i = text.indexOf( '%', i ) - 1;
    }
    else if( text.indexOf( '%', i ) == i )
    {
      i++;
      var idx = parseInt( text.substring( i, ( i + 1 ) ) );
      if( arguments[idx + 1] )
      {
        div.appendChild( arguments[idx + 1] );
      }
      i++;
    }
    else
    {
      div.appendChild( CGI.STRING( text.substring( i ) ) );
      i = text.length;
    }
  }
  return div;
};var cell_correctiveaction =
{
  Save : function( formname )
  {
    var fm = eval( 'document.' + formname );
    if( !fm ) return;
    var params = Form.MakeGetURL( fm );
        params = NVP.Set( params, 'cell', 'CorrectiveAction' );
        params = NVP.Set( params, 'act', 'Save' );
    var a = new AJAX();
    a.URL = URL.Page( 'AJAX', 'Cell' );
    a.Method = 'POST';
    a.Params = params;
    a.OnComplete = function( oResponse, oData )
    {
      var fm = eval( 'document.' + oData );
      if( fm.window_id ) Dialog.Close( fm.window_id.value );
      else AjaxResponse( oResponse, fm.parentNode.id );

    };
    a.Data = formname;
    a.Busy = Busy.Run;
    if( fm.onsubmit() )
    {
      var ucount = 0;
      if( fm.UREF_USER )  ucount += parseInt( fm.UREF_USER.value );
      if( fm.UREF_ROLE )  ucount += parseInt( fm.UREF_ROLE.value );
      if( fm.UREF_GROUP ) ucount += parseInt( fm.UREF_GROUP.value );
      if( ucount > 0 ) a.Send();
      else
      {
        var obj = document.getElementById( 'cel_correctiveaction_edit_msg_mustassign' );
        alert( obj.innerHTML ); // 3062
      }
    }
  },
  CommentSave : function( formname, cacstatetypid )
  {
    var fm = eval( 'document.' + formname );
    if( !fm ) return;
    var params = Form.MakeGetURL( fm );
        params = NVP.Set( params, 'cell', 'CorrectiveAction' );
        params = NVP.Set( params, 'act', 'CommentSave' );
        params = NVP.Set( params, 'CACStateTypID', cacstatetypid );
    var a = new AJAX();
    a.URL = URL.Page( 'AJAX', 'Cell' );
    a.Method = 'POST';
    a.Params = params;
    a.OnComplete = function( oRequest, oData )
    {
      var fm = eval( 'document.' + oData );
      if( fm.window_id )
      {
        Dialog.Close( fm.window_id.value );
      }
      if( Widget ) Widget.Refresh( 'TaskList' );
    };
    a.Data = formname;
    a.Busy = Busy.Run;
    if( fm.onsubmit() )
    {
      a.Send();
    }
  },
  UpdateList : function( formname, status )
  {
    var fm = eval( 'document.' + formname );
    if( !fm ) return;
    var params = Form.MakeGetURL( fm );
        params = NVP.Set( params, 'cell', 'CorrectiveAction' );
        params = NVP.Set( params, 'act', 'List' );
        params = NVP.Set( params, 'ctype', 'text/xml' );
    if( status )
        params = NVP.Set( params, 'CASTATETYPID', status );
    if( status == 'all' )
        params = NVP.Set( params, 'CASTATETYPID', 0 );
    var a = new AJAX();
    a.URL = URL.Page( 'AJAX', 'Cell' );
    a.Method = 'POST';
    a.Params = params;
    a.OnComplete = function( oRequest, oData )
    {
      var fm = eval( 'document.' + oData );
      var obj = false;
      try
      {
        obj = DomNodeToObject( oRequest.responseXML );
      }
      catch ( err )
      {
        alert( err );
      }
      if( obj )
      {
        if( obj.root.html )
        {
          var div = fm.parentNode;
          if( div ) div.innerHTML = obj.root.html;
        }
      }
    };
    a.Data = formname;
    a.Send();
  }
};

this.scrollbar_timer = null;
this.scrollbar_id = null;

function scroll_left( id )
{
  if( !id ) id = this.scrollbar_id;
  if( !id ) return;
  if( id && ( id != this.scrollbar_id ) ) scroll_stop( id );
  var content = document.getElementById( id );
  if( !content ) return;
  content.style.left = ( parseInt( content.style.left ) + 300 ) + "px";
  this.scrollbar_timer = setTimeout( 'scroll_left()', 500 );
};

function scroll_stop()
{
  if( this.scrollbar_timer != null ) return;
  clearTimeout( this.scrollbar_timer );
  this.scrollbar_timer = null;
  this.scrollbar_id = null;
};

function scroll_right( id )
{
  if( !id ) id = this.scrollbar_id;
  if( !id ) return;
  if( id && ( id != this.scrollbar_id ) ) scroll_stop( id );
  var content = document.getElementById( id );
  if( !content ) return;
  content.style.left = ( parseInt( content.style.left ) - 300 ) + "px";
  this.scrollbar_timer = setTimeout( 'scroll_right()', 500 );
};
function login_loadnews( cid_value )
{
  var a = new AJAX();
  a.URL = URL.Page( 'Login', 'LoadNews', {ctype : 'text/xml', cid : cid_value } );
  a.Method = 'POST';
  a.OnComplete = function( oReturn, oData )
  {
    var div = document.getElementById( 'news_content' );
    if( div )
    {
      div.outerHTML = oReturn.response;
    }
  };
  a.Send();
};

function login_usereg( code )
{
  var fm = document.entryForm;
  var compid = 0;
  if( fm.cid )
	  compid = fm.cid.options[ fm.cid.selectedIndex ].value;

  var url = URL.Page( 'AJAX', 'Page', { page : 'Login', command : 'NewUser', CompID : compid, InviteCode : code } );
  PopUP.Create( url, '', Busy.Run );
};

function login_verifypassword()
{
  var fm = document.login_verifypassword_form;
  var bOK = document.login_verifypassword_form.onsubmit();
  if ( !bOK ) return;
  if( fm.NewUsrPassword.value != fm.NewUsrPassword.defaultValue )
  {
    fm.NewUsrPassword.value = CRC32STR( Format.Trim(fm.NewUsrPassword.value), true);
  }
  fm.submit();
};

function login_verifyemail()
{
  var fm = document.login_verifyemail_form;
  var bOK = document.login_verifyemail_form.onsubmit();
  if ( !bOK ) return;
  if( fm.UsrPassword.value )
  {
    fm.UsrPassword.value = CRC32STR( Format.Trim(fm.UsrPassword.value), true);
    fm.submit();
  }
};

function login_savereg( btn )
{
  var form = btn.form;
  var ok = ( !Form.CheckFields( [ [ form.UsrCompID, '!zero', 'Company :: Group' ], [form.txtCode, '!zero', 'Code' ], [form.txtCode, '=CodeValue', 'Code' ] ] ) );
  if( ok ) CheckLoginID( form.UsrLoginID );
  if( ok ) CheckEmailAddr( form.UsrEmailAddr );
  if( ok ) ok = form.onsubmit();
  if( !ok ) return;

  form.UsrPassword.value = CRC32STR( form.UsrPassword.value, true );

  var params = Form.MakeGetURL( form );
      params = NVP.Set( params, 'ctype', 'text/xml' );
  var a = new AJAX();
  a.URL = form.action;
  a.Params = params;
  a.Method = 'POST';
  a.OnComplete =
    function( oRequest, oData )
    {
        var obj = false;
        try
        {
          var obj = DomNodeToObject( oRequest.responseXML.documentElement );
        }
        catch( e )
        {
          alert( oRequest.responseText );
        }
        if( obj )
        {
          if( obj.error )
          {
            alert( obj.error );
            oData.UsrLoginID.value = '';
            oData.UsrPassword.value = '';
          }
          else
          {
            if( document.entryForm && document.entryForm.UsrLoginID )
            {
              PopUP.Destroy();
              if( document.entryForm.cid )
              {
                document.entryForm.cid.value = obj.cid;
              }
              document.entryForm.UsrLoginID.value = obj.uid;
              FillInfoBox( obj.msg );
            }
          }
        }
    };
  a.Busy = Busy.Run;
  a.Data = form;
  a.Send();
};

/*********************************************************/
function CheckLoginID( elem )
{
  if( ! elem.value.length )
  {
    var oSpn = document.getElementById( elem.name + '_response' );
        oSpn.innerHTML = '';
    return;
  }
  var a   = new AJAX();
  a.Async = false;
  a.URL   = URL.Page( 'AJAX', 'Page', { page: 'Login', command: 'CheckLoginAJAX',
                                        UsrLoginID: elem.value,
                                        UsrGrpID: elem.form.UsrCompID.value } );
  a.OnComplete = function( oRequest, oData )
  {
    var sCheck = parseInt( oRequest.responseText );
    var oSpn   = document.getElementById( oData.name + '_response' );
    if( !oSpn )
    {
      oData.form.checking_login.value = 0;
      return;
    }

    if( sCheck )
    {
      oSpn.style.color = 'black';
      oSpn.style.fontSize  = '10pt';
      oSpn.innerHTML = sValidResponse;
      oData.form.checking_login.value = 1;

      if( oData.form.UsrEmailAddr && oData.form.UsrEmailAddr.value == '' && Is.EmailAddress( oData.form.UsrLoginID.value ) )
      {
        oData.form.UsrEmailAddr.value = oData.form.UsrLoginID.value;
        oData.form.UsrEmailAddr.onblur();
      }

      return;
    }
    else
    {
      oSpn.style.color = 'red';
      oSpn.style.fontSize  = '12pt';
      oSpn.innerHTML = sInvalidResponse;
    }

    oData.form.checking_login.value = 0;
  };
  a.Data = elem;
  a.Send();
};

//#16231
/*********************************************************/
function CheckEmailAddr( elem )
{
  if( ! elem.value.length )
  {
    var oSpn = document.getElementById( elem.name + '_response' );
        oSpn.innerHTML = '';
    return;
  }
  var a   = new AJAX();
  a.Async = false;
  a.URL   = URL.Page( 'AJAX', 'Page', { page: 'Login', command: 'CheckEmailAJAX',
                                        UsrEmailAddr: elem.value,
                                        UsrGrpID: elem.form.UsrCompID.value } );
  a.OnComplete = function( oRequest, oData )
  {
    var sCheck = parseInt( oRequest.responseText );
    var oSpn   = document.getElementById( oData.name + '_response' );
    if( !oSpn )
    {
      oData.form.checking_email.value = 0;
      return;
    }

    if( sCheck )
    {
      oSpn.style.color = 'black';
      oSpn.style.fontSize  = '10pt';
      oSpn.innerHTML = sValidResponse;
      oData.form.checking_email.value = 1;

      if( oData.form.UsrLoginID && ( oData.form.UsrLoginID.defaultValue == '' || oData.form.UsrLoginID.defaultValue == oData.form.UsrLoginID.value ) )
      {
        oData.form.UsrLoginID.value = oData.form.UsrEmailAddr.value;
        oData.form.UsrLoginID.defaultValue = oData.form.UsrLoginID.value;
        oData.form.UsrLoginID.onblur();
      }

      return;
    }
    else
    {
      oSpn.style.color = 'red';
      oSpn.style.fontSize  = '12pt';
      oSpn.innerHTML = sInvalidResponse;
    }

    oData.form.checking_email.value = 0;
  };
  a.Data = elem;
  a.Send();
};

//#EMP-1249
/*********************************************************/
var DialogTitle = '';
function showForgotPasswordDialog()
{
  var page_url = URL.Page( 'Login', 'Dialog', {ctype : 'text/xml'} );
  Dialog.Init({title:ForgotPasswordDialogTitle, url: page_url, fitcontent:1, width: '500', height: '150', status: '', scrolling : 1 });
}
function resetPassword()
{
  var fm = document.getElementById('ForgotPasswordInput').form;
  var bok = !Form.CheckFields( [[ fm.ForgotPasswordInput, '!empty', ForgoPasswordValidationMessage ]] );
  if(bok)
    document.getElementById('ForgotPasswordInput').form.submit();
}
function AdjustMenuBar()
{
  var oDiv  = document.getElementById( 'dropmenu_frame' );
  var oDiv2 = document.getElementById( 'dropmenu_list' );

  if( !oDiv || !oDiv2 )
    return( false );

  var nHgt = GetStyle( oDiv2, 'height' );

  if( nHgt == 'auto' ) // IE
    nHgt = oDiv2.clientHeight + 'px';

  oDiv.style.height = nHgt;
};

var DropMenu =
{
  _current : null,
  _focused : 0,
  _timer   : null,

  Show : function( obj )
  {
    var ul = obj.querySelector( '.submenu' );

    // Sub menu -
    if( !ul )
      return;

    if( DropMenu._current )
    {
      if( DropMenu._current == ul )
        return;

      DropMenu._current.classList.add( 'hidden' );
    }

    // Show it
    if( ul.classList.contains( "hidden" ) )
      ul.classList.remove( 'hidden' );

    var rct = GetAbsolutePosition( obj );

    var pad = GetStyle( ul.parentNode, 'padding-bottom' );
    pad = ( !pad ) ? 0 : parseInt( pad );

	  if( Browser.IsIE() && parseFloat( Browser.GetVersion() ) < 8 )
      pad = -pad;

	  ul.style.top = ( rct.bottom + pad + 1 ) + "px";
    ul.style.left = rct.left - 1 + "px";
    ul.disabled = false;

    DropMenu._current = ul;
  },

  Event : function( e )
  {
    var evt = ( e ) ? e : window.event;
    var obj = ( evt.target ) ? evt.target : evt.srcElement;

    if( obj && obj.tagName.toLowerCase() != 'li' )
      obj = obj.parentNode;

    switch( evt.type )
    {
      case 'click':
        DropMenu.Show( obj );
        break;

      case 'mouseover':
        DropMenu._focused++;
        DropMenu.Show( obj );
        break;

      case 'mouseout':
        DropMenu._focused--;
        DropMenu.Close();
        break;
    }
  },

  Close : function( bRun )
  {
    if( !bRun )
      return setTimeout( "DropMenu.Close( 1 )", 1000 );

    clearTimeout( DropMenu._timer );

    if( DropMenu._focused <= 0 )
    {
      if( DropMenu._current )
      {
        DropMenu._current.classList.add( "hidden" );
        DropMenu._current.disabled = true;
        DropMenu._current = null;
        DropMenu._focused = 0;
      }

      return;
    }

    DropMenu._timer = setTimeout( "DropMenu.Close( 1 )", 1000 );
  }
};
AJAX.AppendToURL = "SESSIONID=MBO5671BC1F";
parent.defaultStatus = "Worker Management";
gbl_img_noimage = "https://worker.avetta.com/sys/images/scheme/noimage.gif?1561042754";
gbl_img_busy = "https://worker.avetta.com/site/images/scheme/busy.gif?1561042752";
dsp_tbl_width = "980";
sValidResponse = "Entry accepted";
sInvalidResponse = "Already in use. Please try again.";
sNoneSelected = "None selected";

gbl_msg_fileexterr = "Unsupported file type";
gbl_msg_fileexterrus = "Unsupported file type - this field accepts %0";

Is.sFreqDone = "Done";
Is.sFreqOnce = "Once";

Date.SIDate   = ( 0 ) ? true : false;
Date.DT_FMT   = "Y-m-d";
Date.TM_FMT   = "H:i";
Date.DTTM_FMT = "Y-m-d H:i";

FLD_LBL_INTERVAL_ONCE      = 'One Time';
FLD_LBL_INTERVAL_TIME      = 'Every %0 Minute(s) Every %1 Hour(s)';
FLD_LBL_INTERVAL_DAYS      = 'Every %0 Day(s)';
FLD_LBL_INTERVAL_WEEK      = 'Every %0 Week(s) on %1';
FLD_LBL_INTERVAL_MONTHOPT1 = 'Day %0 of every %1 month(s)';
FLD_LBL_INTERVAL_MONTHOPT2 = 'The %0 %1 of every %2 month(s)';
FLD_LBL_INTERVAL_YEAROPT1  = 'Every %0 %1';
FLD_LBL_INTERVAL_YEAROPT2  = 'Every %0 %1 of every %2';

FLD_LBL_INTERVAL_DUROPT1  = 'No End Date';
FLD_LBL_INTERVAL_DUROPT2  = 'End after %0 occurrences';
FLD_LBL_INTERVAL_DUROPT3  = 'End by %0';

Date.Weekdays.Short = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
Date.Weekdays.Long = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
Date.Weekdays.Init = true;
Date.Months.Short = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
Date.Months.Long = ["January","February","March","April","May","June","July","August","September","October","November","December"];
Date.Months.Init = true;

var bCHGLOG = false;
var bCHGLOGPROMPT = false;

// Variables from the client computer...
var dt = new Date();
Cookie.SetNVP( "MBO5.CLIENT", 'GMTOFFSET', ( -1 * dt.getTimezoneOffset() ) * 60, 60 * 24 * 30 );
Cookie.SetNVP( "MBO5.CLIENT", 'ISDST', ( dt.IsDST() ) ? 1 : 0 );
Cookie.SetNVP( "MBO5.CLIENT", 'HTML5', ( document.createElement( 'audio' ).play ) ? 1 : 0 );

if( parent.name == self.name && !self.name )
	self.name = "Login_Default";

try
{
	if( window.opener && !window.opener.closed && ( typeof( window.opener.Window ) != 'undefined' ) )
	{
		if( !ArrayHas( window.opener.Window._Collection, self ) )
			window.opener.Window._Collection.push( self );
	}
}
catch(e)
{
}

URL.BaseURL = "https://worker.avetta.com";
URL.sPage = 'index.pl';

AppInfo =
{
	User :
	{
		id : 0,
		code : "",
		first_name : "",
		last_name : "",
		email_addr : "",
		comp_id : 0,
		comp_code : "",
		comp_name : "System",
		is_new : 1,
		is_admin : 0,
		is_client : "",
		is_supplier : "",
		lang_id : 2,
		lang_title : "American English (en-US)"
	}
};

AppInfo.Page =
{
	name : "Login",
	command : "Default",
	is_new : 0
};
</script>
<script>function WindowOnLoad()
{
	login_loadnews(0);
	ForgotPasswordDialogTitle = 'Forgot your Password?';
	ForgoPasswordValidationMessage = 'Email or login id';
	SchemeImageList['hdr_close'] = 'https://worker.avetta.com/site/images/scheme/hdr_close.png?1561042752';
	SchemeImageList['hdr_min'] = 'https://worker.avetta.com/site/images/scheme/hdr_min.png?1561042752';
	SchemeImageList['resize'] = 'https://worker.avetta.com/sys/images/scheme/resize.gif?1561042754';
	SchemeImageList['screen'] = 'https://worker.avetta.com/sys/images/scheme/screen.gif?1561042754';
};
</script><div class="information-box" id="information_box">&nbsp;</div><div class="page-login page-container"><div class="page-header"><div class="app-header"><table><tbody><tr><td class="logo"><a href="https://worker.avetta.com/index.pl"><img class="logo" src="/sys/images/logos/avetta-logo.png" title="Worker Management"></a></td><td class="navigation"><table><tbody><tr><td></td></tr></tbody></table></td></tr></tbody></table></div></div><div class="page-body"><!-- ActionMenu: FALSE, Rows: 1, Cols: 2 -->
<div class="page-content"><div class="page-title">Login</div><div class="page-data"><div class="clearfix columns-mode"><div class="w3-col s12 m6"><div class="w3-row"><div class="cell cell-html w3-col w3-col s12" id="HTML"><div class="" id="HTML_header" style="background-image: url( https://worker.avetta.com/sys/images/scheme/hdr_line.png?1561042754 );"><span></span></div><div class="cell-body" id="HTML_body"><script>function FormOnSubmit( fm, cmd )
{
  if( !cmd )
    cmd = 'LOGIN';

  var bok = true;
  var changepwd = 0;

  switch( cmd.toUpperCase() )
  {
    case 'LOGIN':
      var fields =
      [
        [ fm.cid, '!zero', "Select Company" ],
        [ fm.UsrLoginID, '!empty', "Login ID" ],
        [ fm.UsrPassword, '!empty', "Password" ]
      ];

      // if have to change pw, make sure newpwd not empty
      if( changepwd )
      {
        fields.push(
          [ fm.newpwd, '!empty', "Password field must be completed" ],
          [ fm.verpwd, "!empty,newpwd!='',=newpwd", "Confirm Password", "New Password" ],
          [ fm.pwdhint, "&pwdhint.value!='',!~newpwd", "You need to change the Password Hint, it contains your Password." ]
          );
      }

      bok = !Form.CheckFields( fields );
      if( ( 0 == 1 ) && fm.UsrLoginID.value.length && fm.UsrPassword.value.length )
      {
        fm.cid.selectedIndex = 0;
      }
      else
      {
        if( bok && changepwd )
          fm.verpwd.value = fm.newpwd.value = CRC32STR( fm.newpwd.value, true );
      }

      break;
  }
  return( bok );
}
</script><form method="post" action="https://worker.avetta.com/index.pl?pg=Login&amp;cmd=Default" enctype="multipart/form-data" id="entryForm" name="entryForm" onsubmit="return( FormOnSubmit( this, &quot;LOGIN&quot; ) );"><input type="hidden" name="resetpwd" value="0"><table class="page_login"><tbody><tr><td><table><tbody><tr><td class="label required" style="width:100px;">Login ID</td><td><input type="text" name="UsrLoginID" size="30" maxlength="128"></td></tr><tr><td class="label required" style="width:100px;">Password</td><td><input type="password" name="UsrPassword" size="16" maxlength="16"></td></tr><tr><td colspan="2" style="text-align:center;"><input type="submit" value="Login"></td></tr></tbody></table></td></tr><tr><td><label><input type="checkbox" name="resetHP" value="1">Reset My Dashboard</label></td></tr><tr><td><div style="font-size: 100%"><a href="javascript:void(0);" onclick="showForgotPasswordDialog();">Forgot your Password?</a></div></td></tr><tr><td style="color:#E64126;"></td></tr><tr><td></td></tr><tr><td></td></tr></tbody></table>
</form></div></div></div></div><div class="w3-col s12 m6"><div class="w3-row"><div class="cell cell-html w3-col w3-col s12" id="HTML"><div class="" id="HTML_header" style="background-image: url( https://worker.avetta.com/sys/images/scheme/hdr_line.png?1561042754 );"><span></span></div><div class="cell-body" id="HTML_body"><div id="news_content"><p><strong>Loading notifications ...</strong></p><img src="https://worker.avetta.com/site/images/scheme/busy.gif?1561042752"></div></div></div></div></div></div></div></div></div><div class="page-footer"><div class="cell-footer"><br><table><tbody><tr><td><hr size="1"></td></tr><tr><td><a href="http://cloud.exxtend.com/OSI_Internal/Privacy_Policy_Master.pdf" target="_document">Privacy Policy</a> | <a href="http://cloud.exxtend.com/OSI_Internal/Terms_and_Conditions_Master.pdf" target="_document">Terms and Conditions</a></td></tr><tr><td><a href="javascript:void(0);" onclick="window.scrollTo(0,0);" title="Return To Top">Return To Top</a></td></tr><tr><td><address></address></td></tr><tr><td>version 05.00.04-94</td></tr></tbody></table></div></div></div>

</body></html>

                             

Screenshot: