﻿//oddefs.js

/*--
Copyright © 1998, 2009, Oracle and/or its affiliates.  All rights reserved.
--*/

//<!--Version 9.5.0.33-->

if (typeof(Gkod) == 'undefined' || !Gkod)
{
    var Gkod = {};
}

//System

if (typeof(Gkod.System) == 'undefined' || !Gkod.System)
{
    Gkod.System = {};
}

//FF3
Gkod.System.New = function()
{
    if (arguments.length > 0)
    {
        var c = arguments[0];
        var undefined;
        var o = {};
        var a = [];
        for (var i = 1; i < arguments.length; i++)
            a.push(arguments[i]);
        c.apply( o,a);
        if(c.prototype !== undefined) // Works with FF, Safari, Chrome
            o.__proto__ = c.prototype;
        return o;
    }
    
    return null;
}

Gkod.System.Reset = function()
{
    Gkod.Trace.Write(Gkod.Trace.ID.INFO, '[ODDEFS] : Gkod.System.Reset() ', 3);
    Gkod.Variables.Reset();
    Gkod.Application.Reset();
    Gkod.ctxinfo.reset();
    Gkod.ctxfunctions.reset();
}

Gkod.System.IsPopupBlocked = function()
{
    var popup = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no');
    var popUpsBlocked = true;
    if (popup)
    {
        popUpsBlocked = false;
        popup.close();
    }
    return popUpsBlocked;
}

//Gkod.Utility

if (typeof(Gkod.Utility) == 'undefined' || !Gkod.Utility)
{
    Gkod.Utility = {};
}

Gkod.Utility.IsIE = function()
{
    return navigator.appName.indexOf('Microsoft') > -1;
}

//Gkod.Trace

if (typeof(Gkod.Trace) == 'undefined' || !Gkod.Trace)
{
    Gkod.Trace = {};  
}

Gkod.Trace.ID =
{
    LOAD    : 'LOAD',
    CTX     : 'CTX',
    IDENT   : 'IDENT',
    IDENTU  : 'IDENTU',
    ERROR   : 'ERROR',
    INFO    : 'INFO',
    ODDEFS  : 'ODDEFS',
    ODCTX   : 'ODCTX',
    ODUT    : 'ODUT',
    GEN     : 'GEN',
    DEF     : 'DEF'
};

//Log in Firefox Firebug, or IE Webdeveloper2 console
Gkod.Trace.Log = function(text)
{
    if (typeof(window.console) == 'object' && typeof(window.console.log) == 'function')
    {
        window.console.log(text);
    }
}

//Log into TraceView
Gkod.Trace.Write2 = function(ids, msg)
{
    if (!Gkod.Utility.IsIE())
    {
        try
        {
            if('createEvent' in document)
            {
                var element = document.getElementById('ODTraceMessageId');
                if(!element)
                {
                    element = document.createElement('ODTraceMessage');
                    element.setAttribute('id', 'ODTraceMessageId');
                    document.documentElement.appendChild(element);
                }

                element.setAttribute('msg', msg);
                element.setAttribute('ids', ids);
                var ev = document.createEvent('Events');
                ev.initEvent('ODTraceEvent', true, false);
                element.dispatchEvent(ev);
            }
        }
        catch(e){}
    }
    else
    {
        try
        {
            _ax_odtrace = new ActiveXObject('ODTraceCom.ODTrace');
            if(_ax_odtrace)
            {
                _ax_odtrace.Write(ids, msg);
            }
        }
        catch(e){}
    }

    Gkod.Trace.Log(msg);
}

if (typeof(Gkod.Trace.Dump) == 'undefined')
    Gkod.Trace.Dump = function(){}

if (typeof(Gkod.Trace.Warning) == 'undefined')
    Gkod.Trace.Warning = function(){}

if (typeof(Gkod.Trace.Error) == 'undefined')
    Gkod.Trace.Error = function(){}

if (typeof(Gkod.Trace.Write) == 'undefined')
    Gkod.Trace.Write = Gkod.Trace.Write2;

Gkod.Trace.Write(Gkod.Trace.ID.LOAD, '[ODDEFS] : oddefs.js is loaded into window.name = [' + window.name + '] URL = [' + window.location.href + ']', 3); 

