if (typeof jmaki == "undefined") {
    var _globalScope = window;

    var jmaki = function() {

    /**
     * Map is a general map object for storing key value pairs
     *
     * @param mixin -
     *            default set of properties
     *
     */
    var Map = function(mixin) {

       var map = this;

       if (typeof mixin == 'undefined') {
           map = {};
       } else {
           map = mixin;
       }

       /**
        * Get a list of the keys to check
        */
       this.keys = function() {
           var o = {};
           var _keys = [];

           for (var _i in map){
               // make sure we don't return prototype properties.
               if (typeof o[_i] == 'undefined') {
                   _keys.push(_i);
               }
           }
           return _keys;
       };
       /**
        * Put stores the value in the table
        * @param key the index in the table where the value will be stored
        * @param value the value to be stored
        */
       this.put = function(key,value) {
           map[key] = value;
       };

       /**
        * Return the value stored in the table
        * @param key the index of the value to retrieve
        */
       this.get = function(key) {
           return map[key];
       };

       /**
        * Remove the value from the table
        * @param key the index of the value to be removed
        */
       this.remove =  function(key) {
           delete map[key];
       };
       /**
        *  Clear the table
        */
       this.clear = function() {
           map = {};
       };
   };

    var ctx = {
            version :"1.8.2",
            debugGlue :false,
            verboseDebug :false,
            debug :false,
            loaded : false,
            initialized :false,
            webRoot :"",
            resourcesRoot :"resources",
            preextensions : [],
            inspectDepth :2,
            publishToParent :false,
            displayErrorsInline :true,
            MSIE : /MSIE/i.test(navigator.userAgent),
            defaultLocale :"jmaki-en-us",
            // default locale for messages
            locale :"jmaki-en-us",
            defaultMessages : {
                "request_timeout" :"Request for {0} timed out.",
                "invalid_json" :"Invalid JSON.",
                "publish_function_not_found" :"Publish Error : function {0} not found on object {1}",
                "publish_object_not_found" :"Publish Error :  Object not found: {0}",
                "publish_match" :"<span style='color:green'>Subscribe Match :</span> : Topic: {0} listener {1}",
                "publish" :"<span style='color:red'>Publish </span> : Topic: {0} message {1}",
                "subscribe_handler_required" :"Subscribe Error : Handler required for subscriber {0}.",
                "subscribe_topic_required" :"Subscribe Error : topic or topicRegExp required for {0}.",
                "ajax_url_required" :"doAjax error: url required.",
                "ajax_error" :"jMaki.doAjax Error: {0}",
                "ajax_request_open_error" :"doAjax error making request: {0}",
                "ajax_send_body_error" :"doAjax error sending body of request to {0}.",
                "ajax_server_error" :"doAjax error communicating with {0}. Server returned status code {1}.",
                "write_dynamic_script_error" :"Attempt to write a script that can not be dynamically load widget with  id {0}. Consider using the widget in an iframe.",
                "widget_constructor_not_found" :"Unable to find widget constructor for {0}.",
                "extension_constructor_not_found" :"Unable to find extension constructor for {0}.",
                "widget_instantiation_error" :"Unable to create an instance of {0}. Enable logging for more details.",
                "unknown" :"unknown",
                "widget_error" :"<span>Error loading {0} : id={1}<br>Script: {2} (line: {3}).<br>Message: {4}</span>",
                "jmaki_logger" :"jMaki Logger",
                "clear" :"Clear",
                "x_close" :"[X]",
                "clear_logger" :"Clear Logger",
                "hide_logger" :"Hide Logger",
                "more" :"[more]",
                "jmaki_version" :"jMaki Version : {0}",
                "unable_to_load_url" :"Unable to load URL {0}."
            },
            ajaxRequestQueue : [],
            timers : [],
            subs : [],
            widgets : [],
            counter : 0,
              dcontainers :  new Map(),
              extensions : new Map(),
              attributes : new Map()
        };

    var head;
    var body;

     var namespace = function(_path, target) {
         // get the top level object
         var paths = _path.split('.');
         var _obj = window[paths[0]];
         if (typeof _obj == "undefined") {
             window[paths[0]] = _obj = {};
         }
         for ( var ii = 1; ii < paths.length; ii++) {
             if (typeof _obj[paths[ii]] != "undefined") {
                 _obj = _obj[paths[ii]];
             } else {
                 _obj[paths[ii]] = {};
                 _obj = _obj[paths[ii]];
             }
         }
         // if object provided it becomes the last in the chain
         if (typeof target == 'object') {
             _obj = target;
         }
         return _obj;
     };


    var  messageFormat = function(_message, _args) {
        if (typeof _message != "undefined" &&  typeof _args != "undefined") {
            for (var i=0; i < _args.length; i++) {
                var rex = new RegExp("\\{" + i + "\\}", "g");
                _message =  _message.replace(rex, _args[i]);
            }
        }
        return _message;
    };

    var getMessage =  function(id, args) {
        var message = null;
        var lmessages;
        if (ctx.messages.get(ctx.locale)) {
            lmessages = ctx.messages.get(ctx.locale);
            // fallback
        } else {
            lmessages = ctx.messages.get(ctx.defaultLocale);
        }
        if (lmessages) {
            message = lmessages.get(id);
        }
        if (typeof args != "undefined" && message) {
            return messageFormat(message, args);
        }
        return message;
    };

    /*
     * Combination function that will do mixing in and extending depending on if
     * _par is an object or a function (constructor)
     *
     * @param _src is the source object
     * @param _par is the class or object to extend
     *
     */
     var  mixin = function(_src, _target, _override) {
        var o = false;
        if (typeof _override != "undefined") {
            o = _override;
        }
        for (var i in _src) {
            if (!_target[i] || o) {
                _target[i] = _src[i];
            }
        }
    };

     var genId = function() {
         return "jmk" + ctx.counter++;
     };

    var createElement = function(type) {
        return document.createElement(type);
    };

     function appendChild(_parent, _child) {
        if (_parent){
            _parent.appendChild(_child);
        }
    }

     var getElement = function(id) {
         return document.getElementById(id);
     };

     var log = function(text, level) {
        // cached messages until after the page has been created
        if (!ctx.initialized) {
            if (!ctx._messages) {ctx._messages = [];}
            ctx._messages.push({ text : text, level : level});
        }
        if (!ctx.debug ) { return;}
        var ld = getElement("jmakiLogger");
        var b = getElement("jmakiLoggerContent");
        if (!ld){
            ld = document.createElement("div");

            ld.id = 'jmakiLogger';
            var lds = ld.style;
            lds.border = "1px solid #000000";
            lds.fontSize = "12px";
            lds.position  = "absolute";
            lds.zIndex  = "999";
            lds.bottom = "0px";
            lds.background = "#65B2DB";
            lds.right ="0px";
            lds.width = "600px";
            lds.height = "300px";

            var tb = "<div  style='height: 14px; background : #000; color : white; font-size : 10px'>" +
                     "<div style='float:left;width:545px;text-align:center'>" +
                     getMessage("jmaki_logger") +
                     "</div><div style='right:0px,text-align:left'><a href='javascript:jmaki.clearLogger()' title='" +
                     getMessage("clear_logger") +
                     "' style='color:white;text-decoration:none'>[" +
                     getMessage("clear") +
                     "]</a> <a href='javascript:jmaki.hideLogger()' title='" +
                     getMessage("hide_logger") +
                      "' style='color:white;text-decoration:none'>" +
                      getMessage("x_close") +
                      "</a></div></div>";

            var tbE = createElement("div");
            tbE.innerHTML = tb;
            ld.appendChild(tbE);
            b = document.createElement("div");
            b.id ='jmakiLoggerContent';
            b.style.height = "286px";
            b.style.overflowY = "auto";
            ld.appendChild(b);

            if (body) {
              appendChild(body, ld);
            }
        }
        if (ctx.loaded && ld !== null) {ld.style.visibility = 'visible';}
        var lm = createElement("div");
        lm.style.clear = "both";
        if (text && text.length > 125 &&
            ctx.verboseDebug === false) {
            var lid = genId();
            var tn = createElement("div");
            appendChild(lm, tn);
            tn.innerHTML = "<div style='float:left;width:535px;height:12px;overflow:hidden'>" +  text.substring(0,135) + "</div><div style='float:left'>...&nbsp;</div><a id='" +  lid + "_href' href=\"javascript:jmaki.showLogMessage(\'" +
                           lid +  "\')\" style='text-decoration: none'><span id='" +
                           lid + "_link'>" + getMessage("more") + "</span></a>";
            var mn = createElement("div");
            mn.id = lid;
            mn.innerHTML = text;
            mn.style.margin = "5px";
            mn.style.background = "#FF9900";
            mn.style.display = "none";

            appendChild(lm, mn);
        } else {
            lm.innerHTML =  text;
        }
        if (b) {
            b.appendChild(lm);
        }
    };

    function addMessages(locale, _messages) {
        ctx.messages.put(locale, new Map(_messages));
    }

    var isDefined = function(_target) {
        return (typeof _target != "undefined");
    };

    var matchWildcard = function(pattern,topic) {

        var patpos = 0;
        var patlen = pattern.length;
        var strpos = 0;
        var strlen = topic.length;

        var i=0;
        var star = false;

        while (strpos+i<strlen) {
            if (patpos+i<patlen) {
                switch (pattern.charAt(patpos + i)) {
                case "?":
                    i++;
                    continue;
                case '*':
                    star = true;
                    strpos += i;
                    patpos += i;
                    do {
                        ++patpos;
                        if (patpos == patlen) {return true;}
                    } while (pattern.charAt(patpos) == '*');
                    i=0;
                    continue;
                }
                if (topic.charAt(strpos + i) != pattern.charAt(patpos + i)) {
                    if (!star) {return false;}
                    strpos++;
                    i=0;
                    continue;
                }
                i++;
            } else {
                if (!star) {return false;}
                strpos++;
                i=0;
            }
        }
        do {
            if (patpos + i == patlen) {return true;}
        } while(pattern.charAt(patpos + i++)=='*');
        return false;
    };

    /**
     *  Unsubscribe a listener
     *  @param _lis
     */
    function unsubscribe(_lis) {
        for (var _l=0; _l < ctx.subs.length;_l++ ) {
            if (ctx.subs[_l].id  == _lis.id) {
                ctx.subs.splice(_l,1);
                break;
            }
        }
    }

    /**
     * A function to cloning an object or array so that different references do not
     * end up with shared references.
     *
     * @param - t A single object or array
     *
     */
     var clone = function(t) {
        var _obj;
        if (t instanceof Array) {
            _obj = [];
            for (var _j=0;_j< t.length;_j++) {
                if (typeof t[_j] != "function") {
                    _obj.push(clone(t[_j]));
                }
            }
        } else if (t instanceof Object) {
            _obj = {};
            for (var _jj in t) {
                if (typeof t[_jj] != "function") {
                 _obj[_jj] = clone(t[_jj]);
                }
            }
        } else {
            _obj = t;
        }
        return _obj;
     };

    var inspect = function(_o, _inspectDepth, _currentDepth) {
        var _ind = ctx.inspectDepth;
        var _cd = 0;

        if (typeof _inspectDepth == "number"){
            _ind =_inspectDepth;
        }
        if (typeof _currentDepth != "undefined"){
            _cd = _currentDepth;
        }
        if (_cd >= _ind && _ind != -1) {
           if (typeof _o == "string") {
               return "'" + _o + "'";
           } else {
               return _o;
           }
        } else  {
            _cd++;
        }

        var _rs = [];
        if (typeof _o == "undefined") {
            return 'undefined';
        }
        if (_o instanceof Array) {
            for (var i=0; i < _o.length; i++) {
                _rs.push(inspect(_o[i],_ind,_cd));
            }
            return "[" +  _rs.join(" , ") + "]";
        } else if (typeof _o == "string") {
           return "'" + _o + "'";
        } else if (typeof _o == "number" ||  typeof _o == "boolean") {
           return _o;
        } else if (typeof _o == "object") {
            for (var _oi in _o) {
                    if (typeof _o[_oi] != "function") {
                        _rs.push(_oi  + " : " + inspect(_o[_oi],_ind,_cd));
                    }
            }
            if (_rs.length > 0) {
                 return "{" + _rs.join(" , ") + "}";
            }
            else {
                return "{}";
            }
        } else {
            return _o;
        }
    };

    var findObject = function(_path) {
        var paths = _path.split('.');
        var found = false;
        var _obj = window[paths[0]];
        if (_obj && paths.length == 1) {
            found = true;
        }
        if (typeof _obj != "undefined"){
            for (var ii =1; ii < paths.length; ii++) {
                var _lp = paths[ii];
                if (_lp.indexOf('()') != -1){
                  var _ns = _lp.split('()');
                  if (typeof _obj[_ns[0]] == 'function'){
                      var _fn = _obj[_ns[0]];
                      return _fn.call(window);
                  }
                }
                if (typeof _obj[_lp] != "undefined") {
                    _obj = _obj[_lp];
                    found = true;
                } else {
                    found = false;
                    break;
                }
            }
            if (found) {
                return _obj;
            }
        }
        return null;
    };

    /**
     *  All for a filter to be applied to a dataset
     *  @param input - An object you wish to filter
     *  @param filter a string representing the path to the object or
     *    a function reference to procress the input
     */
    var filter = function(input, filter){
        if (typeof filter == 'string') {
            var h = findObject(filter);
            return h.call(window,input);
        } else if (typeof filter == 'function'){
            return filter.call(window, input);
        }
        return null;
    };

    var trim = function(t) {
        return  t.replace(/^\s+|\s+$/g, "");
    };

    /**
     *  Publish an event to a topic
     *  @param name Name of the topic to be published to
     *  @param args Palyoad of the publish
     *  @param bubbleDown Sends events down to children if set
     *  @param bubbleUp Sends event to parent contexts if they contain jmaki object and current context created by jmaki
     */
    var publish = function(name, args, bubbleDown, bubbleUp) {
        if (typeof name == "undefined" || typeof args == "undefined"){
            return false;
        }
        if (ctx.debugGlue) {
            log(getMessage("publish",  [name , inspect(args)]));
        }

        // check the glue for listeners
        if (ctx.subs){
            for (var _l=0; _l < ctx.subs.length;_l++ ) {
                var _listener = ctx.subs[_l];
                     if ((_listener.topic instanceof RegExp &&
                          _listener.topic.test(name))  ||
                           _listener.topic == name   ||
                          (typeof _listener.topic.charAt == 'function' &&
                       matchWildcard(_listener.topic,name))
                   ) {

                    // set the topic on payload
                    args.topic = name;
                    if (ctx.debugGlue) {
                        var _vname = name;
                        if (_listener.topicString) {
                            _vname = _listener.topicString;
                        }
                        log(getMessage("publish_match", [_vname, _listener]));
                    }
                    if (_listener.action == 'call' && _listener.target) {
                        // get the top level object
                        var Obj;
                        var myo = 'undefined';
                        if (_listener.target.functionName) {
                            Obj = findObject(_listener.target.object);
                            // create an instance of the object if needed.
                            if (typeof _obj == 'function') {
                                myo = new Obj();
                            } else if (Obj) {
                                myo = Obj;
                            } else {
                              log(getMessage("publish_function_not_found",
                                   [_listener.target.functionName,_listener.target.object]));
                            }
                            if (typeof myo != "undefined" &&
                                typeof myo[_listener.target.functionName] == 'function'){
                                myo[_listener.target.functionName].call(window,args);
                            } else {
                                   log(getMessage("publish_object_not_found",
                                        [_listener.target.functionName,_listener.target.object]));
                            }
                        } else if (_listener.target.functionHandler) {
                            _listener.target.functionHandler.call(window,args);
                        }
                    }
                } else if (ctx.subs[_l].action == 'forward') {
                    var _topics = ctx.subs[_l].topics;
                    // now multiplex the event
                    for (var ti = 0; ti < _topics.length; ti++){
                        // don't cause a recursive loop if the topic is this one
                        if (_topics[ti] != name) {
                            publish(_topics[ti], args);
                        }
                    }
                }
            }
        }
        // publish to subframes with a global context appended
        var bd = true;
        if (typeof bubbleDown != "undefined"){
            bd = bubbleDown;
        }
        if (bd === true &&
            window.frames !== null &&
            window.frames.length > 0) {
            var _frames = ctx.dcontainers.keys();
            for (var i=0; i < _frames.length; i++){
              var _dc = ctx.dcontainers.get(_frames[i]);
              if (_dc.iframe && !_dc.externalDomain && window.frames[_dc.uuid + "_iframe"] && window.frames[_dc.uuid + "_iframe"].jmaki){
                  window.frames[_dc.uuid + "_iframe"].jmaki.publish("/global" + name, args, true, false);
              }
            }
        }
        //  publish to parent frame if we are a sub-frame. This will prevent duplicate events
        if (ctx.publishToParent){
            var bu = true;
            if (typeof bubbleUp != "undefined") {
                bu = bubbleUp;
            }
            if (bu && window.parent.jmaki){
                  window.parent.jmaki.publish("/global" + name, args, false, true);
            }
        }
        return true;
    };

    /*
     * Add a glue listener programatcially. following is an example.
     *
     *{topic : "/dojo/fisheye",action: "call", target: { object: "jmaki.dynamicfaces",functionName: "fishEyeValueUpdate"}}
     *   or
     * @param l as topic and
     * @param t as the target object path ending with a function
     */
    var subscribe = function(l, t) {
        if (!isDefined(l)) {
            return null;
        }
        // handle key word arguments
        var lis;
        if (typeof l == 'object' && !(l instanceof RegExp)) {
            if (l.topic){
                l.topic = trim(l.topic);
            }
            if (l.topicRegExp){
                l.topic = new RegExp(l.topicRegExp);
            }
            lis = l;
        // function binding
        } else if (typeof t == 'string'){
          lis = {};
          if (l.topicRegExp) {
              lis.topic = new RegExp(l.topicRegExp);
          } else {
              lis.topic = l;
          }
          lis.target = {};
          var _is = t.split('.');
          lis.action = "call";
          lis.target.functionName = _is.pop();
          lis.target.object = _is.join('.');
        // inline function
        } else if (typeof t == 'function') {
          lis = {};
          if (l.topicRegExp) {
              lis.topic =  new RegExp(l.topicRegExp);
          } else {
              lis.topic = l;
          }
          lis.target = {};
          lis.action = "call";
          lis.target.functionHandler = t;
        } else {
          log(getMessage("subscribe_handler_required", [l]));
        }
        if (isDefined(lis)){
            if (!isDefined(ctx.subs)) {
                ctx.subs = [];
            }
            if (!lis.id) {
                lis.id = genId();
            }
            if (lis.topic){
                lis.prototype = {};
                lis.prototype.toString = function() {
                    return inspect(this);
                };
                ctx.subs.push(lis);
            } else {
                log(getMessage("subscribe_topic_required", [l]));
                return null;
            }
            return lis;
        }
        return null;
    };

    var Timer = function(args, isCall) {
        var _src = this;
        this.args = args;
        var _target;

        this.processTopic = function() {
            for (var ti = 0; ti < args.topics.length; ti++){
                publish(args.topics[ti], {topic: args.topics[ti],
                type:'timer',
                src:_src,
                timeout: args.to});
            }
        };

        this.processCall = function() {
            if (!_target) {
             var  Obj = findObject(args.on);
                if (typeof Obj == 'function'){
                    _target = new Obj();
                } else if (typeof _obj == 'object'){
                    _target = Obj;
                }
            }
            if ((_target && typeof _target == 'object')) {
              if(typeof _target[args.fn] == 'function') {
                _target[args.fn]({type:'timer', src:_src, timeout: args.to});
              }
            }
        };

        this.run = function() {
            if (isCall) {
                _src.processCall();
            } else {
                _src.processTopic();
            }
            window.setTimeout(_src.run,args.to);
        };
    };


    /**
     *  Get the XMLHttpRequest object
     *
     *  Allow for config override to allow for older ActiveX XHR for local file
     *  System with IE7
     *
     */
    var getXHR = function () {
        if (window.XMLHttpRequest &&
             !( ctx.MSIE &&
                isDefined(ctx.config) &&
                typeof(ctx.config.forceActiveXXHR) == "boolean" &&
                ctx.config.forceActiveXXHR === true)) {
            return new window.XMLHttpRequest();
        } else if (window.ActiveXObject) {
            return new window.ActiveXObject("Microsoft.XMLHTTP");
        } else {
            return null;
        }
    };

    function handleAjaxError(_m, _r, args){
       if (args.onerror) {
             args.onerror(_m,_r);
           } else {
         log(getMessage("ajax_error", [_m]));
       }
    }

    var doAjax;
    var addLibraries;

    function updateAjaxQueue() {
        if (ctx.ajaxRequestQueue.length > 0) {
            doAjax(ctx.ajaxRequestQueue.pop());
        } else {
            ctx.processingAjax = false;
            if (isDefined(ctx._scriptQueue) &&
                ctx._scriptQueue.length > 0) {
                var _n = ctx._scriptQueue[0];
                ctx._scriptQueue.shift();
                addLibraries(_n);
            }
        }
    }

    /**
     * Load a set of libraries in order and call the callback function
     */
    addLibraries = function(_o, _cb, _inp, _cu) {

        var _libs;
        var _inprocess;
        var _cleanup = true;

        // check to see if anything is still processing and if not
        // call the callback
        var checkQueue = function() {
            if (_inprocess.keys().length === 0) {
                if (isDefined(_cb)){
                    setTimeout(function(){_cb();}, 0);
                }
                 _inprocess.clear();
                ctx.processingScripts = false;
                updateAjaxQueue();
            }
           return;
       };

        // overload the function to allow for object literals
        if (_o instanceof Array) {
             _libs = _o;
             _inprocess = _inp;
             _cleanup = _cu;
        } else {
            _libs = _o.libs;
            _cb = _o.callback;
            _inprocess = _o.inprocess;
            _cleanup = _o.cleanup;
        }
        // queue the request if there are scripts being loaded.
        // this prevents the 2 connections from being sucked up.
        if (!isDefined(_inprocess) && (ctx.processingScripts ||
            ctx.processingAjax)) {
            _inprocess = new Map();
            if (!isDefined(ctx._scriptQueue)) {
                ctx._scriptQueue =[];
            }
            ctx._scriptQueue.push({libs : _libs, callback : _cb, cleanup : _cleanup});
            return;
        } else if (!isDefined(_inprocess)) {
            ctx.processingScripts = true;
            _inprocess = new Map();
        }

        if (_libs.length <= 0) {
            checkQueue();
        }
        var _uuid = new Date().getMilliseconds();
        var _lib = _libs[_libs.length-1];
        var _s_uuid = "c_script_" + genId();

        var e = createElement("script");
        e.start = _uuid;
        e.id =  _s_uuid;
        head.appendChild(e);

        var se = getElement(_s_uuid);
        _inprocess.put(_s_uuid,_lib);
        var loadHandler = function (_id) {
            var _s = getElement(_id);
            // remove the script node
            if (_s  && !(isDefined(_cleanup) && _cleanup === false)){
                _s.parentNode.removeChild(_s);
            }
            _inprocess.remove(_id);
            if (_libs.length-1 > 0) {
                _libs.pop();
                addLibraries({ libs : _libs, callback : _cb, inprocess : _inprocess, cleanup : _cleanup});
            }
            checkQueue();
        };

        // wait for the script to be loaded
        if (ctx.MSIE) {
            se.onreadystatechange = function () {
                if (this.readyState == "loaded") {
                    var _id = _s_uuid;
                    loadHandler(_id);
                }
            };
            getElement(_s_uuid).src = _lib;
        } else {
            // the onload handler works on opera, ff, safari
            // and the addEventListener will not work on opera
            se.onload = function(){
                    var _id = _s_uuid;
                  loadHandler(_id);
            };
            setTimeout(function(){
                getElement(_s_uuid).src = _lib;
                }, 0);
        }
    };


    /**
     * Generalized XMLHttpRequest which can be used from evaluated code. Evaluated code is not allowed to make calls.
     * @param args is an object literal containing configuration parameters including method[get| post, get is default], body[bodycontent for a post], asynchronous[true is default]
     */
    doAjax= function(args) {
        if (typeof args == 'undefined' || !args.url) {
            log(getMessage("ajax_url_required"));
            return;
        }
        // sync up the processing queues for script and ajax loading
        // synchronous requests should not be stopped
        if ((ctx.processingScripts && args.asynchronous) ||
            (ctx.processingAjax &&
            args.asynchronous) ) {
                ctx.ajaxRequestQueue.push(args);
                return;
        }
        ctx.processingAjax = true;
        var _req =  getXHR();

        var method = "GET";
        var async = true;
        var callback;
        var _c = false;
        if (args.timeout) {
            setTimeout(function(){
              if (_c === false) {
                _c = true;
                if (_req.abort) {
                    _req.abort();
                }
                handleAjaxError(getMessage("request_timeout", [args.url]), _req, args);
                updateAjaxQueue();
                return;
               }
            }, args.timeout);
        }

        if  (typeof args.asynchronous != "undefined") {
             async=args.asynchronous;
        }
        if (args.method) {
             method=args.method;
        }
        if (typeof args.callback == 'function') {
            callback = args.callback;
        }
        var _body = null;
        if (args.body) {
            _body = args.body;
        } else if (args.content) {
            _body = "";
            for (var l in args.content) {
                if (typeof args.content[l] != "function") {
                    _body = _body +  l + "=" + encodeURIComponent(args.content[l]) + "&";
                }
            }
        }
        if (async === true && _c === false) {
            _req.onreadystatechange = function() {
                if (_req.readyState == 4 && _c === false) {
                    _c = true;
                    if ((_req.status == 200 || _req.status === 0) &&
                            callback) {
                        callback(_req);
                    } else if (_req.status != 200) {
                        _c = true;
                        handleAjaxError(getMessage("ajax_server_error",
                                        [args.url, _req.status ]), _req, args);
                    }
                    updateAjaxQueue();
                    return;
                }
            };
        }
        try {
           if (!_c) {
               _req.open(method, args.url, async);
           }
        } catch(e) {
          _c = true;
          handleAjaxError(getMessage("ajax_request_open_error", [args.url]),_req, args);
          updateAjaxQueue();
          return;
        }
        // add headers
        if (args.headers && args.headers.length > 0) {
            for (var _h=0;_h < args.headers.length; _h++) {
                _req.setRequestHeader(args.headers[_h].name, args.headers[_h].value);
            }
        }
        // customize the method
        if (args.method) {
             method=args.method;
             if (method.toLowerCase() == 'post') {
                if (!args.contentType) {
                    _req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                }
             }
        }
        if (args.contentType) {
            _req.setRequestHeader("Content-Type", args.contentType);
        }
        try {
          if (_c === false) {
              _req.send(_body);
          }
        } catch(er) {
          _c = true;
          handleAjaxError(getMessage("ajax_send_body_error", [args.url]), _req, args);
          updateAjaxQueue();
          return;
        }
        if (_c === false && async === false) {
            _c = true;
            if (_req.status === 200 || _req.status === 0) {
                 if (callback) {
                     callback(_req);
                 }
            } else {
                _c = true;
                handleAjaxError(getMessage("ajax_server_error", [args.url,_req.status]), _req, args);
            }
            updateAjaxQueue();
        }
     };

     /**
      * Loads the style sheet by adding a link element to the DOM
      * @param target name of style sheet to load
      */
     var loadStyle = function(target) {
         var styleElement = createElement("link");
         styleElement.type = "text/css";
         styleElement.rel="stylesheet";
         if (target[0] == '/')  {
             target = ctx.webRoot + target;
         }
         styleElement.href = target;
         if (document.getElementsByTagName('head').length === 0) {
             var headN = document.createElement("head");
             document.documentElement.insertBefore(headN, document.documentElement.firstChild);
         }
         head.appendChild(styleElement);
     };

     /**
      * Utility Function to get children
      * @param target Element for which to get the children. All document children are loaded if not specified
      * @param children An array used internally to build up a list of children found
      */
     var getAllChildren = function(target, children) {
         var _nc = target.childNodes;
         for (var l=0; _nc && l <  _nc.length; l++) {
             if (_nc[l].nodeType == 1) {
                 children.push(_nc[l]);
                 if (_nc[l].childNodes.length > 0) {
                     getAllChildren(_nc[l], children);
                 }
             }
         }
         return children;
     };


     /**
      * Find a set of child nodes that contain the className specified
      * @param className is the targetClassName you are looking for
      * @param root  An optional root node to start searching from. The entire document will be searched if not specfied.
      *
      */
      var getElementsByStyle = function(className, root){
          var elements = [];
          if (isDefined(root)) {
              var rootNode = root;
              if (typeof root == "string") {
                  rootNode = getElement(root);
              }
              elements = getAllChildren(rootNode, []);
          } else {
              elements = (document.all) ? document.all : document.getElementsByTagName("*");
          }
      var found = [];
      for (var i=0; i < elements.length; i++) {
      // Handle cases where there are multiple class names
              if (elements[i].className.indexOf(' ') != -1) {
                  var cn = elements[i].className.split(' ');
                  for (var ci =0; ci < cn.length; ci++) {
                      if (cn[ci] == className) {
                          found.push(elements[i]);
                      }
                  }
              } else  if (elements[i].className == className) {
                  found.push(elements[i]);
              }
          }
          return found;
      };

     /**
      * Replace style class
      * @param root root of the oldStyle classes
      * @param oldStyle name of class or classes to replace
      * @param targetStyle name of new class or classes to use
      */
     var replaceStyleClass = function (root, oldStyle, targetStyle) {
         var elements = getElementsByStyle(oldStyle,root);
         for (var i=0; i < elements.length; i++) {
             // Handle cases where there are multiple classnames
             if (elements[i].className.indexOf(' ') != -1) {
                 var classNames = elements[i].className.split(' ');
                 for (var ci in classNames) {
                     if (classNames[ci] == oldStyle) {
                         classNames[ci] = targetStyle;
                     }
                 }
                 // now reset the styles with the replaced values
                 elements[i].className = classNames.join(' ');
             } else  if (elements[i].className == oldStyle) {
                 elements[i].className = targetStyle;
             }
         }
     };

     /**
      * Load extension
      * @param _ext Object representing widget to load
      */
     this.loadExtension = function(_ext) {
         if (ctx.extensions.get(_ext)){
             return;
         }
         var targetName ="jmaki.extensions." + _ext.name + ".Extension";
         var Con = findObject(targetName);
         if (typeof Con != "function") {
             log(getMessage("extension_constructor_not_found", [targetName]));
         } else {
           var ex = new Con(_ext);
           if (ex.postLoad) {
               ex.postLoad.call(window);
           }
           ctx.extensions.put(_ext.name, ex);
         }

     };

     function logError(message, div) {
         if (ctx.displayErrorsInline) {
             if (!isDefined(div) || !div) {
                 div = createElement("div");
             }
             div.className = "";
             div.style.color = "red";
             appendChild(body, div);
            div.innerHTML = message;
         } else {
             log(message);
         }
     }

     function logWidgetError(name,uuid, url, line, _m, div) {
         var message= getMessage("widget_error", [name, uuid, url, line, _m]);
         logError(message, div);
     }


     /**
      * Load a widget
      * @param _jmw Object representing widget to load
      */
     var loadWidget = function(_jmw) {

         // see if the widget has been defined.
         if (ctx.attributes.get(_jmw.uuid) != null) {
             return null;
         }
         var targetName ="jmaki.widgets." + _jmw.name + ".Widget";
         var Con = findObject(targetName);
         if (typeof Con != "function") {
             logError(getMessage("widget_constructor_not_found", [targetName]), getElement(_jmw.uuid));
             return null;
         }
         var wimpl;
         // bind the value using a @{foo.obj} notation
         if ((typeof _jmw.value == 'string') && _jmw.value.indexOf("@{") === 0) {
             var _vw = /[^@{].*[^}]/.exec(_jmw.value);
             _jmw.value = findObject(_vw + "");
         }
         // do not wrap IE with exception handler
         // because we can't get the right line number
         var _uuid = _jmw.uuid;
         if (ctx.MSIE) {
             var oldError = null;
             if (window.onerror) {
                 oldError = window.onerror;
             }
             var eh = function(message, url, line) {
                 var _puuid = _uuid;
                 logWidgetError(targetName, _puuid,url, line, message, getElement(_puuid));
             };
             window.onerror = eh;
             wimpl = new Con(_jmw);

             window.onerror = null;
             if (oldError) {
                 window.onerror = oldError;
             }
         } else if (typeof Con == 'function'){
           try {
                 wimpl = new Con(_jmw);
            } catch (e){
                 var line = getMessage("unknown");
                 var description = null;
                 if (e.lineNumber) {
                     line = e.lineNumber;
                 }
                 if (e.message){
                     description = e.message;
                 }
                 if (ctx.debug) {
                     logWidgetError(targetName, _jmw.uuid,_jmw.script, line, description , getElement(_jmw.uuid));
                     return null;
                 }
             }
         }
         if (typeof wimpl == 'object') {
             ctx.attributes.put(_jmw.uuid, wimpl);
             if (wimpl.postLoad) {
                 wimpl.postLoad.call(window);
             }
             // map in any subscribe handlers.
             if (_jmw.subscribe && _jmw.subscribe.push) { //string also have length property
                 for (var _wi = 0; _wi < _jmw.subscribe.length; _wi++) {
                     var _t = _jmw.subscribe[_wi].topic;
                     var _m = _jmw.subscribe[_wi].handler;
                     var _h = null;
                     if (typeof _m == 'string' && _m.indexOf("@{") === 0) {
                          var _hw = /[^@{].*[^}]/.exec(_m);
                         _h = findObject(_hw + "");
                     } else if (wimpl[_m]) {
                         _h = wimpl[_m];
                     }
                     if (_h !== null) {
                         subscribe(_jmw.subscribe[_wi].topic,_h);
                     }
                 }
             }
             publish("/jmaki/runtime/widget/loaded", { id : _jmw.uuid});
             return wimpl;
         } else {
             logError(getMessage("widget_instantiation_error",[targetName]), getElement(_jmw.uuid ));
         }
         return null;
     };





     /**
      * An easy way to get a instance of a widget.
      * returns null if their is not a widget with the id.
      */
     var getWidget = function(id) {
         return ctx.attributes.get(id);
     };

     var removeWidget = function(_wid) {
         var _w = getWidget(_wid);
         if (_w) {
             if ( typeof _w.destroy == 'function') {
                 _w.destroy();
             }
             var _p = getElement(_wid);
             if( null !== _p) {
                 _p.parentNode.removeChild(_p);
             }
         }
         ctx.attributes.remove(_wid);
     };

     /**
      * destroy all registered widgets under the target node
      * @param _root - The _root to start at. All widgets will be removed if not specified.
      */
     this.clearWidgets = function(_root) {

         if (!isDefined(_root)) {
             var _k = ctx.attributes.keys();
             for (var l=0; l < _k.length; l++) {
                 removeWidget(_k[l]);
             }
             ctx.loaded = false;
             ctx.widgets = [];
         } else {
            var _ws = getAllChildren(_root,[]);
            for (var ll=0; ll < _ws.length; ll++) {
                 if (_ws[ll].id) {
                     removeWidget(_ws[ll].id);
                 }
             }
         }
     };

     /**
      *  Library name is added as a script element which will be loaded when the page is rendered
      *  @param lib library to add
      *  @param cb Callback handler
      */
     var addLibrary = function(lib, cb) {
       var libs = [];
       libs.push(lib);
       addLibraries({libs : libs, callback : cb});
     };

     /**
      * Register widget with jMaki
      * @param widget Object representing the widget
      */
     var addWidget = function(widget) {
         ctx.widgets.push(widget);
         if (ctx.loaded){
             loadWidget(widget);
         }
     };

      /**
      * Register widget with jMaki
      * @param ext Object representing the extension params
      */
     var addExtension = function(ext) {
         ctx.preextensions.push(ext);
     };

     /**
      * Register widget with jMaki
      * @param id The id of the extension
      */
     var getExtension = function(id) {
         return ctx.extensions.get(id);
     };

     /**
      * Bootstrap or load all registered widgets
      */
      function bootstrapWidgets() {
         ctx.loaded = true;
         for (var l=0; l < ctx.widgets.length; l++) {
             loadWidget(ctx.widgets[l]);
         }
     }

     /**
      * Bootstrap or load all registered extensions
      */
     function loadExtensions() {
         for (var l=0; l < ctx.preextensions.length; l++) {
             loadExtension(ctx.preextensions[l]);
         }
     }

    /**
      * Checks whether a script has been loaded yet
      */
     var writeScript = function(_s, _id) {
         if (ctx.loaded === true) {
             if (getElement(_id)) {
                 getElement(_id).innerHTML = getMessage("write_dynamic_script_error", [_id]);
             }
         } else {
             document.write("<script src='" + _s + "'></script>");
         }
     };
     /*
      * @param _src is the source object
      * @param _par is the class to extend
      */
     var extend = function(_src, Par) {
         _src.prototype = new Par();
         _src.prototype.constructor = _src;
         _src.superclass = Par.prototype;
         for (var i in _src.prototype) {
             if (typeof _src.prototype[i] != "undefined") {
                 _src[i] = _src.prototype[i];
             }
         }
     };

     var hideLogger = function() {
       var ld = getElement("jmakiLogger");
       if (ld){
           ld.style.visibility = 'hidden';
       }
     };

     var clearLogger = function() {
       var b = getElement("jmakiLoggerContent");
       if (b) {
           b.innerHTML = "";
       }
     };


     var showLogMessage = function(id) {
         var n = getElement(id);
         if (n && n.style){
             n.style.display = "block";
             var h = getElement(id + "_href");
             h.href = "javascript:jmaki.hideLogMessage('" + id + "')";
             var l = getElement(id + "_link");
             l.innerHTML = "&nbsp;" + getMessage("x_close");
         }
     };

     var hideLogMessage = function(id) {
         var n = getElement(id);
         if (n && n.style){
             n.style.display = "none";
             var h = getElement(id + "_href");
             h.href = "javascript:jmaki.showLogMessage('" + id + "')";
             var l = getElement(id + "_link");
             l.innerHTML = getMessage("more");
         }
     };

     /*  This function takes an object literal and performs actions if present
      *  or it publishes a message to the provided topic.
      *
      *  _t = object literal { topic : 'topic to publish to',
      *                        widgetId : 'source widget id',
      *                        targetId : 'foo',
      *                        action : [
      *                            { topic : '/some topic', message : { payload}}
      *                        ],
      *                        value : 'somevalue'
      *                      }
      * The action, targetId, and value properties are optional.
      * The topic and widgetId are required
      *
      */
     var processActions = function(_t) {

         if (_t) {
             var _topic = _t.topic;
             var _m = {widgetId : _t.widgetId, type : _t.type, targetId : _t.targetId};
             if (isDefined(_t.value)) {
                 _m.value = _t.value;
             }
             var action = _t.action;
             if (!action) {
                 _topic = _topic + "/" + _t.type;
             }
             if (isDefined(action) &&
                 action instanceof Array) {
               for (var _a=0; _a < action.length; _a++) {
                   var payload = clone(_m);
                   if (action[_a].topic) {
                       payload.topic = action[_a].topic;
                   } else {
                       payload.topic = _t.topic;
                   }
                   if (action[_a].message) {
                       payload.message = action[_a].message;
                   }
                   publish(payload.topic,payload);
               }
             } else {
                 if (action) {
                   if (action.topic) {
                            _topic = _m.topic = action.topic;
                        }
                        if (action.message) {
                            _m.message = action.message;
                        }
                }
                publish(_topic, _m);
            }
         }
     };

     /**
         * Find the position of an Element
         *
         */
      var getPosition = function(_e){
         var pX = 0;
         var pY = 0;
         if(_e.offsetParent) {
             while(true){
                 pY += _e.offsetTop;
                 pX += _e.offsetLeft;
                 if(_e.offsetParent === null){
                     break;
                 }
                 _e = _e.offsetParent;
             }
         } else if(_e.y) {
                 pY += _e.y;
                 pX += _e.x;
         }
         return  {x: pX, y: pY};
     };

     var getDimensions = function(n, min) {
         if (typeof n == 'undefined' ||
             n === null) {
             return null;
         }
         var _min = 0;
         if (typeof min != "undefined") {
             _min = min;
         }
         var rn = n.parentNode;
         while(rn && true) {
             if (rn.clientHeight > _min) {
                 break;
             }
             if (rn.parentNode && rn.parentNode.clientHeight) {
                 rn = rn.parentNode;
             } else {
                break;
             }
         }
         if (!rn) {
             return null;
         }
         return {h : rn.clientHeight, w : rn.clientWidth};
     };



     var addTimers = function(_timers){
         if (isDefined(_timers)){
             for (var _l=0; _l <_timers.length;_l++ ) {
                 // create a wrapper and add the timer
                 var _timer = _timers[_l];
                 if (_timer.action == 'call' &&
                 isDefined(_timer.target) &&
                 isDefined(_timer.target.object) &&
                 isDefined(_timer.target.functionName) &&
                 isDefined(_timer.timeout)) {
                     // create the timer
                     var t1 = new Timer({on: _timer.target.object,
                         fn: _timer.target.functionName,
                         to: _timer.timeout
                         },true);
                     ctx.timers.push(t1);
                     t1.run();
                 } else if (_timers[_l].action == 'publish') {
                     var t2 = new Timer( {topics: _timers[_l].topics,
                     to: _timer.timeout
                     },false);
                     ctx.timers.push(t2);
                     t2.run();
                 }
             }
         }
     };

     var addTimer = function(_timer){
         var timers = [];
         timers.push(_timer);
         addTimers(timers);
     };

    var postInitialize = function() {

         if (ctx.initialized) {
             return;
         } else {
             ctx.initialized = true;
         }
         if (ctx.config.logLevel) {
             switch (ctx.config.logLevel) {
                 case 'debug' :
                         ctx.debug = true;
                         log(getMessage("jmaki_version",[ctx.version]));
                         break;

                 case 'all' :
                     ctx.debug = true;
                     ctx.debugGlue = true;
                         break;
                 case  'off' :
                     ctx.debug = false;
                         break;
             }
         }
         // write out the dependent libraries so we have access
         if (ctx.config.glue) {
             if (ctx.config.glue.timers) {
                 addTimers(ctx.config.glue.timers);
             }
             if (ctx.config.gluelisteners){
                 for (var gl=0; gl < ctx.config.glue.listeners.length;gl++) {
                     subscribe (ctx.config.glue.listeners[gl]);
                 }
             }
         }

         // log any messages that might be queued up during pre-init
         if (ctx._messages) {
             for (var i=0; i < ctx._messages.length; i++) {
                 var _m = ctx._messages[i];
                 log(_m.text, _m.level);
             }
         }
         publish("/jmaki/runtime/intialized", {});
         loadExtensions();
         publish("/jmaki/runtime/extensionsLoaded", {});
         bootstrapWidgets();

         publish("/jmaki/runtime/widgetsLoaded", {});
         // load the theme
         if ( ctx.config.theme) {
             var theme = ctx.config.theme;
             if (!/(^http)/i.test(theme)) {
                 theme = ctx.webRoot + theme;
             }
             loadStyle(theme);
         }
         publish("/jmaki/runtime/loadComplete", {});
     };

     /**
      * Initialize jMaki by loading the config.json
      *  Write in the glue by loading dependencies and
      *  Register listeners.
      */
     var initialize = function() {
         head = document.getElementsByTagName("head")[0];
         body = document.body;
         if (!ctx.config) {
             ctx.config = {};
           doAjax({ url : typeof(jmakiConfigJson)=="string" ? jmakiConfigJson:ctx.webRoot + ctx.resourcesRoot + "/config.json",
                asynchronous : false,
                timeout : 3000,
                onerror : function() { /* do nothing and continue*/},
                callback :  function(req) {
                   if (req.responseText !== "") {
                       var obj = eval('(' + req.responseText + ')');
                       if (obj.config) {
                           ctx.config = obj.config;
                       }
                   }
               }
           });
         }
         postInitialize();
     };

    var Injector = function() {

          var _uuid = new Date().getMilliseconds();
          var _injector = this;
          var _processing = false;

          var tasks = [];

          /**
           * If were returning an text document remove any script in the
           * the document and add it to the global scope using a time out.
           */
          var getContent = function(rawContent, _task) {

           _task.embeddedScripts = [];
           _task.embeddedStyles = [];
           _task.scriptReferences = [];
           _task.styleReferences = [];

            var _t = rawContent;

            // check against the base directory
            var getReativeURL = function() {
                var root = window.location.href;
                if (root[root.length -1] == "/") {
                    return root;
                }
                var _p = root.split("/");
                // remove the file portion
                _p.pop();
                root = _p.join("/") + "/";
                return root;
            };

            // recursively go through and weed out the scripts

            var gscripts = document.getElementsByTagName("script");
            var gstyles = document.getElementsByTagName("link");

            var root = getReativeURL();
            while (_t.indexOf("<script") != -1) {
                    var realStart = _t.indexOf("<script");
                    var scriptSourceStart = _t.indexOf("src=", (realStart));
                    var scriptElementEnd = _t.indexOf(">", realStart);
                    var end = _t.indexOf("</script>", (realStart)) + "</script>".length;
                    if (realStart != -1 && scriptSourceStart != -1) {
                        var scriptSourceName;
                        var scriptSourceLinkStart= scriptSourceStart + 5;
                        var quoteType =  _t.substring(scriptSourceStart + 4, (scriptSourceStart +5));
                        var scriptSourceLinkEnd= _t.indexOf("\"", (scriptSourceLinkStart + 1));
                          scriptSourceLinkEnd= _t.indexOf(quoteType, (scriptSourceLinkStart + 1));
                        if (scriptSourceStart < scriptElementEnd) {
                            scriptSourceName = _t.substring(scriptSourceLinkStart, scriptSourceLinkEnd);
                            // prevent multiple inclusions of the same script
                            var exists = false;
                            for (var i = 0; i < gscripts.length; i++) {
                                if (typeof gscripts[i].src) {
                                    if (gscripts[i].src == scriptSourceName ||
                                            gscripts[i].src == (root + scriptSourceName)) {
                                        exists = true;
                                        break;
                                    }
                                }
                            }
                            if (!exists) {
                                _task.scriptReferences.push(scriptSourceName);
                            }
                        }
                    }
                   // now remove the script body
                   var scriptBodyStart =  scriptElementEnd + 1;
                   var sBody = _t.substring(scriptBodyStart, end - "</script>".length);
                   if (sBody.length > 0) {
                          _task.embeddedScripts.push(sBody);
                   }
                   //remove script
                   _t = _t.substring(0, realStart) + _t.substring(end, _t.length);
                   scriptSourceLinkEnd = -1;
              }
              while (_t.indexOf("<style") != -1) {
                   var rs = _t.indexOf("<style");
                   var styleElementEnd = _t.indexOf(">", rs);
                   var e2 = _t.indexOf("</style>", rs) ;
                   var styleBodyStart =  styleElementEnd + 1;
                   var sBody2 = _t.substring(styleBodyStart, e2);
                   if (sBody2.length > 0) {
                      _task.embeddedStyles.push(sBody2);
                   }
                   //remove style
                   _t = _t.substring(0, rs) + _t.substring(e2 + "</style>".length, _t.length);
                }
                // get the links
                while (_t.indexOf("<link") != -1) {
                    var rs2 = _t.indexOf("<link");
                    var styleSourceStart = _t.indexOf("href=", rs2);
                    var styleElementEnd2 = _t.indexOf(">", rs2) +1;
                    if (rs2 != -1 && styleSourceStart != -1) {
                        var styleSourceName;
                        var styleSourceLinkStart= styleSourceStart + 6;
                        var qt =  _t.substring(styleSourceStart + 5, (styleSourceStart + 6));
                        var styleSourceLinkEnd= _t.indexOf(qt, (styleSourceLinkStart + 1));
                        if (styleSourceStart < styleElementEnd2) {
                            styleSourceName = _t.substring(styleSourceLinkStart, styleSourceLinkEnd);
                              var exists2 = false;
                                for (var ii = 0; ii < gstyles.length; ii++) {
                                    if (isDefined(gstyles[ii].href)) {
                                        if (gstyles[ii].href == styleSourceName) {
                                            exists2 = true;
                                        }
                                    }
                                }
                        if (!exists2) {
                              _task.styleReferences.push(styleSourceName);
                          }
                        }
                        //remove style
                        _t = _t.substring(0, rs2) + _t.substring(styleElementEnd2, _t.length);
                    }
                }

                // inject the links
                for(var loop = 0; _task.styleReferences && loop < _task.styleReferences.length; loop++) {
                    var link = createElement("link");
                    link.href = _task.styleReferences[loop];
                    link.type = "text/css";
                    link.rel = "stylesheet";
                    head.appendChild(link);
                }

                var stylesElement;
                if (_task.embeddedStyles.length > 0) {
                    stylesElement = createElement("style");
                    stylesElement.type="text/css";
                    var stylesText;
                    for(var j = 0; j < _task.embeddedStyles.length; j++) {
                        stylesText = stylesText + _task.embeddedStyles[j];
                    }
                    if (document.styleSheets && +
                        document.styleSheets[0].cssText) {
                        document.styleSheets[0].cssText = document.styleSheets[0].cssText + stylesText;
                    } else {
                        appendChild(stylesElement, document.createTextNode(stylesText));
                        head.appendChild(stylesElement);
                    }
                }
                _task.content = _t;
                return _t;
           };

          this.inject = function(task) {
           // make sure jmaki creates a list of libraries it can not load
            if (tasks.length === 0 && !_processing) {
                inject(task);
            } else {
                tasks.push(task);
            }
          };

          // pass in a reference to the task
          // start the next task
          function processNextTask() {
              if (tasks.length >0) {
                  var _t = tasks.shift();
                  inject(_t);
              }
              _processing = false;
          }

          function processTask(injectionPoint, task) {
              clearWidgets(injectionPoint);
              var _id = "injector_" + _uuid;
              var data = task.content + "<div id='" + _id + "'></div>";
              injectionPoint.innerHTML = data;
              // wait for the content to be loaded
              var _t = setInterval(function() {
                  if (getElement(_id)) {
                      clearInterval(_t);
                      try {
                          _injector.loadScripts(task,function () {
                              // if we are using Widget Loader check for widgets and add them
                              var wf = getExtension("widgetFactory");
                              if (wf) { // !== null) {
                                  wf.findAndAdd(injectionPoint.id);
                              }
                              processNextTask();
                          });
                      } catch (e) {
                          injectionPoint.innerHTML = "<span style='color:red'>" + e.message + "</span>";
                      }
                  }
              }, 25);
          }

          /**
           *
           * Load template text aloing with an associated script
           *
           * Argument p properties are as follows:
           *
           * url :              Not required but used if you want to get the template from
           *                    something other than the injection serlvet. For example if
           *                    you want to load content directly from a a JSP or HTML file.
           *
           * p.injectionPoint:  Not required. This is the id of an element into. If this is
           *                    not specfied a div will be created under the root node of
           *                    the document and the template will be injected into it.
           *                    Content is injected by setting the innerHTML property
           *                    of an element to the template text.
           */
          function inject(task) {
              _processing = true;

              doAjax({
                    method:"GET",
                    url: task.url,
                    asynchronous: false,
                    callback: function(req){
                           getContent(req.responseText, task);
                       //if no parent is given append to the document root
                       var injectionPoint;
                       if (typeof task.injectionPoint == 'string') {
                           injectionPoint = getElement(task.injectionPoint);
                           // wait for the injection point
                           if (!getElement(task.injectionPoint)) {
                               var _t = setInterval(function() {
                                   if (getElement(task.injectionPoint)) {
                                       clearInterval(_t);
                                       injectionPoint = getElement(task.injectionPoint);
                                       setTimeout(function(){processTask(injectionPoint,task);},0);
                                   }
                               }, 25);
                           } else {
                               processTask(injectionPoint, task);
                           }
                        } else {
                            processTask(task.injectionPoint, task);
                        }
                 },
                 onerror : function(){
                    var ip = task.injectionPoint;
                    if (typeof task.injectionPoint == 'string') {
                        ip = getElement(task.injectionPoint);
                    }
                    clearWidgets(ip);
                    ip.innerHTML = getMessage("unable_to_load_url", [task.url]);
                    processNextTask();
                 }

               });
          }


          /**
           *
           * Load template text along with an associated script
           *
           * Argument p properties are as follows:
           *
           * url :              Not required but used if you want to get the template from
           *                    something other than the injection serlvet. For example if
           *                    you want to load content directly from a a JSP, JSF call, PHP, or HTML file.
           */
          this.get = function (p) {
              var _rd = "";
               doAjax({
                    method:"GET",
                    url: p.url,
                    asynchronous: false,
                    callback: function(req){
                        _rd = getContent(req.responseText);
                        return _rd;
                    }
                   });
                   return _rd;
          };

          this.loadScripts = function(task, initFunction) {
                  var _loadEmbeded = function() {
                      // evaluate the embedded javascripts in the order they were added
                      for(var loop = 0;task.embeddedScripts && loop < task.embeddedScripts.length; loop++) {
                          var script = task.embeddedScripts[loop];
                          // append to the script a method to call the scriptLoaderCallback
                          eval(script);
                          if (loop == (task.embeddedScripts.length -1)) {
                              if (isDefined(initFunction)) {
                                  initFunction();
                              }
                              return;
                          }
                      }
                      if (task.embeddedScripts && task.embeddedScripts.length === 0 &&
                          isDefined(initFunction)) {
                          initFunction();
                      }
                  };
                  if (task.scriptReferences &&
                      task.scriptReferences.length > 0){
                      // load the global scripts before loading the embedded scripts
                      addLibraries({ libs : task.scriptReferences.reverse(),
                          cleanup : false,
                          callback : function() {_loadEmbeded();}
                      });
                  } else {
                      _loadEmbeded();
                  }
                  return true;
             };
          };

      ctx.injector = new Injector();


     var DContainer = function(args){

         var _self = this;
         var _container;

           if (typeof args.target == 'string') {
               _self.uuid = args.target;
               _container = getElement(_self.uuid);
           } else {
               this.uuid = args.target.id;
               _container = args.target;
           }
           if (!_self.uuid) {
               _self.uuid = genId();
           }
           // add to a reference of the jmaki containers
           ctx.dcontainers.put(_self.uuid, _self);

           var oldWidth;
           this.url = null;
           this.externalDomain = false;
           var autoSizeH = false;
           var autoSizeW = false;

           var resizing = false;
           var lastSize = 0;
           // default sizes are all based on the width of the container
           var VIEWPORT_WIDTH;
           var VIEWPORT_HEIGHT;

           if (args.autosize) {
               autoSizeH = true;
               autoSizeW = true;
           }

           if (typeof args.autosizeH == 'boolean') {
               autosizeH = args.autosizeH;
           }
           if (typeof args.autosizeW == 'boolean') {
               autoSizeW = args.autosizeW;
           }

           var getHost = function(url) {
               var host = "";
               // get the second 1/2
               var _p = url.split("://");
               if (_p[1]) {
                   if (_p[1].indexOf("/") != -1) {
                       host = _p[1].substring(0, _p[1].indexOf("/"));
                   } else {
                       host = _p[1];
                   }
               }
               return host;
           };

           this.setSize = function(size) {
               if (size.w) {
                   VIEWPORT_WIDTH = size.w;
                   _container.style.width = VIEWPORT_WIDTH + "px";
                   if (_self.iframe)  {
                       _self.iframe.style.width = VIEWPORT_WIDTH -2 + "px";
                   }
               }
               if (size.h) {
                   VIEWPORT_HEIGHT = size.h;
                   _container.style.height = VIEWPORT_HEIGHT + "px";
                   if (_self.iframe) {
                       _self.iframe.style.height = VIEWPORT_HEIGHT -2 + "px";
                   }
               }
           };

           var resize = function() {
               var _dim = getDimensions(_container);
               if (autoSizeH || autoSizeW){
                   if (!_container.parentNode){
                       return;
                   }
                  var pos = getPosition(_container);
                   if (_container.parentNode.nodeName == "BODY") {
                       if (window.innerHeight){
                           if (autoSizeH) {
                               VIEWPORT_HEIGHT = window.innerHeight - pos.y ;
                           }
                           if (autoSizeW) {
                               VIEWPORT_WIDTH = window.innerWidth - 20;
                           }
                       } else {
                           if (_dim === null) {
                               if (autoSizeW) {
                                   VIEWPORT_WIDTH = 400;
                               }
                           } else {
                               if (autoSizeW) {
                                   VIEWPORT_WIDTH = _dim.w -20;
                               }
                               if (autoSizeH) {
                                   VIEWPORT_HEIGHT = _dim.h - pos.y;
                               }
                           }
                       }
                   } else {
                       if (_dim === null) {
                           if (autoSizeW) {
                               VIEWPORT_WIDTH = 400;
                           }
                       } else {
                           if (autoSizeW) {
                               VIEWPORT_WIDTH = _dim.w;
                           }
                           if (autoSizeH) {
                               VIEWPORT_HEIGHT = _dim.h;
                           }
                       }
                   }
                   if (autoSizeH) {
                       if (VIEWPORT_HEIGHT < 0) {
                           VIEWPORT_HEIGHT = 320;
                       }
                       _container.style.height = VIEWPORT_HEIGHT + "px";
                   }
                   if (autoSizeW) {
                       _container.style.width = VIEWPORT_WIDTH + "px";
                   }
               } else {
                   _container.style.width = VIEWPORT_WIDTH + "px";
                   _container.style.height = VIEWPORT_HEIGHT + "px";
               }
               if (VIEWPORT_HEIGHT < 0) {
                   VIEWPORT_HEIGHT = 320;
               }
               if (VIEWPORT_WIDTH < 0) {
                   VIEWPORT_WIDTH = 500;
               }

               if (args.useIframe) {
                   if (_self.iframe) {
                       _self.iframe.style.height = VIEWPORT_HEIGHT -2 + "px";
                       _self.iframe.style.width = VIEWPORT_WIDTH -2 + "px";
                   }
               }
               // used for tracking with IE
               oldWidth = body.clientWidth;
           };

           var loadURL = function(_url){
               // shut down all events published to iframe
               if (_self.iframe) {
                   _self.externalDomain = true;
               }
               if (_url.message) {
                   _url = _url.message;
               }
               if (typeof _url == 'string') {
                   _self.url = _url;
               } else if (_url.url) {
                   _self.url = _url.url;
               } else if (_url.value) {
                   _self.url = _url.value;
               }
               // check for jmaki and enable events to flow to parent jmaki instances
               function enableEvents() {
                   // check to see if we are in the same domain for pushing messages from the bus
                   // check if we are an external link
                   if (/http/i.test( _self.url) &&  top.window.location.host != getHost( _self.url)) {
                       _self.externalDomain = true;
                   } else {
                       _self.externalDomain = false;
                   }
                   if (!_self.externalDomain) {
                       var _w = _self.iframe.contentWindow ? _self.iframe.contentWindow  : _self.iframe.window;
                       if (_w && _w.jmaki) {
                           _w.jmaki.publishToParent = true;
                       }
                   }
               }
               if (args.useIframe) {
                   // wait for the iframe if it hasn't loaded
                   if (!_self.iframe) {
                       var _t = setInterval(function() {
                           if (getElement(_self.uuid + "_iframe")) {
                               clearInterval(_t);
                               _self.iframe = getElement(_self.uuid + "_iframe");
                               // wire on event listener to wait for iframe load and then
                                   if (ctx.MSIE){
                                       _self.iframe.onreadystatechange = function() {
                                           if (this.readyState == "complete") {
                                               enableEvents();
                                           }
                                        };
                                   } else {
                                     _self.iframe.onload = enableEvents;
                                   }
                               _self.iframe.src =  _self.url;
                           }
                       }, 5);
                 } else {
                     if (ctx.MSIE){
                         _self.iframe.onreadystatechange = function() {
                             if (this.readyState == "complete") {
                                 enableEvents();
                             }
                         };
                     } else {
                         _self.iframe.onload = enableEvents;
                     }
                     _self.iframe.src = _self.url;
                }
               } else {
                   ctx.injector.inject({url: _self.url, injectionPoint: _container});
                   /*
                   if (/http/i.test(_url) &&  top.window.location.host != getHost(_url)) {
                       _self.externalDomain = true;
                   } else {
                       _self.externalDomain = false;
                   } */
               }
           };

           var layout = function() {
               if (!ctx.MSIE) {
                   resize();
                   return;
               }
               // special handling for ie resizing.
               // we wait for no change for a full second before resizing.
               if (oldWidth != body.clientWidth && !resizing) {
                   if (!resizing) {
                       resizing = true;
                       setTimeout(layout,500);
                   }
               } else if (resizing && body.clientWidth == lastSize) {
                   resizing = false;
                   resize();
               } else if (resizing) {
                   lastSize = body.clientWidth;
                   setTimeout(layout, 500);
               }
       };

      var  initD = function() {
               if (window.attachEvent) {
                   window.attachEvent('onresize', layout);
               } else if (window.addEventListener) {
                   window.addEventListener('resize', layout, true);
               }
               var _ot = _container;
               if (_self.iframe) {
                   _ot = _self.iframe;
               }
               if (args.overflow) {
                   _ot.style.overflow = args.overflow;
               }
               if (args.overflowX) {
                   _ot.style.overflowX = args.overflowX;
               }
               if (args.overflowY) {
                   _ot.style.overflowY = args.overflowY;
               }
               if (args.startWidth) {
                   VIEWPORT_WIDTH = Number(args.startWidth);
                   _container.style.width = VIEWPORT_WIDTH + "px";
               } else {
                   VIEWPORT_WIDTH = _container.clientWidth;
                   autoSizeW = true;
               }
               if (args.startHeight) {
                   VIEWPORT_HEIGHT = Number(args.startHeight);
               } else {
                   VIEWPORT_HEIGHT = _container.clientHeight;
                   autoSizeH = true;
               }
               if (VIEWPORT_HEIGHT <= 0) {
                   VIEWPORT_HEIGHT = 320;
               }
               _container.style.height = VIEWPORT_HEIGHT + "px";
               if (args.useIFrame &&  _self.iframe) {
                   _self.iframe.style.height = VIEWPORT_HEIGHT + "px";
               }
               resize();
               if (args.url && !args.useIframe) {
                   loadURL(args.url);
               } else if (args.content && !_self.iframe) {
                   _container.innerHTML = args.content;
               } else if (args.url && !args.url) {
                   loadURL(args.url);
               }
               if (_self.iframe) {
                   _self.iframe.style.display = "inline";
               }
           };


           function createIframe(content) {
               _self.iframe = getElement(_self.uuid + "_iframe");
               if (_self.iframe) {
                   _self.iframe.parentNode.removeChild(_self.iframe);
               }
               // use this technique as creating the iframe programmatically does not allow us to turn the border off
               var iframeTemplate = "<iframe style='display:none' id='" + _self.uuid + "_iframe' name='" + _self.uuid +
                   "_iframe' frameborder=0 scrolling=" +
                   ((args.overflow == 'hidden') ? 'NO' : 'YES') + "></iframe>";
               _container.innerHTML = iframeTemplate;
               // wait for the iframe
               var _t = setInterval(function() {
                   if (getElement(_self.uuid + "_iframe")) {
                       clearInterval(_t);
                       _self.iframe = getElement(_self.uuid + "_iframe");
                       setTimeout(function(){
                           if (/http/i.test(_self.url) &&  top.window.location.host != getHost(_self.url)) {
                               _self.externalDomain = true;
                           } else {
                               _self.externalDomain = false;
                           }
                           if (!_self.externalDomain && content) {
                               var _w = _self.iframe.contentWindow ? _self.iframe.contentWindow  : _self.iframe.window;
                               if (_w && _w.document.body) {
                                   _w.document.body.innerHTML = content;
                               }
                           }
                           initD();},0);
                   }
               }, 5);
           }

       var clear = function() {
               if (args.useIframe) {
                   if (_self.iframe) {
                       loadURL("");
                   } else {
                       args.url = "";
                   }
               } else {
                   clearWidgets(_container);
                   _container.innerHTML = "";
               }
           };

           var setContent = function(_c) {
               var _con;
               if (_c.message) {
                   _c = _c.message;
               }
               if (_c.value) {
                   _con = _c.value;
               } else {
                   _con = _c;
               }
               if (!_self.iframe) {
                   _container.innerHTML = _con;
               } else {
                   clear();
                   // recreate the iframe
                   _container.innerHTML = "";
                   createIframe(_c);
               }
           };

       this.destroy = function() {
           ctx.dcontainers.remove(_self.uuid);
           if (window.attachEvent) {
               window.dettachEvent('onresize', layout);
           } else if (window.addEventListener) {
               window.removeEventListener("resize", layout, true);
           }
       };

       _self.clear = clear;
       _self.resize = resize;
       _self.loadURL = loadURL;
       _self.setContent = setContent;
       _self.init = initD;

       if (args.useIframe && args.useIframe === true) {
           createIframe(args.content);
       } else{
           initD();
       }
   };

   /*

   The code was adopt with minor modifications from:
   http://www.json.org/json2.js
   */

   ctx.json = function () {

           var f = function(n) {    // Format integers to have at least two digits.
               return n < 10 ? '0' + n : n;
           };

           var m = {    // table of character substitutions
               '\b': '\\b',
               '\t': '\\t',
               '\n': '\\n',
               '\f': '\\f',
               '\r': '\\r',
               '"' : '\\"',
               '\\': '\\\\'
           };

           var stringify = function(value, whitelist) {
               var a,          // The array holding the partial texts.
                   i,          // The loop counter.
                   k,          // The member key.
                   l,          // Length.
                   r = /["\\\x00-\x1f\x7f-\x9f]/g,
                   v;          // The member value.

               switch (typeof value) {
               case 'string':

   // If the string contains no control characters, no quote characters, and no
   // backslash characters, then we can safely slap some quotes around it.
   // Otherwise we must also replace the offending characters with safe sequences.

                   return r.test(value) ?
                       '"' + value.replace(r, function (a) {
                           var c = m[a];
                           if (c) {
                               return c;
                           }
                           c = a.charCodeAt();
                           return '\\u00' + Math.floor(c / 16).toString(16) +
                                                      (c % 16).toString(16);
                       }) + '"' :
                       '"' + value + '"';

               case 'number':

   // JSON numbers must be finite. Encode non-finite numbers as null.

                   return isFinite(value) ? String(value) : 'null';

               case 'boolean':
                   return String(value);
               case 'null':
                   return String(value);
               case 'date':
                 return value.getUTCFullYear() + '-' +
                    f(value.getUTCMonth() + 1) + '-' +
                    f(value.getUTCDate())      + 'T' +
                    f(value.getUTCHours())     + ':' +
                    f(value.getUTCMinutes())   + ':' +
                    f(value.getUTCSeconds())   + 'Z';

               case 'object':

   // Due to a specification blunder in ECMAScript,
   // typeof null is 'object', so watch out for that case.

                   if (!value) {
                       return 'null';
                   }

   // If the object has a toJSON method, call it, and stringify the result.

                   if (typeof value.toJSON === 'function') {
                       return stringify(value.toJSON());
                   }
                   a = [];
                   if (typeof value.length === 'number' &&
                           !(value.propertyIsEnumerable('length'))) {

   // The object is an array. Stringify every element. Use null as a placeholder
   // for non-JSON values.

                       l = value.length;
                       for (i = 0; i < l; i += 1) {
                           a.push(stringify(value[i], whitelist) || 'null');
                       }

   // Join all of the elements together and wrap them in brackets.

                       return '[' + a.join(',') + ']';
                   }
                   if (whitelist) {

   // If a whitelist (array of keys) is provided, use it to select the components
   // of the object.

                       l = whitelist.length;
                       for (i = 0; i < l; i += 1) {
                           k = whitelist[i];
                           if (typeof k === 'string') {
                               v = stringify(value[k], whitelist);
                               if (v) {
                                   a.push(stringify(k) + ':' + v);
                               }
                           }
                       }
                   } else {

   // Otherwise, iterate through all of the keys in the object.

                       for (k in value) {
                           if (typeof k === 'string') {
                               v = stringify(value[k], whitelist);
                               if (v) {
                                   a.push(stringify(k) + ':' + v);
                               }
                           }
                       }
                   }

   // Join all of the member texts together and wrap them in braces.

                   return '{' + a.join(',') + '}';
               }
               return 'null';
           };

           return {
               serialize: stringify,
               deserialize: function (text, filter) {
                   var j;
                   text = trim(text);
                   var walk = function(k, v) {
                       var i, n;
                       if (v && typeof v === 'object') {
                           for (i in v) {
                               if (Object.prototype.hasOwnProperty.apply(v, [i])) {
                                   n = walk(i, v[i]);
                                   if (n !== undefined) {
                                       v[i] = n;
                                   }
                               }
                           }
                       }
                       return filter(k, v);
                   };

   // Parsing happens in three stages. In the first stage, we run the text against
   // regular expressions that look for non-JSON patterns. We are especially
   // concerned with '()' and 'new' because they can cause invocation, and '='
   // because it can cause mutation. But just to be safe, we want to reject all
   // unexpected forms.

   // We split the first stage into 4 regexp operations in order to work around
   // crippling inefficiencies in IE's and Safari's regexp engines. First we
   // replace all backslash pairs with '@' (a non-JSON character). Second, we
   // replace all simple value tokens with ']' characters. Third, we delete all
   // open brackets that follow a colon or comma or that begin the text. Finally,
   // we look to see that the remaining characters are only whitespace or ']' or
   // ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
                   if (/^[\],:{}\s]*$/.test(text.replace(/\\./g, '@').
   replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(:?[eE][+\-]?\d+)?/g, ']').
   replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
   // In the second stage we use the eval function to compile the text into a
   // JavaScript structure. The '{' operator is subject to a syntactic ambiguity
   // in JavaScript: it can begin a block or an object literal. We wrap the text
   // in parens to eliminate the ambiguity.
                       j = eval('(' + text + ')');

   // In the optional third stage, we recursively walk the new structure, passing
   // each name/value pair to a filter function for possible transformation.

                       return typeof filter === 'function' ? walk('', j) : j;
                   }

   // If the text is not JSON parseable, then a SyntaxError is thrown.
                  throw new Error(getMessage('invalid_json'));
               }
           };

       }();

    // Localized messages
    // where the first set is a set of languages
    ctx.messages = new Map();

    // This map is intialized with the default languages and messages
    addMessages(ctx.defaultLocale, ctx.defaultMessages);

    var oldLoad  = window.onload;

    /**
     * onload calls bootstrap function to initialize and load all registered widgets
     * override initial onload.
     */
    window.onload = function() {
        if (!ctx.initialized) {
            initialize();
        } else {
            bootstrapWidgets();
            return;
        }
        if (typeof oldLoad  == 'function') {
            oldLoad();
        }
    };

    /*
     * public Functions Available on the jmaki namespace
     */
    mixin({
        // public functions
        log : log,
        mixin : mixin,
        namespace : namespace,
          getMessage : getMessage,
          messageFormat : messageFormat,
          subscribe : subscribe,
        unsubscribe : unsubscribe,
        publish : publish,
        Timer : Timer,
        inspect : inspect,
        findObject : findObject,
        genId : genId,
        doAjax : doAjax,
        addLibraries : addLibraries,
        addWidget : addWidget,
        loadStyle : loadStyle,
        getElementsByStyle : getElementsByStyle,
        replaceStyleClass : replaceStyleClass,
        getAllChildren : getAllChildren,
        getWidget : getWidget,
        loadWidget : loadWidget,
        loadExtension : loadExtension,
        getExtension : getExtension,
        removeWidget : removeWidget,
        trim : trim,
        writeScript : writeScript,
        extend : extend,
        hideLogger : hideLogger,
        clearLogger : clearLogger,
        showLogMessage : showLogMessage,
        hideLogMessage : hideLogMessage,
        initialize : initialize,
        clone : clone,
        filter : filter,
        processActions : processActions,
        getDimensions : getDimensions,
        getPosition : getPosition,
        addTimer : addTimer,
        addTimers : addTimers,
        DContainer : DContainer,
        Injector : Injector
        }, ctx);
    return ctx;

}();
}
//
////eval(function(p,a,c,k,e,r){
//  e=function(c){
//    return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))
//    };if(!''.replace(/^/,String)){
//    while(c--)r[e(c)]=k[c]||e(c);k=[function(e){
//      return r[e]
//      }];e=function(){
//      return'\\w+'
//      };c=1
//    };while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p
//  }('7(14 1q=="1h"){9 6J=19;9 1q=11(){9 T=11(c){9 d=1i;7(14 c==\'1h\'){d={}}13{d=c}1i.3c=11(){9 o={};9 a=[];1a(9 b 1N d){7(14 o[b]==\'1h\'){a.1j(b)}}12 a};1i.2t=11(a,b){d[a]=b};1i.1E=11(a){12 d[a]};1i.3d=11(a){6K d[a]};1i.2u=11(){d={}}};9 U={4X:"1.8.2",3e:1b,4Y:1b,2g:1b,26:1b,2M:1b,3f:"",4Z:"6L",3g:[],50:2,3Q:1b,51:17,27:/27/i.2h(6M.6N),3R:"1q-52-53",3S:"1q-52-53",54:{"55":"6O 1a {0} 6P 6Q.","56":"6R 6S.","57":"3T 2i : 11 {0} 3U 58 3V 1v {1}","59":"3T 2i :  3W 3U 58: {0}","5a":"<1O 18=\'2j:6T\'>3X 6U :</1O> : 5b: {0} 6V {1}","2v":"<1O 18=\'2j:3Y\'>3T </1O> : 5b: {0} 1x {1}","5c":"3X 2i : 6W 3Z 1a 6X {0}.","5d":"3X 2i : 1g 6Y 2k 3Z 1a {0}.","5e":"2w 3h: 1f 3Z.","5f":"40.2w 2i: {0}","5g":"2w 3h 6Z 5h: {0}","5i":"2w 3h 70 2x 5j 5h 1F {0}.","41":"2w 3h 71 5k {0}. 72 73 28 74 {1}.","5l":"75 1F 5m a 1G 76 77 3U 1w 78 5n 3i 5k  1r {0}. 79 7a 7b 3i 1N 5o 1c.","5p":"3j 1F 5q 3i 42 1a {0}.","5r":"3j 1F 5q 7c 42 1a {0}.","5s":"3j 1F 7d 5o 7e 5j {0}. 7f 7g 1a 2N 7h.","43":"43","5t":"<1O>2i 7i {0} : 1r={1}<1U>7j: {2} (7k: {3}).<1U>7l: {4}</1O>","5u":"40 44","2u":"5v","45":"[X]","5w":"5v 44","5x":"7m 44","2N":"[2N]","5y":"40 7n : {0}","5z":"3j 1F 5n 7o {0}."},3k:[],2O:[],1C:[],2y:[],5A:0,2P:1k T(),2Q:1k T(),2z:1k T()};9 V;9 W;9 X=11(a,b){9 c=a.29(\'.\');9 d=19[c[0]];7(14 d=="1h"){19[c[0]]=d={}}1a(9 e=1;e<c.15;e++){7(14 d[c[e]]!="1h"){d=d[c[e]]}13{d[c[e]]={};d=d[c[e]]}}7(14 b==\'1v\'){d=b}12 d};9 Y=11(a,b){7(14 a!="1h"&&14 b!="1h"){1a(9 i=0;i<b.15;i++){9 c=1k 2A("\\\\{"+i+"\\\\}","g");a=a.2B(c,b[i])}}12 a};9 Z=11(a,b){9 c=1d;9 d;7(U.2R.1E(U.3S)){d=U.2R.1E(U.3S)}13{d=U.2R.1E(U.3R)}7(d){c=d.1E(a)}7(14 b!="1h"&&c){12 Y(c,b)}12 c};9 46=11(a,b,c){9 o=1b;7(14 c!="1h"){o=c}1a(9 i 1N a){7(!b[i]||o){b[i]=a[i]}}};9 2C=11(){12"7p"+U.5A++};9 1P=11(a){12 1o.3l(a)};11 1y(a,b){7(a){a.1y(b)}}9 1e=11(a){12 1o.7q(a)};9 1w=11(a,c){7(!U.2M){7(!U.2D){U.2D=[]}U.2D.1j({1Q:a,5B:c})}7(!U.2g){12}9 d=1e("47");9 b=1e("48");7(!d){d=1o.3l("1s");d.1r=\'47\';9 e=d.18;e.7r="7s 7t #7u";e.7v="5C";e.7w="7x";e.7y="7z";e.7A="49";e.4a="#7B";e.5D="49";e.1V="7C";e.1H="7D";9 f="<1s  18=\'1H: 7E; 4a : #7F; 2j : 4b; 7G-7H : 7I\'>"+"<1s 18=\'4c:3m;1V:7J;1Q-5E:7K\'>"+Z("5u")+"</1s><1s 18=\'5D:49,1Q-5E:3m\'><a 1I=\'2S:1q.5F()\' 5G=\'"+Z("5w")+"\' 18=\'2j:4b;1Q-4d:2E\'>["+Z("2u")+"]</a> <a 1I=\'2S:1q.5H()\' 5G=\'"+Z("5x")+"\' 18=\'2j:4b;1Q-4d:2E\'>"+Z("45")+"</a></1s></1s>";9 g=1P("1s");g.1u=f;d.1y(g);b=1o.3l("1s");b.1r=\'48\';b.18.1H="7L";b.18.3n="7M";d.1y(b);7(W){1y(W,d)}}7(U.26&&d!==1d){d.18.5I=\'7N\'}9 h=1P("1s");h.18.2u="7O";7(a&&a.15>7P&&U.4Y===1b){9 i=2C();9 j=1P("1s");1y(h,j);j.1u="<1s 18=\'4c:3m;1V:7Q;1H:5C;2T:4e\'>"+a.1z(0,7R)+"</1s><1s 18=\'4c:3m\'>...&5J;</1s><a 1r=\'"+i+"4f\' 1I=\\"2S:1q.4g(\\\'"+i+"\\\')\\" 18=\'1Q-4d: 2E\'><1O 1r=\'"+i+"4h\'>"+Z("2N")+"</1O></a>";9 k=1P("1s");k.1r=i;k.1u=a;k.18.7S="7T";k.18.4a="#7U";k.18.2U="2E";1y(h,k)}13{h.1u=a}7(b){b.1y(h)}};11 5K(a,b){U.2R.2t(a,1k T(b))}9 1n=11(a){12(14 a!="1h")};9 5L=11(a,b){9 c=0;9 d=a.15;9 e=0;9 f=b.15;9 i=0;9 g=1b;2a(e+i<f){7(c+i<d){4i(a.2F(c+i)){1J"?":i++;4j;1J\'*\':g=17;e+=i;c+=i;5M{++c;7(c==d){12 17}}2a(a.2F(c)==\'*\');i=0;4j}7(b.2F(e+i)!=a.2F(c+i)){7(!g){12 1b}e++;i=0;4j}i++}13{7(!g){12 1b}e++;i=0}}5M{7(c+i==d){12 17}}2a(a.2F(c+i++)==\'*\');12 1b};11 4k(a){1a(9 b=0;b<U.1C.15;b++){7(U.1C[b].1r==a.1r){U.1C.7V(b,1);1W}}}9 2V=11(t){9 a;7(t 2l 3o){a=[];1a(9 b=0;b<t.15;b++){7(14 t[b]!="11"){a.1j(2V(t[b]))}}}13 7(t 2l 3W){a={};1a(9 c 1N t){7(14 t[c]!="11"){a[c]=2V(t[c])}}}13{a=t}12 a};9 2G=11(a,b,c){9 d=U.50;9 e=0;7(14 b=="3p"){d=b}7(14 c!="1h"){e=c}7(e>=d&&d!=-1){7(14 a=="1A"){12"\'"+a+"\'"}13{12 a}}13{e++}9 f=[];7(14 a=="1h"){12\'1h\'}7(a 2l 3o){1a(9 i=0;i<a.15;i++){f.1j(2G(a[i],d,e))}12"["+f.2m(" , ")+"]"}13 7(14 a=="1A"){12"\'"+a+"\'"}13 7(14 a=="3p"||14 a=="2W"){12 a}13 7(14 a=="1v"){1a(9 g 1N a){7(14 a[g]!="11"){f.1j(g+" : "+2G(a[g],d,e))}}7(f.15>0){12"{"+f.2m(" , ")+"}"}13{12"{}"}}13{12 a}};9 1X=11(a){9 b=a.29(\'.\');9 c=1b;9 d=19[b[0]];7(d&&b.15==1){c=17}7(14 d!="1h"){1a(9 e=1;e<b.15;e++){9 f=b[e];7(f.1p(\'()\')!=-1){9 g=f.29(\'()\');7(14 d[g[0]]==\'11\'){9 h=d[g[0]];12 h.1K(19)}}7(14 d[f]!="1h"){d=d[f];c=17}13{c=1b;1W}}7(c){12 d}}12 1d};9 5N=11(a,b){7(14 b==\'1A\'){9 h=1X(b);12 h.1K(19,a)}13 7(14 b==\'11\'){12 b.1K(19,a)}12 1d};9 3q=11(t){12 t.2B(/^\\s+|\\s+$/g,"")};9 1L=11(a,b,c,d){7(14 a=="1h"||14 b=="1h"){12 1b}7(U.3e){1w(Z("2v",[a,2G(b)]))}7(U.1C){1a(9 e=0;e<U.1C.15;e++){9 f=U.1C[e];7((f.1g 2l 2A&&f.1g.2h(a))||f.1g==a||(14 f.1g.2F==\'11\'&&5L(f.1g,a))){b.1g=a;7(U.3e){9 g=a;7(f.5O){g=f.5O}1w(Z("5a",[g,f]))}7(f.2n==\'1K\'&&f.1l){9 h;9 j=\'1h\';7(f.1l.2b){h=1X(f.1l.1v);7(14 5P==\'11\'){j=1k h()}13 7(h){j=h}13{1w(Z("57",[f.1l.2b,f.1l.1v]))}7(14 j!="1h"&&14 j[f.1l.2b]==\'11\'){j[f.1l.2b].1K(19,b)}13{1w(Z("59",[f.1l.2b,f.1l.1v]))}}13 7(f.1l.4l){f.1l.4l.1K(19,b)}}}13 7(U.1C[e].2n==\'7W\'){9 k=U.1C[e].2H;1a(9 l=0;l<k.15;l++){7(k[l]!=a){1L(k[l],b)}}}}}9 m=17;7(14 c!="1h"){m=c}7(m===17&&19.2X!==1d&&19.2X.15>0){9 n=U.2P.3c();1a(9 i=0;i<n.15;i++){9 o=U.2P.1E(n[i]);7(o.1c&&!o.1Y&&19.2X[o.1m+"1R"]&&19.2X[o.1m+"1R"].1q){19.2X[o.1m+"1R"].1q.2v("/5Q"+a,b,17,1b)}}}7(U.3Q){9 p=17;7(14 d!="1h"){p=d}7(p&&19.5R.1q){19.5R.1q.2v("/5Q"+a,b,1b,17)}}12 17};9 3r=11(l,t){7(!1n(l)){12 1d}9 a;7(14 l==\'1v\'&&!(l 2l 2A)){7(l.1g){l.1g=3q(l.1g)}7(l.2k){l.1g=1k 2A(l.2k)}a=l}13 7(14 t==\'1A\'){a={};7(l.2k){a.1g=1k 2A(l.2k)}13{a.1g=l}a.1l={};9 b=t.29(\'.\');a.2n="1K";a.1l.2b=b.3s();a.1l.1v=b.2m(\'.\')}13 7(14 t==\'11\'){a={};7(l.2k){a.1g=1k 2A(l.2k)}13{a.1g=l}a.1l={};a.2n="1K";a.1l.4l=t}13{1w(Z("5c",[l]))}7(1n(a)){7(!1n(U.1C)){U.1C=[]}7(!a.1r){a.1r=2C()}7(a.1g){a.1Z={};a.1Z.4m=11(){12 2G(1i)};U.1C.1j(a)}13{1w(Z("5d",[l]));12 1d}12 a}12 1d};9 3t=11(b,c){9 d=1i;1i.7X=b;9 e;1i.5S=11(){1a(9 a=0;a<b.2H.15;a++){1L(b.2H[a],{1g:b.2H[a],2c:\'5T\',1M:d,2d:b.1F})}};1i.5U=11(){7(!e){9 a=1X(b.3V);7(14 a==\'11\'){e=1k a()}13 7(14 5P==\'1v\'){e=a}}7((e&&14 e==\'1v\')){7(14 e[b.4n]==\'11\'){e[b.4n]({2c:\'5T\',1M:d,2d:b.1F})}}};1i.3u=11(){7(c){d.5U()}13{d.5S()}19.2e(d.3u,b.1F)}};9 5V=11(){7(19.5W&&!(U.27&&1n(U.1t)&&14(U.1t.5X)=="2W"&&U.1t.5X===17)){12 1k 19.5W()}13 7(19.5Y){12 1k 19.5Y("7Y.7Z")}13{12 1d}};11 2I(a,b,c){7(c.21){c.21(a,b)}13{1w(Z("5f",[a]))}}9 2o;9 1U;11 2p(){7(U.3k.15>0){2o(U.3k.3s())}13{U.3v=1b;7(1n(U.2q)&&U.2q.15>0){9 a=U.2q[0];U.2q.5Z();1U(a)}}}1U=11(c,d,f,g){9 h;9 i;9 j=17;9 k=11(){7(i.3c().15===0){7(1n(d)){2e(11(){d()},0)}i.2u();U.3w=1b;2p()}12};7(c 2l 3o){h=c;i=f;j=g}13{h=c.2Y;d=c.1S;i=c.60;j=c.3x}7(!1n(i)&&(U.3w||U.3v)){i=1k T();7(!1n(U.2q)){U.2q=[]}U.2q.1j({2Y:h,1S:d,3x:j});12}13 7(!1n(i)){U.3w=17;i=1k T()}7(h.15<=0){k()}9 l=1k 61().62();9 m=h[h.15-1];9 n="80"+2C();9 e=1P("1G");e.81=l;e.1r=n;V.1y(e);9 o=1e(n);i.2t(n,m);9 p=11(a){9 b=1e(a);7(b&&!(1n(j)&&j===1b)){b.22.4o(b)}i.3d(a);7(h.15-1>0){h.3s();1U({2Y:h,1S:d,60:i,3x:j})}k()};7(U.27){o.3y=11(){7(1i.3z=="26"){9 a=n;p(a)}};1e(n).1M=m}13{o.2Z=11(){9 a=n;p(a)};2e(11(){1e(n).1M=m},0)}};2o=11(a){7(14 a==\'1h\'||!a.1f){1w(Z("5e"));12}7((U.3w&&a.2r)||(U.3v&&a.2r)){U.3k.1j(a);12}U.3v=17;9 b=5V();9 c="4p";9 d=17;9 f;9 g=1b;7(a.2d){2e(11(){7(g===1b){g=17;7(b.63){b.63()}2I(Z("55",[a.1f]),b,a);2p();12}},a.2d)}7(14 a.2r!="1h"){d=a.2r}7(a.2J){c=a.2J}7(14 a.1S==\'11\'){f=a.1S}9 h=1d;7(a.2x){h=a.2x}13 7(a.23){h="";1a(9 l 1N a.23){7(14 a.23[l]!="11"){h=h+l+"="+82(a.23[l])+"&"}}}7(d===17&&g===1b){b.3y=11(){7(b.3z==4&&g===1b){g=17;7((b.28==4q||b.28===0)&&f){f(b)}13 7(b.28!=4q){g=17;2I(Z("41",[a.1f,b.28]),b,a)}2p();12}}}3A{7(!g){b.83(c,a.1f,d)}}3B(e){g=17;2I(Z("5g",[a.1f]),b,a);2p();12}7(a.30&&a.30.15>0){1a(9 i=0;i<a.30.15;i++){b.4r(a.30[i].31,a.30[i].1D)}}7(a.2J){c=a.2J;7(c.84()==\'85\'){7(!a.4s){b.4r("64-65","86/x-87-88-89")}}}7(a.4s){b.4r("64-65",a.4s)}3A{7(g===1b){b.8a(h)}}3B(8b){g=17;2I(Z("5i",[a.1f]),b,a);2p();12}7(g===1b&&d===1b){g=17;7(b.28===4q||b.28===0){7(f){f(b)}}13{g=17;2I(Z("41",[a.1f,b.28]),b,a)}2p()}};9 4t=11(a){9 b=1P("32");b.2c="1Q/4u";b.66="67";7(a[0]==\'/\'){a=U.3f+a}b.1I=a;7(1o.33(\'4v\').15===0){9 c=1o.3l("4v");1o.68.8c(c,1o.68.8d)}V.1y(b)};9 34=11(a,b){9 c=a.69;1a(9 l=0;c&&l<c.15;l++){7(c[l].8e==1){b.1j(c[l]);7(c[l].69.15>0){34(c[l],b)}}}12 b};9 4w=11(a,b){9 c=[];7(1n(b)){9 d=b;7(14 b=="1A"){d=1e(b)}c=34(d,[])}13{c=(1o.4x)?1o.4x:1o.33("*")}9 e=[];1a(9 i=0;i<c.15;i++){7(c[i].24.1p(\' \')!=-1){9 f=c[i].24.29(\' \');1a(9 g=0;g<f.15;g++){7(f[g]==a){e.1j(c[i])}}}13 7(c[i].24==a){e.1j(c[i])}}12 e};9 6a=11(a,b,c){9 d=4w(b,a);1a(9 i=0;i<d.15;i++){7(d[i].24.1p(\' \')!=-1){9 e=d[i].24.29(\' \');1a(9 f 1N e){7(e[f]==b){e[f]=c}}d[i].24=e.2m(\' \')}13 7(d[i].24==b){d[i].24=c}}};1i.3C=11(a){7(U.2Q.1E(a)){12}9 b="1q.2Q."+a.31+".8f";9 c=1X(b);7(14 c!="11"){1w(Z("5r",[b]))}13{9 d=1k c(a);7(d.3D){d.3D.1K(19)}U.2Q.2t(a.31,d)}};11 3E(a,b){7(U.51){7(!1n(b)||!b){b=1P("1s")}b.24="";b.18.2j="3Y";1y(W,b);b.1u=a}13{1w(a)}}11 4y(a,b,c,d,e,f){9 g=Z("5t",[a,b,c,d,e]);3E(g,f)}9 3F=11(f){7(U.2z.1E(f.1m)!=1d){12 1d}9 g="1q.2y."+f.31+".8g";9 h=1X(g);7(14 h!="11"){3E(Z("5p",[g]),1e(f.1m));12 1d}9 i;7((14 f.1D==\'1A\')&&f.1D.1p("@{")===0){9 j=/[^@{].*[^}]/.6b(f.1D);f.1D=1X(j+"")}9 k=f.1m;7(U.27){9 l=1d;7(19.21){l=19.21}9 m=11(a,b,c){9 d=k;4y(g,d,b,c,a,1e(d))};19.21=m;i=1k h(f);19.21=1d;7(l){19.21=l}}13 7(14 h==\'11\'){3A{i=1k h(f)}3B(e){9 n=Z("43");9 o=1d;7(e.6c){n=e.6c}7(e.1x){o=e.1x}7(U.2g){4y(g,f.1m,f.1G,n,o,1e(f.1m));12 1d}}}7(14 i==\'1v\'){U.2z.2t(f.1m,i);7(i.3D){i.3D.1K(19)}7(f.2s&&f.2s.1j){1a(9 p=0;p<f.2s.15;p++){9 q=f.2s[p].1g;9 r=f.2s[p].8h;9 s=1d;7(14 r==\'1A\'&&r.1p("@{")===0){9 t=/[^@{].*[^}]/.6b(r);s=1X(t+"")}13 7(i[r]){s=i[r]}7(s!==1d){3r(f.2s[p].1g,s)}}}1L("/1q/35/3i/26",{1r:f.1m});12 i}13{3E(Z("5s",[g]),1e(f.1m))}12 1d};9 4z=11(a){12 U.2z.1E(a)};9 3G=11(a){9 b=4z(a);7(b){7(14 b.4A==\'11\'){b.4A()}9 c=1e(a);7(1d!==c){c.22.4o(c)}}U.2z.3d(a)};1i.3H=11(a){7(!1n(a)){9 b=U.2z.3c();1a(9 l=0;l<b.15;l++){3G(b[l])}U.26=1b;U.2y=[]}13{9 c=34(a,[]);1a(9 d=0;d<c.15;d++){7(c[d].1r){3G(c[d].1r)}}}};9 8i=11(a,b){9 c=[];c.1j(a);1U({2Y:c,1S:b})};9 6d=11(a){U.2y.1j(a);7(U.26){3F(a)}};9 8j=11(a){U.3g.1j(a)};9 4B=11(a){12 U.2Q.1E(a)};11 4C(){U.26=17;1a(9 l=0;l<U.2y.15;l++){3F(U.2y[l])}}11 6e(){1a(9 l=0;l<U.3g.15;l++){3C(U.3g[l])}}9 6f=11(a,b){7(U.26===17){7(1e(b)){1e(b).1u=Z("5l",[b])}}13{1o.5m("<1G 1M=\'"+a+"\'></1G>")}};9 6g=11(a,b){a.1Z=1k b();a.1Z.42=a;a.8k=b.1Z;1a(9 i 1N a.1Z){7(14 a.1Z[i]!="1h"){a[i]=a.1Z[i]}}};9 6h=11(){9 a=1e("47");7(a){a.18.5I=\'4e\'}};9 6i=11(){9 b=1e("48");7(b){b.1u=""}};9 6j=11(a){9 n=1e(a);7(n&&n.18){n.18.2U="8l";9 h=1e(a+"4f");h.1I="2S:1q.6k(\'"+a+"\')";9 l=1e(a+"4h");l.1u="&5J;"+Z("45")}};9 6l=11(a){9 n=1e(a);7(n&&n.18){n.18.2U="2E";9 h=1e(a+"4f");h.1I="2S:1q.4g(\'"+a+"\')";9 l=1e(a+"4h");l.1u=Z("2N")}};9 6m=11(a){7(a){9 b=a.1g;9 c={6n:a.6n,2c:a.2c,6o:a.6o};7(1n(a.1D)){c.1D=a.1D}9 d=a.2n;7(!d){b=b+"/"+a.2c}7(1n(d)&&d 2l 3o){1a(9 e=0;e<d.15;e++){9 f=2V(c);7(d[e].1g){f.1g=d[e].1g}13{f.1g=a.1g}7(d[e].1x){f.1x=d[e].1x}1L(f.1g,f)}}13{7(d){7(d.1g){b=c.1g=d.1g}7(d.1x){c.1x=d.1x}}1L(b,c)}}};9 4D=11(a){9 b=0;9 c=0;7(a.4E){2a(17){c+=a.8m;b+=a.8n;7(a.4E===1d){1W}a=a.4E}}13 7(a.y){c+=a.y;b+=a.x}12{x:b,y:c}};9 4F=11(n,a){7(14 n==\'1h\'||n===1d){12 1d}9 b=0;7(14 a!="1h"){b=a}9 c=n.22;2a(c&&17){7(c.3I>b){1W}7(c.22&&c.22.3I){c=c.22}13{1W}}7(!c){12 1d}12{h:c.3I,w:c.2K}};9 3J=11(a){7(1n(a)){1a(9 b=0;b<a.15;b++){9 c=a[b];7(c.2n==\'1K\'&&1n(c.1l)&&1n(c.1l.1v)&&1n(c.1l.2b)&&1n(c.2d)){9 d=1k 3t({3V:c.1l.1v,4n:c.1l.2b,1F:c.2d},17);U.2O.1j(d);d.3u()}13 7(a[b].2n==\'2v\'){9 e=1k 3t({2H:a[b].2H,1F:c.2d},1b);U.2O.1j(e);e.3u()}}}};9 6p=11(a){9 b=[];b.1j(a);3J(b)};9 6q=11(){7(U.2M){12}13{U.2M=17}7(U.1t.6r){4i(U.1t.6r){1J\'2g\':U.2g=17;1w(Z("5y",[U.4X]));1W;1J\'4x\':U.2g=17;U.3e=17;1W;1J\'8o\':U.2g=1b;1W}}7(U.1t.36){7(U.1t.36.2O){3J(U.1t.36.2O)}7(U.1t.8p){1a(9 a=0;a<U.1t.36.6s.15;a++){3r(U.1t.36.6s[a])}}}7(U.2D){1a(9 i=0;i<U.2D.15;i++){9 b=U.2D[i];1w(b.1Q,b.5B)}}1L("/1q/35/8q",{});6e();1L("/1q/35/8r",{});4C();1L("/1q/35/8s",{});7(U.1t.6t){9 c=U.1t.6t;7(!/(^4G)/i.2h(c)){c=U.3f+c}4t(c)}1L("/1q/35/8t",{})};9 4H=11(){V=1o.33("4v")[0];W=1o.2x;7(!U.1t){U.1t={};2o({1f:U.3f+U.4Z+"/1t.6u",2r:1b,2d:8u,21:11(){},1S:11(a){7(a.3K!==""){9 b=4I(\'(\'+a.3K+\')\');7(b.1t){U.1t=b.1t}}}})}6q()};9 4J=11(){9 O=1k 61().62();9 P=1i;9 Q=1b;9 R=[];9 S=11(c,d){d.2f=[];d.37=[];d.38=[];d.39=[];9 e=c;9 f=11(){9 a=19.4K.1I;7(a[a.15-1]=="/"){12 a}9 b=a.29("/");b.3s();a=b.2m("/")+"/";12 a};9 g=1o.33("1G");9 h=1o.33("32");9 k=f();2a(e.1p("<1G")!=-1){9 l=e.1p("<1G");9 m=e.1p("1M=",(l));9 n=e.1p(">",l);9 o=e.1p("</1G>",(l))+"</1G>".15;7(l!=-1&&m!=-1){9 p;9 q=m+5;9 r=e.1z(m+4,(m+5));9 s=e.1p("\\"",(q+1));s=e.1p(r,(q+1));7(m<n){p=e.1z(q,s);9 t=1b;1a(9 i=0;i<g.15;i++){7(14 g[i].1M){7(g[i].1M==p||g[i].1M==(k+p)){t=17;1W}}}7(!t){d.38.1j(p)}}}9 u=n+1;9 v=e.1z(u,o-"</1G>".15);7(v.15>0){d.2f.1j(v)}e=e.1z(0,l)+e.1z(o,e.15);s=-1}2a(e.1p("<18")!=-1){9 w=e.1p("<18");9 x=e.1p(">",w);9 y=e.1p("</18>",w);9 z=x+1;9 A=e.1z(z,y);7(A.15>0){d.37.1j(A)}e=e.1z(0,w)+e.1z(y+"</18>".15,e.15)}2a(e.1p("<32")!=-1){9 B=e.1p("<32");9 C=e.1p("1I=",B);9 D=e.1p(">",B)+1;7(B!=-1&&C!=-1){9 E;9 F=C+6;9 G=e.1z(C+5,(C+6));9 H=e.1p(G,(F+1));7(C<D){E=e.1z(F,H);9 I=1b;1a(9 J=0;J<h.15;J++){7(1n(h[J].1I)){7(h[J].1I==E){I=17}}}7(!I){d.39.1j(E)}}e=e.1z(0,B)+e.1z(D,e.15)}}1a(9 K=0;d.39&&K<d.39.15;K++){9 L=1P("32");L.1I=d.39[K];L.2c="1Q/4u";L.66="67";V.1y(L)}9 M;7(d.37.15>0){M=1P("18");M.2c="1Q/4u";9 N;1a(9 j=0;j<d.37.15;j++){N=N+d.37[j]}7(1o.3L&&+1o.3L[0].4L){1o.3L[0].4L=1o.3L[0].4L+N}13{1y(M,1o.8v(N));V.1y(M)}}d.23=e;12 e};1i.3a=11(a){7(R.15===0&&!Q){3a(a)}13{R.1j(a)}};11 4M(){7(R.15>0){9 a=R.5Z();3a(a)}Q=1b}11 3M(b,c){3H(b);9 d="8w"+O;9 f=c.23+"<1s 1r=\'"+d+"\'></1s>";b.1u=f;9 g=3N(11(){7(1e(d)){3O(g);3A{P.6v(c,11(){9 a=4B("8x");7(a!==1d){a.8y(b.1r)}4M()})}3B(e){b.1u="<1O 18=\'2j:3Y\'>"+e.1x+"</1O>"}}},25)}11 3a(d){Q=17;2o({2J:"4p",1f:d.1f,2r:1b,1S:11(a){S(a.3K,d);9 b;7(14 d.1T==\'1A\'){b=1e(d.1T);7(!1e(d.1T)){9 c=3N(11(){7(1e(d.1T)){3O(c);b=1e(d.1T);2e(11(){3M(b,d)},0)}},25)}13{3M(b,d)}}13{3M(d.1T,d)}},21:11(){9 a=d.1T;7(14 d.1T==\'1A\'){a=1e(d.1T)}3H(a);a.1u=Z("5z",[d.1f]);4M()}})}1i.1E=11(p){9 b="";2o({2J:"4p",1f:p.1f,2r:1b,1S:11(a){b=S(a.3K);12 b}});12 b};1i.6v=11(c,d){9 e=11(){1a(9 a=0;c.2f&&a<c.2f.15;a++){9 b=c.2f[a];4I(b);7(a==(c.2f.15-1)){7(1n(d)){d()}12}}7(c.2f&&c.2f.15===0&&1n(d)){d()}};7(c.38&&c.38.15>0){1U({2Y:c.38.8z(),3x:1b,1S:11(){e()}})}13{e()}12 17}};U.6w=1k 4J();9 6x=11(e){9 f=1i;9 g;7(14 e.1l==\'1A\'){f.1m=e.1l;g=1e(f.1m)}13{1i.1m=e.1l.1r;g=e.1l}7(!f.1m){f.1m=2C()}U.2P.2t(f.1m,f);9 h;1i.1f=1d;1i.1Y=1b;9 i=1b;9 j=1b;9 k=1b;9 l=0;9 m;9 n;7(e.8A){i=17;j=17}7(14 e.4N==\'2W\'){4N=e.4N}7(14 e.6y==\'2W\'){j=e.6y}9 o=11(a){9 b="";9 c=a.29("://");7(c[1]){7(c[1].1p("/")!=-1){b=c[1].1z(0,c[1].1p("/"))}13{b=c[1]}}12 b};1i.8B=11(a){7(a.w){m=a.w;g.18.1V=m+"1B";7(f.1c){f.1c.18.1V=m-2+"1B"}}7(a.h){n=a.h;g.18.1H=n+"1B";7(f.1c){f.1c.18.1H=n-2+"1B"}}};9 p=11(){9 a=4F(g);7(i||j){7(!g.22){12}9 b=4D(g);7(g.22.8C=="8D"){7(19.6z){7(i){n=19.6z-b.y}7(j){m=19.8E-20}}13{7(a===1d){7(j){m=6A}}13{7(j){m=a.w-20}7(i){n=a.h-b.y}}}}13{7(a===1d){7(j){m=6A}}13{7(j){m=a.w}7(i){n=a.h}}}7(i){7(n<0){n=4O}g.18.1H=n+"1B"}7(j){g.18.1V=m+"1B"}}13{g.18.1V=m+"1B";g.18.1H=n+"1B"}7(n<0){n=4O}7(m<0){m=4P}7(e.2L){7(f.1c){f.1c.18.1H=n-2+"1B";f.1c.18.1V=m-2+"1B"}}h=W.2K};9 q=11(b){7(f.1c){f.1Y=17}7(b.1x){b=b.1x}7(14 b==\'1A\'){f.1f=b}13 7(b.1f){f.1f=b.1f}13 7(b.1D){f.1f=b.1D}11 3b(){7(/4G/i.2h(f.1f)&&6B.19.4K.6C!=o(f.1f)){f.1Y=17}13{f.1Y=1b}7(!f.1Y){9 a=f.1c.3P?f.1c.3P:f.1c.19;7(a&&a.1q){a.1q.3Q=17}}}7(e.2L){7(!f.1c){9 c=3N(11(){7(1e(f.1m+"1R")){3O(c);f.1c=1e(f.1m+"1R");7(U.27){f.1c.3y=11(){7(1i.3z=="6D"){3b()}}}13{f.1c.2Z=3b}f.1c.1M=f.1f}},5)}13{7(U.27){f.1c.3y=11(){7(1i.3z=="6D"){3b()}}}13{f.1c.2Z=3b}f.1c.1M=f.1f}}13{U.6w.3a({1f:f.1f,1T:g})}};9 r=11(){7(!U.27){p();12}7(h!=W.2K&&!k){7(!k){k=17;2e(r,4P)}}13 7(k&&W.2K==l){k=1b;p()}13 7(k){l=W.2K;2e(r,4P)}};9 s=11(){7(19.4Q){19.4Q(\'6E\',r)}13 7(19.4R){19.4R(\'4S\',r,17)}9 a=g;7(f.1c){a=f.1c}7(e.2T){a.18.2T=e.2T}7(e.4T){a.18.4T=e.4T}7(e.3n){a.18.3n=e.3n}7(e.6F){m=6G(e.6F);g.18.1V=m+"1B"}13{m=g.2K;j=17}7(e.6H){n=6G(e.6H)}13{n=g.3I;i=17}7(n<=0){n=4O}g.18.1H=n+"1B";7(e.8F&&f.1c){f.1c.18.1H=n+"1B"}p();7(e.1f&&!e.2L){q(e.1f)}13 7(e.23&&!f.1c){g.1u=e.23}13 7(e.1f&&!e.1f){q(e.1f)}7(f.1c){f.1c.18.2U="8G"}};11 4U(b){f.1c=1e(f.1m+"1R");7(f.1c){f.1c.22.4o(f.1c)}9 c="<1c 18=\'2U:2E\' 1r=\'"+f.1m+"1R\' 31=\'"+f.1m+"1R\' 8H=0 8I="+((e.2T==\'4e\')?\'8J\':\'8K\')+"></1c>";g.1u=c;9 d=3N(11(){7(1e(f.1m+"1R")){3O(d);f.1c=1e(f.1m+"1R");2e(11(){7(/4G/i.2h(f.1f)&&6B.19.4K.6C!=o(f.1f)){f.1Y=17}13{f.1Y=1b}7(!f.1Y&&b){9 a=f.1c.3P?f.1c.3P:f.1c.19;7(a&&a.1o.2x){a.1o.2x.1u=b}}s()},0)}},5)}9 t=11(){7(e.2L){7(f.1c){q("")}13{e.1f=""}}13{3H(g);g.1u=""}};9 u=11(a){9 b;7(a.1x){a=a.1x}7(a.1D){b=a.1D}13{b=a}7(!f.1c){g.1u=b}13{t();g.1u="";4U(a)}};1i.4A=11(){U.2P.3d(f.1m);7(19.4Q){19.8L(\'6E\',r)}13 7(19.4R){19.8M("4S",r,17)}};f.2u=t;f.4S=p;f.8N=q;f.8O=u;f.8P=s;7(e.2L&&e.2L===17){4U(e.23)}13{s()}};U.6u=11(){9 f=11(n){12 n<10?\'0\'+n:n};9 m={\'\\b\':\'\\\\b\',\'\\t\':\'\\\\t\',\'\\n\':\'\\\\n\',\'\\f\':\'\\\\f\',\'\\r\':\'\\\\r\',\'"\':\'\\\\"\',\'\\\\\':\'\\\\\\\\\'};9 e=11(b,d){9 a,i,k,l,r=/["\\\\\\8Q-\\8R\\8S-\\8T]/g,v;4i(14 b){1J\'1A\':12 r.2h(b)?\'"\'+b.2B(r,11(a){9 c=m[a];7(c){12 c}c=a.8U();12\'\\\\8V\'+8W.8X(c/16).4m(16)+(c%16).4m(16)})+\'"\':\'"\'+b+\'"\';1J\'3p\':12 8Y(b)?4V(b):\'1d\';1J\'2W\':12 4V(b);1J\'1d\':12 4V(b);1J\'8Z\':12 b.90()+\'-\'+f(b.91()+1)+\'-\'+f(b.92())+\'T\'+f(b.93())+\':\'+f(b.94())+\':\'+f(b.95())+\'Z\';1J\'1v\':7(!b){12\'1d\'}7(14 b.6I===\'11\'){12 e(b.6I())}a=[];7(14 b.15===\'3p\'&&!(b.96(\'15\'))){l=b.15;1a(i=0;i<l;i+=1){a.1j(e(b[i],d)||\'1d\')}12\'[\'+a.2m(\',\')+\']\'}7(d){l=d.15;1a(i=0;i<l;i+=1){k=d[i];7(14 k===\'1A\'){v=e(b[k],d);7(v){a.1j(e(k)+\':\'+v)}}}}13{1a(k 1N b){7(14 k===\'1A\'){v=e(b[k],d);7(v){a.1j(e(k)+\':\'+v)}}}}12\'{\'+a.2m(\',\')+\'}\'}12\'1d\'};12{97:e,98:11(a,b){9 j;a=3q(a);9 c=11(k,v){9 i,n;7(v&&14 v===\'1v\'){1a(i 1N v){7(3W.1Z.99.9a(v,[i])){n=c(i,v[i]);7(n!==1h){v[i]=n}}}}12 b(k,v)};7(/^[\\],:{}\\s]*$/.2h(a.2B(/\\\\./g,\'@\').2B(/"[^"\\\\\\n\\r]*"|17|1b|1d|-?\\d+(?:\\.\\d*)?(:?[9b][+\\-]?\\d+)?/g,\']\').2B(/(?:^|:|,)(?:\\s*\\[)+/g,\'\'))){j=4I(\'(\'+a+\')\');12 14 b===\'11\'?c(\'\',j):j}9c 1k 2i(Z(\'56\'));}}}();U.2R=1k T();5K(U.3R,U.54);9 4W=19.2Z;19.2Z=11(){7(!U.2M){4H()}13{4C();12}7(14 4W==\'11\'){4W()}};46({9d:1w,9e:46,9f:X,9g:Z,9h:Y,2s:3r,4k:4k,2v:1L,9i:3t,9j:2G,9k:1X,9l:2C,2w:2o,9m:1U,9n:6d,9o:4t,9p:4w,9q:6a,9r:34,9s:4z,9t:3F,3C:3C,9u:4B,9v:3G,9w:3q,9x:6f,9y:6g,5H:6h,5F:6i,4g:6j,6k:6l,9z:4H,9A:2V,9B:5N,9C:6m,9D:4F,9E:4D,9F:6p,9G:3J,9H:6x,9I:4J},U);12 U}()}',62,603,'|||||||if||var||||||||||||||||||||||||||||||||||||||||||||||||||||||function|return|else|typeof|length||true|style|window|for|false|iframe|null|bd|url|topic|undefined|this|push|new|target|uuid|bf|document|indexOf|jmaki|id|div|config|innerHTML|object|be|message|appendChild|substring|string|px|subs|value|get|to|script|height|href|case|call|bm|src|in|span|bc|text|_iframe|callback|injectionPoint|br|width|break|bj|externalDomain|prototype||onerror|parentNode|content|className||loaded|MSIE|status|split|while|functionName|type|timeout|setTimeout|embeddedScripts|debug|test|Error|color|topicRegExp|instanceof|join|action|bq|updateAjaxQueue|_scriptQueue|asynchronous|subscribe|put|clear|publish|doAjax|body|widgets|attributes|RegExp|replace|bb|_messages|none|charAt|bi|topics|handleAjaxError|method|clientWidth|useIframe|initialized|more|timers|dcontainers|extensions|messages|javascript|overflow|display|bh|boolean|frames|libs|onload|headers|name|link|getElementsByTagName|bt|runtime|glue|embeddedStyles|scriptReferences|styleReferences|inject|enableEvents|keys|remove|debugGlue|webRoot|preextensions|error|widget|Unable|ajaxRequestQueue|createElement|left|overflowY|Array|number|bl|bn|pop|bo|run|processingAjax|processingScripts|cleanup|onreadystatechange|readyState|try|catch|loadExtension|postLoad|logError|bw|by|clearWidgets|clientHeight|bM|responseText|styleSheets|processTask|setInterval|clearInterval|contentWindow|publishToParent|defaultLocale|locale|Publish|not|on|Object|Subscribe|red|required|jMaki|ajax_server_error|constructor|unknown|Logger|x_close|ba|jmakiLogger|jmakiLoggerContent|0px|background|white|float|decoration|hidden|_href|showLogMessage|_link|switch|continue|unsubscribe|functionHandler|toString|fn|removeChild|GET|200|setRequestHeader|contentType|bs|css|head|bu|all|logWidgetError|bx|destroy|bC|bootstrapWidgets|bK|offsetParent|bL|http|bP|eval|bQ|location|cssText|processNextTask|autosizeH|320|500|attachEvent|addEventListener|resize|overflowX|createIframe|String|bS|version|verboseDebug|resourcesRoot|inspectDepth|displayErrorsInline|en|us|defaultMessages|request_timeout|invalid_json|publish_function_not_found|found|publish_object_not_found|publish_match|Topic|subscribe_handler_required|subscribe_topic_required|ajax_url_required|ajax_error|ajax_request_open_error|request|ajax_send_body_error|of|with|write_dynamic_script_error|write|load|an|widget_constructor_not_found|find|extension_constructor_not_found|widget_instantiation_error|widget_error|jmaki_logger|Clear|clear_logger|hide_logger|jmaki_version|unable_to_load_url|counter|level|12px|right|align|clearLogger|title|hideLogger|visibility|nbsp|addMessages|bg|do|bk|topicString|_obj|global|parent|processTopic|timer|processCall|bp|XMLHttpRequest|forceActiveXXHR|ActiveXObject|shift|inprocess|Date|getMilliseconds|abort|Content|Type|rel|stylesheet|documentElement|childNodes|bv|exec|lineNumber|bA|loadExtensions|bD|bE|bF|bG|bH|hideLogMessage|bI|bJ|widgetId|targetId|bN|bO|logLevel|listeners|theme|json|loadScripts|injector|bR|autosizeW|innerHeight|400|top|host|complete|onresize|startWidth|Number|startHeight|toJSON|_globalScope|delete|resources|navigator|userAgent|Request|timed|out|Invalid|JSON|green|Match|listener|Handler|subscriber|or|making|sending|communicating|Server|returned|code|Attempt|that|can|dynamically|Consider|using|the|extension|create|instance|Enable|logging|details|loading|Script|line|Message|Hide|Version|URL|jmk|getElementById|border|1px|solid|000000|fontSize|position|absolute|zIndex|999|bottom|65B2DB|600px|300px|14px|000|font|size|10px|545px|center|286px|auto|visible|both|125|535px|135|margin|5px|FF9900|splice|forward|args|Microsoft|XMLHTTP|c_script_|start|encodeURIComponent|open|toLowerCase|post|application|www|form|urlencoded|send|er|insertBefore|firstChild|nodeType|Extension|Widget|handler|bz|bB|superclass|block|offsetTop|offsetLeft|off|gluelisteners|intialized|extensionsLoaded|widgetsLoaded|loadComplete|3000|createTextNode|injector_|widgetFactory|findAndAdd|reverse|autosize|setSize|nodeName|BODY|innerWidth|useIFrame|inline|frameborder|scrolling|NO|YES|dettachEvent|removeEventListener|loadURL|setContent|init|x00|x1f|x7f|x9f|charCodeAt|u00|Math|floor|isFinite|date|getUTCFullYear|getUTCMonth|getUTCDate|getUTCHours|getUTCMinutes|getUTCSeconds|propertyIsEnumerable|serialize|deserialize|hasOwnProperty|apply|eE|throw|log|mixin|namespace|getMessage|messageFormat|Timer|inspect|findObject|genId|addLibraries|addWidget|loadStyle|getElementsByStyle|replaceStyleClass|getAllChildren|getWidget|loadWidget|getExtension|removeWidget|trim|writeScript|extend|initialize|clone|filter|processActions|getDimensions|getPosition|addTimer|addTimers|DContainer|Injector'.split('|'),0,{}))