Gkod.Modules =
{
    _modules : {},
    _validModules : {'oddefs' : true, 'odcontext' : true, 'odgatewaydefs' : true, 'odutilities' : true},
    _isValidModule : function(mod)
    {
        if (Gkod.Modules._validModules[mod] == true)
            return true;

        return false;
    },
    IsRegistered : function(mod)
    {
        //Gkod.Trace.Write(Gkod.Trace.ID.DEF, '[ODDEFS] : Gkod.Modules.IsRegistered = [' + mod + ']', 3);
        if (typeof(Gkod.Modules._modules[mod]) != 'undefined' && Gkod.Modules._modules[mod] == true)
            return true;

        return false;
    },
    Register : function(mod)
    {
        if (Gkod.Modules._isValidModule(mod))
        {
            Gkod.Modules._modules[mod] = true;
            Gkod.Trace.Write(Gkod.Trace.ID.DEF, '[ODDEFS] : Gkod.Modules.Registered = [' + mod + ']', 3);
        }
        else
        {
            //invalid module
        }
    },
    Remove : function(mod)
    {
        Gkod.Modules._modules[mod] = false;
    }
};

Gkod.Modules.Register('oddefs');

//Gkod.Context

if (typeof(Gkod.Context) == 'undefined' || !Gkod.Context)
{
    Gkod.Context = {};
}

Gkod.Context.ContextObject = function()
{
    this.contextid = ''; //ODCTX
    this.name = '';
    this.usenameasprefix = '1'; //ODCTXPREF
    this.caption = '';
    this.searchable = '1';
    this.generic = '0';
    this.ctxpostf = ''; //ODCTXPOSTF
    this.custom = '';
    this.weight = 0;
    this.limit = -1;
    
    this.copy = function()
    {
        var _t = Gkod.System.New(Gkod.Context.ContextObject);
        _t.contextid = this.contextid;
        _t.name = this.name;
        _t.usenameasprefix = this.usenameasprefix;
        _t.caption = this.caption;
        _t.searchable = this.searchable;
        _t.generic = this.generic;
        _t.ctxpostf = this.ctxpostf;
        _t.custom = this.custom;
        _t.weight = this.weight;
        _t.limit = this.limit;

        return _t;
    }
}

Gkod.Context.ExtendedContextObject = function()
{
    this._ctxid = []; //array of Gkod.Context.ContextObject
    this.extra = []; //ODEXTRA

    this.reset = function()
    {
        this._ctxid = [];
        this.appname = '';
        this.language = '';
        this.ctxex = '';
        this.ctxex2 = '';
        this.tocurl = '';
        this.gatewayurl = '';
        this.apphelpurl = '';
        this.priority = 0;
        this.modulename = '';
        this.extra = [];
        this.custom = '';
        this.reserved = '';
    }

    this.reset();

    this.setappname = function(_appname){ this.appname = _appname; };
    this.setlanguage = function(_language){ this.language = _language; };
    this.setctxex = function(_ctxex){ this.ctxex = _ctxex; };
    this.setctxex2 = function(_ctxex2){ this.ctxex2 = _ctxex2; };
    this.settocurl = function(_tocurl){ this.tocurl = _tocurl; };
    this.setapphelpurl = function(_apphelpurl){ this.apphelpurl = _apphelpurl; };
    this.setgatewayurl = function(_gatewayurl){ this.gatewayurl = _gatewayurl; };
    this.setpriority = function(_priority){ this.priority = _priority; };
    this.setmodulename = function(_modulename){ this.modulename = _modulename; };
    this.getappname = function(){ return this.appname; };
    this.getlanguage = function(){ return this.language; };
    this.getctxex = function(){ return this.ctxex; };
    this.getctxex2 = function(){ return this.ctxex2; };
    this.gettocurl = function(){ return this.tocurl; };
    this.getgatewayurl = function(){ return this.gatewayurl; };
    this.getapphelpurl = function(){ return this.apphelpurl; };
    this.getpriority = function(){ return this.priority; };
    this.getmodulename = function(){ return this.modulename; };

    this.copy = function()
    {
        var _t = Gkod.System.New(Gkod.Context.ExtendedContextObject);
        
        var _ctxid = [];
        for (var i = 0; i < this._ctxid.length; i++)
        {
            _ctxid.push(this._ctxid[i].copy());
        }
        _t._ctxid = _ctxid;
        _t.appname = this.appname;
        _t.language = this.language;
        _t.ctxex  = this.ctxex;
        _t.ctxex2  = this.ctxex2;
        _t.tocurl = this.tocurl;
        _t.gatewayurl =	this.gatewayurl;
        _t.apphelpurl = this.apphelpurl;
        _t.priority = this.priority;
        _t.modulename = this.modulename;
        _t.extra = this.extra;
        _t.custom = this.custom;
        _t.reserved = this.reserved;
        return _t;
    }
}

Gkod.Context.IsHiddenFrame = function(_obj)
{
    var _window = _obj || window;
    var bhidden = false;
    var l = 0, r = 0, t = 0, b = 0;

    try
    {
        if (Gkod.Utility.AccessGranted(_window))
        {
            var pcanvas = null;
            var mode = _window.document.compatMode;
            if (mode == 'CSS1Compat')
            {
                pcanvas = _window.document.documentElement;
            }
            else
            {
                pcanvas = _window.document.body;
            }
            if (pcanvas)
            {
                /* //NA in FF
                l = pcanvas.getBoundingClientRect().left;
                r = pcanvas.getBoundingClientRect().right;
                t = pcanvas.getBoundingClientRect().top;
                b = pcanvas.getBoundingClientRect().bottom;
                */
                l = pcanvas.offsetLeft;
                r = pcanvas.offsetLeft + pcanvas.offsetWidth;
                t = pcanvas.offsetTop;
                b = pcanvas.offsetTop + pcanvas.offsetHeight;
            }
        }
    }
    catch(e)
    {
        Gkod.Utility.OnError('Gkod.Context.IsHiddenFrame()', e);
    bhidden = true;
    }

    if (r*b == 0)
    {
        bhidden = true;
    }

    Gkod.Trace.Write(Gkod.Trace.ID.DEF, '[ODDEFS] : Gkod.Context.IsHiddenFrame() hidden=' + bhidden + ' window.name = [' + window.name + '] URL = [' + window.location.href + ']', 3); 
    return bhidden;
}

//Gkod.Variables

Gkod.Variables =
{
//odcustomurl.js
OD_URL                      : {},
OD_DEFAULT_URL              : '../../',
OD_APPLICATIONHELP_URL      : '',
OD_APPLICATION_URL          : '',    //URL of the application
OD_HEMIFRAMELOCATION        : 'topframe', //default, other value is 'bottomframe'
OD_APPLICATIONNAME          : 'STDHTML', //default
OD_EXTERNALAPPSCRIPTS       : [],
OD_TOCVIEW_ALL              : 0,

OD_ECIDTESTMODE             : false,
OD_SHOWHELPMODE             : 3,
//enum
_EMBEDDED_TOP               : 1,
_EMBEDDED_BOTTOM            : 2,
_LINK_GATEWAY               : 3,
_LINK_TOC                   : 4,

OD_GATEWAY                  : 'stdie_gateway.html',

//odbrand.js
OD_SHOWHELPTEXT             : 'Help',
OD_SHOWAPPLOGO              : 'large_logo.gif',
OD_BRAND                    : 'UPK',

//odstdcustomurl.js
OD_STANDARD_URL             : '',
OD_APPLICATIONDOMAIN        : '',
OD_CUSTOMERRORHTML          : 0, //set to 1, if odcustomerror.html is used
OD_APPLICATIONSCRIPTS_URL   : [],

//optional
OD_ENABLEMULTIPLEHITS       : 0,
OD_PRIORITY                 : 0, //default, no priority 

//odstdtest.js
OD_BUTTONCACHE       	    : 0,
OD_ENABLETRACE              : 0,
OD_TRACELEVEL               : 0,
OD_HEMIPARAMTEST            : 0,

//Generic
OD_ENABLESMARTMATCH         : 1, //generic is enabled by default
OD_GENERICAPPLICATION       : 0, //which application has generic context
OD_DISABLESMARTMATCH        : 0, //targeted apps can disable generic context
OD_GENERICAPPLICATIONNAME   : 'STDHTML', //default generic appname
OD_SMARTMATCH_URL           : '', //external generic content
OD_STRICTURLCHECK           : 0, //stop, if any of the OD_APPICATIONSCRIPTS_URL entries do not exist

//Messages
OD_HEMIMSG                  : ['Undefined error code'],
OD_ERROR                    : 0,

//stdhemiscripts.js
OD_EXTERNALSCRIPTS          : [],
OD_EXTERNALHEMISCRIPTS      : [], 

//Private
ODTARGET                    : window,
ODPREFIX                    : 'Gkod',
ODAPPLICATIONPREFIX         : 'Application',
ODCONTEXTFUNCTION           : 'GetContextID',   //default
ODAPPNAMEFUNCTION           : 'GetApplicationName',   //default
ODMODNAMEFUNCTION           : 'GetApplicationModuleName',   //default
ODAPPLANGUAGEFUNCTION       : 'GetApplicationLanguage',   //default
ODAPPHELPFUNCTION           : 'GetApplicationHelpURL',   //default, context sensitive help - param only
ODISOWNAPPLICATION          : 'IsOwnApplication',   //default
ODVERSION                   : '',

ODWINDOWS                   : [], //Array of Windows from the lib (xframe/xdomain scripting does not apply)

//Temp
_temp                       : '',

//Reserved, application specific, if not empty, do not use all ecid parts (WEBGUI, PORTAL)
OD_DESIGNATEDECIDPARTS      : '',

//Gateway URL parameters
ODCTXID                     : 'ODCTXID',
ODCTXPREF                   : 'ODCTXPREF',
ODCTXPOSTF                  : 'ODCTXPOSTF', //query expr 'APP$CTX'Z Z=postfix (SAP)
ODAPPNAME                   : 'ODAPPNAME',
ODAPPLANG                   : 'ODAPPLANG',
ODAPPHELP                   : 'ODAPPHELP',
ODCTXEX                     : 'ODCTXEX',
ODTOCURL                    : 'ODTOCURL',
ODEXTRA                     : 'ODEXTRA', //extra info, test params (SAP)
ODCUSTOM                    : 'ODCUSTOM', //custom odcustomurl.js (SAP)
ODRESERVED                  : 'ODRESERVED', //reserved
ODOPENTOC                   : 'ODOPENTOC', //default, other value is 'replace' - sapgui hack (cannot close browser window in FF)
ODSEP                       : ';'
};

Gkod.Variables.FunctionObject = function(appname, contextid, modname, applang, apphelp)
{
    this.Reset = function()
    {
        this.getapplicationname = Gkod.Variables.ODAPPNAMEFUNCTION;
        this.getcontextid = Gkod.Variables.ODCONTEXTFUNCTION;
        this.getapplicationmodulename = Gkod.Variables.ODMODNAMEFUNCTION;
        this.getapplicationlanguage = Gkod.Variables.ODAPPLANGUAGEFUNCTION;
        this.getapplicationhelpurl = Gkod.Variables.ODAPPHELPFUNCTION;
    }

    this.Set = function(appname, contextid, modname, applang, apphelp)
    {
        if (typeof(appname) != 'undefined' && appname != '')
            this.getapplicationname = appname;
        if (typeof(contextid) != 'undefined' && contextid != '')
            this.getcontextid = contextid;
        if (typeof(modname) != 'undefined' && modname != '')
            this.getapplicationmodulename = modname;
        if (typeof(applang) != 'undefined' && applang != '')
            this.getapplicationlanguage = applang;
        if (typeof(apphelp) != 'undefined' && apphelp != '')
            this.getapplicationhelpurl = apphelp;
    }
    this.setappname = function(appname) { this.getapplicationname = appname; }
    this.setcontextid = function(contextid) { this.getcontextid = contextid; }
    this.setmodname = function(modname) { this.getapplicationmodulename = modname; }
    this.setapplang = function(applang) { this.getapplicationlanguage = applang; }
    this.setapphelp = function(apphelp) { this.getapplicationhelpurl = apphelp; }
    
    this.Reset();
    this.Set(appname, contextid, modname, applang, apphelp);    
}

//Gkod.Application

if (typeof(Gkod.Application) == 'undefined' || !Gkod.Application)
{
    Gkod.Application = {};
}

Gkod.Application.SetWindowList = function(list)
{
    Gkod.Trace.Write(Gkod.Trace.ID.ODDEFS, '[ODDEFS] : SetWindowList() - list.length = ' + list.length, 3);
/*
    for (var i = 0; i < list.length; i++)
    {
        Gkod.Trace.Write(Gkod.Trace.ID.ODDEFS, '[ODDEFS] : SetWindowList[' + i + '] name = [' + list[i].name + '] URL = [' + list[i].location.href + ']', 3);
    }
*/
    Gkod.Variables.ODWINDOWS = list;
}

//Works only in IE, FF does not know VBArray object
//Call it from C++, multi dimension array
Gkod.Application.ConvVBArrToJSArr = function(vbarray)
{
    //Gkod.Trace.Write('Gkod.Application.ConvVBArrToJSArr [' + vbarray.dimensions() + ']', 3);
    var ret = [];
    if (typeof(vbarray.getItem) != 'undefined')
    {
        for (var i = vbarray.lbound(); i <= vbarray.ubound(); i++)
        {
            var sub = vbarray.getItem(i);
            if (sub != null)
            {
                for (var j = 0; j < sub.length; j++)
                {
                    ret.push(sub[j]);
                }
            }
        }
    }
    return ret;
}

//Call it from C++, one dimension array
Gkod.Application.ConvVBArrToJSArr2 = function(vbarray)
{
    //Gkod.Trace.Write('Gkod.Application.ConvVBArrToJSArr2 [' + vbarray.dimensions() + ']', 3);
    return vbarray.toArray();
}

//Call it from C++
Gkod.Application.TypeOf = function(obj)
{
    return typeof(obj);
}

//Gkod.Utility, 2

Gkod.Utility.ShowOdHemiError = function(title, baseurl, errcode, errtype)
{
    Gkod.Trace.Write(Gkod.Trace.ID.INFO, '[ODDEFS] : Gkod.Utility.ShowOdHemiError() title = ' + title + ' baseurl = ' + baseurl + ' errcode=' + errcode + ' errtype=' + errtype, 3);
    if (baseurl.charAt(baseurl.length - 1) == '/')
        baseurl = baseurl.substring(0, baseurl.length - 1);

    var strFeatures = 'width=300,height=150,left='+(screen.availWidth-411)/2+',top='+(screen.availHeight-314)/2+ 
            ',resizable=0,toolbar=0,scrollbars=0,location=0,menubar=0';

    var isnumber = (parseInt(errcode) == errcode);
    if (!isnumber)
    {
        //debug window, bigger
        strFeatures = 'width=500,height=250,left='+(screen.availWidth-211)/2+',top='+(screen.availHeight-214)/2+ 
            ',resizable=0,toolbar=0,scrollbars=0,location=0,menubar=0';    
    }

    var dialogurl = '';
    if (Gkod.Variables.OD_CUSTOMERRORHTML == 1)
    {
        dialogurl = baseurl + '/odcustomerror.html';
    }
    else
    {
        dialogurl = baseurl + '/odcontenterror.html';
    }

    var newwin = window.open(dialogurl + '?errtitle=' + Gkod.Utility.Encode(title) + '&errcode=' + Gkod.Utility.Encode(errcode) + '&errtype=' + Gkod.Utility.Encode(errtype), '_odhemi_', strFeatures);
    if (newwin)
    {
        newwin.focus();        
    }
}

Gkod.Utility.IsObject = function(obj)
{
        return ((typeof(obj) == 'object' || Gkod.Utility.IsFunction(obj)) && obj != null);
}

Gkod.Utility.IsFunction = function(obj) 
{
        return (typeof(obj) == 'function');
}

Gkod.Utility.IsArray = function(obj) 
{ 
    // frames lose type, so test constructor string
    if (obj == null)
        return false;
    if (obj.constructor && obj.constructor.toString().indexOf('Array') > -1)
    {
        return true;
    }
    else
    {
        return (Gkod.Utility.IsObject(obj) && obj.constructor == Array);
    }
}

Gkod.Utility.IsString = function(obj)
{
    return (typeof(obj) == 'string');
}

Gkod.Utility.WriteScript = function(obj, src)
{
    var headID = obj.document.getElementsByTagName('head')[0];
    var newScript = obj.document.createElement('script');
    newScript.type = 'text/javascript';
    newScript.src = src;
    headID.appendChild(newScript);
}

Gkod.Utility.LoadScript = function(obj, src)
{
    var s1 = 'void(z=document.getElementsByTagName(\'head\')[0].appendChild(document.createElement(\'script\')));';
    var s2 = 'void(z.language=\'javascript\');';
    var s3 = 'void(z.type=\'text/javascript\');';
    var s4 = 'void(z.src=\'' + src + '\');';
    obj.eval(s1 + s2 + s3 + s4);
}

//calling execScript once on a window object causes the eval method magically to appear, if it was disappeared
Gkod.Utility.MakeSureEvalIsExist = function(obj)
{
    if (typeof(obj) == 'object' && typeof(obj.eval) == 'undefined')
    {
        if (typeof(obj.execScript) != 'undefined')
        {
            obj.execScript('null');
        }
    }
}

Gkod.Utility.AccessGranted = function(obj)
{
    //Gkod.Trace.Write(Gkod.Trace.ID.INFO, '[ODDEFS] : Gkod.Utility.AccessGranted()', 3);
    //Access denied error
    if (navigator.appName == 'Netscape')
    {
        try
        {
            if (typeof(obj) == 'object' && typeof(obj.document) == 'undefined')
                return false;
            //tyepof(obj.document) is 'object'
            var dummy = obj.document.URL;
        }
        catch(e)
        {
            //Access denied if exception occur
            return false;
        }
        return true;
    }
    else if (navigator.appName == 'Microsoft Internet Explorer')
    {
        if (typeof(obj) == 'object' && typeof(obj.document) != 'unknown')
            return true;
    }

    return false;
}

//Encode/Decode UTF8
Gkod.Utility.Encode = function (s)
{
//  return unescape(encodeURIComponent(s));
    return encodeURIComponent(s);
}

Gkod.Utility.Decode = function (s)
{
//  return decodeURIComponent(escape(s));
    return decodeURIComponent(s);
}

Gkod.Utility.OnError = function(text, e) 
{
    if (!Gkod.Utility.IsIE())
    {
        if (typeof(e) != 'undefined' && e != null)
            Gkod.Trace.Write(Gkod.Trace.ID.ERROR, '[ODDEFS] : Gkod.Utility.OnError(text, e) text = ' + text + ' error = ' + e, 2);
        else
            Gkod.Trace.Write(Gkod.Trace.ID.ERROR, '[ODDEFS] : Gkod.Utility.OnError(text, e) text = ' + text, 2);
    }
    else
    {
        if (typeof(e) != 'undefined' && e != null)
            Gkod.Trace.Write(Gkod.Trace.ID.ERROR, '[ODDEFS] : Gkod.Utility.OnError(text, e) text = ' + text + ' error = ' + e.description, 2);
        else
            Gkod.Trace.Write(Gkod.Trace.ID.ERROR, '[ODDEFS] : Gkod.Utility.OnError(text, e) text = ' + text, 2);
    }
}

//Gkod.Version

if (typeof(Gkod.Version) == 'undefined' || !Gkod.Version)
{
    Gkod.Version = {};
}

Gkod.Version.SetVersion = function(ver)
{
    Gkod.Variables.ODVERSION = ver;
}

Gkod.Version.GetVersion = function()
{
    return Gkod.Variables.ODVERSION;
}

Gkod.Variables.Reset = function()
{
    this.OD_URL = {};
    this.OD_DEFAULT_URL = '../../';
    this.OD_APPLICATIONHELP_URL = '';
    this.OD_APPLICATION_URL = '';
    this.OD_HEMIFRAMELOCATION = 'topframe';
    //this.OD_APPLICATIONNAME = 'STDHTML';
    //this.OD_EXTERNALAPPSCRIPTS = [{'src':'hemi/odcustomurl.js', 'type':'optional'}];
    this.OD_TOCVIEW_ALL = 0;
    this.OD_SHOWHELPMODE = 3;
    this.OD_GATEWAY = 'stdie_gateway.html';
    this.OD_SHOWHELPTEXT = 'Help';
    this.OD_SHOWAPPLOGO = 'large_logo.gif';
    this.OD_BRAND = 'UPK';
    this.OD_STANDARD_URL = '';
    this.OD_APPLICATIONDOMAIN = '';
    this.OD_CUSTOMERRORHTML = 0;
    //this.OD_APPLICATIONSCRIPTS_URL = [];
    this.OD_ENABLEMULTIPLEHITS = 0;
    this.OD_PRIORITY = 0;
    this.OD_BUTTONCACHE = 0;
    this.OD_ENABLETRACE = 0;
    this.OD_TRACELEVEL = 0;
    this.OD_HEMIPARAMTEST = 0;
    this.OD_ENABLESMARTMATCH = 1;
    this.OD_GENERICAPPLICATION = 0;
    this.OD_DISABLESMARTMATCH = 0;
    //this.OD_STRICTURLCHECK = 0;
    this.OD_GENERICAPPLICATIONNAME = 'STDHTML';
    this.OD_HEMIMSG = ['Undefined error code'];
    this.OD_ERROR = 0;
    //this.OD_EXTERNALSCRIPTS = [{'src':'../stdhemi/hemi/odstdcustomurl.js', 'type':'optional'}];
    //this.OD_EXTERNALHEMISCRIPTS = []; 

    this.ODTARGET = window;
    this.ODPREFIX = 'Gkod';
    this.ODAPPLICATIONPREFIX = 'Application';
    this.ODCONTEXTFUNCTION = 'GetContextID';
    this.ODAPPNAMEFUNCTION = 'GetApplicationName';
    this.ODMODNAMEFUNCTION = 'GetApplicationModuleName';
    this.ODAPPLANGUAGEFUNCTION = 'GetApplicationLanguage';
    this.ODAPPHELPFUNCTION = 'GetApplicationHelpURL';
    this.ODISOWNAPPLICATION = 'IsOwnApplication';
    //this.ODVERSION = '';
    this.ODWINDOWS = [];
    this._temp = '';
    this.OD_DESIGNATEDECIDPARTS = '';
}

Gkod.Application.Reset = function()
{
    Gkod.Application.IsOwnApplication = function()
    {
        /// <summary>This method returns whether the frame belongs to the application</summary> 
        return false;
    }

    Gkod.Application.GetContextID = function()
    {
        /// <summary>This method returns the context of the application</summary> 
        return [];
    }

    Gkod.Application.GetApplicationName = function()
    {
        /// <summary>This method returns the name of the application</summary> 
        return '';
    }

    Gkod.Application.GetApplicationLanguage = function()
    {
        /// <summary>This method returns the language code of the application</summary> 
        return '';
    }

    Gkod.Application.GetApplicationHelpURL = function()
    {
        /// <summary>This method returns the query string of the application's help system</summary> 
        return '';
    }
        //When there is more than one application needs the same application name, internal identifier only
    Gkod.Application.GetApplicationModuleName = function()
    {
        return Gkod.Application.GetApplicationName();
    }
}

Gkod.Application.Reset();

//Initialization, create default context object
Gkod.ctxinfo = Gkod.System.New(Gkod.Context.ExtendedContextObject);
Gkod.ctxfunctions = Gkod.System.New(Gkod.Variables.FunctionObject);
Gkod.Version.SetVersion('3.0');

Gkod.Variables.OD_EXTERNALHEMISCRIPTS.push({'src':'hemi/stdhemiscripts.js', 'type':'required'});
Gkod.Variables.OD_EXTERNALSCRIPTS.push({'src':'../stdhemi/hemi/odstdcustomurl.js', 'type':'optional'});
Gkod.Variables.OD_EXTERNALSCRIPTS.push({'src':'../stdhemi/hemi/scripts/odgatewaydefs.js', 'type':'playback'});
Gkod.Variables.OD_EXTERNALSCRIPTS.push({'src':'../stdhemi/hemi/scripts/odcontext.js', 'type':'playback'});
Gkod.Variables.OD_EXTERNALSCRIPTS.push({'src':'../stdhemi/hemi/odstdtest.js', 'type':'optional'});
Gkod.Variables.OD_EXTERNALSCRIPTS.push({'src':'../stdhemi/tools/ondemandtrace.js', 'type':'optional'});
Gkod.Variables.OD_EXTERNALSCRIPTS.push({'src':'../stdhemi/hemi/scripts/escape.js', 'type':'playback'});
Gkod.Variables.OD_EXTERNALAPPSCRIPTS.push({'src':'hemi/odcustomurl.js', 'type':'optional'});

//FF3
window.Gkod = Gkod;

