www.avantiwestcoast.co.uk Open in urlscan Pro
52.215.251.192  Public Scan

Submitted URL: http://avantiwestcoast.co.uk/Assets/js/assets.compiled.js?version=12.0.0.0
Effective URL: https://www.avantiwestcoast.co.uk/Assets/js/assets.compiled.js?version=12.0.0.0
Submission: On November 24 via api from CH — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

/** vim: et:ts=4:sw=4:sts=4
 * @license RequireJS 2.1.22 Copyright (c) 2010-2015, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/jrburke/requirejs for details
 */
//Not using strict: uneven strict support in browsers, #392, and causes
//problems with requirejs.exec()/transpiler plugins that may not be strict.
/*jslint regexp: true, nomen: true, sloppy: true */
/*global window, navigator, document, importScripts, setTimeout, opera */

var requirejs, require, define;
(function (global) {
    var req, s, head, baseElement, dataMain, src,
        interactiveScript, currentlyAddingScript, mainScript, subPath,
        version = '2.1.22',
        commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
        cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
        jsSuffixRegExp = /\.js$/,
        currDirRegExp = /^\.\//,
        op = Object.prototype,
        ostring = op.toString,
        hasOwn = op.hasOwnProperty,
        ap = Array.prototype,
        isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document),
        isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
        //PS3 indicates loaded and complete, but need to wait for complete
        //specifically. Sequence is 'loading', 'loaded', execution,
        // then 'complete'. The UA check is unfortunate, but not sure how
        //to feature test w/o causing perf issues.
        readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
                      /^complete$/ : /^(complete|loaded)$/,
        defContextName = '_',
        //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
        isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',
        contexts = {},
        cfg = {},
        globalDefQueue = [],
        useInteractive = false;

    function isFunction(it) {
        return ostring.call(it) === '[object Function]';
    }

    function isArray(it) {
        return ostring.call(it) === '[object Array]';
    }

    /**
     * Helper function for iterating over an array. If the func returns
     * a true value, it will break out of the loop.
     */
    function each(ary, func) {
        if (ary) {
            var i;
            for (i = 0; i < ary.length; i += 1) {
                if (ary[i] && func(ary[i], i, ary)) {
                    break;
                }
            }
        }
    }

    /**
     * Helper function for iterating over an array backwards. If the func
     * returns a true value, it will break out of the loop.
     */
    function eachReverse(ary, func) {
        if (ary) {
            var i;
            for (i = ary.length - 1; i > -1; i -= 1) {
                if (ary[i] && func(ary[i], i, ary)) {
                    break;
                }
            }
        }
    }

    function hasProp(obj, prop) {
        return hasOwn.call(obj, prop);
    }

    function getOwn(obj, prop) {
        return hasProp(obj, prop) && obj[prop];
    }

    /**
     * Cycles over properties in an object and calls a function for each
     * property value. If the function returns a truthy value, then the
     * iteration is stopped.
     */
    function eachProp(obj, func) {
        var prop;
        for (prop in obj) {
            if (hasProp(obj, prop)) {
                if (func(obj[prop], prop)) {
                    break;
                }
            }
        }
    }

    /**
     * Simple function to mix in properties from source into target,
     * but only if target does not already have a property of the same name.
     */
    function mixin(target, source, force, deepStringMixin) {
        if (source) {
            eachProp(source, function (value, prop) {
                if (force || !hasProp(target, prop)) {
                    if (deepStringMixin && typeof value === 'object' && value &&
                        !isArray(value) && !isFunction(value) &&
                        !(value instanceof RegExp)) {

                        if (!target[prop]) {
                            target[prop] = {};
                        }
                        mixin(target[prop], value, force, deepStringMixin);
                    } else {
                        target[prop] = value;
                    }
                }
            });
        }
        return target;
    }

    //Similar to Function.prototype.bind, but the 'this' object is specified
    //first, since it is easier to read/figure out what 'this' will be.
    function bind(obj, fn) {
        return function () {
            return fn.apply(obj, arguments);
        };
    }

    function scripts() {
        return document.getElementsByTagName('script');
    }

    function defaultOnError(err) {
        throw err;
    }

    //Allow getting a global that is expressed in
    //dot notation, like 'a.b.c'.
    function getGlobal(value) {
        if (!value) {
            return value;
        }
        var g = global;
        each(value.split('.'), function (part) {
            g = g[part];
        });
        return g;
    }

    /**
     * Constructs an error with a pointer to an URL with more information.
     * @param {String} id the error ID that maps to an ID on a web page.
     * @param {String} message human readable error.
     * @param {Error} [err] the original error, if there is one.
     *
     * @returns {Error}
     */
    function makeError(id, msg, err, requireModules) {
        var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
        e.requireType = id;
        e.requireModules = requireModules;
        if (err) {
            e.originalError = err;
        }
        return e;
    }

    if (typeof define !== 'undefined') {
        //If a define is already in play via another AMD loader,
        //do not overwrite.
        return;
    }

    if (typeof requirejs !== 'undefined') {
        if (isFunction(requirejs)) {
            //Do not overwrite an existing requirejs instance.
            return;
        }
        cfg = requirejs;
        requirejs = undefined;
    }

    //Allow for a require config object
    if (typeof require !== 'undefined' && !isFunction(require)) {
        //assume it is a config object.
        cfg = require;
        require = undefined;
    }

    function newContext(contextName) {
        var inCheckLoaded, Module, context, handlers,
            checkLoadedTimeoutId,
            config = {
                //Defaults. Do not set a default for map
                //config to speed up normalize(), which
                //will run faster if there is no default.
                waitSeconds: 7,
                baseUrl: './',
                paths: {},
                bundles: {},
                pkgs: {},
                shim: {},
                config: {}
            },
            registry = {},
            //registry of just enabled modules, to speed
            //cycle breaking code when lots of modules
            //are registered, but not activated.
            enabledRegistry = {},
            undefEvents = {},
            defQueue = [],
            defined = {},
            urlFetched = {},
            bundlesMap = {},
            requireCounter = 1,
            unnormalizedCounter = 1;

        /**
         * Trims the . and .. from an array of path segments.
         * It will keep a leading path segment if a .. will become
         * the first path segment, to help with module name lookups,
         * which act like paths, but can be remapped. But the end result,
         * all paths that use this function should look normalized.
         * NOTE: this method MODIFIES the input array.
         * @param {Array} ary the array of path segments.
         */
        function trimDots(ary) {
            var i, part;
            for (i = 0; i < ary.length; i++) {
                part = ary[i];
                if (part === '.') {
                    ary.splice(i, 1);
                    i -= 1;
                } else if (part === '..') {
                    // If at the start, or previous value is still ..,
                    // keep them so that when converted to a path it may
                    // still work when converted to a path, even though
                    // as an ID it is less than ideal. In larger point
                    // releases, may be better to just kick out an error.
                    if (i === 0 || (i === 1 && ary[2] === '..') || ary[i - 1] === '..') {
                        continue;
                    } else if (i > 0) {
                        ary.splice(i - 1, 2);
                        i -= 2;
                    }
                }
            }
        }

        /**
         * Given a relative module name, like ./something, normalize it to
         * a real name that can be mapped to a path.
         * @param {String} name the relative name
         * @param {String} baseName a real name that the name arg is relative
         * to.
         * @param {Boolean} applyMap apply the map config to the value. Should
         * only be done if this normalization is for a dependency ID.
         * @returns {String} normalized name
         */
        function normalize(name, baseName, applyMap) {
            var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex,
                foundMap, foundI, foundStarMap, starI, normalizedBaseParts,
                baseParts = (baseName && baseName.split('/')),
                map = config.map,
                starMap = map && map['*'];

            //Adjust any relative paths.
            if (name) {
                name = name.split('/');
                lastIndex = name.length - 1;

                // If wanting node ID compatibility, strip .js from end
                // of IDs. Have to do this here, and not in nameToUrl
                // because node allows either .js or non .js to map
                // to same file.
                if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
                    name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
                }

                // Starts with a '.' so need the baseName
                if (name[0].charAt(0) === '.' && baseParts) {
                    //Convert baseName to array, and lop off the last part,
                    //so that . matches that 'directory' and not name of the baseName's
                    //module. For instance, baseName of 'one/two/three', maps to
                    //'one/two/three.js', but we want the directory, 'one/two' for
                    //this normalization.
                    normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
                    name = normalizedBaseParts.concat(name);
                }

                trimDots(name);
                name = name.join('/');
            }

            //Apply map config if available.
            if (applyMap && map && (baseParts || starMap)) {
                nameParts = name.split('/');

                outerLoop: for (i = nameParts.length; i > 0; i -= 1) {
                    nameSegment = nameParts.slice(0, i).join('/');

                    if (baseParts) {
                        //Find the longest baseName segment match in the config.
                        //So, do joins on the biggest to smallest lengths of baseParts.
                        for (j = baseParts.length; j > 0; j -= 1) {
                            mapValue = getOwn(map, baseParts.slice(0, j).join('/'));

                            //baseName segment has config, find if it has one for
                            //this name.
                            if (mapValue) {
                                mapValue = getOwn(mapValue, nameSegment);
                                if (mapValue) {
                                    //Match, update name to the new value.
                                    foundMap = mapValue;
                                    foundI = i;
                                    break outerLoop;
                                }
                            }
                        }
                    }

                    //Check for a star map match, but just hold on to it,
                    //if there is a shorter segment match later in a matching
                    //config, then favor over this star map.
                    if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) {
                        foundStarMap = getOwn(starMap, nameSegment);
                        starI = i;
                    }
                }

                if (!foundMap && foundStarMap) {
                    foundMap = foundStarMap;
                    foundI = starI;
                }

                if (foundMap) {
                    nameParts.splice(0, foundI, foundMap);
                    name = nameParts.join('/');
                }
            }

            // If the name points to a package's name, use
            // the package main instead.
            pkgMain = getOwn(config.pkgs, name);

            return pkgMain ? pkgMain : name;
        }

        function removeScript(name) {
            if (isBrowser) {
                each(scripts(), function (scriptNode) {
                    if (scriptNode.getAttribute('data-requiremodule') === name &&
                            scriptNode.getAttribute('data-requirecontext') === context.contextName) {
                        scriptNode.parentNode.removeChild(scriptNode);
                        return true;
                    }
                });
            }
        }

        function hasPathFallback(id) {
            var pathConfig = getOwn(config.paths, id);
            if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
                //Pop off the first array value, since it failed, and
                //retry
                pathConfig.shift();
                context.require.undef(id);

                //Custom require that does not do map translation, since
                //ID is "absolute", already mapped/resolved.
                context.makeRequire(null, {
                    skipMap: true
                })([id]);

                return true;
            }
        }

        //Turns a plugin!resource to [plugin, resource]
        //with the plugin being undefined if the name
        //did not have a plugin prefix.
        function splitPrefix(name) {
            var prefix,
                index = name ? name.indexOf('!') : -1;
            if (index > -1) {
                prefix = name.substring(0, index);
                name = name.substring(index + 1, name.length);
            }
            return [prefix, name];
        }

        /**
         * Creates a module mapping that includes plugin prefix, module
         * name, and path. If parentModuleMap is provided it will
         * also normalize the name via require.normalize()
         *
         * @param {String} name the module name
         * @param {String} [parentModuleMap] parent module map
         * for the module name, used to resolve relative names.
         * @param {Boolean} isNormalized: is the ID already normalized.
         * This is true if this call is done for a define() module ID.
         * @param {Boolean} applyMap: apply the map config to the ID.
         * Should only be true if this map is for a dependency.
         *
         * @returns {Object}
         */
        function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
            var url, pluginModule, suffix, nameParts,
                prefix = null,
                parentName = parentModuleMap ? parentModuleMap.name : null,
                originalName = name,
                isDefine = true,
                normalizedName = '';

            //If no name, then it means it is a require call, generate an
            //internal name.
            if (!name) {
                isDefine = false;
                name = '_@r' + (requireCounter += 1);
            }

            nameParts = splitPrefix(name);
            prefix = nameParts[0];
            name = nameParts[1];

            if (prefix) {
                prefix = normalize(prefix, parentName, applyMap);
                pluginModule = getOwn(defined, prefix);
            }

            //Account for relative paths if there is a base name.
            if (name) {
                if (prefix) {
                    if (pluginModule && pluginModule.normalize) {
                        //Plugin is loaded, use its normalize method.
                        normalizedName = pluginModule.normalize(name, function (name) {
                            return normalize(name, parentName, applyMap);
                        });
                    } else {
                        // If nested plugin references, then do not try to
                        // normalize, as it will not normalize correctly. This
                        // places a restriction on resourceIds, and the longer
                        // term solution is not to normalize until plugins are
                        // loaded and all normalizations to allow for async
                        // loading of a loader plugin. But for now, fixes the
                        // common uses. Details in #1131
                        normalizedName = name.indexOf('!') === -1 ?
                                         normalize(name, parentName, applyMap) :
                                         name;
                    }
                } else {
                    //A regular module.
                    normalizedName = normalize(name, parentName, applyMap);

                    //Normalized name may be a plugin ID due to map config
                    //application in normalize. The map config values must
                    //already be normalized, so do not need to redo that part.
                    nameParts = splitPrefix(normalizedName);
                    prefix = nameParts[0];
                    normalizedName = nameParts[1];
                    isNormalized = true;

                    url = context.nameToUrl(normalizedName);
                }
            }

            //If the id is a plugin id that cannot be determined if it needs
            //normalization, stamp it with a unique ID so two matching relative
            //ids that may conflict can be separate.
            suffix = prefix && !pluginModule && !isNormalized ?
                     '_unnormalized' + (unnormalizedCounter += 1) :
                     '';

            return {
                prefix: prefix,
                name: normalizedName,
                parentMap: parentModuleMap,
                unnormalized: !!suffix,
                url: url,
                originalName: originalName,
                isDefine: isDefine,
                id: (prefix ?
                        prefix + '!' + normalizedName :
                        normalizedName) + suffix
            };
        }

        function getModule(depMap) {
            var id = depMap.id,
                mod = getOwn(registry, id);

            if (!mod) {
                mod = registry[id] = new context.Module(depMap);
            }

            return mod;
        }

        function on(depMap, name, fn) {
            var id = depMap.id,
                mod = getOwn(registry, id);

            if (hasProp(defined, id) &&
                    (!mod || mod.defineEmitComplete)) {
                if (name === 'defined') {
                    fn(defined[id]);
                }
            } else {
                mod = getModule(depMap);
                if (mod.error && name === 'error') {
                    fn(mod.error);
                } else {
                    mod.on(name, fn);
                }
            }
        }

        function onError(err, errback) {
            var ids = err.requireModules,
                notified = false;

            if (errback) {
                errback(err);
            } else {
                each(ids, function (id) {
                    var mod = getOwn(registry, id);
                    if (mod) {
                        //Set error on module, so it skips timeout checks.
                        mod.error = err;
                        if (mod.events.error) {
                            notified = true;
                            mod.emit('error', err);
                        }
                    }
                });

                if (!notified) {
                    req.onError(err);
                }
            }
        }

        /**
         * Internal method to transfer globalQueue items to this context's
         * defQueue.
         */
        function takeGlobalQueue() {
            //Push all the globalDefQueue items into the context's defQueue
            if (globalDefQueue.length) {
                each(globalDefQueue, function(queueItem) {
                    var id = queueItem[0];
                    if (typeof id === 'string') {
                        context.defQueueMap[id] = true;
                    }
                    defQueue.push(queueItem);
                });
                globalDefQueue = [];
            }
        }

        handlers = {
            'require': function (mod) {
                if (mod.require) {
                    return mod.require;
                } else {
                    return (mod.require = context.makeRequire(mod.map));
                }
            },
            'exports': function (mod) {
                mod.usingExports = true;
                if (mod.map.isDefine) {
                    if (mod.exports) {
                        return (defined[mod.map.id] = mod.exports);
                    } else {
                        return (mod.exports = defined[mod.map.id] = {});
                    }
                }
            },
            'module': function (mod) {
                if (mod.module) {
                    return mod.module;
                } else {
                    return (mod.module = {
                        id: mod.map.id,
                        uri: mod.map.url,
                        config: function () {
                            return getOwn(config.config, mod.map.id) || {};
                        },
                        exports: mod.exports || (mod.exports = {})
                    });
                }
            }
        };

        function cleanRegistry(id) {
            //Clean up machinery used for waiting modules.
            delete registry[id];
            delete enabledRegistry[id];
        }

        function breakCycle(mod, traced, processed) {
            var id = mod.map.id;

            if (mod.error) {
                mod.emit('error', mod.error);
            } else {
                traced[id] = true;
                each(mod.depMaps, function (depMap, i) {
                    var depId = depMap.id,
                        dep = getOwn(registry, depId);

                    //Only force things that have not completed
                    //being defined, so still in the registry,
                    //and only if it has not been matched up
                    //in the module already.
                    if (dep && !mod.depMatched[i] && !processed[depId]) {
                        if (getOwn(traced, depId)) {
                            mod.defineDep(i, defined[depId]);
                            mod.check(); //pass false?
                        } else {
                            breakCycle(dep, traced, processed);
                        }
                    }
                });
                processed[id] = true;
            }
        }

        function checkLoaded() {
            var err, usingPathFallback,
                waitInterval = config.waitSeconds * 1000,
                //It is possible to disable the wait interval by using waitSeconds of 0.
                expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
                noLoads = [],
                reqCalls = [],
                stillLoading = false,
                needCycleCheck = true;

            //Do not bother if this call was a result of a cycle break.
            if (inCheckLoaded) {
                return;
            }

            inCheckLoaded = true;

            //Figure out the state of all the modules.
            eachProp(enabledRegistry, function (mod) {
                var map = mod.map,
                    modId = map.id;

                //Skip things that are not enabled or in error state.
                if (!mod.enabled) {
                    return;
                }

                if (!map.isDefine) {
                    reqCalls.push(mod);
                }

                if (!mod.error) {
                    //If the module should be executed, and it has not
                    //been inited and time is up, remember it.
                    if (!mod.inited && expired) {
                        if (hasPathFallback(modId)) {
                            usingPathFallback = true;
                            stillLoading = true;
                        } else {
                            noLoads.push(modId);
                            removeScript(modId);
                        }
                    } else if (!mod.inited && mod.fetched && map.isDefine) {
                        stillLoading = true;
                        if (!map.prefix) {
                            //No reason to keep looking for unfinished
                            //loading. If the only stillLoading is a
                            //plugin resource though, keep going,
                            //because it may be that a plugin resource
                            //is waiting on a non-plugin cycle.
                            return (needCycleCheck = false);
                        }
                    }
                }
            });

            if (expired && noLoads.length) {
                //If wait time expired, throw error of unloaded modules.
                err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads);
                err.contextName = context.contextName;
                return onError(err);
            }

            //Not expired, check for a cycle.
            if (needCycleCheck) {
                each(reqCalls, function (mod) {
                    breakCycle(mod, {}, {});
                });
            }

            //If still waiting on loads, and the waiting load is something
            //other than a plugin resource, or there are still outstanding
            //scripts, then just try back later.
            if ((!expired || usingPathFallback) && stillLoading) {
                //Something is still waiting to load. Wait for it, but only
                //if a timeout is not already in effect.
                if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
                    checkLoadedTimeoutId = setTimeout(function () {
                        checkLoadedTimeoutId = 0;
                        checkLoaded();
                    }, 50);
                }
            }

            inCheckLoaded = false;
        }

        Module = function (map) {
            this.events = getOwn(undefEvents, map.id) || {};
            this.map = map;
            this.shim = getOwn(config.shim, map.id);
            this.depExports = [];
            this.depMaps = [];
            this.depMatched = [];
            this.pluginMaps = {};
            this.depCount = 0;

            /* this.exports this.factory
               this.depMaps = [],
               this.enabled, this.fetched
            */
        };

        Module.prototype = {
            init: function (depMaps, factory, errback, options) {
                options = options || {};

                //Do not do more inits if already done. Can happen if there
                //are multiple define calls for the same module. That is not
                //a normal, common case, but it is also not unexpected.
                if (this.inited) {
                    return;
                }

                this.factory = factory;

                if (errback) {
                    //Register for errors on this module.
                    this.on('error', errback);
                } else if (this.events.error) {
                    //If no errback already, but there are error listeners
                    //on this module, set up an errback to pass to the deps.
                    errback = bind(this, function (err) {
                        this.emit('error', err);
                    });
                }

                //Do a copy of the dependency array, so that
                //source inputs are not modified. For example
                //"shim" deps are passed in here directly, and
                //doing a direct modification of the depMaps array
                //would affect that config.
                this.depMaps = depMaps && depMaps.slice(0);

                this.errback = errback;

                //Indicate this module has be initialized
                this.inited = true;

                this.ignore = options.ignore;

                //Could have option to init this module in enabled mode,
                //or could have been previously marked as enabled. However,
                //the dependencies are not known until init is called. So
                //if enabled previously, now trigger dependencies as enabled.
                if (options.enabled || this.enabled) {
                    //Enable this module and dependencies.
                    //Will call this.check()
                    this.enable();
                } else {
                    this.check();
                }
            },

            defineDep: function (i, depExports) {
                //Because of cycles, defined callback for a given
                //export can be called more than once.
                if (!this.depMatched[i]) {
                    this.depMatched[i] = true;
                    this.depCount -= 1;
                    this.depExports[i] = depExports;
                }
            },

            fetch: function () {
                if (this.fetched) {
                    return;
                }
                this.fetched = true;

                context.startTime = (new Date()).getTime();

                var map = this.map;

                //If the manager is for a plugin managed resource,
                //ask the plugin to load it now.
                if (this.shim) {
                    context.makeRequire(this.map, {
                        enableBuildCallback: true
                    })(this.shim.deps || [], bind(this, function () {
                        return map.prefix ? this.callPlugin() : this.load();
                    }));
                } else {
                    //Regular dependency.
                    return map.prefix ? this.callPlugin() : this.load();
                }
            },

            load: function () {
                var url = this.map.url;

                //Regular dependency.
                if (!urlFetched[url]) {
                    urlFetched[url] = true;
                    context.load(this.map.id, url);
                }
            },

            /**
             * Checks if the module is ready to define itself, and if so,
             * define it.
             */
            check: function () {
                if (!this.enabled || this.enabling) {
                    return;
                }

                var err, cjsModule,
                    id = this.map.id,
                    depExports = this.depExports,
                    exports = this.exports,
                    factory = this.factory;

                if (!this.inited) {
                    // Only fetch if not already in the defQueue.
                    if (!hasProp(context.defQueueMap, id)) {
                        this.fetch();
                    }
                } else if (this.error) {
                    this.emit('error', this.error);
                } else if (!this.defining) {
                    //The factory could trigger another require call
                    //that would result in checking this module to
                    //define itself again. If already in the process
                    //of doing that, skip this work.
                    this.defining = true;

                    if (this.depCount < 1 && !this.defined) {
                        if (isFunction(factory)) {
                            try {
                                exports = context.execCb(id, factory, depExports, exports);
                            } catch (e) {
                                err = e;
                            }

                            // Favor return value over exports. If node/cjs in play,
                            // then will not have a return value anyway. Favor
                            // module.exports assignment over exports object.
                            if (this.map.isDefine && exports === undefined) {
                                cjsModule = this.module;
                                if (cjsModule) {
                                    exports = cjsModule.exports;
                                } else if (this.usingExports) {
                                    //exports already set the defined value.
                                    exports = this.exports;
                                }
                            }

                            if (err) {
                                // If there is an error listener, favor passing
                                // to that instead of throwing an error. However,
                                // only do it for define()'d  modules. require
                                // errbacks should not be called for failures in
                                // their callbacks (#699). However if a global
                                // onError is set, use that.
                                if ((this.events.error && this.map.isDefine) ||
                                    req.onError !== defaultOnError) {
                                    err.requireMap = this.map;
                                    err.requireModules = this.map.isDefine ? [this.map.id] : null;
                                    err.requireType = this.map.isDefine ? 'define' : 'require';
                                    return onError((this.error = err));
                                } else if (typeof console !== 'undefined' &&
                                           console.error) {
                                    // Log the error for debugging. If promises could be
                                    // used, this would be different, but making do.
                                    console.error(err);
                                } else {
                                    // Do not want to completely lose the error. While this
                                    // will mess up processing and lead to similar results
                                    // as bug 1440, it at least surfaces the error.
                                    req.onError(err);
                                }
                            }
                        } else {
                            //Just a literal value
                            exports = factory;
                        }

                        this.exports = exports;

                        if (this.map.isDefine && !this.ignore) {
                            defined[id] = exports;

                            if (req.onResourceLoad) {
                                var resLoadMaps = [];
                                each(this.depMaps, function (depMap) {
                                    resLoadMaps.push(depMap.normalizedMap || depMap);
                                });
                                req.onResourceLoad(context, this.map, resLoadMaps);
                            }
                        }

                        //Clean up
                        cleanRegistry(id);

                        this.defined = true;
                    }

                    //Finished the define stage. Allow calling check again
                    //to allow define notifications below in the case of a
                    //cycle.
                    this.defining = false;

                    if (this.defined && !this.defineEmitted) {
                        this.defineEmitted = true;
                        this.emit('defined', this.exports);
                        this.defineEmitComplete = true;
                    }

                }
            },

            callPlugin: function () {
                var map = this.map,
                    id = map.id,
                    //Map already normalized the prefix.
                    pluginMap = makeModuleMap(map.prefix);

                //Mark this as a dependency for this plugin, so it
                //can be traced for cycles.
                this.depMaps.push(pluginMap);

                on(pluginMap, 'defined', bind(this, function (plugin) {
                    var load, normalizedMap, normalizedMod,
                        bundleId = getOwn(bundlesMap, this.map.id),
                        name = this.map.name,
                        parentName = this.map.parentMap ? this.map.parentMap.name : null,
                        localRequire = context.makeRequire(map.parentMap, {
                            enableBuildCallback: true
                        });

                    //If current map is not normalized, wait for that
                    //normalized name to load instead of continuing.
                    if (this.map.unnormalized) {
                        //Normalize the ID if the plugin allows it.
                        if (plugin.normalize) {
                            name = plugin.normalize(name, function (name) {
                                return normalize(name, parentName, true);
                            }) || '';
                        }

                        //prefix and name should already be normalized, no need
                        //for applying map config again either.
                        normalizedMap = makeModuleMap(map.prefix + '!' + name,
                                                      this.map.parentMap);
                        on(normalizedMap,
                            'defined', bind(this, function (value) {
                                this.map.normalizedMap = normalizedMap;
                                this.init([], function () { return value; }, null, {
                                    enabled: true,
                                    ignore: true
                                });
                            }));

                        normalizedMod = getOwn(registry, normalizedMap.id);
                        if (normalizedMod) {
                            //Mark this as a dependency for this plugin, so it
                            //can be traced for cycles.
                            this.depMaps.push(normalizedMap);

                            if (this.events.error) {
                                normalizedMod.on('error', bind(this, function (err) {
                                    this.emit('error', err);
                                }));
                            }
                            normalizedMod.enable();
                        }

                        return;
                    }

                    //If a paths config, then just load that file instead to
                    //resolve the plugin, as it is built into that paths layer.
                    if (bundleId) {
                        this.map.url = context.nameToUrl(bundleId);
                        this.load();
                        return;
                    }

                    load = bind(this, function (value) {
                        this.init([], function () { return value; }, null, {
                            enabled: true
                        });
                    });

                    load.error = bind(this, function (err) {
                        this.inited = true;
                        this.error = err;
                        err.requireModules = [id];

                        //Remove temp unnormalized modules for this module,
                        //since they will never be resolved otherwise now.
                        eachProp(registry, function (mod) {
                            if (mod.map.id.indexOf(id + '_unnormalized') === 0) {
                                cleanRegistry(mod.map.id);
                            }
                        });

                        onError(err);
                    });

                    //Allow plugins to load other code without having to know the
                    //context or how to 'complete' the load.
                    load.fromText = bind(this, function (text, textAlt) {
                        /*jslint evil: true */
                        var moduleName = map.name,
                            moduleMap = makeModuleMap(moduleName),
                            hasInteractive = useInteractive;

                        //As of 2.1.0, support just passing the text, to reinforce
                        //fromText only being called once per resource. Still
                        //support old style of passing moduleName but discard
                        //that moduleName in favor of the internal ref.
                        if (textAlt) {
                            text = textAlt;
                        }

                        //Turn off interactive script matching for IE for any define
                        //calls in the text, then turn it back on at the end.
                        if (hasInteractive) {
                            useInteractive = false;
                        }

                        //Prime the system by creating a module instance for
                        //it.
                        getModule(moduleMap);

                        //Transfer any config to this other module.
                        if (hasProp(config.config, id)) {
                            config.config[moduleName] = config.config[id];
                        }

                        try {
                            req.exec(text);
                        } catch (e) {
                            return onError(makeError('fromtexteval',
                                             'fromText eval for ' + id +
                                            ' failed: ' + e,
                                             e,
                                             [id]));
                        }

                        if (hasInteractive) {
                            useInteractive = true;
                        }

                        //Mark this as a dependency for the plugin
                        //resource
                        this.depMaps.push(moduleMap);

                        //Support anonymous modules.
                        context.completeLoad(moduleName);

                        //Bind the value of that module to the value for this
                        //resource ID.
                        localRequire([moduleName], load);
                    });

                    //Use parentName here since the plugin's name is not reliable,
                    //could be some weird string with no path that actually wants to
                    //reference the parentName's path.
                    plugin.load(map.name, localRequire, load, config);
                }));

                context.enable(pluginMap, this);
                this.pluginMaps[pluginMap.id] = pluginMap;
            },

            enable: function () {
                enabledRegistry[this.map.id] = this;
                this.enabled = true;

                //Set flag mentioning that the module is enabling,
                //so that immediate calls to the defined callbacks
                //for dependencies do not trigger inadvertent load
                //with the depCount still being zero.
                this.enabling = true;

                //Enable each dependency
                each(this.depMaps, bind(this, function (depMap, i) {
                    var id, mod, handler;

                    if (typeof depMap === 'string') {
                        //Dependency needs to be converted to a depMap
                        //and wired up to this module.
                        depMap = makeModuleMap(depMap,
                                               (this.map.isDefine ? this.map : this.map.parentMap),
                                               false,
                                               !this.skipMap);
                        this.depMaps[i] = depMap;

                        handler = getOwn(handlers, depMap.id);

                        if (handler) {
                            this.depExports[i] = handler(this);
                            return;
                        }

                        this.depCount += 1;

                        on(depMap, 'defined', bind(this, function (depExports) {
                            if (this.undefed) {
                                return;
                            }
                            this.defineDep(i, depExports);
                            this.check();
                        }));

                        if (this.errback) {
                            on(depMap, 'error', bind(this, this.errback));
                        } else if (this.events.error) {
                            // No direct errback on this module, but something
                            // else is listening for errors, so be sure to
                            // propagate the error correctly.
                            on(depMap, 'error', bind(this, function(err) {
                                this.emit('error', err);
                            }));
                        }
                    }

                    id = depMap.id;
                    mod = registry[id];

                    //Skip special modules like 'require', 'exports', 'module'
                    //Also, don't call enable if it is already enabled,
                    //important in circular dependency cases.
                    if (!hasProp(handlers, id) && mod && !mod.enabled) {
                        context.enable(depMap, this);
                    }
                }));

                //Enable each plugin that is used in
                //a dependency
                eachProp(this.pluginMaps, bind(this, function (pluginMap) {
                    var mod = getOwn(registry, pluginMap.id);
                    if (mod && !mod.enabled) {
                        context.enable(pluginMap, this);
                    }
                }));

                this.enabling = false;

                this.check();
            },

            on: function (name, cb) {
                var cbs = this.events[name];
                if (!cbs) {
                    cbs = this.events[name] = [];
                }
                cbs.push(cb);
            },

            emit: function (name, evt) {
                each(this.events[name], function (cb) {
                    cb(evt);
                });
                if (name === 'error') {
                    //Now that the error handler was triggered, remove
                    //the listeners, since this broken Module instance
                    //can stay around for a while in the registry.
                    delete this.events[name];
                }
            }
        };

        function callGetModule(args) {
            //Skip modules already defined.
            if (!hasProp(defined, args[0])) {
                getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
            }
        }

        function removeListener(node, func, name, ieName) {
            //Favor detachEvent because of IE9
            //issue, see attachEvent/addEventListener comment elsewhere
            //in this file.
            if (node.detachEvent && !isOpera) {
                //Probably IE. If not it will throw an error, which will be
                //useful to know.
                if (ieName) {
                    node.detachEvent(ieName, func);
                }
            } else {
                node.removeEventListener(name, func, false);
            }
        }

        /**
         * Given an event from a script node, get the requirejs info from it,
         * and then removes the event listeners on the node.
         * @param {Event} evt
         * @returns {Object}
         */
        function getScriptData(evt) {
            //Using currentTarget instead of target for Firefox 2.0's sake. Not
            //all old browsers will be supported, but this one was easy enough
            //to support and still makes sense.
            var node = evt.currentTarget || evt.srcElement;

            //Remove the listeners once here.
            removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange');
            removeListener(node, context.onScriptError, 'error');

            return {
                node: node,
                id: node && node.getAttribute('data-requiremodule')
            };
        }

        function intakeDefines() {
            var args;

            //Any defined modules in the global queue, intake them now.
            takeGlobalQueue();

            //Make sure any remaining defQueue items get properly processed.
            while (defQueue.length) {
                args = defQueue.shift();
                if (args[0] === null) {
                    return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' +
                        args[args.length - 1]));
                } else {
                    //args are id, deps, factory. Should be normalized by the
                    //define() function.
                    callGetModule(args);
                }
            }
            context.defQueueMap = {};
        }

        context = {
            config: config,
            contextName: contextName,
            registry: registry,
            defined: defined,
            urlFetched: urlFetched,
            defQueue: defQueue,
            defQueueMap: {},
            Module: Module,
            makeModuleMap: makeModuleMap,
            nextTick: req.nextTick,
            onError: onError,

            /**
             * Set a configuration for the context.
             * @param {Object} cfg config object to integrate.
             */
            configure: function (cfg) {
                //Make sure the baseUrl ends in a slash.
                if (cfg.baseUrl) {
                    if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {
                        cfg.baseUrl += '/';
                    }
                }

                //Save off the paths since they require special processing,
                //they are additive.
                var shim = config.shim,
                    objs = {
                        paths: true,
                        bundles: true,
                        config: true,
                        map: true
                    };

                eachProp(cfg, function (value, prop) {
                    if (objs[prop]) {
                        if (!config[prop]) {
                            config[prop] = {};
                        }
                        mixin(config[prop], value, true, true);
                    } else {
                        config[prop] = value;
                    }
                });

                //Reverse map the bundles
                if (cfg.bundles) {
                    eachProp(cfg.bundles, function (value, prop) {
                        each(value, function (v) {
                            if (v !== prop) {
                                bundlesMap[v] = prop;
                            }
                        });
                    });
                }

                //Merge shim
                if (cfg.shim) {
                    eachProp(cfg.shim, function (value, id) {
                        //Normalize the structure
                        if (isArray(value)) {
                            value = {
                                deps: value
                            };
                        }
                        if ((value.exports || value.init) && !value.exportsFn) {
                            value.exportsFn = context.makeShimExports(value);
                        }
                        shim[id] = value;
                    });
                    config.shim = shim;
                }

                //Adjust packages if necessary.
                if (cfg.packages) {
                    each(cfg.packages, function (pkgObj) {
                        var location, name;

                        pkgObj = typeof pkgObj === 'string' ? {name: pkgObj} : pkgObj;

                        name = pkgObj.name;
                        location = pkgObj.location;
                        if (location) {
                            config.paths[name] = pkgObj.location;
                        }

                        //Save pointer to main module ID for pkg name.
                        //Remove leading dot in main, so main paths are normalized,
                        //and remove any trailing .js, since different package
                        //envs have different conventions: some use a module name,
                        //some use a file name.
                        config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main')
                                     .replace(currDirRegExp, '')
                                     .replace(jsSuffixRegExp, '');
                    });
                }

                //If there are any "waiting to execute" modules in the registry,
                //update the maps for them, since their info, like URLs to load,
                //may have changed.
                eachProp(registry, function (mod, id) {
                    //If module already has init called, since it is too
                    //late to modify them, and ignore unnormalized ones
                    //since they are transient.
                    if (!mod.inited && !mod.map.unnormalized) {
                        mod.map = makeModuleMap(id, null, true);
                    }
                });

                //If a deps array or a config callback is specified, then call
                //require with those args. This is useful when require is defined as a
                //config object before require.js is loaded.
                if (cfg.deps || cfg.callback) {
                    context.require(cfg.deps || [], cfg.callback);
                }
            },

            makeShimExports: function (value) {
                function fn() {
                    var ret;
                    if (value.init) {
                        ret = value.init.apply(global, arguments);
                    }
                    return ret || (value.exports && getGlobal(value.exports));
                }
                return fn;
            },

            makeRequire: function (relMap, options) {
                options = options || {};

                function localRequire(deps, callback, errback) {
                    var id, map, requireMod;

                    if (options.enableBuildCallback && callback && isFunction(callback)) {
                        callback.__requireJsBuild = true;
                    }

                    if (typeof deps === 'string') {
                        if (isFunction(callback)) {
                            //Invalid call
                            return onError(makeError('requireargs', 'Invalid require call'), errback);
                        }

                        //If require|exports|module are requested, get the
                        //value for them from the special handlers. Caveat:
                        //this only works while module is being defined.
                        if (relMap && hasProp(handlers, deps)) {
                            return handlers[deps](registry[relMap.id]);
                        }

                        //Synchronous access to one module. If require.get is
                        //available (as in the Node adapter), prefer that.
                        if (req.get) {
                            return req.get(context, deps, relMap, localRequire);
                        }

                        //Normalize module name, if it contains . or ..
                        map = makeModuleMap(deps, relMap, false, true);
                        id = map.id;

                        if (!hasProp(defined, id)) {
                            return onError(makeError('notloaded', 'Module name "' +
                                        id +
                                        '" has not been loaded yet for context: ' +
                                        contextName +
                                        (relMap ? '' : '. Use require([])')));
                        }
                        return defined[id];
                    }

                    //Grab defines waiting in the global queue.
                    intakeDefines();

                    //Mark all the dependencies as needing to be loaded.
                    context.nextTick(function () {
                        //Some defines could have been added since the
                        //require call, collect them.
                        intakeDefines();

                        requireMod = getModule(makeModuleMap(null, relMap));

                        //Store if map config should be applied to this require
                        //call for dependencies.
                        requireMod.skipMap = options.skipMap;

                        requireMod.init(deps, callback, errback, {
                            enabled: true
                        });

                        checkLoaded();
                    });

                    return localRequire;
                }

                mixin(localRequire, {
                    isBrowser: isBrowser,

                    /**
                     * Converts a module name + .extension into an URL path.
                     * *Requires* the use of a module name. It does not support using
                     * plain URLs like nameToUrl.
                     */
                    toUrl: function (moduleNamePlusExt) {
                        var ext,
                            index = moduleNamePlusExt.lastIndexOf('.'),
                            segment = moduleNamePlusExt.split('/')[0],
                            isRelative = segment === '.' || segment === '..';

                        //Have a file extension alias, and it is not the
                        //dots from a relative path.
                        if (index !== -1 && (!isRelative || index > 1)) {
                            ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
                            moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
                        }

                        return context.nameToUrl(normalize(moduleNamePlusExt,
                                                relMap && relMap.id, true), ext,  true);
                    },

                    defined: function (id) {
                        return hasProp(defined, makeModuleMap(id, relMap, false, true).id);
                    },

                    specified: function (id) {
                        id = makeModuleMap(id, relMap, false, true).id;
                        return hasProp(defined, id) || hasProp(registry, id);
                    }
                });

                //Only allow undef on top level require calls
                if (!relMap) {
                    localRequire.undef = function (id) {
                        //Bind any waiting define() calls to this context,
                        //fix for #408
                        takeGlobalQueue();

                        var map = makeModuleMap(id, relMap, true),
                            mod = getOwn(registry, id);

                        mod.undefed = true;
                        removeScript(id);

                        delete defined[id];
                        delete urlFetched[map.url];
                        delete undefEvents[id];

                        //Clean queued defines too. Go backwards
                        //in array so that the splices do not
                        //mess up the iteration.
                        eachReverse(defQueue, function(args, i) {
                            if (args[0] === id) {
                                defQueue.splice(i, 1);
                            }
                        });
                        delete context.defQueueMap[id];

                        if (mod) {
                            //Hold on to listeners in case the
                            //module will be attempted to be reloaded
                            //using a different config.
                            if (mod.events.defined) {
                                undefEvents[id] = mod.events;
                            }

                            cleanRegistry(id);
                        }
                    };
                }

                return localRequire;
            },

            /**
             * Called to enable a module if it is still in the registry
             * awaiting enablement. A second arg, parent, the parent module,
             * is passed in for context, when this method is overridden by
             * the optimizer. Not shown here to keep code compact.
             */
            enable: function (depMap) {
                var mod = getOwn(registry, depMap.id);
                if (mod) {
                    getModule(depMap).enable();
                }
            },

            /**
             * Internal method used by environment adapters to complete a load event.
             * A load event could be a script load or just a load pass from a synchronous
             * load call.
             * @param {String} moduleName the name of the module to potentially complete.
             */
            completeLoad: function (moduleName) {
                var found, args, mod,
                    shim = getOwn(config.shim, moduleName) || {},
                    shExports = shim.exports;

                takeGlobalQueue();

                while (defQueue.length) {
                    args = defQueue.shift();
                    if (args[0] === null) {
                        args[0] = moduleName;
                        //If already found an anonymous module and bound it
                        //to this name, then this is some other anon module
                        //waiting for its completeLoad to fire.
                        if (found) {
                            break;
                        }
                        found = true;
                    } else if (args[0] === moduleName) {
                        //Found matching define call for this script!
                        found = true;
                    }

                    callGetModule(args);
                }
                context.defQueueMap = {};

                //Do this after the cycle of callGetModule in case the result
                //of those calls/init calls changes the registry.
                mod = getOwn(registry, moduleName);

                if (!found && !hasProp(defined, moduleName) && mod && !mod.inited) {
                    if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
                        if (hasPathFallback(moduleName)) {
                            return;
                        } else {
                            return onError(makeError('nodefine',
                                             'No define call for ' + moduleName,
                                             null,
                                             [moduleName]));
                        }
                    } else {
                        //A script that does not call define(), so just simulate
                        //the call for it.
                        callGetModule([moduleName, (shim.deps || []), shim.exportsFn]);
                    }
                }

                checkLoaded();
            },

            /**
             * Converts a module name to a file path. Supports cases where
             * moduleName may actually be just an URL.
             * Note that it **does not** call normalize on the moduleName,
             * it is assumed to have already been normalized. This is an
             * internal API, not a public one. Use toUrl for the public API.
             */
            nameToUrl: function (moduleName, ext, skipExt) {
                var paths, syms, i, parentModule, url,
                    parentPath, bundleId,
                    pkgMain = getOwn(config.pkgs, moduleName);

                if (pkgMain) {
                    moduleName = pkgMain;
                }

                bundleId = getOwn(bundlesMap, moduleName);

                if (bundleId) {
                    return context.nameToUrl(bundleId, ext, skipExt);
                }

                //If a colon is in the URL, it indicates a protocol is used and it is just
                //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
                //or ends with .js, then assume the user meant to use an url and not a module id.
                //The slash is important for protocol-less URLs as well as full paths.
                if (req.jsExtRegExp.test(moduleName)) {
                    //Just a plain path, not module name lookup, so just return it.
                    //Add extension if it is included. This is a bit wonky, only non-.js things pass
                    //an extension, this method probably needs to be reworked.
                    url = moduleName + (ext || '');
                } else {
                    //A module that needs to be converted to a path.
                    paths = config.paths;

                    syms = moduleName.split('/');
                    //For each module name segment, see if there is a path
                    //registered for it. Start with most specific name
                    //and work up from it.
                    for (i = syms.length; i > 0; i -= 1) {
                        parentModule = syms.slice(0, i).join('/');

                        parentPath = getOwn(paths, parentModule);
                        if (parentPath) {
                            //If an array, it means there are a few choices,
                            //Choose the one that is desired
                            if (isArray(parentPath)) {
                                parentPath = parentPath[0];
                            }
                            syms.splice(0, i, parentPath);
                            break;
                        }
                    }

                    //Join the path parts together, then figure out if baseUrl is needed.
                    url = syms.join('/');
                    url += (ext || (/^data\:|\?/.test(url) || skipExt ? '' : '.js'));
                    url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
                }

                return config.urlArgs ? url +
                                        ((url.indexOf('?') === -1 ? '?' : '&') +
                                         config.urlArgs) : url;
            },

            //Delegates to req.load. Broken out as a separate function to
            //allow overriding in the optimizer.
            load: function (id, url) {
                req.load(context, id, url);
            },

            /**
             * Executes a module callback function. Broken out as a separate function
             * solely to allow the build system to sequence the files in the built
             * layer in the right sequence.
             *
             * @private
             */
            execCb: function (name, callback, args, exports) {
                return callback.apply(exports, args);
            },

            /**
             * callback for script loads, used to check status of loading.
             *
             * @param {Event} evt the event from the browser for the script
             * that was loaded.
             */
            onScriptLoad: function (evt) {
                //Using currentTarget instead of target for Firefox 2.0's sake. Not
                //all old browsers will be supported, but this one was easy enough
                //to support and still makes sense.
                if (evt.type === 'load' ||
                        (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
                    //Reset interactive script so a script node is not held onto for
                    //to long.
                    interactiveScript = null;

                    //Pull out the name of the module and the context.
                    var data = getScriptData(evt);
                    context.completeLoad(data.id);
                }
            },

            /**
             * Callback for script errors.
             */
            onScriptError: function (evt) {
                var data = getScriptData(evt);
                if (!hasPathFallback(data.id)) {
                    var parents = [];
                    eachProp(registry, function(value, key) {
                        if (key.indexOf('_@r') !== 0) {
                            each(value.depMaps, function(depMap) {
                                if (depMap.id === data.id) {
                                    parents.push(key);
                                }
                                return true;
                            });
                        }
                    });
                    return onError(makeError('scripterror', 'Script error for "' + data.id +
                                             (parents.length ?
                                             '", needed by: ' + parents.join(', ') :
                                             '"'), evt, [data.id]));
                }
            }
        };

        context.require = context.makeRequire();
        return context;
    }

    /**
     * Main entry point.
     *
     * If the only argument to require is a string, then the module that
     * is represented by that string is fetched for the appropriate context.
     *
     * If the first argument is an array, then it will be treated as an array
     * of dependency string names to fetch. An optional function callback can
     * be specified to execute when all of those dependencies are available.
     *
     * Make a local req variable to help Caja compliance (it assumes things
     * on a require that are not standardized), and to give a short
     * name for minification/local scope use.
     */
    req = requirejs = function (deps, callback, errback, optional) {

        //Find the right context, use default
        var context, config,
            contextName = defContextName;

        // Determine if have config object in the call.
        if (!isArray(deps) && typeof deps !== 'string') {
            // deps is a config object
            config = deps;
            if (isArray(callback)) {
                // Adjust args if there are dependencies
                deps = callback;
                callback = errback;
                errback = optional;
            } else {
                deps = [];
            }
        }

        if (config && config.context) {
            contextName = config.context;
        }

        context = getOwn(contexts, contextName);
        if (!context) {
            context = contexts[contextName] = req.s.newContext(contextName);
        }

        if (config) {
            context.configure(config);
        }

        return context.require(deps, callback, errback);
    };

    /**
     * Support require.config() to make it easier to cooperate with other
     * AMD loaders on globally agreed names.
     */
    req.config = function (config) {
        return req(config);
    };

    /**
     * Execute something after the current tick
     * of the event loop. Override for other envs
     * that have a better solution than setTimeout.
     * @param  {Function} fn function to execute later.
     */
    req.nextTick = typeof setTimeout !== 'undefined' ? function (fn) {
        setTimeout(fn, 4);
    } : function (fn) { fn(); };

    /**
     * Export require as a global, but only if it does not already exist.
     */
    if (!require) {
        require = req;
    }

    req.version = version;

    //Used to filter out dependencies that are already paths.
    req.jsExtRegExp = /^\/|:|\?|\.js$/;
    req.isBrowser = isBrowser;
    s = req.s = {
        contexts: contexts,
        newContext: newContext
    };

    //Create default context.
    req({});

    //Exports some context-sensitive methods on global require.
    each([
        'toUrl',
        'undef',
        'defined',
        'specified'
    ], function (prop) {
        //Reference from contexts instead of early binding to default context,
        //so that during builds, the latest instance of the default context
        //with its config gets used.
        req[prop] = function () {
            var ctx = contexts[defContextName];
            return ctx.require[prop].apply(ctx, arguments);
        };
    });

    if (isBrowser) {
        head = s.head = document.getElementsByTagName('head')[0];
        //If BASE tag is in play, using appendChild is a problem for IE6.
        //When that browser dies, this can be removed. Details in this jQuery bug:
        //http://dev.jquery.com/ticket/2709
        baseElement = document.getElementsByTagName('base')[0];
        if (baseElement) {
            head = s.head = baseElement.parentNode;
        }
    }

    /**
     * Any errors that require explicitly generates will be passed to this
     * function. Intercept/override it if you want custom error handling.
     * @param {Error} err the error object.
     */
    req.onError = defaultOnError;

    /**
     * Creates the node for the load command. Only used in browser envs.
     */
    req.createNode = function (config, moduleName, url) {
        var node = config.xhtml ?
                document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
                document.createElement('script');
        node.type = config.scriptType || 'text/javascript';
        node.charset = 'utf-8';
        node.async = true;
        return node;
    };

    /**
     * Does the request to load a module for the browser case.
     * Make this a separate function to allow other environments
     * to override it.
     *
     * @param {Object} context the require context to find state.
     * @param {String} moduleName the name of the module.
     * @param {Object} url the URL to the module.
     */
    req.load = function (context, moduleName, url) {
        var config = (context && context.config) || {},
            node;
        if (isBrowser) {
            //In the browser so use a script tag
            node = req.createNode(config, moduleName, url);
            if (config.onNodeCreated) {
                config.onNodeCreated(node, config, moduleName, url);
            }

            node.setAttribute('data-requirecontext', context.contextName);
            node.setAttribute('data-requiremodule', moduleName);

            //Set up load listener. Test attachEvent first because IE9 has
            //a subtle issue in its addEventListener and script onload firings
            //that do not match the behavior of all other browsers with
            //addEventListener support, which fire the onload event for a
            //script right after the script execution. See:
            //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
            //UNFORTUNATELY Opera implements attachEvent but does not follow the script
            //script execution mode.
            if (node.attachEvent &&
                    //Check if node.attachEvent is artificially added by custom script or
                    //natively supported by browser
                    //read https://github.com/jrburke/requirejs/issues/187
                    //if we can NOT find [native code] then it must NOT natively supported.
                    //in IE8, node.attachEvent does not have toString()
                    //Note the test for "[native code" with no closing brace, see:
                    //https://github.com/jrburke/requirejs/issues/273
                    !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
                    !isOpera) {
                //Probably IE. IE (at least 6-8) do not fire
                //script onload right after executing the script, so
                //we cannot tie the anonymous define call to a name.
                //However, IE reports the script as being in 'interactive'
                //readyState at the time of the define call.
                useInteractive = true;

                node.attachEvent('onreadystatechange', context.onScriptLoad);
                //It would be great to add an error handler here to catch
                //404s in IE9+. However, onreadystatechange will fire before
                //the error handler, so that does not help. If addEventListener
                //is used, then IE will fire error before load, but we cannot
                //use that pathway given the connect.microsoft.com issue
                //mentioned above about not doing the 'script execute,
                //then fire the script load event listener before execute
                //next script' that other browsers do.
                //Best hope: IE10 fixes the issues,
                //and then destroys all installs of IE 6-9.
                //node.attachEvent('onerror', context.onScriptError);
            } else {
                node.addEventListener('load', context.onScriptLoad, false);
                node.addEventListener('error', context.onScriptError, false);
            }
            node.src = url;

            //For some cache cases in IE 6-8, the script executes before the end
            //of the appendChild execution, so to tie an anonymous define
            //call to the module name (which is stored on the node), hold on
            //to a reference to this node, but clear after the DOM insertion.
            currentlyAddingScript = node;
            if (baseElement) {
                head.insertBefore(node, baseElement);
            } else {
                head.appendChild(node);
            }
            currentlyAddingScript = null;

            return node;
        } else if (isWebWorker) {
            try {
                //In a web worker, use importScripts. This is not a very
                //efficient use of importScripts, importScripts will block until
                //its script is downloaded and evaluated. However, if web workers
                //are in play, the expectation is that a build has been done so
                //that only one script needs to be loaded anyway. This may need
                //to be reevaluated if other use cases become common.
                importScripts(url);

                //Account for anonymous modules
                context.completeLoad(moduleName);
            } catch (e) {
                context.onError(makeError('importscripts',
                                'importScripts failed for ' +
                                    moduleName + ' at ' + url,
                                e,
                                [moduleName]));
            }
        }
    };

    function getInteractiveScript() {
        if (interactiveScript && interactiveScript.readyState === 'interactive') {
            return interactiveScript;
        }

        eachReverse(scripts(), function (script) {
            if (script.readyState === 'interactive') {
                return (interactiveScript = script);
            }
        });
        return interactiveScript;
    }

    //Look for a data-main script attribute, which could also adjust the baseUrl.
    if (isBrowser && !cfg.skipDataMain) {
        //Figure out baseUrl. Get it from the script tag with require.js in it.
        eachReverse(scripts(), function (script) {
            //Set the 'head' where we can append children by
            //using the script's parent.
            if (!head) {
                head = script.parentNode;
            }

            //Look for a data-main attribute to set main script for the page
            //to load. If it is there, the path to data main becomes the
            //baseUrl, if it is not already set.
            dataMain = script.getAttribute('data-main');
            if (dataMain) {
                //Preserve dataMain in case it is a path (i.e. contains '?')
                mainScript = dataMain;

                //Set final baseUrl if there is not already an explicit one.
                if (!cfg.baseUrl) {
                    //Pull off the directory of data-main for use as the
                    //baseUrl.
                    src = mainScript.split('/');
                    mainScript = src.pop();
                    subPath = src.length ? src.join('/')  + '/' : './';

                    cfg.baseUrl = subPath;
                }

                //Strip off any trailing .js since mainScript is now
                //like a module name.
                mainScript = mainScript.replace(jsSuffixRegExp, '');

                //If mainScript is still a path, fall back to dataMain
                if (req.jsExtRegExp.test(mainScript)) {
                    mainScript = dataMain;
                }

                //Put the data-main script in the files to load.
                cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript];

                return true;
            }
        });
    }

    /**
     * The function that handles definitions of modules. Differs from
     * require() in that a string for the module should be the first argument,
     * and the function to execute after dependencies are loaded should
     * return a value to define the module corresponding to the first argument's
     * name.
     */
    define = function (name, deps, callback) {
        var node, context;

        //Allow for anonymous modules
        if (typeof name !== 'string') {
            //Adjust args appropriately
            callback = deps;
            deps = name;
            name = null;
        }

        //This module may not have dependencies
        if (!isArray(deps)) {
            callback = deps;
            deps = null;
        }

        //If no name, and callback is a function, then figure out if it a
        //CommonJS thing with dependencies.
        if (!deps && isFunction(callback)) {
            deps = [];
            //Remove comments from the callback string,
            //look for require calls, and pull them into the dependencies,
            //but only if there are function args.
            if (callback.length) {
                callback
                    .toString()
                    .replace(commentRegExp, '')
                    .replace(cjsRequireRegExp, function (match, dep) {
                        deps.push(dep);
                    });

                //May be a CommonJS thing even without require calls, but still
                //could use exports, and module. Avoid doing exports and module
                //work though if it just needs require.
                //REQUIRES the function to expect the CommonJS variables in the
                //order listed below.
                deps = (callback.length === 1 ? ['require'] : ['require', 'exports', 'module']).concat(deps);
            }
        }

        //If in IE 6-8 and hit an anonymous define() call, do the interactive
        //work.
        if (useInteractive) {
            node = currentlyAddingScript || getInteractiveScript();
            if (node) {
                if (!name) {
                    name = node.getAttribute('data-requiremodule');
                }
                context = contexts[node.getAttribute('data-requirecontext')];
            }
        }

        //Always save off evaluating the def call until the script onload handler.
        //This allows multiple modules to be in a file without prematurely
        //tracing dependencies, and allows for anonymous module support,
        //where the module name is not known until the script onload event
        //occurs. If no context, use the global queue, and get it processed
        //in the onscript load callback.
        if (context) {
            context.defQueue.push([name, deps, callback]);
            context.defQueueMap[name] = true;
        } else {
            globalDefQueue.push([name, deps, callback]);
        }
    };

    define.amd = {
        jQuery: true
    };

    /**
     * Executes the text. Normally just uses eval, but can be modified
     * to use a better, environment-specific call. Only used for transpiling
     * loader plugins, not for plain JS modules.
     * @param {String} text the text to execute/evaluate.
     */
    req.exec = function (text) {
        /*jslint evil: true */
        return eval(text);
    };

    //Set up with config info.
    req(cfg);
}(this));

define("requireLib", function(){});

/*!
 * Knockout JavaScript library v3.3.0
 * (c) Steven Sanderson - http://knockoutjs.com/
 * License: MIT (http://www.opensource.org/licenses/mit-license.php)
 */

(function() {(function(p){var y=this||(0,eval)("this"),w=y.document,M=y.navigator,u=y.jQuery,E=y.JSON;(function(p){"function"===typeof define&&define.amd?define('knockout',["exports","require"],p):"function"===typeof require&&"object"===typeof exports&&"object"===typeof module?p(module.exports||exports):p(y.ko={})})(function(N,O){function J(a,d){return null===a||typeof a in Q?a===d:!1}function R(a,d){var c;return function(){c||(c=setTimeout(function(){c=p;a()},d))}}function S(a,d){var c;return function(){clearTimeout(c);
c=setTimeout(a,d)}}function K(b,d,c,e){a.d[b]={init:function(b,k,h,l,g){var m,x;a.w(function(){var q=a.a.c(k()),n=!c!==!q,r=!x;if(r||d||n!==m)r&&a.Z.oa()&&(x=a.a.la(a.e.childNodes(b),!0)),n?(r||a.e.T(b,a.a.la(x)),a.Ja(e?e(g,q):g,b)):a.e.ma(b),m=n},null,{q:b});return{controlsDescendantBindings:!0}}};a.h.ka[b]=!1;a.e.R[b]=!0}var a="undefined"!==typeof N?N:{};a.b=function(b,d){for(var c=b.split("."),e=a,f=0;f<c.length-1;f++)e=e[c[f]];e[c[c.length-1]]=d};a.D=function(a,d,c){a[d]=c};a.version="3.3.0";
a.b("version",a.version);a.a=function(){function b(a,b){for(var c in a)a.hasOwnProperty(c)&&b(c,a[c])}function d(a,b){if(b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function c(a,b){a.__proto__=b;return a}function e(b,c,g,d){var e=b[c].match(m)||[];a.a.o(g.match(m),function(b){a.a.ga(e,b,d)});b[c]=e.join(" ")}var f={__proto__:[]}instanceof Array,k={},h={};k[M&&/Firefox\/2/i.test(M.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"];k.MouseEvents="click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" ");
b(k,function(a,b){if(b.length)for(var c=0,g=b.length;c<g;c++)h[b[c]]=a});var l={propertychange:!0},g=w&&function(){for(var a=3,b=w.createElement("div"),c=b.getElementsByTagName("i");b.innerHTML="\x3c!--[if gt IE "+ ++a+"]><i></i><![endif]--\x3e",c[0];);return 4<a?a:p}(),m=/\S+/g;return{Bb:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],o:function(a,b){for(var c=0,g=a.length;c<g;c++)b(a[c],c)},m:function(a,b){if("function"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(a,
b);for(var c=0,g=a.length;c<g;c++)if(a[c]===b)return c;return-1},vb:function(a,b,c){for(var g=0,d=a.length;g<d;g++)if(b.call(c,a[g],g))return a[g];return null},ya:function(b,c){var g=a.a.m(b,c);0<g?b.splice(g,1):0===g&&b.shift()},wb:function(b){b=b||[];for(var c=[],g=0,d=b.length;g<d;g++)0>a.a.m(c,b[g])&&c.push(b[g]);return c},Ka:function(a,b){a=a||[];for(var c=[],g=0,d=a.length;g<d;g++)c.push(b(a[g],g));return c},xa:function(a,b){a=a||[];for(var c=[],g=0,d=a.length;g<d;g++)b(a[g],g)&&c.push(a[g]);
return c},ia:function(a,b){if(b instanceof Array)a.push.apply(a,b);else for(var c=0,g=b.length;c<g;c++)a.push(b[c]);return a},ga:function(b,c,g){var d=a.a.m(a.a.cb(b),c);0>d?g&&b.push(c):g||b.splice(d,1)},za:f,extend:d,Fa:c,Ga:f?c:d,A:b,pa:function(a,b){if(!a)return a;var c={},g;for(g in a)a.hasOwnProperty(g)&&(c[g]=b(a[g],g,a));return c},Ra:function(b){for(;b.firstChild;)a.removeNode(b.firstChild)},Jb:function(b){b=a.a.O(b);for(var c=(b[0]&&b[0].ownerDocument||w).createElement("div"),g=0,d=b.length;g<
d;g++)c.appendChild(a.S(b[g]));return c},la:function(b,c){for(var g=0,d=b.length,e=[];g<d;g++){var m=b[g].cloneNode(!0);e.push(c?a.S(m):m)}return e},T:function(b,c){a.a.Ra(b);if(c)for(var g=0,d=c.length;g<d;g++)b.appendChild(c[g])},Qb:function(b,c){var g=b.nodeType?[b]:b;if(0<g.length){for(var d=g[0],e=d.parentNode,m=0,f=c.length;m<f;m++)e.insertBefore(c[m],d);m=0;for(f=g.length;m<f;m++)a.removeNode(g[m])}},na:function(a,b){if(a.length){for(b=8===b.nodeType&&b.parentNode||b;a.length&&a[0].parentNode!==
b;)a.splice(0,1);if(1<a.length){var c=a[0],g=a[a.length-1];for(a.length=0;c!==g;)if(a.push(c),c=c.nextSibling,!c)return;a.push(g)}}return a},Sb:function(a,b){7>g?a.setAttribute("selected",b):a.selected=b},ib:function(a){return null===a||a===p?"":a.trim?a.trim():a.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Dc:function(a,b){a=a||"";return b.length>a.length?!1:a.substring(0,b.length)===b},jc:function(a,b){if(a===b)return!0;if(11===a.nodeType)return!1;if(b.contains)return b.contains(3===a.nodeType?
a.parentNode:a);if(b.compareDocumentPosition)return 16==(b.compareDocumentPosition(a)&16);for(;a&&a!=b;)a=a.parentNode;return!!a},Qa:function(b){return a.a.jc(b,b.ownerDocument.documentElement)},tb:function(b){return!!a.a.vb(b,a.a.Qa)},v:function(a){return a&&a.tagName&&a.tagName.toLowerCase()},n:function(b,c,d){var m=g&&l[c];if(!m&&u)u(b).bind(c,d);else if(m||"function"!=typeof b.addEventListener)if("undefined"!=typeof b.attachEvent){var e=function(a){d.call(b,a)},f="on"+c;b.attachEvent(f,e);a.a.C.fa(b,
function(){b.detachEvent(f,e)})}else throw Error("Browser doesn't support addEventListener or attachEvent");else b.addEventListener(c,d,!1)},qa:function(b,c){if(!b||!b.nodeType)throw Error("element must be a DOM node when calling triggerEvent");var g;"input"===a.a.v(b)&&b.type&&"click"==c.toLowerCase()?(g=b.type,g="checkbox"==g||"radio"==g):g=!1;if(u&&!g)u(b).trigger(c);else if("function"==typeof w.createEvent)if("function"==typeof b.dispatchEvent)g=w.createEvent(h[c]||"HTMLEvents"),g.initEvent(c,
!0,!0,y,0,0,0,0,0,!1,!1,!1,!1,0,b),b.dispatchEvent(g);else throw Error("The supplied element doesn't support dispatchEvent");else if(g&&b.click)b.click();else if("undefined"!=typeof b.fireEvent)b.fireEvent("on"+c);else throw Error("Browser doesn't support triggering events");},c:function(b){return a.F(b)?b():b},cb:function(b){return a.F(b)?b.B():b},Ia:function(b,c,g){var d;c&&("object"===typeof b.classList?(d=b.classList[g?"add":"remove"],a.a.o(c.match(m),function(a){d.call(b.classList,a)})):"string"===
typeof b.className.baseVal?e(b.className,"baseVal",c,g):e(b,"className",c,g))},Ha:function(b,c){var g=a.a.c(c);if(null===g||g===p)g="";var d=a.e.firstChild(b);!d||3!=d.nodeType||a.e.nextSibling(d)?a.e.T(b,[b.ownerDocument.createTextNode(g)]):d.data=g;a.a.mc(b)},Rb:function(a,b){a.name=b;if(7>=g)try{a.mergeAttributes(w.createElement("<input name='"+a.name+"'/>"),!1)}catch(c){}},mc:function(a){9<=g&&(a=1==a.nodeType?a:a.parentNode,a.style&&(a.style.zoom=a.style.zoom))},kc:function(a){if(g){var b=a.style.width;
a.style.width=0;a.style.width=b}},Bc:function(b,c){b=a.a.c(b);c=a.a.c(c);for(var g=[],d=b;d<=c;d++)g.push(d);return g},O:function(a){for(var b=[],c=0,g=a.length;c<g;c++)b.push(a[c]);return b},Hc:6===g,Ic:7===g,M:g,Db:function(b,c){for(var g=a.a.O(b.getElementsByTagName("input")).concat(a.a.O(b.getElementsByTagName("textarea"))),d="string"==typeof c?function(a){return a.name===c}:function(a){return c.test(a.name)},m=[],e=g.length-1;0<=e;e--)d(g[e])&&m.push(g[e]);return m},yc:function(b){return"string"==
typeof b&&(b=a.a.ib(b))?E&&E.parse?E.parse(b):(new Function("return "+b))():null},jb:function(b,c,g){if(!E||!E.stringify)throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");return E.stringify(a.a.c(b),c,g)},zc:function(c,g,d){d=d||{};var m=d.params||{},e=d.includeFields||this.Bb,f=c;if("object"==typeof c&&"form"===a.a.v(c))for(var f=c.action,
l=e.length-1;0<=l;l--)for(var k=a.a.Db(c,e[l]),h=k.length-1;0<=h;h--)m[k[h].name]=k[h].value;g=a.a.c(g);var s=w.createElement("form");s.style.display="none";s.action=f;s.method="post";for(var p in g)c=w.createElement("input"),c.type="hidden",c.name=p,c.value=a.a.jb(a.a.c(g[p])),s.appendChild(c);b(m,function(a,b){var c=w.createElement("input");c.type="hidden";c.name=a;c.value=b;s.appendChild(c)});w.body.appendChild(s);d.submitter?d.submitter(s):s.submit();setTimeout(function(){s.parentNode.removeChild(s)},
0)}}}();a.b("utils",a.a);a.b("utils.arrayForEach",a.a.o);a.b("utils.arrayFirst",a.a.vb);a.b("utils.arrayFilter",a.a.xa);a.b("utils.arrayGetDistinctValues",a.a.wb);a.b("utils.arrayIndexOf",a.a.m);a.b("utils.arrayMap",a.a.Ka);a.b("utils.arrayPushAll",a.a.ia);a.b("utils.arrayRemoveItem",a.a.ya);a.b("utils.extend",a.a.extend);a.b("utils.fieldsIncludedWithJsonPost",a.a.Bb);a.b("utils.getFormFields",a.a.Db);a.b("utils.peekObservable",a.a.cb);a.b("utils.postJson",a.a.zc);a.b("utils.parseJson",a.a.yc);a.b("utils.registerEventHandler",
a.a.n);a.b("utils.stringifyJson",a.a.jb);a.b("utils.range",a.a.Bc);a.b("utils.toggleDomNodeCssClass",a.a.Ia);a.b("utils.triggerEvent",a.a.qa);a.b("utils.unwrapObservable",a.a.c);a.b("utils.objectForEach",a.a.A);a.b("utils.addOrRemoveItem",a.a.ga);a.b("utils.setTextContent",a.a.Ha);a.b("unwrap",a.a.c);Function.prototype.bind||(Function.prototype.bind=function(a){var d=this;if(1===arguments.length)return function(){return d.apply(a,arguments)};var c=Array.prototype.slice.call(arguments,1);return function(){var e=
c.slice(0);e.push.apply(e,arguments);return d.apply(a,e)}});a.a.f=new function(){function a(b,k){var h=b[c];if(!h||"null"===h||!e[h]){if(!k)return p;h=b[c]="ko"+d++;e[h]={}}return e[h]}var d=0,c="__ko__"+(new Date).getTime(),e={};return{get:function(c,d){var e=a(c,!1);return e===p?p:e[d]},set:function(c,d,e){if(e!==p||a(c,!1)!==p)a(c,!0)[d]=e},clear:function(a){var b=a[c];return b?(delete e[b],a[c]=null,!0):!1},I:function(){return d++ +c}}};a.b("utils.domData",a.a.f);a.b("utils.domData.clear",a.a.f.clear);
a.a.C=new function(){function b(b,d){var e=a.a.f.get(b,c);e===p&&d&&(e=[],a.a.f.set(b,c,e));return e}function d(c){var e=b(c,!1);if(e)for(var e=e.slice(0),l=0;l<e.length;l++)e[l](c);a.a.f.clear(c);a.a.C.cleanExternalData(c);if(f[c.nodeType])for(e=c.firstChild;c=e;)e=c.nextSibling,8===c.nodeType&&d(c)}var c=a.a.f.I(),e={1:!0,8:!0,9:!0},f={1:!0,9:!0};return{fa:function(a,c){if("function"!=typeof c)throw Error("Callback must be a function");b(a,!0).push(c)},Pb:function(d,e){var f=b(d,!1);f&&(a.a.ya(f,
e),0==f.length&&a.a.f.set(d,c,p))},S:function(b){if(e[b.nodeType]&&(d(b),f[b.nodeType])){var c=[];a.a.ia(c,b.getElementsByTagName("*"));for(var l=0,g=c.length;l<g;l++)d(c[l])}return b},removeNode:function(b){a.S(b);b.parentNode&&b.parentNode.removeChild(b)},cleanExternalData:function(a){u&&"function"==typeof u.cleanData&&u.cleanData([a])}}};a.S=a.a.C.S;a.removeNode=a.a.C.removeNode;a.b("cleanNode",a.S);a.b("removeNode",a.removeNode);a.b("utils.domNodeDisposal",a.a.C);a.b("utils.domNodeDisposal.addDisposeCallback",
a.a.C.fa);a.b("utils.domNodeDisposal.removeDisposeCallback",a.a.C.Pb);(function(){a.a.ca=function(b,d){var c;if(u)if(u.parseHTML)c=u.parseHTML(b,d)||[];else{if((c=u.clean([b],d))&&c[0]){for(var e=c[0];e.parentNode&&11!==e.parentNode.nodeType;)e=e.parentNode;e.parentNode&&e.parentNode.removeChild(e)}}else{(e=d)||(e=w);c=e.parentWindow||e.defaultView||y;var f=a.a.ib(b).toLowerCase(),e=e.createElement("div"),f=f.match(/^<(thead|tbody|tfoot)/)&&[1,"<table>","</table>"]||!f.indexOf("<tr")&&[2,"<table><tbody>",
"</tbody></table>"]||(!f.indexOf("<td")||!f.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""],k="ignored<div>"+f[1]+b+f[2]+"</div>";for("function"==typeof c.innerShiv?e.appendChild(c.innerShiv(k)):e.innerHTML=k;f[0]--;)e=e.lastChild;c=a.a.O(e.lastChild.childNodes)}return c};a.a.gb=function(b,d){a.a.Ra(b);d=a.a.c(d);if(null!==d&&d!==p)if("string"!=typeof d&&(d=d.toString()),u)u(b).html(d);else for(var c=a.a.ca(d,b.ownerDocument),e=0;e<c.length;e++)b.appendChild(c[e])}})();
a.b("utils.parseHtmlFragment",a.a.ca);a.b("utils.setHtml",a.a.gb);a.H=function(){function b(c,d){if(c)if(8==c.nodeType){var f=a.H.Lb(c.nodeValue);null!=f&&d.push({ic:c,wc:f})}else if(1==c.nodeType)for(var f=0,k=c.childNodes,h=k.length;f<h;f++)b(k[f],d)}var d={};return{$a:function(a){if("function"!=typeof a)throw Error("You can only pass a function to ko.memoization.memoize()");var b=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);
d[b]=a;return"\x3c!--[ko_memo:"+b+"]--\x3e"},Wb:function(a,b){var f=d[a];if(f===p)throw Error("Couldn't find any memo with ID "+a+". Perhaps it's already been unmemoized.");try{return f.apply(null,b||[]),!0}finally{delete d[a]}},Xb:function(c,d){var f=[];b(c,f);for(var k=0,h=f.length;k<h;k++){var l=f[k].ic,g=[l];d&&a.a.ia(g,d);a.H.Wb(f[k].wc,g);l.nodeValue="";l.parentNode&&l.parentNode.removeChild(l)}},Lb:function(a){return(a=a.match(/^\[ko_memo\:(.*?)\]$/))?a[1]:null}}}();a.b("memoization",a.H);
a.b("memoization.memoize",a.H.$a);a.b("memoization.unmemoize",a.H.Wb);a.b("memoization.parseMemoText",a.H.Lb);a.b("memoization.unmemoizeDomNodeAndDescendants",a.H.Xb);a.Sa={throttle:function(b,d){b.throttleEvaluation=d;var c=null;return a.j({read:b,write:function(a){clearTimeout(c);c=setTimeout(function(){b(a)},d)}})},rateLimit:function(a,d){var c,e,f;"number"==typeof d?c=d:(c=d.timeout,e=d.method);f="notifyWhenChangesStop"==e?S:R;a.Za(function(a){return f(a,c)})},notify:function(a,d){a.equalityComparer=
"always"==d?null:J}};var Q={undefined:1,"boolean":1,number:1,string:1};a.b("extenders",a.Sa);a.Ub=function(b,d,c){this.da=b;this.La=d;this.hc=c;this.Gb=!1;a.D(this,"dispose",this.p)};a.Ub.prototype.p=function(){this.Gb=!0;this.hc()};a.Q=function(){a.a.Ga(this,a.Q.fn);this.G={};this.rb=1};var z={U:function(b,d,c){var e=this;c=c||"change";var f=new a.Ub(e,d?b.bind(d):b,function(){a.a.ya(e.G[c],f);e.ua&&e.ua(c)});e.ja&&e.ja(c);e.G[c]||(e.G[c]=[]);e.G[c].push(f);return f},notifySubscribers:function(b,
d){d=d||"change";"change"===d&&this.Yb();if(this.Ba(d))try{a.k.xb();for(var c=this.G[d].slice(0),e=0,f;f=c[e];++e)f.Gb||f.La(b)}finally{a.k.end()}},Aa:function(){return this.rb},pc:function(a){return this.Aa()!==a},Yb:function(){++this.rb},Za:function(b){var d=this,c=a.F(d),e,f,k;d.ta||(d.ta=d.notifySubscribers,d.notifySubscribers=function(a,b){b&&"change"!==b?"beforeChange"===b?d.pb(a):d.ta(a,b):d.qb(a)});var h=b(function(){c&&k===d&&(k=d());e=!1;d.Wa(f,k)&&d.ta(f=k)});d.qb=function(a){e=!0;k=a;
h()};d.pb=function(a){e||(f=a,d.ta(a,"beforeChange"))}},Ba:function(a){return this.G[a]&&this.G[a].length},nc:function(b){if(b)return this.G[b]&&this.G[b].length||0;var d=0;a.a.A(this.G,function(a,b){d+=b.length});return d},Wa:function(a,d){return!this.equalityComparer||!this.equalityComparer(a,d)},extend:function(b){var d=this;b&&a.a.A(b,function(b,e){var f=a.Sa[b];"function"==typeof f&&(d=f(d,e)||d)});return d}};a.D(z,"subscribe",z.U);a.D(z,"extend",z.extend);a.D(z,"getSubscriptionsCount",z.nc);
a.a.za&&a.a.Fa(z,Function.prototype);a.Q.fn=z;a.Hb=function(a){return null!=a&&"function"==typeof a.U&&"function"==typeof a.notifySubscribers};a.b("subscribable",a.Q);a.b("isSubscribable",a.Hb);a.Z=a.k=function(){function b(a){c.push(e);e=a}function d(){e=c.pop()}var c=[],e,f=0;return{xb:b,end:d,Ob:function(b){if(e){if(!a.Hb(b))throw Error("Only subscribable things can act as dependencies");e.La(b,b.ac||(b.ac=++f))}},u:function(a,c,e){try{return b(),a.apply(c,e||[])}finally{d()}},oa:function(){if(e)return e.w.oa()},
Ca:function(){if(e)return e.Ca}}}();a.b("computedContext",a.Z);a.b("computedContext.getDependenciesCount",a.Z.oa);a.b("computedContext.isInitial",a.Z.Ca);a.b("computedContext.isSleeping",a.Z.Jc);a.b("ignoreDependencies",a.Gc=a.k.u);a.r=function(b){function d(){if(0<arguments.length)return d.Wa(c,arguments[0])&&(d.X(),c=arguments[0],d.W()),this;a.k.Ob(d);return c}var c=b;a.Q.call(d);a.a.Ga(d,a.r.fn);d.B=function(){return c};d.W=function(){d.notifySubscribers(c)};d.X=function(){d.notifySubscribers(c,
"beforeChange")};a.D(d,"peek",d.B);a.D(d,"valueHasMutated",d.W);a.D(d,"valueWillMutate",d.X);return d};a.r.fn={equalityComparer:J};var H=a.r.Ac="__ko_proto__";a.r.fn[H]=a.r;a.a.za&&a.a.Fa(a.r.fn,a.Q.fn);a.Ta=function(b,d){return null===b||b===p||b[H]===p?!1:b[H]===d?!0:a.Ta(b[H],d)};a.F=function(b){return a.Ta(b,a.r)};a.Da=function(b){return"function"==typeof b&&b[H]===a.r||"function"==typeof b&&b[H]===a.j&&b.qc?!0:!1};a.b("observable",a.r);a.b("isObservable",a.F);a.b("isWriteableObservable",a.Da);
a.b("isWritableObservable",a.Da);a.ba=function(b){b=b||[];if("object"!=typeof b||!("length"in b))throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");b=a.r(b);a.a.Ga(b,a.ba.fn);return b.extend({trackArrayChanges:!0})};a.ba.fn={remove:function(b){for(var d=this.B(),c=[],e="function"!=typeof b||a.F(b)?function(a){return a===b}:b,f=0;f<d.length;f++){var k=d[f];e(k)&&(0===c.length&&this.X(),c.push(k),d.splice(f,1),f--)}c.length&&this.W();return c},
removeAll:function(b){if(b===p){var d=this.B(),c=d.slice(0);this.X();d.splice(0,d.length);this.W();return c}return b?this.remove(function(c){return 0<=a.a.m(b,c)}):[]},destroy:function(b){var d=this.B(),c="function"!=typeof b||a.F(b)?function(a){return a===b}:b;this.X();for(var e=d.length-1;0<=e;e--)c(d[e])&&(d[e]._destroy=!0);this.W()},destroyAll:function(b){return b===p?this.destroy(function(){return!0}):b?this.destroy(function(d){return 0<=a.a.m(b,d)}):[]},indexOf:function(b){var d=this();return a.a.m(d,
b)},replace:function(a,d){var c=this.indexOf(a);0<=c&&(this.X(),this.B()[c]=d,this.W())}};a.a.o("pop push reverse shift sort splice unshift".split(" "),function(b){a.ba.fn[b]=function(){var a=this.B();this.X();this.yb(a,b,arguments);a=a[b].apply(a,arguments);this.W();return a}});a.a.o(["slice"],function(b){a.ba.fn[b]=function(){var a=this();return a[b].apply(a,arguments)}});a.a.za&&a.a.Fa(a.ba.fn,a.r.fn);a.b("observableArray",a.ba);a.Sa.trackArrayChanges=function(b){function d(){if(!c){c=!0;var g=
b.notifySubscribers;b.notifySubscribers=function(a,b){b&&"change"!==b||++k;return g.apply(this,arguments)};var d=[].concat(b.B()||[]);e=null;f=b.U(function(c){c=[].concat(c||[]);if(b.Ba("arrayChange")){var g;if(!e||1<k)e=a.a.Ma(d,c,{sparse:!0});g=e}d=c;e=null;k=0;g&&g.length&&b.notifySubscribers(g,"arrayChange")})}}if(!b.yb){var c=!1,e=null,f,k=0,h=b.ja,l=b.ua;b.ja=function(a){h&&h.call(b,a);"arrayChange"===a&&d()};b.ua=function(a){l&&l.call(b,a);"arrayChange"!==a||b.Ba("arrayChange")||(f.p(),c=!1)};
b.yb=function(b,d,f){function l(a,b,c){return h[h.length]={status:a,value:b,index:c}}if(c&&!k){var h=[],r=b.length,v=f.length,t=0;switch(d){case "push":t=r;case "unshift":for(d=0;d<v;d++)l("added",f[d],t+d);break;case "pop":t=r-1;case "shift":r&&l("deleted",b[t],t);break;case "splice":d=Math.min(Math.max(0,0>f[0]?r+f[0]:f[0]),r);for(var r=1===v?r:Math.min(d+(f[1]||0),r),v=d+v-2,t=Math.max(r,v),G=[],A=[],p=2;d<t;++d,++p)d<r&&A.push(l("deleted",b[d],d)),d<v&&G.push(l("added",f[p],d));a.a.Cb(A,G);break;
default:return}e=h}}}};a.w=a.j=function(b,d,c){function e(a,b,c){if(I&&b===g)throw Error("A 'pure' computed must not be called recursively");B[a]=c;c.sa=F++;c.ea=b.Aa()}function f(){var a,b;for(a in B)if(B.hasOwnProperty(a)&&(b=B[a],b.da.pc(b.ea)))return!0}function k(){!s&&B&&a.a.A(B,function(a,b){b.p&&b.p()});B=null;F=0;G=!0;s=r=!1}function h(){var a=g.throttleEvaluation;a&&0<=a?(clearTimeout(z),z=setTimeout(function(){l(!0)},a)):g.nb?g.nb():l(!0)}function l(b){if(!v&&!G){if(y&&y()){if(!t){w();return}}else t=
!1;v=!0;try{var c=B,m=F,f=I?p:!F;a.k.xb({La:function(a,b){G||(m&&c[b]?(e(b,a,c[b]),delete c[b],--m):B[b]||e(b,a,s?{da:a}:a.U(h)))},w:g,Ca:f});B={};F=0;try{var l=d?A.call(d):A()}finally{a.k.end(),m&&!s&&a.a.A(c,function(a,b){b.p&&b.p()}),r=!1}g.Wa(n,l)&&(s||q(n,"beforeChange"),n=l,s?g.Yb():b&&q(n));f&&q(n,"awake")}finally{v=!1}F||w()}}function g(){if(0<arguments.length){if("function"===typeof C)C.apply(d,arguments);else throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");
return this}a.k.Ob(g);(r||s&&f())&&l();return n}function m(){(r&&!F||s&&f())&&l();return n}function x(){return r||0<F}function q(a,b){g.notifySubscribers(a,b)}var n,r=!0,v=!1,t=!1,G=!1,A=b,I=!1,s=!1;A&&"object"==typeof A?(c=A,A=c.read):(c=c||{},A||(A=c.read));if("function"!=typeof A)throw Error("Pass a function that returns the value of the ko.computed");var C=c.write,D=c.disposeWhenNodeIsRemoved||c.q||null,u=c.disposeWhen||c.Pa,y=u,w=k,B={},F=0,z=null;d||(d=c.owner);a.Q.call(g);a.a.Ga(g,a.j.fn);
g.B=m;g.oa=function(){return F};g.qc="function"===typeof C;g.p=function(){w()};g.$=x;var T=g.Za;g.Za=function(a){T.call(g,a);g.nb=function(){g.pb(n);r=!0;g.qb(g)}};c.pure?(s=I=!0,g.ja=function(b){if(!G&&s&&"change"==b){s=!1;if(r||f())B=null,F=0,r=!0,l();else{var c=[];a.a.A(B,function(a,b){c[b.sa]=a});a.a.o(c,function(a,b){var c=B[a],g=c.da.U(h);g.sa=b;g.ea=c.ea;B[a]=g})}G||q(n,"awake")}},g.ua=function(b){G||"change"!=b||g.Ba("change")||(a.a.A(B,function(a,b){b.p&&(B[a]={da:b.da,sa:b.sa,ea:b.ea},b.p())}),
s=!0,q(p,"asleep"))},g.bc=g.Aa,g.Aa=function(){s&&(r||f())&&l();return g.bc()}):c.deferEvaluation&&(g.ja=function(a){"change"!=a&&"beforeChange"!=a||m()});a.D(g,"peek",g.B);a.D(g,"dispose",g.p);a.D(g,"isActive",g.$);a.D(g,"getDependenciesCount",g.oa);D&&(t=!0,D.nodeType&&(y=function(){return!a.a.Qa(D)||u&&u()}));s||c.deferEvaluation||l();D&&x()&&D.nodeType&&(w=function(){a.a.C.Pb(D,w);k()},a.a.C.fa(D,w));return g};a.sc=function(b){return a.Ta(b,a.j)};z=a.r.Ac;a.j[z]=a.r;a.j.fn={equalityComparer:J};
a.j.fn[z]=a.j;a.a.za&&a.a.Fa(a.j.fn,a.Q.fn);a.b("dependentObservable",a.j);a.b("computed",a.j);a.b("isComputed",a.sc);a.Nb=function(b,d){if("function"===typeof b)return a.w(b,d,{pure:!0});b=a.a.extend({},b);b.pure=!0;return a.w(b,d)};a.b("pureComputed",a.Nb);(function(){function b(a,f,k){k=k||new c;a=f(a);if("object"!=typeof a||null===a||a===p||a instanceof Date||a instanceof String||a instanceof Number||a instanceof Boolean)return a;var h=a instanceof Array?[]:{};k.save(a,h);d(a,function(c){var g=
f(a[c]);switch(typeof g){case "boolean":case "number":case "string":case "function":h[c]=g;break;case "object":case "undefined":var d=k.get(g);h[c]=d!==p?d:b(g,f,k)}});return h}function d(a,b){if(a instanceof Array){for(var c=0;c<a.length;c++)b(c);"function"==typeof a.toJSON&&b("toJSON")}else for(c in a)b(c)}function c(){this.keys=[];this.mb=[]}a.Vb=function(c){if(0==arguments.length)throw Error("When calling ko.toJS, pass the object you want to convert.");return b(c,function(b){for(var c=0;a.F(b)&&
10>c;c++)b=b();return b})};a.toJSON=function(b,c,d){b=a.Vb(b);return a.a.jb(b,c,d)};c.prototype={save:function(b,c){var d=a.a.m(this.keys,b);0<=d?this.mb[d]=c:(this.keys.push(b),this.mb.push(c))},get:function(b){b=a.a.m(this.keys,b);return 0<=b?this.mb[b]:p}}})();a.b("toJS",a.Vb);a.b("toJSON",a.toJSON);(function(){a.i={s:function(b){switch(a.a.v(b)){case "option":return!0===b.__ko__hasDomDataOptionValue__?a.a.f.get(b,a.d.options.ab):7>=a.a.M?b.getAttributeNode("value")&&b.getAttributeNode("value").specified?
b.value:b.text:b.value;case "select":return 0<=b.selectedIndex?a.i.s(b.options[b.selectedIndex]):p;default:return b.value}},Y:function(b,d,c){switch(a.a.v(b)){case "option":switch(typeof d){case "string":a.a.f.set(b,a.d.options.ab,p);"__ko__hasDomDataOptionValue__"in b&&delete b.__ko__hasDomDataOptionValue__;b.value=d;break;default:a.a.f.set(b,a.d.options.ab,d),b.__ko__hasDomDataOptionValue__=!0,b.value="number"===typeof d?d:""}break;case "select":if(""===d||null===d)d=p;for(var e=-1,f=0,k=b.options.length,
h;f<k;++f)if(h=a.i.s(b.options[f]),h==d||""==h&&d===p){e=f;break}if(c||0<=e||d===p&&1<b.size)b.selectedIndex=e;break;default:if(null===d||d===p)d="";b.value=d}}}})();a.b("selectExtensions",a.i);a.b("selectExtensions.readValue",a.i.s);a.b("selectExtensions.writeValue",a.i.Y);a.h=function(){function b(b){b=a.a.ib(b);123===b.charCodeAt(0)&&(b=b.slice(1,-1));var c=[],d=b.match(e),x,h=[],n=0;if(d){d.push(",");for(var r=0,v;v=d[r];++r){var t=v.charCodeAt(0);if(44===t){if(0>=n){c.push(x&&h.length?{key:x,
value:h.join("")}:{unknown:x||h.join("")});x=n=0;h=[];continue}}else if(58===t){if(!n&&!x&&1===h.length){x=h.pop();continue}}else 47===t&&r&&1<v.length?(t=d[r-1].match(f))&&!k[t[0]]&&(b=b.substr(b.indexOf(v)+1),d=b.match(e),d.push(","),r=-1,v="/"):40===t||123===t||91===t?++n:41===t||125===t||93===t?--n:x||h.length||34!==t&&39!==t||(v=v.slice(1,-1));h.push(v)}}return c}var d=["true","false","null","undefined"],c=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,e=RegExp("\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'|/(?:[^/\\\\]|\\\\.)*/w*|[^\\s:,/][^,\"'{}()/:[\\]]*[^\\s,\"'{}()/:[\\]]|[^\\s]",
"g"),f=/[\])"'A-Za-z0-9_$]+$/,k={"in":1,"return":1,"typeof":1},h={};return{ka:[],V:h,bb:b,Ea:function(e,g){function m(b,g){var e;if(!r){var l=a.getBindingHandler(b);if(l&&l.preprocess&&!(g=l.preprocess(g,b,m)))return;if(l=h[b])e=g,0<=a.a.m(d,e)?e=!1:(l=e.match(c),e=null===l?!1:l[1]?"Object("+l[1]+")"+l[2]:e),l=e;l&&k.push("'"+b+"':function(_z){"+e+"=_z}")}n&&(g="function(){return "+g+" }");f.push("'"+b+"':"+g)}g=g||{};var f=[],k=[],n=g.valueAccessors,r=g.bindingParams,v="string"===typeof e?b(e):e;
a.a.o(v,function(a){m(a.key||a.unknown,a.value)});k.length&&m("_ko_property_writers","{"+k.join(",")+" }");return f.join(",")},vc:function(a,b){for(var c=0;c<a.length;c++)if(a[c].key==b)return!0;return!1},ra:function(b,c,d,e,f){if(b&&a.F(b))!a.Da(b)||f&&b.B()===e||b(e);else if((b=c.get("_ko_property_writers"))&&b[d])b[d](e)}}}();a.b("expressionRewriting",a.h);a.b("expressionRewriting.bindingRewriteValidators",a.h.ka);a.b("expressionRewriting.parseObjectLiteral",a.h.bb);a.b("expressionRewriting.preProcessBindings",
a.h.Ea);a.b("expressionRewriting._twoWayBindings",a.h.V);a.b("jsonExpressionRewriting",a.h);a.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson",a.h.Ea);(function(){function b(a){return 8==a.nodeType&&k.test(f?a.text:a.nodeValue)}function d(a){return 8==a.nodeType&&h.test(f?a.text:a.nodeValue)}function c(a,c){for(var e=a,f=1,l=[];e=e.nextSibling;){if(d(e)&&(f--,0===f))return l;l.push(e);b(e)&&f++}if(!c)throw Error("Cannot find closing comment tag to match: "+a.nodeValue);return null}function e(a,
b){var d=c(a,b);return d?0<d.length?d[d.length-1].nextSibling:a.nextSibling:null}var f=w&&"\x3c!--test--\x3e"===w.createComment("test").text,k=f?/^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,h=f?/^\x3c!--\s*\/ko\s*--\x3e$/:/^\s*\/ko\s*$/,l={ul:!0,ol:!0};a.e={R:{},childNodes:function(a){return b(a)?c(a):a.childNodes},ma:function(c){if(b(c)){c=a.e.childNodes(c);for(var d=0,e=c.length;d<e;d++)a.removeNode(c[d])}else a.a.Ra(c)},T:function(c,d){if(b(c)){a.e.ma(c);for(var e=c.nextSibling,
f=0,l=d.length;f<l;f++)e.parentNode.insertBefore(d[f],e)}else a.a.T(c,d)},Mb:function(a,c){b(a)?a.parentNode.insertBefore(c,a.nextSibling):a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c)},Fb:function(c,d,e){e?b(c)?c.parentNode.insertBefore(d,e.nextSibling):e.nextSibling?c.insertBefore(d,e.nextSibling):c.appendChild(d):a.e.Mb(c,d)},firstChild:function(a){return b(a)?!a.nextSibling||d(a.nextSibling)?null:a.nextSibling:a.firstChild},nextSibling:function(a){b(a)&&(a=e(a));return a.nextSibling&&
d(a.nextSibling)?null:a.nextSibling},oc:b,Fc:function(a){return(a=(f?a.text:a.nodeValue).match(k))?a[1]:null},Kb:function(c){if(l[a.a.v(c)]){var m=c.firstChild;if(m){do if(1===m.nodeType){var f;f=m.firstChild;var h=null;if(f){do if(h)h.push(f);else if(b(f)){var k=e(f,!0);k?f=k:h=[f]}else d(f)&&(h=[f]);while(f=f.nextSibling)}if(f=h)for(h=m.nextSibling,k=0;k<f.length;k++)h?c.insertBefore(f[k],h):c.appendChild(f[k])}while(m=m.nextSibling)}}}}})();a.b("virtualElements",a.e);a.b("virtualElements.allowedBindings",
a.e.R);a.b("virtualElements.emptyNode",a.e.ma);a.b("virtualElements.insertAfter",a.e.Fb);a.b("virtualElements.prepend",a.e.Mb);a.b("virtualElements.setDomNodeChildren",a.e.T);(function(){a.L=function(){this.ec={}};a.a.extend(a.L.prototype,{nodeHasBindings:function(b){switch(b.nodeType){case 1:return null!=b.getAttribute("data-bind")||a.g.getComponentNameForNode(b);case 8:return a.e.oc(b);default:return!1}},getBindings:function(b,d){var c=this.getBindingsString(b,d),c=c?this.parseBindingsString(c,
d,b):null;return a.g.sb(c,b,d,!1)},getBindingAccessors:function(b,d){var c=this.getBindingsString(b,d),c=c?this.parseBindingsString(c,d,b,{valueAccessors:!0}):null;return a.g.sb(c,b,d,!0)},getBindingsString:function(b){switch(b.nodeType){case 1:return b.getAttribute("data-bind");case 8:return a.e.Fc(b);default:return null}},parseBindingsString:function(b,d,c,e){try{var f=this.ec,k=b+(e&&e.valueAccessors||""),h;if(!(h=f[k])){var l,g="with($context){with($data||{}){return{"+a.h.Ea(b,e)+"}}}";l=new Function("$context",
"$element",g);h=f[k]=l}return h(d,c)}catch(m){throw m.message="Unable to parse bindings.\nBindings value: "+b+"\nMessage: "+m.message,m;}}});a.L.instance=new a.L})();a.b("bindingProvider",a.L);(function(){function b(a){return function(){return a}}function d(a){return a()}function c(b){return a.a.pa(a.k.u(b),function(a,c){return function(){return b()[c]}})}function e(d,g,e){return"function"===typeof d?c(d.bind(null,g,e)):a.a.pa(d,b)}function f(a,b){return c(this.getBindings.bind(this,a,b))}function k(b,
c,d){var g,e=a.e.firstChild(c),f=a.L.instance,m=f.preprocessNode;if(m){for(;g=e;)e=a.e.nextSibling(g),m.call(f,g);e=a.e.firstChild(c)}for(;g=e;)e=a.e.nextSibling(g),h(b,g,d)}function h(b,c,d){var e=!0,f=1===c.nodeType;f&&a.e.Kb(c);if(f&&d||a.L.instance.nodeHasBindings(c))e=g(c,null,b,d).shouldBindDescendants;e&&!x[a.a.v(c)]&&k(b,c,!f)}function l(b){var c=[],d={},g=[];a.a.A(b,function I(e){if(!d[e]){var f=a.getBindingHandler(e);f&&(f.after&&(g.push(e),a.a.o(f.after,function(c){if(b[c]){if(-1!==a.a.m(g,
c))throw Error("Cannot combine the following bindings, because they have a cyclic dependency: "+g.join(", "));I(c)}}),g.length--),c.push({key:e,Eb:f}));d[e]=!0}});return c}function g(b,c,g,e){var m=a.a.f.get(b,q);if(!c){if(m)throw Error("You cannot apply bindings multiple times to the same element.");a.a.f.set(b,q,!0)}!m&&e&&a.Tb(b,g);var h;if(c&&"function"!==typeof c)h=c;else{var k=a.L.instance,x=k.getBindingAccessors||f,n=a.j(function(){(h=c?c(g,b):x.call(k,b,g))&&g.K&&g.K();return h},null,{q:b});
h&&n.$()||(n=null)}var u;if(h){var w=n?function(a){return function(){return d(n()[a])}}:function(a){return h[a]},y=function(){return a.a.pa(n?n():h,d)};y.get=function(a){return h[a]&&d(w(a))};y.has=function(a){return a in h};e=l(h);a.a.o(e,function(c){var d=c.Eb.init,e=c.Eb.update,f=c.key;if(8===b.nodeType&&!a.e.R[f])throw Error("The binding '"+f+"' cannot be used with virtual elements");try{"function"==typeof d&&a.k.u(function(){var a=d(b,w(f),y,g.$data,g);if(a&&a.controlsDescendantBindings){if(u!==
p)throw Error("Multiple bindings ("+u+" and "+f+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");u=f}}),"function"==typeof e&&a.j(function(){e(b,w(f),y,g.$data,g)},null,{q:b})}catch(m){throw m.message='Unable to process binding "'+f+": "+h[f]+'"\nMessage: '+m.message,m;}})}return{shouldBindDescendants:u===p}}function m(b){return b&&b instanceof a.N?b:new a.N(b)}a.d={};var x={script:!0,textarea:!0};a.getBindingHandler=function(b){return a.d[b]};
a.N=function(b,c,d,g){var e=this,f="function"==typeof b&&!a.F(b),m,l=a.j(function(){var m=f?b():b,h=a.a.c(m);c?(c.K&&c.K(),a.a.extend(e,c),l&&(e.K=l)):(e.$parents=[],e.$root=h,e.ko=a);e.$rawData=m;e.$data=h;d&&(e[d]=h);g&&g(e,c,h);return e.$data},null,{Pa:function(){return m&&!a.a.tb(m)},q:!0});l.$()&&(e.K=l,l.equalityComparer=null,m=[],l.Zb=function(b){m.push(b);a.a.C.fa(b,function(b){a.a.ya(m,b);m.length||(l.p(),e.K=l=p)})})};a.N.prototype.createChildContext=function(b,c,d){return new a.N(b,this,
c,function(a,b){a.$parentContext=b;a.$parent=b.$data;a.$parents=(b.$parents||[]).slice(0);a.$parents.unshift(a.$parent);d&&d(a)})};a.N.prototype.extend=function(b){return new a.N(this.K||this.$data,this,null,function(c,d){c.$rawData=d.$rawData;a.a.extend(c,"function"==typeof b?b():b)})};var q=a.a.f.I(),n=a.a.f.I();a.Tb=function(b,c){if(2==arguments.length)a.a.f.set(b,n,c),c.K&&c.K.Zb(b);else return a.a.f.get(b,n)};a.va=function(b,c,d){1===b.nodeType&&a.e.Kb(b);return g(b,c,m(d),!0)};a.cc=function(b,
c,d){d=m(d);return a.va(b,e(c,d,b),d)};a.Ja=function(a,b){1!==b.nodeType&&8!==b.nodeType||k(m(a),b,!0)};a.ub=function(a,b){!u&&y.jQuery&&(u=y.jQuery);if(b&&1!==b.nodeType&&8!==b.nodeType)throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");b=b||y.document.body;h(m(a),b,!0)};a.Oa=function(b){switch(b.nodeType){case 1:case 8:var c=a.Tb(b);if(c)return c;if(b.parentNode)return a.Oa(b.parentNode)}return p};a.gc=function(b){return(b=a.Oa(b))?
b.$data:p};a.b("bindingHandlers",a.d);a.b("applyBindings",a.ub);a.b("applyBindingsToDescendants",a.Ja);a.b("applyBindingAccessorsToNode",a.va);a.b("applyBindingsToNode",a.cc);a.b("contextFor",a.Oa);a.b("dataFor",a.gc)})();(function(b){function d(d,e){var g=f.hasOwnProperty(d)?f[d]:b,m;g?g.U(e):(g=f[d]=new a.Q,g.U(e),c(d,function(a,b){var c=!(!b||!b.synchronous);k[d]={definition:a,tc:c};delete f[d];m||c?g.notifySubscribers(a):setTimeout(function(){g.notifySubscribers(a)},0)}),m=!0)}function c(a,b){e("getConfig",
[a],function(c){c?e("loadComponent",[a,c],function(a){b(a,c)}):b(null,null)})}function e(c,d,g,f){f||(f=a.g.loaders.slice(0));var k=f.shift();if(k){var q=k[c];if(q){var n=!1;if(q.apply(k,d.concat(function(a){n?g(null):null!==a?g(a):e(c,d,g,f)}))!==b&&(n=!0,!k.suppressLoaderExceptions))throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.");}else e(c,d,g,f)}else g(null)}var f={},k={};a.g={get:function(c,e){var g=k.hasOwnProperty(c)?k[c]:
b;g?g.tc?a.k.u(function(){e(g.definition)}):setTimeout(function(){e(g.definition)},0):d(c,e)},zb:function(a){delete k[a]},ob:e};a.g.loaders=[];a.b("components",a.g);a.b("components.get",a.g.get);a.b("components.clearCachedDefinition",a.g.zb)})();(function(){function b(b,c,d,e){function k(){0===--v&&e(h)}var h={},v=2,t=d.template;d=d.viewModel;t?f(c,t,function(c){a.g.ob("loadTemplate",[b,c],function(a){h.template=a;k()})}):k();d?f(c,d,function(c){a.g.ob("loadViewModel",[b,c],function(a){h[l]=a;k()})}):
k()}function d(a,b,c){if("function"===typeof b)c(function(a){return new b(a)});else if("function"===typeof b[l])c(b[l]);else if("instance"in b){var e=b.instance;c(function(){return e})}else"viewModel"in b?d(a,b.viewModel,c):a("Unknown viewModel value: "+b)}function c(b){switch(a.a.v(b)){case "script":return a.a.ca(b.text);case "textarea":return a.a.ca(b.value);case "template":if(e(b.content))return a.a.la(b.content.childNodes)}return a.a.la(b.childNodes)}function e(a){return y.DocumentFragment?a instanceof
DocumentFragment:a&&11===a.nodeType}function f(a,b,c){"string"===typeof b.require?O||y.require?(O||y.require)([b.require],c):a("Uses require, but no AMD loader is present"):c(b)}function k(a){return function(b){throw Error("Component '"+a+"': "+b);}}var h={};a.g.register=function(b,c){if(!c)throw Error("Invalid configuration for "+b);if(a.g.Xa(b))throw Error("Component "+b+" is already registered");h[b]=c};a.g.Xa=function(a){return a in h};a.g.Ec=function(b){delete h[b];a.g.zb(b)};a.g.Ab={getConfig:function(a,
b){b(h.hasOwnProperty(a)?h[a]:null)},loadComponent:function(a,c,d){var e=k(a);f(e,c,function(c){b(a,e,c,d)})},loadTemplate:function(b,d,f){b=k(b);if("string"===typeof d)f(a.a.ca(d));else if(d instanceof Array)f(d);else if(e(d))f(a.a.O(d.childNodes));else if(d.element)if(d=d.element,y.HTMLElement?d instanceof HTMLElement:d&&d.tagName&&1===d.nodeType)f(c(d));else if("string"===typeof d){var l=w.getElementById(d);l?f(c(l)):b("Cannot find element with ID "+d)}else b("Unknown element type: "+d);else b("Unknown template value: "+
d)},loadViewModel:function(a,b,c){d(k(a),b,c)}};var l="createViewModel";a.b("components.register",a.g.register);a.b("components.isRegistered",a.g.Xa);a.b("components.unregister",a.g.Ec);a.b("components.defaultLoader",a.g.Ab);a.g.loaders.push(a.g.Ab);a.g.$b=h})();(function(){function b(b,e){var f=b.getAttribute("params");if(f){var f=d.parseBindingsString(f,e,b,{valueAccessors:!0,bindingParams:!0}),f=a.a.pa(f,function(d){return a.w(d,null,{q:b})}),k=a.a.pa(f,function(d){var e=d.B();return d.$()?a.w({read:function(){return a.a.c(d())},
write:a.Da(e)&&function(a){d()(a)},q:b}):e});k.hasOwnProperty("$raw")||(k.$raw=f);return k}return{$raw:{}}}a.g.getComponentNameForNode=function(b){b=a.a.v(b);return a.g.Xa(b)&&b};a.g.sb=function(c,d,f,k){if(1===d.nodeType){var h=a.g.getComponentNameForNode(d);if(h){c=c||{};if(c.component)throw Error('Cannot use the "component" binding on a custom element matching a component');var l={name:h,params:b(d,f)};c.component=k?function(){return l}:l}}return c};var d=new a.L;9>a.a.M&&(a.g.register=function(a){return function(b){w.createElement(b);
return a.apply(this,arguments)}}(a.g.register),w.createDocumentFragment=function(b){return function(){var d=b(),f=a.g.$b,k;for(k in f)f.hasOwnProperty(k)&&d.createElement(k);return d}}(w.createDocumentFragment))})();(function(b){function d(b,c,d){c=c.template;if(!c)throw Error("Component '"+b+"' has no template");b=a.a.la(c);a.e.T(d,b)}function c(a,b,c,d){var e=a.createViewModel;return e?e.call(a,d,{element:b,templateNodes:c}):d}var e=0;a.d.component={init:function(f,k,h,l,g){function m(){var a=x&&
x.dispose;"function"===typeof a&&a.call(x);q=null}var x,q,n=a.a.O(a.e.childNodes(f));a.a.C.fa(f,m);a.w(function(){var l=a.a.c(k()),h,t;"string"===typeof l?h=l:(h=a.a.c(l.name),t=a.a.c(l.params));if(!h)throw Error("No component name specified");var p=q=++e;a.g.get(h,function(e){if(q===p){m();if(!e)throw Error("Unknown component '"+h+"'");d(h,e,f);var l=c(e,f,n,t);e=g.createChildContext(l,b,function(a){a.$component=l;a.$componentTemplateNodes=n});x=l;a.Ja(e,f)}})},null,{q:f});return{controlsDescendantBindings:!0}}};
a.e.R.component=!0})();var P={"class":"className","for":"htmlFor"};a.d.attr={update:function(b,d){var c=a.a.c(d())||{};a.a.A(c,function(c,d){d=a.a.c(d);var k=!1===d||null===d||d===p;k&&b.removeAttribute(c);8>=a.a.M&&c in P?(c=P[c],k?b.removeAttribute(c):b[c]=d):k||b.setAttribute(c,d.toString());"name"===c&&a.a.Rb(b,k?"":d.toString())})}};(function(){a.d.checked={after:["value","attr"],init:function(b,d,c){function e(){var e=b.checked,f=x?k():e;if(!a.Z.Ca()&&(!l||e)){var h=a.k.u(d);g?m!==f?(e&&(a.a.ga(h,
f,!0),a.a.ga(h,m,!1)),m=f):a.a.ga(h,f,e):a.h.ra(h,c,"checked",f,!0)}}function f(){var c=a.a.c(d());b.checked=g?0<=a.a.m(c,k()):h?c:k()===c}var k=a.Nb(function(){return c.has("checkedValue")?a.a.c(c.get("checkedValue")):c.has("value")?a.a.c(c.get("value")):b.value}),h="checkbox"==b.type,l="radio"==b.type;if(h||l){var g=h&&a.a.c(d())instanceof Array,m=g?k():p,x=l||g;l&&!b.name&&a.d.uniqueName.init(b,function(){return!0});a.w(e,null,{q:b});a.a.n(b,"click",e);a.w(f,null,{q:b})}}};a.h.V.checked=!0;a.d.checkedValue=
{update:function(b,d){b.value=a.a.c(d())}}})();a.d.css={update:function(b,d){var c=a.a.c(d());null!==c&&"object"==typeof c?a.a.A(c,function(c,d){d=a.a.c(d);a.a.Ia(b,c,d)}):(c=String(c||""),a.a.Ia(b,b.__ko__cssValue,!1),b.__ko__cssValue=c,a.a.Ia(b,c,!0))}};a.d.enable={update:function(b,d){var c=a.a.c(d());c&&b.disabled?b.removeAttribute("disabled"):c||b.disabled||(b.disabled=!0)}};a.d.disable={update:function(b,d){a.d.enable.update(b,function(){return!a.a.c(d())})}};a.d.event={init:function(b,d,c,
e,f){var k=d()||{};a.a.A(k,function(h){"string"==typeof h&&a.a.n(b,h,function(b){var g,m=d()[h];if(m){try{var k=a.a.O(arguments);e=f.$data;k.unshift(e);g=m.apply(e,k)}finally{!0!==g&&(b.preventDefault?b.preventDefault():b.returnValue=!1)}!1===c.get(h+"Bubble")&&(b.cancelBubble=!0,b.stopPropagation&&b.stopPropagation())}})})}};a.d.foreach={Ib:function(b){return function(){var d=b(),c=a.a.cb(d);if(!c||"number"==typeof c.length)return{foreach:d,templateEngine:a.P.Va};a.a.c(d);return{foreach:c.data,as:c.as,
includeDestroyed:c.includeDestroyed,afterAdd:c.afterAdd,beforeRemove:c.beforeRemove,afterRender:c.afterRender,beforeMove:c.beforeMove,afterMove:c.afterMove,templateEngine:a.P.Va}}},init:function(b,d){return a.d.template.init(b,a.d.foreach.Ib(d))},update:function(b,d,c,e,f){return a.d.template.update(b,a.d.foreach.Ib(d),c,e,f)}};a.h.ka.foreach=!1;a.e.R.foreach=!0;a.d.hasfocus={init:function(b,d,c){function e(e){b.__ko_hasfocusUpdating=!0;var f=b.ownerDocument;if("activeElement"in f){var g;try{g=f.activeElement}catch(m){g=
f.body}e=g===b}f=d();a.h.ra(f,c,"hasfocus",e,!0);b.__ko_hasfocusLastValue=e;b.__ko_hasfocusUpdating=!1}var f=e.bind(null,!0),k=e.bind(null,!1);a.a.n(b,"focus",f);a.a.n(b,"focusin",f);a.a.n(b,"blur",k);a.a.n(b,"focusout",k)},update:function(b,d){var c=!!a.a.c(d());b.__ko_hasfocusUpdating||b.__ko_hasfocusLastValue===c||(c?b.focus():b.blur(),a.k.u(a.a.qa,null,[b,c?"focusin":"focusout"]))}};a.h.V.hasfocus=!0;a.d.hasFocus=a.d.hasfocus;a.h.V.hasFocus=!0;a.d.html={init:function(){return{controlsDescendantBindings:!0}},
update:function(b,d){a.a.gb(b,d())}};K("if");K("ifnot",!1,!0);K("with",!0,!1,function(a,d){return a.createChildContext(d)});var L={};a.d.options={init:function(b){if("select"!==a.a.v(b))throw Error("options binding applies only to SELECT elements");for(;0<b.length;)b.remove(0);return{controlsDescendantBindings:!0}},update:function(b,d,c){function e(){return a.a.xa(b.options,function(a){return a.selected})}function f(a,b,c){var d=typeof b;return"function"==d?b(a):"string"==d?a[b]:c}function k(d,e){if(r&&
m)a.i.Y(b,a.a.c(c.get("value")),!0);else if(n.length){var g=0<=a.a.m(n,a.i.s(e[0]));a.a.Sb(e[0],g);r&&!g&&a.k.u(a.a.qa,null,[b,"change"])}}var h=b.multiple,l=0!=b.length&&h?b.scrollTop:null,g=a.a.c(d()),m=c.get("valueAllowUnset")&&c.has("value"),x=c.get("optionsIncludeDestroyed");d={};var q,n=[];m||(h?n=a.a.Ka(e(),a.i.s):0<=b.selectedIndex&&n.push(a.i.s(b.options[b.selectedIndex])));g&&("undefined"==typeof g.length&&(g=[g]),q=a.a.xa(g,function(b){return x||b===p||null===b||!a.a.c(b._destroy)}),c.has("optionsCaption")&&
(g=a.a.c(c.get("optionsCaption")),null!==g&&g!==p&&q.unshift(L)));var r=!1;d.beforeRemove=function(a){b.removeChild(a)};g=k;c.has("optionsAfterRender")&&"function"==typeof c.get("optionsAfterRender")&&(g=function(b,d){k(0,d);a.k.u(c.get("optionsAfterRender"),null,[d[0],b!==L?b:p])});a.a.fb(b,q,function(d,e,g){g.length&&(n=!m&&g[0].selected?[a.i.s(g[0])]:[],r=!0);e=b.ownerDocument.createElement("option");d===L?(a.a.Ha(e,c.get("optionsCaption")),a.i.Y(e,p)):(g=f(d,c.get("optionsValue"),d),a.i.Y(e,a.a.c(g)),
d=f(d,c.get("optionsText"),g),a.a.Ha(e,d));return[e]},d,g);a.k.u(function(){m?a.i.Y(b,a.a.c(c.get("value")),!0):(h?n.length&&e().length<n.length:n.length&&0<=b.selectedIndex?a.i.s(b.options[b.selectedIndex])!==n[0]:n.length||0<=b.selectedIndex)&&a.a.qa(b,"change")});a.a.kc(b);l&&20<Math.abs(l-b.scrollTop)&&(b.scrollTop=l)}};a.d.options.ab=a.a.f.I();a.d.selectedOptions={after:["options","foreach"],init:function(b,d,c){a.a.n(b,"change",function(){var e=d(),f=[];a.a.o(b.getElementsByTagName("option"),
function(b){b.selected&&f.push(a.i.s(b))});a.h.ra(e,c,"selectedOptions",f)})},update:function(b,d){if("select"!=a.a.v(b))throw Error("values binding applies only to SELECT elements");var c=a.a.c(d());c&&"number"==typeof c.length&&a.a.o(b.getElementsByTagName("option"),function(b){var d=0<=a.a.m(c,a.i.s(b));a.a.Sb(b,d)})}};a.h.V.selectedOptions=!0;a.d.style={update:function(b,d){var c=a.a.c(d()||{});a.a.A(c,function(c,d){d=a.a.c(d);if(null===d||d===p||!1===d)d="";b.style[c]=d})}};a.d.submit={init:function(b,
d,c,e,f){if("function"!=typeof d())throw Error("The value for a submit binding must be a function");a.a.n(b,"submit",function(a){var c,e=d();try{c=e.call(f.$data,b)}finally{!0!==c&&(a.preventDefault?a.preventDefault():a.returnValue=!1)}})}};a.d.text={init:function(){return{controlsDescendantBindings:!0}},update:function(b,d){a.a.Ha(b,d())}};a.e.R.text=!0;(function(){if(y&&y.navigator)var b=function(a){if(a)return parseFloat(a[1])},d=y.opera&&y.opera.version&&parseInt(y.opera.version()),c=y.navigator.userAgent,
e=b(c.match(/^(?:(?!chrome).)*version\/([^ ]*) safari/i)),f=b(c.match(/Firefox\/([^ ]*)/));if(10>a.a.M)var k=a.a.f.I(),h=a.a.f.I(),l=function(b){var c=this.activeElement;(c=c&&a.a.f.get(c,h))&&c(b)},g=function(b,c){var d=b.ownerDocument;a.a.f.get(d,k)||(a.a.f.set(d,k,!0),a.a.n(d,"selectionchange",l));a.a.f.set(b,h,c)};a.d.textInput={init:function(b,c,l){function h(c,d){a.a.n(b,c,d)}function k(){var d=a.a.c(c());if(null===d||d===p)d="";w!==p&&d===w?setTimeout(k,4):b.value!==d&&(u=d,b.value=d)}function v(){A||
(w=b.value,A=setTimeout(t,4))}function t(){clearTimeout(A);w=A=p;var d=b.value;u!==d&&(u=d,a.h.ra(c(),l,"textInput",d))}var u=b.value,A,w;10>a.a.M?(h("propertychange",function(a){"value"===a.propertyName&&t()}),8==a.a.M&&(h("keyup",t),h("keydown",t)),8<=a.a.M&&(g(b,t),h("dragend",v))):(h("input",t),5>e&&"textarea"===a.a.v(b)?(h("keydown",v),h("paste",v),h("cut",v)):11>d?h("keydown",v):4>f&&(h("DOMAutoComplete",t),h("dragdrop",t),h("drop",t)));h("change",t);a.w(k,null,{q:b})}};a.h.V.textInput=!0;a.d.textinput=
{preprocess:function(a,b,c){c("textInput",a)}}})();a.d.uniqueName={init:function(b,d){if(d()){var c="ko_unique_"+ ++a.d.uniqueName.fc;a.a.Rb(b,c)}}};a.d.uniqueName.fc=0;a.d.value={after:["options","foreach"],init:function(b,d,c){if("input"!=b.tagName.toLowerCase()||"checkbox"!=b.type&&"radio"!=b.type){var e=["change"],f=c.get("valueUpdate"),k=!1,h=null;f&&("string"==typeof f&&(f=[f]),a.a.ia(e,f),e=a.a.wb(e));var l=function(){h=null;k=!1;var e=d(),g=a.i.s(b);a.h.ra(e,c,"value",g)};!a.a.M||"input"!=
b.tagName.toLowerCase()||"text"!=b.type||"off"==b.autocomplete||b.form&&"off"==b.form.autocomplete||-1!=a.a.m(e,"propertychange")||(a.a.n(b,"propertychange",function(){k=!0}),a.a.n(b,"focus",function(){k=!1}),a.a.n(b,"blur",function(){k&&l()}));a.a.o(e,function(c){var d=l;a.a.Dc(c,"after")&&(d=function(){h=a.i.s(b);setTimeout(l,0)},c=c.substring(5));a.a.n(b,c,d)});var g=function(){var e=a.a.c(d()),f=a.i.s(b);if(null!==h&&e===h)setTimeout(g,0);else if(e!==f)if("select"===a.a.v(b)){var l=c.get("valueAllowUnset"),
f=function(){a.i.Y(b,e,l)};f();l||e===a.i.s(b)?setTimeout(f,0):a.k.u(a.a.qa,null,[b,"change"])}else a.i.Y(b,e)};a.w(g,null,{q:b})}else a.va(b,{checkedValue:d})},update:function(){}};a.h.V.value=!0;a.d.visible={update:function(b,d){var c=a.a.c(d()),e="none"!=b.style.display;c&&!e?b.style.display="":!c&&e&&(b.style.display="none")}};(function(b){a.d[b]={init:function(d,c,e,f,k){return a.d.event.init.call(this,d,function(){var a={};a[b]=c();return a},e,f,k)}}})("click");a.J=function(){};a.J.prototype.renderTemplateSource=
function(){throw Error("Override renderTemplateSource");};a.J.prototype.createJavaScriptEvaluatorBlock=function(){throw Error("Override createJavaScriptEvaluatorBlock");};a.J.prototype.makeTemplateSource=function(b,d){if("string"==typeof b){d=d||w;var c=d.getElementById(b);if(!c)throw Error("Cannot find template with ID "+b);return new a.t.l(c)}if(1==b.nodeType||8==b.nodeType)return new a.t.ha(b);throw Error("Unknown template type: "+b);};a.J.prototype.renderTemplate=function(a,d,c,e){a=this.makeTemplateSource(a,
e);return this.renderTemplateSource(a,d,c,e)};a.J.prototype.isTemplateRewritten=function(a,d){return!1===this.allowTemplateRewriting?!0:this.makeTemplateSource(a,d).data("isRewritten")};a.J.prototype.rewriteTemplate=function(a,d,c){a=this.makeTemplateSource(a,c);d=d(a.text());a.text(d);a.data("isRewritten",!0)};a.b("templateEngine",a.J);a.kb=function(){function b(b,c,d,h){b=a.h.bb(b);for(var l=a.h.ka,g=0;g<b.length;g++){var m=b[g].key;if(l.hasOwnProperty(m)){var x=l[m];if("function"===typeof x){if(m=
x(b[g].value))throw Error(m);}else if(!x)throw Error("This template engine does not support the '"+m+"' binding within its templates");}}d="ko.__tr_ambtns(function($context,$element){return(function(){return{ "+a.h.Ea(b,{valueAccessors:!0})+" } })()},'"+d.toLowerCase()+"')";return h.createJavaScriptEvaluatorBlock(d)+c}var d=/(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi,c=/\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;return{lc:function(b,
c,d){c.isTemplateRewritten(b,d)||c.rewriteTemplate(b,function(b){return a.kb.xc(b,c)},d)},xc:function(a,f){return a.replace(d,function(a,c,d,e,m){return b(m,c,d,f)}).replace(c,function(a,c){return b(c,"\x3c!-- ko --\x3e","#comment",f)})},dc:function(b,c){return a.H.$a(function(d,h){var l=d.nextSibling;l&&l.nodeName.toLowerCase()===c&&a.va(l,b,h)})}}}();a.b("__tr_ambtns",a.kb.dc);(function(){a.t={};a.t.l=function(a){this.l=a};a.t.l.prototype.text=function(){var b=a.a.v(this.l),b="script"===b?"text":
"textarea"===b?"value":"innerHTML";if(0==arguments.length)return this.l[b];var d=arguments[0];"innerHTML"===b?a.a.gb(this.l,d):this.l[b]=d};var b=a.a.f.I()+"_";a.t.l.prototype.data=function(c){if(1===arguments.length)return a.a.f.get(this.l,b+c);a.a.f.set(this.l,b+c,arguments[1])};var d=a.a.f.I();a.t.ha=function(a){this.l=a};a.t.ha.prototype=new a.t.l;a.t.ha.prototype.text=function(){if(0==arguments.length){var b=a.a.f.get(this.l,d)||{};b.lb===p&&b.Na&&(b.lb=b.Na.innerHTML);return b.lb}a.a.f.set(this.l,
d,{lb:arguments[0]})};a.t.l.prototype.nodes=function(){if(0==arguments.length)return(a.a.f.get(this.l,d)||{}).Na;a.a.f.set(this.l,d,{Na:arguments[0]})};a.b("templateSources",a.t);a.b("templateSources.domElement",a.t.l);a.b("templateSources.anonymousTemplate",a.t.ha)})();(function(){function b(b,c,d){var e;for(c=a.e.nextSibling(c);b&&(e=b)!==c;)b=a.e.nextSibling(e),d(e,b)}function d(c,d){if(c.length){var e=c[0],f=c[c.length-1],h=e.parentNode,k=a.L.instance,r=k.preprocessNode;if(r){b(e,f,function(a,
b){var c=a.previousSibling,d=r.call(k,a);d&&(a===e&&(e=d[0]||b),a===f&&(f=d[d.length-1]||c))});c.length=0;if(!e)return;e===f?c.push(e):(c.push(e,f),a.a.na(c,h))}b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.ub(d,b)});b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.H.Xb(b,[d])});a.a.na(c,h)}}function c(a){return a.nodeType?a:0<a.length?a[0]:null}function e(b,e,f,h,q){q=q||{};var n=(b&&c(b)||f||{}).ownerDocument,r=q.templateEngine||k;a.kb.lc(f,r,n);f=r.renderTemplate(f,h,q,n);if("number"!=
typeof f.length||0<f.length&&"number"!=typeof f[0].nodeType)throw Error("Template engine must return an array of DOM nodes");n=!1;switch(e){case "replaceChildren":a.e.T(b,f);n=!0;break;case "replaceNode":a.a.Qb(b,f);n=!0;break;case "ignoreTargetNode":break;default:throw Error("Unknown renderMode: "+e);}n&&(d(f,h),q.afterRender&&a.k.u(q.afterRender,null,[f,h.$data]));return f}function f(b,c,d){return a.F(b)?b():"function"===typeof b?b(c,d):b}var k;a.hb=function(b){if(b!=p&&!(b instanceof a.J))throw Error("templateEngine must inherit from ko.templateEngine");
k=b};a.eb=function(b,d,h,x,q){h=h||{};if((h.templateEngine||k)==p)throw Error("Set a template engine before calling renderTemplate");q=q||"replaceChildren";if(x){var n=c(x);return a.j(function(){var k=d&&d instanceof a.N?d:new a.N(a.a.c(d)),p=f(b,k.$data,k),k=e(x,q,p,k,h);"replaceNode"==q&&(x=k,n=c(x))},null,{Pa:function(){return!n||!a.a.Qa(n)},q:n&&"replaceNode"==q?n.parentNode:n})}return a.H.$a(function(c){a.eb(b,d,h,c,"replaceNode")})};a.Cc=function(b,c,h,k,q){function n(a,b){d(b,v);h.afterRender&&
h.afterRender(b,a);v=null}function r(a,c){v=q.createChildContext(a,h.as,function(a){a.$index=c});var d=f(b,a,v);return e(null,"ignoreTargetNode",d,v,h)}var v;return a.j(function(){var b=a.a.c(c)||[];"undefined"==typeof b.length&&(b=[b]);b=a.a.xa(b,function(b){return h.includeDestroyed||b===p||null===b||!a.a.c(b._destroy)});a.k.u(a.a.fb,null,[k,b,r,h,n])},null,{q:k})};var h=a.a.f.I();a.d.template={init:function(b,c){var d=a.a.c(c());if("string"==typeof d||d.name)a.e.ma(b);else{if("nodes"in d){if(d=
d.nodes||[],a.F(d))throw Error('The "nodes" option must be a plain, non-observable array.');}else d=a.e.childNodes(b);d=a.a.Jb(d);(new a.t.ha(b)).nodes(d)}return{controlsDescendantBindings:!0}},update:function(b,c,d,e,f){var k=c(),r;c=a.a.c(k);d=!0;e=null;"string"==typeof c?c={}:(k=c.name,"if"in c&&(d=a.a.c(c["if"])),d&&"ifnot"in c&&(d=!a.a.c(c.ifnot)),r=a.a.c(c.data));"foreach"in c?e=a.Cc(k||b,d&&c.foreach||[],c,b,f):d?(f="data"in c?f.createChildContext(r,c.as):f,e=a.eb(k||b,f,c,b)):a.e.ma(b);f=
e;(r=a.a.f.get(b,h))&&"function"==typeof r.p&&r.p();a.a.f.set(b,h,f&&f.$()?f:p)}};a.h.ka.template=function(b){b=a.h.bb(b);return 1==b.length&&b[0].unknown||a.h.vc(b,"name")?null:"This template engine does not support anonymous templates nested within its templates"};a.e.R.template=!0})();a.b("setTemplateEngine",a.hb);a.b("renderTemplate",a.eb);a.a.Cb=function(a,d,c){if(a.length&&d.length){var e,f,k,h,l;for(e=f=0;(!c||e<c)&&(h=a[f]);++f){for(k=0;l=d[k];++k)if(h.value===l.value){h.moved=l.index;l.moved=
h.index;d.splice(k,1);e=k=0;break}e+=k}}};a.a.Ma=function(){function b(b,c,e,f,k){var h=Math.min,l=Math.max,g=[],m,p=b.length,q,n=c.length,r=n-p||1,v=p+n+1,t,u,w;for(m=0;m<=p;m++)for(u=t,g.push(t=[]),w=h(n,m+r),q=l(0,m-1);q<=w;q++)t[q]=q?m?b[m-1]===c[q-1]?u[q-1]:h(u[q]||v,t[q-1]||v)+1:q+1:m+1;h=[];l=[];r=[];m=p;for(q=n;m||q;)n=g[m][q]-1,q&&n===g[m][q-1]?l.push(h[h.length]={status:e,value:c[--q],index:q}):m&&n===g[m-1][q]?r.push(h[h.length]={status:f,value:b[--m],index:m}):(--q,--m,k.sparse||h.push({status:"retained",
value:c[q]}));a.a.Cb(l,r,10*p);return h.reverse()}return function(a,c,e){e="boolean"===typeof e?{dontLimitMoves:e}:e||{};a=a||[];c=c||[];return a.length<=c.length?b(a,c,"added","deleted",e):b(c,a,"deleted","added",e)}}();a.b("utils.compareArrays",a.a.Ma);(function(){function b(b,d,f,k,h){var l=[],g=a.j(function(){var g=d(f,h,a.a.na(l,b))||[];0<l.length&&(a.a.Qb(l,g),k&&a.k.u(k,null,[f,g,h]));l.length=0;a.a.ia(l,g)},null,{q:b,Pa:function(){return!a.a.tb(l)}});return{aa:l,j:g.$()?g:p}}var d=a.a.f.I();
a.a.fb=function(c,e,f,k,h){function l(b,d){s=u[d];t!==d&&(z[b]=s);s.Ua(t++);a.a.na(s.aa,c);r.push(s);y.push(s)}function g(b,c){if(b)for(var d=0,e=c.length;d<e;d++)c[d]&&a.a.o(c[d].aa,function(a){b(a,d,c[d].wa)})}e=e||[];k=k||{};var m=a.a.f.get(c,d)===p,u=a.a.f.get(c,d)||[],q=a.a.Ka(u,function(a){return a.wa}),n=a.a.Ma(q,e,k.dontLimitMoves),r=[],v=0,t=0,w=[],y=[];e=[];for(var z=[],q=[],s,C=0,D,E;D=n[C];C++)switch(E=D.moved,D.status){case "deleted":E===p&&(s=u[v],s.j&&s.j.p(),w.push.apply(w,a.a.na(s.aa,
c)),k.beforeRemove&&(e[C]=s,y.push(s)));v++;break;case "retained":l(C,v++);break;case "added":E!==p?l(C,E):(s={wa:D.value,Ua:a.r(t++)},r.push(s),y.push(s),m||(q[C]=s))}g(k.beforeMove,z);a.a.o(w,k.beforeRemove?a.S:a.removeNode);for(var C=0,m=a.e.firstChild(c),H;s=y[C];C++){s.aa||a.a.extend(s,b(c,f,s.wa,h,s.Ua));for(v=0;n=s.aa[v];m=n.nextSibling,H=n,v++)n!==m&&a.e.Fb(c,n,H);!s.rc&&h&&(h(s.wa,s.aa,s.Ua),s.rc=!0)}g(k.beforeRemove,e);g(k.afterMove,z);g(k.afterAdd,q);a.a.f.set(c,d,r)}})();a.b("utils.setDomNodeChildrenFromArrayMapping",
a.a.fb);a.P=function(){this.allowTemplateRewriting=!1};a.P.prototype=new a.J;a.P.prototype.renderTemplateSource=function(b,d,c,e){if(d=(9>a.a.M?0:b.nodes)?b.nodes():null)return a.a.O(d.cloneNode(!0).childNodes);b=b.text();return a.a.ca(b,e)};a.P.Va=new a.P;a.hb(a.P.Va);a.b("nativeTemplateEngine",a.P);(function(){a.Ya=function(){var a=this.uc=function(){if(!u||!u.tmpl)return 0;try{if(0<=u.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(a){}return 1}();this.renderTemplateSource=function(b,
e,f,k){k=k||w;f=f||{};if(2>a)throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");var h=b.data("precompiled");h||(h=b.text()||"",h=u.template(null,"{{ko_with $item.koBindingContext}}"+h+"{{/ko_with}}"),b.data("precompiled",h));b=[e.$data];e=u.extend({koBindingContext:e},f.templateOptions);e=u.tmpl(h,b,e);e.appendTo(k.createElement("div"));u.fragments={};return e};this.createJavaScriptEvaluatorBlock=function(a){return"{{ko_code ((function() { return "+
a+" })()) }}"};this.addTemplate=function(a,b){w.write("<script type='text/html' id='"+a+"'>"+b+"\x3c/script>")};0<a&&(u.tmpl.tag.ko_code={open:"__.push($1 || '');"},u.tmpl.tag.ko_with={open:"with($1) {",close:"} "})};a.Ya.prototype=new a.J;var b=new a.Ya;0<b.uc&&a.hb(b);a.b("jqueryTmplTemplateEngine",a.Ya)})()})})();})();

/*=============================================================================
	Author:			Eric M. Barnard - @ericmbarnard								
	License:		MIT (http://opensource.org/licenses/mit-license.php)		
																				
	Description:	Validation Library for KnockoutJS							
	Version:		2.0.3											
===============================================================================
*/
/*globals require: false, exports: false, define: false, ko: false */

(function (factory) {
	// Module systems magic dance.

	if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
		// CommonJS or Node: hard-coded dependency on "knockout"
		factory(require("knockout"), exports);
	} else if (typeof define === "function" && define["amd"]) {
		// AMD anonymous module with hard-coded dependency on "knockout"
		define('knockoutvalidation',["knockout", "exports"], factory);
	} else {
		// <script> tag: use the global `ko` object, attaching a `mapping` property
		factory(ko, ko.validation = {});
	}
}(function ( ko, exports ) {

	if (typeof (ko) === 'undefined') {
		throw new Error('Knockout is required, please ensure it is loaded before loading this validation plug-in');
	}

	// create our namespace object
	ko.validation = exports;

	var kv = ko.validation,
		koUtils = ko.utils,
		unwrap = koUtils.unwrapObservable,
		forEach = koUtils.arrayForEach,
		extend = koUtils.extend;
;/*global ko: false*/

var defaults = {
	registerExtenders: true,
	messagesOnModified: true,
	errorsAsTitle: true,            // enables/disables showing of errors as title attribute of the target element.
	errorsAsTitleOnModified: false, // shows the error when hovering the input field (decorateElement must be true)
	messageTemplate: null,
	insertMessages: true,           // automatically inserts validation messages as <span></span>
	parseInputAttributes: false,    // parses the HTML5 validation attribute from a form element and adds that to the object
	writeInputAttributes: false,    // adds HTML5 input validation attributes to form elements that ko observable's are bound to
	decorateInputElement: false,         // false to keep backward compatibility
	decorateElementOnModified: true,// true to keep backward compatibility
	errorClass: null,               // single class for error message and element
	errorElementClass: 'validationElement',  // class to decorate error element
	errorMessageClass: 'validationMessage',  // class to decorate error message
	allowHtmlMessages: false,		// allows HTML in validation messages
	grouping: {
		deep: false,        //by default grouping is shallow
		observable: true,   //and using observables
		live: false		    //react to changes to observableArrays if observable === true
	},
	validate: {
		// throttle: 10
	}
};

// make a copy  so we can use 'reset' later
var configuration = extend({}, defaults);

configuration.html5Attributes = ['required', 'pattern', 'min', 'max', 'step'];
configuration.html5InputTypes = ['email', 'number', 'date'];

configuration.reset = function () {
	extend(configuration, defaults);
};

kv.configuration = configuration;
;kv.utils = (function () {
	var seedId = new Date().getTime();

	var domData = {}; //hash of data objects that we reference from dom elements
	var domDataKey = '__ko_validation__';

	return {
		isArray: function (o) {
			return o.isArray || Object.prototype.toString.call(o) === '[object Array]';
		},
		isObject: function (o) {
			return o !== null && typeof o === 'object';
		},
		isNumber: function(o) {
			return !isNaN(o);	
		},
		isObservableArray: function(instance) {
			return !!instance &&
					typeof instance["remove"] === "function" &&
					typeof instance["removeAll"] === "function" &&
					typeof instance["destroy"] === "function" &&
					typeof instance["destroyAll"] === "function" &&
					typeof instance["indexOf"] === "function" &&
					typeof instance["replace"] === "function";
		},
		values: function (o) {
			var r = [];
			for (var i in o) {
				if (o.hasOwnProperty(i)) {
					r.push(o[i]);
				}
			}
			return r;
		},
		getValue: function (o) {
			return (typeof o === 'function' ? o() : o);
		},
		hasAttribute: function (node, attr) {
			return node.getAttribute(attr) !== null;
		},
		getAttribute: function (element, attr) {
			return element.getAttribute(attr);
		},
		setAttribute: function (element, attr, value) {
			return element.setAttribute(attr, value);
		},
		isValidatable: function (o) {
			return !!(o && o.rules && o.isValid && o.isModified);
		},
		insertAfter: function (node, newNode) {
			node.parentNode.insertBefore(newNode, node.nextSibling);
		},
		newId: function () {
			return seedId += 1;
		},
		getConfigOptions: function (element) {
			var options = kv.utils.contextFor(element);

			return options || kv.configuration;
		},
		setDomData: function (node, data) {
			var key = node[domDataKey];

			if (!key) {
				node[domDataKey] = key = kv.utils.newId();
			}

			domData[key] = data;
		},
		getDomData: function (node) {
			var key = node[domDataKey];

			if (!key) {
				return undefined;
			}

			return domData[key];
		},
		contextFor: function (node) {
			switch (node.nodeType) {
				case 1:
				case 8:
					var context = kv.utils.getDomData(node);
					if (context) { return context; }
					if (node.parentNode) { return kv.utils.contextFor(node.parentNode); }
					break;
			}
			return undefined;
		},
		isEmptyVal: function (val) {
			if (val === undefined) {
				return true;
			}
			if (val === null) {
				return true;
			}
			if (val === "") {
				return true;
			}
		},
		getOriginalElementTitle: function (element) {
			var savedOriginalTitle = kv.utils.getAttribute(element, 'data-orig-title'),
				currentTitle = element.title,
				hasSavedOriginalTitle = kv.utils.hasAttribute(element, 'data-orig-title');

			return hasSavedOriginalTitle ?
				savedOriginalTitle : currentTitle;
		},
		async: function (expr) {
			if (window.setImmediate) { window.setImmediate(expr); }
			else { window.setTimeout(expr, 0); }
		},
		forEach: function (object, callback) {
			if (kv.utils.isArray(object)) {
				return forEach(object, callback);
			}
			for (var prop in object) {
				if (object.hasOwnProperty(prop)) {
					callback(object[prop], prop);
				}
			}
		}
	};
}());;var api = (function () {

	var isInitialized = 0,
		configuration = kv.configuration,
		utils = kv.utils;

	function cleanUpSubscriptions(context) {
		forEach(context.subscriptions, function (subscription) {
			subscription.dispose();
		});
		context.subscriptions = [];
	}

	function dispose(context) {
		if (context.options.deep) {
			forEach(context.flagged, function (obj) {
				delete obj.__kv_traversed;
			});
			context.flagged.length = 0;
		}

		if (!context.options.live) {
			cleanUpSubscriptions(context);
		}
	}

	function runTraversal(obj, context) {
		context.validatables = [];
		cleanUpSubscriptions(context);
		traverseGraph(obj, context);
		dispose(context);
	}

	function traverseGraph(obj, context, level) {
		var objValues = [],
			val = obj.peek ? obj.peek() : obj;

		if (obj.__kv_traversed === true) {
			return;
		}

		if (context.options.deep) {
			obj.__kv_traversed = true;
			context.flagged.push(obj);
		}

		//default level value depends on deep option.
		level = (level !== undefined ? level : context.options.deep ? 1 : -1);

		// if object is observable then add it to the list
		if (ko.isObservable(obj)) {
			// ensure it's validatable but don't extend validatedObservable because it
			// would overwrite isValid property.
			if (!obj.errors && !utils.isValidatable(obj)) {
				obj.extend({ validatable: true });
			}
			context.validatables.push(obj);

			if (context.options.live && utils.isObservableArray(obj)) {
				context.subscriptions.push(obj.subscribe(function () {
					context.graphMonitor.valueHasMutated();
				}));
			}
		}

		//get list of values either from array or object but ignore non-objects
		// and destroyed objects
		if (val && !val._destroy) {
			if (utils.isArray(val)) {
				objValues = val;
			}
			else if (utils.isObject(val)) {
				objValues = utils.values(val);
			}
		}

		//process recursively if it is deep grouping
		if (level !== 0) {
			utils.forEach(objValues, function (observable) {
				//but not falsy things and not HTML Elements
				if (observable && !observable.nodeType && (!ko.isComputed(observable) || observable.rules)) {
					traverseGraph(observable, context, level + 1);
				}
			});
		}
	}

	function collectErrors(array) {
		var errors = [];
		forEach(array, function (observable) {
			// Do not collect validatedObservable errors
			if (utils.isValidatable(observable) && !observable.isValid()) {
				// Use peek because we don't want a dependency for 'error' property because it
				// changes before 'isValid' does. (Issue #99)
				errors.push(observable.error.peek());
			}
		});
		return errors;
	}

	return {
		//Call this on startup
		//any config can be overridden with the passed in options
		init: function (options, force) {
			//done run this multiple times if we don't really want to
			if (isInitialized > 0 && !force) {
				return;
			}

			//because we will be accessing options properties it has to be an object at least
			options = options || {};
			//if specific error classes are not provided then apply generic errorClass
			//it has to be done on option so that options.errorClass can override default
			//errorElementClass and errorMessage class but not those provided in options
			options.errorElementClass = options.errorElementClass || options.errorClass || configuration.errorElementClass;
			options.errorMessageClass = options.errorMessageClass || options.errorClass || configuration.errorMessageClass;

			extend(configuration, options);

			if (configuration.registerExtenders) {
				kv.registerExtenders();
			}

			isInitialized = 1;
		},

		// resets the config back to its original state
		reset: kv.configuration.reset,

		// recursively walks a viewModel and creates an object that
		// provides validation information for the entire viewModel
		// obj -> the viewModel to walk
		// options -> {
		//	  deep: false, // if true, will walk past the first level of viewModel properties
		//	  observable: false // if true, returns a computed observable indicating if the viewModel is valid
		// }
		group: function group(obj, options) { // array of observables or viewModel
			options = extend(extend({}, configuration.grouping), options);

			var context = {
				options: options,
				graphMonitor: ko.observable(),
				flagged: [],
				subscriptions: [],
				validatables: []
			};

			var result = null;

			//if using observables then traverse structure once and add observables
			if (options.observable) {
				result = ko.computed(function () {
					context.graphMonitor(); //register dependency
					runTraversal(obj, context);
					return collectErrors(context.validatables);
				});
			}
			else { //if not using observables then every call to error() should traverse the structure
				result = function () {
					runTraversal(obj, context);
					return collectErrors(context.validatables);
				};
			}

			result.showAllMessages = function (show) { // thanks @heliosPortal
				if (show === undefined) {//default to true
					show = true;
				}

				result.forEach(function (observable) {
					if (utils.isValidatable(observable)) {
						observable.isModified(show);
					}
				});
			};

			result.isAnyMessageShown = function () {
				var invalidAndModifiedPresent;

				invalidAndModifiedPresent = !!result.find(function (observable) {
					return utils.isValidatable(observable) && !observable.isValid() && observable.isModified();
				});
				return invalidAndModifiedPresent;
			};

			result.filter = function(predicate) {
				predicate = predicate || function () { return true; };
				// ensure we have latest changes
				result();

				return koUtils.arrayFilter(context.validatables, predicate);
			};

			result.find = function(predicate) {
				predicate = predicate || function () { return true; };
				// ensure we have latest changes
				result();

				return koUtils.arrayFirst(context.validatables, predicate);
			};

			result.forEach = function(callback) {
				callback = callback || function () { };
				// ensure we have latest changes
				result();

				forEach(context.validatables, callback);
			};

			result.map = function(mapping) {
				mapping = mapping || function (item) { return item; };
				// ensure we have latest changes
				result();

				return koUtils.arrayMap(context.validatables, mapping);
			};

			/**
			 * @private You should not rely on this method being here.
			 * It's a private method and it may change in the future.
			 *
			 * @description Updates the validated object and collects errors from it.
			 */
			result._updateState = function(newValue) {
				if (!utils.isObject(newValue)) {
					throw new Error('An object is required.');
				}
				obj = newValue;
				if (options.observable) {
					context.graphMonitor.valueHasMutated();
				}
				else {
					runTraversal(newValue, context);
					return collectErrors(context.validatables);
				}
			};
			return result;
		},

		formatMessage: function (message, params, observable) {
			if (utils.isObject(params) && params.typeAttr) {
				params = params.value;
			}
			if (typeof message === 'function') {
				return message(params, observable);
			}
			var replacements = unwrap(params);
            if (replacements == null) {
                replacements = [];
            }
			if (!utils.isArray(replacements)) {
				replacements = [replacements];
			}
			return message.replace(/{(\d+)}/gi, function(match, index) {
				if (typeof replacements[index] !== 'undefined') {
					return replacements[index];
				}
				return match;
			});
		},

		// addRule:
		// This takes in a ko.observable and a Rule Context - which is just a rule name and params to supply to the validator
		// ie: kv.addRule(myObservable, {
		//		  rule: 'required',
		//		  params: true
		//	  });
		//
		addRule: function (observable, rule) {
			observable.extend({ validatable: true });

			var hasRule = !!koUtils.arrayFirst(observable.rules(), function(item) {
				return item.rule && item.rule === rule.rule;
			});

			if (!hasRule) {
				//push a Rule Context to the observables local array of Rule Contexts
				observable.rules.push(rule);
			}
			return observable;
		},

		// addAnonymousRule:
		// Anonymous Rules essentially have all the properties of a Rule, but are only specific for a certain property
		// and developers typically are wanting to add them on the fly or not register a rule with the 'kv.rules' object
		//
		// Example:
		// var test = ko.observable('something').extend{(
		//	  validation: {
		//		  validator: function(val, someOtherVal){
		//			  return true;
		//		  },
		//		  message: "Something must be really wrong!',
		//		  params: true
		//	  }
		//  )};
		addAnonymousRule: function (observable, ruleObj) {
			if (ruleObj['message'] === undefined) {
				ruleObj['message'] = 'Error';
			}

			//make sure onlyIf is honoured
			if (ruleObj.onlyIf) {
				ruleObj.condition = ruleObj.onlyIf;
			}

			//add the anonymous rule to the observable
			kv.addRule(observable, ruleObj);
		},

		addExtender: function (ruleName) {
			ko.extenders[ruleName] = function (observable, params) {
				//params can come in a few flavors
				// 1. Just the params to be passed to the validator
				// 2. An object containing the Message to be used and the Params to pass to the validator
				// 3. A condition when the validation rule to be applied
				//
				// Example:
				// var test = ko.observable(3).extend({
				//	  max: {
				//		  message: 'This special field has a Max of {0}',
				//		  params: 2,
				//		  onlyIf: function() {
				//					  return specialField.IsVisible();
				//				  }
				//	  }
				//  )};
				//
				if (params && (params.message || params.onlyIf)) { //if it has a message or condition object, then its an object literal to use
					return kv.addRule(observable, {
						rule: ruleName,
						message: params.message,
						params: utils.isEmptyVal(params.params) ? true : params.params,
						condition: params.onlyIf
					});
				} else {
					return kv.addRule(observable, {
						rule: ruleName,
						params: params
					});
				}
			};
		},

		// loops through all kv.rules and adds them as extenders to
		// ko.extenders
		registerExtenders: function () { // root extenders optional, use 'validation' extender if would cause conflicts
			if (configuration.registerExtenders) {
				for (var ruleName in kv.rules) {
					if (kv.rules.hasOwnProperty(ruleName)) {
						if (!ko.extenders[ruleName]) {
							kv.addExtender(ruleName);
						}
					}
				}
			}
		},

		//creates a span next to the @element with the specified error class
		insertValidationMessage: function (element) {
			var span = document.createElement('SPAN');
			span.className = utils.getConfigOptions(element).errorMessageClass;
			utils.insertAfter(element, span);
			return span;
		},

		// if html-5 validation attributes have been specified, this parses
		// the attributes on @element
		parseInputValidationAttributes: function (element, valueAccessor) {
			forEach(kv.configuration.html5Attributes, function (attr) {
				if (utils.hasAttribute(element, attr)) {

					var params = element.getAttribute(attr) || true;

					if (attr === 'min' || attr === 'max')
					{
						// If we're validating based on the min and max attributes, we'll
						// need to know what the 'type' attribute is set to
						var typeAttr = element.getAttribute('type');
						if (typeof typeAttr === "undefined" || !typeAttr)
						{
							// From http://www.w3.org/TR/html-markup/input:
							//   An input element with no type attribute specified represents the
							//   same thing as an input element with its type attribute set to "text".
							typeAttr = "text";
						}
						params = {typeAttr: typeAttr, value: params};
					}

					kv.addRule(valueAccessor(), {
						rule: attr,
						params: params
					});
				}
			});

			var currentType = element.getAttribute('type');
			forEach(kv.configuration.html5InputTypes, function (type) {
				if (type === currentType) {
					kv.addRule(valueAccessor(), {
						rule: (type === 'date') ? 'dateISO' : type,
						params: true
					});
				}
			});
		},

		// writes html5 validation attributes on the element passed in
		writeInputValidationAttributes: function (element, valueAccessor) {
			var observable = valueAccessor();

			if (!observable || !observable.rules) {
				return;
			}

			var contexts = observable.rules(); // observable array

			// loop through the attributes and add the information needed
			forEach(kv.configuration.html5Attributes, function (attr) {
				var ctx = koUtils.arrayFirst(contexts, function (ctx) {
					return ctx.rule && ctx.rule.toLowerCase() === attr.toLowerCase();
				});

				if (!ctx) {
					return;
				}

				// we have a rule matching a validation attribute at this point
				// so lets add it to the element along with the params
				ko.computed({
					read: function() {
						var params = ko.unwrap(ctx.params);

						// we have to do some special things for the pattern validation
						if (ctx.rule === "pattern" && params instanceof RegExp) {
							// we need the pure string representation of the RegExpr without the //gi stuff
							params = params.source;
						}

						element.setAttribute(attr, params);
					},
					disposeWhenNodeIsRemoved: element
				});
			});

			contexts = null;
		},

		//take an existing binding handler and make it cause automatic validations
		makeBindingHandlerValidatable: function (handlerName) {
			var init = ko.bindingHandlers[handlerName].init;

			ko.bindingHandlers[handlerName].init = function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {

				init(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext);

				return ko.bindingHandlers['validationCore'].init(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext);
			};
		},

		// visit an objects properties and apply validation rules from a definition
		setRules: function (target, definition) {
			var setRules = function (target, definition) {
				if (!target || !definition) { return; }

				for (var prop in definition) {
					if (!definition.hasOwnProperty(prop)) { continue; }
					var ruleDefinitions = definition[prop];

					//check the target property exists and has a value
					if (!target[prop]) { continue; }
					var targetValue = target[prop],
						unwrappedTargetValue = unwrap(targetValue),
						rules = {},
						nonRules = {};

					for (var rule in ruleDefinitions) {
						if (!ruleDefinitions.hasOwnProperty(rule)) { continue; }
						if (kv.rules[rule]) {
							rules[rule] = ruleDefinitions[rule];
						} else {
							nonRules[rule] = ruleDefinitions[rule];
						}
					}

					//apply rules
					if (ko.isObservable(targetValue)) {
						targetValue.extend(rules);
					}

					//then apply child rules
					//if it's an array, apply rules to all children
					if (unwrappedTargetValue && utils.isArray(unwrappedTargetValue)) {
						for (var i = 0; i < unwrappedTargetValue.length; i++) {
							setRules(unwrappedTargetValue[i], nonRules);
						}
						//otherwise, just apply to this property
					} else {
						setRules(unwrappedTargetValue, nonRules);
					}
				}
			};
			setRules(target, definition);
		}
	};

}());

// expose api publicly
extend(ko.validation, api);
;//Validation Rules:
// You can view and override messages or rules via:
// kv.rules[ruleName]
//
// To implement a custom Rule, simply use this template:
// kv.rules['<custom rule name>'] = {
//      validator: function (val, param) {
//          <custom logic>
//          return <true or false>;
//      },
//      message: '<custom validation message>' //optionally you can also use a '{0}' to denote a placeholder that will be replaced with your 'param'
// };
//
// Example:
// kv.rules['mustEqual'] = {
//      validator: function( val, mustEqualVal ){
//          return val === mustEqualVal;
//      },
//      message: 'This field must equal {0}'
// };
//
kv.rules = {};
kv.rules['required'] = {
	validator: function (val, required) {
		var testVal;

		if (val === undefined || val === null) {
			return !required;
		}

		testVal = val;
		if (typeof (val) === 'string') {
			if (String.prototype.trim) {
				testVal = val.trim();
			}
			else {
				testVal = val.replace(/^\s+|\s+$/g, '');
			}
		}

		if (!required) {// if they passed: { required: false }, then don't require this
			return true;
		}

		return ((testVal + '').length > 0);
	},
	message: 'This field is required.'
};

function minMaxValidatorFactory(validatorName) {
    var isMaxValidation = validatorName === "max";

    return function (val, options) {
        if (kv.utils.isEmptyVal(val)) {
            return true;
        }

        var comparisonValue, type;
        if (options.typeAttr === undefined) {
            // This validator is being called from javascript rather than
            // being bound from markup
            type = "text";
            comparisonValue = options;
        } else {
            type = options.typeAttr;
            comparisonValue = options.value;
        }

        // From http://www.w3.org/TR/2012/WD-html5-20121025/common-input-element-attributes.html#attr-input-min,
        // if the value is parseable to a number, then the minimum should be numeric
        if (!isNaN(comparisonValue) && !(comparisonValue instanceof Date)) {
            type = "number";
        }

        var regex, valMatches, comparisonValueMatches;
        switch (type.toLowerCase()) {
            case "week":
                regex = /^(\d{4})-W(\d{2})$/;
                valMatches = val.match(regex);
                if (valMatches === null) {
                    throw new Error("Invalid value for " + validatorName + " attribute for week input.  Should look like " +
                        "'2000-W33' http://www.w3.org/TR/html-markup/input.week.html#input.week.attrs.min");
                }
                comparisonValueMatches = comparisonValue.match(regex);
                // If no regex matches were found, validation fails
                if (!comparisonValueMatches) {
                    return false;
                }

                if (isMaxValidation) {
                    return (valMatches[1] < comparisonValueMatches[1]) || // older year
                        // same year, older week
                        ((valMatches[1] === comparisonValueMatches[1]) && (valMatches[2] <= comparisonValueMatches[2]));
                } else {
                    return (valMatches[1] > comparisonValueMatches[1]) || // newer year
                        // same year, newer week
                        ((valMatches[1] === comparisonValueMatches[1]) && (valMatches[2] >= comparisonValueMatches[2]));
                }
                break;

            case "month":
                regex = /^(\d{4})-(\d{2})$/;
                valMatches = val.match(regex);
                if (valMatches === null) {
                    throw new Error("Invalid value for " + validatorName + " attribute for month input.  Should look like " +
                        "'2000-03' http://www.w3.org/TR/html-markup/input.month.html#input.month.attrs.min");
                }
                comparisonValueMatches = comparisonValue.match(regex);
                // If no regex matches were found, validation fails
                if (!comparisonValueMatches) {
                    return false;
                }

                if (isMaxValidation) {
                    return ((valMatches[1] < comparisonValueMatches[1]) || // older year
                        // same year, older month
                        ((valMatches[1] === comparisonValueMatches[1]) && (valMatches[2] <= comparisonValueMatches[2])));
                } else {
                    return (valMatches[1] > comparisonValueMatches[1]) || // newer year
                        // same year, newer month
                        ((valMatches[1] === comparisonValueMatches[1]) && (valMatches[2] >= comparisonValueMatches[2]));
                }
                break;

            case "number":
            case "range":
                if (isMaxValidation) {
                    return (!isNaN(val) && parseFloat(val) <= parseFloat(comparisonValue));
                } else {
                    return (!isNaN(val) && parseFloat(val) >= parseFloat(comparisonValue));
                }
                break;

            default:
                if (isMaxValidation) {
                    return val <= comparisonValue;
                } else {
                    return val >= comparisonValue;
                }
        }
    };
}

kv.rules['min'] = {
	validator: minMaxValidatorFactory("min"),
	message: 'Please enter a value greater than or equal to {0}.'
};

kv.rules['max'] = {
	validator: minMaxValidatorFactory("max"),
	message: 'Please enter a value less than or equal to {0}.'
};

kv.rules['minLength'] = {
	validator: function (val, minLength) {
		if(kv.utils.isEmptyVal(val)) { return true; }
		var normalizedVal = kv.utils.isNumber(val) ? ('' + val) : val;
		return normalizedVal.length >= minLength;
	},
	message: 'Please enter at least {0} characters.'
};

kv.rules['maxLength'] = {
	validator: function (val, maxLength) {
		if(kv.utils.isEmptyVal(val)) { return true; }
		var normalizedVal = kv.utils.isNumber(val) ? ('' + val) : val;
		return normalizedVal.length <= maxLength;
	},
	message: 'Please enter no more than {0} characters.'
};

kv.rules['pattern'] = {
	validator: function (val, regex) {
		return kv.utils.isEmptyVal(val) || val.toString().match(regex) !== null;
	},
	message: 'Please check this value.'
};

kv.rules['step'] = {
	validator: function (val, step) {

		// in order to handle steps of .1 & .01 etc.. Modulus won't work
		// if the value is a decimal, so we have to correct for that
		if (kv.utils.isEmptyVal(val) || step === 'any') { return true; }
		var dif = (val * 100) % (step * 100);
		return Math.abs(dif) < 0.00001 || Math.abs(1 - dif) < 0.00001;
	},
	message: 'The value must increment by {0}.'
};

kv.rules['email'] = {
	validator: function (val, validate) {
		if (!validate) { return true; }

		//I think an empty email address is also a valid entry
		//if one want's to enforce entry it should be done with 'required: true'
		return kv.utils.isEmptyVal(val) || (
			// jquery validate regex - thanks Scott Gonzalez
			validate && /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i.test(val)
		);
	},
	message: 'Please enter a proper email address.'
};

kv.rules['date'] = {
	validator: function (value, validate) {
		if (!validate) { return true; }
		return kv.utils.isEmptyVal(value) || (validate && !/Invalid|NaN/.test(new Date(value)));
	},
	message: 'Please enter a proper date.'
};

kv.rules['dateISO'] = {
	validator: function (value, validate) {
		if (!validate) { return true; }
		return kv.utils.isEmptyVal(value) || (validate && /^\d{4}[-/](?:0?[1-9]|1[012])[-/](?:0?[1-9]|[12][0-9]|3[01])$/.test(value));
	},
	message: 'Please enter a proper date.'
};

kv.rules['number'] = {
	validator: function (value, validate) {
		if (!validate) { return true; }
		return kv.utils.isEmptyVal(value) || (validate && /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value));
	},
	message: 'Please enter a number.'
};

kv.rules['digit'] = {
	validator: function (value, validate) {
		if (!validate) { return true; }
		return kv.utils.isEmptyVal(value) || (validate && /^\d+$/.test(value));
	},
	message: 'Please enter a digit.'
};

kv.rules['phoneUS'] = {
	validator: function (phoneNumber, validate) {
		if (!validate) { return true; }
		if (kv.utils.isEmptyVal(phoneNumber)) { return true; } // makes it optional, use 'required' rule if it should be required
		if (typeof (phoneNumber) !== 'string') { return false; }
		phoneNumber = phoneNumber.replace(/\s+/g, "");
		return validate && phoneNumber.length > 9 && phoneNumber.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
	},
	message: 'Please specify a valid phone number.'
};

kv.rules['equal'] = {
	validator: function (val, params) {
		var otherValue = params;
		return val === kv.utils.getValue(otherValue);
	},
	message: 'Values must equal.'
};

kv.rules['notEqual'] = {
	validator: function (val, params) {
		var otherValue = params;
		return val !== kv.utils.getValue(otherValue);
	},
	message: 'Please choose another value.'
};

//unique in collection
// options are:
//    collection: array or function returning (observable) array
//              in which the value has to be unique
//    valueAccessor: function that returns value from an object stored in collection
//              if it is null the value is compared directly
//    external: set to true when object you are validating is automatically updating collection
kv.rules['unique'] = {
	validator: function (val, options) {
		var c = kv.utils.getValue(options.collection),
			external = kv.utils.getValue(options.externalValue),
			counter = 0;

		if (!val || !c) { return true; }

		koUtils.arrayFilter(c, function (item) {
			if (val === (options.valueAccessor ? options.valueAccessor(item) : item)) { counter++; }
		});
		// if value is external even 1 same value in collection means the value is not unique
		return counter < (!!external ? 1 : 2);
	},
	message: 'Please make sure the value is unique.'
};


//now register all of these!
(function () {
	kv.registerExtenders();
}());
;// The core binding handler
// this allows us to setup any value binding that internally always
// performs the same functionality
ko.bindingHandlers['validationCore'] = (function () {

	return {
		init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
			var config = kv.utils.getConfigOptions(element);
			var observable = valueAccessor();

			// parse html5 input validation attributes, optional feature
			if (config.parseInputAttributes) {
				kv.utils.async(function () { kv.parseInputValidationAttributes(element, valueAccessor); });
			}

			// if requested insert message element and apply bindings
			if (config.insertMessages && kv.utils.isValidatable(observable)) {

				// insert the <span></span>
				var validationMessageElement = kv.insertValidationMessage(element);

				// if we're told to use a template, make sure that gets rendered
				if (config.messageTemplate) {
					ko.renderTemplate(config.messageTemplate, { field: observable }, null, validationMessageElement, 'replaceNode');
				} else {
					ko.applyBindingsToNode(validationMessageElement, { validationMessage: observable });
				}
			}

			// write the html5 attributes if indicated by the config
			if (config.writeInputAttributes && kv.utils.isValidatable(observable)) {

				kv.writeInputValidationAttributes(element, valueAccessor);
			}

			// if requested, add binding to decorate element
			if (config.decorateInputElement && kv.utils.isValidatable(observable)) {
				ko.applyBindingsToNode(element, { validationElement: observable });
			}
		}
	};

}());

// override for KO's default 'value', 'checked', 'textInput' and selectedOptions bindings
kv.makeBindingHandlerValidatable("value");
kv.makeBindingHandlerValidatable("checked");
if (ko.bindingHandlers.textInput) {
	kv.makeBindingHandlerValidatable("textInput");
}
kv.makeBindingHandlerValidatable("selectedOptions");


ko.bindingHandlers['validationMessage'] = { // individual error message, if modified or post binding
	update: function (element, valueAccessor) {
		var obsv = valueAccessor(),
			config = kv.utils.getConfigOptions(element),
			val = unwrap(obsv),
			msg = null,
			isModified = false,
			isValid = false;

		if (obsv === null || typeof obsv === 'undefined') {
			throw new Error('Cannot bind validationMessage to undefined value. data-bind expression: ' +
				element.getAttribute('data-bind'));
		}

		isModified = obsv.isModified && obsv.isModified();
		isValid = obsv.isValid && obsv.isValid();

		var error = null;
		if (!config.messagesOnModified || isModified) {
			error = isValid ? null : obsv.error;
		}

		var isVisible = !config.messagesOnModified || isModified ? !isValid : false;
		var isCurrentlyVisible = element.style.display !== "none";

		if (config.allowHtmlMessages) {
			koUtils.setHtml(element, error);
		} else {
			ko.bindingHandlers.text.update(element, function () { return error; });
		}

		if (isCurrentlyVisible && !isVisible) {
			element.style.display = 'none';
		} else if (!isCurrentlyVisible && isVisible) {
			element.style.display = '';
		}
	}
};

ko.bindingHandlers['validationElement'] = {
	update: function (element, valueAccessor, allBindingsAccessor) {
		var obsv = valueAccessor(),
			config = kv.utils.getConfigOptions(element),
			val = unwrap(obsv),
			msg = null,
			isModified = false,
			isValid = false;

		if (obsv === null || typeof obsv === 'undefined') {
			throw new Error('Cannot bind validationElement to undefined value. data-bind expression: ' +
				element.getAttribute('data-bind'));
		}

		isModified = obsv.isModified && obsv.isModified();
		isValid = obsv.isValid && obsv.isValid();

		// create an evaluator function that will return something like:
		// css: { validationElement: true }
		var cssSettingsAccessor = function () {
			var css = {};

			var shouldShow = ((!config.decorateElementOnModified || isModified) ? !isValid : false);

			// css: { validationElement: false }
			css[config.errorElementClass] = shouldShow;

			return css;
		};

		//add or remove class on the element;
		ko.bindingHandlers.css.update(element, cssSettingsAccessor, allBindingsAccessor);
		if (!config.errorsAsTitle) { return; }

		ko.bindingHandlers.attr.update(element, function () {
			var
				hasModification = !config.errorsAsTitleOnModified || isModified,
				title = kv.utils.getOriginalElementTitle(element);

			if (hasModification && !isValid) {
				return { title: obsv.error, 'data-orig-title': title };
			} else if (!hasModification || isValid) {
				return { title: title, 'data-orig-title': null };
			}
		});
	}
};

// ValidationOptions:
// This binding handler allows you to override the initial config by setting any of the options for a specific element or context of elements
//
// Example:
// <div data-bind="validationOptions: { insertMessages: true, messageTemplate: 'customTemplate', errorMessageClass: 'mySpecialClass'}">
//      <input type="text" data-bind="value: someValue"/>
//      <input type="text" data-bind="value: someValue2"/>
// </div>
ko.bindingHandlers['validationOptions'] = (function () {
	return {
		init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
			var options = unwrap(valueAccessor());
			if (options) {
				var newConfig = extend({}, kv.configuration);
				extend(newConfig, options);

				//store the validation options on the node so we can retrieve it later
				kv.utils.setDomData(element, newConfig);
			}
		}
	};
}());
;// Validation Extender:
// This is for creating custom validation logic on the fly
// Example:
// var test = ko.observable('something').extend{(
//      validation: {
//          validator: function(val, someOtherVal){
//              return true;
//          },
//          message: "Something must be really wrong!',
//          params: true
//      }
//  )};
ko.extenders['validation'] = function (observable, rules) { // allow single rule or array
	forEach(kv.utils.isArray(rules) ? rules : [rules], function (rule) {
		// the 'rule' being passed in here has no name to identify a core Rule,
		// so we add it as an anonymous rule
		// If the developer is wanting to use a core Rule, but use a different message see the 'addExtender' logic for examples
		kv.addAnonymousRule(observable, rule);
	});
	return observable;
};

//This is the extender that makes a Knockout Observable also 'Validatable'
//examples include:
// 1. var test = ko.observable('something').extend({validatable: true});
// this will ensure that the Observable object is setup properly to respond to rules
//
// 2. test.extend({validatable: false});
// this will remove the validation properties from the Observable object should you need to do that.
ko.extenders['validatable'] = function (observable, options) {
	if (!kv.utils.isObject(options)) {
		options = { enable: options };
	}

	if (!('enable' in options)) {
		options.enable = true;
	}

	if (options.enable && !kv.utils.isValidatable(observable)) {
		var config = kv.configuration.validate || {};
		var validationOptions = {
			throttleEvaluation : options.throttle || config.throttle
		};

		observable.error = ko.observable(null); // holds the error message, we only need one since we stop processing validators when one is invalid

		// observable.rules:
		// ObservableArray of Rule Contexts, where a Rule Context is simply the name of a rule and the params to supply to it
		//
		// Rule Context = { rule: '<rule name>', params: '<passed in params>', message: '<Override of default Message>' }
		observable.rules = ko.observableArray(); //holds the rule Contexts to use as part of validation

		//in case async validation is occurring
		observable.isValidating = ko.observable(false);

		//the true holder of whether the observable is valid or not
		observable.__valid__ = ko.observable(true);

		observable.isModified = ko.observable(false);

		// a semi-protected observable
		observable.isValid = ko.computed(observable.__valid__);

		//manually set error state
		observable.setError = function (error) {
			var previousError = observable.error.peek();
			var previousIsValid = observable.__valid__.peek();

			observable.error(error);
			observable.__valid__(false);

			if (previousError !== error && !previousIsValid) {
				// if the observable was not valid before then isValid will not mutate,
				// hence causing any grouping to not display the latest error.
				observable.isValid.notifySubscribers();
			}
		};

		//manually clear error state
		observable.clearError = function () {
			observable.error(null);
			observable.__valid__(true);
			return observable;
		};

		//subscribe to changes in the observable
		var h_change = observable.subscribe(function () {
			observable.isModified(true);
		});

		// we use a computed here to ensure that anytime a dependency changes, the
		// validation logic evaluates
		var h_obsValidationTrigger = ko.computed(extend({
			read: function () {
				var obs = observable(),
					ruleContexts = observable.rules();

				kv.validateObservable(observable);

				return true;
			}
		}, validationOptions));

		extend(h_obsValidationTrigger, validationOptions);

		observable._disposeValidation = function () {
			//first dispose of the subscriptions
			observable.isValid.dispose();
			observable.rules.removeAll();
			h_change.dispose();
			h_obsValidationTrigger.dispose();

			delete observable['rules'];
			delete observable['error'];
			delete observable['isValid'];
			delete observable['isValidating'];
			delete observable['__valid__'];
			delete observable['isModified'];
            delete observable['setError'];
            delete observable['clearError'];
            delete observable['_disposeValidation'];
		};
	} else if (options.enable === false && observable._disposeValidation) {
		observable._disposeValidation();
	}
	return observable;
};

function validateSync(observable, rule, ctx) {
	//Execute the validator and see if its valid
	if (!rule.validator(observable(), (ctx.params === undefined ? true : unwrap(ctx.params)))) { // default param is true, eg. required = true

		//not valid, so format the error message and stick it in the 'error' variable
		observable.setError(kv.formatMessage(
					ctx.message || rule.message,
					unwrap(ctx.params),
					observable));
		return false;
	} else {
		return true;
	}
}

function validateAsync(observable, rule, ctx) {
	observable.isValidating(true);

	var callBack = function (valObj) {
		var isValid = false,
			msg = '';

		if (!observable.__valid__()) {

			// since we're returning early, make sure we turn this off
			observable.isValidating(false);

			return; //if its already NOT valid, don't add to that
		}

		//we were handed back a complex object
		if (valObj['message']) {
			isValid = valObj.isValid;
			msg = valObj.message;
		} else {
			isValid = valObj;
		}

		if (!isValid) {
			//not valid, so format the error message and stick it in the 'error' variable
			observable.error(kv.formatMessage(
				msg || ctx.message || rule.message,
				unwrap(ctx.params),
				observable));
			observable.__valid__(isValid);
		}

		// tell it that we're done
		observable.isValidating(false);
	};

	kv.utils.async(function() {
	    //fire the validator and hand it the callback
        rule.validator(observable(), ctx.params === undefined ? true : unwrap(ctx.params), callBack);
	});
}

kv.validateObservable = function (observable) {
	var i = 0,
		rule, // the rule validator to execute
		ctx, // the current Rule Context for the loop
		ruleContexts = observable.rules(), //cache for iterator
		len = ruleContexts.length; //cache for iterator

	for (; i < len; i++) {

		//get the Rule Context info to give to the core Rule
		ctx = ruleContexts[i];

		// checks an 'onlyIf' condition
		if (ctx.condition && !ctx.condition()) {
			continue;
		}

		//get the core Rule to use for validation
		rule = ctx.rule ? kv.rules[ctx.rule] : ctx;

		if (rule['async'] || ctx['async']) {
			//run async validation
			validateAsync(observable, rule, ctx);

		} else {
			//run normal sync validation
			if (!validateSync(observable, rule, ctx)) {
				return false; //break out of the loop
			}
		}
	}
	//finally if we got this far, make the observable valid again!
	observable.clearError();
	return true;
};
;
var _locales = {};
var _currentLocale;

kv.defineLocale = function(name, values) {
	if (name && values) {
		_locales[name.toLowerCase()] = values;
		return values;
	}
	return null;
};

kv.locale = function(name) {
	if (name) {
		name = name.toLowerCase();

		if (_locales.hasOwnProperty(name)) {
			kv.localize(_locales[name]);
			_currentLocale = name;
		}
		else {
			throw new Error('Localization ' + name + ' has not been loaded.');
		}
	}
	return _currentLocale;
};

//quick function to override rule messages
kv.localize = function (msgTranslations) {
	var rules = kv.rules;

	//loop the properties in the object and assign the msg to the rule
	for (var ruleName in msgTranslations) {
		if (rules.hasOwnProperty(ruleName)) {
			rules[ruleName].message = msgTranslations[ruleName];
		}
	}
};

// Populate default locale (this will make en-US.js somewhat redundant)
(function() {
	var localeData = {};
	var rules = kv.rules;

	for (var ruleName in rules) {
		if (rules.hasOwnProperty(ruleName)) {
			localeData[ruleName] = rules[ruleName].message;
		}
	}
	kv.defineLocale('en-us', localeData);
})();

// No need to invoke locale because the messages are already defined along with the rules for en-US
_currentLocale = 'en-us';
;/**
 * Possible invocations:
 * 		applyBindingsWithValidation(viewModel)
 * 		applyBindingsWithValidation(viewModel, options)
 * 		applyBindingsWithValidation(viewModel, rootNode)
 *		applyBindingsWithValidation(viewModel, rootNode, options)
 */
ko.applyBindingsWithValidation = function (viewModel, rootNode, options) {
	var node = document.body,
		config;

	if (rootNode && rootNode.nodeType) {
		node = rootNode;
		config = options;
	}
	else {
		config = rootNode;
	}

	kv.init();

	if (config) {
		config = extend(extend({}, kv.configuration), config);
		kv.utils.setDomData(node, config);
	}

	ko.applyBindings(viewModel, node);
};

//override the original applyBindings so that we can ensure all new rules and what not are correctly registered
var origApplyBindings = ko.applyBindings;
ko.applyBindings = function (viewModel, rootNode) {

	kv.init();

	origApplyBindings(viewModel, rootNode);
};

ko.validatedObservable = function (initialValue, options) {
	if (!options && !kv.utils.isObject(initialValue)) {
		return ko.observable(initialValue).extend({ validatable: true });
	}

	var obsv = ko.observable(initialValue);
	obsv.errors = kv.group(kv.utils.isObject(initialValue) ? initialValue : {}, options);
	obsv.isValid = ko.observable(obsv.errors().length === 0);

	if (ko.isObservable(obsv.errors)) {
		obsv.errors.subscribe(function(errors) {
			obsv.isValid(errors.length === 0);
		});
	}
	else {
		ko.computed(obsv.errors).subscribe(function (errors) {
			obsv.isValid(errors.length === 0);
		});
	}

	obsv.subscribe(function(newValue) {
		if (!kv.utils.isObject(newValue)) {
			/*
			 * The validation group works on objects.
			 * Since the new value is a primitive (scalar, null or undefined) we need
			 * to create an empty object to pass along.
			 */
			newValue = {};
		}
		// Force the group to refresh
		obsv.errors._updateState(newValue);
		obsv.isValid(obsv.errors().length === 0);
	});

	return obsv;
};
;}));
define('context', [],
    function () {
        return {
            environment: {
                railinfoApiUrl: entryDataContext.RailInfoApiUrl,
                commonApiUrl: entryDataContext.CommonApiUrl,
                travelUpdatesPageUrl: entryDataContext.ServicePages.TravelUpdatesPageUrl,
                journeyCheckPageUrl: entryDataContext.ServicePages.JourneyCheckPageUrl,
                stationDetailsPageUrl: entryDataContext.ServicePages.StationDetailsPageUrl,
                serviceStatusPageUrl: entryDataContext.ServicePages.ServiceStatusPageUrl,
                searchPageUrl: entryDataContext.ServicePages.SearchPageUrl,
                popularStations: entryDataContext.PopularStations,
                DateSetting: entryDataContext.DateSetting,

                AllstationForPICO: entryDataContext.AllstationForPICO,
                HandoffForPICO: entryDataContext.HandoffForPICO,

                RailcardForPICO: entryDataContext.RailcardForPICO,

                OrganizationId: entryDataContext.OrganizationId,
                geoliseUrl: entryDataContext.GeoliseUrl,
                booking: {
                    webtisUrl: entryDataContext.WebtisBookingEngineUrl,
                    PICOWebtisEngineUrl: entryDataContext.PICOWebtisEngineUrl,
                    webtisMobileUrl: entryDataContext.WebtisMobileBookingEngineUrl,
                    webtisHomeUrl: entryDataContext.WebtisBookingEngineHomeUrl,
                    webtisMobileHomeUrl: entryDataContext.WebtisMobileBookingEngineHomeUrl,
                    mdInternalUrl: entryDataContext.MixingDeckInternalUrl,
                    mdThreshold: entryDataContext.MixingDeckThreshold                
                },
                integratedServicesThreshold: entryDataContext.IntegratedServicesThreshold,
                webtisMyAccountUrl: entryDataContext.WebtisMyAccountUrl
            },
            apiKeys: {
                googlemaps: entryDataContext.GoogleMapsApiKey
            },
            form: {
                allowedImages: ['image/gif', 'image/jpeg', 'image/png'],
                maxFileSize: 2000000
            },
            dateFormat: {
                tinyDate: 'DD MMM YYYY',
                shortDate: 'DD/MM/YYYY',
                longDate: 'YYYY-MM-DDTHHmm',
                verboseDate: 'ddd MMM D YYYY, HH:mm:ss',
                atomDate: 'YYYY-MM-DDTHH:mm:ss.SSSZZ',
                time: 'HH:mm',
                shortDayOfMonth: 'ddd DD MMM',
                longDayOfMonth: 'dddd DD MMMM',
                shortDayMonthTime: 'DD MMM HH:mm'
            },
            paging: {
                pageSize: 10
            }
        };
    });

//! moment.js
//! version : 2.10.6
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT
//! momentjs.com

(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
    typeof define === 'function' && define.amd ? define('moment',factory) :
    global.moment = factory()
}(this, function () { 'use strict';

    var hookCallback;

    function utils_hooks__hooks () {
        return hookCallback.apply(null, arguments);
    }

    // This is done to register the method called with moment()
    // without creating circular dependencies.
    function setHookCallback (callback) {
        hookCallback = callback;
    }

    function isArray(input) {
        return Object.prototype.toString.call(input) === '[object Array]';
    }

    function isDate(input) {
        return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]';
    }

    function map(arr, fn) {
        var res = [], i;
        for (i = 0; i < arr.length; ++i) {
            res.push(fn(arr[i], i));
        }
        return res;
    }

    function hasOwnProp(a, b) {
        return Object.prototype.hasOwnProperty.call(a, b);
    }

    function extend(a, b) {
        for (var i in b) {
            if (hasOwnProp(b, i)) {
                a[i] = b[i];
            }
        }

        if (hasOwnProp(b, 'toString')) {
            a.toString = b.toString;
        }

        if (hasOwnProp(b, 'valueOf')) {
            a.valueOf = b.valueOf;
        }

        return a;
    }

    function create_utc__createUTC (input, format, locale, strict) {
        return createLocalOrUTC(input, format, locale, strict, true).utc();
    }

    function defaultParsingFlags() {
        // We need to deep clone this object.
        return {
            empty           : false,
            unusedTokens    : [],
            unusedInput     : [],
            overflow        : -2,
            charsLeftOver   : 0,
            nullInput       : false,
            invalidMonth    : null,
            invalidFormat   : false,
            userInvalidated : false,
            iso             : false
        };
    }

    function getParsingFlags(m) {
        if (m._pf == null) {
            m._pf = defaultParsingFlags();
        }
        return m._pf;
    }

    function valid__isValid(m) {
        if (m._isValid == null) {
            var flags = getParsingFlags(m);
            m._isValid = !isNaN(m._d.getTime()) &&
                flags.overflow < 0 &&
                !flags.empty &&
                !flags.invalidMonth &&
                !flags.invalidWeekday &&
                !flags.nullInput &&
                !flags.invalidFormat &&
                !flags.userInvalidated;

            if (m._strict) {
                m._isValid = m._isValid &&
                    flags.charsLeftOver === 0 &&
                    flags.unusedTokens.length === 0 &&
                    flags.bigHour === undefined;
            }
        }
        return m._isValid;
    }

    function valid__createInvalid (flags) {
        var m = create_utc__createUTC(NaN);
        if (flags != null) {
            extend(getParsingFlags(m), flags);
        }
        else {
            getParsingFlags(m).userInvalidated = true;
        }

        return m;
    }

    var momentProperties = utils_hooks__hooks.momentProperties = [];

    function copyConfig(to, from) {
        var i, prop, val;

        if (typeof from._isAMomentObject !== 'undefined') {
            to._isAMomentObject = from._isAMomentObject;
        }
        if (typeof from._i !== 'undefined') {
            to._i = from._i;
        }
        if (typeof from._f !== 'undefined') {
            to._f = from._f;
        }
        if (typeof from._l !== 'undefined') {
            to._l = from._l;
        }
        if (typeof from._strict !== 'undefined') {
            to._strict = from._strict;
        }
        if (typeof from._tzm !== 'undefined') {
            to._tzm = from._tzm;
        }
        if (typeof from._isUTC !== 'undefined') {
            to._isUTC = from._isUTC;
        }
        if (typeof from._offset !== 'undefined') {
            to._offset = from._offset;
        }
        if (typeof from._pf !== 'undefined') {
            to._pf = getParsingFlags(from);
        }
        if (typeof from._locale !== 'undefined') {
            to._locale = from._locale;
        }

        if (momentProperties.length > 0) {
            for (i in momentProperties) {
                prop = momentProperties[i];
                val = from[prop];
                if (typeof val !== 'undefined') {
                    to[prop] = val;
                }
            }
        }

        return to;
    }

    var updateInProgress = false;

    // Moment prototype object
    function Moment(config) {
        copyConfig(this, config);
        this._d = new Date(config._d != null ? config._d.getTime() : NaN);
        // Prevent infinite loop in case updateOffset creates new moment
        // objects.
        if (updateInProgress === false) {
            updateInProgress = true;
            utils_hooks__hooks.updateOffset(this);
            updateInProgress = false;
        }
    }

    function isMoment (obj) {
        return obj instanceof Moment || (obj != null && obj._isAMomentObject != null);
    }

    function absFloor (number) {
        if (number < 0) {
            return Math.ceil(number);
        } else {
            return Math.floor(number);
        }
    }

    function toInt(argumentForCoercion) {
        var coercedNumber = +argumentForCoercion,
            value = 0;

        if (coercedNumber !== 0 && isFinite(coercedNumber)) {
            value = absFloor(coercedNumber);
        }

        return value;
    }

    function compareArrays(array1, array2, dontConvert) {
        var len = Math.min(array1.length, array2.length),
            lengthDiff = Math.abs(array1.length - array2.length),
            diffs = 0,
            i;
        for (i = 0; i < len; i++) {
            if ((dontConvert && array1[i] !== array2[i]) ||
                (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
                diffs++;
            }
        }
        return diffs + lengthDiff;
    }

    function Locale() {
    }

    var locales = {};
    var globalLocale;

    function normalizeLocale(key) {
        return key ? key.toLowerCase().replace('_', '-') : key;
    }

    // pick the locale from the array
    // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
    // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
    function chooseLocale(names) {
        var i = 0, j, next, locale, split;

        while (i < names.length) {
            split = normalizeLocale(names[i]).split('-');
            j = split.length;
            next = normalizeLocale(names[i + 1]);
            next = next ? next.split('-') : null;
            while (j > 0) {
                locale = loadLocale(split.slice(0, j).join('-'));
                if (locale) {
                    return locale;
                }
                if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
                    //the next array item is better than a shallower substring of this one
                    break;
                }
                j--;
            }
            i++;
        }
        return null;
    }

    function loadLocale(name) {
        var oldLocale = null;
        // TODO: Find a better way to register and load all the locales in Node
        if (!locales[name] && typeof module !== 'undefined' &&
                module && module.exports) {
            try {
                oldLocale = globalLocale._abbr;
                require('./locale/' + name);
                // because defineLocale currently also sets the global locale, we
                // want to undo that for lazy loaded locales
                locale_locales__getSetGlobalLocale(oldLocale);
            } catch (e) { }
        }
        return locales[name];
    }

    // This function will load locale and then set the global locale.  If
    // no arguments are passed in, it will simply return the current global
    // locale key.
    function locale_locales__getSetGlobalLocale (key, values) {
        var data;
        if (key) {
            if (typeof values === 'undefined') {
                data = locale_locales__getLocale(key);
            }
            else {
                data = defineLocale(key, values);
            }

            if (data) {
                // moment.duration._locale = moment._locale = data;
                globalLocale = data;
            }
        }

        return globalLocale._abbr;
    }

    function defineLocale (name, values) {
        if (values !== null) {
            values.abbr = name;
            locales[name] = locales[name] || new Locale();
            locales[name].set(values);

            // backwards compat for now: also set the locale
            locale_locales__getSetGlobalLocale(name);

            return locales[name];
        } else {
            // useful for testing
            delete locales[name];
            return null;
        }
    }

    // returns locale data
    function locale_locales__getLocale (key) {
        var locale;

        if (key && key._locale && key._locale._abbr) {
            key = key._locale._abbr;
        }

        if (!key) {
            return globalLocale;
        }

        if (!isArray(key)) {
            //short-circuit everything else
            locale = loadLocale(key);
            if (locale) {
                return locale;
            }
            key = [key];
        }

        return chooseLocale(key);
    }

    var aliases = {};

    function addUnitAlias (unit, shorthand) {
        var lowerCase = unit.toLowerCase();
        aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
    }

    function normalizeUnits(units) {
        return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined;
    }

    function normalizeObjectUnits(inputObject) {
        var normalizedInput = {},
            normalizedProp,
            prop;

        for (prop in inputObject) {
            if (hasOwnProp(inputObject, prop)) {
                normalizedProp = normalizeUnits(prop);
                if (normalizedProp) {
                    normalizedInput[normalizedProp] = inputObject[prop];
                }
            }
        }

        return normalizedInput;
    }

    function makeGetSet (unit, keepTime) {
        return function (value) {
            if (value != null) {
                get_set__set(this, unit, value);
                utils_hooks__hooks.updateOffset(this, keepTime);
                return this;
            } else {
                return get_set__get(this, unit);
            }
        };
    }

    function get_set__get (mom, unit) {
        return mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]();
    }

    function get_set__set (mom, unit, value) {
        return mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
    }

    // MOMENTS

    function getSet (units, value) {
        var unit;
        if (typeof units === 'object') {
            for (unit in units) {
                this.set(unit, units[unit]);
            }
        } else {
            units = normalizeUnits(units);
            if (typeof this[units] === 'function') {
                return this[units](value);
            }
        }
        return this;
    }

    function zeroFill(number, targetLength, forceSign) {
        var absNumber = '' + Math.abs(number),
            zerosToFill = targetLength - absNumber.length,
            sign = number >= 0;
        return (sign ? (forceSign ? '+' : '') : '-') +
            Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
    }

    var formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;

    var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g;

    var formatFunctions = {};

    var formatTokenFunctions = {};

    // token:    'M'
    // padded:   ['MM', 2]
    // ordinal:  'Mo'
    // callback: function () { this.month() + 1 }
    function addFormatToken (token, padded, ordinal, callback) {
        var func = callback;
        if (typeof callback === 'string') {
            func = function () {
                return this[callback]();
            };
        }
        if (token) {
            formatTokenFunctions[token] = func;
        }
        if (padded) {
            formatTokenFunctions[padded[0]] = function () {
                return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
            };
        }
        if (ordinal) {
            formatTokenFunctions[ordinal] = function () {
                return this.localeData().ordinal(func.apply(this, arguments), token);
            };
        }
    }

    function removeFormattingTokens(input) {
        if (input.match(/\[[\s\S]/)) {
            return input.replace(/^\[|\]$/g, '');
        }
        return input.replace(/\\/g, '');
    }

    function makeFormatFunction(format) {
        var array = format.match(formattingTokens), i, length;

        for (i = 0, length = array.length; i < length; i++) {
            if (formatTokenFunctions[array[i]]) {
                array[i] = formatTokenFunctions[array[i]];
            } else {
                array[i] = removeFormattingTokens(array[i]);
            }
        }

        return function (mom) {
            var output = '';
            for (i = 0; i < length; i++) {
                output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
            }
            return output;
        };
    }

    // format date using native date object
    function formatMoment(m, format) {
        if (!m.isValid()) {
            return m.localeData().invalidDate();
        }

        format = expandFormat(format, m.localeData());
        formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);

        return formatFunctions[format](m);
    }

    function expandFormat(format, locale) {
        var i = 5;

        function replaceLongDateFormatTokens(input) {
            return locale.longDateFormat(input) || input;
        }

        localFormattingTokens.lastIndex = 0;
        while (i >= 0 && localFormattingTokens.test(format)) {
            format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
            localFormattingTokens.lastIndex = 0;
            i -= 1;
        }

        return format;
    }

    var match1         = /\d/;            //       0 - 9
    var match2         = /\d\d/;          //      00 - 99
    var match3         = /\d{3}/;         //     000 - 999
    var match4         = /\d{4}/;         //    0000 - 9999
    var match6         = /[+-]?\d{6}/;    // -999999 - 999999
    var match1to2      = /\d\d?/;         //       0 - 99
    var match1to3      = /\d{1,3}/;       //       0 - 999
    var match1to4      = /\d{1,4}/;       //       0 - 9999
    var match1to6      = /[+-]?\d{1,6}/;  // -999999 - 999999

    var matchUnsigned  = /\d+/;           //       0 - inf
    var matchSigned    = /[+-]?\d+/;      //    -inf - inf

    var matchOffset    = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z

    var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123

    // any word (or two) characters or numbers including two/three word month in arabic.
    var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i;

    var regexes = {};

    function isFunction (sth) {
        // https://github.com/moment/moment/issues/2325
        return typeof sth === 'function' &&
            Object.prototype.toString.call(sth) === '[object Function]';
    }


    function addRegexToken (token, regex, strictRegex) {
        regexes[token] = isFunction(regex) ? regex : function (isStrict) {
            return (isStrict && strictRegex) ? strictRegex : regex;
        };
    }

    function getParseRegexForToken (token, config) {
        if (!hasOwnProp(regexes, token)) {
            return new RegExp(unescapeFormat(token));
        }

        return regexes[token](config._strict, config._locale);
    }

    // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
    function unescapeFormat(s) {
        return s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
            return p1 || p2 || p3 || p4;
        }).replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
    }

    var tokens = {};

    function addParseToken (token, callback) {
        var i, func = callback;
        if (typeof token === 'string') {
            token = [token];
        }
        if (typeof callback === 'number') {
            func = function (input, array) {
                array[callback] = toInt(input);
            };
        }
        for (i = 0; i < token.length; i++) {
            tokens[token[i]] = func;
        }
    }

    function addWeekParseToken (token, callback) {
        addParseToken(token, function (input, array, config, token) {
            config._w = config._w || {};
            callback(input, config._w, config, token);
        });
    }

    function addTimeToArrayFromToken(token, input, config) {
        if (input != null && hasOwnProp(tokens, token)) {
            tokens[token](input, config._a, config, token);
        }
    }

    var YEAR = 0;
    var MONTH = 1;
    var DATE = 2;
    var HOUR = 3;
    var MINUTE = 4;
    var SECOND = 5;
    var MILLISECOND = 6;

    function daysInMonth(year, month) {
        return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
    }

    // FORMATTING

    addFormatToken('M', ['MM', 2], 'Mo', function () {
        return this.month() + 1;
    });

    addFormatToken('MMM', 0, 0, function (format) {
        return this.localeData().monthsShort(this, format);
    });

    addFormatToken('MMMM', 0, 0, function (format) {
        return this.localeData().months(this, format);
    });

    // ALIASES

    addUnitAlias('month', 'M');

    // PARSING

    addRegexToken('M',    match1to2);
    addRegexToken('MM',   match1to2, match2);
    addRegexToken('MMM',  matchWord);
    addRegexToken('MMMM', matchWord);

    addParseToken(['M', 'MM'], function (input, array) {
        array[MONTH] = toInt(input) - 1;
    });

    addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
        var month = config._locale.monthsParse(input, token, config._strict);
        // if we didn't find a month name, mark the date as invalid.
        if (month != null) {
            array[MONTH] = month;
        } else {
            getParsingFlags(config).invalidMonth = input;
        }
    });

    // LOCALES

    var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_');
    function localeMonths (m) {
        return this._months[m.month()];
    }

    var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_');
    function localeMonthsShort (m) {
        return this._monthsShort[m.month()];
    }

    function localeMonthsParse (monthName, format, strict) {
        var i, mom, regex;

        if (!this._monthsParse) {
            this._monthsParse = [];
            this._longMonthsParse = [];
            this._shortMonthsParse = [];
        }

        for (i = 0; i < 12; i++) {
            // make the regex if we don't have it already
            mom = create_utc__createUTC([2000, i]);
            if (strict && !this._longMonthsParse[i]) {
                this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
                this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
            }
            if (!strict && !this._monthsParse[i]) {
                regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
                this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
            }
            // test the regex
            if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
                return i;
            } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
                return i;
            } else if (!strict && this._monthsParse[i].test(monthName)) {
                return i;
            }
        }
    }

    // MOMENTS

    function setMonth (mom, value) {
        var dayOfMonth;

        // TODO: Move this out of here!
        if (typeof value === 'string') {
            value = mom.localeData().monthsParse(value);
            // TODO: Another silent failure?
            if (typeof value !== 'number') {
                return mom;
            }
        }

        dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
        mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
        return mom;
    }

    function getSetMonth (value) {
        if (value != null) {
            setMonth(this, value);
            utils_hooks__hooks.updateOffset(this, true);
            return this;
        } else {
            return get_set__get(this, 'Month');
        }
    }

    function getDaysInMonth () {
        return daysInMonth(this.year(), this.month());
    }

    function checkOverflow (m) {
        var overflow;
        var a = m._a;

        if (a && getParsingFlags(m).overflow === -2) {
            overflow =
                a[MONTH]       < 0 || a[MONTH]       > 11  ? MONTH :
                a[DATE]        < 1 || a[DATE]        > daysInMonth(a[YEAR], a[MONTH]) ? DATE :
                a[HOUR]        < 0 || a[HOUR]        > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR :
                a[MINUTE]      < 0 || a[MINUTE]      > 59  ? MINUTE :
                a[SECOND]      < 0 || a[SECOND]      > 59  ? SECOND :
                a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND :
                -1;

            if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
                overflow = DATE;
            }

            getParsingFlags(m).overflow = overflow;
        }

        return m;
    }

    function warn(msg) {
        if (utils_hooks__hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn) {
            console.warn('Deprecation warning: ' + msg);
        }
    }

    function deprecate(msg, fn) {
        var firstTime = true;

        return extend(function () {
            if (firstTime) {
                warn(msg + '\n' + (new Error()).stack);
                firstTime = false;
            }
            return fn.apply(this, arguments);
        }, fn);
    }

    var deprecations = {};

    function deprecateSimple(name, msg) {
        if (!deprecations[name]) {
            warn(msg);
            deprecations[name] = true;
        }
    }

    utils_hooks__hooks.suppressDeprecationWarnings = false;

    var from_string__isoRegex = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;

    var isoDates = [
        ['YYYYYY-MM-DD', /[+-]\d{6}-\d{2}-\d{2}/],
        ['YYYY-MM-DD', /\d{4}-\d{2}-\d{2}/],
        ['GGGG-[W]WW-E', /\d{4}-W\d{2}-\d/],
        ['GGGG-[W]WW', /\d{4}-W\d{2}/],
        ['YYYY-DDD', /\d{4}-\d{3}/]
    ];

    // iso time formats and regexes
    var isoTimes = [
        ['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/],
        ['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/],
        ['HH:mm', /(T| )\d\d:\d\d/],
        ['HH', /(T| )\d\d/]
    ];

    var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;

    // date from iso format
    function configFromISO(config) {
        var i, l,
            string = config._i,
            match = from_string__isoRegex.exec(string);

        if (match) {
            getParsingFlags(config).iso = true;
            for (i = 0, l = isoDates.length; i < l; i++) {
                if (isoDates[i][1].exec(string)) {
                    config._f = isoDates[i][0];
                    break;
                }
            }
            for (i = 0, l = isoTimes.length; i < l; i++) {
                if (isoTimes[i][1].exec(string)) {
                    // match[6] should be 'T' or space
                    config._f += (match[6] || ' ') + isoTimes[i][0];
                    break;
                }
            }
            if (string.match(matchOffset)) {
                config._f += 'Z';
            }
            configFromStringAndFormat(config);
        } else {
            config._isValid = false;
        }
    }

    // date from iso format or fallback
    function configFromString(config) {
        var matched = aspNetJsonRegex.exec(config._i);

        if (matched !== null) {
            config._d = new Date(+matched[1]);
            return;
        }

        configFromISO(config);
        if (config._isValid === false) {
            delete config._isValid;
            utils_hooks__hooks.createFromInputFallback(config);
        }
    }

    utils_hooks__hooks.createFromInputFallback = deprecate(
        'moment construction falls back to js Date. This is ' +
        'discouraged and will be removed in upcoming major ' +
        'release. Please refer to ' +
        'https://github.com/moment/moment/issues/1407 for more info.',
        function (config) {
            config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
        }
    );

    function createDate (y, m, d, h, M, s, ms) {
        //can't just apply() to create a date:
        //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
        var date = new Date(y, m, d, h, M, s, ms);

        //the date constructor doesn't accept years < 1970
        if (y < 1970) {
            date.setFullYear(y);
        }
        return date;
    }

    function createUTCDate (y) {
        var date = new Date(Date.UTC.apply(null, arguments));
        if (y < 1970) {
            date.setUTCFullYear(y);
        }
        return date;
    }

    addFormatToken(0, ['YY', 2], 0, function () {
        return this.year() % 100;
    });

    addFormatToken(0, ['YYYY',   4],       0, 'year');
    addFormatToken(0, ['YYYYY',  5],       0, 'year');
    addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');

    // ALIASES

    addUnitAlias('year', 'y');

    // PARSING

    addRegexToken('Y',      matchSigned);
    addRegexToken('YY',     match1to2, match2);
    addRegexToken('YYYY',   match1to4, match4);
    addRegexToken('YYYYY',  match1to6, match6);
    addRegexToken('YYYYYY', match1to6, match6);

    addParseToken(['YYYYY', 'YYYYYY'], YEAR);
    addParseToken('YYYY', function (input, array) {
        array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input);
    });
    addParseToken('YY', function (input, array) {
        array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input);
    });

    // HELPERS

    function daysInYear(year) {
        return isLeapYear(year) ? 366 : 365;
    }

    function isLeapYear(year) {
        return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
    }

    // HOOKS

    utils_hooks__hooks.parseTwoDigitYear = function (input) {
        return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
    };

    // MOMENTS

    var getSetYear = makeGetSet('FullYear', false);

    function getIsLeapYear () {
        return isLeapYear(this.year());
    }

    addFormatToken('w', ['ww', 2], 'wo', 'week');
    addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');

    // ALIASES

    addUnitAlias('week', 'w');
    addUnitAlias('isoWeek', 'W');

    // PARSING

    addRegexToken('w',  match1to2);
    addRegexToken('ww', match1to2, match2);
    addRegexToken('W',  match1to2);
    addRegexToken('WW', match1to2, match2);

    addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) {
        week[token.substr(0, 1)] = toInt(input);
    });

    // HELPERS

    // firstDayOfWeek       0 = sun, 6 = sat
    //                      the day of the week that starts the week
    //                      (usually sunday or monday)
    // firstDayOfWeekOfYear 0 = sun, 6 = sat
    //                      the first week is the week that contains the first
    //                      of this day of the week
    //                      (eg. ISO weeks use thursday (4))
    function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {
        var end = firstDayOfWeekOfYear - firstDayOfWeek,
            daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),
            adjustedMoment;


        if (daysToDayOfWeek > end) {
            daysToDayOfWeek -= 7;
        }

        if (daysToDayOfWeek < end - 7) {
            daysToDayOfWeek += 7;
        }

        adjustedMoment = local__createLocal(mom).add(daysToDayOfWeek, 'd');
        return {
            week: Math.ceil(adjustedMoment.dayOfYear() / 7),
            year: adjustedMoment.year()
        };
    }

    // LOCALES

    function localeWeek (mom) {
        return weekOfYear(mom, this._week.dow, this._week.doy).week;
    }

    var defaultLocaleWeek = {
        dow : 0, // Sunday is the first day of the week.
        doy : 6  // The week that contains Jan 1st is the first week of the year.
    };

    function localeFirstDayOfWeek () {
        return this._week.dow;
    }

    function localeFirstDayOfYear () {
        return this._week.doy;
    }

    // MOMENTS

    function getSetWeek (input) {
        var week = this.localeData().week(this);
        return input == null ? week : this.add((input - week) * 7, 'd');
    }

    function getSetISOWeek (input) {
        var week = weekOfYear(this, 1, 4).week;
        return input == null ? week : this.add((input - week) * 7, 'd');
    }

    addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');

    // ALIASES

    addUnitAlias('dayOfYear', 'DDD');

    // PARSING

    addRegexToken('DDD',  match1to3);
    addRegexToken('DDDD', match3);
    addParseToken(['DDD', 'DDDD'], function (input, array, config) {
        config._dayOfYear = toInt(input);
    });

    // HELPERS

    //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
    function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) {
        var week1Jan = 6 + firstDayOfWeek - firstDayOfWeekOfYear, janX = createUTCDate(year, 0, 1 + week1Jan), d = janX.getUTCDay(), dayOfYear;
        if (d < firstDayOfWeek) {
            d += 7;
        }

        weekday = weekday != null ? 1 * weekday : firstDayOfWeek;

        dayOfYear = 1 + week1Jan + 7 * (week - 1) - d + weekday;

        return {
            year: dayOfYear > 0 ? year : year - 1,
            dayOfYear: dayOfYear > 0 ?  dayOfYear : daysInYear(year - 1) + dayOfYear
        };
    }

    // MOMENTS

    function getSetDayOfYear (input) {
        var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1;
        return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
    }

    // Pick the first defined of two or three arguments.
    function defaults(a, b, c) {
        if (a != null) {
            return a;
        }
        if (b != null) {
            return b;
        }
        return c;
    }

    function currentDateArray(config) {
        var now = new Date();
        if (config._useUTC) {
            return [now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate()];
        }
        return [now.getFullYear(), now.getMonth(), now.getDate()];
    }

    // convert an array to a date.
    // the array should mirror the parameters below
    // note: all values past the year are optional and will default to the lowest possible value.
    // [year, month, day , hour, minute, second, millisecond]
    function configFromArray (config) {
        var i, date, input = [], currentDate, yearToUse;

        if (config._d) {
            return;
        }

        currentDate = currentDateArray(config);

        //compute day of the year from weeks and weekdays
        if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
            dayOfYearFromWeekInfo(config);
        }

        //if the day of the year is set, figure out what it is
        if (config._dayOfYear) {
            yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);

            if (config._dayOfYear > daysInYear(yearToUse)) {
                getParsingFlags(config)._overflowDayOfYear = true;
            }

            date = createUTCDate(yearToUse, 0, config._dayOfYear);
            config._a[MONTH] = date.getUTCMonth();
            config._a[DATE] = date.getUTCDate();
        }

        // Default to current date.
        // * if no year, month, day of month are given, default to today
        // * if day of month is given, default month and year
        // * if month is given, default only year
        // * if year is given, don't default anything
        for (i = 0; i < 3 && config._a[i] == null; ++i) {
            config._a[i] = input[i] = currentDate[i];
        }

        // Zero out whatever was not defaulted, including time
        for (; i < 7; i++) {
            config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
        }

        // Check for 24:00:00.000
        if (config._a[HOUR] === 24 &&
                config._a[MINUTE] === 0 &&
                config._a[SECOND] === 0 &&
                config._a[MILLISECOND] === 0) {
            config._nextDay = true;
            config._a[HOUR] = 0;
        }

        config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input);
        // Apply timezone offset from input. The actual utcOffset can be changed
        // with parseZone.
        if (config._tzm != null) {
            config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
        }

        if (config._nextDay) {
            config._a[HOUR] = 24;
        }
    }

    function dayOfYearFromWeekInfo(config) {
        var w, weekYear, week, weekday, dow, doy, temp;

        w = config._w;
        if (w.GG != null || w.W != null || w.E != null) {
            dow = 1;
            doy = 4;

            // TODO: We need to take the current isoWeekYear, but that depends on
            // how we interpret now (local, utc, fixed offset). So create
            // a now version of current config (take local/utc/offset flags, and
            // create now).
            weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year);
            week = defaults(w.W, 1);
            weekday = defaults(w.E, 1);
        } else {
            dow = config._locale._week.dow;
            doy = config._locale._week.doy;

            weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year);
            week = defaults(w.w, 1);

            if (w.d != null) {
                // weekday -- low day numbers are considered next week
                weekday = w.d;
                if (weekday < dow) {
                    ++week;
                }
            } else if (w.e != null) {
                // local weekday -- counting starts from begining of week
                weekday = w.e + dow;
            } else {
                // default to begining of week
                weekday = dow;
            }
        }
        temp = dayOfYearFromWeeks(weekYear, week, weekday, doy, dow);

        config._a[YEAR] = temp.year;
        config._dayOfYear = temp.dayOfYear;
    }

    utils_hooks__hooks.ISO_8601 = function () {};

    // date from string and format string
    function configFromStringAndFormat(config) {
        // TODO: Move this to another part of the creation flow to prevent circular deps
        if (config._f === utils_hooks__hooks.ISO_8601) {
            configFromISO(config);
            return;
        }

        config._a = [];
        getParsingFlags(config).empty = true;

        // This array is used to make a Date, either with `new Date` or `Date.UTC`
        var string = '' + config._i,
            i, parsedInput, tokens, token, skipped,
            stringLength = string.length,
            totalParsedInputLength = 0;

        tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];

        for (i = 0; i < tokens.length; i++) {
            token = tokens[i];
            parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
            if (parsedInput) {
                skipped = string.substr(0, string.indexOf(parsedInput));
                if (skipped.length > 0) {
                    getParsingFlags(config).unusedInput.push(skipped);
                }
                string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
                totalParsedInputLength += parsedInput.length;
            }
            // don't parse if it's not a known token
            if (formatTokenFunctions[token]) {
                if (parsedInput) {
                    getParsingFlags(config).empty = false;
                }
                else {
                    getParsingFlags(config).unusedTokens.push(token);
                }
                addTimeToArrayFromToken(token, parsedInput, config);
            }
            else if (config._strict && !parsedInput) {
                getParsingFlags(config).unusedTokens.push(token);
            }
        }

        // add remaining unparsed input length to the string
        getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength;
        if (string.length > 0) {
            getParsingFlags(config).unusedInput.push(string);
        }

        // clear _12h flag if hour is <= 12
        if (getParsingFlags(config).bigHour === true &&
                config._a[HOUR] <= 12 &&
                config._a[HOUR] > 0) {
            getParsingFlags(config).bigHour = undefined;
        }
        // handle meridiem
        config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem);

        configFromArray(config);
        checkOverflow(config);
    }


    function meridiemFixWrap (locale, hour, meridiem) {
        var isPm;

        if (meridiem == null) {
            // nothing to do
            return hour;
        }
        if (locale.meridiemHour != null) {
            return locale.meridiemHour(hour, meridiem);
        } else if (locale.isPM != null) {
            // Fallback
            isPm = locale.isPM(meridiem);
            if (isPm && hour < 12) {
                hour += 12;
            }
            if (!isPm && hour === 12) {
                hour = 0;
            }
            return hour;
        } else {
            // this is not supposed to happen
            return hour;
        }
    }

    function configFromStringAndArray(config) {
        var tempConfig,
            bestMoment,

            scoreToBeat,
            i,
            currentScore;

        if (config._f.length === 0) {
            getParsingFlags(config).invalidFormat = true;
            config._d = new Date(NaN);
            return;
        }

        for (i = 0; i < config._f.length; i++) {
            currentScore = 0;
            tempConfig = copyConfig({}, config);
            if (config._useUTC != null) {
                tempConfig._useUTC = config._useUTC;
            }
            tempConfig._f = config._f[i];
            configFromStringAndFormat(tempConfig);

            if (!valid__isValid(tempConfig)) {
                continue;
            }

            // if there is any input that was not parsed add a penalty for that format
            currentScore += getParsingFlags(tempConfig).charsLeftOver;

            //or tokens
            currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;

            getParsingFlags(tempConfig).score = currentScore;

            if (scoreToBeat == null || currentScore < scoreToBeat) {
                scoreToBeat = currentScore;
                bestMoment = tempConfig;
            }
        }

        extend(config, bestMoment || tempConfig);
    }

    function configFromObject(config) {
        if (config._d) {
            return;
        }

        var i = normalizeObjectUnits(config._i);
        config._a = [i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond];

        configFromArray(config);
    }

    function createFromConfig (config) {
        var res = new Moment(checkOverflow(prepareConfig(config)));
        if (res._nextDay) {
            // Adding is smart enough around DST
            res.add(1, 'd');
            res._nextDay = undefined;
        }

        return res;
    }

    function prepareConfig (config) {
        var input = config._i,
            format = config._f;

        config._locale = config._locale || locale_locales__getLocale(config._l);

        if (input === null || (format === undefined && input === '')) {
            return valid__createInvalid({nullInput: true});
        }

        if (typeof input === 'string') {
            config._i = input = config._locale.preparse(input);
        }

        if (isMoment(input)) {
            return new Moment(checkOverflow(input));
        } else if (isArray(format)) {
            configFromStringAndArray(config);
        } else if (format) {
            configFromStringAndFormat(config);
        } else if (isDate(input)) {
            config._d = input;
        } else {
            configFromInput(config);
        }

        return config;
    }

    function configFromInput(config) {
        var input = config._i;
        if (input === undefined) {
            config._d = new Date();
        } else if (isDate(input)) {
            config._d = new Date(+input);
        } else if (typeof input === 'string') {
            configFromString(config);
        } else if (isArray(input)) {
            config._a = map(input.slice(0), function (obj) {
                return parseInt(obj, 10);
            });
            configFromArray(config);
        } else if (typeof(input) === 'object') {
            configFromObject(config);
        } else if (typeof(input) === 'number') {
            // from milliseconds
            config._d = new Date(input);
        } else {
            utils_hooks__hooks.createFromInputFallback(config);
        }
    }

    function createLocalOrUTC (input, format, locale, strict, isUTC) {
        var c = {};

        if (typeof(locale) === 'boolean') {
            strict = locale;
            locale = undefined;
        }
        // object construction must be done this way.
        // https://github.com/moment/moment/issues/1423
        c._isAMomentObject = true;
        c._useUTC = c._isUTC = isUTC;
        c._l = locale;
        c._i = input;
        c._f = format;
        c._strict = strict;

        return createFromConfig(c);
    }

    function local__createLocal (input, format, locale, strict) {
        return createLocalOrUTC(input, format, locale, strict, false);
    }

    var prototypeMin = deprecate(
         'moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548',
         function () {
             var other = local__createLocal.apply(null, arguments);
             return other < this ? this : other;
         }
     );

    var prototypeMax = deprecate(
        'moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548',
        function () {
            var other = local__createLocal.apply(null, arguments);
            return other > this ? this : other;
        }
    );

    // Pick a moment m from moments so that m[fn](other) is true for all
    // other. This relies on the function fn to be transitive.
    //
    // moments should either be an array of moment objects or an array, whose
    // first element is an array of moment objects.
    function pickBy(fn, moments) {
        var res, i;
        if (moments.length === 1 && isArray(moments[0])) {
            moments = moments[0];
        }
        if (!moments.length) {
            return local__createLocal();
        }
        res = moments[0];
        for (i = 1; i < moments.length; ++i) {
            if (!moments[i].isValid() || moments[i][fn](res)) {
                res = moments[i];
            }
        }
        return res;
    }

    // TODO: Use [].sort instead?
    function min () {
        var args = [].slice.call(arguments, 0);

        return pickBy('isBefore', args);
    }

    function max () {
        var args = [].slice.call(arguments, 0);

        return pickBy('isAfter', args);
    }

    function Duration (duration) {
        var normalizedInput = normalizeObjectUnits(duration),
            years = normalizedInput.year || 0,
            quarters = normalizedInput.quarter || 0,
            months = normalizedInput.month || 0,
            weeks = normalizedInput.week || 0,
            days = normalizedInput.day || 0,
            hours = normalizedInput.hour || 0,
            minutes = normalizedInput.minute || 0,
            seconds = normalizedInput.second || 0,
            milliseconds = normalizedInput.millisecond || 0;

        // representation for dateAddRemove
        this._milliseconds = +milliseconds +
            seconds * 1e3 + // 1000
            minutes * 6e4 + // 1000 * 60
            hours * 36e5; // 1000 * 60 * 60
        // Because of dateAddRemove treats 24 hours as different from a
        // day when working around DST, we need to store them separately
        this._days = +days +
            weeks * 7;
        // It is impossible translate months into days without knowing
        // which months you are are talking about, so we have to store
        // it separately.
        this._months = +months +
            quarters * 3 +
            years * 12;

        this._data = {};

        this._locale = locale_locales__getLocale();

        this._bubble();
    }

    function isDuration (obj) {
        return obj instanceof Duration;
    }

    function offset (token, separator) {
        addFormatToken(token, 0, 0, function () {
            var offset = this.utcOffset();
            var sign = '+';
            if (offset < 0) {
                offset = -offset;
                sign = '-';
            }
            return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2);
        });
    }

    offset('Z', ':');
    offset('ZZ', '');

    // PARSING

    addRegexToken('Z',  matchOffset);
    addRegexToken('ZZ', matchOffset);
    addParseToken(['Z', 'ZZ'], function (input, array, config) {
        config._useUTC = true;
        config._tzm = offsetFromString(input);
    });

    // HELPERS

    // timezone chunker
    // '+10:00' > ['10',  '00']
    // '-1530'  > ['-15', '30']
    var chunkOffset = /([\+\-]|\d\d)/gi;

    function offsetFromString(string) {
        var matches = ((string || '').match(matchOffset) || []);
        var chunk   = matches[matches.length - 1] || [];
        var parts   = (chunk + '').match(chunkOffset) || ['-', 0, 0];
        var minutes = +(parts[1] * 60) + toInt(parts[2]);

        return parts[0] === '+' ? minutes : -minutes;
    }

    // Return a moment from input, that is local/utc/zone equivalent to model.
    function cloneWithOffset(input, model) {
        var res, diff;
        if (model._isUTC) {
            res = model.clone();
            diff = (isMoment(input) || isDate(input) ? +input : +local__createLocal(input)) - (+res);
            // Use low-level api, because this fn is low-level api.
            res._d.setTime(+res._d + diff);
            utils_hooks__hooks.updateOffset(res, false);
            return res;
        } else {
            return local__createLocal(input).local();
        }
    }

    function getDateOffset (m) {
        // On Firefox.24 Date#getTimezoneOffset returns a floating point.
        // https://github.com/moment/moment/pull/1871
        return -Math.round(m._d.getTimezoneOffset() / 15) * 15;
    }

    // HOOKS

    // This function will be called whenever a moment is mutated.
    // It is intended to keep the offset in sync with the timezone.
    utils_hooks__hooks.updateOffset = function () {};

    // MOMENTS

    // keepLocalTime = true means only change the timezone, without
    // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
    // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
    // +0200, so we adjust the time as needed, to be valid.
    //
    // Keeping the time actually adds/subtracts (one hour)
    // from the actual represented time. That is why we call updateOffset
    // a second time. In case it wants us to change the offset again
    // _changeInProgress == true case, then we have to adjust, because
    // there is no such time in the given timezone.
    function getSetOffset (input, keepLocalTime) {
        var offset = this._offset || 0,
            localAdjust;
        if (input != null) {
            if (typeof input === 'string') {
                input = offsetFromString(input);
            }
            if (Math.abs(input) < 16) {
                input = input * 60;
            }
            if (!this._isUTC && keepLocalTime) {
                localAdjust = getDateOffset(this);
            }
            this._offset = input;
            this._isUTC = true;
            if (localAdjust != null) {
                this.add(localAdjust, 'm');
            }
            if (offset !== input) {
                if (!keepLocalTime || this._changeInProgress) {
                    add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false);
                } else if (!this._changeInProgress) {
                    this._changeInProgress = true;
                    utils_hooks__hooks.updateOffset(this, true);
                    this._changeInProgress = null;
                }
            }
            return this;
        } else {
            return this._isUTC ? offset : getDateOffset(this);
        }
    }

    function getSetZone (input, keepLocalTime) {
        if (input != null) {
            if (typeof input !== 'string') {
                input = -input;
            }

            this.utcOffset(input, keepLocalTime);

            return this;
        } else {
            return -this.utcOffset();
        }
    }

    function setOffsetToUTC (keepLocalTime) {
        return this.utcOffset(0, keepLocalTime);
    }

    function setOffsetToLocal (keepLocalTime) {
        if (this._isUTC) {
            this.utcOffset(0, keepLocalTime);
            this._isUTC = false;

            if (keepLocalTime) {
                this.subtract(getDateOffset(this), 'm');
            }
        }
        return this;
    }

    function setOffsetToParsedOffset () {
        if (this._tzm) {
            this.utcOffset(this._tzm);
        } else if (typeof this._i === 'string') {
            this.utcOffset(offsetFromString(this._i));
        }
        return this;
    }

    function hasAlignedHourOffset (input) {
        input = input ? local__createLocal(input).utcOffset() : 0;

        return (this.utcOffset() - input) % 60 === 0;
    }

    function isDaylightSavingTime () {
        return (
            this.utcOffset() > this.clone().month(0).utcOffset() ||
            this.utcOffset() > this.clone().month(5).utcOffset()
        );
    }

    function isDaylightSavingTimeShifted () {
        if (typeof this._isDSTShifted !== 'undefined') {
            return this._isDSTShifted;
        }

        var c = {};

        copyConfig(c, this);
        c = prepareConfig(c);

        if (c._a) {
            var other = c._isUTC ? create_utc__createUTC(c._a) : local__createLocal(c._a);
            this._isDSTShifted = this.isValid() &&
                compareArrays(c._a, other.toArray()) > 0;
        } else {
            this._isDSTShifted = false;
        }

        return this._isDSTShifted;
    }

    function isLocal () {
        return !this._isUTC;
    }

    function isUtcOffset () {
        return this._isUTC;
    }

    function isUtc () {
        return this._isUTC && this._offset === 0;
    }

    var aspNetRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/;

    // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
    // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
    var create__isoRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;

    function create__createDuration (input, key) {
        var duration = input,
            // matching against regexp is expensive, do it on demand
            match = null,
            sign,
            ret,
            diffRes;

        if (isDuration(input)) {
            duration = {
                ms : input._milliseconds,
                d  : input._days,
                M  : input._months
            };
        } else if (typeof input === 'number') {
            duration = {};
            if (key) {
                duration[key] = input;
            } else {
                duration.milliseconds = input;
            }
        } else if (!!(match = aspNetRegex.exec(input))) {
            sign = (match[1] === '-') ? -1 : 1;
            duration = {
                y  : 0,
                d  : toInt(match[DATE])        * sign,
                h  : toInt(match[HOUR])        * sign,
                m  : toInt(match[MINUTE])      * sign,
                s  : toInt(match[SECOND])      * sign,
                ms : toInt(match[MILLISECOND]) * sign
            };
        } else if (!!(match = create__isoRegex.exec(input))) {
            sign = (match[1] === '-') ? -1 : 1;
            duration = {
                y : parseIso(match[2], sign),
                M : parseIso(match[3], sign),
                d : parseIso(match[4], sign),
                h : parseIso(match[5], sign),
                m : parseIso(match[6], sign),
                s : parseIso(match[7], sign),
                w : parseIso(match[8], sign)
            };
        } else if (duration == null) {// checks for null or undefined
            duration = {};
        } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) {
            diffRes = momentsDifference(local__createLocal(duration.from), local__createLocal(duration.to));

            duration = {};
            duration.ms = diffRes.milliseconds;
            duration.M = diffRes.months;
        }

        ret = new Duration(duration);

        if (isDuration(input) && hasOwnProp(input, '_locale')) {
            ret._locale = input._locale;
        }

        return ret;
    }

    create__createDuration.fn = Duration.prototype;

    function parseIso (inp, sign) {
        // We'd normally use ~~inp for this, but unfortunately it also
        // converts floats to ints.
        // inp may be undefined, so careful calling replace on it.
        var res = inp && parseFloat(inp.replace(',', '.'));
        // apply sign while we're at it
        return (isNaN(res) ? 0 : res) * sign;
    }

    function positiveMomentsDifference(base, other) {
        var res = {milliseconds: 0, months: 0};

        res.months = other.month() - base.month() +
            (other.year() - base.year()) * 12;
        if (base.clone().add(res.months, 'M').isAfter(other)) {
            --res.months;
        }

        res.milliseconds = +other - +(base.clone().add(res.months, 'M'));

        return res;
    }

    function momentsDifference(base, other) {
        var res;
        other = cloneWithOffset(other, base);
        if (base.isBefore(other)) {
            res = positiveMomentsDifference(base, other);
        } else {
            res = positiveMomentsDifference(other, base);
            res.milliseconds = -res.milliseconds;
            res.months = -res.months;
        }

        return res;
    }

    function createAdder(direction, name) {
        return function (val, period) {
            var dur, tmp;
            //invert the arguments, but complain about it
            if (period !== null && !isNaN(+period)) {
                deprecateSimple(name, 'moment().' + name  + '(period, number) is deprecated. Please use moment().' + name + '(number, period).');
                tmp = val; val = period; period = tmp;
            }

            val = typeof val === 'string' ? +val : val;
            dur = create__createDuration(val, period);
            add_subtract__addSubtract(this, dur, direction);
            return this;
        };
    }

    function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) {
        var milliseconds = duration._milliseconds,
            days = duration._days,
            months = duration._months;
        updateOffset = updateOffset == null ? true : updateOffset;

        if (milliseconds) {
            mom._d.setTime(+mom._d + milliseconds * isAdding);
        }
        if (days) {
            get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding);
        }
        if (months) {
            setMonth(mom, get_set__get(mom, 'Month') + months * isAdding);
        }
        if (updateOffset) {
            utils_hooks__hooks.updateOffset(mom, days || months);
        }
    }

    var add_subtract__add      = createAdder(1, 'add');
    var add_subtract__subtract = createAdder(-1, 'subtract');

    function moment_calendar__calendar (time, formats) {
        // We want to compare the start of today, vs this.
        // Getting start-of-today depends on whether we're local/utc/offset or not.
        var now = time || local__createLocal(),
            sod = cloneWithOffset(now, this).startOf('day'),
            diff = this.diff(sod, 'days', true),
            format = diff < -6 ? 'sameElse' :
                diff < -1 ? 'lastWeek' :
                diff < 0 ? 'lastDay' :
                diff < 1 ? 'sameDay' :
                diff < 2 ? 'nextDay' :
                diff < 7 ? 'nextWeek' : 'sameElse';
        return this.format(formats && formats[format] || this.localeData().calendar(format, this, local__createLocal(now)));
    }

    function clone () {
        return new Moment(this);
    }

    function isAfter (input, units) {
        var inputMs;
        units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
        if (units === 'millisecond') {
            input = isMoment(input) ? input : local__createLocal(input);
            return +this > +input;
        } else {
            inputMs = isMoment(input) ? +input : +local__createLocal(input);
            return inputMs < +this.clone().startOf(units);
        }
    }

    function isBefore (input, units) {
        var inputMs;
        units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
        if (units === 'millisecond') {
            input = isMoment(input) ? input : local__createLocal(input);
            return +this < +input;
        } else {
            inputMs = isMoment(input) ? +input : +local__createLocal(input);
            return +this.clone().endOf(units) < inputMs;
        }
    }

    function isBetween (from, to, units) {
        return this.isAfter(from, units) && this.isBefore(to, units);
    }

    function isSame (input, units) {
        var inputMs;
        units = normalizeUnits(units || 'millisecond');
        if (units === 'millisecond') {
            input = isMoment(input) ? input : local__createLocal(input);
            return +this === +input;
        } else {
            inputMs = +local__createLocal(input);
            return +(this.clone().startOf(units)) <= inputMs && inputMs <= +(this.clone().endOf(units));
        }
    }

    function diff (input, units, asFloat) {
        var that = cloneWithOffset(input, this),
            zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4,
            delta, output;

        units = normalizeUnits(units);

        if (units === 'year' || units === 'month' || units === 'quarter') {
            output = monthDiff(this, that);
            if (units === 'quarter') {
                output = output / 3;
            } else if (units === 'year') {
                output = output / 12;
            }
        } else {
            delta = this - that;
            output = units === 'second' ? delta / 1e3 : // 1000
                units === 'minute' ? delta / 6e4 : // 1000 * 60
                units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60
                units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
                units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
                delta;
        }
        return asFloat ? output : absFloor(output);
    }

    function monthDiff (a, b) {
        // difference in months
        var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()),
            // b is in (anchor - 1 month, anchor + 1 month)
            anchor = a.clone().add(wholeMonthDiff, 'months'),
            anchor2, adjust;

        if (b - anchor < 0) {
            anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
            // linear across the month
            adjust = (b - anchor) / (anchor - anchor2);
        } else {
            anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
            // linear across the month
            adjust = (b - anchor) / (anchor2 - anchor);
        }

        return -(wholeMonthDiff + adjust);
    }

    utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';

    function toString () {
        return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
    }

    function moment_format__toISOString () {
        var m = this.clone().utc();
        if (0 < m.year() && m.year() <= 9999) {
            if ('function' === typeof Date.prototype.toISOString) {
                // native implementation is ~50x faster, use it when we can
                return this.toDate().toISOString();
            } else {
                return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
            }
        } else {
            return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
        }
    }

    function format (inputString) {
        var output = formatMoment(this, inputString || utils_hooks__hooks.defaultFormat);
        return this.localeData().postformat(output);
    }

    function from (time, withoutSuffix) {
        if (!this.isValid()) {
            return this.localeData().invalidDate();
        }
        return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
    }

    function fromNow (withoutSuffix) {
        return this.from(local__createLocal(), withoutSuffix);
    }

    function to (time, withoutSuffix) {
        if (!this.isValid()) {
            return this.localeData().invalidDate();
        }
        return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix);
    }

    function toNow (withoutSuffix) {
        return this.to(local__createLocal(), withoutSuffix);
    }

    function locale (key) {
        var newLocaleData;

        if (key === undefined) {
            return this._locale._abbr;
        } else {
            newLocaleData = locale_locales__getLocale(key);
            if (newLocaleData != null) {
                this._locale = newLocaleData;
            }
            return this;
        }
    }

    var lang = deprecate(
        'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
        function (key) {
            if (key === undefined) {
                return this.localeData();
            } else {
                return this.locale(key);
            }
        }
    );

    function localeData () {
        return this._locale;
    }

    function startOf (units) {
        units = normalizeUnits(units);
        // the following switch intentionally omits break keywords
        // to utilize falling through the cases.
        switch (units) {
        case 'year':
            this.month(0);
            /* falls through */
        case 'quarter':
        case 'month':
            this.date(1);
            /* falls through */
        case 'week':
        case 'isoWeek':
        case 'day':
            this.hours(0);
            /* falls through */
        case 'hour':
            this.minutes(0);
            /* falls through */
        case 'minute':
            this.seconds(0);
            /* falls through */
        case 'second':
            this.milliseconds(0);
        }

        // weeks are a special case
        if (units === 'week') {
            this.weekday(0);
        }
        if (units === 'isoWeek') {
            this.isoWeekday(1);
        }

        // quarters are also special
        if (units === 'quarter') {
            this.month(Math.floor(this.month() / 3) * 3);
        }

        return this;
    }

    function endOf (units) {
        units = normalizeUnits(units);
        if (units === undefined || units === 'millisecond') {
            return this;
        }
        return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
    }

    function to_type__valueOf () {
        return +this._d - ((this._offset || 0) * 60000);
    }

    function unix () {
        return Math.floor(+this / 1000);
    }

    function toDate () {
        return this._offset ? new Date(+this) : this._d;
    }

    function toArray () {
        var m = this;
        return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()];
    }

    function toObject () {
        var m = this;
        return {
            years: m.year(),
            months: m.month(),
            date: m.date(),
            hours: m.hours(),
            minutes: m.minutes(),
            seconds: m.seconds(),
            milliseconds: m.milliseconds()
        };
    }

    function moment_valid__isValid () {
        return valid__isValid(this);
    }

    function parsingFlags () {
        return extend({}, getParsingFlags(this));
    }

    function invalidAt () {
        return getParsingFlags(this).overflow;
    }

    addFormatToken(0, ['gg', 2], 0, function () {
        return this.weekYear() % 100;
    });

    addFormatToken(0, ['GG', 2], 0, function () {
        return this.isoWeekYear() % 100;
    });

    function addWeekYearFormatToken (token, getter) {
        addFormatToken(0, [token, token.length], 0, getter);
    }

    addWeekYearFormatToken('gggg',     'weekYear');
    addWeekYearFormatToken('ggggg',    'weekYear');
    addWeekYearFormatToken('GGGG',  'isoWeekYear');
    addWeekYearFormatToken('GGGGG', 'isoWeekYear');

    // ALIASES

    addUnitAlias('weekYear', 'gg');
    addUnitAlias('isoWeekYear', 'GG');

    // PARSING

    addRegexToken('G',      matchSigned);
    addRegexToken('g',      matchSigned);
    addRegexToken('GG',     match1to2, match2);
    addRegexToken('gg',     match1to2, match2);
    addRegexToken('GGGG',   match1to4, match4);
    addRegexToken('gggg',   match1to4, match4);
    addRegexToken('GGGGG',  match1to6, match6);
    addRegexToken('ggggg',  match1to6, match6);

    addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) {
        week[token.substr(0, 2)] = toInt(input);
    });

    addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
        week[token] = utils_hooks__hooks.parseTwoDigitYear(input);
    });

    // HELPERS

    function weeksInYear(year, dow, doy) {
        return weekOfYear(local__createLocal([year, 11, 31 + dow - doy]), dow, doy).week;
    }

    // MOMENTS

    function getSetWeekYear (input) {
        var year = weekOfYear(this, this.localeData()._week.dow, this.localeData()._week.doy).year;
        return input == null ? year : this.add((input - year), 'y');
    }

    function getSetISOWeekYear (input) {
        var year = weekOfYear(this, 1, 4).year;
        return input == null ? year : this.add((input - year), 'y');
    }

    function getISOWeeksInYear () {
        return weeksInYear(this.year(), 1, 4);
    }

    function getWeeksInYear () {
        var weekInfo = this.localeData()._week;
        return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
    }

    addFormatToken('Q', 0, 0, 'quarter');

    // ALIASES

    addUnitAlias('quarter', 'Q');

    // PARSING

    addRegexToken('Q', match1);
    addParseToken('Q', function (input, array) {
        array[MONTH] = (toInt(input) - 1) * 3;
    });

    // MOMENTS

    function getSetQuarter (input) {
        return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
    }

    addFormatToken('D', ['DD', 2], 'Do', 'date');

    // ALIASES

    addUnitAlias('date', 'D');

    // PARSING

    addRegexToken('D',  match1to2);
    addRegexToken('DD', match1to2, match2);
    addRegexToken('Do', function (isStrict, locale) {
        return isStrict ? locale._ordinalParse : locale._ordinalParseLenient;
    });

    addParseToken(['D', 'DD'], DATE);
    addParseToken('Do', function (input, array) {
        array[DATE] = toInt(input.match(match1to2)[0], 10);
    });

    // MOMENTS

    var getSetDayOfMonth = makeGetSet('Date', true);

    addFormatToken('d', 0, 'do', 'day');

    addFormatToken('dd', 0, 0, function (format) {
        return this.localeData().weekdaysMin(this, format);
    });

    addFormatToken('ddd', 0, 0, function (format) {
        return this.localeData().weekdaysShort(this, format);
    });

    addFormatToken('dddd', 0, 0, function (format) {
        return this.localeData().weekdays(this, format);
    });

    addFormatToken('e', 0, 0, 'weekday');
    addFormatToken('E', 0, 0, 'isoWeekday');

    // ALIASES

    addUnitAlias('day', 'd');
    addUnitAlias('weekday', 'e');
    addUnitAlias('isoWeekday', 'E');

    // PARSING

    addRegexToken('d',    match1to2);
    addRegexToken('e',    match1to2);
    addRegexToken('E',    match1to2);
    addRegexToken('dd',   matchWord);
    addRegexToken('ddd',  matchWord);
    addRegexToken('dddd', matchWord);

    addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config) {
        var weekday = config._locale.weekdaysParse(input);
        // if we didn't get a weekday name, mark the date as invalid
        if (weekday != null) {
            week.d = weekday;
        } else {
            getParsingFlags(config).invalidWeekday = input;
        }
    });

    addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
        week[token] = toInt(input);
    });

    // HELPERS

    function parseWeekday(input, locale) {
        if (typeof input !== 'string') {
            return input;
        }

        if (!isNaN(input)) {
            return parseInt(input, 10);
        }

        input = locale.weekdaysParse(input);
        if (typeof input === 'number') {
            return input;
        }

        return null;
    }

    // LOCALES

    var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_');
    function localeWeekdays (m) {
        return this._weekdays[m.day()];
    }

    var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_');
    function localeWeekdaysShort (m) {
        return this._weekdaysShort[m.day()];
    }

    var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_');
    function localeWeekdaysMin (m) {
        return this._weekdaysMin[m.day()];
    }

    function localeWeekdaysParse (weekdayName) {
        var i, mom, regex;

        this._weekdaysParse = this._weekdaysParse || [];

        for (i = 0; i < 7; i++) {
            // make the regex if we don't have it already
            if (!this._weekdaysParse[i]) {
                mom = local__createLocal([2000, 1]).day(i);
                regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
                this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
            }
            // test the regex
            if (this._weekdaysParse[i].test(weekdayName)) {
                return i;
            }
        }
    }

    // MOMENTS

    function getSetDayOfWeek (input) {
        var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
        if (input != null) {
            input = parseWeekday(input, this.localeData());
            return this.add(input - day, 'd');
        } else {
            return day;
        }
    }

    function getSetLocaleDayOfWeek (input) {
        var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
        return input == null ? weekday : this.add(input - weekday, 'd');
    }

    function getSetISODayOfWeek (input) {
        // behaves the same as moment#day except
        // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
        // as a setter, sunday should belong to the previous week.
        return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
    }

    addFormatToken('H', ['HH', 2], 0, 'hour');
    addFormatToken('h', ['hh', 2], 0, function () {
        return this.hours() % 12 || 12;
    });

    function meridiem (token, lowercase) {
        addFormatToken(token, 0, 0, function () {
            return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
        });
    }

    meridiem('a', true);
    meridiem('A', false);

    // ALIASES

    addUnitAlias('hour', 'h');

    // PARSING

    function matchMeridiem (isStrict, locale) {
        return locale._meridiemParse;
    }

    addRegexToken('a',  matchMeridiem);
    addRegexToken('A',  matchMeridiem);
    addRegexToken('H',  match1to2);
    addRegexToken('h',  match1to2);
    addRegexToken('HH', match1to2, match2);
    addRegexToken('hh', match1to2, match2);

    addParseToken(['H', 'HH'], HOUR);
    addParseToken(['a', 'A'], function (input, array, config) {
        config._isPm = config._locale.isPM(input);
        config._meridiem = input;
    });
    addParseToken(['h', 'hh'], function (input, array, config) {
        array[HOUR] = toInt(input);
        getParsingFlags(config).bigHour = true;
    });

    // LOCALES

    function localeIsPM (input) {
        // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
        // Using charAt should be more compatible.
        return ((input + '').toLowerCase().charAt(0) === 'p');
    }

    var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i;
    function localeMeridiem (hours, minutes, isLower) {
        if (hours > 11) {
            return isLower ? 'pm' : 'PM';
        } else {
            return isLower ? 'am' : 'AM';
        }
    }


    // MOMENTS

    // Setting the hour should keep the time, because the user explicitly
    // specified which hour he wants. So trying to maintain the same hour (in
    // a new timezone) makes sense. Adding/subtracting hours does not follow
    // this rule.
    var getSetHour = makeGetSet('Hours', true);

    addFormatToken('m', ['mm', 2], 0, 'minute');

    // ALIASES

    addUnitAlias('minute', 'm');

    // PARSING

    addRegexToken('m',  match1to2);
    addRegexToken('mm', match1to2, match2);
    addParseToken(['m', 'mm'], MINUTE);

    // MOMENTS

    var getSetMinute = makeGetSet('Minutes', false);

    addFormatToken('s', ['ss', 2], 0, 'second');

    // ALIASES

    addUnitAlias('second', 's');

    // PARSING

    addRegexToken('s',  match1to2);
    addRegexToken('ss', match1to2, match2);
    addParseToken(['s', 'ss'], SECOND);

    // MOMENTS

    var getSetSecond = makeGetSet('Seconds', false);

    addFormatToken('S', 0, 0, function () {
        return ~~(this.millisecond() / 100);
    });

    addFormatToken(0, ['SS', 2], 0, function () {
        return ~~(this.millisecond() / 10);
    });

    addFormatToken(0, ['SSS', 3], 0, 'millisecond');
    addFormatToken(0, ['SSSS', 4], 0, function () {
        return this.millisecond() * 10;
    });
    addFormatToken(0, ['SSSSS', 5], 0, function () {
        return this.millisecond() * 100;
    });
    addFormatToken(0, ['SSSSSS', 6], 0, function () {
        return this.millisecond() * 1000;
    });
    addFormatToken(0, ['SSSSSSS', 7], 0, function () {
        return this.millisecond() * 10000;
    });
    addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
        return this.millisecond() * 100000;
    });
    addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
        return this.millisecond() * 1000000;
    });


    // ALIASES

    addUnitAlias('millisecond', 'ms');

    // PARSING

    addRegexToken('S',    match1to3, match1);
    addRegexToken('SS',   match1to3, match2);
    addRegexToken('SSS',  match1to3, match3);

    var token;
    for (token = 'SSSS'; token.length <= 9; token += 'S') {
        addRegexToken(token, matchUnsigned);
    }

    function parseMs(input, array) {
        array[MILLISECOND] = toInt(('0.' + input) * 1000);
    }

    for (token = 'S'; token.length <= 9; token += 'S') {
        addParseToken(token, parseMs);
    }
    // MOMENTS

    var getSetMillisecond = makeGetSet('Milliseconds', false);

    addFormatToken('z',  0, 0, 'zoneAbbr');
    addFormatToken('zz', 0, 0, 'zoneName');

    // MOMENTS

    function getZoneAbbr () {
        return this._isUTC ? 'UTC' : '';
    }

    function getZoneName () {
        return this._isUTC ? 'Coordinated Universal Time' : '';
    }

    var momentPrototype__proto = Moment.prototype;

    momentPrototype__proto.add          = add_subtract__add;
    momentPrototype__proto.calendar     = moment_calendar__calendar;
    momentPrototype__proto.clone        = clone;
    momentPrototype__proto.diff         = diff;
    momentPrototype__proto.endOf        = endOf;
    momentPrototype__proto.format       = format;
    momentPrototype__proto.from         = from;
    momentPrototype__proto.fromNow      = fromNow;
    momentPrototype__proto.to           = to;
    momentPrototype__proto.toNow        = toNow;
    momentPrototype__proto.get          = getSet;
    momentPrototype__proto.invalidAt    = invalidAt;
    momentPrototype__proto.isAfter      = isAfter;
    momentPrototype__proto.isBefore     = isBefore;
    momentPrototype__proto.isBetween    = isBetween;
    momentPrototype__proto.isSame       = isSame;
    momentPrototype__proto.isValid      = moment_valid__isValid;
    momentPrototype__proto.lang         = lang;
    momentPrototype__proto.locale       = locale;
    momentPrototype__proto.localeData   = localeData;
    momentPrototype__proto.max          = prototypeMax;
    momentPrototype__proto.min          = prototypeMin;
    momentPrototype__proto.parsingFlags = parsingFlags;
    momentPrototype__proto.set          = getSet;
    momentPrototype__proto.startOf      = startOf;
    momentPrototype__proto.subtract     = add_subtract__subtract;
    momentPrototype__proto.toArray      = toArray;
    momentPrototype__proto.toObject     = toObject;
    momentPrototype__proto.toDate       = toDate;
    momentPrototype__proto.toISOString  = moment_format__toISOString;
    momentPrototype__proto.toJSON       = moment_format__toISOString;
    momentPrototype__proto.toString     = toString;
    momentPrototype__proto.unix         = unix;
    momentPrototype__proto.valueOf      = to_type__valueOf;

    // Year
    momentPrototype__proto.year       = getSetYear;
    momentPrototype__proto.isLeapYear = getIsLeapYear;

    // Week Year
    momentPrototype__proto.weekYear    = getSetWeekYear;
    momentPrototype__proto.isoWeekYear = getSetISOWeekYear;

    // Quarter
    momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter;

    // Month
    momentPrototype__proto.month       = getSetMonth;
    momentPrototype__proto.daysInMonth = getDaysInMonth;

    // Week
    momentPrototype__proto.week           = momentPrototype__proto.weeks        = getSetWeek;
    momentPrototype__proto.isoWeek        = momentPrototype__proto.isoWeeks     = getSetISOWeek;
    momentPrototype__proto.weeksInYear    = getWeeksInYear;
    momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear;

    // Day
    momentPrototype__proto.date       = getSetDayOfMonth;
    momentPrototype__proto.day        = momentPrototype__proto.days             = getSetDayOfWeek;
    momentPrototype__proto.weekday    = getSetLocaleDayOfWeek;
    momentPrototype__proto.isoWeekday = getSetISODayOfWeek;
    momentPrototype__proto.dayOfYear  = getSetDayOfYear;

    // Hour
    momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour;

    // Minute
    momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute;

    // Second
    momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond;

    // Millisecond
    momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond;

    // Offset
    momentPrototype__proto.utcOffset            = getSetOffset;
    momentPrototype__proto.utc                  = setOffsetToUTC;
    momentPrototype__proto.local                = setOffsetToLocal;
    momentPrototype__proto.parseZone            = setOffsetToParsedOffset;
    momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset;
    momentPrototype__proto.isDST                = isDaylightSavingTime;
    momentPrototype__proto.isDSTShifted         = isDaylightSavingTimeShifted;
    momentPrototype__proto.isLocal              = isLocal;
    momentPrototype__proto.isUtcOffset          = isUtcOffset;
    momentPrototype__proto.isUtc                = isUtc;
    momentPrototype__proto.isUTC                = isUtc;

    // Timezone
    momentPrototype__proto.zoneAbbr = getZoneAbbr;
    momentPrototype__proto.zoneName = getZoneName;

    // Deprecations
    momentPrototype__proto.dates  = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
    momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
    momentPrototype__proto.years  = deprecate('years accessor is deprecated. Use year instead', getSetYear);
    momentPrototype__proto.zone   = deprecate('moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779', getSetZone);

    var momentPrototype = momentPrototype__proto;

    function moment__createUnix (input) {
        return local__createLocal(input * 1000);
    }

    function moment__createInZone () {
        return local__createLocal.apply(null, arguments).parseZone();
    }

    var defaultCalendar = {
        sameDay : '[Today at] LT',
        nextDay : '[Tomorrow at] LT',
        nextWeek : 'dddd [at] LT',
        lastDay : '[Yesterday at] LT',
        lastWeek : '[Last] dddd [at] LT',
        sameElse : 'L'
    };

    function locale_calendar__calendar (key, mom, now) {
        var output = this._calendar[key];
        return typeof output === 'function' ? output.call(mom, now) : output;
    }

    var defaultLongDateFormat = {
        LTS  : 'h:mm:ss A',
        LT   : 'h:mm A',
        L    : 'MM/DD/YYYY',
        LL   : 'MMMM D, YYYY',
        LLL  : 'MMMM D, YYYY h:mm A',
        LLLL : 'dddd, MMMM D, YYYY h:mm A'
    };

    function longDateFormat (key) {
        var format = this._longDateFormat[key],
            formatUpper = this._longDateFormat[key.toUpperCase()];

        if (format || !formatUpper) {
            return format;
        }

        this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) {
            return val.slice(1);
        });

        return this._longDateFormat[key];
    }

    var defaultInvalidDate = 'Invalid date';

    function invalidDate () {
        return this._invalidDate;
    }

    var defaultOrdinal = '%d';
    var defaultOrdinalParse = /\d{1,2}/;

    function ordinal (number) {
        return this._ordinal.replace('%d', number);
    }

    function preParsePostFormat (string) {
        return string;
    }

    var defaultRelativeTime = {
        future : 'in %s',
        past   : '%s ago',
        s  : 'a few seconds',
        m  : 'a minute',
        mm : '%d minutes',
        h  : 'an hour',
        hh : '%d hours',
        d  : 'a day',
        dd : '%d days',
        M  : 'a month',
        MM : '%d months',
        y  : 'a year',
        yy : '%d years'
    };

    function relative__relativeTime (number, withoutSuffix, string, isFuture) {
        var output = this._relativeTime[string];
        return (typeof output === 'function') ?
            output(number, withoutSuffix, string, isFuture) :
            output.replace(/%d/i, number);
    }

    function pastFuture (diff, output) {
        var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
        return typeof format === 'function' ? format(output) : format.replace(/%s/i, output);
    }

    function locale_set__set (config) {
        var prop, i;
        for (i in config) {
            prop = config[i];
            if (typeof prop === 'function') {
                this[i] = prop;
            } else {
                this['_' + i] = prop;
            }
        }
        // Lenient ordinal parsing accepts just a number in addition to
        // number + (possibly) stuff coming from _ordinalParseLenient.
        this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source);
    }

    var prototype__proto = Locale.prototype;

    prototype__proto._calendar       = defaultCalendar;
    prototype__proto.calendar        = locale_calendar__calendar;
    prototype__proto._longDateFormat = defaultLongDateFormat;
    prototype__proto.longDateFormat  = longDateFormat;
    prototype__proto._invalidDate    = defaultInvalidDate;
    prototype__proto.invalidDate     = invalidDate;
    prototype__proto._ordinal        = defaultOrdinal;
    prototype__proto.ordinal         = ordinal;
    prototype__proto._ordinalParse   = defaultOrdinalParse;
    prototype__proto.preparse        = preParsePostFormat;
    prototype__proto.postformat      = preParsePostFormat;
    prototype__proto._relativeTime   = defaultRelativeTime;
    prototype__proto.relativeTime    = relative__relativeTime;
    prototype__proto.pastFuture      = pastFuture;
    prototype__proto.set             = locale_set__set;

    // Month
    prototype__proto.months       =        localeMonths;
    prototype__proto._months      = defaultLocaleMonths;
    prototype__proto.monthsShort  =        localeMonthsShort;
    prototype__proto._monthsShort = defaultLocaleMonthsShort;
    prototype__proto.monthsParse  =        localeMonthsParse;

    // Week
    prototype__proto.week = localeWeek;
    prototype__proto._week = defaultLocaleWeek;
    prototype__proto.firstDayOfYear = localeFirstDayOfYear;
    prototype__proto.firstDayOfWeek = localeFirstDayOfWeek;

    // Day of Week
    prototype__proto.weekdays       =        localeWeekdays;
    prototype__proto._weekdays      = defaultLocaleWeekdays;
    prototype__proto.weekdaysMin    =        localeWeekdaysMin;
    prototype__proto._weekdaysMin   = defaultLocaleWeekdaysMin;
    prototype__proto.weekdaysShort  =        localeWeekdaysShort;
    prototype__proto._weekdaysShort = defaultLocaleWeekdaysShort;
    prototype__proto.weekdaysParse  =        localeWeekdaysParse;

    // Hours
    prototype__proto.isPM = localeIsPM;
    prototype__proto._meridiemParse = defaultLocaleMeridiemParse;
    prototype__proto.meridiem = localeMeridiem;

    function lists__get (format, index, field, setter) {
        var locale = locale_locales__getLocale();
        var utc = create_utc__createUTC().set(setter, index);
        return locale[field](utc, format);
    }

    function list (format, index, field, count, setter) {
        if (typeof format === 'number') {
            index = format;
            format = undefined;
        }

        format = format || '';

        if (index != null) {
            return lists__get(format, index, field, setter);
        }

        var i;
        var out = [];
        for (i = 0; i < count; i++) {
            out[i] = lists__get(format, i, field, setter);
        }
        return out;
    }

    function lists__listMonths (format, index) {
        return list(format, index, 'months', 12, 'month');
    }

    function lists__listMonthsShort (format, index) {
        return list(format, index, 'monthsShort', 12, 'month');
    }

    function lists__listWeekdays (format, index) {
        return list(format, index, 'weekdays', 7, 'day');
    }

    function lists__listWeekdaysShort (format, index) {
        return list(format, index, 'weekdaysShort', 7, 'day');
    }

    function lists__listWeekdaysMin (format, index) {
        return list(format, index, 'weekdaysMin', 7, 'day');
    }

    locale_locales__getSetGlobalLocale('en', {
        ordinalParse: /\d{1,2}(th|st|nd|rd)/,
        ordinal : function (number) {
            var b = number % 10,
                output = (toInt(number % 100 / 10) === 1) ? 'th' :
                (b === 1) ? 'st' :
                (b === 2) ? 'nd' :
                (b === 3) ? 'rd' : 'th';
            return number + output;
        }
    });

    // Side effect imports
    utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale);
    utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale);

    var mathAbs = Math.abs;

    function duration_abs__abs () {
        var data           = this._data;

        this._milliseconds = mathAbs(this._milliseconds);
        this._days         = mathAbs(this._days);
        this._months       = mathAbs(this._months);

        data.milliseconds  = mathAbs(data.milliseconds);
        data.seconds       = mathAbs(data.seconds);
        data.minutes       = mathAbs(data.minutes);
        data.hours         = mathAbs(data.hours);
        data.months        = mathAbs(data.months);
        data.years         = mathAbs(data.years);

        return this;
    }

    function duration_add_subtract__addSubtract (duration, input, value, direction) {
        var other = create__createDuration(input, value);

        duration._milliseconds += direction * other._milliseconds;
        duration._days         += direction * other._days;
        duration._months       += direction * other._months;

        return duration._bubble();
    }

    // supports only 2.0-style add(1, 's') or add(duration)
    function duration_add_subtract__add (input, value) {
        return duration_add_subtract__addSubtract(this, input, value, 1);
    }

    // supports only 2.0-style subtract(1, 's') or subtract(duration)
    function duration_add_subtract__subtract (input, value) {
        return duration_add_subtract__addSubtract(this, input, value, -1);
    }

    function absCeil (number) {
        if (number < 0) {
            return Math.floor(number);
        } else {
            return Math.ceil(number);
        }
    }

    function bubble () {
        var milliseconds = this._milliseconds;
        var days         = this._days;
        var months       = this._months;
        var data         = this._data;
        var seconds, minutes, hours, years, monthsFromDays;

        // if we have a mix of positive and negative values, bubble down first
        // check: https://github.com/moment/moment/issues/2166
        if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
                (milliseconds <= 0 && days <= 0 && months <= 0))) {
            milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
            days = 0;
            months = 0;
        }

        // The following code bubbles up values, see the tests for
        // examples of what that means.
        data.milliseconds = milliseconds % 1000;

        seconds           = absFloor(milliseconds / 1000);
        data.seconds      = seconds % 60;

        minutes           = absFloor(seconds / 60);
        data.minutes      = minutes % 60;

        hours             = absFloor(minutes / 60);
        data.hours        = hours % 24;

        days += absFloor(hours / 24);

        // convert days to months
        monthsFromDays = absFloor(daysToMonths(days));
        months += monthsFromDays;
        days -= absCeil(monthsToDays(monthsFromDays));

        // 12 months -> 1 year
        years = absFloor(months / 12);
        months %= 12;

        data.days   = days;
        data.months = months;
        data.years  = years;

        return this;
    }

    function daysToMonths (days) {
        // 400 years have 146097 days (taking into account leap year rules)
        // 400 years have 12 months === 4800
        return days * 4800 / 146097;
    }

    function monthsToDays (months) {
        // the reverse of daysToMonths
        return months * 146097 / 4800;
    }

    function as (units) {
        var days;
        var months;
        var milliseconds = this._milliseconds;

        units = normalizeUnits(units);

        if (units === 'month' || units === 'year') {
            days   = this._days   + milliseconds / 864e5;
            months = this._months + daysToMonths(days);
            return units === 'month' ? months : months / 12;
        } else {
            // handle milliseconds separately because of floating point math errors (issue #1867)
            days = this._days + Math.round(monthsToDays(this._months));
            switch (units) {
                case 'week'   : return days / 7     + milliseconds / 6048e5;
                case 'day'    : return days         + milliseconds / 864e5;
                case 'hour'   : return days * 24    + milliseconds / 36e5;
                case 'minute' : return days * 1440  + milliseconds / 6e4;
                case 'second' : return days * 86400 + milliseconds / 1000;
                // Math.floor prevents floating point math errors here
                case 'millisecond': return Math.floor(days * 864e5) + milliseconds;
                default: throw new Error('Unknown unit ' + units);
            }
        }
    }

    // TODO: Use this.as('ms')?
    function duration_as__valueOf () {
        return (
            this._milliseconds +
            this._days * 864e5 +
            (this._months % 12) * 2592e6 +
            toInt(this._months / 12) * 31536e6
        );
    }

    function makeAs (alias) {
        return function () {
            return this.as(alias);
        };
    }

    var asMilliseconds = makeAs('ms');
    var asSeconds      = makeAs('s');
    var asMinutes      = makeAs('m');
    var asHours        = makeAs('h');
    var asDays         = makeAs('d');
    var asWeeks        = makeAs('w');
    var asMonths       = makeAs('M');
    var asYears        = makeAs('y');

    function duration_get__get (units) {
        units = normalizeUnits(units);
        return this[units + 's']();
    }

    function makeGetter(name) {
        return function () {
            return this._data[name];
        };
    }

    var milliseconds = makeGetter('milliseconds');
    var seconds      = makeGetter('seconds');
    var minutes      = makeGetter('minutes');
    var hours        = makeGetter('hours');
    var days         = makeGetter('days');
    var months       = makeGetter('months');
    var years        = makeGetter('years');

    function weeks () {
        return absFloor(this.days() / 7);
    }

    var round = Math.round;
    var thresholds = {
        s: 45,  // seconds to minute
        m: 45,  // minutes to hour
        h: 22,  // hours to day
        d: 26,  // days to month
        M: 11   // months to year
    };

    // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
    function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
        return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
    }

    function duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) {
        var duration = create__createDuration(posNegDuration).abs();
        var seconds  = round(duration.as('s'));
        var minutes  = round(duration.as('m'));
        var hours    = round(duration.as('h'));
        var days     = round(duration.as('d'));
        var months   = round(duration.as('M'));
        var years    = round(duration.as('y'));

        var a = seconds < thresholds.s && ['s', seconds]  ||
                minutes === 1          && ['m']           ||
                minutes < thresholds.m && ['mm', minutes] ||
                hours   === 1          && ['h']           ||
                hours   < thresholds.h && ['hh', hours]   ||
                days    === 1          && ['d']           ||
                days    < thresholds.d && ['dd', days]    ||
                months  === 1          && ['M']           ||
                months  < thresholds.M && ['MM', months]  ||
                years   === 1          && ['y']           || ['yy', years];

        a[2] = withoutSuffix;
        a[3] = +posNegDuration > 0;
        a[4] = locale;
        return substituteTimeAgo.apply(null, a);
    }

    // This function allows you to set a threshold for relative time strings
    function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) {
        if (thresholds[threshold] === undefined) {
            return false;
        }
        if (limit === undefined) {
            return thresholds[threshold];
        }
        thresholds[threshold] = limit;
        return true;
    }

    function humanize (withSuffix) {
        var locale = this.localeData();
        var output = duration_humanize__relativeTime(this, !withSuffix, locale);

        if (withSuffix) {
            output = locale.pastFuture(+this, output);
        }

        return locale.postformat(output);
    }

    var iso_string__abs = Math.abs;

    function iso_string__toISOString() {
        // for ISO strings we do not use the normal bubbling rules:
        //  * milliseconds bubble up until they become hours
        //  * days do not bubble at all
        //  * months bubble up until they become years
        // This is because there is no context-free conversion between hours and days
        // (think of clock changes)
        // and also not between days and months (28-31 days per month)
        var seconds = iso_string__abs(this._milliseconds) / 1000;
        var days         = iso_string__abs(this._days);
        var months       = iso_string__abs(this._months);
        var minutes, hours, years;

        // 3600 seconds -> 60 minutes -> 1 hour
        minutes           = absFloor(seconds / 60);
        hours             = absFloor(minutes / 60);
        seconds %= 60;
        minutes %= 60;

        // 12 months -> 1 year
        years  = absFloor(months / 12);
        months %= 12;


        // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
        var Y = years;
        var M = months;
        var D = days;
        var h = hours;
        var m = minutes;
        var s = seconds;
        var total = this.asSeconds();

        if (!total) {
            // this is the same as C#'s (Noda) and python (isodate)...
            // but not other JS (goog.date)
            return 'P0D';
        }

        return (total < 0 ? '-' : '') +
            'P' +
            (Y ? Y + 'Y' : '') +
            (M ? M + 'M' : '') +
            (D ? D + 'D' : '') +
            ((h || m || s) ? 'T' : '') +
            (h ? h + 'H' : '') +
            (m ? m + 'M' : '') +
            (s ? s + 'S' : '');
    }

    var duration_prototype__proto = Duration.prototype;

    duration_prototype__proto.abs            = duration_abs__abs;
    duration_prototype__proto.add            = duration_add_subtract__add;
    duration_prototype__proto.subtract       = duration_add_subtract__subtract;
    duration_prototype__proto.as             = as;
    duration_prototype__proto.asMilliseconds = asMilliseconds;
    duration_prototype__proto.asSeconds      = asSeconds;
    duration_prototype__proto.asMinutes      = asMinutes;
    duration_prototype__proto.asHours        = asHours;
    duration_prototype__proto.asDays         = asDays;
    duration_prototype__proto.asWeeks        = asWeeks;
    duration_prototype__proto.asMonths       = asMonths;
    duration_prototype__proto.asYears        = asYears;
    duration_prototype__proto.valueOf        = duration_as__valueOf;
    duration_prototype__proto._bubble        = bubble;
    duration_prototype__proto.get            = duration_get__get;
    duration_prototype__proto.milliseconds   = milliseconds;
    duration_prototype__proto.seconds        = seconds;
    duration_prototype__proto.minutes        = minutes;
    duration_prototype__proto.hours          = hours;
    duration_prototype__proto.days           = days;
    duration_prototype__proto.weeks          = weeks;
    duration_prototype__proto.months         = months;
    duration_prototype__proto.years          = years;
    duration_prototype__proto.humanize       = humanize;
    duration_prototype__proto.toISOString    = iso_string__toISOString;
    duration_prototype__proto.toString       = iso_string__toISOString;
    duration_prototype__proto.toJSON         = iso_string__toISOString;
    duration_prototype__proto.locale         = locale;
    duration_prototype__proto.localeData     = localeData;

    // Deprecations
    duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString);
    duration_prototype__proto.lang = lang;

    // Side effect imports

    addFormatToken('X', 0, 0, 'unix');
    addFormatToken('x', 0, 0, 'valueOf');

    // PARSING

    addRegexToken('x', matchSigned);
    addRegexToken('X', matchTimestamp);
    addParseToken('X', function (input, array, config) {
        config._d = new Date(parseFloat(input, 10) * 1000);
    });
    addParseToken('x', function (input, array, config) {
        config._d = new Date(toInt(input));
    });

    // Side effect imports


    utils_hooks__hooks.version = '2.10.6';

    setHookCallback(local__createLocal);

    utils_hooks__hooks.fn                    = momentPrototype;
    utils_hooks__hooks.min                   = min;
    utils_hooks__hooks.max                   = max;
    utils_hooks__hooks.utc                   = create_utc__createUTC;
    utils_hooks__hooks.unix                  = moment__createUnix;
    utils_hooks__hooks.months                = lists__listMonths;
    utils_hooks__hooks.isDate                = isDate;
    utils_hooks__hooks.locale                = locale_locales__getSetGlobalLocale;
    utils_hooks__hooks.invalid               = valid__createInvalid;
    utils_hooks__hooks.duration              = create__createDuration;
    utils_hooks__hooks.isMoment              = isMoment;
    utils_hooks__hooks.weekdays              = lists__listWeekdays;
    utils_hooks__hooks.parseZone             = moment__createInZone;
    utils_hooks__hooks.localeData            = locale_locales__getLocale;
    utils_hooks__hooks.isDuration            = isDuration;
    utils_hooks__hooks.monthsShort           = lists__listMonthsShort;
    utils_hooks__hooks.weekdaysMin           = lists__listWeekdaysMin;
    utils_hooks__hooks.defineLocale          = defineLocale;
    utils_hooks__hooks.weekdaysShort         = lists__listWeekdaysShort;
    utils_hooks__hooks.normalizeUnits        = normalizeUnits;
    utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold;

    var _moment = utils_hooks__hooks;

    return _moment;

}));
//! moment-timezone.js
//! version : 0.5.33
//! Copyright (c) JS Foundation and other contributors
//! license : MIT
//! github.com/moment/moment-timezone

(function (root, factory) {
	"use strict";

	/*global define*/
	if (typeof module === 'object' && module.exports) {
		module.exports = factory(require('moment')); // Node
	} else if (typeof define === 'function' && define.amd) {
		define('momenttimezone',['moment'], factory);                 // AMD
	} else {
		factory(root.moment);                        // Browser
	}
}(this, function (moment) {
	"use strict";

	// Resolves es6 module loading issue
	if (moment.version === undefined && moment.default) {
		moment = moment.default;
	}

	// Do not load moment-timezone a second time.
	// if (moment.tz !== undefined) {
	// 	logError('Moment Timezone ' + moment.tz.version + ' was already loaded ' + (moment.tz.dataVersion ? 'with data from ' : 'without any data') + moment.tz.dataVersion);
	// 	return moment;
	// }

	var VERSION = "0.5.33",
		zones = {},
		links = {},
		countries = {},
		names = {},
		guesses = {},
		cachedGuess;

	if (!moment || typeof moment.version !== 'string') {
		logError('Moment Timezone requires Moment.js. See https://momentjs.com/timezone/docs/#/use-it/browser/');
	}

	var momentVersion = moment.version.split('.'),
		major = +momentVersion[0],
		minor = +momentVersion[1];

	// Moment.js version check
	if (major < 2 || (major === 2 && minor < 6)) {
		logError('Moment Timezone requires Moment.js >= 2.6.0. You are using Moment.js ' + moment.version + '. See momentjs.com');
	}

	/************************************
		Unpacking
	************************************/

	function charCodeToInt(charCode) {
		if (charCode > 96) {
			return charCode - 87;
		} else if (charCode > 64) {
			return charCode - 29;
		}
		return charCode - 48;
	}

	function unpackBase60(string) {
		var i = 0,
			parts = string.split('.'),
			whole = parts[0],
			fractional = parts[1] || '',
			multiplier = 1,
			num,
			out = 0,
			sign = 1;

		// handle negative numbers
		if (string.charCodeAt(0) === 45) {
			i = 1;
			sign = -1;
		}

		// handle digits before the decimal
		for (i; i < whole.length; i++) {
			num = charCodeToInt(whole.charCodeAt(i));
			out = 60 * out + num;
		}

		// handle digits after the decimal
		for (i = 0; i < fractional.length; i++) {
			multiplier = multiplier / 60;
			num = charCodeToInt(fractional.charCodeAt(i));
			out += num * multiplier;
		}

		return out * sign;
	}

	function arrayToInt (array) {
		for (var i = 0; i < array.length; i++) {
			array[i] = unpackBase60(array[i]);
		}
	}

	function intToUntil (array, length) {
		for (var i = 0; i < length; i++) {
			array[i] = Math.round((array[i - 1] || 0) + (array[i] * 60000)); // minutes to milliseconds
		}

		array[length - 1] = Infinity;
	}

	function mapIndices (source, indices) {
		var out = [], i;

		for (i = 0; i < indices.length; i++) {
			out[i] = source[indices[i]];
		}

		return out;
	}

	function unpack (string) {
		var data = string.split('|'),
			offsets = data[2].split(' '),
			indices = data[3].split(''),
			untils  = data[4].split(' ');

		arrayToInt(offsets);
		arrayToInt(indices);
		arrayToInt(untils);

		intToUntil(untils, indices.length);

		return {
			name       : data[0],
			abbrs      : mapIndices(data[1].split(' '), indices),
			offsets    : mapIndices(offsets, indices),
			untils     : untils,
			population : data[5] | 0
		};
	}

	/************************************
		Zone object
	************************************/

	function Zone (packedString) {
		if (packedString) {
			this._set(unpack(packedString));
		}
	}

	Zone.prototype = {
		_set : function (unpacked) {
			this.name       = unpacked.name;
			this.abbrs      = unpacked.abbrs;
			this.untils     = unpacked.untils;
			this.offsets    = unpacked.offsets;
			this.population = unpacked.population;
		},

		_index : function (timestamp) {
			var target = +timestamp,
				untils = this.untils,
				i;

			for (i = 0; i < untils.length; i++) {
				if (target < untils[i]) {
					return i;
				}
			}
		},

		countries : function () {
			var zone_name = this.name;
			return Object.keys(countries).filter(function (country_code) {
				return countries[country_code].zones.indexOf(zone_name) !== -1;
			});
		},

		parse : function (timestamp) {
			var target  = +timestamp,
				offsets = this.offsets,
				untils  = this.untils,
				max     = untils.length - 1,
				offset, offsetNext, offsetPrev, i;

			for (i = 0; i < max; i++) {
				offset     = offsets[i];
				offsetNext = offsets[i + 1];
				offsetPrev = offsets[i ? i - 1 : i];

				if (offset < offsetNext && tz.moveAmbiguousForward) {
					offset = offsetNext;
				} else if (offset > offsetPrev && tz.moveInvalidForward) {
					offset = offsetPrev;
				}

				if (target < untils[i] - (offset * 60000)) {
					return offsets[i];
				}
			}

			return offsets[max];
		},

		abbr : function (mom) {
			return this.abbrs[this._index(mom)];
		},

		offset : function (mom) {
			logError("zone.offset has been deprecated in favor of zone.utcOffset");
			return this.offsets[this._index(mom)];
		},

		utcOffset : function (mom) {
			return this.offsets[this._index(mom)];
		}
	};

	/************************************
		Country object
	************************************/

	function Country (country_name, zone_names) {
		this.name = country_name;
		this.zones = zone_names;
	}

	/************************************
		Current Timezone
	************************************/

	function OffsetAt(at) {
		var timeString = at.toTimeString();
		var abbr = timeString.match(/\([a-z ]+\)/i);
		if (abbr && abbr[0]) {
			// 17:56:31 GMT-0600 (CST)
			// 17:56:31 GMT-0600 (Central Standard Time)
			abbr = abbr[0].match(/[A-Z]/g);
			abbr = abbr ? abbr.join('') : undefined;
		} else {
			// 17:56:31 CST
			// 17:56:31 GMT+0800 (台北標準時間)
			abbr = timeString.match(/[A-Z]{3,5}/g);
			abbr = abbr ? abbr[0] : undefined;
		}

		if (abbr === 'GMT') {
			abbr = undefined;
		}

		this.at = +at;
		this.abbr = abbr;
		this.offset = at.getTimezoneOffset();
	}

	function ZoneScore(zone) {
		this.zone = zone;
		this.offsetScore = 0;
		this.abbrScore = 0;
	}

	ZoneScore.prototype.scoreOffsetAt = function (offsetAt) {
		this.offsetScore += Math.abs(this.zone.utcOffset(offsetAt.at) - offsetAt.offset);
		if (this.zone.abbr(offsetAt.at).replace(/[^A-Z]/g, '') !== offsetAt.abbr) {
			this.abbrScore++;
		}
	};

	function findChange(low, high) {
		var mid, diff;

		while ((diff = ((high.at - low.at) / 12e4 | 0) * 6e4)) {
			mid = new OffsetAt(new Date(low.at + diff));
			if (mid.offset === low.offset) {
				low = mid;
			} else {
				high = mid;
			}
		}

		return low;
	}

	function userOffsets() {
		var startYear = new Date().getFullYear() - 2,
			last = new OffsetAt(new Date(startYear, 0, 1)),
			offsets = [last],
			change, next, i;

		for (i = 1; i < 48; i++) {
			next = new OffsetAt(new Date(startYear, i, 1));
			if (next.offset !== last.offset) {
				change = findChange(last, next);
				offsets.push(change);
				offsets.push(new OffsetAt(new Date(change.at + 6e4)));
			}
			last = next;
		}

		for (i = 0; i < 4; i++) {
			offsets.push(new OffsetAt(new Date(startYear + i, 0, 1)));
			offsets.push(new OffsetAt(new Date(startYear + i, 6, 1)));
		}

		return offsets;
	}

	function sortZoneScores (a, b) {
		if (a.offsetScore !== b.offsetScore) {
			return a.offsetScore - b.offsetScore;
		}
		if (a.abbrScore !== b.abbrScore) {
			return a.abbrScore - b.abbrScore;
		}
		if (a.zone.population !== b.zone.population) {
			return b.zone.population - a.zone.population;
		}
		return b.zone.name.localeCompare(a.zone.name);
	}

	function addToGuesses (name, offsets) {
		var i, offset;
		arrayToInt(offsets);
		for (i = 0; i < offsets.length; i++) {
			offset = offsets[i];
			guesses[offset] = guesses[offset] || {};
			guesses[offset][name] = true;
		}
	}

	function guessesForUserOffsets (offsets) {
		var offsetsLength = offsets.length,
			filteredGuesses = {},
			out = [],
			i, j, guessesOffset;

		for (i = 0; i < offsetsLength; i++) {
			guessesOffset = guesses[offsets[i].offset] || {};
			for (j in guessesOffset) {
				if (guessesOffset.hasOwnProperty(j)) {
					filteredGuesses[j] = true;
				}
			}
		}

		for (i in filteredGuesses) {
			if (filteredGuesses.hasOwnProperty(i)) {
				out.push(names[i]);
			}
		}

		return out;
	}

	function rebuildGuess () {

		// use Intl API when available and returning valid time zone
		try {
			var intlName = Intl.DateTimeFormat().resolvedOptions().timeZone;
			if (intlName && intlName.length > 3) {
				var name = names[normalizeName(intlName)];
				if (name) {
					return name;
				}
				logError("Moment Timezone found " + intlName + " from the Intl api, but did not have that data loaded.");
			}
		} catch (e) {
			// Intl unavailable, fall back to manual guessing.
		}

		var offsets = userOffsets(),
			offsetsLength = offsets.length,
			guesses = guessesForUserOffsets(offsets),
			zoneScores = [],
			zoneScore, i, j;

		for (i = 0; i < guesses.length; i++) {
			zoneScore = new ZoneScore(getZone(guesses[i]), offsetsLength);
			for (j = 0; j < offsetsLength; j++) {
				zoneScore.scoreOffsetAt(offsets[j]);
			}
			zoneScores.push(zoneScore);
		}

		zoneScores.sort(sortZoneScores);

		return zoneScores.length > 0 ? zoneScores[0].zone.name : undefined;
	}

	function guess (ignoreCache) {
		if (!cachedGuess || ignoreCache) {
			cachedGuess = rebuildGuess();
		}
		return cachedGuess;
	}

	/************************************
		Global Methods
	************************************/

	function normalizeName (name) {
		return (name || '').toLowerCase().replace(/\//g, '_');
	}

	function addZone (packed) {
		var i, name, split, normalized;

		if (typeof packed === "string") {
			packed = [packed];
		}

		for (i = 0; i < packed.length; i++) {
			split = packed[i].split('|');
			name = split[0];
			normalized = normalizeName(name);
			zones[normalized] = packed[i];
			names[normalized] = name;
			addToGuesses(normalized, split[2].split(' '));
		}
	}

	function getZone (name, caller) {

		name = normalizeName(name);

		var zone = zones[name];
		var link;

		if (zone instanceof Zone) {
			return zone;
		}

		if (typeof zone === 'string') {
			zone = new Zone(zone);
			zones[name] = zone;
			return zone;
		}

		// Pass getZone to prevent recursion more than 1 level deep
		if (links[name] && caller !== getZone && (link = getZone(links[name], getZone))) {
			zone = zones[name] = new Zone();
			zone._set(link);
			zone.name = names[name];
			return zone;
		}

		return null;
	}

	function getNames () {
		var i, out = [];

		for (i in names) {
			if (names.hasOwnProperty(i) && (zones[i] || zones[links[i]]) && names[i]) {
				out.push(names[i]);
			}
		}

		return out.sort();
	}

	function getCountryNames () {
		return Object.keys(countries);
	}

	function addLink (aliases) {
		var i, alias, normal0, normal1;

		if (typeof aliases === "string") {
			aliases = [aliases];
		}

		for (i = 0; i < aliases.length; i++) {
			alias = aliases[i].split('|');

			normal0 = normalizeName(alias[0]);
			normal1 = normalizeName(alias[1]);

			links[normal0] = normal1;
			names[normal0] = alias[0];

			links[normal1] = normal0;
			names[normal1] = alias[1];
		}
	}

	function addCountries (data) {
		var i, country_code, country_zones, split;
		if (!data || !data.length) return;
		for (i = 0; i < data.length; i++) {
			split = data[i].split('|');
			country_code = split[0].toUpperCase();
			country_zones = split[1].split(' ');
			countries[country_code] = new Country(
				country_code,
				country_zones
			);
		}
	}

	function getCountry (name) {
		name = name.toUpperCase();
		return countries[name] || null;
	}

	function zonesForCountry(country, with_offset) {
		country = getCountry(country);

		if (!country) return null;

		var zones = country.zones.sort();

		if (with_offset) {
			return zones.map(function (zone_name) {
				var zone = getZone(zone_name);
				return {
					name: zone_name,
					offset: zone.utcOffset(new Date())
				};
			});
		}

		return zones;
	}

	function loadData (data) {
		addZone(data.zones);
		addLink(data.links);
		addCountries(data.countries);
		tz.dataVersion = data.version;
	}

	function zoneExists (name) {
		if (!zoneExists.didShowError) {
			zoneExists.didShowError = true;
				logError("moment.tz.zoneExists('" + name + "') has been deprecated in favor of !moment.tz.zone('" + name + "')");
		}
		return !!getZone(name);
	}

	function needsOffset (m) {
		var isUnixTimestamp = (m._f === 'X' || m._f === 'x');
		return !!(m._a && (m._tzm === undefined) && !isUnixTimestamp);
	}

	function logError (message) {
		if (typeof console !== 'undefined' && typeof console.error === 'function') {
			console.error(message);
		}
	}

	/************************************
		moment.tz namespace
	************************************/

	function tz (input) {
		var args = Array.prototype.slice.call(arguments, 0, -1),
			name = arguments[arguments.length - 1],
			zone = getZone(name),
			out  = moment.utc.apply(null, args);

		if (zone && !moment.isMoment(input) && needsOffset(out)) {
			out.add(zone.parse(out), 'minutes');
		}

		out.tz(name);

		return out;
	}

	tz.version      = VERSION;
	tz.dataVersion  = '';
	tz._zones       = zones;
	tz._links       = links;
	tz._names       = names;
	tz._countries	= countries;
	tz.add          = addZone;
	tz.link         = addLink;
	tz.load         = loadData;
	tz.zone         = getZone;
	tz.zoneExists   = zoneExists; // deprecated in 0.1.0
	tz.guess        = guess;
	tz.names        = getNames;
	tz.Zone         = Zone;
	tz.unpack       = unpack;
	tz.unpackBase60 = unpackBase60;
	tz.needsOffset  = needsOffset;
	tz.moveInvalidForward   = true;
	tz.moveAmbiguousForward = false;
	tz.countries    = getCountryNames;
	tz.zonesForCountry = zonesForCountry;

	/************************************
		Interface with Moment.js
	************************************/

	var fn = moment.fn;

	moment.tz = tz;

	moment.defaultZone = null;

	moment.updateOffset = function (mom, keepTime) {
		var zone = moment.defaultZone,
			offset;

		if (mom._z === undefined) {
			if (zone && needsOffset(mom) && !mom._isUTC) {
				mom._d = moment.utc(mom._a)._d;
				mom.utc().add(zone.parse(mom), 'minutes');
			}
			mom._z = zone;
		}
		if (mom._z) {
			offset = mom._z.utcOffset(mom);
			if (Math.abs(offset) < 16) {
				offset = offset / 60;
			}
			if (mom.utcOffset !== undefined) {
				var z = mom._z;
				mom.utcOffset(-offset, keepTime);
				mom._z = z;
			} else {
				mom.zone(offset, keepTime);
			}
		}
	};

	fn.tz = function (name, keepTime) {
		if (name) {
			if (typeof name !== 'string') {
				throw new Error('Time zone name must be a string, got ' + name + ' [' + typeof name + ']');
			}
			this._z = getZone(name);
			if (this._z) {
				moment.updateOffset(this, keepTime);
			} else {
				logError("Moment Timezone has no data for " + name + ". See http://momentjs.com/timezone/docs/#/data-loading/.");
			}
			return this;
		}
		if (this._z) { return this._z.name; }
	};

	function abbrWrap (old) {
		return function () {
			if (this._z) { return this._z.abbr(this); }
			return old.call(this);
		};
	}

	function resetZoneWrap (old) {
		return function () {
			this._z = null;
			return old.apply(this, arguments);
		};
	}

	function resetZoneWrap2 (old) {
		return function () {
			if (arguments.length > 0) this._z = null;
			return old.apply(this, arguments);
		};
	}

	fn.zoneName  = abbrWrap(fn.zoneName);
	fn.zoneAbbr  = abbrWrap(fn.zoneAbbr);
	fn.utc       = resetZoneWrap(fn.utc);
	fn.local     = resetZoneWrap(fn.local);
	fn.utcOffset = resetZoneWrap2(fn.utcOffset);

	moment.tz.setDefault = function(name) {
		if (major < 2 || (major === 2 && minor < 9)) {
			logError('Moment Timezone setDefault() requires Moment.js >= 2.9.0. You are using Moment.js ' + moment.version + '.');
		}
		moment.defaultZone = name ? getZone(name) : null;
		return moment;
	};

	// Cloning a moment should include the _z property.
	var momentProperties = moment.momentProperties;
	if (Object.prototype.toString.call(momentProperties) === '[object Array]') {
		// moment 2.8.1+
		momentProperties.push('_z');
		momentProperties.push('_a');
	} else if (momentProperties) {
		// moment 2.7.0
		momentProperties._z = null;
	}

	loadData({
		"version": "2021a",
		"zones": [
			"Africa/Abidjan|LMT GMT|g.8 0|01|-2ldXH.Q|48e5",
			"Africa/Accra|LMT GMT +0020 +0030|.Q 0 -k -u|01212121212121212121212121212121212121212121212131313131313131|-2bRzX.8 9RbX.8 fdE 1BAk MLE 1Bck MLE 1Bck MLE 1Bck MLE 1BAk MLE 1Bck MLE 1Bck MLE 1Bck MLE 1BAk MLE 1Bck MLE 1Bck MLE 1Bck MLE 1BAk MLE 1Bck MLE 1Bck MLE 1Bck MLE 1BAk MLE 1Bck MLE 1Bck MLE 1Bck MLE Mok 1BXE M0k 1BXE fak 9vbu bjCu MLu 1Bcu MLu 1BAu MLu 1Bcu MLu 1Bcu MLu 1Bcu MLu|41e5",
			"Africa/Nairobi|LMT +0230 EAT +0245|-2r.g -2u -30 -2J|012132|-2ua2r.g N6nV.g 3Fbu h1cu dzbJ|47e5",
			"Africa/Algiers|PMT WET WEST CET CEST|-9.l 0 -10 -10 -20|0121212121212121343431312123431213|-2nco9.l cNb9.l HA0 19A0 1iM0 11c0 1oo0 Wo0 1rc0 QM0 1EM0 UM0 DA0 Imo0 rd0 De0 9Xz0 1fb0 1ap0 16K0 2yo0 mEp0 hwL0 jxA0 11A0 dDd0 17b0 11B0 1cN0 2Dy0 1cN0 1fB0 1cL0|26e5",
			"Africa/Lagos|LMT GMT +0030 WAT|-d.z 0 -u -10|01023|-2B40d.z 7iod.z dnXK.p dLzH.z|17e6",
			"Africa/Bissau|LMT -01 GMT|12.k 10 0|012|-2ldX0 2xoo0|39e4",
			"Africa/Maputo|LMT CAT|-2a.k -20|01|-2GJea.k|26e5",
			"Africa/Cairo|EET EEST|-20 -30|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-1bIO0 vb0 1ip0 11z0 1iN0 1nz0 12p0 1pz0 10N0 1pz0 16p0 1jz0 s3d0 Vz0 1oN0 11b0 1oO0 10N0 1pz0 10N0 1pb0 10N0 1pb0 10N0 1pb0 10N0 1pz0 10N0 1pb0 10N0 1pb0 11d0 1oL0 11d0 1pb0 11d0 1oL0 11d0 1oL0 11d0 1oL0 11d0 1pb0 11d0 1oL0 11d0 1oL0 11d0 1oL0 11d0 1pb0 11d0 1oL0 11d0 1oL0 11d0 1oL0 11d0 1pb0 11d0 1oL0 11d0 1WL0 rd0 1Rz0 wp0 1pb0 11d0 1oL0 11d0 1oL0 11d0 1oL0 11d0 1pb0 11d0 1qL0 Xd0 1oL0 11d0 1oL0 11d0 1pb0 11d0 1oL0 11d0 1oL0 11d0 1ny0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 WL0 1qN0 Rb0 1wp0 On0 1zd0 Lz0 1EN0 Fb0 c10 8n0 8Nd0 gL0 e10 mn0|15e6",
			"Africa/Casablanca|LMT +00 +01|u.k 0 -10|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212|-2gMnt.E 130Lt.E rb0 Dd0 dVb0 b6p0 TX0 EoB0 LL0 gnd0 rz0 43d0 AL0 1Nd0 XX0 1Cp0 pz0 dEp0 4mn0 SyN0 AL0 1Nd0 wn0 1FB0 Db0 1zd0 Lz0 1Nf0 wM0 co0 go0 1o00 s00 dA0 vc0 11A0 A00 e00 y00 11A0 uM0 e00 Dc0 11A0 s00 e00 IM0 WM0 mo0 gM0 LA0 WM0 jA0 e00 28M0 e00 2600 gM0 2600 e00 2600 gM0 2600 gM0 2600 e00 2600 gM0 2600 e00 28M0 e00 2600 gM0 2600 e00 2600 gM0 2600 gM0 2600 e00 2600 gM0 2600 e00 2600 gM0 2600 gM0 2600 e00 2600 gM0|32e5",
			"Africa/Ceuta|WET WEST CET CEST|0 -10 -10 -20|010101010101010101010232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-25KN0 11z0 drd0 18p0 3HX0 17d0 1fz0 1a10 1io0 1a00 1y7o0 LL0 gnd0 rz0 43d0 AL0 1Nd0 XX0 1Cp0 pz0 dEp0 4VB0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|85e3",
			"Africa/El_Aaiun|LMT -01 +00 +01|Q.M 10 0 -10|012323232323232323232323232323232323232323232323232323232323232323232323232323232323|-1rDz7.c 1GVA7.c 6L0 AL0 1Nd0 XX0 1Cp0 pz0 1cBB0 AL0 1Nd0 wn0 1FB0 Db0 1zd0 Lz0 1Nf0 wM0 co0 go0 1o00 s00 dA0 vc0 11A0 A00 e00 y00 11A0 uM0 e00 Dc0 11A0 s00 e00 IM0 WM0 mo0 gM0 LA0 WM0 jA0 e00 28M0 e00 2600 gM0 2600 e00 2600 gM0 2600 gM0 2600 e00 2600 gM0 2600 e00 28M0 e00 2600 gM0 2600 e00 2600 gM0 2600 gM0 2600 e00 2600 gM0 2600 e00 2600 gM0 2600 gM0 2600 e00 2600 gM0|20e4",
			"Africa/Johannesburg|SAST SAST SAST|-1u -20 -30|012121|-2GJdu 1Ajdu 1cL0 1cN0 1cL0|84e5",
			"Africa/Juba|LMT CAT CAST EAT|-26.s -20 -30 -30|012121212121212121212121212121212131|-1yW26.s 1zK06.s 16L0 1iN0 17b0 1jd0 17b0 1ip0 17z0 1i10 17X0 1hB0 18n0 1hd0 19b0 1gp0 19z0 1iN0 17b0 1ip0 17z0 1i10 18n0 1hd0 18L0 1gN0 19b0 1gp0 19z0 1iN0 17z0 1i10 17X0 yGd0 PeX0|",
			"Africa/Khartoum|LMT CAT CAST EAT|-2a.8 -20 -30 -30|012121212121212121212121212121212131|-1yW2a.8 1zK0a.8 16L0 1iN0 17b0 1jd0 17b0 1ip0 17z0 1i10 17X0 1hB0 18n0 1hd0 19b0 1gp0 19z0 1iN0 17b0 1ip0 17z0 1i10 18n0 1hd0 18L0 1gN0 19b0 1gp0 19z0 1iN0 17z0 1i10 17X0 yGd0 HjL0|51e5",
			"Africa/Monrovia|MMT MMT GMT|H.8 I.u 0|012|-23Lzg.Q 28G01.m|11e5",
			"Africa/Ndjamena|LMT WAT WAST|-10.c -10 -20|0121|-2le10.c 2J3c0.c Wn0|13e5",
			"Africa/Sao_Tome|LMT GMT WAT|A.J 0 -10|0121|-2le00 4i6N0 2q00|",
			"Africa/Tripoli|LMT CET CEST EET|-Q.I -10 -20 -20|012121213121212121212121213123123|-21JcQ.I 1hnBQ.I vx0 4iP0 xx0 4eN0 Bb0 7ip0 U0n0 A10 1db0 1cN0 1db0 1dd0 1db0 1eN0 1bb0 1e10 1cL0 1c10 1db0 1dd0 1db0 1cN0 1db0 1q10 fAn0 1ep0 1db0 AKq0 TA0 1o00|11e5",
			"Africa/Tunis|PMT CET CEST|-9.l -10 -20|0121212121212121212121212121212121|-2nco9.l 18pa9.l 1qM0 DA0 3Tc0 11B0 1ze0 WM0 7z0 3d0 14L0 1cN0 1f90 1ar0 16J0 1gXB0 WM0 1rA0 11c0 nwo0 Ko0 1cM0 1cM0 1rA0 10M0 zuM0 10N0 1aN0 1qM0 WM0 1qM0 11A0 1o00|20e5",
			"Africa/Windhoek|+0130 SAST SAST CAT WAT|-1u -20 -30 -20 -10|01213434343434343434343434343434343434343434343434343|-2GJdu 1Ajdu 1cL0 1SqL0 9Io0 16P0 1nX0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0|32e4",
			"America/Adak|NST NWT NPT BST BDT AHST HST HDT|b0 a0 a0 b0 a0 a0 a0 90|012034343434343434343434343434343456767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676|-17SX0 8wW0 iB0 Qlb0 52O0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 cm0 10q0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|326",
			"America/Anchorage|AST AWT APT AHST AHDT YST AKST AKDT|a0 90 90 a0 90 90 90 80|012034343434343434343434343434343456767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676|-17T00 8wX0 iA0 Qlb0 52O0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 cm0 10q0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|30e4",
			"America/Port_of_Spain|LMT AST|46.4 40|01|-2kNvR.U|43e3",
			"America/Araguaina|LMT -03 -02|3c.M 30 20|0121212121212121212121212121212121212121212121212121|-2glwL.c HdKL.c 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 dMN0 Lz0 1zd0 Rb0 1wN0 Wn0 1tB0 Rb0 1tB0 WL0 1tB0 Rb0 1zd0 On0 1HB0 FX0 ny10 Lz0|14e4",
			"America/Argentina/Buenos_Aires|CMT -04 -03 -02|4g.M 40 30 20|01212121212121212121212121212121212121212123232323232323232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Rb0 1wp0 Rb0 1wp0 TX0 A4p0 uL0 1qN0 WL0|",
			"America/Argentina/Catamarca|CMT -04 -03 -02|4g.M 40 30 20|01212121212121212121212121212121212121212123232323132321232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Rb0 1wq0 Ra0 1wp0 TX0 rlB0 7B0 8zb0 uL0|",
			"America/Argentina/Cordoba|CMT -04 -03 -02|4g.M 40 30 20|01212121212121212121212121212121212121212123232323132323232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Rb0 1wq0 Ra0 1wp0 TX0 A4p0 uL0 1qN0 WL0|",
			"America/Argentina/Jujuy|CMT -04 -03 -02|4g.M 40 30 20|012121212121212121212121212121212121212121232323121323232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1ze0 TX0 1ld0 WK0 1wp0 TX0 A4p0 uL0|",
			"America/Argentina/La_Rioja|CMT -04 -03 -02|4g.M 40 30 20|012121212121212121212121212121212121212121232323231232321232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Qn0 qO0 16n0 Rb0 1wp0 TX0 rlB0 7B0 8zb0 uL0|",
			"America/Argentina/Mendoza|CMT -04 -03 -02|4g.M 40 30 20|01212121212121212121212121212121212121212123232312121321232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1u20 SL0 1vd0 Tb0 1wp0 TW0 ri10 Op0 7TX0 uL0|",
			"America/Argentina/Rio_Gallegos|CMT -04 -03 -02|4g.M 40 30 20|01212121212121212121212121212121212121212123232323232321232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Rb0 1wp0 Rb0 1wp0 TX0 rlB0 7B0 8zb0 uL0|",
			"America/Argentina/Salta|CMT -04 -03 -02|4g.M 40 30 20|012121212121212121212121212121212121212121232323231323232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Rb0 1wq0 Ra0 1wp0 TX0 A4p0 uL0|",
			"America/Argentina/San_Juan|CMT -04 -03 -02|4g.M 40 30 20|012121212121212121212121212121212121212121232323231232321232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Qn0 qO0 16n0 Rb0 1wp0 TX0 rld0 m10 8lb0 uL0|",
			"America/Argentina/San_Luis|CMT -04 -03 -02|4g.M 40 30 20|012121212121212121212121212121212121212121232323121212321212|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 XX0 1q20 SL0 AN0 vDb0 m10 8lb0 8L0 jd0 1qN0 WL0 1qN0|",
			"America/Argentina/Tucuman|CMT -04 -03 -02|4g.M 40 30 20|0121212121212121212121212121212121212121212323232313232123232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Rb0 1wq0 Ra0 1wp0 TX0 rlB0 4N0 8BX0 uL0 1qN0 WL0|",
			"America/Argentina/Ushuaia|CMT -04 -03 -02|4g.M 40 30 20|01212121212121212121212121212121212121212123232323232321232|-20UHH.c pKnH.c Mn0 1iN0 Tb0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 1C10 LX0 1C10 LX0 1C10 LX0 1C10 Mn0 MN0 2jz0 MN0 4lX0 u10 5Lb0 1pB0 Fnz0 u10 uL0 1vd0 SL0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 zvd0 Bz0 1tB0 TX0 1wp0 Rb0 1wp0 Rb0 1wp0 TX0 rkN0 8p0 8zb0 uL0|",
			"America/Curacao|LMT -0430 AST|4z.L 4u 40|012|-2kV7o.d 28KLS.d|15e4",
			"America/Asuncion|AMT -04 -03|3O.E 40 30|012121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212|-1x589.k 1DKM9.k 3CL0 3Dd0 10L0 1pB0 10n0 1pB0 10n0 1pB0 1cL0 1dd0 1db0 1dd0 1cL0 1dd0 1cL0 1dd0 1cL0 1dd0 1db0 1dd0 1cL0 1dd0 1cL0 1dd0 1cL0 1dd0 1db0 1dd0 1cL0 1lB0 14n0 1dd0 1cL0 1fd0 WL0 1rd0 1aL0 1dB0 Xz0 1qp0 Xb0 1qN0 10L0 1rB0 TX0 1tB0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1qN0 1cL0 WN0 1qL0 11B0 1nX0 1ip0 WL0 1qN0 WL0 1qN0 WL0 1tB0 TX0 1tB0 TX0 1tB0 19X0 1a10 1fz0 1a10 1fz0 1cN0 17b0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1fB0 19X0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1fB0 19X0 1ip0 17b0 1ip0 17b0 1ip0|28e5",
			"America/Atikokan|CST CDT CWT CPT EST|60 50 50 50 50|0101234|-25TQ0 1in0 Rnb0 3je0 8x30 iw0|28e2",
			"America/Bahia_Banderas|LMT MST CST PST MDT CDT|71 70 60 80 60 50|0121212131414141414141414141414141414152525252525252525252525252525252525252525252525252525252|-1UQF0 deL0 8lc0 17c0 10M0 1dd0 otX0 gmN0 P2N0 13Vd0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nW0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0|84e3",
			"America/Bahia|LMT -03 -02|2y.4 30 20|01212121212121212121212121212121212121212121212121212121212121|-2glxp.U HdLp.U 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 1EN0 Lz0 1C10 IL0 1HB0 Db0 1HB0 On0 1zd0 On0 1zd0 Lz0 1zd0 Rb0 1wN0 Wn0 1tB0 Rb0 1tB0 WL0 1tB0 Rb0 1zd0 On0 1HB0 FX0 l5B0 Rb0|27e5",
			"America/Barbados|LMT BMT AST ADT|3W.t 3W.t 40 30|01232323232|-1Q0I1.v jsM0 1ODC1.v IL0 1ip0 17b0 1ip0 17b0 1ld0 13b0|28e4",
			"America/Belem|LMT -03 -02|3d.U 30 20|012121212121212121212121212121|-2glwK.4 HdKK.4 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0|20e5",
			"America/Belize|LMT CST -0530 CWT CPT CDT|5Q.M 60 5u 50 50 50|012121212121212121212121212121212121212121212121213412121212121212121212121212121212121212121215151|-2kBu7.c fPA7.c Onu 1zcu Rbu 1wou Rbu 1wou Rbu 1zcu Onu 1zcu Onu 1zcu Rbu 1wou Rbu 1wou Rbu 1wou Rbu 1zcu Onu 1zcu Onu 1zcu Rbu 1wou Rbu 1wou Rbu 1zcu Onu 1zcu Onu 1zcu Onu 1zcu Rbu 1wou Rbu 1wou Rbu 1zcu Onu 1zcu Onu 1zcu Rbu Rcu 7Bt0 Ni0 4nd0 Rbu 1wou Rbu 1wou Rbu 1zcu Onu 1zcu Onu 1zcu Rbu 1wou Rbu 1wou Rbu 1wou Rbu 1zcu Onu 1zcu Onu 1zcu Rbu 1wou Rbu 1wou Rbu 1zcu Onu 1zcu Onu 1zcu Onu 1zcu Rbu 1wou Rbu 1wou Rbu 1zcu Onu e9Au qn0 lxB0 mn0|57e3",
			"America/Blanc-Sablon|AST ADT AWT APT|40 30 30 30|010230|-25TS0 1in0 UGp0 8x50 iu0|11e2",
			"America/Boa_Vista|LMT -04 -03|42.E 40 30|0121212121212121212121212121212121|-2glvV.k HdKV.k 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 smp0 WL0 1tB0 2L0|62e2",
			"America/Bogota|BMT -05 -04|4U.g 50 40|0121|-2eb73.I 38yo3.I 2en0|90e5",
			"America/Boise|PST PDT MST MWT MPT MDT|80 70 70 60 60 60|0101023425252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252|-261q0 1nX0 11B0 1nX0 8C10 JCL0 8x20 ix0 QwN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 Dd0 1Kn0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|21e4",
			"America/Cambridge_Bay|-00 MST MWT MPT MDDT MDT CST CDT EST|0 70 60 60 50 60 60 50 50|0123141515151515151515151515151515151515151515678651515151515151515151515151515151515151515151515151515151515151515151515151|-21Jc0 RO90 8x20 ix0 LCL0 1fA0 zgO0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11A0 1nX0 2K0 WQ0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|15e2",
			"America/Campo_Grande|LMT -04 -03|3C.s 40 30|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2glwl.w HdLl.w 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 1EN0 Lz0 1C10 IL0 1HB0 Db0 1HB0 On0 1zd0 On0 1zd0 Lz0 1zd0 Rb0 1wN0 Wn0 1tB0 Rb0 1tB0 WL0 1tB0 Rb0 1zd0 On0 1HB0 FX0 1C10 Lz0 1Ip0 HX0 1zd0 On0 1HB0 IL0 1wp0 On0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 Rb0 1zd0 Lz0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 On0 1zd0 On0 1HB0 FX0|77e4",
			"America/Cancun|LMT CST EST EDT CDT|5L.4 60 50 40 50|0123232341414141414141414141414141414141412|-1UQG0 2q2o0 yLB0 1lb0 14p0 1lb0 14p0 Lz0 xB0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 Dd0|63e4",
			"America/Caracas|CMT -0430 -04|4r.E 4u 40|01212|-2kV7w.k 28KM2.k 1IwOu kqo0|29e5",
			"America/Cayenne|LMT -04 -03|3t.k 40 30|012|-2mrwu.E 2gWou.E|58e3",
			"America/Panama|CMT EST|5j.A 50|01|-2uduE.o|15e5",
			"America/Chicago|CST CDT EST CWT CPT|60 50 50 50 50|01010101010101010101010101010101010102010101010103401010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261s0 1nX0 11B0 1nX0 1wp0 TX0 WN0 1qL0 1cN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 11B0 1Hz0 14p0 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 RB0 8x30 iw0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|92e5",
			"America/Chihuahua|LMT MST CST CDT MDT|74.k 70 60 50 60|0121212323241414141414141414141414141414141414141414141414141414141414141414141414141414141|-1UQF0 deL0 8lc0 17c0 10M0 1dd0 2zQN0 1lb0 14p0 1lb0 14q0 1lb0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0|81e4",
			"America/Costa_Rica|SJMT CST CDT|5A.d 60 50|0121212121|-1Xd6n.L 2lu0n.L Db0 1Kp0 Db0 pRB0 15b0 1kp0 mL0|12e5",
			"America/Creston|MST PST|70 80|010|-29DR0 43B0|53e2",
			"America/Cuiaba|LMT -04 -03|3I.k 40 30|012121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2glwf.E HdLf.E 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 1EN0 Lz0 1C10 IL0 1HB0 Db0 1HB0 On0 1zd0 On0 1zd0 Lz0 1zd0 Rb0 1wN0 Wn0 1tB0 Rb0 1tB0 WL0 1tB0 Rb0 1zd0 On0 1HB0 FX0 4a10 HX0 1zd0 On0 1HB0 IL0 1wp0 On0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 Rb0 1zd0 Lz0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 On0 1zd0 On0 1HB0 FX0|54e4",
			"America/Danmarkshavn|LMT -03 -02 GMT|1e.E 30 20 0|01212121212121212121212121212121213|-2a5WJ.k 2z5fJ.k 19U0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 DC0|8",
			"America/Dawson_Creek|PST PDT PWT PPT MST|80 70 70 70 70|0102301010101010101010101010101010101010101010101010101014|-25TO0 1in0 UGp0 8x10 iy0 3NB0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 ML0|12e3",
			"America/Dawson|YST YDT YWT YPT YDDT PST PDT MST|90 80 80 80 70 80 70 70|010102304056565656565656565656565656565656565656565656565656565656565656565656565656565656567|-25TN0 1in0 1o10 13V0 Ser0 8x00 iz0 LCL0 1fA0 jrA0 fNd0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1z90|13e2",
			"America/Denver|MST MDT MWT MPT|70 60 60 60|01010101023010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261r0 1nX0 11B0 1nX0 11B0 1qL0 WN0 mn0 Ord0 8x20 ix0 LCN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|26e5",
			"America/Detroit|LMT CST EST EWT EPT EDT|5w.b 60 50 40 40 40|0123425252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252|-2Cgir.N peqr.N 156L0 8x40 iv0 6fd0 11z0 JxX1 SMX 1cN0 1cL0 aW10 1cL0 s10 1Vz0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|37e5",
			"America/Edmonton|LMT MST MDT MWT MPT|7x.Q 70 60 60 60|0121212121212134121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2yd4q.8 shdq.8 1in0 17d0 hz0 2dB0 1fz0 1a10 11z0 1qN0 WL0 1qN0 11z0 IGN0 8x20 ix0 3NB0 11z0 XQp0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|10e5",
			"America/Eirunepe|LMT -05 -04|4D.s 50 40|0121212121212121212121212121212121|-2glvk.w HdLk.w 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 dPB0 On0 yTd0 d5X0|31e3",
			"America/El_Salvador|LMT CST CDT|5U.M 60 50|012121|-1XiG3.c 2Fvc3.c WL0 1qN0 WL0|11e5",
			"America/Tijuana|LMT MST PST PDT PWT PPT|7M.4 70 80 70 70 70|012123245232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-1UQE0 4PX0 8mM0 8lc0 SN0 1cL0 pHB0 83r0 zI0 5O10 1Rz0 cOO0 11A0 1o00 11A0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 BUp0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 U10 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|20e5",
			"America/Fort_Nelson|PST PDT PWT PPT MST|80 70 70 70 70|01023010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010104|-25TO0 1in0 UGp0 8x10 iy0 3NB0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0|39e2",
			"America/Fort_Wayne|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|010101023010101010101010101040454545454545454545454545454545454545454545454545454545454545454545454|-261s0 1nX0 11B0 1nX0 QI10 Db0 RB0 8x30 iw0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 5Tz0 1o10 qLb0 1cL0 1cN0 1cL0 1qhd0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"America/Fortaleza|LMT -03 -02|2y 30 20|0121212121212121212121212121212121212121|-2glxq HdLq 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 nsp0 WL0 1tB0 5z0 2mN0 On0|34e5",
			"America/Glace_Bay|LMT AST ADT AWT APT|3X.M 40 30 30 30|012134121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2IsI0.c CwO0.c 1in0 UGp0 8x50 iu0 iq10 11z0 Jg10 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|19e3",
			"America/Godthab|LMT -03 -02|3q.U 30 20|0121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2a5Ux.4 2z5dx.4 19U0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|17e3",
			"America/Goose_Bay|NST NDT NST NDT NWT NPT AST ADT ADDT|3u.Q 2u.Q 3u 2u 2u 2u 40 30 20|010232323232323245232323232323232323232323232323232323232326767676767676767676767676767676767676767676768676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676|-25TSt.8 1in0 DXb0 2HbX.8 WL0 1qN0 WL0 1qN0 WL0 1tB0 TX0 1tB0 WL0 1qN0 WL0 1qN0 7UHu itu 1tB0 WL0 1qN0 WL0 1qN0 WL0 1qN0 WL0 1tB0 WL0 1ld0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 S10 g0u 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14n1 1lb0 14p0 1nW0 11C0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zcX Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|76e2",
			"America/Grand_Turk|KMT EST EDT AST|57.a 50 40 40|0121212121212121212121212121212121212121212121212121212121212121212121212132121212121212121212121212121212121212121|-2l1uQ.O 2HHBQ.O 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 7jA0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|37e2",
			"America/Guatemala|LMT CST CDT|62.4 60 50|0121212121|-24KhV.U 2efXV.U An0 mtd0 Nz0 ifB0 17b0 zDB0 11z0|13e5",
			"America/Guayaquil|QMT -05 -04|5e 50 40|0121|-1yVSK 2uILK rz0|27e5",
			"America/Guyana|LMT -0345 -03 -04|3Q.E 3J 30 40|0123|-2dvU7.k 2r6LQ.k Bxbf|80e4",
			"America/Halifax|LMT AST ADT AWT APT|4e.o 40 30 30 30|0121212121212121212121212121212121212121212121212134121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2IsHJ.A xzzJ.A 1db0 3I30 1in0 3HX0 IL0 1E10 ML0 1yN0 Pb0 1Bd0 Mn0 1Bd0 Rz0 1w10 Xb0 1w10 LX0 1w10 Xb0 1w10 Lz0 1C10 Jz0 1E10 OL0 1yN0 Un0 1qp0 Xb0 1qp0 11X0 1w10 Lz0 1HB0 LX0 1C10 FX0 1w10 Xb0 1qp0 Xb0 1BB0 LX0 1td0 Xb0 1qp0 Xb0 Rf0 8x50 iu0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 3Qp0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 3Qp0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 6i10 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|39e4",
			"America/Havana|HMT CST CDT|5t.A 50 40|012121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-1Meuu.o 72zu.o ML0 sld0 An0 1Nd0 Db0 1Nd0 An0 6Ep0 An0 1Nd0 An0 JDd0 Mn0 1Ap0 On0 1fd0 11X0 1qN0 WL0 1wp0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 14n0 1ld0 14L0 1kN0 15b0 1kp0 1cL0 1cN0 1fz0 1a10 1fz0 1fB0 11z0 14p0 1nX0 11B0 1nX0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 14n0 1ld0 14n0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 1a10 1in0 1a10 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 17c0 1o00 11A0 1qM0 11A0 1o00 11A0 1o00 14o0 1lc0 14o0 1lc0 11A0 6i00 Rc0 1wo0 U00 1tA0 Rc0 1wo0 U00 1wo0 U00 1zc0 U00 1qM0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0|21e5",
			"America/Hermosillo|LMT MST CST PST MDT|7n.Q 70 60 80 60|0121212131414141|-1UQF0 deL0 8lc0 17c0 10M0 1dd0 otX0 gmN0 P2N0 13Vd0 1lb0 14p0 1lb0 14p0 1lb0|64e4",
			"America/Indiana/Knox|CST CDT CWT CPT EST|60 50 50 50 50|0101023010101010101010101010101010101040101010101010101010101010101010101010101010101010141010101010101010101010101010101010101010101010101010101010101010|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 3NB0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 1fz0 1cN0 1cL0 1cN0 11z0 1o10 11z0 1o10 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 3Cn0 8wp0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 z8o0 1o00 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"America/Indiana/Marengo|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|0101023010101010101010104545454545414545454545454545454545454545454545454545454545454545454545454545454|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 dyN0 11z0 6fd0 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 jrz0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1VA0 LA0 1BX0 1e6p0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"America/Indiana/Petersburg|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|01010230101010101010101010104010101010101010101010141014545454545454545454545454545454545454545454545454545454545454|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 njX0 WN0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 3Fb0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 19co0 1o00 Rd0 1zb0 Oo0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"America/Indiana/Tell_City|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|01010230101010101010101010401054541010101010101010101010101010101010101010101010101010101010101010|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 njX0 WN0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 8wn0 1cN0 1cL0 1cN0 1cK0 1cN0 1cL0 1qhd0 1o00 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"America/Indiana/Vevay|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|010102304545454545454545454545454545454545454545454545454545454545454545454545454|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 kPB0 Awn0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1lnd0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"America/Indiana/Vincennes|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|01010230101010101010101010101010454541014545454545454545454545454545454545454545454545454545454545454|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 1o10 11z0 g0p0 11z0 1o10 11z0 1qL0 WN0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 1fz0 1cN0 WL0 1qN0 1cL0 1cN0 1cL0 1cN0 caL0 1cL0 1cN0 1cL0 1qhd0 1o00 Rd0 1zb0 Oo0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"America/Indiana/Winamac|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|01010230101010101010101010101010101010454541054545454545454545454545454545454545454545454545454545454545454|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 1fz0 1cN0 1cL0 1cN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 jrz0 1cL0 1cN0 1cL0 1qhd0 1o00 Rd0 1za0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"America/Inuvik|-00 PST PDDT MST MDT|0 80 60 70 60|0121343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343|-FnA0 tWU0 1fA0 wPe0 2pz0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|35e2",
			"America/Iqaluit|-00 EWT EPT EST EDDT EDT CST CDT|0 40 40 50 30 40 60 50|01234353535353535353535353535353535353535353567353535353535353535353535353535353535353535353535353535353535353535353535353|-16K00 7nX0 iv0 LCL0 1fA0 zgO0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11C0 1nX0 11A0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|67e2",
			"America/Jamaica|KMT EST EDT|57.a 50 40|0121212121212121212121|-2l1uQ.O 2uM1Q.O 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0|94e4",
			"America/Juneau|PST PWT PPT PDT YDT YST AKST AKDT|80 70 70 70 80 90 90 80|01203030303030303030303030403030356767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676|-17T20 8x10 iy0 Vo10 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cM0 1cM0 1cL0 1cN0 1fz0 1a10 1fz0 co0 10q0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|33e3",
			"America/Kentucky/Louisville|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|0101010102301010101010101010101010101454545454545414545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454|-261s0 1nX0 11B0 1nX0 3Fd0 Nb0 LPd0 11z0 RB0 8x30 iw0 1nX1 e0X 9vd0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 xz0 gso0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1VA0 LA0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"America/Kentucky/Monticello|CST CDT CWT CPT EST EDT|60 50 50 50 50 40|0101023010101010101010101010101010101010101010101010101010101010101010101454545454545454545454545454545454545454545454545454545454545454545454545454|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 SWp0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11A0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"America/La_Paz|CMT BST -04|4w.A 3w.A 40|012|-1x37r.o 13b0|19e5",
			"America/Lima|LMT -05 -04|58.A 50 40|0121212121212121|-2tyGP.o 1bDzP.o zX0 1aN0 1cL0 1cN0 1cL0 1PrB0 zX0 1O10 zX0 6Gp0 zX0 98p0 zX0|11e6",
			"America/Los_Angeles|PST PDT PWT PPT|80 70 70 70|010102301010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261q0 1nX0 11B0 1nX0 SgN0 8x10 iy0 5Wp1 1VaX 3dA0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1a00 1fA0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|15e6",
			"America/Maceio|LMT -03 -02|2m.Q 30 20|012121212121212121212121212121212121212121|-2glxB.8 HdLB.8 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 dMN0 Lz0 8Q10 WL0 1tB0 5z0 2mN0 On0|93e4",
			"America/Managua|MMT CST EST CDT|5J.c 60 50 50|0121313121213131|-1quie.M 1yAMe.M 4mn0 9Up0 Dz0 1K10 Dz0 s3F0 1KH0 DB0 9In0 k8p0 19X0 1o30 11y0|22e5",
			"America/Manaus|LMT -04 -03|40.4 40 30|01212121212121212121212121212121|-2glvX.U HdKX.U 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 dPB0 On0|19e5",
			"America/Martinique|FFMT AST ADT|44.k 40 30|0121|-2mPTT.E 2LPbT.E 19X0|39e4",
			"America/Matamoros|LMT CST CDT|6E 60 50|0121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-1UQG0 2FjC0 1nX0 i6p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 U10 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|45e4",
			"America/Mazatlan|LMT MST CST PST MDT|75.E 70 60 80 60|0121212131414141414141414141414141414141414141414141414141414141414141414141414141414141414141|-1UQF0 deL0 8lc0 17c0 10M0 1dd0 otX0 gmN0 P2N0 13Vd0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0|44e4",
			"America/Menominee|CST CDT CWT CPT EST|60 50 50 50 50|01010230101041010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 1o10 11z0 LCN0 1fz0 6410 9Jb0 1cM0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|85e2",
			"America/Merida|LMT CST EST CDT|5W.s 60 50 50|0121313131313131313131313131313131313131313131313131313131313131313131313131313131313131|-1UQG0 2q2o0 2hz0 wu30 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0|11e5",
			"America/Metlakatla|PST PWT PPT PDT AKST AKDT|80 70 70 70 90 80|01203030303030303030303030303030304545450454545454545454545454545454545454545454|-17T20 8x10 iy0 Vo10 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1hU10 Rd0 1zb0 Op0 1zb0 Op0 1zb0 uM0 jB0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|14e2",
			"America/Mexico_City|LMT MST CST CDT CWT|6A.A 70 60 50 50|012121232324232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-1UQF0 deL0 8lc0 17c0 10M0 1dd0 gEn0 TX0 3xd0 Jb0 6zB0 SL0 e5d0 17b0 1Pff0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0|20e6",
			"America/Miquelon|LMT AST -03 -02|3I.E 40 30 20|012323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-2mKkf.k 2LTAf.k gQ10 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|61e2",
			"America/Moncton|EST AST ADT AWT APT|50 40 30 30 30|012121212121212121212134121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2IsH0 CwN0 1in0 zAo0 An0 1Nd0 An0 1Nd0 An0 1Nd0 An0 1Nd0 An0 1Nd0 An0 1K10 Lz0 1zB0 NX0 1u10 Wn0 S20 8x50 iu0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 3Cp0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14n1 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 ReX 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|64e3",
			"America/Monterrey|LMT CST CDT|6F.g 60 50|0121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-1UQG0 2FjC0 1nX0 i6p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0|41e5",
			"America/Montevideo|LMT MMT -04 -03 -0330 -0230 -02 -0130|3I.P 3I.P 40 30 3u 2u 20 1u|012343434343434343434343435353636353636375363636363636363636363636363636363636363636363|-2tRUf.9 sVc0 8jcf.9 1db0 1dcu 1cLu 1dcu 1cLu ircu 11zu 1o0u 11zu 1o0u 11zu 1o0u 11zu 1qMu WLu 1qMu WLu 1fAu 1cLu 1o0u 11zu NAu 3jXu zXu Dq0u 19Xu pcu jz0 cm10 19X0 6tB0 1fbu 3o0u jX0 4vB0 xz0 3Cp0 mmu 1a10 IMu Db0 4c10 uL0 1Nd0 An0 1SN0 uL0 mp0 28L0 iPB0 un0 1SN0 xz0 1zd0 Lz0 1zd0 Rb0 1zd0 On0 1wp0 Rb0 s8p0 1fB0 1ip0 11z0 1ld0 14n0 1o10 11z0 1o10 11z0 1o10 14n0 1ld0 14n0 1ld0 14n0 1o10 11z0 1o10 11z0 1o10 11z0|17e5",
			"America/Toronto|EST EDT EWT EPT|50 40 40 40|01010101010101010101010101010101010101010101012301010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-25TR0 1in0 11Wu 1nzu 1fD0 WJ0 1wr0 Nb0 1Ap0 On0 1zd0 On0 1wp0 TX0 1tB0 TX0 1tB0 TX0 1tB0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 4kM0 8x40 iv0 1o10 11z0 1nX0 11z0 1o10 11z0 1o10 1qL0 11D0 1nX0 11B0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|65e5",
			"America/Nassau|LMT EST EWT EPT EDT|59.u 50 40 40 40|01212314141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141|-2kNuO.u 1drbO.u 6tX0 cp0 1hS0 pF0 J630 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|24e4",
			"America/New_York|EST EDT EWT EPT|50 40 40 40|01010101010101010101010101010101010101010101010102301010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261t0 1nX0 11B0 1nX0 11B0 1qL0 1a10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 RB0 8x40 iv0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|21e6",
			"America/Nipigon|EST EDT EWT EPT|50 40 40 40|010123010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-25TR0 1in0 Rnb0 3je0 8x40 iv0 19yN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|16e2",
			"America/Nome|NST NWT NPT BST BDT YST AKST AKDT|b0 a0 a0 b0 a0 90 90 80|012034343434343434343434343434343456767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676767676|-17SX0 8wW0 iB0 Qlb0 52O0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 cl0 10q0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|38e2",
			"America/Noronha|LMT -02 -01|29.E 20 10|0121212121212121212121212121212121212121|-2glxO.k HdKO.k 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 nsp0 WL0 1tB0 2L0 2pB0 On0|30e2",
			"America/North_Dakota/Beulah|MST MDT MWT MPT CST CDT|70 60 60 60 60 50|010102301010101010101010101010101010101010101010101010101010101010101010101010101010101010101014545454545454545454545454545454545454545454545454545454|-261r0 1nX0 11B0 1nX0 SgN0 8x20 ix0 QwN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Oo0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"America/North_Dakota/Center|MST MDT MWT MPT CST CDT|70 60 60 60 60 50|010102301010101010101010101010101010101010101010101010101014545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454|-261r0 1nX0 11B0 1nX0 SgN0 8x20 ix0 QwN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14o0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"America/North_Dakota/New_Salem|MST MDT MWT MPT CST CDT|70 60 60 60 60 50|010102301010101010101010101010101010101010101010101010101010101010101010101010101454545454545454545454545454545454545454545454545454545454545454545454|-261r0 1nX0 11B0 1nX0 SgN0 8x20 ix0 QwN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14o0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"America/Ojinaga|LMT MST CST CDT MDT|6V.E 70 60 50 60|0121212323241414141414141414141414141414141414141414141414141414141414141414141414141414141|-1UQF0 deL0 8lc0 17c0 10M0 1dd0 2zQN0 1lb0 14p0 1lb0 14q0 1lb0 14p0 1nX0 11B0 1nX0 1fB0 WL0 1fB0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 U10 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|23e3",
			"America/Pangnirtung|-00 AST AWT APT ADDT ADT EDT EST CST CDT|0 40 30 30 20 30 40 50 60 50|012314151515151515151515151515151515167676767689767676767676767676767676767676767676767676767676767676767676767676767676767|-1XiM0 PnG0 8x50 iu0 LCL0 1fA0 zgO0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1o00 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11C0 1nX0 11A0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|14e2",
			"America/Paramaribo|LMT PMT PMT -0330 -03|3E.E 3E.Q 3E.A 3u 30|01234|-2nDUj.k Wqo0.c qanX.I 1yVXN.o|24e4",
			"America/Phoenix|MST MDT MWT|70 60 60|01010202010|-261r0 1nX0 11B0 1nX0 SgN0 4Al1 Ap0 1db0 SWqX 1cL0|42e5",
			"America/Port-au-Prince|PPMT EST EDT|4N 50 40|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-28RHb 2FnMb 19X0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14q0 1o00 11A0 1o00 11A0 1o00 14o0 1lc0 14o0 1lc0 14o0 1o00 11A0 1o00 11A0 1o00 14o0 1lc0 14o0 1lc0 i6n0 1nX0 11B0 1nX0 d430 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 3iN0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|23e5",
			"America/Rio_Branco|LMT -05 -04|4v.c 50 40|01212121212121212121212121212121|-2glvs.M HdLs.M 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 NBd0 d5X0|31e4",
			"America/Porto_Velho|LMT -04 -03|4f.A 40 30|012121212121212121212121212121|-2glvI.o HdKI.o 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0|37e4",
			"America/Puerto_Rico|AST AWT APT|40 30 30|0120|-17lU0 7XT0 iu0|24e5",
			"America/Punta_Arenas|SMT -05 -04 -03|4G.K 50 40 30|0102021212121212121232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323|-2q2jh.e fJAh.e 5knG.K 1Vzh.e jRAG.K 1pbh.e 11d0 1oL0 11d0 1oL0 11d0 1oL0 11d0 1pb0 11d0 nHX0 op0 blz0 ko0 Qeo0 WL0 1zd0 On0 1ip0 11z0 1o10 11z0 1qN0 WL0 1ld0 14n0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 WL0 1qN0 1cL0 1cN0 11z0 1o10 11z0 1qN0 WL0 1fB0 19X0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 17b0 1ip0 11z0 1ip0 1fz0 1fB0 11z0 1qN0 WL0 1qN0 WL0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 17b0 1ip0 11z0 1o10 19X0 1fB0 1nX0 G10 1EL0 Op0 1zb0 Rd0 1wn0 Rd0 46n0 Ap0|",
			"America/Rainy_River|CST CDT CWT CPT|60 50 50 50|010123010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-25TQ0 1in0 Rnb0 3je0 8x30 iw0 19yN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|842",
			"America/Rankin_Inlet|-00 CST CDDT CDT EST|0 60 40 50 50|012131313131313131313131313131313131313131313431313131313131313131313131313131313131313131313131313131313131313131313131|-vDc0 keu0 1fA0 zgO0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|26e2",
			"America/Recife|LMT -03 -02|2j.A 30 20|0121212121212121212121212121212121212121|-2glxE.o HdLE.o 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 nsp0 WL0 1tB0 2L0 2pB0 On0|33e5",
			"America/Regina|LMT MST MDT MWT MPT CST|6W.A 70 60 60 60 60|012121212121212121212121341212121212121212121212121215|-2AD51.o uHe1.o 1in0 s2L0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 66N0 1cL0 1cN0 19X0 1fB0 1cL0 1fB0 1cL0 1cN0 1cL0 M30 8x20 ix0 1ip0 1cL0 1ip0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 3NB0 1cL0 1cN0|19e4",
			"America/Resolute|-00 CST CDDT CDT EST|0 60 40 50 50|012131313131313131313131313131313131313131313431313131313431313131313131313131313131313131313131313131313131313131313131|-SnA0 GWS0 1fA0 zgO0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|229",
			"America/Santarem|LMT -04 -03|3C.M 40 30|0121212121212121212121212121212|-2glwl.c HdLl.c 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 qe10 xb0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 NBd0|21e4",
			"America/Santiago|SMT -05 -04 -03|4G.K 50 40 30|010202121212121212321232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323|-2q2jh.e fJAh.e 5knG.K 1Vzh.e jRAG.K 1pbh.e 11d0 1oL0 11d0 1oL0 11d0 1oL0 11d0 1pb0 11d0 nHX0 op0 9Bz0 jb0 1oN0 ko0 Qeo0 WL0 1zd0 On0 1ip0 11z0 1o10 11z0 1qN0 WL0 1ld0 14n0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 WL0 1qN0 1cL0 1cN0 11z0 1o10 11z0 1qN0 WL0 1fB0 19X0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 17b0 1ip0 11z0 1ip0 1fz0 1fB0 11z0 1qN0 WL0 1qN0 WL0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 17b0 1ip0 11z0 1o10 19X0 1fB0 1nX0 G10 1EL0 Op0 1zb0 Rd0 1wn0 Rd0 46n0 Ap0 1Nb0 Ap0 1Nb0 Ap0 1zb0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0|62e5",
			"America/Santo_Domingo|SDMT EST EDT -0430 AST|4E 50 40 4u 40|01213131313131414|-1ttjk 1lJMk Mn0 6sp0 Lbu 1Cou yLu 1RAu wLu 1QMu xzu 1Q0u xXu 1PAu 13jB0 e00|29e5",
			"America/Sao_Paulo|LMT -03 -02|36.s 30 20|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2glwR.w HdKR.w 1cc0 1e10 1bX0 Ezd0 So0 1vA0 Mn0 1BB0 ML0 1BB0 zX0 pTd0 PX0 2ep0 nz0 1C10 zX0 1C10 LX0 1C10 Mn0 H210 Rb0 1tB0 IL0 1Fd0 FX0 1EN0 FX0 1HB0 Lz0 1EN0 Lz0 1C10 IL0 1HB0 Db0 1HB0 On0 1zd0 On0 1zd0 Lz0 1zd0 Rb0 1wN0 Wn0 1tB0 Rb0 1tB0 WL0 1tB0 Rb0 1zd0 On0 1HB0 FX0 1C10 Lz0 1Ip0 HX0 1zd0 On0 1HB0 IL0 1wp0 On0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 Rb0 1zd0 Lz0 1C10 Lz0 1C10 On0 1zd0 On0 1zd0 On0 1zd0 On0 1HB0 FX0|20e6",
			"America/Scoresbysund|LMT -02 -01 +00|1r.Q 20 10 0|0121323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-2a5Ww.8 2z5ew.8 1a00 1cK0 1cL0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|452",
			"America/Sitka|PST PWT PPT PDT YST AKST AKDT|80 70 70 70 90 90 80|01203030303030303030303030303030345656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565656565|-17T20 8x10 iy0 Vo10 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 co0 10q0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|90e2",
			"America/St_Johns|NST NDT NST NDT NWT NPT NDDT|3u.Q 2u.Q 3u 2u 2u 2u 1u|01010101010101010101010101010101010102323232323232324523232323232323232323232323232323232323232323232323232323232323232323232323232323232326232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-28oit.8 14L0 1nB0 1in0 1gm0 Dz0 1JB0 1cL0 1cN0 1cL0 1fB0 19X0 1fB0 19X0 1fB0 19X0 1fB0 19X0 1fB0 1cL0 1cN0 1cL0 1fB0 19X0 1fB0 19X0 1fB0 19X0 1fB0 19X0 1fB0 1cL0 1fB0 19X0 1fB0 19X0 10O0 eKX.8 19X0 1iq0 WL0 1qN0 WL0 1qN0 WL0 1tB0 TX0 1tB0 WL0 1qN0 WL0 1qN0 7UHu itu 1tB0 WL0 1qN0 WL0 1qN0 WL0 1qN0 WL0 1tB0 WL0 1ld0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14n1 1lb0 14p0 1nW0 11C0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zcX Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|11e4",
			"America/Swift_Current|LMT MST MDT MWT MPT CST|7b.k 70 60 60 60 60|012134121212121212121215|-2AD4M.E uHdM.E 1in0 UGp0 8x20 ix0 1o10 17b0 1ip0 11z0 1o10 11z0 1o10 11z0 isN0 1cL0 3Cp0 1cL0 1cN0 11z0 1qN0 WL0 pMp0|16e3",
			"America/Tegucigalpa|LMT CST CDT|5M.Q 60 50|01212121|-1WGGb.8 2ETcb.8 WL0 1qN0 WL0 GRd0 AL0|11e5",
			"America/Thule|LMT AST ADT|4z.8 40 30|012121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2a5To.Q 31NBo.Q 1cL0 1cN0 1cL0 1fB0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|656",
			"America/Thunder_Bay|CST EST EWT EPT EDT|60 50 40 40 40|0123141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141|-2q5S0 1iaN0 8x40 iv0 XNB0 1cL0 1cN0 1fz0 1cN0 1cL0 3Cp0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|11e4",
			"America/Vancouver|PST PDT PWT PPT|80 70 70 70|0102301010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-25TO0 1in0 UGp0 8x10 iy0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|23e5",
			"America/Whitehorse|YST YDT YWT YPT YDDT PST PDT MST|90 80 80 80 70 80 70 70|010102304056565656565656565656565656565656565656565656565656565656565656565656565656565656567|-25TN0 1in0 1o10 13V0 Ser0 8x00 iz0 LCL0 1fA0 3NA0 vrd0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1z90|23e3",
			"America/Winnipeg|CST CDT CWT CPT|60 50 50 50|010101023010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2aIi0 WL0 3ND0 1in0 Jap0 Rb0 aCN0 8x30 iw0 1tB0 11z0 1ip0 11z0 1o10 11z0 1o10 11z0 1rd0 10L0 1op0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 1cL0 1cN0 11z0 6i10 WL0 6i10 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1a00 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1a00 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 14o0 1lc0 14o0 1o00 11A0 1o00 11A0 1o00 14o0 1lc0 14o0 1lc0 14o0 1o00 11A0 1o00 11A0 1o00 14o0 1lc0 14o0 1lc0 14o0 1lc0 14o0 1o00 11A0 1o00 11A0 1o00 14o0 1lc0 14o0 1lc0 14o0 1o00 11A0 1o00 11A0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|66e4",
			"America/Yakutat|YST YWT YPT YDT AKST AKDT|90 80 80 80 90 80|01203030303030303030303030303030304545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454|-17T10 8x00 iz0 Vo10 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 cn0 10q0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|642",
			"America/Yellowknife|-00 MST MWT MPT MDDT MDT|0 70 60 60 50 60|012314151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151|-1pdA0 hix0 8x20 ix0 LCL0 1fA0 zgO0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|19e3",
			"Antarctica/Casey|-00 +08 +11|0 -80 -b0|0121212121212|-2q00 1DjS0 T90 40P0 KL0 blz0 3m10 1o30 14k0 1kr0 12l0 1o01|10",
			"Antarctica/Davis|-00 +07 +05|0 -70 -50|01012121|-vyo0 iXt0 alj0 1D7v0 VB0 3Wn0 KN0|70",
			"Antarctica/DumontDUrville|-00 +10|0 -a0|0101|-U0o0 cfq0 bFm0|80",
			"Antarctica/Macquarie|AEST AEDT -00|-a0 -b0 0|010201010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101|-29E80 1a00 4SK0 1ayy0 Lvs0 1cM0 1o00 Rc0 1wo0 Rc0 1wo0 U00 1wo0 LA0 1C00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 11A0 1qM0 WM0 1qM0 Oo0 1zc0 Oo0 1zc0 Oo0 1wo0 WM0 1tA0 WM0 1tA0 U00 1tA0 U00 1tA0 11A0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 11A0 1o00 1io0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1cM0 1a00 1io0 1cM0 1cM0 1cM0 1cM0 3Co0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0|1",
			"Antarctica/Mawson|-00 +06 +05|0 -60 -50|012|-CEo0 2fyk0|60",
			"Pacific/Auckland|NZMT NZST NZST NZDT|-bu -cu -c0 -d0|01020202020202020202020202023232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323|-1GCVu Lz0 1tB0 11zu 1o0u 11zu 1o0u 11zu 1o0u 14nu 1lcu 14nu 1lcu 1lbu 11Au 1nXu 11Au 1nXu 11Au 1nXu 11Au 1nXu 11Au 1qLu WMu 1qLu 11Au 1n1bu IM0 1C00 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1qM0 14o0 1lc0 14o0 1lc0 14o0 1lc0 17c0 1io0 17c0 1io0 17c0 1io0 17c0 1lc0 14o0 1lc0 14o0 1lc0 17c0 1io0 17c0 1io0 17c0 1lc0 14o0 1lc0 14o0 1lc0 17c0 1io0 17c0 1io0 17c0 1io0 17c0 1io0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1io0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00|14e5",
			"Antarctica/Palmer|-00 -03 -04 -02|0 30 40 20|0121212121213121212121212121212121212121212121212121212121212121212121212121212121|-cao0 nD0 1vd0 SL0 1vd0 17z0 1cN0 1fz0 1cN0 1cL0 1cN0 asn0 Db0 jsN0 14N0 11z0 1o10 11z0 1qN0 WL0 1qN0 WL0 1qN0 1cL0 1cN0 11z0 1o10 11z0 1qN0 WL0 1fB0 19X0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 17b0 1ip0 11z0 1ip0 1fz0 1fB0 11z0 1qN0 WL0 1qN0 WL0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 17b0 1ip0 11z0 1o10 19X0 1fB0 1nX0 G10 1EL0 Op0 1zb0 Rd0 1wn0 Rd0 46n0 Ap0|40",
			"Antarctica/Rothera|-00 -03|0 30|01|gOo0|130",
			"Antarctica/Syowa|-00 +03|0 -30|01|-vs00|20",
			"Antarctica/Troll|-00 +00 +02|0 0 -20|01212121212121212121212121212121212121212121212121212121212121212121|1puo0 hd0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|40",
			"Antarctica/Vostok|-00 +06|0 -60|01|-tjA0|25",
			"Europe/Oslo|CET CEST|-10 -20|010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2awM0 Qm0 W6o0 5pf0 WM0 1fA0 1cM0 1cM0 1cM0 1cM0 wJc0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1qM0 WM0 zpc0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|62e4",
			"Asia/Riyadh|LMT +03|-36.Q -30|01|-TvD6.Q|57e5",
			"Asia/Almaty|LMT +05 +06 +07|-57.M -50 -60 -70|012323232323232323232321232323232323232323232323232|-1Pc57.M eUo7.M 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0|15e5",
			"Asia/Amman|LMT EET EEST|-2n.I -20 -30|0121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-1yW2n.I 1HiMn.I KL0 1oN0 11b0 1oN0 11b0 1pd0 1dz0 1cp0 11b0 1op0 11b0 fO10 1db0 1e10 1cL0 1cN0 1cL0 1cN0 1fz0 1pd0 10n0 1ld0 14n0 1hB0 15b0 1ip0 19X0 1cN0 1cL0 1cN0 17b0 1ld0 14o0 1lc0 17c0 1io0 17c0 1io0 17c0 1So0 y00 1fc0 1dc0 1co0 1dc0 1cM0 1cM0 1cM0 1o00 11A0 1lc0 17c0 1cM0 1cM0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 4bX0 Dd0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|25e5",
			"Asia/Anadyr|LMT +12 +13 +14 +11|-bN.U -c0 -d0 -e0 -b0|01232121212121212121214121212121212121212121212121212121212141|-1PcbN.U eUnN.U 23CL0 1db0 2q10 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 2sp0 WM0|13e3",
			"Asia/Aqtau|LMT +04 +05 +06|-3l.4 -40 -50 -60|012323232323232323232123232312121212121212121212|-1Pc3l.4 eUnl.4 24PX0 2pX0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cN0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0|15e4",
			"Asia/Aqtobe|LMT +04 +05 +06|-3M.E -40 -50 -60|0123232323232323232321232323232323232323232323232|-1Pc3M.E eUnM.E 23CL0 3Db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0|27e4",
			"Asia/Ashgabat|LMT +04 +05 +06|-3R.w -40 -50 -60|0123232323232323232323212|-1Pc3R.w eUnR.w 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0|41e4",
			"Asia/Atyrau|LMT +03 +05 +06 +04|-3r.I -30 -50 -60 -40|01232323232323232323242323232323232324242424242|-1Pc3r.I eUor.I 24PW0 2pX0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 2sp0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0|",
			"Asia/Baghdad|BMT +03 +04|-2V.A -30 -40|012121212121212121212121212121212121212121212121212121|-26BeV.A 2ACnV.A 11b0 1cp0 1dz0 1dd0 1db0 1cN0 1cp0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1de0 1dc0 1dc0 1dc0 1cM0 1dc0 1cM0 1dc0 1cM0 1dc0 1dc0 1dc0 1cM0 1dc0 1cM0 1dc0 1cM0 1dc0 1dc0 1dc0 1cM0 1dc0 1cM0 1dc0 1cM0 1dc0 1dc0 1dc0 1cM0 1dc0 1cM0 1dc0 1cM0 1dc0|66e5",
			"Asia/Qatar|LMT +04 +03|-3q.8 -40 -30|012|-21Jfq.8 27BXq.8|96e4",
			"Asia/Baku|LMT +03 +04 +05|-3j.o -30 -40 -50|01232323232323232323232123232323232323232323232323232323232323232|-1Pc3j.o 1jUoj.o WCL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 1cM0 9Je0 1o00 11z0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00|27e5",
			"Asia/Bangkok|BMT +07|-6G.4 -70|01|-218SG.4|15e6",
			"Asia/Barnaul|LMT +06 +07 +08|-5z -60 -70 -80|0123232323232323232323212323232321212121212121212121212121212121212|-21S5z pCnz 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 p90 LE0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 3rd0|",
			"Asia/Beirut|EET EEST|-20 -30|010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-21aq0 1on0 1410 1db0 19B0 1in0 1ip0 WL0 1lQp0 11b0 1oN0 11b0 1oN0 11b0 1pd0 11b0 1oN0 11b0 q6N0 En0 1oN0 11b0 1oN0 11b0 1oN0 11b0 1pd0 11b0 1oN0 11b0 1op0 11b0 dA10 17b0 1iN0 17b0 1iN0 17b0 1iN0 17b0 1vB0 SL0 1mp0 13z0 1iN0 17b0 1iN0 17b0 1jd0 12n0 1a10 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0|22e5",
			"Asia/Bishkek|LMT +05 +06 +07|-4W.o -50 -60 -70|012323232323232323232321212121212121212121212121212|-1Pc4W.o eUnW.o 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2e00 1tX0 17b0 1ip0 17b0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1cPu 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0|87e4",
			"Asia/Brunei|LMT +0730 +08|-7D.E -7u -80|012|-1KITD.E gDc9.E|42e4",
			"Asia/Kolkata|MMT IST +0630|-5l.a -5u -6u|012121|-2zOtl.a 1r2LP.a 1un0 HB0 7zX0|15e6",
			"Asia/Chita|LMT +08 +09 +10|-7x.Q -80 -90 -a0|012323232323232323232321232323232323232323232323232323232323232312|-21Q7x.Q pAnx.Q 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 3re0|33e4",
			"Asia/Choibalsan|LMT +07 +08 +10 +09|-7C -70 -80 -a0 -90|0123434343434343434343434343434343434343434343424242|-2APHC 2UkoC cKn0 1da0 1dd0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 1cL0 1cN0 1cL0 1cN0 1cL0 6hD0 11z0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 3Db0 h1f0 1cJ0 1cP0 1cJ0|38e3",
			"Asia/Shanghai|CST CDT|-80 -90|01010101010101010101010101010|-23uw0 18n0 OjB0 Rz0 11d0 1wL0 A10 8HX0 1G10 Tz0 1ip0 1jX0 1cN0 11b0 1oN0 aL0 1tU30 Rb0 1o10 11z0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0|23e6",
			"Asia/Colombo|MMT +0530 +06 +0630|-5j.w -5u -60 -6u|01231321|-2zOtj.w 1rFbN.w 1zzu 7Apu 23dz0 11zu n3cu|22e5",
			"Asia/Dhaka|HMT +0630 +0530 +06 +07|-5R.k -6u -5u -60 -70|0121343|-18LFR.k 1unn.k HB0 m6n0 2kxbu 1i00|16e6",
			"Asia/Damascus|LMT EET EEST|-2p.c -20 -30|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-21Jep.c Hep.c 17b0 1ip0 17b0 1ip0 17b0 1ip0 19X0 1xRB0 11X0 1oN0 10L0 1pB0 11b0 1oN0 10L0 1mp0 13X0 1oN0 11b0 1pd0 11b0 1oN0 11b0 1oN0 11b0 1oN0 11b0 1pd0 11b0 1oN0 11b0 1oN0 11b0 1oN0 11b0 1pd0 11b0 1oN0 Nb0 1AN0 Nb0 bcp0 19X0 1gp0 19X0 3ld0 1xX0 Vd0 1Bz0 Sp0 1vX0 10p0 1dz0 1cN0 1cL0 1db0 1db0 1g10 1an0 1ap0 1db0 1fd0 1db0 1cN0 1db0 1dd0 1db0 1cp0 1dz0 1c10 1dX0 1cN0 1db0 1dd0 1db0 1cN0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1db0 1cN0 1db0 1cN0 19z0 1fB0 1qL0 11B0 1on0 Wp0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0|26e5",
			"Asia/Dili|LMT +08 +09|-8m.k -80 -90|01212|-2le8m.k 1dnXm.k 1nfA0 Xld0|19e4",
			"Asia/Dubai|LMT +04|-3F.c -40|01|-21JfF.c|39e5",
			"Asia/Dushanbe|LMT +05 +06 +07|-4z.c -50 -60 -70|012323232323232323232321|-1Pc4z.c eUnz.c 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2hB0|76e4",
			"Asia/Famagusta|LMT EET EEST +03|-2f.M -20 -30 -30|0121212121212121212121212121212121212121212121212121212121212121212121212121212121212312121212121212121212121212121212121212121|-1Vc2f.M 2a3cf.M 1cL0 1qp0 Xz0 19B0 19X0 1fB0 1db0 1cp0 1cL0 1fB0 19X0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 1cL0 1cN0 1cL0 1cN0 1o30 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 15U0 2Ks0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|",
			"Asia/Gaza|EET EEST IST IDT|-20 -30 -20 -30|010101010101010101010101010101010123232323232323232323232323232320101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-1c2o0 MM0 iM0 4JA0 10o0 1pA0 10M0 1pA0 16o0 1jA0 16o0 1jA0 pBa0 Vz0 1oN0 11b0 1oO0 10N0 1pz0 10N0 1pb0 10N0 1pb0 10N0 1pb0 10N0 1pz0 10N0 1pb0 10N0 1pb0 11d0 1oL0 dW0 hfB0 Db0 1fB0 Rb0 bXB0 gM0 8Q00 IM0 1wo0 TX0 1HB0 IL0 1s10 10n0 1o10 WL0 1zd0 On0 1ld0 11z0 1o10 14n0 1o10 14n0 1nd0 12n0 1nd0 Xz0 1q10 12n0 M10 C00 17c0 1io0 17c0 1io0 17c0 1o00 1cL0 1fB0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 17c0 1io0 18N0 1bz0 19z0 1gp0 1610 1iL0 11z0 1o10 14o0 1lA1 SKX 1xd1 MKX 1AN0 1a00 1fA0 1cL0 1cN0 1nX0 1210 1nA0 1210 1qL0 WN0 1qL0 WN0 1qL0 11c0 1on0 11B0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|18e5",
			"Asia/Hebron|EET EEST IST IDT|-20 -30 -20 -30|01010101010101010101010101010101012323232323232323232323232323232010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-1c2o0 MM0 iM0 4JA0 10o0 1pA0 10M0 1pA0 16o0 1jA0 16o0 1jA0 pBa0 Vz0 1oN0 11b0 1oO0 10N0 1pz0 10N0 1pb0 10N0 1pb0 10N0 1pb0 10N0 1pz0 10N0 1pb0 10N0 1pb0 11d0 1oL0 dW0 hfB0 Db0 1fB0 Rb0 bXB0 gM0 8Q00 IM0 1wo0 TX0 1HB0 IL0 1s10 10n0 1o10 WL0 1zd0 On0 1ld0 11z0 1o10 14n0 1o10 14n0 1nd0 12n0 1nd0 Xz0 1q10 12n0 M10 C00 17c0 1io0 17c0 1io0 17c0 1o00 1cL0 1fB0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 17c0 1io0 18N0 1bz0 19z0 1gp0 1610 1iL0 12L0 1mN0 14o0 1lc0 Tb0 1xd1 MKX bB0 cn0 1cN0 1a00 1fA0 1cL0 1cN0 1nX0 1210 1nA0 1210 1qL0 WN0 1qL0 WN0 1qL0 11c0 1on0 11B0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|25e4",
			"Asia/Ho_Chi_Minh|LMT PLMT +07 +08 +09|-76.E -76.u -70 -80 -90|0123423232|-2yC76.E bK00.a 1h7b6.u 5lz0 18o0 3Oq0 k5b0 aW00 BAM0|90e5",
			"Asia/Hong_Kong|LMT HKT HKST HKWT JST|-7A.G -80 -90 -8u -90|0123412121212121212121212121212121212121212121212121212121212121212121|-2CFH0 1taO0 Hc0 xUu 9tBu 11z0 1tDu Rc0 1wo0 11A0 1cM0 11A0 1o00 11A0 1o00 11A0 1o00 14o0 1o00 11A0 1nX0 U10 1tz0 U10 1wn0 Rd0 1wn0 U10 1tz0 U10 1tz0 U10 1tz0 U10 1wn0 Rd0 1wn0 Rd0 1wn0 U10 1tz0 U10 1tz0 17d0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 s10 1Vz0 1cN0 1cL0 1cN0 1cL0 6fd0 14n0|73e5",
			"Asia/Hovd|LMT +06 +07 +08|-66.A -60 -70 -80|012323232323232323232323232323232323232323232323232|-2APG6.A 2Uko6.A cKn0 1db0 1dd0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 1cL0 1cN0 1cL0 1cN0 1cL0 6hD0 11z0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 kEp0 1cJ0 1cP0 1cJ0|81e3",
			"Asia/Irkutsk|IMT +07 +08 +09|-6V.5 -70 -80 -90|01232323232323232323232123232323232323232323232323232323232323232|-21zGV.5 pjXV.5 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|60e4",
			"Europe/Istanbul|IMT EET EEST +03 +04|-1U.U -20 -30 -30 -40|0121212121212121212121212121212121212121212121234312121212121212121212121212121212121212121212121212121212121212123|-2ogNU.U dzzU.U 11b0 8tB0 1on0 1410 1db0 19B0 1in0 3Rd0 Un0 1oN0 11b0 zSN0 CL0 mp0 1Vz0 1gN0 8yn0 1yp0 ML0 1kp0 17b0 1ip0 17b0 1fB0 19X0 1ip0 19X0 1ip0 17b0 qdB0 38L0 1jd0 Tz0 l6O0 11A0 WN0 1qL0 TB0 1tX0 U10 1tz0 11B0 1in0 17d0 z90 cne0 pb0 2Cp0 1800 14o0 1dc0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1a00 1fA0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WO0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 Xc0 1qo0 WM0 1qM0 11A0 1o00 1200 1nA0 11A0 1tA0 U00 15w0|13e6",
			"Asia/Jakarta|BMT +0720 +0730 +09 +08 WIB|-77.c -7k -7u -90 -80 -70|01232425|-1Q0Tk luM0 mPzO 8vWu 6kpu 4PXu xhcu|31e6",
			"Asia/Jayapura|LMT +09 +0930 WIT|-9m.M -90 -9u -90|0123|-1uu9m.M sMMm.M L4nu|26e4",
			"Asia/Jerusalem|JMT IST IDT IDDT|-2k.E -20 -30 -40|01212121212121321212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-26Bek.E SyOk.E MM0 iM0 4JA0 10o0 1pA0 10M0 1pA0 16o0 1jA0 16o0 1jA0 3LA0 Eo0 oo0 1co0 1dA0 16o0 10M0 1jc0 1tA0 14o0 1cM0 1a00 11A0 1Nc0 Ao0 1Nc0 Ao0 1Ko0 LA0 1o00 WM0 EQK0 Db0 1fB0 Rb0 bXB0 gM0 8Q00 IM0 1wo0 TX0 1HB0 IL0 1s10 10n0 1o10 WL0 1zd0 On0 1ld0 11z0 1o10 14n0 1o10 14n0 1nd0 12n0 1nd0 Xz0 1q10 12n0 1hB0 1dX0 1ep0 1aL0 1eN0 17X0 1nf0 11z0 1tB0 19W0 1e10 17b0 1ep0 1gL0 18N0 1fz0 1eN0 17b0 1gq0 1gn0 19d0 1dz0 1c10 17X0 1hB0 1gn0 19d0 1dz0 1c10 17X0 1kp0 1dz0 1c10 1aL0 1eN0 1oL0 10N0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0 10N0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0 10N0 1oL0 10N0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0 10N0 1oL0 10N0 1oL0 10N0 1rz0 W10 1rz0 W10 1rz0 W10 1rz0 10N0 1oL0 10N0 1oL0|81e4",
			"Asia/Kabul|+04 +0430|-40 -4u|01|-10Qs0|46e5",
			"Asia/Kamchatka|LMT +11 +12 +13|-ay.A -b0 -c0 -d0|012323232323232323232321232323232323232323232323232323232323212|-1SLKy.A ivXy.A 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 2sp0 WM0|18e4",
			"Asia/Karachi|LMT +0530 +0630 +05 PKT PKST|-4s.c -5u -6u -50 -50 -60|012134545454|-2xoss.c 1qOKW.c 7zX0 eup0 LqMu 1fy00 1cL0 dK10 11b0 1610 1jX0|24e6",
			"Asia/Urumqi|LMT +06|-5O.k -60|01|-1GgtO.k|32e5",
			"Asia/Kathmandu|LMT +0530 +0545|-5F.g -5u -5J|012|-21JhF.g 2EGMb.g|12e5",
			"Asia/Khandyga|LMT +08 +09 +10 +11|-92.d -80 -90 -a0 -b0|0123232323232323232323212323232323232323232323232343434343434343432|-21Q92.d pAp2.d 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 qK0 yN0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 17V0 7zD0|66e2",
			"Asia/Krasnoyarsk|LMT +06 +07 +08|-6b.q -60 -70 -80|01232323232323232323232123232323232323232323232323232323232323232|-21Hib.q prAb.q 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|10e5",
			"Asia/Kuala_Lumpur|SMT +07 +0720 +0730 +09 +08|-6T.p -70 -7k -7u -90 -80|0123435|-2Bg6T.p 17anT.p l5XE 17bO 8Fyu 1so1u|71e5",
			"Asia/Kuching|LMT +0730 +08 +0820 +09|-7l.k -7u -80 -8k -90|0123232323232323242|-1KITl.k gDbP.k 6ynu AnE 1O0k AnE 1NAk AnE 1NAk AnE 1NAk AnE 1O0k AnE 1NAk AnE pAk 8Fz0|13e4",
			"Asia/Macau|LMT CST +09 +10 CDT|-7y.a -80 -90 -a0 -90|012323214141414141414141414141414141414141414141414141414141414141414141|-2CFHy.a 1uqKy.a PX0 1kn0 15B0 11b0 4Qq0 1oM0 11c0 1ko0 1u00 11A0 1cM0 11c0 1o00 11A0 1o00 11A0 1oo0 1400 1o00 11A0 1o00 U00 1tA0 U00 1wo0 Rc0 1wru U10 1tz0 U10 1tz0 U10 1tz0 U10 1wn0 Rd0 1wn0 Rd0 1wn0 U10 1tz0 U10 1tz0 17d0 1cK0 1cO0 1cK0 1cO0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 s10 1Vz0 1cN0 1cL0 1cN0 1cL0 6fd0 14n0|57e4",
			"Asia/Magadan|LMT +10 +11 +12|-a3.c -a0 -b0 -c0|012323232323232323232321232323232323232323232323232323232323232312|-1Pca3.c eUo3.c 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 3Cq0|95e3",
			"Asia/Makassar|LMT MMT +08 +09 WITA|-7V.A -7V.A -80 -90 -80|01234|-21JjV.A vfc0 myLV.A 8ML0|15e5",
			"Asia/Manila|PST PDT JST|-80 -90 -90|010201010|-1kJI0 AL0 cK10 65X0 mXB0 vX0 VK10 1db0|24e6",
			"Asia/Nicosia|LMT EET EEST|-2d.s -20 -30|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-1Vc2d.s 2a3cd.s 1cL0 1qp0 Xz0 19B0 19X0 1fB0 1db0 1cp0 1cL0 1fB0 19X0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 1cL0 1cN0 1cL0 1cN0 1o30 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|32e4",
			"Asia/Novokuznetsk|LMT +06 +07 +08|-5M.M -60 -70 -80|012323232323232323232321232323232323232323232323232323232323212|-1PctM.M eULM.M 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 2sp0 WM0|55e4",
			"Asia/Novosibirsk|LMT +06 +07 +08|-5v.E -60 -70 -80|0123232323232323232323212323212121212121212121212121212121212121212|-21Qnv.E pAFv.E 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 ml0 Os0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 4eN0|15e5",
			"Asia/Omsk|LMT +05 +06 +07|-4R.u -50 -60 -70|01232323232323232323232123232323232323232323232323232323232323232|-224sR.u pMLR.u 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|12e5",
			"Asia/Oral|LMT +03 +05 +06 +04|-3p.o -30 -50 -60 -40|01232323232323232424242424242424242424242424242|-1Pc3p.o eUop.o 23CK0 3Db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 2pB0 1cM0 1fA0 1cM0 1cM0 IM0 1EM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0|27e4",
			"Asia/Pontianak|LMT PMT +0730 +09 +08 WITA WIB|-7h.k -7h.k -7u -90 -80 -80 -70|012324256|-2ua7h.k XE00 munL.k 8Rau 6kpu 4PXu xhcu Wqnu|23e4",
			"Asia/Pyongyang|LMT KST JST KST|-8n -8u -90 -90|012313|-2um8n 97XR 1lTzu 2Onc0 6BA0|29e5",
			"Asia/Qostanay|LMT +04 +05 +06|-4e.s -40 -50 -60|012323232323232323232123232323232323232323232323|-1Pc4e.s eUoe.s 23CL0 3Db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0|",
			"Asia/Qyzylorda|LMT +04 +05 +06|-4l.Q -40 -50 -60|01232323232323232323232323232323232323232323232|-1Pc4l.Q eUol.Q 23CL0 3Db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 3ao0 1EM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 zQl0|73e4",
			"Asia/Rangoon|RMT +0630 +09|-6o.L -6u -90|0121|-21Jio.L SmnS.L 7j9u|48e5",
			"Asia/Sakhalin|LMT +09 +11 +12 +10|-9u.M -90 -b0 -c0 -a0|01232323232323232323232423232323232424242424242424242424242424242|-2AGVu.M 1BoMu.M 1qFa0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 2pB0 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 3rd0|58e4",
			"Asia/Samarkand|LMT +04 +05 +06|-4r.R -40 -50 -60|01232323232323232323232|-1Pc4r.R eUor.R 23CL0 3Db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0|36e4",
			"Asia/Seoul|LMT KST JST KST KDT KDT|-8r.Q -8u -90 -90 -a0 -9u|012343434343151515151515134343|-2um8r.Q 97XV.Q 1m1zu 6CM0 Fz0 1kN0 14n0 1kN0 14L0 1zd0 On0 69B0 2I0u OL0 1FB0 Rb0 1qN0 TX0 1tB0 TX0 1tB0 TX0 1tB0 TX0 2ap0 12FBu 11A0 1o00 11A0|23e6",
			"Asia/Srednekolymsk|LMT +10 +11 +12|-ae.Q -a0 -b0 -c0|01232323232323232323232123232323232323232323232323232323232323232|-1Pcae.Q eUoe.Q 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|35e2",
			"Asia/Taipei|CST JST CDT|-80 -90 -90|01020202020202020202020202020202020202020|-1iw80 joM0 1yo0 Tz0 1ip0 1jX0 1cN0 11b0 1oN0 11b0 1oN0 11b0 1oN0 11b0 10N0 1BX0 10p0 1pz0 10p0 1pz0 10p0 1db0 1dd0 1db0 1cN0 1db0 1cN0 1db0 1cN0 1db0 1BB0 ML0 1Bd0 ML0 uq10 1db0 1cN0 1db0 97B0 AL0|74e5",
			"Asia/Tashkent|LMT +05 +06 +07|-4B.b -50 -60 -70|012323232323232323232321|-1Pc4B.b eUnB.b 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0|23e5",
			"Asia/Tbilisi|TBMT +03 +04 +05|-2X.b -30 -40 -50|0123232323232323232323212121232323232323232323212|-1Pc2X.b 1jUnX.b WCL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 1cK0 1cL0 1cN0 1cL0 1cN0 2pz0 1cL0 1fB0 3Nz0 11B0 1nX0 11B0 1qL0 WN0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 An0 Os0 WM0|11e5",
			"Asia/Tehran|LMT TMT +0330 +04 +05 +0430|-3p.I -3p.I -3u -40 -50 -4u|01234325252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252|-2btDp.I 1d3c0 1huLT.I TXu 1pz0 sN0 vAu 1cL0 1dB0 1en0 pNB0 UL0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 64p0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0 1cN0 1dz0 1cp0 1dz0 1cp0 1dz0 1cp0 1dz0|14e6",
			"Asia/Thimphu|LMT +0530 +06|-5W.A -5u -60|012|-Su5W.A 1BGMs.A|79e3",
			"Asia/Tokyo|JST JDT|-90 -a0|010101010|-QJJ0 Rc0 1lc0 14o0 1zc0 Oo0 1zc0 Oo0|38e6",
			"Asia/Tomsk|LMT +06 +07 +08|-5D.P -60 -70 -80|0123232323232323232323212323232323232323232323212121212121212121212|-21NhD.P pxzD.P 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 co0 1bB0 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 3Qp0|10e5",
			"Asia/Ulaanbaatar|LMT +07 +08 +09|-77.w -70 -80 -90|012323232323232323232323232323232323232323232323232|-2APH7.w 2Uko7.w cKn0 1db0 1dd0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 1cL0 1cN0 1cL0 1cN0 1cL0 6hD0 11z0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 kEp0 1cJ0 1cP0 1cJ0|12e5",
			"Asia/Ust-Nera|LMT +08 +09 +12 +11 +10|-9w.S -80 -90 -c0 -b0 -a0|012343434343434343434345434343434343434343434343434343434343434345|-21Q9w.S pApw.S 23CL0 1d90 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 17V0 7zD0|65e2",
			"Asia/Vladivostok|LMT +09 +10 +11|-8L.v -90 -a0 -b0|01232323232323232323232123232323232323232323232323232323232323232|-1SJIL.v itXL.v 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|60e4",
			"Asia/Yakutsk|LMT +08 +09 +10|-8C.W -80 -90 -a0|01232323232323232323232123232323232323232323232323232323232323232|-21Q8C.W pAoC.W 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|28e4",
			"Asia/Yekaterinburg|LMT PMT +04 +05 +06|-42.x -3J.5 -40 -50 -60|012343434343434343434343234343434343434343434343434343434343434343|-2ag42.x 7mQh.s qBvJ.5 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|14e5",
			"Asia/Yerevan|LMT +03 +04 +05|-2W -30 -40 -50|0123232323232323232323212121212323232323232323232323232323232|-1Pc2W 1jUnW WCL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 2pB0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 4RX0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0|13e5",
			"Atlantic/Azores|HMT -02 -01 +00 WET|1S.w 20 10 0 0|01212121212121212121212121212121212121212121232123212321232121212121212121212121212121212121212121232323232323232323232323232323234323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-2ldW0 aPX0 Sp0 LX0 1vc0 Tc0 1uM0 SM0 1vc0 Tc0 1vc0 SM0 1vc0 6600 1co0 3E00 17c0 1fA0 1a00 1io0 1a00 1io0 17c0 3I00 17c0 1cM0 1cM0 3Fc0 1cM0 1a00 1fA0 1io0 17c0 1cM0 1cM0 1a00 1fA0 1io0 1qM0 Dc0 1tA0 1cM0 1dc0 1400 gL0 IM0 s10 U00 dX0 Rc0 pd0 Rc0 gL0 Oo0 pd0 Rc0 gL0 Oo0 pd0 14o0 1cM0 1cP0 1cM0 1cM0 1cM0 1cM0 1cM0 3Co0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 qIl0 1cM0 1fA0 1cM0 1cM0 1cN0 1cL0 1cN0 1cM0 1cM0 1cM0 1cM0 1cN0 1cL0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cL0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|25e4",
			"Atlantic/Bermuda|BMT BST AST ADT|4j.i 3j.i 40 30|010102323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-28p7E.G 1bb0 1i10 11X0 ru30 thbE.G 1PX0 11B0 1tz0 Rd0 1zb0 Op0 1zb0 3I10 Lz0 1EN0 FX0 1HB0 FX0 1Kp0 Db0 1Kp0 Db0 1Kp0 FX0 93d0 11z0 GAp0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|65e3",
			"Atlantic/Canary|LMT -01 WET WEST|11.A 10 0 -10|01232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-1UtaW.o XPAW.o 1lAK0 1a10 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|54e4",
			"Atlantic/Cape_Verde|LMT -02 -01|1y.4 20 10|01212|-2ldW0 1eEo0 7zX0 1djf0|50e4",
			"Atlantic/Faroe|LMT WET WEST|r.4 0 -10|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2uSnw.U 2Wgow.U 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|49e3",
			"Atlantic/Madeira|FMT -01 +00 +01 WET WEST|17.A 10 0 -10 0 -10|01212121212121212121212121212121212121212121232123212321232121212121212121212121212121212121212121454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454|-2ldX0 aPX0 Sp0 LX0 1vc0 Tc0 1uM0 SM0 1vc0 Tc0 1vc0 SM0 1vc0 6600 1co0 3E00 17c0 1fA0 1a00 1io0 1a00 1io0 17c0 3I00 17c0 1cM0 1cM0 3Fc0 1cM0 1a00 1fA0 1io0 17c0 1cM0 1cM0 1a00 1fA0 1io0 1qM0 Dc0 1tA0 1cM0 1dc0 1400 gL0 IM0 s10 U00 dX0 Rc0 pd0 Rc0 gL0 Oo0 pd0 Rc0 gL0 Oo0 pd0 14o0 1cM0 1cP0 1cM0 1cM0 1cM0 1cM0 1cM0 3Co0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 qIl0 1cM0 1fA0 1cM0 1cM0 1cN0 1cL0 1cN0 1cM0 1cM0 1cM0 1cM0 1cN0 1cL0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|27e4",
			"Atlantic/Reykjavik|LMT -01 +00 GMT|1s 10 0 0|012121212121212121212121212121212121212121212121212121212121212121213|-2uWmw mfaw 1Bd0 ML0 1LB0 Cn0 1LB0 3fX0 C10 HrX0 1cO0 LB0 1EL0 LA0 1C00 Oo0 1wo0 Rc0 1wo0 Rc0 1wo0 Rc0 1zc0 Oo0 1zc0 14o0 1lc0 14o0 1lc0 14o0 1o00 11A0 1lc0 14o0 1o00 14o0 1lc0 14o0 1lc0 14o0 1lc0 14o0 1lc0 14o0 1o00 14o0 1lc0 14o0 1lc0 14o0 1lc0 14o0 1lc0 14o0 1lc0 14o0 1o00 14o0 1lc0 14o0 1lc0 14o0 1lc0 14o0 1lc0 14o0 1o00 14o0|12e4",
			"Atlantic/South_Georgia|-02|20|0||30",
			"Atlantic/Stanley|SMT -04 -03 -02|3P.o 40 30 20|012121212121212323212121212121212121212121212121212121212121212121212|-2kJw8.A 12bA8.A 19X0 1fB0 19X0 1ip0 19X0 1fB0 19X0 1fB0 19X0 1fB0 Cn0 1Cc10 WL0 1qL0 U10 1tz0 2mN0 WN0 1qL0 WN0 1qL0 WN0 1qL0 WN0 1tz0 U10 1tz0 WN0 1qL0 WN0 1qL0 WN0 1qL0 WN0 1qL0 WN0 1tz0 WN0 1qL0 WN0 1qL0 WN0 1qL0 WN0 1qL0 WN0 1qN0 U10 1wn0 Rd0 1wn0 U10 1tz0 U10 1tz0 U10 1tz0 U10 1tz0 U10 1wn0 U10 1tz0 U10 1tz0 U10|21e2",
			"Australia/Sydney|AEST AEDT|-a0 -b0|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101|-293k0 xc0 10jc0 yM0 1cM0 1cM0 1fA0 1a00 17c00 LA0 1C00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 14o0 1o00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 U00 1qM0 WM0 1tA0 WM0 1tA0 U00 1tA0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 11A0 1o00 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 WM0 1qM0 14o0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0|40e5",
			"Australia/Adelaide|ACST ACDT|-9u -au|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101|-293ju xc0 10jc0 yM0 1cM0 1cM0 1fA0 1a00 17c00 LA0 1C00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 U00 1qM0 WM0 1tA0 WM0 1tA0 U00 1tA0 U00 1tA0 Oo0 1zc0 WM0 1qM0 Rc0 1zc0 U00 1tA0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 WM0 1qM0 14o0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0|11e5",
			"Australia/Brisbane|AEST AEDT|-a0 -b0|01010101010101010|-293k0 xc0 10jc0 yM0 1cM0 1cM0 1fA0 1a00 17c00 LA0 H1A0 Oo0 1zc0 Oo0 1zc0 Oo0|20e5",
			"Australia/Broken_Hill|ACST ACDT|-9u -au|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101|-293ju xc0 10jc0 yM0 1cM0 1cM0 1fA0 1a00 17c00 LA0 1C00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 14o0 1o00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 U00 1qM0 WM0 1tA0 WM0 1tA0 U00 1tA0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 WM0 1qM0 14o0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0|18e3",
			"Australia/Hobart|AEST AEDT|-a0 -b0|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101|-29E80 1a00 1qM0 Oo0 1zc0 Oo0 TAo0 yM0 1cM0 1cM0 1fA0 1a00 VfA0 1cM0 1o00 Rc0 1wo0 Rc0 1wo0 U00 1wo0 LA0 1C00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 11A0 1qM0 WM0 1qM0 Oo0 1zc0 Oo0 1zc0 Oo0 1wo0 WM0 1tA0 WM0 1tA0 U00 1tA0 U00 1tA0 11A0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 11A0 1o00 1io0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1cM0 1a00 1io0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0|21e4",
			"Australia/Darwin|ACST ACDT|-9u -au|010101010|-293ju xc0 10jc0 yM0 1cM0 1cM0 1fA0 1a00|12e4",
			"Australia/Eucla|+0845 +0945|-8J -9J|0101010101010101010|-293iJ xc0 10jc0 yM0 1cM0 1cM0 1gSo0 Oo0 l5A0 Oo0 iJA0 G00 zU00 IM0 1qM0 11A0 1o00 11A0|368",
			"Australia/Lord_Howe|AEST +1030 +1130 +11|-a0 -au -bu -b0|0121212121313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313|raC0 1zdu Rb0 1zd0 On0 1zd0 On0 1zd0 On0 1zd0 TXu 1qMu WLu 1tAu WLu 1tAu TXu 1tAu Onu 1zcu Onu 1zcu Onu 1zcu Rbu 1zcu Onu 1zcu Onu 1zcu 11zu 1o0u 11zu 1o0u 11zu 1o0u 11zu 1qMu WLu 11Au 1nXu 1qMu 11zu 1o0u 11zu 1o0u 11zu 1qMu WLu 1qMu 11zu 1o0u WLu 1qMu 14nu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1fAu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1fAu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1fzu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1fAu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1cMu 1cLu 1fAu 1cLu 1cMu 1cLu 1cMu|347",
			"Australia/Lindeman|AEST AEDT|-a0 -b0|010101010101010101010|-293k0 xc0 10jc0 yM0 1cM0 1cM0 1fA0 1a00 17c00 LA0 H1A0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0|10",
			"Australia/Melbourne|AEST AEDT|-a0 -b0|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101|-293k0 xc0 10jc0 yM0 1cM0 1cM0 1fA0 1a00 17c00 LA0 1C00 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 U00 1qM0 WM0 1qM0 11A0 1tA0 U00 1tA0 U00 1tA0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 11A0 1o00 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 WM0 1qM0 14o0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0|39e5",
			"Australia/Perth|AWST AWDT|-80 -90|0101010101010101010|-293i0 xc0 10jc0 yM0 1cM0 1cM0 1gSo0 Oo0 l5A0 Oo0 iJA0 G00 zU00 IM0 1qM0 11A0 1o00 11A0|18e5",
			"CET|CET CEST|-10 -20|01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2aFe0 11d0 1iO0 11A0 1o00 11A0 Qrc0 6i00 WM0 1fA0 1cM0 1cM0 1cM0 16M0 1gMM0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|",
			"Pacific/Easter|EMT -07 -06 -05|7h.s 70 60 50|012121212121212121212121212123232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323|-1uSgG.w 1s4IG.w WL0 1zd0 On0 1ip0 11z0 1o10 11z0 1qN0 WL0 1ld0 14n0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 WL0 1qN0 11z0 1o10 2pA0 11z0 1o10 11z0 1qN0 WL0 1qN0 WL0 1qN0 1cL0 1cN0 11z0 1o10 11z0 1qN0 WL0 1fB0 19X0 1qN0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 17b0 1ip0 11z0 1ip0 1fz0 1fB0 11z0 1qN0 WL0 1qN0 WL0 1qN0 WL0 1qN0 11z0 1o10 11z0 1o10 11z0 1qN0 WL0 1qN0 17b0 1ip0 11z0 1o10 19X0 1fB0 1nX0 G10 1EL0 Op0 1zb0 Rd0 1wn0 Rd0 46n0 Ap0 1Nb0 Ap0 1Nb0 Ap0 1zb0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1nX0 11B0 1qL0 WN0 1qL0 11B0 1nX0 11B0|30e2",
			"CST6CDT|CST CDT CWT CPT|60 50 50 50|010102301010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261s0 1nX0 11B0 1nX0 SgN0 8x30 iw0 QwN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"EET|EET EEST|-20 -30|010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|hDB0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|",
			"Europe/Dublin|DMT IST GMT BST IST|p.l -y.D 0 -10 -10|01232323232324242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242|-2ax9y.D Rc0 1fzy.D 14M0 1fc0 1g00 1co0 1dc0 1co0 1oo0 1400 1dc0 19A0 1io0 1io0 WM0 1o00 14o0 1o00 17c0 1io0 17c0 1fA0 1a00 1lc0 17c0 1io0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1cM0 1io0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1a00 1io0 1qM0 Dc0 g600 14o0 1wo0 17c0 1io0 11A0 1o00 17c0 1fA0 1a00 1fA0 1cM0 1fA0 1a00 17c0 1fA0 1a00 1io0 17c0 1lc0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1a00 1a00 1qM0 WM0 1qM0 11A0 1o00 WM0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1tA0 IM0 90o0 U00 1tA0 U00 1tA0 U00 1tA0 U00 1tA0 WM0 1qM0 WM0 1qM0 WM0 1tA0 U00 1tA0 U00 1tA0 11z0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 14o0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|12e5",
			"EST|EST|50|0||",
			"EST5EDT|EST EDT EWT EPT|50 40 40 40|010102301010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261t0 1nX0 11B0 1nX0 SgN0 8x40 iv0 QwN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"Etc/GMT-0|GMT|0|0||",
			"Etc/GMT-1|+01|-10|0||",
			"Pacific/Port_Moresby|+10|-a0|0||25e4",
			"Etc/GMT-11|+11|-b0|0||",
			"Pacific/Tarawa|+12|-c0|0||29e3",
			"Etc/GMT-13|+13|-d0|0||",
			"Etc/GMT-14|+14|-e0|0||",
			"Etc/GMT-2|+02|-20|0||",
			"Etc/GMT-3|+03|-30|0||",
			"Etc/GMT-4|+04|-40|0||",
			"Etc/GMT-5|+05|-50|0||",
			"Etc/GMT-6|+06|-60|0||",
			"Indian/Christmas|+07|-70|0||21e2",
			"Etc/GMT-8|+08|-80|0||",
			"Pacific/Palau|+09|-90|0||21e3",
			"Etc/GMT+1|-01|10|0||",
			"Etc/GMT+10|-10|a0|0||",
			"Etc/GMT+11|-11|b0|0||",
			"Etc/GMT+12|-12|c0|0||",
			"Etc/GMT+3|-03|30|0||",
			"Etc/GMT+4|-04|40|0||",
			"Etc/GMT+5|-05|50|0||",
			"Etc/GMT+6|-06|60|0||",
			"Etc/GMT+7|-07|70|0||",
			"Etc/GMT+8|-08|80|0||",
			"Etc/GMT+9|-09|90|0||",
			"Etc/UTC|UTC|0|0||",
			"Europe/Amsterdam|AMT NST +0120 +0020 CEST CET|-j.w -1j.w -1k -k -20 -10|010101010101010101010101010101010101010101012323234545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545|-2aFcj.w 11b0 1iP0 11A0 1io0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1co0 1io0 1yo0 Pc0 1a00 1fA0 1Bc0 Mo0 1tc0 Uo0 1tA0 U00 1uo0 W00 1s00 VA0 1so0 Vc0 1sM0 UM0 1wo0 Rc0 1u00 Wo0 1rA0 W00 1s00 VA0 1sM0 UM0 1w00 fV0 BCX.w 1tA0 U00 1u00 Wo0 1sm0 601k WM0 1fA0 1cM0 1cM0 1cM0 16M0 1gMM0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|16e5",
			"Europe/Andorra|WET CET CEST|0 -10 -20|012121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-UBA0 1xIN0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|79e3",
			"Europe/Astrakhan|LMT +03 +04 +05|-3c.c -30 -40 -50|012323232323232323212121212121212121212121212121212121212121212|-1Pcrc.c eUMc.c 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 2pB0 1cM0 1fA0 1cM0 3Co0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 3rd0|10e5",
			"Europe/Athens|AMT EET EEST CEST CET|-1y.Q -20 -30 -20 -10|012123434121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2a61x.Q CNbx.Q mn0 kU10 9b0 3Es0 Xa0 1fb0 1dd0 k3X0 Nz0 SCp0 1vc0 SO0 1cM0 1a00 1ao0 1fc0 1a10 1fG0 1cg0 1dX0 1bX0 1cQ0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|35e5",
			"Europe/London|GMT BST BDST|0 -10 -20|0101010101010101010101010101010101010101010101010121212121210101210101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2axa0 Rc0 1fA0 14M0 1fc0 1g00 1co0 1dc0 1co0 1oo0 1400 1dc0 19A0 1io0 1io0 WM0 1o00 14o0 1o00 17c0 1io0 17c0 1fA0 1a00 1lc0 17c0 1io0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1cM0 1io0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1a00 1io0 1qM0 Dc0 2Rz0 Dc0 1zc0 Oo0 1zc0 Rc0 1wo0 17c0 1iM0 FA0 xB0 1fA0 1a00 14o0 bb0 LA0 xB0 Rc0 1wo0 11A0 1o00 17c0 1fA0 1a00 1fA0 1cM0 1fA0 1a00 17c0 1fA0 1a00 1io0 17c0 1lc0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1a00 1a00 1qM0 WM0 1qM0 11A0 1o00 WM0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1tA0 IM0 90o0 U00 1tA0 U00 1tA0 U00 1tA0 U00 1tA0 WM0 1qM0 WM0 1qM0 WM0 1tA0 U00 1tA0 U00 1tA0 11z0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1o00 14o0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|10e6",
			"Europe/Belgrade|CET CEST|-10 -20|01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-19RC0 3IP0 WM0 1fA0 1cM0 1cM0 1rc0 Qo0 1vmo0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|12e5",
			"Europe/Berlin|CET CEST CEMT|-10 -20 -30|01010101010101210101210101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2aFe0 11d0 1iO0 11A0 1o00 11A0 Qrc0 6i00 WM0 1fA0 1cM0 1cM0 1cM0 kL0 Nc0 m10 WM0 1ao0 1cp0 dX0 jz0 Dd0 1io0 17c0 1fA0 1a00 1ehA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|41e5",
			"Europe/Prague|CET CEST GMT|-10 -20 0|01010101010101010201010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2aFe0 11d0 1iO0 11A0 1o00 11A0 Qrc0 6i00 WM0 1fA0 1cM0 1cM0 1cM0 1cM0 1qM0 11c0 mp0 xA0 mn0 17c0 1io0 17c0 1fc0 1ao0 1bNc0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|13e5",
			"Europe/Brussels|WET CET CEST WEST|0 -10 -20 -10|0121212103030303030303030303030303030303030303030303212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2ehc0 3zX0 11c0 1iO0 11A0 1o00 11A0 my0 Ic0 1qM0 Rc0 1EM0 UM0 1u00 10o0 1io0 1io0 17c0 1a00 1fA0 1cM0 1cM0 1io0 17c0 1fA0 1a00 1io0 1a30 1io0 17c0 1fA0 1a00 1io0 17c0 1cM0 1cM0 1a00 1io0 1cM0 1cM0 1a00 1fA0 1io0 17c0 1cM0 1cM0 1a00 1fA0 1io0 1qM0 Dc0 y00 5Wn0 WM0 1fA0 1cM0 16M0 1iM0 16M0 1C00 Uo0 1eeo0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|21e5",
			"Europe/Bucharest|BMT EET EEST|-1I.o -20 -30|0121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-1xApI.o 20LI.o RA0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1Axc0 On0 1fA0 1a10 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cK0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cL0 1cN0 1cL0 1fB0 1nX0 11E0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|19e5",
			"Europe/Budapest|CET CEST|-10 -20|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2aFe0 11d0 1iO0 11A0 1o00 11A0 1oo0 11c0 1lc0 17c0 O1V0 3Nf0 WM0 1fA0 1cM0 1cM0 1oJ0 1dd0 1020 1fX0 1cp0 1cM0 1cM0 1cM0 1fA0 1a00 bhy0 Rb0 1wr0 Rc0 1C00 LA0 1C00 LA0 SNW0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cO0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|17e5",
			"Europe/Zurich|CET CEST|-10 -20|01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-19Lc0 11A0 1o00 11A0 1xG10 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|38e4",
			"Europe/Chisinau|CMT BMT EET EEST CEST CET MSK MSD|-1T -1I.o -20 -30 -20 -10 -30 -40|012323232323232323234545467676767676767676767323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232323232|-26jdT wGMa.A 20LI.o RA0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 27A0 2en0 39g0 WM0 1fA0 1cM0 V90 1t7z0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 gL0 WO0 1cM0 1cM0 1cK0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 1nX0 11D0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|67e4",
			"Europe/Copenhagen|CET CEST|-10 -20|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2azC0 Tz0 VuO0 60q0 WM0 1fA0 1cM0 1cM0 1cM0 S00 1HA0 Nc0 1C00 Dc0 1Nc0 Ao0 1h5A0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|12e5",
			"Europe/Gibraltar|GMT BST BDST CET CEST|0 -10 -20 -10 -20|010101010101010101010101010101010101010101010101012121212121010121010101010101010101034343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343|-2axa0 Rc0 1fA0 14M0 1fc0 1g00 1co0 1dc0 1co0 1oo0 1400 1dc0 19A0 1io0 1io0 WM0 1o00 14o0 1o00 17c0 1io0 17c0 1fA0 1a00 1lc0 17c0 1io0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1cM0 1io0 17c0 1fA0 1a00 1io0 17c0 1io0 17c0 1fA0 1a00 1io0 1qM0 Dc0 2Rz0 Dc0 1zc0 Oo0 1zc0 Rc0 1wo0 17c0 1iM0 FA0 xB0 1fA0 1a00 14o0 bb0 LA0 xB0 Rc0 1wo0 11A0 1o00 17c0 1fA0 1a00 1fA0 1cM0 1fA0 1a00 17c0 1fA0 1a00 1io0 17c0 1lc0 17c0 1fA0 10Jz0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|30e3",
			"Europe/Helsinki|HMT EET EEST|-1D.N -20 -30|0121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-1WuND.N OULD.N 1dA0 1xGq0 1cM0 1cM0 1cM0 1cN0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|12e5",
			"Europe/Kaliningrad|CET CEST EET EEST MSK MSD +03|-10 -20 -20 -30 -30 -40 -30|01010101010101232454545454545454543232323232323232323232323232323232323232323262|-2aFe0 11d0 1iO0 11A0 1o00 11A0 Qrc0 6i00 WM0 1fA0 1cM0 1cM0 1cM0 390 7A0 1en0 12N0 1pbb0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cN0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|44e4",
			"Europe/Kiev|KMT EET MSK CEST CET MSD EEST|-22.4 -20 -30 -20 -10 -40 -30|0123434252525252525252525256161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161|-1Pc22.4 eUo2.4 rnz0 2Hg0 WM0 1fA0 da0 1v4m0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 Db0 3220 1cK0 1cL0 1cN0 1cL0 1cN0 1cL0 1cQ0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|34e5",
			"Europe/Kirov|LMT +03 +04 +05|-3i.M -30 -40 -50|01232323232323232321212121212121212121212121212121212121212121|-22WM0 qH90 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 2pB0 1cM0 1fA0 1cM0 3Co0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|48e4",
			"Europe/Lisbon|LMT WET WEST WEMT CET CEST|A.J 0 -10 -20 -10 -20|012121212121212121212121212121212121212121212321232123212321212121212121212121212121212121212121214121212121212121212121212121212124545454212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2le00 aPX0 Sp0 LX0 1vc0 Tc0 1uM0 SM0 1vc0 Tc0 1vc0 SM0 1vc0 6600 1co0 3E00 17c0 1fA0 1a00 1io0 1a00 1io0 17c0 3I00 17c0 1cM0 1cM0 3Fc0 1cM0 1a00 1fA0 1io0 17c0 1cM0 1cM0 1a00 1fA0 1io0 1qM0 Dc0 1tA0 1cM0 1dc0 1400 gL0 IM0 s10 U00 dX0 Rc0 pd0 Rc0 gL0 Oo0 pd0 Rc0 gL0 Oo0 pd0 14o0 1cM0 1cP0 1cM0 1cM0 1cM0 1cM0 1cM0 3Co0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 pvy0 1cM0 1cM0 1fA0 1cM0 1cM0 1cN0 1cL0 1cN0 1cM0 1cM0 1cM0 1cM0 1cN0 1cL0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|27e5",
			"Europe/Luxembourg|LMT CET CEST WET WEST WEST WET|-o.A -10 -20 0 -10 -20 -10|0121212134343434343434343434343434343434343434343434565651212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2DG0o.A t6mo.A TB0 1nX0 Up0 1o20 11A0 rW0 CM0 1qP0 R90 1EO0 UK0 1u20 10m0 1ip0 1in0 17e0 19W0 1fB0 1db0 1cp0 1in0 17d0 1fz0 1a10 1in0 1a10 1in0 17f0 1fA0 1a00 1io0 17c0 1cM0 1cM0 1a00 1io0 1cM0 1cM0 1a00 1fA0 1io0 17c0 1cM0 1cM0 1a00 1fA0 1io0 1qM0 Dc0 vA0 60L0 WM0 1fA0 1cM0 17c0 1io0 16M0 1C00 Uo0 1eeo0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|54e4",
			"Europe/Madrid|WET WEST WEMT CET CEST|0 -10 -20 -10 -20|010101010101010101210343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343|-25Td0 19B0 1cL0 1dd0 b1z0 18p0 3HX0 17d0 1fz0 1a10 1io0 1a00 1in0 17d0 iIn0 Hd0 1cL0 bb0 1200 2s20 14n0 5aL0 Mp0 1vz0 17d0 1in0 17d0 1in0 17d0 1in0 17d0 6hX0 11B0 XHX0 1a10 1fz0 1a10 19X0 1cN0 1fz0 1a10 1fC0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|62e5",
			"Europe/Malta|CET CEST|-10 -20|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2arB0 Lz0 1cN0 1db0 1410 1on0 Wp0 1qL0 17d0 1cL0 M3B0 5M20 WM0 1fA0 1co0 17c0 1iM0 16m0 1de0 1lc0 14m0 1lc0 WO0 1qM0 GTW0 On0 1C10 LA0 1C00 LA0 1EM0 LA0 1C00 LA0 1zc0 Oo0 1C00 Oo0 1co0 1cM0 1lA0 Xc0 1qq0 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1o10 11z0 1iN0 19z0 1fB0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|42e4",
			"Europe/Minsk|MMT EET MSK CEST CET MSD EEST +03|-1O -20 -30 -20 -10 -40 -30 -30|01234343252525252525252525261616161616161616161616161616161616161617|-1Pc1O eUnO qNX0 3gQ0 WM0 1fA0 1cM0 Al0 1tsn0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 3Fc0 1cN0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0|19e5",
			"Europe/Monaco|PMT WET WEST WEMT CET CEST|-9.l 0 -10 -20 -10 -20|01212121212121212121212121212121212121212121212121232323232345454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454|-2n5c9.l cFX9.l HA0 19A0 1iM0 11c0 1oo0 Wo0 1rc0 QM0 1EM0 UM0 1u00 10o0 1io0 1wo0 Rc0 1a00 1fA0 1cM0 1cM0 1io0 17c0 1fA0 1a00 1io0 1a00 1io0 17c0 1fA0 1a00 1io0 17c0 1cM0 1cM0 1a00 1io0 1cM0 1cM0 1a00 1fA0 1io0 17c0 1cM0 1cM0 1a00 1fA0 1io0 1qM0 Df0 2RV0 11z0 11B0 1ze0 WM0 1fA0 1cM0 1fa0 1aq0 16M0 1ekn0 1cL0 1fC0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|38e3",
			"Europe/Moscow|MMT MMT MST MDST MSD MSK +05 EET EEST MSK|-2u.h -2v.j -3v.j -4v.j -40 -30 -50 -20 -30 -40|012132345464575454545454545454545458754545454545454545454545454545454545454595|-2ag2u.h 2pyW.W 1bA0 11X0 GN0 1Hb0 c4v.j ik0 3DA0 dz0 15A0 c10 2q10 iM10 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cN0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0|16e6",
			"Europe/Paris|PMT WET WEST CEST CET WEMT|-9.l 0 -10 -20 -10 -20|0121212121212121212121212121212121212121212121212123434352543434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434|-2nco9.l cNb9.l HA0 19A0 1iM0 11c0 1oo0 Wo0 1rc0 QM0 1EM0 UM0 1u00 10o0 1io0 1wo0 Rc0 1a00 1fA0 1cM0 1cM0 1io0 17c0 1fA0 1a00 1io0 1a00 1io0 17c0 1fA0 1a00 1io0 17c0 1cM0 1cM0 1a00 1io0 1cM0 1cM0 1a00 1fA0 1io0 17c0 1cM0 1cM0 1a00 1fA0 1io0 1qM0 Df0 Ik0 5M30 WM0 1fA0 1cM0 Vx0 hB0 1aq0 16M0 1ekn0 1cL0 1fC0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|11e6",
			"Europe/Riga|RMT LST EET MSK CEST CET MSD EEST|-1A.y -2A.y -20 -30 -20 -10 -40 -30|010102345454536363636363636363727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272727272|-25TzA.y 11A0 1iM0 ko0 gWm0 yDXA.y 2bX0 3fE0 WM0 1fA0 1cM0 1cM0 4m0 1sLy0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cN0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cN0 1o00 11A0 1o00 11A0 1qM0 3oo0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|64e4",
			"Europe/Rome|CET CEST|-10 -20|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2arB0 Lz0 1cN0 1db0 1410 1on0 Wp0 1qL0 17d0 1cL0 M3B0 5M20 WM0 1fA0 1cM0 16M0 1iM0 16m0 1de0 1lc0 14m0 1lc0 WO0 1qM0 GTW0 On0 1C10 LA0 1C00 LA0 1EM0 LA0 1C00 LA0 1zc0 Oo0 1C00 Oo0 1C00 LA0 1zc0 Oo0 1C00 LA0 1C00 LA0 1zc0 Oo0 1C00 Oo0 1zc0 Oo0 1fC0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|39e5",
			"Europe/Samara|LMT +03 +04 +05|-3k.k -30 -40 -50|0123232323232323232121232323232323232323232323232323232323212|-22WM0 qH90 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 2pB0 1cM0 1fA0 2y10 14m0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 2sp0 WM0|12e5",
			"Europe/Saratov|LMT +03 +04 +05|-34.i -30 -40 -50|012323232323232321212121212121212121212121212121212121212121212|-22WM0 qH90 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 2pB0 1cM0 1cM0 1cM0 1fA0 1cM0 3Co0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 5810|",
			"Europe/Simferopol|SMT EET MSK CEST CET MSD EEST MSK|-2g -20 -30 -20 -10 -40 -30 -40|012343432525252525252525252161616525252616161616161616161616161616161616172|-1Pc2g eUog rEn0 2qs0 WM0 1fA0 1cM0 3V0 1u0L0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1Q00 4eL0 1cL0 1cN0 1cL0 1cN0 dX0 WL0 1cN0 1cL0 1fB0 1o30 11B0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11z0 1nW0|33e4",
			"Europe/Sofia|EET CET CEST EEST|-20 -10 -20 -30|01212103030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030|-168L0 WM0 1fA0 1cM0 1cM0 1cN0 1mKH0 1dd0 1fb0 1ap0 1fb0 1a20 1fy0 1a30 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cK0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 1nX0 11E0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|12e5",
			"Europe/Stockholm|CET CEST|-10 -20|01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2azC0 TB0 2yDe0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|15e5",
			"Europe/Tallinn|TMT CET CEST EET MSK MSD EEST|-1D -10 -20 -20 -30 -40 -30|012103421212454545454545454546363636363636363636363636363636363636363636363636363636363636363636363636363636363636363636363|-26oND teD 11A0 1Ta0 4rXl KSLD 2FX0 2Jg0 WM0 1fA0 1cM0 18J0 1sTX0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cN0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o10 11A0 1qM0 5QM0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|41e4",
			"Europe/Tirane|LMT CET CEST|-1j.k -10 -20|01212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2glBj.k 14pcj.k 5LC0 WM0 4M0 1fCK0 10n0 1op0 11z0 1pd0 11z0 1qN0 WL0 1qp0 Xb0 1qp0 Xb0 1qp0 11z0 1lB0 11z0 1qN0 11z0 1iN0 16n0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|42e4",
			"Europe/Ulyanovsk|LMT +03 +04 +05 +02|-3d.A -30 -40 -50 -20|01232323232323232321214121212121212121212121212121212121212121212|-22WM0 qH90 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 2pB0 1cM0 1fA0 2pB0 IM0 rX0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 3rd0|13e5",
			"Europe/Uzhgorod|CET CEST MSK MSD EET EEST|-10 -20 -30 -40 -20 -30|010101023232323232323232320454545454545454545454545454545454545454545454545454545454545454545454545454545454545454545454|-1cqL0 6i00 WM0 1fA0 1cM0 1ml0 1Cp0 1r3W0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1Q00 1Nf0 2pw0 1cL0 1cN0 1cL0 1cN0 1cL0 1cQ0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|11e4",
			"Europe/Vienna|CET CEST|-10 -20|0101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2aFe0 11d0 1iO0 11A0 1o00 11A0 3KM0 14o0 LA00 6i00 WM0 1fA0 1cM0 1cM0 1cM0 400 2qM0 1ao0 1co0 1cM0 1io0 17c0 1gHa0 19X0 1cP0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|18e5",
			"Europe/Vilnius|WMT KMT CET EET MSK CEST MSD EEST|-1o -1z.A -10 -20 -30 -20 -40 -30|012324525254646464646464646473737373737373737352537373737373737373737373737373737373737373737373737373737373737373737373|-293do 6ILM.o 1Ooz.A zz0 Mfd0 29W0 3is0 WM0 1fA0 1cM0 LV0 1tgL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cN0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11B0 1o00 11A0 1qM0 8io0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|54e4",
			"Europe/Volgograd|LMT +03 +04 +05|-2V.E -30 -40 -50|0123232323232323212121212121212121212121212121212121212121212121|-21IqV.E psLV.E 23CL0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 2pB0 1cM0 1cM0 1cM0 1fA0 1cM0 3Co0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 8Hz0 9Jd0 5gn0|10e5",
			"Europe/Warsaw|WMT CET CEST EET EEST|-1o -10 -20 -20 -30|012121234312121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121|-2ctdo 1LXo 11d0 1iO0 11A0 1o00 11A0 1on0 11A0 6zy0 HWP0 5IM0 WM0 1fA0 1cM0 1dz0 1mL0 1en0 15B0 1aq0 1nA0 11A0 1io0 17c0 1fA0 1a00 iDX0 LA0 1cM0 1cM0 1C00 Oo0 1cM0 1cM0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1C00 LA0 uso0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cN0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|17e5",
			"Europe/Zaporozhye|+0220 EET MSK CEST CET MSD EEST|-2k -20 -30 -20 -10 -40 -30|01234342525252525252525252526161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161|-1Pc2k eUok rdb0 2RE0 WM0 1fA0 8m0 1v9a0 1db0 1cN0 1db0 1cN0 1db0 1dd0 1cO0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cK0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cQ0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|77e4",
			"HST|HST|a0|0||",
			"Indian/Chagos|LMT +05 +06|-4N.E -50 -60|012|-2xosN.E 3AGLN.E|30e2",
			"Indian/Cocos|+0630|-6u|0||596",
			"Indian/Kerguelen|-00 +05|0 -50|01|-MG00|130",
			"Indian/Mahe|LMT +04|-3F.M -40|01|-2xorF.M|79e3",
			"Indian/Maldives|MMT +05|-4S -50|01|-olgS|35e4",
			"Indian/Mauritius|LMT +04 +05|-3O -40 -50|012121|-2xorO 34unO 14L0 12kr0 11z0|15e4",
			"Indian/Reunion|LMT +04|-3F.Q -40|01|-2mDDF.Q|84e4",
			"Pacific/Kwajalein|+11 +10 +09 -12 +12|-b0 -a0 -90 c0 -c0|012034|-1kln0 akp0 6Up0 12ry0 Wan0|14e3",
			"MET|MET MEST|-10 -20|01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-2aFe0 11d0 1iO0 11A0 1o00 11A0 Qrc0 6i00 WM0 1fA0 1cM0 1cM0 1cM0 16M0 1gMM0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|",
			"MST|MST|70|0||",
			"MST7MDT|MST MDT MWT MPT|70 60 60 60|010102301010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261r0 1nX0 11B0 1nX0 SgN0 8x20 ix0 QwN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"Pacific/Chatham|+1215 +1245 +1345|-cf -cJ -dJ|012121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212121212|-WqAf 1adef IM0 1C00 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Oo0 1zc0 Rc0 1zc0 Oo0 1qM0 14o0 1lc0 14o0 1lc0 14o0 1lc0 17c0 1io0 17c0 1io0 17c0 1io0 17c0 1lc0 14o0 1lc0 14o0 1lc0 17c0 1io0 17c0 1io0 17c0 1lc0 14o0 1lc0 14o0 1lc0 17c0 1io0 17c0 1io0 17c0 1io0 17c0 1io0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1io0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00|600",
			"Pacific/Apia|LMT -1130 -11 -10 +14 +13|bq.U bu b0 a0 -e0 -d0|01232345454545454545454545454545454545454545454545454545454|-2nDMx.4 1yW03.4 2rRbu 1ff0 1a00 CI0 AQ0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1io0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1a00 1fA0 1cM0 1fA0 1a00 1fA0 1a00|37e3",
			"Pacific/Bougainville|+10 +09 +11|-a0 -90 -b0|0102|-16Wy0 7CN0 2MQp0|18e4",
			"Pacific/Chuuk|+10 +09|-a0 -90|01010|-2ewy0 axB0 RVX0 axd0|49e3",
			"Pacific/Efate|LMT +11 +12|-bd.g -b0 -c0|012121212121212121212121|-2l9nd.g 2uNXd.g Dc0 n610 1cL0 1cN0 1cL0 1fB0 19X0 1fB0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1fB0 Lz0 1Nd0 An0|66e3",
			"Pacific/Enderbury|-12 -11 +13|c0 b0 -d0|012|nIc0 B7X0|1",
			"Pacific/Fakaofo|-11 +13|b0 -d0|01|1Gfn0|483",
			"Pacific/Fiji|LMT +12 +13|-bT.I -c0 -d0|0121212121212121212121212121212121212121212121212121212121212121|-2bUzT.I 3m8NT.I LA0 1EM0 IM0 nJc0 LA0 1o00 Rc0 1wo0 Ao0 1Nc0 Ao0 1Q00 xz0 1SN0 uM0 1SM0 uM0 1VA0 s00 1VA0 s00 1VA0 s00 20o0 pc0 2hc0 bc0 20o0 pc0 20o0 pc0 20o0 pc0 20o0 pc0 20o0 s00 1VA0 s00 20o0 pc0 20o0 pc0 20o0 pc0 20o0 pc0 20o0 s00 20o0 pc0 20o0 pc0 20o0 pc0 20o0 pc0 20o0 s00 1VA0 s00|88e4",
			"Pacific/Galapagos|LMT -05 -06|5W.o 50 60|01212|-1yVS1.A 2dTz1.A gNd0 rz0|25e3",
			"Pacific/Gambier|LMT -09|8X.M 90|01|-2jof0.c|125",
			"Pacific/Guadalcanal|LMT +11|-aD.M -b0|01|-2joyD.M|11e4",
			"Pacific/Guam|GST +09 GDT ChST|-a0 -90 -b0 -a0|01020202020202020203|-18jK0 6pB0 AhB0 3QL0 g2p0 3p91 WOX rX0 1zd0 Rb0 1wp0 Rb0 5xd0 rX0 5sN0 zb1 1C0X On0 ULb0|17e4",
			"Pacific/Honolulu|HST HDT HWT HPT HST|au 9u 9u 9u a0|0102304|-1thLu 8x0 lef0 8wWu iAu 46p0|37e4",
			"Pacific/Kiritimati|-1040 -10 +14|aE a0 -e0|012|nIaE B7Xk|51e2",
			"Pacific/Kosrae|+11 +09 +10 +12|-b0 -90 -a0 -c0|01021030|-2ewz0 axC0 HBy0 akp0 axd0 WOK0 1bdz0|66e2",
			"Pacific/Majuro|+11 +09 +10 +12|-b0 -90 -a0 -c0|0102103|-2ewz0 axC0 HBy0 akp0 6RB0 12um0|28e3",
			"Pacific/Marquesas|LMT -0930|9i 9u|01|-2joeG|86e2",
			"Pacific/Pago_Pago|LMT SST|bm.M b0|01|-2nDMB.c|37e2",
			"Pacific/Nauru|LMT +1130 +09 +12|-b7.E -bu -90 -c0|01213|-1Xdn7.E QCnB.E 7mqu 1lnbu|10e3",
			"Pacific/Niue|-1120 -1130 -11|bk bu b0|012|-KfME 17y0a|12e2",
			"Pacific/Norfolk|+1112 +1130 +1230 +11 +12|-bc -bu -cu -b0 -c0|012134343434343434343434343434343434343434|-Kgbc W01G Oo0 1COo0 9Jcu 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0|25e4",
			"Pacific/Noumea|LMT +11 +12|-b5.M -b0 -c0|01212121|-2l9n5.M 2EqM5.M xX0 1PB0 yn0 HeP0 Ao0|98e3",
			"Pacific/Pitcairn|-0830 -08|8u 80|01|18Vku|56",
			"Pacific/Pohnpei|+11 +09 +10|-b0 -90 -a0|010210|-2ewz0 axC0 HBy0 akp0 axd0|34e3",
			"Pacific/Rarotonga|-1030 -0930 -10|au 9u a0|012121212121212121212121212|lyWu IL0 1zcu Onu 1zcu Onu 1zcu Rbu 1zcu Onu 1zcu Onu 1zcu Onu 1zcu Onu 1zcu Onu 1zcu Rbu 1zcu Onu 1zcu Onu 1zcu Onu|13e3",
			"Pacific/Tahiti|LMT -10|9W.g a0|01|-2joe1.I|18e4",
			"Pacific/Tongatapu|+1220 +13 +14|-ck -d0 -e0|0121212121|-1aB0k 2n5dk 15A0 1wo0 xz0 1Q10 xz0 zWN0 s00|75e3",
			"PST8PDT|PST PDT PWT PPT|80 70 70 70|010102301010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|-261q0 1nX0 11B0 1nX0 SgN0 8x10 iy0 QwN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1cN0 1cL0 1cN0 1cL0 s10 1Vz0 LB0 1BX0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 1cN0 1fz0 1a10 1fz0 1cN0 1cL0 1cN0 1cL0 1cN0 1cL0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 14p0 1lb0 14p0 1lb0 14p0 1nX0 11B0 1nX0 11B0 1nX0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Rd0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0 Op0 1zb0|",
			"WET|WET WEST|0 -10|010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010|hDB0 1a00 1fA0 1cM0 1cM0 1cM0 1fA0 1a00 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1cM0 1fA0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00 11A0 1qM0 WM0 1qM0 WM0 1qM0 WM0 1qM0 11A0 1o00 11A0 1o00|"
		],
		"links": [
			"Africa/Abidjan|Africa/Bamako",
			"Africa/Abidjan|Africa/Banjul",
			"Africa/Abidjan|Africa/Conakry",
			"Africa/Abidjan|Africa/Dakar",
			"Africa/Abidjan|Africa/Freetown",
			"Africa/Abidjan|Africa/Lome",
			"Africa/Abidjan|Africa/Nouakchott",
			"Africa/Abidjan|Africa/Ouagadougou",
			"Africa/Abidjan|Africa/Timbuktu",
			"Africa/Abidjan|Atlantic/St_Helena",
			"Africa/Cairo|Egypt",
			"Africa/Johannesburg|Africa/Maseru",
			"Africa/Johannesburg|Africa/Mbabane",
			"Africa/Lagos|Africa/Bangui",
			"Africa/Lagos|Africa/Brazzaville",
			"Africa/Lagos|Africa/Douala",
			"Africa/Lagos|Africa/Kinshasa",
			"Africa/Lagos|Africa/Libreville",
			"Africa/Lagos|Africa/Luanda",
			"Africa/Lagos|Africa/Malabo",
			"Africa/Lagos|Africa/Niamey",
			"Africa/Lagos|Africa/Porto-Novo",
			"Africa/Maputo|Africa/Blantyre",
			"Africa/Maputo|Africa/Bujumbura",
			"Africa/Maputo|Africa/Gaborone",
			"Africa/Maputo|Africa/Harare",
			"Africa/Maputo|Africa/Kigali",
			"Africa/Maputo|Africa/Lubumbashi",
			"Africa/Maputo|Africa/Lusaka",
			"Africa/Nairobi|Africa/Addis_Ababa",
			"Africa/Nairobi|Africa/Asmara",
			"Africa/Nairobi|Africa/Asmera",
			"Africa/Nairobi|Africa/Dar_es_Salaam",
			"Africa/Nairobi|Africa/Djibouti",
			"Africa/Nairobi|Africa/Kampala",
			"Africa/Nairobi|Africa/Mogadishu",
			"Africa/Nairobi|Indian/Antananarivo",
			"Africa/Nairobi|Indian/Comoro",
			"Africa/Nairobi|Indian/Mayotte",
			"Africa/Tripoli|Libya",
			"America/Adak|America/Atka",
			"America/Adak|US/Aleutian",
			"America/Anchorage|US/Alaska",
			"America/Argentina/Buenos_Aires|America/Buenos_Aires",
			"America/Argentina/Catamarca|America/Argentina/ComodRivadavia",
			"America/Argentina/Catamarca|America/Catamarca",
			"America/Argentina/Cordoba|America/Cordoba",
			"America/Argentina/Cordoba|America/Rosario",
			"America/Argentina/Jujuy|America/Jujuy",
			"America/Argentina/Mendoza|America/Mendoza",
			"America/Atikokan|America/Coral_Harbour",
			"America/Chicago|US/Central",
			"America/Curacao|America/Aruba",
			"America/Curacao|America/Kralendijk",
			"America/Curacao|America/Lower_Princes",
			"America/Denver|America/Shiprock",
			"America/Denver|Navajo",
			"America/Denver|US/Mountain",
			"America/Detroit|US/Michigan",
			"America/Edmonton|Canada/Mountain",
			"America/Fort_Wayne|America/Indiana/Indianapolis",
			"America/Fort_Wayne|America/Indianapolis",
			"America/Fort_Wayne|US/East-Indiana",
			"America/Godthab|America/Nuuk",
			"America/Halifax|Canada/Atlantic",
			"America/Havana|Cuba",
			"America/Indiana/Knox|America/Knox_IN",
			"America/Indiana/Knox|US/Indiana-Starke",
			"America/Jamaica|Jamaica",
			"America/Kentucky/Louisville|America/Louisville",
			"America/Los_Angeles|US/Pacific",
			"America/Manaus|Brazil/West",
			"America/Mazatlan|Mexico/BajaSur",
			"America/Mexico_City|Mexico/General",
			"America/New_York|US/Eastern",
			"America/Noronha|Brazil/DeNoronha",
			"America/Panama|America/Cayman",
			"America/Phoenix|US/Arizona",
			"America/Port_of_Spain|America/Anguilla",
			"America/Port_of_Spain|America/Antigua",
			"America/Port_of_Spain|America/Dominica",
			"America/Port_of_Spain|America/Grenada",
			"America/Port_of_Spain|America/Guadeloupe",
			"America/Port_of_Spain|America/Marigot",
			"America/Port_of_Spain|America/Montserrat",
			"America/Port_of_Spain|America/St_Barthelemy",
			"America/Port_of_Spain|America/St_Kitts",
			"America/Port_of_Spain|America/St_Lucia",
			"America/Port_of_Spain|America/St_Thomas",
			"America/Port_of_Spain|America/St_Vincent",
			"America/Port_of_Spain|America/Tortola",
			"America/Port_of_Spain|America/Virgin",
			"America/Regina|Canada/Saskatchewan",
			"America/Rio_Branco|America/Porto_Acre",
			"America/Rio_Branco|Brazil/Acre",
			"America/Santiago|Chile/Continental",
			"America/Sao_Paulo|Brazil/East",
			"America/St_Johns|Canada/Newfoundland",
			"America/Tijuana|America/Ensenada",
			"America/Tijuana|America/Santa_Isabel",
			"America/Tijuana|Mexico/BajaNorte",
			"America/Toronto|America/Montreal",
			"America/Toronto|Canada/Eastern",
			"America/Vancouver|Canada/Pacific",
			"America/Whitehorse|Canada/Yukon",
			"America/Winnipeg|Canada/Central",
			"Asia/Ashgabat|Asia/Ashkhabad",
			"Asia/Bangkok|Asia/Phnom_Penh",
			"Asia/Bangkok|Asia/Vientiane",
			"Asia/Dhaka|Asia/Dacca",
			"Asia/Dubai|Asia/Muscat",
			"Asia/Ho_Chi_Minh|Asia/Saigon",
			"Asia/Hong_Kong|Hongkong",
			"Asia/Jerusalem|Asia/Tel_Aviv",
			"Asia/Jerusalem|Israel",
			"Asia/Kathmandu|Asia/Katmandu",
			"Asia/Kolkata|Asia/Calcutta",
			"Asia/Kuala_Lumpur|Asia/Singapore",
			"Asia/Kuala_Lumpur|Singapore",
			"Asia/Macau|Asia/Macao",
			"Asia/Makassar|Asia/Ujung_Pandang",
			"Asia/Nicosia|Europe/Nicosia",
			"Asia/Qatar|Asia/Bahrain",
			"Asia/Rangoon|Asia/Yangon",
			"Asia/Riyadh|Asia/Aden",
			"Asia/Riyadh|Asia/Kuwait",
			"Asia/Seoul|ROK",
			"Asia/Shanghai|Asia/Chongqing",
			"Asia/Shanghai|Asia/Chungking",
			"Asia/Shanghai|Asia/Harbin",
			"Asia/Shanghai|PRC",
			"Asia/Taipei|ROC",
			"Asia/Tehran|Iran",
			"Asia/Thimphu|Asia/Thimbu",
			"Asia/Tokyo|Japan",
			"Asia/Ulaanbaatar|Asia/Ulan_Bator",
			"Asia/Urumqi|Asia/Kashgar",
			"Atlantic/Faroe|Atlantic/Faeroe",
			"Atlantic/Reykjavik|Iceland",
			"Atlantic/South_Georgia|Etc/GMT+2",
			"Australia/Adelaide|Australia/South",
			"Australia/Brisbane|Australia/Queensland",
			"Australia/Broken_Hill|Australia/Yancowinna",
			"Australia/Darwin|Australia/North",
			"Australia/Hobart|Australia/Currie",
			"Australia/Hobart|Australia/Tasmania",
			"Australia/Lord_Howe|Australia/LHI",
			"Australia/Melbourne|Australia/Victoria",
			"Australia/Perth|Australia/West",
			"Australia/Sydney|Australia/ACT",
			"Australia/Sydney|Australia/Canberra",
			"Australia/Sydney|Australia/NSW",
			"Etc/GMT-0|Etc/GMT",
			"Etc/GMT-0|Etc/GMT+0",
			"Etc/GMT-0|Etc/GMT0",
			"Etc/GMT-0|Etc/Greenwich",
			"Etc/GMT-0|GMT",
			"Etc/GMT-0|GMT+0",
			"Etc/GMT-0|GMT-0",
			"Etc/GMT-0|GMT0",
			"Etc/GMT-0|Greenwich",
			"Etc/UTC|Etc/UCT",
			"Etc/UTC|Etc/Universal",
			"Etc/UTC|Etc/Zulu",
			"Etc/UTC|UCT",
			"Etc/UTC|UTC",
			"Etc/UTC|Universal",
			"Etc/UTC|Zulu",
			"Europe/Belgrade|Europe/Ljubljana",
			"Europe/Belgrade|Europe/Podgorica",
			"Europe/Belgrade|Europe/Sarajevo",
			"Europe/Belgrade|Europe/Skopje",
			"Europe/Belgrade|Europe/Zagreb",
			"Europe/Chisinau|Europe/Tiraspol",
			"Europe/Dublin|Eire",
			"Europe/Helsinki|Europe/Mariehamn",
			"Europe/Istanbul|Asia/Istanbul",
			"Europe/Istanbul|Turkey",
			"Europe/Lisbon|Portugal",
			"Europe/London|Europe/Belfast",
			"Europe/London|Europe/Guernsey",
			"Europe/London|Europe/Isle_of_Man",
			"Europe/London|Europe/Jersey",
			"Europe/London|GB",
			"Europe/London|GB-Eire",
			"Europe/Moscow|W-SU",
			"Europe/Oslo|Arctic/Longyearbyen",
			"Europe/Oslo|Atlantic/Jan_Mayen",
			"Europe/Prague|Europe/Bratislava",
			"Europe/Rome|Europe/San_Marino",
			"Europe/Rome|Europe/Vatican",
			"Europe/Warsaw|Poland",
			"Europe/Zurich|Europe/Busingen",
			"Europe/Zurich|Europe/Vaduz",
			"Indian/Christmas|Etc/GMT-7",
			"Pacific/Auckland|Antarctica/McMurdo",
			"Pacific/Auckland|Antarctica/South_Pole",
			"Pacific/Auckland|NZ",
			"Pacific/Chatham|NZ-CHAT",
			"Pacific/Chuuk|Pacific/Truk",
			"Pacific/Chuuk|Pacific/Yap",
			"Pacific/Easter|Chile/EasterIsland",
			"Pacific/Guam|Pacific/Saipan",
			"Pacific/Honolulu|Pacific/Johnston",
			"Pacific/Honolulu|US/Hawaii",
			"Pacific/Kwajalein|Kwajalein",
			"Pacific/Pago_Pago|Pacific/Midway",
			"Pacific/Pago_Pago|Pacific/Samoa",
			"Pacific/Pago_Pago|US/Samoa",
			"Pacific/Palau|Etc/GMT-9",
			"Pacific/Pohnpei|Pacific/Ponape",
			"Pacific/Port_Moresby|Etc/GMT-10",
			"Pacific/Tarawa|Etc/GMT-12",
			"Pacific/Tarawa|Pacific/Funafuti",
			"Pacific/Tarawa|Pacific/Wake",
			"Pacific/Tarawa|Pacific/Wallis"
		],
		"countries": [
			"AD|Europe/Andorra",
			"AE|Asia/Dubai",
			"AF|Asia/Kabul",
			"AG|America/Port_of_Spain America/Antigua",
			"AI|America/Port_of_Spain America/Anguilla",
			"AL|Europe/Tirane",
			"AM|Asia/Yerevan",
			"AO|Africa/Lagos Africa/Luanda",
			"AQ|Antarctica/Casey Antarctica/Davis Antarctica/DumontDUrville Antarctica/Mawson Antarctica/Palmer Antarctica/Rothera Antarctica/Syowa Antarctica/Troll Antarctica/Vostok Pacific/Auckland Antarctica/McMurdo",
			"AR|America/Argentina/Buenos_Aires America/Argentina/Cordoba America/Argentina/Salta America/Argentina/Jujuy America/Argentina/Tucuman America/Argentina/Catamarca America/Argentina/La_Rioja America/Argentina/San_Juan America/Argentina/Mendoza America/Argentina/San_Luis America/Argentina/Rio_Gallegos America/Argentina/Ushuaia",
			"AS|Pacific/Pago_Pago",
			"AT|Europe/Vienna",
			"AU|Australia/Lord_Howe Antarctica/Macquarie Australia/Hobart Australia/Currie Australia/Melbourne Australia/Sydney Australia/Broken_Hill Australia/Brisbane Australia/Lindeman Australia/Adelaide Australia/Darwin Australia/Perth Australia/Eucla",
			"AW|America/Curacao America/Aruba",
			"AX|Europe/Helsinki Europe/Mariehamn",
			"AZ|Asia/Baku",
			"BA|Europe/Belgrade Europe/Sarajevo",
			"BB|America/Barbados",
			"BD|Asia/Dhaka",
			"BE|Europe/Brussels",
			"BF|Africa/Abidjan Africa/Ouagadougou",
			"BG|Europe/Sofia",
			"BH|Asia/Qatar Asia/Bahrain",
			"BI|Africa/Maputo Africa/Bujumbura",
			"BJ|Africa/Lagos Africa/Porto-Novo",
			"BL|America/Port_of_Spain America/St_Barthelemy",
			"BM|Atlantic/Bermuda",
			"BN|Asia/Brunei",
			"BO|America/La_Paz",
			"BQ|America/Curacao America/Kralendijk",
			"BR|America/Noronha America/Belem America/Fortaleza America/Recife America/Araguaina America/Maceio America/Bahia America/Sao_Paulo America/Campo_Grande America/Cuiaba America/Santarem America/Porto_Velho America/Boa_Vista America/Manaus America/Eirunepe America/Rio_Branco",
			"BS|America/Nassau",
			"BT|Asia/Thimphu",
			"BW|Africa/Maputo Africa/Gaborone",
			"BY|Europe/Minsk",
			"BZ|America/Belize",
			"CA|America/St_Johns America/Halifax America/Glace_Bay America/Moncton America/Goose_Bay America/Blanc-Sablon America/Toronto America/Nipigon America/Thunder_Bay America/Iqaluit America/Pangnirtung America/Atikokan America/Winnipeg America/Rainy_River America/Resolute America/Rankin_Inlet America/Regina America/Swift_Current America/Edmonton America/Cambridge_Bay America/Yellowknife America/Inuvik America/Creston America/Dawson_Creek America/Fort_Nelson America/Vancouver America/Whitehorse America/Dawson",
			"CC|Indian/Cocos",
			"CD|Africa/Maputo Africa/Lagos Africa/Kinshasa Africa/Lubumbashi",
			"CF|Africa/Lagos Africa/Bangui",
			"CG|Africa/Lagos Africa/Brazzaville",
			"CH|Europe/Zurich",
			"CI|Africa/Abidjan",
			"CK|Pacific/Rarotonga",
			"CL|America/Santiago America/Punta_Arenas Pacific/Easter",
			"CM|Africa/Lagos Africa/Douala",
			"CN|Asia/Shanghai Asia/Urumqi",
			"CO|America/Bogota",
			"CR|America/Costa_Rica",
			"CU|America/Havana",
			"CV|Atlantic/Cape_Verde",
			"CW|America/Curacao",
			"CX|Indian/Christmas",
			"CY|Asia/Nicosia Asia/Famagusta",
			"CZ|Europe/Prague",
			"DE|Europe/Zurich Europe/Berlin Europe/Busingen",
			"DJ|Africa/Nairobi Africa/Djibouti",
			"DK|Europe/Copenhagen",
			"DM|America/Port_of_Spain America/Dominica",
			"DO|America/Santo_Domingo",
			"DZ|Africa/Algiers",
			"EC|America/Guayaquil Pacific/Galapagos",
			"EE|Europe/Tallinn",
			"EG|Africa/Cairo",
			"EH|Africa/El_Aaiun",
			"ER|Africa/Nairobi Africa/Asmara",
			"ES|Europe/Madrid Africa/Ceuta Atlantic/Canary",
			"ET|Africa/Nairobi Africa/Addis_Ababa",
			"FI|Europe/Helsinki",
			"FJ|Pacific/Fiji",
			"FK|Atlantic/Stanley",
			"FM|Pacific/Chuuk Pacific/Pohnpei Pacific/Kosrae",
			"FO|Atlantic/Faroe",
			"FR|Europe/Paris",
			"GA|Africa/Lagos Africa/Libreville",
			"GB|Europe/London",
			"GD|America/Port_of_Spain America/Grenada",
			"GE|Asia/Tbilisi",
			"GF|America/Cayenne",
			"GG|Europe/London Europe/Guernsey",
			"GH|Africa/Accra",
			"GI|Europe/Gibraltar",
			"GL|America/Nuuk America/Danmarkshavn America/Scoresbysund America/Thule",
			"GM|Africa/Abidjan Africa/Banjul",
			"GN|Africa/Abidjan Africa/Conakry",
			"GP|America/Port_of_Spain America/Guadeloupe",
			"GQ|Africa/Lagos Africa/Malabo",
			"GR|Europe/Athens",
			"GS|Atlantic/South_Georgia",
			"GT|America/Guatemala",
			"GU|Pacific/Guam",
			"GW|Africa/Bissau",
			"GY|America/Guyana",
			"HK|Asia/Hong_Kong",
			"HN|America/Tegucigalpa",
			"HR|Europe/Belgrade Europe/Zagreb",
			"HT|America/Port-au-Prince",
			"HU|Europe/Budapest",
			"ID|Asia/Jakarta Asia/Pontianak Asia/Makassar Asia/Jayapura",
			"IE|Europe/Dublin",
			"IL|Asia/Jerusalem",
			"IM|Europe/London Europe/Isle_of_Man",
			"IN|Asia/Kolkata",
			"IO|Indian/Chagos",
			"IQ|Asia/Baghdad",
			"IR|Asia/Tehran",
			"IS|Atlantic/Reykjavik",
			"IT|Europe/Rome",
			"JE|Europe/London Europe/Jersey",
			"JM|America/Jamaica",
			"JO|Asia/Amman",
			"JP|Asia/Tokyo",
			"KE|Africa/Nairobi",
			"KG|Asia/Bishkek",
			"KH|Asia/Bangkok Asia/Phnom_Penh",
			"KI|Pacific/Tarawa Pacific/Enderbury Pacific/Kiritimati",
			"KM|Africa/Nairobi Indian/Comoro",
			"KN|America/Port_of_Spain America/St_Kitts",
			"KP|Asia/Pyongyang",
			"KR|Asia/Seoul",
			"KW|Asia/Riyadh Asia/Kuwait",
			"KY|America/Panama America/Cayman",
			"KZ|Asia/Almaty Asia/Qyzylorda Asia/Qostanay Asia/Aqtobe Asia/Aqtau Asia/Atyrau Asia/Oral",
			"LA|Asia/Bangkok Asia/Vientiane",
			"LB|Asia/Beirut",
			"LC|America/Port_of_Spain America/St_Lucia",
			"LI|Europe/Zurich Europe/Vaduz",
			"LK|Asia/Colombo",
			"LR|Africa/Monrovia",
			"LS|Africa/Johannesburg Africa/Maseru",
			"LT|Europe/Vilnius",
			"LU|Europe/Luxembourg",
			"LV|Europe/Riga",
			"LY|Africa/Tripoli",
			"MA|Africa/Casablanca",
			"MC|Europe/Monaco",
			"MD|Europe/Chisinau",
			"ME|Europe/Belgrade Europe/Podgorica",
			"MF|America/Port_of_Spain America/Marigot",
			"MG|Africa/Nairobi Indian/Antananarivo",
			"MH|Pacific/Majuro Pacific/Kwajalein",
			"MK|Europe/Belgrade Europe/Skopje",
			"ML|Africa/Abidjan Africa/Bamako",
			"MM|Asia/Yangon",
			"MN|Asia/Ulaanbaatar Asia/Hovd Asia/Choibalsan",
			"MO|Asia/Macau",
			"MP|Pacific/Guam Pacific/Saipan",
			"MQ|America/Martinique",
			"MR|Africa/Abidjan Africa/Nouakchott",
			"MS|America/Port_of_Spain America/Montserrat",
			"MT|Europe/Malta",
			"MU|Indian/Mauritius",
			"MV|Indian/Maldives",
			"MW|Africa/Maputo Africa/Blantyre",
			"MX|America/Mexico_City America/Cancun America/Merida America/Monterrey America/Matamoros America/Mazatlan America/Chihuahua America/Ojinaga America/Hermosillo America/Tijuana America/Bahia_Banderas",
			"MY|Asia/Kuala_Lumpur Asia/Kuching",
			"MZ|Africa/Maputo",
			"NA|Africa/Windhoek",
			"NC|Pacific/Noumea",
			"NE|Africa/Lagos Africa/Niamey",
			"NF|Pacific/Norfolk",
			"NG|Africa/Lagos",
			"NI|America/Managua",
			"NL|Europe/Amsterdam",
			"NO|Europe/Oslo",
			"NP|Asia/Kathmandu",
			"NR|Pacific/Nauru",
			"NU|Pacific/Niue",
			"NZ|Pacific/Auckland Pacific/Chatham",
			"OM|Asia/Dubai Asia/Muscat",
			"PA|America/Panama",
			"PE|America/Lima",
			"PF|Pacific/Tahiti Pacific/Marquesas Pacific/Gambier",
			"PG|Pacific/Port_Moresby Pacific/Bougainville",
			"PH|Asia/Manila",
			"PK|Asia/Karachi",
			"PL|Europe/Warsaw",
			"PM|America/Miquelon",
			"PN|Pacific/Pitcairn",
			"PR|America/Puerto_Rico",
			"PS|Asia/Gaza Asia/Hebron",
			"PT|Europe/Lisbon Atlantic/Madeira Atlantic/Azores",
			"PW|Pacific/Palau",
			"PY|America/Asuncion",
			"QA|Asia/Qatar",
			"RE|Indian/Reunion",
			"RO|Europe/Bucharest",
			"RS|Europe/Belgrade",
			"RU|Europe/Kaliningrad Europe/Moscow Europe/Simferopol Europe/Kirov Europe/Astrakhan Europe/Volgograd Europe/Saratov Europe/Ulyanovsk Europe/Samara Asia/Yekaterinburg Asia/Omsk Asia/Novosibirsk Asia/Barnaul Asia/Tomsk Asia/Novokuznetsk Asia/Krasnoyarsk Asia/Irkutsk Asia/Chita Asia/Yakutsk Asia/Khandyga Asia/Vladivostok Asia/Ust-Nera Asia/Magadan Asia/Sakhalin Asia/Srednekolymsk Asia/Kamchatka Asia/Anadyr",
			"RW|Africa/Maputo Africa/Kigali",
			"SA|Asia/Riyadh",
			"SB|Pacific/Guadalcanal",
			"SC|Indian/Mahe",
			"SD|Africa/Khartoum",
			"SE|Europe/Stockholm",
			"SG|Asia/Singapore",
			"SH|Africa/Abidjan Atlantic/St_Helena",
			"SI|Europe/Belgrade Europe/Ljubljana",
			"SJ|Europe/Oslo Arctic/Longyearbyen",
			"SK|Europe/Prague Europe/Bratislava",
			"SL|Africa/Abidjan Africa/Freetown",
			"SM|Europe/Rome Europe/San_Marino",
			"SN|Africa/Abidjan Africa/Dakar",
			"SO|Africa/Nairobi Africa/Mogadishu",
			"SR|America/Paramaribo",
			"SS|Africa/Juba",
			"ST|Africa/Sao_Tome",
			"SV|America/El_Salvador",
			"SX|America/Curacao America/Lower_Princes",
			"SY|Asia/Damascus",
			"SZ|Africa/Johannesburg Africa/Mbabane",
			"TC|America/Grand_Turk",
			"TD|Africa/Ndjamena",
			"TF|Indian/Reunion Indian/Kerguelen",
			"TG|Africa/Abidjan Africa/Lome",
			"TH|Asia/Bangkok",
			"TJ|Asia/Dushanbe",
			"TK|Pacific/Fakaofo",
			"TL|Asia/Dili",
			"TM|Asia/Ashgabat",
			"TN|Africa/Tunis",
			"TO|Pacific/Tongatapu",
			"TR|Europe/Istanbul",
			"TT|America/Port_of_Spain",
			"TV|Pacific/Funafuti",
			"TW|Asia/Taipei",
			"TZ|Africa/Nairobi Africa/Dar_es_Salaam",
			"UA|Europe/Simferopol Europe/Kiev Europe/Uzhgorod Europe/Zaporozhye",
			"UG|Africa/Nairobi Africa/Kampala",
			"UM|Pacific/Pago_Pago Pacific/Wake Pacific/Honolulu Pacific/Midway",
			"US|America/New_York America/Detroit America/Kentucky/Louisville America/Kentucky/Monticello America/Indiana/Indianapolis America/Indiana/Vincennes America/Indiana/Winamac America/Indiana/Marengo America/Indiana/Petersburg America/Indiana/Vevay America/Chicago America/Indiana/Tell_City America/Indiana/Knox America/Menominee America/North_Dakota/Center America/North_Dakota/New_Salem America/North_Dakota/Beulah America/Denver America/Boise America/Phoenix America/Los_Angeles America/Anchorage America/Juneau America/Sitka America/Metlakatla America/Yakutat America/Nome America/Adak Pacific/Honolulu",
			"UY|America/Montevideo",
			"UZ|Asia/Samarkand Asia/Tashkent",
			"VA|Europe/Rome Europe/Vatican",
			"VC|America/Port_of_Spain America/St_Vincent",
			"VE|America/Caracas",
			"VG|America/Port_of_Spain America/Tortola",
			"VI|America/Port_of_Spain America/St_Thomas",
			"VN|Asia/Bangkok Asia/Ho_Chi_Minh",
			"VU|Pacific/Efate",
			"WF|Pacific/Wallis",
			"WS|Pacific/Apia",
			"YE|Asia/Riyadh Asia/Aden",
			"YT|Africa/Nairobi Indian/Mayotte",
			"ZA|Africa/Johannesburg",
			"ZM|Africa/Maputo Africa/Lusaka",
			"ZW|Africa/Maputo Africa/Harare"
		]
	});


	return moment;
}));

define('dateUtils', ['knockout', 'context', 'moment', 'momenttimezone'],
    function (ko, context, moment) {
        //Set default timezone to UK time
        var ukTimezone = 'Europe/London';
        moment.tz.setDefault(ukTimezone);

        var currentDate = function() {
            return moment();
        };


        var newDate = function(year, month, day, hour, minute) {
            return moment([year, month, day, hour, minute]);
        };

        var incrementDate = function(increment, measurement) {
            var now = currentDate();
            var deadline = now.add(increment, measurement);
            return deadline;
        };

        function futureBookingFromNowInc() {
            return incrementDate(182, 'days').add(1, 'days').subtract(0, 'days');
        }
		
		function future15BookingFromNowInc() {
            return incrementDate(15, 'days').add(1, 'days').subtract(0, 'days');
        }

        function addYearsToNow(yearsCount) {
            var now = currentDate();
            return incrementDate(yearsCount, 'years');
        }

        var setDate = function(date, format) {
            if (typeof date == 'undefined') return currentDate();
            if (typeof format == 'undefined') format = moment.ISO_8601;
            return moment(date, format);
        };

        var parseDate = function(dateString, dateFormat) {
            return moment(dateString, dateFormat);
        };

        var incrementTime = function(targetStart, targetEnd, increment) {

            var format = 'HH:mm',
                steps = [],
                start = moment(targetStart, format),
                end = moment(targetEnd, format);

            while( start.isBefore(end) ) {
                steps.push(start.format(format));
                start = start.add(increment, 'minutes');
            }

            return steps;
        };

        var setNearestTimeChunk = function (dateTime, chunk) {
          var minute,
              hour,
              nextMinuteChunk;

          if (!isDate(dateTime)) { return dateTime; }
          if (60 % chunk !== 0) { return dateTime; }

          minute = dateTime.minute();
          hour = dateTime.hour();

          // If the minute is 0, it is already the next time chunk
          if (minute === 0) { return dateTime; }

          nextMinuteChunk = (Math.ceil(minute/chunk) * chunk) % 60;

          if (nextMinuteChunk === 0) {
            dateTime.add(1, 'h').minute(0);
          } else {
            dateTime.minute(nextMinuteChunk);
          }
          return dateTime;
        };

        var isSame = function (dateTimeFirst, dateTimeSecond) {
          return moment(dateTimeFirst).isSame(dateTimeSecond);
        };

        var isDate = function( obj ){
            return moment.isMoment ( obj );
        };

        var getFormattedDate = function(date, dateFormat) {
            if (!date) {
                return '';
            }
            return date.format(dateFormat);
        };

        var decorateModelWithFormattedDate = function (model, newPropertyName, koMomentDate) {
            var self = this;
            model[newPropertyName] = ko.computed(function() {
                return self.getFormattedDate(koMomentDate(), context.dateFormat.shortDate);
            });
        }

        var convertDateToUtc = function (date) {

            if (!date) {
                return '';
            }
            return moment.utc(date);
        }
        return {
            currentDate: currentDate,
            newDate: newDate,
            incrementDate: incrementDate,
            setDate: setDate,
            incrementTime: incrementTime,
            setNearestTimeChunk: setNearestTimeChunk,
            isSame: isSame,
            parseDate: parseDate,
            isDate: isDate,
            futureBookingFromNowInc: futureBookingFromNowInc,
            getFormattedDate: getFormattedDate,
            decorateModelWithFormattedDate: decorateModelWithFormattedDate,
            addYearsToNow: addYearsToNow,
            future15BookingFromNowInc: future15BookingFromNowInc,
            convertDateToUtc: convertDateToUtc
        };
    });

/*!
 * jQuery JavaScript Library v3.5.0
 * https://jquery.com/
 *
 * Includes Sizzle.js
 * https://sizzlejs.com/
 *
 * Copyright JS Foundation and other contributors
 * Released under the MIT license
 * https://jquery.org/license
 *
 * Date: 2020-04-10T15:07Z
 */
( function( global, factory ) {

	"use strict";

	if ( typeof module === "object" && typeof module.exports === "object" ) {

		// For CommonJS and CommonJS-like environments where a proper `window`
		// is present, execute the factory and get jQuery.
		// For environments that do not have a `window` with a `document`
		// (such as Node.js), expose a factory as module.exports.
		// This accentuates the need for the creation of a real `window`.
		// e.g. var jQuery = require("jquery")(window);
		// See ticket #14549 for more info.
		module.exports = global.document ?
			factory( global, true ) :
			function( w ) {
				if ( !w.document ) {
					throw new Error( "jQuery requires a window with a document" );
				}
				return factory( w );
			};
	} else {
		factory( global );
	}

// Pass this if window is not defined yet
} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {

// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
// enough that all such attempts are guarded in a try block.


var arr = [];

var getProto = Object.getPrototypeOf;

var slice = arr.slice;

var flat = arr.flat ? function( array ) {
	return arr.flat.call( array );
} : function( array ) {
	return arr.concat.apply( [], array );
};


var push = arr.push;

var indexOf = arr.indexOf;

var class2type = {};

var toString = class2type.toString;

var hasOwn = class2type.hasOwnProperty;

var fnToString = hasOwn.toString;

var ObjectFunctionString = fnToString.call( Object );

var support = {};

var isFunction = function isFunction( obj ) {

      // Support: Chrome <=57, Firefox <=52
      // In some browsers, typeof returns "function" for HTML <object> elements
      // (i.e., `typeof document.createElement( "object" ) === "function"`).
      // We don't want to classify *any* DOM node as a function.
      return typeof obj === "function" && typeof obj.nodeType !== "number";
  };


var isWindow = function isWindow( obj ) {
		return obj != null && obj === obj.window;
	};


var document = window.document;



	var preservedScriptAttributes = {
		type: true,
		src: true,
		nonce: true,
		noModule: true
	};

	function DOMEval( code, node, doc ) {
		doc = doc || document;

		var i, val,
			script = doc.createElement( "script" );

		script.text = code;
		if ( node ) {
			for ( i in preservedScriptAttributes ) {

				// Support: Firefox 64+, Edge 18+
				// Some browsers don't support the "nonce" property on scripts.
				// On the other hand, just using `getAttribute` is not enough as
				// the `nonce` attribute is reset to an empty string whenever it
				// becomes browsing-context connected.
				// See https://github.com/whatwg/html/issues/2369
				// See https://html.spec.whatwg.org/#nonce-attributes
				// The `node.getAttribute` check was added for the sake of
				// `jQuery.globalEval` so that it can fake a nonce-containing node
				// via an object.
				val = node[ i ] || node.getAttribute && node.getAttribute( i );
				if ( val ) {
					script.setAttribute( i, val );
				}
			}
		}
		doc.head.appendChild( script ).parentNode.removeChild( script );
	}


function toType( obj ) {
	if ( obj == null ) {
		return obj + "";
	}

	// Support: Android <=2.3 only (functionish RegExp)
	return typeof obj === "object" || typeof obj === "function" ?
		class2type[ toString.call( obj ) ] || "object" :
		typeof obj;
}
/* global Symbol */
// Defining this global in .eslintrc.json would create a danger of using the global
// unguarded in another place, it seems safer to define global only for this module



var
	version = "3.5.0",

	// Define a local copy of jQuery
	jQuery = function( selector, context ) {

		// The jQuery object is actually just the init constructor 'enhanced'
		// Need init if jQuery is called (just allow error to be thrown if not included)
		return new jQuery.fn.init( selector, context );
	};

jQuery.fn = jQuery.prototype = {

	// The current version of jQuery being used
	jquery: version,

	constructor: jQuery,

	// The default length of a jQuery object is 0
	length: 0,

	toArray: function() {
		return slice.call( this );
	},

	// Get the Nth element in the matched element set OR
	// Get the whole matched element set as a clean array
	get: function( num ) {

		// Return all the elements in a clean array
		if ( num == null ) {
			return slice.call( this );
		}

		// Return just the one element from the set
		return num < 0 ? this[ num + this.length ] : this[ num ];
	},

	// Take an array of elements and push it onto the stack
	// (returning the new matched element set)
	pushStack: function( elems ) {

		// Build a new jQuery matched element set
		var ret = jQuery.merge( this.constructor(), elems );

		// Add the old object onto the stack (as a reference)
		ret.prevObject = this;

		// Return the newly-formed element set
		return ret;
	},

	// Execute a callback for every element in the matched set.
	each: function( callback ) {
		return jQuery.each( this, callback );
	},

	map: function( callback ) {
		return this.pushStack( jQuery.map( this, function( elem, i ) {
			return callback.call( elem, i, elem );
		} ) );
	},

	slice: function() {
		return this.pushStack( slice.apply( this, arguments ) );
	},

	first: function() {
		return this.eq( 0 );
	},

	last: function() {
		return this.eq( -1 );
	},

	even: function() {
		return this.pushStack( jQuery.grep( this, function( _elem, i ) {
			return ( i + 1 ) % 2;
		} ) );
	},

	odd: function() {
		return this.pushStack( jQuery.grep( this, function( _elem, i ) {
			return i % 2;
		} ) );
	},

	eq: function( i ) {
		var len = this.length,
			j = +i + ( i < 0 ? len : 0 );
		return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
	},

	end: function() {
		return this.prevObject || this.constructor();
	},

	// For internal use only.
	// Behaves like an Array's method, not like a jQuery method.
	push: push,
	sort: arr.sort,
	splice: arr.splice
};

jQuery.extend = jQuery.fn.extend = function() {
	var options, name, src, copy, copyIsArray, clone,
		target = arguments[ 0 ] || {},
		i = 1,
		length = arguments.length,
		deep = false;

	// Handle a deep copy situation
	if ( typeof target === "boolean" ) {
		deep = target;

		// Skip the boolean and the target
		target = arguments[ i ] || {};
		i++;
	}

	// Handle case when target is a string or something (possible in deep copy)
	if ( typeof target !== "object" && !isFunction( target ) ) {
		target = {};
	}

	// Extend jQuery itself if only one argument is passed
	if ( i === length ) {
		target = this;
		i--;
	}

	for ( ; i < length; i++ ) {

		// Only deal with non-null/undefined values
		if ( ( options = arguments[ i ] ) != null ) {

			// Extend the base object
			for ( name in options ) {
				copy = options[ name ];

				// Prevent Object.prototype pollution
				// Prevent never-ending loop
				if ( name === "__proto__" || target === copy ) {
					continue;
				}

				// Recurse if we're merging plain objects or arrays
				if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
					( copyIsArray = Array.isArray( copy ) ) ) ) {
					src = target[ name ];

					// Ensure proper type for the source value
					if ( copyIsArray && !Array.isArray( src ) ) {
						clone = [];
					} else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
						clone = {};
					} else {
						clone = src;
					}
					copyIsArray = false;

					// Never move original objects, clone them
					target[ name ] = jQuery.extend( deep, clone, copy );

				// Don't bring in undefined values
				} else if ( copy !== undefined ) {
					target[ name ] = copy;
				}
			}
		}
	}

	// Return the modified object
	return target;
};

jQuery.extend( {

	// Unique for each copy of jQuery on the page
	expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),

	// Assume jQuery is ready without the ready module
	isReady: true,

	error: function( msg ) {
		throw new Error( msg );
	},

	noop: function() {},

	isPlainObject: function( obj ) {
		var proto, Ctor;

		// Detect obvious negatives
		// Use toString instead of jQuery.type to catch host objects
		if ( !obj || toString.call( obj ) !== "[object Object]" ) {
			return false;
		}

		proto = getProto( obj );

		// Objects with no prototype (e.g., `Object.create( null )`) are plain
		if ( !proto ) {
			return true;
		}

		// Objects with prototype are plain iff they were constructed by a global Object function
		Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
		return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
	},

	isEmptyObject: function( obj ) {
		var name;

		for ( name in obj ) {
			return false;
		}
		return true;
	},

	// Evaluates a script in a provided context; falls back to the global one
	// if not specified.
	globalEval: function( code, options, doc ) {
		DOMEval( code, { nonce: options && options.nonce }, doc );
	},

	each: function( obj, callback ) {
		var length, i = 0;

		if ( isArrayLike( obj ) ) {
			length = obj.length;
			for ( ; i < length; i++ ) {
				if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
					break;
				}
			}
		} else {
			for ( i in obj ) {
				if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
					break;
				}
			}
		}

		return obj;
	},

	// results is for internal usage only
	makeArray: function( arr, results ) {
		var ret = results || [];

		if ( arr != null ) {
			if ( isArrayLike( Object( arr ) ) ) {
				jQuery.merge( ret,
					typeof arr === "string" ?
					[ arr ] : arr
				);
			} else {
				push.call( ret, arr );
			}
		}

		return ret;
	},

	inArray: function( elem, arr, i ) {
		return arr == null ? -1 : indexOf.call( arr, elem, i );
	},

	// Support: Android <=4.0 only, PhantomJS 1 only
	// push.apply(_, arraylike) throws on ancient WebKit
	merge: function( first, second ) {
		var len = +second.length,
			j = 0,
			i = first.length;

		for ( ; j < len; j++ ) {
			first[ i++ ] = second[ j ];
		}

		first.length = i;

		return first;
	},

	grep: function( elems, callback, invert ) {
		var callbackInverse,
			matches = [],
			i = 0,
			length = elems.length,
			callbackExpect = !invert;

		// Go through the array, only saving the items
		// that pass the validator function
		for ( ; i < length; i++ ) {
			callbackInverse = !callback( elems[ i ], i );
			if ( callbackInverse !== callbackExpect ) {
				matches.push( elems[ i ] );
			}
		}

		return matches;
	},

	// arg is for internal usage only
	map: function( elems, callback, arg ) {
		var length, value,
			i = 0,
			ret = [];

		// Go through the array, translating each of the items to their new values
		if ( isArrayLike( elems ) ) {
			length = elems.length;
			for ( ; i < length; i++ ) {
				value = callback( elems[ i ], i, arg );

				if ( value != null ) {
					ret.push( value );
				}
			}

		// Go through every key on the object,
		} else {
			for ( i in elems ) {
				value = callback( elems[ i ], i, arg );

				if ( value != null ) {
					ret.push( value );
				}
			}
		}

		// Flatten any nested arrays
		return flat( ret );
	},

	// A global GUID counter for objects
	guid: 1,

	// jQuery.support is not used in Core but other projects attach their
	// properties to it so it needs to exist.
	support: support
} );

if ( typeof Symbol === "function" ) {
	jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
}

// Populate the class2type map
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
function( _i, name ) {
	class2type[ "[object " + name + "]" ] = name.toLowerCase();
} );

function isArrayLike( obj ) {

	// Support: real iOS 8.2 only (not reproducible in simulator)
	// `in` check used to prevent JIT error (gh-2145)
	// hasOwn isn't used here due to false negatives
	// regarding Nodelist length in IE
	var length = !!obj && "length" in obj && obj.length,
		type = toType( obj );

	if ( isFunction( obj ) || isWindow( obj ) ) {
		return false;
	}

	return type === "array" || length === 0 ||
		typeof length === "number" && length > 0 && ( length - 1 ) in obj;
}
var Sizzle =
/*!
 * Sizzle CSS Selector Engine v2.3.5
 * https://sizzlejs.com/
 *
 * Copyright JS Foundation and other contributors
 * Released under the MIT license
 * https://js.foundation/
 *
 * Date: 2020-03-14
 */
( function( window ) {
var i,
	support,
	Expr,
	getText,
	isXML,
	tokenize,
	compile,
	select,
	outermostContext,
	sortInput,
	hasDuplicate,

	// Local document vars
	setDocument,
	document,
	docElem,
	documentIsHTML,
	rbuggyQSA,
	rbuggyMatches,
	matches,
	contains,

	// Instance-specific data
	expando = "sizzle" + 1 * new Date(),
	preferredDoc = window.document,
	dirruns = 0,
	done = 0,
	classCache = createCache(),
	tokenCache = createCache(),
	compilerCache = createCache(),
	nonnativeSelectorCache = createCache(),
	sortOrder = function( a, b ) {
		if ( a === b ) {
			hasDuplicate = true;
		}
		return 0;
	},

	// Instance methods
	hasOwn = ( {} ).hasOwnProperty,
	arr = [],
	pop = arr.pop,
	pushNative = arr.push,
	push = arr.push,
	slice = arr.slice,

	// Use a stripped-down indexOf as it's faster than native
	// https://jsperf.com/thor-indexof-vs-for/5
	indexOf = function( list, elem ) {
		var i = 0,
			len = list.length;
		for ( ; i < len; i++ ) {
			if ( list[ i ] === elem ) {
				return i;
			}
		}
		return -1;
	},

	booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" +
		"ismap|loop|multiple|open|readonly|required|scoped",

	// Regular expressions

	// http://www.w3.org/TR/css3-selectors/#whitespace
	whitespace = "[\\x20\\t\\r\\n\\f]",

	// https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
	identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
		"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",

	// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
	attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +

		// Operator (capture 2)
		"*([*^$|!~]?=)" + whitespace +

		// "Attribute values must be CSS identifiers [capture 5]
		// or strings [capture 3 or capture 4]"
		"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
		whitespace + "*\\]",

	pseudos = ":(" + identifier + ")(?:\\((" +

		// To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
		// 1. quoted (capture 3; capture 4 or capture 5)
		"('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +

		// 2. simple (capture 6)
		"((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +

		// 3. anything else (capture 2)
		".*" +
		")\\)|)",

	// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
	rwhitespace = new RegExp( whitespace + "+", "g" ),
	rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
		whitespace + "+$", "g" ),

	rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
	rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
		"*" ),
	rdescend = new RegExp( whitespace + "|>" ),

	rpseudo = new RegExp( pseudos ),
	ridentifier = new RegExp( "^" + identifier + "$" ),

	matchExpr = {
		"ID": new RegExp( "^#(" + identifier + ")" ),
		"CLASS": new RegExp( "^\\.(" + identifier + ")" ),
		"TAG": new RegExp( "^(" + identifier + "|[*])" ),
		"ATTR": new RegExp( "^" + attributes ),
		"PSEUDO": new RegExp( "^" + pseudos ),
		"CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
			whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
			whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
		"bool": new RegExp( "^(?:" + booleans + ")$", "i" ),

		// For use in libraries implementing .is()
		// We use this for POS matching in `select`
		"needsContext": new RegExp( "^" + whitespace +
			"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
			"*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
	},

	rhtml = /HTML$/i,
	rinputs = /^(?:input|select|textarea|button)$/i,
	rheader = /^h\d$/i,

	rnative = /^[^{]+\{\s*\[native \w/,

	// Easily-parseable/retrievable ID or TAG or CLASS selectors
	rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,

	rsibling = /[+~]/,

	// CSS escapes
	// http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
	runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ),
	funescape = function( escape, nonHex ) {
		var high = "0x" + escape.slice( 1 ) - 0x10000;

		return nonHex ?

			// Strip the backslash prefix from a non-hex escape sequence
			nonHex :

			// Replace a hexadecimal escape sequence with the encoded Unicode code point
			// Support: IE <=11+
			// For values outside the Basic Multilingual Plane (BMP), manually construct a
			// surrogate pair
			high < 0 ?
				String.fromCharCode( high + 0x10000 ) :
				String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
	},

	// CSS string/identifier serialization
	// https://drafts.csswg.org/cssom/#common-serializing-idioms
	rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
	fcssescape = function( ch, asCodePoint ) {
		if ( asCodePoint ) {

			// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
			if ( ch === "\0" ) {
				return "\uFFFD";
			}

			// Control characters and (dependent upon position) numbers get escaped as code points
			return ch.slice( 0, -1 ) + "\\" +
				ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
		}

		// Other potentially-special ASCII characters get backslash-escaped
		return "\\" + ch;
	},

	// Used for iframes
	// See setDocument()
	// Removing the function wrapper causes a "Permission Denied"
	// error in IE
	unloadHandler = function() {
		setDocument();
	},

	inDisabledFieldset = addCombinator(
		function( elem ) {
			return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
		},
		{ dir: "parentNode", next: "legend" }
	);

// Optimize for push.apply( _, NodeList )
try {
	push.apply(
		( arr = slice.call( preferredDoc.childNodes ) ),
		preferredDoc.childNodes
	);

	// Support: Android<4.0
	// Detect silently failing push.apply
	// eslint-disable-next-line no-unused-expressions
	arr[ preferredDoc.childNodes.length ].nodeType;
} catch ( e ) {
	push = { apply: arr.length ?

		// Leverage slice if possible
		function( target, els ) {
			pushNative.apply( target, slice.call( els ) );
		} :

		// Support: IE<9
		// Otherwise append directly
		function( target, els ) {
			var j = target.length,
				i = 0;

			// Can't trust NodeList.length
			while ( ( target[ j++ ] = els[ i++ ] ) ) {}
			target.length = j - 1;
		}
	};
}

function Sizzle( selector, context, results, seed ) {
	var m, i, elem, nid, match, groups, newSelector,
		newContext = context && context.ownerDocument,

		// nodeType defaults to 9, since context defaults to document
		nodeType = context ? context.nodeType : 9;

	results = results || [];

	// Return early from calls with invalid selector or context
	if ( typeof selector !== "string" || !selector ||
		nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {

		return results;
	}

	// Try to shortcut find operations (as opposed to filters) in HTML documents
	if ( !seed ) {
		setDocument( context );
		context = context || document;

		if ( documentIsHTML ) {

			// If the selector is sufficiently simple, try using a "get*By*" DOM method
			// (excepting DocumentFragment context, where the methods don't exist)
			if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {

				// ID selector
				if ( ( m = match[ 1 ] ) ) {

					// Document context
					if ( nodeType === 9 ) {
						if ( ( elem = context.getElementById( m ) ) ) {

							// Support: IE, Opera, Webkit
							// TODO: identify versions
							// getElementById can match elements by name instead of ID
							if ( elem.id === m ) {
								results.push( elem );
								return results;
							}
						} else {
							return results;
						}

					// Element context
					} else {

						// Support: IE, Opera, Webkit
						// TODO: identify versions
						// getElementById can match elements by name instead of ID
						if ( newContext && ( elem = newContext.getElementById( m ) ) &&
							contains( context, elem ) &&
							elem.id === m ) {

							results.push( elem );
							return results;
						}
					}

				// Type selector
				} else if ( match[ 2 ] ) {
					push.apply( results, context.getElementsByTagName( selector ) );
					return results;

				// Class selector
				} else if ( ( m = match[ 3 ] ) && support.getElementsByClassName &&
					context.getElementsByClassName ) {

					push.apply( results, context.getElementsByClassName( m ) );
					return results;
				}
			}

			// Take advantage of querySelectorAll
			if ( support.qsa &&
				!nonnativeSelectorCache[ selector + " " ] &&
				( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&

				// Support: IE 8 only
				// Exclude object elements
				( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {

				newSelector = selector;
				newContext = context;

				// qSA considers elements outside a scoping root when evaluating child or
				// descendant combinators, which is not what we want.
				// In such cases, we work around the behavior by prefixing every selector in the
				// list with an ID selector referencing the scope context.
				// The technique has to be used as well when a leading combinator is used
				// as such selectors are not recognized by querySelectorAll.
				// Thanks to Andrew Dupont for this technique.
				if ( nodeType === 1 &&
					( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {

					// Expand context for sibling selectors
					newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
						context;

					// We can use :scope instead of the ID hack if the browser
					// supports it & if we're not changing the context.
					if ( newContext !== context || !support.scope ) {

						// Capture the context ID, setting it first if necessary
						if ( ( nid = context.getAttribute( "id" ) ) ) {
							nid = nid.replace( rcssescape, fcssescape );
						} else {
							context.setAttribute( "id", ( nid = expando ) );
						}
					}

					// Prefix every selector in the list
					groups = tokenize( selector );
					i = groups.length;
					while ( i-- ) {
						groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
							toSelector( groups[ i ] );
					}
					newSelector = groups.join( "," );
				}

				try {
					push.apply( results,
						newContext.querySelectorAll( newSelector )
					);
					return results;
				} catch ( qsaError ) {
					nonnativeSelectorCache( selector, true );
				} finally {
					if ( nid === expando ) {
						context.removeAttribute( "id" );
					}
				}
			}
		}
	}

	// All others
	return select( selector.replace( rtrim, "$1" ), context, results, seed );
}

/**
 * Create key-value caches of limited size
 * @returns {function(string, object)} Returns the Object data after storing it on itself with
 *	property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
 *	deleting the oldest entry
 */
function createCache() {
	var keys = [];

	function cache( key, value ) {

		// Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
		if ( keys.push( key + " " ) > Expr.cacheLength ) {

			// Only keep the most recent entries
			delete cache[ keys.shift() ];
		}
		return ( cache[ key + " " ] = value );
	}
	return cache;
}

/**
 * Mark a function for special use by Sizzle
 * @param {Function} fn The function to mark
 */
function markFunction( fn ) {
	fn[ expando ] = true;
	return fn;
}

/**
 * Support testing using an element
 * @param {Function} fn Passed the created element and returns a boolean result
 */
function assert( fn ) {
	var el = document.createElement( "fieldset" );

	try {
		return !!fn( el );
	} catch ( e ) {
		return false;
	} finally {

		// Remove from its parent by default
		if ( el.parentNode ) {
			el.parentNode.removeChild( el );
		}

		// release memory in IE
		el = null;
	}
}

/**
 * Adds the same handler for all of the specified attrs
 * @param {String} attrs Pipe-separated list of attributes
 * @param {Function} handler The method that will be applied
 */
function addHandle( attrs, handler ) {
	var arr = attrs.split( "|" ),
		i = arr.length;

	while ( i-- ) {
		Expr.attrHandle[ arr[ i ] ] = handler;
	}
}

/**
 * Checks document order of two siblings
 * @param {Element} a
 * @param {Element} b
 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
 */
function siblingCheck( a, b ) {
	var cur = b && a,
		diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
			a.sourceIndex - b.sourceIndex;

	// Use IE sourceIndex if available on both nodes
	if ( diff ) {
		return diff;
	}

	// Check if b follows a
	if ( cur ) {
		while ( ( cur = cur.nextSibling ) ) {
			if ( cur === b ) {
				return -1;
			}
		}
	}

	return a ? 1 : -1;
}

/**
 * Returns a function to use in pseudos for input types
 * @param {String} type
 */
function createInputPseudo( type ) {
	return function( elem ) {
		var name = elem.nodeName.toLowerCase();
		return name === "input" && elem.type === type;
	};
}

/**
 * Returns a function to use in pseudos for buttons
 * @param {String} type
 */
function createButtonPseudo( type ) {
	return function( elem ) {
		var name = elem.nodeName.toLowerCase();
		return ( name === "input" || name === "button" ) && elem.type === type;
	};
}

/**
 * Returns a function to use in pseudos for :enabled/:disabled
 * @param {Boolean} disabled true for :disabled; false for :enabled
 */
function createDisabledPseudo( disabled ) {

	// Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
	return function( elem ) {

		// Only certain elements can match :enabled or :disabled
		// https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
		// https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
		if ( "form" in elem ) {

			// Check for inherited disabledness on relevant non-disabled elements:
			// * listed form-associated elements in a disabled fieldset
			//   https://html.spec.whatwg.org/multipage/forms.html#category-listed
			//   https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
			// * option elements in a disabled optgroup
			//   https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
			// All such elements have a "form" property.
			if ( elem.parentNode && elem.disabled === false ) {

				// Option elements defer to a parent optgroup if present
				if ( "label" in elem ) {
					if ( "label" in elem.parentNode ) {
						return elem.parentNode.disabled === disabled;
					} else {
						return elem.disabled === disabled;
					}
				}

				// Support: IE 6 - 11
				// Use the isDisabled shortcut property to check for disabled fieldset ancestors
				return elem.isDisabled === disabled ||

					// Where there is no isDisabled, check manually
					/* jshint -W018 */
					elem.isDisabled !== !disabled &&
					inDisabledFieldset( elem ) === disabled;
			}

			return elem.disabled === disabled;

		// Try to winnow out elements that can't be disabled before trusting the disabled property.
		// Some victims get caught in our net (label, legend, menu, track), but it shouldn't
		// even exist on them, let alone have a boolean value.
		} else if ( "label" in elem ) {
			return elem.disabled === disabled;
		}

		// Remaining elements are neither :enabled nor :disabled
		return false;
	};
}

/**
 * Returns a function to use in pseudos for positionals
 * @param {Function} fn
 */
function createPositionalPseudo( fn ) {
	return markFunction( function( argument ) {
		argument = +argument;
		return markFunction( function( seed, matches ) {
			var j,
				matchIndexes = fn( [], seed.length, argument ),
				i = matchIndexes.length;

			// Match elements found at the specified indexes
			while ( i-- ) {
				if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
					seed[ j ] = !( matches[ j ] = seed[ j ] );
				}
			}
		} );
	} );
}

/**
 * Checks a node for validity as a Sizzle context
 * @param {Element|Object=} context
 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
 */
function testContext( context ) {
	return context && typeof context.getElementsByTagName !== "undefined" && context;
}

// Expose support vars for convenience
support = Sizzle.support = {};

/**
 * Detects XML nodes
 * @param {Element|Object} elem An element or a document
 * @returns {Boolean} True iff elem is a non-HTML XML node
 */
isXML = Sizzle.isXML = function( elem ) {
	var namespace = elem.namespaceURI,
		docElem = ( elem.ownerDocument || elem ).documentElement;

	// Support: IE <=8
	// Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
	// https://bugs.jquery.com/ticket/4833
	return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
};

/**
 * Sets document-related variables once based on the current document
 * @param {Element|Object} [doc] An element or document object to use to set the document
 * @returns {Object} Returns the current document
 */
setDocument = Sizzle.setDocument = function( node ) {
	var hasCompare, subWindow,
		doc = node ? node.ownerDocument || node : preferredDoc;

	// Return early if doc is invalid or already selected
	// Support: IE 11+, Edge 17 - 18+
	// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
	// two documents; shallow comparisons work.
	// eslint-disable-next-line eqeqeq
	if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {
		return document;
	}

	// Update global variables
	document = doc;
	docElem = document.documentElement;
	documentIsHTML = !isXML( document );

	// Support: IE 9 - 11+, Edge 12 - 18+
	// Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
	// Support: IE 11+, Edge 17 - 18+
	// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
	// two documents; shallow comparisons work.
	// eslint-disable-next-line eqeqeq
	if ( preferredDoc != document &&
		( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {

		// Support: IE 11, Edge
		if ( subWindow.addEventListener ) {
			subWindow.addEventListener( "unload", unloadHandler, false );

		// Support: IE 9 - 10 only
		} else if ( subWindow.attachEvent ) {
			subWindow.attachEvent( "onunload", unloadHandler );
		}
	}

	// Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
	// Safari 4 - 5 only, Opera <=11.6 - 12.x only
	// IE/Edge & older browsers don't support the :scope pseudo-class.
	// Support: Safari 6.0 only
	// Safari 6.0 supports :scope but it's an alias of :root there.
	support.scope = assert( function( el ) {
		docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
		return typeof el.querySelectorAll !== "undefined" &&
			!el.querySelectorAll( ":scope fieldset div" ).length;
	} );

	/* Attributes
	---------------------------------------------------------------------- */

	// Support: IE<8
	// Verify that getAttribute really returns attributes and not properties
	// (excepting IE8 booleans)
	support.attributes = assert( function( el ) {
		el.className = "i";
		return !el.getAttribute( "className" );
	} );

	/* getElement(s)By*
	---------------------------------------------------------------------- */

	// Check if getElementsByTagName("*") returns only elements
	support.getElementsByTagName = assert( function( el ) {
		el.appendChild( document.createComment( "" ) );
		return !el.getElementsByTagName( "*" ).length;
	} );

	// Support: IE<9
	support.getElementsByClassName = rnative.test( document.getElementsByClassName );

	// Support: IE<10
	// Check if getElementById returns elements by name
	// The broken getElementById methods don't pick up programmatically-set names,
	// so use a roundabout getElementsByName test
	support.getById = assert( function( el ) {
		docElem.appendChild( el ).id = expando;
		return !document.getElementsByName || !document.getElementsByName( expando ).length;
	} );

	// ID filter and find
	if ( support.getById ) {
		Expr.filter[ "ID" ] = function( id ) {
			var attrId = id.replace( runescape, funescape );
			return function( elem ) {
				return elem.getAttribute( "id" ) === attrId;
			};
		};
		Expr.find[ "ID" ] = function( id, context ) {
			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
				var elem = context.getElementById( id );
				return elem ? [ elem ] : [];
			}
		};
	} else {
		Expr.filter[ "ID" ] =  function( id ) {
			var attrId = id.replace( runescape, funescape );
			return function( elem ) {
				var node = typeof elem.getAttributeNode !== "undefined" &&
					elem.getAttributeNode( "id" );
				return node && node.value === attrId;
			};
		};

		// Support: IE 6 - 7 only
		// getElementById is not reliable as a find shortcut
		Expr.find[ "ID" ] = function( id, context ) {
			if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
				var node, i, elems,
					elem = context.getElementById( id );

				if ( elem ) {

					// Verify the id attribute
					node = elem.getAttributeNode( "id" );
					if ( node && node.value === id ) {
						return [ elem ];
					}

					// Fall back on getElementsByName
					elems = context.getElementsByName( id );
					i = 0;
					while ( ( elem = elems[ i++ ] ) ) {
						node = elem.getAttributeNode( "id" );
						if ( node && node.value === id ) {
							return [ elem ];
						}
					}
				}

				return [];
			}
		};
	}

	// Tag
	Expr.find[ "TAG" ] = support.getElementsByTagName ?
		function( tag, context ) {
			if ( typeof context.getElementsByTagName !== "undefined" ) {
				return context.getElementsByTagName( tag );

			// DocumentFragment nodes don't have gEBTN
			} else if ( support.qsa ) {
				return context.querySelectorAll( tag );
			}
		} :

		function( tag, context ) {
			var elem,
				tmp = [],
				i = 0,

				// By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
				results = context.getElementsByTagName( tag );

			// Filter out possible comments
			if ( tag === "*" ) {
				while ( ( elem = results[ i++ ] ) ) {
					if ( elem.nodeType === 1 ) {
						tmp.push( elem );
					}
				}

				return tmp;
			}
			return results;
		};

	// Class
	Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) {
		if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
			return context.getElementsByClassName( className );
		}
	};

	/* QSA/matchesSelector
	---------------------------------------------------------------------- */

	// QSA and matchesSelector support

	// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
	rbuggyMatches = [];

	// qSa(:focus) reports false when true (Chrome 21)
	// We allow this because of a bug in IE8/9 that throws an error
	// whenever `document.activeElement` is accessed on an iframe
	// So, we allow :focus to pass through QSA all the time to avoid the IE error
	// See https://bugs.jquery.com/ticket/13378
	rbuggyQSA = [];

	if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {

		// Build QSA regex
		// Regex strategy adopted from Diego Perini
		assert( function( el ) {

			var input;

			// Select is set to empty string on purpose
			// This is to test IE's treatment of not explicitly
			// setting a boolean content attribute,
			// since its presence should be enough
			// https://bugs.jquery.com/ticket/12359
			docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
				"<select id='" + expando + "-\r\\' msallowcapture=''>" +
				"<option selected=''></option></select>";

			// Support: IE8, Opera 11-12.16
			// Nothing should be selected when empty strings follow ^= or $= or *=
			// The test attribute must be unknown in Opera but "safe" for WinRT
			// https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
			if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) {
				rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
			}

			// Support: IE8
			// Boolean attributes and "value" are not treated correctly
			if ( !el.querySelectorAll( "[selected]" ).length ) {
				rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
			}

			// Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
			if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
				rbuggyQSA.push( "~=" );
			}

			// Support: IE 11+, Edge 15 - 18+
			// IE 11/Edge don't find elements on a `[name='']` query in some cases.
			// Adding a temporary attribute to the document before the selection works
			// around the issue.
			// Interestingly, IE 10 & older don't seem to have the issue.
			input = document.createElement( "input" );
			input.setAttribute( "name", "" );
			el.appendChild( input );
			if ( !el.querySelectorAll( "[name='']" ).length ) {
				rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
					whitespace + "*(?:''|\"\")" );
			}

			// Webkit/Opera - :checked should return selected option elements
			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
			// IE8 throws error here and will not see later tests
			if ( !el.querySelectorAll( ":checked" ).length ) {
				rbuggyQSA.push( ":checked" );
			}

			// Support: Safari 8+, iOS 8+
			// https://bugs.webkit.org/show_bug.cgi?id=136851
			// In-page `selector#id sibling-combinator selector` fails
			if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
				rbuggyQSA.push( ".#.+[+~]" );
			}

			// Support: Firefox <=3.6 - 5 only
			// Old Firefox doesn't throw on a badly-escaped identifier.
			el.querySelectorAll( "\\\f" );
			rbuggyQSA.push( "[\\r\\n\\f]" );
		} );

		assert( function( el ) {
			el.innerHTML = "<a href='' disabled='disabled'></a>" +
				"<select disabled='disabled'><option/></select>";

			// Support: Windows 8 Native Apps
			// The type and name attributes are restricted during .innerHTML assignment
			var input = document.createElement( "input" );
			input.setAttribute( "type", "hidden" );
			el.appendChild( input ).setAttribute( "name", "D" );

			// Support: IE8
			// Enforce case-sensitivity of name attribute
			if ( el.querySelectorAll( "[name=d]" ).length ) {
				rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
			}

			// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
			// IE8 throws error here and will not see later tests
			if ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
				rbuggyQSA.push( ":enabled", ":disabled" );
			}

			// Support: IE9-11+
			// IE's :disabled selector does not pick up the children of disabled fieldsets
			docElem.appendChild( el ).disabled = true;
			if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
				rbuggyQSA.push( ":enabled", ":disabled" );
			}

			// Support: Opera 10 - 11 only
			// Opera 10-11 does not throw on post-comma invalid pseudos
			el.querySelectorAll( "*,:x" );
			rbuggyQSA.push( ",.*:" );
		} );
	}

	if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
		docElem.webkitMatchesSelector ||
		docElem.mozMatchesSelector ||
		docElem.oMatchesSelector ||
		docElem.msMatchesSelector ) ) ) ) {

		assert( function( el ) {

			// Check to see if it's possible to do matchesSelector
			// on a disconnected node (IE 9)
			support.disconnectedMatch = matches.call( el, "*" );

			// This should fail with an exception
			// Gecko does not error, returns false instead
			matches.call( el, "[s!='']:x" );
			rbuggyMatches.push( "!=", pseudos );
		} );
	}

	rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
	rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) );

	/* Contains
	---------------------------------------------------------------------- */
	hasCompare = rnative.test( docElem.compareDocumentPosition );

	// Element contains another
	// Purposefully self-exclusive
	// As in, an element does not contain itself
	contains = hasCompare || rnative.test( docElem.contains ) ?
		function( a, b ) {
			var adown = a.nodeType === 9 ? a.documentElement : a,
				bup = b && b.parentNode;
			return a === bup || !!( bup && bup.nodeType === 1 && (
				adown.contains ?
					adown.contains( bup ) :
					a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
			) );
		} :
		function( a, b ) {
			if ( b ) {
				while ( ( b = b.parentNode ) ) {
					if ( b === a ) {
						return true;
					}
				}
			}
			return false;
		};

	/* Sorting
	---------------------------------------------------------------------- */

	// Document order sorting
	sortOrder = hasCompare ?
	function( a, b ) {

		// Flag for duplicate removal
		if ( a === b ) {
			hasDuplicate = true;
			return 0;
		}

		// Sort on method existence if only one input has compareDocumentPosition
		var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
		if ( compare ) {
			return compare;
		}

		// Calculate position if both inputs belong to the same document
		// Support: IE 11+, Edge 17 - 18+
		// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
		// two documents; shallow comparisons work.
		// eslint-disable-next-line eqeqeq
		compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
			a.compareDocumentPosition( b ) :

			// Otherwise we know they are disconnected
			1;

		// Disconnected nodes
		if ( compare & 1 ||
			( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {

			// Choose the first element that is related to our preferred document
			// Support: IE 11+, Edge 17 - 18+
			// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
			// two documents; shallow comparisons work.
			// eslint-disable-next-line eqeqeq
			if ( a == document || a.ownerDocument == preferredDoc &&
				contains( preferredDoc, a ) ) {
				return -1;
			}

			// Support: IE 11+, Edge 17 - 18+
			// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
			// two documents; shallow comparisons work.
			// eslint-disable-next-line eqeqeq
			if ( b == document || b.ownerDocument == preferredDoc &&
				contains( preferredDoc, b ) ) {
				return 1;
			}

			// Maintain original order
			return sortInput ?
				( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
				0;
		}

		return compare & 4 ? -1 : 1;
	} :
	function( a, b ) {

		// Exit early if the nodes are identical
		if ( a === b ) {
			hasDuplicate = true;
			return 0;
		}

		var cur,
			i = 0,
			aup = a.parentNode,
			bup = b.parentNode,
			ap = [ a ],
			bp = [ b ];

		// Parentless nodes are either documents or disconnected
		if ( !aup || !bup ) {

			// Support: IE 11+, Edge 17 - 18+
			// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
			// two documents; shallow comparisons work.
			/* eslint-disable eqeqeq */
			return a == document ? -1 :
				b == document ? 1 :
				/* eslint-enable eqeqeq */
				aup ? -1 :
				bup ? 1 :
				sortInput ?
				( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
				0;

		// If the nodes are siblings, we can do a quick check
		} else if ( aup === bup ) {
			return siblingCheck( a, b );
		}

		// Otherwise we need full lists of their ancestors for comparison
		cur = a;
		while ( ( cur = cur.parentNode ) ) {
			ap.unshift( cur );
		}
		cur = b;
		while ( ( cur = cur.parentNode ) ) {
			bp.unshift( cur );
		}

		// Walk down the tree looking for a discrepancy
		while ( ap[ i ] === bp[ i ] ) {
			i++;
		}

		return i ?

			// Do a sibling check if the nodes have a common ancestor
			siblingCheck( ap[ i ], bp[ i ] ) :

			// Otherwise nodes in our document sort first
			// Support: IE 11+, Edge 17 - 18+
			// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
			// two documents; shallow comparisons work.
			/* eslint-disable eqeqeq */
			ap[ i ] == preferredDoc ? -1 :
			bp[ i ] == preferredDoc ? 1 :
			/* eslint-enable eqeqeq */
			0;
	};

	return document;
};

Sizzle.matches = function( expr, elements ) {
	return Sizzle( expr, null, null, elements );
};

Sizzle.matchesSelector = function( elem, expr ) {
	setDocument( elem );

	if ( support.matchesSelector && documentIsHTML &&
		!nonnativeSelectorCache[ expr + " " ] &&
		( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
		( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {

		try {
			var ret = matches.call( elem, expr );

			// IE 9's matchesSelector returns false on disconnected nodes
			if ( ret || support.disconnectedMatch ||

				// As well, disconnected nodes are said to be in a document
				// fragment in IE 9
				elem.document && elem.document.nodeType !== 11 ) {
				return ret;
			}
		} catch ( e ) {
			nonnativeSelectorCache( expr, true );
		}
	}

	return Sizzle( expr, document, null, [ elem ] ).length > 0;
};

Sizzle.contains = function( context, elem ) {

	// Set document vars if needed
	// Support: IE 11+, Edge 17 - 18+
	// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
	// two documents; shallow comparisons work.
	// eslint-disable-next-line eqeqeq
	if ( ( context.ownerDocument || context ) != document ) {
		setDocument( context );
	}
	return contains( context, elem );
};

Sizzle.attr = function( elem, name ) {

	// Set document vars if needed
	// Support: IE 11+, Edge 17 - 18+
	// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
	// two documents; shallow comparisons work.
	// eslint-disable-next-line eqeqeq
	if ( ( elem.ownerDocument || elem ) != document ) {
		setDocument( elem );
	}

	var fn = Expr.attrHandle[ name.toLowerCase() ],

		// Don't get fooled by Object.prototype properties (jQuery #13807)
		val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
			fn( elem, name, !documentIsHTML ) :
			undefined;

	return val !== undefined ?
		val :
		support.attributes || !documentIsHTML ?
			elem.getAttribute( name ) :
			( val = elem.getAttributeNode( name ) ) && val.specified ?
				val.value :
				null;
};

Sizzle.escape = function( sel ) {
	return ( sel + "" ).replace( rcssescape, fcssescape );
};

Sizzle.error = function( msg ) {
	throw new Error( "Syntax error, unrecognized expression: " + msg );
};

/**
 * Document sorting and removing duplicates
 * @param {ArrayLike} results
 */
Sizzle.uniqueSort = function( results ) {
	var elem,
		duplicates = [],
		j = 0,
		i = 0;

	// Unless we *know* we can detect duplicates, assume their presence
	hasDuplicate = !support.detectDuplicates;
	sortInput = !support.sortStable && results.slice( 0 );
	results.sort( sortOrder );

	if ( hasDuplicate ) {
		while ( ( elem = results[ i++ ] ) ) {
			if ( elem === results[ i ] ) {
				j = duplicates.push( i );
			}
		}
		while ( j-- ) {
			results.splice( duplicates[ j ], 1 );
		}
	}

	// Clear input after sorting to release objects
	// See https://github.com/jquery/sizzle/pull/225
	sortInput = null;

	return results;
};

/**
 * Utility function for retrieving the text value of an array of DOM nodes
 * @param {Array|Element} elem
 */
getText = Sizzle.getText = function( elem ) {
	var node,
		ret = "",
		i = 0,
		nodeType = elem.nodeType;

	if ( !nodeType ) {

		// If no nodeType, this is expected to be an array
		while ( ( node = elem[ i++ ] ) ) {

			// Do not traverse comment nodes
			ret += getText( node );
		}
	} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {

		// Use textContent for elements
		// innerText usage removed for consistency of new lines (jQuery #11153)
		if ( typeof elem.textContent === "string" ) {
			return elem.textContent;
		} else {

			// Traverse its children
			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
				ret += getText( elem );
			}
		}
	} else if ( nodeType === 3 || nodeType === 4 ) {
		return elem.nodeValue;
	}

	// Do not include comment or processing instruction nodes

	return ret;
};

Expr = Sizzle.selectors = {

	// Can be adjusted by the user
	cacheLength: 50,

	createPseudo: markFunction,

	match: matchExpr,

	attrHandle: {},

	find: {},

	relative: {
		">": { dir: "parentNode", first: true },
		" ": { dir: "parentNode" },
		"+": { dir: "previousSibling", first: true },
		"~": { dir: "previousSibling" }
	},

	preFilter: {
		"ATTR": function( match ) {
			match[ 1 ] = match[ 1 ].replace( runescape, funescape );

			// Move the given value to match[3] whether quoted or unquoted
			match[ 3 ] = ( match[ 3 ] || match[ 4 ] ||
				match[ 5 ] || "" ).replace( runescape, funescape );

			if ( match[ 2 ] === "~=" ) {
				match[ 3 ] = " " + match[ 3 ] + " ";
			}

			return match.slice( 0, 4 );
		},

		"CHILD": function( match ) {

			/* matches from matchExpr["CHILD"]
				1 type (only|nth|...)
				2 what (child|of-type)
				3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
				4 xn-component of xn+y argument ([+-]?\d*n|)
				5 sign of xn-component
				6 x of xn-component
				7 sign of y-component
				8 y of y-component
			*/
			match[ 1 ] = match[ 1 ].toLowerCase();

			if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {

				// nth-* requires argument
				if ( !match[ 3 ] ) {
					Sizzle.error( match[ 0 ] );
				}

				// numeric x and y parameters for Expr.filter.CHILD
				// remember that false/true cast respectively to 0/1
				match[ 4 ] = +( match[ 4 ] ?
					match[ 5 ] + ( match[ 6 ] || 1 ) :
					2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) );
				match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );

				// other types prohibit arguments
			} else if ( match[ 3 ] ) {
				Sizzle.error( match[ 0 ] );
			}

			return match;
		},

		"PSEUDO": function( match ) {
			var excess,
				unquoted = !match[ 6 ] && match[ 2 ];

			if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
				return null;
			}

			// Accept quoted arguments as-is
			if ( match[ 3 ] ) {
				match[ 2 ] = match[ 4 ] || match[ 5 ] || "";

			// Strip excess characters from unquoted arguments
			} else if ( unquoted && rpseudo.test( unquoted ) &&

				// Get excess from tokenize (recursively)
				( excess = tokenize( unquoted, true ) ) &&

				// advance to the next closing parenthesis
				( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {

				// excess is a negative index
				match[ 0 ] = match[ 0 ].slice( 0, excess );
				match[ 2 ] = unquoted.slice( 0, excess );
			}

			// Return only captures needed by the pseudo filter method (type and argument)
			return match.slice( 0, 3 );
		}
	},

	filter: {

		"TAG": function( nodeNameSelector ) {
			var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
			return nodeNameSelector === "*" ?
				function() {
					return true;
				} :
				function( elem ) {
					return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
				};
		},

		"CLASS": function( className ) {
			var pattern = classCache[ className + " " ];

			return pattern ||
				( pattern = new RegExp( "(^|" + whitespace +
					")" + className + "(" + whitespace + "|$)" ) ) && classCache(
						className, function( elem ) {
							return pattern.test(
								typeof elem.className === "string" && elem.className ||
								typeof elem.getAttribute !== "undefined" &&
									elem.getAttribute( "class" ) ||
								""
							);
				} );
		},

		"ATTR": function( name, operator, check ) {
			return function( elem ) {
				var result = Sizzle.attr( elem, name );

				if ( result == null ) {
					return operator === "!=";
				}
				if ( !operator ) {
					return true;
				}

				result += "";

				/* eslint-disable max-len */

				return operator === "=" ? result === check :
					operator === "!=" ? result !== check :
					operator === "^=" ? check && result.indexOf( check ) === 0 :
					operator === "*=" ? check && result.indexOf( check ) > -1 :
					operator === "$=" ? check && result.slice( -check.length ) === check :
					operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
					operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
					false;
				/* eslint-enable max-len */

			};
		},

		"CHILD": function( type, what, _argument, first, last ) {
			var simple = type.slice( 0, 3 ) !== "nth",
				forward = type.slice( -4 ) !== "last",
				ofType = what === "of-type";

			return first === 1 && last === 0 ?

				// Shortcut for :nth-*(n)
				function( elem ) {
					return !!elem.parentNode;
				} :

				function( elem, _context, xml ) {
					var cache, uniqueCache, outerCache, node, nodeIndex, start,
						dir = simple !== forward ? "nextSibling" : "previousSibling",
						parent = elem.parentNode,
						name = ofType && elem.nodeName.toLowerCase(),
						useCache = !xml && !ofType,
						diff = false;

					if ( parent ) {

						// :(first|last|only)-(child|of-type)
						if ( simple ) {
							while ( dir ) {
								node = elem;
								while ( ( node = node[ dir ] ) ) {
									if ( ofType ?
										node.nodeName.toLowerCase() === name :
										node.nodeType === 1 ) {

										return false;
									}
								}

								// Reverse direction for :only-* (if we haven't yet done so)
								start = dir = type === "only" && !start && "nextSibling";
							}
							return true;
						}

						start = [ forward ? parent.firstChild : parent.lastChild ];

						// non-xml :nth-child(...) stores cache data on `parent`
						if ( forward && useCache ) {

							// Seek `elem` from a previously-cached index

							// ...in a gzip-friendly way
							node = parent;
							outerCache = node[ expando ] || ( node[ expando ] = {} );

							// Support: IE <9 only
							// Defend against cloned attroperties (jQuery gh-1709)
							uniqueCache = outerCache[ node.uniqueID ] ||
								( outerCache[ node.uniqueID ] = {} );

							cache = uniqueCache[ type ] || [];
							nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
							diff = nodeIndex && cache[ 2 ];
							node = nodeIndex && parent.childNodes[ nodeIndex ];

							while ( ( node = ++nodeIndex && node && node[ dir ] ||

								// Fallback to seeking `elem` from the start
								( diff = nodeIndex = 0 ) || start.pop() ) ) {

								// When found, cache indexes on `parent` and break
								if ( node.nodeType === 1 && ++diff && node === elem ) {
									uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
									break;
								}
							}

						} else {

							// Use previously-cached element index if available
							if ( useCache ) {

								// ...in a gzip-friendly way
								node = elem;
								outerCache = node[ expando ] || ( node[ expando ] = {} );

								// Support: IE <9 only
								// Defend against cloned attroperties (jQuery gh-1709)
								uniqueCache = outerCache[ node.uniqueID ] ||
									( outerCache[ node.uniqueID ] = {} );

								cache = uniqueCache[ type ] || [];
								nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
								diff = nodeIndex;
							}

							// xml :nth-child(...)
							// or :nth-last-child(...) or :nth(-last)?-of-type(...)
							if ( diff === false ) {

								// Use the same loop as above to seek `elem` from the start
								while ( ( node = ++nodeIndex && node && node[ dir ] ||
									( diff = nodeIndex = 0 ) || start.pop() ) ) {

									if ( ( ofType ?
										node.nodeName.toLowerCase() === name :
										node.nodeType === 1 ) &&
										++diff ) {

										// Cache the index of each encountered element
										if ( useCache ) {
											outerCache = node[ expando ] ||
												( node[ expando ] = {} );

											// Support: IE <9 only
											// Defend against cloned attroperties (jQuery gh-1709)
											uniqueCache = outerCache[ node.uniqueID ] ||
												( outerCache[ node.uniqueID ] = {} );

											uniqueCache[ type ] = [ dirruns, diff ];
										}

										if ( node === elem ) {
											break;
										}
									}
								}
							}
						}

						// Incorporate the offset, then check against cycle size
						diff -= last;
						return diff === first || ( diff % first === 0 && diff / first >= 0 );
					}
				};
		},

		"PSEUDO": function( pseudo, argument ) {

			// pseudo-class names are case-insensitive
			// http://www.w3.org/TR/selectors/#pseudo-classes
			// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
			// Remember that setFilters inherits from pseudos
			var args,
				fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
					Sizzle.error( "unsupported pseudo: " + pseudo );

			// The user may use createPseudo to indicate that
			// arguments are needed to create the filter function
			// just as Sizzle does
			if ( fn[ expando ] ) {
				return fn( argument );
			}

			// But maintain support for old signatures
			if ( fn.length > 1 ) {
				args = [ pseudo, pseudo, "", argument ];
				return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
					markFunction( function( seed, matches ) {
						var idx,
							matched = fn( seed, argument ),
							i = matched.length;
						while ( i-- ) {
							idx = indexOf( seed, matched[ i ] );
							seed[ idx ] = !( matches[ idx ] = matched[ i ] );
						}
					} ) :
					function( elem ) {
						return fn( elem, 0, args );
					};
			}

			return fn;
		}
	},

	pseudos: {

		// Potentially complex pseudos
		"not": markFunction( function( selector ) {

			// Trim the selector passed to compile
			// to avoid treating leading and trailing
			// spaces as combinators
			var input = [],
				results = [],
				matcher = compile( selector.replace( rtrim, "$1" ) );

			return matcher[ expando ] ?
				markFunction( function( seed, matches, _context, xml ) {
					var elem,
						unmatched = matcher( seed, null, xml, [] ),
						i = seed.length;

					// Match elements unmatched by `matcher`
					while ( i-- ) {
						if ( ( elem = unmatched[ i ] ) ) {
							seed[ i ] = !( matches[ i ] = elem );
						}
					}
				} ) :
				function( elem, _context, xml ) {
					input[ 0 ] = elem;
					matcher( input, null, xml, results );

					// Don't keep the element (issue #299)
					input[ 0 ] = null;
					return !results.pop();
				};
		} ),

		"has": markFunction( function( selector ) {
			return function( elem ) {
				return Sizzle( selector, elem ).length > 0;
			};
		} ),

		"contains": markFunction( function( text ) {
			text = text.replace( runescape, funescape );
			return function( elem ) {
				return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
			};
		} ),

		// "Whether an element is represented by a :lang() selector
		// is based solely on the element's language value
		// being equal to the identifier C,
		// or beginning with the identifier C immediately followed by "-".
		// The matching of C against the element's language value is performed case-insensitively.
		// The identifier C does not have to be a valid language name."
		// http://www.w3.org/TR/selectors/#lang-pseudo
		"lang": markFunction( function( lang ) {

			// lang value must be a valid identifier
			if ( !ridentifier.test( lang || "" ) ) {
				Sizzle.error( "unsupported lang: " + lang );
			}
			lang = lang.replace( runescape, funescape ).toLowerCase();
			return function( elem ) {
				var elemLang;
				do {
					if ( ( elemLang = documentIsHTML ?
						elem.lang :
						elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {

						elemLang = elemLang.toLowerCase();
						return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
					}
				} while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
				return false;
			};
		} ),

		// Miscellaneous
		"target": function( elem ) {
			var hash = window.location && window.location.hash;
			return hash && hash.slice( 1 ) === elem.id;
		},

		"root": function( elem ) {
			return elem === docElem;
		},

		"focus": function( elem ) {
			return elem === document.activeElement &&
				( !document.hasFocus || document.hasFocus() ) &&
				!!( elem.type || elem.href || ~elem.tabIndex );
		},

		// Boolean properties
		"enabled": createDisabledPseudo( false ),
		"disabled": createDisabledPseudo( true ),

		"checked": function( elem ) {

			// In CSS3, :checked should return both checked and selected elements
			// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
			var nodeName = elem.nodeName.toLowerCase();
			return ( nodeName === "input" && !!elem.checked ) ||
				( nodeName === "option" && !!elem.selected );
		},

		"selected": function( elem ) {

			// Accessing this property makes selected-by-default
			// options in Safari work properly
			if ( elem.parentNode ) {
				// eslint-disable-next-line no-unused-expressions
				elem.parentNode.selectedIndex;
			}

			return elem.selected === true;
		},

		// Contents
		"empty": function( elem ) {

			// http://www.w3.org/TR/selectors/#empty-pseudo
			// :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
			//   but not by others (comment: 8; processing instruction: 7; etc.)
			// nodeType < 6 works because attributes (2) do not appear as children
			for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
				if ( elem.nodeType < 6 ) {
					return false;
				}
			}
			return true;
		},

		"parent": function( elem ) {
			return !Expr.pseudos[ "empty" ]( elem );
		},

		// Element/input types
		"header": function( elem ) {
			return rheader.test( elem.nodeName );
		},

		"input": function( elem ) {
			return rinputs.test( elem.nodeName );
		},

		"button": function( elem ) {
			var name = elem.nodeName.toLowerCase();
			return name === "input" && elem.type === "button" || name === "button";
		},

		"text": function( elem ) {
			var attr;
			return elem.nodeName.toLowerCase() === "input" &&
				elem.type === "text" &&

				// Support: IE<8
				// New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
				( ( attr = elem.getAttribute( "type" ) ) == null ||
					attr.toLowerCase() === "text" );
		},

		// Position-in-collection
		"first": createPositionalPseudo( function() {
			return [ 0 ];
		} ),

		"last": createPositionalPseudo( function( _matchIndexes, length ) {
			return [ length - 1 ];
		} ),

		"eq": createPositionalPseudo( function( _matchIndexes, length, argument ) {
			return [ argument < 0 ? argument + length : argument ];
		} ),

		"even": createPositionalPseudo( function( matchIndexes, length ) {
			var i = 0;
			for ( ; i < length; i += 2 ) {
				matchIndexes.push( i );
			}
			return matchIndexes;
		} ),

		"odd": createPositionalPseudo( function( matchIndexes, length ) {
			var i = 1;
			for ( ; i < length; i += 2 ) {
				matchIndexes.push( i );
			}
			return matchIndexes;
		} ),

		"lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
			var i = argument < 0 ?
				argument + length :
				argument > length ?
					length :
					argument;
			for ( ; --i >= 0; ) {
				matchIndexes.push( i );
			}
			return matchIndexes;
		} ),

		"gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
			var i = argument < 0 ? argument + length : argument;
			for ( ; ++i < length; ) {
				matchIndexes.push( i );
			}
			return matchIndexes;
		} )
	}
};

Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];

// Add button/input type pseudos
for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
	Expr.pseudos[ i ] = createInputPseudo( i );
}
for ( i in { submit: true, reset: true } ) {
	Expr.pseudos[ i ] = createButtonPseudo( i );
}

// Easy API for creating new setFilters
function setFilters() {}
setFilters.prototype = Expr.filters = Expr.pseudos;
Expr.setFilters = new setFilters();

tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
	var matched, match, tokens, type,
		soFar, groups, preFilters,
		cached = tokenCache[ selector + " " ];

	if ( cached ) {
		return parseOnly ? 0 : cached.slice( 0 );
	}

	soFar = selector;
	groups = [];
	preFilters = Expr.preFilter;

	while ( soFar ) {

		// Comma and first run
		if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
			if ( match ) {

				// Don't consume trailing commas as valid
				soFar = soFar.slice( match[ 0 ].length ) || soFar;
			}
			groups.push( ( tokens = [] ) );
		}

		matched = false;

		// Combinators
		if ( ( match = rcombinators.exec( soFar ) ) ) {
			matched = match.shift();
			tokens.push( {
				value: matched,

				// Cast descendant combinators to space
				type: match[ 0 ].replace( rtrim, " " )
			} );
			soFar = soFar.slice( matched.length );
		}

		// Filters
		for ( type in Expr.filter ) {
			if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
				( match = preFilters[ type ]( match ) ) ) ) {
				matched = match.shift();
				tokens.push( {
					value: matched,
					type: type,
					matches: match
				} );
				soFar = soFar.slice( matched.length );
			}
		}

		if ( !matched ) {
			break;
		}
	}

	// Return the length of the invalid excess
	// if we're just parsing
	// Otherwise, throw an error or return tokens
	return parseOnly ?
		soFar.length :
		soFar ?
			Sizzle.error( selector ) :

			// Cache the tokens
			tokenCache( selector, groups ).slice( 0 );
};

function toSelector( tokens ) {
	var i = 0,
		len = tokens.length,
		selector = "";
	for ( ; i < len; i++ ) {
		selector += tokens[ i ].value;
	}
	return selector;
}

function addCombinator( matcher, combinator, base ) {
	var dir = combinator.dir,
		skip = combinator.next,
		key = skip || dir,
		checkNonElements = base && key === "parentNode",
		doneName = done++;

	return combinator.first ?

		// Check against closest ancestor/preceding element
		function( elem, context, xml ) {
			while ( ( elem = elem[ dir ] ) ) {
				if ( elem.nodeType === 1 || checkNonElements ) {
					return matcher( elem, context, xml );
				}
			}
			return false;
		} :

		// Check against all ancestor/preceding elements
		function( elem, context, xml ) {
			var oldCache, uniqueCache, outerCache,
				newCache = [ dirruns, doneName ];

			// We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
			if ( xml ) {
				while ( ( elem = elem[ dir ] ) ) {
					if ( elem.nodeType === 1 || checkNonElements ) {
						if ( matcher( elem, context, xml ) ) {
							return true;
						}
					}
				}
			} else {
				while ( ( elem = elem[ dir ] ) ) {
					if ( elem.nodeType === 1 || checkNonElements ) {
						outerCache = elem[ expando ] || ( elem[ expando ] = {} );

						// Support: IE <9 only
						// Defend against cloned attroperties (jQuery gh-1709)
						uniqueCache = outerCache[ elem.uniqueID ] ||
							( outerCache[ elem.uniqueID ] = {} );

						if ( skip && skip === elem.nodeName.toLowerCase() ) {
							elem = elem[ dir ] || elem;
						} else if ( ( oldCache = uniqueCache[ key ] ) &&
							oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {

							// Assign to newCache so results back-propagate to previous elements
							return ( newCache[ 2 ] = oldCache[ 2 ] );
						} else {

							// Reuse newcache so results back-propagate to previous elements
							uniqueCache[ key ] = newCache;

							// A match means we're done; a fail means we have to keep checking
							if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
								return true;
							}
						}
					}
				}
			}
			return false;
		};
}

function elementMatcher( matchers ) {
	return matchers.length > 1 ?
		function( elem, context, xml ) {
			var i = matchers.length;
			while ( i-- ) {
				if ( !matchers[ i ]( elem, context, xml ) ) {
					return false;
				}
			}
			return true;
		} :
		matchers[ 0 ];
}

function multipleContexts( selector, contexts, results ) {
	var i = 0,
		len = contexts.length;
	for ( ; i < len; i++ ) {
		Sizzle( selector, contexts[ i ], results );
	}
	return results;
}

function condense( unmatched, map, filter, context, xml ) {
	var elem,
		newUnmatched = [],
		i = 0,
		len = unmatched.length,
		mapped = map != null;

	for ( ; i < len; i++ ) {
		if ( ( elem = unmatched[ i ] ) ) {
			if ( !filter || filter( elem, context, xml ) ) {
				newUnmatched.push( elem );
				if ( mapped ) {
					map.push( i );
				}
			}
		}
	}

	return newUnmatched;
}

function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
	if ( postFilter && !postFilter[ expando ] ) {
		postFilter = setMatcher( postFilter );
	}
	if ( postFinder && !postFinder[ expando ] ) {
		postFinder = setMatcher( postFinder, postSelector );
	}
	return markFunction( function( seed, results, context, xml ) {
		var temp, i, elem,
			preMap = [],
			postMap = [],
			preexisting = results.length,

			// Get initial elements from seed or context
			elems = seed || multipleContexts(
				selector || "*",
				context.nodeType ? [ context ] : context,
				[]
			),

			// Prefilter to get matcher input, preserving a map for seed-results synchronization
			matcherIn = preFilter && ( seed || !selector ) ?
				condense( elems, preMap, preFilter, context, xml ) :
				elems,

			matcherOut = matcher ?

				// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
				postFinder || ( seed ? preFilter : preexisting || postFilter ) ?

					// ...intermediate processing is necessary
					[] :

					// ...otherwise use results directly
					results :
				matcherIn;

		// Find primary matches
		if ( matcher ) {
			matcher( matcherIn, matcherOut, context, xml );
		}

		// Apply postFilter
		if ( postFilter ) {
			temp = condense( matcherOut, postMap );
			postFilter( temp, [], context, xml );

			// Un-match failing elements by moving them back to matcherIn
			i = temp.length;
			while ( i-- ) {
				if ( ( elem = temp[ i ] ) ) {
					matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
				}
			}
		}

		if ( seed ) {
			if ( postFinder || preFilter ) {
				if ( postFinder ) {

					// Get the final matcherOut by condensing this intermediate into postFinder contexts
					temp = [];
					i = matcherOut.length;
					while ( i-- ) {
						if ( ( elem = matcherOut[ i ] ) ) {

							// Restore matcherIn since elem is not yet a final match
							temp.push( ( matcherIn[ i ] = elem ) );
						}
					}
					postFinder( null, ( matcherOut = [] ), temp, xml );
				}

				// Move matched elements from seed to results to keep them synchronized
				i = matcherOut.length;
				while ( i-- ) {
					if ( ( elem = matcherOut[ i ] ) &&
						( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) {

						seed[ temp ] = !( results[ temp ] = elem );
					}
				}
			}

		// Add elements to results, through postFinder if defined
		} else {
			matcherOut = condense(
				matcherOut === results ?
					matcherOut.splice( preexisting, matcherOut.length ) :
					matcherOut
			);
			if ( postFinder ) {
				postFinder( null, results, matcherOut, xml );
			} else {
				push.apply( results, matcherOut );
			}
		}
	} );
}

function matcherFromTokens( tokens ) {
	var checkContext, matcher, j,
		len = tokens.length,
		leadingRelative = Expr.relative[ tokens[ 0 ].type ],
		implicitRelative = leadingRelative || Expr.relative[ " " ],
		i = leadingRelative ? 1 : 0,

		// The foundational matcher ensures that elements are reachable from top-level context(s)
		matchContext = addCombinator( function( elem ) {
			return elem === checkContext;
		}, implicitRelative, true ),
		matchAnyContext = addCombinator( function( elem ) {
			return indexOf( checkContext, elem ) > -1;
		}, implicitRelative, true ),
		matchers = [ function( elem, context, xml ) {
			var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
				( checkContext = context ).nodeType ?
					matchContext( elem, context, xml ) :
					matchAnyContext( elem, context, xml ) );

			// Avoid hanging onto element (issue #299)
			checkContext = null;
			return ret;
		} ];

	for ( ; i < len; i++ ) {
		if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
			matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
		} else {
			matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );

			// Return special upon seeing a positional matcher
			if ( matcher[ expando ] ) {

				// Find the next relative operator (if any) for proper handling
				j = ++i;
				for ( ; j < len; j++ ) {
					if ( Expr.relative[ tokens[ j ].type ] ) {
						break;
					}
				}
				return setMatcher(
					i > 1 && elementMatcher( matchers ),
					i > 1 && toSelector(

					// If the preceding token was a descendant combinator, insert an implicit any-element `*`
					tokens
						.slice( 0, i - 1 )
						.concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
					).replace( rtrim, "$1" ),
					matcher,
					i < j && matcherFromTokens( tokens.slice( i, j ) ),
					j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
					j < len && toSelector( tokens )
				);
			}
			matchers.push( matcher );
		}
	}

	return elementMatcher( matchers );
}

function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
	var bySet = setMatchers.length > 0,
		byElement = elementMatchers.length > 0,
		superMatcher = function( seed, context, xml, results, outermost ) {
			var elem, j, matcher,
				matchedCount = 0,
				i = "0",
				unmatched = seed && [],
				setMatched = [],
				contextBackup = outermostContext,

				// We must always have either seed elements or outermost context
				elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ),

				// Use integer dirruns iff this is the outermost matcher
				dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
				len = elems.length;

			if ( outermost ) {

				// Support: IE 11+, Edge 17 - 18+
				// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
				// two documents; shallow comparisons work.
				// eslint-disable-next-line eqeqeq
				outermostContext = context == document || context || outermost;
			}

			// Add elements passing elementMatchers directly to results
			// Support: IE<9, Safari
			// Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
			for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
				if ( byElement && elem ) {
					j = 0;

					// Support: IE 11+, Edge 17 - 18+
					// IE/Edge sometimes throw a "Permission denied" error when strict-comparing
					// two documents; shallow comparisons work.
					// eslint-disable-next-line eqeqeq
					if ( !context && elem.ownerDocument != document ) {
						setDocument( elem );
						xml = !documentIsHTML;
					}
					while ( ( matcher = elementMatchers[ j++ ] ) ) {
						if ( matcher( elem, context || document, xml ) ) {
							results.push( elem );
							break;
						}
					}
					if ( outermost ) {
						dirruns = dirrunsUnique;
					}
				}

				// Track unmatched elements for set filters
				if ( bySet ) {

					// They will have gone through all possible matchers
					if ( ( elem = !matcher && elem ) ) {
						matchedCount--;
					}

					// Lengthen the array for every element, matched or not
					if ( seed ) {
						unmatched.push( elem );
					}
				}
			}

			// `i` is now the count of elements visited above, and adding it to `matchedCount`
			// makes the latter nonnegative.
			matchedCount += i;

			// Apply set filters to unmatched elements
			// NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
			// equals `i`), unless we didn't visit _any_ elements in the above loop because we have
			// no element matchers and no seed.
			// Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
			// case, which will result in a "00" `matchedCount` that differs from `i` but is also
			// numerically zero.
			if ( bySet && i !== matchedCount ) {
				j = 0;
				while ( ( matcher = setMatchers[ j++ ] ) ) {
					matcher( unmatched, setMatched, context, xml );
				}

				if ( seed ) {

					// Reintegrate element matches to eliminate the need for sorting
					if ( matchedCount > 0 ) {
						while ( i-- ) {
							if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
								setMatched[ i ] = pop.call( results );
							}
						}
					}

					// Discard index placeholder values to get only actual matches
					setMatched = condense( setMatched );
				}

				// Add matches to results
				push.apply( results, setMatched );

				// Seedless set matches succeeding multiple successful matchers stipulate sorting
				if ( outermost && !seed && setMatched.length > 0 &&
					( matchedCount + setMatchers.length ) > 1 ) {

					Sizzle.uniqueSort( results );
				}
			}

			// Override manipulation of globals by nested matchers
			if ( outermost ) {
				dirruns = dirrunsUnique;
				outermostContext = contextBackup;
			}

			return unmatched;
		};

	return bySet ?
		markFunction( superMatcher ) :
		superMatcher;
}

compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
	var i,
		setMatchers = [],
		elementMatchers = [],
		cached = compilerCache[ selector + " " ];

	if ( !cached ) {

		// Generate a function of recursive functions that can be used to check each element
		if ( !match ) {
			match = tokenize( selector );
		}
		i = match.length;
		while ( i-- ) {
			cached = matcherFromTokens( match[ i ] );
			if ( cached[ expando ] ) {
				setMatchers.push( cached );
			} else {
				elementMatchers.push( cached );
			}
		}

		// Cache the compiled function
		cached = compilerCache(
			selector,
			matcherFromGroupMatchers( elementMatchers, setMatchers )
		);

		// Save selector and tokenization
		cached.selector = selector;
	}
	return cached;
};

/**
 * A low-level selection function that works with Sizzle's compiled
 *  selector functions
 * @param {String|Function} selector A selector or a pre-compiled
 *  selector function built with Sizzle.compile
 * @param {Element} context
 * @param {Array} [results]
 * @param {Array} [seed] A set of elements to match against
 */
select = Sizzle.select = function( selector, context, results, seed ) {
	var i, tokens, token, type, find,
		compiled = typeof selector === "function" && selector,
		match = !seed && tokenize( ( selector = compiled.selector || selector ) );

	results = results || [];

	// Try to minimize operations if there is only one selector in the list and no seed
	// (the latter of which guarantees us context)
	if ( match.length === 1 ) {

		// Reduce context if the leading compound selector is an ID
		tokens = match[ 0 ] = match[ 0 ].slice( 0 );
		if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
			context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {

			context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
				.replace( runescape, funescape ), context ) || [] )[ 0 ];
			if ( !context ) {
				return results;

			// Precompiled matchers will still verify ancestry, so step up a level
			} else if ( compiled ) {
				context = context.parentNode;
			}

			selector = selector.slice( tokens.shift().value.length );
		}

		// Fetch a seed set for right-to-left matching
		i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
		while ( i-- ) {
			token = tokens[ i ];

			// Abort if we hit a combinator
			if ( Expr.relative[ ( type = token.type ) ] ) {
				break;
			}
			if ( ( find = Expr.find[ type ] ) ) {

				// Search, expanding context for leading sibling combinators
				if ( ( seed = find(
					token.matches[ 0 ].replace( runescape, funescape ),
					rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) ||
						context
				) ) ) {

					// If seed is empty or no tokens remain, we can return early
					tokens.splice( i, 1 );
					selector = seed.length && toSelector( tokens );
					if ( !selector ) {
						push.apply( results, seed );
						return results;
					}

					break;
				}
			}
		}
	}

	// Compile and execute a filtering function if one is not provided
	// Provide `match` to avoid retokenization if we modified the selector above
	( compiled || compile( selector, match ) )(
		seed,
		context,
		!documentIsHTML,
		results,
		!context || rsibling.test( selector ) && testContext( context.parentNode ) || context
	);
	return results;
};

// One-time assignments

// Sort stability
support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;

// Support: Chrome 14-35+
// Always assume duplicates if they aren't passed to the comparison function
support.detectDuplicates = !!hasDuplicate;

// Initialize against the default document
setDocument();

// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
// Detached nodes confoundingly follow *each other*
support.sortDetached = assert( function( el ) {

	// Should return 1, but returns 4 (following)
	return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
} );

// Support: IE<8
// Prevent attribute/property "interpolation"
// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
if ( !assert( function( el ) {
	el.innerHTML = "<a href='#'></a>";
	return el.firstChild.getAttribute( "href" ) === "#";
} ) ) {
	addHandle( "type|href|height|width", function( elem, name, isXML ) {
		if ( !isXML ) {
			return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
		}
	} );
}

// Support: IE<9
// Use defaultValue in place of getAttribute("value")
if ( !support.attributes || !assert( function( el ) {
	el.innerHTML = "<input/>";
	el.firstChild.setAttribute( "value", "" );
	return el.firstChild.getAttribute( "value" ) === "";
} ) ) {
	addHandle( "value", function( elem, _name, isXML ) {
		if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
			return elem.defaultValue;
		}
	} );
}

// Support: IE<9
// Use getAttributeNode to fetch booleans when getAttribute lies
if ( !assert( function( el ) {
	return el.getAttribute( "disabled" ) == null;
} ) ) {
	addHandle( booleans, function( elem, name, isXML ) {
		var val;
		if ( !isXML ) {
			return elem[ name ] === true ? name.toLowerCase() :
				( val = elem.getAttributeNode( name ) ) && val.specified ?
					val.value :
					null;
		}
	} );
}

return Sizzle;

} )( window );



jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;

// Deprecated
jQuery.expr[ ":" ] = jQuery.expr.pseudos;
jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
jQuery.escapeSelector = Sizzle.escape;




var dir = function( elem, dir, until ) {
	var matched = [],
		truncate = until !== undefined;

	while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
		if ( elem.nodeType === 1 ) {
			if ( truncate && jQuery( elem ).is( until ) ) {
				break;
			}
			matched.push( elem );
		}
	}
	return matched;
};


var siblings = function( n, elem ) {
	var matched = [];

	for ( ; n; n = n.nextSibling ) {
		if ( n.nodeType === 1 && n !== elem ) {
			matched.push( n );
		}
	}

	return matched;
};


var rneedsContext = jQuery.expr.match.needsContext;



function nodeName( elem, name ) {

  return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();

};
var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );



// Implement the identical functionality for filter and not
function winnow( elements, qualifier, not ) {
	if ( isFunction( qualifier ) ) {
		return jQuery.grep( elements, function( elem, i ) {
			return !!qualifier.call( elem, i, elem ) !== not;
		} );
	}

	// Single element
	if ( qualifier.nodeType ) {
		return jQuery.grep( elements, function( elem ) {
			return ( elem === qualifier ) !== not;
		} );
	}

	// Arraylike of elements (jQuery, arguments, Array)
	if ( typeof qualifier !== "string" ) {
		return jQuery.grep( elements, function( elem ) {
			return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
		} );
	}

	// Filtered directly for both simple and complex selectors
	return jQuery.filter( qualifier, elements, not );
}

jQuery.filter = function( expr, elems, not ) {
	var elem = elems[ 0 ];

	if ( not ) {
		expr = ":not(" + expr + ")";
	}

	if ( elems.length === 1 && elem.nodeType === 1 ) {
		return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
	}

	return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
		return elem.nodeType === 1;
	} ) );
};

jQuery.fn.extend( {
	find: function( selector ) {
		var i, ret,
			len = this.length,
			self = this;

		if ( typeof selector !== "string" ) {
			return this.pushStack( jQuery( selector ).filter( function() {
				for ( i = 0; i < len; i++ ) {
					if ( jQuery.contains( self[ i ], this ) ) {
						return true;
					}
				}
			} ) );
		}

		ret = this.pushStack( [] );

		for ( i = 0; i < len; i++ ) {
			jQuery.find( selector, self[ i ], ret );
		}

		return len > 1 ? jQuery.uniqueSort( ret ) : ret;
	},
	filter: function( selector ) {
		return this.pushStack( winnow( this, selector || [], false ) );
	},
	not: function( selector ) {
		return this.pushStack( winnow( this, selector || [], true ) );
	},
	is: function( selector ) {
		return !!winnow(
			this,

			// If this is a positional/relative selector, check membership in the returned set
			// so $("p:first").is("p:last") won't return true for a doc with two "p".
			typeof selector === "string" && rneedsContext.test( selector ) ?
				jQuery( selector ) :
				selector || [],
			false
		).length;
	}
} );


// Initialize a jQuery object


// A central reference to the root jQuery(document)
var rootjQuery,

	// A simple way to check for HTML strings
	// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
	// Strict HTML recognition (#11290: must start with <)
	// Shortcut simple #id case for speed
	rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,

	init = jQuery.fn.init = function( selector, context, root ) {
		var match, elem;

		// HANDLE: $(""), $(null), $(undefined), $(false)
		if ( !selector ) {
			return this;
		}

		// Method init() accepts an alternate rootjQuery
		// so migrate can support jQuery.sub (gh-2101)
		root = root || rootjQuery;

		// Handle HTML strings
		if ( typeof selector === "string" ) {
			if ( selector[ 0 ] === "<" &&
				selector[ selector.length - 1 ] === ">" &&
				selector.length >= 3 ) {

				// Assume that strings that start and end with <> are HTML and skip the regex check
				match = [ null, selector, null ];

			} else {
				match = rquickExpr.exec( selector );
			}

			// Match html or make sure no context is specified for #id
			if ( match && ( match[ 1 ] || !context ) ) {

				// HANDLE: $(html) -> $(array)
				if ( match[ 1 ] ) {
					context = context instanceof jQuery ? context[ 0 ] : context;

					// Option to run scripts is true for back-compat
					// Intentionally let the error be thrown if parseHTML is not present
					jQuery.merge( this, jQuery.parseHTML(
						match[ 1 ],
						context && context.nodeType ? context.ownerDocument || context : document,
						true
					) );

					// HANDLE: $(html, props)
					if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
						for ( match in context ) {

							// Properties of context are called as methods if possible
							if ( isFunction( this[ match ] ) ) {
								this[ match ]( context[ match ] );

							// ...and otherwise set as attributes
							} else {
								this.attr( match, context[ match ] );
							}
						}
					}

					return this;

				// HANDLE: $(#id)
				} else {
					elem = document.getElementById( match[ 2 ] );

					if ( elem ) {

						// Inject the element directly into the jQuery object
						this[ 0 ] = elem;
						this.length = 1;
					}
					return this;
				}

			// HANDLE: $(expr, $(...))
			} else if ( !context || context.jquery ) {
				return ( context || root ).find( selector );

			// HANDLE: $(expr, context)
			// (which is just equivalent to: $(context).find(expr)
			} else {
				return this.constructor( context ).find( selector );
			}

		// HANDLE: $(DOMElement)
		} else if ( selector.nodeType ) {
			this[ 0 ] = selector;
			this.length = 1;
			return this;

		// HANDLE: $(function)
		// Shortcut for document ready
		} else if ( isFunction( selector ) ) {
			return root.ready !== undefined ?
				root.ready( selector ) :

				// Execute immediately if ready is not present
				selector( jQuery );
		}

		return jQuery.makeArray( selector, this );
	};

// Give the init function the jQuery prototype for later instantiation
init.prototype = jQuery.fn;

// Initialize central reference
rootjQuery = jQuery( document );


var rparentsprev = /^(?:parents|prev(?:Until|All))/,

	// Methods guaranteed to produce a unique set when starting from a unique set
	guaranteedUnique = {
		children: true,
		contents: true,
		next: true,
		prev: true
	};

jQuery.fn.extend( {
	has: function( target ) {
		var targets = jQuery( target, this ),
			l = targets.length;

		return this.filter( function() {
			var i = 0;
			for ( ; i < l; i++ ) {
				if ( jQuery.contains( this, targets[ i ] ) ) {
					return true;
				}
			}
		} );
	},

	closest: function( selectors, context ) {
		var cur,
			i = 0,
			l = this.length,
			matched = [],
			targets = typeof selectors !== "string" && jQuery( selectors );

		// Positional selectors never match, since there's no _selection_ context
		if ( !rneedsContext.test( selectors ) ) {
			for ( ; i < l; i++ ) {
				for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {

					// Always skip document fragments
					if ( cur.nodeType < 11 && ( targets ?
						targets.index( cur ) > -1 :

						// Don't pass non-elements to Sizzle
						cur.nodeType === 1 &&
							jQuery.find.matchesSelector( cur, selectors ) ) ) {

						matched.push( cur );
						break;
					}
				}
			}
		}

		return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
	},

	// Determine the position of an element within the set
	index: function( elem ) {

		// No argument, return index in parent
		if ( !elem ) {
			return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
		}

		// Index in selector
		if ( typeof elem === "string" ) {
			return indexOf.call( jQuery( elem ), this[ 0 ] );
		}

		// Locate the position of the desired element
		return indexOf.call( this,

			// If it receives a jQuery object, the first element is used
			elem.jquery ? elem[ 0 ] : elem
		);
	},

	add: function( selector, context ) {
		return this.pushStack(
			jQuery.uniqueSort(
				jQuery.merge( this.get(), jQuery( selector, context ) )
			)
		);
	},

	addBack: function( selector ) {
		return this.add( selector == null ?
			this.prevObject : this.prevObject.filter( selector )
		);
	}
} );

function sibling( cur, dir ) {
	while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
	return cur;
}

jQuery.each( {
	parent: function( elem ) {
		var parent = elem.parentNode;
		return parent && parent.nodeType !== 11 ? parent : null;
	},
	parents: function( elem ) {
		return dir( elem, "parentNode" );
	},
	parentsUntil: function( elem, _i, until ) {
		return dir( elem, "parentNode", until );
	},
	next: function( elem ) {
		return sibling( elem, "nextSibling" );
	},
	prev: function( elem ) {
		return sibling( elem, "previousSibling" );
	},
	nextAll: function( elem ) {
		return dir( elem, "nextSibling" );
	},
	prevAll: function( elem ) {
		return dir( elem, "previousSibling" );
	},
	nextUntil: function( elem, _i, until ) {
		return dir( elem, "nextSibling", until );
	},
	prevUntil: function( elem, _i, until ) {
		return dir( elem, "previousSibling", until );
	},
	siblings: function( elem ) {
		return siblings( ( elem.parentNode || {} ).firstChild, elem );
	},
	children: function( elem ) {
		return siblings( elem.firstChild );
	},
	contents: function( elem ) {
		if ( elem.contentDocument != null &&

			// Support: IE 11+
			// <object> elements with no `data` attribute has an object
			// `contentDocument` with a `null` prototype.
			getProto( elem.contentDocument ) ) {

			return elem.contentDocument;
		}

		// Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
		// Treat the template element as a regular one in browsers that
		// don't support it.
		if ( nodeName( elem, "template" ) ) {
			elem = elem.content || elem;
		}

		return jQuery.merge( [], elem.childNodes );
	}
}, function( name, fn ) {
	jQuery.fn[ name ] = function( until, selector ) {
		var matched = jQuery.map( this, fn, until );

		if ( name.slice( -5 ) !== "Until" ) {
			selector = until;
		}

		if ( selector && typeof selector === "string" ) {
			matched = jQuery.filter( selector, matched );
		}

		if ( this.length > 1 ) {

			// Remove duplicates
			if ( !guaranteedUnique[ name ] ) {
				jQuery.uniqueSort( matched );
			}

			// Reverse order for parents* and prev-derivatives
			if ( rparentsprev.test( name ) ) {
				matched.reverse();
			}
		}

		return this.pushStack( matched );
	};
} );
var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );



// Convert String-formatted options into Object-formatted ones
function createOptions( options ) {
	var object = {};
	jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
		object[ flag ] = true;
	} );
	return object;
}

/*
 * Create a callback list using the following parameters:
 *
 *	options: an optional list of space-separated options that will change how
 *			the callback list behaves or a more traditional option object
 *
 * By default a callback list will act like an event callback list and can be
 * "fired" multiple times.
 *
 * Possible options:
 *
 *	once:			will ensure the callback list can only be fired once (like a Deferred)
 *
 *	memory:			will keep track of previous values and will call any callback added
 *					after the list has been fired right away with the latest "memorized"
 *					values (like a Deferred)
 *
 *	unique:			will ensure a callback can only be added once (no duplicate in the list)
 *
 *	stopOnFalse:	interrupt callings when a callback returns false
 *
 */
jQuery.Callbacks = function( options ) {

	// Convert options from String-formatted to Object-formatted if needed
	// (we check in cache first)
	options = typeof options === "string" ?
		createOptions( options ) :
		jQuery.extend( {}, options );

	var // Flag to know if list is currently firing
		firing,

		// Last fire value for non-forgettable lists
		memory,

		// Flag to know if list was already fired
		fired,

		// Flag to prevent firing
		locked,

		// Actual callback list
		list = [],

		// Queue of execution data for repeatable lists
		queue = [],

		// Index of currently firing callback (modified by add/remove as needed)
		firingIndex = -1,

		// Fire callbacks
		fire = function() {

			// Enforce single-firing
			locked = locked || options.once;

			// Execute callbacks for all pending executions,
			// respecting firingIndex overrides and runtime changes
			fired = firing = true;
			for ( ; queue.length; firingIndex = -1 ) {
				memory = queue.shift();
				while ( ++firingIndex < list.length ) {

					// Run callback and check for early termination
					if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
						options.stopOnFalse ) {

						// Jump to end and forget the data so .add doesn't re-fire
						firingIndex = list.length;
						memory = false;
					}
				}
			}

			// Forget the data if we're done with it
			if ( !options.memory ) {
				memory = false;
			}

			firing = false;

			// Clean up if we're done firing for good
			if ( locked ) {

				// Keep an empty list if we have data for future add calls
				if ( memory ) {
					list = [];

				// Otherwise, this object is spent
				} else {
					list = "";
				}
			}
		},

		// Actual Callbacks object
		self = {

			// Add a callback or a collection of callbacks to the list
			add: function() {
				if ( list ) {

					// If we have memory from a past run, we should fire after adding
					if ( memory && !firing ) {
						firingIndex = list.length - 1;
						queue.push( memory );
					}

					( function add( args ) {
						jQuery.each( args, function( _, arg ) {
							if ( isFunction( arg ) ) {
								if ( !options.unique || !self.has( arg ) ) {
									list.push( arg );
								}
							} else if ( arg && arg.length && toType( arg ) !== "string" ) {

								// Inspect recursively
								add( arg );
							}
						} );
					} )( arguments );

					if ( memory && !firing ) {
						fire();
					}
				}
				return this;
			},

			// Remove a callback from the list
			remove: function() {
				jQuery.each( arguments, function( _, arg ) {
					var index;
					while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
						list.splice( index, 1 );

						// Handle firing indexes
						if ( index <= firingIndex ) {
							firingIndex--;
						}
					}
				} );
				return this;
			},

			// Check if a given callback is in the list.
			// If no argument is given, return whether or not list has callbacks attached.
			has: function( fn ) {
				return fn ?
					jQuery.inArray( fn, list ) > -1 :
					list.length > 0;
			},

			// Remove all callbacks from the list
			empty: function() {
				if ( list ) {
					list = [];
				}
				return this;
			},

			// Disable .fire and .add
			// Abort any current/pending executions
			// Clear all callbacks and values
			disable: function() {
				locked = queue = [];
				list = memory = "";
				return this;
			},
			disabled: function() {
				return !list;
			},

			// Disable .fire
			// Also disable .add unless we have memory (since it would have no effect)
			// Abort any pending executions
			lock: function() {
				locked = queue = [];
				if ( !memory && !firing ) {
					list = memory = "";
				}
				return this;
			},
			locked: function() {
				return !!locked;
			},

			// Call all callbacks with the given context and arguments
			fireWith: function( context, args ) {
				if ( !locked ) {
					args = args || [];
					args = [ context, args.slice ? args.slice() : args ];
					queue.push( args );
					if ( !firing ) {
						fire();
					}
				}
				return this;
			},

			// Call all the callbacks with the given arguments
			fire: function() {
				self.fireWith( this, arguments );
				return this;
			},

			// To know if the callbacks have already been called at least once
			fired: function() {
				return !!fired;
			}
		};

	return self;
};


function Identity( v ) {
	return v;
}
function Thrower( ex ) {
	throw ex;
}

function adoptValue( value, resolve, reject, noValue ) {
	var method;

	try {

		// Check for promise aspect first to privilege synchronous behavior
		if ( value && isFunction( ( method = value.promise ) ) ) {
			method.call( value ).done( resolve ).fail( reject );

		// Other thenables
		} else if ( value && isFunction( ( method = value.then ) ) ) {
			method.call( value, resolve, reject );

		// Other non-thenables
		} else {

			// Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
			// * false: [ value ].slice( 0 ) => resolve( value )
			// * true: [ value ].slice( 1 ) => resolve()
			resolve.apply( undefined, [ value ].slice( noValue ) );
		}

	// For Promises/A+, convert exceptions into rejections
	// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
	// Deferred#then to conditionally suppress rejection.
	} catch ( value ) {

		// Support: Android 4.0 only
		// Strict mode functions invoked without .call/.apply get global-object context
		reject.apply( undefined, [ value ] );
	}
}

jQuery.extend( {

	Deferred: function( func ) {
		var tuples = [

				// action, add listener, callbacks,
				// ... .then handlers, argument index, [final state]
				[ "notify", "progress", jQuery.Callbacks( "memory" ),
					jQuery.Callbacks( "memory" ), 2 ],
				[ "resolve", "done", jQuery.Callbacks( "once memory" ),
					jQuery.Callbacks( "once memory" ), 0, "resolved" ],
				[ "reject", "fail", jQuery.Callbacks( "once memory" ),
					jQuery.Callbacks( "once memory" ), 1, "rejected" ]
			],
			state = "pending",
			promise = {
				state: function() {
					return state;
				},
				always: function() {
					deferred.done( arguments ).fail( arguments );
					return this;
				},
				"catch": function( fn ) {
					return promise.then( null, fn );
				},

				// Keep pipe for back-compat
				pipe: function( /* fnDone, fnFail, fnProgress */ ) {
					var fns = arguments;

					return jQuery.Deferred( function( newDefer ) {
						jQuery.each( tuples, function( _i, tuple ) {

							// Map tuples (progress, done, fail) to arguments (done, fail, progress)
							var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];

							// deferred.progress(function() { bind to newDefer or newDefer.notify })
							// deferred.done(function() { bind to newDefer or newDefer.resolve })
							// deferred.fail(function() { bind to newDefer or newDefer.reject })
							deferred[ tuple[ 1 ] ]( function() {
								var returned = fn && fn.apply( this, arguments );
								if ( returned && isFunction( returned.promise ) ) {
									returned.promise()
										.progress( newDefer.notify )
										.done( newDefer.resolve )
										.fail( newDefer.reject );
								} else {
									newDefer[ tuple[ 0 ] + "With" ](
										this,
										fn ? [ returned ] : arguments
									);
								}
							} );
						} );
						fns = null;
					} ).promise();
				},
				then: function( onFulfilled, onRejected, onProgress ) {
					var maxDepth = 0;
					function resolve( depth, deferred, handler, special ) {
						return function() {
							var that = this,
								args = arguments,
								mightThrow = function() {
									var returned, then;

									// Support: Promises/A+ section 2.3.3.3.3
									// https://promisesaplus.com/#point-59
									// Ignore double-resolution attempts
									if ( depth < maxDepth ) {
										return;
									}

									returned = handler.apply( that, args );

									// Support: Promises/A+ section 2.3.1
									// https://promisesaplus.com/#point-48
									if ( returned === deferred.promise() ) {
										throw new TypeError( "Thenable self-resolution" );
									}

									// Support: Promises/A+ sections 2.3.3.1, 3.5
									// https://promisesaplus.com/#point-54
									// https://promisesaplus.com/#point-75
									// Retrieve `then` only once
									then = returned &&

										// Support: Promises/A+ section 2.3.4
										// https://promisesaplus.com/#point-64
										// Only check objects and functions for thenability
										( typeof returned === "object" ||
											typeof returned === "function" ) &&
										returned.then;

									// Handle a returned thenable
									if ( isFunction( then ) ) {

										// Special processors (notify) just wait for resolution
										if ( special ) {
											then.call(
												returned,
												resolve( maxDepth, deferred, Identity, special ),
												resolve( maxDepth, deferred, Thrower, special )
											);

										// Normal processors (resolve) also hook into progress
										} else {

											// ...and disregard older resolution values
											maxDepth++;

											then.call(
												returned,
												resolve( maxDepth, deferred, Identity, special ),
												resolve( maxDepth, deferred, Thrower, special ),
												resolve( maxDepth, deferred, Identity,
													deferred.notifyWith )
											);
										}

									// Handle all other returned values
									} else {

										// Only substitute handlers pass on context
										// and multiple values (non-spec behavior)
										if ( handler !== Identity ) {
											that = undefined;
											args = [ returned ];
										}

										// Process the value(s)
										// Default process is resolve
										( special || deferred.resolveWith )( that, args );
									}
								},

								// Only normal processors (resolve) catch and reject exceptions
								process = special ?
									mightThrow :
									function() {
										try {
											mightThrow();
										} catch ( e ) {

											if ( jQuery.Deferred.exceptionHook ) {
												jQuery.Deferred.exceptionHook( e,
													process.stackTrace );
											}

											// Support: Promises/A+ section 2.3.3.3.4.1
											// https://promisesaplus.com/#point-61
											// Ignore post-resolution exceptions
											if ( depth + 1 >= maxDepth ) {

												// Only substitute handlers pass on context
												// and multiple values (non-spec behavior)
												if ( handler !== Thrower ) {
													that = undefined;
													args = [ e ];
												}

												deferred.rejectWith( that, args );
											}
										}
									};

							// Support: Promises/A+ section 2.3.3.3.1
							// https://promisesaplus.com/#point-57
							// Re-resolve promises immediately to dodge false rejection from
							// subsequent errors
							if ( depth ) {
								process();
							} else {

								// Call an optional hook to record the stack, in case of exception
								// since it's otherwise lost when execution goes async
								if ( jQuery.Deferred.getStackHook ) {
									process.stackTrace = jQuery.Deferred.getStackHook();
								}
								window.setTimeout( process );
							}
						};
					}

					return jQuery.Deferred( function( newDefer ) {

						// progress_handlers.add( ... )
						tuples[ 0 ][ 3 ].add(
							resolve(
								0,
								newDefer,
								isFunction( onProgress ) ?
									onProgress :
									Identity,
								newDefer.notifyWith
							)
						);

						// fulfilled_handlers.add( ... )
						tuples[ 1 ][ 3 ].add(
							resolve(
								0,
								newDefer,
								isFunction( onFulfilled ) ?
									onFulfilled :
									Identity
							)
						);

						// rejected_handlers.add( ... )
						tuples[ 2 ][ 3 ].add(
							resolve(
								0,
								newDefer,
								isFunction( onRejected ) ?
									onRejected :
									Thrower
							)
						);
					} ).promise();
				},

				// Get a promise for this deferred
				// If obj is provided, the promise aspect is added to the object
				promise: function( obj ) {
					return obj != null ? jQuery.extend( obj, promise ) : promise;
				}
			},
			deferred = {};

		// Add list-specific methods
		jQuery.each( tuples, function( i, tuple ) {
			var list = tuple[ 2 ],
				stateString = tuple[ 5 ];

			// promise.progress = list.add
			// promise.done = list.add
			// promise.fail = list.add
			promise[ tuple[ 1 ] ] = list.add;

			// Handle state
			if ( stateString ) {
				list.add(
					function() {

						// state = "resolved" (i.e., fulfilled)
						// state = "rejected"
						state = stateString;
					},

					// rejected_callbacks.disable
					// fulfilled_callbacks.disable
					tuples[ 3 - i ][ 2 ].disable,

					// rejected_handlers.disable
					// fulfilled_handlers.disable
					tuples[ 3 - i ][ 3 ].disable,

					// progress_callbacks.lock
					tuples[ 0 ][ 2 ].lock,

					// progress_handlers.lock
					tuples[ 0 ][ 3 ].lock
				);
			}

			// progress_handlers.fire
			// fulfilled_handlers.fire
			// rejected_handlers.fire
			list.add( tuple[ 3 ].fire );

			// deferred.notify = function() { deferred.notifyWith(...) }
			// deferred.resolve = function() { deferred.resolveWith(...) }
			// deferred.reject = function() { deferred.rejectWith(...) }
			deferred[ tuple[ 0 ] ] = function() {
				deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
				return this;
			};

			// deferred.notifyWith = list.fireWith
			// deferred.resolveWith = list.fireWith
			// deferred.rejectWith = list.fireWith
			deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
		} );

		// Make the deferred a promise
		promise.promise( deferred );

		// Call given func if any
		if ( func ) {
			func.call( deferred, deferred );
		}

		// All done!
		return deferred;
	},

	// Deferred helper
	when: function( singleValue ) {
		var

			// count of uncompleted subordinates
			remaining = arguments.length,

			// count of unprocessed arguments
			i = remaining,

			// subordinate fulfillment data
			resolveContexts = Array( i ),
			resolveValues = slice.call( arguments ),

			// the master Deferred
			master = jQuery.Deferred(),

			// subordinate callback factory
			updateFunc = function( i ) {
				return function( value ) {
					resolveContexts[ i ] = this;
					resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
					if ( !( --remaining ) ) {
						master.resolveWith( resolveContexts, resolveValues );
					}
				};
			};

		// Single- and empty arguments are adopted like Promise.resolve
		if ( remaining <= 1 ) {
			adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
				!remaining );

			// Use .then() to unwrap secondary thenables (cf. gh-3000)
			if ( master.state() === "pending" ||
				isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {

				return master.then();
			}
		}

		// Multiple arguments are aggregated like Promise.all array elements
		while ( i-- ) {
			adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
		}

		return master.promise();
	}
} );


// These usually indicate a programmer mistake during development,
// warn about them ASAP rather than swallowing them by default.
var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;

jQuery.Deferred.exceptionHook = function( error, stack ) {

	// Support: IE 8 - 9 only
	// Console exists when dev tools are open, which can happen at any time
	if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
		window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
	}
};




jQuery.readyException = function( error ) {
	window.setTimeout( function() {
		throw error;
	} );
};




// The deferred used on DOM ready
var readyList = jQuery.Deferred();

jQuery.fn.ready = function( fn ) {

	readyList
		.then( fn )

		// Wrap jQuery.readyException in a function so that the lookup
		// happens at the time of error handling instead of callback
		// registration.
		.catch( function( error ) {
			jQuery.readyException( error );
		} );

	return this;
};

jQuery.extend( {

	// Is the DOM ready to be used? Set to true once it occurs.
	isReady: false,

	// A counter to track how many items to wait for before
	// the ready event fires. See #6781
	readyWait: 1,

	// Handle when the DOM is ready
	ready: function( wait ) {

		// Abort if there are pending holds or we're already ready
		if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
			return;
		}

		// Remember that the DOM is ready
		jQuery.isReady = true;

		// If a normal DOM Ready event fired, decrement, and wait if need be
		if ( wait !== true && --jQuery.readyWait > 0 ) {
			return;
		}

		// If there are functions bound, to execute
		readyList.resolveWith( document, [ jQuery ] );
	}
} );

jQuery.ready.then = readyList.then;

// The ready event handler and self cleanup method
function completed() {
	document.removeEventListener( "DOMContentLoaded", completed );
	window.removeEventListener( "load", completed );
	jQuery.ready();
}

// Catch cases where $(document).ready() is called
// after the browser event has already occurred.
// Support: IE <=9 - 10 only
// Older IE sometimes signals "interactive" too soon
if ( document.readyState === "complete" ||
	( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {

	// Handle it asynchronously to allow scripts the opportunity to delay ready
	window.setTimeout( jQuery.ready );

} else {

	// Use the handy event callback
	document.addEventListener( "DOMContentLoaded", completed );

	// A fallback to window.onload, that will always work
	window.addEventListener( "load", completed );
}




// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
	var i = 0,
		len = elems.length,
		bulk = key == null;

	// Sets many values
	if ( toType( key ) === "object" ) {
		chainable = true;
		for ( i in key ) {
			access( elems, fn, i, key[ i ], true, emptyGet, raw );
		}

	// Sets one value
	} else if ( value !== undefined ) {
		chainable = true;

		if ( !isFunction( value ) ) {
			raw = true;
		}

		if ( bulk ) {

			// Bulk operations run against the entire set
			if ( raw ) {
				fn.call( elems, value );
				fn = null;

			// ...except when executing function values
			} else {
				bulk = fn;
				fn = function( elem, _key, value ) {
					return bulk.call( jQuery( elem ), value );
				};
			}
		}

		if ( fn ) {
			for ( ; i < len; i++ ) {
				fn(
					elems[ i ], key, raw ?
					value :
					value.call( elems[ i ], i, fn( elems[ i ], key ) )
				);
			}
		}
	}

	if ( chainable ) {
		return elems;
	}

	// Gets
	if ( bulk ) {
		return fn.call( elems );
	}

	return len ? fn( elems[ 0 ], key ) : emptyGet;
};


// Matches dashed string for camelizing
var rmsPrefix = /^-ms-/,
	rdashAlpha = /-([a-z])/g;

// Used by camelCase as callback to replace()
function fcamelCase( _all, letter ) {
	return letter.toUpperCase();
}

// Convert dashed to camelCase; used by the css and data modules
// Support: IE <=9 - 11, Edge 12 - 15
// Microsoft forgot to hump their vendor prefix (#9572)
function camelCase( string ) {
	return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
}
var acceptData = function( owner ) {

	// Accepts only:
	//  - Node
	//    - Node.ELEMENT_NODE
	//    - Node.DOCUMENT_NODE
	//  - Object
	//    - Any
	return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
};




function Data() {
	this.expando = jQuery.expando + Data.uid++;
}

Data.uid = 1;

Data.prototype = {

	cache: function( owner ) {

		// Check if the owner object already has a cache
		var value = owner[ this.expando ];

		// If not, create one
		if ( !value ) {
			value = Object.create( null );

			// We can accept data for non-element nodes in modern browsers,
			// but we should not, see #8335.
			// Always return an empty object.
			if ( acceptData( owner ) ) {

				// If it is a node unlikely to be stringify-ed or looped over
				// use plain assignment
				if ( owner.nodeType ) {
					owner[ this.expando ] = value;

				// Otherwise secure it in a non-enumerable property
				// configurable must be true to allow the property to be
				// deleted when data is removed
				} else {
					Object.defineProperty( owner, this.expando, {
						value: value,
						configurable: true
					} );
				}
			}
		}

		return value;
	},
	set: function( owner, data, value ) {
		var prop,
			cache = this.cache( owner );

		// Handle: [ owner, key, value ] args
		// Always use camelCase key (gh-2257)
		if ( typeof data === "string" ) {
			cache[ camelCase( data ) ] = value;

		// Handle: [ owner, { properties } ] args
		} else {

			// Copy the properties one-by-one to the cache object
			for ( prop in data ) {
				cache[ camelCase( prop ) ] = data[ prop ];
			}
		}
		return cache;
	},
	get: function( owner, key ) {
		return key === undefined ?
			this.cache( owner ) :

			// Always use camelCase key (gh-2257)
			owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
	},
	access: function( owner, key, value ) {

		// In cases where either:
		//
		//   1. No key was specified
		//   2. A string key was specified, but no value provided
		//
		// Take the "read" path and allow the get method to determine
		// which value to return, respectively either:
		//
		//   1. The entire cache object
		//   2. The data stored at the key
		//
		if ( key === undefined ||
				( ( key && typeof key === "string" ) && value === undefined ) ) {

			return this.get( owner, key );
		}

		// When the key is not a string, or both a key and value
		// are specified, set or extend (existing objects) with either:
		//
		//   1. An object of properties
		//   2. A key and value
		//
		this.set( owner, key, value );

		// Since the "set" path can have two possible entry points
		// return the expected data based on which path was taken[*]
		return value !== undefined ? value : key;
	},
	remove: function( owner, key ) {
		var i,
			cache = owner[ this.expando ];

		if ( cache === undefined ) {
			return;
		}

		if ( key !== undefined ) {

			// Support array or space separated string of keys
			if ( Array.isArray( key ) ) {

				// If key is an array of keys...
				// We always set camelCase keys, so remove that.
				key = key.map( camelCase );
			} else {
				key = camelCase( key );

				// If a key with the spaces exists, use it.
				// Otherwise, create an array by matching non-whitespace
				key = key in cache ?
					[ key ] :
					( key.match( rnothtmlwhite ) || [] );
			}

			i = key.length;

			while ( i-- ) {
				delete cache[ key[ i ] ];
			}
		}

		// Remove the expando if there's no more data
		if ( key === undefined || jQuery.isEmptyObject( cache ) ) {

			// Support: Chrome <=35 - 45
			// Webkit & Blink performance suffers when deleting properties
			// from DOM nodes, so set to undefined instead
			// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
			if ( owner.nodeType ) {
				owner[ this.expando ] = undefined;
			} else {
				delete owner[ this.expando ];
			}
		}
	},
	hasData: function( owner ) {
		var cache = owner[ this.expando ];
		return cache !== undefined && !jQuery.isEmptyObject( cache );
	}
};
var dataPriv = new Data();

var dataUser = new Data();



//	Implementation Summary
//
//	1. Enforce API surface and semantic compatibility with 1.9.x branch
//	2. Improve the module's maintainability by reducing the storage
//		paths to a single mechanism.
//	3. Use the same single mechanism to support "private" and "user" data.
//	4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
//	5. Avoid exposing implementation details on user objects (eg. expando properties)
//	6. Provide a clear path for implementation upgrade to WeakMap in 2014

var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
	rmultiDash = /[A-Z]/g;

function getData( data ) {
	if ( data === "true" ) {
		return true;
	}

	if ( data === "false" ) {
		return false;
	}

	if ( data === "null" ) {
		return null;
	}

	// Only convert to a number if it doesn't change the string
	if ( data === +data + "" ) {
		return +data;
	}

	if ( rbrace.test( data ) ) {
		return JSON.parse( data );
	}

	return data;
}

function dataAttr( elem, key, data ) {
	var name;

	// If nothing was found internally, try to fetch any
	// data from the HTML5 data-* attribute
	if ( data === undefined && elem.nodeType === 1 ) {
		name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
		data = elem.getAttribute( name );

		if ( typeof data === "string" ) {
			try {
				data = getData( data );
			} catch ( e ) {}

			// Make sure we set the data so it isn't changed later
			dataUser.set( elem, key, data );
		} else {
			data = undefined;
		}
	}
	return data;
}

jQuery.extend( {
	hasData: function( elem ) {
		return dataUser.hasData( elem ) || dataPriv.hasData( elem );
	},

	data: function( elem, name, data ) {
		return dataUser.access( elem, name, data );
	},

	removeData: function( elem, name ) {
		dataUser.remove( elem, name );
	},

	// TODO: Now that all calls to _data and _removeData have been replaced
	// with direct calls to dataPriv methods, these can be deprecated.
	_data: function( elem, name, data ) {
		return dataPriv.access( elem, name, data );
	},

	_removeData: function( elem, name ) {
		dataPriv.remove( elem, name );
	}
} );

jQuery.fn.extend( {
	data: function( key, value ) {
		var i, name, data,
			elem = this[ 0 ],
			attrs = elem && elem.attributes;

		// Gets all values
		if ( key === undefined ) {
			if ( this.length ) {
				data = dataUser.get( elem );

				if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
					i = attrs.length;
					while ( i-- ) {

						// Support: IE 11 only
						// The attrs elements can be null (#14894)
						if ( attrs[ i ] ) {
							name = attrs[ i ].name;
							if ( name.indexOf( "data-" ) === 0 ) {
								name = camelCase( name.slice( 5 ) );
								dataAttr( elem, name, data[ name ] );
							}
						}
					}
					dataPriv.set( elem, "hasDataAttrs", true );
				}
			}

			return data;
		}

		// Sets multiple values
		if ( typeof key === "object" ) {
			return this.each( function() {
				dataUser.set( this, key );
			} );
		}

		return access( this, function( value ) {
			var data;

			// The calling jQuery object (element matches) is not empty
			// (and therefore has an element appears at this[ 0 ]) and the
			// `value` parameter was not undefined. An empty jQuery object
			// will result in `undefined` for elem = this[ 0 ] which will
			// throw an exception if an attempt to read a data cache is made.
			if ( elem && value === undefined ) {

				// Attempt to get data from the cache
				// The key will always be camelCased in Data
				data = dataUser.get( elem, key );
				if ( data !== undefined ) {
					return data;
				}

				// Attempt to "discover" the data in
				// HTML5 custom data-* attrs
				data = dataAttr( elem, key );
				if ( data !== undefined ) {
					return data;
				}

				// We tried really hard, but the data doesn't exist.
				return;
			}

			// Set the data...
			this.each( function() {

				// We always store the camelCased key
				dataUser.set( this, key, value );
			} );
		}, null, value, arguments.length > 1, null, true );
	},

	removeData: function( key ) {
		return this.each( function() {
			dataUser.remove( this, key );
		} );
	}
} );


jQuery.extend( {
	queue: function( elem, type, data ) {
		var queue;

		if ( elem ) {
			type = ( type || "fx" ) + "queue";
			queue = dataPriv.get( elem, type );

			// Speed up dequeue by getting out quickly if this is just a lookup
			if ( data ) {
				if ( !queue || Array.isArray( data ) ) {
					queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
				} else {
					queue.push( data );
				}
			}
			return queue || [];
		}
	},

	dequeue: function( elem, type ) {
		type = type || "fx";

		var queue = jQuery.queue( elem, type ),
			startLength = queue.length,
			fn = queue.shift(),
			hooks = jQuery._queueHooks( elem, type ),
			next = function() {
				jQuery.dequeue( elem, type );
			};

		// If the fx queue is dequeued, always remove the progress sentinel
		if ( fn === "inprogress" ) {
			fn = queue.shift();
			startLength--;
		}

		if ( fn ) {

			// Add a progress sentinel to prevent the fx queue from being
			// automatically dequeued
			if ( type === "fx" ) {
				queue.unshift( "inprogress" );
			}

			// Clear up the last queue stop function
			delete hooks.stop;
			fn.call( elem, next, hooks );
		}

		if ( !startLength && hooks ) {
			hooks.empty.fire();
		}
	},

	// Not public - generate a queueHooks object, or return the current one
	_queueHooks: function( elem, type ) {
		var key = type + "queueHooks";
		return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
			empty: jQuery.Callbacks( "once memory" ).add( function() {
				dataPriv.remove( elem, [ type + "queue", key ] );
			} )
		} );
	}
} );

jQuery.fn.extend( {
	queue: function( type, data ) {
		var setter = 2;

		if ( typeof type !== "string" ) {
			data = type;
			type = "fx";
			setter--;
		}

		if ( arguments.length < setter ) {
			return jQuery.queue( this[ 0 ], type );
		}

		return data === undefined ?
			this :
			this.each( function() {
				var queue = jQuery.queue( this, type, data );

				// Ensure a hooks for this queue
				jQuery._queueHooks( this, type );

				if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
					jQuery.dequeue( this, type );
				}
			} );
	},
	dequeue: function( type ) {
		return this.each( function() {
			jQuery.dequeue( this, type );
		} );
	},
	clearQueue: function( type ) {
		return this.queue( type || "fx", [] );
	},

	// Get a promise resolved when queues of a certain type
	// are emptied (fx is the type by default)
	promise: function( type, obj ) {
		var tmp,
			count = 1,
			defer = jQuery.Deferred(),
			elements = this,
			i = this.length,
			resolve = function() {
				if ( !( --count ) ) {
					defer.resolveWith( elements, [ elements ] );
				}
			};

		if ( typeof type !== "string" ) {
			obj = type;
			type = undefined;
		}
		type = type || "fx";

		while ( i-- ) {
			tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
			if ( tmp && tmp.empty ) {
				count++;
				tmp.empty.add( resolve );
			}
		}
		resolve();
		return defer.promise( obj );
	}
} );
var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;

var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );


var cssExpand = [ "Top", "Right", "Bottom", "Left" ];

var documentElement = document.documentElement;



	var isAttached = function( elem ) {
			return jQuery.contains( elem.ownerDocument, elem );
		},
		composed = { composed: true };

	// Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
	// Check attachment across shadow DOM boundaries when possible (gh-3504)
	// Support: iOS 10.0-10.2 only
	// Early iOS 10 versions support `attachShadow` but not `getRootNode`,
	// leading to errors. We need to check for `getRootNode`.
	if ( documentElement.getRootNode ) {
		isAttached = function( elem ) {
			return jQuery.contains( elem.ownerDocument, elem ) ||
				elem.getRootNode( composed ) === elem.ownerDocument;
		};
	}
var isHiddenWithinTree = function( elem, el ) {

		// isHiddenWithinTree might be called from jQuery#filter function;
		// in that case, element will be second argument
		elem = el || elem;

		// Inline style trumps all
		return elem.style.display === "none" ||
			elem.style.display === "" &&

			// Otherwise, check computed style
			// Support: Firefox <=43 - 45
			// Disconnected elements can have computed display: none, so first confirm that elem is
			// in the document.
			isAttached( elem ) &&

			jQuery.css( elem, "display" ) === "none";
	};



function adjustCSS( elem, prop, valueParts, tween ) {
	var adjusted, scale,
		maxIterations = 20,
		currentValue = tween ?
			function() {
				return tween.cur();
			} :
			function() {
				return jQuery.css( elem, prop, "" );
			},
		initial = currentValue(),
		unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),

		// Starting value computation is required for potential unit mismatches
		initialInUnit = elem.nodeType &&
			( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
			rcssNum.exec( jQuery.css( elem, prop ) );

	if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {

		// Support: Firefox <=54
		// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
		initial = initial / 2;

		// Trust units reported by jQuery.css
		unit = unit || initialInUnit[ 3 ];

		// Iteratively approximate from a nonzero starting point
		initialInUnit = +initial || 1;

		while ( maxIterations-- ) {

			// Evaluate and update our best guess (doubling guesses that zero out).
			// Finish if the scale equals or crosses 1 (making the old*new product non-positive).
			jQuery.style( elem, prop, initialInUnit + unit );
			if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
				maxIterations = 0;
			}
			initialInUnit = initialInUnit / scale;

		}

		initialInUnit = initialInUnit * 2;
		jQuery.style( elem, prop, initialInUnit + unit );

		// Make sure we update the tween properties later on
		valueParts = valueParts || [];
	}

	if ( valueParts ) {
		initialInUnit = +initialInUnit || +initial || 0;

		// Apply relative offset (+=/-=) if specified
		adjusted = valueParts[ 1 ] ?
			initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
			+valueParts[ 2 ];
		if ( tween ) {
			tween.unit = unit;
			tween.start = initialInUnit;
			tween.end = adjusted;
		}
	}
	return adjusted;
}


var defaultDisplayMap = {};

function getDefaultDisplay( elem ) {
	var temp,
		doc = elem.ownerDocument,
		nodeName = elem.nodeName,
		display = defaultDisplayMap[ nodeName ];

	if ( display ) {
		return display;
	}

	temp = doc.body.appendChild( doc.createElement( nodeName ) );
	display = jQuery.css( temp, "display" );

	temp.parentNode.removeChild( temp );

	if ( display === "none" ) {
		display = "block";
	}
	defaultDisplayMap[ nodeName ] = display;

	return display;
}

function showHide( elements, show ) {
	var display, elem,
		values = [],
		index = 0,
		length = elements.length;

	// Determine new display value for elements that need to change
	for ( ; index < length; index++ ) {
		elem = elements[ index ];
		if ( !elem.style ) {
			continue;
		}

		display = elem.style.display;
		if ( show ) {

			// Since we force visibility upon cascade-hidden elements, an immediate (and slow)
			// check is required in this first loop unless we have a nonempty display value (either
			// inline or about-to-be-restored)
			if ( display === "none" ) {
				values[ index ] = dataPriv.get( elem, "display" ) || null;
				if ( !values[ index ] ) {
					elem.style.display = "";
				}
			}
			if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
				values[ index ] = getDefaultDisplay( elem );
			}
		} else {
			if ( display !== "none" ) {
				values[ index ] = "none";

				// Remember what we're overwriting
				dataPriv.set( elem, "display", display );
			}
		}
	}

	// Set the display of the elements in a second loop to avoid constant reflow
	for ( index = 0; index < length; index++ ) {
		if ( values[ index ] != null ) {
			elements[ index ].style.display = values[ index ];
		}
	}

	return elements;
}

jQuery.fn.extend( {
	show: function() {
		return showHide( this, true );
	},
	hide: function() {
		return showHide( this );
	},
	toggle: function( state ) {
		if ( typeof state === "boolean" ) {
			return state ? this.show() : this.hide();
		}

		return this.each( function() {
			if ( isHiddenWithinTree( this ) ) {
				jQuery( this ).show();
			} else {
				jQuery( this ).hide();
			}
		} );
	}
} );
var rcheckableType = ( /^(?:checkbox|radio)$/i );

var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );

var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );



( function() {
	var fragment = document.createDocumentFragment(),
		div = fragment.appendChild( document.createElement( "div" ) ),
		input = document.createElement( "input" );

	// Support: Android 4.0 - 4.3 only
	// Check state lost if the name is set (#11217)
	// Support: Windows Web Apps (WWA)
	// `name` and `type` must use .setAttribute for WWA (#14901)
	input.setAttribute( "type", "radio" );
	input.setAttribute( "checked", "checked" );
	input.setAttribute( "name", "t" );

	div.appendChild( input );

	// Support: Android <=4.1 only
	// Older WebKit doesn't clone checked state correctly in fragments
	support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;

	// Support: IE <=11 only
	// Make sure textarea (and checkbox) defaultValue is properly cloned
	div.innerHTML = "<textarea>x</textarea>";
	support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;

	// Support: IE <=9 only
	// IE <=9 replaces <option> tags with their contents when inserted outside of
	// the select element.
	div.innerHTML = "<option></option>";
	support.option = !!div.lastChild;
} )();


// We have to close these tags to support XHTML (#13200)
var wrapMap = {

	// XHTML parsers do not magically insert elements in the
	// same way that tag soup parsers do. So we cannot shorten
	// this by omitting <tbody> or other required elements.
	thead: [ 1, "<table>", "</table>" ],
	col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
	tr: [ 2, "<table><tbody>", "</tbody></table>" ],
	td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],

	_default: [ 0, "", "" ]
};

wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;

// Support: IE <=9 only
if ( !support.option ) {
	wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
}


function getAll( context, tag ) {

	// Support: IE <=9 - 11 only
	// Use typeof to avoid zero-argument method invocation on host objects (#15151)
	var ret;

	if ( typeof context.getElementsByTagName !== "undefined" ) {
		ret = context.getElementsByTagName( tag || "*" );

	} else if ( typeof context.querySelectorAll !== "undefined" ) {
		ret = context.querySelectorAll( tag || "*" );

	} else {
		ret = [];
	}

	if ( tag === undefined || tag && nodeName( context, tag ) ) {
		return jQuery.merge( [ context ], ret );
	}

	return ret;
}


// Mark scripts as having already been evaluated
function setGlobalEval( elems, refElements ) {
	var i = 0,
		l = elems.length;

	for ( ; i < l; i++ ) {
		dataPriv.set(
			elems[ i ],
			"globalEval",
			!refElements || dataPriv.get( refElements[ i ], "globalEval" )
		);
	}
}


var rhtml = /<|&#?\w+;/;

function buildFragment( elems, context, scripts, selection, ignored ) {
	var elem, tmp, tag, wrap, attached, j,
		fragment = context.createDocumentFragment(),
		nodes = [],
		i = 0,
		l = elems.length;

	for ( ; i < l; i++ ) {
		elem = elems[ i ];

		if ( elem || elem === 0 ) {

			// Add nodes directly
			if ( toType( elem ) === "object" ) {

				// Support: Android <=4.0 only, PhantomJS 1 only
				// push.apply(_, arraylike) throws on ancient WebKit
				jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );

			// Convert non-html into a text node
			} else if ( !rhtml.test( elem ) ) {
				nodes.push( context.createTextNode( elem ) );

			// Convert html into DOM nodes
			} else {
				tmp = tmp || fragment.appendChild( context.createElement( "div" ) );

				// Deserialize a standard representation
				tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
				wrap = wrapMap[ tag ] || wrapMap._default;
				tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];

				// Descend through wrappers to the right content
				j = wrap[ 0 ];
				while ( j-- ) {
					tmp = tmp.lastChild;
				}

				// Support: Android <=4.0 only, PhantomJS 1 only
				// push.apply(_, arraylike) throws on ancient WebKit
				jQuery.merge( nodes, tmp.childNodes );

				// Remember the top-level container
				tmp = fragment.firstChild;

				// Ensure the created nodes are orphaned (#12392)
				tmp.textContent = "";
			}
		}
	}

	// Remove wrapper from fragment
	fragment.textContent = "";

	i = 0;
	while ( ( elem = nodes[ i++ ] ) ) {

		// Skip elements already in the context collection (trac-4087)
		if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
			if ( ignored ) {
				ignored.push( elem );
			}
			continue;
		}

		attached = isAttached( elem );

		// Append to fragment
		tmp = getAll( fragment.appendChild( elem ), "script" );

		// Preserve script evaluation history
		if ( attached ) {
			setGlobalEval( tmp );
		}

		// Capture executables
		if ( scripts ) {
			j = 0;
			while ( ( elem = tmp[ j++ ] ) ) {
				if ( rscriptType.test( elem.type || "" ) ) {
					scripts.push( elem );
				}
			}
		}
	}

	return fragment;
}


var
	rkeyEvent = /^key/,
	rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
	rtypenamespace = /^([^.]*)(?:\.(.+)|)/;

function returnTrue() {
	return true;
}

function returnFalse() {
	return false;
}

// Support: IE <=9 - 11+
// focus() and blur() are asynchronous, except when they are no-op.
// So expect focus to be synchronous when the element is already active,
// and blur to be synchronous when the element is not already active.
// (focus and blur are always synchronous in other supported browsers,
// this just defines when we can count on it).
function expectSync( elem, type ) {
	return ( elem === safeActiveElement() ) === ( type === "focus" );
}

// Support: IE <=9 only
// Accessing document.activeElement can throw unexpectedly
// https://bugs.jquery.com/ticket/13393
function safeActiveElement() {
	try {
		return document.activeElement;
	} catch ( err ) { }
}

function on( elem, types, selector, data, fn, one ) {
	var origFn, type;

	// Types can be a map of types/handlers
	if ( typeof types === "object" ) {

		// ( types-Object, selector, data )
		if ( typeof selector !== "string" ) {

			// ( types-Object, data )
			data = data || selector;
			selector = undefined;
		}
		for ( type in types ) {
			on( elem, type, selector, data, types[ type ], one );
		}
		return elem;
	}

	if ( data == null && fn == null ) {

		// ( types, fn )
		fn = selector;
		data = selector = undefined;
	} else if ( fn == null ) {
		if ( typeof selector === "string" ) {

			// ( types, selector, fn )
			fn = data;
			data = undefined;
		} else {

			// ( types, data, fn )
			fn = data;
			data = selector;
			selector = undefined;
		}
	}
	if ( fn === false ) {
		fn = returnFalse;
	} else if ( !fn ) {
		return elem;
	}

	if ( one === 1 ) {
		origFn = fn;
		fn = function( event ) {

			// Can use an empty set, since event contains the info
			jQuery().off( event );
			return origFn.apply( this, arguments );
		};

		// Use same guid so caller can remove using origFn
		fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
	}
	return elem.each( function() {
		jQuery.event.add( this, types, fn, data, selector );
	} );
}

/*
 * Helper functions for managing events -- not part of the public interface.
 * Props to Dean Edwards' addEvent library for many of the ideas.
 */
jQuery.event = {

	global: {},

	add: function( elem, types, handler, data, selector ) {

		var handleObjIn, eventHandle, tmp,
			events, t, handleObj,
			special, handlers, type, namespaces, origType,
			elemData = dataPriv.get( elem );

		// Only attach events to objects that accept data
		if ( !acceptData( elem ) ) {
			return;
		}

		// Caller can pass in an object of custom data in lieu of the handler
		if ( handler.handler ) {
			handleObjIn = handler;
			handler = handleObjIn.handler;
			selector = handleObjIn.selector;
		}

		// Ensure that invalid selectors throw exceptions at attach time
		// Evaluate against documentElement in case elem is a non-element node (e.g., document)
		if ( selector ) {
			jQuery.find.matchesSelector( documentElement, selector );
		}

		// Make sure that the handler has a unique ID, used to find/remove it later
		if ( !handler.guid ) {
			handler.guid = jQuery.guid++;
		}

		// Init the element's event structure and main handler, if this is the first
		if ( !( events = elemData.events ) ) {
			events = elemData.events = Object.create( null );
		}
		if ( !( eventHandle = elemData.handle ) ) {
			eventHandle = elemData.handle = function( e ) {

				// Discard the second event of a jQuery.event.trigger() and
				// when an event is called after a page has unloaded
				return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
					jQuery.event.dispatch.apply( elem, arguments ) : undefined;
			};
		}

		// Handle multiple events separated by a space
		types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
		t = types.length;
		while ( t-- ) {
			tmp = rtypenamespace.exec( types[ t ] ) || [];
			type = origType = tmp[ 1 ];
			namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();

			// There *must* be a type, no attaching namespace-only handlers
			if ( !type ) {
				continue;
			}

			// If event changes its type, use the special event handlers for the changed type
			special = jQuery.event.special[ type ] || {};

			// If selector defined, determine special event api type, otherwise given type
			type = ( selector ? special.delegateType : special.bindType ) || type;

			// Update special based on newly reset type
			special = jQuery.event.special[ type ] || {};

			// handleObj is passed to all event handlers
			handleObj = jQuery.extend( {
				type: type,
				origType: origType,
				data: data,
				handler: handler,
				guid: handler.guid,
				selector: selector,
				needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
				namespace: namespaces.join( "." )
			}, handleObjIn );

			// Init the event handler queue if we're the first
			if ( !( handlers = events[ type ] ) ) {
				handlers = events[ type ] = [];
				handlers.delegateCount = 0;

				// Only use addEventListener if the special events handler returns false
				if ( !special.setup ||
					special.setup.call( elem, data, namespaces, eventHandle ) === false ) {

					if ( elem.addEventListener ) {
						elem.addEventListener( type, eventHandle );
					}
				}
			}

			if ( special.add ) {
				special.add.call( elem, handleObj );

				if ( !handleObj.handler.guid ) {
					handleObj.handler.guid = handler.guid;
				}
			}

			// Add to the element's handler list, delegates in front
			if ( selector ) {
				handlers.splice( handlers.delegateCount++, 0, handleObj );
			} else {
				handlers.push( handleObj );
			}

			// Keep track of which events have ever been used, for event optimization
			jQuery.event.global[ type ] = true;
		}

	},

	// Detach an event or set of events from an element
	remove: function( elem, types, handler, selector, mappedTypes ) {

		var j, origCount, tmp,
			events, t, handleObj,
			special, handlers, type, namespaces, origType,
			elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );

		if ( !elemData || !( events = elemData.events ) ) {
			return;
		}

		// Once for each type.namespace in types; type may be omitted
		types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
		t = types.length;
		while ( t-- ) {
			tmp = rtypenamespace.exec( types[ t ] ) || [];
			type = origType = tmp[ 1 ];
			namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();

			// Unbind all events (on this namespace, if provided) for the element
			if ( !type ) {
				for ( type in events ) {
					jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
				}
				continue;
			}

			special = jQuery.event.special[ type ] || {};
			type = ( selector ? special.delegateType : special.bindType ) || type;
			handlers = events[ type ] || [];
			tmp = tmp[ 2 ] &&
				new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );

			// Remove matching events
			origCount = j = handlers.length;
			while ( j-- ) {
				handleObj = handlers[ j ];

				if ( ( mappedTypes || origType === handleObj.origType ) &&
					( !handler || handler.guid === handleObj.guid ) &&
					( !tmp || tmp.test( handleObj.namespace ) ) &&
					( !selector || selector === handleObj.selector ||
						selector === "**" && handleObj.selector ) ) {
					handlers.splice( j, 1 );

					if ( handleObj.selector ) {
						handlers.delegateCount--;
					}
					if ( special.remove ) {
						special.remove.call( elem, handleObj );
					}
				}
			}

			// Remove generic event handler if we removed something and no more handlers exist
			// (avoids potential for endless recursion during removal of special event handlers)
			if ( origCount && !handlers.length ) {
				if ( !special.teardown ||
					special.teardown.call( elem, namespaces, elemData.handle ) === false ) {

					jQuery.removeEvent( elem, type, elemData.handle );
				}

				delete events[ type ];
			}
		}

		// Remove data and the expando if it's no longer used
		if ( jQuery.isEmptyObject( events ) ) {
			dataPriv.remove( elem, "handle events" );
		}
	},

	dispatch: function( nativeEvent ) {

		var i, j, ret, matched, handleObj, handlerQueue,
			args = new Array( arguments.length ),

			// Make a writable jQuery.Event from the native event object
			event = jQuery.event.fix( nativeEvent ),

			handlers = (
					dataPriv.get( this, "events" ) || Object.create( null )
				)[ event.type ] || [],
			special = jQuery.event.special[ event.type ] || {};

		// Use the fix-ed jQuery.Event rather than the (read-only) native event
		args[ 0 ] = event;

		for ( i = 1; i < arguments.length; i++ ) {
			args[ i ] = arguments[ i ];
		}

		event.delegateTarget = this;

		// Call the preDispatch hook for the mapped type, and let it bail if desired
		if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
			return;
		}

		// Determine handlers
		handlerQueue = jQuery.event.handlers.call( this, event, handlers );

		// Run delegates first; they may want to stop propagation beneath us
		i = 0;
		while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
			event.currentTarget = matched.elem;

			j = 0;
			while ( ( handleObj = matched.handlers[ j++ ] ) &&
				!event.isImmediatePropagationStopped() ) {

				// If the event is namespaced, then each handler is only invoked if it is
				// specially universal or its namespaces are a superset of the event's.
				if ( !event.rnamespace || handleObj.namespace === false ||
					event.rnamespace.test( handleObj.namespace ) ) {

					event.handleObj = handleObj;
					event.data = handleObj.data;

					ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
						handleObj.handler ).apply( matched.elem, args );

					if ( ret !== undefined ) {
						if ( ( event.result = ret ) === false ) {
							event.preventDefault();
							event.stopPropagation();
						}
					}
				}
			}
		}

		// Call the postDispatch hook for the mapped type
		if ( special.postDispatch ) {
			special.postDispatch.call( this, event );
		}

		return event.result;
	},

	handlers: function( event, handlers ) {
		var i, handleObj, sel, matchedHandlers, matchedSelectors,
			handlerQueue = [],
			delegateCount = handlers.delegateCount,
			cur = event.target;

		// Find delegate handlers
		if ( delegateCount &&

			// Support: IE <=9
			// Black-hole SVG <use> instance trees (trac-13180)
			cur.nodeType &&

			// Support: Firefox <=42
			// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
			// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
			// Support: IE 11 only
			// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
			!( event.type === "click" && event.button >= 1 ) ) {

			for ( ; cur !== this; cur = cur.parentNode || this ) {

				// Don't check non-elements (#13208)
				// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
				if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
					matchedHandlers = [];
					matchedSelectors = {};
					for ( i = 0; i < delegateCount; i++ ) {
						handleObj = handlers[ i ];

						// Don't conflict with Object.prototype properties (#13203)
						sel = handleObj.selector + " ";

						if ( matchedSelectors[ sel ] === undefined ) {
							matchedSelectors[ sel ] = handleObj.needsContext ?
								jQuery( sel, this ).index( cur ) > -1 :
								jQuery.find( sel, this, null, [ cur ] ).length;
						}
						if ( matchedSelectors[ sel ] ) {
							matchedHandlers.push( handleObj );
						}
					}
					if ( matchedHandlers.length ) {
						handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
					}
				}
			}
		}

		// Add the remaining (directly-bound) handlers
		cur = this;
		if ( delegateCount < handlers.length ) {
			handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
		}

		return handlerQueue;
	},

	addProp: function( name, hook ) {
		Object.defineProperty( jQuery.Event.prototype, name, {
			enumerable: true,
			configurable: true,

			get: isFunction( hook ) ?
				function() {
					if ( this.originalEvent ) {
							return hook( this.originalEvent );
					}
				} :
				function() {
					if ( this.originalEvent ) {
							return this.originalEvent[ name ];
					}
				},

			set: function( value ) {
				Object.defineProperty( this, name, {
					enumerable: true,
					configurable: true,
					writable: true,
					value: value
				} );
			}
		} );
	},

	fix: function( originalEvent ) {
		return originalEvent[ jQuery.expando ] ?
			originalEvent :
			new jQuery.Event( originalEvent );
	},

	special: {
		load: {

			// Prevent triggered image.load events from bubbling to window.load
			noBubble: true
		},
		click: {

			// Utilize native event to ensure correct state for checkable inputs
			setup: function( data ) {

				// For mutual compressibility with _default, replace `this` access with a local var.
				// `|| data` is dead code meant only to preserve the variable through minification.
				var el = this || data;

				// Claim the first handler
				if ( rcheckableType.test( el.type ) &&
					el.click && nodeName( el, "input" ) ) {

					// dataPriv.set( el, "click", ... )
					leverageNative( el, "click", returnTrue );
				}

				// Return false to allow normal processing in the caller
				return false;
			},
			trigger: function( data ) {

				// For mutual compressibility with _default, replace `this` access with a local var.
				// `|| data` is dead code meant only to preserve the variable through minification.
				var el = this || data;

				// Force setup before triggering a click
				if ( rcheckableType.test( el.type ) &&
					el.click && nodeName( el, "input" ) ) {

					leverageNative( el, "click" );
				}

				// Return non-false to allow normal event-path propagation
				return true;
			},

			// For cross-browser consistency, suppress native .click() on links
			// Also prevent it if we're currently inside a leveraged native-event stack
			_default: function( event ) {
				var target = event.target;
				return rcheckableType.test( target.type ) &&
					target.click && nodeName( target, "input" ) &&
					dataPriv.get( target, "click" ) ||
					nodeName( target, "a" );
			}
		},

		beforeunload: {
			postDispatch: function( event ) {

				// Support: Firefox 20+
				// Firefox doesn't alert if the returnValue field is not set.
				if ( event.result !== undefined && event.originalEvent ) {
					event.originalEvent.returnValue = event.result;
				}
			}
		}
	}
};

// Ensure the presence of an event listener that handles manually-triggered
// synthetic events by interrupting progress until reinvoked in response to
// *native* events that it fires directly, ensuring that state changes have
// already occurred before other listeners are invoked.
function leverageNative( el, type, expectSync ) {

	// Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
	if ( !expectSync ) {
		if ( dataPriv.get( el, type ) === undefined ) {
			jQuery.event.add( el, type, returnTrue );
		}
		return;
	}

	// Register the controller as a special universal handler for all event namespaces
	dataPriv.set( el, type, false );
	jQuery.event.add( el, type, {
		namespace: false,
		handler: function( event ) {
			var notAsync, result,
				saved = dataPriv.get( this, type );

			if ( ( event.isTrigger & 1 ) && this[ type ] ) {

				// Interrupt processing of the outer synthetic .trigger()ed event
				// Saved data should be false in such cases, but might be a leftover capture object
				// from an async native handler (gh-4350)
				if ( !saved.length ) {

					// Store arguments for use when handling the inner native event
					// There will always be at least one argument (an event object), so this array
					// will not be confused with a leftover capture object.
					saved = slice.call( arguments );
					dataPriv.set( this, type, saved );

					// Trigger the native event and capture its result
					// Support: IE <=9 - 11+
					// focus() and blur() are asynchronous
					notAsync = expectSync( this, type );
					this[ type ]();
					result = dataPriv.get( this, type );
					if ( saved !== result || notAsync ) {
						dataPriv.set( this, type, false );
					} else {
						result = {};
					}
					if ( saved !== result ) {

						// Cancel the outer synthetic event
						event.stopImmediatePropagation();
						event.preventDefault();
						return result.value;
					}

				// If this is an inner synthetic event for an event with a bubbling surrogate
				// (focus or blur), assume that the surrogate already propagated from triggering the
				// native event and prevent that from happening again here.
				// This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
				// bubbling surrogate propagates *after* the non-bubbling base), but that seems
				// less bad than duplication.
				} else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
					event.stopPropagation();
				}

			// If this is a native event triggered above, everything is now in order
			// Fire an inner synthetic event with the original arguments
			} else if ( saved.length ) {

				// ...and capture the result
				dataPriv.set( this, type, {
					value: jQuery.event.trigger(

						// Support: IE <=9 - 11+
						// Extend with the prototype to reset the above stopImmediatePropagation()
						jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
						saved.slice( 1 ),
						this
					)
				} );

				// Abort handling of the native event
				event.stopImmediatePropagation();
			}
		}
	} );
}

jQuery.removeEvent = function( elem, type, handle ) {

	// This "if" is needed for plain objects
	if ( elem.removeEventListener ) {
		elem.removeEventListener( type, handle );
	}
};

jQuery.Event = function( src, props ) {

	// Allow instantiation without the 'new' keyword
	if ( !( this instanceof jQuery.Event ) ) {
		return new jQuery.Event( src, props );
	}

	// Event object
	if ( src && src.type ) {
		this.originalEvent = src;
		this.type = src.type;

		// Events bubbling up the document may have been marked as prevented
		// by a handler lower down the tree; reflect the correct value.
		this.isDefaultPrevented = src.defaultPrevented ||
				src.defaultPrevented === undefined &&

				// Support: Android <=2.3 only
				src.returnValue === false ?
			returnTrue :
			returnFalse;

		// Create target properties
		// Support: Safari <=6 - 7 only
		// Target should not be a text node (#504, #13143)
		this.target = ( src.target && src.target.nodeType === 3 ) ?
			src.target.parentNode :
			src.target;

		this.currentTarget = src.currentTarget;
		this.relatedTarget = src.relatedTarget;

	// Event type
	} else {
		this.type = src;
	}

	// Put explicitly provided properties onto the event object
	if ( props ) {
		jQuery.extend( this, props );
	}

	// Create a timestamp if incoming event doesn't have one
	this.timeStamp = src && src.timeStamp || Date.now();

	// Mark it as fixed
	this[ jQuery.expando ] = true;
};

// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
	constructor: jQuery.Event,
	isDefaultPrevented: returnFalse,
	isPropagationStopped: returnFalse,
	isImmediatePropagationStopped: returnFalse,
	isSimulated: false,

	preventDefault: function() {
		var e = this.originalEvent;

		this.isDefaultPrevented = returnTrue;

		if ( e && !this.isSimulated ) {
			e.preventDefault();
		}
	},
	stopPropagation: function() {
		var e = this.originalEvent;

		this.isPropagationStopped = returnTrue;

		if ( e && !this.isSimulated ) {
			e.stopPropagation();
		}
	},
	stopImmediatePropagation: function() {
		var e = this.originalEvent;

		this.isImmediatePropagationStopped = returnTrue;

		if ( e && !this.isSimulated ) {
			e.stopImmediatePropagation();
		}

		this.stopPropagation();
	}
};

// Includes all common event props including KeyEvent and MouseEvent specific props
jQuery.each( {
	altKey: true,
	bubbles: true,
	cancelable: true,
	changedTouches: true,
	ctrlKey: true,
	detail: true,
	eventPhase: true,
	metaKey: true,
	pageX: true,
	pageY: true,
	shiftKey: true,
	view: true,
	"char": true,
	code: true,
	charCode: true,
	key: true,
	keyCode: true,
	button: true,
	buttons: true,
	clientX: true,
	clientY: true,
	offsetX: true,
	offsetY: true,
	pointerId: true,
	pointerType: true,
	screenX: true,
	screenY: true,
	targetTouches: true,
	toElement: true,
	touches: true,

	which: function( event ) {
		var button = event.button;

		// Add which for key events
		if ( event.which == null && rkeyEvent.test( event.type ) ) {
			return event.charCode != null ? event.charCode : event.keyCode;
		}

		// Add which for click: 1 === left; 2 === middle; 3 === right
		if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
			if ( button & 1 ) {
				return 1;
			}

			if ( button & 2 ) {
				return 3;
			}

			if ( button & 4 ) {
				return 2;
			}

			return 0;
		}

		return event.which;
	}
}, jQuery.event.addProp );

jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
	jQuery.event.special[ type ] = {

		// Utilize native event if possible so blur/focus sequence is correct
		setup: function() {

			// Claim the first handler
			// dataPriv.set( this, "focus", ... )
			// dataPriv.set( this, "blur", ... )
			leverageNative( this, type, expectSync );

			// Return false to allow normal processing in the caller
			return false;
		},
		trigger: function() {

			// Force setup before trigger
			leverageNative( this, type );

			// Return non-false to allow normal event-path propagation
			return true;
		},

		delegateType: delegateType
	};
} );

// Create mouseenter/leave events using mouseover/out and event-time checks
// so that event delegation works in jQuery.
// Do the same for pointerenter/pointerleave and pointerover/pointerout
//
// Support: Safari 7 only
// Safari sends mouseenter too often; see:
// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
// for the description of the bug (it existed in older Chrome versions as well).
jQuery.each( {
	mouseenter: "mouseover",
	mouseleave: "mouseout",
	pointerenter: "pointerover",
	pointerleave: "pointerout"
}, function( orig, fix ) {
	jQuery.event.special[ orig ] = {
		delegateType: fix,
		bindType: fix,

		handle: function( event ) {
			var ret,
				target = this,
				related = event.relatedTarget,
				handleObj = event.handleObj;

			// For mouseenter/leave call the handler if related is outside the target.
			// NB: No relatedTarget if the mouse left/entered the browser window
			if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
				event.type = handleObj.origType;
				ret = handleObj.handler.apply( this, arguments );
				event.type = fix;
			}
			return ret;
		}
	};
} );

jQuery.fn.extend( {

	on: function( types, selector, data, fn ) {
		return on( this, types, selector, data, fn );
	},
	one: function( types, selector, data, fn ) {
		return on( this, types, selector, data, fn, 1 );
	},
	off: function( types, selector, fn ) {
		var handleObj, type;
		if ( types && types.preventDefault && types.handleObj ) {

			// ( event )  dispatched jQuery.Event
			handleObj = types.handleObj;
			jQuery( types.delegateTarget ).off(
				handleObj.namespace ?
					handleObj.origType + "." + handleObj.namespace :
					handleObj.origType,
				handleObj.selector,
				handleObj.handler
			);
			return this;
		}
		if ( typeof types === "object" ) {

			// ( types-object [, selector] )
			for ( type in types ) {
				this.off( type, selector, types[ type ] );
			}
			return this;
		}
		if ( selector === false || typeof selector === "function" ) {

			// ( types [, fn] )
			fn = selector;
			selector = undefined;
		}
		if ( fn === false ) {
			fn = returnFalse;
		}
		return this.each( function() {
			jQuery.event.remove( this, types, fn, selector );
		} );
	}
} );


var

	// Support: IE <=10 - 11, Edge 12 - 13 only
	// In IE/Edge using regex groups here causes severe slowdowns.
	// See https://connect.microsoft.com/IE/feedback/details/1736512/
	rnoInnerhtml = /<script|<style|<link/i,

	// checked="checked" or checked
	rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
	rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;

// Prefer a tbody over its parent table for containing new rows
function manipulationTarget( elem, content ) {
	if ( nodeName( elem, "table" ) &&
		nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {

		return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
	}

	return elem;
}

// Replace/restore the type attribute of script elements for safe DOM manipulation
function disableScript( elem ) {
	elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
	return elem;
}
function restoreScript( elem ) {
	if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
		elem.type = elem.type.slice( 5 );
	} else {
		elem.removeAttribute( "type" );
	}

	return elem;
}

function cloneCopyEvent( src, dest ) {
	var i, l, type, pdataOld, udataOld, udataCur, events;

	if ( dest.nodeType !== 1 ) {
		return;
	}

	// 1. Copy private data: events, handlers, etc.
	if ( dataPriv.hasData( src ) ) {
		pdataOld = dataPriv.get( src );
		events = pdataOld.events;

		if ( events ) {
			dataPriv.remove( dest, "handle events" );

			for ( type in events ) {
				for ( i = 0, l = events[ type ].length; i < l; i++ ) {
					jQuery.event.add( dest, type, events[ type ][ i ] );
				}
			}
		}
	}

	// 2. Copy user data
	if ( dataUser.hasData( src ) ) {
		udataOld = dataUser.access( src );
		udataCur = jQuery.extend( {}, udataOld );

		dataUser.set( dest, udataCur );
	}
}

// Fix IE bugs, see support tests
function fixInput( src, dest ) {
	var nodeName = dest.nodeName.toLowerCase();

	// Fails to persist the checked state of a cloned checkbox or radio button.
	if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
		dest.checked = src.checked;

	// Fails to return the selected option to the default selected state when cloning options
	} else if ( nodeName === "input" || nodeName === "textarea" ) {
		dest.defaultValue = src.defaultValue;
	}
}

function domManip( collection, args, callback, ignored ) {

	// Flatten any nested arrays
	args = flat( args );

	var fragment, first, scripts, hasScripts, node, doc,
		i = 0,
		l = collection.length,
		iNoClone = l - 1,
		value = args[ 0 ],
		valueIsFunction = isFunction( value );

	// We can't cloneNode fragments that contain checked, in WebKit
	if ( valueIsFunction ||
			( l > 1 && typeof value === "string" &&
				!support.checkClone && rchecked.test( value ) ) ) {
		return collection.each( function( index ) {
			var self = collection.eq( index );
			if ( valueIsFunction ) {
				args[ 0 ] = value.call( this, index, self.html() );
			}
			domManip( self, args, callback, ignored );
		} );
	}

	if ( l ) {
		fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
		first = fragment.firstChild;

		if ( fragment.childNodes.length === 1 ) {
			fragment = first;
		}

		// Require either new content or an interest in ignored elements to invoke the callback
		if ( first || ignored ) {
			scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
			hasScripts = scripts.length;

			// Use the original fragment for the last item
			// instead of the first because it can end up
			// being emptied incorrectly in certain situations (#8070).
			for ( ; i < l; i++ ) {
				node = fragment;

				if ( i !== iNoClone ) {
					node = jQuery.clone( node, true, true );

					// Keep references to cloned scripts for later restoration
					if ( hasScripts ) {

						// Support: Android <=4.0 only, PhantomJS 1 only
						// push.apply(_, arraylike) throws on ancient WebKit
						jQuery.merge( scripts, getAll( node, "script" ) );
					}
				}

				callback.call( collection[ i ], node, i );
			}

			if ( hasScripts ) {
				doc = scripts[ scripts.length - 1 ].ownerDocument;

				// Reenable scripts
				jQuery.map( scripts, restoreScript );

				// Evaluate executable scripts on first document insertion
				for ( i = 0; i < hasScripts; i++ ) {
					node = scripts[ i ];
					if ( rscriptType.test( node.type || "" ) &&
						!dataPriv.access( node, "globalEval" ) &&
						jQuery.contains( doc, node ) ) {

						if ( node.src && ( node.type || "" ).toLowerCase()  !== "module" ) {

							// Optional AJAX dependency, but won't run scripts if not present
							if ( jQuery._evalUrl && !node.noModule ) {
								jQuery._evalUrl( node.src, {
									nonce: node.nonce || node.getAttribute( "nonce" )
								}, doc );
							}
						} else {
							DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
						}
					}
				}
			}
		}
	}

	return collection;
}

function remove( elem, selector, keepData ) {
	var node,
		nodes = selector ? jQuery.filter( selector, elem ) : elem,
		i = 0;

	for ( ; ( node = nodes[ i ] ) != null; i++ ) {
		if ( !keepData && node.nodeType === 1 ) {
			jQuery.cleanData( getAll( node ) );
		}

		if ( node.parentNode ) {
			if ( keepData && isAttached( node ) ) {
				setGlobalEval( getAll( node, "script" ) );
			}
			node.parentNode.removeChild( node );
		}
	}

	return elem;
}

jQuery.extend( {
	htmlPrefilter: function( html ) {
		return html;
	},

	clone: function( elem, dataAndEvents, deepDataAndEvents ) {
		var i, l, srcElements, destElements,
			clone = elem.cloneNode( true ),
			inPage = isAttached( elem );

		// Fix IE cloning issues
		if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
				!jQuery.isXMLDoc( elem ) ) {

			// We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
			destElements = getAll( clone );
			srcElements = getAll( elem );

			for ( i = 0, l = srcElements.length; i < l; i++ ) {
				fixInput( srcElements[ i ], destElements[ i ] );
			}
		}

		// Copy the events from the original to the clone
		if ( dataAndEvents ) {
			if ( deepDataAndEvents ) {
				srcElements = srcElements || getAll( elem );
				destElements = destElements || getAll( clone );

				for ( i = 0, l = srcElements.length; i < l; i++ ) {
					cloneCopyEvent( srcElements[ i ], destElements[ i ] );
				}
			} else {
				cloneCopyEvent( elem, clone );
			}
		}

		// Preserve script evaluation history
		destElements = getAll( clone, "script" );
		if ( destElements.length > 0 ) {
			setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
		}

		// Return the cloned set
		return clone;
	},

	cleanData: function( elems ) {
		var data, elem, type,
			special = jQuery.event.special,
			i = 0;

		for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
			if ( acceptData( elem ) ) {
				if ( ( data = elem[ dataPriv.expando ] ) ) {
					if ( data.events ) {
						for ( type in data.events ) {
							if ( special[ type ] ) {
								jQuery.event.remove( elem, type );

							// This is a shortcut to avoid jQuery.event.remove's overhead
							} else {
								jQuery.removeEvent( elem, type, data.handle );
							}
						}
					}

					// Support: Chrome <=35 - 45+
					// Assign undefined instead of using delete, see Data#remove
					elem[ dataPriv.expando ] = undefined;
				}
				if ( elem[ dataUser.expando ] ) {

					// Support: Chrome <=35 - 45+
					// Assign undefined instead of using delete, see Data#remove
					elem[ dataUser.expando ] = undefined;
				}
			}
		}
	}
} );

jQuery.fn.extend( {
	detach: function( selector ) {
		return remove( this, selector, true );
	},

	remove: function( selector ) {
		return remove( this, selector );
	},

	text: function( value ) {
		return access( this, function( value ) {
			return value === undefined ?
				jQuery.text( this ) :
				this.empty().each( function() {
					if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
						this.textContent = value;
					}
				} );
		}, null, value, arguments.length );
	},

	append: function() {
		return domManip( this, arguments, function( elem ) {
			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
				var target = manipulationTarget( this, elem );
				target.appendChild( elem );
			}
		} );
	},

	prepend: function() {
		return domManip( this, arguments, function( elem ) {
			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
				var target = manipulationTarget( this, elem );
				target.insertBefore( elem, target.firstChild );
			}
		} );
	},

	before: function() {
		return domManip( this, arguments, function( elem ) {
			if ( this.parentNode ) {
				this.parentNode.insertBefore( elem, this );
			}
		} );
	},

	after: function() {
		return domManip( this, arguments, function( elem ) {
			if ( this.parentNode ) {
				this.parentNode.insertBefore( elem, this.nextSibling );
			}
		} );
	},

	empty: function() {
		var elem,
			i = 0;

		for ( ; ( elem = this[ i ] ) != null; i++ ) {
			if ( elem.nodeType === 1 ) {

				// Prevent memory leaks
				jQuery.cleanData( getAll( elem, false ) );

				// Remove any remaining nodes
				elem.textContent = "";
			}
		}

		return this;
	},

	clone: function( dataAndEvents, deepDataAndEvents ) {
		dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
		deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;

		return this.map( function() {
			return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
		} );
	},

	html: function( value ) {
		return access( this, function( value ) {
			var elem = this[ 0 ] || {},
				i = 0,
				l = this.length;

			if ( value === undefined && elem.nodeType === 1 ) {
				return elem.innerHTML;
			}

			// See if we can take a shortcut and just use innerHTML
			if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
				!wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {

				value = jQuery.htmlPrefilter( value );

				try {
					for ( ; i < l; i++ ) {
						elem = this[ i ] || {};

						// Remove element nodes and prevent memory leaks
						if ( elem.nodeType === 1 ) {
							jQuery.cleanData( getAll( elem, false ) );
							elem.innerHTML = value;
						}
					}

					elem = 0;

				// If using innerHTML throws an exception, use the fallback method
				} catch ( e ) {}
			}

			if ( elem ) {
				this.empty().append( value );
			}
		}, null, value, arguments.length );
	},

	replaceWith: function() {
		var ignored = [];

		// Make the changes, replacing each non-ignored context element with the new content
		return domManip( this, arguments, function( elem ) {
			var parent = this.parentNode;

			if ( jQuery.inArray( this, ignored ) < 0 ) {
				jQuery.cleanData( getAll( this ) );
				if ( parent ) {
					parent.replaceChild( elem, this );
				}
			}

		// Force callback invocation
		}, ignored );
	}
} );

jQuery.each( {
	appendTo: "append",
	prependTo: "prepend",
	insertBefore: "before",
	insertAfter: "after",
	replaceAll: "replaceWith"
}, function( name, original ) {
	jQuery.fn[ name ] = function( selector ) {
		var elems,
			ret = [],
			insert = jQuery( selector ),
			last = insert.length - 1,
			i = 0;

		for ( ; i <= last; i++ ) {
			elems = i === last ? this : this.clone( true );
			jQuery( insert[ i ] )[ original ]( elems );

			// Support: Android <=4.0 only, PhantomJS 1 only
			// .get() because push.apply(_, arraylike) throws on ancient WebKit
			push.apply( ret, elems.get() );
		}

		return this.pushStack( ret );
	};
} );
var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );

var getStyles = function( elem ) {

		// Support: IE <=11 only, Firefox <=30 (#15098, #14150)
		// IE throws on elements created in popups
		// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
		var view = elem.ownerDocument.defaultView;

		if ( !view || !view.opener ) {
			view = window;
		}

		return view.getComputedStyle( elem );
	};

var swap = function( elem, options, callback ) {
	var ret, name,
		old = {};

	// Remember the old values, and insert the new ones
	for ( name in options ) {
		old[ name ] = elem.style[ name ];
		elem.style[ name ] = options[ name ];
	}

	ret = callback.call( elem );

	// Revert the old values
	for ( name in options ) {
		elem.style[ name ] = old[ name ];
	}

	return ret;
};


var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );



( function() {

	// Executing both pixelPosition & boxSizingReliable tests require only one layout
	// so they're executed at the same time to save the second computation.
	function computeStyleTests() {

		// This is a singleton, we need to execute it only once
		if ( !div ) {
			return;
		}

		container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
			"margin-top:1px;padding:0;border:0";
		div.style.cssText =
			"position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
			"margin:auto;border:1px;padding:1px;" +
			"width:60%;top:1%";
		documentElement.appendChild( container ).appendChild( div );

		var divStyle = window.getComputedStyle( div );
		pixelPositionVal = divStyle.top !== "1%";

		// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
		reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;

		// Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
		// Some styles come back with percentage values, even though they shouldn't
		div.style.right = "60%";
		pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;

		// Support: IE 9 - 11 only
		// Detect misreporting of content dimensions for box-sizing:border-box elements
		boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;

		// Support: IE 9 only
		// Detect overflow:scroll screwiness (gh-3699)
		// Support: Chrome <=64
		// Don't get tricked when zoom affects offsetWidth (gh-4029)
		div.style.position = "absolute";
		scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;

		documentElement.removeChild( container );

		// Nullify the div so it wouldn't be stored in the memory and
		// it will also be a sign that checks already performed
		div = null;
	}

	function roundPixelMeasures( measure ) {
		return Math.round( parseFloat( measure ) );
	}

	var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
		reliableTrDimensionsVal, reliableMarginLeftVal,
		container = document.createElement( "div" ),
		div = document.createElement( "div" );

	// Finish early in limited (non-browser) environments
	if ( !div.style ) {
		return;
	}

	// Support: IE <=9 - 11 only
	// Style of cloned element affects source element cloned (#8908)
	div.style.backgroundClip = "content-box";
	div.cloneNode( true ).style.backgroundClip = "";
	support.clearCloneStyle = div.style.backgroundClip === "content-box";

	jQuery.extend( support, {
		boxSizingReliable: function() {
			computeStyleTests();
			return boxSizingReliableVal;
		},
		pixelBoxStyles: function() {
			computeStyleTests();
			return pixelBoxStylesVal;
		},
		pixelPosition: function() {
			computeStyleTests();
			return pixelPositionVal;
		},
		reliableMarginLeft: function() {
			computeStyleTests();
			return reliableMarginLeftVal;
		},
		scrollboxSize: function() {
			computeStyleTests();
			return scrollboxSizeVal;
		},

		// Support: IE 9 - 11+, Edge 15 - 18+
		// IE/Edge misreport `getComputedStyle` of table rows with width/height
		// set in CSS while `offset*` properties report correct values.
		// Behavior in IE 9 is more subtle than in newer versions & it passes
		// some versions of this test; make sure not to make it pass there!
		reliableTrDimensions: function() {
			var table, tr, trChild, trStyle;
			if ( reliableTrDimensionsVal == null ) {
				table = document.createElement( "table" );
				tr = document.createElement( "tr" );
				trChild = document.createElement( "div" );

				table.style.cssText = "position:absolute;left:-11111px";
				tr.style.height = "1px";
				trChild.style.height = "9px";

				documentElement
					.appendChild( table )
					.appendChild( tr )
					.appendChild( trChild );

				trStyle = window.getComputedStyle( tr );
				reliableTrDimensionsVal = parseInt( trStyle.height ) > 3;

				documentElement.removeChild( table );
			}
			return reliableTrDimensionsVal;
		}
	} );
} )();


function curCSS( elem, name, computed ) {
	var width, minWidth, maxWidth, ret,

		// Support: Firefox 51+
		// Retrieving style before computed somehow
		// fixes an issue with getting wrong values
		// on detached elements
		style = elem.style;

	computed = computed || getStyles( elem );

	// getPropertyValue is needed for:
	//   .css('filter') (IE 9 only, #12537)
	//   .css('--customProperty) (#3144)
	if ( computed ) {
		ret = computed.getPropertyValue( name ) || computed[ name ];

		if ( ret === "" && !isAttached( elem ) ) {
			ret = jQuery.style( elem, name );
		}

		// A tribute to the "awesome hack by Dean Edwards"
		// Android Browser returns percentage for some values,
		// but width seems to be reliably pixels.
		// This is against the CSSOM draft spec:
		// https://drafts.csswg.org/cssom/#resolved-values
		if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {

			// Remember the original values
			width = style.width;
			minWidth = style.minWidth;
			maxWidth = style.maxWidth;

			// Put in the new values to get a computed value out
			style.minWidth = style.maxWidth = style.width = ret;
			ret = computed.width;

			// Revert the changed values
			style.width = width;
			style.minWidth = minWidth;
			style.maxWidth = maxWidth;
		}
	}

	return ret !== undefined ?

		// Support: IE <=9 - 11 only
		// IE returns zIndex value as an integer.
		ret + "" :
		ret;
}


function addGetHookIf( conditionFn, hookFn ) {

	// Define the hook, we'll check on the first run if it's really needed.
	return {
		get: function() {
			if ( conditionFn() ) {

				// Hook not needed (or it's not possible to use it due
				// to missing dependency), remove it.
				delete this.get;
				return;
			}

			// Hook needed; redefine it so that the support test is not executed again.
			return ( this.get = hookFn ).apply( this, arguments );
		}
	};
}


var cssPrefixes = [ "Webkit", "Moz", "ms" ],
	emptyStyle = document.createElement( "div" ).style,
	vendorProps = {};

// Return a vendor-prefixed property or undefined
function vendorPropName( name ) {

	// Check for vendor prefixed names
	var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
		i = cssPrefixes.length;

	while ( i-- ) {
		name = cssPrefixes[ i ] + capName;
		if ( name in emptyStyle ) {
			return name;
		}
	}
}

// Return a potentially-mapped jQuery.cssProps or vendor prefixed property
function finalPropName( name ) {
	var final = jQuery.cssProps[ name ] || vendorProps[ name ];

	if ( final ) {
		return final;
	}
	if ( name in emptyStyle ) {
		return name;
	}
	return vendorProps[ name ] = vendorPropName( name ) || name;
}


var

	// Swappable if display is none or starts with table
	// except "table", "table-cell", or "table-caption"
	// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
	rdisplayswap = /^(none|table(?!-c[ea]).+)/,
	rcustomProp = /^--/,
	cssShow = { position: "absolute", visibility: "hidden", display: "block" },
	cssNormalTransform = {
		letterSpacing: "0",
		fontWeight: "400"
	};

function setPositiveNumber( _elem, value, subtract ) {

	// Any relative (+/-) values have already been
	// normalized at this point
	var matches = rcssNum.exec( value );
	return matches ?

		// Guard against undefined "subtract", e.g., when used as in cssHooks
		Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
		value;
}

function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
	var i = dimension === "width" ? 1 : 0,
		extra = 0,
		delta = 0;

	// Adjustment may not be necessary
	if ( box === ( isBorderBox ? "border" : "content" ) ) {
		return 0;
	}

	for ( ; i < 4; i += 2 ) {

		// Both box models exclude margin
		if ( box === "margin" ) {
			delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
		}

		// If we get here with a content-box, we're seeking "padding" or "border" or "margin"
		if ( !isBorderBox ) {

			// Add padding
			delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );

			// For "border" or "margin", add border
			if ( box !== "padding" ) {
				delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );

			// But still keep track of it otherwise
			} else {
				extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
			}

		// If we get here with a border-box (content + padding + border), we're seeking "content" or
		// "padding" or "margin"
		} else {

			// For "content", subtract padding
			if ( box === "content" ) {
				delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
			}

			// For "content" or "padding", subtract border
			if ( box !== "margin" ) {
				delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
			}
		}
	}

	// Account for positive content-box scroll gutter when requested by providing computedVal
	if ( !isBorderBox && computedVal >= 0 ) {

		// offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
		// Assuming integer scroll gutter, subtract the rest and round down
		delta += Math.max( 0, Math.ceil(
			elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
			computedVal -
			delta -
			extra -
			0.5

		// If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
		// Use an explicit zero to avoid NaN (gh-3964)
		) ) || 0;
	}

	return delta;
}

function getWidthOrHeight( elem, dimension, extra ) {

	// Start with computed style
	var styles = getStyles( elem ),

		// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
		// Fake content-box until we know it's needed to know the true value.
		boxSizingNeeded = !support.boxSizingReliable() || extra,
		isBorderBox = boxSizingNeeded &&
			jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
		valueIsBorderBox = isBorderBox,

		val = curCSS( elem, dimension, styles ),
		offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );

	// Support: Firefox <=54
	// Return a confounding non-pixel value or feign ignorance, as appropriate.
	if ( rnumnonpx.test( val ) ) {
		if ( !extra ) {
			return val;
		}
		val = "auto";
	}


	// Support: IE 9 - 11 only
	// Use offsetWidth/offsetHeight for when box sizing is unreliable.
	// In those cases, the computed value can be trusted to be border-box.
	if ( ( !support.boxSizingReliable() && isBorderBox ||

		// Support: IE 10 - 11+, Edge 15 - 18+
		// IE/Edge misreport `getComputedStyle` of table rows with width/height
		// set in CSS while `offset*` properties report correct values.
		// Interestingly, in some cases IE 9 doesn't suffer from this issue.
		!support.reliableTrDimensions() && nodeName( elem, "tr" ) ||

		// Fall back to offsetWidth/offsetHeight when value is "auto"
		// This happens for inline elements with no explicit setting (gh-3571)
		val === "auto" ||

		// Support: Android <=4.1 - 4.3 only
		// Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
		!parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&

		// Make sure the element is visible & connected
		elem.getClientRects().length ) {

		isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";

		// Where available, offsetWidth/offsetHeight approximate border box dimensions.
		// Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
		// retrieved value as a content box dimension.
		valueIsBorderBox = offsetProp in elem;
		if ( valueIsBorderBox ) {
			val = elem[ offsetProp ];
		}
	}

	// Normalize "" and auto
	val = parseFloat( val ) || 0;

	// Adjust for the element's box model
	return ( val +
		boxModelAdjustment(
			elem,
			dimension,
			extra || ( isBorderBox ? "border" : "content" ),
			valueIsBorderBox,
			styles,

			// Provide the current computed size to request scroll gutter calculation (gh-3589)
			val
		)
	) + "px";
}

jQuery.extend( {

	// Add in style property hooks for overriding the default
	// behavior of getting and setting a style property
	cssHooks: {
		opacity: {
			get: function( elem, computed ) {
				if ( computed ) {

					// We should always get a number back from opacity
					var ret = curCSS( elem, "opacity" );
					return ret === "" ? "1" : ret;
				}
			}
		}
	},

	// Don't automatically add "px" to these possibly-unitless properties
	cssNumber: {
		"animationIterationCount": true,
		"columnCount": true,
		"fillOpacity": true,
		"flexGrow": true,
		"flexShrink": true,
		"fontWeight": true,
		"gridArea": true,
		"gridColumn": true,
		"gridColumnEnd": true,
		"gridColumnStart": true,
		"gridRow": true,
		"gridRowEnd": true,
		"gridRowStart": true,
		"lineHeight": true,
		"opacity": true,
		"order": true,
		"orphans": true,
		"widows": true,
		"zIndex": true,
		"zoom": true
	},

	// Add in properties whose names you wish to fix before
	// setting or getting the value
	cssProps: {},

	// Get and set the style property on a DOM Node
	style: function( elem, name, value, extra ) {

		// Don't set styles on text and comment nodes
		if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
			return;
		}

		// Make sure that we're working with the right name
		var ret, type, hooks,
			origName = camelCase( name ),
			isCustomProp = rcustomProp.test( name ),
			style = elem.style;

		// Make sure that we're working with the right name. We don't
		// want to query the value if it is a CSS custom property
		// since they are user-defined.
		if ( !isCustomProp ) {
			name = finalPropName( origName );
		}

		// Gets hook for the prefixed version, then unprefixed version
		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];

		// Check if we're setting a value
		if ( value !== undefined ) {
			type = typeof value;

			// Convert "+=" or "-=" to relative numbers (#7345)
			if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
				value = adjustCSS( elem, name, ret );

				// Fixes bug #9237
				type = "number";
			}

			// Make sure that null and NaN values aren't set (#7116)
			if ( value == null || value !== value ) {
				return;
			}

			// If a number was passed in, add the unit (except for certain CSS properties)
			// The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
			// "px" to a few hardcoded values.
			if ( type === "number" && !isCustomProp ) {
				value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
			}

			// background-* props affect original clone's values
			if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
				style[ name ] = "inherit";
			}

			// If a hook was provided, use that value, otherwise just set the specified value
			if ( !hooks || !( "set" in hooks ) ||
				( value = hooks.set( elem, value, extra ) ) !== undefined ) {

				if ( isCustomProp ) {
					style.setProperty( name, value );
				} else {
					style[ name ] = value;
				}
			}

		} else {

			// If a hook was provided get the non-computed value from there
			if ( hooks && "get" in hooks &&
				( ret = hooks.get( elem, false, extra ) ) !== undefined ) {

				return ret;
			}

			// Otherwise just get the value from the style object
			return style[ name ];
		}
	},

	css: function( elem, name, extra, styles ) {
		var val, num, hooks,
			origName = camelCase( name ),
			isCustomProp = rcustomProp.test( name );

		// Make sure that we're working with the right name. We don't
		// want to modify the value if it is a CSS custom property
		// since they are user-defined.
		if ( !isCustomProp ) {
			name = finalPropName( origName );
		}

		// Try prefixed name followed by the unprefixed name
		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];

		// If a hook was provided get the computed value from there
		if ( hooks && "get" in hooks ) {
			val = hooks.get( elem, true, extra );
		}

		// Otherwise, if a way to get the computed value exists, use that
		if ( val === undefined ) {
			val = curCSS( elem, name, styles );
		}

		// Convert "normal" to computed value
		if ( val === "normal" && name in cssNormalTransform ) {
			val = cssNormalTransform[ name ];
		}

		// Make numeric if forced or a qualifier was provided and val looks numeric
		if ( extra === "" || extra ) {
			num = parseFloat( val );
			return extra === true || isFinite( num ) ? num || 0 : val;
		}

		return val;
	}
} );

jQuery.each( [ "height", "width" ], function( _i, dimension ) {
	jQuery.cssHooks[ dimension ] = {
		get: function( elem, computed, extra ) {
			if ( computed ) {

				// Certain elements can have dimension info if we invisibly show them
				// but it must have a current display style that would benefit
				return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&

					// Support: Safari 8+
					// Table columns in Safari have non-zero offsetWidth & zero
					// getBoundingClientRect().width unless display is changed.
					// Support: IE <=11 only
					// Running getBoundingClientRect on a disconnected node
					// in IE throws an error.
					( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
						swap( elem, cssShow, function() {
							return getWidthOrHeight( elem, dimension, extra );
						} ) :
						getWidthOrHeight( elem, dimension, extra );
			}
		},

		set: function( elem, value, extra ) {
			var matches,
				styles = getStyles( elem ),

				// Only read styles.position if the test has a chance to fail
				// to avoid forcing a reflow.
				scrollboxSizeBuggy = !support.scrollboxSize() &&
					styles.position === "absolute",

				// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
				boxSizingNeeded = scrollboxSizeBuggy || extra,
				isBorderBox = boxSizingNeeded &&
					jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
				subtract = extra ?
					boxModelAdjustment(
						elem,
						dimension,
						extra,
						isBorderBox,
						styles
					) :
					0;

			// Account for unreliable border-box dimensions by comparing offset* to computed and
			// faking a content-box to get border and padding (gh-3699)
			if ( isBorderBox && scrollboxSizeBuggy ) {
				subtract -= Math.ceil(
					elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
					parseFloat( styles[ dimension ] ) -
					boxModelAdjustment( elem, dimension, "border", false, styles ) -
					0.5
				);
			}

			// Convert to pixels if value adjustment is needed
			if ( subtract && ( matches = rcssNum.exec( value ) ) &&
				( matches[ 3 ] || "px" ) !== "px" ) {

				elem.style[ dimension ] = value;
				value = jQuery.css( elem, dimension );
			}

			return setPositiveNumber( elem, value, subtract );
		}
	};
} );

jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
	function( elem, computed ) {
		if ( computed ) {
			return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
				elem.getBoundingClientRect().left -
					swap( elem, { marginLeft: 0 }, function() {
						return elem.getBoundingClientRect().left;
					} )
				) + "px";
		}
	}
);

// These hooks are used by animate to expand properties
jQuery.each( {
	margin: "",
	padding: "",
	border: "Width"
}, function( prefix, suffix ) {
	jQuery.cssHooks[ prefix + suffix ] = {
		expand: function( value ) {
			var i = 0,
				expanded = {},

				// Assumes a single number if not a string
				parts = typeof value === "string" ? value.split( " " ) : [ value ];

			for ( ; i < 4; i++ ) {
				expanded[ prefix + cssExpand[ i ] + suffix ] =
					parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
			}

			return expanded;
		}
	};

	if ( prefix !== "margin" ) {
		jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
	}
} );

jQuery.fn.extend( {
	css: function( name, value ) {
		return access( this, function( elem, name, value ) {
			var styles, len,
				map = {},
				i = 0;

			if ( Array.isArray( name ) ) {
				styles = getStyles( elem );
				len = name.length;

				for ( ; i < len; i++ ) {
					map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
				}

				return map;
			}

			return value !== undefined ?
				jQuery.style( elem, name, value ) :
				jQuery.css( elem, name );
		}, name, value, arguments.length > 1 );
	}
} );


function Tween( elem, options, prop, end, easing ) {
	return new Tween.prototype.init( elem, options, prop, end, easing );
}
jQuery.Tween = Tween;

Tween.prototype = {
	constructor: Tween,
	init: function( elem, options, prop, end, easing, unit ) {
		this.elem = elem;
		this.prop = prop;
		this.easing = easing || jQuery.easing._default;
		this.options = options;
		this.start = this.now = this.cur();
		this.end = end;
		this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
	},
	cur: function() {
		var hooks = Tween.propHooks[ this.prop ];

		return hooks && hooks.get ?
			hooks.get( this ) :
			Tween.propHooks._default.get( this );
	},
	run: function( percent ) {
		var eased,
			hooks = Tween.propHooks[ this.prop ];

		if ( this.options.duration ) {
			this.pos = eased = jQuery.easing[ this.easing ](
				percent, this.options.duration * percent, 0, 1, this.options.duration
			);
		} else {
			this.pos = eased = percent;
		}
		this.now = ( this.end - this.start ) * eased + this.start;

		if ( this.options.step ) {
			this.options.step.call( this.elem, this.now, this );
		}

		if ( hooks && hooks.set ) {
			hooks.set( this );
		} else {
			Tween.propHooks._default.set( this );
		}
		return this;
	}
};

Tween.prototype.init.prototype = Tween.prototype;

Tween.propHooks = {
	_default: {
		get: function( tween ) {
			var result;

			// Use a property on the element directly when it is not a DOM element,
			// or when there is no matching style property that exists.
			if ( tween.elem.nodeType !== 1 ||
				tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
				return tween.elem[ tween.prop ];
			}

			// Passing an empty string as a 3rd parameter to .css will automatically
			// attempt a parseFloat and fallback to a string if the parse fails.
			// Simple values such as "10px" are parsed to Float;
			// complex values such as "rotate(1rad)" are returned as-is.
			result = jQuery.css( tween.elem, tween.prop, "" );

			// Empty strings, null, undefined and "auto" are converted to 0.
			return !result || result === "auto" ? 0 : result;
		},
		set: function( tween ) {

			// Use step hook for back compat.
			// Use cssHook if its there.
			// Use .style if available and use plain properties where available.
			if ( jQuery.fx.step[ tween.prop ] ) {
				jQuery.fx.step[ tween.prop ]( tween );
			} else if ( tween.elem.nodeType === 1 && (
					jQuery.cssHooks[ tween.prop ] ||
					tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
				jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
			} else {
				tween.elem[ tween.prop ] = tween.now;
			}
		}
	}
};

// Support: IE <=9 only
// Panic based approach to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
	set: function( tween ) {
		if ( tween.elem.nodeType && tween.elem.parentNode ) {
			tween.elem[ tween.prop ] = tween.now;
		}
	}
};

jQuery.easing = {
	linear: function( p ) {
		return p;
	},
	swing: function( p ) {
		return 0.5 - Math.cos( p * Math.PI ) / 2;
	},
	_default: "swing"
};

jQuery.fx = Tween.prototype.init;

// Back compat <1.8 extension point
jQuery.fx.step = {};




var
	fxNow, inProgress,
	rfxtypes = /^(?:toggle|show|hide)$/,
	rrun = /queueHooks$/;

function schedule() {
	if ( inProgress ) {
		if ( document.hidden === false && window.requestAnimationFrame ) {
			window.requestAnimationFrame( schedule );
		} else {
			window.setTimeout( schedule, jQuery.fx.interval );
		}

		jQuery.fx.tick();
	}
}

// Animations created synchronously will run synchronously
function createFxNow() {
	window.setTimeout( function() {
		fxNow = undefined;
	} );
	return ( fxNow = Date.now() );
}

// Generate parameters to create a standard animation
function genFx( type, includeWidth ) {
	var which,
		i = 0,
		attrs = { height: type };

	// If we include width, step value is 1 to do all cssExpand values,
	// otherwise step value is 2 to skip over Left and Right
	includeWidth = includeWidth ? 1 : 0;
	for ( ; i < 4; i += 2 - includeWidth ) {
		which = cssExpand[ i ];
		attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
	}

	if ( includeWidth ) {
		attrs.opacity = attrs.width = type;
	}

	return attrs;
}

function createTween( value, prop, animation ) {
	var tween,
		collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
		index = 0,
		length = collection.length;
	for ( ; index < length; index++ ) {
		if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {

			// We're done with this property
			return tween;
		}
	}
}

function defaultPrefilter( elem, props, opts ) {
	var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
		isBox = "width" in props || "height" in props,
		anim = this,
		orig = {},
		style = elem.style,
		hidden = elem.nodeType && isHiddenWithinTree( elem ),
		dataShow = dataPriv.get( elem, "fxshow" );

	// Queue-skipping animations hijack the fx hooks
	if ( !opts.queue ) {
		hooks = jQuery._queueHooks( elem, "fx" );
		if ( hooks.unqueued == null ) {
			hooks.unqueued = 0;
			oldfire = hooks.empty.fire;
			hooks.empty.fire = function() {
				if ( !hooks.unqueued ) {
					oldfire();
				}
			};
		}
		hooks.unqueued++;

		anim.always( function() {

			// Ensure the complete handler is called before this completes
			anim.always( function() {
				hooks.unqueued--;
				if ( !jQuery.queue( elem, "fx" ).length ) {
					hooks.empty.fire();
				}
			} );
		} );
	}

	// Detect show/hide animations
	for ( prop in props ) {
		value = props[ prop ];
		if ( rfxtypes.test( value ) ) {
			delete props[ prop ];
			toggle = toggle || value === "toggle";
			if ( value === ( hidden ? "hide" : "show" ) ) {

				// Pretend to be hidden if this is a "show" and
				// there is still data from a stopped show/hide
				if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
					hidden = true;

				// Ignore all other no-op show/hide data
				} else {
					continue;
				}
			}
			orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
		}
	}

	// Bail out if this is a no-op like .hide().hide()
	propTween = !jQuery.isEmptyObject( props );
	if ( !propTween && jQuery.isEmptyObject( orig ) ) {
		return;
	}

	// Restrict "overflow" and "display" styles during box animations
	if ( isBox && elem.nodeType === 1 ) {

		// Support: IE <=9 - 11, Edge 12 - 15
		// Record all 3 overflow attributes because IE does not infer the shorthand
		// from identically-valued overflowX and overflowY and Edge just mirrors
		// the overflowX value there.
		opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];

		// Identify a display type, preferring old show/hide data over the CSS cascade
		restoreDisplay = dataShow && dataShow.display;
		if ( restoreDisplay == null ) {
			restoreDisplay = dataPriv.get( elem, "display" );
		}
		display = jQuery.css( elem, "display" );
		if ( display === "none" ) {
			if ( restoreDisplay ) {
				display = restoreDisplay;
			} else {

				// Get nonempty value(s) by temporarily forcing visibility
				showHide( [ elem ], true );
				restoreDisplay = elem.style.display || restoreDisplay;
				display = jQuery.css( elem, "display" );
				showHide( [ elem ] );
			}
		}

		// Animate inline elements as inline-block
		if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
			if ( jQuery.css( elem, "float" ) === "none" ) {

				// Restore the original display value at the end of pure show/hide animations
				if ( !propTween ) {
					anim.done( function() {
						style.display = restoreDisplay;
					} );
					if ( restoreDisplay == null ) {
						display = style.display;
						restoreDisplay = display === "none" ? "" : display;
					}
				}
				style.display = "inline-block";
			}
		}
	}

	if ( opts.overflow ) {
		style.overflow = "hidden";
		anim.always( function() {
			style.overflow = opts.overflow[ 0 ];
			style.overflowX = opts.overflow[ 1 ];
			style.overflowY = opts.overflow[ 2 ];
		} );
	}

	// Implement show/hide animations
	propTween = false;
	for ( prop in orig ) {

		// General show/hide setup for this element animation
		if ( !propTween ) {
			if ( dataShow ) {
				if ( "hidden" in dataShow ) {
					hidden = dataShow.hidden;
				}
			} else {
				dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
			}

			// Store hidden/visible for toggle so `.stop().toggle()` "reverses"
			if ( toggle ) {
				dataShow.hidden = !hidden;
			}

			// Show elements before animating them
			if ( hidden ) {
				showHide( [ elem ], true );
			}

			/* eslint-disable no-loop-func */

			anim.done( function() {

			/* eslint-enable no-loop-func */

				// The final step of a "hide" animation is actually hiding the element
				if ( !hidden ) {
					showHide( [ elem ] );
				}
				dataPriv.remove( elem, "fxshow" );
				for ( prop in orig ) {
					jQuery.style( elem, prop, orig[ prop ] );
				}
			} );
		}

		// Per-property setup
		propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
		if ( !( prop in dataShow ) ) {
			dataShow[ prop ] = propTween.start;
			if ( hidden ) {
				propTween.end = propTween.start;
				propTween.start = 0;
			}
		}
	}
}

function propFilter( props, specialEasing ) {
	var index, name, easing, value, hooks;

	// camelCase, specialEasing and expand cssHook pass
	for ( index in props ) {
		name = camelCase( index );
		easing = specialEasing[ name ];
		value = props[ index ];
		if ( Array.isArray( value ) ) {
			easing = value[ 1 ];
			value = props[ index ] = value[ 0 ];
		}

		if ( index !== name ) {
			props[ name ] = value;
			delete props[ index ];
		}

		hooks = jQuery.cssHooks[ name ];
		if ( hooks && "expand" in hooks ) {
			value = hooks.expand( value );
			delete props[ name ];

			// Not quite $.extend, this won't overwrite existing keys.
			// Reusing 'index' because we have the correct "name"
			for ( index in value ) {
				if ( !( index in props ) ) {
					props[ index ] = value[ index ];
					specialEasing[ index ] = easing;
				}
			}
		} else {
			specialEasing[ name ] = easing;
		}
	}
}

function Animation( elem, properties, options ) {
	var result,
		stopped,
		index = 0,
		length = Animation.prefilters.length,
		deferred = jQuery.Deferred().always( function() {

			// Don't match elem in the :animated selector
			delete tick.elem;
		} ),
		tick = function() {
			if ( stopped ) {
				return false;
			}
			var currentTime = fxNow || createFxNow(),
				remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),

				// Support: Android 2.3 only
				// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
				temp = remaining / animation.duration || 0,
				percent = 1 - temp,
				index = 0,
				length = animation.tweens.length;

			for ( ; index < length; index++ ) {
				animation.tweens[ index ].run( percent );
			}

			deferred.notifyWith( elem, [ animation, percent, remaining ] );

			// If there's more to do, yield
			if ( percent < 1 && length ) {
				return remaining;
			}

			// If this was an empty animation, synthesize a final progress notification
			if ( !length ) {
				deferred.notifyWith( elem, [ animation, 1, 0 ] );
			}

			// Resolve the animation and report its conclusion
			deferred.resolveWith( elem, [ animation ] );
			return false;
		},
		animation = deferred.promise( {
			elem: elem,
			props: jQuery.extend( {}, properties ),
			opts: jQuery.extend( true, {
				specialEasing: {},
				easing: jQuery.easing._default
			}, options ),
			originalProperties: properties,
			originalOptions: options,
			startTime: fxNow || createFxNow(),
			duration: options.duration,
			tweens: [],
			createTween: function( prop, end ) {
				var tween = jQuery.Tween( elem, animation.opts, prop, end,
						animation.opts.specialEasing[ prop ] || animation.opts.easing );
				animation.tweens.push( tween );
				return tween;
			},
			stop: function( gotoEnd ) {
				var index = 0,

					// If we are going to the end, we want to run all the tweens
					// otherwise we skip this part
					length = gotoEnd ? animation.tweens.length : 0;
				if ( stopped ) {
					return this;
				}
				stopped = true;
				for ( ; index < length; index++ ) {
					animation.tweens[ index ].run( 1 );
				}

				// Resolve when we played the last frame; otherwise, reject
				if ( gotoEnd ) {
					deferred.notifyWith( elem, [ animation, 1, 0 ] );
					deferred.resolveWith( elem, [ animation, gotoEnd ] );
				} else {
					deferred.rejectWith( elem, [ animation, gotoEnd ] );
				}
				return this;
			}
		} ),
		props = animation.props;

	propFilter( props, animation.opts.specialEasing );

	for ( ; index < length; index++ ) {
		result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
		if ( result ) {
			if ( isFunction( result.stop ) ) {
				jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
					result.stop.bind( result );
			}
			return result;
		}
	}

	jQuery.map( props, createTween, animation );

	if ( isFunction( animation.opts.start ) ) {
		animation.opts.start.call( elem, animation );
	}

	// Attach callbacks from options
	animation
		.progress( animation.opts.progress )
		.done( animation.opts.done, animation.opts.complete )
		.fail( animation.opts.fail )
		.always( animation.opts.always );

	jQuery.fx.timer(
		jQuery.extend( tick, {
			elem: elem,
			anim: animation,
			queue: animation.opts.queue
		} )
	);

	return animation;
}

jQuery.Animation = jQuery.extend( Animation, {

	tweeners: {
		"*": [ function( prop, value ) {
			var tween = this.createTween( prop, value );
			adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
			return tween;
		} ]
	},

	tweener: function( props, callback ) {
		if ( isFunction( props ) ) {
			callback = props;
			props = [ "*" ];
		} else {
			props = props.match( rnothtmlwhite );
		}

		var prop,
			index = 0,
			length = props.length;

		for ( ; index < length; index++ ) {
			prop = props[ index ];
			Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
			Animation.tweeners[ prop ].unshift( callback );
		}
	},

	prefilters: [ defaultPrefilter ],

	prefilter: function( callback, prepend ) {
		if ( prepend ) {
			Animation.prefilters.unshift( callback );
		} else {
			Animation.prefilters.push( callback );
		}
	}
} );

jQuery.speed = function( speed, easing, fn ) {
	var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
		complete: fn || !fn && easing ||
			isFunction( speed ) && speed,
		duration: speed,
		easing: fn && easing || easing && !isFunction( easing ) && easing
	};

	// Go to the end state if fx are off
	if ( jQuery.fx.off ) {
		opt.duration = 0;

	} else {
		if ( typeof opt.duration !== "number" ) {
			if ( opt.duration in jQuery.fx.speeds ) {
				opt.duration = jQuery.fx.speeds[ opt.duration ];

			} else {
				opt.duration = jQuery.fx.speeds._default;
			}
		}
	}

	// Normalize opt.queue - true/undefined/null -> "fx"
	if ( opt.queue == null || opt.queue === true ) {
		opt.queue = "fx";
	}

	// Queueing
	opt.old = opt.complete;

	opt.complete = function() {
		if ( isFunction( opt.old ) ) {
			opt.old.call( this );
		}

		if ( opt.queue ) {
			jQuery.dequeue( this, opt.queue );
		}
	};

	return opt;
};

jQuery.fn.extend( {
	fadeTo: function( speed, to, easing, callback ) {

		// Show any hidden elements after setting opacity to 0
		return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()

			// Animate to the value specified
			.end().animate( { opacity: to }, speed, easing, callback );
	},
	animate: function( prop, speed, easing, callback ) {
		var empty = jQuery.isEmptyObject( prop ),
			optall = jQuery.speed( speed, easing, callback ),
			doAnimation = function() {

				// Operate on a copy of prop so per-property easing won't be lost
				var anim = Animation( this, jQuery.extend( {}, prop ), optall );

				// Empty animations, or finishing resolves immediately
				if ( empty || dataPriv.get( this, "finish" ) ) {
					anim.stop( true );
				}
			};
			doAnimation.finish = doAnimation;

		return empty || optall.queue === false ?
			this.each( doAnimation ) :
			this.queue( optall.queue, doAnimation );
	},
	stop: function( type, clearQueue, gotoEnd ) {
		var stopQueue = function( hooks ) {
			var stop = hooks.stop;
			delete hooks.stop;
			stop( gotoEnd );
		};

		if ( typeof type !== "string" ) {
			gotoEnd = clearQueue;
			clearQueue = type;
			type = undefined;
		}
		if ( clearQueue ) {
			this.queue( type || "fx", [] );
		}

		return this.each( function() {
			var dequeue = true,
				index = type != null && type + "queueHooks",
				timers = jQuery.timers,
				data = dataPriv.get( this );

			if ( index ) {
				if ( data[ index ] && data[ index ].stop ) {
					stopQueue( data[ index ] );
				}
			} else {
				for ( index in data ) {
					if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
						stopQueue( data[ index ] );
					}
				}
			}

			for ( index = timers.length; index--; ) {
				if ( timers[ index ].elem === this &&
					( type == null || timers[ index ].queue === type ) ) {

					timers[ index ].anim.stop( gotoEnd );
					dequeue = false;
					timers.splice( index, 1 );
				}
			}

			// Start the next in the queue if the last step wasn't forced.
			// Timers currently will call their complete callbacks, which
			// will dequeue but only if they were gotoEnd.
			if ( dequeue || !gotoEnd ) {
				jQuery.dequeue( this, type );
			}
		} );
	},
	finish: function( type ) {
		if ( type !== false ) {
			type = type || "fx";
		}
		return this.each( function() {
			var index,
				data = dataPriv.get( this ),
				queue = data[ type + "queue" ],
				hooks = data[ type + "queueHooks" ],
				timers = jQuery.timers,
				length = queue ? queue.length : 0;

			// Enable finishing flag on private data
			data.finish = true;

			// Empty the queue first
			jQuery.queue( this, type, [] );

			if ( hooks && hooks.stop ) {
				hooks.stop.call( this, true );
			}

			// Look for any active animations, and finish them
			for ( index = timers.length; index--; ) {
				if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
					timers[ index ].anim.stop( true );
					timers.splice( index, 1 );
				}
			}

			// Look for any animations in the old queue and finish them
			for ( index = 0; index < length; index++ ) {
				if ( queue[ index ] && queue[ index ].finish ) {
					queue[ index ].finish.call( this );
				}
			}

			// Turn off finishing flag
			delete data.finish;
		} );
	}
} );

jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) {
	var cssFn = jQuery.fn[ name ];
	jQuery.fn[ name ] = function( speed, easing, callback ) {
		return speed == null || typeof speed === "boolean" ?
			cssFn.apply( this, arguments ) :
			this.animate( genFx( name, true ), speed, easing, callback );
	};
} );

// Generate shortcuts for custom animations
jQuery.each( {
	slideDown: genFx( "show" ),
	slideUp: genFx( "hide" ),
	slideToggle: genFx( "toggle" ),
	fadeIn: { opacity: "show" },
	fadeOut: { opacity: "hide" },
	fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
	jQuery.fn[ name ] = function( speed, easing, callback ) {
		return this.animate( props, speed, easing, callback );
	};
} );

jQuery.timers = [];
jQuery.fx.tick = function() {
	var timer,
		i = 0,
		timers = jQuery.timers;

	fxNow = Date.now();

	for ( ; i < timers.length; i++ ) {
		timer = timers[ i ];

		// Run the timer and safely remove it when done (allowing for external removal)
		if ( !timer() && timers[ i ] === timer ) {
			timers.splice( i--, 1 );
		}
	}

	if ( !timers.length ) {
		jQuery.fx.stop();
	}
	fxNow = undefined;
};

jQuery.fx.timer = function( timer ) {
	jQuery.timers.push( timer );
	jQuery.fx.start();
};

jQuery.fx.interval = 13;
jQuery.fx.start = function() {
	if ( inProgress ) {
		return;
	}

	inProgress = true;
	schedule();
};

jQuery.fx.stop = function() {
	inProgress = null;
};

jQuery.fx.speeds = {
	slow: 600,
	fast: 200,

	// Default speed
	_default: 400
};


// Based off of the plugin by Clint Helfers, with permission.
// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
jQuery.fn.delay = function( time, type ) {
	time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
	type = type || "fx";

	return this.queue( type, function( next, hooks ) {
		var timeout = window.setTimeout( next, time );
		hooks.stop = function() {
			window.clearTimeout( timeout );
		};
	} );
};


( function() {
	var input = document.createElement( "input" ),
		select = document.createElement( "select" ),
		opt = select.appendChild( document.createElement( "option" ) );

	input.type = "checkbox";

	// Support: Android <=4.3 only
	// Default value for a checkbox should be "on"
	support.checkOn = input.value !== "";

	// Support: IE <=11 only
	// Must access selectedIndex to make default options select
	support.optSelected = opt.selected;

	// Support: IE <=11 only
	// An input loses its value after becoming a radio
	input = document.createElement( "input" );
	input.value = "t";
	input.type = "radio";
	support.radioValue = input.value === "t";
} )();


var boolHook,
	attrHandle = jQuery.expr.attrHandle;

jQuery.fn.extend( {
	attr: function( name, value ) {
		return access( this, jQuery.attr, name, value, arguments.length > 1 );
	},

	removeAttr: function( name ) {
		return this.each( function() {
			jQuery.removeAttr( this, name );
		} );
	}
} );

jQuery.extend( {
	attr: function( elem, name, value ) {
		var ret, hooks,
			nType = elem.nodeType;

		// Don't get/set attributes on text, comment and attribute nodes
		if ( nType === 3 || nType === 8 || nType === 2 ) {
			return;
		}

		// Fallback to prop when attributes are not supported
		if ( typeof elem.getAttribute === "undefined" ) {
			return jQuery.prop( elem, name, value );
		}

		// Attribute hooks are determined by the lowercase version
		// Grab necessary hook if one is defined
		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
			hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
				( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
		}

		if ( value !== undefined ) {
			if ( value === null ) {
				jQuery.removeAttr( elem, name );
				return;
			}

			if ( hooks && "set" in hooks &&
				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
				return ret;
			}

			elem.setAttribute( name, value + "" );
			return value;
		}

		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
			return ret;
		}

		ret = jQuery.find.attr( elem, name );

		// Non-existent attributes return null, we normalize to undefined
		return ret == null ? undefined : ret;
	},

	attrHooks: {
		type: {
			set: function( elem, value ) {
				if ( !support.radioValue && value === "radio" &&
					nodeName( elem, "input" ) ) {
					var val = elem.value;
					elem.setAttribute( "type", value );
					if ( val ) {
						elem.value = val;
					}
					return value;
				}
			}
		}
	},

	removeAttr: function( elem, value ) {
		var name,
			i = 0,

			// Attribute names can contain non-HTML whitespace characters
			// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
			attrNames = value && value.match( rnothtmlwhite );

		if ( attrNames && elem.nodeType === 1 ) {
			while ( ( name = attrNames[ i++ ] ) ) {
				elem.removeAttribute( name );
			}
		}
	}
} );

// Hooks for boolean attributes
boolHook = {
	set: function( elem, value, name ) {
		if ( value === false ) {

			// Remove boolean attributes when set to false
			jQuery.removeAttr( elem, name );
		} else {
			elem.setAttribute( name, name );
		}
		return name;
	}
};

jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
	var getter = attrHandle[ name ] || jQuery.find.attr;

	attrHandle[ name ] = function( elem, name, isXML ) {
		var ret, handle,
			lowercaseName = name.toLowerCase();

		if ( !isXML ) {

			// Avoid an infinite loop by temporarily removing this function from the getter
			handle = attrHandle[ lowercaseName ];
			attrHandle[ lowercaseName ] = ret;
			ret = getter( elem, name, isXML ) != null ?
				lowercaseName :
				null;
			attrHandle[ lowercaseName ] = handle;
		}
		return ret;
	};
} );




var rfocusable = /^(?:input|select|textarea|button)$/i,
	rclickable = /^(?:a|area)$/i;

jQuery.fn.extend( {
	prop: function( name, value ) {
		return access( this, jQuery.prop, name, value, arguments.length > 1 );
	},

	removeProp: function( name ) {
		return this.each( function() {
			delete this[ jQuery.propFix[ name ] || name ];
		} );
	}
} );

jQuery.extend( {
	prop: function( elem, name, value ) {
		var ret, hooks,
			nType = elem.nodeType;

		// Don't get/set properties on text, comment and attribute nodes
		if ( nType === 3 || nType === 8 || nType === 2 ) {
			return;
		}

		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {

			// Fix name and attach hooks
			name = jQuery.propFix[ name ] || name;
			hooks = jQuery.propHooks[ name ];
		}

		if ( value !== undefined ) {
			if ( hooks && "set" in hooks &&
				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
				return ret;
			}

			return ( elem[ name ] = value );
		}

		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
			return ret;
		}

		return elem[ name ];
	},

	propHooks: {
		tabIndex: {
			get: function( elem ) {

				// Support: IE <=9 - 11 only
				// elem.tabIndex doesn't always return the
				// correct value when it hasn't been explicitly set
				// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
				// Use proper attribute retrieval(#12072)
				var tabindex = jQuery.find.attr( elem, "tabindex" );

				if ( tabindex ) {
					return parseInt( tabindex, 10 );
				}

				if (
					rfocusable.test( elem.nodeName ) ||
					rclickable.test( elem.nodeName ) &&
					elem.href
				) {
					return 0;
				}

				return -1;
			}
		}
	},

	propFix: {
		"for": "htmlFor",
		"class": "className"
	}
} );

// Support: IE <=11 only
// Accessing the selectedIndex property
// forces the browser to respect setting selected
// on the option
// The getter ensures a default option is selected
// when in an optgroup
// eslint rule "no-unused-expressions" is disabled for this code
// since it considers such accessions noop
if ( !support.optSelected ) {
	jQuery.propHooks.selected = {
		get: function( elem ) {

			/* eslint no-unused-expressions: "off" */

			var parent = elem.parentNode;
			if ( parent && parent.parentNode ) {
				parent.parentNode.selectedIndex;
			}
			return null;
		},
		set: function( elem ) {

			/* eslint no-unused-expressions: "off" */

			var parent = elem.parentNode;
			if ( parent ) {
				parent.selectedIndex;

				if ( parent.parentNode ) {
					parent.parentNode.selectedIndex;
				}
			}
		}
	};
}

jQuery.each( [
	"tabIndex",
	"readOnly",
	"maxLength",
	"cellSpacing",
	"cellPadding",
	"rowSpan",
	"colSpan",
	"useMap",
	"frameBorder",
	"contentEditable"
], function() {
	jQuery.propFix[ this.toLowerCase() ] = this;
} );




	// Strip and collapse whitespace according to HTML spec
	// https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
	function stripAndCollapse( value ) {
		var tokens = value.match( rnothtmlwhite ) || [];
		return tokens.join( " " );
	}


function getClass( elem ) {
	return elem.getAttribute && elem.getAttribute( "class" ) || "";
}

function classesToArray( value ) {
	if ( Array.isArray( value ) ) {
		return value;
	}
	if ( typeof value === "string" ) {
		return value.match( rnothtmlwhite ) || [];
	}
	return [];
}

jQuery.fn.extend( {
	addClass: function( value ) {
		var classes, elem, cur, curValue, clazz, j, finalValue,
			i = 0;

		if ( isFunction( value ) ) {
			return this.each( function( j ) {
				jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
			} );
		}

		classes = classesToArray( value );

		if ( classes.length ) {
			while ( ( elem = this[ i++ ] ) ) {
				curValue = getClass( elem );
				cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );

				if ( cur ) {
					j = 0;
					while ( ( clazz = classes[ j++ ] ) ) {
						if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
							cur += clazz + " ";
						}
					}

					// Only assign if different to avoid unneeded rendering.
					finalValue = stripAndCollapse( cur );
					if ( curValue !== finalValue ) {
						elem.setAttribute( "class", finalValue );
					}
				}
			}
		}

		return this;
	},

	removeClass: function( value ) {
		var classes, elem, cur, curValue, clazz, j, finalValue,
			i = 0;

		if ( isFunction( value ) ) {
			return this.each( function( j ) {
				jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
			} );
		}

		if ( !arguments.length ) {
			return this.attr( "class", "" );
		}

		classes = classesToArray( value );

		if ( classes.length ) {
			while ( ( elem = this[ i++ ] ) ) {
				curValue = getClass( elem );

				// This expression is here for better compressibility (see addClass)
				cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );

				if ( cur ) {
					j = 0;
					while ( ( clazz = classes[ j++ ] ) ) {

						// Remove *all* instances
						while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
							cur = cur.replace( " " + clazz + " ", " " );
						}
					}

					// Only assign if different to avoid unneeded rendering.
					finalValue = stripAndCollapse( cur );
					if ( curValue !== finalValue ) {
						elem.setAttribute( "class", finalValue );
					}
				}
			}
		}

		return this;
	},

	toggleClass: function( value, stateVal ) {
		var type = typeof value,
			isValidValue = type === "string" || Array.isArray( value );

		if ( typeof stateVal === "boolean" && isValidValue ) {
			return stateVal ? this.addClass( value ) : this.removeClass( value );
		}

		if ( isFunction( value ) ) {
			return this.each( function( i ) {
				jQuery( this ).toggleClass(
					value.call( this, i, getClass( this ), stateVal ),
					stateVal
				);
			} );
		}

		return this.each( function() {
			var className, i, self, classNames;

			if ( isValidValue ) {

				// Toggle individual class names
				i = 0;
				self = jQuery( this );
				classNames = classesToArray( value );

				while ( ( className = classNames[ i++ ] ) ) {

					// Check each className given, space separated list
					if ( self.hasClass( className ) ) {
						self.removeClass( className );
					} else {
						self.addClass( className );
					}
				}

			// Toggle whole class name
			} else if ( value === undefined || type === "boolean" ) {
				className = getClass( this );
				if ( className ) {

					// Store className if set
					dataPriv.set( this, "__className__", className );
				}

				// If the element has a class name or if we're passed `false`,
				// then remove the whole classname (if there was one, the above saved it).
				// Otherwise bring back whatever was previously saved (if anything),
				// falling back to the empty string if nothing was stored.
				if ( this.setAttribute ) {
					this.setAttribute( "class",
						className || value === false ?
						"" :
						dataPriv.get( this, "__className__" ) || ""
					);
				}
			}
		} );
	},

	hasClass: function( selector ) {
		var className, elem,
			i = 0;

		className = " " + selector + " ";
		while ( ( elem = this[ i++ ] ) ) {
			if ( elem.nodeType === 1 &&
				( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
					return true;
			}
		}

		return false;
	}
} );




var rreturn = /\r/g;

jQuery.fn.extend( {
	val: function( value ) {
		var hooks, ret, valueIsFunction,
			elem = this[ 0 ];

		if ( !arguments.length ) {
			if ( elem ) {
				hooks = jQuery.valHooks[ elem.type ] ||
					jQuery.valHooks[ elem.nodeName.toLowerCase() ];

				if ( hooks &&
					"get" in hooks &&
					( ret = hooks.get( elem, "value" ) ) !== undefined
				) {
					return ret;
				}

				ret = elem.value;

				// Handle most common string cases
				if ( typeof ret === "string" ) {
					return ret.replace( rreturn, "" );
				}

				// Handle cases where value is null/undef or number
				return ret == null ? "" : ret;
			}

			return;
		}

		valueIsFunction = isFunction( value );

		return this.each( function( i ) {
			var val;

			if ( this.nodeType !== 1 ) {
				return;
			}

			if ( valueIsFunction ) {
				val = value.call( this, i, jQuery( this ).val() );
			} else {
				val = value;
			}

			// Treat null/undefined as ""; convert numbers to string
			if ( val == null ) {
				val = "";

			} else if ( typeof val === "number" ) {
				val += "";

			} else if ( Array.isArray( val ) ) {
				val = jQuery.map( val, function( value ) {
					return value == null ? "" : value + "";
				} );
			}

			hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];

			// If set returns undefined, fall back to normal setting
			if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
				this.value = val;
			}
		} );
	}
} );

jQuery.extend( {
	valHooks: {
		option: {
			get: function( elem ) {

				var val = jQuery.find.attr( elem, "value" );
				return val != null ?
					val :

					// Support: IE <=10 - 11 only
					// option.text throws exceptions (#14686, #14858)
					// Strip and collapse whitespace
					// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
					stripAndCollapse( jQuery.text( elem ) );
			}
		},
		select: {
			get: function( elem ) {
				var value, option, i,
					options = elem.options,
					index = elem.selectedIndex,
					one = elem.type === "select-one",
					values = one ? null : [],
					max = one ? index + 1 : options.length;

				if ( index < 0 ) {
					i = max;

				} else {
					i = one ? index : 0;
				}

				// Loop through all the selected options
				for ( ; i < max; i++ ) {
					option = options[ i ];

					// Support: IE <=9 only
					// IE8-9 doesn't update selected after form reset (#2551)
					if ( ( option.selected || i === index ) &&

							// Don't return options that are disabled or in a disabled optgroup
							!option.disabled &&
							( !option.parentNode.disabled ||
								!nodeName( option.parentNode, "optgroup" ) ) ) {

						// Get the specific value for the option
						value = jQuery( option ).val();

						// We don't need an array for one selects
						if ( one ) {
							return value;
						}

						// Multi-Selects return an array
						values.push( value );
					}
				}

				return values;
			},

			set: function( elem, value ) {
				var optionSet, option,
					options = elem.options,
					values = jQuery.makeArray( value ),
					i = options.length;

				while ( i-- ) {
					option = options[ i ];

					/* eslint-disable no-cond-assign */

					if ( option.selected =
						jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
					) {
						optionSet = true;
					}

					/* eslint-enable no-cond-assign */
				}

				// Force browsers to behave consistently when non-matching value is set
				if ( !optionSet ) {
					elem.selectedIndex = -1;
				}
				return values;
			}
		}
	}
} );

// Radios and checkboxes getter/setter
jQuery.each( [ "radio", "checkbox" ], function() {
	jQuery.valHooks[ this ] = {
		set: function( elem, value ) {
			if ( Array.isArray( value ) ) {
				return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
			}
		}
	};
	if ( !support.checkOn ) {
		jQuery.valHooks[ this ].get = function( elem ) {
			return elem.getAttribute( "value" ) === null ? "on" : elem.value;
		};
	}
} );




// Return jQuery for attributes-only inclusion


support.focusin = "onfocusin" in window;


var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
	stopPropagationCallback = function( e ) {
		e.stopPropagation();
	};

jQuery.extend( jQuery.event, {

	trigger: function( event, data, elem, onlyHandlers ) {

		var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
			eventPath = [ elem || document ],
			type = hasOwn.call( event, "type" ) ? event.type : event,
			namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];

		cur = lastElement = tmp = elem = elem || document;

		// Don't do events on text and comment nodes
		if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
			return;
		}

		// focus/blur morphs to focusin/out; ensure we're not firing them right now
		if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
			return;
		}

		if ( type.indexOf( "." ) > -1 ) {

			// Namespaced trigger; create a regexp to match event type in handle()
			namespaces = type.split( "." );
			type = namespaces.shift();
			namespaces.sort();
		}
		ontype = type.indexOf( ":" ) < 0 && "on" + type;

		// Caller can pass in a jQuery.Event object, Object, or just an event type string
		event = event[ jQuery.expando ] ?
			event :
			new jQuery.Event( type, typeof event === "object" && event );

		// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
		event.isTrigger = onlyHandlers ? 2 : 3;
		event.namespace = namespaces.join( "." );
		event.rnamespace = event.namespace ?
			new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
			null;

		// Clean up the event in case it is being reused
		event.result = undefined;
		if ( !event.target ) {
			event.target = elem;
		}

		// Clone any incoming data and prepend the event, creating the handler arg list
		data = data == null ?
			[ event ] :
			jQuery.makeArray( data, [ event ] );

		// Allow special events to draw outside the lines
		special = jQuery.event.special[ type ] || {};
		if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
			return;
		}

		// Determine event propagation path in advance, per W3C events spec (#9951)
		// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
		if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {

			bubbleType = special.delegateType || type;
			if ( !rfocusMorph.test( bubbleType + type ) ) {
				cur = cur.parentNode;
			}
			for ( ; cur; cur = cur.parentNode ) {
				eventPath.push( cur );
				tmp = cur;
			}

			// Only add window if we got to document (e.g., not plain obj or detached DOM)
			if ( tmp === ( elem.ownerDocument || document ) ) {
				eventPath.push( tmp.defaultView || tmp.parentWindow || window );
			}
		}

		// Fire handlers on the event path
		i = 0;
		while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
			lastElement = cur;
			event.type = i > 1 ?
				bubbleType :
				special.bindType || type;

			// jQuery handler
			handle = (
					dataPriv.get( cur, "events" ) || Object.create( null )
				)[ event.type ] &&
				dataPriv.get( cur, "handle" );
			if ( handle ) {
				handle.apply( cur, data );
			}

			// Native handler
			handle = ontype && cur[ ontype ];
			if ( handle && handle.apply && acceptData( cur ) ) {
				event.result = handle.apply( cur, data );
				if ( event.result === false ) {
					event.preventDefault();
				}
			}
		}
		event.type = type;

		// If nobody prevented the default action, do it now
		if ( !onlyHandlers && !event.isDefaultPrevented() ) {

			if ( ( !special._default ||
				special._default.apply( eventPath.pop(), data ) === false ) &&
				acceptData( elem ) ) {

				// Call a native DOM method on the target with the same name as the event.
				// Don't do default actions on window, that's where global variables be (#6170)
				if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {

					// Don't re-trigger an onFOO event when we call its FOO() method
					tmp = elem[ ontype ];

					if ( tmp ) {
						elem[ ontype ] = null;
					}

					// Prevent re-triggering of the same event, since we already bubbled it above
					jQuery.event.triggered = type;

					if ( event.isPropagationStopped() ) {
						lastElement.addEventListener( type, stopPropagationCallback );
					}

					elem[ type ]();

					if ( event.isPropagationStopped() ) {
						lastElement.removeEventListener( type, stopPropagationCallback );
					}

					jQuery.event.triggered = undefined;

					if ( tmp ) {
						elem[ ontype ] = tmp;
					}
				}
			}
		}

		return event.result;
	},

	// Piggyback on a donor event to simulate a different one
	// Used only for `focus(in | out)` events
	simulate: function( type, elem, event ) {
		var e = jQuery.extend(
			new jQuery.Event(),
			event,
			{
				type: type,
				isSimulated: true
			}
		);

		jQuery.event.trigger( e, null, elem );
	}

} );

jQuery.fn.extend( {

	trigger: function( type, data ) {
		return this.each( function() {
			jQuery.event.trigger( type, data, this );
		} );
	},
	triggerHandler: function( type, data ) {
		var elem = this[ 0 ];
		if ( elem ) {
			return jQuery.event.trigger( type, data, elem, true );
		}
	}
} );


// Support: Firefox <=44
// Firefox doesn't have focus(in | out) events
// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
//
// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
// focus(in | out) events fire after focus & blur events,
// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
if ( !support.focusin ) {
	jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {

		// Attach a single capturing handler on the document while someone wants focusin/focusout
		var handler = function( event ) {
			jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
		};

		jQuery.event.special[ fix ] = {
			setup: function() {

				// Handle: regular nodes (via `this.ownerDocument`), window
				// (via `this.document`) & document (via `this`).
				var doc = this.ownerDocument || this.document || this,
					attaches = dataPriv.access( doc, fix );

				if ( !attaches ) {
					doc.addEventListener( orig, handler, true );
				}
				dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
			},
			teardown: function() {
				var doc = this.ownerDocument || this.document || this,
					attaches = dataPriv.access( doc, fix ) - 1;

				if ( !attaches ) {
					doc.removeEventListener( orig, handler, true );
					dataPriv.remove( doc, fix );

				} else {
					dataPriv.access( doc, fix, attaches );
				}
			}
		};
	} );
}
var location = window.location;

var nonce = { guid: Date.now() };

var rquery = ( /\?/ );



// Cross-browser xml parsing
jQuery.parseXML = function( data ) {
	var xml;
	if ( !data || typeof data !== "string" ) {
		return null;
	}

	// Support: IE 9 - 11 only
	// IE throws on parseFromString with invalid input.
	try {
		xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
	} catch ( e ) {
		xml = undefined;
	}

	if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
		jQuery.error( "Invalid XML: " + data );
	}
	return xml;
};


var
	rbracket = /\[\]$/,
	rCRLF = /\r?\n/g,
	rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
	rsubmittable = /^(?:input|select|textarea|keygen)/i;

function buildParams( prefix, obj, traditional, add ) {
	var name;

	if ( Array.isArray( obj ) ) {

		// Serialize array item.
		jQuery.each( obj, function( i, v ) {
			if ( traditional || rbracket.test( prefix ) ) {

				// Treat each array item as a scalar.
				add( prefix, v );

			} else {

				// Item is non-scalar (array or object), encode its numeric index.
				buildParams(
					prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
					v,
					traditional,
					add
				);
			}
		} );

	} else if ( !traditional && toType( obj ) === "object" ) {

		// Serialize object item.
		for ( name in obj ) {
			buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
		}

	} else {

		// Serialize scalar item.
		add( prefix, obj );
	}
}

// Serialize an array of form elements or a set of
// key/values into a query string
jQuery.param = function( a, traditional ) {
	var prefix,
		s = [],
		add = function( key, valueOrFunction ) {

			// If value is a function, invoke it and use its return value
			var value = isFunction( valueOrFunction ) ?
				valueOrFunction() :
				valueOrFunction;

			s[ s.length ] = encodeURIComponent( key ) + "=" +
				encodeURIComponent( value == null ? "" : value );
		};

	if ( a == null ) {
		return "";
	}

	// If an array was passed in, assume that it is an array of form elements.
	if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {

		// Serialize the form elements
		jQuery.each( a, function() {
			add( this.name, this.value );
		} );

	} else {

		// If traditional, encode the "old" way (the way 1.3.2 or older
		// did it), otherwise encode params recursively.
		for ( prefix in a ) {
			buildParams( prefix, a[ prefix ], traditional, add );
		}
	}

	// Return the resulting serialization
	return s.join( "&" );
};

jQuery.fn.extend( {
	serialize: function() {
		return jQuery.param( this.serializeArray() );
	},
	serializeArray: function() {
		return this.map( function() {

			// Can add propHook for "elements" to filter or add form elements
			var elements = jQuery.prop( this, "elements" );
			return elements ? jQuery.makeArray( elements ) : this;
		} )
		.filter( function() {
			var type = this.type;

			// Use .is( ":disabled" ) so that fieldset[disabled] works
			return this.name && !jQuery( this ).is( ":disabled" ) &&
				rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
				( this.checked || !rcheckableType.test( type ) );
		} )
		.map( function( _i, elem ) {
			var val = jQuery( this ).val();

			if ( val == null ) {
				return null;
			}

			if ( Array.isArray( val ) ) {
				return jQuery.map( val, function( val ) {
					return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
				} );
			}

			return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
		} ).get();
	}
} );


var
	r20 = /%20/g,
	rhash = /#.*$/,
	rantiCache = /([?&])_=[^&]*/,
	rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,

	// #7653, #8125, #8152: local protocol detection
	rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
	rnoContent = /^(?:GET|HEAD)$/,
	rprotocol = /^\/\//,

	/* Prefilters
	 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
	 * 2) These are called:
	 *    - BEFORE asking for a transport
	 *    - AFTER param serialization (s.data is a string if s.processData is true)
	 * 3) key is the dataType
	 * 4) the catchall symbol "*" can be used
	 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
	 */
	prefilters = {},

	/* Transports bindings
	 * 1) key is the dataType
	 * 2) the catchall symbol "*" can be used
	 * 3) selection will start with transport dataType and THEN go to "*" if needed
	 */
	transports = {},

	// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
	allTypes = "*/".concat( "*" ),

	// Anchor tag for parsing the document origin
	originAnchor = document.createElement( "a" );
	originAnchor.href = location.href;

// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {

	// dataTypeExpression is optional and defaults to "*"
	return function( dataTypeExpression, func ) {

		if ( typeof dataTypeExpression !== "string" ) {
			func = dataTypeExpression;
			dataTypeExpression = "*";
		}

		var dataType,
			i = 0,
			dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];

		if ( isFunction( func ) ) {

			// For each dataType in the dataTypeExpression
			while ( ( dataType = dataTypes[ i++ ] ) ) {

				// Prepend if requested
				if ( dataType[ 0 ] === "+" ) {
					dataType = dataType.slice( 1 ) || "*";
					( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );

				// Otherwise append
				} else {
					( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
				}
			}
		}
	};
}

// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {

	var inspected = {},
		seekingTransport = ( structure === transports );

	function inspect( dataType ) {
		var selected;
		inspected[ dataType ] = true;
		jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
			var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
			if ( typeof dataTypeOrTransport === "string" &&
				!seekingTransport && !inspected[ dataTypeOrTransport ] ) {

				options.dataTypes.unshift( dataTypeOrTransport );
				inspect( dataTypeOrTransport );
				return false;
			} else if ( seekingTransport ) {
				return !( selected = dataTypeOrTransport );
			}
		} );
		return selected;
	}

	return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
}

// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
	var key, deep,
		flatOptions = jQuery.ajaxSettings.flatOptions || {};

	for ( key in src ) {
		if ( src[ key ] !== undefined ) {
			( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
		}
	}
	if ( deep ) {
		jQuery.extend( true, target, deep );
	}

	return target;
}

/* Handles responses to an ajax request:
 * - finds the right dataType (mediates between content-type and expected dataType)
 * - returns the corresponding response
 */
function ajaxHandleResponses( s, jqXHR, responses ) {

	var ct, type, finalDataType, firstDataType,
		contents = s.contents,
		dataTypes = s.dataTypes;

	// Remove auto dataType and get content-type in the process
	while ( dataTypes[ 0 ] === "*" ) {
		dataTypes.shift();
		if ( ct === undefined ) {
			ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
		}
	}

	// Check if we're dealing with a known content-type
	if ( ct ) {
		for ( type in contents ) {
			if ( contents[ type ] && contents[ type ].test( ct ) ) {
				dataTypes.unshift( type );
				break;
			}
		}
	}

	// Check to see if we have a response for the expected dataType
	if ( dataTypes[ 0 ] in responses ) {
		finalDataType = dataTypes[ 0 ];
	} else {

		// Try convertible dataTypes
		for ( type in responses ) {
			if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
				finalDataType = type;
				break;
			}
			if ( !firstDataType ) {
				firstDataType = type;
			}
		}

		// Or just use first one
		finalDataType = finalDataType || firstDataType;
	}

	// If we found a dataType
	// We add the dataType to the list if needed
	// and return the corresponding response
	if ( finalDataType ) {
		if ( finalDataType !== dataTypes[ 0 ] ) {
			dataTypes.unshift( finalDataType );
		}
		return responses[ finalDataType ];
	}
}

/* Chain conversions given the request and the original response
 * Also sets the responseXXX fields on the jqXHR instance
 */
function ajaxConvert( s, response, jqXHR, isSuccess ) {
	var conv2, current, conv, tmp, prev,
		converters = {},

		// Work with a copy of dataTypes in case we need to modify it for conversion
		dataTypes = s.dataTypes.slice();

	// Create converters map with lowercased keys
	if ( dataTypes[ 1 ] ) {
		for ( conv in s.converters ) {
			converters[ conv.toLowerCase() ] = s.converters[ conv ];
		}
	}

	current = dataTypes.shift();

	// Convert to each sequential dataType
	while ( current ) {

		if ( s.responseFields[ current ] ) {
			jqXHR[ s.responseFields[ current ] ] = response;
		}

		// Apply the dataFilter if provided
		if ( !prev && isSuccess && s.dataFilter ) {
			response = s.dataFilter( response, s.dataType );
		}

		prev = current;
		current = dataTypes.shift();

		if ( current ) {

			// There's only work to do if current dataType is non-auto
			if ( current === "*" ) {

				current = prev;

			// Convert response if prev dataType is non-auto and differs from current
			} else if ( prev !== "*" && prev !== current ) {

				// Seek a direct converter
				conv = converters[ prev + " " + current ] || converters[ "* " + current ];

				// If none found, seek a pair
				if ( !conv ) {
					for ( conv2 in converters ) {

						// If conv2 outputs current
						tmp = conv2.split( " " );
						if ( tmp[ 1 ] === current ) {

							// If prev can be converted to accepted input
							conv = converters[ prev + " " + tmp[ 0 ] ] ||
								converters[ "* " + tmp[ 0 ] ];
							if ( conv ) {

								// Condense equivalence converters
								if ( conv === true ) {
									conv = converters[ conv2 ];

								// Otherwise, insert the intermediate dataType
								} else if ( converters[ conv2 ] !== true ) {
									current = tmp[ 0 ];
									dataTypes.unshift( tmp[ 1 ] );
								}
								break;
							}
						}
					}
				}

				// Apply converter (if not an equivalence)
				if ( conv !== true ) {

					// Unless errors are allowed to bubble, catch and return them
					if ( conv && s.throws ) {
						response = conv( response );
					} else {
						try {
							response = conv( response );
						} catch ( e ) {
							return {
								state: "parsererror",
								error: conv ? e : "No conversion from " + prev + " to " + current
							};
						}
					}
				}
			}
		}
	}

	return { state: "success", data: response };
}

jQuery.extend( {

	// Counter for holding the number of active queries
	active: 0,

	// Last-Modified header cache for next request
	lastModified: {},
	etag: {},

	ajaxSettings: {
		url: location.href,
		type: "GET",
		isLocal: rlocalProtocol.test( location.protocol ),
		global: true,
		processData: true,
		async: true,
		contentType: "application/x-www-form-urlencoded; charset=UTF-8",

		/*
		timeout: 0,
		data: null,
		dataType: null,
		username: null,
		password: null,
		cache: null,
		throws: false,
		traditional: false,
		headers: {},
		*/

		accepts: {
			"*": allTypes,
			text: "text/plain",
			html: "text/html",
			xml: "application/xml, text/xml",
			json: "application/json, text/javascript"
		},

		contents: {
			xml: /\bxml\b/,
			html: /\bhtml/,
			json: /\bjson\b/
		},

		responseFields: {
			xml: "responseXML",
			text: "responseText",
			json: "responseJSON"
		},

		// Data converters
		// Keys separate source (or catchall "*") and destination types with a single space
		converters: {

			// Convert anything to text
			"* text": String,

			// Text to html (true = no transformation)
			"text html": true,

			// Evaluate text as a json expression
			"text json": JSON.parse,

			// Parse text as xml
			"text xml": jQuery.parseXML
		},

		// For options that shouldn't be deep extended:
		// you can add your own custom options here if
		// and when you create one that shouldn't be
		// deep extended (see ajaxExtend)
		flatOptions: {
			url: true,
			context: true
		}
	},

	// Creates a full fledged settings object into target
	// with both ajaxSettings and settings fields.
	// If target is omitted, writes into ajaxSettings.
	ajaxSetup: function( target, settings ) {
		return settings ?

			// Building a settings object
			ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :

			// Extending ajaxSettings
			ajaxExtend( jQuery.ajaxSettings, target );
	},

	ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
	ajaxTransport: addToPrefiltersOrTransports( transports ),

	// Main method
	ajax: function( url, options ) {

		// If url is an object, simulate pre-1.5 signature
		if ( typeof url === "object" ) {
			options = url;
			url = undefined;
		}

		// Force options to be an object
		options = options || {};

		var transport,

			// URL without anti-cache param
			cacheURL,

			// Response headers
			responseHeadersString,
			responseHeaders,

			// timeout handle
			timeoutTimer,

			// Url cleanup var
			urlAnchor,

			// Request state (becomes false upon send and true upon completion)
			completed,

			// To know if global events are to be dispatched
			fireGlobals,

			// Loop variable
			i,

			// uncached part of the url
			uncached,

			// Create the final options object
			s = jQuery.ajaxSetup( {}, options ),

			// Callbacks context
			callbackContext = s.context || s,

			// Context for global events is callbackContext if it is a DOM node or jQuery collection
			globalEventContext = s.context &&
				( callbackContext.nodeType || callbackContext.jquery ) ?
					jQuery( callbackContext ) :
					jQuery.event,

			// Deferreds
			deferred = jQuery.Deferred(),
			completeDeferred = jQuery.Callbacks( "once memory" ),

			// Status-dependent callbacks
			statusCode = s.statusCode || {},

			// Headers (they are sent all at once)
			requestHeaders = {},
			requestHeadersNames = {},

			// Default abort message
			strAbort = "canceled",

			// Fake xhr
			jqXHR = {
				readyState: 0,

				// Builds headers hashtable if needed
				getResponseHeader: function( key ) {
					var match;
					if ( completed ) {
						if ( !responseHeaders ) {
							responseHeaders = {};
							while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
								responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
									( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
										.concat( match[ 2 ] );
							}
						}
						match = responseHeaders[ key.toLowerCase() + " " ];
					}
					return match == null ? null : match.join( ", " );
				},

				// Raw string
				getAllResponseHeaders: function() {
					return completed ? responseHeadersString : null;
				},

				// Caches the header
				setRequestHeader: function( name, value ) {
					if ( completed == null ) {
						name = requestHeadersNames[ name.toLowerCase() ] =
							requestHeadersNames[ name.toLowerCase() ] || name;
						requestHeaders[ name ] = value;
					}
					return this;
				},

				// Overrides response content-type header
				overrideMimeType: function( type ) {
					if ( completed == null ) {
						s.mimeType = type;
					}
					return this;
				},

				// Status-dependent callbacks
				statusCode: function( map ) {
					var code;
					if ( map ) {
						if ( completed ) {

							// Execute the appropriate callbacks
							jqXHR.always( map[ jqXHR.status ] );
						} else {

							// Lazy-add the new callbacks in a way that preserves old ones
							for ( code in map ) {
								statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
							}
						}
					}
					return this;
				},

				// Cancel the request
				abort: function( statusText ) {
					var finalText = statusText || strAbort;
					if ( transport ) {
						transport.abort( finalText );
					}
					done( 0, finalText );
					return this;
				}
			};

		// Attach deferreds
		deferred.promise( jqXHR );

		// Add protocol if not provided (prefilters might expect it)
		// Handle falsy url in the settings object (#10093: consistency with old signature)
		// We also use the url parameter if available
		s.url = ( ( url || s.url || location.href ) + "" )
			.replace( rprotocol, location.protocol + "//" );

		// Alias method option to type as per ticket #12004
		s.type = options.method || options.type || s.method || s.type;

		// Extract dataTypes list
		s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];

		// A cross-domain request is in order when the origin doesn't match the current origin.
		if ( s.crossDomain == null ) {
			urlAnchor = document.createElement( "a" );

			// Support: IE <=8 - 11, Edge 12 - 15
			// IE throws exception on accessing the href property if url is malformed,
			// e.g. http://example.com:80x/
			try {
				urlAnchor.href = s.url;

				// Support: IE <=8 - 11 only
				// Anchor's host property isn't correctly set when s.url is relative
				urlAnchor.href = urlAnchor.href;
				s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
					urlAnchor.protocol + "//" + urlAnchor.host;
			} catch ( e ) {

				// If there is an error parsing the URL, assume it is crossDomain,
				// it can be rejected by the transport if it is invalid
				s.crossDomain = true;
			}
		}

		// Convert data if not already a string
		if ( s.data && s.processData && typeof s.data !== "string" ) {
			s.data = jQuery.param( s.data, s.traditional );
		}

		// Apply prefilters
		inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );

		// If request was aborted inside a prefilter, stop there
		if ( completed ) {
			return jqXHR;
		}

		// We can fire global events as of now if asked to
		// Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
		fireGlobals = jQuery.event && s.global;

		// Watch for a new set of requests
		if ( fireGlobals && jQuery.active++ === 0 ) {
			jQuery.event.trigger( "ajaxStart" );
		}

		// Uppercase the type
		s.type = s.type.toUpperCase();

		// Determine if request has content
		s.hasContent = !rnoContent.test( s.type );

		// Save the URL in case we're toying with the If-Modified-Since
		// and/or If-None-Match header later on
		// Remove hash to simplify url manipulation
		cacheURL = s.url.replace( rhash, "" );

		// More options handling for requests with no content
		if ( !s.hasContent ) {

			// Remember the hash so we can put it back
			uncached = s.url.slice( cacheURL.length );

			// If data is available and should be processed, append data to url
			if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
				cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;

				// #9682: remove data so that it's not used in an eventual retry
				delete s.data;
			}

			// Add or update anti-cache param if needed
			if ( s.cache === false ) {
				cacheURL = cacheURL.replace( rantiCache, "$1" );
				uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +
					uncached;
			}

			// Put hash and anti-cache on the URL that will be requested (gh-1732)
			s.url = cacheURL + uncached;

		// Change '%20' to '+' if this is encoded form body content (gh-2658)
		} else if ( s.data && s.processData &&
			( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
			s.data = s.data.replace( r20, "+" );
		}

		// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
		if ( s.ifModified ) {
			if ( jQuery.lastModified[ cacheURL ] ) {
				jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
			}
			if ( jQuery.etag[ cacheURL ] ) {
				jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
			}
		}

		// Set the correct header, if data is being sent
		if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
			jqXHR.setRequestHeader( "Content-Type", s.contentType );
		}

		// Set the Accepts header for the server, depending on the dataType
		jqXHR.setRequestHeader(
			"Accept",
			s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
				s.accepts[ s.dataTypes[ 0 ] ] +
					( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
				s.accepts[ "*" ]
		);

		// Check for headers option
		for ( i in s.headers ) {
			jqXHR.setRequestHeader( i, s.headers[ i ] );
		}

		// Allow custom headers/mimetypes and early abort
		if ( s.beforeSend &&
			( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {

			// Abort if not done already and return
			return jqXHR.abort();
		}

		// Aborting is no longer a cancellation
		strAbort = "abort";

		// Install callbacks on deferreds
		completeDeferred.add( s.complete );
		jqXHR.done( s.success );
		jqXHR.fail( s.error );

		// Get transport
		transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );

		// If no transport, we auto-abort
		if ( !transport ) {
			done( -1, "No Transport" );
		} else {
			jqXHR.readyState = 1;

			// Send global event
			if ( fireGlobals ) {
				globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
			}

			// If request was aborted inside ajaxSend, stop there
			if ( completed ) {
				return jqXHR;
			}

			// Timeout
			if ( s.async && s.timeout > 0 ) {
				timeoutTimer = window.setTimeout( function() {
					jqXHR.abort( "timeout" );
				}, s.timeout );
			}

			try {
				completed = false;
				transport.send( requestHeaders, done );
			} catch ( e ) {

				// Rethrow post-completion exceptions
				if ( completed ) {
					throw e;
				}

				// Propagate others as results
				done( -1, e );
			}
		}

		// Callback for when everything is done
		function done( status, nativeStatusText, responses, headers ) {
			var isSuccess, success, error, response, modified,
				statusText = nativeStatusText;

			// Ignore repeat invocations
			if ( completed ) {
				return;
			}

			completed = true;

			// Clear timeout if it exists
			if ( timeoutTimer ) {
				window.clearTimeout( timeoutTimer );
			}

			// Dereference transport for early garbage collection
			// (no matter how long the jqXHR object will be used)
			transport = undefined;

			// Cache response headers
			responseHeadersString = headers || "";

			// Set readyState
			jqXHR.readyState = status > 0 ? 4 : 0;

			// Determine if successful
			isSuccess = status >= 200 && status < 300 || status === 304;

			// Get response data
			if ( responses ) {
				response = ajaxHandleResponses( s, jqXHR, responses );
			}

			// Use a noop converter for missing script
			if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) {
				s.converters[ "text script" ] = function() {};
			}

			// Convert no matter what (that way responseXXX fields are always set)
			response = ajaxConvert( s, response, jqXHR, isSuccess );

			// If successful, handle type chaining
			if ( isSuccess ) {

				// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
				if ( s.ifModified ) {
					modified = jqXHR.getResponseHeader( "Last-Modified" );
					if ( modified ) {
						jQuery.lastModified[ cacheURL ] = modified;
					}
					modified = jqXHR.getResponseHeader( "etag" );
					if ( modified ) {
						jQuery.etag[ cacheURL ] = modified;
					}
				}

				// if no content
				if ( status === 204 || s.type === "HEAD" ) {
					statusText = "nocontent";

				// if not modified
				} else if ( status === 304 ) {
					statusText = "notmodified";

				// If we have data, let's convert it
				} else {
					statusText = response.state;
					success = response.data;
					error = response.error;
					isSuccess = !error;
				}
			} else {

				// Extract error from statusText and normalize for non-aborts
				error = statusText;
				if ( status || !statusText ) {
					statusText = "error";
					if ( status < 0 ) {
						status = 0;
					}
				}
			}

			// Set data for the fake xhr object
			jqXHR.status = status;
			jqXHR.statusText = ( nativeStatusText || statusText ) + "";

			// Success/Error
			if ( isSuccess ) {
				deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
			} else {
				deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
			}

			// Status-dependent callbacks
			jqXHR.statusCode( statusCode );
			statusCode = undefined;

			if ( fireGlobals ) {
				globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
					[ jqXHR, s, isSuccess ? success : error ] );
			}

			// Complete
			completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );

			if ( fireGlobals ) {
				globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );

				// Handle the global AJAX counter
				if ( !( --jQuery.active ) ) {
					jQuery.event.trigger( "ajaxStop" );
				}
			}
		}

		return jqXHR;
	},

	getJSON: function( url, data, callback ) {
		return jQuery.get( url, data, callback, "json" );
	},

	getScript: function( url, callback ) {
		return jQuery.get( url, undefined, callback, "script" );
	}
} );

jQuery.each( [ "get", "post" ], function( _i, method ) {
	jQuery[ method ] = function( url, data, callback, type ) {

		// Shift arguments if data argument was omitted
		if ( isFunction( data ) ) {
			type = type || callback;
			callback = data;
			data = undefined;
		}

		// The url can be an options object (which then must have .url)
		return jQuery.ajax( jQuery.extend( {
			url: url,
			type: method,
			dataType: type,
			data: data,
			success: callback
		}, jQuery.isPlainObject( url ) && url ) );
	};
} );

jQuery.ajaxPrefilter( function( s ) {
	var i;
	for ( i in s.headers ) {
		if ( i.toLowerCase() === "content-type" ) {
			s.contentType = s.headers[ i ] || "";
		}
	}
} );


jQuery._evalUrl = function( url, options, doc ) {
	return jQuery.ajax( {
		url: url,

		// Make this explicit, since user can override this through ajaxSetup (#11264)
		type: "GET",
		dataType: "script",
		cache: true,
		async: false,
		global: false,

		// Only evaluate the response if it is successful (gh-4126)
		// dataFilter is not invoked for failure responses, so using it instead
		// of the default converter is kludgy but it works.
		converters: {
			"text script": function() {}
		},
		dataFilter: function( response ) {
			jQuery.globalEval( response, options, doc );
		}
	} );
};


jQuery.fn.extend( {
	wrapAll: function( html ) {
		var wrap;

		if ( this[ 0 ] ) {
			if ( isFunction( html ) ) {
				html = html.call( this[ 0 ] );
			}

			// The elements to wrap the target around
			wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );

			if ( this[ 0 ].parentNode ) {
				wrap.insertBefore( this[ 0 ] );
			}

			wrap.map( function() {
				var elem = this;

				while ( elem.firstElementChild ) {
					elem = elem.firstElementChild;
				}

				return elem;
			} ).append( this );
		}

		return this;
	},

	wrapInner: function( html ) {
		if ( isFunction( html ) ) {
			return this.each( function( i ) {
				jQuery( this ).wrapInner( html.call( this, i ) );
			} );
		}

		return this.each( function() {
			var self = jQuery( this ),
				contents = self.contents();

			if ( contents.length ) {
				contents.wrapAll( html );

			} else {
				self.append( html );
			}
		} );
	},

	wrap: function( html ) {
		var htmlIsFunction = isFunction( html );

		return this.each( function( i ) {
			jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
		} );
	},

	unwrap: function( selector ) {
		this.parent( selector ).not( "body" ).each( function() {
			jQuery( this ).replaceWith( this.childNodes );
		} );
		return this;
	}
} );


jQuery.expr.pseudos.hidden = function( elem ) {
	return !jQuery.expr.pseudos.visible( elem );
};
jQuery.expr.pseudos.visible = function( elem ) {
	return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
};




jQuery.ajaxSettings.xhr = function() {
	try {
		return new window.XMLHttpRequest();
	} catch ( e ) {}
};

var xhrSuccessStatus = {

		// File protocol always yields status code 0, assume 200
		0: 200,

		// Support: IE <=9 only
		// #1450: sometimes IE returns 1223 when it should be 204
		1223: 204
	},
	xhrSupported = jQuery.ajaxSettings.xhr();

support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
support.ajax = xhrSupported = !!xhrSupported;

jQuery.ajaxTransport( function( options ) {
	var callback, errorCallback;

	// Cross domain only allowed if supported through XMLHttpRequest
	if ( support.cors || xhrSupported && !options.crossDomain ) {
		return {
			send: function( headers, complete ) {
				var i,
					xhr = options.xhr();

				xhr.open(
					options.type,
					options.url,
					options.async,
					options.username,
					options.password
				);

				// Apply custom fields if provided
				if ( options.xhrFields ) {
					for ( i in options.xhrFields ) {
						xhr[ i ] = options.xhrFields[ i ];
					}
				}

				// Override mime type if needed
				if ( options.mimeType && xhr.overrideMimeType ) {
					xhr.overrideMimeType( options.mimeType );
				}

				// X-Requested-With header
				// For cross-domain requests, seeing as conditions for a preflight are
				// akin to a jigsaw puzzle, we simply never set it to be sure.
				// (it can always be set on a per-request basis or even using ajaxSetup)
				// For same-domain requests, won't change header if already provided.
				if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
					headers[ "X-Requested-With" ] = "XMLHttpRequest";
				}

				// Set headers
				for ( i in headers ) {
					xhr.setRequestHeader( i, headers[ i ] );
				}

				// Callback
				callback = function( type ) {
					return function() {
						if ( callback ) {
							callback = errorCallback = xhr.onload =
								xhr.onerror = xhr.onabort = xhr.ontimeout =
									xhr.onreadystatechange = null;

							if ( type === "abort" ) {
								xhr.abort();
							} else if ( type === "error" ) {

								// Support: IE <=9 only
								// On a manual native abort, IE9 throws
								// errors on any property access that is not readyState
								if ( typeof xhr.status !== "number" ) {
									complete( 0, "error" );
								} else {
									complete(

										// File: protocol always yields status 0; see #8605, #14207
										xhr.status,
										xhr.statusText
									);
								}
							} else {
								complete(
									xhrSuccessStatus[ xhr.status ] || xhr.status,
									xhr.statusText,

									// Support: IE <=9 only
									// IE9 has no XHR2 but throws on binary (trac-11426)
									// For XHR2 non-text, let the caller handle it (gh-2498)
									( xhr.responseType || "text" ) !== "text"  ||
									typeof xhr.responseText !== "string" ?
										{ binary: xhr.response } :
										{ text: xhr.responseText },
									xhr.getAllResponseHeaders()
								);
							}
						}
					};
				};

				// Listen to events
				xhr.onload = callback();
				errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );

				// Support: IE 9 only
				// Use onreadystatechange to replace onabort
				// to handle uncaught aborts
				if ( xhr.onabort !== undefined ) {
					xhr.onabort = errorCallback;
				} else {
					xhr.onreadystatechange = function() {

						// Check readyState before timeout as it changes
						if ( xhr.readyState === 4 ) {

							// Allow onerror to be called first,
							// but that will not handle a native abort
							// Also, save errorCallback to a variable
							// as xhr.onerror cannot be accessed
							window.setTimeout( function() {
								if ( callback ) {
									errorCallback();
								}
							} );
						}
					};
				}

				// Create the abort callback
				callback = callback( "abort" );

				try {

					// Do send the request (this may raise an exception)
					xhr.send( options.hasContent && options.data || null );
				} catch ( e ) {

					// #14683: Only rethrow if this hasn't been notified as an error yet
					if ( callback ) {
						throw e;
					}
				}
			},

			abort: function() {
				if ( callback ) {
					callback();
				}
			}
		};
	}
} );




// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
jQuery.ajaxPrefilter( function( s ) {
	if ( s.crossDomain ) {
		s.contents.script = false;
	}
} );

// Install script dataType
jQuery.ajaxSetup( {
	accepts: {
		script: "text/javascript, application/javascript, " +
			"application/ecmascript, application/x-ecmascript"
	},
	contents: {
		script: /\b(?:java|ecma)script\b/
	},
	converters: {
		"text script": function( text ) {
			jQuery.globalEval( text );
			return text;
		}
	}
} );

// Handle cache's special case and crossDomain
jQuery.ajaxPrefilter( "script", function( s ) {
	if ( s.cache === undefined ) {
		s.cache = false;
	}
	if ( s.crossDomain ) {
		s.type = "GET";
	}
} );

// Bind script tag hack transport
jQuery.ajaxTransport( "script", function( s ) {

	// This transport only deals with cross domain or forced-by-attrs requests
	if ( s.crossDomain || s.scriptAttrs ) {
		var script, callback;
		return {
			send: function( _, complete ) {
				script = jQuery( "<script>" )
					.attr( s.scriptAttrs || {} )
					.prop( { charset: s.scriptCharset, src: s.url } )
					.on( "load error", callback = function( evt ) {
						script.remove();
						callback = null;
						if ( evt ) {
							complete( evt.type === "error" ? 404 : 200, evt.type );
						}
					} );

				// Use native DOM manipulation to avoid our domManip AJAX trickery
				document.head.appendChild( script[ 0 ] );
			},
			abort: function() {
				if ( callback ) {
					callback();
				}
			}
		};
	}
} );




var oldCallbacks = [],
	rjsonp = /(=)\?(?=&|$)|\?\?/;

// Default jsonp settings
jQuery.ajaxSetup( {
	jsonp: "callback",
	jsonpCallback: function() {
		var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) );
		this[ callback ] = true;
		return callback;
	}
} );

// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {

	var callbackName, overwritten, responseContainer,
		jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
			"url" :
			typeof s.data === "string" &&
				( s.contentType || "" )
					.indexOf( "application/x-www-form-urlencoded" ) === 0 &&
				rjsonp.test( s.data ) && "data"
		);

	// Handle iff the expected data type is "jsonp" or we have a parameter to set
	if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {

		// Get callback name, remembering preexisting value associated with it
		callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
			s.jsonpCallback() :
			s.jsonpCallback;

		// Insert callback into url or form data
		if ( jsonProp ) {
			s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
		} else if ( s.jsonp !== false ) {
			s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
		}

		// Use data converter to retrieve json after script execution
		s.converters[ "script json" ] = function() {
			if ( !responseContainer ) {
				jQuery.error( callbackName + " was not called" );
			}
			return responseContainer[ 0 ];
		};

		// Force json dataType
		s.dataTypes[ 0 ] = "json";

		// Install callback
		overwritten = window[ callbackName ];
		window[ callbackName ] = function() {
			responseContainer = arguments;
		};

		// Clean-up function (fires after converters)
		jqXHR.always( function() {

			// If previous value didn't exist - remove it
			if ( overwritten === undefined ) {
				jQuery( window ).removeProp( callbackName );

			// Otherwise restore preexisting value
			} else {
				window[ callbackName ] = overwritten;
			}

			// Save back as free
			if ( s[ callbackName ] ) {

				// Make sure that re-using the options doesn't screw things around
				s.jsonpCallback = originalSettings.jsonpCallback;

				// Save the callback name for future use
				oldCallbacks.push( callbackName );
			}

			// Call if it was a function and we have a response
			if ( responseContainer && isFunction( overwritten ) ) {
				overwritten( responseContainer[ 0 ] );
			}

			responseContainer = overwritten = undefined;
		} );

		// Delegate to script
		return "script";
	}
} );




// Support: Safari 8 only
// In Safari 8 documents created via document.implementation.createHTMLDocument
// collapse sibling forms: the second one becomes a child of the first one.
// Because of that, this security measure has to be disabled in Safari 8.
// https://bugs.webkit.org/show_bug.cgi?id=137337
support.createHTMLDocument = ( function() {
	var body = document.implementation.createHTMLDocument( "" ).body;
	body.innerHTML = "<form></form><form></form>";
	return body.childNodes.length === 2;
} )();


// Argument "data" should be string of html
// context (optional): If specified, the fragment will be created in this context,
// defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string
jQuery.parseHTML = function( data, context, keepScripts ) {
	if ( typeof data !== "string" ) {
		return [];
	}
	if ( typeof context === "boolean" ) {
		keepScripts = context;
		context = false;
	}

	var base, parsed, scripts;

	if ( !context ) {

		// Stop scripts or inline event handlers from being executed immediately
		// by using document.implementation
		if ( support.createHTMLDocument ) {
			context = document.implementation.createHTMLDocument( "" );

			// Set the base href for the created document
			// so any parsed elements with URLs
			// are based on the document's URL (gh-2965)
			base = context.createElement( "base" );
			base.href = document.location.href;
			context.head.appendChild( base );
		} else {
			context = document;
		}
	}

	parsed = rsingleTag.exec( data );
	scripts = !keepScripts && [];

	// Single tag
	if ( parsed ) {
		return [ context.createElement( parsed[ 1 ] ) ];
	}

	parsed = buildFragment( [ data ], context, scripts );

	if ( scripts && scripts.length ) {
		jQuery( scripts ).remove();
	}

	return jQuery.merge( [], parsed.childNodes );
};


/**
 * Load a url into a page
 */
jQuery.fn.load = function( url, params, callback ) {
	var selector, type, response,
		self = this,
		off = url.indexOf( " " );

	if ( off > -1 ) {
		selector = stripAndCollapse( url.slice( off ) );
		url = url.slice( 0, off );
	}

	// If it's a function
	if ( isFunction( params ) ) {

		// We assume that it's the callback
		callback = params;
		params = undefined;

	// Otherwise, build a param string
	} else if ( params && typeof params === "object" ) {
		type = "POST";
	}

	// If we have elements to modify, make the request
	if ( self.length > 0 ) {
		jQuery.ajax( {
			url: url,

			// If "type" variable is undefined, then "GET" method will be used.
			// Make value of this field explicit since
			// user can override it through ajaxSetup method
			type: type || "GET",
			dataType: "html",
			data: params
		} ).done( function( responseText ) {

			// Save response for use in complete callback
			response = arguments;

			self.html( selector ?

				// If a selector was specified, locate the right elements in a dummy div
				// Exclude scripts to avoid IE 'Permission Denied' errors
				jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :

				// Otherwise use the full result
				responseText );

		// If the request succeeds, this function gets "data", "status", "jqXHR"
		// but they are ignored because response was set above.
		// If it fails, this function gets "jqXHR", "status", "error"
		} ).always( callback && function( jqXHR, status ) {
			self.each( function() {
				callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
			} );
		} );
	}

	return this;
};




jQuery.expr.pseudos.animated = function( elem ) {
	return jQuery.grep( jQuery.timers, function( fn ) {
		return elem === fn.elem;
	} ).length;
};




jQuery.offset = {
	setOffset: function( elem, options, i ) {
		var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
			position = jQuery.css( elem, "position" ),
			curElem = jQuery( elem ),
			props = {};

		// Set position first, in-case top/left are set even on static elem
		if ( position === "static" ) {
			elem.style.position = "relative";
		}

		curOffset = curElem.offset();
		curCSSTop = jQuery.css( elem, "top" );
		curCSSLeft = jQuery.css( elem, "left" );
		calculatePosition = ( position === "absolute" || position === "fixed" ) &&
			( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;

		// Need to be able to calculate position if either
		// top or left is auto and position is either absolute or fixed
		if ( calculatePosition ) {
			curPosition = curElem.position();
			curTop = curPosition.top;
			curLeft = curPosition.left;

		} else {
			curTop = parseFloat( curCSSTop ) || 0;
			curLeft = parseFloat( curCSSLeft ) || 0;
		}

		if ( isFunction( options ) ) {

			// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
			options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
		}

		if ( options.top != null ) {
			props.top = ( options.top - curOffset.top ) + curTop;
		}
		if ( options.left != null ) {
			props.left = ( options.left - curOffset.left ) + curLeft;
		}

		if ( "using" in options ) {
			options.using.call( elem, props );

		} else {
			if ( typeof props.top === "number" ) {
				props.top += "px";
			}
			if ( typeof props.left === "number" ) {
				props.left += "px";
			}
			curElem.css( props );
		}
	}
};

jQuery.fn.extend( {

	// offset() relates an element's border box to the document origin
	offset: function( options ) {

		// Preserve chaining for setter
		if ( arguments.length ) {
			return options === undefined ?
				this :
				this.each( function( i ) {
					jQuery.offset.setOffset( this, options, i );
				} );
		}

		var rect, win,
			elem = this[ 0 ];

		if ( !elem ) {
			return;
		}

		// Return zeros for disconnected and hidden (display: none) elements (gh-2310)
		// Support: IE <=11 only
		// Running getBoundingClientRect on a
		// disconnected node in IE throws an error
		if ( !elem.getClientRects().length ) {
			return { top: 0, left: 0 };
		}

		// Get document-relative position by adding viewport scroll to viewport-relative gBCR
		rect = elem.getBoundingClientRect();
		win = elem.ownerDocument.defaultView;
		return {
			top: rect.top + win.pageYOffset,
			left: rect.left + win.pageXOffset
		};
	},

	// position() relates an element's margin box to its offset parent's padding box
	// This corresponds to the behavior of CSS absolute positioning
	position: function() {
		if ( !this[ 0 ] ) {
			return;
		}

		var offsetParent, offset, doc,
			elem = this[ 0 ],
			parentOffset = { top: 0, left: 0 };

		// position:fixed elements are offset from the viewport, which itself always has zero offset
		if ( jQuery.css( elem, "position" ) === "fixed" ) {

			// Assume position:fixed implies availability of getBoundingClientRect
			offset = elem.getBoundingClientRect();

		} else {
			offset = this.offset();

			// Account for the *real* offset parent, which can be the document or its root element
			// when a statically positioned element is identified
			doc = elem.ownerDocument;
			offsetParent = elem.offsetParent || doc.documentElement;
			while ( offsetParent &&
				( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
				jQuery.css( offsetParent, "position" ) === "static" ) {

				offsetParent = offsetParent.parentNode;
			}
			if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {

				// Incorporate borders into its offset, since they are outside its content origin
				parentOffset = jQuery( offsetParent ).offset();
				parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
				parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
			}
		}

		// Subtract parent offsets and element margins
		return {
			top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
			left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
		};
	},

	// This method will return documentElement in the following cases:
	// 1) For the element inside the iframe without offsetParent, this method will return
	//    documentElement of the parent window
	// 2) For the hidden or detached element
	// 3) For body or html element, i.e. in case of the html node - it will return itself
	//
	// but those exceptions were never presented as a real life use-cases
	// and might be considered as more preferable results.
	//
	// This logic, however, is not guaranteed and can change at any point in the future
	offsetParent: function() {
		return this.map( function() {
			var offsetParent = this.offsetParent;

			while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
				offsetParent = offsetParent.offsetParent;
			}

			return offsetParent || documentElement;
		} );
	}
} );

// Create scrollLeft and scrollTop methods
jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
	var top = "pageYOffset" === prop;

	jQuery.fn[ method ] = function( val ) {
		return access( this, function( elem, method, val ) {

			// Coalesce documents and windows
			var win;
			if ( isWindow( elem ) ) {
				win = elem;
			} else if ( elem.nodeType === 9 ) {
				win = elem.defaultView;
			}

			if ( val === undefined ) {
				return win ? win[ prop ] : elem[ method ];
			}

			if ( win ) {
				win.scrollTo(
					!top ? val : win.pageXOffset,
					top ? val : win.pageYOffset
				);

			} else {
				elem[ method ] = val;
			}
		}, method, val, arguments.length );
	};
} );

// Support: Safari <=7 - 9.1, Chrome <=37 - 49
// Add the top/left cssHooks using jQuery.fn.position
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
// getComputedStyle returns percent when specified for top/left/bottom/right;
// rather than make the css module depend on the offset module, just check for it here
jQuery.each( [ "top", "left" ], function( _i, prop ) {
	jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
		function( elem, computed ) {
			if ( computed ) {
				computed = curCSS( elem, prop );

				// If curCSS returns percentage, fallback to offset
				return rnumnonpx.test( computed ) ?
					jQuery( elem ).position()[ prop ] + "px" :
					computed;
			}
		}
	);
} );


// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
	jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
		function( defaultExtra, funcName ) {

		// Margin is only for outerHeight, outerWidth
		jQuery.fn[ funcName ] = function( margin, value ) {
			var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
				extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );

			return access( this, function( elem, type, value ) {
				var doc;

				if ( isWindow( elem ) ) {

					// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
					return funcName.indexOf( "outer" ) === 0 ?
						elem[ "inner" + name ] :
						elem.document.documentElement[ "client" + name ];
				}

				// Get document width or height
				if ( elem.nodeType === 9 ) {
					doc = elem.documentElement;

					// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
					// whichever is greatest
					return Math.max(
						elem.body[ "scroll" + name ], doc[ "scroll" + name ],
						elem.body[ "offset" + name ], doc[ "offset" + name ],
						doc[ "client" + name ]
					);
				}

				return value === undefined ?

					// Get width or height on the element, requesting but not forcing parseFloat
					jQuery.css( elem, type, extra ) :

					// Set width or height on the element
					jQuery.style( elem, type, value, extra );
			}, type, chainable ? margin : undefined, chainable );
		};
	} );
} );


jQuery.each( [
	"ajaxStart",
	"ajaxStop",
	"ajaxComplete",
	"ajaxError",
	"ajaxSuccess",
	"ajaxSend"
], function( _i, type ) {
	jQuery.fn[ type ] = function( fn ) {
		return this.on( type, fn );
	};
} );




jQuery.fn.extend( {

	bind: function( types, data, fn ) {
		return this.on( types, null, data, fn );
	},
	unbind: function( types, fn ) {
		return this.off( types, null, fn );
	},

	delegate: function( selector, types, data, fn ) {
		return this.on( types, selector, data, fn );
	},
	undelegate: function( selector, types, fn ) {

		// ( namespace ) or ( selector, types [, fn] )
		return arguments.length === 1 ?
			this.off( selector, "**" ) :
			this.off( types, selector || "**", fn );
	},

	hover: function( fnOver, fnOut ) {
		return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
	}
} );

jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
	"change select submit keydown keypress keyup contextmenu" ).split( " " ),
	function( _i, name ) {

		// Handle event binding
		jQuery.fn[ name ] = function( data, fn ) {
			return arguments.length > 0 ?
				this.on( name, null, data, fn ) :
				this.trigger( name );
		};
	} );




// Support: Android <=4.0 only
// Make sure we trim BOM and NBSP
var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;

// Bind a function to a context, optionally partially applying any
// arguments.
// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
// However, it is not slated for removal any time soon
jQuery.proxy = function( fn, context ) {
	var tmp, args, proxy;

	if ( typeof context === "string" ) {
		tmp = fn[ context ];
		context = fn;
		fn = tmp;
	}

	// Quick check to determine if target is callable, in the spec
	// this throws a TypeError, but we will just return undefined.
	if ( !isFunction( fn ) ) {
		return undefined;
	}

	// Simulated bind
	args = slice.call( arguments, 2 );
	proxy = function() {
		return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
	};

	// Set the guid of unique handler to the same of original handler, so it can be removed
	proxy.guid = fn.guid = fn.guid || jQuery.guid++;

	return proxy;
};

jQuery.holdReady = function( hold ) {
	if ( hold ) {
		jQuery.readyWait++;
	} else {
		jQuery.ready( true );
	}
};
jQuery.isArray = Array.isArray;
jQuery.parseJSON = JSON.parse;
jQuery.nodeName = nodeName;
jQuery.isFunction = isFunction;
jQuery.isWindow = isWindow;
jQuery.camelCase = camelCase;
jQuery.type = toType;

jQuery.now = Date.now;

jQuery.isNumeric = function( obj ) {

	// As of jQuery 3.0, isNumeric is limited to
	// strings and numbers (primitives or objects)
	// that can be coerced to finite numbers (gh-2662)
	var type = jQuery.type( obj );
	return ( type === "number" || type === "string" ) &&

		// parseFloat NaNs numeric-cast false positives ("")
		// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
		// subtraction forces infinities to NaN
		!isNaN( obj - parseFloat( obj ) );
};

jQuery.trim = function( text ) {
	return text == null ?
		"" :
		( text + "" ).replace( rtrim, "" );
};



// Register as a named AMD module, since jQuery can be concatenated with other
// files that may use define, but not via a proper concatenation script that
// understands anonymous AMD modules. A named AMD is safest and most robust
// way to register. Lowercase jquery is used because AMD module names are
// derived from file names, and jQuery is normally delivered in a lowercase
// file name. Do this after creating the global so that if an AMD module wants
// to call noConflict to hide this version of jQuery, it will work.

// Note that for maximum portability, libraries that are not jQuery should
// declare themselves as anonymous modules, and avoid setting a global if an
// AMD loader is present. jQuery is a special case. For more information, see
// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon

if ( typeof define === "function" && define.amd ) {
	define( "jquery", [], function() {
		return jQuery;
	} );
}




var

	// Map over jQuery in case of overwrite
	_jQuery = window.jQuery,

	// Map over the $ in case of overwrite
	_$ = window.$;

jQuery.noConflict = function( deep ) {
	if ( window.$ === jQuery ) {
		window.$ = _$;
	}

	if ( deep && window.jQuery === jQuery ) {
		window.jQuery = _jQuery;
	}

	return jQuery;
};

// Expose jQuery and $ identifiers, even in AMD
// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
// and CommonJS for browser emulators (#13566)
if ( typeof noGlobal === "undefined" ) {
	window.jQuery = window.$ = jQuery;
}




return jQuery;
} );

define('jqueryNoConflict', ['jquery'], function ($) {
    return $.noConflict();
});

//     Underscore.js 1.8.3
//     http://underscorejs.org
//     (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//     Underscore may be freely distributed under the MIT license.

(function() {

  // Baseline setup
  // --------------

  // Establish the root object, `window` in the browser, or `exports` on the server.
  var root = this;

  // Save the previous value of the `_` variable.
  var previousUnderscore = root._;

  // Save bytes in the minified (but not gzipped) version:
  var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;

  // Create quick reference variables for speed access to core prototypes.
  var
    push             = ArrayProto.push,
    slice            = ArrayProto.slice,
    toString         = ObjProto.toString,
    hasOwnProperty   = ObjProto.hasOwnProperty;

  // All **ECMAScript 5** native function implementations that we hope to use
  // are declared here.
  var
    nativeIsArray      = Array.isArray,
    nativeKeys         = Object.keys,
    nativeBind         = FuncProto.bind,
    nativeCreate       = Object.create;

  // Naked function reference for surrogate-prototype-swapping.
  var Ctor = function(){};

  // Create a safe reference to the Underscore object for use below.
  var _ = function(obj) {
    if (obj instanceof _) return obj;
    if (!(this instanceof _)) return new _(obj);
    this._wrapped = obj;
  };

  // Export the Underscore object for **Node.js**, with
  // backwards-compatibility for the old `require()` API. If we're in
  // the browser, add `_` as a global object.
  if (typeof exports !== 'undefined') {
    if (typeof module !== 'undefined' && module.exports) {
      exports = module.exports = _;
    }
    exports._ = _;
  } else {
    root._ = _;
  }

  // Current version.
  _.VERSION = '1.8.3';

  // Internal function that returns an efficient (for current engines) version
  // of the passed-in callback, to be repeatedly applied in other Underscore
  // functions.
  var optimizeCb = function(func, context, argCount) {
    if (context === void 0) return func;
    switch (argCount == null ? 3 : argCount) {
      case 1: return function(value) {
        return func.call(context, value);
      };
      case 2: return function(value, other) {
        return func.call(context, value, other);
      };
      case 3: return function(value, index, collection) {
        return func.call(context, value, index, collection);
      };
      case 4: return function(accumulator, value, index, collection) {
        return func.call(context, accumulator, value, index, collection);
      };
    }
    return function() {
      return func.apply(context, arguments);
    };
  };

  // A mostly-internal function to generate callbacks that can be applied
  // to each element in a collection, returning the desired result — either
  // identity, an arbitrary callback, a property matcher, or a property accessor.
  var cb = function(value, context, argCount) {
    if (value == null) return _.identity;
    if (_.isFunction(value)) return optimizeCb(value, context, argCount);
    if (_.isObject(value)) return _.matcher(value);
    return _.property(value);
  };
  _.iteratee = function(value, context) {
    return cb(value, context, Infinity);
  };

  // An internal function for creating assigner functions.
  var createAssigner = function(keysFunc, undefinedOnly) {
    return function(obj) {
      var length = arguments.length;
      if (length < 2 || obj == null) return obj;
      for (var index = 1; index < length; index++) {
        var source = arguments[index],
            keys = keysFunc(source),
            l = keys.length;
        for (var i = 0; i < l; i++) {
          var key = keys[i];
          if (!undefinedOnly || obj[key] === void 0) obj[key] = source[key];
        }
      }
      return obj;
    };
  };

  // An internal function for creating a new object that inherits from another.
  var baseCreate = function(prototype) {
    if (!_.isObject(prototype)) return {};
    if (nativeCreate) return nativeCreate(prototype);
    Ctor.prototype = prototype;
    var result = new Ctor;
    Ctor.prototype = null;
    return result;
  };

  var property = function(key) {
    return function(obj) {
      return obj == null ? void 0 : obj[key];
    };
  };

  // Helper for collection methods to determine whether a collection
  // should be iterated as an array or as an object
  // Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength
  // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094
  var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;
  var getLength = property('length');
  var isArrayLike = function(collection) {
    var length = getLength(collection);
    return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX;
  };

  // Collection Functions
  // --------------------

  // The cornerstone, an `each` implementation, aka `forEach`.
  // Handles raw objects in addition to array-likes. Treats all
  // sparse array-likes as if they were dense.
  _.each = _.forEach = function(obj, iteratee, context) {
    iteratee = optimizeCb(iteratee, context);
    var i, length;
    if (isArrayLike(obj)) {
      for (i = 0, length = obj.length; i < length; i++) {
        iteratee(obj[i], i, obj);
      }
    } else {
      var keys = _.keys(obj);
      for (i = 0, length = keys.length; i < length; i++) {
        iteratee(obj[keys[i]], keys[i], obj);
      }
    }
    return obj;
  };

  // Return the results of applying the iteratee to each element.
  _.map = _.collect = function(obj, iteratee, context) {
    iteratee = cb(iteratee, context);
    var keys = !isArrayLike(obj) && _.keys(obj),
        length = (keys || obj).length,
        results = Array(length);
    for (var index = 0; index < length; index++) {
      var currentKey = keys ? keys[index] : index;
      results[index] = iteratee(obj[currentKey], currentKey, obj);
    }
    return results;
  };

  // Create a reducing function iterating left or right.
  function createReduce(dir) {
    // Optimized iterator function as using arguments.length
    // in the main function will deoptimize the, see #1991.
    function iterator(obj, iteratee, memo, keys, index, length) {
      for (; index >= 0 && index < length; index += dir) {
        var currentKey = keys ? keys[index] : index;
        memo = iteratee(memo, obj[currentKey], currentKey, obj);
      }
      return memo;
    }

    return function(obj, iteratee, memo, context) {
      iteratee = optimizeCb(iteratee, context, 4);
      var keys = !isArrayLike(obj) && _.keys(obj),
          length = (keys || obj).length,
          index = dir > 0 ? 0 : length - 1;
      // Determine the initial value if none is provided.
      if (arguments.length < 3) {
        memo = obj[keys ? keys[index] : index];
        index += dir;
      }
      return iterator(obj, iteratee, memo, keys, index, length);
    };
  }

  // **Reduce** builds up a single result from a list of values, aka `inject`,
  // or `foldl`.
  _.reduce = _.foldl = _.inject = createReduce(1);

  // The right-associative version of reduce, also known as `foldr`.
  _.reduceRight = _.foldr = createReduce(-1);

  // Return the first value which passes a truth test. Aliased as `detect`.
  _.find = _.detect = function(obj, predicate, context) {
    var key;
    if (isArrayLike(obj)) {
      key = _.findIndex(obj, predicate, context);
    } else {
      key = _.findKey(obj, predicate, context);
    }
    if (key !== void 0 && key !== -1) return obj[key];
  };

  // Return all the elements that pass a truth test.
  // Aliased as `select`.
  _.filter = _.select = function(obj, predicate, context) {
    var results = [];
    predicate = cb(predicate, context);
    _.each(obj, function(value, index, list) {
      if (predicate(value, index, list)) results.push(value);
    });
    return results;
  };

  // Return all the elements for which a truth test fails.
  _.reject = function(obj, predicate, context) {
    return _.filter(obj, _.negate(cb(predicate)), context);
  };

  // Determine whether all of the elements match a truth test.
  // Aliased as `all`.
  _.every = _.all = function(obj, predicate, context) {
    predicate = cb(predicate, context);
    var keys = !isArrayLike(obj) && _.keys(obj),
        length = (keys || obj).length;
    for (var index = 0; index < length; index++) {
      var currentKey = keys ? keys[index] : index;
      if (!predicate(obj[currentKey], currentKey, obj)) return false;
    }
    return true;
  };

  // Determine if at least one element in the object matches a truth test.
  // Aliased as `any`.
  _.some = _.any = function(obj, predicate, context) {
    predicate = cb(predicate, context);
    var keys = !isArrayLike(obj) && _.keys(obj),
        length = (keys || obj).length;
    for (var index = 0; index < length; index++) {
      var currentKey = keys ? keys[index] : index;
      if (predicate(obj[currentKey], currentKey, obj)) return true;
    }
    return false;
  };

  // Determine if the array or object contains a given item (using `===`).
  // Aliased as `includes` and `include`.
  _.contains = _.includes = _.include = function(obj, item, fromIndex, guard) {
    if (!isArrayLike(obj)) obj = _.values(obj);
    if (typeof fromIndex != 'number' || guard) fromIndex = 0;
    return _.indexOf(obj, item, fromIndex) >= 0;
  };

  // Invoke a method (with arguments) on every item in a collection.
  _.invoke = function(obj, method) {
    var args = slice.call(arguments, 2);
    var isFunc = _.isFunction(method);
    return _.map(obj, function(value) {
      var func = isFunc ? method : value[method];
      return func == null ? func : func.apply(value, args);
    });
  };

  // Convenience version of a common use case of `map`: fetching a property.
  _.pluck = function(obj, key) {
    return _.map(obj, _.property(key));
  };

  // Convenience version of a common use case of `filter`: selecting only objects
  // containing specific `key:value` pairs.
  _.where = function(obj, attrs) {
    return _.filter(obj, _.matcher(attrs));
  };

  // Convenience version of a common use case of `find`: getting the first object
  // containing specific `key:value` pairs.
  _.findWhere = function(obj, attrs) {
    return _.find(obj, _.matcher(attrs));
  };

  // Return the maximum element (or element-based computation).
  _.max = function(obj, iteratee, context) {
    var result = -Infinity, lastComputed = -Infinity,
        value, computed;
    if (iteratee == null && obj != null) {
      obj = isArrayLike(obj) ? obj : _.values(obj);
      for (var i = 0, length = obj.length; i < length; i++) {
        value = obj[i];
        if (value > result) {
          result = value;
        }
      }
    } else {
      iteratee = cb(iteratee, context);
      _.each(obj, function(value, index, list) {
        computed = iteratee(value, index, list);
        if (computed > lastComputed || computed === -Infinity && result === -Infinity) {
          result = value;
          lastComputed = computed;
        }
      });
    }
    return result;
  };

  // Return the minimum element (or element-based computation).
  _.min = function(obj, iteratee, context) {
    var result = Infinity, lastComputed = Infinity,
        value, computed;
    if (iteratee == null && obj != null) {
      obj = isArrayLike(obj) ? obj : _.values(obj);
      for (var i = 0, length = obj.length; i < length; i++) {
        value = obj[i];
        if (value < result) {
          result = value;
        }
      }
    } else {
      iteratee = cb(iteratee, context);
      _.each(obj, function(value, index, list) {
        computed = iteratee(value, index, list);
        if (computed < lastComputed || computed === Infinity && result === Infinity) {
          result = value;
          lastComputed = computed;
        }
      });
    }
    return result;
  };

  // Shuffle a collection, using the modern version of the
  // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).
  _.shuffle = function(obj) {
    var set = isArrayLike(obj) ? obj : _.values(obj);
    var length = set.length;
    var shuffled = Array(length);
    for (var index = 0, rand; index < length; index++) {
      rand = _.random(0, index);
      if (rand !== index) shuffled[index] = shuffled[rand];
      shuffled[rand] = set[index];
    }
    return shuffled;
  };

  // Sample **n** random values from a collection.
  // If **n** is not specified, returns a single random element.
  // The internal `guard` argument allows it to work with `map`.
  _.sample = function(obj, n, guard) {
    if (n == null || guard) {
      if (!isArrayLike(obj)) obj = _.values(obj);
      return obj[_.random(obj.length - 1)];
    }
    return _.shuffle(obj).slice(0, Math.max(0, n));
  };

  // Sort the object's values by a criterion produced by an iteratee.
  _.sortBy = function(obj, iteratee, context) {
    iteratee = cb(iteratee, context);
    return _.pluck(_.map(obj, function(value, index, list) {
      return {
        value: value,
        index: index,
        criteria: iteratee(value, index, list)
      };
    }).sort(function(left, right) {
      var a = left.criteria;
      var b = right.criteria;
      if (a !== b) {
        if (a > b || a === void 0) return 1;
        if (a < b || b === void 0) return -1;
      }
      return left.index - right.index;
    }), 'value');
  };

  // An internal function used for aggregate "group by" operations.
  var group = function(behavior) {
    return function(obj, iteratee, context) {
      var result = {};
      iteratee = cb(iteratee, context);
      _.each(obj, function(value, index) {
        var key = iteratee(value, index, obj);
        behavior(result, value, key);
      });
      return result;
    };
  };

  // Groups the object's values by a criterion. Pass either a string attribute
  // to group by, or a function that returns the criterion.
  _.groupBy = group(function(result, value, key) {
    if (_.has(result, key)) result[key].push(value); else result[key] = [value];
  });

  // Indexes the object's values by a criterion, similar to `groupBy`, but for
  // when you know that your index values will be unique.
  _.indexBy = group(function(result, value, key) {
    result[key] = value;
  });

  // Counts instances of an object that group by a certain criterion. Pass
  // either a string attribute to count by, or a function that returns the
  // criterion.
  _.countBy = group(function(result, value, key) {
    if (_.has(result, key)) result[key]++; else result[key] = 1;
  });

  // Safely create a real, live array from anything iterable.
  _.toArray = function(obj) {
    if (!obj) return [];
    if (_.isArray(obj)) return slice.call(obj);
    if (isArrayLike(obj)) return _.map(obj, _.identity);
    return _.values(obj);
  };

  // Return the number of elements in an object.
  _.size = function(obj) {
    if (obj == null) return 0;
    return isArrayLike(obj) ? obj.length : _.keys(obj).length;
  };

  // Split a collection into two arrays: one whose elements all satisfy the given
  // predicate, and one whose elements all do not satisfy the predicate.
  _.partition = function(obj, predicate, context) {
    predicate = cb(predicate, context);
    var pass = [], fail = [];
    _.each(obj, function(value, key, obj) {
      (predicate(value, key, obj) ? pass : fail).push(value);
    });
    return [pass, fail];
  };

  // Array Functions
  // ---------------

  // Get the first element of an array. Passing **n** will return the first N
  // values in the array. Aliased as `head` and `take`. The **guard** check
  // allows it to work with `_.map`.
  _.first = _.head = _.take = function(array, n, guard) {
    if (array == null) return void 0;
    if (n == null || guard) return array[0];
    return _.initial(array, array.length - n);
  };

  // Returns everything but the last entry of the array. Especially useful on
  // the arguments object. Passing **n** will return all the values in
  // the array, excluding the last N.
  _.initial = function(array, n, guard) {
    return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));
  };

  // Get the last element of an array. Passing **n** will return the last N
  // values in the array.
  _.last = function(array, n, guard) {
    if (array == null) return void 0;
    if (n == null || guard) return array[array.length - 1];
    return _.rest(array, Math.max(0, array.length - n));
  };

  // Returns everything but the first entry of the array. Aliased as `tail` and `drop`.
  // Especially useful on the arguments object. Passing an **n** will return
  // the rest N values in the array.
  _.rest = _.tail = _.drop = function(array, n, guard) {
    return slice.call(array, n == null || guard ? 1 : n);
  };

  // Trim out all falsy values from an array.
  _.compact = function(array) {
    return _.filter(array, _.identity);
  };

  // Internal implementation of a recursive `flatten` function.
  var flatten = function(input, shallow, strict, startIndex) {
    var output = [], idx = 0;
    for (var i = startIndex || 0, length = getLength(input); i < length; i++) {
      var value = input[i];
      if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) {
        //flatten current level of array or arguments object
        if (!shallow) value = flatten(value, shallow, strict);
        var j = 0, len = value.length;
        output.length += len;
        while (j < len) {
          output[idx++] = value[j++];
        }
      } else if (!strict) {
        output[idx++] = value;
      }
    }
    return output;
  };

  // Flatten out an array, either recursively (by default), or just one level.
  _.flatten = function(array, shallow) {
    return flatten(array, shallow, false);
  };

  // Return a version of the array that does not contain the specified value(s).
  _.without = function(array) {
    return _.difference(array, slice.call(arguments, 1));
  };

  // Produce a duplicate-free version of the array. If the array has already
  // been sorted, you have the option of using a faster algorithm.
  // Aliased as `unique`.
  _.uniq = _.unique = function(array, isSorted, iteratee, context) {
    if (!_.isBoolean(isSorted)) {
      context = iteratee;
      iteratee = isSorted;
      isSorted = false;
    }
    if (iteratee != null) iteratee = cb(iteratee, context);
    var result = [];
    var seen = [];
    for (var i = 0, length = getLength(array); i < length; i++) {
      var value = array[i],
          computed = iteratee ? iteratee(value, i, array) : value;
      if (isSorted) {
        if (!i || seen !== computed) result.push(value);
        seen = computed;
      } else if (iteratee) {
        if (!_.contains(seen, computed)) {
          seen.push(computed);
          result.push(value);
        }
      } else if (!_.contains(result, value)) {
        result.push(value);
      }
    }
    return result;
  };

  // Produce an array that contains the union: each distinct element from all of
  // the passed-in arrays.
  _.union = function() {
    return _.uniq(flatten(arguments, true, true));
  };

  // Produce an array that contains every item shared between all the
  // passed-in arrays.
  _.intersection = function(array) {
    var result = [];
    var argsLength = arguments.length;
    for (var i = 0, length = getLength(array); i < length; i++) {
      var item = array[i];
      if (_.contains(result, item)) continue;
      for (var j = 1; j < argsLength; j++) {
        if (!_.contains(arguments[j], item)) break;
      }
      if (j === argsLength) result.push(item);
    }
    return result;
  };

  // Take the difference between one array and a number of other arrays.
  // Only the elements present in just the first array will remain.
  _.difference = function(array) {
    var rest = flatten(arguments, true, true, 1);
    return _.filter(array, function(value){
      return !_.contains(rest, value);
    });
  };

  // Zip together multiple lists into a single array -- elements that share
  // an index go together.
  _.zip = function() {
    return _.unzip(arguments);
  };

  // Complement of _.zip. Unzip accepts an array of arrays and groups
  // each array's elements on shared indices
  _.unzip = function(array) {
    var length = array && _.max(array, getLength).length || 0;
    var result = Array(length);

    for (var index = 0; index < length; index++) {
      result[index] = _.pluck(array, index);
    }
    return result;
  };

  // Converts lists into objects. Pass either a single array of `[key, value]`
  // pairs, or two parallel arrays of the same length -- one of keys, and one of
  // the corresponding values.
  _.object = function(list, values) {
    var result = {};
    for (var i = 0, length = getLength(list); i < length; i++) {
      if (values) {
        result[list[i]] = values[i];
      } else {
        result[list[i][0]] = list[i][1];
      }
    }
    return result;
  };

  // Generator function to create the findIndex and findLastIndex functions
  function createPredicateIndexFinder(dir) {
    return function(array, predicate, context) {
      predicate = cb(predicate, context);
      var length = getLength(array);
      var index = dir > 0 ? 0 : length - 1;
      for (; index >= 0 && index < length; index += dir) {
        if (predicate(array[index], index, array)) return index;
      }
      return -1;
    };
  }

  // Returns the first index on an array-like that passes a predicate test
  _.findIndex = createPredicateIndexFinder(1);
  _.findLastIndex = createPredicateIndexFinder(-1);

  // Use a comparator function to figure out the smallest index at which
  // an object should be inserted so as to maintain order. Uses binary search.
  _.sortedIndex = function(array, obj, iteratee, context) {
    iteratee = cb(iteratee, context, 1);
    var value = iteratee(obj);
    var low = 0, high = getLength(array);
    while (low < high) {
      var mid = Math.floor((low + high) / 2);
      if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;
    }
    return low;
  };

  // Generator function to create the indexOf and lastIndexOf functions
  function createIndexFinder(dir, predicateFind, sortedIndex) {
    return function(array, item, idx) {
      var i = 0, length = getLength(array);
      if (typeof idx == 'number') {
        if (dir > 0) {
            i = idx >= 0 ? idx : Math.max(idx + length, i);
        } else {
            length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;
        }
      } else if (sortedIndex && idx && length) {
        idx = sortedIndex(array, item);
        return array[idx] === item ? idx : -1;
      }
      if (item !== item) {
        idx = predicateFind(slice.call(array, i, length), _.isNaN);
        return idx >= 0 ? idx + i : -1;
      }
      for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {
        if (array[idx] === item) return idx;
      }
      return -1;
    };
  }

  // Return the position of the first occurrence of an item in an array,
  // or -1 if the item is not included in the array.
  // If the array is large and already in sort order, pass `true`
  // for **isSorted** to use binary search.
  _.indexOf = createIndexFinder(1, _.findIndex, _.sortedIndex);
  _.lastIndexOf = createIndexFinder(-1, _.findLastIndex);

  // Generate an integer Array containing an arithmetic progression. A port of
  // the native Python `range()` function. See
  // [the Python documentation](http://docs.python.org/library/functions.html#range).
  _.range = function(start, stop, step) {
    if (stop == null) {
      stop = start || 0;
      start = 0;
    }
    step = step || 1;

    var length = Math.max(Math.ceil((stop - start) / step), 0);
    var range = Array(length);

    for (var idx = 0; idx < length; idx++, start += step) {
      range[idx] = start;
    }

    return range;
  };

  // Function (ahem) Functions
  // ------------------

  // Determines whether to execute a function as a constructor
  // or a normal function with the provided arguments
  var executeBound = function(sourceFunc, boundFunc, context, callingContext, args) {
    if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);
    var self = baseCreate(sourceFunc.prototype);
    var result = sourceFunc.apply(self, args);
    if (_.isObject(result)) return result;
    return self;
  };

  // Create a function bound to a given object (assigning `this`, and arguments,
  // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
  // available.
  _.bind = function(func, context) {
    if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
    if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function');
    var args = slice.call(arguments, 2);
    var bound = function() {
      return executeBound(func, bound, context, this, args.concat(slice.call(arguments)));
    };
    return bound;
  };

  // Partially apply a function by creating a version that has had some of its
  // arguments pre-filled, without changing its dynamic `this` context. _ acts
  // as a placeholder, allowing any combination of arguments to be pre-filled.
  _.partial = function(func) {
    var boundArgs = slice.call(arguments, 1);
    var bound = function() {
      var position = 0, length = boundArgs.length;
      var args = Array(length);
      for (var i = 0; i < length; i++) {
        args[i] = boundArgs[i] === _ ? arguments[position++] : boundArgs[i];
      }
      while (position < arguments.length) args.push(arguments[position++]);
      return executeBound(func, bound, this, this, args);
    };
    return bound;
  };

  // Bind a number of an object's methods to that object. Remaining arguments
  // are the method names to be bound. Useful for ensuring that all callbacks
  // defined on an object belong to it.
  _.bindAll = function(obj) {
    var i, length = arguments.length, key;
    if (length <= 1) throw new Error('bindAll must be passed function names');
    for (i = 1; i < length; i++) {
      key = arguments[i];
      obj[key] = _.bind(obj[key], obj);
    }
    return obj;
  };

  // Memoize an expensive function by storing its results.
  _.memoize = function(func, hasher) {
    var memoize = function(key) {
      var cache = memoize.cache;
      var address = '' + (hasher ? hasher.apply(this, arguments) : key);
      if (!_.has(cache, address)) cache[address] = func.apply(this, arguments);
      return cache[address];
    };
    memoize.cache = {};
    return memoize;
  };

  // Delays a function for the given number of milliseconds, and then calls
  // it with the arguments supplied.
  _.delay = function(func, wait) {
    var args = slice.call(arguments, 2);
    return setTimeout(function(){
      return func.apply(null, args);
    }, wait);
  };

  // Defers a function, scheduling it to run after the current call stack has
  // cleared.
  _.defer = _.partial(_.delay, _, 1);

  // Returns a function, that, when invoked, will only be triggered at most once
  // during a given window of time. Normally, the throttled function will run
  // as much as it can, without ever going more than once per `wait` duration;
  // but if you'd like to disable the execution on the leading edge, pass
  // `{leading: false}`. To disable execution on the trailing edge, ditto.
  _.throttle = function(func, wait, options) {
    var context, args, result;
    var timeout = null;
    var previous = 0;
    if (!options) options = {};
    var later = function() {
      previous = options.leading === false ? 0 : _.now();
      timeout = null;
      result = func.apply(context, args);
      if (!timeout) context = args = null;
    };
    return function() {
      var now = _.now();
      if (!previous && options.leading === false) previous = now;
      var remaining = wait - (now - previous);
      context = this;
      args = arguments;
      if (remaining <= 0 || remaining > wait) {
        if (timeout) {
          clearTimeout(timeout);
          timeout = null;
        }
        previous = now;
        result = func.apply(context, args);
        if (!timeout) context = args = null;
      } else if (!timeout && options.trailing !== false) {
        timeout = setTimeout(later, remaining);
      }
      return result;
    };
  };

  // Returns a function, that, as long as it continues to be invoked, will not
  // be triggered. The function will be called after it stops being called for
  // N milliseconds. If `immediate` is passed, trigger the function on the
  // leading edge, instead of the trailing.
  _.debounce = function(func, wait, immediate) {
    var timeout, args, context, timestamp, result;

    var later = function() {
      var last = _.now() - timestamp;

      if (last < wait && last >= 0) {
        timeout = setTimeout(later, wait - last);
      } else {
        timeout = null;
        if (!immediate) {
          result = func.apply(context, args);
          if (!timeout) context = args = null;
        }
      }
    };

    return function() {
      context = this;
      args = arguments;
      timestamp = _.now();
      var callNow = immediate && !timeout;
      if (!timeout) timeout = setTimeout(later, wait);
      if (callNow) {
        result = func.apply(context, args);
        context = args = null;
      }

      return result;
    };
  };

  // Returns the first function passed as an argument to the second,
  // allowing you to adjust arguments, run code before and after, and
  // conditionally execute the original function.
  _.wrap = function(func, wrapper) {
    return _.partial(wrapper, func);
  };

  // Returns a negated version of the passed-in predicate.
  _.negate = function(predicate) {
    return function() {
      return !predicate.apply(this, arguments);
    };
  };

  // Returns a function that is the composition of a list of functions, each
  // consuming the return value of the function that follows.
  _.compose = function() {
    var args = arguments;
    var start = args.length - 1;
    return function() {
      var i = start;
      var result = args[start].apply(this, arguments);
      while (i--) result = args[i].call(this, result);
      return result;
    };
  };

  // Returns a function that will only be executed on and after the Nth call.
  _.after = function(times, func) {
    return function() {
      if (--times < 1) {
        return func.apply(this, arguments);
      }
    };
  };

  // Returns a function that will only be executed up to (but not including) the Nth call.
  _.before = function(times, func) {
    var memo;
    return function() {
      if (--times > 0) {
        memo = func.apply(this, arguments);
      }
      if (times <= 1) func = null;
      return memo;
    };
  };

  // Returns a function that will be executed at most one time, no matter how
  // often you call it. Useful for lazy initialization.
  _.once = _.partial(_.before, 2);

  // Object Functions
  // ----------------

  // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.
  var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');
  var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',
                      'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];

  function collectNonEnumProps(obj, keys) {
    var nonEnumIdx = nonEnumerableProps.length;
    var constructor = obj.constructor;
    var proto = (_.isFunction(constructor) && constructor.prototype) || ObjProto;

    // Constructor is a special case.
    var prop = 'constructor';
    if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop);

    while (nonEnumIdx--) {
      prop = nonEnumerableProps[nonEnumIdx];
      if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) {
        keys.push(prop);
      }
    }
  }

  // Retrieve the names of an object's own properties.
  // Delegates to **ECMAScript 5**'s native `Object.keys`
  _.keys = function(obj) {
    if (!_.isObject(obj)) return [];
    if (nativeKeys) return nativeKeys(obj);
    var keys = [];
    for (var key in obj) if (_.has(obj, key)) keys.push(key);
    // Ahem, IE < 9.
    if (hasEnumBug) collectNonEnumProps(obj, keys);
    return keys;
  };

  // Retrieve all the property names of an object.
  _.allKeys = function(obj) {
    if (!_.isObject(obj)) return [];
    var keys = [];
    for (var key in obj) keys.push(key);
    // Ahem, IE < 9.
    if (hasEnumBug) collectNonEnumProps(obj, keys);
    return keys;
  };

  // Retrieve the values of an object's properties.
  _.values = function(obj) {
    var keys = _.keys(obj);
    var length = keys.length;
    var values = Array(length);
    for (var i = 0; i < length; i++) {
      values[i] = obj[keys[i]];
    }
    return values;
  };

  // Returns the results of applying the iteratee to each element of the object
  // In contrast to _.map it returns an object
  _.mapObject = function(obj, iteratee, context) {
    iteratee = cb(iteratee, context);
    var keys =  _.keys(obj),
          length = keys.length,
          results = {},
          currentKey;
      for (var index = 0; index < length; index++) {
        currentKey = keys[index];
        results[currentKey] = iteratee(obj[currentKey], currentKey, obj);
      }
      return results;
  };

  // Convert an object into a list of `[key, value]` pairs.
  _.pairs = function(obj) {
    var keys = _.keys(obj);
    var length = keys.length;
    var pairs = Array(length);
    for (var i = 0; i < length; i++) {
      pairs[i] = [keys[i], obj[keys[i]]];
    }
    return pairs;
  };

  // Invert the keys and values of an object. The values must be serializable.
  _.invert = function(obj) {
    var result = {};
    var keys = _.keys(obj);
    for (var i = 0, length = keys.length; i < length; i++) {
      result[obj[keys[i]]] = keys[i];
    }
    return result;
  };

  // Return a sorted list of the function names available on the object.
  // Aliased as `methods`
  _.functions = _.methods = function(obj) {
    var names = [];
    for (var key in obj) {
      if (_.isFunction(obj[key])) names.push(key);
    }
    return names.sort();
  };

  // Extend a given object with all the properties in passed-in object(s).
  _.extend = createAssigner(_.allKeys);

  // Assigns a given object with all the own properties in the passed-in object(s)
  // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
  _.extendOwn = _.assign = createAssigner(_.keys);

  // Returns the first key on an object that passes a predicate test
  _.findKey = function(obj, predicate, context) {
    predicate = cb(predicate, context);
    var keys = _.keys(obj), key;
    for (var i = 0, length = keys.length; i < length; i++) {
      key = keys[i];
      if (predicate(obj[key], key, obj)) return key;
    }
  };

  // Return a copy of the object only containing the whitelisted properties.
  _.pick = function(object, oiteratee, context) {
    var result = {}, obj = object, iteratee, keys;
    if (obj == null) return result;
    if (_.isFunction(oiteratee)) {
      keys = _.allKeys(obj);
      iteratee = optimizeCb(oiteratee, context);
    } else {
      keys = flatten(arguments, false, false, 1);
      iteratee = function(value, key, obj) { return key in obj; };
      obj = Object(obj);
    }
    for (var i = 0, length = keys.length; i < length; i++) {
      var key = keys[i];
      var value = obj[key];
      if (iteratee(value, key, obj)) result[key] = value;
    }
    return result;
  };

   // Return a copy of the object without the blacklisted properties.
  _.omit = function(obj, iteratee, context) {
    if (_.isFunction(iteratee)) {
      iteratee = _.negate(iteratee);
    } else {
      var keys = _.map(flatten(arguments, false, false, 1), String);
      iteratee = function(value, key) {
        return !_.contains(keys, key);
      };
    }
    return _.pick(obj, iteratee, context);
  };

  // Fill in a given object with default properties.
  _.defaults = createAssigner(_.allKeys, true);

  // Creates an object that inherits from the given prototype object.
  // If additional properties are provided then they will be added to the
  // created object.
  _.create = function(prototype, props) {
    var result = baseCreate(prototype);
    if (props) _.extendOwn(result, props);
    return result;
  };

  // Create a (shallow-cloned) duplicate of an object.
  _.clone = function(obj) {
    if (!_.isObject(obj)) return obj;
    return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
  };

  // Invokes interceptor with the obj, and then returns obj.
  // The primary purpose of this method is to "tap into" a method chain, in
  // order to perform operations on intermediate results within the chain.
  _.tap = function(obj, interceptor) {
    interceptor(obj);
    return obj;
  };

  // Returns whether an object has a given set of `key:value` pairs.
  _.isMatch = function(object, attrs) {
    var keys = _.keys(attrs), length = keys.length;
    if (object == null) return !length;
    var obj = Object(object);
    for (var i = 0; i < length; i++) {
      var key = keys[i];
      if (attrs[key] !== obj[key] || !(key in obj)) return false;
    }
    return true;
  };


  // Internal recursive comparison function for `isEqual`.
  var eq = function(a, b, aStack, bStack) {
    // Identical objects are equal. `0 === -0`, but they aren't identical.
    // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
    if (a === b) return a !== 0 || 1 / a === 1 / b;
    // A strict comparison is necessary because `null == undefined`.
    if (a == null || b == null) return a === b;
    // Unwrap any wrapped objects.
    if (a instanceof _) a = a._wrapped;
    if (b instanceof _) b = b._wrapped;
    // Compare `[[Class]]` names.
    var className = toString.call(a);
    if (className !== toString.call(b)) return false;
    switch (className) {
      // Strings, numbers, regular expressions, dates, and booleans are compared by value.
      case '[object RegExp]':
      // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')
      case '[object String]':
        // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
        // equivalent to `new String("5")`.
        return '' + a === '' + b;
      case '[object Number]':
        // `NaN`s are equivalent, but non-reflexive.
        // Object(NaN) is equivalent to NaN
        if (+a !== +a) return +b !== +b;
        // An `egal` comparison is performed for other numeric values.
        return +a === 0 ? 1 / +a === 1 / b : +a === +b;
      case '[object Date]':
      case '[object Boolean]':
        // Coerce dates and booleans to numeric primitive values. Dates are compared by their
        // millisecond representations. Note that invalid dates with millisecond representations
        // of `NaN` are not equivalent.
        return +a === +b;
    }

    var areArrays = className === '[object Array]';
    if (!areArrays) {
      if (typeof a != 'object' || typeof b != 'object') return false;

      // Objects with different constructors are not equivalent, but `Object`s or `Array`s
      // from different frames are.
      var aCtor = a.constructor, bCtor = b.constructor;
      if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor &&
                               _.isFunction(bCtor) && bCtor instanceof bCtor)
                          && ('constructor' in a && 'constructor' in b)) {
        return false;
      }
    }
    // Assume equality for cyclic structures. The algorithm for detecting cyclic
    // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.

    // Initializing stack of traversed objects.
    // It's done here since we only need them for objects and arrays comparison.
    aStack = aStack || [];
    bStack = bStack || [];
    var length = aStack.length;
    while (length--) {
      // Linear search. Performance is inversely proportional to the number of
      // unique nested structures.
      if (aStack[length] === a) return bStack[length] === b;
    }

    // Add the first object to the stack of traversed objects.
    aStack.push(a);
    bStack.push(b);

    // Recursively compare objects and arrays.
    if (areArrays) {
      // Compare array lengths to determine if a deep comparison is necessary.
      length = a.length;
      if (length !== b.length) return false;
      // Deep compare the contents, ignoring non-numeric properties.
      while (length--) {
        if (!eq(a[length], b[length], aStack, bStack)) return false;
      }
    } else {
      // Deep compare objects.
      var keys = _.keys(a), key;
      length = keys.length;
      // Ensure that both objects contain the same number of properties before comparing deep equality.
      if (_.keys(b).length !== length) return false;
      while (length--) {
        // Deep compare each member
        key = keys[length];
        if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false;
      }
    }
    // Remove the first object from the stack of traversed objects.
    aStack.pop();
    bStack.pop();
    return true;
  };

  // Perform a deep comparison to check if two objects are equal.
  _.isEqual = function(a, b) {
    return eq(a, b);
  };

  // Is a given array, string, or object empty?
  // An "empty" object has no enumerable own-properties.
  _.isEmpty = function(obj) {
    if (obj == null) return true;
    if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0;
    return _.keys(obj).length === 0;
  };

  // Is a given value a DOM element?
  _.isElement = function(obj) {
    return !!(obj && obj.nodeType === 1);
  };

  // Is a given value an array?
  // Delegates to ECMA5's native Array.isArray
  _.isArray = nativeIsArray || function(obj) {
    return toString.call(obj) === '[object Array]';
  };

  // Is a given variable an object?
  _.isObject = function(obj) {
    var type = typeof obj;
    return type === 'function' || type === 'object' && !!obj;
  };

  // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError.
  _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function(name) {
    _['is' + name] = function(obj) {
      return toString.call(obj) === '[object ' + name + ']';
    };
  });

  // Define a fallback version of the method in browsers (ahem, IE < 9), where
  // there isn't any inspectable "Arguments" type.
  if (!_.isArguments(arguments)) {
    _.isArguments = function(obj) {
      return _.has(obj, 'callee');
    };
  }

  // Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8,
  // IE 11 (#1621), and in Safari 8 (#1929).
  if (typeof /./ != 'function' && typeof Int8Array != 'object') {
    _.isFunction = function(obj) {
      return typeof obj == 'function' || false;
    };
  }

  // Is a given object a finite number?
  _.isFinite = function(obj) {
    return isFinite(obj) && !isNaN(parseFloat(obj));
  };

  // Is the given value `NaN`? (NaN is the only number which does not equal itself).
  _.isNaN = function(obj) {
    return _.isNumber(obj) && obj !== +obj;
  };

  // Is a given value a boolean?
  _.isBoolean = function(obj) {
    return obj === true || obj === false || toString.call(obj) === '[object Boolean]';
  };

  // Is a given value equal to null?
  _.isNull = function(obj) {
    return obj === null;
  };

  // Is a given variable undefined?
  _.isUndefined = function(obj) {
    return obj === void 0;
  };

  // Shortcut function for checking if an object has a given property directly
  // on itself (in other words, not on a prototype).
  _.has = function(obj, key) {
    return obj != null && hasOwnProperty.call(obj, key);
  };

  // Utility Functions
  // -----------------

  // Run Underscore.js in *noConflict* mode, returning the `_` variable to its
  // previous owner. Returns a reference to the Underscore object.
  _.noConflict = function() {
    root._ = previousUnderscore;
    return this;
  };

  // Keep the identity function around for default iteratees.
  _.identity = function(value) {
    return value;
  };

  // Predicate-generating functions. Often useful outside of Underscore.
  _.constant = function(value) {
    return function() {
      return value;
    };
  };

  _.noop = function(){};

  _.property = property;

  // Generates a function for a given object that returns a given property.
  _.propertyOf = function(obj) {
    return obj == null ? function(){} : function(key) {
      return obj[key];
    };
  };

  // Returns a predicate for checking whether an object has a given set of
  // `key:value` pairs.
  _.matcher = _.matches = function(attrs) {
    attrs = _.extendOwn({}, attrs);
    return function(obj) {
      return _.isMatch(obj, attrs);
    };
  };

  // Run a function **n** times.
  _.times = function(n, iteratee, context) {
    var accum = Array(Math.max(0, n));
    iteratee = optimizeCb(iteratee, context, 1);
    for (var i = 0; i < n; i++) accum[i] = iteratee(i);
    return accum;
  };

  // Return a random integer between min and max (inclusive).
  _.random = function(min, max) {
    if (max == null) {
      max = min;
      min = 0;
    }
    return min + Math.floor(Math.random() * (max - min + 1));
  };

  // A (possibly faster) way to get the current timestamp as an integer.
  _.now = Date.now || function() {
    return new Date().getTime();
  };

   // List of HTML entities for escaping.
  var escapeMap = {
    '&': '&amp;',
    '<': '&lt;',
    '>': '&gt;',
    '"': '&quot;',
    "'": '&#x27;',
    '`': '&#x60;'
  };
  var unescapeMap = _.invert(escapeMap);

  // Functions for escaping and unescaping strings to/from HTML interpolation.
  var createEscaper = function(map) {
    var escaper = function(match) {
      return map[match];
    };
    // Regexes for identifying a key that needs to be escaped
    var source = '(?:' + _.keys(map).join('|') + ')';
    var testRegexp = RegExp(source);
    var replaceRegexp = RegExp(source, 'g');
    return function(string) {
      string = string == null ? '' : '' + string;
      return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;
    };
  };
  _.escape = createEscaper(escapeMap);
  _.unescape = createEscaper(unescapeMap);

  // If the value of the named `property` is a function then invoke it with the
  // `object` as context; otherwise, return it.
  _.result = function(object, property, fallback) {
    var value = object == null ? void 0 : object[property];
    if (value === void 0) {
      value = fallback;
    }
    return _.isFunction(value) ? value.call(object) : value;
  };

  // Generate a unique integer id (unique within the entire client session).
  // Useful for temporary DOM ids.
  var idCounter = 0;
  _.uniqueId = function(prefix) {
    var id = ++idCounter + '';
    return prefix ? prefix + id : id;
  };

  // By default, Underscore uses ERB-style template delimiters, change the
  // following template settings to use alternative delimiters.
  _.templateSettings = {
    evaluate    : /<%([\s\S]+?)%>/g,
    interpolate : /<%=([\s\S]+?)%>/g,
    escape      : /<%-([\s\S]+?)%>/g
  };

  // When customizing `templateSettings`, if you don't want to define an
  // interpolation, evaluation or escaping regex, we need one that is
  // guaranteed not to match.
  var noMatch = /(.)^/;

  // Certain characters need to be escaped so that they can be put into a
  // string literal.
  var escapes = {
    "'":      "'",
    '\\':     '\\',
    '\r':     'r',
    '\n':     'n',
    '\u2028': 'u2028',
    '\u2029': 'u2029'
  };

  var escaper = /\\|'|\r|\n|\u2028|\u2029/g;

  var escapeChar = function(match) {
    return '\\' + escapes[match];
  };

  // JavaScript micro-templating, similar to John Resig's implementation.
  // Underscore templating handles arbitrary delimiters, preserves whitespace,
  // and correctly escapes quotes within interpolated code.
  // NB: `oldSettings` only exists for backwards compatibility.
  _.template = function(text, settings, oldSettings) {
    if (!settings && oldSettings) settings = oldSettings;
    settings = _.defaults({}, settings, _.templateSettings);

    // Combine delimiters into one regular expression via alternation.
    var matcher = RegExp([
      (settings.escape || noMatch).source,
      (settings.interpolate || noMatch).source,
      (settings.evaluate || noMatch).source
    ].join('|') + '|$', 'g');

    // Compile the template source, escaping string literals appropriately.
    var index = 0;
    var source = "__p+='";
    text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {
      source += text.slice(index, offset).replace(escaper, escapeChar);
      index = offset + match.length;

      if (escape) {
        source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'";
      } else if (interpolate) {
        source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'";
      } else if (evaluate) {
        source += "';\n" + evaluate + "\n__p+='";
      }

      // Adobe VMs need the match returned to produce the correct offest.
      return match;
    });
    source += "';\n";

    // If a variable is not specified, place data values in local scope.
    if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n';

    source = "var __t,__p='',__j=Array.prototype.join," +
      "print=function(){__p+=__j.call(arguments,'');};\n" +
      source + 'return __p;\n';

    try {
      var render = new Function(settings.variable || 'obj', '_', source);
    } catch (e) {
      e.source = source;
      throw e;
    }

    var template = function(data) {
      return render.call(this, data, _);
    };

    // Provide the compiled source as a convenience for precompilation.
    var argument = settings.variable || 'obj';
    template.source = 'function(' + argument + '){\n' + source + '}';

    return template;
  };

  // Add a "chain" function. Start chaining a wrapped Underscore object.
  _.chain = function(obj) {
    var instance = _(obj);
    instance._chain = true;
    return instance;
  };

  // OOP
  // ---------------
  // If Underscore is called as a function, it returns a wrapped object that
  // can be used OO-style. This wrapper holds altered versions of all the
  // underscore functions. Wrapped objects may be chained.

  // Helper function to continue chaining intermediate results.
  var result = function(instance, obj) {
    return instance._chain ? _(obj).chain() : obj;
  };

  // Add your own custom functions to the Underscore object.
  _.mixin = function(obj) {
    _.each(_.functions(obj), function(name) {
      var func = _[name] = obj[name];
      _.prototype[name] = function() {
        var args = [this._wrapped];
        push.apply(args, arguments);
        return result(this, func.apply(_, args));
      };
    });
  };

  // Add all of the Underscore functions to the wrapper object.
  _.mixin(_);

  // Add all mutator Array functions to the wrapper.
  _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
    var method = ArrayProto[name];
    _.prototype[name] = function() {
      var obj = this._wrapped;
      method.apply(obj, arguments);
      if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0];
      return result(this, obj);
    };
  });

  // Add all accessor Array functions to the wrapper.
  _.each(['concat', 'join', 'slice'], function(name) {
    var method = ArrayProto[name];
    _.prototype[name] = function() {
      return result(this, method.apply(this._wrapped, arguments));
    };
  });

  // Extracts the result from a wrapped and chained object.
  _.prototype.value = function() {
    return this._wrapped;
  };

  // Provide unwrapping proxy for some methods used in engine operations
  // such as arithmetic and JSON stringification.
  _.prototype.valueOf = _.prototype.toJSON = _.prototype.value;

  _.prototype.toString = function() {
    return '' + this._wrapped;
  };

  // AMD registration happens at the end for compatibility with AMD loaders
  // that may not enforce next-turn semantics on modules. Even though general
  // practice for AMD registration is to be anonymous, underscore registers
  // as a named module because, like jQuery, it is a base library that is
  // popular enough to be bundled in a third party lib, but not be part of
  // an AMD load request. Those cases could generate an error when an
  // anonymous define() is called outside of a loader request.
  if (typeof define === 'function' && define.amd) {
    define('underscore', [], function() {
      return _;
    });
  }
}.call(this));

define('utils', ['jquery', 'underscore'],
    function ($, _) {
        var waitForElement = function (selector, callback) {
            if (jQuery(selector).length > 0) {
                callback();
            }
            else {
                setTimeout(function () {
                    waitForElement(selector, callback)
                }, 100);
            }
        }

        var _checkTrustEObject = function (callback) {
            var count = 0;
            if (typeof (truste) !== 'undefined' && typeof (truste.cma) !== 'undefined') {
                callback(truste);
            }
            else {
                if (count > 10) {
                    callback(null);
                }
                else {
                    setTimeout(function () {
                        _checkTrustEObject(callback);
                        count += 1;
                    }, 500)
                }
            }
        };

        var inclusiveRange = function (start, end, step) {
            if (step === undefined)
                step = 1;
            return _.range(start, end + step, step);
        };

        var firstOrDefault = function (obj, d) {
            for (var i in obj) {
                if (obj.hasOwnProperty(i)) {
                    return obj[i];
                }
            }
            return d;
        };

        Math.radians = function (degrees) {
            return degrees * Math.PI / 180;
        };

        function numericSuffix(number, suffixes) {
            if (number == 0) {
                return number.toString() + suffixes.none;
            }
            else if (number == 1) {
                return number.toString() + suffixes.singular;
            }
            else if (number > 1) {
                return number.toString() + suffixes.multiple;
            }
            else if (number == '10+') {
                return number.toString() + suffixes.multiple;
            }

            return number;
        }

        function startsWith(value, str) {
            return value.indexOf(str) === 0;
        };

        var redirect = function (redirectUrl, params, method) {
            if (!params && method === "GET") {
                location.href = redirectUrl;
                return;
            }

            var form = document.createElement("form");
            form.setAttribute('method', method || "post");
            form.setAttribute('action', redirectUrl);
            form.setAttribute('style', 'display:none;');

            if (params) {
                for (var key in params) {
                    if (params.hasOwnProperty(key)) {
                        var hiddenField = document.createElement("input");
                        hiddenField.setAttribute("type", "hidden");
                        hiddenField.setAttribute("name", key);
                        hiddenField.setAttribute("value", params[key]);

                        form.appendChild(hiddenField);
                    }
                }
            }            

            var submitButton = document.createElement("input");
            submitButton.name = "send";
            submitButton.type = "submit";
            form.appendChild(submitButton);
            document.body.appendChild(form);

            form.submit();
        };

        var getUrlParts = function(url) {
            var a = document.createElement('a');
            a.href = url;

            return {
                href: a.href,
                host: a.host,
                hostname: a.hostname,
                port: a.port,
                pathname: a.pathname,
                protocol: a.protocol,
                hash: a.hash,
                search: a.search
            };
        };

        var isAbsoluteUrl = function(url) {
            var r = new RegExp('^(?:[a-z]+:)?//', 'i');
            return r.test(url);
        };

        var ensureAbsoluteUrl = function(url) {
            if (isAbsoluteUrl(url)) {
                return url;
            }

            if (!url.startsWith('/')) {
                url = '/' + url;
            }
            return window.location.protocol + '//' + window.location.host + url;
        };

        function isDesktop() {
            return Math.max(document.documentElement.clientWidth, window.innerWidth || 0) >= 1224;  // screen width set in variables.less. Obviously this needs to be kept synchronised.
        }

        var formatString = function(value, arguments) {    
            var i = arguments.length;       
            while (i--) {
                value = value.replace(new RegExp('\\{' + i + '\\}', 'gm'), arguments[i]);
            }
            return value;
        };

        var filesToString = function (files) {
            var filesPath = '';

            for (var indexFile = 0; indexFile < files.length; indexFile++) {
                var file = files[indexFile];
                filesPath += file.name;
                if (indexFile < files.length - 1) {
                    filesPath += ', ';
                }
            }

            return filesPath;
        };

        var randomString = function (length) {
            var text = "";
            var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
            for (var i = 0; i < length; i++) {
                text += possible.charAt(Math.floor(Math.random() * possible.length));
            }
            return text;
        };

        var findInArray = function (array, callback) {
            if (array === null) {
                throw new TypeError('findInArray called on null or undefined');
            } else if (typeof callback !== 'function') {
                throw new TypeError('callback must be a function');
            }
            var list = Object(array);
            // Makes sures is always has an positive integer as length.
            var length = list.length >>> 0;
            var thisArg = arguments[1];
            for (var i = 0; i < length; i++) {
                var element = list[i];
                if (callback.call(thisArg, element, i, list)) {
                    return element;
                }
            }
        };

        var checkFunctionalCookieConsent = function (callback) {
            var trusteObject = _checkTrustEObject(function(trusteObject) {
                if (trusteObject != null) {
                //get consent decision
                var decision = trusteObject.cma.callApi("getGDPRConsentDecision", self.location.host);
                if (decision.consentDecision.indexOf(2) > -1) {
                    callback(decision);
                }
                else {
                    callback(null);
                }
            }
            else {
                callback(null);
            }
			});
        }

        var checkIfTrusteConsentGiven = function (callback) {
            var trusteObject = _checkTrustEObject(function (trusteObject) {
                if (trusteObject != null) {
                    //get consent decision
                    var decision = truste.cma.callApi("getConsentDecision", self.location.host);
                    if (decision.source.toString() == "implied") {
                        callback(true);
                    }
                    else {
                        callback(false);
                    }
                }
                else {
                    callback(false);
                }
            });
        }

        return {
            inclusiveRange: inclusiveRange,
            numericSuffix: numericSuffix,
            startsWith: startsWith,
            redirect: redirect,
            getUrlParts: getUrlParts,
            firstOrDefault: firstOrDefault,
            isDesktop: isDesktop,
            isAbsoluteUrl: isAbsoluteUrl,
            ensureAbsoluteUrl: ensureAbsoluteUrl,
            formatString: formatString,
            filesToString: filesToString,
            randomString: randomString,
            findInArray: findInArray,
            checkFunctionalCookieConsent: checkFunctionalCookieConsent,
            checkIfTrusteConsentGiven: checkIfTrusteConsentGiven,
            waitForElement: waitForElement
        };
    });
/**
 * @license RequireJS text 2.0.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/requirejs/text for details
 */
/*jslint regexp: true */
/*global require: false, XMLHttpRequest: false, ActiveXObject: false,
  define: false, window: false, process: false, Packages: false,
  java: false, location: false */

define('text',['module'], function (module) {
    'use strict';

    var text, fs,
        progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'],
        xmlRegExp = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,
        bodyRegExp = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,
        hasLocation = typeof location !== 'undefined' && location.href,
        defaultProtocol = hasLocation && location.protocol && location.protocol.replace(/\:/, ''),
        defaultHostName = hasLocation && location.hostname,
        defaultPort = hasLocation && (location.port || undefined),
        buildMap = [],
        masterConfig = (module.config && module.config()) || {};

    text = {
        version: '2.0.5',

        strip: function (content) {
            //Strips <?xml ...?> declarations so that external SVG and XML
            //documents can be added to a document without worry. Also, if the string
            //is an HTML document, only the part inside the body tag is returned.
            if (content) {
                content = content.replace(xmlRegExp, "");
                var matches = content.match(bodyRegExp);
                if (matches) {
                    content = matches[1];
                }
            } else {
                content = "";
            }
            return content;
        },

        jsEscape: function (content) {
            return content.replace(/(['\\])/g, '\\$1')
                .replace(/[\f]/g, "\\f")
                .replace(/[\b]/g, "\\b")
                .replace(/[\n]/g, "\\n")
                .replace(/[\t]/g, "\\t")
                .replace(/[\r]/g, "\\r")
                .replace(/[\u2028]/g, "\\u2028")
                .replace(/[\u2029]/g, "\\u2029");
        },

        createXhr: masterConfig.createXhr || function () {
            //Would love to dump the ActiveX crap in here. Need IE 6 to die first.
            var xhr, i, progId;
            if (typeof XMLHttpRequest !== "undefined") {
                return new XMLHttpRequest();
            } else if (typeof ActiveXObject !== "undefined") {
                for (i = 0; i < 3; i += 1) {
                    progId = progIds[i];
                    try {
                        xhr = new ActiveXObject(progId);
                    } catch (e) {}

                    if (xhr) {
                        progIds = [progId];  // so faster next time
                        break;
                    }
                }
            }

            return xhr;
        },

        /**
         * Parses a resource name into its component parts. Resource names
         * look like: module/name.ext!strip, where the !strip part is
         * optional.
         * @param {String} name the resource name
         * @returns {Object} with properties "moduleName", "ext" and "strip"
         * where strip is a boolean.
         */
        parseName: function (name) {
            var modName, ext, temp,
                strip = false,
                index = name.indexOf("."),
                isRelative = name.indexOf('./') === 0 ||
                             name.indexOf('../') === 0;

            if (index !== -1 && (!isRelative || index > 1)) {
                modName = name.substring(0, index);
                ext = name.substring(index + 1, name.length);
            } else {
                modName = name;
            }

            temp = ext || modName;
            index = temp.indexOf("!");
            if (index !== -1) {
                //Pull off the strip arg.
                strip = temp.substring(index + 1) === "strip";
                temp = temp.substring(0, index);
                if (ext) {
                    ext = temp;
                } else {
                    modName = temp;
                }
            }

            return {
                moduleName: modName,
                ext: ext,
                strip: strip
            };
        },

        xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/,

        /**
         * Is an URL on another domain. Only works for browser use, returns
         * false in non-browser environments. Only used to know if an
         * optimized .js version of a text resource should be loaded
         * instead.
         * @param {String} url
         * @returns Boolean
         */
        useXhr: function (url, protocol, hostname, port) {
            var uProtocol, uHostName, uPort,
                match = text.xdRegExp.exec(url);
            if (!match) {
                return true;
            }
            uProtocol = match[2];
            uHostName = match[3];

            uHostName = uHostName.split(':');
            uPort = uHostName[1];
            uHostName = uHostName[0];

            return (!uProtocol || uProtocol === protocol) &&
                   (!uHostName || uHostName.toLowerCase() === hostname.toLowerCase()) &&
                   ((!uPort && !uHostName) || uPort === port);
        },

        finishLoad: function (name, strip, content, onLoad) {
            content = strip ? text.strip(content) : content;
            if (masterConfig.isBuild) {
                buildMap[name] = content;
            }
            onLoad(content);
        },

        load: function (name, req, onLoad, config) {
            //Name has format: some.module.filext!strip
            //The strip part is optional.
            //if strip is present, then that means only get the string contents
            //inside a body tag in an HTML string. For XML/SVG content it means
            //removing the <?xml ...?> declarations so the content can be inserted
            //into the current doc without problems.

            // Do not bother with the work if a build and text will
            // not be inlined.
            if (config.isBuild && !config.inlineText) {
                onLoad();
                return;
            }

            masterConfig.isBuild = config.isBuild;

            var parsed = text.parseName(name),
                nonStripName = parsed.moduleName +
                    (parsed.ext ? '.' + parsed.ext : ''),
                url = req.toUrl(nonStripName),
                useXhr = (masterConfig.useXhr) ||
                         text.useXhr;

            //Load the text. Use XHR if possible and in a browser.
            if (!hasLocation || useXhr(url, defaultProtocol, defaultHostName, defaultPort)) {
                text.get(url, function (content) {
                    text.finishLoad(name, parsed.strip, content, onLoad);
                }, function (err) {
                    if (onLoad.error) {
                        onLoad.error(err);
                    }
                });
            } else {
                //Need to fetch the resource across domains. Assume
                //the resource has been optimized into a JS module. Fetch
                //by the module name + extension, but do not include the
                //!strip part to avoid file system issues.
                req([nonStripName], function (content) {
                    text.finishLoad(parsed.moduleName + '.' + parsed.ext,
                                    parsed.strip, content, onLoad);
                });
            }
        },

        write: function (pluginName, moduleName, write, config) {
            if (buildMap.hasOwnProperty(moduleName)) {
                var content = text.jsEscape(buildMap[moduleName]);
                write.asModule(pluginName + "!" + moduleName,
                               "define(function () { return '" +
                                   content +
                               "';});\n");
            }
        },

        writeFile: function (pluginName, moduleName, req, write, config) {
            var parsed = text.parseName(moduleName),
                extPart = parsed.ext ? '.' + parsed.ext : '',
                nonStripName = parsed.moduleName + extPart,
                //Use a '.js' file name so that it indicates it is a
                //script that can be loaded across domains.
                fileName = req.toUrl(parsed.moduleName + extPart) + '.js';

            //Leverage own load() method to load plugin value, but only
            //write out values that do not have the strip argument,
            //to avoid any potential issues with ! in file names.
            text.load(nonStripName, req, function (value) {
                //Use own write() method to construct full module value.
                //But need to create shell that translates writeFile's
                //write() to the right interface.
                var textWrite = function (contents) {
                    return write(fileName, contents);
                };
                textWrite.asModule = function (moduleName, contents) {
                    return write.asModule(moduleName, fileName, contents);
                };

                text.write(pluginName, nonStripName, textWrite, config);
            }, config);
        }
    };

    if (masterConfig.env === 'node' || (!masterConfig.env &&
            typeof process !== "undefined" &&
            process.versions &&
            !!process.versions.node)) {
        //Using special require.nodeRequire, something added by r.js.
        fs = require.nodeRequire('fs');

        text.get = function (url, callback) {
            var file = fs.readFileSync(url, 'utf8');
            //Remove BOM (Byte Mark Order) from utf8 files if it is there.
            if (file.indexOf('\uFEFF') === 0) {
                file = file.substring(1);
            }
            callback(file);
        };
    } else if (masterConfig.env === 'xhr' || (!masterConfig.env &&
            text.createXhr())) {
        text.get = function (url, callback, errback, headers) {
            var xhr = text.createXhr(), header;
            xhr.open('GET', url, true);

            //Allow plugins direct access to xhr headers
            if (headers) {
                for (header in headers) {
                    if (headers.hasOwnProperty(header)) {
                        xhr.setRequestHeader(header.toLowerCase(), headers[header]);
                    }
                }
            }

            //Allow overrides specified in config
            if (masterConfig.onXhr) {
                masterConfig.onXhr(xhr, url);
            }

            xhr.onreadystatechange = function (evt) {
                var status, err;
                //Do not explicitly handle errors, those should be
                //visible via console output in the browser.
                if (xhr.readyState === 4) {
                    status = xhr.status;
                    if (status > 399 && status < 600) {
                        //An http 4xx or 5xx error. Signal an error.
                        err = new Error(url + ' HTTP status: ' + status);
                        err.xhr = xhr;
                        errback(err);
                    } else {
                        callback(xhr.responseText);
                    }
                }
            };
            xhr.send(null);
        };
    } else if (masterConfig.env === 'rhino' || (!masterConfig.env &&
            typeof Packages !== 'undefined' && typeof java !== 'undefined')) {
        //Why Java, why is this so awkward?
        text.get = function (url, callback) {
            var stringBuffer, line,
                encoding = "utf-8",
                file = new java.io.File(url),
                lineSeparator = java.lang.System.getProperty("line.separator"),
                input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)),
                content = '';
            try {
                stringBuffer = new java.lang.StringBuffer();
                line = input.readLine();

                // Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324
                // http://www.unicode.org/faq/utf_bom.html

                // Note that when we use utf-8, the BOM should appear as "EF BB BF", but it doesn't due to this bug in the JDK:
                // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058
                if (line && line.length() && line.charAt(0) === 0xfeff) {
                    // Eat the BOM, since we've already found the encoding on this file,
                    // and we plan to concatenating this buffer with others; the BOM should
                    // only appear at the top of a file.
                    line = line.substring(1);
                }

                stringBuffer.append(line);

                while ((line = input.readLine()) !== null) {
                    stringBuffer.append(lineSeparator);
                    stringBuffer.append(line);
                }
                //Make sure we return a JavaScript string and not a Java string.
                content = String(stringBuffer.toString()); //String
            } finally {
                input.close();
            }
            callback(content);
        };
    }

    return text;
});

/** @license
 * RequireJS plugin for loading JSON files
 * - depends on Text plugin and it was HEAVILY "inspired" by it as well.
 * Author: Miller Medeiros
 * Version: 0.4.0 (2014/04/10)
 * Released under the MIT license
 */
define('json',['text'], function(text){

    var CACHE_BUST_QUERY_PARAM = 'bust',
        CACHE_BUST_FLAG = '!bust',
        jsonParse = (typeof JSON !== 'undefined' && typeof JSON.parse === 'function')? JSON.parse : function(val){
            return eval('('+ val +')'); //quick and dirty
        },
        buildMap = {};

    function cacheBust(url){
        url = url.replace(CACHE_BUST_FLAG, '');
        url += (url.indexOf('?') < 0)? '?' : '&';
        return url + CACHE_BUST_QUERY_PARAM +'='+ Math.round(2147483647 * Math.random());
    }

    //API
    return {

        load : function(name, req, onLoad, config) {
            if (( config.isBuild && (config.inlineJSON === false || name.indexOf(CACHE_BUST_QUERY_PARAM +'=') !== -1)) || (req.toUrl(name).indexOf('empty:') === 0)) {
                //avoid inlining cache busted JSON or if inlineJSON:false
                //and don't inline files marked as empty!
                onLoad(null);
            } else {
                text.get(req.toUrl(name), function(data){
                    if (config.isBuild) {
                        buildMap[name] = data;
                        onLoad(data);
                    } else {
                        onLoad(jsonParse(data));
                    }
                },
                    onLoad.error, {
                        accept: 'application/json'
                    }
                );
            }
        },

        normalize : function (name, normalize) {
            // used normalize to avoid caching references to a "cache busted" request
            if (name.indexOf(CACHE_BUST_FLAG) !== -1) {
                name = cacheBust(name);
            }
            // resolve any relative paths
            return normalize(name);
        },

        //write method based on RequireJS official text plugin by James Burke
        //https://github.com/jrburke/requirejs/blob/master/text.js
        write : function(pluginName, moduleName, write){
            if(moduleName in buildMap){
                var content = buildMap[moduleName];
                write('define("'+ pluginName +'!'+ moduleName +'", function(){ return '+ content +';});\n');
            }
        }

    };
});


define("json!mock/allstations.json", function(){ return [{"Name":"Abbey Wood","CrsCode":"ABW","Latitude":51.49072,"Longitude":0.120343},{"Name":"Aber","CrsCode":"ABE","Latitude":51.5753632,"Longitude":-3.23089},{"Name":"Abercynon","CrsCode":"ACY","Latitude":51.64262,"Longitude":-3.329549},{"Name":"Aberdare","CrsCode":"ABA","Latitude":51.71502,"Longitude":-3.44313},{"Name":"Aberdeen","CrsCode":"ABD","Latitude":57.1431274,"Longitude":-2.097464},{"Name":"Aberdour","CrsCode":"AUR","Latitude":56.0546455,"Longitude":-3.300575},{"Name":"Aberdovey","CrsCode":"AVY","Latitude":52.5439339,"Longitude":-4.057118},{"Name":"Abererch","CrsCode":"ABH","Latitude":52.8985672,"Longitude":-4.37423},{"Name":"Abergavenny","CrsCode":"AGV","Latitude":51.81665,"Longitude":-3.009679},{"Name":"Abergele And Pensarn","CrsCode":"AGL","Latitude":53.2947578,"Longitude":-3.581343},{"Name":"Aberystwyth","CrsCode":"AYW","Latitude":52.4140167,"Longitude":-4.081946},{"Name":"Accrington","CrsCode":"ACR","Latitude":53.7531929,"Longitude":-2.370016},{"Name":"Achanalt","CrsCode":"AAT","Latitude":57.60992,"Longitude":-4.914243},{"Name":"Achnasheen","CrsCode":"ACN","Latitude":57.5792046,"Longitude":-5.072421},{"Name":"Achnashellach","CrsCode":"ACH","Latitude":57.4826965,"Longitude":-5.333001},{"Name":"Acklington","CrsCode":"ACK","Latitude":55.30713,"Longitude":-1.651816},{"Name":"Acle","CrsCode":"ACL","Latitude":52.6346474,"Longitude":1.543981},{"Name":"Acocks Green","CrsCode":"ACG","Latitude":52.44929,"Longitude":-1.81898},{"Name":"Acton Bridge (Cheshire)","CrsCode":"ACB","Latitude":53.26596,"Longitude":-2.602689},{"Name":"Acton Central","CrsCode":"ACC","Latitude":51.5087166,"Longitude":-0.263601},{"Name":"Acton Main Line","CrsCode":"AML","Latitude":51.5168648,"Longitude":-0.26762},{"Name":"Adderley Park","CrsCode":"ADD","Latitude":52.4835052,"Longitude":-1.854184},{"Name":"Addiewell","CrsCode":"ADW","Latitude":55.84345,"Longitude":-3.60655},{"Name":"Addlestone","CrsCode":"ASN","Latitude":51.3724136,"Longitude":-0.48571},{"Name":"Adisham","CrsCode":"ADM","Latitude":51.2413521,"Longitude":1.199277},{"Name":"Adlington (Cheshire)","CrsCode":"ADC","Latitude":53.3195419,"Longitude":-2.133571},{"Name":"Adlington (Lancashire)","CrsCode":"ADL","Latitude":53.6129265,"Longitude":-2.603084},{"Name":"Adwick","CrsCode":"AWK","Latitude":53.5729942,"Longitude":-1.181465},{"Name":"Aigburth","CrsCode":"AIG","Latitude":53.3646126,"Longitude":-2.927041},{"Name":"Ainsdale","CrsCode":"ANS","Latitude":53.6018181,"Longitude":-3.042691},{"Name":"Aintree","CrsCode":"AIN","Latitude":53.4739952,"Longitude":-2.956687},{"Name":"Airbles","CrsCode":"AIR","Latitude":55.782505,"Longitude":-3.994447},{"Name":"Airdrie","CrsCode":"ADR","Latitude":55.86403,"Longitude":-3.982952},{"Name":"Albany Park","CrsCode":"AYP","Latitude":51.4357452,"Longitude":0.126427},{"Name":"Albrighton","CrsCode":"ALB","Latitude":52.6379166,"Longitude":-2.268913},{"Name":"Aldeburgh (Via Saxmundham)","CrsCode":"ALG","Latitude":52.1547546,"Longitude":1.600261},{"Name":"Alderley Edge","CrsCode":"ALD","Latitude":53.30376,"Longitude":-2.236812},{"Name":"Aldermaston","CrsCode":"AMT","Latitude":51.4020462,"Longitude":-1.136972},{"Name":"Aldershot","CrsCode":"AHT","Latitude":51.24615,"Longitude":-0.760657},{"Name":"Aldrington","CrsCode":"AGT","Latitude":50.8366,"Longitude":-0.182151},{"Name":"Alexandra Palace","CrsCode":"AAP","Latitude":51.5982246,"Longitude":-0.120129},{"Name":"Alexandra Parade","CrsCode":"AXP","Latitude":55.8637238,"Longitude":-4.211465},{"Name":"Alexandria","CrsCode":"ALX","Latitude":55.98513,"Longitude":-4.577534},{"Name":"Alfreton","CrsCode":"ALF","Latitude":53.1004143,"Longitude":-1.369689},{"Name":"Allens West","CrsCode":"ALW","Latitude":54.524128,"Longitude":-1.363418},{"Name":"Alloa","CrsCode":"ALO","Latitude":56.1179,"Longitude":-3.7872},{"Name":"Alness","CrsCode":"ASS","Latitude":57.6944771,"Longitude":-4.249743},{"Name":"Alnmouth","CrsCode":"ALM","Latitude":55.3924561,"Longitude":-1.636858},{"Name":"Alresford (Essex)","CrsCode":"ALR","Latitude":51.85383,"Longitude":0.997114},{"Name":"Alsager","CrsCode":"ASG","Latitude":53.0930557,"Longitude":-2.29861},{"Name":"Althorne (Essex)","CrsCode":"ALN","Latitude":51.6475258,"Longitude":0.753603},{"Name":"Althorpe","CrsCode":"ALP","Latitude":53.5852623,"Longitude":-0.732558},{"Name":"Altnabreac","CrsCode":"ABC","Latitude":58.38844,"Longitude":-3.705279},{"Name":"Alton","CrsCode":"AON","Latitude":51.151947,"Longitude":-0.967658},{"Name":"Altrincham","CrsCode":"ALT","Latitude":53.3874,"Longitude":-2.347212},{"Name":"Alvechurch","CrsCode":"ALV","Latitude":52.3466072,"Longitude":-1.967854},{"Name":"Ambergate","CrsCode":"AMB","Latitude":53.0605,"Longitude":-1.4807},{"Name":"Amberley","CrsCode":"AMY","Latitude":50.8965073,"Longitude":-0.542446},{"Name":"Amersham","CrsCode":"AMR","Latitude":51.67439,"Longitude":-0.60613},{"Name":"Ammanford","CrsCode":"AMF","Latitude":51.7959328,"Longitude":-3.996783},{"Name":"Ancaster","CrsCode":"ANC","Latitude":52.98789,"Longitude":-0.535596},{"Name":"Anderston","CrsCode":"AND","Latitude":55.8599243,"Longitude":-4.271969},{"Name":"Andover","CrsCode":"ADV","Latitude":51.2120476,"Longitude":-1.493167},{"Name":"Anerley","CrsCode":"ANZ","Latitude":51.41163,"Longitude":-0.064348},{"Name":"Angmering","CrsCode":"ANG","Latitude":50.8167038,"Longitude":-0.489559},{"Name":"Annan","CrsCode":"ANN","Latitude":54.98386,"Longitude":-3.262603},{"Name":"Anniesland","CrsCode":"ANL","Latitude":55.8895531,"Longitude":-4.321684},{"Name":"Ansdell And Fairhaven","CrsCode":"AFV","Latitude":53.7415581,"Longitude":-2.993077},{"Name":"Antrim","CrsCode":"ANM","Latitude":null,"Longitude":null},{"Name":"Antrim","CrsCode":"M020","Latitude":null,"Longitude":null},{"Name":"Apperley Bridge","CrsCode":"APY","Latitude":53.84138,"Longitude":-1.703065},{"Name":"Appleby","CrsCode":"APP","Latitude":54.58032,"Longitude":-2.486692},{"Name":"Appledore (Kent)","CrsCode":"APD","Latitude":51.0326233,"Longitude":0.816826},{"Name":"Appleford","CrsCode":"APF","Latitude":51.63956,"Longitude":-1.242375},{"Name":"Appley Bridge","CrsCode":"APB","Latitude":53.57903,"Longitude":-2.718906},{"Name":"Apsley","CrsCode":"APS","Latitude":51.73271,"Longitude":-0.463568},{"Name":"Arbroath","CrsCode":"ARB","Latitude":56.5596275,"Longitude":-2.588928},{"Name":"Ardgay","CrsCode":"ARD","Latitude":57.88112,"Longitude":-4.362604},{"Name":"Ardlui","CrsCode":"AUI","Latitude":56.3020248,"Longitude":-4.721712},{"Name":"Ardrossan (Any)","CrsCode":"4","Latitude":null,"Longitude":null},{"Name":"Ardrossan Harbour","CrsCode":"ADS","Latitude":55.6408539,"Longitude":-4.823461},{"Name":"Ardrossan South Beach","CrsCode":"ASB","Latitude":55.6404953,"Longitude":-4.799593},{"Name":"Ardrossan Town","CrsCode":"ADN","Latitude":55.6393127,"Longitude":-4.812212},{"Name":"Ardwick","CrsCode":"ADK","Latitude":53.47134,"Longitude":-2.213893},{"Name":"Argyle Street","CrsCode":"AGS","Latitude":55.855938,"Longitude":-4.244574},{"Name":"Arisaig","CrsCode":"ARG","Latitude":56.9126167,"Longitude":-5.839141},{"Name":"Arklow","CrsCode":"ARW","Latitude":null,"Longitude":null},{"Name":"Arlesey","CrsCode":"ARL","Latitude":52.0259361,"Longitude":-0.266178},{"Name":"Armadale (West Lothian)","CrsCode":"ARM","Latitude":55.88639,"Longitude":-3.68504},{"Name":"Armathwaite","CrsCode":"AWT","Latitude":54.8096123,"Longitude":-2.77209},{"Name":"Arnside","CrsCode":"ARN","Latitude":54.2021141,"Longitude":-2.827783},{"Name":"Arram","CrsCode":"ARR","Latitude":53.8845673,"Longitude":-0.426833},{"Name":"Arrochar And Tarbet","CrsCode":"ART","Latitude":56.20402,"Longitude":-4.722822},{"Name":"Arundel","CrsCode":"ARU","Latitude":50.8480034,"Longitude":-0.546796},{"Name":"Ascot (Berks)","CrsCode":"ACT","Latitude":51.4061852,"Longitude":-0.675827},{"Name":"Ascott-Under-Wychwood","CrsCode":"AUW","Latitude":51.8673744,"Longitude":-1.564136},{"Name":"Ash","CrsCode":"ASH","Latitude":51.24922,"Longitude":-0.711856},{"Name":"Ash Vale","CrsCode":"AHV","Latitude":51.27271,"Longitude":-0.721247},{"Name":"Ashburys","CrsCode":"ABY","Latitude":53.47176,"Longitude":-2.194991},{"Name":"Ashchurch For Tewkesbury","CrsCode":"ASC","Latitude":51.9971581,"Longitude":-2.10921},{"Name":"Ashfield","CrsCode":"ASF","Latitude":55.8892136,"Longitude":-4.2433},{"Name":"Ashford (Surrey)","CrsCode":"AFS","Latitude":51.4360466,"Longitude":-0.469229},{"Name":"Ashford International","CrsCode":"AFK","Latitude":51.1436729,"Longitude":0.873628},{"Name":"Ashley","CrsCode":"ASY","Latitude":53.3559837,"Longitude":-2.341029},{"Name":"Ashtead","CrsCode":"AHD","Latitude":51.31782,"Longitude":-0.308126},{"Name":"Ashton-Under-Lyne","CrsCode":"AHN","Latitude":53.4912643,"Longitude":-2.093415},{"Name":"Ashurst (Kent)","CrsCode":"AHS","Latitude":51.1286,"Longitude":0.152298},{"Name":"Ashurst New Forest","CrsCode":"ANF","Latitude":50.8888664,"Longitude":-1.525097},{"Name":"Ashwell And Morden","CrsCode":"AWM","Latitude":52.0305862,"Longitude":-0.10934},{"Name":"Askam","CrsCode":"ASK","Latitude":54.18905,"Longitude":-3.204545},{"Name":"Aslockton","CrsCode":"ALK","Latitude":52.95135,"Longitude":-0.898541},{"Name":"Aspatria","CrsCode":"ASP","Latitude":54.75934,"Longitude":-3.331752},{"Name":"Aspley Guise","CrsCode":"APG","Latitude":52.0207253,"Longitude":-0.631519},{"Name":"Aston","CrsCode":"AST","Latitude":52.5051041,"Longitude":-1.871788},{"Name":"Athenry","CrsCode":"ATR","Latitude":null,"Longitude":null},{"Name":"Atherstone","CrsCode":"ATH","Latitude":52.57895,"Longitude":-1.552808},{"Name":"Atherton","CrsCode":"ATN","Latitude":53.5288162,"Longitude":-2.478683},{"Name":"Athlone","CrsCode":"ATO","Latitude":null,"Longitude":null},{"Name":"Athy","CrsCode":"ATY","Latitude":null,"Longitude":null},{"Name":"Attadale","CrsCode":"ATT","Latitude":57.39487,"Longitude":-5.456549},{"Name":"Attenborough","CrsCode":"ATB","Latitude":52.9063225,"Longitude":-1.231262},{"Name":"Attleborough","CrsCode":"ATL","Latitude":52.5142136,"Longitude":1.022719},{"Name":"Auchinleck","CrsCode":"AUK","Latitude":55.47031,"Longitude":-4.295389},{"Name":"Audley End","CrsCode":"AUD","Latitude":52.0044,"Longitude":0.20719},{"Name":"Aughton Park","CrsCode":"AUG","Latitude":53.55447,"Longitude":-2.895095},{"Name":"Aviemore","CrsCode":"AVM","Latitude":57.18914,"Longitude":-3.828348},{"Name":"Avoncliff","CrsCode":"AVF","Latitude":51.3395958,"Longitude":-2.281342},{"Name":"Avonmouth","CrsCode":"AVN","Latitude":51.5001945,"Longitude":-2.699332},{"Name":"Axminster","CrsCode":"AXM","Latitude":50.7789764,"Longitude":-3.005613},{"Name":"Aylesbury","CrsCode":"AYS","Latitude":51.81387,"Longitude":-0.815048},{"Name":"Aylesbury Vale Parkway","CrsCode":"AVP","Latitude":51.8327,"Longitude":-0.8623},{"Name":"Aylesford","CrsCode":"AYL","Latitude":51.301384,"Longitude":0.465964},{"Name":"Aylesham","CrsCode":"AYH","Latitude":51.2271843,"Longitude":1.209682},{"Name":"Ayr","CrsCode":"AYR","Latitude":55.45825,"Longitude":-4.626878},{"Name":"Bache","CrsCode":"BAC","Latitude":53.2093124,"Longitude":-2.892386},{"Name":"Baglan","CrsCode":"BAJ","Latitude":51.61549,"Longitude":-3.811182},{"Name":"Bagshot","CrsCode":"BAG","Latitude":51.3649635,"Longitude":-0.688501},{"Name":"Baildon","CrsCode":"BLD","Latitude":53.84968,"Longitude":-1.753717},{"Name":"Baillieston","CrsCode":"BIO","Latitude":55.84476,"Longitude":-4.11454},{"Name":"Balcombe","CrsCode":"BAB","Latitude":51.05624,"Longitude":-0.137881},{"Name":"Baldock","CrsCode":"BDK","Latitude":51.9931564,"Longitude":-0.188106},{"Name":"Balham","CrsCode":"BAL","Latitude":51.44317,"Longitude":-0.152403},{"Name":"Ballina","CrsCode":"BAX","Latitude":null,"Longitude":null},{"Name":"Ballinasloe","CrsCode":"BSG","Latitude":null,"Longitude":null},{"Name":"Balloch","CrsCode":"BHC","Latitude":56.0029831,"Longitude":-4.583539},{"Name":"Ballybrophy (Irish Rail)","CrsCode":"BBY","Latitude":null,"Longitude":null},{"Name":"Ballyhaunis","CrsCode":"BHN","Latitude":null,"Longitude":null},{"Name":"Ballymena","CrsCode":"BMA","Latitude":null,"Longitude":null},{"Name":"Ballymote","CrsCode":"BAO","Latitude":null,"Longitude":null},{"Name":"Balmossie","CrsCode":"BSI","Latitude":56.4755478,"Longitude":-2.83764},{"Name":"Bamber Bridge","CrsCode":"BMB","Latitude":53.7267723,"Longitude":-2.660793},{"Name":"Bamford","CrsCode":"BAM","Latitude":53.3389854,"Longitude":-1.689078},{"Name":"Banavie","CrsCode":"BNV","Latitude":56.84338,"Longitude":-5.095477},{"Name":"Banbury","CrsCode":"BAN","Latitude":52.0609245,"Longitude":-1.327541},{"Name":"Bangor (Gwynedd)","CrsCode":"BNG","Latitude":53.2229,"Longitude":-4.135505},{"Name":"Bank Hall","CrsCode":"BAH","Latitude":53.43736,"Longitude":-2.987509},{"Name":"Banstead","CrsCode":"BAD","Latitude":51.32992,"Longitude":-0.214384},{"Name":"Banteer (Irish Rail)","CrsCode":"BNU","Latitude":null,"Longitude":null},{"Name":"Barassie","CrsCode":"BSS","Latitude":55.5611,"Longitude":-4.651181},{"Name":"Bardon Mill","CrsCode":"BLL","Latitude":54.9746361,"Longitude":-2.349922},{"Name":"Bare Lane","CrsCode":"BAR","Latitude":54.0744743,"Longitude":-2.835331},{"Name":"Bargeddie","CrsCode":"BGI","Latitude":55.8517761,"Longitude":-4.071789},{"Name":"Bargoed","CrsCode":"BGD","Latitude":51.69227,"Longitude":-3.229717},{"Name":"Barking","CrsCode":"BKG","Latitude":51.53998,"Longitude":0.080804},{"Name":"Barlaston","CrsCode":"BRT","Latitude":52.9428558,"Longitude":-2.168118},{"Name":"Barlaston Orchard Drive","CrsCode":"BPL","Latitude":null,"Longitude":null},{"Name":"Barming","CrsCode":"BMG","Latitude":51.2849045,"Longitude":0.479428},{"Name":"Barmouth","CrsCode":"BRM","Latitude":52.72287,"Longitude":-4.056641},{"Name":"Barnehurst","CrsCode":"BNH","Latitude":51.464798,"Longitude":0.160885},{"Name":"Barnes","CrsCode":"BNS","Latitude":51.4670143,"Longitude":-0.240711},{"Name":"Barnes Bridge","CrsCode":"BNI","Latitude":51.4716759,"Longitude":-0.252051},{"Name":"Barnetby","CrsCode":"BTB","Latitude":53.57422,"Longitude":-0.409679},{"Name":"Barnham","CrsCode":"BAA","Latitude":50.8311348,"Longitude":-0.639627},{"Name":"Barnhill","CrsCode":"BNL","Latitude":55.8778954,"Longitude":-4.223463},{"Name":"Barnsley","CrsCode":"BNY","Latitude":53.553978,"Longitude":-1.477688},{"Name":"Barnstaple","CrsCode":"BNP","Latitude":51.0735321,"Longitude":-4.064032},{"Name":"Barnt Green","CrsCode":"BTG","Latitude":52.36133,"Longitude":-1.994098},{"Name":"Barrhead","CrsCode":"BRR","Latitude":55.8045349,"Longitude":-4.396411},{"Name":"Barrhill","CrsCode":"BRL","Latitude":55.09703,"Longitude":-4.781834},{"Name":"Barrow Haven","CrsCode":"BAV","Latitude":53.69713,"Longitude":-0.391427},{"Name":"Barrow-In-Furness","CrsCode":"BIF","Latitude":54.1188774,"Longitude":-3.22614},{"Name":"Barrow-Upon-Soar","CrsCode":"BWS","Latitude":52.7502441,"Longitude":-1.14956},{"Name":"Barry","CrsCode":"BRY","Latitude":51.39673,"Longitude":-3.285023},{"Name":"Barry Docks","CrsCode":"BYD","Latitude":51.4023933,"Longitude":-3.260749},{"Name":"Barry Island","CrsCode":"BYI","Latitude":51.39236,"Longitude":-3.273405},{"Name":"Barry Links","CrsCode":"BYL","Latitude":56.493206,"Longitude":-2.745444},{"Name":"Barton-On-Humber","CrsCode":"BAU","Latitude":53.6888237,"Longitude":-0.443233},{"Name":"Basildon","CrsCode":"BSO","Latitude":51.5686722,"Longitude":0.457309},{"Name":"Basingstoke","CrsCode":"BSK","Latitude":51.26804,"Longitude":-1.086896},{"Name":"Bat And Ball","CrsCode":"BBL","Latitude":51.2897034,"Longitude":0.194258},{"Name":"Bath Spa","CrsCode":"BTH","Latitude":51.37806,"Longitude":-2.356302},{"Name":"Bathgate","CrsCode":"BHG","Latitude":55.8986778,"Longitude":-3.644019},{"Name":"Batley","CrsCode":"BTL","Latitude":53.70913,"Longitude":-1.622734},{"Name":"Battersby","CrsCode":"BTT","Latitude":54.4576874,"Longitude":-1.092945},{"Name":"Battersea Park","CrsCode":"BAK","Latitude":51.477272,"Longitude":-0.148151},{"Name":"Battle","CrsCode":"BAT","Latitude":50.91312,"Longitude":0.495169},{"Name":"Battlesbridge","CrsCode":"BLB","Latitude":51.6248055,"Longitude":0.565826},{"Name":"Bayford","CrsCode":"BAY","Latitude":51.75881,"Longitude":-0.096074},{"Name":"Beaconsfield","CrsCode":"BCF","Latitude":51.61114,"Longitude":-0.643644},{"Name":"Bearley","CrsCode":"BER","Latitude":52.24425,"Longitude":-1.750259},{"Name":"Bearsden","CrsCode":"BRN","Latitude":55.917202,"Longitude":-4.332945},{"Name":"Bearsted","CrsCode":"BSD","Latitude":51.27559,"Longitude":0.57786},{"Name":"Beasdale","CrsCode":"BSL","Latitude":56.8996239,"Longitude":-5.763864},{"Name":"Beaulieu Road","CrsCode":"BEU","Latitude":50.8542061,"Longitude":-1.505586},{"Name":"Beauly","CrsCode":"BEL","Latitude":57.478,"Longitude":-4.4698},{"Name":"Bebington","CrsCode":"BEB","Latitude":53.35765,"Longitude":-3.003659},{"Name":"Beccles","CrsCode":"BCC","Latitude":52.45848,"Longitude":1.569547},{"Name":"Beckenham Hill","CrsCode":"BEC","Latitude":51.4247665,"Longitude":-0.016497},{"Name":"Beckenham Junction","CrsCode":"BKJ","Latitude":51.4114456,"Longitude":-0.027144},{"Name":"Bedford","CrsCode":"BDM","Latitude":52.1361732,"Longitude":-0.47945},{"Name":"Bedford (Any)","CrsCode":"10","Latitude":null,"Longitude":null},{"Name":"Bedford St Johns","CrsCode":"BSJ","Latitude":52.1293,"Longitude":-0.467348},{"Name":"Bedhampton","CrsCode":"BDH","Latitude":50.8536377,"Longitude":-0.996989},{"Name":"Bedminster","CrsCode":"BMT","Latitude":51.4400368,"Longitude":-2.594184},{"Name":"Bedworth","CrsCode":"BEH","Latitude":52.4791336,"Longitude":-1.46749},{"Name":"Bedwyn","CrsCode":"BDW","Latitude":51.379715,"Longitude":-1.599077},{"Name":"Beeston","CrsCode":"BEE","Latitude":52.92055,"Longitude":-1.207211},{"Name":"Bekesbourne","CrsCode":"BKS","Latitude":51.26105,"Longitude":1.136125},{"Name":"Belfast Central","CrsCode":"BFC","Latitude":null,"Longitude":null},{"Name":"Belfast Port","CrsCode":"BFA","Latitude":null,"Longitude":null},{"Name":"Belford Bus","CrsCode":"BFB","Latitude":null,"Longitude":null},{"Name":"Belle Vue","CrsCode":"BLV","Latitude":53.46218,"Longitude":-2.180809},{"Name":"Bellgrove","CrsCode":"BLG","Latitude":55.85718,"Longitude":-4.22547},{"Name":"Bellingham","CrsCode":"BGM","Latitude":51.4338264,"Longitude":-0.020421},{"Name":"Bellshill","CrsCode":"BLH","Latitude":55.8166046,"Longitude":-4.025222},{"Name":"Belmont","CrsCode":"BLM","Latitude":51.3440857,"Longitude":-0.199471},{"Name":"Belper","CrsCode":"BLP","Latitude":53.0245552,"Longitude":-1.482622},{"Name":"Beltring","CrsCode":"BEG","Latitude":51.20465,"Longitude":0.403518},{"Name":"Belvedere","CrsCode":"BVD","Latitude":51.4919357,"Longitude":0.152088},{"Name":"Bempton","CrsCode":"BEM","Latitude":54.1282959,"Longitude":-0.180389},{"Name":"Ben Rhydding","CrsCode":"BEY","Latitude":53.9261665,"Longitude":-1.797429},{"Name":"Benfleet","CrsCode":"BEF","Latitude":51.5439644,"Longitude":0.561273},{"Name":"Bentham","CrsCode":"BEN","Latitude":54.11579,"Longitude":-2.510918},{"Name":"Bentley (Hampshire)","CrsCode":"BTY","Latitude":51.1806946,"Longitude":-0.868287},{"Name":"Bentley (South Yorkshire)","CrsCode":"BYK","Latitude":53.5428658,"Longitude":-1.148788},{"Name":"Bere Alston","CrsCode":"BAS","Latitude":50.4855347,"Longitude":-4.200418},{"Name":"Bere Ferrers","CrsCode":"BFE","Latitude":50.450798,"Longitude":-4.181901},{"Name":"Berkhamsted","CrsCode":"BKM","Latitude":51.7636375,"Longitude":-0.562498},{"Name":"Berkswell","CrsCode":"BKW","Latitude":52.39585,"Longitude":-1.642845},{"Name":"Bermuda Park","CrsCode":"BEP","Latitude":52.5029,"Longitude":-1.4726},{"Name":"Berney Arms","CrsCode":"BYA","Latitude":52.5897446,"Longitude":1.63043},{"Name":"Berry Brow","CrsCode":"BBW","Latitude":53.6223679,"Longitude":-1.797371},{"Name":"Berrylands","CrsCode":"BRS","Latitude":51.39838,"Longitude":-0.282157},{"Name":"Berwick (Sussex)","CrsCode":"BRK","Latitude":50.84057,"Longitude":0.164587},{"Name":"Berwick-Upon-Tweed","CrsCode":"BWK","Latitude":55.77487,"Longitude":-2.01112},{"Name":"Bescar Lane","CrsCode":"BES","Latitude":53.62353,"Longitude":-2.914703},{"Name":"Bescot Stadium","CrsCode":"BSC","Latitude":52.5627022,"Longitude":-1.991116},{"Name":"Betchworth","CrsCode":"BTO","Latitude":51.2479935,"Longitude":-0.26771},{"Name":"Bethnal Green","CrsCode":"BET","Latitude":51.5244064,"Longitude":-0.059747},{"Name":"Betws-Y-Coed","CrsCode":"BYC","Latitude":53.0920563,"Longitude":-3.80091},{"Name":"Beverley","CrsCode":"BEV","Latitude":53.84228,"Longitude":-0.423855},{"Name":"Bexhill","CrsCode":"BEX","Latitude":50.84068,"Longitude":0.475678},{"Name":"Bexley","CrsCode":"BXY","Latitude":51.4407425,"Longitude":0.148248},{"Name":"Bexleyheath","CrsCode":"BXH","Latitude":51.4634933,"Longitude":0.133471},{"Name":"Bicester (Any)","CrsCode":"11","Latitude":null,"Longitude":null},{"Name":"Bicester North","CrsCode":"BCS","Latitude":51.9034,"Longitude":-1.150517},{"Name":"Bicester Village","CrsCode":"BIT","Latitude":51.89343,"Longitude":-1.148393},{"Name":"Bickley","CrsCode":"BKL","Latitude":51.40033,"Longitude":0.044272},{"Name":"Bidston","CrsCode":"BID","Latitude":53.40913,"Longitude":-3.078589},{"Name":"Biggleswade","CrsCode":"BIW","Latitude":52.0850677,"Longitude":-0.260294},{"Name":"Bilbrook","CrsCode":"BBK","Latitude":52.6236954,"Longitude":-2.186101},{"Name":"Billericay","CrsCode":"BIC","Latitude":51.6288338,"Longitude":0.418656},{"Name":"Billingham","CrsCode":"BIL","Latitude":54.6063271,"Longitude":-1.278525},{"Name":"Billingshurst","CrsCode":"BIG","Latitude":51.01494,"Longitude":-0.450348},{"Name":"Bingham","CrsCode":"BIN","Latitude":52.9545364,"Longitude":-0.952044},{"Name":"Bingley","CrsCode":"BIY","Latitude":53.84803,"Longitude":-1.837327},{"Name":"Birchgrove","CrsCode":"BCG","Latitude":51.5216866,"Longitude":-3.203502},{"Name":"Birchington-On-Sea","CrsCode":"BCH","Latitude":51.3779564,"Longitude":1.300781},{"Name":"Birchwood","CrsCode":"BWD","Latitude":53.41193,"Longitude":-2.52802},{"Name":"Birkbeck","CrsCode":"BIK","Latitude":51.4038467,"Longitude":-0.056218},{"Name":"Birkdale","CrsCode":"BDL","Latitude":53.6335144,"Longitude":-3.014742},{"Name":"Birkenhead Central","CrsCode":"BKC","Latitude":53.3882446,"Longitude":-3.020897},{"Name":"Birkenhead Hamilton Square","CrsCode":"BKQ","Latitude":53.39469,"Longitude":-3.01365},{"Name":"Birkenhead North","CrsCode":"BKN","Latitude":53.40482,"Longitude":-3.057425},{"Name":"Birkenhead Park","CrsCode":"BKP","Latitude":53.3974152,"Longitude":-3.03927},{"Name":"Birmingham (Any)","CrsCode":"13","Latitude":null,"Longitude":null},{"Name":"Birmingham International","CrsCode":"BHI","Latitude":52.4506721,"Longitude":-1.725149},{"Name":"Birmingham Moor Street","CrsCode":"BMO","Latitude":52.4790535,"Longitude":-1.892483},{"Name":"Birmingham New Street","CrsCode":"BHM","Latitude":52.4781532,"Longitude":-1.898375},{"Name":"Birmingham Snow Hill","CrsCode":"BSW","Latitude":52.4835548,"Longitude":-1.899833},{"Name":"Bishop Auckland","CrsCode":"BIA","Latitude":54.6574821,"Longitude":-1.677545},{"Name":"Bishopbriggs","CrsCode":"BBG","Latitude":55.9039268,"Longitude":-4.224958},{"Name":"Bishops Stortford","CrsCode":"BIS","Latitude":51.86669,"Longitude":0.16557},{"Name":"Bishopstone (Sussex)","CrsCode":"BIP","Latitude":50.780014,"Longitude":0.082352},{"Name":"Bishopton (Renfrewshire)","CrsCode":"BPT","Latitude":55.9022064,"Longitude":-4.501637},{"Name":"Bitterne","CrsCode":"BTE","Latitude":50.9183426,"Longitude":-1.378279},{"Name":"Blackburn","CrsCode":"BBN","Latitude":53.7465134,"Longitude":-2.479135},{"Name":"Blackheath","CrsCode":"BKH","Latitude":51.4657059,"Longitude":0.008317},{"Name":"Blackhorse Road","CrsCode":"BHO","Latitude":51.5861435,"Longitude":-0.04123},{"Name":"Blackpool (Any)","CrsCode":"14","Latitude":null,"Longitude":null},{"Name":"Blackpool North","CrsCode":"BPN","Latitude":53.822773,"Longitude":-3.049908},{"Name":"Blackpool Pleasure Beach","CrsCode":"BPB","Latitude":53.7881546,"Longitude":-3.053856},{"Name":"Blackpool South","CrsCode":"BPS","Latitude":53.79861,"Longitude":-3.049081},{"Name":"Blackridge","CrsCode":"BKR","Latitude":55.88368,"Longitude":-3.75047},{"Name":"Blackrod","CrsCode":"BLK","Latitude":53.5915222,"Longitude":-2.56954},{"Name":"Blackwater","CrsCode":"BAW","Latitude":51.33176,"Longitude":-0.777023},{"Name":"Blaenau Ffestiniog","CrsCode":"BFF","Latitude":52.9962845,"Longitude":-3.944449},{"Name":"Blair Atholl","CrsCode":"BLA","Latitude":56.7656136,"Longitude":-3.85025},{"Name":"Blairhill","CrsCode":"BAI","Latitude":55.8666534,"Longitude":-4.04221},{"Name":"Blake Street","CrsCode":"BKT","Latitude":52.6050529,"Longitude":-1.844888},{"Name":"Blakedown","CrsCode":"BKD","Latitude":52.406147,"Longitude":-2.176365},{"Name":"Blantyre","CrsCode":"BLT","Latitude":55.7976,"Longitude":-4.086466},{"Name":"Blaydon","CrsCode":"BLO","Latitude":54.9658127,"Longitude":-1.712578},{"Name":"Bleasby","CrsCode":"BSB","Latitude":53.04165,"Longitude":-0.942469},{"Name":"Bletchley","CrsCode":"BLY","Latitude":51.99534,"Longitude":-0.736368},{"Name":"Bloxwich","CrsCode":"BLX","Latitude":52.61853,"Longitude":-2.011783},{"Name":"Bloxwich North","CrsCode":"BWN","Latitude":52.6256371,"Longitude":-2.019173},{"Name":"Blundellsands And Crosby","CrsCode":"BLN","Latitude":53.4876747,"Longitude":-3.039889},{"Name":"Blythe Bridge","CrsCode":"BYB","Latitude":52.9681244,"Longitude":-2.066966},{"Name":"Bodmin Parkway","CrsCode":"BOD","Latitude":50.4458237,"Longitude":-4.663026},{"Name":"Bodorgan","CrsCode":"BOR","Latitude":53.2042923,"Longitude":-4.418067},{"Name":"Bognor Regis","CrsCode":"BOG","Latitude":50.7865944,"Longitude":-0.676384},{"Name":"Bogston","CrsCode":"BGS","Latitude":55.9372673,"Longitude":-4.713676},{"Name":"Bolton","CrsCode":"BON","Latitude":53.5739822,"Longitude":-2.425661},{"Name":"Bolton-Upon-Dearne","CrsCode":"BTD","Latitude":53.5189857,"Longitude":-1.312217},{"Name":"Bookham","CrsCode":"BKA","Latitude":51.2883339,"Longitude":-0.385224},{"Name":"Bootle (Any)","CrsCode":"16","Latitude":null,"Longitude":null},{"Name":"Bootle (Cumbria)","CrsCode":"BOC","Latitude":54.29025,"Longitude":-3.394818},{"Name":"Bootle New Strand","CrsCode":"BNW","Latitude":53.4533577,"Longitude":-2.994676},{"Name":"Bootle Oriel Road","CrsCode":"BOT","Latitude":53.44656,"Longitude":-2.995791},{"Name":"Bordesley","CrsCode":"BBS","Latitude":52.4718437,"Longitude":-1.877771},{"Name":"Borough Green And Wrotham","CrsCode":"BRG","Latitude":51.29295,"Longitude":0.306296},{"Name":"Borth","CrsCode":"BRH","Latitude":52.491,"Longitude":-4.050236},{"Name":"Bosham","CrsCode":"BOH","Latitude":50.84326,"Longitude":-0.846655},{"Name":"Boston","CrsCode":"BSN","Latitude":52.9788,"Longitude":-0.030949},{"Name":"Botley","CrsCode":"BOE","Latitude":50.916748,"Longitude":-1.258809},{"Name":"Bottesford","CrsCode":"BTF","Latitude":52.94496,"Longitude":-0.796012},{"Name":"Bourne End","CrsCode":"BNE","Latitude":51.5765381,"Longitude":-0.711287},{"Name":"Bournemouth","CrsCode":"BMH","Latitude":50.727478,"Longitude":-1.863955},{"Name":"Bournville","CrsCode":"BRV","Latitude":52.4269371,"Longitude":-1.926434},{"Name":"Bow Brickhill","CrsCode":"BWB","Latitude":52.0034752,"Longitude":-0.696154},{"Name":"Bowes Park","CrsCode":"BOP","Latitude":51.6072159,"Longitude":-0.119761},{"Name":"Bowling","CrsCode":"BWG","Latitude":55.93113,"Longitude":-4.493879},{"Name":"Box Hill And Westhumble","CrsCode":"BXW","Latitude":51.253376,"Longitude":-0.329128},{"Name":"Boyle","CrsCode":"BOQ","Latitude":null,"Longitude":null},{"Name":"Bracknell","CrsCode":"BCE","Latitude":51.41332,"Longitude":-0.751833},{"Name":"Bradford (Any)","CrsCode":"17","Latitude":null,"Longitude":null},{"Name":"Bradford Forster Square","CrsCode":"BDQ","Latitude":53.79575,"Longitude":-1.752505},{"Name":"Bradford Interchange","CrsCode":"BDI","Latitude":53.7911949,"Longitude":-1.749701},{"Name":"Bradford-On-Avon","CrsCode":"BOA","Latitude":51.34506,"Longitude":-2.252669},{"Name":"Brading","CrsCode":"BDN","Latitude":50.67851,"Longitude":-1.13801},{"Name":"Braintree","CrsCode":"BTR","Latitude":51.87499,"Longitude":0.558261},{"Name":"Braintree Freeport","CrsCode":"BTP","Latitude":51.8693161,"Longitude":0.568258},{"Name":"Bramhall","CrsCode":"BML","Latitude":53.35996,"Longitude":-2.162249},{"Name":"Bramley (Hampshire)","CrsCode":"BMY","Latitude":51.32988,"Longitude":-1.061265},{"Name":"Bramley (West Yorkshire)","CrsCode":"BLE","Latitude":53.80353,"Longitude":-1.630985},{"Name":"Brampton (Cumbria)","CrsCode":"BMP","Latitude":54.9326553,"Longitude":-2.703814},{"Name":"Brampton (Suffolk)","CrsCode":"BRP","Latitude":52.3953972,"Longitude":1.543871},{"Name":"Branchton","CrsCode":"BCN","Latitude":55.9406471,"Longitude":-4.803598},{"Name":"Brandon","CrsCode":"BND","Latitude":52.45448,"Longitude":0.624116},{"Name":"Branksome","CrsCode":"BSM","Latitude":50.7275276,"Longitude":-1.919211},{"Name":"Braystones","CrsCode":"BYS","Latitude":54.43956,"Longitude":-3.543406},{"Name":"Bredbury","CrsCode":"BDY","Latitude":53.42294,"Longitude":-2.109823},{"Name":"Breich","CrsCode":"BRC","Latitude":55.82735,"Longitude":-3.668147},{"Name":"Brentford","CrsCode":"BFD","Latitude":51.4878044,"Longitude":-0.309048},{"Name":"Brentwood","CrsCode":"BRE","Latitude":51.61322,"Longitude":0.30083},{"Name":"Bricket Wood","CrsCode":"BWO","Latitude":51.7052231,"Longitude":-0.358846},{"Name":"Bridge Of Allan","CrsCode":"BEA","Latitude":56.15743,"Longitude":-3.956166},{"Name":"Bridge Of Orchy","CrsCode":"BRO","Latitude":56.5159264,"Longitude":-4.763048},{"Name":"Bridgend","CrsCode":"BGN","Latitude":51.50648,"Longitude":-3.576296},{"Name":"Bridgeton","CrsCode":"BDG","Latitude":55.849968,"Longitude":-4.226668},{"Name":"Bridgwater","CrsCode":"BWT","Latitude":51.1280251,"Longitude":-2.99031},{"Name":"Bridlington","CrsCode":"BDT","Latitude":54.0845451,"Longitude":-0.200659},{"Name":"Brierfield","CrsCode":"BRF","Latitude":53.8245354,"Longitude":-2.236959},{"Name":"Brigg","CrsCode":"BGG","Latitude":53.5491371,"Longitude":-0.486094},{"Name":"Brighouse","CrsCode":"BGH","Latitude":53.6987343,"Longitude":-1.781855},{"Name":"Brighton","CrsCode":"BTN","Latitude":50.82966,"Longitude":-0.141234},{"Name":"Brimsdown","CrsCode":"BMD","Latitude":51.6552238,"Longitude":-0.031022},{"Name":"Brinnington","CrsCode":"BNT","Latitude":53.43188,"Longitude":-2.134097},{"Name":"Bristol Airport (By Bus)","CrsCode":"XPB","Latitude":null,"Longitude":null},{"Name":"Bristol Parkway","CrsCode":"BPW","Latitude":51.51406,"Longitude":-2.53461},{"Name":"Bristol Temple Meads","CrsCode":"BRI","Latitude":51.4490929,"Longitude":-2.581349},{"Name":"Brithdir","CrsCode":"BHD","Latitude":51.7102661,"Longitude":-3.228765},{"Name":"Briton Ferry","CrsCode":"BNF","Latitude":51.63785,"Longitude":-3.8193},{"Name":"Brixton","CrsCode":"BRX","Latitude":51.4632454,"Longitude":-0.114164},{"Name":"Broad Green","CrsCode":"BGE","Latitude":53.40654,"Longitude":-2.893267},{"Name":"Broadbottom","CrsCode":"BDB","Latitude":53.4409676,"Longitude":-2.01653},{"Name":"Broadstairs","CrsCode":"BSR","Latitude":51.3606529,"Longitude":1.43317},{"Name":"Brockenhurst","CrsCode":"BCU","Latitude":50.8167076,"Longitude":-1.574112},{"Name":"Brockholes","CrsCode":"BHS","Latitude":53.59715,"Longitude":-1.770299},{"Name":"Brockley","CrsCode":"BCY","Latitude":51.4646835,"Longitude":-0.037797},{"Name":"Brockley Whins","CrsCode":"BNR","Latitude":54.95867,"Longitude":-1.462749},{"Name":"Brodick (Arran)","CrsCode":"BDC","Latitude":null,"Longitude":null},{"Name":"Bromborough","CrsCode":"BOM","Latitude":53.3221474,"Longitude":-2.987058},{"Name":"Bromborough Rake","CrsCode":"BMR","Latitude":53.3299,"Longitude":-2.989644},{"Name":"Bromley Cross (Lancs)","CrsCode":"BMC","Latitude":53.6137428,"Longitude":-2.409614},{"Name":"Bromley North","CrsCode":"BMN","Latitude":51.4088936,"Longitude":0.017325},{"Name":"Bromley South","CrsCode":"BMS","Latitude":51.3998871,"Longitude":0.018374},{"Name":"Bromsgrove","CrsCode":"BMV","Latitude":52.3226624,"Longitude":-2.048379},{"Name":"Brondesbury","CrsCode":"BSY","Latitude":51.5455742,"Longitude":-0.203063},{"Name":"Brondesbury Park","CrsCode":"BSP","Latitude":51.5408974,"Longitude":-0.209955},{"Name":"Brookmans Park","CrsCode":"BPK","Latitude":51.7209549,"Longitude":-0.204811},{"Name":"Brookwood","CrsCode":"BKO","Latitude":51.303215,"Longitude":-0.635753},{"Name":"Broome","CrsCode":"BME","Latitude":52.4227448,"Longitude":-2.88524},{"Name":"Broomfleet","CrsCode":"BMF","Latitude":53.74013,"Longitude":-0.673328},{"Name":"Brora","CrsCode":"BRA","Latitude":58.0126572,"Longitude":-3.853251},{"Name":"Brough","CrsCode":"BUH","Latitude":53.72645,"Longitude":-0.578255},{"Name":"Broughty Ferry","CrsCode":"BYF","Latitude":56.4672127,"Longitude":-2.873153},{"Name":"Broxbourne","CrsCode":"BXB","Latitude":51.7457123,"Longitude":-0.011157},{"Name":"Bruce Grove","CrsCode":"BCV","Latitude":51.59292,"Longitude":-0.06982},{"Name":"Brundall","CrsCode":"BDA","Latitude":52.6197472,"Longitude":1.439316},{"Name":"Brundall Gardens","CrsCode":"BGA","Latitude":52.6230354,"Longitude":1.418896},{"Name":"Brunstane","CrsCode":"BSU","Latitude":55.94143,"Longitude":-3.10064},{"Name":"Brunswick","CrsCode":"BRW","Latitude":53.3821526,"Longitude":-2.975665},{"Name":"Bruton","CrsCode":"BRU","Latitude":51.1115837,"Longitude":-2.447103},{"Name":"Bryn","CrsCode":"BYN","Latitude":53.4998932,"Longitude":-2.647233},{"Name":"Buckenham","CrsCode":"BUC","Latitude":52.59816,"Longitude":1.47013},{"Name":"Buckley","CrsCode":"BCK","Latitude":53.16302,"Longitude":-3.055948},{"Name":"Bucknell","CrsCode":"BUK","Latitude":52.3575249,"Longitude":-2.948551},{"Name":"Buckshaw Parkway","CrsCode":"BSV","Latitude":53.67283,"Longitude":-2.66447},{"Name":"Bude Bus","CrsCode":"BUA","Latitude":null,"Longitude":null},{"Name":"Bugle","CrsCode":"BGL","Latitude":50.39998,"Longitude":-4.791736},{"Name":"Builth Road","CrsCode":"BHR","Latitude":52.16929,"Longitude":-3.427068},{"Name":"Bulwell","CrsCode":"BLW","Latitude":52.9996262,"Longitude":-1.196115},{"Name":"Bures","CrsCode":"BUE","Latitude":51.97094,"Longitude":0.769021},{"Name":"Burgess Hill","CrsCode":"BUG","Latitude":50.9535522,"Longitude":-0.127749},{"Name":"Burley Park","CrsCode":"BUY","Latitude":53.8087425,"Longitude":-1.576277},{"Name":"Burley-In-Wharfedale","CrsCode":"BUW","Latitude":53.90811,"Longitude":-1.753363},{"Name":"Burnage","CrsCode":"BNA","Latitude":53.4212036,"Longitude":-2.215896},{"Name":"Burneside (Cumbria)","CrsCode":"BUD","Latitude":54.3553047,"Longitude":-2.766231},{"Name":"Burnham (Buckinghamshire)","CrsCode":"BNM","Latitude":51.5235367,"Longitude":-0.647335},{"Name":"Burnham-On-Crouch","CrsCode":"BUU","Latitude":51.6335258,"Longitude":0.813459},{"Name":"Burnley (Any)","CrsCode":"24","Latitude":null,"Longitude":null},{"Name":"Burnley Barracks","CrsCode":"BUB","Latitude":53.7912369,"Longitude":-2.258014},{"Name":"Burnley Central","CrsCode":"BNC","Latitude":53.7937775,"Longitude":-2.244644},{"Name":"Burnley Manchester Road","CrsCode":"BYM","Latitude":53.78496,"Longitude":-2.248883},{"Name":"Burnside (South Lanarkshire)","CrsCode":"BUI","Latitude":55.8171234,"Longitude":-4.204029},{"Name":"Burntisland","CrsCode":"BTS","Latitude":56.0571327,"Longitude":-3.233214},{"Name":"Burscough Bridge","CrsCode":"BCB","Latitude":53.60519,"Longitude":-2.841758},{"Name":"Burscough Junction","CrsCode":"BCJ","Latitude":53.59801,"Longitude":-2.840105},{"Name":"Bursledon","CrsCode":"BUO","Latitude":50.88286,"Longitude":-1.304835},{"Name":"Burton Joyce","CrsCode":"BUJ","Latitude":52.9840469,"Longitude":-1.040698},{"Name":"Burton-On-Trent","CrsCode":"BUT","Latitude":52.8057976,"Longitude":-1.64246},{"Name":"Bury St Edmunds","CrsCode":"BSE","Latitude":52.253727,"Longitude":0.713355},{"Name":"Busby","CrsCode":"BUS","Latitude":55.78011,"Longitude":-4.262551},{"Name":"Bush Hill Park","CrsCode":"BHK","Latitude":51.6423645,"Longitude":-0.06916},{"Name":"Bushey","CrsCode":"BSH","Latitude":51.64467,"Longitude":-0.384806},{"Name":"Butlers Lane","CrsCode":"BUL","Latitude":52.5923767,"Longitude":-1.838163},{"Name":"Buxted","CrsCode":"BXD","Latitude":50.9904747,"Longitude":0.131651},{"Name":"Buxton","CrsCode":"BUX","Latitude":53.26058,"Longitude":-1.913086},{"Name":"Byfleet And New Haw","CrsCode":"BFN","Latitude":51.34987,"Longitude":-0.480714},{"Name":"Bynea","CrsCode":"BYE","Latitude":51.67276,"Longitude":-4.098396},{"Name":"Cadoxton","CrsCode":"CAD","Latitude":51.4124222,"Longitude":-3.248087},{"Name":"Caergwrle","CrsCode":"CGW","Latitude":53.10792,"Longitude":-3.033069},{"Name":"Caerphilly","CrsCode":"CPH","Latitude":51.5719032,"Longitude":-3.217805},{"Name":"Caersws","CrsCode":"CWS","Latitude":52.5162621,"Longitude":-3.43387},{"Name":"Cahir","CrsCode":"CAH","Latitude":null,"Longitude":null},{"Name":"Cairnryan","CrsCode":"CRP","Latitude":null,"Longitude":null},{"Name":"Caldercruix","CrsCode":"CAC","Latitude":55.88791,"Longitude":-3.88978},{"Name":"Caldicot","CrsCode":"CDT","Latitude":51.58474,"Longitude":-2.760598},{"Name":"Caledonian Road And Barnsbury","CrsCode":"CIR","Latitude":51.5433,"Longitude":-0.115177},{"Name":"Calstock","CrsCode":"CSK","Latitude":50.4974861,"Longitude":-4.208665},{"Name":"Cam And Dursley","CrsCode":"CDU","Latitude":51.71701,"Longitude":-2.366194},{"Name":"Camberley","CrsCode":"CAM","Latitude":51.33591,"Longitude":-0.745328},{"Name":"Camborne","CrsCode":"CBN","Latitude":50.210392,"Longitude":-5.297921},{"Name":"Cambridge","CrsCode":"CBG","Latitude":52.19452,"Longitude":0.137584},{"Name":"Cambridge Heath","CrsCode":"CBH","Latitude":51.53157,"Longitude":-0.057997},{"Name":"Cambridge North","CrsCode":"CMB","Latitude":52.22333,"Longitude":0.157778},{"Name":"Cambuslang","CrsCode":"CBL","Latitude":55.819458,"Longitude":-4.173839},{"Name":"Camden Road","CrsCode":"CMD","Latitude":51.54189,"Longitude":-0.139764},{"Name":"Camelon","CrsCode":"CMO","Latitude":56.0067749,"Longitude":-3.817015},{"Name":"Campbeltown","CrsCode":"CBT","Latitude":null,"Longitude":null},{"Name":"Canada Water","CrsCode":"ZCW","Latitude":51.49823,"Longitude":-0.05076},{"Name":"Canley","CrsCode":"CNL","Latitude":52.3994179,"Longitude":-1.547232},{"Name":"Cannock","CrsCode":"CAO","Latitude":52.6867676,"Longitude":-2.022158},{"Name":"Canonbury","CrsCode":"CNN","Latitude":51.548748,"Longitude":-0.091614},{"Name":"Canterbury (Any)","CrsCode":"26","Latitude":null,"Longitude":null},{"Name":"Canterbury East","CrsCode":"CBE","Latitude":51.27526,"Longitude":1.075434},{"Name":"Canterbury West","CrsCode":"CBW","Latitude":51.28428,"Longitude":1.074608},{"Name":"Cantley","CrsCode":"CNY","Latitude":52.578907,"Longitude":1.512899},{"Name":"Capenhurst","CrsCode":"CPU","Latitude":53.2601547,"Longitude":-2.942908},{"Name":"Carbis Bay","CrsCode":"CBB","Latitude":50.19746,"Longitude":-5.463815},{"Name":"Cardenden","CrsCode":"CDD","Latitude":56.1413078,"Longitude":-3.261651},{"Name":"Cardiff Air Bus","CrsCode":"XCF","Latitude":51.3966675,"Longitude":-3.343333},{"Name":"Cardiff Bay","CrsCode":"CDB","Latitude":51.4663239,"Longitude":-3.166049},{"Name":"Cardiff Central","CrsCode":"CDF","Latitude":51.475193,"Longitude":-3.177794},{"Name":"Cardiff Queen Street","CrsCode":"CDQ","Latitude":51.4824638,"Longitude":-3.170782},{"Name":"Cardonald","CrsCode":"CDO","Latitude":55.8532524,"Longitude":-4.340297},{"Name":"Cardross","CrsCode":"CDR","Latitude":55.9601631,"Longitude":-4.652782},{"Name":"Carfin","CrsCode":"CRF","Latitude":55.80694,"Longitude":-3.956112},{"Name":"Cark And Cartmel","CrsCode":"CAK","Latitude":54.1775131,"Longitude":-2.972746},{"Name":"Carlisle","CrsCode":"CAR","Latitude":54.8906746,"Longitude":-2.933833},{"Name":"Carlow","CrsCode":"CAW","Latitude":null,"Longitude":null},{"Name":"Carlton","CrsCode":"CTO","Latitude":52.9645729,"Longitude":-1.078357},{"Name":"Carluke","CrsCode":"CLU","Latitude":55.7304077,"Longitude":-3.848761},{"Name":"Carmarthen","CrsCode":"CMN","Latitude":51.8532333,"Longitude":-4.305732},{"Name":"Carmyle","CrsCode":"CML","Latitude":55.834053,"Longitude":-4.161873},{"Name":"Carnforth","CrsCode":"CNF","Latitude":54.12969,"Longitude":-2.771244},{"Name":"Carnoustie","CrsCode":"CAN","Latitude":56.500618,"Longitude":-2.7066},{"Name":"Carntyne","CrsCode":"CAY","Latitude":55.8544121,"Longitude":-4.17898},{"Name":"Carpenders Park","CrsCode":"CPK","Latitude":51.6278839,"Longitude":-0.385578},{"Name":"Carrbridge","CrsCode":"CAG","Latitude":57.2798729,"Longitude":-3.829541},{"Name":"Carrick-On-Shannon","CrsCode":"CKA","Latitude":null,"Longitude":null},{"Name":"Carrick-On-Suir","CrsCode":"CKU","Latitude":null,"Longitude":null},{"Name":"Carshalton","CrsCode":"CSH","Latitude":51.36786,"Longitude":-0.16693},{"Name":"Carshalton Beeches","CrsCode":"CSB","Latitude":51.3571167,"Longitude":-0.17023},{"Name":"Carstairs","CrsCode":"CRS","Latitude":55.69075,"Longitude":-3.668696},{"Name":"Cartsdyke","CrsCode":"CDY","Latitude":55.94226,"Longitude":-4.731633},{"Name":"Castle Bar Park","CrsCode":"CBP","Latitude":51.5228653,"Longitude":-0.331575},{"Name":"Castle Cary","CrsCode":"CLC","Latitude":51.0995827,"Longitude":-2.522683},{"Name":"Castlebar","CrsCode":"CLB","Latitude":null,"Longitude":null},{"Name":"Castleford","CrsCode":"CFD","Latitude":53.72417,"Longitude":-1.355852},{"Name":"Castlerea","CrsCode":"CSE","Latitude":null,"Longitude":null},{"Name":"Castleton (Manchester)","CrsCode":"CAS","Latitude":53.5918045,"Longitude":-2.178125},{"Name":"Castleton Moor","CrsCode":"CSM","Latitude":54.4672966,"Longitude":-0.947707},{"Name":"Caterham","CrsCode":"CAT","Latitude":51.2828026,"Longitude":-0.078539},{"Name":"Catford","CrsCode":"CTF","Latitude":51.444706,"Longitude":-0.025701},{"Name":"Catford (Any)","CrsCode":"33","Latitude":null,"Longitude":null},{"Name":"Catford Bridge","CrsCode":"CFB","Latitude":51.444725,"Longitude":-0.027142},{"Name":"Cathays","CrsCode":"CYS","Latitude":51.488678,"Longitude":-3.178149},{"Name":"Cathcart","CrsCode":"CCT","Latitude":55.81788,"Longitude":-4.261552},{"Name":"Cattal","CrsCode":"CTL","Latitude":53.9975166,"Longitude":-1.319808},{"Name":"Catterick Garrison Bus","CrsCode":"CGT","Latitude":null,"Longitude":null},{"Name":"Causeland","CrsCode":"CAU","Latitude":50.4055252,"Longitude":-4.466937},{"Name":"Cefn-Y-Bedd","CrsCode":"CYB","Latitude":53.09851,"Longitude":-3.031972},{"Name":"Chadwell Heath","CrsCode":"CTH","Latitude":51.5679054,"Longitude":0.128263},{"Name":"Chafford Hundred Lakeside","CrsCode":"CFH","Latitude":51.5027924,"Longitude":0.290938},{"Name":"Chalfont And Latimer","CrsCode":"CFO","Latitude":51.66835,"Longitude":-0.560646},{"Name":"Chalkwell","CrsCode":"CHW","Latitude":51.53883,"Longitude":0.6706},{"Name":"Chandlers Ford","CrsCode":"CFR","Latitude":50.983,"Longitude":-1.3845},{"Name":"Chapel-En-Le-Frith","CrsCode":"CEF","Latitude":53.3124046,"Longitude":-1.918915},{"Name":"Chapelton (Devon)","CrsCode":"CPN","Latitude":51.01577,"Longitude":-4.024398},{"Name":"Chapeltown (South Yorkshire)","CrsCode":"CLN","Latitude":53.4640465,"Longitude":-1.466743},{"Name":"Chappel And Wakes Colne","CrsCode":"CWC","Latitude":51.925312,"Longitude":0.758944},{"Name":"Charing (Kent)","CrsCode":"CHG","Latitude":51.20865,"Longitude":0.790337},{"Name":"Charing Cross (Glasgow)","CrsCode":"CHC","Latitude":55.865345,"Longitude":-4.270689},{"Name":"Charlbury","CrsCode":"CBY","Latitude":51.87293,"Longitude":-1.490133},{"Name":"Charleville","CrsCode":"CHJ","Latitude":null,"Longitude":null},{"Name":"Charlton","CrsCode":"CTN","Latitude":51.4869041,"Longitude":0.030852},{"Name":"Chartham","CrsCode":"CRT","Latitude":51.256958,"Longitude":1.018303},{"Name":"Chassen Road","CrsCode":"CSR","Latitude":53.44605,"Longitude":-2.368171},{"Name":"Chatelherault","CrsCode":"CTE","Latitude":55.76521,"Longitude":-4.00466},{"Name":"Chatham","CrsCode":"CTM","Latitude":51.38116,"Longitude":0.520559},{"Name":"Chathill","CrsCode":"CHT","Latitude":55.5364037,"Longitude":-1.706846},{"Name":"Cheadle Hulme","CrsCode":"CHU","Latitude":53.3759575,"Longitude":-2.188125},{"Name":"Cheam","CrsCode":"CHE","Latitude":51.35601,"Longitude":-0.2148},{"Name":"Cheddington","CrsCode":"CED","Latitude":51.8579063,"Longitude":-0.662168},{"Name":"Chelford (Cheshire)","CrsCode":"CEL","Latitude":53.2707443,"Longitude":-2.280375},{"Name":"Chelmsford","CrsCode":"CHM","Latitude":51.7365952,"Longitude":0.469316},{"Name":"Chelsfield","CrsCode":"CLD","Latitude":51.35603,"Longitude":0.108373},{"Name":"Chelt Races Bus","CrsCode":"CRC","Latitude":null,"Longitude":null},{"Name":"Cheltenham Spa","CrsCode":"CNM","Latitude":51.8964653,"Longitude":-2.100245},{"Name":"Chepstow","CrsCode":"CPW","Latitude":51.6401367,"Longitude":-2.67193},{"Name":"Cherry Tree","CrsCode":"CYT","Latitude":53.73287,"Longitude":-2.518401},{"Name":"Chertsey","CrsCode":"CHY","Latitude":51.3871078,"Longitude":-0.509667},{"Name":"Chesham Underground","CrsCode":"ZCM","Latitude":null,"Longitude":null},{"Name":"Cheshunt","CrsCode":"CHN","Latitude":51.7027473,"Longitude":-0.023171},{"Name":"Chessington North","CrsCode":"CSN","Latitude":51.3644829,"Longitude":-0.300661},{"Name":"Chessington South","CrsCode":"CSS","Latitude":51.35649,"Longitude":-0.308144},{"Name":"Chester","CrsCode":"CTR","Latitude":53.1968155,"Longitude":-2.880152},{"Name":"Chester Road","CrsCode":"CRD","Latitude":52.5355759,"Longitude":-1.832582},{"Name":"Chester-Le-Street","CrsCode":"CLS","Latitude":54.8548851,"Longitude":-1.577847},{"Name":"Chesterfield","CrsCode":"CHD","Latitude":53.23821,"Longitude":-1.42011},{"Name":"Chestfield And Swalecliffe","CrsCode":"CSW","Latitude":51.3600044,"Longitude":1.068182},{"Name":"Chetnole","CrsCode":"CNO","Latitude":50.86643,"Longitude":-2.574072},{"Name":"Chichester","CrsCode":"CCH","Latitude":50.83182,"Longitude":-0.783032},{"Name":"Chilham","CrsCode":"CIL","Latitude":51.24455,"Longitude":0.975937},{"Name":"Chilworth","CrsCode":"CHL","Latitude":51.21553,"Longitude":-0.523795},{"Name":"Chingford","CrsCode":"CHI","Latitude":51.63385,"Longitude":0.009955},{"Name":"Chinley","CrsCode":"CLY","Latitude":53.3402748,"Longitude":-1.9444},{"Name":"Chippenham","CrsCode":"CPM","Latitude":51.462162,"Longitude":-2.115123},{"Name":"Chipstead","CrsCode":"CHP","Latitude":51.3094444,"Longitude":-0.169259},{"Name":"Chirk","CrsCode":"CRK","Latitude":52.9327927,"Longitude":-3.066708},{"Name":"Chislehurst","CrsCode":"CIT","Latitude":51.4055061,"Longitude":0.057437},{"Name":"Chiswick","CrsCode":"CHK","Latitude":51.4809,"Longitude":-0.267538},{"Name":"Cholsey","CrsCode":"CHO","Latitude":51.5701332,"Longitude":-1.157942},{"Name":"Chorley","CrsCode":"CRL","Latitude":53.6524277,"Longitude":-2.626693},{"Name":"Chorleywood","CrsCode":"CLW","Latitude":51.6541862,"Longitude":-0.51846},{"Name":"Christchurch","CrsCode":"CHR","Latitude":50.7381477,"Longitude":-1.784566},{"Name":"Christs Hospital","CrsCode":"CHH","Latitude":51.05063,"Longitude":-0.363538},{"Name":"Church And Oswaldtwistle","CrsCode":"CTW","Latitude":53.75043,"Longitude":-2.391216},{"Name":"Church Fenton","CrsCode":"CHF","Latitude":53.82767,"Longitude":-1.226652},{"Name":"Church Stretton","CrsCode":"CTT","Latitude":52.5366058,"Longitude":-2.803485},{"Name":"Cilmeri","CrsCode":"CIM","Latitude":52.1509361,"Longitude":-3.45719},{"Name":"City Thameslink","CrsCode":"CTK","Latitude":51.5143356,"Longitude":-0.103412},{"Name":"Clacton-On-Sea","CrsCode":"CLT","Latitude":51.7939529,"Longitude":1.154134},{"Name":"Clandon","CrsCode":"CLA","Latitude":51.2638321,"Longitude":-0.503622},{"Name":"Clapham (North Yorkshire)","CrsCode":"CPY","Latitude":54.1053925,"Longitude":-2.409858},{"Name":"Clapham High Street","CrsCode":"CLP","Latitude":51.46534,"Longitude":-0.1328},{"Name":"Clapham Junction","CrsCode":"CLJ","Latitude":51.4641342,"Longitude":-0.170281},{"Name":"Clapton","CrsCode":"CPT","Latitude":51.56213,"Longitude":-0.056685},{"Name":"Clara","CrsCode":"CLQ","Latitude":null,"Longitude":null},{"Name":"Clarbeston Road","CrsCode":"CLR","Latitude":51.8522072,"Longitude":-4.88221},{"Name":"Claremorris","CrsCode":"CMI","Latitude":null,"Longitude":null},{"Name":"Clarkston","CrsCode":"CKS","Latitude":55.789753,"Longitude":-4.275865},{"Name":"Claverdon","CrsCode":"CLV","Latitude":52.2764244,"Longitude":-1.696566},{"Name":"Claygate","CrsCode":"CLG","Latitude":51.3606644,"Longitude":-0.348207},{"Name":"Cleethorpes","CrsCode":"CLE","Latitude":53.56316,"Longitude":-0.029584},{"Name":"Cleland","CrsCode":"CEA","Latitude":55.8040733,"Longitude":-3.909695},{"Name":"Clifton (Manchester)","CrsCode":"CLI","Latitude":53.5225029,"Longitude":-2.314811},{"Name":"Clifton Down","CrsCode":"CFN","Latitude":51.46423,"Longitude":-2.611761},{"Name":"Clitheroe","CrsCode":"CLH","Latitude":53.87345,"Longitude":-2.394365},{"Name":"Clock House","CrsCode":"CLK","Latitude":51.4080963,"Longitude":-0.041668},{"Name":"Clonmel","CrsCode":"CLX","Latitude":null,"Longitude":null},{"Name":"Cloughjordan","CrsCode":"CLZ","Latitude":null,"Longitude":null},{"Name":"Clunderwen","CrsCode":"CUW","Latitude":51.8405,"Longitude":-4.731915},{"Name":"Clydebank","CrsCode":"CYK","Latitude":55.9005623,"Longitude":-4.403927},{"Name":"Coatbridge Central","CrsCode":"CBC","Latitude":55.8632126,"Longitude":-4.032443},{"Name":"Coatbridge Sunnyside","CrsCode":"CBS","Latitude":55.8668861,"Longitude":-4.027847},{"Name":"Coatdyke","CrsCode":"COA","Latitude":55.8645668,"Longitude":-4.005343},{"Name":"Cobh","CrsCode":"COQ","Latitude":null,"Longitude":null},{"Name":"Cobham And Stoke Dabernon","CrsCode":"CSD","Latitude":51.3180771,"Longitude":-0.389917},{"Name":"Codsall","CrsCode":"CSL","Latitude":52.6272621,"Longitude":-2.200891},{"Name":"Cogan","CrsCode":"CGN","Latitude":51.4453964,"Longitude":-3.189974},{"Name":"Colchester","CrsCode":"COL","Latitude":51.90048,"Longitude":0.894085},{"Name":"Colchester (Any)","CrsCode":"37","Latitude":null,"Longitude":null},{"Name":"Colchester Town","CrsCode":"CET","Latitude":51.8865051,"Longitude":0.904055},{"Name":"Coleraine","CrsCode":"CEI","Latitude":null,"Longitude":null},{"Name":"Coleshill Parkway","CrsCode":"CEH","Latitude":52.5164,"Longitude":-1.7081},{"Name":"Collingham","CrsCode":"CLM","Latitude":53.1440468,"Longitude":-0.748588},{"Name":"Collington","CrsCode":"CLL","Latitude":50.83927,"Longitude":0.457142},{"Name":"Collooney","CrsCode":"COU","Latitude":null,"Longitude":null},{"Name":"Colne","CrsCode":"CNE","Latitude":53.85478,"Longitude":-2.181087},{"Name":"Colwall","CrsCode":"CWL","Latitude":52.0802841,"Longitude":-2.357489},{"Name":"Colwyn Bay","CrsCode":"CWB","Latitude":53.29635,"Longitude":-3.725462},{"Name":"Combe (Oxon)","CrsCode":"CME","Latitude":51.8322754,"Longitude":-1.392817},{"Name":"Commondale","CrsCode":"COM","Latitude":54.4810181,"Longitude":-0.97514},{"Name":"Congleton","CrsCode":"CNG","Latitude":53.15764,"Longitude":-2.192754},{"Name":"Conisbrough","CrsCode":"CNS","Latitude":53.48885,"Longitude":-1.234333},{"Name":"Connel Ferry","CrsCode":"CON","Latitude":56.45198,"Longitude":-5.384973},{"Name":"Conon Bridge","CrsCode":"CBD","Latitude":57.5617,"Longitude":-4.4404},{"Name":"Cononley","CrsCode":"CEY","Latitude":53.91735,"Longitude":-2.010631},{"Name":"Conway Park","CrsCode":"CNP","Latitude":53.38622,"Longitude":-3.026886},{"Name":"Conwy","CrsCode":"CNW","Latitude":53.2800941,"Longitude":-3.83046},{"Name":"Cooden Beach","CrsCode":"COB","Latitude":50.83271,"Longitude":0.426969},{"Name":"Cookham","CrsCode":"COO","Latitude":51.5568733,"Longitude":-0.721948},{"Name":"Cooksbridge","CrsCode":"CBR","Latitude":50.90394,"Longitude":-0.010272},{"Name":"Coombe Junction Halt","CrsCode":"COE","Latitude":50.44479,"Longitude":-4.481655},{"Name":"Copplestone","CrsCode":"COP","Latitude":50.8142281,"Longitude":-3.751624},{"Name":"Corbridge","CrsCode":"CRB","Latitude":54.9661522,"Longitude":-2.017141},{"Name":"Corby","CrsCode":"COR","Latitude":52.4891968,"Longitude":-0.687944},{"Name":"Corby-Peterborough (By Bus)","CrsCode":"CBZ","Latitude":null,"Longitude":null},{"Name":"Corfe Castle","CrsCode":"CFC","Latitude":50.6377525,"Longitude":2.055308},{"Name":"Cork City","CrsCode":"COK","Latitude":null,"Longitude":null},{"Name":"Corkerhill","CrsCode":"CKH","Latitude":55.8364944,"Longitude":-4.323322},{"Name":"Corkickle","CrsCode":"CKL","Latitude":54.5416565,"Longitude":-3.582155},{"Name":"Corpach","CrsCode":"CPA","Latitude":56.8427238,"Longitude":-5.121662},{"Name":"Corrour","CrsCode":"CRR","Latitude":56.76018,"Longitude":-4.690966},{"Name":"Coryton","CrsCode":"COY","Latitude":51.52051,"Longitude":-3.230858},{"Name":"Coseley","CrsCode":"CSY","Latitude":52.54574,"Longitude":-2.086051},{"Name":"Cosford","CrsCode":"COS","Latitude":52.64503,"Longitude":-2.301479},{"Name":"Cosham","CrsCode":"CSA","Latitude":50.8416443,"Longitude":-1.068259},{"Name":"Cottingham","CrsCode":"CGM","Latitude":53.781826,"Longitude":-0.406402},{"Name":"Cottingley","CrsCode":"COT","Latitude":53.767437,"Longitude":-1.588832},{"Name":"Coulsdon South","CrsCode":"CDS","Latitude":51.31523,"Longitude":-0.13746},{"Name":"Coulsdon Town","CrsCode":"CDN","Latitude":51.32243,"Longitude":-0.13429},{"Name":"Coventry","CrsCode":"COV","Latitude":52.4007874,"Longitude":-1.513466},{"Name":"Coventry Arena","CrsCode":"CAA","Latitude":52.4470329,"Longitude":-1.494559},{"Name":"Cowden (Kent)","CrsCode":"CWN","Latitude":51.15544,"Longitude":0.110653},{"Name":"Cowdenbeath","CrsCode":"COW","Latitude":56.11168,"Longitude":-3.344314},{"Name":"Cradley Heath","CrsCode":"CRA","Latitude":52.4691772,"Longitude":-2.08976},{"Name":"Craigendoran","CrsCode":"CGD","Latitude":55.99485,"Longitude":-4.711291},{"Name":"Cramlington","CrsCode":"CRM","Latitude":55.088604,"Longitude":-1.598887},{"Name":"Cranbrook (Devon)","CrsCode":"CBK","Latitude":50.7501,"Longitude":-3.4206},{"Name":"Craven Arms","CrsCode":"CRV","Latitude":52.4419746,"Longitude":-2.837077},{"Name":"Crawley","CrsCode":"CRW","Latitude":51.1118736,"Longitude":-0.187083},{"Name":"Crayford","CrsCode":"CRY","Latitude":51.4482727,"Longitude":0.178826},{"Name":"Crediton","CrsCode":"CDI","Latitude":50.7833748,"Longitude":-3.646912},{"Name":"Cressing (Essex)","CrsCode":"CES","Latitude":51.8520279,"Longitude":0.580186},{"Name":"Cressington","CrsCode":"CSG","Latitude":53.3588,"Longitude":-2.91172},{"Name":"Creswell","CrsCode":"CWD","Latitude":53.2640076,"Longitude":-1.215865},{"Name":"Crewe","CrsCode":"CRE","Latitude":53.0896072,"Longitude":-2.432987},{"Name":"Crewkerne","CrsCode":"CKN","Latitude":50.8733368,"Longitude":-2.778815},{"Name":"Crews Hill","CrsCode":"CWH","Latitude":51.6843338,"Longitude":-0.106441},{"Name":"Crianlarich","CrsCode":"CNR","Latitude":56.3896523,"Longitude":-4.617778},{"Name":"Criccieth","CrsCode":"CCC","Latitude":52.9183121,"Longitude":-4.236972},{"Name":"Cricklewood","CrsCode":"CRI","Latitude":51.559227,"Longitude":-0.214071},{"Name":"Croftfoot","CrsCode":"CFF","Latitude":55.8184547,"Longitude":-4.229643},{"Name":"Crofton Park","CrsCode":"CFT","Latitude":51.4547768,"Longitude":-0.03678},{"Name":"Cromer","CrsCode":"CMR","Latitude":52.9305954,"Longitude":1.292778},{"Name":"Cromford","CrsCode":"CMF","Latitude":53.112915,"Longitude":-1.548788},{"Name":"Crookston","CrsCode":"CKT","Latitude":55.84388,"Longitude":-4.36049},{"Name":"Cross Gates","CrsCode":"CRG","Latitude":53.8046379,"Longitude":-1.451798},{"Name":"Crossflatts","CrsCode":"CFL","Latitude":53.85883,"Longitude":-1.844886},{"Name":"Crosshill","CrsCode":"COI","Latitude":55.8332253,"Longitude":-4.257648},{"Name":"Crosskeys","CrsCode":"CKY","Latitude":51.621,"Longitude":-3.1261},{"Name":"Crossmyloof","CrsCode":"CMY","Latitude":55.8336258,"Longitude":-4.284813},{"Name":"Croston","CrsCode":"CSO","Latitude":53.66756,"Longitude":-2.777717},{"Name":"Crouch Hill","CrsCode":"CRH","Latitude":51.5712051,"Longitude":-0.116907},{"Name":"Crowborough","CrsCode":"COH","Latitude":51.0460854,"Longitude":0.188422},{"Name":"Crowhurst","CrsCode":"CWU","Latitude":50.8887024,"Longitude":0.500984},{"Name":"Crowle","CrsCode":"CWE","Latitude":53.5897255,"Longitude":-0.817042},{"Name":"Crowthorne","CrsCode":"CRN","Latitude":51.3663559,"Longitude":-0.819194},{"Name":"Croxley","CrsCode":"ZCO","Latitude":null,"Longitude":null},{"Name":"Croy","CrsCode":"CRO","Latitude":55.9557343,"Longitude":-4.035697},{"Name":"Croydon (Any)","CrsCode":"38","Latitude":null,"Longitude":null},{"Name":"Crystal Palace","CrsCode":"CYP","Latitude":51.4176025,"Longitude":-0.072899},{"Name":"Cuddington","CrsCode":"CUD","Latitude":53.23991,"Longitude":-2.599329},{"Name":"Cuffley","CrsCode":"CUF","Latitude":51.7086754,"Longitude":-0.109761},{"Name":"Culham","CrsCode":"CUM","Latitude":51.6537743,"Longitude":-1.236445},{"Name":"Culrain","CrsCode":"CUA","Latitude":57.91984,"Longitude":-4.405676},{"Name":"Cumbernauld","CrsCode":"CUB","Latitude":55.9413261,"Longitude":-3.982089},{"Name":"Cumbrae","CrsCode":"CUL","Latitude":null,"Longitude":null},{"Name":"Cupar","CrsCode":"CUP","Latitude":56.3170433,"Longitude":-3.008772},{"Name":"Curriehill","CrsCode":"CUH","Latitude":55.9017029,"Longitude":-3.317849},{"Name":"Cuxton","CrsCode":"CUX","Latitude":51.3743,"Longitude":0.462693},{"Name":"Cwmbach","CrsCode":"CMH","Latitude":51.7018852,"Longitude":-3.413774},{"Name":"Cwmbran","CrsCode":"CWM","Latitude":51.6565437,"Longitude":-3.016233},{"Name":"Cynghordy","CrsCode":"CYN","Latitude":52.05169,"Longitude":-3.747095},{"Name":"Dagenham Dock","CrsCode":"DDK","Latitude":51.5262375,"Longitude":0.14505},{"Name":"Daisy Hill","CrsCode":"DSY","Latitude":53.53939,"Longitude":-2.516212},{"Name":"Dalgety Bay","CrsCode":"DAG","Latitude":56.044178,"Longitude":-3.354809},{"Name":"Dalmally","CrsCode":"DAL","Latitude":56.4002724,"Longitude":-4.9832},{"Name":"Dalmarnock","CrsCode":"DAK","Latitude":55.83937,"Longitude":-4.21647},{"Name":"Dalmeny","CrsCode":"DAM","Latitude":55.9863625,"Longitude":-3.381645},{"Name":"Dalmuir","CrsCode":"DMR","Latitude":55.9117928,"Longitude":-4.427038},{"Name":"Dalreoch","CrsCode":"DLR","Latitude":55.9473648,"Longitude":-4.578226},{"Name":"Dalry","CrsCode":"DLY","Latitude":55.7053947,"Longitude":-4.711899},{"Name":"Dalston (Cumbria)","CrsCode":"DLS","Latitude":54.8462029,"Longitude":-2.988866},{"Name":"Dalston Junction","CrsCode":"DLJ","Latitude":51.54614,"Longitude":-0.07544},{"Name":"Dalston Kingsland","CrsCode":"DLK","Latitude":51.5480347,"Longitude":-0.074594},{"Name":"Dalton (Cumbria)","CrsCode":"DLT","Latitude":54.15424,"Longitude":-3.179031},{"Name":"Dalwhinnie","CrsCode":"DLW","Latitude":56.9343338,"Longitude":-4.246498},{"Name":"Danby","CrsCode":"DNY","Latitude":54.46607,"Longitude":-0.910704},{"Name":"Danescourt","CrsCode":"DCT","Latitude":51.5052,"Longitude":-3.23332},{"Name":"Danzey","CrsCode":"DZY","Latitude":52.32433,"Longitude":-1.819493},{"Name":"Darlington","CrsCode":"DAR","Latitude":54.520462,"Longitude":-1.54732},{"Name":"Darnall","CrsCode":"DAN","Latitude":53.3810844,"Longitude":-1.410661},{"Name":"Darsham","CrsCode":"DSM","Latitude":52.27281,"Longitude":1.522343},{"Name":"Dartford","CrsCode":"DFD","Latitude":51.4475479,"Longitude":0.217643},{"Name":"Darton","CrsCode":"DRT","Latitude":53.58836,"Longitude":-1.531646},{"Name":"Darwen","CrsCode":"DWN","Latitude":53.69804,"Longitude":-2.464958},{"Name":"Datchet","CrsCode":"DAT","Latitude":51.4833031,"Longitude":-0.579978},{"Name":"Davenport","CrsCode":"DVN","Latitude":53.39072,"Longitude":-2.153234},{"Name":"Dawlish","CrsCode":"DWL","Latitude":50.5806923,"Longitude":-3.464583},{"Name":"Dawlish Warren","CrsCode":"DWW","Latitude":50.59931,"Longitude":-3.443903},{"Name":"Deal","CrsCode":"DEA","Latitude":51.22313,"Longitude":1.398559},{"Name":"Dean (Wilts)","CrsCode":"DEN","Latitude":51.04263,"Longitude":-1.634802},{"Name":"Deansgate","CrsCode":"DGT","Latitude":53.47396,"Longitude":-2.250061},{"Name":"Deganwy","CrsCode":"DGY","Latitude":53.29474,"Longitude":-3.833424},{"Name":"Deighton","CrsCode":"DHN","Latitude":53.6690178,"Longitude":-1.751739},{"Name":"Delamere","CrsCode":"DLM","Latitude":53.2287674,"Longitude":-2.666577},{"Name":"Denby Dale","CrsCode":"DBD","Latitude":53.572628,"Longitude":-1.663215},{"Name":"Denham","CrsCode":"DNM","Latitude":51.578495,"Longitude":-0.497633},{"Name":"Denham Golf Club","CrsCode":"DGC","Latitude":51.5805435,"Longitude":-0.517774},{"Name":"Denmark Hill","CrsCode":"DMK","Latitude":51.4682426,"Longitude":-0.089475},{"Name":"Dent","CrsCode":"DNT","Latitude":54.2825966,"Longitude":-2.363987},{"Name":"Denton","CrsCode":"DTN","Latitude":53.45709,"Longitude":-2.131648},{"Name":"Deptford","CrsCode":"DEP","Latitude":51.4788971,"Longitude":-0.02711},{"Name":"Derby","CrsCode":"DBY","Latitude":52.91638,"Longitude":-1.462555},{"Name":"Derby Road (Ipswich)","CrsCode":"DBR","Latitude":52.04953,"Longitude":1.182332},{"Name":"Dereham Coach","CrsCode":"DEB","Latitude":52.6848946,"Longitude":0.945983},{"Name":"Devonport","CrsCode":"DPT","Latitude":50.37813,"Longitude":-4.171534},{"Name":"Dewsbury","CrsCode":"DEW","Latitude":53.69209,"Longitude":-1.633487},{"Name":"Didcot Parkway","CrsCode":"DID","Latitude":51.6112747,"Longitude":-1.242614},{"Name":"Digby And Sowton","CrsCode":"DIG","Latitude":50.7164345,"Longitude":-3.474574},{"Name":"Dilton Marsh","CrsCode":"DMH","Latitude":51.2489281,"Longitude":-2.207723},{"Name":"Dinas (Rhondda)","CrsCode":"DMG","Latitude":51.6170731,"Longitude":-3.437123},{"Name":"Dinas Powys","CrsCode":"DNS","Latitude":51.4316139,"Longitude":-3.21839},{"Name":"Dingle Road","CrsCode":"DGL","Latitude":51.44011,"Longitude":-3.179776},{"Name":"Dingwall","CrsCode":"DIN","Latitude":57.59424,"Longitude":-4.422611},{"Name":"Dinsdale","CrsCode":"DND","Latitude":54.51474,"Longitude":-1.467051},{"Name":"Dinting","CrsCode":"DTG","Latitude":53.4493828,"Longitude":-1.970276},{"Name":"Disley","CrsCode":"DSL","Latitude":53.3581467,"Longitude":-2.042465},{"Name":"Diss","CrsCode":"DIS","Latitude":52.3730965,"Longitude":1.123274},{"Name":"Dockyard (Devonport)","CrsCode":"DOC","Latitude":50.3825531,"Longitude":-4.175957},{"Name":"Dodworth","CrsCode":"DOD","Latitude":53.5452156,"Longitude":-1.530617},{"Name":"Dolau","CrsCode":"DOL","Latitude":52.2952232,"Longitude":-3.263955},{"Name":"Doleham","CrsCode":"DLH","Latitude":50.9186859,"Longitude":0.610732},{"Name":"Dolgarrog","CrsCode":"DLG","Latitude":53.1861229,"Longitude":-3.822808},{"Name":"Dolwyddelan","CrsCode":"DWD","Latitude":53.0521049,"Longitude":-3.884288},{"Name":"Doncaster","CrsCode":"DON","Latitude":53.52147,"Longitude":-1.140225},{"Name":"Dorchester (Any)","CrsCode":"64","Latitude":null,"Longitude":null},{"Name":"Dorchester South","CrsCode":"DCH","Latitude":50.70875,"Longitude":-2.437593},{"Name":"Dorchester West","CrsCode":"DCW","Latitude":50.7105255,"Longitude":-2.443274},{"Name":"Dore And Totley","CrsCode":"DOR","Latitude":53.3276253,"Longitude":-1.514997},{"Name":"Dorking (Any)","CrsCode":"65","Latitude":null,"Longitude":null},{"Name":"Dorking (Deepdene)","CrsCode":"DPD","Latitude":51.23892,"Longitude":-0.323921},{"Name":"Dorking (Main)","CrsCode":"DKG","Latitude":51.2416153,"Longitude":-0.323822},{"Name":"Dorking West","CrsCode":"DKT","Latitude":51.2364426,"Longitude":-0.339762},{"Name":"Dormans","CrsCode":"DMS","Latitude":51.15567,"Longitude":-0.005183},{"Name":"Dorridge","CrsCode":"DDG","Latitude":52.37186,"Longitude":-1.753209},{"Name":"Dove Holes","CrsCode":"DVH","Latitude":53.3000069,"Longitude":-1.890678},{"Name":"Dover Priory","CrsCode":"DVP","Latitude":51.125988,"Longitude":1.304227},{"Name":"Dovercourt","CrsCode":"DVC","Latitude":51.9388924,"Longitude":1.280724},{"Name":"Dovey Junction","CrsCode":"DVY","Latitude":52.5641327,"Longitude":-3.925273},{"Name":"Downham Market","CrsCode":"DOW","Latitude":52.60471,"Longitude":0.365751},{"Name":"Drayton Green","CrsCode":"DRG","Latitude":51.5163269,"Longitude":-0.330089},{"Name":"Drayton Park","CrsCode":"DYP","Latitude":51.552124,"Longitude":-0.104723},{"Name":"Drem","CrsCode":"DRM","Latitude":56.00598,"Longitude":-2.785752},{"Name":"Driffield","CrsCode":"DRF","Latitude":54.0015259,"Longitude":-0.434627},{"Name":"Drigg","CrsCode":"DRI","Latitude":54.37697,"Longitude":-3.444066},{"Name":"Drogheda","CrsCode":"DRA","Latitude":null,"Longitude":null},{"Name":"Droitwich Spa","CrsCode":"DTW","Latitude":52.26862,"Longitude":-2.158239},{"Name":"Dromod","CrsCode":"DMD","Latitude":null,"Longitude":null},{"Name":"Dronfield","CrsCode":"DRO","Latitude":53.3013573,"Longitude":-1.468768},{"Name":"Drumchapel","CrsCode":"DMC","Latitude":55.9049263,"Longitude":-4.364204},{"Name":"Drumfrochar","CrsCode":"DFR","Latitude":55.94129,"Longitude":-4.774822},{"Name":"Drumgelloch","CrsCode":"DRU","Latitude":55.8672333,"Longitude":-3.95114},{"Name":"Drumry","CrsCode":"DMY","Latitude":55.9044952,"Longitude":-4.386583},{"Name":"Dublin","CrsCode":"398","Latitude":null,"Longitude":null},{"Name":"Dublin Connolly","CrsCode":"DCL","Latitude":null,"Longitude":null},{"Name":"Dublin Ferryport","CrsCode":"DFP","Latitude":null,"Longitude":null},{"Name":"Dublin Heuston","CrsCode":"DHT","Latitude":null,"Longitude":null},{"Name":"Dublin Pearse","CrsCode":"DBP","Latitude":null,"Longitude":null},{"Name":"Dublin Port - Stena","CrsCode":"DPS","Latitude":null,"Longitude":null},{"Name":"Duddeston","CrsCode":"DUD","Latitude":52.488018,"Longitude":-1.871842},{"Name":"Dudley (Any)","CrsCode":"66","Latitude":null,"Longitude":null},{"Name":"Dudley Port","CrsCode":"DDP","Latitude":52.5245171,"Longitude":-2.049401},{"Name":"Duffield","CrsCode":"DFI","Latitude":52.9877129,"Longitude":-1.486035},{"Name":"Duirinish","CrsCode":"DRN","Latitude":57.3198471,"Longitude":-5.692103},{"Name":"Duke Street","CrsCode":"DST","Latitude":55.8592072,"Longitude":-4.212814},{"Name":"Dullingham","CrsCode":"DUL","Latitude":52.200943,"Longitude":0.366197},{"Name":"Dulwich (Any)","CrsCode":"67","Latitude":null,"Longitude":null},{"Name":"Dumbarton (Any)","CrsCode":"68","Latitude":null,"Longitude":null},{"Name":"Dumbarton Central","CrsCode":"DBC","Latitude":55.9467049,"Longitude":-4.56697},{"Name":"Dumbarton East","CrsCode":"DBE","Latitude":55.94248,"Longitude":-4.55387},{"Name":"Dumbreck","CrsCode":"DUM","Latitude":55.8412552,"Longitude":-4.309216},{"Name":"Dumfries","CrsCode":"DMF","Latitude":55.0723953,"Longitude":-3.605261},{"Name":"Dumpton Park","CrsCode":"DMP","Latitude":51.3455658,"Longitude":1.426291},{"Name":"Dunbar","CrsCode":"DUN","Latitude":55.99843,"Longitude":-2.514625},{"Name":"Dunblane","CrsCode":"DBL","Latitude":56.186,"Longitude":-3.967296},{"Name":"Duncraig","CrsCode":"DCG","Latitude":57.3367271,"Longitude":-5.637282},{"Name":"Dundalk","CrsCode":"DUK","Latitude":null,"Longitude":null},{"Name":"Dundee","CrsCode":"DEE","Latitude":56.45667,"Longitude":-2.970576},{"Name":"Dunfermline Queen Margaret","CrsCode":"DFL","Latitude":56.0807076,"Longitude":-3.42164},{"Name":"Dunfermline Town","CrsCode":"DFE","Latitude":56.0682335,"Longitude":-3.452033},{"Name":"Dunkeld And Birnam","CrsCode":"DKD","Latitude":56.5573,"Longitude":-3.578097},{"Name":"Dunlop","CrsCode":"DNL","Latitude":55.7119255,"Longitude":-4.532435},{"Name":"Dunoon","CrsCode":"DUO","Latitude":55.94681,"Longitude":-4.92252},{"Name":"Dunrobin Castle","CrsCode":"DNO","Latitude":57.98611,"Longitude":-3.946595},{"Name":"Duns","CrsCode":"DUU","Latitude":55.7788658,"Longitude":-2.342808},{"Name":"Dunston","CrsCode":"DOT","Latitude":54.9521637,"Longitude":-1.648648},{"Name":"Dunton Green","CrsCode":"DNG","Latitude":51.2964249,"Longitude":0.171616},{"Name":"Durham","CrsCode":"DHM","Latitude":54.7794075,"Longitude":-1.581746},{"Name":"Durrington-On-Sea","CrsCode":"DUR","Latitude":50.8174629,"Longitude":-0.411463},{"Name":"Dyce","CrsCode":"DYC","Latitude":57.205,"Longitude":-2.191978},{"Name":"Dyffryn Ardudwy","CrsCode":"DYF","Latitude":52.78857,"Longitude":-4.104242},{"Name":"Eaglescliffe","CrsCode":"EAG","Latitude":54.52945,"Longitude":-1.349426},{"Name":"Ealing (Any)","CrsCode":"69","Latitude":null,"Longitude":null},{"Name":"Ealing Broadway","CrsCode":"EAL","Latitude":51.51466,"Longitude":-0.300843},{"Name":"Earlestown","CrsCode":"ERL","Latitude":53.4511375,"Longitude":-2.637674},{"Name":"Earley","CrsCode":"EAR","Latitude":51.44105,"Longitude":-0.917989},{"Name":"Earlsfield","CrsCode":"EAD","Latitude":51.44193,"Longitude":-0.188423},{"Name":"Earlston","CrsCode":"EAS","Latitude":55.6390724,"Longitude":-2.68},{"Name":"Earlswood (Surrey)","CrsCode":"ELD","Latitude":51.22763,"Longitude":-0.171078},{"Name":"Earlswood (West Midlands)","CrsCode":"EWD","Latitude":52.36664,"Longitude":-1.861907},{"Name":"East Boldon","CrsCode":"EBL","Latitude":54.9468,"Longitude":-1.420767},{"Name":"East Cowes","CrsCode":"ECW","Latitude":50.75873,"Longitude":-1.29107},{"Name":"East Croydon","CrsCode":"ECR","Latitude":51.37568,"Longitude":-0.093335},{"Name":"East Didsbury","CrsCode":"EDY","Latitude":53.4102058,"Longitude":-2.22111},{"Name":"East Dulwich","CrsCode":"EDW","Latitude":51.46091,"Longitude":-0.081151},{"Name":"East Farleigh","CrsCode":"EFL","Latitude":51.25511,"Longitude":0.48498},{"Name":"East Garforth","CrsCode":"EGF","Latitude":53.7916222,"Longitude":-1.363933},{"Name":"East Grinstead","CrsCode":"EGR","Latitude":51.1262131,"Longitude":-0.017887},{"Name":"East Kilbride","CrsCode":"EKL","Latitude":55.76539,"Longitude":-4.18199},{"Name":"East Malling","CrsCode":"EML","Latitude":51.2857475,"Longitude":0.439308},{"Name":"East Midlands Airport (By Bus)","CrsCode":"EMA","Latitude":null,"Longitude":null},{"Name":"East Midlands Parkway","CrsCode":"EMD","Latitude":52.862,"Longitude":-1.263},{"Name":"East Tilbury","CrsCode":"ETL","Latitude":51.4850655,"Longitude":0.412479},{"Name":"East Worthing","CrsCode":"EWR","Latitude":50.82207,"Longitude":-0.354517},{"Name":"Eastbourne","CrsCode":"EBN","Latitude":50.7690849,"Longitude":0.281847},{"Name":"Eastbrook","CrsCode":"EBK","Latitude":51.4371262,"Longitude":-3.207031},{"Name":"Easterhouse","CrsCode":"EST","Latitude":55.860157,"Longitude":-4.107389},{"Name":"Eastham Rake","CrsCode":"ERA","Latitude":53.3075333,"Longitude":-2.9812},{"Name":"Eastleigh","CrsCode":"ESL","Latitude":50.96856,"Longitude":-1.350563},{"Name":"Eastrington","CrsCode":"EGN","Latitude":53.75481,"Longitude":-0.786612},{"Name":"Ebbsfleet International","CrsCode":"EBD","Latitude":51.4429626,"Longitude":0.320921},{"Name":"Ebbw Vale Parkway","CrsCode":"EBV","Latitude":51.7573,"Longitude":-3.1965},{"Name":"Ebbw Vale Town","CrsCode":"EBB","Latitude":51.7772522,"Longitude":-3.202288},{"Name":"Eccles (Manchester)","CrsCode":"ECC","Latitude":53.4854431,"Longitude":-2.333014},{"Name":"Eccles Road","CrsCode":"ECS","Latitude":52.4705849,"Longitude":0.969656},{"Name":"Eccleston Park","CrsCode":"ECL","Latitude":53.4306641,"Longitude":-2.780555},{"Name":"Edale","CrsCode":"EDL","Latitude":53.36477,"Longitude":-1.817395},{"Name":"Eden Park","CrsCode":"EDN","Latitude":51.3907623,"Longitude":-0.026587},{"Name":"Edenbridge (Any)","CrsCode":"70","Latitude":null,"Longitude":null},{"Name":"Edenbridge Town","CrsCode":"EBT","Latitude":51.2002869,"Longitude":0.06689},{"Name":"Edenbridge(Kent)","CrsCode":"EBR","Latitude":51.2085075,"Longitude":0.060099},{"Name":"Edge Hill","CrsCode":"EDG","Latitude":53.4026642,"Longitude":-2.946986},{"Name":"Edinburgh (Waverley)","CrsCode":"EDB","Latitude":55.9524422,"Longitude":-3.188236},{"Name":"Edinburgh Airport (By Bus Or Tram)","CrsCode":"EDA","Latitude":55.95,"Longitude":-3.3725},{"Name":"Edinburgh Gateway","CrsCode":"EGY","Latitude":55.941,"Longitude":-3.32},{"Name":"Edinburgh Park","CrsCode":"EDP","Latitude":55.9276161,"Longitude":-3.307829},{"Name":"Edmonton Green","CrsCode":"EDR","Latitude":51.6238022,"Longitude":-0.059665},{"Name":"Effingham Junction","CrsCode":"EFF","Latitude":51.2915039,"Longitude":-0.419536},{"Name":"Eggesford","CrsCode":"EGG","Latitude":50.8878479,"Longitude":-3.875235},{"Name":"Egham","CrsCode":"EGH","Latitude":51.4289246,"Longitude":-0.545701},{"Name":"Egton","CrsCode":"EGT","Latitude":54.43768,"Longitude":-0.761896},{"Name":"Elephant And Castle","CrsCode":"EPH","Latitude":51.49447,"Longitude":-0.098462},{"Name":"Elgin","CrsCode":"ELG","Latitude":57.64299,"Longitude":-3.31163},{"Name":"Ellesmere Port","CrsCode":"ELP","Latitude":53.2820969,"Longitude":-2.895403},{"Name":"Elmers End","CrsCode":"ELE","Latitude":51.3983345,"Longitude":-0.049263},{"Name":"Elmstead Woods","CrsCode":"ESD","Latitude":51.4174347,"Longitude":0.043594},{"Name":"Elmswell","CrsCode":"ESW","Latitude":52.2382,"Longitude":0.911625},{"Name":"Elsecar","CrsCode":"ELR","Latitude":53.4989243,"Longitude":-1.428617},{"Name":"Elsenham (Essex)","CrsCode":"ESM","Latitude":51.92038,"Longitude":0.22779},{"Name":"Elstree And Borehamwood","CrsCode":"ELS","Latitude":51.6528358,"Longitude":-0.279779},{"Name":"Eltham","CrsCode":"ELW","Latitude":51.4551,"Longitude":0.0496},{"Name":"Elton And Orston","CrsCode":"ELO","Latitude":52.9518433,"Longitude":-0.855362},{"Name":"Ely","CrsCode":"ELY","Latitude":52.3908463,"Longitude":0.266105},{"Name":"Emerson Park","CrsCode":"EMP","Latitude":51.56889,"Longitude":0.220658},{"Name":"Emr Destination","CrsCode":"QED","Latitude":null,"Longitude":null},{"Name":"Emr Origin","CrsCode":"QEO","Latitude":null,"Longitude":null},{"Name":"Emsworth","CrsCode":"EMS","Latitude":50.851326,"Longitude":-0.938784},{"Name":"Energlyn And Churchill Park","CrsCode":"ECP","Latitude":51.5838,"Longitude":-3.2287},{"Name":"Enfield (Any)","CrsCode":"71","Latitude":null,"Longitude":null},{"Name":"Enfield (Ireland)","CrsCode":"EFD","Latitude":null,"Longitude":null},{"Name":"Enfield Chase","CrsCode":"ENC","Latitude":51.652607,"Longitude":-0.090404},{"Name":"Enfield Lock","CrsCode":"ENL","Latitude":51.67138,"Longitude":-0.028875},{"Name":"Enfield Town","CrsCode":"ENF","Latitude":51.6515236,"Longitude":-0.078891},{"Name":"Ennis","CrsCode":"ENN","Latitude":null,"Longitude":null},{"Name":"Enniscorthy","CrsCode":"ENS","Latitude":null,"Longitude":null},{"Name":"Entwistle","CrsCode":"ENT","Latitude":53.65559,"Longitude":-2.413983},{"Name":"Epsom (Any)","CrsCode":"72","Latitude":null,"Longitude":null},{"Name":"Epsom (Surrey)","CrsCode":"EPS","Latitude":51.33434,"Longitude":-0.268756},{"Name":"Epsom Downs","CrsCode":"EPD","Latitude":51.3213654,"Longitude":-0.243411},{"Name":"Erdington","CrsCode":"ERD","Latitude":52.5284348,"Longitude":-1.839297},{"Name":"Eridge","CrsCode":"ERI","Latitude":51.0890236,"Longitude":0.200452},{"Name":"Eridge (A26 Bus Stop)","CrsCode":"ERB","Latitude":null,"Longitude":null},{"Name":"Erith","CrsCode":"ERH","Latitude":51.48162,"Longitude":0.174651},{"Name":"Esher","CrsCode":"ESH","Latitude":51.3796425,"Longitude":-0.354714},{"Name":"Eskbank","CrsCode":"EKB","Latitude":55.88956,"Longitude":-3.07845},{"Name":"Essex Road","CrsCode":"EXR","Latitude":51.5403023,"Longitude":-0.096552},{"Name":"Etchingham","CrsCode":"ETC","Latitude":51.01048,"Longitude":0.441935},{"Name":"Euxton Balshaw Lane","CrsCode":"EBA","Latitude":53.67007,"Longitude":-2.675045},{"Name":"Evesham","CrsCode":"EVE","Latitude":52.098793,"Longitude":-1.947413},{"Name":"Ewell (Any)","CrsCode":"73","Latitude":null,"Longitude":null},{"Name":"Ewell East","CrsCode":"EWE","Latitude":51.34561,"Longitude":-0.24106},{"Name":"Ewell West","CrsCode":"EWW","Latitude":51.3494453,"Longitude":-0.256711},{"Name":"Exeter (Any)","CrsCode":"74","Latitude":null,"Longitude":null},{"Name":"Exeter Central","CrsCode":"EXC","Latitude":50.72647,"Longitude":-3.532973},{"Name":"Exeter St Davids","CrsCode":"EXD","Latitude":50.72902,"Longitude":-3.544387},{"Name":"Exeter St Thomas","CrsCode":"EXT","Latitude":50.71653,"Longitude":-3.538759},{"Name":"Exhibition Centre (Glasgow)","CrsCode":"EXG","Latitude":55.86062,"Longitude":-4.283207},{"Name":"Exmouth","CrsCode":"EXM","Latitude":50.6209373,"Longitude":-3.415035},{"Name":"Exton","CrsCode":"EXN","Latitude":50.6682549,"Longitude":-3.443337},{"Name":"Eynsford","CrsCode":"EYN","Latitude":51.3623772,"Longitude":0.203465},{"Name":"Fairbourne","CrsCode":"FRB","Latitude":52.69602,"Longitude":-4.049464},{"Name":"Fairfield","CrsCode":"FRF","Latitude":53.4712143,"Longitude":-2.14581},{"Name":"Fairlie","CrsCode":"FRL","Latitude":55.7525139,"Longitude":-4.853834},{"Name":"Fairwater","CrsCode":"FRW","Latitude":51.4917145,"Longitude":-3.232963},{"Name":"Falconwood","CrsCode":"FCN","Latitude":51.4590874,"Longitude":0.078571},{"Name":"Falkirk (Any)","CrsCode":"75","Latitude":null,"Longitude":null},{"Name":"Falkirk Grahamston","CrsCode":"FKG","Latitude":56.0027351,"Longitude":-3.786359},{"Name":"Falkirk High","CrsCode":"FKK","Latitude":55.9918633,"Longitude":-3.792276},{"Name":"Falls Of Cruachan","CrsCode":"FOC","Latitude":56.3862419,"Longitude":-5.114992},{"Name":"Falmer","CrsCode":"FMR","Latitude":50.8620644,"Longitude":-0.087364},{"Name":"Falmouth (Any)","CrsCode":"76","Latitude":null,"Longitude":null},{"Name":"Falmouth Docks","CrsCode":"FAL","Latitude":50.15075,"Longitude":-5.0559},{"Name":"Falmouth Town","CrsCode":"FMT","Latitude":50.14839,"Longitude":-5.065443},{"Name":"Fareham","CrsCode":"FRM","Latitude":50.85335,"Longitude":-1.19162},{"Name":"Farnborough (Any)","CrsCode":"77","Latitude":null,"Longitude":null},{"Name":"Farnborough (Main)","CrsCode":"FNB","Latitude":51.29647,"Longitude":-0.756436},{"Name":"Farnborough North","CrsCode":"FNN","Latitude":51.3017235,"Longitude":-0.743385},{"Name":"Farncombe","CrsCode":"FNC","Latitude":51.19764,"Longitude":-0.604522},{"Name":"Farnham","CrsCode":"FNH","Latitude":51.211422,"Longitude":-0.793093},{"Name":"Farningham Road","CrsCode":"FNR","Latitude":51.4013367,"Longitude":0.235533},{"Name":"Farnworth","CrsCode":"FNW","Latitude":53.55,"Longitude":-2.387857},{"Name":"Farranfore","CrsCode":"FAR","Latitude":null,"Longitude":null},{"Name":"Fauldhouse","CrsCode":"FLD","Latitude":55.8221626,"Longitude":-3.719006},{"Name":"Faversham","CrsCode":"FAV","Latitude":51.3114357,"Longitude":0.891278},{"Name":"Faygate","CrsCode":"FGT","Latitude":51.0959435,"Longitude":-0.263403},{"Name":"Fazakerley","CrsCode":"FAZ","Latitude":53.4690628,"Longitude":-2.936729},{"Name":"Fearn","CrsCode":"FRN","Latitude":57.77783,"Longitude":-3.994245},{"Name":"Featherstone","CrsCode":"FEA","Latitude":53.6792526,"Longitude":-1.359562},{"Name":"Felixstowe","CrsCode":"FLX","Latitude":51.96745,"Longitude":1.352707},{"Name":"Feltham","CrsCode":"FEL","Latitude":51.4478455,"Longitude":-0.40983},{"Name":"Feniton","CrsCode":"FNT","Latitude":50.78702,"Longitude":-3.285259},{"Name":"Fenny Stratford","CrsCode":"FEN","Latitude":52.000103,"Longitude":-0.716636},{"Name":"Fernhill","CrsCode":"FER","Latitude":51.6859322,"Longitude":-3.394469},{"Name":"Ferriby","CrsCode":"FRY","Latitude":53.7166252,"Longitude":-0.508878},{"Name":"Ferryside","CrsCode":"FYS","Latitude":51.76833,"Longitude":-4.36952},{"Name":"Ffairfach","CrsCode":"FFA","Latitude":51.87244,"Longitude":-3.992916},{"Name":"Filey","CrsCode":"FIL","Latitude":54.2099457,"Longitude":-0.293351},{"Name":"Filton Abbey Wood","CrsCode":"FIT","Latitude":51.5094376,"Longitude":-2.561933},{"Name":"Finchley Road And Frognal","CrsCode":"FNY","Latitude":51.5501976,"Longitude":-0.183324},{"Name":"Finsbury Park","CrsCode":"FPK","Latitude":51.564724,"Longitude":-0.105642},{"Name":"Finstock","CrsCode":"FIN","Latitude":51.85305,"Longitude":-1.47003},{"Name":"Fishbourne (Sussex)","CrsCode":"FSB","Latitude":50.83935,"Longitude":-0.815495},{"Name":"Fishersgate","CrsCode":"FSG","Latitude":50.83447,"Longitude":-0.219161},{"Name":"Fishguard And Goodwick","CrsCode":"FGW","Latitude":52.0035,"Longitude":-4.9948},{"Name":"Fishguard Harbour","CrsCode":"FGH","Latitude":52.0115051,"Longitude":-4.985713},{"Name":"Fiskerton","CrsCode":"FSK","Latitude":53.0602531,"Longitude":-0.912181},{"Name":"Fitzwilliam","CrsCode":"FZW","Latitude":53.6325874,"Longitude":-1.375391},{"Name":"Five Ways","CrsCode":"FWY","Latitude":52.4700775,"Longitude":-1.913116},{"Name":"Fleet","CrsCode":"FLE","Latitude":51.290947,"Longitude":-0.831169},{"Name":"Flimby","CrsCode":"FLM","Latitude":54.6898155,"Longitude":-3.520544},{"Name":"Flint","CrsCode":"FLN","Latitude":53.2495155,"Longitude":-3.13302},{"Name":"Flitwick","CrsCode":"FLT","Latitude":52.0034561,"Longitude":-0.4952},{"Name":"Flixton","CrsCode":"FLI","Latitude":53.4437447,"Longitude":-2.383878},{"Name":"Flowery Field","CrsCode":"FLF","Latitude":53.46174,"Longitude":-2.080965},{"Name":"Folkestone (Any)","CrsCode":"78","Latitude":null,"Longitude":null},{"Name":"Folkestone Central","CrsCode":"FKC","Latitude":51.0829849,"Longitude":1.168331},{"Name":"Folkestone West","CrsCode":"FKW","Latitude":51.0851631,"Longitude":1.154209},{"Name":"Ford","CrsCode":"FOD","Latitude":50.8295059,"Longitude":-0.578611},{"Name":"Forest Gate","CrsCode":"FOG","Latitude":51.5499763,"Longitude":0.023568},{"Name":"Forest Hill","CrsCode":"FOH","Latitude":51.43887,"Longitude":-0.053297},{"Name":"Formby","CrsCode":"FBY","Latitude":53.5537949,"Longitude":-3.070706},{"Name":"Forres","CrsCode":"FOR","Latitude":57.60966,"Longitude":-3.62847},{"Name":"Forsinard","CrsCode":"FRS","Latitude":58.357,"Longitude":-3.896903},{"Name":"Fort Matilda","CrsCode":"FTM","Latitude":55.95881,"Longitude":-4.7953},{"Name":"Fort William","CrsCode":"FTW","Latitude":56.8206253,"Longitude":-5.106721},{"Name":"Four Oaks","CrsCode":"FOK","Latitude":52.5796623,"Longitude":-1.8273},{"Name":"Foxfield","CrsCode":"FOX","Latitude":54.25904,"Longitude":-3.215796},{"Name":"Foxton","CrsCode":"FXN","Latitude":52.1195259,"Longitude":0.056572},{"Name":"Frant","CrsCode":"FRT","Latitude":51.10432,"Longitude":0.294034},{"Name":"Fratton","CrsCode":"FTN","Latitude":50.79582,"Longitude":-1.073422},{"Name":"Freshfield","CrsCode":"FRE","Latitude":53.566494,"Longitude":-3.072014},{"Name":"Freshford","CrsCode":"FFD","Latitude":51.34225,"Longitude":-2.30146},{"Name":"Frimley","CrsCode":"FML","Latitude":51.3116531,"Longitude":-0.747426},{"Name":"Frinton-On-Sea","CrsCode":"FRI","Latitude":51.8383141,"Longitude":1.242907},{"Name":"Frizinghall","CrsCode":"FZH","Latitude":53.8209572,"Longitude":-1.769072},{"Name":"Frodsham","CrsCode":"FRD","Latitude":53.2958527,"Longitude":-2.723145},{"Name":"Frome","CrsCode":"FRO","Latitude":51.22713,"Longitude":-2.309302},{"Name":"Fulwell","CrsCode":"FLW","Latitude":51.4335251,"Longitude":-0.349893},{"Name":"Furness Vale","CrsCode":"FNV","Latitude":53.3483849,"Longitude":-1.989445},{"Name":"Furze Platt","CrsCode":"FZP","Latitude":51.53308,"Longitude":-0.728467},{"Name":"Gainsborough (Any)","CrsCode":"79","Latitude":null,"Longitude":null},{"Name":"Gainsborough Central","CrsCode":"GNB","Latitude":53.3995743,"Longitude":-0.769674},{"Name":"Gainsborough Lea Road","CrsCode":"GBL","Latitude":53.3860779,"Longitude":-0.768558},{"Name":"Galashiels","CrsCode":"GAL","Latitude":55.6104279,"Longitude":-2.809693},{"Name":"Galashiels Bus Station","CrsCode":"XAA","Latitude":null,"Longitude":null},{"Name":"Galway","CrsCode":"GWY","Latitude":null,"Longitude":null},{"Name":"Garelochhead","CrsCode":"GCH","Latitude":56.07945,"Longitude":-4.826544},{"Name":"Garforth","CrsCode":"GRF","Latitude":53.79621,"Longitude":-1.382083},{"Name":"Gargrave","CrsCode":"GGV","Latitude":53.97842,"Longitude":-2.105171},{"Name":"Garrowhill","CrsCode":"GAR","Latitude":55.8552856,"Longitude":-4.129497},{"Name":"Garscadden","CrsCode":"GRS","Latitude":55.88784,"Longitude":-4.364757},{"Name":"Garsdale","CrsCode":"GSD","Latitude":54.32135,"Longitude":-2.325891},{"Name":"Garston (Hertfordshire)","CrsCode":"GSN","Latitude":51.6866837,"Longitude":-0.381689},{"Name":"Garswood","CrsCode":"GSW","Latitude":53.4885178,"Longitude":-2.672149},{"Name":"Gartcosh","CrsCode":"GRH","Latitude":55.885,"Longitude":-4.078},{"Name":"Garth (Mid Glamorgan)","CrsCode":"GMG","Latitude":51.5964127,"Longitude":-3.641504},{"Name":"Garth (Powys)","CrsCode":"GTH","Latitude":52.1338158,"Longitude":-3.531142},{"Name":"Garve","CrsCode":"GVE","Latitude":57.61313,"Longitude":-4.688429},{"Name":"Gathurst","CrsCode":"GST","Latitude":53.5594,"Longitude":-2.694418},{"Name":"Gatley","CrsCode":"GTY","Latitude":53.394,"Longitude":-2.230052},{"Name":"Gatwick Airport","CrsCode":"GTW","Latitude":51.1564255,"Longitude":-0.161022},{"Name":"Georgemas Junction","CrsCode":"GGJ","Latitude":58.51372,"Longitude":-3.45212},{"Name":"Gerrards Cross","CrsCode":"GER","Latitude":51.5888824,"Longitude":-0.555367},{"Name":"Gidea Park","CrsCode":"GDP","Latitude":51.58177,"Longitude":0.205411},{"Name":"Giffnock","CrsCode":"GFN","Latitude":55.8046875,"Longitude":-4.294289},{"Name":"Giggleswick","CrsCode":"GIG","Latitude":54.0617752,"Longitude":-2.302644},{"Name":"Gilberdyke","CrsCode":"GBD","Latitude":53.7479553,"Longitude":-0.732223},{"Name":"Gilfach Fargoed","CrsCode":"GFF","Latitude":51.6842079,"Longitude":-3.226604},{"Name":"Gillingham (Dorset)","CrsCode":"GIL","Latitude":51.033886,"Longitude":-2.272361},{"Name":"Gillingham (Kent)","CrsCode":"GLM","Latitude":51.38683,"Longitude":0.549618},{"Name":"Gilshochill","CrsCode":"GSC","Latitude":55.8972969,"Longitude":-4.28201},{"Name":"Gipsy Hill","CrsCode":"GIP","Latitude":51.424984,"Longitude":-0.084096},{"Name":"Girvan","CrsCode":"GIR","Latitude":55.2465172,"Longitude":-4.848927},{"Name":"Glaisdale","CrsCode":"GLS","Latitude":54.4397964,"Longitude":-0.794221},{"Name":"Glan Conwy","CrsCode":"GCW","Latitude":53.2666435,"Longitude":-3.796892},{"Name":"Glasgow (Any)","CrsCode":"81","Latitude":null,"Longitude":null},{"Name":"Glasgow Airport","CrsCode":"GGT","Latitude":55.8658028,"Longitude":-4.432114},{"Name":"Glasgow Central","CrsCode":"GLC","Latitude":55.860157,"Longitude":-4.259208},{"Name":"Glasgow Queen Street","CrsCode":"GLQ","Latitude":55.8630028,"Longitude":-4.251385},{"Name":"Glasshoughton","CrsCode":"GLH","Latitude":53.70884,"Longitude":-1.34247},{"Name":"Glastonbury Bus","CrsCode":"XEA","Latitude":51.14853,"Longitude":-2.714062},{"Name":"Glazebrook","CrsCode":"GLZ","Latitude":53.4280777,"Longitude":-2.461152},{"Name":"Gleneagles","CrsCode":"GLE","Latitude":56.2749023,"Longitude":-3.7312},{"Name":"Glenfinnan","CrsCode":"GLF","Latitude":56.8727531,"Longitude":-5.449219},{"Name":"Glengarnock","CrsCode":"GLG","Latitude":55.73858,"Longitude":-4.674364},{"Name":"Glenrothes With Thornton","CrsCode":"GLT","Latitude":56.1622238,"Longitude":-3.143189},{"Name":"Glossop","CrsCode":"GLO","Latitude":53.4445038,"Longitude":-1.949403},{"Name":"Gloucester","CrsCode":"GCR","Latitude":51.8648,"Longitude":-2.238141},{"Name":"Glynde","CrsCode":"GLY","Latitude":50.8593979,"Longitude":0.06883},{"Name":"Gobowen","CrsCode":"GOB","Latitude":52.8935,"Longitude":-3.036019},{"Name":"Godalming","CrsCode":"GOD","Latitude":51.1861153,"Longitude":-0.619175},{"Name":"Godley","CrsCode":"GDL","Latitude":53.44815,"Longitude":-2.049649},{"Name":"Godstone","CrsCode":"GDN","Latitude":51.2176056,"Longitude":-0.051188},{"Name":"Goldthorpe","CrsCode":"GOE","Latitude":53.53338,"Longitude":-1.313488},{"Name":"Golf Street","CrsCode":"GOF","Latitude":56.4978523,"Longitude":-2.719541},{"Name":"Golspie","CrsCode":"GOL","Latitude":57.9710922,"Longitude":-3.98806},{"Name":"Gomshall","CrsCode":"GOM","Latitude":51.2189636,"Longitude":-0.442065},{"Name":"Goodmayes","CrsCode":"GMY","Latitude":51.5655022,"Longitude":0.112277},{"Name":"Goole","CrsCode":"GOO","Latitude":53.7044258,"Longitude":-0.872907},{"Name":"Goostrey","CrsCode":"GTR","Latitude":53.2226334,"Longitude":-2.32628},{"Name":"Gordon Hill","CrsCode":"GDH","Latitude":51.66346,"Longitude":-0.094289},{"Name":"Gorebridge","CrsCode":"GBG","Latitude":55.83673,"Longitude":-3.046099},{"Name":"Gorey","CrsCode":"GOY","Latitude":null,"Longitude":null},{"Name":"Goring And Streatley","CrsCode":"GOR","Latitude":51.5214272,"Longitude":-1.133051},{"Name":"Goring-By-Sea","CrsCode":"GBS","Latitude":50.8177528,"Longitude":-0.432751},{"Name":"Gorton","CrsCode":"GTO","Latitude":53.46871,"Longitude":-2.167182},{"Name":"Gospel Oak","CrsCode":"GPO","Latitude":51.5555458,"Longitude":-0.150737},{"Name":"Gourock","CrsCode":"GRK","Latitude":55.9627876,"Longitude":-4.818021},{"Name":"Gowerton","CrsCode":"GWN","Latitude":51.6487,"Longitude":-4.035124},{"Name":"Goxhill","CrsCode":"GOX","Latitude":53.6766129,"Longitude":-0.337699},{"Name":"Grange Park","CrsCode":"GPK","Latitude":51.64281,"Longitude":-0.096599},{"Name":"Grange-Over-Sands","CrsCode":"GOS","Latitude":54.195282,"Longitude":-2.902752},{"Name":"Grangetown (Cardiff)","CrsCode":"GTN","Latitude":51.4669838,"Longitude":-3.189097},{"Name":"Grantham","CrsCode":"GRA","Latitude":52.90645,"Longitude":-0.642438},{"Name":"Grateley","CrsCode":"GRT","Latitude":51.17027,"Longitude":-1.619497},{"Name":"Gravelly Hill","CrsCode":"GVH","Latitude":52.51497,"Longitude":-1.852612},{"Name":"Gravesend","CrsCode":"GRV","Latitude":51.44103,"Longitude":0.36699},{"Name":"Grays","CrsCode":"GRY","Latitude":51.47609,"Longitude":0.322719},{"Name":"Great Ayton","CrsCode":"GTA","Latitude":54.4902,"Longitude":-1.113845},{"Name":"Great Bentley","CrsCode":"GRB","Latitude":51.85207,"Longitude":1.065258},{"Name":"Great Chesterford","CrsCode":"GRC","Latitude":52.0604019,"Longitude":0.1939},{"Name":"Great Coates","CrsCode":"GCT","Latitude":53.5755424,"Longitude":-0.128701},{"Name":"Great Malvern","CrsCode":"GMV","Latitude":52.1091652,"Longitude":-2.318289},{"Name":"Great Missenden","CrsCode":"GMN","Latitude":51.7033043,"Longitude":-0.709132},{"Name":"Great Yarmouth","CrsCode":"GYM","Latitude":52.61212,"Longitude":1.720949},{"Name":"Green Lane","CrsCode":"GNL","Latitude":53.38271,"Longitude":-3.016281},{"Name":"Green Road","CrsCode":"GNR","Latitude":54.2447472,"Longitude":-3.245602},{"Name":"Greenbank","CrsCode":"GBK","Latitude":53.2516632,"Longitude":-2.533185},{"Name":"Greenfaulds","CrsCode":"GRL","Latitude":55.9320641,"Longitude":-3.999232},{"Name":"Greenfield","CrsCode":"GNF","Latitude":53.5388336,"Longitude":-2.014189},{"Name":"Greenford","CrsCode":"GFD","Latitude":51.54235,"Longitude":-0.3463},{"Name":"Greenhithe For Bluewater","CrsCode":"GNH","Latitude":51.4508553,"Longitude":0.279694},{"Name":"Greenock Central","CrsCode":"GKC","Latitude":55.945385,"Longitude":-4.752692},{"Name":"Greenock West","CrsCode":"GKW","Latitude":55.94772,"Longitude":-4.768866},{"Name":"Greenwich","CrsCode":"GNW","Latitude":51.47778,"Longitude":-0.014198},{"Name":"Gretna Green","CrsCode":"GEA","Latitude":55.0019341,"Longitude":-3.064608},{"Name":"Greystones","CrsCode":"GSO","Latitude":null,"Longitude":null},{"Name":"Grimsby (Any)","CrsCode":"84","Latitude":null,"Longitude":null},{"Name":"Grimsby Docks","CrsCode":"GMD","Latitude":53.5747,"Longitude":-0.075873},{"Name":"Grimsby Town","CrsCode":"GMB","Latitude":53.56409,"Longitude":-0.086922},{"Name":"Grindleford","CrsCode":"GRN","Latitude":53.30555,"Longitude":-1.62629},{"Name":"Grosmont","CrsCode":"GMT","Latitude":54.4363937,"Longitude":-0.724937},{"Name":"Grove Park","CrsCode":"GRP","Latitude":51.43039,"Longitude":0.022597},{"Name":"Guide Bridge","CrsCode":"GUI","Latitude":53.47417,"Longitude":-2.112961},{"Name":"Guildford","CrsCode":"GLD","Latitude":51.23691,"Longitude":-0.580409},{"Name":"Guildford (Any)","CrsCode":"85","Latitude":null,"Longitude":null},{"Name":"Guiseley","CrsCode":"GSY","Latitude":53.8756676,"Longitude":-1.715537},{"Name":"Gunnersbury","CrsCode":"GUN","Latitude":51.4918137,"Longitude":-0.275766},{"Name":"Gunnislake","CrsCode":"GSL","Latitude":50.51599,"Longitude":-4.219437},{"Name":"Gunton","CrsCode":"GNT","Latitude":52.8660774,"Longitude":1.348821},{"Name":"Gwersyllt","CrsCode":"GWE","Latitude":53.07256,"Longitude":-3.017913},{"Name":"Gypsy Lane","CrsCode":"GYP","Latitude":54.5329,"Longitude":-1.179375},{"Name":"Habrough","CrsCode":"HAB","Latitude":53.6055069,"Longitude":-0.267936},{"Name":"Hackbridge","CrsCode":"HCB","Latitude":51.378437,"Longitude":-0.15358},{"Name":"Hackney Central","CrsCode":"HKC","Latitude":51.5468254,"Longitude":-0.055896},{"Name":"Hackney Downs","CrsCode":"HAC","Latitude":51.5486946,"Longitude":-0.060144},{"Name":"Hackney Wick","CrsCode":"HKW","Latitude":51.5436249,"Longitude":-0.025759},{"Name":"Haddenham And Thame Parkway","CrsCode":"HDM","Latitude":51.7707863,"Longitude":-0.942121},{"Name":"Haddiscoe","CrsCode":"HAD","Latitude":52.5288353,"Longitude":1.622451},{"Name":"Hadfield","CrsCode":"HDF","Latitude":53.4608727,"Longitude":-1.965429},{"Name":"Hadley Wood","CrsCode":"HDW","Latitude":51.6683655,"Longitude":-0.176519},{"Name":"Hag Fold","CrsCode":"HGF","Latitude":53.5334435,"Longitude":-2.493744},{"Name":"Haggerston","CrsCode":"HGG","Latitude":51.53912,"Longitude":-0.07642},{"Name":"Hagley","CrsCode":"HAG","Latitude":52.4223747,"Longitude":-2.147018},{"Name":"Hairmyres","CrsCode":"HMY","Latitude":55.7620125,"Longitude":-4.220047},{"Name":"Hale (Manchester)","CrsCode":"HAL","Latitude":53.37867,"Longitude":-2.347383},{"Name":"Halesworth","CrsCode":"HAS","Latitude":52.3461571,"Longitude":1.506141},{"Name":"Halewood","CrsCode":"HED","Latitude":53.3644676,"Longitude":-2.830149},{"Name":"Halifax","CrsCode":"HFX","Latitude":53.720417,"Longitude":-1.854486},{"Name":"Hall Green","CrsCode":"HLG","Latitude":52.4367447,"Longitude":-1.845513},{"Name":"Hall Road","CrsCode":"HLR","Latitude":53.49744,"Longitude":-3.049607},{"Name":"Hall-I-Th-Wood","CrsCode":"HID","Latitude":53.5975456,"Longitude":-2.413986},{"Name":"Halling","CrsCode":"HAI","Latitude":51.35217,"Longitude":0.445711},{"Name":"Haltwhistle","CrsCode":"HWH","Latitude":54.96797,"Longitude":-2.462321},{"Name":"Ham Street","CrsCode":"HMT","Latitude":51.0676842,"Longitude":0.854653},{"Name":"Hamble","CrsCode":"HME","Latitude":50.87131,"Longitude":-1.329173},{"Name":"Hamilton Central","CrsCode":"HNC","Latitude":55.77324,"Longitude":-4.038928},{"Name":"Hamilton West","CrsCode":"HNW","Latitude":55.779232,"Longitude":-4.056781},{"Name":"Hammerton","CrsCode":"HMM","Latitude":53.9961052,"Longitude":-1.283026},{"Name":"Hampden Park (Sussex)","CrsCode":"HMD","Latitude":50.7961235,"Longitude":0.278906},{"Name":"Hampstead (Any)","CrsCode":"88","Latitude":null,"Longitude":null},{"Name":"Hampstead Heath","CrsCode":"HDH","Latitude":51.55578,"Longitude":-0.165159},{"Name":"Hampton (London)","CrsCode":"HMP","Latitude":51.41607,"Longitude":-0.37199},{"Name":"Hampton Court","CrsCode":"HMC","Latitude":51.401947,"Longitude":-0.342412},{"Name":"Hampton Wick","CrsCode":"HMW","Latitude":51.41412,"Longitude":-0.313201},{"Name":"Hampton-In-Arden","CrsCode":"HIA","Latitude":52.4283752,"Longitude":-1.699934},{"Name":"Hamstead (Birmingham)","CrsCode":"HSD","Latitude":52.53072,"Longitude":-1.92838},{"Name":"Hamworthy","CrsCode":"HAM","Latitude":50.7257538,"Longitude":-2.018381},{"Name":"Hanborough","CrsCode":"HND","Latitude":51.8251724,"Longitude":-1.373471},{"Name":"Handforth","CrsCode":"HTH","Latitude":53.34639,"Longitude":-2.213263},{"Name":"Hanley Bus Stn","CrsCode":"HNY","Latitude":null,"Longitude":null},{"Name":"Hanwell","CrsCode":"HAN","Latitude":51.5116043,"Longitude":-0.338432},{"Name":"Hapton","CrsCode":"HPN","Latitude":53.78139,"Longitude":-2.318115},{"Name":"Harlech","CrsCode":"HRL","Latitude":52.86131,"Longitude":-4.109248},{"Name":"Harlesden","CrsCode":"HDN","Latitude":51.53652,"Longitude":-0.258214},{"Name":"Harling Road","CrsCode":"HRD","Latitude":52.45413,"Longitude":0.908188},{"Name":"Harlington (Bedfordshire)","CrsCode":"HLN","Latitude":51.9620132,"Longitude":-0.495715},{"Name":"Harlow Mill","CrsCode":"HWM","Latitude":51.79088,"Longitude":0.131497},{"Name":"Harlow Town","CrsCode":"HWN","Latitude":51.78164,"Longitude":0.094804},{"Name":"Harold Wood","CrsCode":"HRO","Latitude":51.592907,"Longitude":0.234819},{"Name":"Harpenden","CrsCode":"HPD","Latitude":51.81483,"Longitude":-0.351961},{"Name":"Harrietsham","CrsCode":"HRM","Latitude":51.24465,"Longitude":0.673574},{"Name":"Harringay","CrsCode":"HGY","Latitude":51.5773048,"Longitude":-0.105115},{"Name":"Harringay Green Lanes","CrsCode":"HRY","Latitude":51.5773354,"Longitude":-0.098104},{"Name":"Harrington","CrsCode":"HRR","Latitude":54.6135521,"Longitude":-3.565573},{"Name":"Harrogate","CrsCode":"HGT","Latitude":53.99196,"Longitude":-1.537814},{"Name":"Harrow And Wealdstone","CrsCode":"HRW","Latitude":51.5915756,"Longitude":-0.334067},{"Name":"Harrow-On-The-Hill","CrsCode":"HOH","Latitude":51.57931,"Longitude":-0.336628},{"Name":"Hartford (Cheshire)","CrsCode":"HTF","Latitude":53.2417221,"Longitude":-2.553978},{"Name":"Hartlebury","CrsCode":"HBY","Latitude":52.33505,"Longitude":-2.22158},{"Name":"Hartlepool","CrsCode":"HPL","Latitude":54.68677,"Longitude":-1.2073},{"Name":"Hartwood","CrsCode":"HTW","Latitude":55.81053,"Longitude":-3.839792},{"Name":"Harwich (Any)","CrsCode":"92","Latitude":null,"Longitude":null},{"Name":"Harwich International","CrsCode":"HPQ","Latitude":51.9477,"Longitude":1.255167},{"Name":"Harwich Town","CrsCode":"HWC","Latitude":51.9441566,"Longitude":1.285469},{"Name":"Haslemere","CrsCode":"HSL","Latitude":51.0892372,"Longitude":-0.719162},{"Name":"Hassocks","CrsCode":"HSK","Latitude":50.9232635,"Longitude":-0.146043},{"Name":"Hastings","CrsCode":"HGS","Latitude":50.8582878,"Longitude":0.57608},{"Name":"Hatch End","CrsCode":"HTE","Latitude":51.610054,"Longitude":-0.369499},{"Name":"Hatfield (Herts)","CrsCode":"HAT","Latitude":51.7633972,"Longitude":-0.216162},{"Name":"Hatfield And Stainforth","CrsCode":"HFS","Latitude":53.58953,"Longitude":-1.020931},{"Name":"Hatfield Peverel","CrsCode":"HAP","Latitude":51.7797852,"Longitude":0.593463},{"Name":"Hathersage","CrsCode":"HSG","Latitude":53.3254051,"Longitude":-1.651641},{"Name":"Hattersley","CrsCode":"HTY","Latitude":53.4451256,"Longitude":-2.040324},{"Name":"Hatton","CrsCode":"HTN","Latitude":52.2952423,"Longitude":-1.672982},{"Name":"Havant","CrsCode":"HAV","Latitude":50.8544159,"Longitude":-0.982763},{"Name":"Havenhouse","CrsCode":"HVN","Latitude":53.1145477,"Longitude":0.272619},{"Name":"Haverfordwest","CrsCode":"HVF","Latitude":51.8026,"Longitude":-4.960279},{"Name":"Hawarden","CrsCode":"HWD","Latitude":53.1857033,"Longitude":-3.032561},{"Name":"Hawarden (Any)","CrsCode":"93","Latitude":null,"Longitude":null},{"Name":"Hawarden Bridge","CrsCode":"HWB","Latitude":53.21897,"Longitude":-3.031866},{"Name":"Hawkhead","CrsCode":"HKH","Latitude":55.8431358,"Longitude":-4.398792},{"Name":"Haydon Bridge","CrsCode":"HDB","Latitude":54.9748878,"Longitude":-2.246809},{"Name":"Haydons Road","CrsCode":"HYR","Latitude":51.4257545,"Longitude":-0.189073},{"Name":"Hayes (Kent)","CrsCode":"HYS","Latitude":51.3757439,"Longitude":0.010123},{"Name":"Hayes And Harlington","CrsCode":"HAY","Latitude":51.50297,"Longitude":-0.420785},{"Name":"Hayle","CrsCode":"HYL","Latitude":50.1861763,"Longitude":-5.419558},{"Name":"Haymarket","CrsCode":"HYM","Latitude":55.9458542,"Longitude":-3.218458},{"Name":"Haywards Heath","CrsCode":"HHE","Latitude":51.00536,"Longitude":-0.105717},{"Name":"Hazel Grove","CrsCode":"HAZ","Latitude":53.3774147,"Longitude":-2.122121},{"Name":"Headcorn","CrsCode":"HCN","Latitude":51.165657,"Longitude":0.627507},{"Name":"Headingley","CrsCode":"HDY","Latitude":53.8177872,"Longitude":-1.59289},{"Name":"Headstone Lane","CrsCode":"HDL","Latitude":51.60268,"Longitude":-0.356766},{"Name":"Heald Green","CrsCode":"HDG","Latitude":53.3692474,"Longitude":-2.236533},{"Name":"Healing","CrsCode":"HLI","Latitude":53.5814247,"Longitude":-0.160163},{"Name":"Heath (Any)","CrsCode":"94","Latitude":null,"Longitude":null},{"Name":"Heath High Level","CrsCode":"HHL","Latitude":51.5165176,"Longitude":-3.181737},{"Name":"Heath Low Level","CrsCode":"HLL","Latitude":51.5156059,"Longitude":-3.183163},{"Name":"Heathrow Airport (Any)","CrsCode":"193","Latitude":null,"Longitude":null},{"Name":"Heathrow Bus","CrsCode":"420","Latitude":null,"Longitude":null},{"Name":"Heathrow Rail","CrsCode":"419","Latitude":null,"Longitude":null},{"Name":"Heathrow T1 No Underground","CrsCode":"427","Latitude":null,"Longitude":null},{"Name":"Heathrow T123","CrsCode":"405","Latitude":null,"Longitude":null},{"Name":"Heathrow T123 No Underground","CrsCode":"426","Latitude":null,"Longitude":null},{"Name":"Heathrow T2 No Underground","CrsCode":"428","Latitude":null,"Longitude":null},{"Name":"Heathrow T3 No Underground","CrsCode":"429","Latitude":null,"Longitude":null},{"Name":"Heathrow T4 No Underground","CrsCode":"430","Latitude":null,"Longitude":null},{"Name":"Heathrow T5 No Underground","CrsCode":"431","Latitude":null,"Longitude":null},{"Name":"Heathrow Terminal 2","CrsCode":"407","Latitude":null,"Longitude":null},{"Name":"Heathrow Terminal 3","CrsCode":"408","Latitude":null,"Longitude":null},{"Name":"Heathrow Terminal 4","CrsCode":"409","Latitude":null,"Longitude":null},{"Name":"Heathrow Terminal 4 (Rail Station Only)","CrsCode":"HAF","Latitude":51.4582138,"Longitude":-0.445447},{"Name":"Heathrow Terminal 5","CrsCode":"418","Latitude":null,"Longitude":null},{"Name":"Heathrow Terminal 5 (Rail Station Only)","CrsCode":"HWV","Latitude":51.47,"Longitude":-0.48},{"Name":"Heathrow Terminals 2 And 3 (Rail Station Only)","CrsCode":"HXX","Latitude":51.471,"Longitude":-0.456},{"Name":"Heathrow Underground","CrsCode":"ZHJ","Latitude":null,"Longitude":null},{"Name":"Heaton Chapel","CrsCode":"HTC","Latitude":53.4255562,"Longitude":-2.179046},{"Name":"Hebden Bridge","CrsCode":"HBD","Latitude":53.737587,"Longitude":-2.009063},{"Name":"Heckington","CrsCode":"HEC","Latitude":52.9774628,"Longitude":-0.29316},{"Name":"Hedge End","CrsCode":"HDE","Latitude":50.9277725,"Longitude":-1.297056},{"Name":"Hednesford","CrsCode":"HNF","Latitude":52.7099228,"Longitude":-2.00199},{"Name":"Heighington","CrsCode":"HEI","Latitude":54.5969772,"Longitude":-1.582071},{"Name":"Helensburgh (Any)","CrsCode":"95","Latitude":null,"Longitude":null},{"Name":"Helensburgh Central","CrsCode":"HLC","Latitude":56.00426,"Longitude":-4.732803},{"Name":"Helensburgh Upper","CrsCode":"HLU","Latitude":56.0132675,"Longitude":-4.73184},{"Name":"Hellifield","CrsCode":"HLD","Latitude":54.01097,"Longitude":-2.227961},{"Name":"Helmsdale","CrsCode":"HMS","Latitude":58.1177368,"Longitude":-3.660068},{"Name":"Helsby","CrsCode":"HSB","Latitude":53.2757835,"Longitude":-2.770786},{"Name":"Helston Bus","CrsCode":"XAV","Latitude":null,"Longitude":null},{"Name":"Hemel Hempstead","CrsCode":"HML","Latitude":51.74206,"Longitude":-0.490762},{"Name":"Hendon","CrsCode":"HEN","Latitude":51.5800552,"Longitude":-0.238652},{"Name":"Hengoed","CrsCode":"HNG","Latitude":51.64736,"Longitude":-3.224162},{"Name":"Henley-In-Arden","CrsCode":"HNL","Latitude":52.291,"Longitude":-1.784444},{"Name":"Henley-On-Thames","CrsCode":"HOT","Latitude":51.5341835,"Longitude":-0.900133},{"Name":"Hensall","CrsCode":"HEL","Latitude":53.6983566,"Longitude":-1.113905},{"Name":"Hereford","CrsCode":"HFD","Latitude":52.0607147,"Longitude":-2.708854},{"Name":"Herne Bay","CrsCode":"HNB","Latitude":51.36406,"Longitude":1.118742},{"Name":"Herne Hill","CrsCode":"HNH","Latitude":51.4531479,"Longitude":-0.101624},{"Name":"Hersham","CrsCode":"HER","Latitude":51.37742,"Longitude":-0.389271},{"Name":"Hertford (Any)","CrsCode":"96","Latitude":null,"Longitude":null},{"Name":"Hertford East","CrsCode":"HFE","Latitude":51.7997932,"Longitude":-0.072591},{"Name":"Hertford North","CrsCode":"HFN","Latitude":51.79833,"Longitude":-0.092961},{"Name":"Hessle","CrsCode":"HES","Latitude":53.7175674,"Longitude":-0.442169},{"Name":"Heswall","CrsCode":"HSW","Latitude":53.32917,"Longitude":-3.073568},{"Name":"Hever","CrsCode":"HEV","Latitude":51.180912,"Longitude":0.094648},{"Name":"Hever (Brocas Farm By Bus)","CrsCode":"HBF","Latitude":null,"Longitude":null},{"Name":"Heworth","CrsCode":"HEW","Latitude":54.9518623,"Longitude":-1.554976},{"Name":"Hexham","CrsCode":"HEX","Latitude":54.9742,"Longitude":-2.095266},{"Name":"Heyford","CrsCode":"HYD","Latitude":51.91902,"Longitude":-1.299262},{"Name":"Heysham Port","CrsCode":"HHB","Latitude":54.0332832,"Longitude":-2.913179},{"Name":"High Brooms","CrsCode":"HIB","Latitude":51.14961,"Longitude":0.277686},{"Name":"High Street (Glasgow)","CrsCode":"HST","Latitude":55.85872,"Longitude":-4.239953},{"Name":"High Wycombe","CrsCode":"HWY","Latitude":51.62979,"Longitude":-0.745139},{"Name":"Higham","CrsCode":"HGM","Latitude":51.4263763,"Longitude":0.466931},{"Name":"Highams Park","CrsCode":"HIP","Latitude":51.6088371,"Longitude":0.000183},{"Name":"Highbridge And Burnham","CrsCode":"HIG","Latitude":51.2180977,"Longitude":-2.972192},{"Name":"Highbury And Islington","CrsCode":"HHY","Latitude":51.54668,"Longitude":-0.10206},{"Name":"Hightown","CrsCode":"HTO","Latitude":53.5252724,"Longitude":-3.057407},{"Name":"Hildenborough","CrsCode":"HLB","Latitude":51.21445,"Longitude":0.226465},{"Name":"Hillfoot","CrsCode":"HLF","Latitude":55.9201431,"Longitude":-4.32032},{"Name":"Hillington East","CrsCode":"HLE","Latitude":55.85478,"Longitude":-4.354768},{"Name":"Hillington West","CrsCode":"HLW","Latitude":55.85537,"Longitude":-4.370778},{"Name":"Hillside","CrsCode":"HIL","Latitude":53.62217,"Longitude":-3.024673},{"Name":"Hilsea","CrsCode":"HLS","Latitude":50.8280754,"Longitude":-1.058592},{"Name":"Hinchley Wood","CrsCode":"HYW","Latitude":51.37494,"Longitude":-0.340508},{"Name":"Hinckley (Leics)","CrsCode":"HNK","Latitude":52.53497,"Longitude":-1.371916},{"Name":"Hindley","CrsCode":"HIN","Latitude":53.5420532,"Longitude":-2.574909},{"Name":"Hinton Admiral","CrsCode":"HNA","Latitude":50.7523842,"Longitude":-1.713616},{"Name":"Hitchin","CrsCode":"HIT","Latitude":51.9529152,"Longitude":-0.262498},{"Name":"Hither Green","CrsCode":"HGR","Latitude":51.4523735,"Longitude":-0.000906},{"Name":"Hockley","CrsCode":"HOC","Latitude":51.6038246,"Longitude":0.659971},{"Name":"Hollingbourne","CrsCode":"HBN","Latitude":51.2654839,"Longitude":0.627465},{"Name":"Holmes Chapel","CrsCode":"HCH","Latitude":53.19913,"Longitude":-2.351063},{"Name":"Holmwood","CrsCode":"HLM","Latitude":51.1804276,"Longitude":-0.321752},{"Name":"Holton Heath","CrsCode":"HOL","Latitude":50.7113457,"Longitude":-2.077863},{"Name":"Holyhead","CrsCode":"HHD","Latitude":53.3076744,"Longitude":-4.631062},{"Name":"Holytown","CrsCode":"HLY","Latitude":55.8129425,"Longitude":-3.973967},{"Name":"Homerton","CrsCode":"HMN","Latitude":51.5465355,"Longitude":-0.038601},{"Name":"Honeybourne","CrsCode":"HYB","Latitude":52.1013832,"Longitude":-1.834989},{"Name":"Honiton","CrsCode":"HON","Latitude":50.7970619,"Longitude":-3.186207},{"Name":"Honley","CrsCode":"HOY","Latitude":53.60885,"Longitude":-1.780814},{"Name":"Honor Oak Park","CrsCode":"HPA","Latitude":51.450428,"Longitude":-0.045607},{"Name":"Hook","CrsCode":"HOK","Latitude":51.2795868,"Longitude":-0.961933},{"Name":"Hooton","CrsCode":"HOO","Latitude":53.29674,"Longitude":-2.976721},{"Name":"Hope (Derbyshire)","CrsCode":"HOP","Latitude":53.346283,"Longitude":-1.729587},{"Name":"Hope (Flintshire)","CrsCode":"HPE","Latitude":53.1173439,"Longitude":-3.03691},{"Name":"Hopton Heath","CrsCode":"HPT","Latitude":52.391964,"Longitude":-2.912536},{"Name":"Horden","CrsCode":"HRE","Latitude":null,"Longitude":null},{"Name":"Horley","CrsCode":"HOR","Latitude":51.1681366,"Longitude":-0.161994},{"Name":"Hornbeam Park","CrsCode":"HBP","Latitude":53.9802361,"Longitude":-1.527272},{"Name":"Hornsey","CrsCode":"HRN","Latitude":51.5864143,"Longitude":-0.111961},{"Name":"Horsforth","CrsCode":"HRS","Latitude":53.8475761,"Longitude":-1.630612},{"Name":"Horsham","CrsCode":"HRH","Latitude":51.0661736,"Longitude":-0.318753},{"Name":"Horsley","CrsCode":"HSY","Latitude":51.2791138,"Longitude":-0.434304},{"Name":"Horton-In-Ribblesdale","CrsCode":"HIR","Latitude":54.14938,"Longitude":-2.302054},{"Name":"Horwich Parkway","CrsCode":"HWI","Latitude":53.57995,"Longitude":-2.543712},{"Name":"Hoscar","CrsCode":"HSC","Latitude":53.5973663,"Longitude":-2.803828},{"Name":"Hough Green","CrsCode":"HGN","Latitude":53.37238,"Longitude":-2.775056},{"Name":"Hounslow","CrsCode":"HOU","Latitude":51.46247,"Longitude":-0.361808},{"Name":"Hove","CrsCode":"HOV","Latitude":50.8355141,"Longitude":-0.170824},{"Name":"Hoveton And Wroxham","CrsCode":"HXM","Latitude":52.7150841,"Longitude":1.408312},{"Name":"How Wood (Hertfordshire)","CrsCode":"HWW","Latitude":51.7176971,"Longitude":-0.344594},{"Name":"Howden","CrsCode":"HOW","Latitude":53.7645264,"Longitude":-0.86068},{"Name":"Howwood (Renfrewshire)","CrsCode":"HOZ","Latitude":55.811,"Longitude":-4.56},{"Name":"Hoxton","CrsCode":"HOX","Latitude":51.53193,"Longitude":-0.07672},{"Name":"Hoylake","CrsCode":"HYK","Latitude":53.3902,"Longitude":-3.178861},{"Name":"Hubberts Bridge","CrsCode":"HBB","Latitude":52.9755936,"Longitude":-0.110044},{"Name":"Hucknall","CrsCode":"HKN","Latitude":53.0382652,"Longitude":-1.195793},{"Name":"Huddersfield","CrsCode":"HUD","Latitude":53.648407,"Longitude":-1.785142},{"Name":"Hull","CrsCode":"HUL","Latitude":53.7441444,"Longitude":-0.345645},{"Name":"Humphrey Park","CrsCode":"HUP","Latitude":53.45232,"Longitude":-2.327363},{"Name":"Huncoat","CrsCode":"HCT","Latitude":53.7721443,"Longitude":-2.345903},{"Name":"Hungerford","CrsCode":"HGD","Latitude":51.4153442,"Longitude":-1.511056},{"Name":"Hunmanby","CrsCode":"HUB","Latitude":54.17429,"Longitude":-0.314737},{"Name":"Hunstanton Bus","CrsCode":"HUS","Latitude":null,"Longitude":null},{"Name":"Huntingdon","CrsCode":"HUN","Latitude":52.3286133,"Longitude":-0.192047},{"Name":"Huntly","CrsCode":"HNT","Latitude":57.4444,"Longitude":-2.776354},{"Name":"Hunts Cross","CrsCode":"HNX","Latitude":53.3606453,"Longitude":-2.855716},{"Name":"Hurst Green","CrsCode":"HUR","Latitude":51.244545,"Longitude":0.004397},{"Name":"Hutton Cranswick","CrsCode":"HUT","Latitude":53.95567,"Longitude":-0.43331},{"Name":"Huyton","CrsCode":"HUY","Latitude":53.4098129,"Longitude":-2.842991},{"Name":"Hyde Central","CrsCode":"HYC","Latitude":53.451683,"Longitude":-2.085149},{"Name":"Hyde North","CrsCode":"HYT","Latitude":53.4643059,"Longitude":-2.085829},{"Name":"Hykeham","CrsCode":"HKM","Latitude":53.1945457,"Longitude":-0.600412},{"Name":"Hyndland","CrsCode":"HYN","Latitude":55.8798027,"Longitude":-4.314715},{"Name":"Hythe (Essex)","CrsCode":"HYH","Latitude":51.88528,"Longitude":0.926539},{"Name":"Ifield","CrsCode":"IFI","Latitude":51.1159019,"Longitude":-0.215505},{"Name":"Ilford","CrsCode":"IFD","Latitude":51.55908,"Longitude":0.068699},{"Name":"Ilkeston","CrsCode":"ILN","Latitude":52.9794,"Longitude":-1.2949},{"Name":"Ilkley","CrsCode":"ILK","Latitude":53.9253044,"Longitude":-1.821799},{"Name":"Imperial Wharf","CrsCode":"IMW","Latitude":51.4751358,"Longitude":-0.183026},{"Name":"Ince (Manchester)","CrsCode":"INC","Latitude":53.5389748,"Longitude":-2.611865},{"Name":"Ince And Elton (Cheshire)","CrsCode":"INE","Latitude":53.2767372,"Longitude":-2.816234},{"Name":"Ingatestone","CrsCode":"INT","Latitude":51.6673,"Longitude":0.384556},{"Name":"Insch","CrsCode":"INS","Latitude":57.33749,"Longitude":-2.616279},{"Name":"Invergordon","CrsCode":"IGD","Latitude":57.6885872,"Longitude":-4.175563},{"Name":"Invergowrie","CrsCode":"ING","Latitude":56.4567947,"Longitude":-3.057897},{"Name":"Inverkeithing","CrsCode":"INK","Latitude":56.0347252,"Longitude":-3.39621},{"Name":"Inverkip","CrsCode":"INP","Latitude":55.90578,"Longitude":-4.873089},{"Name":"Inverness","CrsCode":"INV","Latitude":57.4801941,"Longitude":-4.223199},{"Name":"Invershin","CrsCode":"INH","Latitude":57.92536,"Longitude":-4.399288},{"Name":"Inverurie","CrsCode":"INR","Latitude":57.2863426,"Longitude":-2.373224},{"Name":"Ipswich","CrsCode":"IPS","Latitude":52.0505524,"Longitude":1.144481},{"Name":"Irlam","CrsCode":"IRL","Latitude":53.4341736,"Longitude":-2.432989},{"Name":"Irvine","CrsCode":"IRV","Latitude":55.6109161,"Longitude":-4.675196},{"Name":"Isleworth","CrsCode":"ISL","Latitude":51.47471,"Longitude":-0.33689},{"Name":"Islip","CrsCode":"ISP","Latitude":51.82571,"Longitude":-1.238185},{"Name":"Iver","CrsCode":"IVR","Latitude":51.5083427,"Longitude":-0.506659},{"Name":"Ivybridge","CrsCode":"IVY","Latitude":50.3935165,"Longitude":-3.904954},{"Name":"James Cook University Hospital","CrsCode":"JCH","Latitude":54.5515,"Longitude":-1.2076},{"Name":"Jewellery Quarter","CrsCode":"JEQ","Latitude":52.4895134,"Longitude":-1.913522},{"Name":"Johnston (Pembs)","CrsCode":"JOH","Latitude":51.7567139,"Longitude":-4.996407},{"Name":"Johnstone (Strathclyde)","CrsCode":"JHN","Latitude":55.83476,"Longitude":-4.50369},{"Name":"Jordanhill","CrsCode":"JOR","Latitude":55.8822823,"Longitude":-4.326053},{"Name":"Kearsley (Manchester)","CrsCode":"KSL","Latitude":53.54419,"Longitude":-2.375032},{"Name":"Kearsney (Kent)","CrsCode":"KSN","Latitude":51.1494,"Longitude":1.271566},{"Name":"Keighley","CrsCode":"KEI","Latitude":53.86787,"Longitude":-1.90112},{"Name":"Keith","CrsCode":"KEH","Latitude":57.5509758,"Longitude":-2.954062},{"Name":"Kelvedon","CrsCode":"KEL","Latitude":51.8412,"Longitude":0.701529},{"Name":"Kelvindale","CrsCode":"KVD","Latitude":55.8933,"Longitude":-4.3106},{"Name":"Kemble","CrsCode":"KEM","Latitude":51.67622,"Longitude":-2.023115},{"Name":"Kempston Hardwick","CrsCode":"KMH","Latitude":52.0920258,"Longitude":-0.505266},{"Name":"Kempton Park ","CrsCode":"KMP","Latitude":51.4217567,"Longitude":-0.40929},{"Name":"Kemsing","CrsCode":"KMS","Latitude":51.2976837,"Longitude":0.247716},{"Name":"Kemsley","CrsCode":"KML","Latitude":51.3619957,"Longitude":0.733559},{"Name":"Kendal","CrsCode":"KEN","Latitude":54.3321075,"Longitude":-2.739667},{"Name":"Kenilworth","CrsCode":"KNW","Latitude":52.3422,"Longitude":-1.5724},{"Name":"Kenley","CrsCode":"KLY","Latitude":51.3245468,"Longitude":-0.101199},{"Name":"Kennett","CrsCode":"KNE","Latitude":52.277523,"Longitude":0.490482},{"Name":"Kennishead","CrsCode":"KNS","Latitude":55.8131,"Longitude":-4.325119},{"Name":"Kensal Green","CrsCode":"KNL","Latitude":51.5306,"Longitude":-0.223847},{"Name":"Kensal Rise","CrsCode":"KNR","Latitude":51.5341568,"Longitude":-0.220811},{"Name":"Kensington Olympia","CrsCode":"KPA","Latitude":51.4977531,"Longitude":-0.210189},{"Name":"Kent House","CrsCode":"KTH","Latitude":51.41266,"Longitude":-0.045786},{"Name":"Kentish Town","CrsCode":"KTN","Latitude":51.55034,"Longitude":-0.140446},{"Name":"Kentish Town (Any)","CrsCode":"99","Latitude":null,"Longitude":null},{"Name":"Kentish Town West","CrsCode":"KTW","Latitude":51.5465,"Longitude":-0.146778},{"Name":"Kenton","CrsCode":"KNT","Latitude":51.5814362,"Longitude":-0.317123},{"Name":"Kenton (Any)","CrsCode":"100","Latitude":null,"Longitude":null},{"Name":"Kents Bank","CrsCode":"KBK","Latitude":54.172966,"Longitude":-2.925351},{"Name":"Kettering","CrsCode":"KET","Latitude":52.393177,"Longitude":-0.731724},{"Name":"Kettering (By Bus Via Peterborough)","CrsCode":"KEZ","Latitude":null,"Longitude":null},{"Name":"Kew Bridge","CrsCode":"KWB","Latitude":51.48931,"Longitude":-0.288827},{"Name":"Kew Gardens","CrsCode":"KWG","Latitude":51.47756,"Longitude":-0.284949},{"Name":"Keyham","CrsCode":"KEY","Latitude":50.3896866,"Longitude":-4.179095},{"Name":"Keynsham","CrsCode":"KYN","Latitude":51.41712,"Longitude":-2.49465},{"Name":"Kidbrooke","CrsCode":"KDB","Latitude":51.46266,"Longitude":0.028331},{"Name":"Kidderminster","CrsCode":"KID","Latitude":52.3844566,"Longitude":-2.239458},{"Name":"Kidsgrove","CrsCode":"KDG","Latitude":53.0865555,"Longitude":-2.244828},{"Name":"Kidwelly","CrsCode":"KWL","Latitude":51.7343,"Longitude":-4.317046},{"Name":"Kilburn High Road","CrsCode":"KBN","Latitude":51.53731,"Longitude":-0.19186},{"Name":"Kildale","CrsCode":"KLD","Latitude":54.47727,"Longitude":-1.067829},{"Name":"Kildare (Irish Rail)","CrsCode":"KDR","Latitude":null,"Longitude":null},{"Name":"Kildonan","CrsCode":"KIL","Latitude":58.1714325,"Longitude":-3.869993},{"Name":"Kilgetty","CrsCode":"KGT","Latitude":51.73207,"Longitude":-4.715219},{"Name":"Kilkenny","CrsCode":"KNY","Latitude":null,"Longitude":null},{"Name":"Killarney","CrsCode":"KLL","Latitude":null,"Longitude":null},{"Name":"Kilmarnock","CrsCode":"KMK","Latitude":55.6128349,"Longitude":-4.499048},{"Name":"Kilmaurs","CrsCode":"KLM","Latitude":55.636425,"Longitude":-4.532331},{"Name":"Kilpatrick","CrsCode":"KPT","Latitude":55.9247551,"Longitude":-4.453454},{"Name":"Kilwinning","CrsCode":"KWN","Latitude":55.6559944,"Longitude":-4.710071},{"Name":"Kinbrace","CrsCode":"KBC","Latitude":58.2584076,"Longitude":-3.941063},{"Name":"Kingham","CrsCode":"KGM","Latitude":51.90222,"Longitude":-1.629331},{"Name":"Kinghorn","CrsCode":"KGH","Latitude":56.06939,"Longitude":-3.174161},{"Name":"Kings Cross St Pancras","CrsCode":"411","Latitude":null,"Longitude":null},{"Name":"Kings Langley","CrsCode":"KGL","Latitude":51.70631,"Longitude":-0.438411},{"Name":"Kings Lynn","CrsCode":"KLN","Latitude":52.75411,"Longitude":0.403475},{"Name":"Kings Lynn Bus Station","CrsCode":"KLB","Latitude":null,"Longitude":null},{"Name":"Kings Norton","CrsCode":"KNN","Latitude":52.413456,"Longitude":-1.933801},{"Name":"Kings Nympton","CrsCode":"KGN","Latitude":50.93592,"Longitude":-3.905634},{"Name":"Kings Park","CrsCode":"KGP","Latitude":55.8199348,"Longitude":-4.247294},{"Name":"Kings Sutton","CrsCode":"KGS","Latitude":52.0201836,"Longitude":-1.280066},{"Name":"Kingsknowe","CrsCode":"KGE","Latitude":55.919323,"Longitude":-3.265634},{"Name":"Kingston","CrsCode":"KNG","Latitude":51.4121552,"Longitude":-0.301768},{"Name":"Kingswood","CrsCode":"KND","Latitude":51.2948074,"Longitude":-0.211439},{"Name":"Kingussie","CrsCode":"KIN","Latitude":57.07785,"Longitude":-4.052227},{"Name":"Kintbury","CrsCode":"KIT","Latitude":51.40247,"Longitude":-1.445059},{"Name":"Kirby Cross","CrsCode":"KBX","Latitude":51.8408966,"Longitude":1.214045},{"Name":"Kirk Sandall","CrsCode":"KKS","Latitude":53.56347,"Longitude":-1.075006},{"Name":"Kirkby (Merseyside)","CrsCode":"KIR","Latitude":53.486618,"Longitude":-2.902021},{"Name":"Kirkby Stephen","CrsCode":"KSW","Latitude":54.4551353,"Longitude":-2.368603},{"Name":"Kirkby-In-Ashfield","CrsCode":"KKB","Latitude":53.09976,"Longitude":-1.253278},{"Name":"Kirkby-In-Furness","CrsCode":"KBF","Latitude":54.2324257,"Longitude":-3.187398},{"Name":"Kirkcaldy","CrsCode":"KDY","Latitude":56.11258,"Longitude":-3.167445},{"Name":"Kirkconnel","CrsCode":"KRK","Latitude":55.38834,"Longitude":-3.998533},{"Name":"Kirkdale","CrsCode":"KKD","Latitude":53.4408951,"Longitude":-2.981093},{"Name":"Kirkham And Wesham","CrsCode":"KKM","Latitude":53.7873726,"Longitude":-2.881834},{"Name":"Kirkhill","CrsCode":"KKH","Latitude":55.8141556,"Longitude":-4.168751},{"Name":"Kirknewton","CrsCode":"KKN","Latitude":55.8887444,"Longitude":-3.432526},{"Name":"Kirkstall Forge","CrsCode":"KLF","Latitude":53.826,"Longitude":-1.62},{"Name":"Kirkwood","CrsCode":"KWD","Latitude":55.85577,"Longitude":-4.048037},{"Name":"Kirton Lindsey","CrsCode":"KTL","Latitude":53.48483,"Longitude":-0.593886},{"Name":"Kiveton (Any)","CrsCode":"101","Latitude":null,"Longitude":null},{"Name":"Kiveton Bridge","CrsCode":"KIV","Latitude":53.34073,"Longitude":-1.265524},{"Name":"Kiveton Park","CrsCode":"KVP","Latitude":53.3369751,"Longitude":-1.240052},{"Name":"Knaresborough","CrsCode":"KNA","Latitude":54.0087547,"Longitude":-1.470482},{"Name":"Knebworth","CrsCode":"KBW","Latitude":51.86636,"Longitude":-0.187406},{"Name":"Knighton","CrsCode":"KNI","Latitude":52.3450432,"Longitude":-3.042232},{"Name":"Knockholt","CrsCode":"KCK","Latitude":51.34573,"Longitude":0.130865},{"Name":"Knottingley","CrsCode":"KNO","Latitude":53.7065277,"Longitude":-1.259172},{"Name":"Knucklas","CrsCode":"KNU","Latitude":52.3598328,"Longitude":-3.096907},{"Name":"Knutsford","CrsCode":"KNF","Latitude":53.3019562,"Longitude":-2.372101},{"Name":"Kyle Of Lochalsh","CrsCode":"KYL","Latitude":57.2805672,"Longitude":-5.713067},{"Name":"Ladybank","CrsCode":"LDY","Latitude":56.2738342,"Longitude":-3.122284},{"Name":"Ladywell","CrsCode":"LAD","Latitude":51.45629,"Longitude":-0.019445},{"Name":"Laindon","CrsCode":"LAI","Latitude":51.5675659,"Longitude":0.424063},{"Name":"Lairg","CrsCode":"LRG","Latitude":58.0017,"Longitude":-4.401},{"Name":"Lake","CrsCode":"LKE","Latitude":50.64814,"Longitude":-1.16686},{"Name":"Lakenheath","CrsCode":"LAK","Latitude":52.4474564,"Longitude":0.533911},{"Name":"Lamphey","CrsCode":"LAM","Latitude":51.6671448,"Longitude":-4.873332},{"Name":"Lanark","CrsCode":"LNK","Latitude":55.67312,"Longitude":-3.772901},{"Name":"Lancaster","CrsCode":"LAN","Latitude":54.0485535,"Longitude":-2.807934},{"Name":"Lancing","CrsCode":"LAC","Latitude":50.8270149,"Longitude":-0.323103},{"Name":"Landywood","CrsCode":"LAW","Latitude":52.6571,"Longitude":-2.020659},{"Name":"Langbank","CrsCode":"LGB","Latitude":55.9247246,"Longitude":-4.586326},{"Name":"Langho","CrsCode":"LHO","Latitude":53.8049355,"Longitude":-2.447934},{"Name":"Langley (Berks)","CrsCode":"LNY","Latitude":51.50801,"Longitude":-0.541747},{"Name":"Langley Green","CrsCode":"LGG","Latitude":52.4943848,"Longitude":-2.005857},{"Name":"Langley Mill","CrsCode":"LGM","Latitude":53.0182343,"Longitude":-1.330982},{"Name":"Langside","CrsCode":"LGS","Latitude":55.8211746,"Longitude":-4.277696},{"Name":"Langwathby","CrsCode":"LGW","Latitude":54.6947441,"Longitude":-2.662457},{"Name":"Langwith-Whaley Thorns","CrsCode":"LAG","Latitude":53.2328835,"Longitude":-1.208882},{"Name":"Lapford","CrsCode":"LAP","Latitude":50.8573837,"Longitude":-3.811489},{"Name":"Lapworth","CrsCode":"LPW","Latitude":52.3412323,"Longitude":-1.72549},{"Name":"Larbert","CrsCode":"LBT","Latitude":56.02275,"Longitude":-3.830604},{"Name":"Largs","CrsCode":"LAR","Latitude":55.7926369,"Longitude":-4.867942},{"Name":"Larkhall","CrsCode":"LRH","Latitude":55.7392578,"Longitude":-3.974445},{"Name":"Laurencekirk","CrsCode":"LAU","Latitude":56.8359451,"Longitude":-2.466345},{"Name":"Lawrence Hill","CrsCode":"LWH","Latitude":51.458168,"Longitude":-2.564183},{"Name":"Layton (Lancs)","CrsCode":"LAY","Latitude":53.8356247,"Longitude":-3.030249},{"Name":"Lazonby And Kirkoswald","CrsCode":"LZB","Latitude":54.7502327,"Longitude":-2.702207},{"Name":"Lea Bridge","CrsCode":"LEB","Latitude":51.5672,"Longitude":-0.00363},{"Name":"Lea Green","CrsCode":"LEG","Latitude":53.42709,"Longitude":-2.72386},{"Name":"Lea Hall","CrsCode":"LEH","Latitude":52.48071,"Longitude":-1.786457},{"Name":"Leagrave","CrsCode":"LEA","Latitude":51.905304,"Longitude":-0.459139},{"Name":"Lealholm","CrsCode":"LHM","Latitude":54.4598846,"Longitude":-0.826027},{"Name":"Leamington Spa","CrsCode":"LMS","Latitude":52.284893,"Longitude":-1.536723},{"Name":"Leasowe","CrsCode":"LSW","Latitude":53.4080353,"Longitude":-3.099624},{"Name":"Leatherhead","CrsCode":"LHD","Latitude":51.2983971,"Longitude":-0.333225},{"Name":"Ledbury","CrsCode":"LED","Latitude":52.04499,"Longitude":-2.425728},{"Name":"Lee (London)","CrsCode":"LEE","Latitude":51.4494324,"Longitude":0.013364},{"Name":"Leeds","CrsCode":"LDS","Latitude":53.79516,"Longitude":-1.549089},{"Name":"Leeds Bradford Airport","CrsCode":"XLB","Latitude":null,"Longitude":null},{"Name":"Leicester","CrsCode":"LEI","Latitude":52.6313972,"Longitude":-1.125274},{"Name":"Leigh (Kent)","CrsCode":"LIH","Latitude":51.1940575,"Longitude":0.211179},{"Name":"Leigh-On-Sea","CrsCode":"LES","Latitude":51.54131,"Longitude":0.640454},{"Name":"Leighton Buzzard","CrsCode":"LBZ","Latitude":51.9160461,"Longitude":-0.676874},{"Name":"Leiston (Via Saxmundham)","CrsCode":"LIE","Latitude":52.208992,"Longitude":1.574502},{"Name":"Lelant","CrsCode":"LEL","Latitude":50.1838875,"Longitude":-5.436207},{"Name":"Lelant (Any)","CrsCode":"103","Latitude":null,"Longitude":null},{"Name":"Lelant Saltings","CrsCode":"LTS","Latitude":50.17923,"Longitude":-5.441468},{"Name":"Lenham","CrsCode":"LEN","Latitude":51.2339859,"Longitude":0.707337},{"Name":"Lenzie","CrsCode":"LNZ","Latitude":55.9213638,"Longitude":-4.153932},{"Name":"Leominster","CrsCode":"LEO","Latitude":52.22511,"Longitude":-2.730506},{"Name":"Letchworth Garden City","CrsCode":"LET","Latitude":51.9803047,"Longitude":-0.229403},{"Name":"Leuchars","CrsCode":"LEU","Latitude":56.3754272,"Longitude":-2.893734},{"Name":"Levenshulme","CrsCode":"LVM","Latitude":53.4444046,"Longitude":-2.192676},{"Name":"Lewes","CrsCode":"LWS","Latitude":50.87028,"Longitude":0.012455},{"Name":"Lewisham","CrsCode":"LEW","Latitude":51.4661,"Longitude":-0.014703},{"Name":"Leyland","CrsCode":"LEY","Latitude":53.69886,"Longitude":-2.687101},{"Name":"Leyton (Any)","CrsCode":"104","Latitude":null,"Longitude":null},{"Name":"Leyton Midland Road","CrsCode":"LEM","Latitude":51.5693932,"Longitude":-0.007313},{"Name":"Leytonstone High Road","CrsCode":"LER","Latitude":51.5637245,"Longitude":0.008304},{"Name":"Lichfield (Any)","CrsCode":"105","Latitude":null,"Longitude":null},{"Name":"Lichfield City","CrsCode":"LIC","Latitude":52.6803474,"Longitude":-1.825431},{"Name":"Lichfield Trent Valley","CrsCode":"LTV","Latitude":52.6869,"Longitude":-1.800014},{"Name":"Lidlington","CrsCode":"LID","Latitude":52.0413857,"Longitude":-0.558972},{"Name":"Limehouse","CrsCode":"LHS","Latitude":51.51239,"Longitude":-0.040071},{"Name":"Limerick","CrsCode":"LRK","Latitude":null,"Longitude":null},{"Name":"Limerick Junction","CrsCode":"LJN","Latitude":null,"Longitude":null},{"Name":"Lincoln","CrsCode":"LCN","Latitude":53.22709,"Longitude":-0.540922},{"Name":"Lingfield","CrsCode":"LFD","Latitude":51.17639,"Longitude":-0.007151},{"Name":"Lingwood","CrsCode":"LGD","Latitude":52.6218719,"Longitude":1.489735},{"Name":"Linlithgow","CrsCode":"LIN","Latitude":55.97569,"Longitude":-3.596},{"Name":"Liphook","CrsCode":"LIP","Latitude":51.0712128,"Longitude":-0.801027},{"Name":"Lisburn","CrsCode":"LBN","Latitude":null,"Longitude":null},{"Name":"Liskeard","CrsCode":"LSK","Latitude":50.4467125,"Longitude":-4.46753},{"Name":"Liss","CrsCode":"LIS","Latitude":51.0442543,"Longitude":-0.893023},{"Name":"Lisvane And Thornhill","CrsCode":"LVT","Latitude":51.5443573,"Longitude":-3.185344},{"Name":"Little Kimble","CrsCode":"LTK","Latitude":51.7520142,"Longitude":-0.809152},{"Name":"Little Sutton","CrsCode":"LTT","Latitude":53.2855377,"Longitude":-2.943134},{"Name":"Littleborough","CrsCode":"LTL","Latitude":53.6429863,"Longitude":-2.094698},{"Name":"Littlehampton","CrsCode":"LIT","Latitude":50.8102264,"Longitude":-0.546547},{"Name":"Littlehaven","CrsCode":"LVN","Latitude":51.0795135,"Longitude":-0.308276},{"Name":"Littleport","CrsCode":"LTP","Latitude":52.4626961,"Longitude":0.316905},{"Name":"Liverpool (Any)","CrsCode":"106","Latitude":null,"Longitude":null},{"Name":"Liverpool Airport Bus","CrsCode":"LJL","Latitude":null,"Longitude":null},{"Name":"Liverpool Central","CrsCode":"LVC","Latitude":53.40525,"Longitude":-2.977841},{"Name":"Liverpool James Street","CrsCode":"LVJ","Latitude":53.404747,"Longitude":-2.991993},{"Name":"Liverpool Lime Street","CrsCode":"LIV","Latitude":53.4073,"Longitude":-2.977746},{"Name":"Liverpool South Parkway","CrsCode":"LPY","Latitude":53.3577,"Longitude":-2.8897},{"Name":"Livingston (Any)","CrsCode":"107","Latitude":null,"Longitude":null},{"Name":"Livingston North","CrsCode":"LSN","Latitude":55.9017372,"Longitude":-3.543357},{"Name":"Livingston South","CrsCode":"LVG","Latitude":55.87171,"Longitude":-3.503823},{"Name":"Llanaber","CrsCode":"LLA","Latitude":52.741375,"Longitude":-4.078263},{"Name":"Llanbedr","CrsCode":"LBR","Latitude":52.8208351,"Longitude":-4.110252},{"Name":"Llanbister Road","CrsCode":"LLT","Latitude":52.33623,"Longitude":-3.212283},{"Name":"Llanbradach","CrsCode":"LNB","Latitude":51.60321,"Longitude":-3.233085},{"Name":"Llandaf","CrsCode":"LLN","Latitude":51.5079422,"Longitude":-3.229076},{"Name":"Llandanwg","CrsCode":"LDN","Latitude":52.835865,"Longitude":-4.124342},{"Name":"Llandecwyn","CrsCode":"LLC","Latitude":52.9206657,"Longitude":-4.057092},{"Name":"Llandeilo","CrsCode":"LLL","Latitude":51.8851166,"Longitude":-3.987662},{"Name":"Llandovery","CrsCode":"LLV","Latitude":51.99509,"Longitude":-3.803163},{"Name":"Llandrindod","CrsCode":"LLO","Latitude":52.2426872,"Longitude":-3.37963},{"Name":"Llandudno","CrsCode":"LLD","Latitude":53.32091,"Longitude":-3.827043},{"Name":"Llandudno Junction","CrsCode":"LLJ","Latitude":53.2839546,"Longitude":-3.809102},{"Name":"Llandybie","CrsCode":"LLI","Latitude":51.8201,"Longitude":-4.003658},{"Name":"Llanelli","CrsCode":"LLE","Latitude":51.6734047,"Longitude":-4.162068},{"Name":"Llanfairfechan","CrsCode":"LLF","Latitude":53.25728,"Longitude":-3.983256},{"Name":"Llanfairpwll","CrsCode":"LPG","Latitude":53.22094,"Longitude":-4.209263},{"Name":"Llangadog","CrsCode":"LLG","Latitude":51.94064,"Longitude":-3.892638},{"Name":"Llangammarch","CrsCode":"LLM","Latitude":52.1137238,"Longitude":-3.55528},{"Name":"Llangennech","CrsCode":"LLH","Latitude":51.6910934,"Longitude":-4.078988},{"Name":"Llangynllo","CrsCode":"LGO","Latitude":52.3502274,"Longitude":-3.161273},{"Name":"Llanharan","CrsCode":"LLR","Latitude":51.53759,"Longitude":-3.4408},{"Name":"Llanhilleth","CrsCode":"LTH","Latitude":51.70034,"Longitude":-3.137033},{"Name":"Llanishen","CrsCode":"LLS","Latitude":51.5335922,"Longitude":-3.182181},{"Name":"Llanrwst","CrsCode":"LWR","Latitude":53.14401,"Longitude":-3.802844},{"Name":"Llansamlet","CrsCode":"LAS","Latitude":51.6609726,"Longitude":-3.892526},{"Name":"Llantwit Major","CrsCode":"LWM","Latitude":51.40623,"Longitude":-3.47503},{"Name":"Llanwrda","CrsCode":"LNR","Latitude":51.96255,"Longitude":-3.871719},{"Name":"Llanwrtyd","CrsCode":"LNW","Latitude":52.1045837,"Longitude":-3.632354},{"Name":"Llwyngwril","CrsCode":"LLW","Latitude":52.66658,"Longitude":-4.088024},{"Name":"Llwynypia","CrsCode":"LLY","Latitude":51.6339569,"Longitude":-3.453557},{"Name":"Loch Awe","CrsCode":"LHA","Latitude":56.40248,"Longitude":-5.040117},{"Name":"Loch Eil Outward Bound","CrsCode":"LHE","Latitude":56.8553429,"Longitude":-5.191638},{"Name":"Lochailort","CrsCode":"LCL","Latitude":56.8810349,"Longitude":-5.663456},{"Name":"Locheilside","CrsCode":"LCS","Latitude":56.8554726,"Longitude":-5.290086},{"Name":"Lochgelly","CrsCode":"LCG","Latitude":56.13538,"Longitude":-3.312958},{"Name":"Lochluichart","CrsCode":"LCC","Latitude":57.6212769,"Longitude":-4.809628},{"Name":"Lochwinnoch","CrsCode":"LHW","Latitude":55.78655,"Longitude":-4.617038},{"Name":"Lockerbie","CrsCode":"LOC","Latitude":55.123085,"Longitude":-3.353242},{"Name":"Lockwood","CrsCode":"LCK","Latitude":53.63585,"Longitude":-1.800335},{"Name":"London (Any)","CrsCode":"182","Latitude":null,"Longitude":null},{"Name":"London Blackfriars","CrsCode":"BFR","Latitude":51.5107346,"Longitude":-0.103554},{"Name":"London Bridge","CrsCode":"LBG","Latitude":51.5050354,"Longitude":-0.085058},{"Name":"London Cannon Street","CrsCode":"CST","Latitude":51.5105247,"Longitude":-0.090589},{"Name":"London Charing Cross","CrsCode":"CHX","Latitude":51.50836,"Longitude":-0.123835},{"Name":"London Euston","CrsCode":"EUS","Latitude":51.5283127,"Longitude":-0.134545},{"Name":"London Fenchurch Street","CrsCode":"FST","Latitude":51.5112343,"Longitude":-0.079039},{"Name":"London Fields","CrsCode":"LOF","Latitude":51.5414543,"Longitude":-0.057574},{"Name":"London Kings Cross","CrsCode":"KGX","Latitude":51.5308266,"Longitude":-0.122907},{"Name":"London Liverpool Street","CrsCode":"LST","Latitude":51.51755,"Longitude":-0.08021},{"Name":"London Marylebone","CrsCode":"MYB","Latitude":51.52248,"Longitude":-0.163605},{"Name":"London Paddington","CrsCode":"PAD","Latitude":51.5160141,"Longitude":-0.176049},{"Name":"London Road (Brighton)","CrsCode":"LRB","Latitude":50.8367729,"Longitude":-0.136696},{"Name":"London Road (Guildford)","CrsCode":"LRD","Latitude":51.24067,"Longitude":-0.56506},{"Name":"London St Pancras International","CrsCode":"STP","Latitude":51.5299759,"Longitude":-0.125823},{"Name":"London Underground Zone 1","CrsCode":"338","Latitude":null,"Longitude":null},{"Name":"London Underground Zone 1-2","CrsCode":"414","Latitude":null,"Longitude":null},{"Name":"London Underground Zone 1-3","CrsCode":"422","Latitude":null,"Longitude":null},{"Name":"London Underground Zone 1-4","CrsCode":"423","Latitude":null,"Longitude":null},{"Name":"London Underground Zone 1-5","CrsCode":"424","Latitude":null,"Longitude":null},{"Name":"London Underground Zone 1-6","CrsCode":"425","Latitude":null,"Longitude":null},{"Name":"London Victoria","CrsCode":"VIC","Latitude":51.4966,"Longitude":-0.1448},{"Name":"London Waterloo","CrsCode":"WAT","Latitude":51.5018654,"Longitude":-0.111126},{"Name":"London Waterloo East","CrsCode":"WAE","Latitude":51.5045128,"Longitude":-0.10814},{"Name":"Londonderry","CrsCode":"LDR","Latitude":null,"Longitude":null},{"Name":"Long Buckby","CrsCode":"LBK","Latitude":52.2939644,"Longitude":-1.086469},{"Name":"Long Eaton","CrsCode":"LGE","Latitude":52.8851051,"Longitude":-1.288114},{"Name":"Long Preston","CrsCode":"LPR","Latitude":54.0171165,"Longitude":-2.254533},{"Name":"Longbeck","CrsCode":"LGK","Latitude":54.5928955,"Longitude":-1.028041},{"Name":"Longbridge","CrsCode":"LOB","Latitude":52.3963852,"Longitude":-1.980861},{"Name":"Longcross","CrsCode":"LNG","Latitude":51.3845558,"Longitude":-0.594536},{"Name":"Longfield","CrsCode":"LGF","Latitude":51.3964958,"Longitude":0.299994},{"Name":"Longford","CrsCode":"LFO","Latitude":null,"Longitude":null},{"Name":"Longniddry","CrsCode":"LND","Latitude":55.9765244,"Longitude":-2.889308},{"Name":"Longport","CrsCode":"LPT","Latitude":53.0416565,"Longitude":-2.21623},{"Name":"Longton","CrsCode":"LGN","Latitude":52.9900131,"Longitude":-2.137216},{"Name":"Looe","CrsCode":"LOO","Latitude":50.3592339,"Longitude":-4.456029},{"Name":"Lostock","CrsCode":"LOT","Latitude":53.5729675,"Longitude":-2.494276},{"Name":"Lostock Gralam","CrsCode":"LTG","Latitude":53.2676773,"Longitude":-2.465197},{"Name":"Lostock Hall","CrsCode":"LOH","Latitude":53.7243156,"Longitude":-2.687069},{"Name":"Lostwithiel","CrsCode":"LOS","Latitude":50.40744,"Longitude":-4.665497},{"Name":"Louborough University Bus","CrsCode":"XLO","Latitude":null,"Longitude":null},{"Name":"Loughborough","CrsCode":"LBO","Latitude":52.7793274,"Longitude":-1.194952},{"Name":"Loughborough Junction","CrsCode":"LGJ","Latitude":51.46666,"Longitude":-0.102499},{"Name":"Low Moor","CrsCode":"LMR","Latitude":53.74924,"Longitude":1.750517},{"Name":"Lowdham","CrsCode":"LOW","Latitude":53.0070724,"Longitude":-0.998465},{"Name":"Lower Sydenham","CrsCode":"LSY","Latitude":51.4250565,"Longitude":-0.033746},{"Name":"Lowestoft","CrsCode":"LWT","Latitude":52.4736176,"Longitude":1.749009},{"Name":"Ludlow","CrsCode":"LUD","Latitude":52.3708534,"Longitude":-2.715275},{"Name":"Luton","CrsCode":"LUT","Latitude":51.8822327,"Longitude":-0.414881},{"Name":"Luton Airport","CrsCode":"LUA","Latitude":51.8809166,"Longitude":-0.413341},{"Name":"Luton Airport Parkway","CrsCode":"LTN","Latitude":51.87116,"Longitude":-0.393485},{"Name":"Luxulyan","CrsCode":"LUX","Latitude":50.3902435,"Longitude":-4.747551},{"Name":"Lydney","CrsCode":"LYD","Latitude":51.7145844,"Longitude":-2.531189},{"Name":"Lye (West Midlands)","CrsCode":"LYE","Latitude":52.4592667,"Longitude":-2.116233},{"Name":"Lymington (Any)","CrsCode":"109","Latitude":null,"Longitude":null},{"Name":"Lymington Pier","CrsCode":"LYP","Latitude":50.7580833,"Longitude":-1.529275},{"Name":"Lymington Town","CrsCode":"LYT","Latitude":50.76082,"Longitude":-1.537753},{"Name":"Lympstone (Any)","CrsCode":"110","Latitude":null,"Longitude":null},{"Name":"Lympstone Commando","CrsCode":"LYC","Latitude":50.66112,"Longitude":-3.438876},{"Name":"Lympstone Village","CrsCode":"LYM","Latitude":50.64862,"Longitude":-3.431419},{"Name":"Lytham","CrsCode":"LTM","Latitude":53.7391,"Longitude":-2.964206},{"Name":"Macclesfield","CrsCode":"MAC","Latitude":53.25933,"Longitude":-2.121397},{"Name":"Machynlleth","CrsCode":"MCN","Latitude":52.5958443,"Longitude":-3.854311},{"Name":"Maesteg","CrsCode":"MST","Latitude":51.6106071,"Longitude":-3.655003},{"Name":"Maesteg (Any)","CrsCode":"111","Latitude":null,"Longitude":null},{"Name":"Maesteg (Ewenny Road)","CrsCode":"MEW","Latitude":51.6052971,"Longitude":-3.649038},{"Name":"Maghull","CrsCode":"MAG","Latitude":53.5064621,"Longitude":-2.930828},{"Name":"Maghull North","CrsCode":"MNS","Latitude":53.516,"Longitude":-2.922},{"Name":"Maiden Newton","CrsCode":"MDN","Latitude":50.78013,"Longitude":-2.568749},{"Name":"Maidenhead","CrsCode":"MAI","Latitude":51.5186,"Longitude":-0.722464},{"Name":"Maidstone (Any)","CrsCode":"112","Latitude":null,"Longitude":null},{"Name":"Maidstone Barracks","CrsCode":"MDB","Latitude":51.2760925,"Longitude":0.513368},{"Name":"Maidstone East","CrsCode":"MDE","Latitude":51.27773,"Longitude":0.520618},{"Name":"Maidstone West","CrsCode":"MDW","Latitude":51.26974,"Longitude":0.515889},{"Name":"Malden Manor","CrsCode":"MAL","Latitude":51.38458,"Longitude":-0.261118},{"Name":"Mallaig","CrsCode":"MLG","Latitude":57.005497,"Longitude":-5.8306},{"Name":"Malling (Any)","CrsCode":"113","Latitude":null,"Longitude":null},{"Name":"Mallow","CrsCode":"MAW","Latitude":null,"Longitude":null},{"Name":"Malton","CrsCode":"MLT","Latitude":54.13155,"Longitude":-0.798593},{"Name":"Malvern (Any)","CrsCode":"114","Latitude":null,"Longitude":null},{"Name":"Malvern Link","CrsCode":"MVL","Latitude":52.12534,"Longitude":-2.31987},{"Name":"Manchester (Any)","CrsCode":"115","Latitude":null,"Longitude":null},{"Name":"Manchester Airport","CrsCode":"MIA","Latitude":53.36157,"Longitude":-2.268941},{"Name":"Manchester Central Zone","CrsCode":"MCZ","Latitude":null,"Longitude":null},{"Name":"Manchester Oxford Road","CrsCode":"MCO","Latitude":53.47398,"Longitude":-2.242531},{"Name":"Manchester Piccadilly","CrsCode":"MAN","Latitude":53.4767036,"Longitude":-2.228991},{"Name":"Manchester United Football Ground","CrsCode":"MUF","Latitude":53.4630547,"Longitude":-2.291389},{"Name":"Manchester Victoria","CrsCode":"MCV","Latitude":53.4874649,"Longitude":-2.242607},{"Name":"Manea","CrsCode":"MNE","Latitude":52.4976921,"Longitude":0.178779},{"Name":"Manningtree","CrsCode":"MNG","Latitude":51.94882,"Longitude":1.045653},{"Name":"Manor Park","CrsCode":"MNP","Latitude":51.5522957,"Longitude":0.045309},{"Name":"Manor Road","CrsCode":"MNR","Latitude":53.39477,"Longitude":-3.171468},{"Name":"Manorbier","CrsCode":"MRB","Latitude":51.6601143,"Longitude":-4.7919},{"Name":"Manors","CrsCode":"MAS","Latitude":54.9727,"Longitude":-1.606296},{"Name":"Mansfield","CrsCode":"MFT","Latitude":53.14223,"Longitude":-1.198192},{"Name":"Mansfield (Any)","CrsCode":"116","Latitude":null,"Longitude":null},{"Name":"Mansfield Woodhouse","CrsCode":"MSW","Latitude":53.1636,"Longitude":-1.201651},{"Name":"Manulla Junction","CrsCode":"MAJ","Latitude":null,"Longitude":null},{"Name":"March","CrsCode":"MCH","Latitude":52.5604324,"Longitude":0.090409},{"Name":"Marden (Kent)","CrsCode":"MRN","Latitude":51.1757851,"Longitude":0.49359},{"Name":"Margate","CrsCode":"MAR","Latitude":51.3849258,"Longitude":1.371737},{"Name":"Market Harborough","CrsCode":"MHR","Latitude":52.4803658,"Longitude":-0.908868},{"Name":"Market Rasen","CrsCode":"MKR","Latitude":53.38444,"Longitude":-0.337075},{"Name":"Markinch","CrsCode":"MNC","Latitude":56.20007,"Longitude":-3.131414},{"Name":"Marks Tey","CrsCode":"MKT","Latitude":51.8806953,"Longitude":0.782372},{"Name":"Marlow","CrsCode":"MLW","Latitude":51.5709953,"Longitude":-0.766452},{"Name":"Marple","CrsCode":"MPL","Latitude":53.4007645,"Longitude":-2.057168},{"Name":"Marsden (Yorks)","CrsCode":"MSN","Latitude":53.6027374,"Longitude":-1.93197},{"Name":"Marske","CrsCode":"MSK","Latitude":54.5874329,"Longitude":-1.018892},{"Name":"Marston Green","CrsCode":"MGN","Latitude":52.46716,"Longitude":-1.755616},{"Name":"Martin Mill","CrsCode":"MTM","Latitude":51.1705933,"Longitude":1.348907},{"Name":"Martins Heron","CrsCode":"MAO","Latitude":51.40669,"Longitude":-0.720386},{"Name":"Marton","CrsCode":"MTO","Latitude":54.543808,"Longitude":-1.197708},{"Name":"Maryhill","CrsCode":"MYH","Latitude":55.8980255,"Longitude":-4.301396},{"Name":"Maryland","CrsCode":"MYL","Latitude":51.545784,"Longitude":0.006075},{"Name":"Maryport","CrsCode":"MRY","Latitude":54.7115974,"Longitude":-3.494738},{"Name":"Matlock","CrsCode":"MAT","Latitude":53.1381264,"Longitude":-1.558988},{"Name":"Matlock Bath","CrsCode":"MTB","Latitude":53.12194,"Longitude":-1.55766},{"Name":"Mauldeth Road","CrsCode":"MAU","Latitude":53.4329834,"Longitude":-2.209325},{"Name":"Maxwell Park","CrsCode":"MAX","Latitude":55.8371239,"Longitude":-4.289813},{"Name":"Maybole","CrsCode":"MAY","Latitude":55.3544846,"Longitude":-4.686269},{"Name":"Maze Hill","CrsCode":"MZH","Latitude":51.4828835,"Longitude":0.003311},{"Name":"Meadowhall","CrsCode":"MHS","Latitude":53.4170456,"Longitude":-1.411669},{"Name":"Meldreth","CrsCode":"MEL","Latitude":52.0906868,"Longitude":0.00853},{"Name":"Melksham","CrsCode":"MKM","Latitude":51.3798027,"Longitude":-2.14449},{"Name":"Melrose","CrsCode":"MLS","Latitude":55.59753,"Longitude":-2.715786},{"Name":"Melton (Suffolk)","CrsCode":"MES","Latitude":52.1036835,"Longitude":1.338085},{"Name":"Melton Mowbray","CrsCode":"MMO","Latitude":52.760643,"Longitude":-0.885564},{"Name":"Menheniot","CrsCode":"MEN","Latitude":50.42618,"Longitude":-4.40938},{"Name":"Menston","CrsCode":"MNN","Latitude":53.8918953,"Longitude":-1.735205},{"Name":"Meols","CrsCode":"MEO","Latitude":53.3993568,"Longitude":-3.15431},{"Name":"Meols Cop","CrsCode":"MEC","Latitude":53.64552,"Longitude":-2.975696},{"Name":"Meopham","CrsCode":"MEP","Latitude":51.3863678,"Longitude":0.356977},{"Name":"Meridian Water","CrsCode":"MRW","Latitude":null,"Longitude":null},{"Name":"Merryton","CrsCode":"MEY","Latitude":55.749012,"Longitude":-3.978667},{"Name":"Merstham","CrsCode":"MHM","Latitude":51.264164,"Longitude":-0.149555},{"Name":"Merthyr Tydfil","CrsCode":"MER","Latitude":51.7454758,"Longitude":-3.377458},{"Name":"Merthyr Vale","CrsCode":"MEV","Latitude":51.6866074,"Longitude":-3.336622},{"Name":"Metheringham","CrsCode":"MGM","Latitude":53.1388664,"Longitude":-0.391421},{"Name":"Metrocentre","CrsCode":"MCE","Latitude":54.9584923,"Longitude":-1.662656},{"Name":"Mexborough","CrsCode":"MEX","Latitude":53.4909859,"Longitude":-1.28855},{"Name":"Micheldever","CrsCode":"MIC","Latitude":51.1820335,"Longitude":-1.260283},{"Name":"Micklefield","CrsCode":"MIK","Latitude":53.7887154,"Longitude":-1.324507},{"Name":"Middlesbrough","CrsCode":"MBR","Latitude":54.5790863,"Longitude":-1.232596},{"Name":"Middlewood","CrsCode":"MDL","Latitude":53.3591423,"Longitude":-2.084111},{"Name":"Midgham","CrsCode":"MDG","Latitude":51.3958054,"Longitude":-1.177683},{"Name":"Milford (Surrey)","CrsCode":"MLF","Latitude":51.16385,"Longitude":-0.63701},{"Name":"Milford Haven","CrsCode":"MFH","Latitude":51.7159767,"Longitude":-5.041485},{"Name":"Mill Hill (Lancs)","CrsCode":"MLH","Latitude":53.73543,"Longitude":-2.501433},{"Name":"Mill Hill Broadway","CrsCode":"MIL","Latitude":51.6128235,"Longitude":-0.249522},{"Name":"Millbrook (Bedfordshire)","CrsCode":"MLB","Latitude":52.05382,"Longitude":-0.532724},{"Name":"Millbrook (Hants)","CrsCode":"MBK","Latitude":50.9114342,"Longitude":-1.433848},{"Name":"Milliken Park","CrsCode":"MIN","Latitude":55.8251572,"Longitude":-4.533405},{"Name":"Millom","CrsCode":"MLM","Latitude":54.21083,"Longitude":-3.271108},{"Name":"Mills Hill (Manchester)","CrsCode":"MIH","Latitude":53.55139,"Longitude":-2.171484},{"Name":"Millstreet (Irish Rail)","CrsCode":"MIE","Latitude":null,"Longitude":null},{"Name":"Milngavie","CrsCode":"MLN","Latitude":55.94091,"Longitude":-4.315152},{"Name":"Milton Keynes Central","CrsCode":"MKC","Latitude":52.0343552,"Longitude":-0.77341},{"Name":"Minehead Bus","CrsCode":"XBW","Latitude":null,"Longitude":null},{"Name":"Minffordd","CrsCode":"MFF","Latitude":52.9264641,"Longitude":-4.085625},{"Name":"Minster","CrsCode":"MSR","Latitude":51.3298073,"Longitude":1.317431},{"Name":"Mira Technology Park","CrsCode":"MTE","Latitude":null,"Longitude":null},{"Name":"Mirfield","CrsCode":"MIR","Latitude":53.6715775,"Longitude":-1.692696},{"Name":"Mistley","CrsCode":"MIS","Latitude":51.9434166,"Longitude":1.080205},{"Name":"Mitcham Eastfields","CrsCode":"MTC","Latitude":51.4077263,"Longitude":-0.154764},{"Name":"Mitcham Junction","CrsCode":"MIJ","Latitude":51.3928871,"Longitude":-0.157308},{"Name":"Mobberley","CrsCode":"MOB","Latitude":53.32994,"Longitude":-2.333309},{"Name":"Monifieth","CrsCode":"MON","Latitude":56.4801674,"Longitude":-2.818249},{"Name":"Monks Risborough","CrsCode":"MRS","Latitude":51.7351341,"Longitude":-0.829882},{"Name":"Montpelier","CrsCode":"MTP","Latitude":51.4682045,"Longitude":-2.588525},{"Name":"Montrose","CrsCode":"MTS","Latitude":56.71286,"Longitude":-2.47207},{"Name":"Moorfields","CrsCode":"MRF","Latitude":53.408535,"Longitude":-2.989182},{"Name":"Moorgate","CrsCode":"MOG","Latitude":51.5186,"Longitude":-0.09027},{"Name":"Moorside","CrsCode":"MSD","Latitude":53.5163536,"Longitude":-2.35146},{"Name":"Moorthorpe","CrsCode":"MRP","Latitude":53.59445,"Longitude":-1.304952},{"Name":"Morar","CrsCode":"MRR","Latitude":56.9697876,"Longitude":-5.821991},{"Name":"Morchard Road","CrsCode":"MRD","Latitude":50.83184,"Longitude":-3.776424},{"Name":"Morden South","CrsCode":"MDS","Latitude":51.3962479,"Longitude":-0.200299},{"Name":"Morecambe","CrsCode":"MCM","Latitude":54.07032,"Longitude":-2.869379},{"Name":"Moreton (Dorset)","CrsCode":"MTN","Latitude":50.7010574,"Longitude":-2.312914},{"Name":"Moreton (Merseyside)","CrsCode":"MRT","Latitude":53.407917,"Longitude":-3.113156},{"Name":"Moreton-In-Marsh","CrsCode":"MIM","Latitude":51.9923363,"Longitude":-1.7014},{"Name":"Morfa Mawddach","CrsCode":"MFA","Latitude":52.7071,"Longitude":-4.032224},{"Name":"Morley","CrsCode":"MLY","Latitude":53.75037,"Longitude":-1.592033},{"Name":"Morpeth","CrsCode":"MPT","Latitude":55.1625366,"Longitude":-1.682903},{"Name":"Mortimer","CrsCode":"MOR","Latitude":51.37194,"Longitude":-1.035979},{"Name":"Mortlake","CrsCode":"MTL","Latitude":51.46829,"Longitude":-0.266575},{"Name":"Moses Gate","CrsCode":"MSS","Latitude":53.55604,"Longitude":-2.400931},{"Name":"Moss Side","CrsCode":"MOS","Latitude":53.76443,"Longitude":-2.943548},{"Name":"Mossley (Manchester)","CrsCode":"MSL","Latitude":53.51496,"Longitude":-2.041263},{"Name":"Mossley Hill","CrsCode":"MSH","Latitude":53.3790245,"Longitude":-2.915464},{"Name":"Mosspark","CrsCode":"MPK","Latitude":55.8389473,"Longitude":-4.336232},{"Name":"Moston","CrsCode":"MSO","Latitude":53.52264,"Longitude":-2.171925},{"Name":"Motherwell","CrsCode":"MTH","Latitude":55.7919273,"Longitude":-3.995234},{"Name":"Motspur Park","CrsCode":"MOT","Latitude":51.3950424,"Longitude":-0.23916},{"Name":"Mottingham","CrsCode":"MTG","Latitude":51.4398041,"Longitude":0.050353},{"Name":"Mottisfont And Dunbridge","CrsCode":"DBG","Latitude":51.0339851,"Longitude":-1.546942},{"Name":"Mouldsworth","CrsCode":"MLD","Latitude":53.2319756,"Longitude":-2.732546},{"Name":"Moulsecoomb","CrsCode":"MCB","Latitude":50.8446159,"Longitude":-0.12076},{"Name":"Mount Florida","CrsCode":"MFL","Latitude":55.82686,"Longitude":-4.262067},{"Name":"Mount Vernon","CrsCode":"MTV","Latitude":55.83988,"Longitude":-4.136638},{"Name":"Mountain Ash","CrsCode":"MTA","Latitude":51.6834221,"Longitude":-3.378478},{"Name":"Muine Bheag (Irish Rail)","CrsCode":"MBH","Latitude":52.6990967,"Longitude":-6.952521},{"Name":"Muir Of Ord","CrsCode":"MOO","Latitude":57.5180168,"Longitude":-4.460981},{"Name":"Muirend","CrsCode":"MUI","Latitude":55.81046,"Longitude":-4.273888},{"Name":"Mullingar","CrsCode":"MUL","Latitude":null,"Longitude":null},{"Name":"Musselburgh","CrsCode":"MUB","Latitude":55.9302254,"Longitude":-3.062719},{"Name":"Mytholmroyd","CrsCode":"MYT","Latitude":53.729496,"Longitude":-1.981773},{"Name":"Nafferton","CrsCode":"NFN","Latitude":54.0116844,"Longitude":-0.386948},{"Name":"Nailsea And Backwell","CrsCode":"NLS","Latitude":51.4193573,"Longitude":-2.750661},{"Name":"Nairn","CrsCode":"NRN","Latitude":57.5802269,"Longitude":-3.873024},{"Name":"Nantwich","CrsCode":"NAN","Latitude":53.0635338,"Longitude":-2.518868},{"Name":"Narberth","CrsCode":"NAR","Latitude":51.8001556,"Longitude":-4.726567},{"Name":"Narborough","CrsCode":"NBR","Latitude":52.5717125,"Longitude":-1.20318},{"Name":"Navigation Road","CrsCode":"NVR","Latitude":53.3954124,"Longitude":-2.3435},{"Name":"Neath","CrsCode":"NTH","Latitude":51.6623154,"Longitude":-3.807267},{"Name":"Needham Market","CrsCode":"NMT","Latitude":52.1564369,"Longitude":1.051047},{"Name":"Neilston","CrsCode":"NEI","Latitude":55.7823639,"Longitude":-4.426945},{"Name":"Nelson","CrsCode":"NEL","Latitude":53.83447,"Longitude":-2.214223},{"Name":"Nenagh","CrsCode":"NEN","Latitude":null,"Longitude":null},{"Name":"Neston","CrsCode":"NES","Latitude":53.29242,"Longitude":-3.063769},{"Name":"Netherfield","CrsCode":"NET","Latitude":52.96097,"Longitude":-1.078427},{"Name":"Nethertown","CrsCode":"NRT","Latitude":54.4567,"Longitude":-3.566201},{"Name":"Netley","CrsCode":"NTL","Latitude":50.8749771,"Longitude":-1.341913},{"Name":"New Barnet","CrsCode":"NBA","Latitude":51.64852,"Longitude":-0.172972},{"Name":"New Beckenham","CrsCode":"NBC","Latitude":51.41699,"Longitude":-0.035525},{"Name":"New Brighton","CrsCode":"NBN","Latitude":53.43726,"Longitude":-3.049191},{"Name":"New Clee","CrsCode":"NCE","Latitude":53.5744553,"Longitude":-0.060771},{"Name":"New Cross","CrsCode":"NWX","Latitude":51.4763,"Longitude":-0.032984},{"Name":"New Cross (Any)","CrsCode":"120","Latitude":null,"Longitude":null},{"Name":"New Cross Gate","CrsCode":"NXG","Latitude":51.475544,"Longitude":-0.041655},{"Name":"New Cumnock","CrsCode":"NCK","Latitude":55.40227,"Longitude":-4.182457},{"Name":"New Eltham","CrsCode":"NEH","Latitude":51.43765,"Longitude":0.0704},{"Name":"New Holland","CrsCode":"NHL","Latitude":53.7021065,"Longitude":-0.360936},{"Name":"New Hythe","CrsCode":"NHE","Latitude":51.3124,"Longitude":0.455075},{"Name":"New Lane","CrsCode":"NLN","Latitude":53.6112976,"Longitude":-2.86758},{"Name":"New Malden","CrsCode":"NEM","Latitude":51.4033928,"Longitude":-0.256084},{"Name":"New Mills (Any)","CrsCode":"122","Latitude":null,"Longitude":null},{"Name":"New Mills Central","CrsCode":"NMC","Latitude":53.3645668,"Longitude":-2.007485},{"Name":"New Mills Newtown","CrsCode":"NMN","Latitude":53.35917,"Longitude":-2.00898},{"Name":"New Milton","CrsCode":"NWM","Latitude":50.7558365,"Longitude":-1.658313},{"Name":"New Pudsey","CrsCode":"NPD","Latitude":53.8045731,"Longitude":-1.679581},{"Name":"New Southgate","CrsCode":"NSG","Latitude":51.6138763,"Longitude":-0.142586},{"Name":"Newark (Any)","CrsCode":"118","Latitude":null,"Longitude":null},{"Name":"Newark Castle","CrsCode":"NCT","Latitude":53.0799866,"Longitude":-0.813151},{"Name":"Newark North Gate","CrsCode":"NNG","Latitude":53.0825424,"Longitude":-0.799644},{"Name":"Newbridge","CrsCode":"NBE","Latitude":51.6656876,"Longitude":-3.142116},{"Name":"Newbury","CrsCode":"NBY","Latitude":51.3976,"Longitude":-1.322608},{"Name":"Newbury (Any)","CrsCode":"119","Latitude":null,"Longitude":null},{"Name":"Newbury Racecourse","CrsCode":"NRC","Latitude":51.39814,"Longitude":-1.308549},{"Name":"Newcastle","CrsCode":"NCL","Latitude":54.9682426,"Longitude":-1.617264},{"Name":"Newcastle Airport","CrsCode":"APN","Latitude":55.03588,"Longitude":-1.71209},{"Name":"Newcourt","CrsCode":"NCO","Latitude":50.7026558,"Longitude":-3.472551},{"Name":"Newcraighall","CrsCode":"NEW","Latitude":55.9326172,"Longitude":-3.091582},{"Name":"Newhaven (Any)","CrsCode":"121","Latitude":null,"Longitude":null},{"Name":"Newhaven Harbour","CrsCode":"NVH","Latitude":50.7903976,"Longitude":0.054433},{"Name":"Newhaven Town","CrsCode":"NVN","Latitude":50.7948875,"Longitude":0.054627},{"Name":"Newington","CrsCode":"NGT","Latitude":51.3537331,"Longitude":0.66269},{"Name":"Newmarket","CrsCode":"NMK","Latitude":52.2379036,"Longitude":0.406249},{"Name":"Newport (Essex)","CrsCode":"NWE","Latitude":51.97995,"Longitude":0.216176},{"Name":"Newport (South Wales)","CrsCode":"NWP","Latitude":51.5901451,"Longitude":-2.998873},{"Name":"Newquay","CrsCode":"NQY","Latitude":50.4152451,"Longitude":-5.075769},{"Name":"Newry","CrsCode":"NWY","Latitude":null,"Longitude":null},{"Name":"Newstead","CrsCode":"NSD","Latitude":53.06996,"Longitude":-1.222036},{"Name":"Newton (Lanark)","CrsCode":"NTN","Latitude":55.8192558,"Longitude":-4.133907},{"Name":"Newton Abbot","CrsCode":"NTA","Latitude":50.5295067,"Longitude":-3.599957},{"Name":"Newton Aycliffe","CrsCode":"NAY","Latitude":54.61317,"Longitude":-1.5881},{"Name":"Newton For Hyde","CrsCode":"NWN","Latitude":53.45623,"Longitude":-2.067735},{"Name":"Newton St Cyres","CrsCode":"NTC","Latitude":50.77879,"Longitude":-3.588594},{"Name":"Newton-Le-Willows","CrsCode":"NLW","Latitude":53.4528732,"Longitude":-2.614369},{"Name":"Newton-On-Ayr","CrsCode":"NOA","Latitude":55.47354,"Longitude":-4.62632},{"Name":"Newtongrange","CrsCode":"NEG","Latitude":55.86565,"Longitude":-3.066151},{"Name":"Newtonmore","CrsCode":"NWR","Latitude":57.0596733,"Longitude":-4.118831},{"Name":"Newtown (Powys)","CrsCode":"NWT","Latitude":52.51229,"Longitude":-3.311432},{"Name":"Ninian Park","CrsCode":"NNP","Latitude":51.47586,"Longitude":-3.200846},{"Name":"Nitshill","CrsCode":"NIT","Latitude":55.81153,"Longitude":-4.360126},{"Name":"Norbiton","CrsCode":"NBT","Latitude":51.4119072,"Longitude":-0.284525},{"Name":"Norbury","CrsCode":"NRB","Latitude":51.4112358,"Longitude":-0.123492},{"Name":"Normans Bay","CrsCode":"NSB","Latitude":50.8253822,"Longitude":0.389669},{"Name":"Normanton","CrsCode":"NOR","Latitude":53.70025,"Longitude":-1.424378},{"Name":"North Berwick","CrsCode":"NBW","Latitude":56.0575447,"Longitude":-2.728989},{"Name":"North Camp","CrsCode":"NCM","Latitude":51.2755165,"Longitude":-0.731195},{"Name":"North Dulwich","CrsCode":"NDL","Latitude":51.4547119,"Longitude":-0.087163},{"Name":"North Fambridge","CrsCode":"NFA","Latitude":51.64859,"Longitude":0.681703},{"Name":"North Llanrwst","CrsCode":"NLR","Latitude":53.14135,"Longitude":-3.792723},{"Name":"North Queensferry","CrsCode":"NQU","Latitude":56.01317,"Longitude":-3.395426},{"Name":"North Road (Darlington)","CrsCode":"NRD","Latitude":54.5366669,"Longitude":-1.554856},{"Name":"North Sheen","CrsCode":"NSH","Latitude":51.4649773,"Longitude":-0.285423},{"Name":"North Walsham","CrsCode":"NWA","Latitude":52.8173828,"Longitude":1.385142},{"Name":"North Wembley","CrsCode":"NWB","Latitude":51.562355,"Longitude":-0.303394},{"Name":"Northallerton","CrsCode":"NTR","Latitude":54.3330841,"Longitude":-1.441718},{"Name":"Northampton","CrsCode":"NMP","Latitude":52.2374344,"Longitude":-0.906689},{"Name":"Northfield","CrsCode":"NFD","Latitude":52.4080734,"Longitude":-1.96469},{"Name":"Northfleet","CrsCode":"NFL","Latitude":51.4463844,"Longitude":0.324092},{"Name":"Northolt Park","CrsCode":"NLT","Latitude":51.5577621,"Longitude":-0.359827},{"Name":"Northumberland Park","CrsCode":"NUM","Latitude":51.6016426,"Longitude":-0.053558},{"Name":"Northwich","CrsCode":"NWI","Latitude":53.2614136,"Longitude":-2.496815},{"Name":"Norwich","CrsCode":"NRW","Latitude":52.62712,"Longitude":1.306879},{"Name":"Norwood (Any)","CrsCode":"123","Latitude":null,"Longitude":null},{"Name":"Norwood Junction","CrsCode":"NWD","Latitude":51.396965,"Longitude":-0.075201},{"Name":"Nottingham","CrsCode":"NOT","Latitude":52.9469032,"Longitude":-1.146441},{"Name":"Nuneaton","CrsCode":"NUN","Latitude":52.5264359,"Longitude":-1.463431},{"Name":"Nunhead","CrsCode":"NHD","Latitude":51.4667473,"Longitude":-0.053546},{"Name":"Nunthorpe","CrsCode":"NNT","Latitude":54.528347,"Longitude":-1.170195},{"Name":"Nutbourne","CrsCode":"NUT","Latitude":50.8463135,"Longitude":-0.883508},{"Name":"Nutfield","CrsCode":"NUF","Latitude":51.22702,"Longitude":-0.132425},{"Name":"Oakengates","CrsCode":"OKN","Latitude":52.6931038,"Longitude":-2.451245},{"Name":"Oakham","CrsCode":"OKM","Latitude":52.6719131,"Longitude":-0.734019},{"Name":"Oakleigh Park","CrsCode":"OKL","Latitude":51.6376266,"Longitude":-0.166189},{"Name":"Oban","CrsCode":"OBN","Latitude":56.41176,"Longitude":-5.473841},{"Name":"Ockendon","CrsCode":"OCK","Latitude":51.5216866,"Longitude":0.290439},{"Name":"Ockley","CrsCode":"OLY","Latitude":51.1509552,"Longitude":-0.335692},{"Name":"Okehampton","CrsCode":"OKE","Latitude":50.731678,"Longitude":-3.988267},{"Name":"Old Hill","CrsCode":"OHL","Latitude":52.470993,"Longitude":-2.055913},{"Name":"Old Roan","CrsCode":"ORN","Latitude":53.48687,"Longitude":-2.951095},{"Name":"Old Street","CrsCode":"OLD","Latitude":51.5257759,"Longitude":-0.088515},{"Name":"Oldfield Park","CrsCode":"OLF","Latitude":51.37978,"Longitude":-2.380742},{"Name":"Olton","CrsCode":"OLT","Latitude":52.43848,"Longitude":-1.804313},{"Name":"Ore","CrsCode":"ORE","Latitude":50.86696,"Longitude":0.590783},{"Name":"Ormskirk","CrsCode":"OMS","Latitude":53.5690155,"Longitude":-2.881615},{"Name":"Orpington","CrsCode":"ORP","Latitude":51.3734627,"Longitude":0.089049},{"Name":"Orrell","CrsCode":"ORR","Latitude":53.53055,"Longitude":-2.709028},{"Name":"Orrell Park","CrsCode":"OPK","Latitude":53.46199,"Longitude":-2.962908},{"Name":"Otford","CrsCode":"OTF","Latitude":51.31214,"Longitude":0.196757},{"Name":"Oulton Broad (Any)","CrsCode":"125","Latitude":null,"Longitude":null},{"Name":"Oulton Broad North","CrsCode":"OUN","Latitude":52.4782257,"Longitude":1.716998},{"Name":"Oulton Broad South","CrsCode":"OUS","Latitude":52.46953,"Longitude":1.707425},{"Name":"Oundle Pb Bus","CrsCode":"OUD","Latitude":null,"Longitude":null},{"Name":"Outwood","CrsCode":"OUT","Latitude":53.7141151,"Longitude":-1.512068},{"Name":"Overpool","CrsCode":"OVE","Latitude":53.2841568,"Longitude":-2.924788},{"Name":"Overton","CrsCode":"OVR","Latitude":51.25397,"Longitude":-1.25913},{"Name":"Oxenholme Lake District","CrsCode":"OXN","Latitude":54.30517,"Longitude":-2.722249},{"Name":"Oxford","CrsCode":"OXF","Latitude":51.7535477,"Longitude":-1.270037},{"Name":"Oxford Parkway","CrsCode":"OXP","Latitude":51.8042,"Longitude":-1.2745},{"Name":"Oxshott","CrsCode":"OXS","Latitude":51.33658,"Longitude":-0.361993},{"Name":"Oxted","CrsCode":"OXT","Latitude":51.2572975,"Longitude":-0.005075},{"Name":"Paddock Wood","CrsCode":"PDW","Latitude":51.1824532,"Longitude":0.389485},{"Name":"Padgate","CrsCode":"PDG","Latitude":53.4055138,"Longitude":-2.556521},{"Name":"Padstow (By Bus)","CrsCode":"PDT","Latitude":null,"Longitude":null},{"Name":"Paignton","CrsCode":"PGN","Latitude":50.4346581,"Longitude":-3.564361},{"Name":"Paisley (Any)","CrsCode":"126","Latitude":null,"Longitude":null},{"Name":"Paisley Canal","CrsCode":"PCN","Latitude":55.8408775,"Longitude":-4.422606},{"Name":"Paisley Gilmour Street","CrsCode":"PYG","Latitude":55.8480263,"Longitude":-4.424646},{"Name":"Paisley St James","CrsCode":"PYJ","Latitude":55.8521652,"Longitude":-4.442486},{"Name":"Palmers Green","CrsCode":"PAL","Latitude":51.6187363,"Longitude":-0.109164},{"Name":"Pangbourne","CrsCode":"PAN","Latitude":51.48523,"Longitude":-1.090522},{"Name":"Pannal","CrsCode":"PNL","Latitude":53.9586868,"Longitude":-1.533605},{"Name":"Pantyffynnon","CrsCode":"PTF","Latitude":51.7788353,"Longitude":-3.997481},{"Name":"Par","CrsCode":"PAR","Latitude":50.3552628,"Longitude":-4.704752},{"Name":"Parbold","CrsCode":"PBL","Latitude":53.5908546,"Longitude":-2.770679},{"Name":"Park Street","CrsCode":"PKT","Latitude":51.72565,"Longitude":-0.340727},{"Name":"Parkstone (Dorset)","CrsCode":"PKS","Latitude":50.72305,"Longitude":-1.94897},{"Name":"Parson Street","CrsCode":"PSN","Latitude":51.43276,"Longitude":-2.60991},{"Name":"Partick","CrsCode":"PTK","Latitude":55.8699875,"Longitude":-4.310921},{"Name":"Parton","CrsCode":"PRN","Latitude":54.5697937,"Longitude":-3.580867},{"Name":"Patchway","CrsCode":"PWY","Latitude":51.52578,"Longitude":-2.562647},{"Name":"Patricroft","CrsCode":"PAT","Latitude":53.484745,"Longitude":-2.357919},{"Name":"Patterton","CrsCode":"PTT","Latitude":55.7904434,"Longitude":-4.334935},{"Name":"Peartree","CrsCode":"PEA","Latitude":52.89684,"Longitude":-1.473198},{"Name":"Peckham (Any)","CrsCode":"127","Latitude":null,"Longitude":null},{"Name":"Peckham Rye","CrsCode":"PMR","Latitude":51.4705849,"Longitude":-0.067782},{"Name":"Pegswood","CrsCode":"PEG","Latitude":55.1786156,"Longitude":-1.64509},{"Name":"Pemberton","CrsCode":"PEM","Latitude":53.530426,"Longitude":-2.670225},{"Name":"Pembrey And Burry Port","CrsCode":"PBY","Latitude":51.6834869,"Longitude":-4.247899},{"Name":"Pembroke","CrsCode":"PMB","Latitude":51.6735458,"Longitude":-4.905563},{"Name":"Pembroke (Any)","CrsCode":"128","Latitude":null,"Longitude":null},{"Name":"Pembroke Dock","CrsCode":"PMD","Latitude":51.69434,"Longitude":-4.93729},{"Name":"Pen-Y-Bont","CrsCode":"PNY","Latitude":52.2739143,"Longitude":-3.321972},{"Name":"Penally","CrsCode":"PNA","Latitude":51.65905,"Longitude":-4.72243},{"Name":"Penarth","CrsCode":"PEN","Latitude":51.43567,"Longitude":-3.173908},{"Name":"Pencoed","CrsCode":"PCD","Latitude":51.5245667,"Longitude":-3.50053},{"Name":"Pengam","CrsCode":"PGM","Latitude":51.67068,"Longitude":-3.230578},{"Name":"Penge (Any)","CrsCode":"129","Latitude":null,"Longitude":null},{"Name":"Penge East","CrsCode":"PNE","Latitude":51.4191246,"Longitude":-0.055566},{"Name":"Penge West","CrsCode":"PNW","Latitude":51.41742,"Longitude":-0.061402},{"Name":"Penhelig","CrsCode":"PHG","Latitude":52.54521,"Longitude":-4.035051},{"Name":"Penistone","CrsCode":"PNS","Latitude":53.5257568,"Longitude":-1.62134},{"Name":"Penkridge","CrsCode":"PKG","Latitude":52.72361,"Longitude":-2.119447},{"Name":"Penmaenmawr","CrsCode":"PMW","Latitude":53.2706337,"Longitude":-3.923514},{"Name":"Penmere","CrsCode":"PNM","Latitude":50.1497345,"Longitude":-5.083108},{"Name":"Penrhiwceiber","CrsCode":"PER","Latitude":51.6719055,"Longitude":-3.363662},{"Name":"Penrhyndeudraeth","CrsCode":"PRH","Latitude":52.9286232,"Longitude":-4.064905},{"Name":"Penrith (North Lakes)","CrsCode":"PNR","Latitude":54.66183,"Longitude":-2.758044},{"Name":"Penryn (Cornwall)","CrsCode":"PYN","Latitude":50.1702042,"Longitude":-5.110885},{"Name":"Pensarn (Gwynedd)","CrsCode":"PES","Latitude":52.8306923,"Longitude":-4.112216},{"Name":"Penshurst","CrsCode":"PHR","Latitude":51.19745,"Longitude":0.174125},{"Name":"Pentre-Bach","CrsCode":"PTB","Latitude":51.7249756,"Longitude":-3.362362},{"Name":"Penychain","CrsCode":"PNC","Latitude":52.903,"Longitude":-4.33845},{"Name":"Penyffordd","CrsCode":"PNF","Latitude":53.1432533,"Longitude":-3.055472},{"Name":"Penzance","CrsCode":"PNZ","Latitude":50.12162,"Longitude":-5.532489},{"Name":"Perranwell","CrsCode":"PRW","Latitude":50.21643,"Longitude":-5.111868},{"Name":"Perry Barr","CrsCode":"PRY","Latitude":52.51636,"Longitude":-1.90196},{"Name":"Pershore","CrsCode":"PSH","Latitude":52.13025,"Longitude":-2.071555},{"Name":"Perth","CrsCode":"PTH","Latitude":56.39275,"Longitude":-3.440068},{"Name":"Peterborough","CrsCode":"PBO","Latitude":52.5749474,"Longitude":-0.24981},{"Name":"Petersfield","CrsCode":"PTR","Latitude":51.0069237,"Longitude":-0.940951},{"Name":"Petts Wood","CrsCode":"PET","Latitude":51.3889961,"Longitude":0.075393},{"Name":"Pevensey (Any)","CrsCode":"130","Latitude":null,"Longitude":null},{"Name":"Pevensey And Westham","CrsCode":"PEV","Latitude":50.8159,"Longitude":0.325291},{"Name":"Pevensey Bay","CrsCode":"PEB","Latitude":50.81825,"Longitude":0.342453},{"Name":"Pewsey","CrsCode":"PEW","Latitude":51.34241,"Longitude":-1.771691},{"Name":"Pickering Bus","CrsCode":"PIZ","Latitude":54.24349,"Longitude":-0.77435},{"Name":"Pilning","CrsCode":"PIL","Latitude":51.5565033,"Longitude":-2.627192},{"Name":"Pinhoe","CrsCode":"PIN","Latitude":50.73808,"Longitude":-3.469582},{"Name":"Pitlochry","CrsCode":"PIT","Latitude":56.70256,"Longitude":-3.736085},{"Name":"Pitsea","CrsCode":"PSE","Latitude":51.5603867,"Longitude":0.508806},{"Name":"Pleasington","CrsCode":"PLS","Latitude":53.73096,"Longitude":-2.544142},{"Name":"Plockton","CrsCode":"PLK","Latitude":57.33317,"Longitude":-5.666848},{"Name":"Pluckley","CrsCode":"PLC","Latitude":51.1565781,"Longitude":0.748571},{"Name":"Plumley","CrsCode":"PLM","Latitude":53.27481,"Longitude":-2.419615},{"Name":"Plumpton","CrsCode":"PMP","Latitude":50.9290657,"Longitude":-0.060435},{"Name":"Plumstead","CrsCode":"PLU","Latitude":51.48959,"Longitude":0.082828},{"Name":"Plymouth","CrsCode":"PLY","Latitude":50.37776,"Longitude":-4.143386},{"Name":"Pokesdown","CrsCode":"POK","Latitude":50.73102,"Longitude":-1.82568},{"Name":"Polegate","CrsCode":"PLG","Latitude":50.8209343,"Longitude":0.251705},{"Name":"Polesworth","CrsCode":"PSW","Latitude":52.6258926,"Longitude":-1.60995},{"Name":"Pollokshaws (Any)","CrsCode":"131","Latitude":null,"Longitude":null},{"Name":"Pollokshaws East","CrsCode":"PWE","Latitude":55.82459,"Longitude":-4.287476},{"Name":"Pollokshaws West","CrsCode":"PWW","Latitude":55.8243179,"Longitude":-4.301826},{"Name":"Pollokshields (Any)","CrsCode":"132","Latitude":null,"Longitude":null},{"Name":"Pollokshields East","CrsCode":"PLE","Latitude":55.8411026,"Longitude":-4.269287},{"Name":"Pollokshields West","CrsCode":"PLW","Latitude":55.83736,"Longitude":-4.277043},{"Name":"Polmont","CrsCode":"PMT","Latitude":55.9848557,"Longitude":-3.716614},{"Name":"Polsloe Bridge","CrsCode":"POL","Latitude":50.7312737,"Longitude":-3.501785},{"Name":"Ponders End","CrsCode":"PON","Latitude":51.6426926,"Longitude":-0.034453},{"Name":"Pont-Y-Pant","CrsCode":"PYP","Latitude":53.065033,"Longitude":-3.862462},{"Name":"Pontarddulais","CrsCode":"PTD","Latitude":51.7168655,"Longitude":-4.045417},{"Name":"Pontefract (Any)","CrsCode":"133","Latitude":null,"Longitude":null},{"Name":"Pontefract Baghill","CrsCode":"PFR","Latitude":53.6915169,"Longitude":-1.303355},{"Name":"Pontefract Monkhill","CrsCode":"PFM","Latitude":53.69871,"Longitude":-1.304749},{"Name":"Pontefract Tanshelf","CrsCode":"POT","Latitude":53.694313,"Longitude":-1.319964},{"Name":"Pontlottyn","CrsCode":"PLT","Latitude":51.74659,"Longitude":-3.278995},{"Name":"Pontyclun","CrsCode":"PYC","Latitude":51.5241127,"Longitude":-3.390959},{"Name":"Pontypool And New Inn","CrsCode":"PPL","Latitude":51.6979256,"Longitude":-3.014277},{"Name":"Pontypridd","CrsCode":"PPD","Latitude":51.59931,"Longitude":-3.342715},{"Name":"Poole","CrsCode":"POO","Latitude":50.71856,"Longitude":-1.982964},{"Name":"Poppleton","CrsCode":"POP","Latitude":53.9763451,"Longitude":-1.147657},{"Name":"Port Glasgow","CrsCode":"PTG","Latitude":55.9342,"Longitude":-4.689432},{"Name":"Port Sunlight","CrsCode":"PSL","Latitude":53.34912,"Longitude":-2.998248},{"Name":"Port Talbot Parkway","CrsCode":"PTA","Latitude":51.59167,"Longitude":-3.781362},{"Name":"Portadown","CrsCode":"PTN","Latitude":null,"Longitude":null},{"Name":"Portarlington (Irish Rail)","CrsCode":"PRO","Latitude":null,"Longitude":null},{"Name":"Portchester","CrsCode":"PTC","Latitude":50.84839,"Longitude":-1.126361},{"Name":"Porth","CrsCode":"POR","Latitude":51.61203,"Longitude":-3.408079},{"Name":"Porthmadog","CrsCode":"PTM","Latitude":52.930954,"Longitude":-4.136431},{"Name":"Portlaoise","CrsCode":"PTO","Latitude":null,"Longitude":null},{"Name":"Portlethen","CrsCode":"PLN","Latitude":57.0604553,"Longitude":-2.128577},{"Name":"Portrush","CrsCode":"PTS","Latitude":null,"Longitude":null},{"Name":"Portslade","CrsCode":"PLD","Latitude":50.8360443,"Longitude":-0.204898},{"Name":"Portsmouth (Any)","CrsCode":"134","Latitude":null,"Longitude":null},{"Name":"Portsmouth And Southsea","CrsCode":"PMS","Latitude":50.7977562,"Longitude":-1.090417},{"Name":"Portsmouth Arms","CrsCode":"PMA","Latitude":50.956768,"Longitude":-3.950633},{"Name":"Portsmouth Harbour","CrsCode":"PMH","Latitude":50.7960968,"Longitude":-1.108895},{"Name":"Possilpark And Parkhouse","CrsCode":"PPK","Latitude":55.8907166,"Longitude":-4.259381},{"Name":"Potters Bar","CrsCode":"PBR","Latitude":51.69739,"Longitude":-0.192715},{"Name":"Poulton-Le-Fylde","CrsCode":"PFY","Latitude":53.84813,"Longitude":-2.990212},{"Name":"Poynton","CrsCode":"PYT","Latitude":53.3504,"Longitude":-2.13448},{"Name":"Prees","CrsCode":"PRS","Latitude":52.89962,"Longitude":-2.689765},{"Name":"Prescot","CrsCode":"PSC","Latitude":53.4235344,"Longitude":-2.799022},{"Name":"Prestatyn","CrsCode":"PRT","Latitude":53.33649,"Longitude":-3.407164},{"Name":"Prestbury","CrsCode":"PRB","Latitude":53.2934647,"Longitude":-2.14549},{"Name":"Preston (Lancs)","CrsCode":"PRE","Latitude":53.755722,"Longitude":-2.707191},{"Name":"Preston Park","CrsCode":"PRP","Latitude":50.8460541,"Longitude":-0.154787},{"Name":"Prestonpans","CrsCode":"PST","Latitude":55.9534264,"Longitude":-2.973665},{"Name":"Prestwick (Any)","CrsCode":"135","Latitude":null,"Longitude":null},{"Name":"Prestwick International Airport","CrsCode":"PRA","Latitude":55.5115128,"Longitude":-4.616166},{"Name":"Prestwick Town","CrsCode":"PTW","Latitude":55.5016747,"Longitude":-4.613935},{"Name":"Priesthill And Darnley","CrsCode":"PTL","Latitude":55.8127365,"Longitude":-4.344246},{"Name":"Princes Risborough","CrsCode":"PRR","Latitude":51.7176971,"Longitude":-0.844059},{"Name":"Prittlewell","CrsCode":"PRL","Latitude":51.5504761,"Longitude":0.71167},{"Name":"Prudhoe","CrsCode":"PRU","Latitude":54.9660721,"Longitude":-1.864077},{"Name":"Pulborough","CrsCode":"PUL","Latitude":50.9573555,"Longitude":-0.517751},{"Name":"Purfleet","CrsCode":"PFL","Latitude":51.4813576,"Longitude":0.236575},{"Name":"Purley","CrsCode":"PUR","Latitude":51.3373337,"Longitude":-0.113592},{"Name":"Purley Oaks","CrsCode":"PUO","Latitude":51.34699,"Longitude":-0.098843},{"Name":"Putney","CrsCode":"PUT","Latitude":51.46125,"Longitude":-0.216463},{"Name":"Pwllheli","CrsCode":"PWL","Latitude":52.887825,"Longitude":-4.416754},{"Name":"Pye Corner","CrsCode":"PYE","Latitude":51.5795135,"Longitude":-3.038295},{"Name":"Pyle","CrsCode":"PYL","Latitude":51.5272,"Longitude":-3.702439},{"Name":"Quakers Yard","CrsCode":"QYD","Latitude":51.6606865,"Longitude":-3.322844},{"Name":"Queenborough","CrsCode":"QBR","Latitude":51.4164734,"Longitude":0.749756},{"Name":"Queens Park (Glasgow)","CrsCode":"QPK","Latitude":55.8357468,"Longitude":-4.267368},{"Name":"Queens Park (London)","CrsCode":"QPW","Latitude":51.5339165,"Longitude":-0.204966},{"Name":"Queens Road (Peckham)","CrsCode":"QRP","Latitude":51.47401,"Longitude":-0.057553},{"Name":"Queenstown Road","CrsCode":"QRB","Latitude":51.4745522,"Longitude":-0.146819},{"Name":"Quintrell Downs","CrsCode":"QUI","Latitude":50.4039078,"Longitude":-5.029838},{"Name":"Radcliffe (Nottinghamshire)","CrsCode":"RDF","Latitude":52.9489059,"Longitude":-1.031059},{"Name":"Radlett","CrsCode":"RDT","Latitude":51.68486,"Longitude":-0.317626},{"Name":"Radley","CrsCode":"RAD","Latitude":51.68559,"Longitude":-1.240398},{"Name":"Radyr","CrsCode":"RDR","Latitude":51.51583,"Longitude":-3.248028},{"Name":"Rainford","CrsCode":"RNF","Latitude":53.51694,"Longitude":-2.789454},{"Name":"Rainham (Essex)","CrsCode":"RNM","Latitude":51.51745,"Longitude":0.190716},{"Name":"Rainham (Kent)","CrsCode":"RAI","Latitude":51.36657,"Longitude":0.611698},{"Name":"Rainhill","CrsCode":"RNH","Latitude":53.41713,"Longitude":-2.766398},{"Name":"Ramsgate","CrsCode":"RAM","Latitude":51.3407669,"Longitude":1.405833},{"Name":"Ramsgreave And Wilpshire","CrsCode":"RGW","Latitude":53.78787,"Longitude":-2.47657},{"Name":"Rannoch","CrsCode":"RAN","Latitude":56.685318,"Longitude":-4.576208},{"Name":"Rathdrum (Irish Rail)","CrsCode":"RDU","Latitude":null,"Longitude":null},{"Name":"Rathmore (Irish Rail)","CrsCode":"RMR","Latitude":null,"Longitude":null},{"Name":"Rauceby","CrsCode":"RAU","Latitude":52.98508,"Longitude":-0.455247},{"Name":"Ravenglass For Eskdale","CrsCode":"RAV","Latitude":54.3558044,"Longitude":-3.409456},{"Name":"Ravensbourne","CrsCode":"RVB","Latitude":51.4138031,"Longitude":-0.0069},{"Name":"Ravensthorpe","CrsCode":"RVN","Latitude":53.6759644,"Longitude":-1.653298},{"Name":"Rawcliffe","CrsCode":"RWC","Latitude":53.68814,"Longitude":-0.961174},{"Name":"Rayleigh","CrsCode":"RLG","Latitude":51.58985,"Longitude":0.601393},{"Name":"Raynes Park","CrsCode":"RAY","Latitude":51.4092941,"Longitude":-0.22998},{"Name":"Reading","CrsCode":"RDG","Latitude":51.4587669,"Longitude":-0.972172},{"Name":"Reading (Any)","CrsCode":"137","Latitude":null,"Longitude":null},{"Name":"Reading West","CrsCode":"RDW","Latitude":51.45508,"Longitude":-0.990143},{"Name":"Rectory Road","CrsCode":"REC","Latitude":51.55872,"Longitude":-0.068379},{"Name":"Redbridge","CrsCode":"RDB","Latitude":50.9196968,"Longitude":-1.470737},{"Name":"Redcar (Any)","CrsCode":"138","Latitude":null,"Longitude":null},{"Name":"Redcar British Steel","CrsCode":"RBS","Latitude":54.6092644,"Longitude":-1.108324},{"Name":"Redcar Central","CrsCode":"RCC","Latitude":54.6156921,"Longitude":-1.069318},{"Name":"Redcar East","CrsCode":"RCE","Latitude":54.6092567,"Longitude":-1.05088},{"Name":"Reddish (Any)","CrsCode":"139","Latitude":null,"Longitude":null},{"Name":"Reddish North","CrsCode":"RDN","Latitude":53.4489555,"Longitude":-2.15656},{"Name":"Reddish South","CrsCode":"RDS","Latitude":53.43587,"Longitude":-2.159028},{"Name":"Redditch","CrsCode":"RDC","Latitude":52.3063354,"Longitude":-1.945248},{"Name":"Redhill","CrsCode":"RDH","Latitude":51.2401237,"Longitude":-0.164851},{"Name":"Redland","CrsCode":"RDA","Latitude":51.468792,"Longitude":-2.598875},{"Name":"Redruth","CrsCode":"RED","Latitude":50.2331123,"Longitude":-5.225877},{"Name":"Reedham (Norfolk)","CrsCode":"REE","Latitude":52.564045,"Longitude":1.558941},{"Name":"Reedham (Surrey)","CrsCode":"RHM","Latitude":51.3321075,"Longitude":-0.123854},{"Name":"Reigate","CrsCode":"REI","Latitude":51.2416229,"Longitude":-0.203474},{"Name":"Renton","CrsCode":"RTN","Latitude":55.9705658,"Longitude":-4.586181},{"Name":"Retford","CrsCode":"RET","Latitude":53.3158722,"Longitude":-0.94772},{"Name":"Rhiwbina","CrsCode":"RHI","Latitude":51.5206871,"Longitude":-3.213561},{"Name":"Rhoose Cardiff International Airport","CrsCode":"RIA","Latitude":51.387455,"Longitude":-3.347599},{"Name":"Rhosneigr","CrsCode":"RHO","Latitude":53.2347832,"Longitude":-4.505768},{"Name":"Rhyl","CrsCode":"RHL","Latitude":53.31841,"Longitude":-3.489144},{"Name":"Rhymney","CrsCode":"RHY","Latitude":51.7590637,"Longitude":-3.289494},{"Name":"Ribblehead","CrsCode":"RHD","Latitude":54.2057762,"Longitude":-2.36087},{"Name":"Rice Lane","CrsCode":"RIL","Latitude":53.457737,"Longitude":-2.962253},{"Name":"Richmond (London)","CrsCode":"RMD","Latitude":51.4625053,"Longitude":-0.301346},{"Name":"Richmond Yks Bus","CrsCode":"RMK","Latitude":null,"Longitude":null},{"Name":"Rickmansworth","CrsCode":"RIC","Latitude":51.6404457,"Longitude":-0.473013},{"Name":"Riddlesdown","CrsCode":"RDD","Latitude":51.33261,"Longitude":-0.099436},{"Name":"Ridgmont","CrsCode":"RID","Latitude":52.02659,"Longitude":-0.594903},{"Name":"Riding Mill","CrsCode":"RDM","Latitude":54.9490662,"Longitude":-1.97186},{"Name":"Risca And Pontymister","CrsCode":"RCA","Latitude":51.60443,"Longitude":-3.093533},{"Name":"Rishton","CrsCode":"RIS","Latitude":53.763813,"Longitude":-2.420165},{"Name":"Robertsbridge","CrsCode":"RBR","Latitude":50.984726,"Longitude":0.469092},{"Name":"Robroyston","CrsCode":"RRN","Latitude":null,"Longitude":null},{"Name":"Roby","CrsCode":"ROB","Latitude":53.4100342,"Longitude":-2.855956},{"Name":"Rochdale","CrsCode":"RCD","Latitude":53.6102943,"Longitude":-2.153444},{"Name":"Roche","CrsCode":"ROC","Latitude":50.41891,"Longitude":-4.830658},{"Name":"Rochester","CrsCode":"RTR","Latitude":51.3849678,"Longitude":0.510698},{"Name":"Rochford","CrsCode":"RFD","Latitude":51.5812759,"Longitude":0.701959},{"Name":"Rock Ferry","CrsCode":"RFY","Latitude":53.37227,"Longitude":-3.010898},{"Name":"Rogart","CrsCode":"ROG","Latitude":57.98898,"Longitude":-4.158224},{"Name":"Rogerstone","CrsCode":"ROR","Latitude":51.5934143,"Longitude":-3.065478},{"Name":"Rolleston","CrsCode":"ROL","Latitude":53.0655365,"Longitude":-0.900095},{"Name":"Roman Bridge","CrsCode":"RMB","Latitude":53.04432,"Longitude":-3.92125},{"Name":"Romford","CrsCode":"RMF","Latitude":51.575016,"Longitude":0.181986},{"Name":"Romiley","CrsCode":"RML","Latitude":53.4140244,"Longitude":-2.089307},{"Name":"Romsey","CrsCode":"ROM","Latitude":50.99264,"Longitude":-1.492716},{"Name":"Roose","CrsCode":"ROO","Latitude":54.1151581,"Longitude":-3.19457},{"Name":"Roscommon","CrsCode":"RCM","Latitude":null,"Longitude":null},{"Name":"Roscrea","CrsCode":"RCR","Latitude":null,"Longitude":null},{"Name":"Rose Grove","CrsCode":"RSG","Latitude":53.7866859,"Longitude":-2.282282},{"Name":"Rose Hill Marple","CrsCode":"RSH","Latitude":53.3961754,"Longitude":-2.076502},{"Name":"Rosslare Europort","CrsCode":"RSB","Latitude":null,"Longitude":null},{"Name":"Rosslare Strand","CrsCode":"RSS","Latitude":null,"Longitude":null},{"Name":"Rosyth","CrsCode":"ROS","Latitude":56.0460548,"Longitude":-3.427114},{"Name":"Rotherham Central","CrsCode":"RMC","Latitude":53.4293556,"Longitude":-1.358811},{"Name":"Rotherhithe","CrsCode":"ROE","Latitude":51.50098,"Longitude":-0.05353},{"Name":"Rothesay (Bute)","CrsCode":"RTY","Latitude":null,"Longitude":null},{"Name":"Roughton Road","CrsCode":"RNR","Latitude":52.9178276,"Longitude":1.299239},{"Name":"Rowlands Castle","CrsCode":"RLN","Latitude":50.8928642,"Longitude":-0.957748},{"Name":"Rowley Regis","CrsCode":"ROW","Latitude":52.4773,"Longitude":-2.030885},{"Name":"Roy Bridge","CrsCode":"RYB","Latitude":56.8881836,"Longitude":-4.83645},{"Name":"Roydon","CrsCode":"RYN","Latitude":51.7754936,"Longitude":0.035088},{"Name":"Royston","CrsCode":"RYS","Latitude":52.05351,"Longitude":-0.026686},{"Name":"Ruabon","CrsCode":"RUA","Latitude":52.9869347,"Longitude":-3.044214},{"Name":"Rufford","CrsCode":"RUF","Latitude":53.6348152,"Longitude":-2.806792},{"Name":"Rugby","CrsCode":"RUG","Latitude":52.37872,"Longitude":-1.249263},{"Name":"Rugeley (Any)","CrsCode":"140","Latitude":null,"Longitude":null},{"Name":"Rugeley Town","CrsCode":"RGT","Latitude":52.754673,"Longitude":-1.936963},{"Name":"Rugeley Trent Valley","CrsCode":"RGL","Latitude":52.76945,"Longitude":-1.930309},{"Name":"Ruislip (Any)","CrsCode":"141","Latitude":null,"Longitude":null},{"Name":"Runcorn","CrsCode":"RUN","Latitude":53.3386955,"Longitude":-2.73919},{"Name":"Runcorn East","CrsCode":"RUE","Latitude":53.3269272,"Longitude":-2.665102},{"Name":"Ruskington","CrsCode":"RKT","Latitude":53.0416145,"Longitude":-0.380127},{"Name":"Ruswarp","CrsCode":"RUS","Latitude":54.4703674,"Longitude":-0.626664},{"Name":"Rutherglen","CrsCode":"RUT","Latitude":55.83045,"Longitude":-4.212766},{"Name":"Ryde (Any)","CrsCode":"143","Latitude":null,"Longitude":null},{"Name":"Ryde Esplanade","CrsCode":"RYD","Latitude":50.7335167,"Longitude":-1.159676},{"Name":"Ryde Hoverport","CrsCode":"XRD","Latitude":null,"Longitude":null},{"Name":"Ryde Pier Head","CrsCode":"RYP","Latitude":50.7389145,"Longitude":-1.159578},{"Name":"Ryde St Johns Road","CrsCode":"RYR","Latitude":50.72361,"Longitude":-1.157028},{"Name":"Ryder Brow","CrsCode":"RRB","Latitude":53.4579163,"Longitude":-2.176173},{"Name":"Rye (Sussex)","CrsCode":"RYE","Latitude":50.9519157,"Longitude":0.730782},{"Name":"Rye House","CrsCode":"RYH","Latitude":51.76881,"Longitude":0.005796},{"Name":"Salford (Any)","CrsCode":"148","Latitude":null,"Longitude":null},{"Name":"Salford Central","CrsCode":"SFD","Latitude":53.482914,"Longitude":-2.254686},{"Name":"Salford Crescent","CrsCode":"SLD","Latitude":53.48646,"Longitude":-2.275715},{"Name":"Salfords (Surrey)","CrsCode":"SAF","Latitude":51.2014122,"Longitude":-0.162096},{"Name":"Salhouse","CrsCode":"SAH","Latitude":52.6750832,"Longitude":1.391886},{"Name":"Salisbury","CrsCode":"SAL","Latitude":51.0709152,"Longitude":-1.805864},{"Name":"Saltaire","CrsCode":"SAE","Latitude":53.8380661,"Longitude":-1.790246},{"Name":"Saltash","CrsCode":"STS","Latitude":50.40711,"Longitude":-4.209449},{"Name":"Saltburn","CrsCode":"SLB","Latitude":54.58346,"Longitude":-0.974116},{"Name":"Saltcoats","CrsCode":"SLT","Latitude":55.6336479,"Longitude":-4.784804},{"Name":"Saltmarshe","CrsCode":"SAM","Latitude":53.7226753,"Longitude":-0.808765},{"Name":"Salwick","CrsCode":"SLW","Latitude":53.7815361,"Longitude":-2.817973},{"Name":"Sampford Courtenay","CrsCode":"SMC","Latitude":50.77896,"Longitude":-3.93751},{"Name":"Sandal And Agbrigg","CrsCode":"SNA","Latitude":53.6645737,"Longitude":-1.485404},{"Name":"Sandbach","CrsCode":"SDB","Latitude":53.1501122,"Longitude":-2.393528},{"Name":"Sanderstead","CrsCode":"SNR","Latitude":51.3486938,"Longitude":-0.093017},{"Name":"Sandhills","CrsCode":"SDL","Latitude":53.43002,"Longitude":-2.9915},{"Name":"Sandhurst (Berks)","CrsCode":"SND","Latitude":51.34642,"Longitude":-0.803911},{"Name":"Sandling","CrsCode":"SDG","Latitude":51.09021,"Longitude":1.065995},{"Name":"Sandown","CrsCode":"SAN","Latitude":50.6571,"Longitude":-1.162457},{"Name":"Sandplace","CrsCode":"SDP","Latitude":50.3866844,"Longitude":-4.464549},{"Name":"Sandwell And Dudley","CrsCode":"SAD","Latitude":52.50843,"Longitude":-2.011281},{"Name":"Sandwich","CrsCode":"SDW","Latitude":51.26971,"Longitude":1.343208},{"Name":"Sandy","CrsCode":"SDY","Latitude":52.12493,"Longitude":-0.28065},{"Name":"Sankey For Penketh","CrsCode":"SNK","Latitude":53.3924522,"Longitude":-2.651094},{"Name":"Sanquhar","CrsCode":"SQH","Latitude":55.3706322,"Longitude":-3.923437},{"Name":"Sarn","CrsCode":"SRR","Latitude":51.54005,"Longitude":-3.589196},{"Name":"Saundersfoot","CrsCode":"SDF","Latitude":51.722084,"Longitude":-4.718965},{"Name":"Saunderton","CrsCode":"SDR","Latitude":51.67575,"Longitude":-0.825626},{"Name":"Sawbridgeworth","CrsCode":"SAW","Latitude":51.8146248,"Longitude":0.160177},{"Name":"Saxilby","CrsCode":"SXY","Latitude":53.2671928,"Longitude":-0.664018},{"Name":"Saxmundham","CrsCode":"SAX","Latitude":52.21531,"Longitude":1.489965},{"Name":"Scarborough","CrsCode":"SCA","Latitude":54.2798,"Longitude":-0.405666},{"Name":"Scotscalder","CrsCode":"SCT","Latitude":58.48289,"Longitude":-3.553764},{"Name":"Scotstounhill","CrsCode":"SCH","Latitude":55.88449,"Longitude":-4.351765},{"Name":"Scunthorpe","CrsCode":"SCU","Latitude":53.58617,"Longitude":-0.650951},{"Name":"Sea Mills","CrsCode":"SML","Latitude":51.48021,"Longitude":-2.649427},{"Name":"Seaburn","CrsCode":"SEB","Latitude":54.9295578,"Longitude":-1.38667},{"Name":"Seaford (Sussex)","CrsCode":"SEF","Latitude":50.7724953,"Longitude":0.10045},{"Name":"Seaforth And Litherland","CrsCode":"SFL","Latitude":53.4663353,"Longitude":-3.005619},{"Name":"Seaham","CrsCode":"SEA","Latitude":54.836834,"Longitude":-1.341019},{"Name":"Seahouses Bus","CrsCode":"SIB","Latitude":null,"Longitude":null},{"Name":"Seamer","CrsCode":"SEM","Latitude":54.2412872,"Longitude":-0.416367},{"Name":"Seascale","CrsCode":"SSC","Latitude":54.39535,"Longitude":-3.48476},{"Name":"Seaton Carew","CrsCode":"SEC","Latitude":54.65796,"Longitude":-1.200106},{"Name":"Seer Green And Jordans","CrsCode":"SRG","Latitude":51.6095238,"Longitude":-0.607809},{"Name":"Selby","CrsCode":"SBY","Latitude":53.78336,"Longitude":-1.06355},{"Name":"Selhurst","CrsCode":"SRS","Latitude":51.392704,"Longitude":-0.089759},{"Name":"Sellafield","CrsCode":"SEL","Latitude":54.4165726,"Longitude":-3.510293},{"Name":"Selling","CrsCode":"SEG","Latitude":51.2778168,"Longitude":0.940801},{"Name":"Selly Oak","CrsCode":"SLY","Latitude":52.4413223,"Longitude":-1.936708},{"Name":"Settle","CrsCode":"SET","Latitude":54.0669,"Longitude":-2.280704},{"Name":"Seven Kings","CrsCode":"SVK","Latitude":51.56399,"Longitude":0.096325},{"Name":"Seven Sisters","CrsCode":"SVS","Latitude":51.5840073,"Longitude":-0.074521},{"Name":"Sevenoaks","CrsCode":"SEV","Latitude":51.27734,"Longitude":0.182193},{"Name":"Severn Beach","CrsCode":"SVB","Latitude":51.559864,"Longitude":-2.664227},{"Name":"Severn Tunnel Junction","CrsCode":"STJ","Latitude":51.58463,"Longitude":-2.777917},{"Name":"Shadwell","CrsCode":"SDE","Latitude":51.51093,"Longitude":-0.05743},{"Name":"Shalford (Surrey)","CrsCode":"SFR","Latitude":51.2142639,"Longitude":-0.566789},{"Name":"Shanklin","CrsCode":"SHN","Latitude":50.6338425,"Longitude":-1.179841},{"Name":"Shawfair","CrsCode":"SFI","Latitude":55.91993,"Longitude":-3.07872},{"Name":"Shawford","CrsCode":"SHW","Latitude":51.02149,"Longitude":-1.328428},{"Name":"Shawlands","CrsCode":"SHL","Latitude":55.8289871,"Longitude":-4.292521},{"Name":"Sheerness-On-Sea","CrsCode":"SSS","Latitude":51.44056,"Longitude":0.758397},{"Name":"Sheffield","CrsCode":"SHF","Latitude":53.37864,"Longitude":-1.463297},{"Name":"Shelford (Cambs)","CrsCode":"SED","Latitude":52.1495171,"Longitude":0.139805},{"Name":"Shenfield","CrsCode":"SNF","Latitude":51.6306152,"Longitude":0.330602},{"Name":"Shenstone","CrsCode":"SEN","Latitude":52.6389847,"Longitude":-1.844528},{"Name":"Shepherds Bush","CrsCode":"SPB","Latitude":51.506,"Longitude":-0.218},{"Name":"Shepherds Well","CrsCode":"SPH","Latitude":51.18834,"Longitude":1.229952},{"Name":"Shepley","CrsCode":"SPY","Latitude":53.588913,"Longitude":-1.703863},{"Name":"Shepperton","CrsCode":"SHP","Latitude":51.39709,"Longitude":-0.447521},{"Name":"Shepreth","CrsCode":"STH","Latitude":52.1145668,"Longitude":0.031517},{"Name":"Sherborne","CrsCode":"SHE","Latitude":50.94405,"Longitude":-2.513816},{"Name":"Sherburn-In-Elmet","CrsCode":"SIE","Latitude":53.797142,"Longitude":-1.23176},{"Name":"Sheringham","CrsCode":"SHM","Latitude":52.94096,"Longitude":1.210195},{"Name":"Shettleston","CrsCode":"SLS","Latitude":55.85296,"Longitude":-4.159731},{"Name":"Shieldmuir","CrsCode":"SDM","Latitude":55.77553,"Longitude":-3.952944},{"Name":"Shifnal","CrsCode":"SFN","Latitude":52.6664047,"Longitude":-2.371116},{"Name":"Shildon","CrsCode":"SHD","Latitude":54.6268158,"Longitude":-1.637515},{"Name":"Shiplake","CrsCode":"SHI","Latitude":51.51121,"Longitude":-0.882452},{"Name":"Shipley (Yorks)","CrsCode":"SHY","Latitude":53.8335533,"Longitude":-1.773558},{"Name":"Shippea Hill","CrsCode":"SPP","Latitude":52.4302177,"Longitude":0.412299},{"Name":"Shipton","CrsCode":"SIP","Latitude":51.86613,"Longitude":-1.591864},{"Name":"Shirebrook","CrsCode":"SHB","Latitude":53.20369,"Longitude":-1.201995},{"Name":"Shirehampton","CrsCode":"SHH","Latitude":51.4842148,"Longitude":-2.679162},{"Name":"Shireoaks","CrsCode":"SRO","Latitude":53.32481,"Longitude":-1.16821},{"Name":"Shirley","CrsCode":"SRL","Latitude":52.4034729,"Longitude":-1.845632},{"Name":"Shoeburyness","CrsCode":"SRY","Latitude":51.531414,"Longitude":0.795616},{"Name":"Sholing","CrsCode":"SHO","Latitude":50.8966866,"Longitude":-1.36436},{"Name":"Shoreditch High Street","CrsCode":"SDC","Latitude":51.5229225,"Longitude":-0.075684},{"Name":"Shoreham (Kent)","CrsCode":"SEH","Latitude":51.3320923,"Longitude":0.187665},{"Name":"Shoreham-By-Sea","CrsCode":"SSE","Latitude":50.83436,"Longitude":-0.271709},{"Name":"Shortlands","CrsCode":"SRT","Latitude":51.40555,"Longitude":0.002798},{"Name":"Shotton","CrsCode":"SHT","Latitude":53.21352,"Longitude":-3.037728},{"Name":"Shotts","CrsCode":"SHS","Latitude":55.8183022,"Longitude":-3.80024},{"Name":"Shrewsbury","CrsCode":"SHR","Latitude":52.71137,"Longitude":-2.74897},{"Name":"Sidcup","CrsCode":"SID","Latitude":51.43436,"Longitude":0.103342},{"Name":"Sileby","CrsCode":"SIL","Latitude":52.7315941,"Longitude":-1.109979},{"Name":"Silecroft","CrsCode":"SIC","Latitude":54.2259674,"Longitude":-3.334281},{"Name":"Silkstone Common","CrsCode":"SLK","Latitude":53.53724,"Longitude":-1.560883},{"Name":"Silver Street","CrsCode":"SLV","Latitude":51.6153641,"Longitude":-0.067415},{"Name":"Silverdale","CrsCode":"SVR","Latitude":54.16992,"Longitude":-2.804164},{"Name":"Singer","CrsCode":"SIN","Latitude":55.90771,"Longitude":-4.405983},{"Name":"Sittingbourne","CrsCode":"SIT","Latitude":51.3422,"Longitude":0.733817},{"Name":"Skegness","CrsCode":"SKG","Latitude":53.1430321,"Longitude":0.333926},{"Name":"Skewen","CrsCode":"SKE","Latitude":51.66079,"Longitude":-3.847692},{"Name":"Skipton","CrsCode":"SKI","Latitude":53.95869,"Longitude":-2.025878},{"Name":"Slade Green","CrsCode":"SGR","Latitude":51.4669571,"Longitude":0.189792},{"Name":"Slaithwaite","CrsCode":"SWT","Latitude":53.6242752,"Longitude":-1.87901},{"Name":"Slateford","CrsCode":"SLA","Latitude":55.92673,"Longitude":-3.243476},{"Name":"Sleaford","CrsCode":"SLR","Latitude":52.9952736,"Longitude":-0.410174},{"Name":"Sleights","CrsCode":"SLH","Latitude":54.46088,"Longitude":-0.66246},{"Name":"Sligo","CrsCode":"SLI","Latitude":null,"Longitude":null},{"Name":"Slough","CrsCode":"SLO","Latitude":51.51192,"Longitude":-0.591803},{"Name":"Small Heath","CrsCode":"SMA","Latitude":52.46283,"Longitude":-1.858673},{"Name":"Smallbrook Junction","CrsCode":"SAB","Latitude":50.712822,"Longitude":-1.15721},{"Name":"Smethwick (Any)","CrsCode":"150","Latitude":null,"Longitude":null},{"Name":"Smethwick Galton Bridge","CrsCode":"SGB","Latitude":52.50179,"Longitude":-1.980495},{"Name":"Smethwick Rolfe Street","CrsCode":"SMR","Latitude":52.50214,"Longitude":-1.981143},{"Name":"Smithy Bridge","CrsCode":"SMB","Latitude":53.6332664,"Longitude":-2.113394},{"Name":"Snaith","CrsCode":"SNI","Latitude":53.69319,"Longitude":-1.027678},{"Name":"Snodland","CrsCode":"SDA","Latitude":51.33052,"Longitude":0.448864},{"Name":"Snowdown","CrsCode":"SWO","Latitude":51.2148857,"Longitude":1.213187},{"Name":"Sole Street","CrsCode":"SOR","Latitude":51.38327,"Longitude":0.376939},{"Name":"Solihull","CrsCode":"SOL","Latitude":52.41508,"Longitude":-1.78972},{"Name":"Somerleyton","CrsCode":"SYT","Latitude":52.50989,"Longitude":1.653333},{"Name":"South Acton","CrsCode":"SAT","Latitude":51.4998131,"Longitude":-0.269697},{"Name":"South Bank","CrsCode":"SBK","Latitude":54.5823746,"Longitude":-1.186112},{"Name":"South Bermondsey","CrsCode":"SBM","Latitude":51.4874458,"Longitude":-0.054101},{"Name":"South Croydon","CrsCode":"SCY","Latitude":51.3621941,"Longitude":-0.093903},{"Name":"South Elmsall","CrsCode":"SES","Latitude":53.5952339,"Longitude":-1.285286},{"Name":"South Greenford","CrsCode":"SGN","Latitude":51.53334,"Longitude":-0.336403},{"Name":"South Gyle","CrsCode":"SGL","Latitude":55.93695,"Longitude":-3.298234},{"Name":"South Hampstead","CrsCode":"SOH","Latitude":51.5414238,"Longitude":-0.178759},{"Name":"South Kenton","CrsCode":"SOK","Latitude":51.56963,"Longitude":-0.308894},{"Name":"South Merton","CrsCode":"SMO","Latitude":51.40353,"Longitude":-0.205764},{"Name":"South Milford","CrsCode":"SOM","Latitude":53.7819939,"Longitude":-1.251772},{"Name":"South Ruislip","CrsCode":"SRU","Latitude":51.5567436,"Longitude":-0.398812},{"Name":"South Tottenham","CrsCode":"STO","Latitude":51.58036,"Longitude":-0.071788},{"Name":"South Wigston","CrsCode":"SWS","Latitude":52.58245,"Longitude":-1.132918},{"Name":"South Woodham Ferrers","CrsCode":"SOF","Latitude":51.64957,"Longitude":0.606512},{"Name":"Southall","CrsCode":"STL","Latitude":51.5058823,"Longitude":-0.378513},{"Name":"Southampton (Any)","CrsCode":"151","Latitude":null,"Longitude":null},{"Name":"Southampton Airport Parkway","CrsCode":"SOA","Latitude":50.9506378,"Longitude":-1.36362},{"Name":"Southampton Central","CrsCode":"SOU","Latitude":50.90774,"Longitude":-1.413983},{"Name":"Southbourne","CrsCode":"SOB","Latitude":50.8483429,"Longitude":-0.907601},{"Name":"Southbury","CrsCode":"SBU","Latitude":51.6483955,"Longitude":-0.052998},{"Name":"Southease","CrsCode":"SEE","Latitude":50.8312836,"Longitude":0.03066},{"Name":"Southease (Church By Bus)","CrsCode":"SEZ","Latitude":50.8307,"Longitude":0.0306},{"Name":"Southend (Any)","CrsCode":"152","Latitude":null,"Longitude":null},{"Name":"Southend Airport","CrsCode":"SIA","Latitude":51.5687,"Longitude":0.704084},{"Name":"Southend Central","CrsCode":"SOC","Latitude":51.536972,"Longitude":0.712305},{"Name":"Southend East","CrsCode":"SOE","Latitude":51.5392342,"Longitude":0.731196},{"Name":"Southend Victoria","CrsCode":"SOV","Latitude":51.54239,"Longitude":0.711184},{"Name":"Southminster","CrsCode":"SMN","Latitude":51.6608734,"Longitude":0.835397},{"Name":"Southport","CrsCode":"SOP","Latitude":53.6466,"Longitude":-3.002229},{"Name":"Southsea Hoverport","CrsCode":"SHV","Latitude":null,"Longitude":null},{"Name":"Southwick","CrsCode":"SWK","Latitude":50.8329277,"Longitude":-0.236254},{"Name":"Southwold Bus","CrsCode":"XSO","Latitude":null,"Longitude":null},{"Name":"Sowerby Bridge","CrsCode":"SOW","Latitude":53.7078857,"Longitude":-1.90756},{"Name":"Spalding","CrsCode":"SPA","Latitude":52.7884178,"Longitude":-0.156722},{"Name":"Spean Bridge","CrsCode":"SBR","Latitude":56.88984,"Longitude":-4.920321},{"Name":"Spital","CrsCode":"SPI","Latitude":53.33987,"Longitude":-2.993903},{"Name":"Spondon","CrsCode":"SPO","Latitude":52.9122658,"Longitude":-1.410627},{"Name":"Spooner Row","CrsCode":"SPN","Latitude":52.5350571,"Longitude":1.086088},{"Name":"Spring Road","CrsCode":"SRI","Latitude":52.44392,"Longitude":-1.83666},{"Name":"Springburn","CrsCode":"SPR","Latitude":55.8813629,"Longitude":-4.230064},{"Name":"Springfield","CrsCode":"SPF","Latitude":56.2951164,"Longitude":-3.051808},{"Name":"Squires Gate","CrsCode":"SQU","Latitude":53.7767563,"Longitude":-3.049403},{"Name":"St Albans Abbey","CrsCode":"SAA","Latitude":51.7446747,"Longitude":-0.342422},{"Name":"St Albans City","CrsCode":"SAC","Latitude":51.74883,"Longitude":-0.326842},{"Name":"St Andrews Bus","CrsCode":"SAO","Latitude":null,"Longitude":null},{"Name":"St Andrews Road","CrsCode":"SAR","Latitude":51.5132141,"Longitude":-2.696009},{"Name":"St Annes-On-The-Sea","CrsCode":"SAS","Latitude":53.7533836,"Longitude":-3.029662},{"Name":"St Austell","CrsCode":"SAU","Latitude":50.3388634,"Longitude":-4.789557},{"Name":"St Bees","CrsCode":"SBS","Latitude":54.492466,"Longitude":-3.591263},{"Name":"St Budeaux (Any)","CrsCode":"145","Latitude":null,"Longitude":null},{"Name":"St Budeaux Ferry Road","CrsCode":"SBF","Latitude":50.40124,"Longitude":-4.186661},{"Name":"St Budeaux Victoria Road","CrsCode":"SBV","Latitude":50.4030075,"Longitude":-4.188144},{"Name":"St Columb Road","CrsCode":"SCR","Latitude":50.3990021,"Longitude":-4.94085},{"Name":"St Denys","CrsCode":"SDN","Latitude":50.9219971,"Longitude":-1.3882},{"Name":"St Erth","CrsCode":"SER","Latitude":50.1710739,"Longitude":-5.443694},{"Name":"St Germans","CrsCode":"SGM","Latitude":50.3943863,"Longitude":-4.308757},{"Name":"St Helens (Any)","CrsCode":"146","Latitude":null,"Longitude":null},{"Name":"St Helens Central","CrsCode":"SNH","Latitude":53.4531174,"Longitude":-2.730328},{"Name":"St Helens Junction","CrsCode":"SHJ","Latitude":53.4335251,"Longitude":-2.699892},{"Name":"St Helier (Surrey)","CrsCode":"SIH","Latitude":51.3899345,"Longitude":-0.199115},{"Name":"St Ives (Cornwall)","CrsCode":"SIV","Latitude":50.20876,"Longitude":-5.477247},{"Name":"St James Park (Exeter)","CrsCode":"SJP","Latitude":50.7310944,"Longitude":-3.523202},{"Name":"St James Street (Walthamstow)","CrsCode":"SJS","Latitude":51.5806122,"Longitude":-0.032804},{"Name":"St Johns (London)","CrsCode":"SAJ","Latitude":51.4689369,"Longitude":-0.023225},{"Name":"St Keyne Wishing Well Halt","CrsCode":"SKN","Latitude":50.4227142,"Longitude":-4.462204},{"Name":"St Leonards (Any)","CrsCode":"147","Latitude":null,"Longitude":null},{"Name":"St Leonards Warrior Square","CrsCode":"SLQ","Latitude":50.85594,"Longitude":0.560326},{"Name":"St Margarets (Herts)","CrsCode":"SMT","Latitude":51.7877731,"Longitude":0.000837},{"Name":"St Margarets (London)","CrsCode":"SMG","Latitude":51.45469,"Longitude":-0.320352},{"Name":"St Mary Cray","CrsCode":"SMY","Latitude":51.3947144,"Longitude":0.107269},{"Name":"St Michaels","CrsCode":"STM","Latitude":53.37565,"Longitude":-2.952704},{"Name":"St Neots","CrsCode":"SNO","Latitude":52.2314377,"Longitude":-0.247244},{"Name":"St Peters","CrsCode":"STZ","Latitude":54.91066,"Longitude":-1.38387},{"Name":"Stadium Of Light","CrsCode":"STI","Latitude":54.9178352,"Longitude":-1.383751},{"Name":"Stafford","CrsCode":"STA","Latitude":52.8044662,"Longitude":-2.123088},{"Name":"Staines","CrsCode":"SNS","Latitude":51.4328728,"Longitude":-0.502415},{"Name":"Stallingborough","CrsCode":"SLL","Latitude":53.58716,"Longitude":-0.182581},{"Name":"Stalybridge","CrsCode":"SYB","Latitude":53.48447,"Longitude":-2.06264},{"Name":"Stamford (Lincs)","CrsCode":"SMD","Latitude":52.6473579,"Longitude":-0.480474},{"Name":"Stamford Hill","CrsCode":"SMH","Latitude":51.5750351,"Longitude":-0.076343},{"Name":"Stanford-Le-Hope","CrsCode":"SFO","Latitude":51.5136337,"Longitude":0.422634},{"Name":"Stanlow And Thornton","CrsCode":"SNT","Latitude":53.2779961,"Longitude":-2.841318},{"Name":"Stansted (Any)","CrsCode":"153","Latitude":null,"Longitude":null},{"Name":"Stansted Airport","CrsCode":"SSD","Latitude":51.88898,"Longitude":0.26162},{"Name":"Stansted Mountfitchet","CrsCode":"SST","Latitude":51.9014969,"Longitude":0.199642},{"Name":"Staplehurst","CrsCode":"SPU","Latitude":51.1718559,"Longitude":0.55061},{"Name":"Stapleton Road","CrsCode":"SRD","Latitude":51.4680519,"Longitude":-2.565747},{"Name":"Starbeck","CrsCode":"SBE","Latitude":53.9990044,"Longitude":-1.501116},{"Name":"Starcross","CrsCode":"SCS","Latitude":50.62773,"Longitude":-3.447757},{"Name":"Staveley (Cumbria)","CrsCode":"SVL","Latitude":54.37563,"Longitude":-2.818961},{"Name":"Stechford","CrsCode":"SCF","Latitude":52.48524,"Longitude":-1.810006},{"Name":"Steeton And Silsden","CrsCode":"SON","Latitude":53.9002571,"Longitude":-1.946704},{"Name":"Stepps","CrsCode":"SPS","Latitude":55.8900261,"Longitude":-4.147389},{"Name":"Stevenage","CrsCode":"SVG","Latitude":51.899025,"Longitude":-0.206437},{"Name":"Stevenston","CrsCode":"STV","Latitude":55.6335335,"Longitude":-4.749829},{"Name":"Stewartby","CrsCode":"SWR","Latitude":52.06974,"Longitude":-0.520596},{"Name":"Stewarton","CrsCode":"STT","Latitude":55.681633,"Longitude":-4.519346},{"Name":"Stirling","CrsCode":"STG","Latitude":56.1191139,"Longitude":-3.934915},{"Name":"Stockport","CrsCode":"SPT","Latitude":53.4049,"Longitude":-2.162419},{"Name":"Stocksfield","CrsCode":"SKS","Latitude":54.94635,"Longitude":-1.917227},{"Name":"Stocksmoor","CrsCode":"SSM","Latitude":53.59435,"Longitude":-1.723478},{"Name":"Stockton","CrsCode":"STK","Latitude":54.56971,"Longitude":-1.31784},{"Name":"Stoke Mandeville","CrsCode":"SKM","Latitude":51.78772,"Longitude":-0.783575},{"Name":"Stoke Newington","CrsCode":"SKW","Latitude":51.56508,"Longitude":-0.07244},{"Name":"Stoke-On-Trent","CrsCode":"SOT","Latitude":53.00801,"Longitude":-2.181119},{"Name":"Stone (Staffs)","CrsCode":"SNE","Latitude":52.90832,"Longitude":-2.154951},{"Name":"Stone Crossing","CrsCode":"SCG","Latitude":51.4520531,"Longitude":0.263924},{"Name":"Stone Grnvle Sq","CrsCode":"SGQ","Latitude":null,"Longitude":null},{"Name":"Stonebridge Park","CrsCode":"SBP","Latitude":51.54396,"Longitude":-0.275233},{"Name":"Stonegate","CrsCode":"SOG","Latitude":51.0201836,"Longitude":0.364016},{"Name":"Stonehaven","CrsCode":"STN","Latitude":56.96689,"Longitude":-2.225286},{"Name":"Stonehouse","CrsCode":"SHU","Latitude":51.74603,"Longitude":-2.279516},{"Name":"Stoneleigh","CrsCode":"SNL","Latitude":51.3637,"Longitude":-0.247546},{"Name":"Stourbridge (Any)","CrsCode":"154","Latitude":null,"Longitude":null},{"Name":"Stourbridge Junction","CrsCode":"SBJ","Latitude":52.4475632,"Longitude":-2.133857},{"Name":"Stourbridge Town","CrsCode":"SBT","Latitude":52.45654,"Longitude":-2.142716},{"Name":"Stow","CrsCode":"SOI","Latitude":55.6914,"Longitude":-2.857782},{"Name":"Stowmarket","CrsCode":"SMK","Latitude":52.1901054,"Longitude":1.000662},{"Name":"Stranraer","CrsCode":"STR","Latitude":54.909626,"Longitude":-5.024806},{"Name":"Stratford (London)","CrsCode":"SRA","Latitude":51.54236,"Longitude":-0.004175},{"Name":"Stratford International","CrsCode":"SFA","Latitude":51.5443077,"Longitude":-0.009882},{"Name":"Stratford-Upon-Avon","CrsCode":"SAV","Latitude":52.19376,"Longitude":-1.716148},{"Name":"Stratford-Upon-Avon (Any)","CrsCode":"344","Latitude":null,"Longitude":null},{"Name":"Stratford-Upon-Avon Parkway","CrsCode":"STY","Latitude":52.20642,"Longitude":-1.7307},{"Name":"Strathcarron","CrsCode":"STC","Latitude":57.4225845,"Longitude":-5.429166},{"Name":"Strawberry Hill","CrsCode":"STW","Latitude":51.439682,"Longitude":-0.339597},{"Name":"Streatham (Any)","CrsCode":"155","Latitude":null,"Longitude":null},{"Name":"Streatham (Greater London)","CrsCode":"STE","Latitude":51.4257545,"Longitude":-0.131535},{"Name":"Streatham Common","CrsCode":"SRC","Latitude":51.41863,"Longitude":-0.136136},{"Name":"Streatham Hill","CrsCode":"SRH","Latitude":51.43829,"Longitude":-0.128136},{"Name":"Streethouse","CrsCode":"SHC","Latitude":53.67616,"Longitude":-1.399346},{"Name":"Strines","CrsCode":"SRN","Latitude":53.37493,"Longitude":-2.033544},{"Name":"Stromeferry","CrsCode":"STF","Latitude":57.3526878,"Longitude":-5.550702},{"Name":"Strood (Kent)","CrsCode":"SOO","Latitude":51.396,"Longitude":0.4998},{"Name":"Stroud (Gloucs)","CrsCode":"STD","Latitude":51.7443581,"Longitude":-2.218673},{"Name":"Sturry","CrsCode":"STU","Latitude":51.3010178,"Longitude":1.121644},{"Name":"Styal","CrsCode":"SYA","Latitude":53.3481369,"Longitude":-2.240313},{"Name":"Sudbury (Suffolk)","CrsCode":"SUY","Latitude":52.03559,"Longitude":0.735111},{"Name":"Sudbury And Harrow Road","CrsCode":"SUD","Latitude":51.55446,"Longitude":-0.316676},{"Name":"Sudbury Harrow (Any)","CrsCode":"156","Latitude":null,"Longitude":null},{"Name":"Sudbury Hill Harrow","CrsCode":"SDH","Latitude":51.5584221,"Longitude":-0.336092},{"Name":"Sugar Loaf","CrsCode":"SUG","Latitude":52.0822372,"Longitude":-3.686991},{"Name":"Summerston","CrsCode":"SUM","Latitude":55.89835,"Longitude":-4.283814},{"Name":"Sunbury","CrsCode":"SUU","Latitude":51.4182625,"Longitude":-0.416611},{"Name":"Sunderland","CrsCode":"SUN","Latitude":54.90617,"Longitude":-1.382357},{"Name":"Sundridge Park","CrsCode":"SUP","Latitude":51.4133377,"Longitude":0.020402},{"Name":"Sunningdale","CrsCode":"SNG","Latitude":51.39131,"Longitude":-0.633135},{"Name":"Sunnymeads","CrsCode":"SNY","Latitude":51.47045,"Longitude":-0.558781},{"Name":"Surbiton","CrsCode":"SUR","Latitude":51.3924065,"Longitude":-0.303942},{"Name":"Surrey Quays","CrsCode":"SQE","Latitude":51.49279,"Longitude":0.048114},{"Name":"Sutton (London)","CrsCode":"SUO","Latitude":51.3601265,"Longitude":-0.190223},{"Name":"Sutton Coldfield","CrsCode":"SUT","Latitude":52.56527,"Longitude":-1.824404},{"Name":"Sutton Common","CrsCode":"SUC","Latitude":51.37552,"Longitude":-0.196799},{"Name":"Sutton Parkway","CrsCode":"SPK","Latitude":53.12211,"Longitude":-1.236385},{"Name":"Swaffham (By Bus)","CrsCode":"SWB","Latitude":null,"Longitude":null},{"Name":"Swale","CrsCode":"SWL","Latitude":51.3904343,"Longitude":0.748194},{"Name":"Swanley","CrsCode":"SAY","Latitude":51.3927269,"Longitude":0.16755},{"Name":"Swanscombe","CrsCode":"SWM","Latitude":51.4493561,"Longitude":0.309854},{"Name":"Swansea","CrsCode":"SWA","Latitude":51.625103,"Longitude":-3.941598},{"Name":"Swanwick","CrsCode":"SNW","Latitude":50.8754272,"Longitude":-1.265151},{"Name":"Sway","CrsCode":"SWY","Latitude":50.7844543,"Longitude":-1.609864},{"Name":"Swaythling","CrsCode":"SWG","Latitude":50.94172,"Longitude":-1.376552},{"Name":"Swinderby","CrsCode":"SWD","Latitude":53.16873,"Longitude":-0.702985},{"Name":"Swindon (Wilts)","CrsCode":"SWI","Latitude":51.5654373,"Longitude":-1.786448},{"Name":"Swineshead","CrsCode":"SWE","Latitude":52.969593,"Longitude":-0.186255},{"Name":"Swinton (Manchester)","CrsCode":"SNN","Latitude":53.51482,"Longitude":-2.337384},{"Name":"Swinton (South Yorks)","CrsCode":"SWN","Latitude":53.487484,"Longitude":-1.305195},{"Name":"Sydenham (Any)","CrsCode":"158","Latitude":null,"Longitude":null},{"Name":"Sydenham (London)","CrsCode":"SYD","Latitude":51.4272079,"Longitude":-0.055232},{"Name":"Sydenham Hill","CrsCode":"SYH","Latitude":51.4330025,"Longitude":-0.079444},{"Name":"Syon Lane","CrsCode":"SYL","Latitude":51.4817352,"Longitude":-0.325116},{"Name":"Syston","CrsCode":"SYS","Latitude":52.69311,"Longitude":-1.082611},{"Name":"Tackley","CrsCode":"TAC","Latitude":51.88118,"Longitude":-1.297202},{"Name":"Tadworth","CrsCode":"TAD","Latitude":51.29158,"Longitude":-0.235953},{"Name":"Tadworth (The Avenue By Bus)","CrsCode":"TTA","Latitude":null,"Longitude":null},{"Name":"Taffs Well","CrsCode":"TAF","Latitude":51.5408478,"Longitude":-3.263129},{"Name":"Tain","CrsCode":"TAI","Latitude":57.81465,"Longitude":-4.051826},{"Name":"Tal-Y-Cafn","CrsCode":"TLC","Latitude":53.2284431,"Longitude":-3.818606},{"Name":"Talsarnau","CrsCode":"TAL","Latitude":52.90429,"Longitude":-4.068213},{"Name":"Talybont","CrsCode":"TLB","Latitude":52.7725067,"Longitude":-4.097534},{"Name":"Tame Bridge Parkway","CrsCode":"TAB","Latitude":52.55102,"Longitude":-1.974899},{"Name":"Tamworth","CrsCode":"TAM","Latitude":52.63737,"Longitude":-1.687083},{"Name":"Taplow","CrsCode":"TAP","Latitude":51.52353,"Longitude":-0.681474},{"Name":"Tattenham Corner","CrsCode":"TAT","Latitude":51.3087654,"Longitude":-0.242456},{"Name":"Taunton","CrsCode":"TAU","Latitude":51.023613,"Longitude":-3.102146},{"Name":"Taynuilt","CrsCode":"TAY","Latitude":56.4307137,"Longitude":-5.23868},{"Name":"Teddington","CrsCode":"TED","Latitude":51.4242935,"Longitude":-0.332965},{"Name":"Teesside Airport","CrsCode":"TEA","Latitude":54.5181465,"Longitude":-1.425305},{"Name":"Teignmouth","CrsCode":"TGM","Latitude":50.5479927,"Longitude":-3.494712},{"Name":"Telford Central","CrsCode":"TFC","Latitude":52.6787643,"Longitude":-2.440744},{"Name":"Templecombe","CrsCode":"TMC","Latitude":51.0010834,"Longitude":-2.417532},{"Name":"Templemore","CrsCode":"TEM","Latitude":null,"Longitude":null},{"Name":"Tenby","CrsCode":"TEN","Latitude":51.6728973,"Longitude":-4.707348},{"Name":"Teynham","CrsCode":"TEY","Latitude":51.33325,"Longitude":0.807944},{"Name":"Thames Ditton","CrsCode":"THD","Latitude":51.3884239,"Longitude":-0.340027},{"Name":"Thatcham","CrsCode":"THA","Latitude":51.39384,"Longitude":-1.243048},{"Name":"Thatto Heath","CrsCode":"THH","Latitude":53.4365845,"Longitude":-2.759419},{"Name":"The Hawthorns","CrsCode":"THW","Latitude":52.5051651,"Longitude":-1.96313},{"Name":"The Lakes (Warks)","CrsCode":"TLK","Latitude":52.359436,"Longitude":-1.845782},{"Name":"Theale","CrsCode":"THE","Latitude":51.4333954,"Longitude":-1.074968},{"Name":"Theobalds Grove","CrsCode":"TEO","Latitude":51.69216,"Longitude":-0.035216},{"Name":"Thetford","CrsCode":"TTF","Latitude":52.419384,"Longitude":0.744109},{"Name":"Thirsk","CrsCode":"THI","Latitude":54.22849,"Longitude":-1.372573},{"Name":"Thornaby","CrsCode":"TBY","Latitude":54.5597343,"Longitude":-1.301006},{"Name":"Thornastown","CrsCode":"THM","Latitude":null,"Longitude":null},{"Name":"Thorne (Any)","CrsCode":"159","Latitude":null,"Longitude":null},{"Name":"Thorne North","CrsCode":"TNN","Latitude":53.61633,"Longitude":-0.972006},{"Name":"Thorne South","CrsCode":"TNS","Latitude":53.6027069,"Longitude":-0.957227},{"Name":"Thornford","CrsCode":"THO","Latitude":50.911377,"Longitude":-2.57889},{"Name":"Thornliebank","CrsCode":"THB","Latitude":55.8106422,"Longitude":-4.312201},{"Name":"Thornton Abbey","CrsCode":"TNA","Latitude":53.6539421,"Longitude":-0.323458},{"Name":"Thornton Heath","CrsCode":"TTH","Latitude":51.39918,"Longitude":-0.100981},{"Name":"Thorntonhall","CrsCode":"THT","Latitude":55.767746,"Longitude":-4.250674},{"Name":"Thorpe Bay","CrsCode":"TPB","Latitude":51.5375862,"Longitude":0.762828},{"Name":"Thorpe Culvert","CrsCode":"TPC","Latitude":53.1231079,"Longitude":0.19982},{"Name":"Thorpe-Le-Soken","CrsCode":"TLS","Latitude":51.8477,"Longitude":1.162258},{"Name":"Three Bridges","CrsCode":"TBD","Latitude":51.1168633,"Longitude":-0.161162},{"Name":"Three Oaks","CrsCode":"TOK","Latitude":50.9006577,"Longitude":0.612558},{"Name":"Thurgarton","CrsCode":"THU","Latitude":53.02924,"Longitude":-0.962157},{"Name":"Thurles","CrsCode":"TUS","Latitude":null,"Longitude":null},{"Name":"Thurnscoe","CrsCode":"THC","Latitude":53.5450325,"Longitude":-1.308775},{"Name":"Thurso","CrsCode":"THS","Latitude":58.59009,"Longitude":-3.527548},{"Name":"Thurston","CrsCode":"TRS","Latitude":52.2497,"Longitude":0.808347},{"Name":"Tilbury (Any)","CrsCode":"160","Latitude":null,"Longitude":null},{"Name":"Tilbury Riverside","CrsCode":"TBR","Latitude":51.4518623,"Longitude":0.36467},{"Name":"Tilbury Town","CrsCode":"TIL","Latitude":51.46288,"Longitude":0.353724},{"Name":"Tile Hill","CrsCode":"THL","Latitude":52.3948,"Longitude":-1.594357},{"Name":"Tilehurst","CrsCode":"TLH","Latitude":51.4713326,"Longitude":-1.029754},{"Name":"Tipperary","CrsCode":"TPY","Latitude":null,"Longitude":null},{"Name":"Tipton","CrsCode":"TIP","Latitude":52.53039,"Longitude":-2.065499},{"Name":"Tir-Phil","CrsCode":"TIR","Latitude":51.72086,"Longitude":-3.246424},{"Name":"Tisbury","CrsCode":"TIS","Latitude":51.060257,"Longitude":-2.078456},{"Name":"Tiverton Parkway","CrsCode":"TVP","Latitude":50.9174767,"Longitude":-3.359979},{"Name":"Todmorden","CrsCode":"TOD","Latitude":53.71361,"Longitude":-2.099977},{"Name":"Tolworth","CrsCode":"TOL","Latitude":51.37677,"Longitude":-0.280098},{"Name":"Ton Pentre","CrsCode":"TPN","Latitude":51.64794,"Longitude":-3.485801},{"Name":"Tonbridge","CrsCode":"TON","Latitude":51.19113,"Longitude":0.269715},{"Name":"Tondu","CrsCode":"TDU","Latitude":51.5484924,"Longitude":-3.595064},{"Name":"Tonfanau","CrsCode":"TNF","Latitude":52.61379,"Longitude":-4.123919},{"Name":"Tonypandy","CrsCode":"TNP","Latitude":51.61961,"Longitude":-3.450216},{"Name":"Tooting","CrsCode":"TOO","Latitude":51.4199142,"Longitude":-0.16053},{"Name":"Topsham","CrsCode":"TOP","Latitude":50.68599,"Longitude":-3.4637},{"Name":"Torquay","CrsCode":"TQY","Latitude":50.4610138,"Longitude":-3.544095},{"Name":"Torre","CrsCode":"TRR","Latitude":50.4726639,"Longitude":-3.547292},{"Name":"Totnes","CrsCode":"TOT","Latitude":50.4356232,"Longitude":-3.688317},{"Name":"Tottenham Hale","CrsCode":"TOM","Latitude":51.5882568,"Longitude":-0.059914},{"Name":"Totton","CrsCode":"TTN","Latitude":50.9179535,"Longitude":-1.482138},{"Name":"Town Green","CrsCode":"TWN","Latitude":53.54281,"Longitude":-2.9045},{"Name":"Trafford Park","CrsCode":"TRA","Latitude":53.4549,"Longitude":-2.310836},{"Name":"Tralee","CrsCode":"TRL","Latitude":null,"Longitude":null},{"Name":"Trefforest","CrsCode":"TRF","Latitude":51.59142,"Longitude":-3.325157},{"Name":"Trefforest (Any)","CrsCode":"162","Latitude":null,"Longitude":null},{"Name":"Trefforest Estate","CrsCode":"TRE","Latitude":51.5684166,"Longitude":-3.2913},{"Name":"Trehafod","CrsCode":"TRH","Latitude":51.60966,"Longitude":-3.380569},{"Name":"Treherbert","CrsCode":"TRB","Latitude":51.6715775,"Longitude":-3.53575},{"Name":"Treorchy","CrsCode":"TRY","Latitude":51.6575928,"Longitude":-3.504922},{"Name":"Trimley","CrsCode":"TRM","Latitude":51.97651,"Longitude":1.318431},{"Name":"Tring","CrsCode":"TRI","Latitude":51.8003273,"Longitude":-0.622253},{"Name":"Troed-Y-Rhiw ","CrsCode":"TRD","Latitude":51.71257,"Longitude":-3.346066},{"Name":"Troon","CrsCode":"TRN","Latitude":55.543045,"Longitude":-4.654731},{"Name":"Trowbridge","CrsCode":"TRO","Latitude":51.3199539,"Longitude":-2.215222},{"Name":"Truro","CrsCode":"TRU","Latitude":50.2636032,"Longitude":-5.063017},{"Name":"Tullamore","CrsCode":"TUM","Latitude":null,"Longitude":null},{"Name":"Tulloch","CrsCode":"TUL","Latitude":56.8839836,"Longitude":-4.701509},{"Name":"Tulse Hill","CrsCode":"TUH","Latitude":51.4397125,"Longitude":-0.10506},{"Name":"Tunbridge Wells","CrsCode":"TBW","Latitude":51.13012,"Longitude":0.262435},{"Name":"Turkey Street","CrsCode":"TUR","Latitude":51.67348,"Longitude":-0.047594},{"Name":"Tutbury And Hatton","CrsCode":"TUT","Latitude":52.86434,"Longitude":-1.682085},{"Name":"Tweedbank","CrsCode":"TWB","Latitude":55.604393,"Longitude":-2.764936},{"Name":"Twickenham","CrsCode":"TWI","Latitude":51.45032,"Longitude":-0.329136},{"Name":"Twyford","CrsCode":"TWY","Latitude":51.475605,"Longitude":-0.86389},{"Name":"Ty Croes","CrsCode":"TYC","Latitude":53.2228851,"Longitude":-4.476033},{"Name":"Ty Glas","CrsCode":"TGS","Latitude":51.519104,"Longitude":-3.193341},{"Name":"Tygwyn","CrsCode":"TYG","Latitude":52.8933067,"Longitude":-4.079579},{"Name":"Tyndrum (Any)","CrsCode":"163","Latitude":null,"Longitude":null},{"Name":"Tyndrum Lower","CrsCode":"TYL","Latitude":56.4334068,"Longitude":-4.714873},{"Name":"Tyseley","CrsCode":"TYS","Latitude":52.45382,"Longitude":-1.839568},{"Name":"Tywyn","CrsCode":"TYW","Latitude":52.5846634,"Longitude":-4.092974},{"Name":"Uckfield","CrsCode":"UCK","Latitude":50.96865,"Longitude":0.095048},{"Name":"Uddingston","CrsCode":"UDD","Latitude":55.82367,"Longitude":-4.086266},{"Name":"Ulceby","CrsCode":"ULC","Latitude":53.6194572,"Longitude":-0.30063},{"Name":"Ulleskelf","CrsCode":"ULL","Latitude":53.85276,"Longitude":-1.215536},{"Name":"Ulverston","CrsCode":"ULV","Latitude":54.19187,"Longitude":-3.097327},{"Name":"Umberleigh","CrsCode":"UMB","Latitude":50.9967041,"Longitude":-3.982228},{"Name":"University (Birmingham)","CrsCode":"UNI","Latitude":52.4512177,"Longitude":-1.936691},{"Name":"Uphall","CrsCode":"UHA","Latitude":55.9193954,"Longitude":-3.499279},{"Name":"Upholland","CrsCode":"UPL","Latitude":53.52819,"Longitude":-2.741346},{"Name":"Upminster","CrsCode":"UPM","Latitude":51.5593071,"Longitude":0.251938},{"Name":"Upper Halliford","CrsCode":"UPH","Latitude":51.4130363,"Longitude":-0.429722},{"Name":"Upper Holloway","CrsCode":"UHL","Latitude":51.563652,"Longitude":-0.129293},{"Name":"Upper Tyndrum","CrsCode":"UTY","Latitude":56.43455,"Longitude":-4.7036},{"Name":"Upper Warlingham","CrsCode":"UWL","Latitude":51.307972,"Longitude":-0.077498},{"Name":"Upton (Merseyside)","CrsCode":"UPT","Latitude":53.38571,"Longitude":-3.084013},{"Name":"Upwey","CrsCode":"UPW","Latitude":50.64838,"Longitude":-2.466731},{"Name":"Urmston","CrsCode":"URM","Latitude":53.448204,"Longitude":-2.35344},{"Name":"Uttoxeter","CrsCode":"UTT","Latitude":52.89704,"Longitude":-1.857258},{"Name":"Valley","CrsCode":"VAL","Latitude":53.28128,"Longitude":-4.563436},{"Name":"Vauxhall","CrsCode":"VXH","Latitude":51.4856873,"Longitude":-0.124025},{"Name":"Virginia Water","CrsCode":"VIR","Latitude":51.4012566,"Longitude":-0.562389},{"Name":"Vt Catering","CrsCode":"I200","Latitude":null,"Longitude":null},{"Name":"Waddon","CrsCode":"WDO","Latitude":51.36706,"Longitude":-0.116688},{"Name":"Wadebridge Bus","CrsCode":"WBE","Latitude":null,"Longitude":null},{"Name":"Wadhurst","CrsCode":"WAD","Latitude":51.07338,"Longitude":0.312483},{"Name":"Wainfleet","CrsCode":"WFL","Latitude":53.1053734,"Longitude":0.234774},{"Name":"Wakefield (Any)","CrsCode":"164","Latitude":null,"Longitude":null},{"Name":"Wakefield Kirkgate","CrsCode":"WKK","Latitude":53.67897,"Longitude":-1.488254},{"Name":"Wakefield Westgate","CrsCode":"WKF","Latitude":53.681736,"Longitude":-1.506386},{"Name":"Walkden","CrsCode":"WKD","Latitude":53.5203133,"Longitude":-2.395128},{"Name":"Wallasey (Any)","CrsCode":"165","Latitude":null,"Longitude":null},{"Name":"Wallasey Grove Road","CrsCode":"WLG","Latitude":53.4280472,"Longitude":-3.06982},{"Name":"Wallasey Village","CrsCode":"WLV","Latitude":53.4226952,"Longitude":-3.069901},{"Name":"Wallington","CrsCode":"WLT","Latitude":51.360424,"Longitude":-0.151431},{"Name":"Wallyford","CrsCode":"WAF","Latitude":55.94232,"Longitude":-3.013417},{"Name":"Walmer","CrsCode":"WAM","Latitude":51.2038078,"Longitude":1.382819},{"Name":"Walsall","CrsCode":"WSL","Latitude":52.5842819,"Longitude":-1.98521},{"Name":"Walsden","CrsCode":"WDN","Latitude":53.6960564,"Longitude":-2.104719},{"Name":"Waltham Cross","CrsCode":"WLC","Latitude":51.6848335,"Longitude":-0.026846},{"Name":"Walthamstow (Any)","CrsCode":"166","Latitude":null,"Longitude":null},{"Name":"Walthamstow Central","CrsCode":"WHC","Latitude":51.58309,"Longitude":-0.019715},{"Name":"Walthamstow Queens Road","CrsCode":"WMW","Latitude":51.5813675,"Longitude":-0.024113},{"Name":"Walton (Any)","CrsCode":"187","Latitude":null,"Longitude":null},{"Name":"Walton (Merseyside)","CrsCode":"WAO","Latitude":53.4563446,"Longitude":-2.965794},{"Name":"Walton-On-Thames","CrsCode":"WAL","Latitude":51.372364,"Longitude":-0.413873},{"Name":"Walton-On-The-Naze","CrsCode":"WON","Latitude":51.8466034,"Longitude":1.268192},{"Name":"Wanborough","CrsCode":"WAN","Latitude":51.24513,"Longitude":-0.66756},{"Name":"Wandsworth (Any)","CrsCode":"167","Latitude":null,"Longitude":null},{"Name":"Wandsworth Common","CrsCode":"WSW","Latitude":51.44607,"Longitude":-0.165239},{"Name":"Wandsworth Road","CrsCode":"WWR","Latitude":51.47083,"Longitude":-0.138332},{"Name":"Wandsworth Town","CrsCode":"WNT","Latitude":51.46081,"Longitude":-0.187679},{"Name":"Wanstead Park","CrsCode":"WNP","Latitude":51.5517464,"Longitude":0.025089},{"Name":"Wapping","CrsCode":"WPE","Latitude":51.50372,"Longitude":-0.05629},{"Name":"Warblington","CrsCode":"WBL","Latitude":50.8533821,"Longitude":-0.967163},{"Name":"Ware (Herts)","CrsCode":"WAR","Latitude":51.8080559,"Longitude":-0.028729},{"Name":"Wareham (Dorset)","CrsCode":"WRM","Latitude":50.6924248,"Longitude":-2.114646},{"Name":"Wargrave","CrsCode":"WGV","Latitude":51.49822,"Longitude":-0.876589},{"Name":"Warminster","CrsCode":"WMN","Latitude":51.2067223,"Longitude":-2.177467},{"Name":"Warnham","CrsCode":"WNH","Latitude":51.0933,"Longitude":-0.329193},{"Name":"Warrington (Any)","CrsCode":"168","Latitude":null,"Longitude":null},{"Name":"Warrington Bank Quay","CrsCode":"WBQ","Latitude":53.38551,"Longitude":-2.602871},{"Name":"Warrington Central","CrsCode":"WAC","Latitude":53.3918571,"Longitude":-2.592434},{"Name":"Warrington West","CrsCode":"WAW","Latitude":null,"Longitude":null},{"Name":"Warwick","CrsCode":"WRW","Latitude":52.28686,"Longitude":-1.582155},{"Name":"Warwick Parkway","CrsCode":"WRP","Latitude":52.2862663,"Longitude":-1.613493},{"Name":"Water Orton","CrsCode":"WTO","Latitude":52.51838,"Longitude":-1.743538},{"Name":"Waterbeach","CrsCode":"WBC","Latitude":52.26268,"Longitude":0.196555},{"Name":"Waterford","CrsCode":"WFD","Latitude":null,"Longitude":null},{"Name":"Wateringbury","CrsCode":"WTR","Latitude":51.2492142,"Longitude":0.423039},{"Name":"Waterloo (Merseyside)","CrsCode":"WLO","Latitude":53.474968,"Longitude":-3.025532},{"Name":"Watford (Any)","CrsCode":"169","Latitude":null,"Longitude":null},{"Name":"Watford High Street","CrsCode":"WFH","Latitude":51.6527443,"Longitude":-0.391656},{"Name":"Watford Junction","CrsCode":"WFJ","Latitude":51.663475,"Longitude":-0.396506},{"Name":"Watford North","CrsCode":"WFN","Latitude":51.675087,"Longitude":-0.3903},{"Name":"Watlington","CrsCode":"WTG","Latitude":52.6727028,"Longitude":0.382736},{"Name":"Watton-At-Stone","CrsCode":"WAS","Latitude":51.8572,"Longitude":-0.119521},{"Name":"Waun-Gron Park","CrsCode":"WNG","Latitude":51.4863663,"Longitude":-3.228492},{"Name":"Wavertree Technology Park","CrsCode":"WAV","Latitude":53.4051323,"Longitude":-2.922964},{"Name":"Wedgwood","CrsCode":"WED","Latitude":52.95184,"Longitude":-2.171135},{"Name":"Weeley","CrsCode":"WEE","Latitude":51.8525658,"Longitude":1.114661},{"Name":"Weeton","CrsCode":"WET","Latitude":53.9238129,"Longitude":-1.581206},{"Name":"Welham Green","CrsCode":"WMG","Latitude":51.7363243,"Longitude":-0.209989},{"Name":"Welling","CrsCode":"WLI","Latitude":51.4649658,"Longitude":0.101872},{"Name":"Wellingborough","CrsCode":"WEL","Latitude":52.3038673,"Longitude":-0.676496},{"Name":"Wellington (Shropshire)","CrsCode":"WLN","Latitude":52.7009277,"Longitude":-2.516438},{"Name":"Welshpool","CrsCode":"WLP","Latitude":52.6569977,"Longitude":-3.141297},{"Name":"Welwyn (Any)","CrsCode":"170","Latitude":null,"Longitude":null},{"Name":"Welwyn Garden City","CrsCode":"WGC","Latitude":51.8009567,"Longitude":-0.203081},{"Name":"Welwyn North","CrsCode":"WLW","Latitude":51.8241653,"Longitude":-0.191992},{"Name":"Wem","CrsCode":"WEM","Latitude":52.8562927,"Longitude":-2.718784},{"Name":"Wembley (Any)","CrsCode":"171","Latitude":null,"Longitude":null},{"Name":"Wembley Central","CrsCode":"WMB","Latitude":51.5514679,"Longitude":-0.296592},{"Name":"Wembley Stadium","CrsCode":"WCX","Latitude":51.5539932,"Longitude":-0.284958},{"Name":"Wemyss Bay","CrsCode":"WMS","Latitude":55.8766556,"Longitude":-4.888525},{"Name":"Wendover","CrsCode":"WND","Latitude":51.76193,"Longitude":-0.747778},{"Name":"Wennington","CrsCode":"WNN","Latitude":54.12353,"Longitude":-2.587517},{"Name":"West Allerton","CrsCode":"WSA","Latitude":53.36912,"Longitude":-2.907},{"Name":"West Brompton","CrsCode":"WBP","Latitude":51.48729,"Longitude":-0.195265},{"Name":"West Byfleet","CrsCode":"WBY","Latitude":51.3393936,"Longitude":-0.505468},{"Name":"West Calder","CrsCode":"WCL","Latitude":55.8538475,"Longitude":-3.567045},{"Name":"West Cowes","CrsCode":"WTW","Latitude":null,"Longitude":null},{"Name":"West Croydon","CrsCode":"WCY","Latitude":51.3785172,"Longitude":-0.101844},{"Name":"West Drayton","CrsCode":"WDT","Latitude":51.5098267,"Longitude":-0.472515},{"Name":"West Dulwich","CrsCode":"WDU","Latitude":51.4403877,"Longitude":-0.090646},{"Name":"West Ealing","CrsCode":"WEA","Latitude":51.5131226,"Longitude":-0.320792},{"Name":"West Ham","CrsCode":"WEH","Latitude":51.52871,"Longitude":0.005323},{"Name":"West Hampstead","CrsCode":"WHD","Latitude":51.54711,"Longitude":-0.191016},{"Name":"West Hampstead Thameslink","CrsCode":"WHP","Latitude":51.548645,"Longitude":-0.1924},{"Name":"West Horndon","CrsCode":"WHR","Latitude":51.56744,"Longitude":0.341807},{"Name":"West Kilbride","CrsCode":"WKB","Latitude":55.6968422,"Longitude":-4.851365},{"Name":"West Kirby","CrsCode":"WKI","Latitude":53.3731728,"Longitude":-3.183771},{"Name":"West Malling","CrsCode":"WMA","Latitude":51.291584,"Longitude":0.418098},{"Name":"West Norwood","CrsCode":"WNW","Latitude":51.4315834,"Longitude":-0.102517},{"Name":"West Ruislip","CrsCode":"WRU","Latitude":51.56971,"Longitude":-0.437812},{"Name":"West Runton","CrsCode":"WRN","Latitude":52.9354973,"Longitude":1.245516},{"Name":"West St Leonards","CrsCode":"WLD","Latitude":50.85368,"Longitude":0.540303},{"Name":"West Sutton","CrsCode":"WSU","Latitude":51.3657341,"Longitude":-0.20437},{"Name":"West Wickham","CrsCode":"WWI","Latitude":51.3815765,"Longitude":-0.015495},{"Name":"West Worthing","CrsCode":"WWO","Latitude":50.81811,"Longitude":-0.392983},{"Name":"Westbury","CrsCode":"WSB","Latitude":51.26693,"Longitude":-2.199202},{"Name":"Westcliff","CrsCode":"WCF","Latitude":51.5374374,"Longitude":0.692146},{"Name":"Westcombe Park","CrsCode":"WCB","Latitude":51.48443,"Longitude":0.017787},{"Name":"Westenhanger","CrsCode":"WHA","Latitude":51.0954437,"Longitude":1.037775},{"Name":"Wester Hailes","CrsCode":"WTA","Latitude":55.9137268,"Longitude":-3.284654},{"Name":"Westerfield","CrsCode":"WFI","Latitude":52.0814171,"Longitude":1.167082},{"Name":"Westerton","CrsCode":"WES","Latitude":55.90548,"Longitude":-4.335444},{"Name":"Westgate-On-Sea","CrsCode":"WGA","Latitude":51.3813858,"Longitude":1.338402},{"Name":"Westhoughton","CrsCode":"WHG","Latitude":53.5557747,"Longitude":-2.523773},{"Name":"Weston Milton","CrsCode":"WNM","Latitude":51.34858,"Longitude":-2.942236},{"Name":"Weston-Super-Mare","CrsCode":"WSM","Latitude":51.34454,"Longitude":-2.972301},{"Name":"Westport","CrsCode":"WPT","Latitude":null,"Longitude":null},{"Name":"Wetheral","CrsCode":"WRL","Latitude":54.88331,"Longitude":-2.833897},{"Name":"Wexford","CrsCode":"WXF","Latitude":null,"Longitude":null},{"Name":"Weybridge","CrsCode":"WYB","Latitude":51.361248,"Longitude":-0.457352},{"Name":"Weymouth","CrsCode":"WEY","Latitude":50.61515,"Longitude":-2.455103},{"Name":"Whaley Bridge","CrsCode":"WBR","Latitude":53.3304024,"Longitude":-1.983448},{"Name":"Whalley (Lancs)","CrsCode":"WHE","Latitude":53.8241653,"Longitude":-2.412186},{"Name":"Whatstandwell","CrsCode":"WTS","Latitude":53.0830765,"Longitude":-1.504312},{"Name":"Whifflet","CrsCode":"WFF","Latitude":55.8525963,"Longitude":-4.022313},{"Name":"Whimple","CrsCode":"WHM","Latitude":50.7682533,"Longitude":-3.354243},{"Name":"Whinhill","CrsCode":"WNL","Latitude":55.9383965,"Longitude":-4.746744},{"Name":"Whiston","CrsCode":"WHN","Latitude":53.4139328,"Longitude":-2.796407},{"Name":"Whitby","CrsCode":"WTB","Latitude":54.4846153,"Longitude":-0.615376},{"Name":"Whitby Bus","CrsCode":"WTZ","Latitude":null,"Longitude":null},{"Name":"Whitchurch (Cardiff)","CrsCode":"WHT","Latitude":51.5206,"Longitude":-3.222209},{"Name":"Whitchurch (Hampshire)","CrsCode":"WCH","Latitude":51.23736,"Longitude":-1.338183},{"Name":"Whitchurch (Shropshire)","CrsCode":"WTC","Latitude":52.96805,"Longitude":-2.671497},{"Name":"White Hart Lane","CrsCode":"WHL","Latitude":51.60462,"Longitude":-0.070759},{"Name":"White Notley","CrsCode":"WNY","Latitude":51.83907,"Longitude":0.596874},{"Name":"Whitechapel","CrsCode":"ZLW","Latitude":51.5190926,"Longitude":-0.061404},{"Name":"Whitecraigs","CrsCode":"WCR","Latitude":55.79,"Longitude":-4.310977},{"Name":"Whitehaven","CrsCode":"WTH","Latitude":54.5528641,"Longitude":-3.586843},{"Name":"Whitland","CrsCode":"WTL","Latitude":51.81799,"Longitude":-4.614454},{"Name":"Whitley Bridge","CrsCode":"WBD","Latitude":53.6986847,"Longitude":-1.159331},{"Name":"Whitlocks End","CrsCode":"WTE","Latitude":52.3918,"Longitude":-1.851545},{"Name":"Whitstable","CrsCode":"WHI","Latitude":51.3582039,"Longitude":1.033577},{"Name":"Whittlesea","CrsCode":"WLE","Latitude":52.5495224,"Longitude":-0.116602},{"Name":"Whittlesford Parkway","CrsCode":"WLF","Latitude":52.10409,"Longitude":0.165388},{"Name":"Whitton (London)","CrsCode":"WTN","Latitude":51.44711,"Longitude":-0.356607},{"Name":"Whitwell (Derbyshire)","CrsCode":"WWL","Latitude":53.2809868,"Longitude":-1.20055},{"Name":"Whyteleafe","CrsCode":"WHY","Latitude":51.3098335,"Longitude":-0.081725},{"Name":"Whyteleafe (Any)","CrsCode":"172","Latitude":null,"Longitude":null},{"Name":"Whyteleafe South","CrsCode":"WHS","Latitude":51.3034744,"Longitude":-0.077684},{"Name":"Wick","CrsCode":"WCK","Latitude":58.4417877,"Longitude":-3.097965},{"Name":"Wickford","CrsCode":"WIC","Latitude":51.6150246,"Longitude":0.519052},{"Name":"Wickham Market","CrsCode":"WCM","Latitude":52.15142,"Longitude":1.398685},{"Name":"Wicklow (Irish Rail)","CrsCode":"WKL","Latitude":null,"Longitude":null},{"Name":"Widdrington","CrsCode":"WDD","Latitude":55.24143,"Longitude":-1.61623},{"Name":"Widnes","CrsCode":"WID","Latitude":53.37849,"Longitude":-2.733556},{"Name":"Widney Manor","CrsCode":"WMR","Latitude":52.3961754,"Longitude":-1.773647},{"Name":"Wigan (Any)","CrsCode":"173","Latitude":null,"Longitude":null},{"Name":"Wigan North Western","CrsCode":"WGN","Latitude":53.5435638,"Longitude":-2.632287},{"Name":"Wigan Wallgate","CrsCode":"WGW","Latitude":53.5453529,"Longitude":-2.633814},{"Name":"Wigton","CrsCode":"WGT","Latitude":54.8293648,"Longitude":-3.164373},{"Name":"Wildmill","CrsCode":"WMI","Latitude":51.5208244,"Longitude":-3.579684},{"Name":"Willesden Junction","CrsCode":"WIJ","Latitude":51.5322,"Longitude":-0.2435},{"Name":"Williamwood","CrsCode":"WLM","Latitude":55.79398,"Longitude":-4.290462},{"Name":"Willington","CrsCode":"WIL","Latitude":52.85407,"Longitude":-1.563356},{"Name":"Wilmcote","CrsCode":"WMC","Latitude":52.22262,"Longitude":-1.755493},{"Name":"Wilmslow","CrsCode":"WML","Latitude":53.3265953,"Longitude":-2.225177},{"Name":"Wilnecote (Staffs)","CrsCode":"WNE","Latitude":52.610817,"Longitude":-1.679499},{"Name":"Wimbledon","CrsCode":"WIM","Latitude":51.4215279,"Longitude":-0.206496},{"Name":"Wimbledon (Any)","CrsCode":"174","Latitude":null,"Longitude":null},{"Name":"Wimbledon Chase","CrsCode":"WBO","Latitude":51.4099579,"Longitude":-0.214138},{"Name":"Winchelsea","CrsCode":"WSE","Latitude":50.9337158,"Longitude":0.701241},{"Name":"Winchester","CrsCode":"WIN","Latitude":51.0673027,"Longitude":-1.320628},{"Name":"Winchfield","CrsCode":"WNF","Latitude":51.28448,"Longitude":-0.90733},{"Name":"Winchmore Hill","CrsCode":"WIH","Latitude":51.6338959,"Longitude":-0.101314},{"Name":"Windermere","CrsCode":"WDM","Latitude":54.3797455,"Longitude":-2.904339},{"Name":"Windsor (Any)","CrsCode":"175","Latitude":null,"Longitude":null},{"Name":"Windsor And Eton Central","CrsCode":"WNC","Latitude":51.48275,"Longitude":-0.608806},{"Name":"Windsor And Eton Riverside","CrsCode":"WNR","Latitude":51.48631,"Longitude":-0.605804},{"Name":"Winnersh","CrsCode":"WNS","Latitude":51.43078,"Longitude":-0.87795},{"Name":"Winnersh (Any)","CrsCode":"176","Latitude":null,"Longitude":null},{"Name":"Winnersh Triangle","CrsCode":"WTI","Latitude":51.437233,"Longitude":-0.895052},{"Name":"Winsford","CrsCode":"WSF","Latitude":53.190506,"Longitude":-2.494669},{"Name":"Wisbech (Coach)","CrsCode":"WIS","Latitude":null,"Longitude":null},{"Name":"Wishaw","CrsCode":"WSH","Latitude":55.7723465,"Longitude":-3.927267},{"Name":"Witham","CrsCode":"WTM","Latitude":51.8057022,"Longitude":0.641373},{"Name":"Witley","CrsCode":"WTY","Latitude":51.13336,"Longitude":-0.645059},{"Name":"Witton (West Midlands)","CrsCode":"WTT","Latitude":52.51141,"Longitude":-1.883566},{"Name":"Wivelsfield","CrsCode":"WVF","Latitude":50.96425,"Longitude":-0.121633},{"Name":"Wivenhoe","CrsCode":"WIV","Latitude":51.85579,"Longitude":0.955116},{"Name":"Woburn Sands","CrsCode":"WOB","Latitude":52.01817,"Longitude":-0.654073},{"Name":"Woking","CrsCode":"WOK","Latitude":51.31847,"Longitude":-0.557814},{"Name":"Wokingham","CrsCode":"WKM","Latitude":51.4115562,"Longitude":-0.842473},{"Name":"Woldingham","CrsCode":"WOH","Latitude":51.289547,"Longitude":-0.051013},{"Name":"Wolverhampton","CrsCode":"WVH","Latitude":52.58782,"Longitude":-2.119529},{"Name":"Wolverton","CrsCode":"WOL","Latitude":52.06486,"Longitude":-0.80377},{"Name":"Wombwell","CrsCode":"WOM","Latitude":53.5177536,"Longitude":-1.417811},{"Name":"Wood End","CrsCode":"WDE","Latitude":52.3441429,"Longitude":-1.844372},{"Name":"Wood Street","CrsCode":"WST","Latitude":51.5872841,"Longitude":-0.00221},{"Name":"Woodbridge","CrsCode":"WDB","Latitude":52.0898552,"Longitude":1.31807},{"Name":"Woodgrange Park","CrsCode":"WGR","Latitude":51.5487061,"Longitude":0.04514},{"Name":"Woodhall","CrsCode":"WDL","Latitude":55.93134,"Longitude":-4.655614},{"Name":"Woodhouse","CrsCode":"WDH","Latitude":53.36464,"Longitude":-1.358278},{"Name":"Woodlawn (Irish Rail)","CrsCode":"WLA","Latitude":null,"Longitude":null},{"Name":"Woodlesford","CrsCode":"WDS","Latitude":53.75697,"Longitude":-1.443328},{"Name":"Woodley","CrsCode":"WLY","Latitude":53.429245,"Longitude":-2.093275},{"Name":"Woodmansterne","CrsCode":"WME","Latitude":51.31012,"Longitude":-0.154887},{"Name":"Woodsmoor","CrsCode":"WSR","Latitude":53.386055,"Longitude":-2.1413},{"Name":"Wool","CrsCode":"WOO","Latitude":50.68148,"Longitude":-2.220775},{"Name":"Woolston","CrsCode":"WLS","Latitude":50.8985558,"Longitude":-1.37713},{"Name":"Woolwich (Any)","CrsCode":"177","Latitude":null,"Longitude":null},{"Name":"Woolwich Arsenal","CrsCode":"WWA","Latitude":51.4898148,"Longitude":0.069883},{"Name":"Woolwich Dockyard","CrsCode":"WWD","Latitude":51.49099,"Longitude":0.054083},{"Name":"Wootton Wawen","CrsCode":"WWW","Latitude":52.26583,"Longitude":-1.784561},{"Name":"Worcester (Any)","CrsCode":"178","Latitude":null,"Longitude":null},{"Name":"Worcester Foregate Street","CrsCode":"WOF","Latitude":52.1948,"Longitude":-2.220885},{"Name":"Worcester Park","CrsCode":"WCP","Latitude":51.38165,"Longitude":-0.245415},{"Name":"Worcester Shrub Hill","CrsCode":"WOS","Latitude":52.1948166,"Longitude":-2.210642},{"Name":"Worcestershire Parkway","CrsCode":"WOP","Latitude":null,"Longitude":null},{"Name":"Workington","CrsCode":"WKG","Latitude":54.64506,"Longitude":-3.558626},{"Name":"Workington (Any)","CrsCode":"345","Latitude":null,"Longitude":null},{"Name":"Worksop","CrsCode":"WRK","Latitude":53.3110046,"Longitude":-1.123444},{"Name":"Worle","CrsCode":"WOR","Latitude":51.3579941,"Longitude":-2.909703},{"Name":"Worplesdon","CrsCode":"WPL","Latitude":51.28819,"Longitude":-0.581705},{"Name":"Worstead","CrsCode":"WRT","Latitude":52.777256,"Longitude":1.404282},{"Name":"Worthing","CrsCode":"WRH","Latitude":50.8187675,"Longitude":-0.375924},{"Name":"Wrabness","CrsCode":"WRB","Latitude":51.9392281,"Longitude":1.17014},{"Name":"Wraysbury","CrsCode":"WRY","Latitude":51.45766,"Longitude":-0.541906},{"Name":"Wrenbury","CrsCode":"WRE","Latitude":53.01931,"Longitude":-2.596089},{"Name":"Wressle","CrsCode":"WRS","Latitude":53.7732124,"Longitude":-0.924169},{"Name":"Wrexham (Any)","CrsCode":"180","Latitude":null,"Longitude":null},{"Name":"Wrexham Central","CrsCode":"WXC","Latitude":53.0448761,"Longitude":-2.996385},{"Name":"Wrexham General","CrsCode":"WRX","Latitude":53.05022,"Longitude":-3.002467},{"Name":"Wye","CrsCode":"WYE","Latitude":51.185463,"Longitude":0.929188},{"Name":"Wylam","CrsCode":"WYM","Latitude":54.97499,"Longitude":-1.814058},{"Name":"Wylde Green","CrsCode":"WYL","Latitude":52.5456,"Longitude":-1.831461},{"Name":"Wymondham","CrsCode":"WMD","Latitude":52.5648041,"Longitude":1.11769},{"Name":"Wythall","CrsCode":"WYT","Latitude":52.38013,"Longitude":-1.866284},{"Name":"Yalding","CrsCode":"YAL","Latitude":51.2260666,"Longitude":0.4118},{"Name":"Yardley Wood","CrsCode":"YRD","Latitude":52.42148,"Longitude":-1.854396},{"Name":"Yarm","CrsCode":"YRM","Latitude":54.506115,"Longitude":-1.35597},{"Name":"Yarmouth (Isle-Of-Wight)","CrsCode":"YMH","Latitude":50.70765,"Longitude":-1.50002},{"Name":"Yate","CrsCode":"YAE","Latitude":51.540554,"Longitude":-2.432541},{"Name":"Yatton","CrsCode":"YAT","Latitude":51.3909645,"Longitude":-2.827815},{"Name":"Yeoford","CrsCode":"YEO","Latitude":50.77684,"Longitude":-3.726109},{"Name":"Yeovil (Any)","CrsCode":"181","Latitude":null,"Longitude":null},{"Name":"Yeovil Junction","CrsCode":"YVJ","Latitude":50.9246864,"Longitude":-2.613198},{"Name":"Yeovil Pen Mill","CrsCode":"YVP","Latitude":50.9444656,"Longitude":-2.613461},{"Name":"Yetminster","CrsCode":"YET","Latitude":50.8961143,"Longitude":-2.573004},{"Name":"Ynyswen","CrsCode":"YNW","Latitude":51.6680946,"Longitude":-3.526959},{"Name":"Yoker","CrsCode":"YOK","Latitude":55.89279,"Longitude":-4.387464},{"Name":"York","CrsCode":"YRK","Latitude":53.9579659,"Longitude":-1.093159},{"Name":"Yorton","CrsCode":"YRT","Latitude":52.80901,"Longitude":-2.73645},{"Name":"Ystrad Mynach","CrsCode":"YSM","Latitude":51.6408844,"Longitude":-3.241342},{"Name":"Ystrad Rhondda","CrsCode":"YSR","Latitude":51.6444778,"Longitude":-3.47557},{"Name":"2859","CrsCode":"","Latitude":null,"Longitude":null}];});

/*!
 * Amplify 1.1.2
 *
 * Copyright 2011 - 2013 appendTo LLC. (http://appendto.com/team)
 * Dual licensed under the MIT or GPL licenses.
 * http://appendto.com/open-source-licenses
 *
 * http://amplifyjs.com
 */
(function( global, undefined ) {

var slice = [].slice,
	subscriptions = {};

var amplify = global.amplify = {
	publish: function( topic ) {
		if ( typeof topic !== "string" ) {
			throw new Error( "You must provide a valid topic to publish." );
		}

		var args = slice.call( arguments, 1 ),
			topicSubscriptions,
			subscription,
			length,
			i = 0,
			ret;

		if ( !subscriptions[ topic ] ) {
			return true;
		}

		topicSubscriptions = subscriptions[ topic ].slice();
		for ( length = topicSubscriptions.length; i < length; i++ ) {
			subscription = topicSubscriptions[ i ];
			ret = subscription.callback.apply( subscription.context, args );
			if ( ret === false ) {
				break;
			}
		}
		return ret !== false;
	},

	subscribe: function( topic, context, callback, priority ) {
		if ( typeof topic !== "string" ) {
			throw new Error( "You must provide a valid topic to create a subscription." );
		}

		if ( arguments.length === 3 && typeof callback === "number" ) {
			priority = callback;
			callback = context;
			context = null;
		}
		if ( arguments.length === 2 ) {
			callback = context;
			context = null;
		}
		priority = priority || 10;

		var topicIndex = 0,
			topics = topic.split( /\s/ ),
			topicLength = topics.length,
			added;
		for ( ; topicIndex < topicLength; topicIndex++ ) {
			topic = topics[ topicIndex ];
			added = false;
			if ( !subscriptions[ topic ] ) {
				subscriptions[ topic ] = [];
			}

			var i = subscriptions[ topic ].length - 1,
				subscriptionInfo = {
					callback: callback,
					context: context,
					priority: priority
				};

			for ( ; i >= 0; i-- ) {
				if ( subscriptions[ topic ][ i ].priority <= priority ) {
					subscriptions[ topic ].splice( i + 1, 0, subscriptionInfo );
					added = true;
					break;
				}
			}

			if ( !added ) {
				subscriptions[ topic ].unshift( subscriptionInfo );
			}
		}

		return callback;
	},

	unsubscribe: function( topic, context, callback ) {
		if ( typeof topic !== "string" ) {
			throw new Error( "You must provide a valid topic to remove a subscription." );
		}

		if ( arguments.length === 2 ) {
			callback = context;
			context = null;
		}

		if ( !subscriptions[ topic ] ) {
			return;
		}

		var length = subscriptions[ topic ].length,
			i = 0;

		for ( ; i < length; i++ ) {
			if ( subscriptions[ topic ][ i ].callback === callback ) {
				if ( !context || subscriptions[ topic ][ i ].context === context ) {
					subscriptions[ topic ].splice( i, 1 );
					
					// Adjust counter and length for removed item
					i--;
					length--;
				}
			}
		}
	}
};

}( this ) );

(function( amplify, undefined ) {

var store = amplify.store = function( key, value, options ) {
	var type = store.type;
	if ( options && options.type && options.type in store.types ) {
		type = options.type;
	}
	return store.types[ type ]( key, value, options || {} );
};

store.types = {};
store.type = null;
store.addType = function( type, storage ) {
	if ( !store.type ) {
		store.type = type;
	}

	store.types[ type ] = storage;
	store[ type ] = function( key, value, options ) {
		options = options || {};
		options.type = type;
		return store( key, value, options );
	};
};
store.error = function() {
	return "amplify.store quota exceeded";
};

var rprefix = /^__amplify__/;
function createFromStorageInterface( storageType, storage ) {
	store.addType( storageType, function( key, value, options ) {
		var storedValue, parsed, i, remove,
			ret = value,
			now = (new Date()).getTime();

		if ( !key ) {
			ret = {};
			remove = [];
			i = 0;
			try {
				// accessing the length property works around a localStorage bug
				// in Firefox 4.0 where the keys don't update cross-page
				// we assign to key just to avoid Closure Compiler from removing
				// the access as "useless code"
				// https://bugzilla.mozilla.org/show_bug.cgi?id=662511
				key = storage.length;

				while ( key = storage.key( i++ ) ) {
					if ( rprefix.test( key ) ) {
						parsed = JSON.parse( storage.getItem( key ) );
						if ( parsed.expires && parsed.expires <= now ) {
							remove.push( key );
						} else {
							ret[ key.replace( rprefix, "" ) ] = parsed.data;
						}
					}
				}
				while ( key = remove.pop() ) {
					storage.removeItem( key );
				}
			} catch ( error ) {}
			return ret;
		}

		// protect against name collisions with direct storage
		key = "__amplify__" + key;

		if ( value === undefined ) {
			storedValue = storage.getItem( key );
			parsed = storedValue ? JSON.parse( storedValue ) : { expires: -1 };
			if ( parsed.expires && parsed.expires <= now ) {
				storage.removeItem( key );
			} else {
				return parsed.data;
			}
		} else {
			if ( value === null ) {
				storage.removeItem( key );
			} else {
				parsed = JSON.stringify({
					data: value,
					expires: options.expires ? now + options.expires : null
				});
				try {
					storage.setItem( key, parsed );
				// quota exceeded
				} catch( error ) {
					// expire old data and try again
					store[ storageType ]();
					try {
						storage.setItem( key, parsed );
					} catch( error ) {
						throw store.error();
					}
				}
			}
		}

		return ret;
	});
}

// localStorage + sessionStorage
// IE 8+, Firefox 3.5+, Safari 4+, Chrome 4+, Opera 10.5+, iPhone 2+, Android 2+
for ( var webStorageType in { localStorage: 1, sessionStorage: 1 } ) {
	// try/catch for file protocol in Firefox and Private Browsing in Safari 5
	try {
		// Safari 5 in Private Browsing mode exposes localStorage
		// but doesn't allow storing data, so we attempt to store and remove an item.
		// This will unfortunately give us a false negative if we're at the limit.
		window[ webStorageType ].setItem( "__amplify__", "x" );
		window[ webStorageType ].removeItem( "__amplify__" );
		createFromStorageInterface( webStorageType, window[ webStorageType ] );
	} catch( e ) {}
}

// globalStorage
// non-standard: Firefox 2+
// https://developer.mozilla.org/en/dom/storage#globalStorage
if ( !store.types.localStorage && window.globalStorage ) {
	// try/catch for file protocol in Firefox
	try {
		createFromStorageInterface( "globalStorage",
			window.globalStorage[ window.location.hostname ] );
		// Firefox 2.0 and 3.0 have sessionStorage and globalStorage
		// make sure we default to globalStorage
		// but don't default to globalStorage in 3.5+ which also has localStorage
		if ( store.type === "sessionStorage" ) {
			store.type = "globalStorage";
		}
	} catch( e ) {}
}

// userData
// non-standard: IE 5+
// http://msdn.microsoft.com/en-us/library/ms531424(v=vs.85).aspx
(function() {
	// IE 9 has quirks in userData that are a huge pain
	// rather than finding a way to detect these quirks
	// we just don't register userData if we have localStorage
	if ( store.types.localStorage ) {
		return;
	}

	// append to html instead of body so we can do this from the head
	var div = document.createElement( "div" ),
		attrKey = "amplify";
	div.style.display = "none";
	document.getElementsByTagName( "head" )[ 0 ].appendChild( div );

	// we can't feature detect userData support
	// so just try and see if it fails
	// surprisingly, even just adding the behavior isn't enough for a failure
	// so we need to load the data as well
	try {
		div.addBehavior( "#default#userdata" );
		div.load( attrKey );
	} catch( e ) {
		div.parentNode.removeChild( div );
		return;
	}

	store.addType( "userData", function( key, value, options ) {
		div.load( attrKey );
		var attr, parsed, prevValue, i, remove,
			ret = value,
			now = (new Date()).getTime();

		if ( !key ) {
			ret = {};
			remove = [];
			i = 0;
			while ( attr = div.XMLDocument.documentElement.attributes[ i++ ] ) {
				parsed = JSON.parse( attr.value );
				if ( parsed.expires && parsed.expires <= now ) {
					remove.push( attr.name );
				} else {
					ret[ attr.name ] = parsed.data;
				}
			}
			while ( key = remove.pop() ) {
				div.removeAttribute( key );
			}
			div.save( attrKey );
			return ret;
		}

		// convert invalid characters to dashes
		// http://www.w3.org/TR/REC-xml/#NT-Name
		// simplified to assume the starting character is valid
		// also removed colon as it is invalid in HTML attribute names
		key = key.replace( /[^\-._0-9A-Za-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u037f-\u1fff\u200c-\u200d\u203f\u2040\u2070-\u218f]/g, "-" );
		// adjust invalid starting character to deal with our simplified sanitization
		key = key.replace( /^-/, "_-" );

		if ( value === undefined ) {
			attr = div.getAttribute( key );
			parsed = attr ? JSON.parse( attr ) : { expires: -1 };
			if ( parsed.expires && parsed.expires <= now ) {
				div.removeAttribute( key );
			} else {
				return parsed.data;
			}
		} else {
			if ( value === null ) {
				div.removeAttribute( key );
			} else {
				// we need to get the previous value in case we need to rollback
				prevValue = div.getAttribute( key );
				parsed = JSON.stringify({
					data: value,
					expires: (options.expires ? (now + options.expires) : null)
				});
				div.setAttribute( key, parsed );
			}
		}

		try {
			div.save( attrKey );
		// quota exceeded
		} catch ( error ) {
			// roll the value back to the previous value
			if ( prevValue === null ) {
				div.removeAttribute( key );
			} else {
				div.setAttribute( key, prevValue );
			}

			// expire old data and try again
			store.userData();
			try {
				div.setAttribute( key, parsed );
				div.save( attrKey );
			} catch ( error ) {
				// roll the value back to the previous value
				if ( prevValue === null ) {
					div.removeAttribute( key );
				} else {
					div.setAttribute( key, prevValue );
				}
				throw store.error();
			}
		}
		return ret;
	});
}() );

// in-memory storage
// fallback for all browsers to enable the API even if we can't persist data
(function() {
	var memory = {},
		timeout = {};

	function copy( obj ) {
		return obj === undefined ? undefined : JSON.parse( JSON.stringify( obj ) );
	}

	store.addType( "memory", function( key, value, options ) {
		if ( !key ) {
			return copy( memory );
		}

		if ( value === undefined ) {
			return copy( memory[ key ] );
		}

		if ( timeout[ key ] ) {
			clearTimeout( timeout[ key ] );
			delete timeout[ key ];
		}

		if ( value === null ) {
			delete memory[ key ];
			return null;
		}

		memory[ key ] = value;
		if ( options.expires ) {
			timeout[ key ] = setTimeout(function() {
				delete memory[ key ];
				delete timeout[ key ];
			}, options.expires );
		}

		return value;
	});
}() );

}( this.amplify = this.amplify || {} ) );

/*global amplify*/

(function( amplify, undefined ) {


function noop() {}
function isFunction( obj ) {
	return ({}).toString.call( obj ) === "[object Function]";
}

function async( fn ) {
	var isAsync = false;
	setTimeout(function() {
		isAsync = true;
	}, 1 );
	return function() {
		var that = this,
			args = arguments;
		if ( isAsync ) {
			fn.apply( that, args );
		} else {
			setTimeout(function() {
				fn.apply( that, args );
			}, 1 );
		}
	};
}

amplify.request = function( resourceId, data, callback ) {
	// default to an empty hash just so we can handle a missing resourceId
	// in one place
	var settings = resourceId || {};

	if ( typeof settings === "string" ) {
		if ( isFunction( data ) ) {
			callback = data;
			data = {};
		}
		settings = {
			resourceId: resourceId,
			data: data || {},
			success: callback
		};
	}

	var request = { abort: noop },
		resource = amplify.request.resources[ settings.resourceId ],
		success = settings.success || noop,
		error = settings.error || noop;

	settings.success = async( function( data, status ) {
		status = status || "success";
		amplify.publish( "request.success", settings, data, status );
		amplify.publish( "request.complete", settings, data, status );
		success( data, status );
	});

	settings.error = async( function( data, status ) {
		status = status || "error";
		amplify.publish( "request.error", settings, data, status );
		amplify.publish( "request.complete", settings, data, status );
		error( data, status );
	});

	if ( !resource ) {
		if ( !settings.resourceId ) {
			throw "amplify.request: no resourceId provided";
		}
		throw "amplify.request: unknown resourceId: " + settings.resourceId;
	}

	if ( !amplify.publish( "request.before", settings ) ) {
		settings.error( null, "abort" );
		return;
	}

	amplify.request.resources[ settings.resourceId ]( settings, request );
	return request;
};

amplify.request.types = {};
amplify.request.resources = {};
amplify.request.define = function( resourceId, type, settings ) {
	if ( typeof type === "string" ) {
		if ( !( type in amplify.request.types ) ) {
			throw "amplify.request.define: unknown type: " + type;
		}

		settings.resourceId = resourceId;
		amplify.request.resources[ resourceId ] =
			amplify.request.types[ type ]( settings );
	} else {
		// no pre-processor or settings for one-off types (don't invoke)
		amplify.request.resources[ resourceId ] = type;
	}
};

}( amplify ) );


(function( amplify, $, undefined ) {


var xhrProps = [ "status", "statusText", "responseText", "responseXML", "readyState" ],
		rurlData = /\{([^\}]+)\}/g;

amplify.request.types.ajax = function( defnSettings ) {
	defnSettings = $.extend({
		type: "GET"
	}, defnSettings );

	return function( settings, request ) {
		var xhr, handleResponse,
			url = defnSettings.url,
			abort = request.abort,
			ajaxSettings = $.extend( true, {}, defnSettings, { data: settings.data } ),
			aborted = false,
			ampXHR = {
				readyState: 0,
				setRequestHeader: function( name, value ) {
					return xhr.setRequestHeader( name, value );
				},
				getAllResponseHeaders: function() {
					return xhr.getAllResponseHeaders();
				},
				getResponseHeader: function( key ) {
					return xhr.getResponseHeader( key );
				},
				overrideMimeType: function( type ) {
					return xhr.overrideMimeType( type );
				},
				abort: function() {
					aborted = true;
					try {
						xhr.abort();
					// IE 7 throws an error when trying to abort
					} catch( e ) {}
					handleResponse( null, "abort" );
				},
				success: function( data, status ) {
					settings.success( data, status );
				},
				error: function( data, status ) {
					settings.error( data, status );
				}
			};

		handleResponse = function( data, status ) {
			$.each( xhrProps, function( i, key ) {
				try {
					ampXHR[ key ] = xhr[ key ];
				} catch( e ) {}
			});
			// Playbook returns "HTTP/1.1 200 OK"
			// TODO: something also returns "OK", what?
			if ( /OK$/.test( ampXHR.statusText ) ) {
				ampXHR.statusText = "success";
			}
			if ( data === undefined ) {
				// TODO: add support for ajax errors with data
				data = null;
			}
			if ( aborted ) {
				status = "abort";
			}
			if ( /timeout|error|abort/.test( status ) ) {
				ampXHR.error( data, status );
			} else {
				ampXHR.success( data, status );
			}
			// avoid handling a response multiple times
			// this can happen if a request is aborted
			// TODO: figure out if this breaks polling or multi-part responses
			handleResponse = $.noop;
		};

		amplify.publish( "request.ajax.preprocess",
			defnSettings, settings, ajaxSettings, ampXHR );

		$.extend( ajaxSettings, {
			isJSONP: function () {
				return (/jsonp/gi).test(this.dataType);
			},
			cacheURL: function () {
				if (!this.isJSONP()) {
					return this.url;
				}

				var callbackName = 'callback';

				// possible for the callback function name to be overridden
				if (this.hasOwnProperty('jsonp')) {
					if (this.jsonp !== false) {
						callbackName = this.jsonp;
					} else {
						if (this.hasOwnProperty('jsonpCallback')) {
							callbackName = this.jsonpCallback;
						}
					}
				}

				// search and replace callback parameter in query string with empty string
				var callbackRegex = new RegExp('&?' + callbackName + '=[^&]*&?', 'gi');
				return this.url.replace(callbackRegex, '');
			},
			success: function( data, status ) {
				handleResponse( data, status );
			},
			error: function( _xhr, status ) {
				handleResponse( null, status );
			},
			beforeSend: function( _xhr, _ajaxSettings ) {
				xhr = _xhr;
				ajaxSettings = _ajaxSettings;
				var ret = defnSettings.beforeSend ?
					defnSettings.beforeSend.call( this, ampXHR, ajaxSettings ) : true;
				return ret && amplify.publish( "request.before.ajax",
					defnSettings, settings, ajaxSettings, ampXHR );
			}
		});

		// cache all JSONP requests
		if (ajaxSettings.cache && ajaxSettings.isJSONP()) {
			$.extend(ajaxSettings, {
				cache: true
			});
		}

		$.ajax( ajaxSettings );

		request.abort = function() {
			ampXHR.abort();
			abort.call( this );
		};
	};
};



amplify.subscribe( "request.ajax.preprocess", function( defnSettings, settings, ajaxSettings ) {
	var mappedKeys = [],
		data = ajaxSettings.data;

	if ( typeof data === "string" ) {
		return;
	}

	data = $.extend( true, {}, defnSettings.data, data );

	ajaxSettings.url = ajaxSettings.url.replace( rurlData, function ( m, key ) {
		if ( key in data ) {
			mappedKeys.push( key );
			return data[ key ];
		}
	});

	// We delete the keys later so duplicates are still replaced
	$.each( mappedKeys, function ( i, key ) {
		delete data[ key ];
	});

	ajaxSettings.data = data;
});



amplify.subscribe( "request.ajax.preprocess", function( defnSettings, settings, ajaxSettings ) {
	var data = ajaxSettings.data,
		dataMap = defnSettings.dataMap;

	if ( !dataMap || typeof data === "string" ) {
		return;
	}

	if ( $.isFunction( dataMap ) ) {
		ajaxSettings.data = dataMap( data );
	} else {
		$.each( defnSettings.dataMap, function( orig, replace ) {
			if ( orig in data ) {
				data[ replace ] = data[ orig ];
				delete data[ orig ];
			}
		});
		ajaxSettings.data = data;
	}
});



var cache = amplify.request.cache = {
	_key: function( resourceId, url, data ) {
		data = url + data;
		var length = data.length,
			i = 0;

		/*jshint bitwise:false*/
		function chunk() {
			return data.charCodeAt( i++ ) << 24 |
				data.charCodeAt( i++ ) << 16 |
				data.charCodeAt( i++ ) << 8 |
				data.charCodeAt( i++ ) << 0;
		}

		var checksum = chunk();
		while ( i < length ) {
			checksum ^= chunk();
		}
		/*jshint bitwise:true*/

		return "request-" + resourceId + "-" + checksum;
	},

	_default: (function() {
		var memoryStore = {};
		return function( resource, settings, ajaxSettings, ampXHR ) {
			// data is already converted to a string by the time we get here
			var cacheKey = cache._key( settings.resourceId,
					ajaxSettings.cacheURL(), ajaxSettings.data ),
				duration = resource.cache;

			if ( cacheKey in memoryStore ) {
				ampXHR.success( memoryStore[ cacheKey ] );
				return false;
			}
			var success = ampXHR.success;
			ampXHR.success = function( data ) {
				memoryStore[ cacheKey ] = data;
				if ( typeof duration === "number" ) {
					setTimeout(function() {
						delete memoryStore[ cacheKey ];
					}, duration );
				}
				success.apply( this, arguments );
			};
		};
	}())
};

if ( amplify.store ) {
	$.each( amplify.store.types, function( type ) {
		cache[ type ] = function( resource, settings, ajaxSettings, ampXHR ) {
			var cacheKey = cache._key( settings.resourceId,
					ajaxSettings.cacheURL(), ajaxSettings.data ),
				cached = amplify.store[ type ]( cacheKey );

			if ( cached ) {
				ajaxSettings.success( cached );
				return false;
			}
			var success = ampXHR.success;
			ampXHR.success = function( data ) {
				amplify.store[ type ]( cacheKey, data, { expires: resource.cache.expires } );
				success.apply( this, arguments );
			};
		};
	});
	cache.persist = cache[ amplify.store.type ];
}

amplify.subscribe( "request.before.ajax", function( resource ) {
	var cacheType = resource.cache;
	if ( cacheType ) {
		// normalize between objects and strings/booleans/numbers
		cacheType = cacheType.type || cacheType;
		return cache[ cacheType in cache ? cacheType : "_default" ]
			.apply( this, arguments );
	}
});



amplify.request.decoders = {
	// http://labs.omniti.com/labs/jsend
	jsend: function( data, status, ampXHR, success, error ) {
		if ( data.status === "success" ) {
			success( data.data );
		} else if ( data.status === "fail" ) {
			error( data.data, "fail" );
		} else if ( data.status === "error" ) {
			delete data.status;
			error( data, "error" );
		} else {
			error( null, "error" );
		}
	}
};

amplify.subscribe( "request.before.ajax", function( resource, settings, ajaxSettings, ampXHR ) {
	var _success = ampXHR.success,
		_error = ampXHR.error,
		decoder = $.isFunction( resource.decoder ) ?
			resource.decoder :
			resource.decoder in amplify.request.decoders ?
				amplify.request.decoders[ resource.decoder ] :
				amplify.request.decoders._default;

	if ( !decoder ) {
		return;
	}

	function success( data, status ) {
		_success( data, status );
	}
	function error( data, status ) {
		_error( data, status );
	}
	ampXHR.success = function( data, status ) {
		decoder( data, status, ampXHR, success, error );
	};
	ampXHR.error = function( data, status ) {
		decoder( data, status, ampXHR, success, error );
	};
});

}( amplify, jQuery ) );

define("amplify", ["jquery"], (function (global) {
    return function () {
        var ret, fn;
        return ret || global.amplify;
    };
}(this)));

/*!
 * jQuery-ajaxTransport-XDomainRequest - v1.0.4 - 2015-03-05
 * https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest
 * Copyright (c) 2015 Jason Moon (@JSONMOON)
 * Licensed MIT (/blob/master/LICENSE.txt)
 */
(function(a){if(typeof define==='function'&&define.amd){define('jQueryXDomainRequest',['jquery'],a)}else if(typeof exports==='object'){module.exports=a(require('jquery'))}else{a(jQuery)}}(function($){if($.support.cors||!$.ajaxTransport||!window.XDomainRequest){return $}var n=/^(https?:)?\/\//i;var o=/^get|post$/i;var p=new RegExp('^(\/\/|'+location.protocol+')','i');$.ajaxTransport('* text html xml json',function(j,k,l){if(!j.crossDomain||!j.async||!o.test(j.type)||!n.test(j.url)||!p.test(j.url)){return}var m=null;return{send:function(f,g){var h='';var i=(k.dataType||'').toLowerCase();m=new XDomainRequest();if(/^\d+$/.test(k.timeout)){m.timeout=k.timeout}m.ontimeout=function(){g(500,'timeout')};m.onload=function(){var a='Content-Length: '+m.responseText.length+'\r\nContent-Type: '+m.contentType;var b={code:200,message:'success'};var c={text:m.responseText};try{if(i==='html'||/text\/html/i.test(m.contentType)){c.html=m.responseText}else if(i==='json'||(i!=='text'&&/\/json/i.test(m.contentType))){try{c.json=$.parseJSON(m.responseText)}catch(e){b.code=500;b.message='parseerror'}}else if(i==='xml'||(i!=='text'&&/\/xml/i.test(m.contentType))){var d=new ActiveXObject('Microsoft.XMLDOM');d.async=false;try{d.loadXML(m.responseText)}catch(e){d=undefined}if(!d||!d.documentElement||d.getElementsByTagName('parsererror').length){b.code=500;b.message='parseerror';throw'Invalid XML: '+m.responseText;}c.xml=d}}catch(parseMessage){throw parseMessage;}finally{g(b.code,b.message,c,a)}};m.onprogress=function(){};m.onerror=function(){g(500,'error',{text:m.responseText})};if(k.data){h=($.type(k.data)==='string')?k.data:$.param(k.data)}m.open(j.type,j.url);m.send(h)},abort:function(){if(m){m.abort()}}}});return $}));
define('requests', ['jquery','amplify', 'context', 'jQueryXDomainRequest'],
    function ($,amplify, context, jQueryXDomainRequest) {
       
        amplify.request.define('RailcardForPICO', 'ajax', {
            url: context.environment.commonApiUrl + '/api/sitecoredatacontent/contents?qtttype=pico',
            dataType: 'json',
            type: 'GET',
            contentType: 'application/json; charset=utf-8'
        });
        amplify.request.define('allstationForPICO', 'ajax', {
            url: context.environment.AllstationForPICO + '/BaseConfig/SearchLocationAsync',
            dataType: 'json',
            type: 'GET',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('stations', 'ajax', {
            url: context.environment.commonApiUrl + '/api/stations',
            dataType: 'json',
            type: 'GET',
            contentType: 'application/json; charset=utf-8'
        });
        amplify.request.define('swrstations', 'ajax', {
            url: context.environment.commonApiUrl + '/api/swrstations',
            dataType: 'json',
            type: 'GET',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('indexedStations', 'ajax', {
            url: context.environment.commonApiUrl + '/api/StationsIndex/{alphabet}',
            dataType: 'json',
            type: 'GET',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('worldlineStations', 'ajax', {
            url: context.environment.commonApiUrl + '/api/rail/locations',
            dataType: 'json',
            type: 'GET',
            contentType: 'application/json; charset=utf-8'
        });

      amplify.request.define('worldlineStationsPICO', 'ajax', {
          url: context.environment.commonApiUrl + '/picoapi/BaseConfig/SearchLocationAsync',
            dataType: 'json',
            type: 'GET',
            contentType: 'application/json; charset=utf-8'
        });


        amplify.request.define('railcards', 'ajax', {
            url: context.environment.commonApiUrl + '/api/rail/railcards',
            dataType: 'json',
            type: 'GET',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('routeStatus', 'ajax', {
            url: context.environment.commonApiUrl + '/api/routeinfo',
            dataType: 'json',
            type: 'GET',
            cache: false,
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('plannedworks', 'ajax', {
            url: context.environment.commonApiUrl + '/api/overallstatus/plannedworks',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('stationArrivals', 'ajax', {
            url: context.environment.railinfoApiUrl + '/journey/arrivals/{stationName}',
            dataType: 'json',
            type: 'GET',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('stationDepartures', 'ajax', {
            url: context.environment.railinfoApiUrl + '/journey/departures/{stationName}',
            dataType: 'json',
            type: 'GET',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('journeyServices', 'ajax', {
            url: context.environment.railinfoApiUrl + '/journey/services',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('journeySearch', 'ajax', {
            url: context.environment.railinfoApiUrl + '/journey/search',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('callingPoints', 'ajax', {
            url: context.environment.railinfoApiUrl + '/journey/callingpoints',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('competitionForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/competition',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('newsletterForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/newsletter',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('signupForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/signup',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('faultReportForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/FaultReport',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('contactusForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/contactus',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('offerForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/offer',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('sendDataToAWS', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/SendDataToAWS',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });
		
		amplify.request.define('reportACrimeForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/reportACrime',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('compensationForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/compensation',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('assistedTravelForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/assistedTravel',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('complaintForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/complaint',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('filmingRequestForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/filmingRequest',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('businessTravelOpenAccountDataForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/businessTravelOpenAccount',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('saveBusinessTravelBookingDataForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/businessTravelBooking',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('saveGroupTravelForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/groupTravel',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('smartApplicationForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/smartApplication',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('newsLetterSignupForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/NewsLetterSignupForm',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('gridArticles', 'ajax', {
            url: context.environment.commonApiUrl + '/renderingapi/GridArticles',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('search', 'ajax', {
            url: context.environment.commonApiUrl + '/api/search',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('lostPropertyForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/LostProperty',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('seatAvailabilityResults', 'ajax', {
            url: context.environment.commonApiUrl + '/api/seatavailability/{fromStation}/{toStation}',
            dataType: 'json',
            type: 'GET',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('seatAvailabilityStations', 'ajax', {
            url: context.environment.commonApiUrl + '/api/seatavailability/stations-to/{toStation}',
            dataType: 'json',
            type: 'GET',
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('liveInformationBoard', 'ajax', {
            url: context.environment.commonApiUrl + '/api/LiveInformationBoard',
            dataType: 'json',
            type: 'GET',
            contentType: 'application/json; charset=utf-8'
        });
		 amplify.request.define('cheapTicketForm', 'ajax', {
            url: context.environment.commonApiUrl + '/api/formsubmission/CheapTicketForm',
            dataType: 'json',
            type: 'POST',
            contentType: 'application/json; charset=utf-8'
		});
		var BaseUrlEvents = "https://www.eventbriteapi.com";
        amplify.request.define('allEventLocations', 'ajax', {
            url: BaseUrlEvents + '/v3/organizations/' + context.environment.OrganizationId + '/venues/',
			dataType: 'json',
			type: 'GET',
			headers: {
				"Authorization": "Bearer OLECJTRXBUBG5CBJ4ZAB"
			},
			contentType: 'application/json; charset=utf-8'
        });
        amplify.request.define('allEventCategories', 'ajax', {
			url: BaseUrlEvents + '/v3/categories/',
			dataType: 'json',
			type: 'GET',
			headers: {
				"Authorization": "Bearer OLECJTRXBUBG5CBJ4ZAB"
			},
			contentType: 'application/json; charset=utf-8'
        });
        amplify.request.define('allEventSubCategories', 'ajax', {
            url: BaseUrlEvents + '/v3/subcategories/',
            dataType: 'json',
            type: 'GET',
            headers: {
                "Authorization": "Bearer OLECJTRXBUBG5CBJ4ZAB"
            },
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('getEventFromVenue', 'ajax', {
            url: BaseUrlEvents + '/v3/venues/{venue_id}/events/',
            dataType: 'json',
            type: 'GET',
            headers: {
                "Authorization": "Bearer OLECJTRXBUBG5CBJ4ZAB"
            },
            contentType: 'application/json; charset=utf-8'
        });

        amplify.request.define('createEvent', 'ajax', {
            url: BaseUrlEvents + '/v3/organizations/' + context.environment.OrganizationId + '/events/',
            dataType: 'json',
          
            type: 'POST',
            headers: {
                "Authorization": "Bearer OLECJTRXBUBG5CBJ4ZAB"
            },
            contentType: 'application/json; charset=utf-8',
            decoder: function (data, status, xhr, success, error) {
                if (xhr.status === 200) {
                    success(data);
                }
                else {
                    error(xhr.responseText, xhr.statusText);
                }
            }
        });
        
        amplify.request.define('EventVenues', 'ajax', {
            url: BaseUrlEvents + '/v3/organizations/' + context.environment.OrganizationId + '/venues/',
            dataType: 'json',
            type: 'POST',
            headers: {
                "Authorization": "Bearer OLECJTRXBUBG5CBJ4ZAB"
            },
            contentType: 'application/json; charset=utf-8',
            decoder: function (data, status, xhr, success, error) {
                if (xhr.status === 200) {
                    success(data);
                }
                else {
                    error(xhr.responseText, xhr.statusText);
                }
            }
        });

    });

define('stationService', ['jquery', 'utils', 'json!mock/allstations.json', 'amplify', 'requests'],
    function ($, utils, gwrStations, amplify, requests) {

        var gwrStationsForAutocomplete = [];
        var allStationsForAutocomplete = [];

        var stationCompareBy = function (prop, a, b) {
            if (a[prop] < b[prop])
                return -1;
            if (a[prop] > b[prop])
                return 1;
            return 0;
        }

        var getWorldlineStations = function () {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'allstationForPICO',
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };
		
		  //var getWorldlineStationsPICO = function () {
    //        return $.Deferred(function (def) {
    //            amplify.request({
    //                resourceId: 'worldlineStationsPICO',
    //                success: function (response) {
    //                    def.resolve(response);
    //                },
    //                error: function () {
    //                    def.reject();
    //                }
    //            });
    //        }).promise();
    //    };

        var getStations = function (config) {
            return $.Deferred(function (def) {
                var baseStations;
                if (config && config.extraStations) {
                    getWorldlineStations().done(function (stations) {
                        baseStations = stations.data.slice(0);
                        baseStations.sort($.proxy(stationCompareBy, null, "name"));
                        def.resolve(baseStations);
                    });
                } else {
                    baseStations = gwrStations.slice(0);
                    baseStations.sort($.proxy(stationCompareBy, null, "Name"));
                    def.resolve(baseStations);
                }
            }).promise();
        };
		
		 var getStationsPICO = function (config) {
            return $.Deferred(function (def) {
				 var baseStations;
                if (config && config.extraStations) {
					 var cachedStations =  localStorage.getItem("stationList");
                         if(cachedStations != undefined && cachedStations !=null && cachedStations.length > 0)
                         {
                           baseStations =JSON.parse(cachedStations);
						    baseStations.sort($.proxy(stationCompareBy, null, "Name"));
                         def.resolve(baseStations);
                         }
     //                    else{
					//		  getWorldlineStationsPICO().done(function (stations) {
     //                      baseStations = stations.Data;
     //                    baseStations.sort($.proxy(stationCompareBy, null, "Name"));
     //                    def.resolve(baseStations);
					//	  localStorage.setItem("stationList",JSON.stringify(stations.Data));
     //               });
					//}
                   
                } else {
                     if(cachedStations != undefined && cachedStations !=null && cachedStations.length > 0)
                         {
                           baseStations = cachedStations;
                         }
                         else{
                              baseStations = gwrStations.slice(0);
                              localStorage.setItem("stationList", baseStations);
                         }
                    baseStations.sort($.proxy(stationCompareBy, null, "Name"));
                    def.resolve(baseStations);
                }
                // var baseStations;
                // if (config && config.extraStations) {
                    // getWorldlineStationsPICO().done(function (stations) {
                        // baseStations = stations.Data;
                        // baseStations.sort($.proxy(stationCompareBy, null, "Name"));
                        // def.resolve(baseStations);
                    // });
                // } else {
                    // baseStations = gwrStations.slice(0);
                    // baseStations.sort($.proxy(stationCompareBy, null, "Name"));
                    // def.resolve(baseStations);
                // }
            }).promise();
        };

        /**
         * Get an array of stations for autocomplete boxes
         * We are keeping this in memory to try and speed things up
         * @param  {object} config Config containing extra stations to add
         * @return {array}         An array of station objects
         */
        var getStationsForAutocomplete = function (config) {
            return $.Deferred(function (def) {
                var cachedStations = config && config.extraStations
                    ? allStationsForAutocomplete : gwrStationsForAutocomplete;

                if (!cachedStations || cachedStations.length === 0) {

                    var nlcAliasList = {};
                    getStations(config).done(function (stations) {
                        $(stations).each(function (index, item) {
                            if (config && config.extraStations && false) {
                                var nlc = item.nlc;
                                if (typeof nlcAliasList[nlc] == 'undefined') {
                                    nlcAliasList[nlc] = 0;
                                } else {
                                    nlc += '_alias_' + (++nlcAliasList[nlc]);
                                }

                                if (!item.code) {
                                    cachedStations.push({ text: item.name, id: nlc, CrsCode: nlc });
                                } else {
                                    cachedStations.push({ text: item.name + ' (' + item.code + ')', id: nlc, CrsCode: item.code });
                                }
                            } else {
                                cachedStations.push({ text: item.Name + ' (' + item.CrsCode + ')', id: item.CrsCode });
                            }
                        });
                        def.resolve(cachedStations);
                    });
                } else {
                    def.resolve(cachedStations);
                }
            }).promise();
        };
		
		
        var getStationsForAutocompletePICO = function () {
            return $.Deferred(function (def) {
                getWorldlineStations().done(function (stations) {
                    var allstations = [];
                    $(stations.Data).each(function (index, item) {
                        allstations.push({ Name: item.Name, CrsCode: item.Id })
                    });
                    allstationsPICO = allstations;
                    def.resolve(allstations);
                });
            }).promise();
        };

        var calculateDistanceBetweenPoints = function (latFrom, latTo, longFrom, longTo) {
            // Calculated using Spherical Law of Cosines
            var phiFrom = Math.radians(latFrom),
                phiTo = Math.radians(latTo),
                deltaLambda = Math.radians((longTo - longFrom)),
                earthRadius = 6371000; // Gives distance in metres

            return Math.acos(Math.sin(phiFrom) * Math.sin(phiTo)
                    + Math.cos(phiFrom) * Math.cos(phiTo) * Math.cos(deltaLambda)) * earthRadius;
        }

        var getNearestStation = function (longitude, latitude, stationList) {
            stationList = stationList || gwrStations;
            var currentStation = utils.firstOrDefault(stationList);
            var currentStationDist = calculateDistanceBetweenPoints(latitude, currentStation.Latitude, longitude, currentStation.Longitude);
            for (var key in stationList) {
                if (currentStation && stationList.hasOwnProperty(key)) {
                    if (calculateDistanceBetweenPoints(latitude, stationList[key].Latitude, longitude, stationList[key].Longitude) < currentStationDist) {
                        currentStation = stationList[key];
                        currentStationDist = calculateDistanceBetweenPoints(latitude, currentStation.Latitude, longitude, currentStation.Longitude);
                    }
                }
            }
            return currentStation;
        }

        var findStationByCrs = function (crsCode, stationList) {
            stationList = stationList || gwrStations;
            var results = $.grep(stationList, function (station) {
                return station.CrsCode === crsCode;
            });

            if (results && results.length > 0) {
                return results[0];
            } else {
                return {};
            }
        };

        var findStationByNlc = function (nlcCode, stationList) {
            stationList = stationList || allStationsForAutocomplete;
            var results = $.grep(stationList, function (station) {
                return station.id === nlcCode;
            });

            if (results && results.length > 0) {
                return results[0];
            } else {
                return {}
            }
        };
        var findStationByName = function (stationName, stationList) {
            stationList = stationList || gwrStations;
            var results = $.grep(stationList, function (station) {
                return station.Name.toLocaleLowerCase().replace(/(\-|\s|\()+/g, " ").replace(')', '') === stationName;
            });

            if (results && results.length > 0) {
                return results[0];
            } else {
                return {}
            }
        };


        return {
            getStations: getStations,
            getStationsForAutocomplete: getStationsForAutocomplete,
			getStationsForAutocompletePICO: getStationsForAutocompletePICO,
            findStationByCrs: findStationByCrs,
            getNearestStation: getNearestStation,
            findStationByNlc: findStationByNlc,
            findStationByName: findStationByName
        };
    });

define('koValidationExtenders', ['knockout', 'knockoutvalidation', 'context', 'dateUtils', 'stationService'],
    function (ko, knockoutvalidation, context, dateUtils, stationService) {
        ko.validation.rules['futureDate'] = {
            validator: function (val) {
                var value = ko.utils.unwrapObservable(val);
                if (value && value._isAMomentObject && value >= dateUtils.currentDate())
                    return true;

                return false;
            },
            message: 'Date and time cannot be in the past'
        };

        ko.validation.rules['noMoreThan3Months'] = {
            validator: function (val) {
                var value = ko.utils.unwrapObservable(val);
                return value && value._isAMomentObject && (value <= dateUtils.futureBookingFromNowInc());
            },
            message: 'Date cannot be more than 6 months in the future'
        };
		
		ko.validation.rules['noMoreThan15Days'] = {
            validator: function (val) {
                var value = ko.utils.unwrapObservable(val);
                return value && value._isAMomentObject && (value <= dateUtils.future15BookingFromNowInc());
            },
            message: 'Date cannot be more than 15 days in the future'
        };

        ko.validation.rules['moreThan16years'] = {
            validator: function (val) {
                var value = ko.utils.unwrapObservable(val);
                return value && value._isAMomentObject && (value <= dateUtils.addYearsToNow(-16));
            },
            message: 'You must be older than 16 years old'
        };

        ko.validation.rules['pastDate'] = {
            validator: function (val) {
                var value = ko.utils.unwrapObservable(val);

                if (value && value._isAMomentObject && value < dateUtils.currentDate())
                    return true;

                return false;
            },
            message: 'Date cannot be in the future'
        };
		
		 ko.validation.rules['endDateValidation'] = {
            validator: function (val,otherVal) {
                var value = ko.utils.unwrapObservable(val);
				  var otherDateValue = ko.utils.unwrapObservable(otherVal);

                if (value && value._isAMomentObject && otherDateValue && otherDateValue._isAMomentObject) {
                    return value > otherDateValue;
                }

                return false;
            },
            message: 'Date cannot be in the future'
        };

        ko.validation.rules['dateLaterThan'] = {
            validator: function (val, otherDate) {
                var value = ko.utils.unwrapObservable(val);
                var otherDateValue = ko.utils.unwrapObservable(otherDate);
                if (value && value._isAMomentObject && otherDateValue && otherDateValue._isAMomentObject) {
                    return value > otherDateValue;
                }
                return false;
            },
            message: function (otherDate) {
                if (otherDate && otherDate._isAMomentObject)
                    return 'Date must be later than ' + otherDate.format();

                return 'Date is too early';
            }
        };
		
		ko.validation.rules['dateLaterThanSeason'] = {
            validator: function (val, otherDate) {
                var value = ko.utils.unwrapObservable(val);
				// if(otherDate!= undefined && otherDate !=null)
				// {
					// otherDate = otherDate.clone().add(1, 'month').add(1, 'days');
				// }
                var otherDateValue = ko.utils.unwrapObservable(otherDate);
                if (value && value._isAMomentObject && otherDateValue && otherDateValue._isAMomentObject) {
                    return value >= otherDateValue;
                }
                return false;
            },
            message: function (otherDate) {
                if (otherDate && otherDate._isAMomentObject)
                    return 'Date must be later than ' + otherDate.format();

                return 'Date is too early';
            }
        };

        ko.validation.rules['isTime'] = {
            validator: function (val, config) {
                if (!val) {
                    return true;
                }

                if (val.match(/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/)) {
                    var timeSegments = val.split(':');
                    var dateObservable = (config || {}).params;
                    var dateValue = ko.utils.unwrapObservable(dateObservable);
                    if (dateUtils.isDate(dateValue) && timeSegments.length == 2) {
                        var newDate = dateValue.clone().hour(timeSegments[0]).minute(timeSegments[1]);
                        dateObservable(newDate);
                    }

                    return true;
                }

                return false;
            },
            message: 'Valid time required'
        };

        ko.validation.rules['isDate'] = {
            validator: function (val, config) {
                if (!val) {
                    return true;
                }

                if (dateUtils.isDate(val) && val.isValid()) {
                    return true;
                }

                return false;
            },
            message: 'Valid date required'
        };

        ko.validation.rules['differentThan'] = {
            validator: function (val, otherVal) {
                var value = ko.utils.unwrapObservable(val);
                var otherValue = ko.utils.unwrapObservable(otherVal);
                return value !== otherValue;
            },
            message: 'Values cannot be the same'
        };

        ko.validation.rules['crsDifferentThan'] = {
            validator: function (val, otherVal) {
                var value = ko.utils.unwrapObservable(val);
                if (value == null) return true;
                if (otherVal instanceof Array) {
                    var test = _.find(otherVal, function (stationNlc) {
                        var nlc = ko.utils.unwrapObservable(stationNlc);
                        return stationService.findStationByNlc(nlc).CrsCode === stationService.findStationByNlc(value).CrsCode;
                    });
                    return test == null;
                } else {
                    var otherValue = ko.utils.unwrapObservable(otherVal);

                    if (stationService.findStationByNlc(value + "").CrsCode == undefined || stationService.findStationByNlc(otherValue).CrsCode == undefined)
                        return value + "" !== otherValue;

                    return stationService.findStationByNlc(value + "").CrsCode !== stationService.findStationByNlc(otherValue).CrsCode;
                }
            },
            message: 'Stations cannot be the same'
        };

        ko.validation.rules['allowedFileType'] = {
            validator: function (val, checkAgainstType) {
                var value = ko.utils.unwrapObservable(val);
                if (!value) return true;
                switch (checkAgainstType) {
                    case 'sensibleImage':
                        if ((context.form.allowedImages.indexOf(val.type) == -1) || (val.size > context.form.maxFileSize))
                            return false;
                        break;
                }
                return true;
            },
            message: 'File should be of described type and not exceed maximum size'
        };

        ko.validation.rules['maxAggregatedSum'] = {
            validator: function (val, array) {
                if (!array || array.length == 0) {
                    return true;
                }

                var aggregatedSum = 0;
                for (var i = 0; i < array.length; i++) {
                    var currentValue = ko.utils.unwrapObservable(array[i]);
                    aggregatedSum += currentValue;
                }

                return val <= aggregatedSum;
            },
            message: 'Aggregated sum must be no greater than {0}'
        };

        ko.validation.rules['maxCombinedSum'] = {
            validator: function (val, params) {
                if (!params || !params.max) {
                    return true;
                }

                var combineWithValue = ko.utils.unwrapObservable(params.combineWith);
                return val + (combineWithValue || 0) <= params.max;
            },
            message: function (params) {
                return 'Combined sum must be no greater than ' + params.max;
            }
        };

        ko.validation.rules['minCombinedSum'] = {
            validator: function (val, params) {
                if (!params || !params.min) {
                    return true;
                }

                var combineWithValue = ko.utils.unwrapObservable(params.combineWith);
                return val + (combineWithValue || 0) >= params.min;
            },
            message: function (params) {
                return 'Combined sum must be not less than ' + params.min;
            }
        };

        ko.validation.rules['mustEqual'] = {
            validator: function (val, otherVal) {
                return val === otherVal;
            },
            message: 'The field must equal {0}'
        };

        ko.validation.rules['maxSize'] = {
            validator: function (val, maxSize) {
                var files = ko.utils.unwrapObservable(val);
                if (files) {
                    for (var indexFile = 0; indexFile < files.length; indexFile++) {
                        var file = files[indexFile];
                        if (file && file.size) {
                            var fileSizeKB = file.size / 1024;
                            return fileSizeKB <= maxSize;
                        }
                    }
                }

                return true;
            },
            message: 'The file should be smaller than {0} KB'
        };

        ko.validation.rules['acceptTypes'] = {
            validator: function (val, allowedTypes) {
                var files = ko.utils.unwrapObservable(val);
                for (var indexFile = 0; indexFile < files.length; indexFile++) {
                    var file = files[indexFile];
                    if (file && file.type) {
                        return allowedTypes.indexOf(file.type) > -1;
                    }

                }

                return false;
            },
            message: 'Selected file type is not supported'
        };

        ko.validation.rules['railcardsSpecifiedAdults'] = {
            validator: function (val, params) {
                var _info = params.railcardInfo(params.code ? params.code() : val);
                var _number = params.number ? params.number() : val;

                return !_info.mustspecifynumber || params.quantity() * _info['minadults'] <= _number && params.quantity() * _info['maxadults'] >= _number;
            },
            message: function (params, val) {
                var _info = params.railcardInfo(params.code ? params.code() : val());
                return (_info['minadults'] != _info['maxadults']) ?
                    'To use your railcard number of adults must be between ' + params.quantity() * _info['minadults'] + ' and ' + params.quantity() * _info['maxadults'] :
                    'To use your railcard number of adults must be ' + params.quantity() * _info['minadults'];
            }
        };

        ko.validation.rules['railcardsSpecifiedChildren'] = {
            validator: function (val, params) {
                var _info = params.railcardInfo(params.code ? params.code() : val);
                var _number = params.number ? params.number() : val;

                return !_info.mustspecifynumber || params.quantity() * _info['minchildren'] <= _number && params.quantity() * _info['maxchildren'] >= _number;
            },
            message: function (params, val) {
                var _info = params.railcardInfo(params.code ? params.code() : val());
                return (_info['minchildren'] != _info['maxchildren']) ?
                    'To use your railcard number of children must be between ' + params.quantity() * _info['minchildren'] + ' and ' + params.quantity() * _info['maxchildren'] :
                    'To use your railcard number of children must be ' + params.quantity() * _info['minchildren'];
            }
        };

        ko.validation.rules['railcardsPassenger'] = {
            validator: function (val, params) {
                var _railcards = params.railcards()
                 if (_railcards.length > 0) {
                     var _children = 0, _adults = 0;

                     for (var index in _railcards) {
                         if (_railcards[index].code()) {
                             var _quantity = _railcards[index].quantity(); // no of railcards selected
                             var _info = params.railcardInfo(_railcards[index].code()); // railcard info
                             var _code = _info.railcardcode;

                             _adults += ((_info.mustspecifynumber || _code == "DIC" || _code == "DIS" || _code == "HMF") ? _railcards[index].adults() : _quantity * _info['maxadults']);
                             _children += ((_info.mustspecifynumber || _code == "DIC" || _code == "DIS" || _code == "HMF") ? _railcards[index].children() : _quantity * _info['maxchildren']);

                         }
                     }

                     return _children <= (params.children ? params.children() : val) && _adults <= (params.adults ? params.adults() : val);

                 }
                //return params.totalRailcards() <= params.children() + params.adults();

                return true;
            },
            message: function (params) {
                return 'Railcards passenger number cannot be higher than overall passenger number';
            }
        };

        ko.validation.rules['validPhoneNumber'] = {
            validator: function (val) {
                if (!val || 0 === val.length) {
                    return true;
                }

                return /(\+|00){0,2}(9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\d{1,14}$/.test('' + val + '');
            },
            message: 'Please enter a proper number.'
        };

        ko.validation.rules['isChecked'] = {
            validator: function (value) {
                if (!value) {
                    return false;
                }
                return true;
            },
            message: 'Please confirm.'
        };

        ko.validation.rules['termsAndConditions'] = {
            validator: function (value) {
                if (!value) {
                    return false;
                }
                return true;
            },
            message: 'Please accept to continue.'
        };

        ko.validation.rules['railcards'] = {
            validator: function (val) {
                if (val.length > 0) {
                    var _isValid = true;
                    for (var index in val) _isValid *= val[index].isValid();

                    return _isValid;
                }

                return true;
            },
            message: ''
        }

        ko.validation.registerExtenders();
    });

define('validationHelper', ['knockout', 'knockoutvalidation', 'koValidationExtenders'],
    function (ko, knockoutvalidation, koValidationExtenders) {
        var init = function () {
            ko.validation.init({
                insertMessages: false,
                decorateInputElement: true,
                decorateElementOnModified: true,
                errorElementClass: 'validation-error',
                errorMessageClass: 'validation-message-error'
            }, true);
        };

        var validate = function (obj, options) {
            var errors = ko.validation.group(obj, options);
            var isValid = errors().length === 0;
            if (!isValid) {
                errors.showAllMessages(true);
            }
            return isValid;
        };

        var reconfigure = function (target, configuration) {
            var ruleDefinitions = target.rules();
            var newRuleDefinitions = [];
            for (var def in ruleDefinitions) {
                var ruleDef = ruleDefinitions[def];

                if (configuration.hasOwnProperty(ruleDef.rule)) {
                    ruleDef.params = configuration[ruleDef.rule];
                }

                newRuleDefinitions.push(ruleDef);
            }

            target.rules(newRuleDefinitions);
        };

        return {
            init: init,
            validate: validate,
            reconfigure: reconfigure
        };
    });
define('uiEffectHelper', ['jquery', 'knockout'],
    function($, ko) {
        var toggleElement = function(element, toggleOptions) {
            var defaultDuration = 200;
            var options = toggleOptions;
            var duration = options.duration || defaultDuration;
            var target = element;
            var isFade = false;

            if (options) {
                if (options.withCss) {
                    target = options.withCss;
                } else if (options.withId) {
                    target = '#' + options.withId;
                }

                if (options.isFade)
                    isFade = true;
            }

            ko.applyBindingsToNode(element, {
                click: function() {
                    if (isFade === true)
                        $(target).fadeToggle(duration).toggleClass('open');
                    else
                        $(target).slideToggle(duration).toggleClass('open');

                    $(element).toggleClass('open');
                }
            });
        };

        var accordion = function (element, options) {

            var defaultConfig = {
                duration: 200,
                animation: false,
                withCss: false,
                withId: false,
                withDataHandle: false,
                scope: false,
                singleOpen: false
            };
            var config = $.extend({}, defaultConfig, options);

            var target = element;

            if (config.withCss) {
                target = config.withCss;
            } else if (config.withId) {
                target = '#' + config.withId;
            } else if (config.withDataHandle)
                target = '[data-accordion-handle="' + config.withDataHandle + '"]';

            ko.applyBindingsToNode(element, {
                click: function () {

                    $(element).toggleClass('open');

                    var isOpen = $(element).hasClass('open');
                    if (config.onOpen && isOpen) {
                        config.onOpen();
                    }
                    else if (config.onClose && !isOpen) {
                        config.onClose();
                    }

                    var scope = $(element).parents(config.scope),
                        others = scope.find('.accordion-thumb').not($(element)),
                        otherOpenContents = scope.find('.accordion-content.open').not($(target));

                    if (config.animation === 'fade') {

                        if (config.singleOpen) {
                            others.removeClass('open');
                            otherOpenContents.fadeOut(config.duration).removeClass('open');
                        }

                        $(target).fadeToggle(config.duration).toggleClass('open');
                    }
                    else {

                        if (config.singleOpen) {
                            others.removeClass('open');
                            otherOpenContents.slideUp(config.duration).removeClass('open');
                        }

                        $(target).slideToggle(config.duration).toggleClass('open');
                    }
                }
            });
        };

        var scrollToElement = function(element, options) {
            var defaultConfig = {
                duration: 300,
                scrollTimeout: 700,
                scrollOffset: 0,
                withCss: false,
                withId: false
            };

            var config = $.extend({}, defaultConfig, options);

            var target;
            if (config.withCss) {
                target = config.withCss;
            } else if (config.withId) {
                target = '#' + config.withId;
            }

            if (target && $(target).length > 0) {
                $(element).click(function () {
                    var accordionTrigger = $(target).parents('.accordion').find('.accordion-thumb');
                    if (!accordionTrigger.hasClass('open')) {
                        accordionTrigger.click();
                    } else {
                        config.scrollTimeout = 0;
                    }

                    var $scrollTarget = $(accordionTrigger).length > 0 ? $(accordionTrigger).first() : $(target);
                    setTimeout(function() {
                        var offset = $scrollTarget.offset();
                        if (offset) {
                            var navHeight = $('.nav-main-wrapper').height();
                            if(!$('.nav-main-wrapper').is(":visible")){
                                navHeight = $('.sticky-wrapper').height();
                            }

                            $('html, body').animate({
                                scrollTop: offset.top - navHeight - config.scrollOffset
                            }, config.duration);
                        }                        
                    }, config.scrollTimeout);                    
                });
            }            
        };

        return {
            toggleElement: toggleElement,
            accordion: accordion,
            scrollToElement: scrollToElement
        };
    });
/**
*  Ajax Autocomplete for jQuery, version 1.2.27
*  (c) 2015 Tomas Kirda
*
*  Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.
*  For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete
*/

/*jslint  browser: true, white: true, single: true, this: true, multivar: true */
/*global define, window, document, jQuery, exports, require */

// Expose plugin as an AMD module if AMD loader is present:
(function (factory) {
    "use strict";
    if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define('devbridgeautocomplete',['jquery'], factory);
    } else if (typeof exports === 'object' && typeof require === 'function') {
        // Browserify
        factory(require('jquery'));
    } else {
        // Browser globals
        factory(jQuery);
    }
}(function ($) {
    'use strict';

    var
        utils = (function () {
            return {
                escapeRegExChars: function (value) {
                    return value.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
                },
                createNode: function (containerClass) {
                    var div = document.createElement('div');
                    div.className = containerClass;
                    div.style.position = 'absolute';
                    div.style.display = 'none';
                    return div;
                }
            };
        }()),

        keys = {
            ESC: 27,
            TAB: 9,
            RETURN: 13,
            LEFT: 37,
            UP: 38,
            RIGHT: 39,
            DOWN: 40
        };

    function Autocomplete(el, options) {
        var noop = $.noop,
            that = this,
            defaults = {
                ajaxSettings: {},
                autoSelectFirst: false,
                appendTo: document.body,
                serviceUrl: null,
                lookup: null,
                onSelect: null,
                width: 'auto',
                minChars: 1,
                maxHeight: 300,
                deferRequestBy: 0,
                params: {},
                formatResult: Autocomplete.formatResult,
                delimiter: null,
                zIndex: 9999,
                type: 'GET',
                noCache: false,
                onSearchStart: noop,
                onSearchComplete: noop,
                onSearchError: noop,
                preserveInput: false,
                containerClass: 'autocomplete-suggestions',
                tabDisabled: false,
                dataType: 'text',
                currentRequest: null,
                triggerSelectOnValidInput: true,
                preventBadQueries: true,
                lookupFilter: function (suggestion, originalQuery, queryLowerCase) {
                    return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
                },
                paramName: 'query',
                transformResult: function (response) {
                    return typeof response === 'string' ? $.parseJSON(response) : response;
                },
                showNoSuggestionNotice: false,
                noSuggestionNotice: 'No results',
                orientation: 'bottom',
                forceFixPosition: false
            };

        // Shared variables:
        that.element = el;
        that.el = $(el);
        that.suggestions = [];
        that.badQueries = [];
        that.selectedIndex = -1;
        that.currentValue = that.element.value;
        that.intervalId = 0;
        that.cachedResponse = {};
        that.onChangeInterval = null;
        that.onChange = null;
        that.isLocal = false;
        that.suggestionsContainer = null;
        that.noSuggestionsContainer = null;
        that.options = $.extend({}, defaults, options);
        that.classes = {
            selected: 'autocomplete-selected',
            suggestion: 'autocomplete-suggestion'
        };
        that.hint = null;
        that.hintValue = '';
        that.selection = null;

        // Initialize and set options:
        that.initialize();
        that.setOptions(options);
    }

    Autocomplete.utils = utils;

    $.Autocomplete = Autocomplete;

    Autocomplete.formatResult = function (suggestion, currentValue) {
        // Do not replace anything if there current value is empty
        if (!currentValue) {
            return suggestion.value;
        }
        
        var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';

        return suggestion.value
            .replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>')
            .replace(/&/g, '&amp;')
            .replace(/</g, '&lt;')
            .replace(/>/g, '&gt;')
            .replace(/"/g, '&quot;')
            .replace(/&lt;(\/?strong)&gt;/g, '<$1>');
    };

    Autocomplete.prototype = {

        killerFn: null,

        initialize: function () {
            var that = this,
                suggestionSelector = '.' + that.classes.suggestion,
                selected = that.classes.selected,
                options = that.options,
                container;

            // Remove autocomplete attribute to prevent native suggestions:
            that.element.setAttribute('autocomplete', 'off');

            that.killerFn = function (e) {
                if (!$(e.target).closest('.' + that.options.containerClass).length) {
                    that.killSuggestions();
                    that.disableKillerFn();
                }
            };

            // html() deals with many types: htmlString or Element or Array or jQuery
            that.noSuggestionsContainer = $('<div class="autocomplete-no-suggestion"></div>')
                                          .html(this.options.noSuggestionNotice).get(0);

            that.suggestionsContainer = Autocomplete.utils.createNode(options.containerClass);

            container = $(that.suggestionsContainer);

            container.appendTo(options.appendTo);

            // Only set width if it was provided:
            if (options.width !== 'auto') {
                container.css('width', options.width);
            }

            // Listen for mouse over event on suggestions list:
            container.on('mouseover.autocomplete', suggestionSelector, function () {
                that.activate($(this).data('index'));
            });

            // Deselect active element when mouse leaves suggestions container:
            container.on('mouseout.autocomplete', function () {
                that.selectedIndex = -1;
                container.children('.' + selected).removeClass(selected);
            });

            // Listen for click event on suggestions list:
            container.on('click.autocomplete', suggestionSelector, function () {
                that.select($(this).data('index'));
                return false;
            });

            that.fixPositionCapture = function () {
                if (that.visible) {
                    that.fixPosition();
                }
            };

            $(window).on('resize.autocomplete', that.fixPositionCapture);

            that.el.on('keydown.autocomplete', function (e) { that.onKeyPress(e); });
            that.el.on('keyup.autocomplete', function (e) { that.onKeyUp(e); });
            that.el.on('blur.autocomplete', function () { that.onBlur(); });
            that.el.on('focus.autocomplete', function () { that.onFocus(); });
            that.el.on('change.autocomplete', function (e) { that.onKeyUp(e); });
            that.el.on('input.autocomplete', function (e) { that.onKeyUp(e); });
        },

        onFocus: function () {
            var that = this;

            that.fixPosition();

            if (that.el.val().length >= that.options.minChars) {
                that.onValueChange();
            }
        },

        onBlur: function () {
            this.enableKillerFn();
        },
        
        abortAjax: function () {
            var that = this;
            if (that.currentRequest) {
                that.currentRequest.abort();
                that.currentRequest = null;
            }
        },

        setOptions: function (suppliedOptions) {
            var that = this,
                options = that.options;

            $.extend(options, suppliedOptions);

            that.isLocal = $.isArray(options.lookup);

            if (that.isLocal) {
                options.lookup = that.verifySuggestionsFormat(options.lookup);
            }

            options.orientation = that.validateOrientation(options.orientation, 'bottom');

            // Adjust height, width and z-index:
            $(that.suggestionsContainer).css({
                'max-height': options.maxHeight + 'px',
                'width': options.width + 'px',
                'z-index': options.zIndex
            });
        },


        clearCache: function () {
            this.cachedResponse = {};
            this.badQueries = [];
        },

        clear: function () {
            this.clearCache();
            this.currentValue = '';
            this.suggestions = [];
        },

        disable: function () {
            var that = this;
            that.disabled = true;
            clearInterval(that.onChangeInterval);
            that.abortAjax();
        },

        enable: function () {
            this.disabled = false;
        },

        fixPosition: function () {
            // Use only when container has already its content

            var that = this,
                $container = $(that.suggestionsContainer),
                containerParent = $container.parent().get(0);
            // Fix position automatically when appended to body.
            // In other cases force parameter must be given.
            if (containerParent !== document.body && !that.options.forceFixPosition) {
                return;
            }

            // Choose orientation
            var orientation = that.options.orientation,
                containerHeight = $container.outerHeight(),
                height = that.el.outerHeight(),
                offset = that.el.offset(),
                styles = { 'top': offset.top, 'left': offset.left };

            if (orientation === 'auto') {
                var viewPortHeight = $(window).height(),
                    scrollTop = $(window).scrollTop(),
                    topOverflow = -scrollTop + offset.top - containerHeight,
                    bottomOverflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight);

                orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow) ? 'top' : 'bottom';
            }

            if (orientation === 'top') {
                styles.top += -containerHeight;
            } else {
                styles.top += height;
            }

            // If container is not positioned to body,
            // correct its position using offset parent offset
            if(containerParent !== document.body) {
                var opacity = $container.css('opacity'),
                    parentOffsetDiff;

                    if (!that.visible){
                        $container.css('opacity', 0).show();
                    }

                parentOffsetDiff = $container.offsetParent().offset();
                styles.top -= parentOffsetDiff.top;
                styles.left -= parentOffsetDiff.left;

                if (!that.visible){
                    $container.css('opacity', opacity).hide();
                }
            }

            if (that.options.width === 'auto') {
                styles.width = that.el.outerWidth() + 'px';
            }

            $container.css(styles);
        },

        enableKillerFn: function () {
            var that = this;
            $(document).on('click.autocomplete', that.killerFn);
        },

        disableKillerFn: function () {
            var that = this;
            $(document).off('click.autocomplete', that.killerFn);
        },

        killSuggestions: function () {
            var that = this;
            that.stopKillSuggestions();
            that.intervalId = window.setInterval(function () {
                if (that.visible) {
                    // No need to restore value when 
                    // preserveInput === true, 
                    // because we did not change it
                    if (!that.options.preserveInput) {
                        that.el.val(that.currentValue);
                    }

                    that.hide();
                }
                
                that.stopKillSuggestions();
            }, 50);
        },

        stopKillSuggestions: function () {
            window.clearInterval(this.intervalId);
        },

        isCursorAtEnd: function () {
            var that = this,
                valLength = that.el.val().length,
                selectionStart = that.element.selectionStart,
                range;

            if (typeof selectionStart === 'number') {
                return selectionStart === valLength;
            }
            if (document.selection) {
                range = document.selection.createRange();
                range.moveStart('character', -valLength);
                return valLength === range.text.length;
            }
            return true;
        },

        onKeyPress: function (e) {
            var that = this;

            // If suggestions are hidden and user presses arrow down, display suggestions:
            if (!that.disabled && !that.visible && e.which === keys.DOWN && that.currentValue) {
                that.suggest();
                return;
            }

            if (that.disabled || !that.visible) {
                return;
            }

            switch (e.which) {
                case keys.ESC:
                    that.el.val(that.currentValue);
                    that.hide();
                    break;
                case keys.RIGHT:
                    if (that.hint && that.options.onHint && that.isCursorAtEnd()) {
                        that.selectHint();
                        break;
                    }
                    return;
                case keys.TAB:
                    if (that.hint && that.options.onHint) {
                        that.selectHint();
                        return;
                    }
                    if (that.selectedIndex === -1) {
                        that.hide();
                        return;
                    }
                    that.select(that.selectedIndex);
                    if (that.options.tabDisabled === false) {
                        return;
                    }
                    break;
                case keys.RETURN:
                    if (that.selectedIndex === -1) {
                        that.hide();
                        return;
                    }
                    that.select(that.selectedIndex);
                    break;
                case keys.UP:
                    that.moveUp();
                    break;
                case keys.DOWN:
                    that.moveDown();
                    break;
                default:
                    return;
            }

            // Cancel event if function did not return:
            e.stopImmediatePropagation();
            e.preventDefault();
        },

        onKeyUp: function (e) {
            var that = this;

            if (that.disabled) {
                return;
            }

            switch (e.which) {
                case keys.UP:
                case keys.DOWN:
                    return;
            }

            clearInterval(that.onChangeInterval);

            if (that.currentValue !== that.el.val()) {
                that.findBestHint();
                if (that.options.deferRequestBy > 0) {
                    // Defer lookup in case when value changes very quickly:
                    that.onChangeInterval = setInterval(function () {
                        that.onValueChange();
                    }, that.options.deferRequestBy);
                } else {
                    that.onValueChange();
                }
            }
        },

        onValueChange: function () {
            var that = this,
                options = that.options,
                value = that.el.val(),
                query = that.getQuery(value);

            if (that.selection && that.currentValue !== query) {
                that.selection = null;
                (options.onInvalidateSelection || $.noop).call(that.element);
            }

            clearInterval(that.onChangeInterval);
            that.currentValue = value;
            that.selectedIndex = -1;

            // Check existing suggestion for the match before proceeding:
            if (options.triggerSelectOnValidInput && that.isExactMatch(query)) {
                that.select(0);
                return;
            }

            if (query.length < options.minChars) {
                that.hide();
            } else {
                that.getSuggestions(query);
            }
        },

        isExactMatch: function (query) {
            var suggestions = this.suggestions;

            return (suggestions.length === 1 && suggestions[0].value.toLowerCase() === query.toLowerCase());
        },

        getQuery: function (value) {
            var delimiter = this.options.delimiter,
                parts;

            if (!delimiter) {
                return value;
            }
            parts = value.split(delimiter);
            return $.trim(parts[parts.length - 1]);
        },

        getSuggestionsLocal: function (query) {
            var that = this,
                options = that.options,
                queryLowerCase = query.toLowerCase(),
                filter = options.lookupFilter,
                limit = parseInt(options.lookupLimit, 10),
                data;

            data = {
                suggestions: $.grep(options.lookup, function (suggestion) {
                    return filter(suggestion, query, queryLowerCase);
                })
            };

            if (limit && data.suggestions.length > limit) {
                data.suggestions = data.suggestions.slice(0, limit);
            }

            return data;
        },

        getSuggestions: function (q) {
            var response,
                that = this,
                options = that.options,
                serviceUrl = options.serviceUrl,
                params,
                cacheKey,
                ajaxSettings;

            options.params[options.paramName] = q;
            params = options.ignoreParams ? null : options.params;

            if (options.onSearchStart.call(that.element, options.params) === false) {
                return;
            }

            if ($.isFunction(options.lookup)){
                options.lookup(q, function (data) {
                    that.suggestions = data.suggestions;
                    that.suggest();
                    options.onSearchComplete.call(that.element, q, data.suggestions);
                });
                return;
            }

            if (that.isLocal) {
                response = that.getSuggestionsLocal(q);
            } else {
                if ($.isFunction(serviceUrl)) {
                    serviceUrl = serviceUrl.call(that.element, q);
                }
                cacheKey = serviceUrl + '?' + $.param(params || {});
                response = that.cachedResponse[cacheKey];
            }

            if (response && $.isArray(response.suggestions)) {
                that.suggestions = response.suggestions;
                that.suggest();
                options.onSearchComplete.call(that.element, q, response.suggestions);
            } else if (!that.isBadQuery(q)) {
                that.abortAjax();

                ajaxSettings = {
                    url: serviceUrl,
                    data: params,
                    type: options.type,
                    dataType: options.dataType
                };

                $.extend(ajaxSettings, options.ajaxSettings);

                that.currentRequest = $.ajax(ajaxSettings).done(function (data) {
                    var result;
                    that.currentRequest = null;
                    result = options.transformResult(data, q);
                    that.processResponse(result, q, cacheKey);
                    options.onSearchComplete.call(that.element, q, result.suggestions);
                }).fail(function (jqXHR, textStatus, errorThrown) {
                    options.onSearchError.call(that.element, q, jqXHR, textStatus, errorThrown);
                });
            } else {
                options.onSearchComplete.call(that.element, q, []);
            }
        },

        isBadQuery: function (q) {
            if (!this.options.preventBadQueries){
                return false;
            }

            var badQueries = this.badQueries,
                i = badQueries.length;

            while (i--) {
                if (q.indexOf(badQueries[i]) === 0) {
                    return true;
                }
            }

            return false;
        },

        hide: function () {
            var that = this,
                container = $(that.suggestionsContainer);

            if ($.isFunction(that.options.onHide) && that.visible) {
                that.options.onHide.call(that.element, container);
            }

            that.visible = false;
            that.selectedIndex = -1;
            clearInterval(that.onChangeInterval);
            $(that.suggestionsContainer).hide();
            that.signalHint(null);
        },

        suggest: function () {
            if (!this.suggestions.length) {
                if (this.options.showNoSuggestionNotice) {
                    this.noSuggestions();
                } else {
                    this.hide();
                }
                return;
            }

            var that = this,
                options = that.options,
                groupBy = options.groupBy,
                formatResult = options.formatResult,
                value = that.getQuery(that.currentValue),
                className = that.classes.suggestion,
                classSelected = that.classes.selected,
                container = $(that.suggestionsContainer),
                noSuggestionsContainer = $(that.noSuggestionsContainer),
                beforeRender = options.beforeRender,
                html = '',
                category,
                formatGroup = function (suggestion, index) {
                        var currentCategory = suggestion.data[groupBy];

                        if (category === currentCategory){
                            return '';
                        }

                        category = currentCategory;

                        return '<div class="autocomplete-group"><strong>' + category + '</strong></div>';
                    };

            if (options.triggerSelectOnValidInput && that.isExactMatch(value)) {
                that.select(0);
                return;
            }

            // Build suggestions inner HTML:
            $.each(that.suggestions, function (i, suggestion) {
                if (groupBy){
                    html += formatGroup(suggestion, value, i);
                }

                html += '<div class="' + className + '" data-index="' + i + '">' + formatResult(suggestion, value, i) + '</div>';
            });

            this.adjustContainerWidth();

            noSuggestionsContainer.detach();
            container.html(html);

            if ($.isFunction(beforeRender)) {
                beforeRender.call(that.element, container, that.suggestions);
            }

            that.fixPosition();
            container.show();

            // Select first value by default:
            if (options.autoSelectFirst) {
                that.selectedIndex = 0;
                container.scrollTop(0);
                container.children('.' + className).first().addClass(classSelected);
            }

            that.visible = true;
            that.findBestHint();
        },

        noSuggestions: function() {
             var that = this,
                 container = $(that.suggestionsContainer),
                 noSuggestionsContainer = $(that.noSuggestionsContainer);

            this.adjustContainerWidth();

            // Some explicit steps. Be careful here as it easy to get
            // noSuggestionsContainer removed from DOM if not detached properly.
            noSuggestionsContainer.detach();
            container.empty(); // clean suggestions if any
            container.append(noSuggestionsContainer);

            that.fixPosition();

            container.show();
            that.visible = true;
        },

        adjustContainerWidth: function() {
            var that = this,
                options = that.options,
                width,
                container = $(that.suggestionsContainer);

            // If width is auto, adjust width before displaying suggestions,
            // because if instance was created before input had width, it will be zero.
            // Also it adjusts if input width has changed.
            if (options.width === 'auto') {
                width = that.el.outerWidth();
                container.css('width', width > 0 ? width : 300);
            }
        },

        findBestHint: function () {
            var that = this,
                value = that.el.val().toLowerCase(),
                bestMatch = null;

            if (!value) {
                return;
            }

            $.each(that.suggestions, function (i, suggestion) {
                var foundMatch = suggestion.value.toLowerCase().indexOf(value) === 0;
                if (foundMatch) {
                    bestMatch = suggestion;
                }
                return !foundMatch;
            });

            that.signalHint(bestMatch);
        },

        signalHint: function (suggestion) {
            var hintValue = '',
                that = this;
            if (suggestion) {
                hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length);
            }
            if (that.hintValue !== hintValue) {
                that.hintValue = hintValue;
                that.hint = suggestion;
                (this.options.onHint || $.noop)(hintValue);
            }
        },

        verifySuggestionsFormat: function (suggestions) {
            // If suggestions is string array, convert them to supported format:
            if (suggestions.length && typeof suggestions[0] === 'string') {
                return $.map(suggestions, function (value) {
                    return { value: value, data: null };
                });
            }

            return suggestions;
        },

        validateOrientation: function(orientation, fallback) {
            orientation = $.trim(orientation || '').toLowerCase();

            if($.inArray(orientation, ['auto', 'bottom', 'top']) === -1){
                orientation = fallback;
            }

            return orientation;
        },

        processResponse: function (result, originalQuery, cacheKey) {
            var that = this,
                options = that.options;

            result.suggestions = that.verifySuggestionsFormat(result.suggestions);

            // Cache results if cache is not disabled:
            if (!options.noCache) {
                that.cachedResponse[cacheKey] = result;
                if (options.preventBadQueries && !result.suggestions.length) {
                    that.badQueries.push(originalQuery);
                }
            }

            // Return if originalQuery is not matching current query:
            if (originalQuery !== that.getQuery(that.currentValue)) {
                return;
            }

            that.suggestions = result.suggestions;
            that.suggest();
        },

        activate: function (index) {
            var that = this,
                activeItem,
                selected = that.classes.selected,
                container = $(that.suggestionsContainer),
                children = container.find('.' + that.classes.suggestion);

            container.find('.' + selected).removeClass(selected);

            that.selectedIndex = index;

            if (that.selectedIndex !== -1 && children.length > that.selectedIndex) {
                activeItem = children.get(that.selectedIndex);
                $(activeItem).addClass(selected);
                return activeItem;
            }

            return null;
        },

        selectHint: function () {
            var that = this,
                i = $.inArray(that.hint, that.suggestions);

            that.select(i);
        },

        select: function (i) {
            var that = this;
            that.hide();
            that.onSelect(i);
            that.disableKillerFn();
        },

        moveUp: function () {
            var that = this;

            if (that.selectedIndex === -1) {
                return;
            }

            if (that.selectedIndex === 0) {
                $(that.suggestionsContainer).children().first().removeClass(that.classes.selected);
                that.selectedIndex = -1;
                that.el.val(that.currentValue);
                that.findBestHint();
                return;
            }

            that.adjustScroll(that.selectedIndex - 1);
        },

        moveDown: function () {
            var that = this;

            if (that.selectedIndex === (that.suggestions.length - 1)) {
                return;
            }

            that.adjustScroll(that.selectedIndex + 1);
        },

        adjustScroll: function (index) {
            var that = this,
                activeItem = that.activate(index);

            if (!activeItem) {
                return;
            }

            var offsetTop,
                upperBound,
                lowerBound,
                heightDelta = $(activeItem).outerHeight();

            offsetTop = activeItem.offsetTop;
            upperBound = $(that.suggestionsContainer).scrollTop();
            lowerBound = upperBound + that.options.maxHeight - heightDelta;

            if (offsetTop < upperBound) {
                $(that.suggestionsContainer).scrollTop(offsetTop);
            } else if (offsetTop > lowerBound) {
                $(that.suggestionsContainer).scrollTop(offsetTop - that.options.maxHeight + heightDelta);
            }

            if (!that.options.preserveInput) {
                that.el.val(that.getValue(that.suggestions[index].value));
            }
            that.signalHint(null);
        },

        onSelect: function (index) {
            var that = this,
                onSelectCallback = that.options.onSelect,
                suggestion = that.suggestions[index];

            that.currentValue = that.getValue(suggestion.value);

            if (that.currentValue !== that.el.val() && !that.options.preserveInput) {
                that.el.val(that.currentValue);
            }

            that.signalHint(null);
            that.suggestions = [];
            that.selection = suggestion;

            if ($.isFunction(onSelectCallback)) {
                onSelectCallback.call(that.element, suggestion);
            }
        },

        getValue: function (value) {
            var that = this,
                delimiter = that.options.delimiter,
                currentValue,
                parts;

            if (!delimiter) {
                return value;
            }

            currentValue = that.currentValue;
            parts = currentValue.split(delimiter);

            if (parts.length === 1) {
                return value;
            }

            return currentValue.substr(0, currentValue.length - parts[parts.length - 1].length) + value;
        },

        dispose: function () {
            var that = this;
            that.el.off('.autocomplete').removeData('autocomplete');
            that.disableKillerFn();
            $(window).off('resize.autocomplete', that.fixPositionCapture);
            $(that.suggestionsContainer).remove();
        }
    };

    // Create chainable jQuery plugin:
    $.fn.autocomplete = $.fn.devbridgeAutocomplete = function (options, args) {
        var dataKey = 'autocomplete';
        // If function invoked without argument return
        // instance of the first matched element:
        if (!arguments.length) {
            return this.first().data(dataKey);
        }

        return this.each(function () {
            var inputElement = $(this),
                instance = inputElement.data(dataKey);

            if (typeof options === 'string') {
                if (instance && typeof instance[options] === 'function') {
                    instance[options](args);
                }
            } else {
                // If instance already exists, destroy it:
                if (instance && instance.dispose) {
                    instance.dispose();
                }
                instance = new Autocomplete(this, options);
                inputElement.data(dataKey, instance);
            }
        });
    };
}));

// Sticky Plugin v1.0.4 for jQuery
// =============
// Author: Anthony Garand
// Improvements by German M. Bravo (Kronuz) and Ruud Kamphuis (ruudk)
// Improvements by Leonardo C. Daronco (daronco)
// Created: 02/14/2011
// Date: 07/20/2015
// Website: http://stickyjs.com/
// Description: Makes an element on the page stick on the screen as you scroll
//              It will only set the 'top' and 'position' of your element, you
//              might need to adjust the width in some cases.

(function (factory) {
    if (typeof define === 'function' && define.amd) {
        // AMD. Register as an anonymous module.
        define('jquerysticky',['jquery'], factory);
    } else if (typeof module === 'object' && module.exports) {
        // Node/CommonJS
        module.exports = factory(require('jquery'));
    } else {
        // Browser globals
        factory(jQuery);
    }
}(function ($) {
    var slice = Array.prototype.slice; // save ref to original slice()
    var splice = Array.prototype.splice; // save ref to original slice()

  var defaults = {
      topSpacing: 0,
      bottomSpacing: 0,
      className: 'is-sticky',
      wrapperClassName: 'sticky-wrapper',
      center: false,
      getWidthFrom: '',
      widthFromWrapper: true, // works only when .getWidthFrom is empty
      responsiveWidth: false,
      zIndex: 'auto'
    },
    $window = $(window),
    $document = $(document),
    sticked = [],
    windowHeight = $window.height(),
    scroller = function() {
      var scrollTop = $window.scrollTop(),
        documentHeight = $document.height(),
        dwh = documentHeight - windowHeight,
        extra = (scrollTop > dwh) ? dwh - scrollTop : 0;

      for (var i = 0, l = sticked.length; i < l; i++) {
        var s = sticked[i],
          elementTop = s.stickyWrapper.offset().top,
          etse = elementTop - s.topSpacing - extra;

        //update height in case of dynamic content
        s.stickyWrapper.css('height', s.stickyElement.outerHeight());

        if (scrollTop <= etse) {
          if (s.currentTop !== null) {
            s.stickyElement
              .css({
                'width': '',
                'position': '',
                'top': '',
                'z-index': ''
              });
            s.stickyElement.parent().removeClass(s.className);
            s.stickyElement.trigger('sticky-end', [s]);
            s.currentTop = null;
          }
        }
        else {
          var newTop = documentHeight - s.stickyElement.outerHeight()
            - s.topSpacing - s.bottomSpacing - scrollTop - extra;
          if (newTop < 0) {
            newTop = newTop + s.topSpacing;
          } else {
            newTop = s.topSpacing;
          }
          if (s.currentTop !== newTop) {
            var newWidth;
            if (s.getWidthFrom) {
                newWidth = $(s.getWidthFrom).width() || null;
            } else if (s.widthFromWrapper) {
                newWidth = s.stickyWrapper.width();
            }
            if (newWidth == null) {
                newWidth = s.stickyElement.width();
            }
            s.stickyElement
              .css('width', newWidth)
              .css('position', 'fixed')
              .css('top', newTop)
              .css('z-index', s.zIndex);

            s.stickyElement.parent().addClass(s.className);

            if (s.currentTop === null) {
              s.stickyElement.trigger('sticky-start', [s]);
            } else {
              // sticky is started but it have to be repositioned
              s.stickyElement.trigger('sticky-update', [s]);
            }

            if (s.currentTop === s.topSpacing && s.currentTop > newTop || s.currentTop === null && newTop < s.topSpacing) {
              // just reached bottom || just started to stick but bottom is already reached
              s.stickyElement.trigger('sticky-bottom-reached', [s]);
            } else if(s.currentTop !== null && newTop === s.topSpacing && s.currentTop < newTop) {
              // sticky is started && sticked at topSpacing && overflowing from top just finished
              s.stickyElement.trigger('sticky-bottom-unreached', [s]);
            }

            s.currentTop = newTop;
          }

          // Check if sticky has reached end of container and stop sticking
          var stickyWrapperContainer = s.stickyWrapper.parent();
          var unstick = (s.stickyElement.offset().top + s.stickyElement.outerHeight() >= stickyWrapperContainer.offset().top + stickyWrapperContainer.outerHeight()) && (s.stickyElement.offset().top <= s.topSpacing);

          if( unstick ) {
            s.stickyElement
              .css('position', 'absolute')
              .css('top', '')
              .css('bottom', 0)
              .css('z-index', '');
          } else {
            s.stickyElement
              .css('position', 'fixed')
              .css('top', newTop)
              .css('bottom', '')
              .css('z-index', s.zIndex);
          }
        }
      }
    },
    resizer = function() {
      windowHeight = $window.height();

      for (var i = 0, l = sticked.length; i < l; i++) {
        var s = sticked[i];
        var newWidth = null;
        if (s.getWidthFrom) {
            if (s.responsiveWidth) {
                newWidth = $(s.getWidthFrom).width();
            }
        } else if(s.widthFromWrapper) {
            newWidth = s.stickyWrapper.width();
        }
        if (newWidth != null) {
            s.stickyElement.css('width', newWidth);
        }
      }
    },
    methods = {
      init: function(options) {
        return this.each(function() {
          var o = $.extend({}, defaults, options);
          var stickyElement = $(this);

          var stickyId = stickyElement.attr('id');
          var wrapperId = stickyId ? stickyId + '-' + defaults.wrapperClassName : defaults.wrapperClassName;
          var wrapper = $('<div></div>')
            .attr('id', wrapperId)
            .addClass(o.wrapperClassName);

          stickyElement.wrapAll(function() {
            if ($(this).parent("#" + wrapperId).length == 0) {
                    return wrapper;
            }
});

          var stickyWrapper = stickyElement.parent();

          if (o.center) {
            stickyWrapper.css({width:stickyElement.outerWidth(),marginLeft:"auto",marginRight:"auto"});
          }

          if (stickyElement.css("float") === "right") {
            stickyElement.css({"float":"none"}).parent().css({"float":"right"});
          }

          o.stickyElement = stickyElement;
          o.stickyWrapper = stickyWrapper;
          o.currentTop    = null;

          sticked.push(o);

          methods.setWrapperHeight(this);
          methods.setupChangeListeners(this);
        });
      },

      setWrapperHeight: function(stickyElement) {
        var element = $(stickyElement);
        var stickyWrapper = element.parent();
        if (stickyWrapper) {
          stickyWrapper.css('height', element.outerHeight());
        }
      },

      setupChangeListeners: function(stickyElement) {
        if (window.MutationObserver) {
          var mutationObserver = new window.MutationObserver(function(mutations) {
            if (mutations[0].addedNodes.length || mutations[0].removedNodes.length) {
              methods.setWrapperHeight(stickyElement);
            }
          });
          mutationObserver.observe(stickyElement, {subtree: true, childList: true});
        } else {
          if (window.addEventListener) {
            stickyElement.addEventListener('DOMNodeInserted', function() {
              methods.setWrapperHeight(stickyElement);
            }, false);
            stickyElement.addEventListener('DOMNodeRemoved', function() {
              methods.setWrapperHeight(stickyElement);
            }, false);
          } else if (window.attachEvent) {
            stickyElement.attachEvent('onDOMNodeInserted', function() {
              methods.setWrapperHeight(stickyElement);
            });
            stickyElement.attachEvent('onDOMNodeRemoved', function() {
              methods.setWrapperHeight(stickyElement);
            });
          }
        }
      },
      update: scroller,
      unstick: function(options) {
        return this.each(function() {
          var that = this;
          var unstickyElement = $(that);

          var removeIdx = -1;
          var i = sticked.length;
          while (i-- > 0) {
            if (sticked[i].stickyElement.get(0) === that) {
                splice.call(sticked,i,1);
                removeIdx = i;
            }
          }
          if(removeIdx !== -1) {
            unstickyElement.unwrap();
            unstickyElement
              .css({
                'width': '',
                'position': '',
                'top': '',
                'float': '',
                'z-index': ''
              })
            ;
          }
        });
      }
    };

  // should be more efficient than using $window.scroll(scroller) and $window.resize(resizer):
  if (window.addEventListener) {
    window.addEventListener('scroll', scroller, false);
    window.addEventListener('resize', resizer, false);
  } else if (window.attachEvent) {
    window.attachEvent('onscroll', scroller);
    window.attachEvent('onresize', resizer);
  }

  $.fn.sticky = function(method) {
    if (methods[method]) {
      return methods[method].apply(this, slice.call(arguments, 1));
    } else if (typeof method === 'object' || !method ) {
      return methods.init.apply( this, arguments );
    } else {
      $.error('Method ' + method + ' does not exist on jQuery.sticky');
    }
  };

  $.fn.unstick = function(method) {
    if (methods[method]) {
      return methods[method].apply(this, slice.call(arguments, 1));
    } else if (typeof method === 'object' || !method ) {
      return methods.unstick.apply( this, arguments );
    } else {
      $.error('Method ' + method + ' does not exist on jQuery.sticky');
    }
  };
  $(function() {
    setTimeout(scroller, 0);
  });
}));

/*!
 * jQuery Browser Plugin 0.0.8
 * https://github.com/gabceb/jquery-browser-plugin
 *
 * Original jquery-browser code Copyright 2005, 2015 jQuery Foundation, Inc. and other contributors
 * http://jquery.org/license
 *
 * Modifications Copyright 2015 Gabriel Cebrian
 * https://github.com/gabceb
 *
 * Released under the MIT license
 *
 * Date: 05-07-2015
 */
/*global window: false */

(function (factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define('jquerybrowser',['jquery'], function ($) {
      return factory($);
    });
  } else if (typeof module === 'object' && typeof module.exports === 'object') {
    // Node-like environment
    module.exports = factory(require('jquery'));
  } else {
    // Browser globals
    factory(window.jQuery);
  }
}(function(jQuery) {
  "use strict";

  function uaMatch( ua ) {
    // If an UA is not provided, default to the current browser UA.
    if ( ua === undefined ) {
      ua = window.navigator.userAgent;
    }
    ua = ua.toLowerCase();

    var match = /(edge)\/([\w.]+)/.exec( ua ) ||
        /(opr)[\/]([\w.]+)/.exec( ua ) ||
        /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
        /(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) ||
        /(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec( ua ) ||
        /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
        /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
        /(msie) ([\w.]+)/.exec( ua ) ||
        ua.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec( ua ) ||
        ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
        [];

    var platform_match = /(ipad)/.exec( ua ) ||
        /(ipod)/.exec( ua ) ||
        /(iphone)/.exec( ua ) ||
        /(kindle)/.exec( ua ) ||
        /(silk)/.exec( ua ) ||
        /(android)/.exec( ua ) ||
        /(windows phone)/.exec( ua ) ||
        /(win)/.exec( ua ) ||
        /(mac)/.exec( ua ) ||
        /(linux)/.exec( ua ) ||
        /(cros)/.exec( ua ) ||
        /(playbook)/.exec( ua ) ||
        /(bb)/.exec( ua ) ||
        /(blackberry)/.exec( ua ) ||
        [];

    var browser = {},
        matched = {
          browser: match[ 5 ] || match[ 3 ] || match[ 1 ] || "",
          version: match[ 2 ] || match[ 4 ] || "0",
          versionNumber: match[ 4 ] || match[ 2 ] || "0",
          platform: platform_match[ 0 ] || ""
        };

    if ( matched.browser ) {
      browser[ matched.browser ] = true;
      browser.version = matched.version;
      browser.versionNumber = parseInt(matched.versionNumber, 10);
    }

    if ( matched.platform ) {
      browser[ matched.platform ] = true;
    }

    // These are all considered mobile platforms, meaning they run a mobile browser
    if ( browser.android || browser.bb || browser.blackberry || browser.ipad || browser.iphone ||
      browser.ipod || browser.kindle || browser.playbook || browser.silk || browser[ "windows phone" ]) {
      browser.mobile = true;
    }

    // These are all considered desktop platforms, meaning they run a desktop browser
    if ( browser.cros || browser.mac || browser.linux || browser.win ) {
      browser.desktop = true;
    }

    // Chrome, Opera 15+ and Safari are webkit based browsers
    if ( browser.chrome || browser.opr || browser.safari ) {
      browser.webkit = true;
    }

    // IE11 has a new token so we will assign it msie to avoid breaking changes
    // IE12 disguises itself as Chrome, but adds a new Edge token.
    if ( browser.rv || browser.edge ) {
      var ie = "msie";

      matched.browser = ie;
      browser[ie] = true;
    }

    // Blackberry browsers are marked as Safari on BlackBerry
    if ( browser.safari && browser.blackberry ) {
      var blackberry = "blackberry";

      matched.browser = blackberry;
      browser[blackberry] = true;
    }

    // Playbook browsers are marked as Safari on Playbook
    if ( browser.safari && browser.playbook ) {
      var playbook = "playbook";

      matched.browser = playbook;
      browser[playbook] = true;
    }

    // BB10 is a newer OS version of BlackBerry
    if ( browser.bb ) {
      var bb = "blackberry";

      matched.browser = bb;
      browser[bb] = true;
    }

    // Opera 15+ are identified as opr
    if ( browser.opr ) {
      var opera = "opera";

      matched.browser = opera;
      browser[opera] = true;
    }

    // Stock Android browsers are marked as Safari on Android.
    if ( browser.safari && browser.android ) {
      var android = "android";

      matched.browser = android;
      browser[  android] = true;
    }

    // Kindle browsers are marked as Safari on Kindle
    if ( browser.safari && browser.kindle ) {
      var kindle = "kindle";

      matched.browser = kindle;
      browser[kindle] = true;
    }

     // Kindle Silk browsers are marked as Safari on Kindle
    if ( browser.safari && browser.silk ) {
      var silk = "silk";

      matched.browser = silk;
      browser[silk] = true;
    }

    // Assign the name and platform variable
    browser.name = matched.browser;
    browser.platform = matched.platform;
    return browser;
  }

  // Run the matching process, also assign the function to the returned object
  // for manual, jQuery-free use if desired
  window.jQBrowser = uaMatch( window.navigator.userAgent );
  window.jQBrowser.uaMatch = uaMatch;

  // Only assign to jQuery.browser if jQuery is loaded
  if ( jQuery ) {
    jQuery.browser = window.jQBrowser;
  }

  return window.jQBrowser;
}));

define('browserHelper', ['jquery', 'jquerybrowser'],
    function ($, jqueryBrowser) {

        var isMobile = function () {
            return jqueryBrowser.mobile || false;
        };

        var isTablet = function () {
            var noMatchMediaSupport = (jqueryBrowser.msie || false) && jqueryBrowser.versionNumber < 9;
            var hasMatchMediaSupport = !noMatchMediaSupport;
            return hasMatchMediaSupport && window.matchMedia("only screen and (min-width: 768px) and (max-width: 1024px)").matches;
        };

        var isAndroid = function() {
            return (jqueryBrowser.platform == "android");  
        }

        var isDesktop = function () {
            return jqueryBrowser.desktop || false;
        };

        var isPhone = function () {
            return isMobile() && !isTablet();
        }

        var supportsWebComponents = function() {
            if (jqueryBrowser.msie) {
                return jqueryBrowser.versionNumber > 9;
            }

            if (jqueryBrowser.mozilla) {
                return jqueryBrowser.versionNumber > 35;
            }

            if (jqueryBrowser.chrome) {
                return jqueryBrowser.versionNumber > 40;
            }

            if (jqueryBrowser.safari) {
                return jqueryBrowser.versionNumber > 7;
            }

            return true;
        };

        var isTouchDevice = function() {
             return 'ontouchstart' in window || 'onmsgesturechange' in window;
        };

        return {
            isDesktop: isDesktop,
            isTablet: isTablet,
            isMobile: isMobile,
            isPhone: isPhone,
            isAndroid: isAndroid,
            supportsWebComponents: supportsWebComponents,
            isTouchDevice: isTouchDevice,
            browser: jqueryBrowser
        };
    });
/// <reference path="customjs/traintimesmodule.js" />
define('mapHelper', ['jquery', 'browserHelper', 'context', 'utils'],
    function ($, browserHelper, context, utils) {
        var isMapsApiLoaded = false;

        window.mapsApiLoaded = function () {
            isMapsApiLoaded = true;
            def.resolve();
        };

        function loadMapApi() {
            $(document).ready(function () {
                var script = document.createElement('script');
                script.type = 'text/javascript';
                script.src = 'https://maps.googleapis.com/maps/api/js?v=3' +
                    '&key=' + context.apiKeys.googlemaps + '&libraries=places&callback=mapsApiLoaded';
                document.body.appendChild(script);
            });
        };

        var def;

        var init = function () {

            //check consent


            if (!def) {
                def = $.Deferred(function () {
                    if (isMapsApiLoaded) {
                        def.resolve();
                        return;
                    }
                    utils.checkFunctionalCookieConsent(function (callback) {
                        if (callback != null) {
                            loadMapApi();
                        }
                        else {
                            //placeholder
                            var message = 'Due to having disabled functional cookies you are unable to view the interactive map. To enable the map please enable all cookies using the Cookie Preferences settings in the bottom left of this page';
                            var customisedMessage = document.getElementById("hiddenMapCookie");
                            if (customisedMessage != null && customisedMessage.value != "") {
                                message = customisedMessage.value;

                            }

                            $(".station-map > .map-canvas").append('<span class="map-placeholder">' + message + '</span>')
                        }
                    });
                });
            }

            return def.promise();
        };

        var showMap = function (mapCanvas, latitude, longitude) {
            var options = {
                scrollwheel: false,
                navigationControl: false,
                mapTypeControl: false,
                scaleControl: false,
                draggable: browserHelper.isDesktop(),
                zoom: 15,
                mapTypeId: google.maps.MapTypeId.ROADMAP,
                zoomControl: true,
                zoomControlOptions: {
                    style: google.maps.ZoomControlStyle.SMALL,
                    position: google.maps.ControlPosition.RIGHT_BOTTOM
                },
                center: new google.maps.LatLng(latitude, longitude)
            };

            var map = new google.maps.Map(mapCanvas, options);

            var marker = new google.maps.Marker({
                map: map,
                animation: google.maps.Animation.DROP,
                position: new google.maps.LatLng(latitude, longitude)
            });

            marker.setMap(map);
        };

        var textSearch = function (query) {
            var map = new google.maps.Map($('<div></div>')[0]);
            var placesService = new google.maps.places.PlacesService(map);
            var deferred = $.Deferred(function () {
                placesService.textSearch({
                    query: query,
                }, function (result, status) {
                    if (status == google.maps.places.PlacesServiceStatus.OK) {
                        deferred.resolve(result);
                    }
                    else {
                        deferred.reject();
                    }
                });
            });

            return deferred.promise();
        };

        return {
            init: init,
            showMap: showMap,
            textSearch: textSearch
        };
    });
/*! jQuery UI - v1.12.1 - 2017-08-20
* http://jqueryui.com
* Includes: widget.js, position.js, data.js, disable-selection.js, focusable.js, form-reset-mixin.js, jquery-1-7.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/draggable.js, widgets/droppable.js, widgets/resizable.js, widgets/selectable.js, widgets/sortable.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/selectmenu.js, widgets/slider.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js
* Copyright jQuery Foundation and other contributors; Licensed MIT */

(function (factory) {
    if (typeof define === "function" && define.amd) {

        // AMD. Register as an anonymous module.
        define('jqueryui',["jquery"], factory);
    } else {

        // Browser globals
        factory(jQuery);
    }
}(function ($) {

    $.ui = $.ui || {};

    var version = $.ui.version = "1.12.1";


    /*!
     * jQuery UI Widget 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Widget
    //>>group: Core
    //>>description: Provides a factory for creating stateful widgets with a common API.
    //>>docs: http://api.jqueryui.com/jQuery.widget/
    //>>demos: http://jqueryui.com/widget/



    var widgetUuid = 0;
    var widgetSlice = Array.prototype.slice;

    $.cleanData = (function (orig) {
        return function (elems) {
            var events, elem, i;
            for (i = 0; (elem = elems[i]) != null; i++) {
                try {

                    // Only trigger remove when necessary to save time
                    events = $._data(elem, "events");
                    if (events && events.remove) {
                        $(elem).triggerHandler("remove");
                    }

                    // Http://bugs.jquery.com/ticket/8235
                } catch (e) { }
            }
            orig(elems);
        };
    })($.cleanData);

    $.widget = function (name, base, prototype) {
        var existingConstructor, constructor, basePrototype;

        // ProxiedPrototype allows the provided prototype to remain unmodified
        // so that it can be used as a mixin for multiple widgets (#8876)
        var proxiedPrototype = {};

        var namespace = name.split(".")[0];
        name = name.split(".")[1];
        var fullName = namespace + "-" + name;

        if (!prototype) {
            prototype = base;
            base = $.Widget;
        }

        if ($.isArray(prototype)) {
            prototype = $.extend.apply(null, [{}].concat(prototype));
        }

        // Create selector for plugin
        $.expr[":"][fullName.toLowerCase()] = function (elem) {
            return !!$.data(elem, fullName);
        };

        $[namespace] = $[namespace] || {};
        existingConstructor = $[namespace][name];
        constructor = $[namespace][name] = function (options, element) {

            // Allow instantiation without "new" keyword
            if (!this._createWidget) {
                return new constructor(options, element);
            }

            // Allow instantiation without initializing for simple inheritance
            // must use "new" keyword (the code above always passes args)
            if (arguments.length) {
                this._createWidget(options, element);
            }
        };

        // Extend with the existing constructor to carry over any static properties
        $.extend(constructor, existingConstructor, {
            version: prototype.version,

            // Copy the object used to create the prototype in case we need to
            // redefine the widget later
            _proto: $.extend({}, prototype),

            // Track widgets that inherit from this widget in case this widget is
            // redefined after a widget inherits from it
            _childConstructors: []
        });

        basePrototype = new base();

        // We need to make the options hash a property directly on the new instance
        // otherwise we'll modify the options hash on the prototype that we're
        // inheriting from
        basePrototype.options = $.widget.extend({}, basePrototype.options);
        $.each(prototype, function (prop, value) {
            if (!$.isFunction(value)) {
                proxiedPrototype[prop] = value;
                return;
            }
            proxiedPrototype[prop] = (function () {
                function _super() {
                    return base.prototype[prop].apply(this, arguments);
                }

                function _superApply(args) {
                    return base.prototype[prop].apply(this, args);
                }

                return function () {
                    var __super = this._super;
                    var __superApply = this._superApply;
                    var returnValue;

                    this._super = _super;
                    this._superApply = _superApply;

                    returnValue = value.apply(this, arguments);

                    this._super = __super;
                    this._superApply = __superApply;

                    return returnValue;
                };
            })();
        });
        constructor.prototype = $.widget.extend(basePrototype, {

            // TODO: remove support for widgetEventPrefix
            // always use the name + a colon as the prefix, e.g., draggable:start
            // don't prefix for widgets that aren't DOM-based
            widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
        }, proxiedPrototype, {
                constructor: constructor,
                namespace: namespace,
                widgetName: name,
                widgetFullName: fullName
            });

        // If this widget is being redefined then we need to find all widgets that
        // are inheriting from it and redefine all of them so that they inherit from
        // the new version of this widget. We're essentially trying to replace one
        // level in the prototype chain.
        if (existingConstructor) {
            $.each(existingConstructor._childConstructors, function (i, child) {
                var childPrototype = child.prototype;

                // Redefine the child widget using the same prototype that was
                // originally used, but inherit from the new version of the base
                $.widget(childPrototype.namespace + "." + childPrototype.widgetName, constructor,
                    child._proto);
            });

            // Remove the list of existing child constructors from the old constructor
            // so the old child constructors can be garbage collected
            delete existingConstructor._childConstructors;
        } else {
            base._childConstructors.push(constructor);
        }

        $.widget.bridge(name, constructor);

        return constructor;
    };

    $.widget.extend = function (target) {
        var input = widgetSlice.call(arguments, 1);
        var inputIndex = 0;
        var inputLength = input.length;
        var key;
        var value;

        for (; inputIndex < inputLength; inputIndex++) {
            for (key in input[inputIndex]) {
                value = input[inputIndex][key];
                if (input[inputIndex].hasOwnProperty(key) && value !== undefined) {

                    // Clone objects
                    if ($.isPlainObject(value)) {
                        target[key] = $.isPlainObject(target[key]) ?
                            $.widget.extend({}, target[key], value) :

                            // Don't extend strings, arrays, etc. with objects
                            $.widget.extend({}, value);

                        // Copy everything else by reference
                    } else {
                        target[key] = value;
                    }
                }
            }
        }
        return target;
    };

    $.widget.bridge = function (name, object) {
        var fullName = object.prototype.widgetFullName || name;
        $.fn[name] = function (options) {
            var isMethodCall = typeof options === "string";
            var args = widgetSlice.call(arguments, 1);
            var returnValue = this;

            if (isMethodCall) {

                // If this is an empty collection, we need to have the instance method
                // return undefined instead of the jQuery instance
                if (!this.length && options === "instance") {
                    returnValue = undefined;
                } else {
                    this.each(function () {
                        var methodValue;
                        var instance = $.data(this, fullName);

                        if (options === "instance") {
                            returnValue = instance;
                            return false;
                        }

                        if (!instance) {
                            return $.error("cannot call methods on " + name +
                                " prior to initialization; " +
                                "attempted to call method '" + options + "'");
                        }

                        if (!$.isFunction(instance[options]) || options.charAt(0) === "_") {
                            return $.error("no such method '" + options + "' for " + name +
                                " widget instance");
                        }

                        methodValue = instance[options].apply(instance, args);

                        if (methodValue !== instance && methodValue !== undefined) {
                            returnValue = methodValue && methodValue.jquery ?
                                returnValue.pushStack(methodValue.get()) :
                                methodValue;
                            return false;
                        }
                    });
                }
            } else {

                // Allow multiple hashes to be passed on init
                if (args.length) {
                    options = $.widget.extend.apply(null, [options].concat(args));
                }

                this.each(function () {
                    var instance = $.data(this, fullName);
                    if (instance) {
                        instance.option(options || {});
                        if (instance._init) {
                            instance._init();
                        }
                    } else {
                        $.data(this, fullName, new object(options, this));
                    }
                });
            }

            return returnValue;
        };
    };

    $.Widget = function ( /* options, element */) { };
    $.Widget._childConstructors = [];

    $.Widget.prototype = {
        widgetName: "widget",
        widgetEventPrefix: "",
        defaultElement: "<div>",

        options: {
            classes: {},
            disabled: false,

            // Callbacks
            create: null
        },

        _createWidget: function (options, element) {
            element = $(element || this.defaultElement || this)[0];
            this.element = $(element);
            this.uuid = widgetUuid++;
            this.eventNamespace = "." + this.widgetName + this.uuid;

            this.bindings = $();
            this.hoverable = $();
            this.focusable = $();
            this.classesElementLookup = {};

            if (element !== this) {
                $.data(element, this.widgetFullName, this);
                this._on(true, this.element, {
                    remove: function (event) {
                        if (event.target === element) {
                            this.destroy();
                        }
                    }
                });
                this.document = $(element.style ?

                    // Element within the document
                    element.ownerDocument :

                    // Element is window or document
                    element.document || element);
                this.window = $(this.document[0].defaultView || this.document[0].parentWindow);
            }

            this.options = $.widget.extend({},
                this.options,
                this._getCreateOptions(),
                options);

            this._create();

            if (this.options.disabled) {
                this._setOptionDisabled(this.options.disabled);
            }

            this._trigger("create", null, this._getCreateEventData());
            this._init();
        },

        _getCreateOptions: function () {
            return {};
        },

        _getCreateEventData: $.noop,

        _create: $.noop,

        _init: $.noop,

        destroy: function () {
            var that = this;

            this._destroy();
            $.each(this.classesElementLookup, function (key, value) {
                that._removeClass(value, key);
            });

            // We can probably remove the unbind calls in 2.0
            // all event bindings should go through this._on()
            this.element
                .off(this.eventNamespace)
                .removeData(this.widgetFullName);
            this.widget()
                .off(this.eventNamespace)
                .removeAttr("aria-disabled");

            // Clean up events and states
            this.bindings.off(this.eventNamespace);
        },

        _destroy: $.noop,

        widget: function () {
            return this.element;
        },

        option: function (key, value) {
            var options = key;
            var parts;
            var curOption;
            var i;

            if (arguments.length === 0) {

                // Don't return a reference to the internal hash
                return $.widget.extend({}, this.options);
            }

            if (typeof key === "string") {

                // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
                options = {};
                parts = key.split(".");
                key = parts.shift();
                if (parts.length) {
                    curOption = options[key] = $.widget.extend({}, this.options[key]);
                    for (i = 0; i < parts.length - 1; i++) {
                        curOption[parts[i]] = curOption[parts[i]] || {};
                        curOption = curOption[parts[i]];
                    }
                    key = parts.pop();
                    if (arguments.length === 1) {
                        return curOption[key] === undefined ? null : curOption[key];
                    }
                    curOption[key] = value;
                } else {
                    if (arguments.length === 1) {
                        return this.options[key] === undefined ? null : this.options[key];
                    }
                    options[key] = value;
                }
            }

            this._setOptions(options);

            return this;
        },

        _setOptions: function (options) {
            var key;

            for (key in options) {
                this._setOption(key, options[key]);
            }

            return this;
        },

        _setOption: function (key, value) {
            if (key === "classes") {
                this._setOptionClasses(value);
            }

            this.options[key] = value;

            if (key === "disabled") {
                this._setOptionDisabled(value);
            }

            return this;
        },

        _setOptionClasses: function (value) {
            var classKey, elements, currentElements;

            for (classKey in value) {
                currentElements = this.classesElementLookup[classKey];
                if (value[classKey] === this.options.classes[classKey] ||
                    !currentElements ||
                    !currentElements.length) {
                    continue;
                }

                // We are doing this to create a new jQuery object because the _removeClass() call
                // on the next line is going to destroy the reference to the current elements being
                // tracked. We need to save a copy of this collection so that we can add the new classes
                // below.
                elements = $(currentElements.get());
                this._removeClass(currentElements, classKey);

                // We don't use _addClass() here, because that uses this.options.classes
                // for generating the string of classes. We want to use the value passed in from
                // _setOption(), this is the new value of the classes option which was passed to
                // _setOption(). We pass this value directly to _classes().
                elements.addClass(this._classes({
                    element: elements,
                    keys: classKey,
                    classes: value,
                    add: true
                }));
            }
        },

        _setOptionDisabled: function (value) {
            this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, !!value);

            // If the widget is becoming disabled, then nothing is interactive
            if (value) {
                this._removeClass(this.hoverable, null, "ui-state-hover");
                this._removeClass(this.focusable, null, "ui-state-focus");
            }
        },

        enable: function () {
            return this._setOptions({ disabled: false });
        },

        disable: function () {
            return this._setOptions({ disabled: true });
        },

        _classes: function (options) {
            var full = [];
            var that = this;

            options = $.extend({
                element: this.element,
                classes: this.options.classes || {}
            }, options);

            function processClassString(classes, checkOption) {
                var current, i;
                for (i = 0; i < classes.length; i++) {
                    current = that.classesElementLookup[classes[i]] || $();
                    if (options.add) {
                        current = $($.unique(current.get().concat(options.element.get())));
                    } else {
                        current = $(current.not(options.element).get());
                    }
                    that.classesElementLookup[classes[i]] = current;
                    full.push(classes[i]);
                    if (checkOption && options.classes[classes[i]]) {
                        full.push(options.classes[classes[i]]);
                    }
                }
            }

            this._on(options.element, {
                "remove": "_untrackClassesElement"
            });

            if (options.keys) {
                processClassString(options.keys.match(/\S+/g) || [], true);
            }
            if (options.extra) {
                processClassString(options.extra.match(/\S+/g) || []);
            }

            return full.join(" ");
        },

        _untrackClassesElement: function (event) {
            var that = this;
            $.each(that.classesElementLookup, function (key, value) {
                if ($.inArray(event.target, value) !== -1) {
                    that.classesElementLookup[key] = $(value.not(event.target).get());
                }
            });
        },

        _removeClass: function (element, keys, extra) {
            return this._toggleClass(element, keys, extra, false);
        },

        _addClass: function (element, keys, extra) {
            return this._toggleClass(element, keys, extra, true);
        },

        _toggleClass: function (element, keys, extra, add) {
            add = (typeof add === "boolean") ? add : extra;
            var shift = (typeof element === "string" || element === null),
                options = {
                    extra: shift ? keys : extra,
                    keys: shift ? element : keys,
                    element: shift ? this.element : element,
                    add: add
                };
            options.element.toggleClass(this._classes(options), add);
            return this;
        },

        _on: function (suppressDisabledCheck, element, handlers) {
            var delegateElement;
            var instance = this;

            // No suppressDisabledCheck flag, shuffle arguments
            if (typeof suppressDisabledCheck !== "boolean") {
                handlers = element;
                element = suppressDisabledCheck;
                suppressDisabledCheck = false;
            }

            // No element argument, shuffle and use this.element
            if (!handlers) {
                handlers = element;
                element = this.element;
                delegateElement = this.widget();
            } else {
                element = delegateElement = $(element);
                this.bindings = this.bindings.add(element);
            }

            $.each(handlers, function (event, handler) {
                function handlerProxy() {

                    // Allow widgets to customize the disabled handling
                    // - disabled as an array instead of boolean
                    // - disabled class as method for disabling individual parts
                    if (!suppressDisabledCheck &&
                        (instance.options.disabled === true ||
                            $(this).hasClass("ui-state-disabled"))) {
                        return;
                    }
                    return (typeof handler === "string" ? instance[handler] : handler)
                        .apply(instance, arguments);
                }

                // Copy the guid so direct unbinding works
                if (typeof handler !== "string") {
                    handlerProxy.guid = handler.guid =
                        handler.guid || handlerProxy.guid || $.guid++;
                }

                var match = event.match(/^([\w:-]*)\s*(.*)$/);
                var eventName = match[1] + instance.eventNamespace;
                var selector = match[2];

                if (selector) {
                    delegateElement.on(eventName, selector, handlerProxy);
                } else {
                    element.on(eventName, handlerProxy);
                }
            });
        },

        _off: function (element, eventName) {
            eventName = (eventName || "").split(" ").join(this.eventNamespace + " ") +
                this.eventNamespace;
            element.off(eventName).off(eventName);

            // Clear the stack to avoid memory leaks (#10056)
            this.bindings = $(this.bindings.not(element).get());
            this.focusable = $(this.focusable.not(element).get());
            this.hoverable = $(this.hoverable.not(element).get());
        },

        _delay: function (handler, delay) {
            function handlerProxy() {
                return (typeof handler === "string" ? instance[handler] : handler)
                    .apply(instance, arguments);
            }
            var instance = this;
            return setTimeout(handlerProxy, delay || 0);
        },

        _hoverable: function (element) {
            this.hoverable = this.hoverable.add(element);
            this._on(element, {
                mouseenter: function (event) {
                    this._addClass($(event.currentTarget), null, "ui-state-hover");
                },
                mouseleave: function (event) {
                    this._removeClass($(event.currentTarget), null, "ui-state-hover");
                }
            });
        },

        _focusable: function (element) {
            this.focusable = this.focusable.add(element);
            this._on(element, {
                focusin: function (event) {
                    this._addClass($(event.currentTarget), null, "ui-state-focus");
                },
                focusout: function (event) {
                    this._removeClass($(event.currentTarget), null, "ui-state-focus");
                }
            });
        },

        _trigger: function (type, event, data) {
            var prop, orig;
            var callback = this.options[type];

            data = data || {};
            event = $.Event(event);
            event.type = (type === this.widgetEventPrefix ?
                type :
                this.widgetEventPrefix + type).toLowerCase();

            // The original event may come from any element
            // so we need to reset the target on the new event
            event.target = this.element[0];

            // Copy original event properties over to the new event
            orig = event.originalEvent;
            if (orig) {
                for (prop in orig) {
                    if (!(prop in event)) {
                        event[prop] = orig[prop];
                    }
                }
            }

            this.element.trigger(event, data);
            return !($.isFunction(callback) &&
                callback.apply(this.element[0], [event].concat(data)) === false ||
                event.isDefaultPrevented());
        }
    };

    $.each({ show: "fadeIn", hide: "fadeOut" }, function (method, defaultEffect) {
        $.Widget.prototype["_" + method] = function (element, options, callback) {
            if (typeof options === "string") {
                options = { effect: options };
            }

            var hasOptions;
            var effectName = !options ?
                method :
                options === true || typeof options === "number" ?
                    defaultEffect :
                    options.effect || defaultEffect;

            options = options || {};
            if (typeof options === "number") {
                options = { duration: options };
            }

            hasOptions = !$.isEmptyObject(options);
            options.complete = callback;

            if (options.delay) {
                element.delay(options.delay);
            }

            if (hasOptions && $.effects && $.effects.effect[effectName]) {
                element[method](options);
            } else if (effectName !== method && element[effectName]) {
                element[effectName](options.duration, options.easing, callback);
            } else {
                element.queue(function (next) {
                    $(this)[method]();
                    if (callback) {
                        callback.call(element[0]);
                    }
                    next();
                });
            }
        };
    });

    var widget = $.widget;


    /*!
     * jQuery UI Position 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     *
     * http://api.jqueryui.com/position/
     */

    //>>label: Position
    //>>group: Core
    //>>description: Positions elements relative to other elements.
    //>>docs: http://api.jqueryui.com/position/
    //>>demos: http://jqueryui.com/position/


    (function () {
        var cachedScrollbarWidth,
            max = Math.max,
            abs = Math.abs,
            rhorizontal = /left|center|right/,
            rvertical = /top|center|bottom/,
            roffset = /[\+\-]\d+(\.[\d]+)?%?/,
            rposition = /^\w+/,
            rpercent = /%$/,
            _position = $.fn.position;

        function getOffsets(offsets, width, height) {
            return [
                parseFloat(offsets[0]) * (rpercent.test(offsets[0]) ? width / 100 : 1),
                parseFloat(offsets[1]) * (rpercent.test(offsets[1]) ? height / 100 : 1)
            ];
        }

        function parseCss(element, property) {
            return parseInt($.css(element, property), 10) || 0;
        }

        function getDimensions(elem) {
            var raw = elem[0];
            if (raw.nodeType === 9) {
                return {
                    width: elem.width(),
                    height: elem.height(),
                    offset: { top: 0, left: 0 }
                };
            }
            if ($.isWindow(raw)) {
                return {
                    width: elem.width(),
                    height: elem.height(),
                    offset: { top: elem.scrollTop(), left: elem.scrollLeft() }
                };
            }
            if (raw.preventDefault) {
                return {
                    width: 0,
                    height: 0,
                    offset: { top: raw.pageY, left: raw.pageX }
                };
            }
            return {
                width: elem.outerWidth(),
                height: elem.outerHeight(),
                offset: elem.offset()
            };
        }

        $.position = {
            scrollbarWidth: function () {
                if (cachedScrollbarWidth !== undefined) {
                    return cachedScrollbarWidth;
                }
                var w1, w2,
                    div = $("<div " +
                        "style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'>" +
                        "<div style='height:100px;width:auto;'></div></div>"),
                    innerDiv = div.children()[0];

                $("body").append(div);
                w1 = innerDiv.offsetWidth;
                div.css("overflow", "scroll");

                w2 = innerDiv.offsetWidth;

                if (w1 === w2) {
                    w2 = div[0].clientWidth;
                }

                div.remove();

                return (cachedScrollbarWidth = w1 - w2);
            },
            getScrollInfo: function (within) {
                var overflowX = within.isWindow || within.isDocument ? "" :
                    within.element.css("overflow-x"),
                    overflowY = within.isWindow || within.isDocument ? "" :
                        within.element.css("overflow-y"),
                    hasOverflowX = overflowX === "scroll" ||
                        (overflowX === "auto" && within.width < within.element[0].scrollWidth),
                    hasOverflowY = overflowY === "scroll" ||
                        (overflowY === "auto" && within.height < within.element[0].scrollHeight);
                return {
                    width: hasOverflowY ? $.position.scrollbarWidth() : 0,
                    height: hasOverflowX ? $.position.scrollbarWidth() : 0
                };
            },
            getWithinInfo: function (element) {
                var withinElement = $(element || window),
                    isWindow = $.isWindow(withinElement[0]),
                    isDocument = !!withinElement[0] && withinElement[0].nodeType === 9,
                    hasOffset = !isWindow && !isDocument;
                return {
                    element: withinElement,
                    isWindow: isWindow,
                    isDocument: isDocument,
                    offset: hasOffset ? $(element).offset() : { left: 0, top: 0 },
                    scrollLeft: withinElement.scrollLeft(),
                    scrollTop: withinElement.scrollTop(),
                    width: withinElement.outerWidth(),
                    height: withinElement.outerHeight()
                };
            }
        };

        $.fn.position = function (options) {
            if (!options || !options.of) {
                return _position.apply(this, arguments);
            }

            // Make a copy, we don't want to modify arguments
            options = $.extend({}, options);

            var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,
                target = $(options.of),
                within = $.position.getWithinInfo(options.within),
                scrollInfo = $.position.getScrollInfo(within),
                collision = (options.collision || "flip").split(" "),
                offsets = {};

            dimensions = getDimensions(target);
            if (target[0].preventDefault) {

                // Force left top to allow flipping
                options.at = "left top";
            }
            targetWidth = dimensions.width;
            targetHeight = dimensions.height;
            targetOffset = dimensions.offset;

            // Clone to reuse original targetOffset later
            basePosition = $.extend({}, targetOffset);

            // Force my and at to have valid horizontal and vertical positions
            // if a value is missing or invalid, it will be converted to center
            $.each(["my", "at"], function () {
                var pos = (options[this] || "").split(" "),
                    horizontalOffset,
                    verticalOffset;

                if (pos.length === 1) {
                    pos = rhorizontal.test(pos[0]) ?
                        pos.concat(["center"]) :
                        rvertical.test(pos[0]) ?
                            ["center"].concat(pos) :
                            ["center", "center"];
                }
                pos[0] = rhorizontal.test(pos[0]) ? pos[0] : "center";
                pos[1] = rvertical.test(pos[1]) ? pos[1] : "center";

                // Calculate offsets
                horizontalOffset = roffset.exec(pos[0]);
                verticalOffset = roffset.exec(pos[1]);
                offsets[this] = [
                    horizontalOffset ? horizontalOffset[0] : 0,
                    verticalOffset ? verticalOffset[0] : 0
                ];

                // Reduce to just the positions without the offsets
                options[this] = [
                    rposition.exec(pos[0])[0],
                    rposition.exec(pos[1])[0]
                ];
            });

            // Normalize collision option
            if (collision.length === 1) {
                collision[1] = collision[0];
            }

            if (options.at[0] === "right") {
                basePosition.left += targetWidth;
            } else if (options.at[0] === "center") {
                basePosition.left += targetWidth / 2;
            }

            if (options.at[1] === "bottom") {
                basePosition.top += targetHeight;
            } else if (options.at[1] === "center") {
                basePosition.top += targetHeight / 2;
            }

            atOffset = getOffsets(offsets.at, targetWidth, targetHeight);
            basePosition.left += atOffset[0];
            basePosition.top += atOffset[1];

            return this.each(function () {
                var collisionPosition, using,
                    elem = $(this),
                    elemWidth = elem.outerWidth(),
                    elemHeight = elem.outerHeight(),
                    marginLeft = parseCss(this, "marginLeft"),
                    marginTop = parseCss(this, "marginTop"),
                    collisionWidth = elemWidth + marginLeft + parseCss(this, "marginRight") +
                        scrollInfo.width,
                    collisionHeight = elemHeight + marginTop + parseCss(this, "marginBottom") +
                        scrollInfo.height,
                    position = $.extend({}, basePosition),
                    myOffset = getOffsets(offsets.my, elem.outerWidth(), elem.outerHeight());

                if (options.my[0] === "right") {
                    position.left -= elemWidth;
                } else if (options.my[0] === "center") {
                    position.left -= elemWidth / 2;
                }

                if (options.my[1] === "bottom") {
                    position.top -= elemHeight;
                } else if (options.my[1] === "center") {
                    position.top -= elemHeight / 2;
                }

                position.left += myOffset[0];
                position.top += myOffset[1];

                collisionPosition = {
                    marginLeft: marginLeft,
                    marginTop: marginTop
                };

                $.each(["left", "top"], function (i, dir) {
                    if ($.ui.position[collision[i]]) {
                        $.ui.position[collision[i]][dir](position, {
                            targetWidth: targetWidth,
                            targetHeight: targetHeight,
                            elemWidth: elemWidth,
                            elemHeight: elemHeight,
                            collisionPosition: collisionPosition,
                            collisionWidth: collisionWidth,
                            collisionHeight: collisionHeight,
                            offset: [atOffset[0] + myOffset[0], atOffset[1] + myOffset[1]],
                            my: options.my,
                            at: options.at,
                            within: within,
                            elem: elem
                        });
                    }
                });

                if (options.using) {

                    // Adds feedback as second argument to using callback, if present
                    using = function (props) {
                        var left = targetOffset.left - position.left,
                            right = left + targetWidth - elemWidth,
                            top = targetOffset.top - position.top,
                            bottom = top + targetHeight - elemHeight,
                            feedback = {
                                target: {
                                    element: target,
                                    left: targetOffset.left,
                                    top: targetOffset.top,
                                    width: targetWidth,
                                    height: targetHeight
                                },
                                element: {
                                    element: elem,
                                    left: position.left,
                                    top: position.top,
                                    width: elemWidth,
                                    height: elemHeight
                                },
                                horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
                                vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
                            };
                        if (targetWidth < elemWidth && abs(left + right) < targetWidth) {
                            feedback.horizontal = "center";
                        }
                        if (targetHeight < elemHeight && abs(top + bottom) < targetHeight) {
                            feedback.vertical = "middle";
                        }
                        if (max(abs(left), abs(right)) > max(abs(top), abs(bottom))) {
                            feedback.important = "horizontal";
                        } else {
                            feedback.important = "vertical";
                        }
                        options.using.call(this, props, feedback);
                    };
                }

                elem.offset($.extend(position, { using: using }));
            });
        };

        $.ui.position = {
            fit: {
                left: function (position, data) {
                    var within = data.within,
                        withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
                        outerWidth = within.width,
                        collisionPosLeft = position.left - data.collisionPosition.marginLeft,
                        overLeft = withinOffset - collisionPosLeft,
                        overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
                        newOverRight;

                    // Element is wider than within
                    if (data.collisionWidth > outerWidth) {

                        // Element is initially over the left side of within
                        if (overLeft > 0 && overRight <= 0) {
                            newOverRight = position.left + overLeft + data.collisionWidth - outerWidth -
                                withinOffset;
                            position.left += overLeft - newOverRight;

                            // Element is initially over right side of within
                        } else if (overRight > 0 && overLeft <= 0) {
                            position.left = withinOffset;

                            // Element is initially over both left and right sides of within
                        } else {
                            if (overLeft > overRight) {
                                position.left = withinOffset + outerWidth - data.collisionWidth;
                            } else {
                                position.left = withinOffset;
                            }
                        }

                        // Too far left -> align with left edge
                    } else if (overLeft > 0) {
                        position.left += overLeft;

                        // Too far right -> align with right edge
                    } else if (overRight > 0) {
                        position.left -= overRight;

                        // Adjust based on position and margin
                    } else {
                        position.left = max(position.left - collisionPosLeft, position.left);
                    }
                },
                top: function (position, data) {
                    var within = data.within,
                        withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
                        outerHeight = data.within.height,
                        collisionPosTop = position.top - data.collisionPosition.marginTop,
                        overTop = withinOffset - collisionPosTop,
                        overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
                        newOverBottom;

                    // Element is taller than within
                    if (data.collisionHeight > outerHeight) {

                        // Element is initially over the top of within
                        if (overTop > 0 && overBottom <= 0) {
                            newOverBottom = position.top + overTop + data.collisionHeight - outerHeight -
                                withinOffset;
                            position.top += overTop - newOverBottom;

                            // Element is initially over bottom of within
                        } else if (overBottom > 0 && overTop <= 0) {
                            position.top = withinOffset;

                            // Element is initially over both top and bottom of within
                        } else {
                            if (overTop > overBottom) {
                                position.top = withinOffset + outerHeight - data.collisionHeight;
                            } else {
                                position.top = withinOffset;
                            }
                        }

                        // Too far up -> align with top
                    } else if (overTop > 0) {
                        position.top += overTop;

                        // Too far down -> align with bottom edge
                    } else if (overBottom > 0) {
                        position.top -= overBottom;

                        // Adjust based on position and margin
                    } else {
                        position.top = max(position.top - collisionPosTop, position.top);
                    }
                }
            },
            flip: {
                left: function (position, data) {
                    var within = data.within,
                        withinOffset = within.offset.left + within.scrollLeft,
                        outerWidth = within.width,
                        offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
                        collisionPosLeft = position.left - data.collisionPosition.marginLeft,
                        overLeft = collisionPosLeft - offsetLeft,
                        overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
                        myOffset = data.my[0] === "left" ?
                            -data.elemWidth :
                            data.my[0] === "right" ?
                                data.elemWidth :
                                0,
                        atOffset = data.at[0] === "left" ?
                            data.targetWidth :
                            data.at[0] === "right" ?
                                -data.targetWidth :
                                0,
                        offset = -2 * data.offset[0],
                        newOverRight,
                        newOverLeft;

                    if (overLeft < 0) {
                        newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth -
                            outerWidth - withinOffset;
                        if (newOverRight < 0 || newOverRight < abs(overLeft)) {
                            position.left += myOffset + atOffset + offset;
                        }
                    } else if (overRight > 0) {
                        newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset +
                            atOffset + offset - offsetLeft;
                        if (newOverLeft > 0 || abs(newOverLeft) < overRight) {
                            position.left += myOffset + atOffset + offset;
                        }
                    }
                },
                top: function (position, data) {
                    var within = data.within,
                        withinOffset = within.offset.top + within.scrollTop,
                        outerHeight = within.height,
                        offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
                        collisionPosTop = position.top - data.collisionPosition.marginTop,
                        overTop = collisionPosTop - offsetTop,
                        overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
                        top = data.my[1] === "top",
                        myOffset = top ?
                            -data.elemHeight :
                            data.my[1] === "bottom" ?
                                data.elemHeight :
                                0,
                        atOffset = data.at[1] === "top" ?
                            data.targetHeight :
                            data.at[1] === "bottom" ?
                                -data.targetHeight :
                                0,
                        offset = -2 * data.offset[1],
                        newOverTop,
                        newOverBottom;
                    if (overTop < 0) {
                        newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight -
                            outerHeight - withinOffset;
                        if (newOverBottom < 0 || newOverBottom < abs(overTop)) {
                            position.top += myOffset + atOffset + offset;
                        }
                    } else if (overBottom > 0) {
                        newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset +
                            offset - offsetTop;
                        if (newOverTop > 0 || abs(newOverTop) < overBottom) {
                            position.top += myOffset + atOffset + offset;
                        }
                    }
                }
            },
            flipfit: {
                left: function () {
                    $.ui.position.flip.left.apply(this, arguments);
                    $.ui.position.fit.left.apply(this, arguments);
                },
                top: function () {
                    $.ui.position.flip.top.apply(this, arguments);
                    $.ui.position.fit.top.apply(this, arguments);
                }
            }
        };

    })();

    var position = $.ui.position;


    /*!
     * jQuery UI :data 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: :data Selector
    //>>group: Core
    //>>description: Selects elements which have data stored under the specified key.
    //>>docs: http://api.jqueryui.com/data-selector/


    var data = $.extend($.expr[":"], {
        data: $.expr.createPseudo ?
            $.expr.createPseudo(function (dataName) {
                return function (elem) {
                    return !!$.data(elem, dataName);
                };
            }) :

            // Support: jQuery <1.8
            function (elem, i, match) {
                return !!$.data(elem, match[3]);
            }
    });

    /*!
     * jQuery UI Disable Selection 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: disableSelection
    //>>group: Core
    //>>description: Disable selection of text content within the set of matched elements.
    //>>docs: http://api.jqueryui.com/disableSelection/

    // This file is deprecated


    var disableSelection = $.fn.extend({
        disableSelection: (function () {
            var eventType = "onselectstart" in document.createElement("div") ?
                "selectstart" :
                "mousedown";

            return function () {
                return this.on(eventType + ".ui-disableSelection", function (event) {
                    event.preventDefault();
                });
            };
        })(),

        enableSelection: function () {
            return this.off(".ui-disableSelection");
        }
    });


    /*!
     * jQuery UI Focusable 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: :focusable Selector
    //>>group: Core
    //>>description: Selects elements which can be focused.
    //>>docs: http://api.jqueryui.com/focusable-selector/



    // Selectors
    $.ui.focusable = function (element, hasTabindex) {
        var map, mapName, img, focusableIfVisible, fieldset,
            nodeName = element.nodeName.toLowerCase();

        if ("area" === nodeName) {
            map = element.parentNode;
            mapName = map.name;
            if (!element.href || !mapName || map.nodeName.toLowerCase() !== "map") {
                return false;
            }
            img = $("img[usemap='#" + mapName + "']");
            return img.length > 0 && img.is(":visible");
        }

        if (/^(input|select|textarea|button|object)$/.test(nodeName)) {
            focusableIfVisible = !element.disabled;

            if (focusableIfVisible) {

                // Form controls within a disabled fieldset are disabled.
                // However, controls within the fieldset's legend do not get disabled.
                // Since controls generally aren't placed inside legends, we skip
                // this portion of the check.
                fieldset = $(element).closest("fieldset")[0];
                if (fieldset) {
                    focusableIfVisible = !fieldset.disabled;
                }
            }
        } else if ("a" === nodeName) {
            focusableIfVisible = element.href || hasTabindex;
        } else {
            focusableIfVisible = hasTabindex;
        }

        return focusableIfVisible && $(element).is(":visible") && visible($(element));
    };

    // Support: IE 8 only
    // IE 8 doesn't resolve inherit to visible/hidden for computed values
    function visible(element) {
        var visibility = element.css("visibility");
        while (visibility === "inherit") {
            element = element.parent();
            visibility = element.css("visibility");
        }
        return visibility !== "hidden";
    }

    $.extend($.expr[":"], {
        focusable: function (element) {
            return $.ui.focusable(element, $.attr(element, "tabindex") != null);
        }
    });

    var focusable = $.ui.focusable;




    // Support: IE8 Only
    // IE8 does not support the form attribute and when it is supplied. It overwrites the form prop
    // with a string, so we need to find the proper form.
    var form = $.fn.form = function () {
        return typeof this[0].form === "string" ? this.closest("form") : $(this[0].form);
    };


    /*!
     * jQuery UI Form Reset Mixin 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Form Reset Mixin
    //>>group: Core
    //>>description: Refresh input widgets when their form is reset
    //>>docs: http://api.jqueryui.com/form-reset-mixin/



    var formResetMixin = $.ui.formResetMixin = {
        _formResetHandler: function () {
            var form = $(this);

            // Wait for the form reset to actually happen before refreshing
            setTimeout(function () {
                var instances = form.data("ui-form-reset-instances");
                $.each(instances, function () {
                    this.refresh();
                });
            });
        },

        _bindFormResetHandler: function () {
            this.form = this.element.form();
            if (!this.form.length) {
                return;
            }

            var instances = this.form.data("ui-form-reset-instances") || [];
            if (!instances.length) {

                // We don't use _on() here because we use a single event handler per form
                this.form.on("reset.ui-form-reset", this._formResetHandler);
            }
            instances.push(this);
            this.form.data("ui-form-reset-instances", instances);
        },

        _unbindFormResetHandler: function () {
            if (!this.form.length) {
                return;
            }

            var instances = this.form.data("ui-form-reset-instances");
            instances.splice($.inArray(this, instances), 1);
            if (instances.length) {
                this.form.data("ui-form-reset-instances", instances);
            } else {
                this.form
                    .removeData("ui-form-reset-instances")
                    .off("reset.ui-form-reset");
            }
        }
    };


    /*!
     * jQuery UI Support for jQuery core 1.7.x 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     *
     */

    //>>label: jQuery 1.7 Support
    //>>group: Core
    //>>description: Support version 1.7.x of jQuery core



    // Support: jQuery 1.7 only
    // Not a great way to check versions, but since we only support 1.7+ and only
    // need to detect <1.8, this is a simple check that should suffice. Checking
    // for "1.7." would be a bit safer, but the version string is 1.7, not 1.7.0
    // and we'll never reach 1.70.0 (if we do, we certainly won't be supporting
    // 1.7 anymore). See #11197 for why we're not using feature detection.
    if ($.fn.jquery.substring(0, 3) === "1.7") {

        // Setters for .innerWidth(), .innerHeight(), .outerWidth(), .outerHeight()
        // Unlike jQuery Core 1.8+, these only support numeric values to set the
        // dimensions in pixels
        $.each(["Width", "Height"], function (i, name) {
            var side = name === "Width" ? ["Left", "Right"] : ["Top", "Bottom"],
                type = name.toLowerCase(),
                orig = {
                    innerWidth: $.fn.innerWidth,
                    innerHeight: $.fn.innerHeight,
                    outerWidth: $.fn.outerWidth,
                    outerHeight: $.fn.outerHeight
                };

            function reduce(elem, size, border, margin) {
                $.each(side, function () {
                    size -= parseFloat($.css(elem, "padding" + this)) || 0;
                    if (border) {
                        size -= parseFloat($.css(elem, "border" + this + "Width")) || 0;
                    }
                    if (margin) {
                        size -= parseFloat($.css(elem, "margin" + this)) || 0;
                    }
                });
                return size;
            }

            $.fn["inner" + name] = function (size) {
                if (size === undefined) {
                    return orig["inner" + name].call(this);
                }

                return this.each(function () {
                    $(this).css(type, reduce(this, size) + "px");
                });
            };

            $.fn["outer" + name] = function (size, margin) {
                if (typeof size !== "number") {
                    return orig["outer" + name].call(this, size);
                }

                return this.each(function () {
                    $(this).css(type, reduce(this, size, true, margin) + "px");
                });
            };
        });

        $.fn.addBack = function (selector) {
            return this.add(selector == null ?
                this.prevObject : this.prevObject.filter(selector)
            );
        };
    }

    ;
    /*!
     * jQuery UI Keycode 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Keycode
    //>>group: Core
    //>>description: Provide keycodes as keynames
    //>>docs: http://api.jqueryui.com/jQuery.ui.keyCode/


    var keycode = $.ui.keyCode = {
        BACKSPACE: 8,
        COMMA: 188,
        DELETE: 46,
        DOWN: 40,
        END: 35,
        ENTER: 13,
        ESCAPE: 27,
        HOME: 36,
        LEFT: 37,
        PAGE_DOWN: 34,
        PAGE_UP: 33,
        PERIOD: 190,
        RIGHT: 39,
        SPACE: 32,
        TAB: 9,
        UP: 38
    };




    // Internal use only
    var escapeSelector = $.ui.escapeSelector = (function () {
        var selectorEscape = /([!"#$%&'()*+,./:;<=>?@[\]^`{|}~])/g;
        return function (selector) {
            return selector.replace(selectorEscape, "\\$1");
        };
    })();


    /*!
     * jQuery UI Labels 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: labels
    //>>group: Core
    //>>description: Find all the labels associated with a given input
    //>>docs: http://api.jqueryui.com/labels/



    var labels = $.fn.labels = function () {
        var ancestor, selector, id, labels, ancestors;

        // Check control.labels first
        if (this[0].labels && this[0].labels.length) {
            return this.pushStack(this[0].labels);
        }

        // Support: IE <= 11, FF <= 37, Android <= 2.3 only
        // Above browsers do not support control.labels. Everything below is to support them
        // as well as document fragments. control.labels does not work on document fragments
        labels = this.eq(0).parents("label");

        // Look for the label based on the id
        id = this.attr("id");
        if (id) {

            // We don't search against the document in case the element
            // is disconnected from the DOM
            ancestor = this.eq(0).parents().last();

            // Get a full set of top level ancestors
            ancestors = ancestor.add(ancestor.length ? ancestor.siblings() : this.siblings());

            // Create a selector for the label based on the id
            selector = "label[for='" + $.ui.escapeSelector(id) + "']";

            labels = labels.add(ancestors.find(selector).addBack(selector));

        }

        // Return whatever we have found for labels
        return this.pushStack(labels);
    };


    /*!
     * jQuery UI Scroll Parent 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: scrollParent
    //>>group: Core
    //>>description: Get the closest ancestor element that is scrollable.
    //>>docs: http://api.jqueryui.com/scrollParent/



    var scrollParent = $.fn.scrollParent = function (includeHidden) {
        var position = this.css("position"),
            excludeStaticParent = position === "absolute",
            overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/,
            scrollParent = this.parents().filter(function () {
                var parent = $(this);
                if (excludeStaticParent && parent.css("position") === "static") {
                    return false;
                }
                return overflowRegex.test(parent.css("overflow") + parent.css("overflow-y") +
                    parent.css("overflow-x"));
            }).eq(0);

        return position === "fixed" || !scrollParent.length ?
            $(this[0].ownerDocument || document) :
            scrollParent;
    };


    /*!
     * jQuery UI Tabbable 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: :tabbable Selector
    //>>group: Core
    //>>description: Selects elements which can be tabbed to.
    //>>docs: http://api.jqueryui.com/tabbable-selector/



    var tabbable = $.extend($.expr[":"], {
        tabbable: function (element) {
            var tabIndex = $.attr(element, "tabindex"),
                hasTabindex = tabIndex != null;
            return (!hasTabindex || tabIndex >= 0) && $.ui.focusable(element, hasTabindex);
        }
    });


    /*!
     * jQuery UI Unique ID 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: uniqueId
    //>>group: Core
    //>>description: Functions to generate and remove uniqueId's
    //>>docs: http://api.jqueryui.com/uniqueId/



    var uniqueId = $.fn.extend({
        uniqueId: (function () {
            var uuid = 0;

            return function () {
                return this.each(function () {
                    if (!this.id) {
                        this.id = "ui-id-" + (++uuid);
                    }
                });
            };
        })(),

        removeUniqueId: function () {
            return this.each(function () {
                if (/^ui-id-\d+$/.test(this.id)) {
                    $(this).removeAttr("id");
                }
            });
        }
    });




    // This file is deprecated
    var ie = $.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());

    /*!
     * jQuery UI Mouse 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Mouse
    //>>group: Widgets
    //>>description: Abstracts mouse-based interactions to assist in creating certain widgets.
    //>>docs: http://api.jqueryui.com/mouse/



    var mouseHandled = false;
    $(document).on("mouseup", function () {
        mouseHandled = false;
    });

    var widgetsMouse = $.widget("ui.mouse", {
        version: "1.12.1",
        options: {
            cancel: "input, textarea, button, select, option",
            distance: 1,
            delay: 0
        },
        _mouseInit: function () {
            var that = this;

            this.element
                .on("mousedown." + this.widgetName, function (event) {
                    return that._mouseDown(event);
                })
                .on("click." + this.widgetName, function (event) {
                    if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) {
                        $.removeData(event.target, that.widgetName + ".preventClickEvent");
                        event.stopImmediatePropagation();
                        return false;
                    }
                });

            this.started = false;
        },

        // TODO: make sure destroying one instance of mouse doesn't mess with
        // other instances of mouse
        _mouseDestroy: function () {
            this.element.off("." + this.widgetName);
            if (this._mouseMoveDelegate) {
                this.document
                    .off("mousemove." + this.widgetName, this._mouseMoveDelegate)
                    .off("mouseup." + this.widgetName, this._mouseUpDelegate);
            }
        },

        _mouseDown: function (event) {

            // don't let more than one widget handle mouseStart
            if (mouseHandled) {
                return;
            }

            this._mouseMoved = false;

            // We may have missed mouseup (out of window)
            (this._mouseStarted && this._mouseUp(event));

            this._mouseDownEvent = event;

            var that = this,
                btnIsLeft = (event.which === 1),

                // event.target.nodeName works around a bug in IE 8 with
                // disabled inputs (#7620)
                elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ?
                    $(event.target).closest(this.options.cancel).length : false);
            if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
                return true;
            }

            this.mouseDelayMet = !this.options.delay;
            if (!this.mouseDelayMet) {
                this._mouseDelayTimer = setTimeout(function () {
                    that.mouseDelayMet = true;
                }, this.options.delay);
            }

            if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
                this._mouseStarted = (this._mouseStart(event) !== false);
                if (!this._mouseStarted) {
                    event.preventDefault();
                    return true;
                }
            }

            // Click event may never have fired (Gecko & Opera)
            if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) {
                $.removeData(event.target, this.widgetName + ".preventClickEvent");
            }

            // These delegates are required to keep context
            this._mouseMoveDelegate = function (event) {
                return that._mouseMove(event);
            };
            this._mouseUpDelegate = function (event) {
                return that._mouseUp(event);
            };

            this.document
                .on("mousemove." + this.widgetName, this._mouseMoveDelegate)
                .on("mouseup." + this.widgetName, this._mouseUpDelegate);

            event.preventDefault();

            mouseHandled = true;
            return true;
        },

        _mouseMove: function (event) {

            // Only check for mouseups outside the document if you've moved inside the document
            // at least once. This prevents the firing of mouseup in the case of IE<9, which will
            // fire a mousemove event if content is placed under the cursor. See #7778
            // Support: IE <9
            if (this._mouseMoved) {

                // IE mouseup check - mouseup happened when mouse was out of window
                if ($.ui.ie && (!document.documentMode || document.documentMode < 9) &&
                    !event.button) {
                    return this._mouseUp(event);

                    // Iframe mouseup check - mouseup occurred in another document
                } else if (!event.which) {

                    // Support: Safari <=8 - 9
                    // Safari sets which to 0 if you press any of the following keys
                    // during a drag (#14461)
                    if (event.originalEvent.altKey || event.originalEvent.ctrlKey ||
                        event.originalEvent.metaKey || event.originalEvent.shiftKey) {
                        this.ignoreMissingWhich = true;
                    } else if (!this.ignoreMissingWhich) {
                        return this._mouseUp(event);
                    }
                }
            }

            if (event.which || event.button) {
                this._mouseMoved = true;
            }

            if (this._mouseStarted) {
                this._mouseDrag(event);
                return event.preventDefault();
            }

            if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
                this._mouseStarted =
                    (this._mouseStart(this._mouseDownEvent, event) !== false);
                (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
            }

            return !this._mouseStarted;
        },

        _mouseUp: function (event) {
            this.document
                .off("mousemove." + this.widgetName, this._mouseMoveDelegate)
                .off("mouseup." + this.widgetName, this._mouseUpDelegate);

            if (this._mouseStarted) {
                this._mouseStarted = false;

                if (event.target === this._mouseDownEvent.target) {
                    $.data(event.target, this.widgetName + ".preventClickEvent", true);
                }

                this._mouseStop(event);
            }

            if (this._mouseDelayTimer) {
                clearTimeout(this._mouseDelayTimer);
                delete this._mouseDelayTimer;
            }

            this.ignoreMissingWhich = false;
            mouseHandled = false;
            event.preventDefault();
        },

        _mouseDistanceMet: function (event) {
            return (Math.max(
                Math.abs(this._mouseDownEvent.pageX - event.pageX),
                Math.abs(this._mouseDownEvent.pageY - event.pageY)
            ) >= this.options.distance
            );
        },

        _mouseDelayMet: function ( /* event */) {
            return this.mouseDelayMet;
        },

        // These are placeholder methods, to be overriden by extending plugin
        _mouseStart: function ( /* event */) { },
        _mouseDrag: function ( /* event */) { },
        _mouseStop: function ( /* event */) { },
        _mouseCapture: function ( /* event */) { return true; }
    });




    // $.ui.plugin is deprecated. Use $.widget() extensions instead.
    var plugin = $.ui.plugin = {
        add: function (module, option, set) {
            var i,
                proto = $.ui[module].prototype;
            for (i in set) {
                proto.plugins[i] = proto.plugins[i] || [];
                proto.plugins[i].push([option, set[i]]);
            }
        },
        call: function (instance, name, args, allowDisconnected) {
            var i,
                set = instance.plugins[name];

            if (!set) {
                return;
            }

            if (!allowDisconnected && (!instance.element[0].parentNode ||
                instance.element[0].parentNode.nodeType === 11)) {
                return;
            }

            for (i = 0; i < set.length; i++) {
                if (instance.options[set[i][0]]) {
                    set[i][1].apply(instance.element, args);
                }
            }
        }
    };



    var safeActiveElement = $.ui.safeActiveElement = function (document) {
        var activeElement;

        // Support: IE 9 only
        // IE9 throws an "Unspecified error" accessing document.activeElement from an <iframe>
        try {
            activeElement = document.activeElement;
        } catch (error) {
            activeElement = document.body;
        }

        // Support: IE 9 - 11 only
        // IE may return null instead of an element
        // Interestingly, this only seems to occur when NOT in an iframe
        if (!activeElement) {
            activeElement = document.body;
        }

        // Support: IE 11 only
        // IE11 returns a seemingly empty object in some cases when accessing
        // document.activeElement from an <iframe>
        if (!activeElement.nodeName) {
            activeElement = document.body;
        }

        return activeElement;
    };



    var safeBlur = $.ui.safeBlur = function (element) {

        // Support: IE9 - 10 only
        // If the <body> is blurred, IE will switch windows, see #9420
        if (element && element.nodeName.toLowerCase() !== "body") {
            $(element).trigger("blur");
        }
    };


    /*!
     * jQuery UI Draggable 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Draggable
    //>>group: Interactions
    //>>description: Enables dragging functionality for any element.
    //>>docs: http://api.jqueryui.com/draggable/
    //>>demos: http://jqueryui.com/draggable/
    //>>css.structure: ../../themes/base/draggable.css



    $.widget("ui.draggable", $.ui.mouse, {
        version: "1.12.1",
        widgetEventPrefix: "drag",
        options: {
            addClasses: true,
            appendTo: "parent",
            axis: false,
            connectToSortable: false,
            containment: false,
            cursor: "auto",
            cursorAt: false,
            grid: false,
            handle: false,
            helper: "original",
            iframeFix: false,
            opacity: false,
            refreshPositions: false,
            revert: false,
            revertDuration: 500,
            scope: "default",
            scroll: true,
            scrollSensitivity: 20,
            scrollSpeed: 20,
            snap: false,
            snapMode: "both",
            snapTolerance: 20,
            stack: false,
            zIndex: false,

            // Callbacks
            drag: null,
            start: null,
            stop: null
        },
        _create: function () {

            if (this.options.helper === "original") {
                this._setPositionRelative();
            }
            if (this.options.addClasses) {
                this._addClass("ui-draggable");
            }
            this._setHandleClassName();

            this._mouseInit();
        },

        _setOption: function (key, value) {
            this._super(key, value);
            if (key === "handle") {
                this._removeHandleClassName();
                this._setHandleClassName();
            }
        },

        _destroy: function () {
            if ((this.helper || this.element).is(".ui-draggable-dragging")) {
                this.destroyOnClear = true;
                return;
            }
            this._removeHandleClassName();
            this._mouseDestroy();
        },

        _mouseCapture: function (event) {
            var o = this.options;

            // Among others, prevent a drag on a resizable-handle
            if (this.helper || o.disabled ||
                $(event.target).closest(".ui-resizable-handle").length > 0) {
                return false;
            }

            //Quit if we're not on a valid handle
            this.handle = this._getHandle(event);
            if (!this.handle) {
                return false;
            }

            this._blurActiveElement(event);

            this._blockFrames(o.iframeFix === true ? "iframe" : o.iframeFix);

            return true;

        },

        _blockFrames: function (selector) {
            this.iframeBlocks = this.document.find(selector).map(function () {
                var iframe = $(this);

                return $("<div>")
                    .css("position", "absolute")
                    .appendTo(iframe.parent())
                    .outerWidth(iframe.outerWidth())
                    .outerHeight(iframe.outerHeight())
                    .offset(iframe.offset())[0];
            });
        },

        _unblockFrames: function () {
            if (this.iframeBlocks) {
                this.iframeBlocks.remove();
                delete this.iframeBlocks;
            }
        },

        _blurActiveElement: function (event) {
            var activeElement = $.ui.safeActiveElement(this.document[0]),
                target = $(event.target);

            // Don't blur if the event occurred on an element that is within
            // the currently focused element
            // See #10527, #12472
            if (target.closest(activeElement).length) {
                return;
            }

            // Blur any element that currently has focus, see #4261
            $.ui.safeBlur(activeElement);
        },

        _mouseStart: function (event) {

            var o = this.options;

            //Create and append the visible helper
            this.helper = this._createHelper(event);

            this._addClass(this.helper, "ui-draggable-dragging");

            //Cache the helper size
            this._cacheHelperProportions();

            //If ddmanager is used for droppables, set the global draggable
            if ($.ui.ddmanager) {
                $.ui.ddmanager.current = this;
            }

            /*
             * - Position generation -
             * This block generates everything position related - it's the core of draggables.
             */

            //Cache the margins of the original element
            this._cacheMargins();

            //Store the helper's css position
            this.cssPosition = this.helper.css("position");
            this.scrollParent = this.helper.scrollParent(true);
            this.offsetParent = this.helper.offsetParent();
            this.hasFixedAncestor = this.helper.parents().filter(function () {
                return $(this).css("position") === "fixed";
            }).length > 0;

            //The element's absolute position on the page minus margins
            this.positionAbs = this.element.offset();
            this._refreshOffsets(event);

            //Generate the original position
            this.originalPosition = this.position = this._generatePosition(event, false);
            this.originalPageX = event.pageX;
            this.originalPageY = event.pageY;

            //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
            (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));

            //Set a containment if given in the options
            this._setContainment();

            //Trigger event + callbacks
            if (this._trigger("start", event) === false) {
                this._clear();
                return false;
            }

            //Recache the helper size
            this._cacheHelperProportions();

            //Prepare the droppable offsets
            if ($.ui.ddmanager && !o.dropBehaviour) {
                $.ui.ddmanager.prepareOffsets(this, event);
            }

            // Execute the drag once - this causes the helper not to be visible before getting its
            // correct position
            this._mouseDrag(event, true);

            // If the ddmanager is used for droppables, inform the manager that dragging has started
            // (see #5003)
            if ($.ui.ddmanager) {
                $.ui.ddmanager.dragStart(this, event);
            }

            return true;
        },

        _refreshOffsets: function (event) {
            this.offset = {
                top: this.positionAbs.top - this.margins.top,
                left: this.positionAbs.left - this.margins.left,
                scroll: false,
                parent: this._getParentOffset(),
                relative: this._getRelativeOffset()
            };

            this.offset.click = {
                left: event.pageX - this.offset.left,
                top: event.pageY - this.offset.top
            };
        },

        _mouseDrag: function (event, noPropagation) {

            // reset any necessary cached properties (see #5009)
            if (this.hasFixedAncestor) {
                this.offset.parent = this._getParentOffset();
            }

            //Compute the helpers position
            this.position = this._generatePosition(event, true);
            this.positionAbs = this._convertPositionTo("absolute");

            //Call plugins and callbacks and use the resulting position if something is returned
            if (!noPropagation) {
                var ui = this._uiHash();
                if (this._trigger("drag", event, ui) === false) {
                    this._mouseUp(new $.Event("mouseup", event));
                    return false;
                }
                this.position = ui.position;
            }

            this.helper[0].style.left = this.position.left + "px";
            this.helper[0].style.top = this.position.top + "px";

            if ($.ui.ddmanager) {
                $.ui.ddmanager.drag(this, event);
            }

            return false;
        },

        _mouseStop: function (event) {

            //If we are using droppables, inform the manager about the drop
            var that = this,
                dropped = false;
            if ($.ui.ddmanager && !this.options.dropBehaviour) {
                dropped = $.ui.ddmanager.drop(this, event);
            }

            //if a drop comes from outside (a sortable)
            if (this.dropped) {
                dropped = this.dropped;
                this.dropped = false;
            }

            if ((this.options.revert === "invalid" && !dropped) ||
                (this.options.revert === "valid" && dropped) ||
                this.options.revert === true || ($.isFunction(this.options.revert) &&
                    this.options.revert.call(this.element, dropped))
            ) {
                $(this.helper).animate(
                    this.originalPosition,
                    parseInt(this.options.revertDuration, 10),
                    function () {
                        if (that._trigger("stop", event) !== false) {
                            that._clear();
                        }
                    }
                );
            } else {
                if (this._trigger("stop", event) !== false) {
                    this._clear();
                }
            }

            return false;
        },

        _mouseUp: function (event) {
            this._unblockFrames();

            // If the ddmanager is used for droppables, inform the manager that dragging has stopped
            // (see #5003)
            if ($.ui.ddmanager) {
                $.ui.ddmanager.dragStop(this, event);
            }

            // Only need to focus if the event occurred on the draggable itself, see #10527
            if (this.handleElement.is(event.target)) {

                // The interaction is over; whether or not the click resulted in a drag,
                // focus the element
                this.element.trigger("focus");
            }

            return $.ui.mouse.prototype._mouseUp.call(this, event);
        },

        cancel: function () {

            if (this.helper.is(".ui-draggable-dragging")) {
                this._mouseUp(new $.Event("mouseup", { target: this.element[0] }));
            } else {
                this._clear();
            }

            return this;

        },

        _getHandle: function (event) {
            return this.options.handle ?
                !!$(event.target).closest(this.element.find(this.options.handle)).length :
                true;
        },

        _setHandleClassName: function () {
            this.handleElement = this.options.handle ?
                this.element.find(this.options.handle) : this.element;
            this._addClass(this.handleElement, "ui-draggable-handle");
        },

        _removeHandleClassName: function () {
            this._removeClass(this.handleElement, "ui-draggable-handle");
        },

        _createHelper: function (event) {

            var o = this.options,
                helperIsFunction = $.isFunction(o.helper),
                helper = helperIsFunction ?
                    $(o.helper.apply(this.element[0], [event])) :
                    (o.helper === "clone" ?
                        this.element.clone().removeAttr("id") :
                        this.element);

            if (!helper.parents("body").length) {
                helper.appendTo((o.appendTo === "parent" ?
                    this.element[0].parentNode :
                    o.appendTo));
            }

            // Http://bugs.jqueryui.com/ticket/9446
            // a helper function can return the original element
            // which wouldn't have been set to relative in _create
            if (helperIsFunction && helper[0] === this.element[0]) {
                this._setPositionRelative();
            }

            if (helper[0] !== this.element[0] &&
                !(/(fixed|absolute)/).test(helper.css("position"))) {
                helper.css("position", "absolute");
            }

            return helper;

        },

        _setPositionRelative: function () {
            if (!(/^(?:r|a|f)/).test(this.element.css("position"))) {
                this.element[0].style.position = "relative";
            }
        },

        _adjustOffsetFromHelper: function (obj) {
            if (typeof obj === "string") {
                obj = obj.split(" ");
            }
            if ($.isArray(obj)) {
                obj = { left: +obj[0], top: +obj[1] || 0 };
            }
            if ("left" in obj) {
                this.offset.click.left = obj.left + this.margins.left;
            }
            if ("right" in obj) {
                this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
            }
            if ("top" in obj) {
                this.offset.click.top = obj.top + this.margins.top;
            }
            if ("bottom" in obj) {
                this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
            }
        },

        _isRootNode: function (element) {
            return (/(html|body)/i).test(element.tagName) || element === this.document[0];
        },

        _getParentOffset: function () {

            //Get the offsetParent and cache its position
            var po = this.offsetParent.offset(),
                document = this.document[0];

            // This is a special case where we need to modify a offset calculated on start, since the
            // following happened:
            // 1. The position of the helper is absolute, so it's position is calculated based on the
            // next positioned parent
            // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
            // the document, which means that the scroll is included in the initial calculation of the
            // offset of the parent, and never recalculated upon drag
            if (this.cssPosition === "absolute" && this.scrollParent[0] !== document &&
                $.contains(this.scrollParent[0], this.offsetParent[0])) {
                po.left += this.scrollParent.scrollLeft();
                po.top += this.scrollParent.scrollTop();
            }

            if (this._isRootNode(this.offsetParent[0])) {
                po = { top: 0, left: 0 };
            }

            return {
                top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
                left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
            };

        },

        _getRelativeOffset: function () {
            if (this.cssPosition !== "relative") {
                return { top: 0, left: 0 };
            }

            var p = this.element.position(),
                scrollIsRootNode = this._isRootNode(this.scrollParent[0]);

            return {
                top: p.top - (parseInt(this.helper.css("top"), 10) || 0) +
                    (!scrollIsRootNode ? this.scrollParent.scrollTop() : 0),
                left: p.left - (parseInt(this.helper.css("left"), 10) || 0) +
                    (!scrollIsRootNode ? this.scrollParent.scrollLeft() : 0)
            };

        },

        _cacheMargins: function () {
            this.margins = {
                left: (parseInt(this.element.css("marginLeft"), 10) || 0),
                top: (parseInt(this.element.css("marginTop"), 10) || 0),
                right: (parseInt(this.element.css("marginRight"), 10) || 0),
                bottom: (parseInt(this.element.css("marginBottom"), 10) || 0)
            };
        },

        _cacheHelperProportions: function () {
            this.helperProportions = {
                width: this.helper.outerWidth(),
                height: this.helper.outerHeight()
            };
        },

        _setContainment: function () {

            var isUserScrollable, c, ce,
                o = this.options,
                document = this.document[0];

            this.relativeContainer = null;

            if (!o.containment) {
                this.containment = null;
                return;
            }

            if (o.containment === "window") {
                this.containment = [
                    $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
                    $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
                    $(window).scrollLeft() + $(window).width() -
                    this.helperProportions.width - this.margins.left,
                    $(window).scrollTop() +
                    ($(window).height() || document.body.parentNode.scrollHeight) -
                    this.helperProportions.height - this.margins.top
                ];
                return;
            }

            if (o.containment === "document") {
                this.containment = [
                    0,
                    0,
                    $(document).width() - this.helperProportions.width - this.margins.left,
                    ($(document).height() || document.body.parentNode.scrollHeight) -
                    this.helperProportions.height - this.margins.top
                ];
                return;
            }

            if (o.containment.constructor === Array) {
                this.containment = o.containment;
                return;
            }

            if (o.containment === "parent") {
                o.containment = this.helper[0].parentNode;
            }

            c = $(o.containment);
            ce = c[0];

            if (!ce) {
                return;
            }

            isUserScrollable = /(scroll|auto)/.test(c.css("overflow"));

            this.containment = [
                (parseInt(c.css("borderLeftWidth"), 10) || 0) +
                (parseInt(c.css("paddingLeft"), 10) || 0),
                (parseInt(c.css("borderTopWidth"), 10) || 0) +
                (parseInt(c.css("paddingTop"), 10) || 0),
                (isUserScrollable ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) -
                (parseInt(c.css("borderRightWidth"), 10) || 0) -
                (parseInt(c.css("paddingRight"), 10) || 0) -
                this.helperProportions.width -
                this.margins.left -
                this.margins.right,
                (isUserScrollable ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) -
                (parseInt(c.css("borderBottomWidth"), 10) || 0) -
                (parseInt(c.css("paddingBottom"), 10) || 0) -
                this.helperProportions.height -
                this.margins.top -
                this.margins.bottom
            ];
            this.relativeContainer = c;
        },

        _convertPositionTo: function (d, pos) {

            if (!pos) {
                pos = this.position;
            }

            var mod = d === "absolute" ? 1 : -1,
                scrollIsRootNode = this._isRootNode(this.scrollParent[0]);

            return {
                top: (

                    // The absolute mouse position
                    pos.top +

                    // Only for relative positioned nodes: Relative offset from element to offset parent
                    this.offset.relative.top * mod +

                    // The offsetParent's offset without borders (offset + border)
                    this.offset.parent.top * mod -
                    ((this.cssPosition === "fixed" ?
                        -this.offset.scroll.top :
                        (scrollIsRootNode ? 0 : this.offset.scroll.top)) * mod)
                ),
                left: (

                    // The absolute mouse position
                    pos.left +

                    // Only for relative positioned nodes: Relative offset from element to offset parent
                    this.offset.relative.left * mod +

                    // The offsetParent's offset without borders (offset + border)
                    this.offset.parent.left * mod -
                    ((this.cssPosition === "fixed" ?
                        -this.offset.scroll.left :
                        (scrollIsRootNode ? 0 : this.offset.scroll.left)) * mod)
                )
            };

        },

        _generatePosition: function (event, constrainPosition) {

            var containment, co, top, left,
                o = this.options,
                scrollIsRootNode = this._isRootNode(this.scrollParent[0]),
                pageX = event.pageX,
                pageY = event.pageY;

            // Cache the scroll
            if (!scrollIsRootNode || !this.offset.scroll) {
                this.offset.scroll = {
                    top: this.scrollParent.scrollTop(),
                    left: this.scrollParent.scrollLeft()
                };
            }

            /*
             * - Position constraining -
             * Constrain the position to a mix of grid, containment.
             */

            // If we are not dragging yet, we won't check for options
            if (constrainPosition) {
                if (this.containment) {
                    if (this.relativeContainer) {
                        co = this.relativeContainer.offset();
                        containment = [
                            this.containment[0] + co.left,
                            this.containment[1] + co.top,
                            this.containment[2] + co.left,
                            this.containment[3] + co.top
                        ];
                    } else {
                        containment = this.containment;
                    }

                    if (event.pageX - this.offset.click.left < containment[0]) {
                        pageX = containment[0] + this.offset.click.left;
                    }
                    if (event.pageY - this.offset.click.top < containment[1]) {
                        pageY = containment[1] + this.offset.click.top;
                    }
                    if (event.pageX - this.offset.click.left > containment[2]) {
                        pageX = containment[2] + this.offset.click.left;
                    }
                    if (event.pageY - this.offset.click.top > containment[3]) {
                        pageY = containment[3] + this.offset.click.top;
                    }
                }

                if (o.grid) {

                    //Check for grid elements set to 0 to prevent divide by 0 error causing invalid
                    // argument errors in IE (see ticket #6950)
                    top = o.grid[1] ? this.originalPageY + Math.round((pageY -
                        this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
                    pageY = containment ? ((top - this.offset.click.top >= containment[1] ||
                        top - this.offset.click.top > containment[3]) ?
                        top :
                        ((top - this.offset.click.top >= containment[1]) ?
                            top - o.grid[1] : top + o.grid[1])) : top;

                    left = o.grid[0] ? this.originalPageX +
                        Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] :
                        this.originalPageX;
                    pageX = containment ? ((left - this.offset.click.left >= containment[0] ||
                        left - this.offset.click.left > containment[2]) ?
                        left :
                        ((left - this.offset.click.left >= containment[0]) ?
                            left - o.grid[0] : left + o.grid[0])) : left;
                }

                if (o.axis === "y") {
                    pageX = this.originalPageX;
                }

                if (o.axis === "x") {
                    pageY = this.originalPageY;
                }
            }

            return {
                top: (

                    // The absolute mouse position
                    pageY -

                    // Click offset (relative to the element)
                    this.offset.click.top -

                    // Only for relative positioned nodes: Relative offset from element to offset parent
                    this.offset.relative.top -

                    // The offsetParent's offset without borders (offset + border)
                    this.offset.parent.top +
                    (this.cssPosition === "fixed" ?
                        -this.offset.scroll.top :
                        (scrollIsRootNode ? 0 : this.offset.scroll.top))
                ),
                left: (

                    // The absolute mouse position
                    pageX -

                    // Click offset (relative to the element)
                    this.offset.click.left -

                    // Only for relative positioned nodes: Relative offset from element to offset parent
                    this.offset.relative.left -

                    // The offsetParent's offset without borders (offset + border)
                    this.offset.parent.left +
                    (this.cssPosition === "fixed" ?
                        -this.offset.scroll.left :
                        (scrollIsRootNode ? 0 : this.offset.scroll.left))
                )
            };

        },

        _clear: function () {
            this._removeClass(this.helper, "ui-draggable-dragging");
            if (this.helper[0] !== this.element[0] && !this.cancelHelperRemoval) {
                this.helper.remove();
            }
            this.helper = null;
            this.cancelHelperRemoval = false;
            if (this.destroyOnClear) {
                this.destroy();
            }
        },

        // From now on bulk stuff - mainly helpers

        _trigger: function (type, event, ui) {
            ui = ui || this._uiHash();
            $.ui.plugin.call(this, type, [event, ui, this], true);

            // Absolute position and offset (see #6884 ) have to be recalculated after plugins
            if (/^(drag|start|stop)/.test(type)) {
                this.positionAbs = this._convertPositionTo("absolute");
                ui.offset = this.positionAbs;
            }
            return $.Widget.prototype._trigger.call(this, type, event, ui);
        },

        plugins: {},

        _uiHash: function () {
            return {
                helper: this.helper,
                position: this.position,
                originalPosition: this.originalPosition,
                offset: this.positionAbs
            };
        }

    });

    $.ui.plugin.add("draggable", "connectToSortable", {
        start: function (event, ui, draggable) {
            var uiSortable = $.extend({}, ui, {
                item: draggable.element
            });

            draggable.sortables = [];
            $(draggable.options.connectToSortable).each(function () {
                var sortable = $(this).sortable("instance");

                if (sortable && !sortable.options.disabled) {
                    draggable.sortables.push(sortable);

                    // RefreshPositions is called at drag start to refresh the containerCache
                    // which is used in drag. This ensures it's initialized and synchronized
                    // with any changes that might have happened on the page since initialization.
                    sortable.refreshPositions();
                    sortable._trigger("activate", event, uiSortable);
                }
            });
        },
        stop: function (event, ui, draggable) {
            var uiSortable = $.extend({}, ui, {
                item: draggable.element
            });

            draggable.cancelHelperRemoval = false;

            $.each(draggable.sortables, function () {
                var sortable = this;

                if (sortable.isOver) {
                    sortable.isOver = 0;

                    // Allow this sortable to handle removing the helper
                    draggable.cancelHelperRemoval = true;
                    sortable.cancelHelperRemoval = false;

                    // Use _storedCSS To restore properties in the sortable,
                    // as this also handles revert (#9675) since the draggable
                    // may have modified them in unexpected ways (#8809)
                    sortable._storedCSS = {
                        position: sortable.placeholder.css("position"),
                        top: sortable.placeholder.css("top"),
                        left: sortable.placeholder.css("left")
                    };

                    sortable._mouseStop(event);

                    // Once drag has ended, the sortable should return to using
                    // its original helper, not the shared helper from draggable
                    sortable.options.helper = sortable.options._helper;
                } else {

                    // Prevent this Sortable from removing the helper.
                    // However, don't set the draggable to remove the helper
                    // either as another connected Sortable may yet handle the removal.
                    sortable.cancelHelperRemoval = true;

                    sortable._trigger("deactivate", event, uiSortable);
                }
            });
        },
        drag: function (event, ui, draggable) {
            $.each(draggable.sortables, function () {
                var innermostIntersecting = false,
                    sortable = this;

                // Copy over variables that sortable's _intersectsWith uses
                sortable.positionAbs = draggable.positionAbs;
                sortable.helperProportions = draggable.helperProportions;
                sortable.offset.click = draggable.offset.click;

                if (sortable._intersectsWith(sortable.containerCache)) {
                    innermostIntersecting = true;

                    $.each(draggable.sortables, function () {

                        // Copy over variables that sortable's _intersectsWith uses
                        this.positionAbs = draggable.positionAbs;
                        this.helperProportions = draggable.helperProportions;
                        this.offset.click = draggable.offset.click;

                        if (this !== sortable &&
                            this._intersectsWith(this.containerCache) &&
                            $.contains(sortable.element[0], this.element[0])) {
                            innermostIntersecting = false;
                        }

                        return innermostIntersecting;
                    });
                }

                if (innermostIntersecting) {

                    // If it intersects, we use a little isOver variable and set it once,
                    // so that the move-in stuff gets fired only once.
                    if (!sortable.isOver) {
                        sortable.isOver = 1;

                        // Store draggable's parent in case we need to reappend to it later.
                        draggable._parent = ui.helper.parent();

                        sortable.currentItem = ui.helper
                            .appendTo(sortable.element)
                            .data("ui-sortable-item", true);

                        // Store helper option to later restore it
                        sortable.options._helper = sortable.options.helper;

                        sortable.options.helper = function () {
                            return ui.helper[0];
                        };

                        // Fire the start events of the sortable with our passed browser event,
                        // and our own helper (so it doesn't create a new one)
                        event.target = sortable.currentItem[0];
                        sortable._mouseCapture(event, true);
                        sortable._mouseStart(event, true, true);

                        // Because the browser event is way off the new appended portlet,
                        // modify necessary variables to reflect the changes
                        sortable.offset.click.top = draggable.offset.click.top;
                        sortable.offset.click.left = draggable.offset.click.left;
                        sortable.offset.parent.left -= draggable.offset.parent.left -
                            sortable.offset.parent.left;
                        sortable.offset.parent.top -= draggable.offset.parent.top -
                            sortable.offset.parent.top;

                        draggable._trigger("toSortable", event);

                        // Inform draggable that the helper is in a valid drop zone,
                        // used solely in the revert option to handle "valid/invalid".
                        draggable.dropped = sortable.element;

                        // Need to refreshPositions of all sortables in the case that
                        // adding to one sortable changes the location of the other sortables (#9675)
                        $.each(draggable.sortables, function () {
                            this.refreshPositions();
                        });

                        // Hack so receive/update callbacks work (mostly)
                        draggable.currentItem = draggable.element;
                        sortable.fromOutside = draggable;
                    }

                    if (sortable.currentItem) {
                        sortable._mouseDrag(event);

                        // Copy the sortable's position because the draggable's can potentially reflect
                        // a relative position, while sortable is always absolute, which the dragged
                        // element has now become. (#8809)
                        ui.position = sortable.position;
                    }
                } else {

                    // If it doesn't intersect with the sortable, and it intersected before,
                    // we fake the drag stop of the sortable, but make sure it doesn't remove
                    // the helper by using cancelHelperRemoval.
                    if (sortable.isOver) {

                        sortable.isOver = 0;
                        sortable.cancelHelperRemoval = true;

                        // Calling sortable's mouseStop would trigger a revert,
                        // so revert must be temporarily false until after mouseStop is called.
                        sortable.options._revert = sortable.options.revert;
                        sortable.options.revert = false;

                        sortable._trigger("out", event, sortable._uiHash(sortable));
                        sortable._mouseStop(event, true);

                        // Restore sortable behaviors that were modfied
                        // when the draggable entered the sortable area (#9481)
                        sortable.options.revert = sortable.options._revert;
                        sortable.options.helper = sortable.options._helper;

                        if (sortable.placeholder) {
                            sortable.placeholder.remove();
                        }

                        // Restore and recalculate the draggable's offset considering the sortable
                        // may have modified them in unexpected ways. (#8809, #10669)
                        ui.helper.appendTo(draggable._parent);
                        draggable._refreshOffsets(event);
                        ui.position = draggable._generatePosition(event, true);

                        draggable._trigger("fromSortable", event);

                        // Inform draggable that the helper is no longer in a valid drop zone
                        draggable.dropped = false;

                        // Need to refreshPositions of all sortables just in case removing
                        // from one sortable changes the location of other sortables (#9675)
                        $.each(draggable.sortables, function () {
                            this.refreshPositions();
                        });
                    }
                }
            });
        }
    });

    $.ui.plugin.add("draggable", "cursor", {
        start: function (event, ui, instance) {
            var t = $("body"),
                o = instance.options;

            if (t.css("cursor")) {
                o._cursor = t.css("cursor");
            }
            t.css("cursor", o.cursor);
        },
        stop: function (event, ui, instance) {
            var o = instance.options;
            if (o._cursor) {
                $("body").css("cursor", o._cursor);
            }
        }
    });

    $.ui.plugin.add("draggable", "opacity", {
        start: function (event, ui, instance) {
            var t = $(ui.helper),
                o = instance.options;
            if (t.css("opacity")) {
                o._opacity = t.css("opacity");
            }
            t.css("opacity", o.opacity);
        },
        stop: function (event, ui, instance) {
            var o = instance.options;
            if (o._opacity) {
                $(ui.helper).css("opacity", o._opacity);
            }
        }
    });

    $.ui.plugin.add("draggable", "scroll", {
        start: function (event, ui, i) {
            if (!i.scrollParentNotHidden) {
                i.scrollParentNotHidden = i.helper.scrollParent(false);
            }

            if (i.scrollParentNotHidden[0] !== i.document[0] &&
                i.scrollParentNotHidden[0].tagName !== "HTML") {
                i.overflowOffset = i.scrollParentNotHidden.offset();
            }
        },
        drag: function (event, ui, i) {

            var o = i.options,
                scrolled = false,
                scrollParent = i.scrollParentNotHidden[0],
                document = i.document[0];

            if (scrollParent !== document && scrollParent.tagName !== "HTML") {
                if (!o.axis || o.axis !== "x") {
                    if ((i.overflowOffset.top + scrollParent.offsetHeight) - event.pageY <
                        o.scrollSensitivity) {
                        scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed;
                    } else if (event.pageY - i.overflowOffset.top < o.scrollSensitivity) {
                        scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed;
                    }
                }

                if (!o.axis || o.axis !== "y") {
                    if ((i.overflowOffset.left + scrollParent.offsetWidth) - event.pageX <
                        o.scrollSensitivity) {
                        scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed;
                    } else if (event.pageX - i.overflowOffset.left < o.scrollSensitivity) {
                        scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed;
                    }
                }

            } else {

                if (!o.axis || o.axis !== "x") {
                    if (event.pageY - $(document).scrollTop() < o.scrollSensitivity) {
                        scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
                    } else if ($(window).height() - (event.pageY - $(document).scrollTop()) <
                        o.scrollSensitivity) {
                        scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
                    }
                }

                if (!o.axis || o.axis !== "y") {
                    if (event.pageX - $(document).scrollLeft() < o.scrollSensitivity) {
                        scrolled = $(document).scrollLeft(
                            $(document).scrollLeft() - o.scrollSpeed
                        );
                    } else if ($(window).width() - (event.pageX - $(document).scrollLeft()) <
                        o.scrollSensitivity) {
                        scrolled = $(document).scrollLeft(
                            $(document).scrollLeft() + o.scrollSpeed
                        );
                    }
                }

            }

            if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
                $.ui.ddmanager.prepareOffsets(i, event);
            }

        }
    });

    $.ui.plugin.add("draggable", "snap", {
        start: function (event, ui, i) {

            var o = i.options;

            i.snapElements = [];

            $(o.snap.constructor !== String ? (o.snap.items || ":data(ui-draggable)") : o.snap)
                .each(function () {
                    var $t = $(this),
                        $o = $t.offset();
                    if (this !== i.element[0]) {
                        i.snapElements.push({
                            item: this,
                            width: $t.outerWidth(), height: $t.outerHeight(),
                            top: $o.top, left: $o.left
                        });
                    }
                });

        },
        drag: function (event, ui, inst) {

            var ts, bs, ls, rs, l, r, t, b, i, first,
                o = inst.options,
                d = o.snapTolerance,
                x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
                y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;

            for (i = inst.snapElements.length - 1; i >= 0; i--) {

                l = inst.snapElements[i].left - inst.margins.left;
                r = l + inst.snapElements[i].width;
                t = inst.snapElements[i].top - inst.margins.top;
                b = t + inst.snapElements[i].height;

                if (x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d ||
                    !$.contains(inst.snapElements[i].item.ownerDocument,
                        inst.snapElements[i].item)) {
                    if (inst.snapElements[i].snapping) {
                        (inst.options.snap.release &&
                            inst.options.snap.release.call(
                                inst.element,
                                event,
                                $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })
                            ));
                    }
                    inst.snapElements[i].snapping = false;
                    continue;
                }

                if (o.snapMode !== "inner") {
                    ts = Math.abs(t - y2) <= d;
                    bs = Math.abs(b - y1) <= d;
                    ls = Math.abs(l - x2) <= d;
                    rs = Math.abs(r - x1) <= d;
                    if (ts) {
                        ui.position.top = inst._convertPositionTo("relative", {
                            top: t - inst.helperProportions.height,
                            left: 0
                        }).top;
                    }
                    if (bs) {
                        ui.position.top = inst._convertPositionTo("relative", {
                            top: b,
                            left: 0
                        }).top;
                    }
                    if (ls) {
                        ui.position.left = inst._convertPositionTo("relative", {
                            top: 0,
                            left: l - inst.helperProportions.width
                        }).left;
                    }
                    if (rs) {
                        ui.position.left = inst._convertPositionTo("relative", {
                            top: 0,
                            left: r
                        }).left;
                    }
                }

                first = (ts || bs || ls || rs);

                if (o.snapMode !== "outer") {
                    ts = Math.abs(t - y1) <= d;
                    bs = Math.abs(b - y2) <= d;
                    ls = Math.abs(l - x1) <= d;
                    rs = Math.abs(r - x2) <= d;
                    if (ts) {
                        ui.position.top = inst._convertPositionTo("relative", {
                            top: t,
                            left: 0
                        }).top;
                    }
                    if (bs) {
                        ui.position.top = inst._convertPositionTo("relative", {
                            top: b - inst.helperProportions.height,
                            left: 0
                        }).top;
                    }
                    if (ls) {
                        ui.position.left = inst._convertPositionTo("relative", {
                            top: 0,
                            left: l
                        }).left;
                    }
                    if (rs) {
                        ui.position.left = inst._convertPositionTo("relative", {
                            top: 0,
                            left: r - inst.helperProportions.width
                        }).left;
                    }
                }

                if (!inst.snapElements[i].snapping && (ts || bs || ls || rs || first)) {
                    (inst.options.snap.snap &&
                        inst.options.snap.snap.call(
                            inst.element,
                            event,
                            $.extend(inst._uiHash(), {
                                snapItem: inst.snapElements[i].item
                            })));
                }
                inst.snapElements[i].snapping = (ts || bs || ls || rs || first);

            }

        }
    });

    $.ui.plugin.add("draggable", "stack", {
        start: function (event, ui, instance) {
            var min,
                o = instance.options,
                group = $.makeArray($(o.stack)).sort(function (a, b) {
                    return (parseInt($(a).css("zIndex"), 10) || 0) -
                        (parseInt($(b).css("zIndex"), 10) || 0);
                });

            if (!group.length) { return; }

            min = parseInt($(group[0]).css("zIndex"), 10) || 0;
            $(group).each(function (i) {
                $(this).css("zIndex", min + i);
            });
            this.css("zIndex", (min + group.length));
        }
    });

    $.ui.plugin.add("draggable", "zIndex", {
        start: function (event, ui, instance) {
            var t = $(ui.helper),
                o = instance.options;

            if (t.css("zIndex")) {
                o._zIndex = t.css("zIndex");
            }
            t.css("zIndex", o.zIndex);
        },
        stop: function (event, ui, instance) {
            var o = instance.options;

            if (o._zIndex) {
                $(ui.helper).css("zIndex", o._zIndex);
            }
        }
    });

    var widgetsDraggable = $.ui.draggable;


    /*!
     * jQuery UI Droppable 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Droppable
    //>>group: Interactions
    //>>description: Enables drop targets for draggable elements.
    //>>docs: http://api.jqueryui.com/droppable/
    //>>demos: http://jqueryui.com/droppable/



    $.widget("ui.droppable", {
        version: "1.12.1",
        widgetEventPrefix: "drop",
        options: {
            accept: "*",
            addClasses: true,
            greedy: false,
            scope: "default",
            tolerance: "intersect",

            // Callbacks
            activate: null,
            deactivate: null,
            drop: null,
            out: null,
            over: null
        },
        _create: function () {

            var proportions,
                o = this.options,
                accept = o.accept;

            this.isover = false;
            this.isout = true;

            this.accept = $.isFunction(accept) ? accept : function (d) {
                return d.is(accept);
            };

            this.proportions = function ( /* valueToWrite */) {
                if (arguments.length) {

                    // Store the droppable's proportions
                    proportions = arguments[0];
                } else {

                    // Retrieve or derive the droppable's proportions
                    return proportions ?
                        proportions :
                        proportions = {
                            width: this.element[0].offsetWidth,
                            height: this.element[0].offsetHeight
                        };
                }
            };

            this._addToManager(o.scope);

            o.addClasses && this._addClass("ui-droppable");

        },

        _addToManager: function (scope) {

            // Add the reference and positions to the manager
            $.ui.ddmanager.droppables[scope] = $.ui.ddmanager.droppables[scope] || [];
            $.ui.ddmanager.droppables[scope].push(this);
        },

        _splice: function (drop) {
            var i = 0;
            for (; i < drop.length; i++) {
                if (drop[i] === this) {
                    drop.splice(i, 1);
                }
            }
        },

        _destroy: function () {
            var drop = $.ui.ddmanager.droppables[this.options.scope];

            this._splice(drop);
        },

        _setOption: function (key, value) {

            if (key === "accept") {
                this.accept = $.isFunction(value) ? value : function (d) {
                    return d.is(value);
                };
            } else if (key === "scope") {
                var drop = $.ui.ddmanager.droppables[this.options.scope];

                this._splice(drop);
                this._addToManager(value);
            }

            this._super(key, value);
        },

        _activate: function (event) {
            var draggable = $.ui.ddmanager.current;

            this._addActiveClass();
            if (draggable) {
                this._trigger("activate", event, this.ui(draggable));
            }
        },

        _deactivate: function (event) {
            var draggable = $.ui.ddmanager.current;

            this._removeActiveClass();
            if (draggable) {
                this._trigger("deactivate", event, this.ui(draggable));
            }
        },

        _over: function (event) {

            var draggable = $.ui.ddmanager.current;

            // Bail if draggable and droppable are same element
            if (!draggable || (draggable.currentItem ||
                draggable.element)[0] === this.element[0]) {
                return;
            }

            if (this.accept.call(this.element[0], (draggable.currentItem ||
                draggable.element))) {
                this._addHoverClass();
                this._trigger("over", event, this.ui(draggable));
            }

        },

        _out: function (event) {

            var draggable = $.ui.ddmanager.current;

            // Bail if draggable and droppable are same element
            if (!draggable || (draggable.currentItem ||
                draggable.element)[0] === this.element[0]) {
                return;
            }

            if (this.accept.call(this.element[0], (draggable.currentItem ||
                draggable.element))) {
                this._removeHoverClass();
                this._trigger("out", event, this.ui(draggable));
            }

        },

        _drop: function (event, custom) {

            var draggable = custom || $.ui.ddmanager.current,
                childrenIntersection = false;

            // Bail if draggable and droppable are same element
            if (!draggable || (draggable.currentItem ||
                draggable.element)[0] === this.element[0]) {
                return false;
            }

            this.element
                .find(":data(ui-droppable)")
                .not(".ui-draggable-dragging")
                .each(function () {
                    var inst = $(this).droppable("instance");
                    if (
                        inst.options.greedy &&
                        !inst.options.disabled &&
                        inst.options.scope === draggable.options.scope &&
                        inst.accept.call(
                            inst.element[0], (draggable.currentItem || draggable.element)
                        ) &&
                        intersect(
                            draggable,
                            $.extend(inst, { offset: inst.element.offset() }),
                            inst.options.tolerance, event
                        )
                    ) {
                        childrenIntersection = true;
                        return false;
                    }
                });
            if (childrenIntersection) {
                return false;
            }

            if (this.accept.call(this.element[0],
                (draggable.currentItem || draggable.element))) {
                this._removeActiveClass();
                this._removeHoverClass();

                this._trigger("drop", event, this.ui(draggable));
                return this.element;
            }

            return false;

        },

        ui: function (c) {
            return {
                draggable: (c.currentItem || c.element),
                helper: c.helper,
                position: c.position,
                offset: c.positionAbs
            };
        },

        // Extension points just to make backcompat sane and avoid duplicating logic
        // TODO: Remove in 1.13 along with call to it below
        _addHoverClass: function () {
            this._addClass("ui-droppable-hover");
        },

        _removeHoverClass: function () {
            this._removeClass("ui-droppable-hover");
        },

        _addActiveClass: function () {
            this._addClass("ui-droppable-active");
        },

        _removeActiveClass: function () {
            this._removeClass("ui-droppable-active");
        }
    });

    var intersect = $.ui.intersect = (function () {
        function isOverAxis(x, reference, size) {
            return (x >= reference) && (x < (reference + size));
        }

        return function (draggable, droppable, toleranceMode, event) {

            if (!droppable.offset) {
                return false;
            }

            var x1 = (draggable.positionAbs ||
                draggable.position.absolute).left + draggable.margins.left,
                y1 = (draggable.positionAbs ||
                    draggable.position.absolute).top + draggable.margins.top,
                x2 = x1 + draggable.helperProportions.width,
                y2 = y1 + draggable.helperProportions.height,
                l = droppable.offset.left,
                t = droppable.offset.top,
                r = l + droppable.proportions().width,
                b = t + droppable.proportions().height;

            switch (toleranceMode) {
                case "fit":
                    return (l <= x1 && x2 <= r && t <= y1 && y2 <= b);
                case "intersect":
                    return (l < x1 + (draggable.helperProportions.width / 2) && // Right Half
                        x2 - (draggable.helperProportions.width / 2) < r && // Left Half
                        t < y1 + (draggable.helperProportions.height / 2) && // Bottom Half
                        y2 - (draggable.helperProportions.height / 2) < b); // Top Half
                case "pointer":
                    return isOverAxis(event.pageY, t, droppable.proportions().height) &&
                        isOverAxis(event.pageX, l, droppable.proportions().width);
                case "touch":
                    return (
                        (y1 >= t && y1 <= b) || // Top edge touching
                        (y2 >= t && y2 <= b) || // Bottom edge touching
                        (y1 < t && y2 > b) // Surrounded vertically
                    ) && (
                            (x1 >= l && x1 <= r) || // Left edge touching
                            (x2 >= l && x2 <= r) || // Right edge touching
                            (x1 < l && x2 > r) // Surrounded horizontally
                        );
                default:
                    return false;
            }
        };
    })();

    /*
        This manager tracks offsets of draggables and droppables
    */
    $.ui.ddmanager = {
        current: null,
        droppables: { "default": [] },
        prepareOffsets: function (t, event) {

            var i, j,
                m = $.ui.ddmanager.droppables[t.options.scope] || [],
                type = event ? event.type : null, // workaround for #2317
                list = (t.currentItem || t.element).find(":data(ui-droppable)").addBack();

            droppablesLoop: for (i = 0; i < m.length; i++) {

                // No disabled and non-accepted
                if (m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],
                    (t.currentItem || t.element)))) {
                    continue;
                }

                // Filter out elements in the current dragged item
                for (j = 0; j < list.length; j++) {
                    if (list[j] === m[i].element[0]) {
                        m[i].proportions().height = 0;
                        continue droppablesLoop;
                    }
                }

                m[i].visible = m[i].element.css("display") !== "none";
                if (!m[i].visible) {
                    continue;
                }

                // Activate the droppable if used directly from draggables
                if (type === "mousedown") {
                    m[i]._activate.call(m[i], event);
                }

                m[i].offset = m[i].element.offset();
                m[i].proportions({
                    width: m[i].element[0].offsetWidth,
                    height: m[i].element[0].offsetHeight
                });

            }

        },
        drop: function (draggable, event) {

            var dropped = false;

            // Create a copy of the droppables in case the list changes during the drop (#9116)
            $.each(($.ui.ddmanager.droppables[draggable.options.scope] || []).slice(), function () {

                if (!this.options) {
                    return;
                }
                if (!this.options.disabled && this.visible &&
                    intersect(draggable, this, this.options.tolerance, event)) {
                    dropped = this._drop.call(this, event) || dropped;
                }

                if (!this.options.disabled && this.visible && this.accept.call(this.element[0],
                    (draggable.currentItem || draggable.element))) {
                    this.isout = true;
                    this.isover = false;
                    this._deactivate.call(this, event);
                }

            });
            return dropped;

        },
        dragStart: function (draggable, event) {

            // Listen for scrolling so that if the dragging causes scrolling the position of the
            // droppables can be recalculated (see #5003)
            draggable.element.parentsUntil("body").on("scroll.droppable", function () {
                if (!draggable.options.refreshPositions) {
                    $.ui.ddmanager.prepareOffsets(draggable, event);
                }
            });
        },
        drag: function (draggable, event) {

            // If you have a highly dynamic page, you might try this option. It renders positions
            // every time you move the mouse.
            if (draggable.options.refreshPositions) {
                $.ui.ddmanager.prepareOffsets(draggable, event);
            }

            // Run through all droppables and check their positions based on specific tolerance options
            $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function () {

                if (this.options.disabled || this.greedyChild || !this.visible) {
                    return;
                }

                var parentInstance, scope, parent,
                    intersects = intersect(draggable, this, this.options.tolerance, event),
                    c = !intersects && this.isover ?
                        "isout" :
                        (intersects && !this.isover ? "isover" : null);
                if (!c) {
                    return;
                }

                if (this.options.greedy) {

                    // find droppable parents with same scope
                    scope = this.options.scope;
                    parent = this.element.parents(":data(ui-droppable)").filter(function () {
                        return $(this).droppable("instance").options.scope === scope;
                    });

                    if (parent.length) {
                        parentInstance = $(parent[0]).droppable("instance");
                        parentInstance.greedyChild = (c === "isover");
                    }
                }

                // We just moved into a greedy child
                if (parentInstance && c === "isover") {
                    parentInstance.isover = false;
                    parentInstance.isout = true;
                    parentInstance._out.call(parentInstance, event);
                }

                this[c] = true;
                this[c === "isout" ? "isover" : "isout"] = false;
                this[c === "isover" ? "_over" : "_out"].call(this, event);

                // We just moved out of a greedy child
                if (parentInstance && c === "isout") {
                    parentInstance.isout = false;
                    parentInstance.isover = true;
                    parentInstance._over.call(parentInstance, event);
                }
            });

        },
        dragStop: function (draggable, event) {
            draggable.element.parentsUntil("body").off("scroll.droppable");

            // Call prepareOffsets one final time since IE does not fire return scroll events when
            // overflow was caused by drag (see #5003)
            if (!draggable.options.refreshPositions) {
                $.ui.ddmanager.prepareOffsets(draggable, event);
            }
        }
    };

    // DEPRECATED
    // TODO: switch return back to widget declaration at top of file when this is removed
    if ($.uiBackCompat !== false) {

        // Backcompat for activeClass and hoverClass options
        $.widget("ui.droppable", $.ui.droppable, {
            options: {
                hoverClass: false,
                activeClass: false
            },
            _addActiveClass: function () {
                this._super();
                if (this.options.activeClass) {
                    this.element.addClass(this.options.activeClass);
                }
            },
            _removeActiveClass: function () {
                this._super();
                if (this.options.activeClass) {
                    this.element.removeClass(this.options.activeClass);
                }
            },
            _addHoverClass: function () {
                this._super();
                if (this.options.hoverClass) {
                    this.element.addClass(this.options.hoverClass);
                }
            },
            _removeHoverClass: function () {
                this._super();
                if (this.options.hoverClass) {
                    this.element.removeClass(this.options.hoverClass);
                }
            }
        });
    }

    var widgetsDroppable = $.ui.droppable;


    /*!
     * jQuery UI Resizable 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Resizable
    //>>group: Interactions
    //>>description: Enables resize functionality for any element.
    //>>docs: http://api.jqueryui.com/resizable/
    //>>demos: http://jqueryui.com/resizable/
    //>>css.structure: ../../themes/base/core.css
    //>>css.structure: ../../themes/base/resizable.css
    //>>css.theme: ../../themes/base/theme.css



    $.widget("ui.resizable", $.ui.mouse, {
        version: "1.12.1",
        widgetEventPrefix: "resize",
        options: {
            alsoResize: false,
            animate: false,
            animateDuration: "slow",
            animateEasing: "swing",
            aspectRatio: false,
            autoHide: false,
            classes: {
                "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se"
            },
            containment: false,
            ghost: false,
            grid: false,
            handles: "e,s,se",
            helper: false,
            maxHeight: null,
            maxWidth: null,
            minHeight: 10,
            minWidth: 10,

            // See #7960
            zIndex: 90,

            // Callbacks
            resize: null,
            start: null,
            stop: null
        },

        _num: function (value) {
            return parseFloat(value) || 0;
        },

        _isNumber: function (value) {
            return !isNaN(parseFloat(value));
        },

        _hasScroll: function (el, a) {

            if ($(el).css("overflow") === "hidden") {
                return false;
            }

            var scroll = (a && a === "left") ? "scrollLeft" : "scrollTop",
                has = false;

            if (el[scroll] > 0) {
                return true;
            }

            // TODO: determine which cases actually cause this to happen
            // if the element doesn't have the scroll set, see if it's possible to
            // set the scroll
            el[scroll] = 1;
            has = (el[scroll] > 0);
            el[scroll] = 0;
            return has;
        },

        _create: function () {

            var margins,
                o = this.options,
                that = this;
            this._addClass("ui-resizable");

            $.extend(this, {
                _aspectRatio: !!(o.aspectRatio),
                aspectRatio: o.aspectRatio,
                originalElement: this.element,
                _proportionallyResizeElements: [],
                _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null
            });

            // Wrap the element if it cannot hold child nodes
            if (this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)) {

                this.element.wrap(
                    $("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({
                        position: this.element.css("position"),
                        width: this.element.outerWidth(),
                        height: this.element.outerHeight(),
                        top: this.element.css("top"),
                        left: this.element.css("left")
                    })
                );

                this.element = this.element.parent().data(
                    "ui-resizable", this.element.resizable("instance")
                );

                this.elementIsWrapper = true;

                margins = {
                    marginTop: this.originalElement.css("marginTop"),
                    marginRight: this.originalElement.css("marginRight"),
                    marginBottom: this.originalElement.css("marginBottom"),
                    marginLeft: this.originalElement.css("marginLeft")
                };

                this.element.css(margins);
                this.originalElement.css("margin", 0);

                // support: Safari
                // Prevent Safari textarea resize
                this.originalResizeStyle = this.originalElement.css("resize");
                this.originalElement.css("resize", "none");

                this._proportionallyResizeElements.push(this.originalElement.css({
                    position: "static",
                    zoom: 1,
                    display: "block"
                }));

                // Support: IE9
                // avoid IE jump (hard set the margin)
                this.originalElement.css(margins);

                this._proportionallyResize();
            }

            this._setupHandles();

            if (o.autoHide) {
                $(this.element)
                    .on("mouseenter", function () {
                        if (o.disabled) {
                            return;
                        }
                        that._removeClass("ui-resizable-autohide");
                        that._handles.show();
                    })
                    .on("mouseleave", function () {
                        if (o.disabled) {
                            return;
                        }
                        if (!that.resizing) {
                            that._addClass("ui-resizable-autohide");
                            that._handles.hide();
                        }
                    });
            }

            this._mouseInit();
        },

        _destroy: function () {

            this._mouseDestroy();

            var wrapper,
                _destroy = function (exp) {
                    $(exp)
                        .removeData("resizable")
                        .removeData("ui-resizable")
                        .off(".resizable")
                        .find(".ui-resizable-handle")
                        .remove();
                };

            // TODO: Unwrap at same DOM position
            if (this.elementIsWrapper) {
                _destroy(this.element);
                wrapper = this.element;
                this.originalElement.css({
                    position: wrapper.css("position"),
                    width: wrapper.outerWidth(),
                    height: wrapper.outerHeight(),
                    top: wrapper.css("top"),
                    left: wrapper.css("left")
                }).insertAfter(wrapper);
                wrapper.remove();
            }

            this.originalElement.css("resize", this.originalResizeStyle);
            _destroy(this.originalElement);

            return this;
        },

        _setOption: function (key, value) {
            this._super(key, value);

            switch (key) {
                case "handles":
                    this._removeHandles();
                    this._setupHandles();
                    break;
                default:
                    break;
            }
        },

        _setupHandles: function () {
            var o = this.options, handle, i, n, hname, axis, that = this;
            this.handles = o.handles ||
                (!$(".ui-resizable-handle", this.element).length ?
                    "e,s,se" : {
                        n: ".ui-resizable-n",
                        e: ".ui-resizable-e",
                        s: ".ui-resizable-s",
                        w: ".ui-resizable-w",
                        se: ".ui-resizable-se",
                        sw: ".ui-resizable-sw",
                        ne: ".ui-resizable-ne",
                        nw: ".ui-resizable-nw"
                    });

            this._handles = $();
            if (this.handles.constructor === String) {

                if (this.handles === "all") {
                    this.handles = "n,e,s,w,se,sw,ne,nw";
                }

                n = this.handles.split(",");
                this.handles = {};

                for (i = 0; i < n.length; i++) {

                    handle = $.trim(n[i]);
                    hname = "ui-resizable-" + handle;
                    axis = $("<div>");
                    this._addClass(axis, "ui-resizable-handle " + hname);

                    axis.css({ zIndex: o.zIndex });

                    this.handles[handle] = ".ui-resizable-" + handle;
                    this.element.append(axis);
                }

            }

            this._renderAxis = function (target) {

                var i, axis, padPos, padWrapper;

                target = target || this.element;

                for (i in this.handles) {

                    if (this.handles[i].constructor === String) {
                        this.handles[i] = this.element.children(this.handles[i]).first().show();
                    } else if (this.handles[i].jquery || this.handles[i].nodeType) {
                        this.handles[i] = $(this.handles[i]);
                        this._on(this.handles[i], { "mousedown": that._mouseDown });
                    }

                    if (this.elementIsWrapper &&
                        this.originalElement[0]
                            .nodeName
                            .match(/^(textarea|input|select|button)$/i)) {
                        axis = $(this.handles[i], this.element);

                        padWrapper = /sw|ne|nw|se|n|s/.test(i) ?
                            axis.outerHeight() :
                            axis.outerWidth();

                        padPos = ["padding",
                            /ne|nw|n/.test(i) ? "Top" :
                                /se|sw|s/.test(i) ? "Bottom" :
                                    /^e$/.test(i) ? "Right" : "Left"].join("");

                        target.css(padPos, padWrapper);

                        this._proportionallyResize();
                    }

                    this._handles = this._handles.add(this.handles[i]);
                }
            };

            // TODO: make renderAxis a prototype function
            this._renderAxis(this.element);

            this._handles = this._handles.add(this.element.find(".ui-resizable-handle"));
            this._handles.disableSelection();

            this._handles.on("mouseover", function () {
                if (!that.resizing) {
                    if (this.className) {
                        axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
                    }
                    that.axis = axis && axis[1] ? axis[1] : "se";
                }
            });

            if (o.autoHide) {
                this._handles.hide();
                this._addClass("ui-resizable-autohide");
            }
        },

        _removeHandles: function () {
            this._handles.remove();
        },

        _mouseCapture: function (event) {
            var i, handle,
                capture = false;

            for (i in this.handles) {
                handle = $(this.handles[i])[0];
                if (handle === event.target || $.contains(handle, event.target)) {
                    capture = true;
                }
            }

            return !this.options.disabled && capture;
        },

        _mouseStart: function (event) {

            var curleft, curtop, cursor,
                o = this.options,
                el = this.element;

            this.resizing = true;

            this._renderProxy();

            curleft = this._num(this.helper.css("left"));
            curtop = this._num(this.helper.css("top"));

            if (o.containment) {
                curleft += $(o.containment).scrollLeft() || 0;
                curtop += $(o.containment).scrollTop() || 0;
            }

            this.offset = this.helper.offset();
            this.position = { left: curleft, top: curtop };

            this.size = this._helper ? {
                width: this.helper.width(),
                height: this.helper.height()
            } : {
                    width: el.width(),
                    height: el.height()
                };

            this.originalSize = this._helper ? {
                width: el.outerWidth(),
                height: el.outerHeight()
            } : {
                    width: el.width(),
                    height: el.height()
                };

            this.sizeDiff = {
                width: el.outerWidth() - el.width(),
                height: el.outerHeight() - el.height()
            };

            this.originalPosition = { left: curleft, top: curtop };
            this.originalMousePosition = { left: event.pageX, top: event.pageY };

            this.aspectRatio = (typeof o.aspectRatio === "number") ?
                o.aspectRatio :
                ((this.originalSize.width / this.originalSize.height) || 1);

            cursor = $(".ui-resizable-" + this.axis).css("cursor");
            $("body").css("cursor", cursor === "auto" ? this.axis + "-resize" : cursor);

            this._addClass("ui-resizable-resizing");
            this._propagate("start", event);
            return true;
        },

        _mouseDrag: function (event) {

            var data, props,
                smp = this.originalMousePosition,
                a = this.axis,
                dx = (event.pageX - smp.left) || 0,
                dy = (event.pageY - smp.top) || 0,
                trigger = this._change[a];

            this._updatePrevProperties();

            if (!trigger) {
                return false;
            }

            data = trigger.apply(this, [event, dx, dy]);

            this._updateVirtualBoundaries(event.shiftKey);
            if (this._aspectRatio || event.shiftKey) {
                data = this._updateRatio(data, event);
            }

            data = this._respectSize(data, event);

            this._updateCache(data);

            this._propagate("resize", event);

            props = this._applyChanges();

            if (!this._helper && this._proportionallyResizeElements.length) {
                this._proportionallyResize();
            }

            if (!$.isEmptyObject(props)) {
                this._updatePrevProperties();
                this._trigger("resize", event, this.ui());
                this._applyChanges();
            }

            return false;
        },

        _mouseStop: function (event) {

            this.resizing = false;
            var pr, ista, soffseth, soffsetw, s, left, top,
                o = this.options, that = this;

            if (this._helper) {

                pr = this._proportionallyResizeElements;
                ista = pr.length && (/textarea/i).test(pr[0].nodeName);
                soffseth = ista && this._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height;
                soffsetw = ista ? 0 : that.sizeDiff.width;

                s = {
                    width: (that.helper.width() - soffsetw),
                    height: (that.helper.height() - soffseth)
                };
                left = (parseFloat(that.element.css("left")) +
                    (that.position.left - that.originalPosition.left)) || null;
                top = (parseFloat(that.element.css("top")) +
                    (that.position.top - that.originalPosition.top)) || null;

                if (!o.animate) {
                    this.element.css($.extend(s, { top: top, left: left }));
                }

                that.helper.height(that.size.height);
                that.helper.width(that.size.width);

                if (this._helper && !o.animate) {
                    this._proportionallyResize();
                }
            }

            $("body").css("cursor", "auto");

            this._removeClass("ui-resizable-resizing");

            this._propagate("stop", event);

            if (this._helper) {
                this.helper.remove();
            }

            return false;

        },

        _updatePrevProperties: function () {
            this.prevPosition = {
                top: this.position.top,
                left: this.position.left
            };
            this.prevSize = {
                width: this.size.width,
                height: this.size.height
            };
        },

        _applyChanges: function () {
            var props = {};

            if (this.position.top !== this.prevPosition.top) {
                props.top = this.position.top + "px";
            }
            if (this.position.left !== this.prevPosition.left) {
                props.left = this.position.left + "px";
            }
            if (this.size.width !== this.prevSize.width) {
                props.width = this.size.width + "px";
            }
            if (this.size.height !== this.prevSize.height) {
                props.height = this.size.height + "px";
            }

            this.helper.css(props);

            return props;
        },

        _updateVirtualBoundaries: function (forceAspectRatio) {
            var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b,
                o = this.options;

            b = {
                minWidth: this._isNumber(o.minWidth) ? o.minWidth : 0,
                maxWidth: this._isNumber(o.maxWidth) ? o.maxWidth : Infinity,
                minHeight: this._isNumber(o.minHeight) ? o.minHeight : 0,
                maxHeight: this._isNumber(o.maxHeight) ? o.maxHeight : Infinity
            };

            if (this._aspectRatio || forceAspectRatio) {
                pMinWidth = b.minHeight * this.aspectRatio;
                pMinHeight = b.minWidth / this.aspectRatio;
                pMaxWidth = b.maxHeight * this.aspectRatio;
                pMaxHeight = b.maxWidth / this.aspectRatio;

                if (pMinWidth > b.minWidth) {
                    b.minWidth = pMinWidth;
                }
                if (pMinHeight > b.minHeight) {
                    b.minHeight = pMinHeight;
                }
                if (pMaxWidth < b.maxWidth) {
                    b.maxWidth = pMaxWidth;
                }
                if (pMaxHeight < b.maxHeight) {
                    b.maxHeight = pMaxHeight;
                }
            }
            this._vBoundaries = b;
        },

        _updateCache: function (data) {
            this.offset = this.helper.offset();
            if (this._isNumber(data.left)) {
                this.position.left = data.left;
            }
            if (this._isNumber(data.top)) {
                this.position.top = data.top;
            }
            if (this._isNumber(data.height)) {
                this.size.height = data.height;
            }
            if (this._isNumber(data.width)) {
                this.size.width = data.width;
            }
        },

        _updateRatio: function (data) {

            var cpos = this.position,
                csize = this.size,
                a = this.axis;

            if (this._isNumber(data.height)) {
                data.width = (data.height * this.aspectRatio);
            } else if (this._isNumber(data.width)) {
                data.height = (data.width / this.aspectRatio);
            }

            if (a === "sw") {
                data.left = cpos.left + (csize.width - data.width);
                data.top = null;
            }
            if (a === "nw") {
                data.top = cpos.top + (csize.height - data.height);
                data.left = cpos.left + (csize.width - data.width);
            }

            return data;
        },

        _respectSize: function (data) {

            var o = this._vBoundaries,
                a = this.axis,
                ismaxw = this._isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width),
                ismaxh = this._isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
                isminw = this._isNumber(data.width) && o.minWidth && (o.minWidth > data.width),
                isminh = this._isNumber(data.height) && o.minHeight && (o.minHeight > data.height),
                dw = this.originalPosition.left + this.originalSize.width,
                dh = this.originalPosition.top + this.originalSize.height,
                cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
            if (isminw) {
                data.width = o.minWidth;
            }
            if (isminh) {
                data.height = o.minHeight;
            }
            if (ismaxw) {
                data.width = o.maxWidth;
            }
            if (ismaxh) {
                data.height = o.maxHeight;
            }

            if (isminw && cw) {
                data.left = dw - o.minWidth;
            }
            if (ismaxw && cw) {
                data.left = dw - o.maxWidth;
            }
            if (isminh && ch) {
                data.top = dh - o.minHeight;
            }
            if (ismaxh && ch) {
                data.top = dh - o.maxHeight;
            }

            // Fixing jump error on top/left - bug #2330
            if (!data.width && !data.height && !data.left && data.top) {
                data.top = null;
            } else if (!data.width && !data.height && !data.top && data.left) {
                data.left = null;
            }

            return data;
        },

        _getPaddingPlusBorderDimensions: function (element) {
            var i = 0,
                widths = [],
                borders = [
                    element.css("borderTopWidth"),
                    element.css("borderRightWidth"),
                    element.css("borderBottomWidth"),
                    element.css("borderLeftWidth")
                ],
                paddings = [
                    element.css("paddingTop"),
                    element.css("paddingRight"),
                    element.css("paddingBottom"),
                    element.css("paddingLeft")
                ];

            for (; i < 4; i++) {
                widths[i] = (parseFloat(borders[i]) || 0);
                widths[i] += (parseFloat(paddings[i]) || 0);
            }

            return {
                height: widths[0] + widths[2],
                width: widths[1] + widths[3]
            };
        },

        _proportionallyResize: function () {

            if (!this._proportionallyResizeElements.length) {
                return;
            }

            var prel,
                i = 0,
                element = this.helper || this.element;

            for (; i < this._proportionallyResizeElements.length; i++) {

                prel = this._proportionallyResizeElements[i];

                // TODO: Seems like a bug to cache this.outerDimensions
                // considering that we are in a loop.
                if (!this.outerDimensions) {
                    this.outerDimensions = this._getPaddingPlusBorderDimensions(prel);
                }

                prel.css({
                    height: (element.height() - this.outerDimensions.height) || 0,
                    width: (element.width() - this.outerDimensions.width) || 0
                });

            }

        },

        _renderProxy: function () {

            var el = this.element, o = this.options;
            this.elementOffset = el.offset();

            if (this._helper) {

                this.helper = this.helper || $("<div style='overflow:hidden;'></div>");

                this._addClass(this.helper, this._helper);
                this.helper.css({
                    width: this.element.outerWidth(),
                    height: this.element.outerHeight(),
                    position: "absolute",
                    left: this.elementOffset.left + "px",
                    top: this.elementOffset.top + "px",
                    zIndex: ++o.zIndex //TODO: Don't modify option
                });

                this.helper
                    .appendTo("body")
                    .disableSelection();

            } else {
                this.helper = this.element;
            }

        },

        _change: {
            e: function (event, dx) {
                return { width: this.originalSize.width + dx };
            },
            w: function (event, dx) {
                var cs = this.originalSize, sp = this.originalPosition;
                return { left: sp.left + dx, width: cs.width - dx };
            },
            n: function (event, dx, dy) {
                var cs = this.originalSize, sp = this.originalPosition;
                return { top: sp.top + dy, height: cs.height - dy };
            },
            s: function (event, dx, dy) {
                return { height: this.originalSize.height + dy };
            },
            se: function (event, dx, dy) {
                return $.extend(this._change.s.apply(this, arguments),
                    this._change.e.apply(this, [event, dx, dy]));
            },
            sw: function (event, dx, dy) {
                return $.extend(this._change.s.apply(this, arguments),
                    this._change.w.apply(this, [event, dx, dy]));
            },
            ne: function (event, dx, dy) {
                return $.extend(this._change.n.apply(this, arguments),
                    this._change.e.apply(this, [event, dx, dy]));
            },
            nw: function (event, dx, dy) {
                return $.extend(this._change.n.apply(this, arguments),
                    this._change.w.apply(this, [event, dx, dy]));
            }
        },

        _propagate: function (n, event) {
            $.ui.plugin.call(this, n, [event, this.ui()]);
            (n !== "resize" && this._trigger(n, event, this.ui()));
        },

        plugins: {},

        ui: function () {
            return {
                originalElement: this.originalElement,
                element: this.element,
                helper: this.helper,
                position: this.position,
                size: this.size,
                originalSize: this.originalSize,
                originalPosition: this.originalPosition
            };
        }

    });

    /*
     * Resizable Extensions
     */

    $.ui.plugin.add("resizable", "animate", {

        stop: function (event) {
            var that = $(this).resizable("instance"),
                o = that.options,
                pr = that._proportionallyResizeElements,
                ista = pr.length && (/textarea/i).test(pr[0].nodeName),
                soffseth = ista && that._hasScroll(pr[0], "left") ? 0 : that.sizeDiff.height,
                soffsetw = ista ? 0 : that.sizeDiff.width,
                style = {
                    width: (that.size.width - soffsetw),
                    height: (that.size.height - soffseth)
                },
                left = (parseFloat(that.element.css("left")) +
                    (that.position.left - that.originalPosition.left)) || null,
                top = (parseFloat(that.element.css("top")) +
                    (that.position.top - that.originalPosition.top)) || null;

            that.element.animate(
                $.extend(style, top && left ? { top: top, left: left } : {}), {
                    duration: o.animateDuration,
                    easing: o.animateEasing,
                    step: function () {

                        var data = {
                            width: parseFloat(that.element.css("width")),
                            height: parseFloat(that.element.css("height")),
                            top: parseFloat(that.element.css("top")),
                            left: parseFloat(that.element.css("left"))
                        };

                        if (pr && pr.length) {
                            $(pr[0]).css({ width: data.width, height: data.height });
                        }

                        // Propagating resize, and updating values for each animation step
                        that._updateCache(data);
                        that._propagate("resize", event);

                    }
                }
            );
        }

    });

    $.ui.plugin.add("resizable", "containment", {

        start: function () {
            var element, p, co, ch, cw, width, height,
                that = $(this).resizable("instance"),
                o = that.options,
                el = that.element,
                oc = o.containment,
                ce = (oc instanceof $) ?
                    oc.get(0) :
                    (/parent/.test(oc)) ? el.parent().get(0) : oc;

            if (!ce) {
                return;
            }

            that.containerElement = $(ce);

            if (/document/.test(oc) || oc === document) {
                that.containerOffset = {
                    left: 0,
                    top: 0
                };
                that.containerPosition = {
                    left: 0,
                    top: 0
                };

                that.parentData = {
                    element: $(document),
                    left: 0,
                    top: 0,
                    width: $(document).width(),
                    height: $(document).height() || document.body.parentNode.scrollHeight
                };
            } else {
                element = $(ce);
                p = [];
                $(["Top", "Right", "Left", "Bottom"]).each(function (i, name) {
                    p[i] = that._num(element.css("padding" + name));
                });

                that.containerOffset = element.offset();
                that.containerPosition = element.position();
                that.containerSize = {
                    height: (element.innerHeight() - p[3]),
                    width: (element.innerWidth() - p[1])
                };

                co = that.containerOffset;
                ch = that.containerSize.height;
                cw = that.containerSize.width;
                width = (that._hasScroll(ce, "left") ? ce.scrollWidth : cw);
                height = (that._hasScroll(ce) ? ce.scrollHeight : ch);

                that.parentData = {
                    element: ce,
                    left: co.left,
                    top: co.top,
                    width: width,
                    height: height
                };
            }
        },

        resize: function (event) {
            var woset, hoset, isParent, isOffsetRelative,
                that = $(this).resizable("instance"),
                o = that.options,
                co = that.containerOffset,
                cp = that.position,
                pRatio = that._aspectRatio || event.shiftKey,
                cop = {
                    top: 0,
                    left: 0
                },
                ce = that.containerElement,
                continueResize = true;

            if (ce[0] !== document && (/static/).test(ce.css("position"))) {
                cop = co;
            }

            if (cp.left < (that._helper ? co.left : 0)) {
                that.size.width = that.size.width +
                    (that._helper ?
                        (that.position.left - co.left) :
                        (that.position.left - cop.left));

                if (pRatio) {
                    that.size.height = that.size.width / that.aspectRatio;
                    continueResize = false;
                }
                that.position.left = o.helper ? co.left : 0;
            }

            if (cp.top < (that._helper ? co.top : 0)) {
                that.size.height = that.size.height +
                    (that._helper ?
                        (that.position.top - co.top) :
                        that.position.top);

                if (pRatio) {
                    that.size.width = that.size.height * that.aspectRatio;
                    continueResize = false;
                }
                that.position.top = that._helper ? co.top : 0;
            }

            isParent = that.containerElement.get(0) === that.element.parent().get(0);
            isOffsetRelative = /relative|absolute/.test(that.containerElement.css("position"));

            if (isParent && isOffsetRelative) {
                that.offset.left = that.parentData.left + that.position.left;
                that.offset.top = that.parentData.top + that.position.top;
            } else {
                that.offset.left = that.element.offset().left;
                that.offset.top = that.element.offset().top;
            }

            woset = Math.abs(that.sizeDiff.width +
                (that._helper ?
                    that.offset.left - cop.left :
                    (that.offset.left - co.left)));

            hoset = Math.abs(that.sizeDiff.height +
                (that._helper ?
                    that.offset.top - cop.top :
                    (that.offset.top - co.top)));

            if (woset + that.size.width >= that.parentData.width) {
                that.size.width = that.parentData.width - woset;
                if (pRatio) {
                    that.size.height = that.size.width / that.aspectRatio;
                    continueResize = false;
                }
            }

            if (hoset + that.size.height >= that.parentData.height) {
                that.size.height = that.parentData.height - hoset;
                if (pRatio) {
                    that.size.width = that.size.height * that.aspectRatio;
                    continueResize = false;
                }
            }

            if (!continueResize) {
                that.position.left = that.prevPosition.left;
                that.position.top = that.prevPosition.top;
                that.size.width = that.prevSize.width;
                that.size.height = that.prevSize.height;
            }
        },

        stop: function () {
            var that = $(this).resizable("instance"),
                o = that.options,
                co = that.containerOffset,
                cop = that.containerPosition,
                ce = that.containerElement,
                helper = $(that.helper),
                ho = helper.offset(),
                w = helper.outerWidth() - that.sizeDiff.width,
                h = helper.outerHeight() - that.sizeDiff.height;

            if (that._helper && !o.animate && (/relative/).test(ce.css("position"))) {
                $(this).css({
                    left: ho.left - cop.left - co.left,
                    width: w,
                    height: h
                });
            }

            if (that._helper && !o.animate && (/static/).test(ce.css("position"))) {
                $(this).css({
                    left: ho.left - cop.left - co.left,
                    width: w,
                    height: h
                });
            }
        }
    });

    $.ui.plugin.add("resizable", "alsoResize", {

        start: function () {
            var that = $(this).resizable("instance"),
                o = that.options;

            $(o.alsoResize).each(function () {
                var el = $(this);
                el.data("ui-resizable-alsoresize", {
                    width: parseFloat(el.width()), height: parseFloat(el.height()),
                    left: parseFloat(el.css("left")), top: parseFloat(el.css("top"))
                });
            });
        },

        resize: function (event, ui) {
            var that = $(this).resizable("instance"),
                o = that.options,
                os = that.originalSize,
                op = that.originalPosition,
                delta = {
                    height: (that.size.height - os.height) || 0,
                    width: (that.size.width - os.width) || 0,
                    top: (that.position.top - op.top) || 0,
                    left: (that.position.left - op.left) || 0
                };

            $(o.alsoResize).each(function () {
                var el = $(this), start = $(this).data("ui-resizable-alsoresize"), style = {},
                    css = el.parents(ui.originalElement[0]).length ?
                        ["width", "height"] :
                        ["width", "height", "top", "left"];

                $.each(css, function (i, prop) {
                    var sum = (start[prop] || 0) + (delta[prop] || 0);
                    if (sum && sum >= 0) {
                        style[prop] = sum || null;
                    }
                });

                el.css(style);
            });
        },

        stop: function () {
            $(this).removeData("ui-resizable-alsoresize");
        }
    });

    $.ui.plugin.add("resizable", "ghost", {

        start: function () {

            var that = $(this).resizable("instance"), cs = that.size;

            that.ghost = that.originalElement.clone();
            that.ghost.css({
                opacity: 0.25,
                display: "block",
                position: "relative",
                height: cs.height,
                width: cs.width,
                margin: 0,
                left: 0,
                top: 0
            });

            that._addClass(that.ghost, "ui-resizable-ghost");

            // DEPRECATED
            // TODO: remove after 1.12
            if ($.uiBackCompat !== false && typeof that.options.ghost === "string") {

                // Ghost option
                that.ghost.addClass(this.options.ghost);
            }

            that.ghost.appendTo(that.helper);

        },

        resize: function () {
            var that = $(this).resizable("instance");
            if (that.ghost) {
                that.ghost.css({
                    position: "relative",
                    height: that.size.height,
                    width: that.size.width
                });
            }
        },

        stop: function () {
            var that = $(this).resizable("instance");
            if (that.ghost && that.helper) {
                that.helper.get(0).removeChild(that.ghost.get(0));
            }
        }

    });

    $.ui.plugin.add("resizable", "grid", {

        resize: function () {
            var outerDimensions,
                that = $(this).resizable("instance"),
                o = that.options,
                cs = that.size,
                os = that.originalSize,
                op = that.originalPosition,
                a = that.axis,
                grid = typeof o.grid === "number" ? [o.grid, o.grid] : o.grid,
                gridX = (grid[0] || 1),
                gridY = (grid[1] || 1),
                ox = Math.round((cs.width - os.width) / gridX) * gridX,
                oy = Math.round((cs.height - os.height) / gridY) * gridY,
                newWidth = os.width + ox,
                newHeight = os.height + oy,
                isMaxWidth = o.maxWidth && (o.maxWidth < newWidth),
                isMaxHeight = o.maxHeight && (o.maxHeight < newHeight),
                isMinWidth = o.minWidth && (o.minWidth > newWidth),
                isMinHeight = o.minHeight && (o.minHeight > newHeight);

            o.grid = grid;

            if (isMinWidth) {
                newWidth += gridX;
            }
            if (isMinHeight) {
                newHeight += gridY;
            }
            if (isMaxWidth) {
                newWidth -= gridX;
            }
            if (isMaxHeight) {
                newHeight -= gridY;
            }

            if (/^(se|s|e)$/.test(a)) {
                that.size.width = newWidth;
                that.size.height = newHeight;
            } else if (/^(ne)$/.test(a)) {
                that.size.width = newWidth;
                that.size.height = newHeight;
                that.position.top = op.top - oy;
            } else if (/^(sw)$/.test(a)) {
                that.size.width = newWidth;
                that.size.height = newHeight;
                that.position.left = op.left - ox;
            } else {
                if (newHeight - gridY <= 0 || newWidth - gridX <= 0) {
                    outerDimensions = that._getPaddingPlusBorderDimensions(this);
                }

                if (newHeight - gridY > 0) {
                    that.size.height = newHeight;
                    that.position.top = op.top - oy;
                } else {
                    newHeight = gridY - outerDimensions.height;
                    that.size.height = newHeight;
                    that.position.top = op.top + os.height - newHeight;
                }
                if (newWidth - gridX > 0) {
                    that.size.width = newWidth;
                    that.position.left = op.left - ox;
                } else {
                    newWidth = gridX - outerDimensions.width;
                    that.size.width = newWidth;
                    that.position.left = op.left + os.width - newWidth;
                }
            }
        }

    });

    var widgetsResizable = $.ui.resizable;


    /*!
     * jQuery UI Selectable 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Selectable
    //>>group: Interactions
    //>>description: Allows groups of elements to be selected with the mouse.
    //>>docs: http://api.jqueryui.com/selectable/
    //>>demos: http://jqueryui.com/selectable/
    //>>css.structure: ../../themes/base/selectable.css



    var widgetsSelectable = $.widget("ui.selectable", $.ui.mouse, {
        version: "1.12.1",
        options: {
            appendTo: "body",
            autoRefresh: true,
            distance: 0,
            filter: "*",
            tolerance: "touch",

            // Callbacks
            selected: null,
            selecting: null,
            start: null,
            stop: null,
            unselected: null,
            unselecting: null
        },
        _create: function () {
            var that = this;

            this._addClass("ui-selectable");

            this.dragged = false;

            // Cache selectee children based on filter
            this.refresh = function () {
                that.elementPos = $(that.element[0]).offset();
                that.selectees = $(that.options.filter, that.element[0]);
                that._addClass(that.selectees, "ui-selectee");
                that.selectees.each(function () {
                    var $this = $(this),
                        selecteeOffset = $this.offset(),
                        pos = {
                            left: selecteeOffset.left - that.elementPos.left,
                            top: selecteeOffset.top - that.elementPos.top
                        };
                    $.data(this, "selectable-item", {
                        element: this,
                        $element: $this,
                        left: pos.left,
                        top: pos.top,
                        right: pos.left + $this.outerWidth(),
                        bottom: pos.top + $this.outerHeight(),
                        startselected: false,
                        selected: $this.hasClass("ui-selected"),
                        selecting: $this.hasClass("ui-selecting"),
                        unselecting: $this.hasClass("ui-unselecting")
                    });
                });
            };
            this.refresh();

            this._mouseInit();

            this.helper = $("<div>");
            this._addClass(this.helper, "ui-selectable-helper");
        },

        _destroy: function () {
            this.selectees.removeData("selectable-item");
            this._mouseDestroy();
        },

        _mouseStart: function (event) {
            var that = this,
                options = this.options;

            this.opos = [event.pageX, event.pageY];
            this.elementPos = $(this.element[0]).offset();

            if (this.options.disabled) {
                return;
            }

            this.selectees = $(options.filter, this.element[0]);

            this._trigger("start", event);

            $(options.appendTo).append(this.helper);

            // position helper (lasso)
            this.helper.css({
                "left": event.pageX,
                "top": event.pageY,
                "width": 0,
                "height": 0
            });

            if (options.autoRefresh) {
                this.refresh();
            }

            this.selectees.filter(".ui-selected").each(function () {
                var selectee = $.data(this, "selectable-item");
                selectee.startselected = true;
                if (!event.metaKey && !event.ctrlKey) {
                    that._removeClass(selectee.$element, "ui-selected");
                    selectee.selected = false;
                    that._addClass(selectee.$element, "ui-unselecting");
                    selectee.unselecting = true;

                    // selectable UNSELECTING callback
                    that._trigger("unselecting", event, {
                        unselecting: selectee.element
                    });
                }
            });

            $(event.target).parents().addBack().each(function () {
                var doSelect,
                    selectee = $.data(this, "selectable-item");
                if (selectee) {
                    doSelect = (!event.metaKey && !event.ctrlKey) ||
                        !selectee.$element.hasClass("ui-selected");
                    that._removeClass(selectee.$element, doSelect ? "ui-unselecting" : "ui-selected")
                        ._addClass(selectee.$element, doSelect ? "ui-selecting" : "ui-unselecting");
                    selectee.unselecting = !doSelect;
                    selectee.selecting = doSelect;
                    selectee.selected = doSelect;

                    // selectable (UN)SELECTING callback
                    if (doSelect) {
                        that._trigger("selecting", event, {
                            selecting: selectee.element
                        });
                    } else {
                        that._trigger("unselecting", event, {
                            unselecting: selectee.element
                        });
                    }
                    return false;
                }
            });

        },

        _mouseDrag: function (event) {

            this.dragged = true;

            if (this.options.disabled) {
                return;
            }

            var tmp,
                that = this,
                options = this.options,
                x1 = this.opos[0],
                y1 = this.opos[1],
                x2 = event.pageX,
                y2 = event.pageY;

            if (x1 > x2) { tmp = x2; x2 = x1; x1 = tmp; }
            if (y1 > y2) { tmp = y2; y2 = y1; y1 = tmp; }
            this.helper.css({ left: x1, top: y1, width: x2 - x1, height: y2 - y1 });

            this.selectees.each(function () {
                var selectee = $.data(this, "selectable-item"),
                    hit = false,
                    offset = {};

                //prevent helper from being selected if appendTo: selectable
                if (!selectee || selectee.element === that.element[0]) {
                    return;
                }

                offset.left = selectee.left + that.elementPos.left;
                offset.right = selectee.right + that.elementPos.left;
                offset.top = selectee.top + that.elementPos.top;
                offset.bottom = selectee.bottom + that.elementPos.top;

                if (options.tolerance === "touch") {
                    hit = (!(offset.left > x2 || offset.right < x1 || offset.top > y2 ||
                        offset.bottom < y1));
                } else if (options.tolerance === "fit") {
                    hit = (offset.left > x1 && offset.right < x2 && offset.top > y1 &&
                        offset.bottom < y2);
                }

                if (hit) {

                    // SELECT
                    if (selectee.selected) {
                        that._removeClass(selectee.$element, "ui-selected");
                        selectee.selected = false;
                    }
                    if (selectee.unselecting) {
                        that._removeClass(selectee.$element, "ui-unselecting");
                        selectee.unselecting = false;
                    }
                    if (!selectee.selecting) {
                        that._addClass(selectee.$element, "ui-selecting");
                        selectee.selecting = true;

                        // selectable SELECTING callback
                        that._trigger("selecting", event, {
                            selecting: selectee.element
                        });
                    }
                } else {

                    // UNSELECT
                    if (selectee.selecting) {
                        if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
                            that._removeClass(selectee.$element, "ui-selecting");
                            selectee.selecting = false;
                            that._addClass(selectee.$element, "ui-selected");
                            selectee.selected = true;
                        } else {
                            that._removeClass(selectee.$element, "ui-selecting");
                            selectee.selecting = false;
                            if (selectee.startselected) {
                                that._addClass(selectee.$element, "ui-unselecting");
                                selectee.unselecting = true;
                            }

                            // selectable UNSELECTING callback
                            that._trigger("unselecting", event, {
                                unselecting: selectee.element
                            });
                        }
                    }
                    if (selectee.selected) {
                        if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
                            that._removeClass(selectee.$element, "ui-selected");
                            selectee.selected = false;

                            that._addClass(selectee.$element, "ui-unselecting");
                            selectee.unselecting = true;

                            // selectable UNSELECTING callback
                            that._trigger("unselecting", event, {
                                unselecting: selectee.element
                            });
                        }
                    }
                }
            });

            return false;
        },

        _mouseStop: function (event) {
            var that = this;

            this.dragged = false;

            $(".ui-unselecting", this.element[0]).each(function () {
                var selectee = $.data(this, "selectable-item");
                that._removeClass(selectee.$element, "ui-unselecting");
                selectee.unselecting = false;
                selectee.startselected = false;
                that._trigger("unselected", event, {
                    unselected: selectee.element
                });
            });
            $(".ui-selecting", this.element[0]).each(function () {
                var selectee = $.data(this, "selectable-item");
                that._removeClass(selectee.$element, "ui-selecting")
                    ._addClass(selectee.$element, "ui-selected");
                selectee.selecting = false;
                selectee.selected = true;
                selectee.startselected = true;
                that._trigger("selected", event, {
                    selected: selectee.element
                });
            });
            this._trigger("stop", event);

            this.helper.remove();

            return false;
        }

    });


    /*!
     * jQuery UI Sortable 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Sortable
    //>>group: Interactions
    //>>description: Enables items in a list to be sorted using the mouse.
    //>>docs: http://api.jqueryui.com/sortable/
    //>>demos: http://jqueryui.com/sortable/
    //>>css.structure: ../../themes/base/sortable.css



    var widgetsSortable = $.widget("ui.sortable", $.ui.mouse, {
        version: "1.12.1",
        widgetEventPrefix: "sort",
        ready: false,
        options: {
            appendTo: "parent",
            axis: false,
            connectWith: false,
            containment: false,
            cursor: "auto",
            cursorAt: false,
            dropOnEmpty: true,
            forcePlaceholderSize: false,
            forceHelperSize: false,
            grid: false,
            handle: false,
            helper: "original",
            items: "> *",
            opacity: false,
            placeholder: false,
            revert: false,
            scroll: true,
            scrollSensitivity: 20,
            scrollSpeed: 20,
            scope: "default",
            tolerance: "intersect",
            zIndex: 1000,

            // Callbacks
            activate: null,
            beforeStop: null,
            change: null,
            deactivate: null,
            out: null,
            over: null,
            receive: null,
            remove: null,
            sort: null,
            start: null,
            stop: null,
            update: null
        },

        _isOverAxis: function (x, reference, size) {
            return (x >= reference) && (x < (reference + size));
        },

        _isFloating: function (item) {
            return (/left|right/).test(item.css("float")) ||
                (/inline|table-cell/).test(item.css("display"));
        },

        _create: function () {
            this.containerCache = {};
            this._addClass("ui-sortable");

            //Get the items
            this.refresh();

            //Let's determine the parent's offset
            this.offset = this.element.offset();

            //Initialize mouse events for interaction
            this._mouseInit();

            this._setHandleClassName();

            //We're ready to go
            this.ready = true;

        },

        _setOption: function (key, value) {
            this._super(key, value);

            if (key === "handle") {
                this._setHandleClassName();
            }
        },

        _setHandleClassName: function () {
            var that = this;
            this._removeClass(this.element.find(".ui-sortable-handle"), "ui-sortable-handle");
            $.each(this.items, function () {
                that._addClass(
                    this.instance.options.handle ?
                        this.item.find(this.instance.options.handle) :
                        this.item,
                    "ui-sortable-handle"
                );
            });
        },

        _destroy: function () {
            this._mouseDestroy();

            for (var i = this.items.length - 1; i >= 0; i--) {
                this.items[i].item.removeData(this.widgetName + "-item");
            }

            return this;
        },

        _mouseCapture: function (event, overrideHandle) {
            var currentItem = null,
                validHandle = false,
                that = this;

            if (this.reverting) {
                return false;
            }

            if (this.options.disabled || this.options.type === "static") {
                return false;
            }

            //We have to refresh the items data once first
            this._refreshItems(event);

            //Find out if the clicked node (or one of its parents) is a actual item in this.items
            $(event.target).parents().each(function () {
                if ($.data(this, that.widgetName + "-item") === that) {
                    currentItem = $(this);
                    return false;
                }
            });
            if ($.data(event.target, that.widgetName + "-item") === that) {
                currentItem = $(event.target);
            }

            if (!currentItem) {
                return false;
            }
            if (this.options.handle && !overrideHandle) {
                $(this.options.handle, currentItem).find("*").addBack().each(function () {
                    if (this === event.target) {
                        validHandle = true;
                    }
                });
                if (!validHandle) {
                    return false;
                }
            }

            this.currentItem = currentItem;
            this._removeCurrentsFromItems();
            return true;

        },

        _mouseStart: function (event, overrideHandle, noActivation) {

            var i, body,
                o = this.options;

            this.currentContainer = this;

            //We only need to call refreshPositions, because the refreshItems call has been moved to
            // mouseCapture
            this.refreshPositions();

            //Create and append the visible helper
            this.helper = this._createHelper(event);

            //Cache the helper size
            this._cacheHelperProportions();

            /*
             * - Position generation -
             * This block generates everything position related - it's the core of draggables.
             */

            //Cache the margins of the original element
            this._cacheMargins();

            //Get the next scrolling parent
            this.scrollParent = this.helper.scrollParent();

            //The element's absolute position on the page minus margins
            this.offset = this.currentItem.offset();
            this.offset = {
                top: this.offset.top - this.margins.top,
                left: this.offset.left - this.margins.left
            };

            $.extend(this.offset, {
                click: { //Where the click happened, relative to the element
                    left: event.pageX - this.offset.left,
                    top: event.pageY - this.offset.top
                },
                parent: this._getParentOffset(),

                // This is a relative to absolute position minus the actual position calculation -
                // only used for relative positioned helper
                relative: this._getRelativeOffset()
            });

            // Only after we got the offset, we can change the helper's position to absolute
            // TODO: Still need to figure out a way to make relative sorting possible
            this.helper.css("position", "absolute");
            this.cssPosition = this.helper.css("position");

            //Generate the original position
            this.originalPosition = this._generatePosition(event);
            this.originalPageX = event.pageX;
            this.originalPageY = event.pageY;

            //Adjust the mouse offset relative to the helper if "cursorAt" is supplied
            (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));

            //Cache the former DOM position
            this.domPosition = {
                prev: this.currentItem.prev()[0],
                parent: this.currentItem.parent()[0]
            };

            // If the helper is not the original, hide the original so it's not playing any role during
            // the drag, won't cause anything bad this way
            if (this.helper[0] !== this.currentItem[0]) {
                this.currentItem.hide();
            }

            //Create the placeholder
            this._createPlaceholder();

            //Set a containment if given in the options
            if (o.containment) {
                this._setContainment();
            }

            if (o.cursor && o.cursor !== "auto") { // cursor option
                body = this.document.find("body");

                // Support: IE
                this.storedCursor = body.css("cursor");
                body.css("cursor", o.cursor);

                this.storedStylesheet =
                    $("<style>*{ cursor: " + o.cursor + " !important; }</style>").appendTo(body);
            }

            if (o.opacity) { // opacity option
                if (this.helper.css("opacity")) {
                    this._storedOpacity = this.helper.css("opacity");
                }
                this.helper.css("opacity", o.opacity);
            }

            if (o.zIndex) { // zIndex option
                if (this.helper.css("zIndex")) {
                    this._storedZIndex = this.helper.css("zIndex");
                }
                this.helper.css("zIndex", o.zIndex);
            }

            //Prepare scrolling
            if (this.scrollParent[0] !== this.document[0] &&
                this.scrollParent[0].tagName !== "HTML") {
                this.overflowOffset = this.scrollParent.offset();
            }

            //Call callbacks
            this._trigger("start", event, this._uiHash());

            //Recache the helper size
            if (!this._preserveHelperProportions) {
                this._cacheHelperProportions();
            }

            //Post "activate" events to possible containers
            if (!noActivation) {
                for (i = this.containers.length - 1; i >= 0; i--) {
                    this.containers[i]._trigger("activate", event, this._uiHash(this));
                }
            }

            //Prepare possible droppables
            if ($.ui.ddmanager) {
                $.ui.ddmanager.current = this;
            }

            if ($.ui.ddmanager && !o.dropBehaviour) {
                $.ui.ddmanager.prepareOffsets(this, event);
            }

            this.dragging = true;

            this._addClass(this.helper, "ui-sortable-helper");

            // Execute the drag once - this causes the helper not to be visiblebefore getting its
            // correct position
            this._mouseDrag(event);
            return true;

        },

        _mouseDrag: function (event) {
            var i, item, itemElement, intersection,
                o = this.options,
                scrolled = false;

            //Compute the helpers position
            this.position = this._generatePosition(event);
            this.positionAbs = this._convertPositionTo("absolute");

            if (!this.lastPositionAbs) {
                this.lastPositionAbs = this.positionAbs;
            }

            //Do scrolling
            if (this.options.scroll) {
                if (this.scrollParent[0] !== this.document[0] &&
                    this.scrollParent[0].tagName !== "HTML") {

                    if ((this.overflowOffset.top + this.scrollParent[0].offsetHeight) -
                        event.pageY < o.scrollSensitivity) {
                        this.scrollParent[0].scrollTop =
                            scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
                    } else if (event.pageY - this.overflowOffset.top < o.scrollSensitivity) {
                        this.scrollParent[0].scrollTop =
                            scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
                    }

                    if ((this.overflowOffset.left + this.scrollParent[0].offsetWidth) -
                        event.pageX < o.scrollSensitivity) {
                        this.scrollParent[0].scrollLeft = scrolled =
                            this.scrollParent[0].scrollLeft + o.scrollSpeed;
                    } else if (event.pageX - this.overflowOffset.left < o.scrollSensitivity) {
                        this.scrollParent[0].scrollLeft = scrolled =
                            this.scrollParent[0].scrollLeft - o.scrollSpeed;
                    }

                } else {

                    if (event.pageY - this.document.scrollTop() < o.scrollSensitivity) {
                        scrolled = this.document.scrollTop(this.document.scrollTop() - o.scrollSpeed);
                    } else if (this.window.height() - (event.pageY - this.document.scrollTop()) <
                        o.scrollSensitivity) {
                        scrolled = this.document.scrollTop(this.document.scrollTop() + o.scrollSpeed);
                    }

                    if (event.pageX - this.document.scrollLeft() < o.scrollSensitivity) {
                        scrolled = this.document.scrollLeft(
                            this.document.scrollLeft() - o.scrollSpeed
                        );
                    } else if (this.window.width() - (event.pageX - this.document.scrollLeft()) <
                        o.scrollSensitivity) {
                        scrolled = this.document.scrollLeft(
                            this.document.scrollLeft() + o.scrollSpeed
                        );
                    }

                }

                if (scrolled !== false && $.ui.ddmanager && !o.dropBehaviour) {
                    $.ui.ddmanager.prepareOffsets(this, event);
                }
            }

            //Regenerate the absolute position used for position checks
            this.positionAbs = this._convertPositionTo("absolute");

            //Set the helper position
            if (!this.options.axis || this.options.axis !== "y") {
                this.helper[0].style.left = this.position.left + "px";
            }
            if (!this.options.axis || this.options.axis !== "x") {
                this.helper[0].style.top = this.position.top + "px";
            }

            //Rearrange
            for (i = this.items.length - 1; i >= 0; i--) {

                //Cache variables and intersection, continue if no intersection
                item = this.items[i];
                itemElement = item.item[0];
                intersection = this._intersectsWithPointer(item);
                if (!intersection) {
                    continue;
                }

                // Only put the placeholder inside the current Container, skip all
                // items from other containers. This works because when moving
                // an item from one container to another the
                // currentContainer is switched before the placeholder is moved.
                //
                // Without this, moving items in "sub-sortables" can cause
                // the placeholder to jitter between the outer and inner container.
                if (item.instance !== this.currentContainer) {
                    continue;
                }

                // Cannot intersect with itself
                // no useless actions that have been done before
                // no action if the item moved is the parent of the item checked
                if (itemElement !== this.currentItem[0] &&
                    this.placeholder[intersection === 1 ? "next" : "prev"]()[0] !== itemElement &&
                    !$.contains(this.placeholder[0], itemElement) &&
                    (this.options.type === "semi-dynamic" ?
                        !$.contains(this.element[0], itemElement) :
                        true
                    )
                ) {

                    this.direction = intersection === 1 ? "down" : "up";

                    if (this.options.tolerance === "pointer" || this._intersectsWithSides(item)) {
                        this._rearrange(event, item);
                    } else {
                        break;
                    }

                    this._trigger("change", event, this._uiHash());
                    break;
                }
            }

            //Post events to containers
            this._contactContainers(event);

            //Interconnect with droppables
            if ($.ui.ddmanager) {
                $.ui.ddmanager.drag(this, event);
            }

            //Call callbacks
            this._trigger("sort", event, this._uiHash());

            this.lastPositionAbs = this.positionAbs;
            return false;

        },

        _mouseStop: function (event, noPropagation) {

            if (!event) {
                return;
            }

            //If we are using droppables, inform the manager about the drop
            if ($.ui.ddmanager && !this.options.dropBehaviour) {
                $.ui.ddmanager.drop(this, event);
            }

            if (this.options.revert) {
                var that = this,
                    cur = this.placeholder.offset(),
                    axis = this.options.axis,
                    animation = {};

                if (!axis || axis === "x") {
                    animation.left = cur.left - this.offset.parent.left - this.margins.left +
                        (this.offsetParent[0] === this.document[0].body ?
                            0 :
                            this.offsetParent[0].scrollLeft
                        );
                }
                if (!axis || axis === "y") {
                    animation.top = cur.top - this.offset.parent.top - this.margins.top +
                        (this.offsetParent[0] === this.document[0].body ?
                            0 :
                            this.offsetParent[0].scrollTop
                        );
                }
                this.reverting = true;
                $(this.helper).animate(
                    animation,
                    parseInt(this.options.revert, 10) || 500,
                    function () {
                        that._clear(event);
                    }
                );
            } else {
                this._clear(event, noPropagation);
            }

            return false;

        },

        cancel: function () {

            if (this.dragging) {

                this._mouseUp(new $.Event("mouseup", { target: null }));

                if (this.options.helper === "original") {
                    this.currentItem.css(this._storedCSS);
                    this._removeClass(this.currentItem, "ui-sortable-helper");
                } else {
                    this.currentItem.show();
                }

                //Post deactivating events to containers
                for (var i = this.containers.length - 1; i >= 0; i--) {
                    this.containers[i]._trigger("deactivate", null, this._uiHash(this));
                    if (this.containers[i].containerCache.over) {
                        this.containers[i]._trigger("out", null, this._uiHash(this));
                        this.containers[i].containerCache.over = 0;
                    }
                }

            }

            if (this.placeholder) {

                //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
                // it unbinds ALL events from the original node!
                if (this.placeholder[0].parentNode) {
                    this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
                }
                if (this.options.helper !== "original" && this.helper &&
                    this.helper[0].parentNode) {
                    this.helper.remove();
                }

                $.extend(this, {
                    helper: null,
                    dragging: false,
                    reverting: false,
                    _noFinalSort: null
                });

                if (this.domPosition.prev) {
                    $(this.domPosition.prev).after(this.currentItem);
                } else {
                    $(this.domPosition.parent).prepend(this.currentItem);
                }
            }

            return this;

        },

        serialize: function (o) {

            var items = this._getItemsAsjQuery(o && o.connected),
                str = [];
            o = o || {};

            $(items).each(function () {
                var res = ($(o.item || this).attr(o.attribute || "id") || "")
                    .match(o.expression || (/(.+)[\-=_](.+)/));
                if (res) {
                    str.push(
                        (o.key || res[1] + "[]") +
                        "=" + (o.key && o.expression ? res[1] : res[2]));
                }
            });

            if (!str.length && o.key) {
                str.push(o.key + "=");
            }

            return str.join("&");

        },

        toArray: function (o) {

            var items = this._getItemsAsjQuery(o && o.connected),
                ret = [];

            o = o || {};

            items.each(function () {
                ret.push($(o.item || this).attr(o.attribute || "id") || "");
            });
            return ret;

        },

        /* Be careful with the following core functions */
        _intersectsWith: function (item) {

            var x1 = this.positionAbs.left,
                x2 = x1 + this.helperProportions.width,
                y1 = this.positionAbs.top,
                y2 = y1 + this.helperProportions.height,
                l = item.left,
                r = l + item.width,
                t = item.top,
                b = t + item.height,
                dyClick = this.offset.click.top,
                dxClick = this.offset.click.left,
                isOverElementHeight = (this.options.axis === "x") || ((y1 + dyClick) > t &&
                    (y1 + dyClick) < b),
                isOverElementWidth = (this.options.axis === "y") || ((x1 + dxClick) > l &&
                    (x1 + dxClick) < r),
                isOverElement = isOverElementHeight && isOverElementWidth;

            if (this.options.tolerance === "pointer" ||
                this.options.forcePointerForContainers ||
                (this.options.tolerance !== "pointer" &&
                    this.helperProportions[this.floating ? "width" : "height"] >
                    item[this.floating ? "width" : "height"])
            ) {
                return isOverElement;
            } else {

                return (l < x1 + (this.helperProportions.width / 2) && // Right Half
                    x2 - (this.helperProportions.width / 2) < r && // Left Half
                    t < y1 + (this.helperProportions.height / 2) && // Bottom Half
                    y2 - (this.helperProportions.height / 2) < b); // Top Half

            }
        },

        _intersectsWithPointer: function (item) {
            var verticalDirection, horizontalDirection,
                isOverElementHeight = (this.options.axis === "x") ||
                    this._isOverAxis(
                        this.positionAbs.top + this.offset.click.top, item.top, item.height),
                isOverElementWidth = (this.options.axis === "y") ||
                    this._isOverAxis(
                        this.positionAbs.left + this.offset.click.left, item.left, item.width),
                isOverElement = isOverElementHeight && isOverElementWidth;

            if (!isOverElement) {
                return false;
            }

            verticalDirection = this._getDragVerticalDirection();
            horizontalDirection = this._getDragHorizontalDirection();

            return this.floating ?
                ((horizontalDirection === "right" || verticalDirection === "down") ? 2 : 1)
                : (verticalDirection && (verticalDirection === "down" ? 2 : 1));

        },

        _intersectsWithSides: function (item) {

            var isOverBottomHalf = this._isOverAxis(this.positionAbs.top +
                this.offset.click.top, item.top + (item.height / 2), item.height),
                isOverRightHalf = this._isOverAxis(this.positionAbs.left +
                    this.offset.click.left, item.left + (item.width / 2), item.width),
                verticalDirection = this._getDragVerticalDirection(),
                horizontalDirection = this._getDragHorizontalDirection();

            if (this.floating && horizontalDirection) {
                return ((horizontalDirection === "right" && isOverRightHalf) ||
                    (horizontalDirection === "left" && !isOverRightHalf));
            } else {
                return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) ||
                    (verticalDirection === "up" && !isOverBottomHalf));
            }

        },

        _getDragVerticalDirection: function () {
            var delta = this.positionAbs.top - this.lastPositionAbs.top;
            return delta !== 0 && (delta > 0 ? "down" : "up");
        },

        _getDragHorizontalDirection: function () {
            var delta = this.positionAbs.left - this.lastPositionAbs.left;
            return delta !== 0 && (delta > 0 ? "right" : "left");
        },

        refresh: function (event) {
            this._refreshItems(event);
            this._setHandleClassName();
            this.refreshPositions();
            return this;
        },

        _connectWith: function () {
            var options = this.options;
            return options.connectWith.constructor === String ?
                [options.connectWith] :
                options.connectWith;
        },

        _getItemsAsjQuery: function (connected) {

            var i, j, cur, inst,
                items = [],
                queries = [],
                connectWith = this._connectWith();

            if (connectWith && connected) {
                for (i = connectWith.length - 1; i >= 0; i--) {
                    cur = $(connectWith[i], this.document[0]);
                    for (j = cur.length - 1; j >= 0; j--) {
                        inst = $.data(cur[j], this.widgetFullName);
                        if (inst && inst !== this && !inst.options.disabled) {
                            queries.push([$.isFunction(inst.options.items) ?
                                inst.options.items.call(inst.element) :
                                $(inst.options.items, inst.element)
                                    .not(".ui-sortable-helper")
                                    .not(".ui-sortable-placeholder"), inst]);
                        }
                    }
                }
            }

            queries.push([$.isFunction(this.options.items) ?
                this.options.items
                    .call(this.element, null, { options: this.options, item: this.currentItem }) :
                $(this.options.items, this.element)
                    .not(".ui-sortable-helper")
                    .not(".ui-sortable-placeholder"), this]);

            function addItems() {
                items.push(this);
            }
            for (i = queries.length - 1; i >= 0; i--) {
                queries[i][0].each(addItems);
            }

            return $(items);

        },

        _removeCurrentsFromItems: function () {

            var list = this.currentItem.find(":data(" + this.widgetName + "-item)");

            this.items = $.grep(this.items, function (item) {
                for (var j = 0; j < list.length; j++) {
                    if (list[j] === item.item[0]) {
                        return false;
                    }
                }
                return true;
            });

        },

        _refreshItems: function (event) {

            this.items = [];
            this.containers = [this];

            var i, j, cur, inst, targetData, _queries, item, queriesLength,
                items = this.items,
                queries = [[$.isFunction(this.options.items) ?
                    this.options.items.call(this.element[0], event, { item: this.currentItem }) :
                    $(this.options.items, this.element), this]],
                connectWith = this._connectWith();

            //Shouldn't be run the first time through due to massive slow-down
            if (connectWith && this.ready) {
                for (i = connectWith.length - 1; i >= 0; i--) {
                    cur = $(connectWith[i], this.document[0]);
                    for (j = cur.length - 1; j >= 0; j--) {
                        inst = $.data(cur[j], this.widgetFullName);
                        if (inst && inst !== this && !inst.options.disabled) {
                            queries.push([$.isFunction(inst.options.items) ?
                                inst.options.items
                                    .call(inst.element[0], event, { item: this.currentItem }) :
                                $(inst.options.items, inst.element), inst]);
                            this.containers.push(inst);
                        }
                    }
                }
            }

            for (i = queries.length - 1; i >= 0; i--) {
                targetData = queries[i][1];
                _queries = queries[i][0];

                for (j = 0, queriesLength = _queries.length; j < queriesLength; j++) {
                    item = $(_queries[j]);

                    // Data for target checking (mouse manager)
                    item.data(this.widgetName + "-item", targetData);

                    items.push({
                        item: item,
                        instance: targetData,
                        width: 0, height: 0,
                        left: 0, top: 0
                    });
                }
            }

        },

        refreshPositions: function (fast) {

            // Determine whether items are being displayed horizontally
            this.floating = this.items.length ?
                this.options.axis === "x" || this._isFloating(this.items[0].item) :
                false;

            //This has to be redone because due to the item being moved out/into the offsetParent,
            // the offsetParent's position will change
            if (this.offsetParent && this.helper) {
                this.offset.parent = this._getParentOffset();
            }

            var i, item, t, p;

            for (i = this.items.length - 1; i >= 0; i--) {
                item = this.items[i];

                //We ignore calculating positions of all connected containers when we're not over them
                if (item.instance !== this.currentContainer && this.currentContainer &&
                    item.item[0] !== this.currentItem[0]) {
                    continue;
                }

                t = this.options.toleranceElement ?
                    $(this.options.toleranceElement, item.item) :
                    item.item;

                if (!fast) {
                    item.width = t.outerWidth();
                    item.height = t.outerHeight();
                }

                p = t.offset();
                item.left = p.left;
                item.top = p.top;
            }

            if (this.options.custom && this.options.custom.refreshContainers) {
                this.options.custom.refreshContainers.call(this);
            } else {
                for (i = this.containers.length - 1; i >= 0; i--) {
                    p = this.containers[i].element.offset();
                    this.containers[i].containerCache.left = p.left;
                    this.containers[i].containerCache.top = p.top;
                    this.containers[i].containerCache.width =
                        this.containers[i].element.outerWidth();
                    this.containers[i].containerCache.height =
                        this.containers[i].element.outerHeight();
                }
            }

            return this;
        },

        _createPlaceholder: function (that) {
            that = that || this;
            var className,
                o = that.options;

            if (!o.placeholder || o.placeholder.constructor === String) {
                className = o.placeholder;
                o.placeholder = {
                    element: function () {

                        var nodeName = that.currentItem[0].nodeName.toLowerCase(),
                            element = $("<" + nodeName + ">", that.document[0]);

                        that._addClass(element, "ui-sortable-placeholder",
                            className || that.currentItem[0].className)
                            ._removeClass(element, "ui-sortable-helper");

                        if (nodeName === "tbody") {
                            that._createTrPlaceholder(
                                that.currentItem.find("tr").eq(0),
                                $("<tr>", that.document[0]).appendTo(element)
                            );
                        } else if (nodeName === "tr") {
                            that._createTrPlaceholder(that.currentItem, element);
                        } else if (nodeName === "img") {
                            element.attr("src", that.currentItem.attr("src"));
                        }

                        if (!className) {
                            element.css("visibility", "hidden");
                        }

                        return element;
                    },
                    update: function (container, p) {

                        // 1. If a className is set as 'placeholder option, we don't force sizes -
                        // the class is responsible for that
                        // 2. The option 'forcePlaceholderSize can be enabled to force it even if a
                        // class name is specified
                        if (className && !o.forcePlaceholderSize) {
                            return;
                        }

                        //If the element doesn't have a actual height by itself (without styles coming
                        // from a stylesheet), it receives the inline height from the dragged item
                        if (!p.height()) {
                            p.height(
                                that.currentItem.innerHeight() -
                                parseInt(that.currentItem.css("paddingTop") || 0, 10) -
                                parseInt(that.currentItem.css("paddingBottom") || 0, 10));
                        }
                        if (!p.width()) {
                            p.width(
                                that.currentItem.innerWidth() -
                                parseInt(that.currentItem.css("paddingLeft") || 0, 10) -
                                parseInt(that.currentItem.css("paddingRight") || 0, 10));
                        }
                    }
                };
            }

            //Create the placeholder
            that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));

            //Append it after the actual current item
            that.currentItem.after(that.placeholder);

            //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
            o.placeholder.update(that, that.placeholder);

        },

        _createTrPlaceholder: function (sourceTr, targetTr) {
            var that = this;

            sourceTr.children().each(function () {
                $("<td>&#160;</td>", that.document[0])
                    .attr("colspan", $(this).attr("colspan") || 1)
                    .appendTo(targetTr);
            });
        },

        _contactContainers: function (event) {
            var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom,
                floating, axis,
                innermostContainer = null,
                innermostIndex = null;

            // Get innermost container that intersects with item
            for (i = this.containers.length - 1; i >= 0; i--) {

                // Never consider a container that's located within the item itself
                if ($.contains(this.currentItem[0], this.containers[i].element[0])) {
                    continue;
                }

                if (this._intersectsWith(this.containers[i].containerCache)) {

                    // If we've already found a container and it's more "inner" than this, then continue
                    if (innermostContainer &&
                        $.contains(
                            this.containers[i].element[0],
                            innermostContainer.element[0])) {
                        continue;
                    }

                    innermostContainer = this.containers[i];
                    innermostIndex = i;

                } else {

                    // container doesn't intersect. trigger "out" event if necessary
                    if (this.containers[i].containerCache.over) {
                        this.containers[i]._trigger("out", event, this._uiHash(this));
                        this.containers[i].containerCache.over = 0;
                    }
                }

            }

            // If no intersecting containers found, return
            if (!innermostContainer) {
                return;
            }

            // Move the item into the container if it's not there already
            if (this.containers.length === 1) {
                if (!this.containers[innermostIndex].containerCache.over) {
                    this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
                    this.containers[innermostIndex].containerCache.over = 1;
                }
            } else {

                // When entering a new container, we will find the item with the least distance and
                // append our item near it
                dist = 10000;
                itemWithLeastDistance = null;
                floating = innermostContainer.floating || this._isFloating(this.currentItem);
                posProperty = floating ? "left" : "top";
                sizeProperty = floating ? "width" : "height";
                axis = floating ? "pageX" : "pageY";

                for (j = this.items.length - 1; j >= 0; j--) {
                    if (!$.contains(
                        this.containers[innermostIndex].element[0], this.items[j].item[0])
                    ) {
                        continue;
                    }
                    if (this.items[j].item[0] === this.currentItem[0]) {
                        continue;
                    }

                    cur = this.items[j].item.offset()[posProperty];
                    nearBottom = false;
                    if (event[axis] - cur > this.items[j][sizeProperty] / 2) {
                        nearBottom = true;
                    }

                    if (Math.abs(event[axis] - cur) < dist) {
                        dist = Math.abs(event[axis] - cur);
                        itemWithLeastDistance = this.items[j];
                        this.direction = nearBottom ? "up" : "down";
                    }
                }

                //Check if dropOnEmpty is enabled
                if (!itemWithLeastDistance && !this.options.dropOnEmpty) {
                    return;
                }

                if (this.currentContainer === this.containers[innermostIndex]) {
                    if (!this.currentContainer.containerCache.over) {
                        this.containers[innermostIndex]._trigger("over", event, this._uiHash());
                        this.currentContainer.containerCache.over = 1;
                    }
                    return;
                }

                itemWithLeastDistance ?
                    this._rearrange(event, itemWithLeastDistance, null, true) :
                    this._rearrange(event, null, this.containers[innermostIndex].element, true);
                this._trigger("change", event, this._uiHash());
                this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
                this.currentContainer = this.containers[innermostIndex];

                //Update the placeholder
                this.options.placeholder.update(this.currentContainer, this.placeholder);

                this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
                this.containers[innermostIndex].containerCache.over = 1;
            }

        },

        _createHelper: function (event) {

            var o = this.options,
                helper = $.isFunction(o.helper) ?
                    $(o.helper.apply(this.element[0], [event, this.currentItem])) :
                    (o.helper === "clone" ? this.currentItem.clone() : this.currentItem);

            //Add the helper to the DOM if that didn't happen already
            if (!helper.parents("body").length) {
                $(o.appendTo !== "parent" ?
                    o.appendTo :
                    this.currentItem[0].parentNode)[0].appendChild(helper[0]);
            }

            if (helper[0] === this.currentItem[0]) {
                this._storedCSS = {
                    width: this.currentItem[0].style.width,
                    height: this.currentItem[0].style.height,
                    position: this.currentItem.css("position"),
                    top: this.currentItem.css("top"),
                    left: this.currentItem.css("left")
                };
            }

            if (!helper[0].style.width || o.forceHelperSize) {
                helper.width(this.currentItem.width());
            }
            if (!helper[0].style.height || o.forceHelperSize) {
                helper.height(this.currentItem.height());
            }

            return helper;

        },

        _adjustOffsetFromHelper: function (obj) {
            if (typeof obj === "string") {
                obj = obj.split(" ");
            }
            if ($.isArray(obj)) {
                obj = { left: +obj[0], top: +obj[1] || 0 };
            }
            if ("left" in obj) {
                this.offset.click.left = obj.left + this.margins.left;
            }
            if ("right" in obj) {
                this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
            }
            if ("top" in obj) {
                this.offset.click.top = obj.top + this.margins.top;
            }
            if ("bottom" in obj) {
                this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
            }
        },

        _getParentOffset: function () {

            //Get the offsetParent and cache its position
            this.offsetParent = this.helper.offsetParent();
            var po = this.offsetParent.offset();

            // This is a special case where we need to modify a offset calculated on start, since the
            // following happened:
            // 1. The position of the helper is absolute, so it's position is calculated based on the
            // next positioned parent
            // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't
            // the document, which means that the scroll is included in the initial calculation of the
            // offset of the parent, and never recalculated upon drag
            if (this.cssPosition === "absolute" && this.scrollParent[0] !== this.document[0] &&
                $.contains(this.scrollParent[0], this.offsetParent[0])) {
                po.left += this.scrollParent.scrollLeft();
                po.top += this.scrollParent.scrollTop();
            }

            // This needs to be actually done for all browsers, since pageX/pageY includes this
            // information with an ugly IE fix
            if (this.offsetParent[0] === this.document[0].body ||
                (this.offsetParent[0].tagName &&
                    this.offsetParent[0].tagName.toLowerCase() === "html" && $.ui.ie)) {
                po = { top: 0, left: 0 };
            }

            return {
                top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0),
                left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0)
            };

        },

        _getRelativeOffset: function () {

            if (this.cssPosition === "relative") {
                var p = this.currentItem.position();
                return {
                    top: p.top - (parseInt(this.helper.css("top"), 10) || 0) +
                        this.scrollParent.scrollTop(),
                    left: p.left - (parseInt(this.helper.css("left"), 10) || 0) +
                        this.scrollParent.scrollLeft()
                };
            } else {
                return { top: 0, left: 0 };
            }

        },

        _cacheMargins: function () {
            this.margins = {
                left: (parseInt(this.currentItem.css("marginLeft"), 10) || 0),
                top: (parseInt(this.currentItem.css("marginTop"), 10) || 0)
            };
        },

        _cacheHelperProportions: function () {
            this.helperProportions = {
                width: this.helper.outerWidth(),
                height: this.helper.outerHeight()
            };
        },

        _setContainment: function () {

            var ce, co, over,
                o = this.options;
            if (o.containment === "parent") {
                o.containment = this.helper[0].parentNode;
            }
            if (o.containment === "document" || o.containment === "window") {
                this.containment = [
                    0 - this.offset.relative.left - this.offset.parent.left,
                    0 - this.offset.relative.top - this.offset.parent.top,
                    o.containment === "document" ?
                        this.document.width() :
                        this.window.width() - this.helperProportions.width - this.margins.left,
                    (o.containment === "document" ?
                        (this.document.height() || document.body.parentNode.scrollHeight) :
                        this.window.height() || this.document[0].body.parentNode.scrollHeight
                    ) - this.helperProportions.height - this.margins.top
                ];
            }

            if (!(/^(document|window|parent)$/).test(o.containment)) {
                ce = $(o.containment)[0];
                co = $(o.containment).offset();
                over = ($(ce).css("overflow") !== "hidden");

                this.containment = [
                    co.left + (parseInt($(ce).css("borderLeftWidth"), 10) || 0) +
                    (parseInt($(ce).css("paddingLeft"), 10) || 0) - this.margins.left,
                    co.top + (parseInt($(ce).css("borderTopWidth"), 10) || 0) +
                    (parseInt($(ce).css("paddingTop"), 10) || 0) - this.margins.top,
                    co.left + (over ? Math.max(ce.scrollWidth, ce.offsetWidth) : ce.offsetWidth) -
                    (parseInt($(ce).css("borderLeftWidth"), 10) || 0) -
                    (parseInt($(ce).css("paddingRight"), 10) || 0) -
                    this.helperProportions.width - this.margins.left,
                    co.top + (over ? Math.max(ce.scrollHeight, ce.offsetHeight) : ce.offsetHeight) -
                    (parseInt($(ce).css("borderTopWidth"), 10) || 0) -
                    (parseInt($(ce).css("paddingBottom"), 10) || 0) -
                    this.helperProportions.height - this.margins.top
                ];
            }

        },

        _convertPositionTo: function (d, pos) {

            if (!pos) {
                pos = this.position;
            }
            var mod = d === "absolute" ? 1 : -1,
                scroll = this.cssPosition === "absolute" &&
                    !(this.scrollParent[0] !== this.document[0] &&
                        $.contains(this.scrollParent[0], this.offsetParent[0])) ?
                    this.offsetParent :
                    this.scrollParent,
                scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);

            return {
                top: (

                    // The absolute mouse position
                    pos.top +

                    // Only for relative positioned nodes: Relative offset from element to offset parent
                    this.offset.relative.top * mod +

                    // The offsetParent's offset without borders (offset + border)
                    this.offset.parent.top * mod -
                    ((this.cssPosition === "fixed" ?
                        -this.scrollParent.scrollTop() :
                        (scrollIsRootNode ? 0 : scroll.scrollTop())) * mod)
                ),
                left: (

                    // The absolute mouse position
                    pos.left +

                    // Only for relative positioned nodes: Relative offset from element to offset parent
                    this.offset.relative.left * mod +

                    // The offsetParent's offset without borders (offset + border)
                    this.offset.parent.left * mod -
                    ((this.cssPosition === "fixed" ?
                        -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
                            scroll.scrollLeft()) * mod)
                )
            };

        },

        _generatePosition: function (event) {

            var top, left,
                o = this.options,
                pageX = event.pageX,
                pageY = event.pageY,
                scroll = this.cssPosition === "absolute" &&
                    !(this.scrollParent[0] !== this.document[0] &&
                        $.contains(this.scrollParent[0], this.offsetParent[0])) ?
                    this.offsetParent :
                    this.scrollParent,
                scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);

            // This is another very weird special case that only happens for relative elements:
            // 1. If the css position is relative
            // 2. and the scroll parent is the document or similar to the offset parent
            // we have to refresh the relative offset during the scroll so there are no jumps
            if (this.cssPosition === "relative" && !(this.scrollParent[0] !== this.document[0] &&
                this.scrollParent[0] !== this.offsetParent[0])) {
                this.offset.relative = this._getRelativeOffset();
            }

            /*
             * - Position constraining -
             * Constrain the position to a mix of grid, containment.
             */

            if (this.originalPosition) { //If we are not dragging yet, we won't check for options

                if (this.containment) {
                    if (event.pageX - this.offset.click.left < this.containment[0]) {
                        pageX = this.containment[0] + this.offset.click.left;
                    }
                    if (event.pageY - this.offset.click.top < this.containment[1]) {
                        pageY = this.containment[1] + this.offset.click.top;
                    }
                    if (event.pageX - this.offset.click.left > this.containment[2]) {
                        pageX = this.containment[2] + this.offset.click.left;
                    }
                    if (event.pageY - this.offset.click.top > this.containment[3]) {
                        pageY = this.containment[3] + this.offset.click.top;
                    }
                }

                if (o.grid) {
                    top = this.originalPageY + Math.round((pageY - this.originalPageY) /
                        o.grid[1]) * o.grid[1];
                    pageY = this.containment ?
                        ((top - this.offset.click.top >= this.containment[1] &&
                            top - this.offset.click.top <= this.containment[3]) ?
                            top :
                            ((top - this.offset.click.top >= this.containment[1]) ?
                                top - o.grid[1] : top + o.grid[1])) :
                        top;

                    left = this.originalPageX + Math.round((pageX - this.originalPageX) /
                        o.grid[0]) * o.grid[0];
                    pageX = this.containment ?
                        ((left - this.offset.click.left >= this.containment[0] &&
                            left - this.offset.click.left <= this.containment[2]) ?
                            left :
                            ((left - this.offset.click.left >= this.containment[0]) ?
                                left - o.grid[0] : left + o.grid[0])) :
                        left;
                }

            }

            return {
                top: (

                    // The absolute mouse position
                    pageY -

                    // Click offset (relative to the element)
                    this.offset.click.top -

                    // Only for relative positioned nodes: Relative offset from element to offset parent
                    this.offset.relative.top -

                    // The offsetParent's offset without borders (offset + border)
                    this.offset.parent.top +
                    ((this.cssPosition === "fixed" ?
                        -this.scrollParent.scrollTop() :
                        (scrollIsRootNode ? 0 : scroll.scrollTop())))
                ),
                left: (

                    // The absolute mouse position
                    pageX -

                    // Click offset (relative to the element)
                    this.offset.click.left -

                    // Only for relative positioned nodes: Relative offset from element to offset parent
                    this.offset.relative.left -

                    // The offsetParent's offset without borders (offset + border)
                    this.offset.parent.left +
                    ((this.cssPosition === "fixed" ?
                        -this.scrollParent.scrollLeft() :
                        scrollIsRootNode ? 0 : scroll.scrollLeft()))
                )
            };

        },

        _rearrange: function (event, i, a, hardRefresh) {

            a ? a[0].appendChild(this.placeholder[0]) :
                i.item[0].parentNode.insertBefore(this.placeholder[0],
                    (this.direction === "down" ? i.item[0] : i.item[0].nextSibling));

            //Various things done here to improve the performance:
            // 1. we create a setTimeout, that calls refreshPositions
            // 2. on the instance, we have a counter variable, that get's higher after every append
            // 3. on the local scope, we copy the counter variable, and check in the timeout,
            // if it's still the same
            // 4. this lets only the last addition to the timeout stack through
            this.counter = this.counter ? ++this.counter : 1;
            var counter = this.counter;

            this._delay(function () {
                if (counter === this.counter) {

                    //Precompute after each DOM insertion, NOT on mousemove
                    this.refreshPositions(!hardRefresh);
                }
            });

        },

        _clear: function (event, noPropagation) {

            this.reverting = false;

            // We delay all events that have to be triggered to after the point where the placeholder
            // has been removed and everything else normalized again
            var i,
                delayedTriggers = [];

            // We first have to update the dom position of the actual currentItem
            // Note: don't do it if the current item is already removed (by a user), or it gets
            // reappended (see #4088)
            if (!this._noFinalSort && this.currentItem.parent().length) {
                this.placeholder.before(this.currentItem);
            }
            this._noFinalSort = null;

            if (this.helper[0] === this.currentItem[0]) {
                for (i in this._storedCSS) {
                    if (this._storedCSS[i] === "auto" || this._storedCSS[i] === "static") {
                        this._storedCSS[i] = "";
                    }
                }
                this.currentItem.css(this._storedCSS);
                this._removeClass(this.currentItem, "ui-sortable-helper");
            } else {
                this.currentItem.show();
            }

            if (this.fromOutside && !noPropagation) {
                delayedTriggers.push(function (event) {
                    this._trigger("receive", event, this._uiHash(this.fromOutside));
                });
            }
            if ((this.fromOutside ||
                this.domPosition.prev !==
                this.currentItem.prev().not(".ui-sortable-helper")[0] ||
                this.domPosition.parent !== this.currentItem.parent()[0]) && !noPropagation) {

                // Trigger update callback if the DOM position has changed
                delayedTriggers.push(function (event) {
                    this._trigger("update", event, this._uiHash());
                });
            }

            // Check if the items Container has Changed and trigger appropriate
            // events.
            if (this !== this.currentContainer) {
                if (!noPropagation) {
                    delayedTriggers.push(function (event) {
                        this._trigger("remove", event, this._uiHash());
                    });
                    delayedTriggers.push((function (c) {
                        return function (event) {
                            c._trigger("receive", event, this._uiHash(this));
                        };
                    }).call(this, this.currentContainer));
                    delayedTriggers.push((function (c) {
                        return function (event) {
                            c._trigger("update", event, this._uiHash(this));
                        };
                    }).call(this, this.currentContainer));
                }
            }

            //Post events to containers
            function delayEvent(type, instance, container) {
                return function (event) {
                    container._trigger(type, event, instance._uiHash(instance));
                };
            }
            for (i = this.containers.length - 1; i >= 0; i--) {
                if (!noPropagation) {
                    delayedTriggers.push(delayEvent("deactivate", this, this.containers[i]));
                }
                if (this.containers[i].containerCache.over) {
                    delayedTriggers.push(delayEvent("out", this, this.containers[i]));
                    this.containers[i].containerCache.over = 0;
                }
            }

            //Do what was originally in plugins
            if (this.storedCursor) {
                this.document.find("body").css("cursor", this.storedCursor);
                this.storedStylesheet.remove();
            }
            if (this._storedOpacity) {
                this.helper.css("opacity", this._storedOpacity);
            }
            if (this._storedZIndex) {
                this.helper.css("zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex);
            }

            this.dragging = false;

            if (!noPropagation) {
                this._trigger("beforeStop", event, this._uiHash());
            }

            //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately,
            // it unbinds ALL events from the original node!
            this.placeholder[0].parentNode.removeChild(this.placeholder[0]);

            if (!this.cancelHelperRemoval) {
                if (this.helper[0] !== this.currentItem[0]) {
                    this.helper.remove();
                }
                this.helper = null;
            }

            if (!noPropagation) {
                for (i = 0; i < delayedTriggers.length; i++) {

                    // Trigger all delayed events
                    delayedTriggers[i].call(this, event);
                }
                this._trigger("stop", event, this._uiHash());
            }

            this.fromOutside = false;
            return !this.cancelHelperRemoval;

        },

        _trigger: function () {
            if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
                this.cancel();
            }
        },

        _uiHash: function (_inst) {
            var inst = _inst || this;
            return {
                helper: inst.helper,
                placeholder: inst.placeholder || $([]),
                position: inst.position,
                originalPosition: inst.originalPosition,
                offset: inst.positionAbs,
                item: inst.currentItem,
                sender: _inst ? _inst.element : null
            };
        }

    });


    /*!
     * jQuery UI Accordion 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Accordion
    //>>group: Widgets
    // jscs:disable maximumLineLength
    //>>description: Displays collapsible content panels for presenting information in a limited amount of space.
    // jscs:enable maximumLineLength
    //>>docs: http://api.jqueryui.com/accordion/
    //>>demos: http://jqueryui.com/accordion/
    //>>css.structure: ../../themes/base/core.css
    //>>css.structure: ../../themes/base/accordion.css
    //>>css.theme: ../../themes/base/theme.css



    var widgetsAccordion = $.widget("ui.accordion", {
        version: "1.12.1",
        options: {
            active: 0,
            animate: {},
            classes: {
                "ui-accordion-header": "ui-corner-top",
                "ui-accordion-header-collapsed": "ui-corner-all",
                "ui-accordion-content": "ui-corner-bottom"
            },
            collapsible: false,
            event: "click",
            header: "> li > :first-child, > :not(li):even",
            heightStyle: "auto",
            icons: {
                activeHeader: "ui-icon-triangle-1-s",
                header: "ui-icon-triangle-1-e"
            },

            // Callbacks
            activate: null,
            beforeActivate: null
        },

        hideProps: {
            borderTopWidth: "hide",
            borderBottomWidth: "hide",
            paddingTop: "hide",
            paddingBottom: "hide",
            height: "hide"
        },

        showProps: {
            borderTopWidth: "show",
            borderBottomWidth: "show",
            paddingTop: "show",
            paddingBottom: "show",
            height: "show"
        },

        _create: function () {
            var options = this.options;

            this.prevShow = this.prevHide = $();
            this._addClass("ui-accordion", "ui-widget ui-helper-reset");
            this.element.attr("role", "tablist");

            // Don't allow collapsible: false and active: false / null
            if (!options.collapsible && (options.active === false || options.active == null)) {
                options.active = 0;
            }

            this._processPanels();

            // handle negative values
            if (options.active < 0) {
                options.active += this.headers.length;
            }
            this._refresh();
        },

        _getCreateEventData: function () {
            return {
                header: this.active,
                panel: !this.active.length ? $() : this.active.next()
            };
        },

        _createIcons: function () {
            var icon, children,
                icons = this.options.icons;

            if (icons) {
                icon = $("<span>");
                this._addClass(icon, "ui-accordion-header-icon", "ui-icon " + icons.header);
                icon.prependTo(this.headers);
                children = this.active.children(".ui-accordion-header-icon");
                this._removeClass(children, icons.header)
                    ._addClass(children, null, icons.activeHeader)
                    ._addClass(this.headers, "ui-accordion-icons");
            }
        },

        _destroyIcons: function () {
            this._removeClass(this.headers, "ui-accordion-icons");
            this.headers.children(".ui-accordion-header-icon").remove();
        },

        _destroy: function () {
            var contents;

            // Clean up main element
            this.element.removeAttr("role");

            // Clean up headers
            this.headers
                .removeAttr("role aria-expanded aria-selected aria-controls tabIndex")
                .removeUniqueId();

            this._destroyIcons();

            // Clean up content panels
            contents = this.headers.next()
                .css("display", "")
                .removeAttr("role aria-hidden aria-labelledby")
                .removeUniqueId();

            if (this.options.heightStyle !== "content") {
                contents.css("height", "");
            }
        },

        _setOption: function (key, value) {
            if (key === "active") {

                // _activate() will handle invalid values and update this.options
                this._activate(value);
                return;
            }

            if (key === "event") {
                if (this.options.event) {
                    this._off(this.headers, this.options.event);
                }
                this._setupEvents(value);
            }

            this._super(key, value);

            // Setting collapsible: false while collapsed; open first panel
            if (key === "collapsible" && !value && this.options.active === false) {
                this._activate(0);
            }

            if (key === "icons") {
                this._destroyIcons();
                if (value) {
                    this._createIcons();
                }
            }
        },

        _setOptionDisabled: function (value) {
            this._super(value);

            this.element.attr("aria-disabled", value);

            // Support: IE8 Only
            // #5332 / #6059 - opacity doesn't cascade to positioned elements in IE
            // so we need to add the disabled class to the headers and panels
            this._toggleClass(null, "ui-state-disabled", !!value);
            this._toggleClass(this.headers.add(this.headers.next()), null, "ui-state-disabled",
                !!value);
        },

        _keydown: function (event) {
            if (event.altKey || event.ctrlKey) {
                return;
            }

            var keyCode = $.ui.keyCode,
                length = this.headers.length,
                currentIndex = this.headers.index(event.target),
                toFocus = false;

            switch (event.keyCode) {
                case keyCode.RIGHT:
                case keyCode.DOWN:
                    toFocus = this.headers[(currentIndex + 1) % length];
                    break;
                case keyCode.LEFT:
                case keyCode.UP:
                    toFocus = this.headers[(currentIndex - 1 + length) % length];
                    break;
                case keyCode.SPACE:
                case keyCode.ENTER:
                    this._eventHandler(event);
                    break;
                case keyCode.HOME:
                    toFocus = this.headers[0];
                    break;
                case keyCode.END:
                    toFocus = this.headers[length - 1];
                    break;
            }

            if (toFocus) {
                $(event.target).attr("tabIndex", -1);
                $(toFocus).attr("tabIndex", 0);
                $(toFocus).trigger("focus");
                event.preventDefault();
            }
        },

        _panelKeyDown: function (event) {
            if (event.keyCode === $.ui.keyCode.UP && event.ctrlKey) {
                $(event.currentTarget).prev().trigger("focus");
            }
        },

        refresh: function () {
            var options = this.options;
            this._processPanels();

            // Was collapsed or no panel
            if ((options.active === false && options.collapsible === true) ||
                !this.headers.length) {
                options.active = false;
                this.active = $();

                // active false only when collapsible is true
            } else if (options.active === false) {
                this._activate(0);

                // was active, but active panel is gone
            } else if (this.active.length && !$.contains(this.element[0], this.active[0])) {

                // all remaining panel are disabled
                if (this.headers.length === this.headers.find(".ui-state-disabled").length) {
                    options.active = false;
                    this.active = $();

                    // activate previous panel
                } else {
                    this._activate(Math.max(0, options.active - 1));
                }

                // was active, active panel still exists
            } else {

                // make sure active index is correct
                options.active = this.headers.index(this.active);
            }

            this._destroyIcons();

            this._refresh();
        },

        _processPanels: function () {
            var prevHeaders = this.headers,
                prevPanels = this.panels;

            this.headers = this.element.find(this.options.header);
            this._addClass(this.headers, "ui-accordion-header ui-accordion-header-collapsed",
                "ui-state-default");

            this.panels = this.headers.next().filter(":not(.ui-accordion-content-active)").hide();
            this._addClass(this.panels, "ui-accordion-content", "ui-helper-reset ui-widget-content");

            // Avoid memory leaks (#10056)
            if (prevPanels) {
                this._off(prevHeaders.not(this.headers));
                this._off(prevPanels.not(this.panels));
            }
        },

        _refresh: function () {
            var maxHeight,
                options = this.options,
                heightStyle = options.heightStyle,
                parent = this.element.parent();

            this.active = this._findActive(options.active);
            this._addClass(this.active, "ui-accordion-header-active", "ui-state-active")
                ._removeClass(this.active, "ui-accordion-header-collapsed");
            this._addClass(this.active.next(), "ui-accordion-content-active");
            this.active.next().show();

            this.headers
                .attr("role", "tab")
                .each(function () {
                    var header = $(this),
                        headerId = header.uniqueId().attr("id"),
                        panel = header.next(),
                        panelId = panel.uniqueId().attr("id");
                    header.attr("aria-controls", panelId);
                    panel.attr("aria-labelledby", headerId);
                })
                .next()
                .attr("role", "tabpanel");

            this.headers
                .not(this.active)
                .attr({
                    "aria-selected": "false",
                    "aria-expanded": "false",
                    tabIndex: -1
                })
                .next()
                .attr({
                    "aria-hidden": "true"
                })
                .hide();

            // Make sure at least one header is in the tab order
            if (!this.active.length) {
                this.headers.eq(0).attr("tabIndex", 0);
            } else {
                this.active.attr({
                    "aria-selected": "true",
                    "aria-expanded": "true",
                    tabIndex: 0
                })
                    .next()
                    .attr({
                        "aria-hidden": "false"
                    });
            }

            this._createIcons();

            this._setupEvents(options.event);

            if (heightStyle === "fill") {
                maxHeight = parent.height();
                this.element.siblings(":visible").each(function () {
                    var elem = $(this),
                        position = elem.css("position");

                    if (position === "absolute" || position === "fixed") {
                        return;
                    }
                    maxHeight -= elem.outerHeight(true);
                });

                this.headers.each(function () {
                    maxHeight -= $(this).outerHeight(true);
                });

                this.headers.next()
                    .each(function () {
                        $(this).height(Math.max(0, maxHeight -
                            $(this).innerHeight() + $(this).height()));
                    })
                    .css("overflow", "auto");
            } else if (heightStyle === "auto") {
                maxHeight = 0;
                this.headers.next()
                    .each(function () {
                        var isVisible = $(this).is(":visible");
                        if (!isVisible) {
                            $(this).show();
                        }
                        maxHeight = Math.max(maxHeight, $(this).css("height", "").height());
                        if (!isVisible) {
                            $(this).hide();
                        }
                    })
                    .height(maxHeight);
            }
        },

        _activate: function (index) {
            var active = this._findActive(index)[0];

            // Trying to activate the already active panel
            if (active === this.active[0]) {
                return;
            }

            // Trying to collapse, simulate a click on the currently active header
            active = active || this.active[0];

            this._eventHandler({
                target: active,
                currentTarget: active,
                preventDefault: $.noop
            });
        },

        _findActive: function (selector) {
            return typeof selector === "number" ? this.headers.eq(selector) : $();
        },

        _setupEvents: function (event) {
            var events = {
                keydown: "_keydown"
            };
            if (event) {
                $.each(event.split(" "), function (index, eventName) {
                    events[eventName] = "_eventHandler";
                });
            }

            this._off(this.headers.add(this.headers.next()));
            this._on(this.headers, events);
            this._on(this.headers.next(), { keydown: "_panelKeyDown" });
            this._hoverable(this.headers);
            this._focusable(this.headers);
        },

        _eventHandler: function (event) {
            var activeChildren, clickedChildren,
                options = this.options,
                active = this.active,
                clicked = $(event.currentTarget),
                clickedIsActive = clicked[0] === active[0],
                collapsing = clickedIsActive && options.collapsible,
                toShow = collapsing ? $() : clicked.next(),
                toHide = active.next(),
                eventData = {
                    oldHeader: active,
                    oldPanel: toHide,
                    newHeader: collapsing ? $() : clicked,
                    newPanel: toShow
                };

            event.preventDefault();

            if (

                // click on active header, but not collapsible
                (clickedIsActive && !options.collapsible) ||

                // allow canceling activation
                (this._trigger("beforeActivate", event, eventData) === false)) {
                return;
            }

            options.active = collapsing ? false : this.headers.index(clicked);

            // When the call to ._toggle() comes after the class changes
            // it causes a very odd bug in IE 8 (see #6720)
            this.active = clickedIsActive ? $() : clicked;
            this._toggle(eventData);

            // Switch classes
            // corner classes on the previously active header stay after the animation
            this._removeClass(active, "ui-accordion-header-active", "ui-state-active");
            if (options.icons) {
                activeChildren = active.children(".ui-accordion-header-icon");
                this._removeClass(activeChildren, null, options.icons.activeHeader)
                    ._addClass(activeChildren, null, options.icons.header);
            }

            if (!clickedIsActive) {
                this._removeClass(clicked, "ui-accordion-header-collapsed")
                    ._addClass(clicked, "ui-accordion-header-active", "ui-state-active");
                if (options.icons) {
                    clickedChildren = clicked.children(".ui-accordion-header-icon");
                    this._removeClass(clickedChildren, null, options.icons.header)
                        ._addClass(clickedChildren, null, options.icons.activeHeader);
                }

                this._addClass(clicked.next(), "ui-accordion-content-active");
            }
        },

        _toggle: function (data) {
            var toShow = data.newPanel,
                toHide = this.prevShow.length ? this.prevShow : data.oldPanel;

            // Handle activating a panel during the animation for another activation
            this.prevShow.add(this.prevHide).stop(true, true);
            this.prevShow = toShow;
            this.prevHide = toHide;

            if (this.options.animate) {
                this._animate(toShow, toHide, data);
            } else {
                toHide.hide();
                toShow.show();
                this._toggleComplete(data);
            }

            toHide.attr({
                "aria-hidden": "true"
            });
            toHide.prev().attr({
                "aria-selected": "false",
                "aria-expanded": "false"
            });

            // if we're switching panels, remove the old header from the tab order
            // if we're opening from collapsed state, remove the previous header from the tab order
            // if we're collapsing, then keep the collapsing header in the tab order
            if (toShow.length && toHide.length) {
                toHide.prev().attr({
                    "tabIndex": -1,
                    "aria-expanded": "false"
                });
            } else if (toShow.length) {
                this.headers.filter(function () {
                    return parseInt($(this).attr("tabIndex"), 10) === 0;
                })
                    .attr("tabIndex", -1);
            }

            toShow
                .attr("aria-hidden", "false")
                .prev()
                .attr({
                    "aria-selected": "true",
                    "aria-expanded": "true",
                    tabIndex: 0
                });
        },

        _animate: function (toShow, toHide, data) {
            var total, easing, duration,
                that = this,
                adjust = 0,
                boxSizing = toShow.css("box-sizing"),
                down = toShow.length &&
                    (!toHide.length || (toShow.index() < toHide.index())),
                animate = this.options.animate || {},
                options = down && animate.down || animate,
                complete = function () {
                    that._toggleComplete(data);
                };

            if (typeof options === "number") {
                duration = options;
            }
            if (typeof options === "string") {
                easing = options;
            }

            // fall back from options to animation in case of partial down settings
            easing = easing || options.easing || animate.easing;
            duration = duration || options.duration || animate.duration;

            if (!toHide.length) {
                return toShow.animate(this.showProps, duration, easing, complete);
            }
            if (!toShow.length) {
                return toHide.animate(this.hideProps, duration, easing, complete);
            }

            total = toShow.show().outerHeight();
            toHide.animate(this.hideProps, {
                duration: duration,
                easing: easing,
                step: function (now, fx) {
                    fx.now = Math.round(now);
                }
            });
            toShow
                .hide()
                .animate(this.showProps, {
                    duration: duration,
                    easing: easing,
                    complete: complete,
                    step: function (now, fx) {
                        fx.now = Math.round(now);
                        if (fx.prop !== "height") {
                            if (boxSizing === "content-box") {
                                adjust += fx.now;
                            }
                        } else if (that.options.heightStyle !== "content") {
                            fx.now = Math.round(total - toHide.outerHeight() - adjust);
                            adjust = 0;
                        }
                    }
                });
        },

        _toggleComplete: function (data) {
            var toHide = data.oldPanel,
                prev = toHide.prev();

            this._removeClass(toHide, "ui-accordion-content-active");
            this._removeClass(prev, "ui-accordion-header-active")
                ._addClass(prev, "ui-accordion-header-collapsed");

            // Work around for rendering bug in IE (#5421)
            if (toHide.length) {
                toHide.parent()[0].className = toHide.parent()[0].className;
            }
            this._trigger("activate", null, data);
        }
    });


    /*!
     * jQuery UI Menu 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Menu
    //>>group: Widgets
    //>>description: Creates nestable menus.
    //>>docs: http://api.jqueryui.com/menu/
    //>>demos: http://jqueryui.com/menu/
    //>>css.structure: ../../themes/base/core.css
    //>>css.structure: ../../themes/base/menu.css
    //>>css.theme: ../../themes/base/theme.css



    var widgetsMenu = $.widget("ui.menu", {
        version: "1.12.1",
        defaultElement: "<ul>",
        delay: 300,
        options: {
            icons: {
                submenu: "ui-icon-caret-1-e"
            },
            items: "> *",
            menus: "ul",
            position: {
                my: "left top",
                at: "right top"
            },
            role: "menu",

            // Callbacks
            blur: null,
            focus: null,
            select: null
        },

        _create: function () {
            this.activeMenu = this.element;

            // Flag used to prevent firing of the click handler
            // as the event bubbles up through nested menus
            this.mouseHandled = false;
            this.element
                .uniqueId()
                .attr({
                    role: this.options.role,
                    tabIndex: 0
                });

            this._addClass("ui-menu", "ui-widget ui-widget-content");
            this._on({

                // Prevent focus from sticking to links inside menu after clicking
                // them (focus should always stay on UL during navigation).
                "mousedown .ui-menu-item": function (event) {
                    event.preventDefault();
                },
                "click .ui-menu-item": function (event) {
                    var target = $(event.target);
                    var active = $($.ui.safeActiveElement(this.document[0]));
                    if (!this.mouseHandled && target.not(".ui-state-disabled").length) {
                        this.select(event);

                        // Only set the mouseHandled flag if the event will bubble, see #9469.
                        if (!event.isPropagationStopped()) {
                            this.mouseHandled = true;
                        }

                        // Open submenu on click
                        if (target.has(".ui-menu").length) {
                            this.expand(event);
                        } else if (!this.element.is(":focus") &&
                            active.closest(".ui-menu").length) {

                            // Redirect focus to the menu
                            this.element.trigger("focus", [true]);

                            // If the active item is on the top level, let it stay active.
                            // Otherwise, blur the active item since it is no longer visible.
                            if (this.active && this.active.parents(".ui-menu").length === 1) {
                                clearTimeout(this.timer);
                            }
                        }
                    }
                },
                "mouseenter .ui-menu-item": function (event) {

                    // Ignore mouse events while typeahead is active, see #10458.
                    // Prevents focusing the wrong item when typeahead causes a scroll while the mouse
                    // is over an item in the menu
                    if (this.previousFilter) {
                        return;
                    }

                    var actualTarget = $(event.target).closest(".ui-menu-item"),
                        target = $(event.currentTarget);

                    // Ignore bubbled events on parent items, see #11641
                    if (actualTarget[0] !== target[0]) {
                        return;
                    }

                    // Remove ui-state-active class from siblings of the newly focused menu item
                    // to avoid a jump caused by adjacent elements both having a class with a border
                    this._removeClass(target.siblings().children(".ui-state-active"),
                        null, "ui-state-active");
                    this.focus(event, target);
                },
                mouseleave: "collapseAll",
                "mouseleave .ui-menu": "collapseAll",
                focus: function (event, keepActiveItem) {

                    // If there's already an active item, keep it active
                    // If not, activate the first item
                    var item = this.active || this.element.find(this.options.items).eq(0);

                    if (!keepActiveItem) {
                        this.focus(event, item);
                    }
                },
                blur: function (event) {
                    this._delay(function () {
                        var notContained = !$.contains(
                            this.element[0],
                            $.ui.safeActiveElement(this.document[0])
                        );
                        if (notContained) {
                            this.collapseAll(event);
                        }
                    });
                },
                keydown: "_keydown"
            });

            this.refresh();

            // Clicks outside of a menu collapse any open menus
            this._on(this.document, {
                click: function (event) {
                    if (this._closeOnDocumentClick(event)) {
                        this.collapseAll(event);
                    }

                    // Reset the mouseHandled flag
                    this.mouseHandled = false;
                }
            });
        },

        _destroy: function () {
            var items = this.element.find(".ui-menu-item")
                .removeAttr("role aria-disabled"),
                submenus = items.children(".ui-menu-item-wrapper")
                    .removeUniqueId()
                    .removeAttr("tabIndex role aria-haspopup");

            // Destroy (sub)menus
            this.element
                .removeAttr("aria-activedescendant")
                .find(".ui-menu").addBack()
                .removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled " +
                    "tabIndex")
                .removeUniqueId()
                .show();

            submenus.children().each(function () {
                var elem = $(this);
                if (elem.data("ui-menu-submenu-caret")) {
                    elem.remove();
                }
            });
        },

        _keydown: function (event) {
            var match, prev, character, skip,
                preventDefault = true;

            switch (event.keyCode) {
                case $.ui.keyCode.PAGE_UP:
                    this.previousPage(event);
                    break;
                case $.ui.keyCode.PAGE_DOWN:
                    this.nextPage(event);
                    break;
                case $.ui.keyCode.HOME:
                    this._move("first", "first", event);
                    break;
                case $.ui.keyCode.END:
                    this._move("last", "last", event);
                    break;
                case $.ui.keyCode.UP:
                    this.previous(event);
                    break;
                case $.ui.keyCode.DOWN:
                    this.next(event);
                    break;
                case $.ui.keyCode.LEFT:
                    this.collapse(event);
                    break;
                case $.ui.keyCode.RIGHT:
                    if (this.active && !this.active.is(".ui-state-disabled")) {
                        this.expand(event);
                    }
                    break;
                case $.ui.keyCode.ENTER:
                case $.ui.keyCode.SPACE:
                    this._activate(event);
                    break;
                case $.ui.keyCode.ESCAPE:
                    this.collapse(event);
                    break;
                default:
                    preventDefault = false;
                    prev = this.previousFilter || "";
                    skip = false;

                    // Support number pad values
                    character = event.keyCode >= 96 && event.keyCode <= 105 ?
                        (event.keyCode - 96).toString() : String.fromCharCode(event.keyCode);

                    clearTimeout(this.filterTimer);

                    if (character === prev) {
                        skip = true;
                    } else {
                        character = prev + character;
                    }

                    match = this._filterMenuItems(character);
                    match = skip && match.index(this.active.next()) !== -1 ?
                        this.active.nextAll(".ui-menu-item") :
                        match;

                    // If no matches on the current filter, reset to the last character pressed
                    // to move down the menu to the first item that starts with that character
                    if (!match.length) {
                        character = String.fromCharCode(event.keyCode);
                        match = this._filterMenuItems(character);
                    }

                    if (match.length) {
                        this.focus(event, match);
                        this.previousFilter = character;
                        this.filterTimer = this._delay(function () {
                            delete this.previousFilter;
                        }, 1000);
                    } else {
                        delete this.previousFilter;
                    }
            }

            if (preventDefault) {
                event.preventDefault();
            }
        },

        _activate: function (event) {
            if (this.active && !this.active.is(".ui-state-disabled")) {
                if (this.active.children("[aria-haspopup='true']").length) {
                    this.expand(event);
                } else {
                    this.select(event);
                }
            }
        },

        refresh: function () {
            var menus, items, newSubmenus, newItems, newWrappers,
                that = this,
                icon = this.options.icons.submenu,
                submenus = this.element.find(this.options.menus);

            this._toggleClass("ui-menu-icons", null, !!this.element.find(".ui-icon").length);

            // Initialize nested menus
            newSubmenus = submenus.filter(":not(.ui-menu)")
                .hide()
                .attr({
                    role: this.options.role,
                    "aria-hidden": "true",
                    "aria-expanded": "false"
                })
                .each(function () {
                    var menu = $(this),
                        item = menu.prev(),
                        submenuCaret = $("<span>").data("ui-menu-submenu-caret", true);

                    that._addClass(submenuCaret, "ui-menu-icon", "ui-icon " + icon);
                    item
                        .attr("aria-haspopup", "true")
                        .prepend(submenuCaret);
                    menu.attr("aria-labelledby", item.attr("id"));
                });

            this._addClass(newSubmenus, "ui-menu", "ui-widget ui-widget-content ui-front");

            menus = submenus.add(this.element);
            items = menus.find(this.options.items);

            // Initialize menu-items containing spaces and/or dashes only as dividers
            items.not(".ui-menu-item").each(function () {
                var item = $(this);
                if (that._isDivider(item)) {
                    that._addClass(item, "ui-menu-divider", "ui-widget-content");
                }
            });

            // Don't refresh list items that are already adapted
            newItems = items.not(".ui-menu-item, .ui-menu-divider");
            newWrappers = newItems.children()
                .not(".ui-menu")
                .uniqueId()
                .attr({
                    tabIndex: -1,
                    role: this._itemRole()
                });
            this._addClass(newItems, "ui-menu-item")
                ._addClass(newWrappers, "ui-menu-item-wrapper");

            // Add aria-disabled attribute to any disabled menu item
            items.filter(".ui-state-disabled").attr("aria-disabled", "true");

            // If the active item has been removed, blur the menu
            if (this.active && !$.contains(this.element[0], this.active[0])) {
                this.blur();
            }
        },

        _itemRole: function () {
            return {
                menu: "menuitem",
                listbox: "option"
            }[this.options.role];
        },

        _setOption: function (key, value) {
            if (key === "icons") {
                var icons = this.element.find(".ui-menu-icon");
                this._removeClass(icons, null, this.options.icons.submenu)
                    ._addClass(icons, null, value.submenu);
            }
            this._super(key, value);
        },

        _setOptionDisabled: function (value) {
            this._super(value);

            this.element.attr("aria-disabled", String(value));
            this._toggleClass(null, "ui-state-disabled", !!value);
        },

        focus: function (event, item) {
            var nested, focused, activeParent;
            this.blur(event, event && event.type === "focus");

            this._scrollIntoView(item);

            this.active = item.first();

            focused = this.active.children(".ui-menu-item-wrapper");
            this._addClass(focused, null, "ui-state-active");

            // Only update aria-activedescendant if there's a role
            // otherwise we assume focus is managed elsewhere
            if (this.options.role) {
                this.element.attr("aria-activedescendant", focused.attr("id"));
            }

            // Highlight active parent menu item, if any
            activeParent = this.active
                .parent()
                .closest(".ui-menu-item")
                .children(".ui-menu-item-wrapper");
            this._addClass(activeParent, null, "ui-state-active");

            if (event && event.type === "keydown") {
                this._close();
            } else {
                this.timer = this._delay(function () {
                    this._close();
                }, this.delay);
            }

            nested = item.children(".ui-menu");
            if (nested.length && event && (/^mouse/.test(event.type))) {
                this._startOpening(nested);
            }
            this.activeMenu = item.parent();

            this._trigger("focus", event, { item: item });
        },

        _scrollIntoView: function (item) {
            var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
            if (this._hasScroll()) {
                borderTop = parseFloat($.css(this.activeMenu[0], "borderTopWidth")) || 0;
                paddingTop = parseFloat($.css(this.activeMenu[0], "paddingTop")) || 0;
                offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
                scroll = this.activeMenu.scrollTop();
                elementHeight = this.activeMenu.height();
                itemHeight = item.outerHeight();

                if (offset < 0) {
                    this.activeMenu.scrollTop(scroll + offset);
                } else if (offset + itemHeight > elementHeight) {
                    this.activeMenu.scrollTop(scroll + offset - elementHeight + itemHeight);
                }
            }
        },

        blur: function (event, fromFocus) {
            if (!fromFocus) {
                clearTimeout(this.timer);
            }

            if (!this.active) {
                return;
            }

            this._removeClass(this.active.children(".ui-menu-item-wrapper"),
                null, "ui-state-active");

            this._trigger("blur", event, { item: this.active });
            this.active = null;
        },

        _startOpening: function (submenu) {
            clearTimeout(this.timer);

            // Don't open if already open fixes a Firefox bug that caused a .5 pixel
            // shift in the submenu position when mousing over the caret icon
            if (submenu.attr("aria-hidden") !== "true") {
                return;
            }

            this.timer = this._delay(function () {
                this._close();
                this._open(submenu);
            }, this.delay);
        },

        _open: function (submenu) {
            var position = $.extend({
                of: this.active
            }, this.options.position);

            clearTimeout(this.timer);
            this.element.find(".ui-menu").not(submenu.parents(".ui-menu"))
                .hide()
                .attr("aria-hidden", "true");

            submenu
                .show()
                .removeAttr("aria-hidden")
                .attr("aria-expanded", "true")
                .position(position);
        },

        collapseAll: function (event, all) {
            clearTimeout(this.timer);
            this.timer = this._delay(function () {

                // If we were passed an event, look for the submenu that contains the event
                var currentMenu = all ? this.element :
                    $(event && event.target).closest(this.element.find(".ui-menu"));

                // If we found no valid submenu ancestor, use the main menu to close all
                // sub menus anyway
                if (!currentMenu.length) {
                    currentMenu = this.element;
                }

                this._close(currentMenu);

                this.blur(event);

                // Work around active item staying active after menu is blurred
                this._removeClass(currentMenu.find(".ui-state-active"), null, "ui-state-active");

                this.activeMenu = currentMenu;
            }, this.delay);
        },

        // With no arguments, closes the currently active menu - if nothing is active
        // it closes all menus.  If passed an argument, it will search for menus BELOW
        _close: function (startMenu) {
            if (!startMenu) {
                startMenu = this.active ? this.active.parent() : this.element;
            }

            startMenu.find(".ui-menu")
                .hide()
                .attr("aria-hidden", "true")
                .attr("aria-expanded", "false");
        },

        _closeOnDocumentClick: function (event) {
            return !$(event.target).closest(".ui-menu").length;
        },

        _isDivider: function (item) {

            // Match hyphen, em dash, en dash
            return !/[^\-\u2014\u2013\s]/.test(item.text());
        },

        collapse: function (event) {
            var newItem = this.active &&
                this.active.parent().closest(".ui-menu-item", this.element);
            if (newItem && newItem.length) {
                this._close();
                this.focus(event, newItem);
            }
        },

        expand: function (event) {
            var newItem = this.active &&
                this.active
                    .children(".ui-menu ")
                    .find(this.options.items)
                    .first();

            if (newItem && newItem.length) {
                this._open(newItem.parent());

                // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
                this._delay(function () {
                    this.focus(event, newItem);
                });
            }
        },

        next: function (event) {
            this._move("next", "first", event);
        },

        previous: function (event) {
            this._move("prev", "last", event);
        },

        isFirstItem: function () {
            return this.active && !this.active.prevAll(".ui-menu-item").length;
        },

        isLastItem: function () {
            return this.active && !this.active.nextAll(".ui-menu-item").length;
        },

        _move: function (direction, filter, event) {
            var next;
            if (this.active) {
                if (direction === "first" || direction === "last") {
                    next = this.active
                    [direction === "first" ? "prevAll" : "nextAll"](".ui-menu-item")
                        .eq(-1);
                } else {
                    next = this.active
                    [direction + "All"](".ui-menu-item")
                        .eq(0);
                }
            }
            if (!next || !next.length || !this.active) {
                next = this.activeMenu.find(this.options.items)[filter]();
            }

            this.focus(event, next);
        },

        nextPage: function (event) {
            var item, base, height;

            if (!this.active) {
                this.next(event);
                return;
            }
            if (this.isLastItem()) {
                return;
            }
            if (this._hasScroll()) {
                base = this.active.offset().top;
                height = this.element.height();
                this.active.nextAll(".ui-menu-item").each(function () {
                    item = $(this);
                    return item.offset().top - base - height < 0;
                });

                this.focus(event, item);
            } else {
                this.focus(event, this.activeMenu.find(this.options.items)
                [!this.active ? "first" : "last"]());
            }
        },

        previousPage: function (event) {
            var item, base, height;
            if (!this.active) {
                this.next(event);
                return;
            }
            if (this.isFirstItem()) {
                return;
            }
            if (this._hasScroll()) {
                base = this.active.offset().top;
                height = this.element.height();
                this.active.prevAll(".ui-menu-item").each(function () {
                    item = $(this);
                    return item.offset().top - base + height > 0;
                });

                this.focus(event, item);
            } else {
                this.focus(event, this.activeMenu.find(this.options.items).first());
            }
        },

        _hasScroll: function () {
            return this.element.outerHeight() < this.element.prop("scrollHeight");
        },

        select: function (event) {

            // TODO: It should never be possible to not have an active item at this
            // point, but the tests don't trigger mouseenter before click.
            this.active = this.active || $(event.target).closest(".ui-menu-item");
            var ui = { item: this.active };
            if (!this.active.has(".ui-menu").length) {
                this.collapseAll(event, true);
            }
            this._trigger("select", event, ui);
        },

        _filterMenuItems: function (character) {
            var escapedCharacter = character.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"),
                regex = new RegExp("^" + escapedCharacter, "i");

            return this.activeMenu
                .find(this.options.items)

                // Only match on items, not dividers or other content (#10571)
                .filter(".ui-menu-item")
                .filter(function () {
                    return regex.test(
                        $.trim($(this).children(".ui-menu-item-wrapper").text()));
                });
        }
    });


    /*!
     * jQuery UI Autocomplete 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Autocomplete
    //>>group: Widgets
    //>>description: Lists suggested words as the user is typing.
    //>>docs: http://api.jqueryui.com/autocomplete/
    //>>demos: http://jqueryui.com/autocomplete/
    //>>css.structure: ../../themes/base/core.css
    //>>css.structure: ../../themes/base/autocomplete.css
    //>>css.theme: ../../themes/base/theme.css



    $.widget("ui.autocomplete", {
        version: "1.12.1",
        defaultElement: "<input>",
        options: {
            appendTo: null,
            autoFocus: false,
            delay: 300,
            minLength: 1,
            position: {
                my: "left top",
                at: "left bottom",
                collision: "none"
            },
            source: null,

            // Callbacks
            change: null,
            close: null,
            focus: null,
            open: null,
            response: null,
            search: null,
            select: null
        },

        requestIndex: 0,
        pending: 0,

        _create: function () {

            // Some browsers only repeat keydown events, not keypress events,
            // so we use the suppressKeyPress flag to determine if we've already
            // handled the keydown event. #7269
            // Unfortunately the code for & in keypress is the same as the up arrow,
            // so we use the suppressKeyPressRepeat flag to avoid handling keypress
            // events when we know the keydown event was used to modify the
            // search term. #7799
            var suppressKeyPress, suppressKeyPressRepeat, suppressInput,
                nodeName = this.element[0].nodeName.toLowerCase(),
                isTextarea = nodeName === "textarea",
                isInput = nodeName === "input";

            // Textareas are always multi-line
            // Inputs are always single-line, even if inside a contentEditable element
            // IE also treats inputs as contentEditable
            // All other element types are determined by whether or not they're contentEditable
            this.isMultiLine = isTextarea || !isInput && this._isContentEditable(this.element);

            this.valueMethod = this.element[isTextarea || isInput ? "val" : "text"];
            this.isNewMenu = true;

            this._addClass("ui-autocomplete-input");
            this.element.attr("autocomplete", "off");

            this._on(this.element, {
                keydown: function (event) {
                    if (this.element.prop("readOnly")) {
                        suppressKeyPress = true;
                        suppressInput = true;
                        suppressKeyPressRepeat = true;
                        return;
                    }

                    suppressKeyPress = false;
                    suppressInput = false;
                    suppressKeyPressRepeat = false;
                    var keyCode = $.ui.keyCode;
                    switch (event.keyCode) {
                        case keyCode.PAGE_UP:
                            suppressKeyPress = true;
                            this._move("previousPage", event);
                            break;
                        case keyCode.PAGE_DOWN:
                            suppressKeyPress = true;
                            this._move("nextPage", event);
                            break;
                        case keyCode.UP:
                            suppressKeyPress = true;
                            this._keyEvent("previous", event);
                            break;
                        case keyCode.DOWN:
                            suppressKeyPress = true;
                            this._keyEvent("next", event);
                            break;
                        case keyCode.ENTER:

                            // when menu is open and has focus
                            if (this.menu.active) {

                                // #6055 - Opera still allows the keypress to occur
                                // which causes forms to submit
                                suppressKeyPress = true;
                                event.preventDefault();
                                this.menu.select(event);
                            }
                            break;
                        case keyCode.TAB:
                            if (this.menu.active) {
                                this.menu.select(event);
                            }
                            break;
                        case keyCode.ESCAPE:
                            if (this.menu.element.is(":visible")) {
                                if (!this.isMultiLine) {
                                    this._value(this.term);
                                }
                                this.close(event);

                                // Different browsers have different default behavior for escape
                                // Single press can mean undo or clear
                                // Double press in IE means clear the whole form
                                event.preventDefault();
                            }
                            break;
                        default:
                            suppressKeyPressRepeat = true;

                            // search timeout should be triggered before the input value is changed
                            this._searchTimeout(event);
                            break;
                    }
                },
                keypress: function (event) {
                    if (suppressKeyPress) {
                        suppressKeyPress = false;
                        if (!this.isMultiLine || this.menu.element.is(":visible")) {
                            event.preventDefault();
                        }
                        return;
                    }
                    if (suppressKeyPressRepeat) {
                        return;
                    }

                    // Replicate some key handlers to allow them to repeat in Firefox and Opera
                    var keyCode = $.ui.keyCode;
                    switch (event.keyCode) {
                        case keyCode.PAGE_UP:
                            this._move("previousPage", event);
                            break;
                        case keyCode.PAGE_DOWN:
                            this._move("nextPage", event);
                            break;
                        case keyCode.UP:
                            this._keyEvent("previous", event);
                            break;
                        case keyCode.DOWN:
                            this._keyEvent("next", event);
                            break;
                    }
                },
                input: function (event) {
                    if (suppressInput) {
                        suppressInput = false;
                        event.preventDefault();
                        return;
                    }
                    this._searchTimeout(event);
                },
                focus: function () {
                    this.selectedItem = null;
                    this.previous = this._value();
                },
                blur: function (event) {
                    if (this.cancelBlur) {
                        delete this.cancelBlur;
                        return;
                    }

                    clearTimeout(this.searching);
                    this.close(event);
                    this._change(event);
                }
            });

            this._initSource();
            this.menu = $("<ul>")
                .appendTo(this._appendTo())
                .menu({

                    // disable ARIA support, the live region takes care of that
                    role: null
                })
                .hide()
                .menu("instance");

            this._addClass(this.menu.element, "ui-autocomplete", "ui-front");
            this._on(this.menu.element, {
                mousedown: function (event) {

                    // prevent moving focus out of the text field
                    event.preventDefault();

                    // IE doesn't prevent moving focus even with event.preventDefault()
                    // so we set a flag to know when we should ignore the blur event
                    this.cancelBlur = true;
                    this._delay(function () {
                        delete this.cancelBlur;

                        // Support: IE 8 only
                        // Right clicking a menu item or selecting text from the menu items will
                        // result in focus moving out of the input. However, we've already received
                        // and ignored the blur event because of the cancelBlur flag set above. So
                        // we restore focus to ensure that the menu closes properly based on the user's
                        // next actions.
                        if (this.element[0] !== $.ui.safeActiveElement(this.document[0])) {
                            this.element.trigger("focus");
                        }
                    });
                },
                menufocus: function (event, ui) {
                    var label, item;

                    // support: Firefox
                    // Prevent accidental activation of menu items in Firefox (#7024 #9118)
                    if (this.isNewMenu) {
                        this.isNewMenu = false;
                        if (event.originalEvent && /^mouse/.test(event.originalEvent.type)) {
                            this.menu.blur();

                            this.document.one("mousemove", function () {
                                $(event.target).trigger(event.originalEvent);
                            });

                            return;
                        }
                    }

                    item = ui.item.data("ui-autocomplete-item");
                    if (false !== this._trigger("focus", event, { item: item })) {

                        // use value to match what will end up in the input, if it was a key event
                        if (event.originalEvent && /^key/.test(event.originalEvent.type)) {
                            this._value(item.value);
                        }
                    }

                    // Announce the value in the liveRegion
                    label = ui.item.attr("aria-label") || item.value;
                    if (label && $.trim(label).length) {
                        this.liveRegion.children().hide();
                        $("<div>").text(label).appendTo(this.liveRegion);
                    }
                },
                menuselect: function (event, ui) {
                    var item = ui.item.data("ui-autocomplete-item"),
                        previous = this.previous;

                    // Only trigger when focus was lost (click on menu)
                    if (this.element[0] !== $.ui.safeActiveElement(this.document[0])) {
                        this.element.trigger("focus");
                        this.previous = previous;

                        // #6109 - IE triggers two focus events and the second
                        // is asynchronous, so we need to reset the previous
                        // term synchronously and asynchronously :-(
                        this._delay(function () {
                            this.previous = previous;
                            this.selectedItem = item;
                        });
                    }

                    if (false !== this._trigger("select", event, { item: item })) {
                        this._value(item.value);
                    }

                    // reset the term after the select event
                    // this allows custom select handling to work properly
                    this.term = this._value();

                    this.close(event);
                    this.selectedItem = item;
                }
            });

            this.liveRegion = $("<div>", {
                role: "status",
                "aria-live": "assertive",
                "aria-relevant": "additions"
            })
                .appendTo(this.document[0].body);

            this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible");

            // Turning off autocomplete prevents the browser from remembering the
            // value when navigating through history, so we re-enable autocomplete
            // if the page is unloaded before the widget is destroyed. #7790
            this._on(this.window, {
                beforeunload: function () {
                    this.element.removeAttr("autocomplete");
                }
            });
        },

        _destroy: function () {
            clearTimeout(this.searching);
            this.element.removeAttr("autocomplete");
            this.menu.element.remove();
            this.liveRegion.remove();
        },

        _setOption: function (key, value) {
            this._super(key, value);
            if (key === "source") {
                this._initSource();
            }
            if (key === "appendTo") {
                this.menu.element.appendTo(this._appendTo());
            }
            if (key === "disabled" && value && this.xhr) {
                this.xhr.abort();
            }
        },

        _isEventTargetInWidget: function (event) {
            var menuElement = this.menu.element[0];

            return event.target === this.element[0] ||
                event.target === menuElement ||
                $.contains(menuElement, event.target);
        },

        _closeOnClickOutside: function (event) {
            if (!this._isEventTargetInWidget(event)) {
                this.close();
            }
        },

        _appendTo: function () {
            var element = this.options.appendTo;

            if (element) {
                element = element.jquery || element.nodeType ?
                    $(element) :
                    this.document.find(element).eq(0);
            }

            if (!element || !element[0]) {
                element = this.element.closest(".ui-front, dialog");
            }

            if (!element.length) {
                element = this.document[0].body;
            }

            return element;
        },

        _initSource: function () {
            var array, url,
                that = this;
            if ($.isArray(this.options.source)) {
                array = this.options.source;
                this.source = function (request, response) {
                    response($.ui.autocomplete.filter(array, request.term));
                };
            } else if (typeof this.options.source === "string") {
                url = this.options.source;
                this.source = function (request, response) {
                    if (that.xhr) {
                        that.xhr.abort();
                    }
                    that.xhr = $.ajax({
                        url: url,
                        data: request,
                        dataType: "json",
                        success: function (data) {
                            response(data);
                        },
                        error: function () {
                            response([]);
                        }
                    });
                };
            } else {
                this.source = this.options.source;
            }
        },

        _searchTimeout: function (event) {
            clearTimeout(this.searching);
            this.searching = this._delay(function () {

                // Search if the value has changed, or if the user retypes the same value (see #7434)
                var equalValues = this.term === this._value(),
                    menuVisible = this.menu.element.is(":visible"),
                    modifierKey = event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;

                if (!equalValues || (equalValues && !menuVisible && !modifierKey)) {
                    this.selectedItem = null;
                    this.search(null, event);
                }
            }, this.options.delay);
        },

        search: function (value, event) {
            value = value != null ? value : this._value();

            // Always save the actual value, not the one passed as an argument
            this.term = this._value();

            if (value.length < this.options.minLength) {
                return this.close(event);
            }

            if (this._trigger("search", event) === false) {
                return;
            }

            return this._search(value);
        },

        _search: function (value) {
            this.pending++;
            this._addClass("ui-autocomplete-loading");
            this.cancelSearch = false;

            this.source({ term: value }, this._response());
        },

        _response: function () {
            var index = ++this.requestIndex;

            return $.proxy(function (content) {
                if (index === this.requestIndex) {
                    this.__response(content);
                }

                this.pending--;
                if (!this.pending) {
                    this._removeClass("ui-autocomplete-loading");
                }
            }, this);
        },

        __response: function (content) {
            if (content) {
                content = this._normalize(content);
            }
            this._trigger("response", null, { content: content });
            if (!this.options.disabled && content && content.length && !this.cancelSearch) {
                this._suggest(content);
                this._trigger("open");
            } else {

                // use ._close() instead of .close() so we don't cancel future searches
                this._close();
            }
        },

        close: function (event) {
            this.cancelSearch = true;
            this._close(event);
        },

        _close: function (event) {

            // Remove the handler that closes the menu on outside clicks
            this._off(this.document, "mousedown");

            if (this.menu.element.is(":visible")) {
                this.menu.element.hide();
                this.menu.blur();
                this.isNewMenu = true;
                this._trigger("close", event);
            }
        },

        _change: function (event) {
            if (this.previous !== this._value()) {
                this._trigger("change", event, { item: this.selectedItem });
            }
        },

        _normalize: function (items) {

            // assume all items have the right format when the first item is complete
            if (items.length && items[0].label && items[0].value) {
                return items;
            }
            return $.map(items, function (item) {
                if (typeof item === "string") {
                    return {
                        label: item,
                        value: item
                    };
                }
                return $.extend({}, item, {
                    label: item.label || item.value,
                    value: item.value || item.label
                });
            });
        },

        _suggest: function (items) {
            var ul = this.menu.element.empty();
            this._renderMenu(ul, items);
            this.isNewMenu = true;
            this.menu.refresh();

            // Size and position menu
            ul.show();
            this._resizeMenu();
            ul.position($.extend({
                of: this.element
            }, this.options.position));

            if (this.options.autoFocus) {
                this.menu.next();
            }

            // Listen for interactions outside of the widget (#6642)
            this._on(this.document, {
                mousedown: "_closeOnClickOutside"
            });
        },

        _resizeMenu: function () {
            var ul = this.menu.element;
            ul.outerWidth(Math.max(

                // Firefox wraps long text (possibly a rounding bug)
                // so we add 1px to avoid the wrapping (#7513)
                ul.width("").outerWidth() + 1,
                this.element.outerWidth()
            ));
        },

        _renderMenu: function (ul, items) {
            var that = this;
            $.each(items, function (index, item) {
                that._renderItemData(ul, item);
            });
        },

        _renderItemData: function (ul, item) {
            return this._renderItem(ul, item).data("ui-autocomplete-item", item);
        },

        _renderItem: function (ul, item) {
            return $("<li>")
                .append($("<div>").text(item.label))
                .appendTo(ul);
        },

        _move: function (direction, event) {
            if (!this.menu.element.is(":visible")) {
                this.search(null, event);
                return;
            }
            if (this.menu.isFirstItem() && /^previous/.test(direction) ||
                this.menu.isLastItem() && /^next/.test(direction)) {

                if (!this.isMultiLine) {
                    this._value(this.term);
                }

                this.menu.blur();
                return;
            }
            this.menu[direction](event);
        },

        widget: function () {
            return this.menu.element;
        },

        _value: function () {
            return this.valueMethod.apply(this.element, arguments);
        },

        _keyEvent: function (keyEvent, event) {
            if (!this.isMultiLine || this.menu.element.is(":visible")) {
                this._move(keyEvent, event);

                // Prevents moving cursor to beginning/end of the text field in some browsers
                event.preventDefault();
            }
        },

        // Support: Chrome <=50
        // We should be able to just use this.element.prop( "isContentEditable" )
        // but hidden elements always report false in Chrome.
        // https://code.google.com/p/chromium/issues/detail?id=313082
        _isContentEditable: function (element) {
            if (!element.length) {
                return false;
            }

            var editable = element.prop("contentEditable");

            if (editable === "inherit") {
                return this._isContentEditable(element.parent());
            }

            return editable === "true";
        }
    });

    $.extend($.ui.autocomplete, {
        escapeRegex: function (value) {
            return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
        },
        filter: function (array, term) {
            var matcher = new RegExp($.ui.autocomplete.escapeRegex(term), "i");
            return $.grep(array, function (value) {
                return matcher.test(value.label || value.value || value);
            });
        }
    });

    // Live region extension, adding a `messages` option
    // NOTE: This is an experimental API. We are still investigating
    // a full solution for string manipulation and internationalization.
    $.widget("ui.autocomplete", $.ui.autocomplete, {
        options: {
            messages: {
                noResults: "No search results.",
                results: function (amount) {
                    return amount + (amount > 1 ? " results are" : " result is") +
                        " available, use up and down arrow keys to navigate.";
                }
            }
        },

        __response: function (content) {
            var message;
            this._superApply(arguments);
            if (this.options.disabled || this.cancelSearch) {
                return;
            }
            if (content && content.length) {
                message = this.options.messages.results(content.length);
            } else {
                message = this.options.messages.noResults;
            }
            this.liveRegion.children().hide();
            $("<div>").text(message).appendTo(this.liveRegion);
        }
    });

    var widgetsAutocomplete = $.ui.autocomplete;


    /*!
     * jQuery UI Controlgroup 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Controlgroup
    //>>group: Widgets
    //>>description: Visually groups form control widgets
    //>>docs: http://api.jqueryui.com/controlgroup/
    //>>demos: http://jqueryui.com/controlgroup/
    //>>css.structure: ../../themes/base/core.css
    //>>css.structure: ../../themes/base/controlgroup.css
    //>>css.theme: ../../themes/base/theme.css


    var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g;

    var widgetsControlgroup = $.widget("ui.controlgroup", {
        version: "1.12.1",
        defaultElement: "<div>",
        options: {
            direction: "horizontal",
            disabled: null,
            onlyVisible: true,
            items: {
                "button": "input[type=button], input[type=submit], input[type=reset], button, a",
                "controlgroupLabel": ".ui-controlgroup-label",
                "checkboxradio": "input[type='checkbox'], input[type='radio']",
                "selectmenu": "select",
                "spinner": ".ui-spinner-input"
            }
        },

        _create: function () {
            this._enhance();
        },

        // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation
        _enhance: function () {
            this.element.attr("role", "toolbar");
            this.refresh();
        },

        _destroy: function () {
            this._callChildMethod("destroy");
            this.childWidgets.removeData("ui-controlgroup-data");
            this.element.removeAttr("role");
            if (this.options.items.controlgroupLabel) {
                this.element
                    .find(this.options.items.controlgroupLabel)
                    .find(".ui-controlgroup-label-contents")
                    .contents().unwrap();
            }
        },

        _initWidgets: function () {
            var that = this,
                childWidgets = [];

            // First we iterate over each of the items options
            $.each(this.options.items, function (widget, selector) {
                var labels;
                var options = {};

                // Make sure the widget has a selector set
                if (!selector) {
                    return;
                }

                if (widget === "controlgroupLabel") {
                    labels = that.element.find(selector);
                    labels.each(function () {
                        var element = $(this);

                        if (element.children(".ui-controlgroup-label-contents").length) {
                            return;
                        }
                        element.contents()
                            .wrapAll("<span class='ui-controlgroup-label-contents'></span>");
                    });
                    that._addClass(labels, null, "ui-widget ui-widget-content ui-state-default");
                    childWidgets = childWidgets.concat(labels.get());
                    return;
                }

                // Make sure the widget actually exists
                if (!$.fn[widget]) {
                    return;
                }

                // We assume everything is in the middle to start because we can't determine
                // first / last elements until all enhancments are done.
                if (that["_" + widget + "Options"]) {
                    options = that["_" + widget + "Options"]("middle");
                } else {
                    options = { classes: {} };
                }

                // Find instances of this widget inside controlgroup and init them
                that.element
                    .find(selector)
                    .each(function () {
                        var element = $(this);
                        var instance = element[widget]("instance");

                        // We need to clone the default options for this type of widget to avoid
                        // polluting the variable options which has a wider scope than a single widget.
                        var instanceOptions = $.widget.extend({}, options);

                        // If the button is the child of a spinner ignore it
                        // TODO: Find a more generic solution
                        if (widget === "button" && element.parent(".ui-spinner").length) {
                            return;
                        }

                        // Create the widget if it doesn't exist
                        if (!instance) {
                            instance = element[widget]()[widget]("instance");
                        }
                        if (instance) {
                            instanceOptions.classes =
                                that._resolveClassesValues(instanceOptions.classes, instance);
                        }
                        element[widget](instanceOptions);

                        // Store an instance of the controlgroup to be able to reference
                        // from the outermost element for changing options and refresh
                        var widgetElement = element[widget]("widget");
                        $.data(widgetElement[0], "ui-controlgroup-data",
                            instance ? instance : element[widget]("instance"));

                        childWidgets.push(widgetElement[0]);
                    });
            });

            this.childWidgets = $($.unique(childWidgets));
            this._addClass(this.childWidgets, "ui-controlgroup-item");
        },

        _callChildMethod: function (method) {
            this.childWidgets.each(function () {
                var element = $(this),
                    data = element.data("ui-controlgroup-data");
                if (data && data[method]) {
                    data[method]();
                }
            });
        },

        _updateCornerClass: function (element, position) {
            var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all";
            var add = this._buildSimpleOptions(position, "label").classes.label;

            this._removeClass(element, null, remove);
            this._addClass(element, null, add);
        },

        _buildSimpleOptions: function (position, key) {
            var direction = this.options.direction === "vertical";
            var result = {
                classes: {}
            };
            result.classes[key] = {
                "middle": "",
                "first": "ui-corner-" + (direction ? "top" : "left"),
                "last": "ui-corner-" + (direction ? "bottom" : "right"),
                "only": "ui-corner-all"
            }[position];

            return result;
        },

        _spinnerOptions: function (position) {
            var options = this._buildSimpleOptions(position, "ui-spinner");

            options.classes["ui-spinner-up"] = "";
            options.classes["ui-spinner-down"] = "";

            return options;
        },

        _buttonOptions: function (position) {
            return this._buildSimpleOptions(position, "ui-button");
        },

        _checkboxradioOptions: function (position) {
            return this._buildSimpleOptions(position, "ui-checkboxradio-label");
        },

        _selectmenuOptions: function (position) {
            var direction = this.options.direction === "vertical";
            return {
                width: direction ? "auto" : false,
                classes: {
                    middle: {
                        "ui-selectmenu-button-open": "",
                        "ui-selectmenu-button-closed": ""
                    },
                    first: {
                        "ui-selectmenu-button-open": "ui-corner-" + (direction ? "top" : "tl"),
                        "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "top" : "left")
                    },
                    last: {
                        "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr",
                        "ui-selectmenu-button-closed": "ui-corner-" + (direction ? "bottom" : "right")
                    },
                    only: {
                        "ui-selectmenu-button-open": "ui-corner-top",
                        "ui-selectmenu-button-closed": "ui-corner-all"
                    }

                }[position]
            };
        },

        _resolveClassesValues: function (classes, instance) {
            var result = {};
            $.each(classes, function (key) {
                var current = instance.options.classes[key] || "";
                current = $.trim(current.replace(controlgroupCornerRegex, ""));
                result[key] = (current + " " + classes[key]).replace(/\s+/g, " ");
            });
            return result;
        },

        _setOption: function (key, value) {
            if (key === "direction") {
                this._removeClass("ui-controlgroup-" + this.options.direction);
            }

            this._super(key, value);
            if (key === "disabled") {
                this._callChildMethod(value ? "disable" : "enable");
                return;
            }

            this.refresh();
        },

        refresh: function () {
            var children,
                that = this;

            this._addClass("ui-controlgroup ui-controlgroup-" + this.options.direction);

            if (this.options.direction === "horizontal") {
                this._addClass(null, "ui-helper-clearfix");
            }
            this._initWidgets();

            children = this.childWidgets;

            // We filter here because we need to track all childWidgets not just the visible ones
            if (this.options.onlyVisible) {
                children = children.filter(":visible");
            }

            if (children.length) {

                // We do this last because we need to make sure all enhancment is done
                // before determining first and last
                $.each(["first", "last"], function (index, value) {
                    var instance = children[value]().data("ui-controlgroup-data");

                    if (instance && that["_" + instance.widgetName + "Options"]) {
                        var options = that["_" + instance.widgetName + "Options"](
                            children.length === 1 ? "only" : value
                        );
                        options.classes = that._resolveClassesValues(options.classes, instance);
                        instance.element[instance.widgetName](options);
                    } else {
                        that._updateCornerClass(children[value](), value);
                    }
                });

                // Finally call the refresh method on each of the child widgets.
                this._callChildMethod("refresh");
            }
        }
    });

    /*!
     * jQuery UI Checkboxradio 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Checkboxradio
    //>>group: Widgets
    //>>description: Enhances a form with multiple themeable checkboxes or radio buttons.
    //>>docs: http://api.jqueryui.com/checkboxradio/
    //>>demos: http://jqueryui.com/checkboxradio/
    //>>css.structure: ../../themes/base/core.css
    //>>css.structure: ../../themes/base/button.css
    //>>css.structure: ../../themes/base/checkboxradio.css
    //>>css.theme: ../../themes/base/theme.css



    $.widget("ui.checkboxradio", [$.ui.formResetMixin, {
        version: "1.12.1",
        options: {
            disabled: null,
            label: null,
            icon: true,
            classes: {
                "ui-checkboxradio-label": "ui-corner-all",
                "ui-checkboxradio-icon": "ui-corner-all"
            }
        },

        _getCreateOptions: function () {
            var disabled, labels;
            var that = this;
            var options = this._super() || {};

            // We read the type here, because it makes more sense to throw a element type error first,
            // rather then the error for lack of a label. Often if its the wrong type, it
            // won't have a label (e.g. calling on a div, btn, etc)
            this._readType();

            labels = this.element.labels();

            // If there are multiple labels, use the last one
            this.label = $(labels[labels.length - 1]);
            if (!this.label.length) {
                $.error("No label found for checkboxradio widget");
            }

            this.originalLabel = "";

            // We need to get the label text but this may also need to make sure it does not contain the
            // input itself.
            this.label.contents().not(this.element[0]).each(function () {

                // The label contents could be text, html, or a mix. We concat each element to get a
                // string representation of the label, without the input as part of it.
                that.originalLabel += this.nodeType === 3 ? $(this).text() : this.outerHTML;
            });

            // Set the label option if we found label text
            if (this.originalLabel) {
                options.label = this.originalLabel;
            }

            disabled = this.element[0].disabled;
            if (disabled != null) {
                options.disabled = disabled;
            }
            return options;
        },

        _create: function () {
            var checked = this.element[0].checked;

            this._bindFormResetHandler();

            if (this.options.disabled == null) {
                this.options.disabled = this.element[0].disabled;
            }

            this._setOption("disabled", this.options.disabled);
            this._addClass("ui-checkboxradio", "ui-helper-hidden-accessible");
            this._addClass(this.label, "ui-checkboxradio-label", "ui-button ui-widget");

            if (this.type === "radio") {
                this._addClass(this.label, "ui-checkboxradio-radio-label");
            }

            if (this.options.label && this.options.label !== this.originalLabel) {
                this._updateLabel();
            } else if (this.originalLabel) {
                this.options.label = this.originalLabel;
            }

            this._enhance();

            if (checked) {
                this._addClass(this.label, "ui-checkboxradio-checked", "ui-state-active");
                if (this.icon) {
                    this._addClass(this.icon, null, "ui-state-hover");
                }
            }

            this._on({
                change: "_toggleClasses",
                focus: function () {
                    this._addClass(this.label, null, "ui-state-focus ui-visual-focus");
                },
                blur: function () {
                    this._removeClass(this.label, null, "ui-state-focus ui-visual-focus");
                }
            });
        },

        _readType: function () {
            var nodeName = this.element[0].nodeName.toLowerCase();
            this.type = this.element[0].type;
            if (nodeName !== "input" || !/radio|checkbox/.test(this.type)) {
                $.error("Can't create checkboxradio on element.nodeName=" + nodeName +
                    " and element.type=" + this.type);
            }
        },

        // Support jQuery Mobile enhanced option
        _enhance: function () {
            this._updateIcon(this.element[0].checked);
        },

        widget: function () {
            return this.label;
        },

        _getRadioGroup: function () {
            var group;
            var name = this.element[0].name;
            var nameSelector = "input[name='" + $.ui.escapeSelector(name) + "']";

            if (!name) {
                return $([]);
            }

            if (this.form.length) {
                group = $(this.form[0].elements).filter(nameSelector);
            } else {

                // Not inside a form, check all inputs that also are not inside a form
                group = $(nameSelector).filter(function () {
                    return $(this).form().length === 0;
                });
            }

            return group.not(this.element);
        },

        _toggleClasses: function () {
            var checked = this.element[0].checked;
            this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked);

            if (this.options.icon && this.type === "checkbox") {
                this._toggleClass(this.icon, null, "ui-icon-check ui-state-checked", checked)
                    ._toggleClass(this.icon, null, "ui-icon-blank", !checked);
            }

            if (this.type === "radio") {
                this._getRadioGroup()
                    .each(function () {
                        var instance = $(this).checkboxradio("instance");

                        if (instance) {
                            instance._removeClass(instance.label,
                                "ui-checkboxradio-checked", "ui-state-active");
                        }
                    });
            }
        },

        _destroy: function () {
            this._unbindFormResetHandler();

            if (this.icon) {
                this.icon.remove();
                this.iconSpace.remove();
            }
        },

        _setOption: function (key, value) {

            // We don't allow the value to be set to nothing
            if (key === "label" && !value) {
                return;
            }

            this._super(key, value);

            if (key === "disabled") {
                this._toggleClass(this.label, null, "ui-state-disabled", value);
                this.element[0].disabled = value;

                // Don't refresh when setting disabled
                return;
            }
            this.refresh();
        },

        _updateIcon: function (checked) {
            var toAdd = "ui-icon ui-icon-background ";

            if (this.options.icon) {
                if (!this.icon) {
                    this.icon = $("<span>");
                    this.iconSpace = $("<span> </span>");
                    this._addClass(this.iconSpace, "ui-checkboxradio-icon-space");
                }

                if (this.type === "checkbox") {
                    toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank";
                    this._removeClass(this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check");
                } else {
                    toAdd += "ui-icon-blank";
                }
                this._addClass(this.icon, "ui-checkboxradio-icon", toAdd);
                if (!checked) {
                    this._removeClass(this.icon, null, "ui-icon-check ui-state-checked");
                }
                this.icon.prependTo(this.label).after(this.iconSpace);
            } else if (this.icon !== undefined) {
                this.icon.remove();
                this.iconSpace.remove();
                delete this.icon;
            }
        },

        _updateLabel: function () {

            // Remove the contents of the label ( minus the icon, icon space, and input )
            var contents = this.label.contents().not(this.element[0]);
            if (this.icon) {
                contents = contents.not(this.icon[0]);
            }
            if (this.iconSpace) {
                contents = contents.not(this.iconSpace[0]);
            }
            contents.remove();

            this.label.append(this.options.label);
        },

        refresh: function () {
            var checked = this.element[0].checked,
                isDisabled = this.element[0].disabled;

            this._updateIcon(checked);
            this._toggleClass(this.label, "ui-checkboxradio-checked", "ui-state-active", checked);
            if (this.options.label !== null) {
                this._updateLabel();
            }

            if (isDisabled !== this.options.disabled) {
                this._setOptions({ "disabled": isDisabled });
            }
        }

    }]);

    var widgetsCheckboxradio = $.ui.checkboxradio;


    /*!
     * jQuery UI Button 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Button
    //>>group: Widgets
    //>>description: Enhances a form with themeable buttons.
    //>>docs: http://api.jqueryui.com/button/
    //>>demos: http://jqueryui.com/button/
    //>>css.structure: ../../themes/base/core.css
    //>>css.structure: ../../themes/base/button.css
    //>>css.theme: ../../themes/base/theme.css



    $.widget("ui.button", {
        version: "1.12.1",
        defaultElement: "<button>",
        options: {
            classes: {
                "ui-button": "ui-corner-all"
            },
            disabled: null,
            icon: null,
            iconPosition: "beginning",
            label: null,
            showLabel: true
        },

        _getCreateOptions: function () {
            var disabled,

                // This is to support cases like in jQuery Mobile where the base widget does have
                // an implementation of _getCreateOptions
                options = this._super() || {};

            this.isInput = this.element.is("input");

            disabled = this.element[0].disabled;
            if (disabled != null) {
                options.disabled = disabled;
            }

            this.originalLabel = this.isInput ? this.element.val() : this.element.html();
            if (this.originalLabel) {
                options.label = this.originalLabel;
            }

            return options;
        },

        _create: function () {
            if (!this.option.showLabel & !this.options.icon) {
                this.options.showLabel = true;
            }

            // We have to check the option again here even though we did in _getCreateOptions,
            // because null may have been passed on init which would override what was set in
            // _getCreateOptions
            if (this.options.disabled == null) {
                this.options.disabled = this.element[0].disabled || false;
            }

            this.hasTitle = !!this.element.attr("title");

            // Check to see if the label needs to be set or if its already correct
            if (this.options.label && this.options.label !== this.originalLabel) {
                if (this.isInput) {
                    this.element.val(this.options.label);
                } else {
                    this.element.html(this.options.label);
                }
            }
            this._addClass("ui-button", "ui-widget");
            this._setOption("disabled", this.options.disabled);
            this._enhance();

            if (this.element.is("a")) {
                this._on({
                    "keyup": function (event) {
                        if (event.keyCode === $.ui.keyCode.SPACE) {
                            event.preventDefault();

                            // Support: PhantomJS <= 1.9, IE 8 Only
                            // If a native click is available use it so we actually cause navigation
                            // otherwise just trigger a click event
                            if (this.element[0].click) {
                                this.element[0].click();
                            } else {
                                this.element.trigger("click");
                            }
                        }
                    }
                });
            }
        },

        _enhance: function () {
            if (!this.element.is("button")) {
                this.element.attr("role", "button");
            }

            if (this.options.icon) {
                this._updateIcon("icon", this.options.icon);
                this._updateTooltip();
            }
        },

        _updateTooltip: function () {
            this.title = this.element.attr("title");

            if (!this.options.showLabel && !this.title) {
                this.element.attr("title", this.options.label);
            }
        },

        _updateIcon: function (option, value) {
            var icon = option !== "iconPosition",
                position = icon ? this.options.iconPosition : value,
                displayBlock = position === "top" || position === "bottom";

            // Create icon
            if (!this.icon) {
                this.icon = $("<span>");

                this._addClass(this.icon, "ui-button-icon", "ui-icon");

                if (!this.options.showLabel) {
                    this._addClass("ui-button-icon-only");
                }
            } else if (icon) {

                // If we are updating the icon remove the old icon class
                this._removeClass(this.icon, null, this.options.icon);
            }

            // If we are updating the icon add the new icon class
            if (icon) {
                this._addClass(this.icon, null, value);
            }

            this._attachIcon(position);

            // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove
            // the iconSpace if there is one.
            if (displayBlock) {
                this._addClass(this.icon, null, "ui-widget-icon-block");
                if (this.iconSpace) {
                    this.iconSpace.remove();
                }
            } else {

                // Position is beginning or end so remove the ui-widget-icon-block class and add the
                // space if it does not exist
                if (!this.iconSpace) {
                    this.iconSpace = $("<span> </span>");
                    this._addClass(this.iconSpace, "ui-button-icon-space");
                }
                this._removeClass(this.icon, null, "ui-wiget-icon-block");
                this._attachIconSpace(position);
            }
        },

        _destroy: function () {
            this.element.removeAttr("role");

            if (this.icon) {
                this.icon.remove();
            }
            if (this.iconSpace) {
                this.iconSpace.remove();
            }
            if (!this.hasTitle) {
                this.element.removeAttr("title");
            }
        },

        _attachIconSpace: function (iconPosition) {
            this.icon[/^(?:end|bottom)/.test(iconPosition) ? "before" : "after"](this.iconSpace);
        },

        _attachIcon: function (iconPosition) {
            this.element[/^(?:end|bottom)/.test(iconPosition) ? "append" : "prepend"](this.icon);
        },

        _setOptions: function (options) {
            var newShowLabel = options.showLabel === undefined ?
                this.options.showLabel :
                options.showLabel,
                newIcon = options.icon === undefined ? this.options.icon : options.icon;

            if (!newShowLabel && !newIcon) {
                options.showLabel = true;
            }
            this._super(options);
        },

        _setOption: function (key, value) {
            if (key === "icon") {
                if (value) {
                    this._updateIcon(key, value);
                } else if (this.icon) {
                    this.icon.remove();
                    if (this.iconSpace) {
                        this.iconSpace.remove();
                    }
                }
            }

            if (key === "iconPosition") {
                this._updateIcon(key, value);
            }

            // Make sure we can't end up with a button that has neither text nor icon
            if (key === "showLabel") {
                this._toggleClass("ui-button-icon-only", null, !value);
                this._updateTooltip();
            }

            if (key === "label") {
                if (this.isInput) {
                    this.element.val(value);
                } else {

                    // If there is an icon, append it, else nothing then append the value
                    // this avoids removal of the icon when setting label text
                    this.element.html(value);
                    if (this.icon) {
                        this._attachIcon(this.options.iconPosition);
                        this._attachIconSpace(this.options.iconPosition);
                    }
                }
            }

            this._super(key, value);

            if (key === "disabled") {
                this._toggleClass(null, "ui-state-disabled", value);
                this.element[0].disabled = value;
                if (value) {
                    this.element.blur();
                }
            }
        },

        refresh: function () {

            // Make sure to only check disabled if its an element that supports this otherwise
            // check for the disabled class to determine state
            var isDisabled = this.element.is("input, button") ?
                this.element[0].disabled : this.element.hasClass("ui-button-disabled");

            if (isDisabled !== this.options.disabled) {
                this._setOptions({ disabled: isDisabled });
            }

            this._updateTooltip();
        }
    });

    // DEPRECATED
    if ($.uiBackCompat !== false) {

        // Text and Icons options
        $.widget("ui.button", $.ui.button, {
            options: {
                text: true,
                icons: {
                    primary: null,
                    secondary: null
                }
            },

            _create: function () {
                if (this.options.showLabel && !this.options.text) {
                    this.options.showLabel = this.options.text;
                }
                if (!this.options.showLabel && this.options.text) {
                    this.options.text = this.options.showLabel;
                }
                if (!this.options.icon && (this.options.icons.primary ||
                    this.options.icons.secondary)) {
                    if (this.options.icons.primary) {
                        this.options.icon = this.options.icons.primary;
                    } else {
                        this.options.icon = this.options.icons.secondary;
                        this.options.iconPosition = "end";
                    }
                } else if (this.options.icon) {
                    this.options.icons.primary = this.options.icon;
                }
                this._super();
            },

            _setOption: function (key, value) {
                if (key === "text") {
                    this._super("showLabel", value);
                    return;
                }
                if (key === "showLabel") {
                    this.options.text = value;
                }
                if (key === "icon") {
                    this.options.icons.primary = value;
                }
                if (key === "icons") {
                    if (value.primary) {
                        this._super("icon", value.primary);
                        this._super("iconPosition", "beginning");
                    } else if (value.secondary) {
                        this._super("icon", value.secondary);
                        this._super("iconPosition", "end");
                    }
                }
                this._superApply(arguments);
            }
        });

        $.fn.button = (function (orig) {
            return function () {
                if (!this.length || (this.length && this[0].tagName !== "INPUT") ||
                    (this.length && this[0].tagName === "INPUT" && (
                        this.attr("type") !== "checkbox" && this.attr("type") !== "radio"
                    ))) {
                    return orig.apply(this, arguments);
                }
                if (!$.ui.checkboxradio) {
                    $.error("Checkboxradio widget missing");
                }
                if (arguments.length === 0) {
                    return this.checkboxradio({
                        "icon": false
                    });
                }
                return this.checkboxradio.apply(this, arguments);
            };
        })($.fn.button);

        $.fn.buttonset = function () {
            if (!$.ui.controlgroup) {
                $.error("Controlgroup widget missing");
            }
            if (arguments[0] === "option" && arguments[1] === "items" && arguments[2]) {
                return this.controlgroup.apply(this,
                    [arguments[0], "items.button", arguments[2]]);
            }
            if (arguments[0] === "option" && arguments[1] === "items") {
                return this.controlgroup.apply(this, [arguments[0], "items.button"]);
            }
            if (typeof arguments[0] === "object" && arguments[0].items) {
                arguments[0].items = {
                    button: arguments[0].items
                };
            }
            return this.controlgroup.apply(this, arguments);
        };
    }

    var widgetsButton = $.ui.button;


    // jscs:disable maximumLineLength
    /* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
    /*!
     * jQuery UI Datepicker 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Datepicker
    //>>group: Widgets
    //>>description: Displays a calendar from an input or inline for selecting dates.
    //>>docs: http://api.jqueryui.com/datepicker/
    //>>demos: http://jqueryui.com/datepicker/
    //>>css.structure: ../../themes/base/core.css
    //>>css.structure: ../../themes/base/datepicker.css
    //>>css.theme: ../../themes/base/theme.css



    $.extend($.ui, { datepicker: { version: "1.12.1" } });

    var datepicker_instActive;

    function datepicker_getZindex(elem) {
        var position, value;
        while (elem.length && elem[0] !== document) {

            // Ignore z-index if position is set to a value where z-index is ignored by the browser
            // This makes behavior of this function consistent across browsers
            // WebKit always returns auto if the element is positioned
            position = elem.css("position");
            if (position === "absolute" || position === "relative" || position === "fixed") {

                // IE returns 0 when zIndex is not specified
                // other browsers return a string
                // we ignore the case of nested elements with an explicit value of 0
                // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
                value = parseInt(elem.css("zIndex"), 10);
                if (!isNaN(value) && value !== 0) {
                    return value;
                }
            }
            elem = elem.parent();
        }

        return 0;
    }
    /* Date picker manager.
       Use the singleton instance of this class, $.datepicker, to interact with the date picker.
       Settings for (groups of) date pickers are maintained in an instance object,
       allowing multiple different settings on the same page. */

    function Datepicker() {
        this._curInst = null; // The current instance in use
        this._keyEvent = false; // If the last event was a key event
        this._disabledInputs = []; // List of date picker inputs that have been disabled
        this._datepickerShowing = false; // True if the popup picker is showing , false if not
        this._inDialog = false; // True if showing within a "dialog", false if not
        this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division
        this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class
        this._appendClass = "ui-datepicker-append"; // The name of the append marker class
        this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class
        this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class
        this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class
        this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class
        this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class
        this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class
        this.regional = []; // Available regional settings, indexed by language code
        this.regional[""] = { // Default regional settings
            closeText: "Done", // Display text for close link
            prevText: "Prev", // Display text for previous month link
            nextText: "Next", // Display text for next month link
            currentText: "Today", // Display text for current month link
            monthNames: ["January", "February", "March", "April", "May", "June",
                "July", "August", "September", "October", "November", "December"], // Names of months for drop-down and formatting
            monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], // For formatting
            dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], // For formatting
            dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], // For formatting
            dayNamesMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], // Column headings for days starting at Sunday
            weekHeader: "Wk", // Column header for week of the year
            dateFormat: "mm/dd/yy", // See format options on parseDate
            firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
            isRTL: false, // True if right-to-left language, false if left-to-right
            showMonthAfterYear: false, // True if the year select precedes month, false for month then year
            yearSuffix: "" // Additional text to append to the year in the month headers
        };
        this._defaults = { // Global defaults for all the date picker instances
            showOn: "focus", // "focus" for popup on focus,
            // "button" for trigger button, or "both" for either
            showAnim: "fadeIn", // Name of jQuery animation for popup
            showOptions: {}, // Options for enhanced animations
            defaultDate: null, // Used when field is blank: actual date,
            // +/-number for offset from today, null for today
            appendText: "", // Display text following the input box, e.g. showing the format
            buttonText: "...", // Text for trigger button
            buttonImage: "", // URL for trigger button image
            buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
            hideIfNoPrevNext: false, // True to hide next/previous month links
            // if not applicable, false to just disable them
            navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
            gotoCurrent: false, // True if today link goes back to current selection instead
            changeMonth: false, // True if month can be selected directly, false if only prev/next
            changeYear: false, // True if year can be selected directly, false if only prev/next
            yearRange: "c-10:c+10", // Range of years to display in drop-down,
            // either relative to today's year (-nn:+nn), relative to currently displayed year
            // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
            showOtherMonths: false, // True to show dates in other months, false to leave blank
            selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
            showWeek: false, // True to show week of the year, false to not show it
            calculateWeek: this.iso8601Week, // How to calculate the week of the year,
            // takes a Date and returns the number of the week for it
            shortYearCutoff: "+10", // Short year values < this are in the current century,
            // > this are in the previous century,
            // string value starting with "+" for current year + value
            minDate: null, // The earliest selectable date, or null for no limit
            maxDate: null, // The latest selectable date, or null for no limit
            duration: "fast", // Duration of display/closure
            beforeShowDay: null, // Function that takes a date and returns an array with
            // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "",
            // [2] = cell title (optional), e.g. $.datepicker.noWeekends
            beforeShow: null, // Function that takes an input field and
            // returns a set of custom settings for the date picker
            onSelect: null, // Define a callback function when a date is selected
            onChangeMonthYear: null, // Define a callback function when the month or year is changed
            onClose: null, // Define a callback function when the datepicker is closed
            numberOfMonths: 1, // Number of months to show at a time
            showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
            stepMonths: 1, // Number of months to step back/forward
            stepBigMonths: 12, // Number of months to step back/forward for the big links
            altField: "", // Selector for an alternate field to store selected dates into
            altFormat: "", // The date format to use for the alternate field
            constrainInput: true, // The input is constrained by the current date format
            showButtonPanel: false, // True to show button panel, false to not show it
            autoSize: false, // True to size the input for the date format, false to leave as is
            disabled: false // The initial disabled state
        };
        $.extend(this._defaults, this.regional[""]);
        this.regional.en = $.extend(true, {}, this.regional[""]);
        this.regional["en-US"] = $.extend(true, {}, this.regional.en);
        this.dpDiv = datepicker_bindHover($("<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"));
    }

    $.extend(Datepicker.prototype, {
        /* Class name added to elements to indicate already configured with a date picker. */
        markerClassName: "hasDatepicker",

        //Keep track of the maximum number of rows displayed (see #7043)
        maxRows: 4,

        // TODO rename to "widget" when switching to widget factory
        _widgetDatepicker: function () {
            return this.dpDiv;
        },

        /* Override the default settings for all instances of the date picker.
         * @param  settings  object - the new settings to use as defaults (anonymous object)
         * @return the manager object
         */
        setDefaults: function (settings) {
            datepicker_extendRemove(this._defaults, settings || {});
            return this;
        },

        /* Attach the date picker to a jQuery selection.
         * @param  target	element - the target input field or division or span
         * @param  settings  object - the new settings to use for this date picker instance (anonymous)
         */
        _attachDatepicker: function (target, settings) {
            var nodeName, inline, inst;
            nodeName = target.nodeName.toLowerCase();
            inline = (nodeName === "div" || nodeName === "span");
            if (!target.id) {
                this.uuid += 1;
                target.id = "dp" + this.uuid;
            }
            inst = this._newInst($(target), inline);
            inst.settings = $.extend({}, settings || {});
            if (nodeName === "input") {
                this._connectDatepicker(target, inst);
            } else if (inline) {
                this._inlineDatepicker(target, inst);
            }
        },

        /* Create a new instance object. */
        _newInst: function (target, inline) {
            var id = target[0].id.replace(/([^A-Za-z0-9_\-])/g, "\\\\$1"); // escape jQuery meta chars
            return {
                id: id, input: target, // associated target
                selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
                drawMonth: 0, drawYear: 0, // month being drawn
                inline: inline, // is datepicker inline or not
                dpDiv: (!inline ? this.dpDiv : // presentation div
                    datepicker_bindHover($("<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")))
            };
        },

        /* Attach the date picker to an input field. */
        _connectDatepicker: function (target, inst) {
            var input = $(target);
            inst.append = $([]);
            inst.trigger = $([]);
            if (input.hasClass(this.markerClassName)) {
                return;
            }
            this._attachments(input, inst);
            input.addClass(this.markerClassName).on("keydown", this._doKeyDown).
                on("keypress", this._doKeyPress).on("keyup", this._doKeyUp);
            this._autoSize(inst);
            $.data(target, "datepicker", inst);

            //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
            if (inst.settings.disabled) {
                this._disableDatepicker(target);
            }
        },

        /* Make attachments based on settings. */
        _attachments: function (input, inst) {
            var showOn, buttonText, buttonImage,
                appendText = this._get(inst, "appendText"),
                isRTL = this._get(inst, "isRTL");

            if (inst.append) {
                inst.append.remove();
            }
            if (appendText) {
                inst.append = $("<span class='" + this._appendClass + "'>" + appendText + "</span>");
                input[isRTL ? "before" : "after"](inst.append);
            }

            input.off("focus", this._showDatepicker);

            if (inst.trigger) {
                inst.trigger.remove();
            }

            showOn = this._get(inst, "showOn");
            if (showOn === "focus" || showOn === "both") { // pop-up date picker when in the marked field
                input.on("focus", this._showDatepicker);
            }
            if (showOn === "button" || showOn === "both") { // pop-up date picker when button clicked
                buttonText = this._get(inst, "buttonText");
                buttonImage = this._get(inst, "buttonImage");
                inst.trigger = $(this._get(inst, "buttonImageOnly") ?
                    $("<img/>").addClass(this._triggerClass).
                        attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
                    $("<button type='button'></button>").addClass(this._triggerClass).
                        html(!buttonImage ? buttonText : $("<img/>").attr(
                            { src: buttonImage, alt: buttonText, title: buttonText })));
                input[isRTL ? "before" : "after"](inst.trigger);
                inst.trigger.on("click", function () {
                    if ($.datepicker._datepickerShowing && $.datepicker._lastInput === input[0]) {
                        $.datepicker._hideDatepicker();
                    } else if ($.datepicker._datepickerShowing && $.datepicker._lastInput !== input[0]) {
                        $.datepicker._hideDatepicker();
                        $.datepicker._showDatepicker(input[0]);
                    } else {
                        $.datepicker._showDatepicker(input[0]);
                    }
                    return false;
                });
            }
        },

        /* Apply the maximum length for the date format. */
        _autoSize: function (inst) {
            if (this._get(inst, "autoSize") && !inst.inline) {
                var findMax, max, maxI, i,
                    date = new Date(2009, 12 - 1, 20), // Ensure double digits
                    dateFormat = this._get(inst, "dateFormat");

                if (dateFormat.match(/[DM]/)) {
                    findMax = function (names) {
                        max = 0;
                        maxI = 0;
                        for (i = 0; i < names.length; i++) {
                            if (names[i].length > max) {
                                max = names[i].length;
                                maxI = i;
                            }
                        }
                        return maxI;
                    };
                    date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
                        "monthNames" : "monthNamesShort"))));
                    date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
                        "dayNames" : "dayNamesShort"))) + 20 - date.getDay());
                }
                inst.input.attr("size", this._formatDate(inst, date).length);
            }
        },

        /* Attach an inline date picker to a div. */
        _inlineDatepicker: function (target, inst) {
            var divSpan = $(target);
            if (divSpan.hasClass(this.markerClassName)) {
                return;
            }
            divSpan.addClass(this.markerClassName).append(inst.dpDiv);
            $.data(target, "datepicker", inst);
            this._setDate(inst, this._getDefaultDate(inst), true);
            this._updateDatepicker(inst);
            this._updateAlternate(inst);

            //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
            if (inst.settings.disabled) {
                this._disableDatepicker(target);
            }

            // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
            // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
            inst.dpDiv.css("display", "block");
        },

        /* Pop-up the date picker in a "dialog" box.
         * @param  input element - ignored
         * @param  date	string or Date - the initial date to display
         * @param  onSelect  function - the function to call when a date is selected
         * @param  settings  object - update the dialog date picker instance's settings (anonymous object)
         * @param  pos int[2] - coordinates for the dialog's position within the screen or
         *					event - with x/y coordinates or
         *					leave empty for default (screen centre)
         * @return the manager object
         */
        _dialogDatepicker: function (input, date, onSelect, settings, pos) {
            var id, browserWidth, browserHeight, scrollX, scrollY,
                inst = this._dialogInst; // internal instance

            if (!inst) {
                this.uuid += 1;
                id = "dp" + this.uuid;
                this._dialogInput = $("<input type='text' id='" + id +
                    "' style='position: absolute; top: -100px; width: 0px;'/>");
                this._dialogInput.on("keydown", this._doKeyDown);
                $("body").append(this._dialogInput);
                inst = this._dialogInst = this._newInst(this._dialogInput, false);
                inst.settings = {};
                $.data(this._dialogInput[0], "datepicker", inst);
            }
            datepicker_extendRemove(inst.settings, settings || {});
            date = (date && date.constructor === Date ? this._formatDate(inst, date) : date);
            this._dialogInput.val(date);

            this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
            if (!this._pos) {
                browserWidth = document.documentElement.clientWidth;
                browserHeight = document.documentElement.clientHeight;
                scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
                scrollY = document.documentElement.scrollTop || document.body.scrollTop;
                this._pos = // should use actual width/height below
                    [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
            }

            // Move input on screen for focus, but hidden behind dialog
            this._dialogInput.css("left", (this._pos[0] + 20) + "px").css("top", this._pos[1] + "px");
            inst.settings.onSelect = onSelect;
            this._inDialog = true;
            this.dpDiv.addClass(this._dialogClass);
            this._showDatepicker(this._dialogInput[0]);
            if ($.blockUI) {
                $.blockUI(this.dpDiv);
            }
            $.data(this._dialogInput[0], "datepicker", inst);
            return this;
        },

        /* Detach a datepicker from its control.
         * @param  target	element - the target input field or division or span
         */
        _destroyDatepicker: function (target) {
            var nodeName,
                $target = $(target),
                inst = $.data(target, "datepicker");

            if (!$target.hasClass(this.markerClassName)) {
                return;
            }

            nodeName = target.nodeName.toLowerCase();
            $.removeData(target, "datepicker");
            if (nodeName === "input") {
                inst.append.remove();
                inst.trigger.remove();
                $target.removeClass(this.markerClassName).
                    off("focus", this._showDatepicker).
                    off("keydown", this._doKeyDown).
                    off("keypress", this._doKeyPress).
                    off("keyup", this._doKeyUp);
            } else if (nodeName === "div" || nodeName === "span") {
                $target.removeClass(this.markerClassName).empty();
            }

            if (datepicker_instActive === inst) {
                datepicker_instActive = null;
            }
        },

        /* Enable the date picker to a jQuery selection.
         * @param  target	element - the target input field or division or span
         */
        _enableDatepicker: function (target) {
            var nodeName, inline,
                $target = $(target),
                inst = $.data(target, "datepicker");

            if (!$target.hasClass(this.markerClassName)) {
                return;
            }

            nodeName = target.nodeName.toLowerCase();
            if (nodeName === "input") {
                target.disabled = false;
                inst.trigger.filter("button").
                    each(function () { this.disabled = false; }).end().
                    filter("img").css({ opacity: "1.0", cursor: "" });
            } else if (nodeName === "div" || nodeName === "span") {
                inline = $target.children("." + this._inlineClass);
                inline.children().removeClass("ui-state-disabled");
                inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
                    prop("disabled", false);
            }
            this._disabledInputs = $.map(this._disabledInputs,
                function (value) { return (value === target ? null : value); }); // delete entry
        },

        /* Disable the date picker to a jQuery selection.
         * @param  target	element - the target input field or division or span
         */
        _disableDatepicker: function (target) {
            var nodeName, inline,
                $target = $(target),
                inst = $.data(target, "datepicker");

            if (!$target.hasClass(this.markerClassName)) {
                return;
            }

            nodeName = target.nodeName.toLowerCase();
            if (nodeName === "input") {
                target.disabled = true;
                inst.trigger.filter("button").
                    each(function () { this.disabled = true; }).end().
                    filter("img").css({ opacity: "0.5", cursor: "default" });
            } else if (nodeName === "div" || nodeName === "span") {
                inline = $target.children("." + this._inlineClass);
                inline.children().addClass("ui-state-disabled");
                inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
                    prop("disabled", true);
            }
            this._disabledInputs = $.map(this._disabledInputs,
                function (value) { return (value === target ? null : value); }); // delete entry
            this._disabledInputs[this._disabledInputs.length] = target;
        },

        /* Is the first field in a jQuery collection disabled as a datepicker?
         * @param  target	element - the target input field or division or span
         * @return boolean - true if disabled, false if enabled
         */
        _isDisabledDatepicker: function (target) {
            if (!target) {
                return false;
            }
            for (var i = 0; i < this._disabledInputs.length; i++) {
                if (this._disabledInputs[i] === target) {
                    return true;
                }
            }
            return false;
        },

        /* Retrieve the instance data for the target control.
         * @param  target  element - the target input field or division or span
         * @return  object - the associated instance data
         * @throws  error if a jQuery problem getting data
         */
        _getInst: function (target) {
            try {
                return $.data(target, "datepicker");
            }
            catch (err) {
                throw "Missing instance data for this datepicker";
            }
        },

        /* Update or retrieve the settings for a date picker attached to an input field or division.
         * @param  target  element - the target input field or division or span
         * @param  name	object - the new settings to update or
         *				string - the name of the setting to change or retrieve,
         *				when retrieving also "all" for all instance settings or
         *				"defaults" for all global defaults
         * @param  value   any - the new value for the setting
         *				(omit if above is an object or to retrieve a value)
         */
        _optionDatepicker: function (target, name, value) {
            var settings, date, minDate, maxDate,
                inst = this._getInst(target);

            if (arguments.length === 2 && typeof name === "string") {
                return (name === "defaults" ? $.extend({}, $.datepicker._defaults) :
                    (inst ? (name === "all" ? $.extend({}, inst.settings) :
                        this._get(inst, name)) : null));
            }

            settings = name || {};
            if (typeof name === "string") {
                settings = {};
                settings[name] = value;
            }

            if (inst) {
                if (this._curInst === inst) {
                    this._hideDatepicker();
                }

                date = this._getDateDatepicker(target, true);
                minDate = this._getMinMaxDate(inst, "min");
                maxDate = this._getMinMaxDate(inst, "max");
                datepicker_extendRemove(inst.settings, settings);

                // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
                if (minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined) {
                    inst.settings.minDate = this._formatDate(inst, minDate);
                }
                if (maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined) {
                    inst.settings.maxDate = this._formatDate(inst, maxDate);
                }
                if ("disabled" in settings) {
                    if (settings.disabled) {
                        this._disableDatepicker(target);
                    } else {
                        this._enableDatepicker(target);
                    }
                }
                this._attachments($(target), inst);
                this._autoSize(inst);
                this._setDate(inst, date);
                this._updateAlternate(inst);
                this._updateDatepicker(inst);
            }
        },

        // Change method deprecated
        _changeDatepicker: function (target, name, value) {
            this._optionDatepicker(target, name, value);
        },

        /* Redraw the date picker attached to an input field or division.
         * @param  target  element - the target input field or division or span
         */
        _refreshDatepicker: function (target) {
            var inst = this._getInst(target);
            if (inst) {
                this._updateDatepicker(inst);
            }
        },

        /* Set the dates for a jQuery selection.
         * @param  target element - the target input field or division or span
         * @param  date	Date - the new date
         */
        _setDateDatepicker: function (target, date) {
            var inst = this._getInst(target);
            if (inst) {
                this._setDate(inst, date);
                this._updateDatepicker(inst);
                this._updateAlternate(inst);
            }
        },

        /* Get the date(s) for the first entry in a jQuery selection.
         * @param  target element - the target input field or division or span
         * @param  noDefault boolean - true if no default date is to be used
         * @return Date - the current date
         */
        _getDateDatepicker: function (target, noDefault) {
            var inst = this._getInst(target);
            if (inst && !inst.inline) {
                this._setDateFromField(inst, noDefault);
            }
            return (inst ? this._getDate(inst) : null);
        },

        /* Handle keystrokes. */
        _doKeyDown: function (event) {
            var onSelect, dateStr, sel,
                inst = $.datepicker._getInst(event.target),
                handled = true,
                isRTL = inst.dpDiv.is(".ui-datepicker-rtl");

            inst._keyEvent = true;
            if ($.datepicker._datepickerShowing) {
                switch (event.keyCode) {
                    case 9: $.datepicker._hideDatepicker();
                        handled = false;
                        break; // hide on tab out
                    case 13: sel = $("td." + $.datepicker._dayOverClass + ":not(." +
                        $.datepicker._currentClass + ")", inst.dpDiv);
                        if (sel[0]) {
                            $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
                        }

                        onSelect = $.datepicker._get(inst, "onSelect");
                        if (onSelect) {
                            dateStr = $.datepicker._formatDate(inst);

                            // Trigger custom callback
                            onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
                        } else {
                            $.datepicker._hideDatepicker();
                        }

                        return false; // don't submit the form
                    case 27: $.datepicker._hideDatepicker();
                        break; // hide on escape
                    case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
                        -$.datepicker._get(inst, "stepBigMonths") :
                        -$.datepicker._get(inst, "stepMonths")), "M");
                        break; // previous month/year on page up/+ ctrl
                    case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
                        +$.datepicker._get(inst, "stepBigMonths") :
                        +$.datepicker._get(inst, "stepMonths")), "M");
                        break; // next month/year on page down/+ ctrl
                    case 35: if (event.ctrlKey || event.metaKey) {
                        $.datepicker._clearDate(event.target);
                    }
                        handled = event.ctrlKey || event.metaKey;
                        break; // clear on ctrl or command +end
                    case 36: if (event.ctrlKey || event.metaKey) {
                        $.datepicker._gotoToday(event.target);
                    }
                        handled = event.ctrlKey || event.metaKey;
                        break; // current on ctrl or command +home
                    case 37: if (event.ctrlKey || event.metaKey) {
                        $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), "D");
                    }
                        handled = event.ctrlKey || event.metaKey;

                        // -1 day on ctrl or command +left
                        if (event.originalEvent.altKey) {
                            $.datepicker._adjustDate(event.target, (event.ctrlKey ?
                                -$.datepicker._get(inst, "stepBigMonths") :
                                -$.datepicker._get(inst, "stepMonths")), "M");
                        }

                        // next month/year on alt +left on Mac
                        break;
                    case 38: if (event.ctrlKey || event.metaKey) {
                        $.datepicker._adjustDate(event.target, -7, "D");
                    }
                        handled = event.ctrlKey || event.metaKey;
                        break; // -1 week on ctrl or command +up
                    case 39: if (event.ctrlKey || event.metaKey) {
                        $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), "D");
                    }
                        handled = event.ctrlKey || event.metaKey;

                        // +1 day on ctrl or command +right
                        if (event.originalEvent.altKey) {
                            $.datepicker._adjustDate(event.target, (event.ctrlKey ?
                                +$.datepicker._get(inst, "stepBigMonths") :
                                +$.datepicker._get(inst, "stepMonths")), "M");
                        }

                        // next month/year on alt +right
                        break;
                    case 40: if (event.ctrlKey || event.metaKey) {
                        $.datepicker._adjustDate(event.target, +7, "D");
                    }
                        handled = event.ctrlKey || event.metaKey;
                        break; // +1 week on ctrl or command +down
                    default: handled = false;
                }
            } else if (event.keyCode === 36 && event.ctrlKey) { // display the date picker on ctrl+home
                $.datepicker._showDatepicker(this);
            } else {
                handled = false;
            }

            if (handled) {
                event.preventDefault();
                event.stopPropagation();
            }
        },

        /* Filter entered characters - based on date format. */
        _doKeyPress: function (event) {
            var chars, chr,
                inst = $.datepicker._getInst(event.target);

            if ($.datepicker._get(inst, "constrainInput")) {
                chars = $.datepicker._possibleChars($.datepicker._get(inst, "dateFormat"));
                chr = String.fromCharCode(event.charCode == null ? event.keyCode : event.charCode);
                return event.ctrlKey || event.metaKey || (chr < " " || !chars || chars.indexOf(chr) > -1);
            }
        },

        /* Synchronise manual entry and field/alternate field. */
        _doKeyUp: function (event) {
            var date,
                inst = $.datepicker._getInst(event.target);

            if (inst.input.val() !== inst.lastVal) {
                try {
                    date = $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
                        (inst.input ? inst.input.val() : null),
                        $.datepicker._getFormatConfig(inst));

                    if (date) { // only if valid
                        $.datepicker._setDateFromField(inst);
                        $.datepicker._updateAlternate(inst);
                        $.datepicker._updateDatepicker(inst);
                    }
                }
                catch (err) {
                }
            }
            return true;
        },

        /* Pop-up the date picker for a given input field.
         * If false returned from beforeShow event handler do not show.
         * @param  input  element - the input field attached to the date picker or
         *					event - if triggered by focus
         */
        _showDatepicker: function (input) {
            input = input.target || input;
            if (input.nodeName.toLowerCase() !== "input") { // find from button/image trigger
                input = $("input", input.parentNode)[0];
            }

            if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput === input) { // already here
                return;
            }

            var inst, beforeShow, beforeShowSettings, isFixed,
                offset, showAnim, duration;

            inst = $.datepicker._getInst(input);
            if ($.datepicker._curInst && $.datepicker._curInst !== inst) {
                $.datepicker._curInst.dpDiv.stop(true, true);
                if (inst && $.datepicker._datepickerShowing) {
                    $.datepicker._hideDatepicker($.datepicker._curInst.input[0]);
                }
            }

            beforeShow = $.datepicker._get(inst, "beforeShow");
            beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
            if (beforeShowSettings === false) {
                return;
            }
            datepicker_extendRemove(inst.settings, beforeShowSettings);

            inst.lastVal = null;
            $.datepicker._lastInput = input;
            $.datepicker._setDateFromField(inst);

            if ($.datepicker._inDialog) { // hide cursor
                input.value = "";
            }
            if (!$.datepicker._pos) { // position below input
                $.datepicker._pos = $.datepicker._findPos(input);
                $.datepicker._pos[1] += input.offsetHeight; // add the height
            }

            isFixed = false;
            $(input).parents().each(function () {
                isFixed |= $(this).css("position") === "fixed";
                return !isFixed;
            });

            offset = { left: $.datepicker._pos[0], top: $.datepicker._pos[1] };
            $.datepicker._pos = null;

            //to avoid flashes on Firefox
            inst.dpDiv.empty();

            // determine sizing offscreen
            inst.dpDiv.css({ position: "absolute", display: "block", top: "-1000px" });
            $.datepicker._updateDatepicker(inst);

            // fix width for dynamic number of date pickers
            // and adjust position before showing
            offset = $.datepicker._checkOffset(inst, offset, isFixed);
            inst.dpDiv.css({
                position: ($.datepicker._inDialog && $.blockUI ?
                    "static" : (isFixed ? "fixed" : "absolute")), display: "none",
                left: offset.left + "px", top: offset.top + "px"
            });

            if (!inst.inline) {
                showAnim = $.datepicker._get(inst, "showAnim");
                duration = $.datepicker._get(inst, "duration");
                inst.dpDiv.css("z-index", datepicker_getZindex($(input)) + 1);
                $.datepicker._datepickerShowing = true;

                if ($.effects && $.effects.effect[showAnim]) {
                    inst.dpDiv.show(showAnim, $.datepicker._get(inst, "showOptions"), duration);
                } else {
                    inst.dpDiv[showAnim || "show"](showAnim ? duration : null);
                }

                if ($.datepicker._shouldFocusInput(inst)) {
                    inst.input.trigger("focus");
                }

                $.datepicker._curInst = inst;
            }
        },

        /* Generate the date picker content. */
        _updateDatepicker: function (inst) {
            this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
            datepicker_instActive = inst; // for delegate hover events
            inst.dpDiv.empty().append(this._generateHTML(inst));
            this._attachHandlers(inst);

            var origyearshtml,
                numMonths = this._getNumberOfMonths(inst),
                cols = numMonths[1],
                width = 17,
                activeCell = inst.dpDiv.find("." + this._dayOverClass + " a");

            if (activeCell.length > 0) {
                datepicker_handleMouseover.apply(activeCell.get(0));
            }

            inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");
            if (cols > 1) {
                inst.dpDiv.addClass("ui-datepicker-multi-" + cols).css("width", (width * cols) + "em");
            }
            inst.dpDiv[(numMonths[0] !== 1 || numMonths[1] !== 1 ? "add" : "remove") +
                "Class"]("ui-datepicker-multi");
            inst.dpDiv[(this._get(inst, "isRTL") ? "add" : "remove") +
                "Class"]("ui-datepicker-rtl");

            if (inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput(inst)) {
                inst.input.trigger("focus");
            }

            // Deffered render of the years select (to avoid flashes on Firefox)
            if (inst.yearshtml) {
                origyearshtml = inst.yearshtml;
                setTimeout(function () {

                    //assure that inst.yearshtml didn't change.
                    if (origyearshtml === inst.yearshtml && inst.yearshtml) {
                        inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml);
                    }
                    origyearshtml = inst.yearshtml = null;
                }, 0);
            }
        },

        // #6694 - don't focus the input if it's already focused
        // this breaks the change event in IE
        // Support: IE and jQuery <1.9
        _shouldFocusInput: function (inst) {
            return inst.input && inst.input.is(":visible") && !inst.input.is(":disabled") && !inst.input.is(":focus");
        },

        /* Check positioning to remain on screen. */
        _checkOffset: function (inst, offset, isFixed) {
            var dpWidth = inst.dpDiv.outerWidth(),
                dpHeight = inst.dpDiv.outerHeight(),
                inputWidth = inst.input ? inst.input.outerWidth() : 0,
                inputHeight = inst.input ? inst.input.outerHeight() : 0,
                viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()),
                viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());

            offset.left -= (this._get(inst, "isRTL") ? (dpWidth - inputWidth) : 0);
            offset.left -= (isFixed && offset.left === inst.input.offset().left) ? $(document).scrollLeft() : 0;
            offset.top -= (isFixed && offset.top === (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;

            // Now check if datepicker is showing outside window viewport - move to a better place if so.
            offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
                Math.abs(offset.left + dpWidth - viewWidth) : 0);
            offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
                Math.abs(dpHeight + inputHeight) : 0);

            return offset;
        },

        /* Find an object's position on the screen. */
        _findPos: function (obj) {
            var position,
                inst = this._getInst(obj),
                isRTL = this._get(inst, "isRTL");

            while (obj && (obj.type === "hidden" || obj.nodeType !== 1 || $.expr.filters.hidden(obj))) {
                obj = obj[isRTL ? "previousSibling" : "nextSibling"];
            }

            position = $(obj).offset();
            return [position.left, position.top];
        },

        /* Hide the date picker from view.
         * @param  input  element - the input field attached to the date picker
         */
        _hideDatepicker: function (input) {
            var showAnim, duration, postProcess, onClose,
                inst = this._curInst;

            if (!inst || (input && inst !== $.data(input, "datepicker"))) {
                return;
            }

            if (this._datepickerShowing) {
                showAnim = this._get(inst, "showAnim");
                duration = this._get(inst, "duration");
                postProcess = function () {
                    $.datepicker._tidyDialog(inst);
                };

                // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
                if ($.effects && ($.effects.effect[showAnim] || $.effects[showAnim])) {
                    inst.dpDiv.hide(showAnim, $.datepicker._get(inst, "showOptions"), duration, postProcess);
                } else {
                    inst.dpDiv[(showAnim === "slideDown" ? "slideUp" :
                        (showAnim === "fadeIn" ? "fadeOut" : "hide"))]((showAnim ? duration : null), postProcess);
                }

                if (!showAnim) {
                    postProcess();
                }
                this._datepickerShowing = false;

                onClose = this._get(inst, "onClose");
                if (onClose) {
                    onClose.apply((inst.input ? inst.input[0] : null), [(inst.input ? inst.input.val() : ""), inst]);
                }

                this._lastInput = null;
                if (this._inDialog) {
                    this._dialogInput.css({ position: "absolute", left: "0", top: "-100px" });
                    if ($.blockUI) {
                        $.unblockUI();
                        $("body").append(this.dpDiv);
                    }
                }
                this._inDialog = false;
            }
        },

        /* Tidy up after a dialog display. */
        _tidyDialog: function (inst) {
            inst.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar");
        },

        /* Close date picker if clicked elsewhere. */
        _checkExternalClick: function (event) {
            if (!$.datepicker._curInst) {
                return;
            }

            var $target = $(event.target),
                inst = $.datepicker._getInst($target[0]);

            if ((($target[0].id !== $.datepicker._mainDivId &&
                $target.parents("#" + $.datepicker._mainDivId).length === 0 &&
                !$target.hasClass($.datepicker.markerClassName) &&
                !$target.closest("." + $.datepicker._triggerClass).length &&
                $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))) ||
                ($target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst !== inst)) {
                $.datepicker._hideDatepicker();
            }
        },

        /* Adjust one of the date sub-fields. */
        _adjustDate: function (id, offset, period) {
            var target = $(id),
                inst = this._getInst(target[0]);

            if (this._isDisabledDatepicker(target[0])) {
                return;
            }
            this._adjustInstDate(inst, offset +
                (period === "M" ? this._get(inst, "showCurrentAtPos") : 0), // undo positioning
                period);
            this._updateDatepicker(inst);
        },

        /* Action for current link. */
        _gotoToday: function (id) {
            var date,
                target = $(id),
                inst = this._getInst(target[0]);

            if (this._get(inst, "gotoCurrent") && inst.currentDay) {
                inst.selectedDay = inst.currentDay;
                inst.drawMonth = inst.selectedMonth = inst.currentMonth;
                inst.drawYear = inst.selectedYear = inst.currentYear;
            } else {
                date = new Date();
                inst.selectedDay = date.getDate();
                inst.drawMonth = inst.selectedMonth = date.getMonth();
                inst.drawYear = inst.selectedYear = date.getFullYear();
            }
            this._notifyChange(inst);
            this._adjustDate(target);
        },

        /* Action for selecting a new month/year. */
        _selectMonthYear: function (id, select, period) {
            var target = $(id),
                inst = this._getInst(target[0]);

            inst["selected" + (period === "M" ? "Month" : "Year")] =
                inst["draw" + (period === "M" ? "Month" : "Year")] =
                parseInt(select.options[select.selectedIndex].value, 10);

            this._notifyChange(inst);
            this._adjustDate(target);
        },

        /* Action for selecting a day. */
        _selectDay: function (id, month, year, td) {
            var inst,
                target = $(id);

            if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
                return;
            }

            inst = this._getInst(target[0]);
            inst.selectedDay = inst.currentDay = $("a", td).html();
            inst.selectedMonth = inst.currentMonth = month;
            inst.selectedYear = inst.currentYear = year;
            this._selectDate(id, this._formatDate(inst,
                inst.currentDay, inst.currentMonth, inst.currentYear));
        },

        /* Erase the input field and hide the date picker. */
        _clearDate: function (id) {
            var target = $(id);
            this._selectDate(target, "");
        },

        /* Update the input field with the selected date. */
        _selectDate: function (id, dateStr) {
            var onSelect,
                target = $(id),
                inst = this._getInst(target[0]);

            dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
            if (inst.input) {
                inst.input.val(dateStr);
            }
            this._updateAlternate(inst);

            onSelect = this._get(inst, "onSelect");
            if (onSelect) {
                onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);  // trigger custom callback
            } else if (inst.input) {
                inst.input.trigger("change"); // fire the change event
            }

            if (inst.inline) {
                this._updateDatepicker(inst);
            } else {
                this._hideDatepicker();
                this._lastInput = inst.input[0];
                if (typeof (inst.input[0]) !== "object") {
                    inst.input.trigger("focus"); // restore focus
                }
                this._lastInput = null;
            }
        },

        /* Update any alternate field to synchronise with the main field. */
        _updateAlternate: function (inst) {
            var altFormat, date, dateStr,
                altField = this._get(inst, "altField");

            if (altField) { // update alternate field too
                altFormat = this._get(inst, "altFormat") || this._get(inst, "dateFormat");
                date = this._getDate(inst);
                dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
                $(altField).val(dateStr);
            }
        },

        /* Set as beforeShowDay function to prevent selection of weekends.
         * @param  date  Date - the date to customise
         * @return [boolean, string] - is this date selectable?, what is its CSS class?
         */
        noWeekends: function (date) {
            var day = date.getDay();
            return [(day > 0 && day < 6), ""];
        },

        /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
         * @param  date  Date - the date to get the week for
         * @return  number - the number of the week within the year that contains this date
         */
        iso8601Week: function (date) {
            var time,
                checkDate = new Date(date.getTime());

            // Find Thursday of this week starting on Monday
            checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));

            time = checkDate.getTime();
            checkDate.setMonth(0); // Compare with Jan 1
            checkDate.setDate(1);
            return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
        },

        /* Parse a string value into a date object.
         * See formatDate below for the possible formats.
         *
         * @param  format string - the expected format of the date
         * @param  value string - the date in the above format
         * @param  settings Object - attributes include:
         *					shortYearCutoff  number - the cutoff year for determining the century (optional)
         *					dayNamesShort	string[7] - abbreviated names of the days from Sunday (optional)
         *					dayNames		string[7] - names of the days from Sunday (optional)
         *					monthNamesShort string[12] - abbreviated names of the months (optional)
         *					monthNames		string[12] - names of the months (optional)
         * @return  Date - the extracted date value or null if value is blank
         */
        parseDate: function (format, value, settings) {
            if (format == null || value == null) {
                throw "Invalid arguments";
            }

            value = (typeof value === "object" ? value.toString() : value + "");
            if (value === "") {
                return null;
            }

            var iFormat, dim, extra,
                iValue = 0,
                shortYearCutoffTemp = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff,
                shortYearCutoff = (typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp :
                    new Date().getFullYear() % 100 + parseInt(shortYearCutoffTemp, 10)),
                dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
                dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
                monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
                monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,
                year = -1,
                month = -1,
                day = -1,
                doy = -1,
                literal = false,
                date,

                // Check whether a format character is doubled
                lookAhead = function (match) {
                    var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
                    if (matches) {
                        iFormat++;
                    }
                    return matches;
                },

                // Extract a number from the string value
                getNumber = function (match) {
                    var isDoubled = lookAhead(match),
                        size = (match === "@" ? 14 : (match === "!" ? 20 :
                            (match === "y" && isDoubled ? 4 : (match === "o" ? 3 : 2)))),
                        minSize = (match === "y" ? size : 1),
                        digits = new RegExp("^\\d{" + minSize + "," + size + "}"),
                        num = value.substring(iValue).match(digits);
                    if (!num) {
                        throw "Missing number at position " + iValue;
                    }
                    iValue += num[0].length;
                    return parseInt(num[0], 10);
                },

                // Extract a name from the string value and convert to an index
                getName = function (match, shortNames, longNames) {
                    var index = -1,
                        names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
                            return [[k, v]];
                        }).sort(function (a, b) {
                            return -(a[1].length - b[1].length);
                        });

                    $.each(names, function (i, pair) {
                        var name = pair[1];
                        if (value.substr(iValue, name.length).toLowerCase() === name.toLowerCase()) {
                            index = pair[0];
                            iValue += name.length;
                            return false;
                        }
                    });
                    if (index !== -1) {
                        return index + 1;
                    } else {
                        throw "Unknown name at position " + iValue;
                    }
                },

                // Confirm that a literal character matches the string value
                checkLiteral = function () {
                    if (value.charAt(iValue) !== format.charAt(iFormat)) {
                        throw "Unexpected literal at position " + iValue;
                    }
                    iValue++;
                };

            for (iFormat = 0; iFormat < format.length; iFormat++) {
                if (literal) {
                    if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
                        literal = false;
                    } else {
                        checkLiteral();
                    }
                } else {
                    switch (format.charAt(iFormat)) {
                        case "d":
                            day = getNumber("d");
                            break;
                        case "D":
                            getName("D", dayNamesShort, dayNames);
                            break;
                        case "o":
                            doy = getNumber("o");
                            break;
                        case "m":
                            month = getNumber("m");
                            break;
                        case "M":
                            month = getName("M", monthNamesShort, monthNames);
                            break;
                        case "y":
                            year = getNumber("y");
                            break;
                        case "@":
                            date = new Date(getNumber("@"));
                            year = date.getFullYear();
                            month = date.getMonth() + 1;
                            day = date.getDate();
                            break;
                        case "!":
                            date = new Date((getNumber("!") - this._ticksTo1970) / 10000);
                            year = date.getFullYear();
                            month = date.getMonth() + 1;
                            day = date.getDate();
                            break;
                        case "'":
                            if (lookAhead("'")) {
                                checkLiteral();
                            } else {
                                literal = true;
                            }
                            break;
                        default:
                            checkLiteral();
                    }
                }
            }

            if (iValue < value.length) {
                extra = value.substr(iValue);
                if (!/^\s+/.test(extra)) {
                    throw "Extra/unparsed characters found in date: " + extra;
                }
            }

            if (year === -1) {
                year = new Date().getFullYear();
            } else if (year < 100) {
                year += new Date().getFullYear() - new Date().getFullYear() % 100 +
                    (year <= shortYearCutoff ? 0 : -100);
            }

            if (doy > -1) {
                month = 1;
                day = doy;
                do {
                    dim = this._getDaysInMonth(year, month - 1);
                    if (day <= dim) {
                        break;
                    }
                    month++;
                    day -= dim;
                } while (true);
            }

            date = this._daylightSavingAdjust(new Date(year, month - 1, day));
            if (date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day) {
                throw "Invalid date"; // E.g. 31/02/00
            }
            return date;
        },

        /* Standard date formats. */
        ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601)
        COOKIE: "D, dd M yy",
        ISO_8601: "yy-mm-dd",
        RFC_822: "D, d M y",
        RFC_850: "DD, dd-M-y",
        RFC_1036: "D, d M y",
        RFC_1123: "D, d M yy",
        RFC_2822: "D, d M yy",
        RSS: "D, d M y", // RFC 822
        TICKS: "!",
        TIMESTAMP: "@",
        W3C: "yy-mm-dd", // ISO 8601

        _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
            Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),

        /* Format a date object into a string value.
         * The format can be combinations of the following:
         * d  - day of month (no leading zero)
         * dd - day of month (two digit)
         * o  - day of year (no leading zeros)
         * oo - day of year (three digit)
         * D  - day name short
         * DD - day name long
         * m  - month of year (no leading zero)
         * mm - month of year (two digit)
         * M  - month name short
         * MM - month name long
         * y  - year (two digit)
         * yy - year (four digit)
         * @ - Unix timestamp (ms since 01/01/1970)
         * ! - Windows ticks (100ns since 01/01/0001)
         * "..." - literal text
         * '' - single quote
         *
         * @param  format string - the desired format of the date
         * @param  date Date - the date value to format
         * @param  settings Object - attributes include:
         *					dayNamesShort	string[7] - abbreviated names of the days from Sunday (optional)
         *					dayNames		string[7] - names of the days from Sunday (optional)
         *					monthNamesShort string[12] - abbreviated names of the months (optional)
         *					monthNames		string[12] - names of the months (optional)
         * @return  string - the date in the above format
         */
        formatDate: function (format, date, settings) {
            if (!date) {
                return "";
            }

            var iFormat,
                dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort,
                dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames,
                monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort,
                monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames,

                // Check whether a format character is doubled
                lookAhead = function (match) {
                    var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
                    if (matches) {
                        iFormat++;
                    }
                    return matches;
                },

                // Format a number, with leading zero if necessary
                formatNumber = function (match, value, len) {
                    var num = "" + value;
                    if (lookAhead(match)) {
                        while (num.length < len) {
                            num = "0" + num;
                        }
                    }
                    return num;
                },

                // Format a name, short or long as requested
                formatName = function (match, value, shortNames, longNames) {
                    return (lookAhead(match) ? longNames[value] : shortNames[value]);
                },
                output = "",
                literal = false;

            if (date) {
                for (iFormat = 0; iFormat < format.length; iFormat++) {
                    if (literal) {
                        if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
                            literal = false;
                        } else {
                            output += format.charAt(iFormat);
                        }
                    } else {
                        switch (format.charAt(iFormat)) {
                            case "d":
                                output += formatNumber("d", date.getDate(), 2);
                                break;
                            case "D":
                                output += formatName("D", date.getDay(), dayNamesShort, dayNames);
                                break;
                            case "o":
                                output += formatNumber("o",
                                    Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
                                break;
                            case "m":
                                output += formatNumber("m", date.getMonth() + 1, 2);
                                break;
                            case "M":
                                output += formatName("M", date.getMonth(), monthNamesShort, monthNames);
                                break;
                            case "y":
                                output += (lookAhead("y") ? date.getFullYear() :
                                    (date.getFullYear() % 100 < 10 ? "0" : "") + date.getFullYear() % 100);
                                break;
                            case "@":
                                output += date.getTime();
                                break;
                            case "!":
                                output += date.getTime() * 10000 + this._ticksTo1970;
                                break;
                            case "'":
                                if (lookAhead("'")) {
                                    output += "'";
                                } else {
                                    literal = true;
                                }
                                break;
                            default:
                                output += format.charAt(iFormat);
                        }
                    }
                }
            }
            return output;
        },

        /* Extract all possible characters from the date format. */
        _possibleChars: function (format) {
            var iFormat,
                chars = "",
                literal = false,

                // Check whether a format character is doubled
                lookAhead = function (match) {
                    var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) === match);
                    if (matches) {
                        iFormat++;
                    }
                    return matches;
                };

            for (iFormat = 0; iFormat < format.length; iFormat++) {
                if (literal) {
                    if (format.charAt(iFormat) === "'" && !lookAhead("'")) {
                        literal = false;
                    } else {
                        chars += format.charAt(iFormat);
                    }
                } else {
                    switch (format.charAt(iFormat)) {
                        case "d": case "m": case "y": case "@":
                            chars += "0123456789";
                            break;
                        case "D": case "M":
                            return null; // Accept anything
                        case "'":
                            if (lookAhead("'")) {
                                chars += "'";
                            } else {
                                literal = true;
                            }
                            break;
                        default:
                            chars += format.charAt(iFormat);
                    }
                }
            }
            return chars;
        },

        /* Get a setting value, defaulting if necessary. */
        _get: function (inst, name) {
            return inst.settings[name] !== undefined ?
                inst.settings[name] : this._defaults[name];
        },

        /* Parse existing date and initialise date picker. */
        _setDateFromField: function (inst, noDefault) {
            if (inst.input.val() === inst.lastVal) {
                return;
            }

            var dateFormat = this._get(inst, "dateFormat"),
                dates = inst.lastVal = inst.input ? inst.input.val() : null,
                defaultDate = this._getDefaultDate(inst),
                date = defaultDate,
                settings = this._getFormatConfig(inst);

            try {
                date = this.parseDate(dateFormat, dates, settings) || defaultDate;
            } catch (event) {
                dates = (noDefault ? "" : dates);
            }
            inst.selectedDay = date.getDate();
            inst.drawMonth = inst.selectedMonth = date.getMonth();
            inst.drawYear = inst.selectedYear = date.getFullYear();
            inst.currentDay = (dates ? date.getDate() : 0);
            inst.currentMonth = (dates ? date.getMonth() : 0);
            inst.currentYear = (dates ? date.getFullYear() : 0);
            this._adjustInstDate(inst);
        },

        /* Retrieve the default date shown on opening. */
        _getDefaultDate: function (inst) {
            return this._restrictMinMax(inst,
                this._determineDate(inst, this._get(inst, "defaultDate"), new Date()));
        },

        /* A date may be specified as an exact value or a relative one. */
        _determineDate: function (inst, date, defaultDate) {
            var offsetNumeric = function (offset) {
                var date = new Date();
                date.setDate(date.getDate() + offset);
                return date;
            },
                offsetString = function (offset) {
                    try {
                        return $.datepicker.parseDate($.datepicker._get(inst, "dateFormat"),
                            offset, $.datepicker._getFormatConfig(inst));
                    }
                    catch (e) {

                        // Ignore
                    }

                    var date = (offset.toLowerCase().match(/^c/) ?
                        $.datepicker._getDate(inst) : null) || new Date(),
                        year = date.getFullYear(),
                        month = date.getMonth(),
                        day = date.getDate(),
                        pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,
                        matches = pattern.exec(offset);

                    while (matches) {
                        switch (matches[2] || "d") {
                            case "d": case "D":
                                day += parseInt(matches[1], 10); break;
                            case "w": case "W":
                                day += parseInt(matches[1], 10) * 7; break;
                            case "m": case "M":
                                month += parseInt(matches[1], 10);
                                day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
                                break;
                            case "y": case "Y":
                                year += parseInt(matches[1], 10);
                                day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
                                break;
                        }
                        matches = pattern.exec(offset);
                    }
                    return new Date(year, month, day);
                },
                newDate = (date == null || date === "" ? defaultDate : (typeof date === "string" ? offsetString(date) :
                    (typeof date === "number" ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));

            newDate = (newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate);
            if (newDate) {
                newDate.setHours(0);
                newDate.setMinutes(0);
                newDate.setSeconds(0);
                newDate.setMilliseconds(0);
            }
            return this._daylightSavingAdjust(newDate);
        },

        /* Handle switch to/from daylight saving.
         * Hours may be non-zero on daylight saving cut-over:
         * > 12 when midnight changeover, but then cannot generate
         * midnight datetime, so jump to 1AM, otherwise reset.
         * @param  date  (Date) the date to check
         * @return  (Date) the corrected date
         */
        _daylightSavingAdjust: function (date) {
            if (!date) {
                return null;
            }
            date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
            return date;
        },

        /* Set the date(s) directly. */
        _setDate: function (inst, date, noChange) {
            var clear = !date,
                origMonth = inst.selectedMonth,
                origYear = inst.selectedYear,
                newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));

            inst.selectedDay = inst.currentDay = newDate.getDate();
            inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
            inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
            if ((origMonth !== inst.selectedMonth || origYear !== inst.selectedYear) && !noChange) {
                this._notifyChange(inst);
            }
            this._adjustInstDate(inst);
            if (inst.input) {
                inst.input.val(clear ? "" : this._formatDate(inst));
            }
        },

        /* Retrieve the date(s) directly. */
        _getDate: function (inst) {
            var startDate = (!inst.currentYear || (inst.input && inst.input.val() === "") ? null :
                this._daylightSavingAdjust(new Date(
                    inst.currentYear, inst.currentMonth, inst.currentDay)));
            return startDate;
        },

        /* Attach the onxxx handlers.  These are declared statically so
         * they work with static code transformers like Caja.
         */
        _attachHandlers: function (inst) {
            var stepMonths = this._get(inst, "stepMonths"),
                id = "#" + inst.id.replace(/\\\\/g, "\\");
            inst.dpDiv.find("[data-handler]").map(function () {
                var handler = {
                    prev: function () {
                        $.datepicker._adjustDate(id, -stepMonths, "M");
                    },
                    next: function () {
                        $.datepicker._adjustDate(id, +stepMonths, "M");
                    },
                    hide: function () {
                        $.datepicker._hideDatepicker();
                    },
                    today: function () {
                        $.datepicker._gotoToday(id);
                    },
                    selectDay: function () {
                        $.datepicker._selectDay(id, +this.getAttribute("data-month"), +this.getAttribute("data-year"), this);
                        return false;
                    },
                    selectMonth: function () {
                        $.datepicker._selectMonthYear(id, this, "M");
                        return false;
                    },
                    selectYear: function () {
                        $.datepicker._selectMonthYear(id, this, "Y");
                        return false;
                    }
                };
                $(this).on(this.getAttribute("data-event"), handler[this.getAttribute("data-handler")]);
            });
        },

        /* Generate the HTML for the current state of the date picker. */
        _generateHTML: function (inst) {
            var maxDraw, prevText, prev, nextText, next, currentText, gotoDate,
                controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin,
                monthNames, monthNamesShort, beforeShowDay, showOtherMonths,
                selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate,
                cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows,
                printDate, dRow, tbody, daySettings, otherMonth, unselectable,
                tempDate = new Date(),
                today = this._daylightSavingAdjust(
                    new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate())), // clear time
                isRTL = this._get(inst, "isRTL"),
                showButtonPanel = this._get(inst, "showButtonPanel"),
                hideIfNoPrevNext = this._get(inst, "hideIfNoPrevNext"),
                navigationAsDateFormat = this._get(inst, "navigationAsDateFormat"),
                numMonths = this._getNumberOfMonths(inst),
                showCurrentAtPos = this._get(inst, "showCurrentAtPos"),
                stepMonths = this._get(inst, "stepMonths"),
                isMultiMonth = (numMonths[0] !== 1 || numMonths[1] !== 1),
                currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
                    new Date(inst.currentYear, inst.currentMonth, inst.currentDay))),
                minDate = this._getMinMaxDate(inst, "min"),
                maxDate = this._getMinMaxDate(inst, "max"),
                drawMonth = inst.drawMonth - showCurrentAtPos,
                drawYear = inst.drawYear;

            if (drawMonth < 0) {
                drawMonth += 12;
                drawYear--;
            }
            if (maxDate) {
                maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
                    maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
                maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
                while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
                    drawMonth--;
                    if (drawMonth < 0) {
                        drawMonth = 11;
                        drawYear--;
                    }
                }
            }
            inst.drawMonth = drawMonth;
            inst.drawYear = drawYear;

            prevText = this._get(inst, "prevText");
            prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
                this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
                this._getFormatConfig(inst)));

            prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
                "<a class='ui-datepicker-prev ui-corner-all' data-handler='prev' data-event='click'" +
                " title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + (isRTL ? "e" : "w") + "'>" + prevText + "</span></a>" :
                (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-prev ui-corner-all ui-state-disabled' title='" + prevText + "'><span class='ui-icon ui-icon-circle-triangle-" + (isRTL ? "e" : "w") + "'>" + prevText + "</span></a>"));

            nextText = this._get(inst, "nextText");
            nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
                this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
                this._getFormatConfig(inst)));

            next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
                "<a class='ui-datepicker-next ui-corner-all' data-handler='next' data-event='click'" +
                " title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + (isRTL ? "w" : "e") + "'>" + nextText + "</span></a>" :
                (hideIfNoPrevNext ? "" : "<a class='ui-datepicker-next ui-corner-all ui-state-disabled' title='" + nextText + "'><span class='ui-icon ui-icon-circle-triangle-" + (isRTL ? "w" : "e") + "'>" + nextText + "</span></a>"));

            currentText = this._get(inst, "currentText");
            gotoDate = (this._get(inst, "gotoCurrent") && inst.currentDay ? currentDate : today);
            currentText = (!navigationAsDateFormat ? currentText :
                this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));

            controls = (!inst.inline ? "<button type='button' class='ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all' data-handler='hide' data-event='click'>" +
                this._get(inst, "closeText") + "</button>" : "");

            buttonPanel = (showButtonPanel) ? "<div class='ui-datepicker-buttonpane ui-widget-content'>" + (isRTL ? controls : "") +
                (this._isInRange(inst, gotoDate) ? "<button type='button' class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all' data-handler='today' data-event='click'" +
                    ">" + currentText + "</button>" : "") + (isRTL ? "" : controls) + "</div>" : "";

            firstDay = parseInt(this._get(inst, "firstDay"), 10);
            firstDay = (isNaN(firstDay) ? 0 : firstDay);

            showWeek = this._get(inst, "showWeek");
            dayNames = this._get(inst, "dayNames");
            dayNamesMin = this._get(inst, "dayNamesMin");
            monthNames = this._get(inst, "monthNames");
            monthNamesShort = this._get(inst, "monthNamesShort");
            beforeShowDay = this._get(inst, "beforeShowDay");
            showOtherMonths = this._get(inst, "showOtherMonths");
            selectOtherMonths = this._get(inst, "selectOtherMonths");
            defaultDate = this._getDefaultDate(inst);
            html = "";

            for (row = 0; row < numMonths[0]; row++) {
                group = "";
                this.maxRows = 4;
                for (col = 0; col < numMonths[1]; col++) {
                    selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
                    cornerClass = " ui-corner-all";
                    calender = "";
                    if (isMultiMonth) {
                        calender += "<div class='ui-datepicker-group";
                        if (numMonths[1] > 1) {
                            switch (col) {
                                case 0: calender += " ui-datepicker-group-first";
                                    cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break;
                                case numMonths[1] - 1: calender += " ui-datepicker-group-last";
                                    cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break;
                                default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break;
                            }
                        }
                        calender += "'>";
                    }
                    calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" +
                        (/all|left/.test(cornerClass) && row === 0 ? (isRTL ? next : prev) : "") +
                        (/all|right/.test(cornerClass) && row === 0 ? (isRTL ? prev : next) : "") +
                        this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
                            row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
                        "</div><table class='ui-datepicker-calendar'><thead>" +
                        "<tr>";
                    thead = (showWeek ? "<th class='ui-datepicker-week-col'>" + this._get(inst, "weekHeader") + "</th>" : "");
                    for (dow = 0; dow < 7; dow++) { // days of the week
                        day = (dow + firstDay) % 7;
                        thead += "<th scope='col'" + ((dow + firstDay + 6) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "") + ">" +
                            "<span title='" + dayNames[day] + "'>" + dayNamesMin[day] + "</span></th>";
                    }
                    calender += thead + "</tr></thead><tbody>";
                    daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
                    if (drawYear === inst.selectedYear && drawMonth === inst.selectedMonth) {
                        inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
                    }
                    leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
                    curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
                    numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
                    this.maxRows = numRows;
                    printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
                    for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows
                        calender += "<tr>";
                        tbody = (!showWeek ? "" : "<td class='ui-datepicker-week-col'>" +
                            this._get(inst, "calculateWeek")(printDate) + "</td>");
                        for (dow = 0; dow < 7; dow++) { // create date picker days
                            daySettings = (beforeShowDay ?
                                beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, ""]);
                            otherMonth = (printDate.getMonth() !== drawMonth);
                            unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
                                (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
                            tbody += "<td class='" +
                                ((dow + firstDay + 6) % 7 >= 5 ? " ui-datepicker-week-end" : "") + // highlight weekends
                                (otherMonth ? " ui-datepicker-other-month" : "") + // highlight days from other months
                                ((printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent) || // user pressed key
                                    (defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime()) ?

                                    // or defaultDate is current printedDate and defaultDate is selectedDate
                                    " " + this._dayOverClass : "") + // highlight selected day
                                (unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "") +  // highlight unselectable days
                                (otherMonth && !showOtherMonths ? "" : " " + daySettings[1] + // highlight custom dates
                                    (printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "") + // highlight selected day
                                    (printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "")) + "'" + // highlight today (if different)
                                ((!otherMonth || showOtherMonths) && daySettings[2] ? " title='" + daySettings[2].replace(/'/g, "&#39;") + "'" : "") + // cell title
                                (unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'") + ">" + // actions
                                (otherMonth && !showOtherMonths ? "&#xa0;" : // display for other months
                                    (unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" +
                                        (printDate.getTime() === today.getTime() ? " ui-state-highlight" : "") +
                                        (printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "") + // highlight selected day
                                        (otherMonth ? " ui-priority-secondary" : "") + // distinguish dates from other months
                                        "' href='#'>" + printDate.getDate() + "</a>")) + "</td>"; // display selectable date
                            printDate.setDate(printDate.getDate() + 1);
                            printDate = this._daylightSavingAdjust(printDate);
                        }
                        calender += tbody + "</tr>";
                    }
                    drawMonth++;
                    if (drawMonth > 11) {
                        drawMonth = 0;
                        drawYear++;
                    }
                    calender += "</tbody></table>" + (isMultiMonth ? "</div>" +
                        ((numMonths[0] > 0 && col === numMonths[1] - 1) ? "<div class='ui-datepicker-row-break'></div>" : "") : "");
                    group += calender;
                }
                html += group;
            }
            html += buttonPanel;
            inst._keyEvent = false;
            return html;
        },

        /* Generate the month and year header. */
        _generateMonthYearHeader: function (inst, drawMonth, drawYear, minDate, maxDate,
            secondary, monthNames, monthNamesShort) {

            var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
                changeMonth = this._get(inst, "changeMonth"),
                changeYear = this._get(inst, "changeYear"),
                showMonthAfterYear = this._get(inst, "showMonthAfterYear"),
                html = "<div class='ui-datepicker-title'>",
                monthHtml = "";

            // Month selection
            if (secondary || !changeMonth) {
                monthHtml += "<span class='ui-datepicker-month'>" + monthNames[drawMonth] + "</span>";
            } else {
                inMinYear = (minDate && minDate.getFullYear() === drawYear);
                inMaxYear = (maxDate && maxDate.getFullYear() === drawYear);
                monthHtml += "<select class='ui-datepicker-month' data-handler='selectMonth' data-event='change'>";
                for (month = 0; month < 12; month++) {
                    if ((!inMinYear || month >= minDate.getMonth()) && (!inMaxYear || month <= maxDate.getMonth())) {
                        monthHtml += "<option value='" + month + "'" +
                            (month === drawMonth ? " selected='selected'" : "") +
                            ">" + monthNamesShort[month] + "</option>";
                    }
                }
                monthHtml += "</select>";
            }

            if (!showMonthAfterYear) {
                html += monthHtml + (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "");
            }

            // Year selection
            if (!inst.yearshtml) {
                inst.yearshtml = "";
                if (secondary || !changeYear) {
                    html += "<span class='ui-datepicker-year'>" + drawYear + "</span>";
                } else {

                    // determine range of years to display
                    years = this._get(inst, "yearRange").split(":");
                    thisYear = new Date().getFullYear();
                    determineYear = function (value) {
                        var year = (value.match(/c[+\-].*/) ? drawYear + parseInt(value.substring(1), 10) :
                            (value.match(/[+\-].*/) ? thisYear + parseInt(value, 10) :
                                parseInt(value, 10)));
                        return (isNaN(year) ? thisYear : year);
                    };
                    year = determineYear(years[0]);
                    endYear = Math.max(year, determineYear(years[1] || ""));
                    year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
                    endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
                    inst.yearshtml += "<select class='ui-datepicker-year' data-handler='selectYear' data-event='change'>";
                    for (; year <= endYear; year++) {
                        inst.yearshtml += "<option value='" + year + "'" +
                            (year === drawYear ? " selected='selected'" : "") +
                            ">" + year + "</option>";
                    }
                    inst.yearshtml += "</select>";

                    html += inst.yearshtml;
                    inst.yearshtml = null;
                }
            }

            html += this._get(inst, "yearSuffix");
            if (showMonthAfterYear) {
                html += (secondary || !(changeMonth && changeYear) ? "&#xa0;" : "") + monthHtml;
            }
            html += "</div>"; // Close datepicker_header
            return html;
        },

        /* Adjust one of the date sub-fields. */
        _adjustInstDate: function (inst, offset, period) {
            var year = inst.selectedYear + (period === "Y" ? offset : 0),
                month = inst.selectedMonth + (period === "M" ? offset : 0),
                day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) + (period === "D" ? offset : 0),
                date = this._restrictMinMax(inst, this._daylightSavingAdjust(new Date(year, month, day)));

            inst.selectedDay = date.getDate();
            inst.drawMonth = inst.selectedMonth = date.getMonth();
            inst.drawYear = inst.selectedYear = date.getFullYear();
            if (period === "M" || period === "Y") {
                this._notifyChange(inst);
            }
        },

        /* Ensure a date is within any min/max bounds. */
        _restrictMinMax: function (inst, date) {
            var minDate = this._getMinMaxDate(inst, "min"),
                maxDate = this._getMinMaxDate(inst, "max"),
                newDate = (minDate && date < minDate ? minDate : date);
            return (maxDate && newDate > maxDate ? maxDate : newDate);
        },

        /* Notify change of month/year. */
        _notifyChange: function (inst) {
            var onChange = this._get(inst, "onChangeMonthYear");
            if (onChange) {
                onChange.apply((inst.input ? inst.input[0] : null),
                    [inst.selectedYear, inst.selectedMonth + 1, inst]);
            }
        },

        /* Determine the number of months to show. */
        _getNumberOfMonths: function (inst) {
            var numMonths = this._get(inst, "numberOfMonths");
            return (numMonths == null ? [1, 1] : (typeof numMonths === "number" ? [1, numMonths] : numMonths));
        },

        /* Determine the current maximum date - ensure no time components are set. */
        _getMinMaxDate: function (inst, minMax) {
            return this._determineDate(inst, this._get(inst, minMax + "Date"), null);
        },

        /* Find the number of days in a given month. */
        _getDaysInMonth: function (year, month) {
            return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
        },

        /* Find the day of the week of the first of a month. */
        _getFirstDayOfMonth: function (year, month) {
            return new Date(year, month, 1).getDay();
        },

        /* Determines if we should allow a "next/prev" month display change. */
        _canAdjustMonth: function (inst, offset, curYear, curMonth) {
            var numMonths = this._getNumberOfMonths(inst),
                date = this._daylightSavingAdjust(new Date(curYear,
                    curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));

            if (offset < 0) {
                date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
            }
            return this._isInRange(inst, date);
        },

        /* Is the given date in the accepted range? */
        _isInRange: function (inst, date) {
            var yearSplit, currentYear,
                minDate = this._getMinMaxDate(inst, "min"),
                maxDate = this._getMinMaxDate(inst, "max"),
                minYear = null,
                maxYear = null,
                years = this._get(inst, "yearRange");
            if (years) {
                yearSplit = years.split(":");
                currentYear = new Date().getFullYear();
                minYear = parseInt(yearSplit[0], 10);
                maxYear = parseInt(yearSplit[1], 10);
                if (yearSplit[0].match(/[+\-].*/)) {
                    minYear += currentYear;
                }
                if (yearSplit[1].match(/[+\-].*/)) {
                    maxYear += currentYear;
                }
            }

            return ((!minDate || date.getTime() >= minDate.getTime()) &&
                (!maxDate || date.getTime() <= maxDate.getTime()) &&
                (!minYear || date.getFullYear() >= minYear) &&
                (!maxYear || date.getFullYear() <= maxYear));
        },

        /* Provide the configuration settings for formatting/parsing. */
        _getFormatConfig: function (inst) {
            var shortYearCutoff = this._get(inst, "shortYearCutoff");
            shortYearCutoff = (typeof shortYearCutoff !== "string" ? shortYearCutoff :
                new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
            return {
                shortYearCutoff: shortYearCutoff,
                dayNamesShort: this._get(inst, "dayNamesShort"), dayNames: this._get(inst, "dayNames"),
                monthNamesShort: this._get(inst, "monthNamesShort"), monthNames: this._get(inst, "monthNames")
            };
        },

        /* Format the given date for display. */
        _formatDate: function (inst, day, month, year) {
            if (!day) {
                inst.currentDay = inst.selectedDay;
                inst.currentMonth = inst.selectedMonth;
                inst.currentYear = inst.selectedYear;
            }
            var date = (day ? (typeof day === "object" ? day :
                this._daylightSavingAdjust(new Date(year, month, day))) :
                this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
            return this.formatDate(this._get(inst, "dateFormat"), date, this._getFormatConfig(inst));
        }
    });

    /*
     * Bind hover events for datepicker elements.
     * Done via delegate so the binding only occurs once in the lifetime of the parent div.
     * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
     */
    function datepicker_bindHover(dpDiv) {
        var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";
        return dpDiv.on("mouseout", selector, function () {
            $(this).removeClass("ui-state-hover");
            if (this.className.indexOf("ui-datepicker-prev") !== -1) {
                $(this).removeClass("ui-datepicker-prev-hover");
            }
            if (this.className.indexOf("ui-datepicker-next") !== -1) {
                $(this).removeClass("ui-datepicker-next-hover");
            }
        })
            .on("mouseover", selector, datepicker_handleMouseover);
    }

    function datepicker_handleMouseover() {
        if (!$.datepicker._isDisabledDatepicker(datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[0] : datepicker_instActive.input[0])) {
            $(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
            $(this).addClass("ui-state-hover");
            if (this.className.indexOf("ui-datepicker-prev") !== -1) {
                $(this).addClass("ui-datepicker-prev-hover");
            }
            if (this.className.indexOf("ui-datepicker-next") !== -1) {
                $(this).addClass("ui-datepicker-next-hover");
            }
        }
    }

    /* jQuery extend now ignores nulls! */
    function datepicker_extendRemove(target, props) {
        $.extend(target, props);
        for (var name in props) {
            if (props[name] == null) {
                target[name] = props[name];
            }
        }
        return target;
    }

    /* Invoke the datepicker functionality.
       @param  options  string - a command, optionally followed by additional parameters or
                        Object - settings for attaching new datepicker functionality
       @return  jQuery object */
    $.fn.datepicker = function (options) {

        /* Verify an empty collection wasn't passed - Fixes #6976 */
        if (!this.length) {
            return this;
        }

        /* Initialise the date picker. */
        if (!$.datepicker.initialized) {
            $(document).on("mousedown", $.datepicker._checkExternalClick);
            $.datepicker.initialized = true;
        }

        /* Append datepicker main container to body if not exist. */
        if ($("#" + $.datepicker._mainDivId).length === 0) {
            $("body").append($.datepicker.dpDiv);
        }

        var otherArgs = Array.prototype.slice.call(arguments, 1);
        if (typeof options === "string" && (options === "isDisabled" || options === "getDate" || options === "widget")) {
            return $.datepicker["_" + options + "Datepicker"].
                apply($.datepicker, [this[0]].concat(otherArgs));
        }
        if (options === "option" && arguments.length === 2 && typeof arguments[1] === "string") {
            return $.datepicker["_" + options + "Datepicker"].
                apply($.datepicker, [this[0]].concat(otherArgs));
        }
        return this.each(function () {
            typeof options === "string" ?
                $.datepicker["_" + options + "Datepicker"].
                    apply($.datepicker, [this].concat(otherArgs)) :
                $.datepicker._attachDatepicker(this, options);
        });
    };

    $.datepicker = new Datepicker(); // singleton instance
    $.datepicker.initialized = false;
    $.datepicker.uuid = new Date().getTime();
    $.datepicker.version = "1.12.1";

    var widgetsDatepicker = $.datepicker;


    /*!
     * jQuery UI Dialog 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Dialog
    //>>group: Widgets
    //>>description: Displays customizable dialog windows.
    //>>docs: http://api.jqueryui.com/dialog/
    //>>demos: http://jqueryui.com/dialog/
    //>>css.structure: ../../themes/base/core.css
    //>>css.structure: ../../themes/base/dialog.css
    //>>css.theme: ../../themes/base/theme.css



    $.widget("ui.dialog", {
        version: "1.12.1",
        options: {
            appendTo: "body",
            autoOpen: true,
            buttons: [],
            classes: {
                "ui-dialog": "ui-corner-all",
                "ui-dialog-titlebar": "ui-corner-all"
            },
            closeOnEscape: true,
            closeText: "Close",
            draggable: true,
            hide: null,
            height: "auto",
            maxHeight: null,
            maxWidth: null,
            minHeight: 150,
            minWidth: 150,
            modal: false,
            position: {
                my: "center",
                at: "center",
                of: window,
                collision: "fit",

                // Ensure the titlebar is always visible
                using: function (pos) {
                    var topOffset = $(this).css(pos).offset().top;
                    if (topOffset < 0) {
                        $(this).css("top", pos.top - topOffset);
                    }
                }
            },
            resizable: true,
            show: null,
            title: null,
            width: 300,

            // Callbacks
            beforeClose: null,
            close: null,
            drag: null,
            dragStart: null,
            dragStop: null,
            focus: null,
            open: null,
            resize: null,
            resizeStart: null,
            resizeStop: null
        },

        sizeRelatedOptions: {
            buttons: true,
            height: true,
            maxHeight: true,
            maxWidth: true,
            minHeight: true,
            minWidth: true,
            width: true
        },

        resizableRelatedOptions: {
            maxHeight: true,
            maxWidth: true,
            minHeight: true,
            minWidth: true
        },

        _create: function () {
            this.originalCss = {
                display: this.element[0].style.display,
                width: this.element[0].style.width,
                minHeight: this.element[0].style.minHeight,
                maxHeight: this.element[0].style.maxHeight,
                height: this.element[0].style.height
            };
            this.originalPosition = {
                parent: this.element.parent(),
                index: this.element.parent().children().index(this.element)
            };
            this.originalTitle = this.element.attr("title");
            if (this.options.title == null && this.originalTitle != null) {
                this.options.title = this.originalTitle;
            }

            // Dialogs can't be disabled
            if (this.options.disabled) {
                this.options.disabled = false;
            }

            this._createWrapper();

            this.element
                .show()
                .removeAttr("title")
                .appendTo(this.uiDialog);

            this._addClass("ui-dialog-content", "ui-widget-content");

            this._createTitlebar();
            this._createButtonPane();

            if (this.options.draggable && $.fn.draggable) {
                this._makeDraggable();
            }
            if (this.options.resizable && $.fn.resizable) {
                this._makeResizable();
            }

            this._isOpen = false;

            this._trackFocus();
        },

        _init: function () {
            if (this.options.autoOpen) {
                this.open();
            }
        },

        _appendTo: function () {
            var element = this.options.appendTo;
            if (element && (element.jquery || element.nodeType)) {
                return $(element);
            }
            return this.document.find(element || "body").eq(0);
        },

        _destroy: function () {
            var next,
                originalPosition = this.originalPosition;

            this._untrackInstance();
            this._destroyOverlay();

            this.element
                .removeUniqueId()
                .css(this.originalCss)

                // Without detaching first, the following becomes really slow
                .detach();

            this.uiDialog.remove();

            if (this.originalTitle) {
                this.element.attr("title", this.originalTitle);
            }

            next = originalPosition.parent.children().eq(originalPosition.index);

            // Don't try to place the dialog next to itself (#8613)
            if (next.length && next[0] !== this.element[0]) {
                next.before(this.element);
            } else {
                originalPosition.parent.append(this.element);
            }
        },

        widget: function () {
            return this.uiDialog;
        },

        disable: $.noop,
        enable: $.noop,

        close: function (event) {
            var that = this;

            if (!this._isOpen || this._trigger("beforeClose", event) === false) {
                return;
            }

            this._isOpen = false;
            this._focusedElement = null;
            this._destroyOverlay();
            this._untrackInstance();

            if (!this.opener.filter(":focusable").trigger("focus").length) {

                // Hiding a focused element doesn't trigger blur in WebKit
                // so in case we have nothing to focus on, explicitly blur the active element
                // https://bugs.webkit.org/show_bug.cgi?id=47182
                $.ui.safeBlur($.ui.safeActiveElement(this.document[0]));
            }

            this._hide(this.uiDialog, this.options.hide, function () {
                that._trigger("close", event);
            });
        },

        isOpen: function () {
            return this._isOpen;
        },

        moveToTop: function () {
            this._moveToTop();
        },

        _moveToTop: function (event, silent) {
            var moved = false,
                zIndices = this.uiDialog.siblings(".ui-front:visible").map(function () {
                    return +$(this).css("z-index");
                }).get(),
                zIndexMax = Math.max.apply(null, zIndices);

            if (zIndexMax >= +this.uiDialog.css("z-index")) {
                this.uiDialog.css("z-index", zIndexMax + 1);
                moved = true;
            }

            if (moved && !silent) {
                this._trigger("focus", event);
            }
            return moved;
        },

        open: function () {
            var that = this;
            if (this._isOpen) {
                if (this._moveToTop()) {
                    this._focusTabbable();
                }
                return;
            }

            this._isOpen = true;
            this.opener = $($.ui.safeActiveElement(this.document[0]));

            this._size();
            this._position();
            this._createOverlay();
            this._moveToTop(null, true);

            // Ensure the overlay is moved to the top with the dialog, but only when
            // opening. The overlay shouldn't move after the dialog is open so that
            // modeless dialogs opened after the modal dialog stack properly.
            if (this.overlay) {
                this.overlay.css("z-index", this.uiDialog.css("z-index") - 1);
            }

            this._show(this.uiDialog, this.options.show, function () {
                that._focusTabbable();
                that._trigger("focus");
            });

            // Track the dialog immediately upon openening in case a focus event
            // somehow occurs outside of the dialog before an element inside the
            // dialog is focused (#10152)
            this._makeFocusTarget();

            this._trigger("open");
        },

        _focusTabbable: function () {

            // Set focus to the first match:
            // 1. An element that was focused previously
            // 2. First element inside the dialog matching [autofocus]
            // 3. Tabbable element inside the content element
            // 4. Tabbable element inside the buttonpane
            // 5. The close button
            // 6. The dialog itself
            var hasFocus = this._focusedElement;
            if (!hasFocus) {
                hasFocus = this.element.find("[autofocus]");
            }
            if (!hasFocus.length) {
                hasFocus = this.element.find(":tabbable");
            }
            if (!hasFocus.length) {
                hasFocus = this.uiDialogButtonPane.find(":tabbable");
            }
            if (!hasFocus.length) {
                hasFocus = this.uiDialogTitlebarClose.filter(":tabbable");
            }
            if (!hasFocus.length) {
                hasFocus = this.uiDialog;
            }
            hasFocus.eq(0).trigger("focus");
        },

        _keepFocus: function (event) {
            function checkFocus() {
                var activeElement = $.ui.safeActiveElement(this.document[0]),
                    isActive = this.uiDialog[0] === activeElement ||
                        $.contains(this.uiDialog[0], activeElement);
                if (!isActive) {
                    this._focusTabbable();
                }
            }
            event.preventDefault();
            checkFocus.call(this);

            // support: IE
            // IE <= 8 doesn't prevent moving focus even with event.preventDefault()
            // so we check again later
            this._delay(checkFocus);
        },

        _createWrapper: function () {
            this.uiDialog = $("<div>")
                .hide()
                .attr({

                    // Setting tabIndex makes the div focusable
                    tabIndex: -1,
                    role: "dialog"
                })
                .appendTo(this._appendTo());

            this._addClass(this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front");
            this._on(this.uiDialog, {
                keydown: function (event) {
                    if (this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
                        event.keyCode === $.ui.keyCode.ESCAPE) {
                        event.preventDefault();
                        this.close(event);
                        return;
                    }

                    // Prevent tabbing out of dialogs
                    if (event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented()) {
                        return;
                    }
                    var tabbables = this.uiDialog.find(":tabbable"),
                        first = tabbables.filter(":first"),
                        last = tabbables.filter(":last");

                    if ((event.target === last[0] || event.target === this.uiDialog[0]) &&
                        !event.shiftKey) {
                        this._delay(function () {
                            first.trigger("focus");
                        });
                        event.preventDefault();
                    } else if ((event.target === first[0] ||
                        event.target === this.uiDialog[0]) && event.shiftKey) {
                        this._delay(function () {
                            last.trigger("focus");
                        });
                        event.preventDefault();
                    }
                },
                mousedown: function (event) {
                    if (this._moveToTop(event)) {
                        this._focusTabbable();
                    }
                }
            });

            // We assume that any existing aria-describedby attribute means
            // that the dialog content is marked up properly
            // otherwise we brute force the content as the description
            if (!this.element.find("[aria-describedby]").length) {
                this.uiDialog.attr({
                    "aria-describedby": this.element.uniqueId().attr("id")
                });
            }
        },

        _createTitlebar: function () {
            var uiDialogTitle;

            this.uiDialogTitlebar = $("<div>");
            this._addClass(this.uiDialogTitlebar,
                "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix");
            this._on(this.uiDialogTitlebar, {
                mousedown: function (event) {

                    // Don't prevent click on close button (#8838)
                    // Focusing a dialog that is partially scrolled out of view
                    // causes the browser to scroll it into view, preventing the click event
                    if (!$(event.target).closest(".ui-dialog-titlebar-close")) {

                        // Dialog isn't getting focus when dragging (#8063)
                        this.uiDialog.trigger("focus");
                    }
                }
            });

            // Support: IE
            // Use type="button" to prevent enter keypresses in textboxes from closing the
            // dialog in IE (#9312)
            this.uiDialogTitlebarClose = $("<button type='button'></button>")
                .button({
                    label: $("<a>").text(this.options.closeText).html(),
                    icon: "ui-icon-closethick",
                    showLabel: false
                })
                .appendTo(this.uiDialogTitlebar);

            this._addClass(this.uiDialogTitlebarClose, "ui-dialog-titlebar-close");
            this._on(this.uiDialogTitlebarClose, {
                click: function (event) {
                    event.preventDefault();
                    this.close(event);
                }
            });

            uiDialogTitle = $("<span>").uniqueId().prependTo(this.uiDialogTitlebar);
            this._addClass(uiDialogTitle, "ui-dialog-title");
            this._title(uiDialogTitle);

            this.uiDialogTitlebar.prependTo(this.uiDialog);

            this.uiDialog.attr({
                "aria-labelledby": uiDialogTitle.attr("id")
            });
        },

        _title: function (title) {
            if (this.options.title) {
                title.text(this.options.title);
            } else {
                title.html("&#160;");
            }
        },

        _createButtonPane: function () {
            this.uiDialogButtonPane = $("<div>");
            this._addClass(this.uiDialogButtonPane, "ui-dialog-buttonpane",
                "ui-widget-content ui-helper-clearfix");

            this.uiButtonSet = $("<div>")
                .appendTo(this.uiDialogButtonPane);
            this._addClass(this.uiButtonSet, "ui-dialog-buttonset");

            this._createButtons();
        },

        _createButtons: function () {
            var that = this,
                buttons = this.options.buttons;

            // If we already have a button pane, remove it
            this.uiDialogButtonPane.remove();
            this.uiButtonSet.empty();

            if ($.isEmptyObject(buttons) || ($.isArray(buttons) && !buttons.length)) {
                this._removeClass(this.uiDialog, "ui-dialog-buttons");
                return;
            }

            $.each(buttons, function (name, props) {
                var click, buttonOptions;
                props = $.isFunction(props) ?
                    { click: props, text: name } :
                    props;

                // Default to a non-submitting button
                props = $.extend({ type: "button" }, props);

                // Change the context for the click callback to be the main element
                click = props.click;
                buttonOptions = {
                    icon: props.icon,
                    iconPosition: props.iconPosition,
                    showLabel: props.showLabel,

                    // Deprecated options
                    icons: props.icons,
                    text: props.text
                };

                delete props.click;
                delete props.icon;
                delete props.iconPosition;
                delete props.showLabel;

                // Deprecated options
                delete props.icons;
                if (typeof props.text === "boolean") {
                    delete props.text;
                }

                $("<button></button>", props)
                    .button(buttonOptions)
                    .appendTo(that.uiButtonSet)
                    .on("click", function () {
                        click.apply(that.element[0], arguments);
                    });
            });
            this._addClass(this.uiDialog, "ui-dialog-buttons");
            this.uiDialogButtonPane.appendTo(this.uiDialog);
        },

        _makeDraggable: function () {
            var that = this,
                options = this.options;

            function filteredUi(ui) {
                return {
                    position: ui.position,
                    offset: ui.offset
                };
            }

            this.uiDialog.draggable({
                cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
                handle: ".ui-dialog-titlebar",
                containment: "document",
                start: function (event, ui) {
                    that._addClass($(this), "ui-dialog-dragging");
                    that._blockFrames();
                    that._trigger("dragStart", event, filteredUi(ui));
                },
                drag: function (event, ui) {
                    that._trigger("drag", event, filteredUi(ui));
                },
                stop: function (event, ui) {
                    var left = ui.offset.left - that.document.scrollLeft(),
                        top = ui.offset.top - that.document.scrollTop();

                    options.position = {
                        my: "left top",
                        at: "left" + (left >= 0 ? "+" : "") + left + " " +
                            "top" + (top >= 0 ? "+" : "") + top,
                        of: that.window
                    };
                    that._removeClass($(this), "ui-dialog-dragging");
                    that._unblockFrames();
                    that._trigger("dragStop", event, filteredUi(ui));
                }
            });
        },

        _makeResizable: function () {
            var that = this,
                options = this.options,
                handles = options.resizable,

                // .ui-resizable has position: relative defined in the stylesheet
                // but dialogs have to use absolute or fixed positioning
                position = this.uiDialog.css("position"),
                resizeHandles = typeof handles === "string" ?
                    handles :
                    "n,e,s,w,se,sw,ne,nw";

            function filteredUi(ui) {
                return {
                    originalPosition: ui.originalPosition,
                    originalSize: ui.originalSize,
                    position: ui.position,
                    size: ui.size
                };
            }

            this.uiDialog.resizable({
                cancel: ".ui-dialog-content",
                containment: "document",
                alsoResize: this.element,
                maxWidth: options.maxWidth,
                maxHeight: options.maxHeight,
                minWidth: options.minWidth,
                minHeight: this._minHeight(),
                handles: resizeHandles,
                start: function (event, ui) {
                    that._addClass($(this), "ui-dialog-resizing");
                    that._blockFrames();
                    that._trigger("resizeStart", event, filteredUi(ui));
                },
                resize: function (event, ui) {
                    that._trigger("resize", event, filteredUi(ui));
                },
                stop: function (event, ui) {
                    var offset = that.uiDialog.offset(),
                        left = offset.left - that.document.scrollLeft(),
                        top = offset.top - that.document.scrollTop();

                    options.height = that.uiDialog.height();
                    options.width = that.uiDialog.width();
                    options.position = {
                        my: "left top",
                        at: "left" + (left >= 0 ? "+" : "") + left + " " +
                            "top" + (top >= 0 ? "+" : "") + top,
                        of: that.window
                    };
                    that._removeClass($(this), "ui-dialog-resizing");
                    that._unblockFrames();
                    that._trigger("resizeStop", event, filteredUi(ui));
                }
            })
                .css("position", position);
        },

        _trackFocus: function () {
            this._on(this.widget(), {
                focusin: function (event) {
                    this._makeFocusTarget();
                    this._focusedElement = $(event.target);
                }
            });
        },

        _makeFocusTarget: function () {
            this._untrackInstance();
            this._trackingInstances().unshift(this);
        },

        _untrackInstance: function () {
            var instances = this._trackingInstances(),
                exists = $.inArray(this, instances);
            if (exists !== -1) {
                instances.splice(exists, 1);
            }
        },

        _trackingInstances: function () {
            var instances = this.document.data("ui-dialog-instances");
            if (!instances) {
                instances = [];
                this.document.data("ui-dialog-instances", instances);
            }
            return instances;
        },

        _minHeight: function () {
            var options = this.options;

            return options.height === "auto" ?
                options.minHeight :
                Math.min(options.minHeight, options.height);
        },

        _position: function () {

            // Need to show the dialog to get the actual offset in the position plugin
            var isVisible = this.uiDialog.is(":visible");
            if (!isVisible) {
                this.uiDialog.show();
            }
            this.uiDialog.position(this.options.position);
            if (!isVisible) {
                this.uiDialog.hide();
            }
        },

        _setOptions: function (options) {
            var that = this,
                resize = false,
                resizableOptions = {};

            $.each(options, function (key, value) {
                that._setOption(key, value);

                if (key in that.sizeRelatedOptions) {
                    resize = true;
                }
                if (key in that.resizableRelatedOptions) {
                    resizableOptions[key] = value;
                }
            });

            if (resize) {
                this._size();
                this._position();
            }
            if (this.uiDialog.is(":data(ui-resizable)")) {
                this.uiDialog.resizable("option", resizableOptions);
            }
        },

        _setOption: function (key, value) {
            var isDraggable, isResizable,
                uiDialog = this.uiDialog;

            if (key === "disabled") {
                return;
            }

            this._super(key, value);

            if (key === "appendTo") {
                this.uiDialog.appendTo(this._appendTo());
            }

            if (key === "buttons") {
                this._createButtons();
            }

            if (key === "closeText") {
                this.uiDialogTitlebarClose.button({

                    // Ensure that we always pass a string
                    label: $("<a>").text("" + this.options.closeText).html()
                });
            }

            if (key === "draggable") {
                isDraggable = uiDialog.is(":data(ui-draggable)");
                if (isDraggable && !value) {
                    uiDialog.draggable("destroy");
                }

                if (!isDraggable && value) {
                    this._makeDraggable();
                }
            }

            if (key === "position") {
                this._position();
            }

            if (key === "resizable") {

                // currently resizable, becoming non-resizable
                isResizable = uiDialog.is(":data(ui-resizable)");
                if (isResizable && !value) {
                    uiDialog.resizable("destroy");
                }

                // Currently resizable, changing handles
                if (isResizable && typeof value === "string") {
                    uiDialog.resizable("option", "handles", value);
                }

                // Currently non-resizable, becoming resizable
                if (!isResizable && value !== false) {
                    this._makeResizable();
                }
            }

            if (key === "title") {
                this._title(this.uiDialogTitlebar.find(".ui-dialog-title"));
            }
        },

        _size: function () {

            // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
            // divs will both have width and height set, so we need to reset them
            var nonContentHeight, minContentHeight, maxContentHeight,
                options = this.options;

            // Reset content sizing
            this.element.show().css({
                width: "auto",
                minHeight: 0,
                maxHeight: "none",
                height: 0
            });

            if (options.minWidth > options.width) {
                options.width = options.minWidth;
            }

            // Reset wrapper sizing
            // determine the height of all the non-content elements
            nonContentHeight = this.uiDialog.css({
                height: "auto",
                width: options.width
            })
                .outerHeight();
            minContentHeight = Math.max(0, options.minHeight - nonContentHeight);
            maxContentHeight = typeof options.maxHeight === "number" ?
                Math.max(0, options.maxHeight - nonContentHeight) :
                "none";

            if (options.height === "auto") {
                this.element.css({
                    minHeight: minContentHeight,
                    maxHeight: maxContentHeight,
                    height: "auto"
                });
            } else {
                this.element.height(Math.max(0, options.height - nonContentHeight));
            }

            if (this.uiDialog.is(":data(ui-resizable)")) {
                this.uiDialog.resizable("option", "minHeight", this._minHeight());
            }
        },

        _blockFrames: function () {
            this.iframeBlocks = this.document.find("iframe").map(function () {
                var iframe = $(this);

                return $("<div>")
                    .css({
                        position: "absolute",
                        width: iframe.outerWidth(),
                        height: iframe.outerHeight()
                    })
                    .appendTo(iframe.parent())
                    .offset(iframe.offset())[0];
            });
        },

        _unblockFrames: function () {
            if (this.iframeBlocks) {
                this.iframeBlocks.remove();
                delete this.iframeBlocks;
            }
        },

        _allowInteraction: function (event) {
            if ($(event.target).closest(".ui-dialog").length) {
                return true;
            }

            // TODO: Remove hack when datepicker implements
            // the .ui-front logic (#8989)
            return !!$(event.target).closest(".ui-datepicker").length;
        },

        _createOverlay: function () {
            if (!this.options.modal) {
                return;
            }

            // We use a delay in case the overlay is created from an
            // event that we're going to be cancelling (#2804)
            var isOpening = true;
            this._delay(function () {
                isOpening = false;
            });

            if (!this.document.data("ui-dialog-overlays")) {

                // Prevent use of anchors and inputs
                // Using _on() for an event handler shared across many instances is
                // safe because the dialogs stack and must be closed in reverse order
                this._on(this.document, {
                    focusin: function (event) {
                        if (isOpening) {
                            return;
                        }

                        if (!this._allowInteraction(event)) {
                            event.preventDefault();
                            this._trackingInstances()[0]._focusTabbable();
                        }
                    }
                });
            }

            this.overlay = $("<div>")
                .appendTo(this._appendTo());

            this._addClass(this.overlay, null, "ui-widget-overlay ui-front");
            this._on(this.overlay, {
                mousedown: "_keepFocus"
            });
            this.document.data("ui-dialog-overlays",
                (this.document.data("ui-dialog-overlays") || 0) + 1);
        },

        _destroyOverlay: function () {
            if (!this.options.modal) {
                return;
            }

            if (this.overlay) {
                var overlays = this.document.data("ui-dialog-overlays") - 1;

                if (!overlays) {
                    this._off(this.document, "focusin");
                    this.document.removeData("ui-dialog-overlays");
                } else {
                    this.document.data("ui-dialog-overlays", overlays);
                }

                this.overlay.remove();
                this.overlay = null;
            }
        }
    });

    // DEPRECATED
    // TODO: switch return back to widget declaration at top of file when this is removed
    if ($.uiBackCompat !== false) {

        // Backcompat for dialogClass option
        $.widget("ui.dialog", $.ui.dialog, {
            options: {
                dialogClass: ""
            },
            _createWrapper: function () {
                this._super();
                this.uiDialog.addClass(this.options.dialogClass);
            },
            _setOption: function (key, value) {
                if (key === "dialogClass") {
                    this.uiDialog
                        .removeClass(this.options.dialogClass)
                        .addClass(value);
                }
                this._superApply(arguments);
            }
        });
    }

    var widgetsDialog = $.ui.dialog;


    /*!
     * jQuery UI Progressbar 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Progressbar
    //>>group: Widgets
    // jscs:disable maximumLineLength
    //>>description: Displays a status indicator for loading state, standard percentage, and other progress indicators.
    // jscs:enable maximumLineLength
    //>>docs: http://api.jqueryui.com/progressbar/
    //>>demos: http://jqueryui.com/progressbar/
    //>>css.structure: ../../themes/base/core.css
    //>>css.structure: ../../themes/base/progressbar.css
    //>>css.theme: ../../themes/base/theme.css



    var widgetsProgressbar = $.widget("ui.progressbar", {
        version: "1.12.1",
        options: {
            classes: {
                "ui-progressbar": "ui-corner-all",
                "ui-progressbar-value": "ui-corner-left",
                "ui-progressbar-complete": "ui-corner-right"
            },
            max: 100,
            value: 0,

            change: null,
            complete: null
        },

        min: 0,

        _create: function () {

            // Constrain initial value
            this.oldValue = this.options.value = this._constrainedValue();

            this.element.attr({

                // Only set static values; aria-valuenow and aria-valuemax are
                // set inside _refreshValue()
                role: "progressbar",
                "aria-valuemin": this.min
            });
            this._addClass("ui-progressbar", "ui-widget ui-widget-content");

            this.valueDiv = $("<div>").appendTo(this.element);
            this._addClass(this.valueDiv, "ui-progressbar-value", "ui-widget-header");
            this._refreshValue();
        },

        _destroy: function () {
            this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow");

            this.valueDiv.remove();
        },

        value: function (newValue) {
            if (newValue === undefined) {
                return this.options.value;
            }

            this.options.value = this._constrainedValue(newValue);
            this._refreshValue();
        },

        _constrainedValue: function (newValue) {
            if (newValue === undefined) {
                newValue = this.options.value;
            }

            this.indeterminate = newValue === false;

            // Sanitize value
            if (typeof newValue !== "number") {
                newValue = 0;
            }

            return this.indeterminate ? false :
                Math.min(this.options.max, Math.max(this.min, newValue));
        },

        _setOptions: function (options) {

            // Ensure "value" option is set after other values (like max)
            var value = options.value;
            delete options.value;

            this._super(options);

            this.options.value = this._constrainedValue(value);
            this._refreshValue();
        },

        _setOption: function (key, value) {
            if (key === "max") {

                // Don't allow a max less than min
                value = Math.max(this.min, value);
            }
            this._super(key, value);
        },

        _setOptionDisabled: function (value) {
            this._super(value);

            this.element.attr("aria-disabled", value);
            this._toggleClass(null, "ui-state-disabled", !!value);
        },

        _percentage: function () {
            return this.indeterminate ?
                100 :
                100 * (this.options.value - this.min) / (this.options.max - this.min);
        },

        _refreshValue: function () {
            var value = this.options.value,
                percentage = this._percentage();

            this.valueDiv
                .toggle(this.indeterminate || value > this.min)
                .width(percentage.toFixed(0) + "%");

            this
                ._toggleClass(this.valueDiv, "ui-progressbar-complete", null,
                    value === this.options.max)
                ._toggleClass("ui-progressbar-indeterminate", null, this.indeterminate);

            if (this.indeterminate) {
                this.element.removeAttr("aria-valuenow");
                if (!this.overlayDiv) {
                    this.overlayDiv = $("<div>").appendTo(this.valueDiv);
                    this._addClass(this.overlayDiv, "ui-progressbar-overlay");
                }
            } else {
                this.element.attr({
                    "aria-valuemax": this.options.max,
                    "aria-valuenow": value
                });
                if (this.overlayDiv) {
                    this.overlayDiv.remove();
                    this.overlayDiv = null;
                }
            }

            if (this.oldValue !== value) {
                this.oldValue = value;
                this._trigger("change");
            }
            if (value === this.options.max) {
                this._trigger("complete");
            }
        }
    });


    /*!
     * jQuery UI Selectmenu 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Selectmenu
    //>>group: Widgets
    // jscs:disable maximumLineLength
    //>>description: Duplicates and extends the functionality of a native HTML select element, allowing it to be customizable in behavior and appearance far beyond the limitations of a native select.
    // jscs:enable maximumLineLength
    //>>docs: http://api.jqueryui.com/selectmenu/
    //>>demos: http://jqueryui.com/selectmenu/
    //>>css.structure: ../../themes/base/core.css
    //>>css.structure: ../../themes/base/selectmenu.css, ../../themes/base/button.css
    //>>css.theme: ../../themes/base/theme.css



    var widgetsSelectmenu = $.widget("ui.selectmenu", [$.ui.formResetMixin, {
        version: "1.12.1",
        defaultElement: "<select>",
        options: {
            appendTo: null,
            classes: {
                "ui-selectmenu-button-open": "ui-corner-top",
                "ui-selectmenu-button-closed": "ui-corner-all"
            },
            disabled: null,
            icons: {
                button: "ui-icon-triangle-1-s"
            },
            position: {
                my: "left top",
                at: "left bottom",
                collision: "none"
            },
            width: false,

            // Callbacks
            change: null,
            close: null,
            focus: null,
            open: null,
            select: null
        },

        _create: function () {
            var selectmenuId = this.element.uniqueId().attr("id");
            this.ids = {
                element: selectmenuId,
                button: selectmenuId + "-button",
                menu: selectmenuId + "-menu"
            };

            this._drawButton();
            this._drawMenu();
            this._bindFormResetHandler();

            this._rendered = false;
            this.menuItems = $();
        },

        _drawButton: function () {
            var icon,
                that = this,
                item = this._parseOption(
                    this.element.find("option:selected"),
                    this.element[0].selectedIndex
                );

            // Associate existing label with the new button
            this.labels = this.element.labels().attr("for", this.ids.button);
            this._on(this.labels, {
                click: function (event) {
                    this.button.focus();
                    event.preventDefault();
                }
            });

            // Hide original select element
            this.element.hide();

            // Create button
            this.button = $("<span>", {
                tabindex: this.options.disabled ? -1 : 0,
                id: this.ids.button,
                role: "combobox",
                "aria-expanded": "false",
                "aria-autocomplete": "list",
                "aria-owns": this.ids.menu,
                "aria-haspopup": "true",
                title: this.element.attr("title")
            })
                .insertAfter(this.element);

            this._addClass(this.button, "ui-selectmenu-button ui-selectmenu-button-closed",
                "ui-button ui-widget");

            icon = $("<span>").appendTo(this.button);
            this._addClass(icon, "ui-selectmenu-icon", "ui-icon " + this.options.icons.button);
            this.buttonItem = this._renderButtonItem(item)
                .appendTo(this.button);

            if (this.options.width !== false) {
                this._resizeButton();
            }

            this._on(this.button, this._buttonEvents);
            this.button.one("focusin", function () {

                // Delay rendering the menu items until the button receives focus.
                // The menu may have already been rendered via a programmatic open.
                if (!that._rendered) {
                    that._refreshMenu();
                }
            });
        },

        _drawMenu: function () {
            var that = this;

            // Create menu
            this.menu = $("<ul>", {
                "aria-hidden": "true",
                "aria-labelledby": this.ids.button,
                id: this.ids.menu
            });

            // Wrap menu
            this.menuWrap = $("<div>").append(this.menu);
            this._addClass(this.menuWrap, "ui-selectmenu-menu", "ui-front");
            this.menuWrap.appendTo(this._appendTo());

            // Initialize menu widget
            this.menuInstance = this.menu
                .menu({
                    classes: {
                        "ui-menu": "ui-corner-bottom"
                    },
                    role: "listbox",
                    select: function (event, ui) {
                        event.preventDefault();

                        // Support: IE8
                        // If the item was selected via a click, the text selection
                        // will be destroyed in IE
                        that._setSelection();

                        that._select(ui.item.data("ui-selectmenu-item"), event);
                    },
                    focus: function (event, ui) {
                        var item = ui.item.data("ui-selectmenu-item");

                        // Prevent inital focus from firing and check if its a newly focused item
                        if (that.focusIndex != null && item.index !== that.focusIndex) {
                            that._trigger("focus", event, { item: item });
                            if (!that.isOpen) {
                                that._select(item, event);
                            }
                        }
                        that.focusIndex = item.index;

                        that.button.attr("aria-activedescendant",
                            that.menuItems.eq(item.index).attr("id"));
                    }
                })
                .menu("instance");

            // Don't close the menu on mouseleave
            this.menuInstance._off(this.menu, "mouseleave");

            // Cancel the menu's collapseAll on document click
            this.menuInstance._closeOnDocumentClick = function () {
                return false;
            };

            // Selects often contain empty items, but never contain dividers
            this.menuInstance._isDivider = function () {
                return false;
            };
        },

        refresh: function () {
            this._refreshMenu();
            this.buttonItem.replaceWith(
                this.buttonItem = this._renderButtonItem(

                    // Fall back to an empty object in case there are no options
                    this._getSelectedItem().data("ui-selectmenu-item") || {}
                )
            );
            if (this.options.width === null) {
                this._resizeButton();
            }
        },

        _refreshMenu: function () {
            var item,
                options = this.element.find("option");

            this.menu.empty();

            this._parseOptions(options);
            this._renderMenu(this.menu, this.items);

            this.menuInstance.refresh();
            this.menuItems = this.menu.find("li")
                .not(".ui-selectmenu-optgroup")
                .find(".ui-menu-item-wrapper");

            this._rendered = true;

            if (!options.length) {
                return;
            }

            item = this._getSelectedItem();

            // Update the menu to have the correct item focused
            this.menuInstance.focus(null, item);
            this._setAria(item.data("ui-selectmenu-item"));

            // Set disabled state
            this._setOption("disabled", this.element.prop("disabled"));
        },

        open: function (event) {
            if (this.options.disabled) {
                return;
            }

            // If this is the first time the menu is being opened, render the items
            if (!this._rendered) {
                this._refreshMenu();
            } else {

                // Menu clears focus on close, reset focus to selected item
                this._removeClass(this.menu.find(".ui-state-active"), null, "ui-state-active");
                this.menuInstance.focus(null, this._getSelectedItem());
            }

            // If there are no options, don't open the menu
            if (!this.menuItems.length) {
                return;
            }

            this.isOpen = true;
            this._toggleAttr();
            this._resizeMenu();
            this._position();

            this._on(this.document, this._documentClick);

            this._trigger("open", event);
        },

        _position: function () {
            this.menuWrap.position($.extend({ of: this.button }, this.options.position));
        },

        close: function (event) {
            if (!this.isOpen) {
                return;
            }

            this.isOpen = false;
            this._toggleAttr();

            this.range = null;
            this._off(this.document);

            this._trigger("close", event);
        },

        widget: function () {
            return this.button;
        },

        menuWidget: function () {
            return this.menu;
        },

        _renderButtonItem: function (item) {
            var buttonItem = $("<span>");

            this._setText(buttonItem, item.label);
            this._addClass(buttonItem, "ui-selectmenu-text");

            return buttonItem;
        },

        _renderMenu: function (ul, items) {
            var that = this,
                currentOptgroup = "";

            $.each(items, function (index, item) {
                var li;

                if (item.optgroup !== currentOptgroup) {
                    li = $("<li>", {
                        text: item.optgroup
                    });
                    that._addClass(li, "ui-selectmenu-optgroup", "ui-menu-divider" +
                        (item.element.parent("optgroup").prop("disabled") ?
                            " ui-state-disabled" :
                            ""));

                    li.appendTo(ul);

                    currentOptgroup = item.optgroup;
                }

                that._renderItemData(ul, item);
            });
        },

        _renderItemData: function (ul, item) {
            return this._renderItem(ul, item).data("ui-selectmenu-item", item);
        },

        _renderItem: function (ul, item) {
            var li = $("<li>"),
                wrapper = $("<div>", {
                    title: item.element.attr("title")
                });

            if (item.disabled) {
                this._addClass(li, null, "ui-state-disabled");
            }
            this._setText(wrapper, item.label);

            return li.append(wrapper).appendTo(ul);
        },

        _setText: function (element, value) {
            if (value) {
                element.text(value);
            } else {
                element.html("&#160;");
            }
        },

        _move: function (direction, event) {
            var item, next,
                filter = ".ui-menu-item";

            if (this.isOpen) {
                item = this.menuItems.eq(this.focusIndex).parent("li");
            } else {
                item = this.menuItems.eq(this.element[0].selectedIndex).parent("li");
                filter += ":not(.ui-state-disabled)";
            }

            if (direction === "first" || direction === "last") {
                next = item[direction === "first" ? "prevAll" : "nextAll"](filter).eq(-1);
            } else {
                next = item[direction + "All"](filter).eq(0);
            }

            if (next.length) {
                this.menuInstance.focus(event, next);
            }
        },

        _getSelectedItem: function () {
            return this.menuItems.eq(this.element[0].selectedIndex).parent("li");
        },

        _toggle: function (event) {
            this[this.isOpen ? "close" : "open"](event);
        },

        _setSelection: function () {
            var selection;

            if (!this.range) {
                return;
            }

            if (window.getSelection) {
                selection = window.getSelection();
                selection.removeAllRanges();
                selection.addRange(this.range);

                // Support: IE8
            } else {
                this.range.select();
            }

            // Support: IE
            // Setting the text selection kills the button focus in IE, but
            // restoring the focus doesn't kill the selection.
            this.button.focus();
        },

        _documentClick: {
            mousedown: function (event) {
                if (!this.isOpen) {
                    return;
                }

                if (!$(event.target).closest(".ui-selectmenu-menu, #" +
                    $.ui.escapeSelector(this.ids.button)).length) {
                    this.close(event);
                }
            }
        },

        _buttonEvents: {

            // Prevent text selection from being reset when interacting with the selectmenu (#10144)
            mousedown: function () {
                var selection;

                if (window.getSelection) {
                    selection = window.getSelection();
                    if (selection.rangeCount) {
                        this.range = selection.getRangeAt(0);
                    }

                    // Support: IE8
                } else {
                    this.range = document.selection.createRange();
                }
            },

            click: function (event) {
                this._setSelection();
                this._toggle(event);
            },

            keydown: function (event) {
                var preventDefault = true;
                switch (event.keyCode) {
                    case $.ui.keyCode.TAB:
                    case $.ui.keyCode.ESCAPE:
                        this.close(event);
                        preventDefault = false;
                        break;
                    case $.ui.keyCode.ENTER:
                        if (this.isOpen) {
                            this._selectFocusedItem(event);
                        }
                        break;
                    case $.ui.keyCode.UP:
                        if (event.altKey) {
                            this._toggle(event);
                        } else {
                            this._move("prev", event);
                        }
                        break;
                    case $.ui.keyCode.DOWN:
                        if (event.altKey) {
                            this._toggle(event);
                        } else {
                            this._move("next", event);
                        }
                        break;
                    case $.ui.keyCode.SPACE:
                        if (this.isOpen) {
                            this._selectFocusedItem(event);
                        } else {
                            this._toggle(event);
                        }
                        break;
                    case $.ui.keyCode.LEFT:
                        this._move("prev", event);
                        break;
                    case $.ui.keyCode.RIGHT:
                        this._move("next", event);
                        break;
                    case $.ui.keyCode.HOME:
                    case $.ui.keyCode.PAGE_UP:
                        this._move("first", event);
                        break;
                    case $.ui.keyCode.END:
                    case $.ui.keyCode.PAGE_DOWN:
                        this._move("last", event);
                        break;
                    default:
                        this.menu.trigger(event);
                        preventDefault = false;
                }

                if (preventDefault) {
                    event.preventDefault();
                }
            }
        },

        _selectFocusedItem: function (event) {
            var item = this.menuItems.eq(this.focusIndex).parent("li");
            if (!item.hasClass("ui-state-disabled")) {
                this._select(item.data("ui-selectmenu-item"), event);
            }
        },

        _select: function (item, event) {
            var oldIndex = this.element[0].selectedIndex;

            // Change native select element
            this.element[0].selectedIndex = item.index;
            this.buttonItem.replaceWith(this.buttonItem = this._renderButtonItem(item));
            this._setAria(item);
            this._trigger("select", event, { item: item });

            if (item.index !== oldIndex) {
                this._trigger("change", event, { item: item });
            }

            this.close(event);
        },

        _setAria: function (item) {
            var id = this.menuItems.eq(item.index).attr("id");

            this.button.attr({
                "aria-labelledby": id,
                "aria-activedescendant": id
            });
            this.menu.attr("aria-activedescendant", id);
        },

        _setOption: function (key, value) {
            if (key === "icons") {
                var icon = this.button.find("span.ui-icon");
                this._removeClass(icon, null, this.options.icons.button)
                    ._addClass(icon, null, value.button);
            }

            this._super(key, value);

            if (key === "appendTo") {
                this.menuWrap.appendTo(this._appendTo());
            }

            if (key === "width") {
                this._resizeButton();
            }
        },

        _setOptionDisabled: function (value) {
            this._super(value);

            this.menuInstance.option("disabled", value);
            this.button.attr("aria-disabled", value);
            this._toggleClass(this.button, null, "ui-state-disabled", value);

            this.element.prop("disabled", value);
            if (value) {
                this.button.attr("tabindex", -1);
                this.close();
            } else {
                this.button.attr("tabindex", 0);
            }
        },

        _appendTo: function () {
            var element = this.options.appendTo;

            if (element) {
                element = element.jquery || element.nodeType ?
                    $(element) :
                    this.document.find(element).eq(0);
            }

            if (!element || !element[0]) {
                element = this.element.closest(".ui-front, dialog");
            }

            if (!element.length) {
                element = this.document[0].body;
            }

            return element;
        },

        _toggleAttr: function () {
            this.button.attr("aria-expanded", this.isOpen);

            // We can't use two _toggleClass() calls here, because we need to make sure
            // we always remove classes first and add them second, otherwise if both classes have the
            // same theme class, it will be removed after we add it.
            this._removeClass(this.button, "ui-selectmenu-button-" +
                (this.isOpen ? "closed" : "open"))
                ._addClass(this.button, "ui-selectmenu-button-" +
                    (this.isOpen ? "open" : "closed"))
                ._toggleClass(this.menuWrap, "ui-selectmenu-open", null, this.isOpen);

            this.menu.attr("aria-hidden", !this.isOpen);
        },

        _resizeButton: function () {
            var width = this.options.width;

            // For `width: false`, just remove inline style and stop
            if (width === false) {
                this.button.css("width", "");
                return;
            }

            // For `width: null`, match the width of the original element
            if (width === null) {
                width = this.element.show().outerWidth();
                this.element.hide();
            }

            this.button.outerWidth(width);
        },

        _resizeMenu: function () {
            this.menu.outerWidth(Math.max(
                this.button.outerWidth(),

                // Support: IE10
                // IE10 wraps long text (possibly a rounding bug)
                // so we add 1px to avoid the wrapping
                this.menu.width("").outerWidth() + 1
            ));
        },

        _getCreateOptions: function () {
            var options = this._super();

            options.disabled = this.element.prop("disabled");

            return options;
        },

        _parseOptions: function (options) {
            var that = this,
                data = [];
            options.each(function (index, item) {
                data.push(that._parseOption($(item), index));
            });
            this.items = data;
        },

        _parseOption: function (option, index) {
            var optgroup = option.parent("optgroup");

            return {
                element: option,
                index: index,
                value: option.val(),
                label: option.text(),
                optgroup: optgroup.attr("label") || "",
                disabled: optgroup.prop("disabled") || option.prop("disabled")
            };
        },

        _destroy: function () {
            this._unbindFormResetHandler();
            this.menuWrap.remove();
            this.button.remove();
            this.element.show();
            this.element.removeUniqueId();
            this.labels.attr("for", this.ids.element);
        }
    }]);


    /*!
     * jQuery UI Slider 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Slider
    //>>group: Widgets
    //>>description: Displays a flexible slider with ranges and accessibility via keyboard.
    //>>docs: http://api.jqueryui.com/slider/
    //>>demos: http://jqueryui.com/slider/
    //>>css.structure: ../../themes/base/core.css
    //>>css.structure: ../../themes/base/slider.css
    //>>css.theme: ../../themes/base/theme.css



    var widgetsSlider = $.widget("ui.slider", $.ui.mouse, {
        version: "1.12.1",
        widgetEventPrefix: "slide",

        options: {
            animate: false,
            classes: {
                "ui-slider": "ui-corner-all",
                "ui-slider-handle": "ui-corner-all",

                // Note: ui-widget-header isn't the most fittingly semantic framework class for this
                // element, but worked best visually with a variety of themes
                "ui-slider-range": "ui-corner-all ui-widget-header"
            },
            distance: 0,
            max: 100,
            min: 0,
            orientation: "horizontal",
            range: false,
            step: 1,
            value: 0,
            values: null,

            // Callbacks
            change: null,
            slide: null,
            start: null,
            stop: null
        },

        // Number of pages in a slider
        // (how many times can you page up/down to go through the whole range)
        numPages: 5,

        _create: function () {
            this._keySliding = false;
            this._mouseSliding = false;
            this._animateOff = true;
            this._handleIndex = null;
            this._detectOrientation();
            this._mouseInit();
            this._calculateNewMax();

            this._addClass("ui-slider ui-slider-" + this.orientation,
                "ui-widget ui-widget-content");

            this._refresh();

            this._animateOff = false;
        },

        _refresh: function () {
            this._createRange();
            this._createHandles();
            this._setupEvents();
            this._refreshValue();
        },

        _createHandles: function () {
            var i, handleCount,
                options = this.options,
                existingHandles = this.element.find(".ui-slider-handle"),
                handle = "<span tabindex='0'></span>",
                handles = [];

            handleCount = (options.values && options.values.length) || 1;

            if (existingHandles.length > handleCount) {
                existingHandles.slice(handleCount).remove();
                existingHandles = existingHandles.slice(0, handleCount);
            }

            for (i = existingHandles.length; i < handleCount; i++) {
                handles.push(handle);
            }

            this.handles = existingHandles.add($(handles.join("")).appendTo(this.element));

            this._addClass(this.handles, "ui-slider-handle", "ui-state-default");

            this.handle = this.handles.eq(0);

            this.handles.each(function (i) {
                $(this)
                    .data("ui-slider-handle-index", i)
                    .attr("tabIndex", 0);
            });
        },

        _createRange: function () {
            var options = this.options;

            if (options.range) {
                if (options.range === true) {
                    if (!options.values) {
                        options.values = [this._valueMin(), this._valueMin()];
                    } else if (options.values.length && options.values.length !== 2) {
                        options.values = [options.values[0], options.values[0]];
                    } else if ($.isArray(options.values)) {
                        options.values = options.values.slice(0);
                    }
                }

                if (!this.range || !this.range.length) {
                    this.range = $("<div>")
                        .appendTo(this.element);

                    this._addClass(this.range, "ui-slider-range");
                } else {
                    this._removeClass(this.range, "ui-slider-range-min ui-slider-range-max");

                    // Handle range switching from true to min/max
                    this.range.css({
                        "left": "",
                        "bottom": ""
                    });
                }
                if (options.range === "min" || options.range === "max") {
                    this._addClass(this.range, "ui-slider-range-" + options.range);
                }
            } else {
                if (this.range) {
                    this.range.remove();
                }
                this.range = null;
            }
        },

        _setupEvents: function () {
            this._off(this.handles);
            this._on(this.handles, this._handleEvents);
            this._hoverable(this.handles);
            this._focusable(this.handles);
        },

        _destroy: function () {
            this.handles.remove();
            if (this.range) {
                this.range.remove();
            }

            this._mouseDestroy();
        },

        _mouseCapture: function (event) {
            var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
                that = this,
                o = this.options;

            if (o.disabled) {
                return false;
            }

            this.elementSize = {
                width: this.element.outerWidth(),
                height: this.element.outerHeight()
            };
            this.elementOffset = this.element.offset();

            position = { x: event.pageX, y: event.pageY };
            normValue = this._normValueFromMouse(position);
            distance = this._valueMax() - this._valueMin() + 1;
            this.handles.each(function (i) {
                var thisDistance = Math.abs(normValue - that.values(i));
                if ((distance > thisDistance) ||
                    (distance === thisDistance &&
                        (i === that._lastChangedValue || that.values(i) === o.min))) {
                    distance = thisDistance;
                    closestHandle = $(this);
                    index = i;
                }
            });

            allowed = this._start(event, index);
            if (allowed === false) {
                return false;
            }
            this._mouseSliding = true;

            this._handleIndex = index;

            this._addClass(closestHandle, null, "ui-state-active");
            closestHandle.trigger("focus");

            offset = closestHandle.offset();
            mouseOverHandle = !$(event.target).parents().addBack().is(".ui-slider-handle");
            this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
                left: event.pageX - offset.left - (closestHandle.width() / 2),
                top: event.pageY - offset.top -
                    (closestHandle.height() / 2) -
                    (parseInt(closestHandle.css("borderTopWidth"), 10) || 0) -
                    (parseInt(closestHandle.css("borderBottomWidth"), 10) || 0) +
                    (parseInt(closestHandle.css("marginTop"), 10) || 0)
            };

            if (!this.handles.hasClass("ui-state-hover")) {
                this._slide(event, index, normValue);
            }
            this._animateOff = true;
            return true;
        },

        _mouseStart: function () {
            return true;
        },

        _mouseDrag: function (event) {
            var position = { x: event.pageX, y: event.pageY },
                normValue = this._normValueFromMouse(position);

            this._slide(event, this._handleIndex, normValue);

            return false;
        },

        _mouseStop: function (event) {
            this._removeClass(this.handles, null, "ui-state-active");
            this._mouseSliding = false;

            this._stop(event, this._handleIndex);
            this._change(event, this._handleIndex);

            this._handleIndex = null;
            this._clickOffset = null;
            this._animateOff = false;

            return false;
        },

        _detectOrientation: function () {
            this.orientation = (this.options.orientation === "vertical") ? "vertical" : "horizontal";
        },

        _normValueFromMouse: function (position) {
            var pixelTotal,
                pixelMouse,
                percentMouse,
                valueTotal,
                valueMouse;

            if (this.orientation === "horizontal") {
                pixelTotal = this.elementSize.width;
                pixelMouse = position.x - this.elementOffset.left -
                    (this._clickOffset ? this._clickOffset.left : 0);
            } else {
                pixelTotal = this.elementSize.height;
                pixelMouse = position.y - this.elementOffset.top -
                    (this._clickOffset ? this._clickOffset.top : 0);
            }

            percentMouse = (pixelMouse / pixelTotal);
            if (percentMouse > 1) {
                percentMouse = 1;
            }
            if (percentMouse < 0) {
                percentMouse = 0;
            }
            if (this.orientation === "vertical") {
                percentMouse = 1 - percentMouse;
            }

            valueTotal = this._valueMax() - this._valueMin();
            valueMouse = this._valueMin() + percentMouse * valueTotal;

            return this._trimAlignValue(valueMouse);
        },

        _uiHash: function (index, value, values) {
            var uiHash = {
                handle: this.handles[index],
                handleIndex: index,
                value: value !== undefined ? value : this.value()
            };

            if (this._hasMultipleValues()) {
                uiHash.value = value !== undefined ? value : this.values(index);
                uiHash.values = values || this.values();
            }

            return uiHash;
        },

        _hasMultipleValues: function () {
            return this.options.values && this.options.values.length;
        },

        _start: function (event, index) {
            return this._trigger("start", event, this._uiHash(index));
        },

        _slide: function (event, index, newVal) {
            var allowed, otherVal,
                currentValue = this.value(),
                newValues = this.values();

            if (this._hasMultipleValues()) {
                otherVal = this.values(index ? 0 : 1);
                currentValue = this.values(index);

                if (this.options.values.length === 2 && this.options.range === true) {
                    newVal = index === 0 ? Math.min(otherVal, newVal) : Math.max(otherVal, newVal);
                }

                newValues[index] = newVal;
            }

            if (newVal === currentValue) {
                return;
            }

            allowed = this._trigger("slide", event, this._uiHash(index, newVal, newValues));

            // A slide can be canceled by returning false from the slide callback
            if (allowed === false) {
                return;
            }

            if (this._hasMultipleValues()) {
                this.values(index, newVal);
            } else {
                this.value(newVal);
            }
        },

        _stop: function (event, index) {
            this._trigger("stop", event, this._uiHash(index));
        },

        _change: function (event, index) {
            if (!this._keySliding && !this._mouseSliding) {

                //store the last changed value index for reference when handles overlap
                this._lastChangedValue = index;
                this._trigger("change", event, this._uiHash(index));
            }
        },

        value: function (newValue) {
            if (arguments.length) {
                this.options.value = this._trimAlignValue(newValue);
                this._refreshValue();
                this._change(null, 0);
                return;
            }

            return this._value();
        },

        values: function (index, newValue) {
            var vals,
                newValues,
                i;

            if (arguments.length > 1) {
                this.options.values[index] = this._trimAlignValue(newValue);
                this._refreshValue();
                this._change(null, index);
                return;
            }

            if (arguments.length) {
                if ($.isArray(arguments[0])) {
                    vals = this.options.values;
                    newValues = arguments[0];
                    for (i = 0; i < vals.length; i += 1) {
                        vals[i] = this._trimAlignValue(newValues[i]);
                        this._change(null, i);
                    }
                    this._refreshValue();
                } else {
                    if (this._hasMultipleValues()) {
                        return this._values(index);
                    } else {
                        return this.value();
                    }
                }
            } else {
                return this._values();
            }
        },

        _setOption: function (key, value) {
            var i,
                valsLength = 0;

            if (key === "range" && this.options.range === true) {
                if (value === "min") {
                    this.options.value = this._values(0);
                    this.options.values = null;
                } else if (value === "max") {
                    this.options.value = this._values(this.options.values.length - 1);
                    this.options.values = null;
                }
            }

            if ($.isArray(this.options.values)) {
                valsLength = this.options.values.length;
            }

            this._super(key, value);

            switch (key) {
                case "orientation":
                    this._detectOrientation();
                    this._removeClass("ui-slider-horizontal ui-slider-vertical")
                        ._addClass("ui-slider-" + this.orientation);
                    this._refreshValue();
                    if (this.options.range) {
                        this._refreshRange(value);
                    }

                    // Reset positioning from previous orientation
                    this.handles.css(value === "horizontal" ? "bottom" : "left", "");
                    break;
                case "value":
                    this._animateOff = true;
                    this._refreshValue();
                    this._change(null, 0);
                    this._animateOff = false;
                    break;
                case "values":
                    this._animateOff = true;
                    this._refreshValue();

                    // Start from the last handle to prevent unreachable handles (#9046)
                    for (i = valsLength - 1; i >= 0; i--) {
                        this._change(null, i);
                    }
                    this._animateOff = false;
                    break;
                case "step":
                case "min":
                case "max":
                    this._animateOff = true;
                    this._calculateNewMax();
                    this._refreshValue();
                    this._animateOff = false;
                    break;
                case "range":
                    this._animateOff = true;
                    this._refresh();
                    this._animateOff = false;
                    break;
            }
        },

        _setOptionDisabled: function (value) {
            this._super(value);

            this._toggleClass(null, "ui-state-disabled", !!value);
        },

        //internal value getter
        // _value() returns value trimmed by min and max, aligned by step
        _value: function () {
            var val = this.options.value;
            val = this._trimAlignValue(val);

            return val;
        },

        //internal values getter
        // _values() returns array of values trimmed by min and max, aligned by step
        // _values( index ) returns single value trimmed by min and max, aligned by step
        _values: function (index) {
            var val,
                vals,
                i;

            if (arguments.length) {
                val = this.options.values[index];
                val = this._trimAlignValue(val);

                return val;
            } else if (this._hasMultipleValues()) {

                // .slice() creates a copy of the array
                // this copy gets trimmed by min and max and then returned
                vals = this.options.values.slice();
                for (i = 0; i < vals.length; i += 1) {
                    vals[i] = this._trimAlignValue(vals[i]);
                }

                return vals;
            } else {
                return [];
            }
        },

        // Returns the step-aligned value that val is closest to, between (inclusive) min and max
        _trimAlignValue: function (val) {
            if (val <= this._valueMin()) {
                return this._valueMin();
            }
            if (val >= this._valueMax()) {
                return this._valueMax();
            }
            var step = (this.options.step > 0) ? this.options.step : 1,
                valModStep = (val - this._valueMin()) % step,
                alignValue = val - valModStep;

            if (Math.abs(valModStep) * 2 >= step) {
                alignValue += (valModStep > 0) ? step : (-step);
            }

            // Since JavaScript has problems with large floats, round
            // the final value to 5 digits after the decimal point (see #4124)
            return parseFloat(alignValue.toFixed(5));
        },

        _calculateNewMax: function () {
            var max = this.options.max,
                min = this._valueMin(),
                step = this.options.step,
                aboveMin = Math.round((max - min) / step) * step;
            max = aboveMin + min;
            if (max > this.options.max) {

                //If max is not divisible by step, rounding off may increase its value
                max -= step;
            }
            this.max = parseFloat(max.toFixed(this._precision()));
        },

        _precision: function () {
            var precision = this._precisionOf(this.options.step);
            if (this.options.min !== null) {
                precision = Math.max(precision, this._precisionOf(this.options.min));
            }
            return precision;
        },

        _precisionOf: function (num) {
            var str = num.toString(),
                decimal = str.indexOf(".");
            return decimal === -1 ? 0 : str.length - decimal - 1;
        },

        _valueMin: function () {
            return this.options.min;
        },

        _valueMax: function () {
            return this.max;
        },

        _refreshRange: function (orientation) {
            if (orientation === "vertical") {
                this.range.css({ "width": "", "left": "" });
            }
            if (orientation === "horizontal") {
                this.range.css({ "height": "", "bottom": "" });
            }
        },

        _refreshValue: function () {
            var lastValPercent, valPercent, value, valueMin, valueMax,
                oRange = this.options.range,
                o = this.options,
                that = this,
                animate = (!this._animateOff) ? o.animate : false,
                _set = {};

            if (this._hasMultipleValues()) {
                this.handles.each(function (i) {
                    valPercent = (that.values(i) - that._valueMin()) / (that._valueMax() -
                        that._valueMin()) * 100;
                    _set[that.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
                    $(this).stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);
                    if (that.options.range === true) {
                        if (that.orientation === "horizontal") {
                            if (i === 0) {
                                that.range.stop(1, 1)[animate ? "animate" : "css"]({
                                    left: valPercent + "%"
                                }, o.animate);
                            }
                            if (i === 1) {
                                that.range[animate ? "animate" : "css"]({
                                    width: (valPercent - lastValPercent) + "%"
                                }, {
                                        queue: false,
                                        duration: o.animate
                                    });
                            }
                        } else {
                            if (i === 0) {
                                that.range.stop(1, 1)[animate ? "animate" : "css"]({
                                    bottom: (valPercent) + "%"
                                }, o.animate);
                            }
                            if (i === 1) {
                                that.range[animate ? "animate" : "css"]({
                                    height: (valPercent - lastValPercent) + "%"
                                }, {
                                        queue: false,
                                        duration: o.animate
                                    });
                            }
                        }
                    }
                    lastValPercent = valPercent;
                });
            } else {
                value = this.value();
                valueMin = this._valueMin();
                valueMax = this._valueMax();
                valPercent = (valueMax !== valueMin) ?
                    (value - valueMin) / (valueMax - valueMin) * 100 :
                    0;
                _set[this.orientation === "horizontal" ? "left" : "bottom"] = valPercent + "%";
                this.handle.stop(1, 1)[animate ? "animate" : "css"](_set, o.animate);

                if (oRange === "min" && this.orientation === "horizontal") {
                    this.range.stop(1, 1)[animate ? "animate" : "css"]({
                        width: valPercent + "%"
                    }, o.animate);
                }
                if (oRange === "max" && this.orientation === "horizontal") {
                    this.range.stop(1, 1)[animate ? "animate" : "css"]({
                        width: (100 - valPercent) + "%"
                    }, o.animate);
                }
                if (oRange === "min" && this.orientation === "vertical") {
                    this.range.stop(1, 1)[animate ? "animate" : "css"]({
                        height: valPercent + "%"
                    }, o.animate);
                }
                if (oRange === "max" && this.orientation === "vertical") {
                    this.range.stop(1, 1)[animate ? "animate" : "css"]({
                        height: (100 - valPercent) + "%"
                    }, o.animate);
                }
            }
        },

        _handleEvents: {
            keydown: function (event) {
                var allowed, curVal, newVal, step,
                    index = $(event.target).data("ui-slider-handle-index");

                switch (event.keyCode) {
                    case $.ui.keyCode.HOME:
                    case $.ui.keyCode.END:
                    case $.ui.keyCode.PAGE_UP:
                    case $.ui.keyCode.PAGE_DOWN:
                    case $.ui.keyCode.UP:
                    case $.ui.keyCode.RIGHT:
                    case $.ui.keyCode.DOWN:
                    case $.ui.keyCode.LEFT:
                        event.preventDefault();
                        if (!this._keySliding) {
                            this._keySliding = true;
                            this._addClass($(event.target), null, "ui-state-active");
                            allowed = this._start(event, index);
                            if (allowed === false) {
                                return;
                            }
                        }
                        break;
                }

                step = this.options.step;
                if (this._hasMultipleValues()) {
                    curVal = newVal = this.values(index);
                } else {
                    curVal = newVal = this.value();
                }

                switch (event.keyCode) {
                    case $.ui.keyCode.HOME:
                        newVal = this._valueMin();
                        break;
                    case $.ui.keyCode.END:
                        newVal = this._valueMax();
                        break;
                    case $.ui.keyCode.PAGE_UP:
                        newVal = this._trimAlignValue(
                            curVal + ((this._valueMax() - this._valueMin()) / this.numPages)
                        );
                        break;
                    case $.ui.keyCode.PAGE_DOWN:
                        newVal = this._trimAlignValue(
                            curVal - ((this._valueMax() - this._valueMin()) / this.numPages));
                        break;
                    case $.ui.keyCode.UP:
                    case $.ui.keyCode.RIGHT:
                        if (curVal === this._valueMax()) {
                            return;
                        }
                        newVal = this._trimAlignValue(curVal + step);
                        break;
                    case $.ui.keyCode.DOWN:
                    case $.ui.keyCode.LEFT:
                        if (curVal === this._valueMin()) {
                            return;
                        }
                        newVal = this._trimAlignValue(curVal - step);
                        break;
                }

                this._slide(event, index, newVal);
            },
            keyup: function (event) {
                var index = $(event.target).data("ui-slider-handle-index");

                if (this._keySliding) {
                    this._keySliding = false;
                    this._stop(event, index);
                    this._change(event, index);
                    this._removeClass($(event.target), null, "ui-state-active");
                }
            }
        }
    });


    /*!
     * jQuery UI Spinner 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Spinner
    //>>group: Widgets
    //>>description: Displays buttons to easily input numbers via the keyboard or mouse.
    //>>docs: http://api.jqueryui.com/spinner/
    //>>demos: http://jqueryui.com/spinner/
    //>>css.structure: ../../themes/base/core.css
    //>>css.structure: ../../themes/base/spinner.css
    //>>css.theme: ../../themes/base/theme.css



    function spinnerModifer(fn) {
        return function () {
            var previous = this.element.val();
            fn.apply(this, arguments);
            this._refresh();
            if (previous !== this.element.val()) {
                this._trigger("change");
            }
        };
    }

    $.widget("ui.spinner", {
        version: "1.12.1",
        defaultElement: "<input>",
        widgetEventPrefix: "spin",
        options: {
            classes: {
                "ui-spinner": "ui-corner-all",
                "ui-spinner-down": "ui-corner-br",
                "ui-spinner-up": "ui-corner-tr"
            },
            culture: null,
            icons: {
                down: "ui-icon-triangle-1-s",
                up: "ui-icon-triangle-1-n"
            },
            incremental: true,
            max: null,
            min: null,
            numberFormat: null,
            page: 10,
            step: 1,

            change: null,
            spin: null,
            start: null,
            stop: null
        },

        _create: function () {

            // handle string values that need to be parsed
            this._setOption("max", this.options.max);
            this._setOption("min", this.options.min);
            this._setOption("step", this.options.step);

            // Only format if there is a value, prevents the field from being marked
            // as invalid in Firefox, see #9573.
            if (this.value() !== "") {

                // Format the value, but don't constrain.
                this._value(this.element.val(), true);
            }

            this._draw();
            this._on(this._events);
            this._refresh();

            // Turning off autocomplete prevents the browser from remembering the
            // value when navigating through history, so we re-enable autocomplete
            // if the page is unloaded before the widget is destroyed. #7790
            this._on(this.window, {
                beforeunload: function () {
                    this.element.removeAttr("autocomplete");
                }
            });
        },

        _getCreateOptions: function () {
            var options = this._super();
            var element = this.element;

            $.each(["min", "max", "step"], function (i, option) {
                var value = element.attr(option);
                if (value != null && value.length) {
                    options[option] = value;
                }
            });

            return options;
        },

        _events: {
            keydown: function (event) {
                if (this._start(event) && this._keydown(event)) {
                    event.preventDefault();
                }
            },
            keyup: "_stop",
            focus: function () {
                this.previous = this.element.val();
            },
            blur: function (event) {
                if (this.cancelBlur) {
                    delete this.cancelBlur;
                    return;
                }

                this._stop();
                this._refresh();
                if (this.previous !== this.element.val()) {
                    this._trigger("change", event);
                }
            },
            mousewheel: function (event, delta) {
                if (!delta) {
                    return;
                }
                if (!this.spinning && !this._start(event)) {
                    return false;
                }

                this._spin((delta > 0 ? 1 : -1) * this.options.step, event);
                clearTimeout(this.mousewheelTimer);
                this.mousewheelTimer = this._delay(function () {
                    if (this.spinning) {
                        this._stop(event);
                    }
                }, 100);
                event.preventDefault();
            },
            "mousedown .ui-spinner-button": function (event) {
                var previous;

                // We never want the buttons to have focus; whenever the user is
                // interacting with the spinner, the focus should be on the input.
                // If the input is focused then this.previous is properly set from
                // when the input first received focus. If the input is not focused
                // then we need to set this.previous based on the value before spinning.
                previous = this.element[0] === $.ui.safeActiveElement(this.document[0]) ?
                    this.previous : this.element.val();
                function checkFocus() {
                    var isActive = this.element[0] === $.ui.safeActiveElement(this.document[0]);
                    if (!isActive) {
                        this.element.trigger("focus");
                        this.previous = previous;

                        // support: IE
                        // IE sets focus asynchronously, so we need to check if focus
                        // moved off of the input because the user clicked on the button.
                        this._delay(function () {
                            this.previous = previous;
                        });
                    }
                }

                // Ensure focus is on (or stays on) the text field
                event.preventDefault();
                checkFocus.call(this);

                // Support: IE
                // IE doesn't prevent moving focus even with event.preventDefault()
                // so we set a flag to know when we should ignore the blur event
                // and check (again) if focus moved off of the input.
                this.cancelBlur = true;
                this._delay(function () {
                    delete this.cancelBlur;
                    checkFocus.call(this);
                });

                if (this._start(event) === false) {
                    return;
                }

                this._repeat(null, $(event.currentTarget)
                    .hasClass("ui-spinner-up") ? 1 : -1, event);
            },
            "mouseup .ui-spinner-button": "_stop",
            "mouseenter .ui-spinner-button": function (event) {

                // button will add ui-state-active if mouse was down while mouseleave and kept down
                if (!$(event.currentTarget).hasClass("ui-state-active")) {
                    return;
                }

                if (this._start(event) === false) {
                    return false;
                }
                this._repeat(null, $(event.currentTarget)
                    .hasClass("ui-spinner-up") ? 1 : -1, event);
            },

            // TODO: do we really want to consider this a stop?
            // shouldn't we just stop the repeater and wait until mouseup before
            // we trigger the stop event?
            "mouseleave .ui-spinner-button": "_stop"
        },

        // Support mobile enhanced option and make backcompat more sane
        _enhance: function () {
            this.uiSpinner = this.element
                .attr("autocomplete", "off")
                .wrap("<span>")
                .parent()

                // Add buttons
                .append(
                    "<a></a><a></a>"
                );
        },

        _draw: function () {
            this._enhance();

            this._addClass(this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content");
            this._addClass("ui-spinner-input");

            this.element.attr("role", "spinbutton");

            // Button bindings
            this.buttons = this.uiSpinner.children("a")
                .attr("tabIndex", -1)
                .attr("aria-hidden", true)
                .button({
                    classes: {
                        "ui-button": ""
                    }
                });

            // TODO: Right now button does not support classes this is already updated in button PR
            this._removeClass(this.buttons, "ui-corner-all");

            this._addClass(this.buttons.first(), "ui-spinner-button ui-spinner-up");
            this._addClass(this.buttons.last(), "ui-spinner-button ui-spinner-down");
            this.buttons.first().button({
                "icon": this.options.icons.up,
                "showLabel": false
            });
            this.buttons.last().button({
                "icon": this.options.icons.down,
                "showLabel": false
            });

            // IE 6 doesn't understand height: 50% for the buttons
            // unless the wrapper has an explicit height
            if (this.buttons.height() > Math.ceil(this.uiSpinner.height() * 0.5) &&
                this.uiSpinner.height() > 0) {
                this.uiSpinner.height(this.uiSpinner.height());
            }
        },

        _keydown: function (event) {
            var options = this.options,
                keyCode = $.ui.keyCode;

            switch (event.keyCode) {
                case keyCode.UP:
                    this._repeat(null, 1, event);
                    return true;
                case keyCode.DOWN:
                    this._repeat(null, -1, event);
                    return true;
                case keyCode.PAGE_UP:
                    this._repeat(null, options.page, event);
                    return true;
                case keyCode.PAGE_DOWN:
                    this._repeat(null, -options.page, event);
                    return true;
            }

            return false;
        },

        _start: function (event) {
            if (!this.spinning && this._trigger("start", event) === false) {
                return false;
            }

            if (!this.counter) {
                this.counter = 1;
            }
            this.spinning = true;
            return true;
        },

        _repeat: function (i, steps, event) {
            i = i || 500;

            clearTimeout(this.timer);
            this.timer = this._delay(function () {
                this._repeat(40, steps, event);
            }, i);

            this._spin(steps * this.options.step, event);
        },

        _spin: function (step, event) {
            var value = this.value() || 0;

            if (!this.counter) {
                this.counter = 1;
            }

            value = this._adjustValue(value + step * this._increment(this.counter));

            if (!this.spinning || this._trigger("spin", event, { value: value }) !== false) {
                this._value(value);
                this.counter++;
            }
        },

        _increment: function (i) {
            var incremental = this.options.incremental;

            if (incremental) {
                return $.isFunction(incremental) ?
                    incremental(i) :
                    Math.floor(i * i * i / 50000 - i * i / 500 + 17 * i / 200 + 1);
            }

            return 1;
        },

        _precision: function () {
            var precision = this._precisionOf(this.options.step);
            if (this.options.min !== null) {
                precision = Math.max(precision, this._precisionOf(this.options.min));
            }
            return precision;
        },

        _precisionOf: function (num) {
            var str = num.toString(),
                decimal = str.indexOf(".");
            return decimal === -1 ? 0 : str.length - decimal - 1;
        },

        _adjustValue: function (value) {
            var base, aboveMin,
                options = this.options;

            // Make sure we're at a valid step
            // - find out where we are relative to the base (min or 0)
            base = options.min !== null ? options.min : 0;
            aboveMin = value - base;

            // - round to the nearest step
            aboveMin = Math.round(aboveMin / options.step) * options.step;

            // - rounding is based on 0, so adjust back to our base
            value = base + aboveMin;

            // Fix precision from bad JS floating point math
            value = parseFloat(value.toFixed(this._precision()));

            // Clamp the value
            if (options.max !== null && value > options.max) {
                return options.max;
            }
            if (options.min !== null && value < options.min) {
                return options.min;
            }

            return value;
        },

        _stop: function (event) {
            if (!this.spinning) {
                return;
            }

            clearTimeout(this.timer);
            clearTimeout(this.mousewheelTimer);
            this.counter = 0;
            this.spinning = false;
            this._trigger("stop", event);
        },

        _setOption: function (key, value) {
            var prevValue, first, last;

            if (key === "culture" || key === "numberFormat") {
                prevValue = this._parse(this.element.val());
                this.options[key] = value;
                this.element.val(this._format(prevValue));
                return;
            }

            if (key === "max" || key === "min" || key === "step") {
                if (typeof value === "string") {
                    value = this._parse(value);
                }
            }
            if (key === "icons") {
                first = this.buttons.first().find(".ui-icon");
                this._removeClass(first, null, this.options.icons.up);
                this._addClass(first, null, value.up);
                last = this.buttons.last().find(".ui-icon");
                this._removeClass(last, null, this.options.icons.down);
                this._addClass(last, null, value.down);
            }

            this._super(key, value);
        },

        _setOptionDisabled: function (value) {
            this._super(value);

            this._toggleClass(this.uiSpinner, null, "ui-state-disabled", !!value);
            this.element.prop("disabled", !!value);
            this.buttons.button(value ? "disable" : "enable");
        },

        _setOptions: spinnerModifer(function (options) {
            this._super(options);
        }),

        _parse: function (val) {
            if (typeof val === "string" && val !== "") {
                val = window.Globalize && this.options.numberFormat ?
                    Globalize.parseFloat(val, 10, this.options.culture) : +val;
            }
            return val === "" || isNaN(val) ? null : val;
        },

        _format: function (value) {
            if (value === "") {
                return "";
            }
            return window.Globalize && this.options.numberFormat ?
                Globalize.format(value, this.options.numberFormat, this.options.culture) :
                value;
        },

        _refresh: function () {
            this.element.attr({
                "aria-valuemin": this.options.min,
                "aria-valuemax": this.options.max,

                // TODO: what should we do with values that can't be parsed?
                "aria-valuenow": this._parse(this.element.val())
            });
        },

        isValid: function () {
            var value = this.value();

            // Null is invalid
            if (value === null) {
                return false;
            }

            // If value gets adjusted, it's invalid
            return value === this._adjustValue(value);
        },

        // Update the value without triggering change
        _value: function (value, allowAny) {
            var parsed;
            if (value !== "") {
                parsed = this._parse(value);
                if (parsed !== null) {
                    if (!allowAny) {
                        parsed = this._adjustValue(parsed);
                    }
                    value = this._format(parsed);
                }
            }
            this.element.val(value);
            this._refresh();
        },

        _destroy: function () {
            this.element
                .prop("disabled", false)
                .removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow");

            this.uiSpinner.replaceWith(this.element);
        },

        stepUp: spinnerModifer(function (steps) {
            this._stepUp(steps);
        }),
        _stepUp: function (steps) {
            if (this._start()) {
                this._spin((steps || 1) * this.options.step);
                this._stop();
            }
        },

        stepDown: spinnerModifer(function (steps) {
            this._stepDown(steps);
        }),
        _stepDown: function (steps) {
            if (this._start()) {
                this._spin((steps || 1) * -this.options.step);
                this._stop();
            }
        },

        pageUp: spinnerModifer(function (pages) {
            this._stepUp((pages || 1) * this.options.page);
        }),

        pageDown: spinnerModifer(function (pages) {
            this._stepDown((pages || 1) * this.options.page);
        }),

        value: function (newVal) {
            if (!arguments.length) {
                return this._parse(this.element.val());
            }
            spinnerModifer(this._value).call(this, newVal);
        },

        widget: function () {
            return this.uiSpinner;
        }
    });

    // DEPRECATED
    // TODO: switch return back to widget declaration at top of file when this is removed
    if ($.uiBackCompat !== false) {

        // Backcompat for spinner html extension points
        $.widget("ui.spinner", $.ui.spinner, {
            _enhance: function () {
                this.uiSpinner = this.element
                    .attr("autocomplete", "off")
                    .wrap(this._uiSpinnerHtml())
                    .parent()

                    // Add buttons
                    .append(this._buttonHtml());
            },
            _uiSpinnerHtml: function () {
                return "<span>";
            },

            _buttonHtml: function () {
                return "<a></a><a></a>";
            }
        });
    }

    var widgetsSpinner = $.ui.spinner;


    /*!
     * jQuery UI Tabs 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Tabs
    //>>group: Widgets
    //>>description: Transforms a set of container elements into a tab structure.
    //>>docs: http://api.jqueryui.com/tabs/
    //>>demos: http://jqueryui.com/tabs/
    //>>css.structure: ../../themes/base/core.css
    //>>css.structure: ../../themes/base/tabs.css
    //>>css.theme: ../../themes/base/theme.css



    $.widget("ui.tabs", {
        version: "1.12.1",
        delay: 300,
        options: {
            active: null,
            classes: {
                "ui-tabs": "ui-corner-all",
                "ui-tabs-nav": "ui-corner-all",
                "ui-tabs-panel": "ui-corner-bottom",
                "ui-tabs-tab": "ui-corner-top"
            },
            collapsible: false,
            event: "click",
            heightStyle: "content",
            hide: null,
            show: null,

            // Callbacks
            activate: null,
            beforeActivate: null,
            beforeLoad: null,
            load: null
        },

        _isLocal: (function () {
            var rhash = /#.*$/;

            return function (anchor) {
                var anchorUrl, locationUrl;

                anchorUrl = anchor.href.replace(rhash, "");
                locationUrl = location.href.replace(rhash, "");

                // Decoding may throw an error if the URL isn't UTF-8 (#9518)
                try {
                    anchorUrl = decodeURIComponent(anchorUrl);
                } catch (error) { }
                try {
                    locationUrl = decodeURIComponent(locationUrl);
                } catch (error) { }

                return anchor.hash.length > 1 && anchorUrl === locationUrl;
            };
        })(),

        _create: function () {
            var that = this,
                options = this.options;

            this.running = false;

            this._addClass("ui-tabs", "ui-widget ui-widget-content");
            this._toggleClass("ui-tabs-collapsible", null, options.collapsible);

            this._processTabs();
            options.active = this._initialActive();

            // Take disabling tabs via class attribute from HTML
            // into account and update option properly.
            if ($.isArray(options.disabled)) {
                options.disabled = $.unique(options.disabled.concat(
                    $.map(this.tabs.filter(".ui-state-disabled"), function (li) {
                        return that.tabs.index(li);
                    })
                )).sort();
            }

            // Check for length avoids error when initializing empty list
            if (this.options.active !== false && this.anchors.length) {
                this.active = this._findActive(options.active);
            } else {
                this.active = $();
            }

            this._refresh();

            if (this.active.length) {
                this.load(options.active);
            }
        },

        _initialActive: function () {
            var active = this.options.active,
                collapsible = this.options.collapsible,
                locationHash = location.hash.substring(1);

            if (active === null) {

                // check the fragment identifier in the URL
                if (locationHash) {
                    this.tabs.each(function (i, tab) {
                        if ($(tab).attr("aria-controls") === locationHash) {
                            active = i;
                            return false;
                        }
                    });
                }

                // Check for a tab marked active via a class
                if (active === null) {
                    active = this.tabs.index(this.tabs.filter(".ui-tabs-active"));
                }

                // No active tab, set to false
                if (active === null || active === -1) {
                    active = this.tabs.length ? 0 : false;
                }
            }

            // Handle numbers: negative, out of range
            if (active !== false) {
                active = this.tabs.index(this.tabs.eq(active));
                if (active === -1) {
                    active = collapsible ? false : 0;
                }
            }

            // Don't allow collapsible: false and active: false
            if (!collapsible && active === false && this.anchors.length) {
                active = 0;
            }

            return active;
        },

        _getCreateEventData: function () {
            return {
                tab: this.active,
                panel: !this.active.length ? $() : this._getPanelForTab(this.active)
            };
        },

        _tabKeydown: function (event) {
            var focusedTab = $($.ui.safeActiveElement(this.document[0])).closest("li"),
                selectedIndex = this.tabs.index(focusedTab),
                goingForward = true;

            if (this._handlePageNav(event)) {
                return;
            }

            switch (event.keyCode) {
                case $.ui.keyCode.RIGHT:
                case $.ui.keyCode.DOWN:
                    selectedIndex++;
                    break;
                case $.ui.keyCode.UP:
                case $.ui.keyCode.LEFT:
                    goingForward = false;
                    selectedIndex--;
                    break;
                case $.ui.keyCode.END:
                    selectedIndex = this.anchors.length - 1;
                    break;
                case $.ui.keyCode.HOME:
                    selectedIndex = 0;
                    break;
                case $.ui.keyCode.SPACE:

                    // Activate only, no collapsing
                    event.preventDefault();
                    clearTimeout(this.activating);
                    this._activate(selectedIndex);
                    return;
                case $.ui.keyCode.ENTER:

                    // Toggle (cancel delayed activation, allow collapsing)
                    event.preventDefault();
                    clearTimeout(this.activating);

                    // Determine if we should collapse or activate
                    this._activate(selectedIndex === this.options.active ? false : selectedIndex);
                    return;
                default:
                    return;
            }

            // Focus the appropriate tab, based on which key was pressed
            event.preventDefault();
            clearTimeout(this.activating);
            selectedIndex = this._focusNextTab(selectedIndex, goingForward);

            // Navigating with control/command key will prevent automatic activation
            if (!event.ctrlKey && !event.metaKey) {

                // Update aria-selected immediately so that AT think the tab is already selected.
                // Otherwise AT may confuse the user by stating that they need to activate the tab,
                // but the tab will already be activated by the time the announcement finishes.
                focusedTab.attr("aria-selected", "false");
                this.tabs.eq(selectedIndex).attr("aria-selected", "true");

                this.activating = this._delay(function () {
                    this.option("active", selectedIndex);
                }, this.delay);
            }
        },

        _panelKeydown: function (event) {
            if (this._handlePageNav(event)) {
                return;
            }

            // Ctrl+up moves focus to the current tab
            if (event.ctrlKey && event.keyCode === $.ui.keyCode.UP) {
                event.preventDefault();
                this.active.trigger("focus");
            }
        },

        // Alt+page up/down moves focus to the previous/next tab (and activates)
        _handlePageNav: function (event) {
            if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP) {
                this._activate(this._focusNextTab(this.options.active - 1, false));
                return true;
            }
            if (event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN) {
                this._activate(this._focusNextTab(this.options.active + 1, true));
                return true;
            }
        },

        _findNextTab: function (index, goingForward) {
            var lastTabIndex = this.tabs.length - 1;

            function constrain() {
                if (index > lastTabIndex) {
                    index = 0;
                }
                if (index < 0) {
                    index = lastTabIndex;
                }
                return index;
            }

            while ($.inArray(constrain(), this.options.disabled) !== -1) {
                index = goingForward ? index + 1 : index - 1;
            }

            return index;
        },

        _focusNextTab: function (index, goingForward) {
            index = this._findNextTab(index, goingForward);
            this.tabs.eq(index).trigger("focus");
            return index;
        },

        _setOption: function (key, value) {
            if (key === "active") {

                // _activate() will handle invalid values and update this.options
                this._activate(value);
                return;
            }

            this._super(key, value);

            if (key === "collapsible") {
                this._toggleClass("ui-tabs-collapsible", null, value);

                // Setting collapsible: false while collapsed; open first panel
                if (!value && this.options.active === false) {
                    this._activate(0);
                }
            }

            if (key === "event") {
                this._setupEvents(value);
            }

            if (key === "heightStyle") {
                this._setupHeightStyle(value);
            }
        },

        _sanitizeSelector: function (hash) {
            return hash ? hash.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&") : "";
        },

        refresh: function () {
            var options = this.options,
                lis = this.tablist.children(":has(a[href])");

            // Get disabled tabs from class attribute from HTML
            // this will get converted to a boolean if needed in _refresh()
            options.disabled = $.map(lis.filter(".ui-state-disabled"), function (tab) {
                return lis.index(tab);
            });

            this._processTabs();

            // Was collapsed or no tabs
            if (options.active === false || !this.anchors.length) {
                options.active = false;
                this.active = $();

                // was active, but active tab is gone
            } else if (this.active.length && !$.contains(this.tablist[0], this.active[0])) {

                // all remaining tabs are disabled
                if (this.tabs.length === options.disabled.length) {
                    options.active = false;
                    this.active = $();

                    // activate previous tab
                } else {
                    this._activate(this._findNextTab(Math.max(0, options.active - 1), false));
                }

                // was active, active tab still exists
            } else {

                // make sure active index is correct
                options.active = this.tabs.index(this.active);
            }

            this._refresh();
        },

        _refresh: function () {
            this._setOptionDisabled(this.options.disabled);
            this._setupEvents(this.options.event);
            this._setupHeightStyle(this.options.heightStyle);

            this.tabs.not(this.active).attr({
                "aria-selected": "false",
                "aria-expanded": "false",
                tabIndex: -1
            });
            this.panels.not(this._getPanelForTab(this.active))
                .hide()
                .attr({
                    "aria-hidden": "true"
                });

            // Make sure one tab is in the tab order
            if (!this.active.length) {
                this.tabs.eq(0).attr("tabIndex", 0);
            } else {
                this.active
                    .attr({
                        "aria-selected": "true",
                        "aria-expanded": "true",
                        tabIndex: 0
                    });
                this._addClass(this.active, "ui-tabs-active", "ui-state-active");
                this._getPanelForTab(this.active)
                    .show()
                    .attr({
                        "aria-hidden": "false"
                    });
            }
        },

        _processTabs: function () {
            var that = this,
                prevTabs = this.tabs,
                prevAnchors = this.anchors,
                prevPanels = this.panels;

            this.tablist = this._getList().attr("role", "tablist");
            this._addClass(this.tablist, "ui-tabs-nav",
                "ui-helper-reset ui-helper-clearfix ui-widget-header");

            // Prevent users from focusing disabled tabs via click
            this.tablist
                .on("mousedown" + this.eventNamespace, "> li", function (event) {
                    if ($(this).is(".ui-state-disabled")) {
                        event.preventDefault();
                    }
                })

                // Support: IE <9
                // Preventing the default action in mousedown doesn't prevent IE
                // from focusing the element, so if the anchor gets focused, blur.
                // We don't have to worry about focusing the previously focused
                // element since clicking on a non-focusable element should focus
                // the body anyway.
                .on("focus" + this.eventNamespace, ".ui-tabs-anchor", function () {
                    if ($(this).closest("li").is(".ui-state-disabled")) {
                        this.blur();
                    }
                });

            this.tabs = this.tablist.find("> li:has(a[href])")
                .attr({
                    role: "tab",
                    tabIndex: -1
                });
            this._addClass(this.tabs, "ui-tabs-tab", "ui-state-default");

            this.anchors = this.tabs.map(function () {
                return $("a", this)[0];
            })
                .attr({
                    role: "presentation",
                    tabIndex: -1
                });
            this._addClass(this.anchors, "ui-tabs-anchor");

            this.panels = $();

            this.anchors.each(function (i, anchor) {
                var selector, panel, panelId,
                    anchorId = $(anchor).uniqueId().attr("id"),
                    tab = $(anchor).closest("li"),
                    originalAriaControls = tab.attr("aria-controls");

                // Inline tab
                if (that._isLocal(anchor)) {
                    selector = anchor.hash;
                    panelId = selector.substring(1);
                    panel = that.element.find(that._sanitizeSelector(selector));

                    // remote tab
                } else {

                    // If the tab doesn't already have aria-controls,
                    // generate an id by using a throw-away element
                    panelId = tab.attr("aria-controls") || $({}).uniqueId()[0].id;
                    selector = "#" + panelId;
                    panel = that.element.find(selector);
                    if (!panel.length) {
                        panel = that._createPanel(panelId);
                        panel.insertAfter(that.panels[i - 1] || that.tablist);
                    }
                    panel.attr("aria-live", "polite");
                }

                if (panel.length) {
                    that.panels = that.panels.add(panel);
                }
                if (originalAriaControls) {
                    tab.data("ui-tabs-aria-controls", originalAriaControls);
                }
                tab.attr({
                    "aria-controls": panelId,
                    "aria-labelledby": anchorId
                });
                panel.attr("aria-labelledby", anchorId);
            });

            this.panels.attr("role", "tabpanel");
            this._addClass(this.panels, "ui-tabs-panel", "ui-widget-content");

            // Avoid memory leaks (#10056)
            if (prevTabs) {
                this._off(prevTabs.not(this.tabs));
                this._off(prevAnchors.not(this.anchors));
                this._off(prevPanels.not(this.panels));
            }
        },

        // Allow overriding how to find the list for rare usage scenarios (#7715)
        _getList: function () {
            return this.tablist || this.element.find("ol, ul").eq(0);
        },

        _createPanel: function (id) {
            return $("<div>")
                .attr("id", id)
                .data("ui-tabs-destroy", true);
        },

        _setOptionDisabled: function (disabled) {
            var currentItem, li, i;

            if ($.isArray(disabled)) {
                if (!disabled.length) {
                    disabled = false;
                } else if (disabled.length === this.anchors.length) {
                    disabled = true;
                }
            }

            // Disable tabs
            for (i = 0; (li = this.tabs[i]); i++) {
                currentItem = $(li);
                if (disabled === true || $.inArray(i, disabled) !== -1) {
                    currentItem.attr("aria-disabled", "true");
                    this._addClass(currentItem, null, "ui-state-disabled");
                } else {
                    currentItem.removeAttr("aria-disabled");
                    this._removeClass(currentItem, null, "ui-state-disabled");
                }
            }

            this.options.disabled = disabled;

            this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null,
                disabled === true);
        },

        _setupEvents: function (event) {
            var events = {};
            if (event) {
                $.each(event.split(" "), function (index, eventName) {
                    events[eventName] = "_eventHandler";
                });
            }

            this._off(this.anchors.add(this.tabs).add(this.panels));

            // Always prevent the default action, even when disabled
            this._on(true, this.anchors, {
                click: function (event) {
                    event.preventDefault();
                }
            });
            this._on(this.anchors, events);
            this._on(this.tabs, { keydown: "_tabKeydown" });
            this._on(this.panels, { keydown: "_panelKeydown" });

            this._focusable(this.tabs);
            this._hoverable(this.tabs);
        },

        _setupHeightStyle: function (heightStyle) {
            var maxHeight,
                parent = this.element.parent();

            if (heightStyle === "fill") {
                maxHeight = parent.height();
                maxHeight -= this.element.outerHeight() - this.element.height();

                this.element.siblings(":visible").each(function () {
                    var elem = $(this),
                        position = elem.css("position");

                    if (position === "absolute" || position === "fixed") {
                        return;
                    }
                    maxHeight -= elem.outerHeight(true);
                });

                this.element.children().not(this.panels).each(function () {
                    maxHeight -= $(this).outerHeight(true);
                });

                this.panels.each(function () {
                    $(this).height(Math.max(0, maxHeight -
                        $(this).innerHeight() + $(this).height()));
                })
                    .css("overflow", "auto");
            } else if (heightStyle === "auto") {
                maxHeight = 0;
                this.panels.each(function () {
                    maxHeight = Math.max(maxHeight, $(this).height("").height());
                }).height(maxHeight);
            }
        },

        _eventHandler: function (event) {
            var options = this.options,
                active = this.active,
                anchor = $(event.currentTarget),
                tab = anchor.closest("li"),
                clickedIsActive = tab[0] === active[0],
                collapsing = clickedIsActive && options.collapsible,
                toShow = collapsing ? $() : this._getPanelForTab(tab),
                toHide = !active.length ? $() : this._getPanelForTab(active),
                eventData = {
                    oldTab: active,
                    oldPanel: toHide,
                    newTab: collapsing ? $() : tab,
                    newPanel: toShow
                };

            event.preventDefault();

            if (tab.hasClass("ui-state-disabled") ||

                // tab is already loading
                tab.hasClass("ui-tabs-loading") ||

                // can't switch durning an animation
                this.running ||

                // click on active header, but not collapsible
                (clickedIsActive && !options.collapsible) ||

                // allow canceling activation
                (this._trigger("beforeActivate", event, eventData) === false)) {
                return;
            }

            options.active = collapsing ? false : this.tabs.index(tab);

            this.active = clickedIsActive ? $() : tab;
            if (this.xhr) {
                this.xhr.abort();
            }

            if (!toHide.length && !toShow.length) {
                $.error("jQuery UI Tabs: Mismatching fragment identifier.");
            }

            if (toShow.length) {
                this.load(this.tabs.index(tab), event);
            }
            this._toggle(event, eventData);
        },

        // Handles show/hide for selecting tabs
        _toggle: function (event, eventData) {
            var that = this,
                toShow = eventData.newPanel,
                toHide = eventData.oldPanel;

            this.running = true;

            function complete() {
                that.running = false;
                that._trigger("activate", event, eventData);
            }

            function show() {
                that._addClass(eventData.newTab.closest("li"), "ui-tabs-active", "ui-state-active");

                if (toShow.length && that.options.show) {
                    that._show(toShow, that.options.show, complete);
                } else {
                    toShow.show();
                    complete();
                }
            }

            // Start out by hiding, then showing, then completing
            if (toHide.length && this.options.hide) {
                this._hide(toHide, this.options.hide, function () {
                    that._removeClass(eventData.oldTab.closest("li"),
                        "ui-tabs-active", "ui-state-active");
                    show();
                });
            } else {
                this._removeClass(eventData.oldTab.closest("li"),
                    "ui-tabs-active", "ui-state-active");
                toHide.hide();
                show();
            }

            toHide.attr("aria-hidden", "true");
            eventData.oldTab.attr({
                "aria-selected": "false",
                "aria-expanded": "false"
            });

            // If we're switching tabs, remove the old tab from the tab order.
            // If we're opening from collapsed state, remove the previous tab from the tab order.
            // If we're collapsing, then keep the collapsing tab in the tab order.
            if (toShow.length && toHide.length) {
                eventData.oldTab.attr("tabIndex", -1);
            } else if (toShow.length) {
                this.tabs.filter(function () {
                    return $(this).attr("tabIndex") === 0;
                })
                    .attr("tabIndex", -1);
            }

            toShow.attr("aria-hidden", "false");
            eventData.newTab.attr({
                "aria-selected": "true",
                "aria-expanded": "true",
                tabIndex: 0
            });
        },

        _activate: function (index) {
            var anchor,
                active = this._findActive(index);

            // Trying to activate the already active panel
            if (active[0] === this.active[0]) {
                return;
            }

            // Trying to collapse, simulate a click on the current active header
            if (!active.length) {
                active = this.active;
            }

            anchor = active.find(".ui-tabs-anchor")[0];
            this._eventHandler({
                target: anchor,
                currentTarget: anchor,
                preventDefault: $.noop
            });
        },

        _findActive: function (index) {
            return index === false ? $() : this.tabs.eq(index);
        },

        _getIndex: function (index) {

            // meta-function to give users option to provide a href string instead of a numerical index.
            if (typeof index === "string") {
                index = this.anchors.index(this.anchors.filter("[href$='" +
                    $.ui.escapeSelector(index) + "']"));
            }

            return index;
        },

        _destroy: function () {
            if (this.xhr) {
                this.xhr.abort();
            }

            this.tablist
                .removeAttr("role")
                .off(this.eventNamespace);

            this.anchors
                .removeAttr("role tabIndex")
                .removeUniqueId();

            this.tabs.add(this.panels).each(function () {
                if ($.data(this, "ui-tabs-destroy")) {
                    $(this).remove();
                } else {
                    $(this).removeAttr("role tabIndex " +
                        "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded");
                }
            });

            this.tabs.each(function () {
                var li = $(this),
                    prev = li.data("ui-tabs-aria-controls");
                if (prev) {
                    li
                        .attr("aria-controls", prev)
                        .removeData("ui-tabs-aria-controls");
                } else {
                    li.removeAttr("aria-controls");
                }
            });

            this.panels.show();

            if (this.options.heightStyle !== "content") {
                this.panels.css("height", "");
            }
        },

        enable: function (index) {
            var disabled = this.options.disabled;
            if (disabled === false) {
                return;
            }

            if (index === undefined) {
                disabled = false;
            } else {
                index = this._getIndex(index);
                if ($.isArray(disabled)) {
                    disabled = $.map(disabled, function (num) {
                        return num !== index ? num : null;
                    });
                } else {
                    disabled = $.map(this.tabs, function (li, num) {
                        return num !== index ? num : null;
                    });
                }
            }
            this._setOptionDisabled(disabled);
        },

        disable: function (index) {
            var disabled = this.options.disabled;
            if (disabled === true) {
                return;
            }

            if (index === undefined) {
                disabled = true;
            } else {
                index = this._getIndex(index);
                if ($.inArray(index, disabled) !== -1) {
                    return;
                }
                if ($.isArray(disabled)) {
                    disabled = $.merge([index], disabled).sort();
                } else {
                    disabled = [index];
                }
            }
            this._setOptionDisabled(disabled);
        },

        load: function (index, event) {
            index = this._getIndex(index);
            var that = this,
                tab = this.tabs.eq(index),
                anchor = tab.find(".ui-tabs-anchor"),
                panel = this._getPanelForTab(tab),
                eventData = {
                    tab: tab,
                    panel: panel
                },
                complete = function (jqXHR, status) {
                    if (status === "abort") {
                        that.panels.stop(false, true);
                    }

                    that._removeClass(tab, "ui-tabs-loading");
                    panel.removeAttr("aria-busy");

                    if (jqXHR === that.xhr) {
                        delete that.xhr;
                    }
                };

            // Not remote
            if (this._isLocal(anchor[0])) {
                return;
            }

            this.xhr = $.ajax(this._ajaxSettings(anchor, event, eventData));

            // Support: jQuery <1.8
            // jQuery <1.8 returns false if the request is canceled in beforeSend,
            // but as of 1.8, $.ajax() always returns a jqXHR object.
            if (this.xhr && this.xhr.statusText !== "canceled") {
                this._addClass(tab, "ui-tabs-loading");
                panel.attr("aria-busy", "true");

                this.xhr
                    .done(function (response, status, jqXHR) {

                        // support: jQuery <1.8
                        // http://bugs.jquery.com/ticket/11778
                        setTimeout(function () {
                            panel.html(response);
                            that._trigger("load", event, eventData);

                            complete(jqXHR, status);
                        }, 1);
                    })
                    .fail(function (jqXHR, status) {

                        // support: jQuery <1.8
                        // http://bugs.jquery.com/ticket/11778
                        setTimeout(function () {
                            complete(jqXHR, status);
                        }, 1);
                    });
            }
        },

        _ajaxSettings: function (anchor, event, eventData) {
            var that = this;
            return {

                // Support: IE <11 only
                // Strip any hash that exists to prevent errors with the Ajax request
                url: anchor.attr("href").replace(/#.*$/, ""),
                beforeSend: function (jqXHR, settings) {
                    return that._trigger("beforeLoad", event,
                        $.extend({ jqXHR: jqXHR, ajaxSettings: settings }, eventData));
                }
            };
        },

        _getPanelForTab: function (tab) {
            var id = $(tab).attr("aria-controls");
            return this.element.find(this._sanitizeSelector("#" + id));
        }
    });

    // DEPRECATED
    // TODO: Switch return back to widget declaration at top of file when this is removed
    if ($.uiBackCompat !== false) {

        // Backcompat for ui-tab class (now ui-tabs-tab)
        $.widget("ui.tabs", $.ui.tabs, {
            _processTabs: function () {
                this._superApply(arguments);
                this._addClass(this.tabs, "ui-tab");
            }
        });
    }

    var widgetsTabs = $.ui.tabs;


    /*!
     * jQuery UI Tooltip 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Tooltip
    //>>group: Widgets
    //>>description: Shows additional information for any element on hover or focus.
    //>>docs: http://api.jqueryui.com/tooltip/
    //>>demos: http://jqueryui.com/tooltip/
    //>>css.structure: ../../themes/base/core.css
    //>>css.structure: ../../themes/base/tooltip.css
    //>>css.theme: ../../themes/base/theme.css



    $.widget("ui.tooltip", {
        version: "1.12.1",
        options: {
            classes: {
                "ui-tooltip": "ui-corner-all ui-widget-shadow"
            },
            content: function () {

                // support: IE<9, Opera in jQuery <1.7
                // .text() can't accept undefined, so coerce to a string
                var title = $(this).attr("title") || "";

                // Escape title, since we're going from an attribute to raw HTML
                return $("<a>").text(title).html();
            },
            hide: true,

            // Disabled elements have inconsistent behavior across browsers (#8661)
            items: "[title]:not([disabled])",
            position: {
                my: "left top+15",
                at: "left bottom",
                collision: "flipfit flip"
            },
            show: true,
            track: false,

            // Callbacks
            close: null,
            open: null
        },

        _addDescribedBy: function (elem, id) {
            var describedby = (elem.attr("aria-describedby") || "").split(/\s+/);
            describedby.push(id);
            elem
                .data("ui-tooltip-id", id)
                .attr("aria-describedby", $.trim(describedby.join(" ")));
        },

        _removeDescribedBy: function (elem) {
            var id = elem.data("ui-tooltip-id"),
                describedby = (elem.attr("aria-describedby") || "").split(/\s+/),
                index = $.inArray(id, describedby);

            if (index !== -1) {
                describedby.splice(index, 1);
            }

            elem.removeData("ui-tooltip-id");
            describedby = $.trim(describedby.join(" "));
            if (describedby) {
                elem.attr("aria-describedby", describedby);
            } else {
                elem.removeAttr("aria-describedby");
            }
        },

        _create: function () {
            this._on({
                mouseover: "open",
                focusin: "open"
            });

            // IDs of generated tooltips, needed for destroy
            this.tooltips = {};

            // IDs of parent tooltips where we removed the title attribute
            this.parents = {};

            // Append the aria-live region so tooltips announce correctly
            this.liveRegion = $("<div>")
                .attr({
                    role: "log",
                    "aria-live": "assertive",
                    "aria-relevant": "additions"
                })
                .appendTo(this.document[0].body);
            this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible");

            this.disabledTitles = $([]);
        },

        _setOption: function (key, value) {
            var that = this;

            this._super(key, value);

            if (key === "content") {
                $.each(this.tooltips, function (id, tooltipData) {
                    that._updateContent(tooltipData.element);
                });
            }
        },

        _setOptionDisabled: function (value) {
            this[value ? "_disable" : "_enable"]();
        },

        _disable: function () {
            var that = this;

            // Close open tooltips
            $.each(this.tooltips, function (id, tooltipData) {
                var event = $.Event("blur");
                event.target = event.currentTarget = tooltipData.element[0];
                that.close(event, true);
            });

            // Remove title attributes to prevent native tooltips
            this.disabledTitles = this.disabledTitles.add(
                this.element.find(this.options.items).addBack()
                    .filter(function () {
                        var element = $(this);
                        if (element.is("[title]")) {
                            return element
                                .data("ui-tooltip-title", element.attr("title"))
                                .removeAttr("title");
                        }
                    })
            );
        },

        _enable: function () {

            // restore title attributes
            this.disabledTitles.each(function () {
                var element = $(this);
                if (element.data("ui-tooltip-title")) {
                    element.attr("title", element.data("ui-tooltip-title"));
                }
            });
            this.disabledTitles = $([]);
        },

        open: function (event) {
            var that = this,
                target = $(event ? event.target : this.element)

                    // we need closest here due to mouseover bubbling,
                    // but always pointing at the same event target
                    .closest(this.options.items);

            // No element to show a tooltip for or the tooltip is already open
            if (!target.length || target.data("ui-tooltip-id")) {
                return;
            }

            if (target.attr("title")) {
                target.data("ui-tooltip-title", target.attr("title"));
            }

            target.data("ui-tooltip-open", true);

            // Kill parent tooltips, custom or native, for hover
            if (event && event.type === "mouseover") {
                target.parents().each(function () {
                    var parent = $(this),
                        blurEvent;
                    if (parent.data("ui-tooltip-open")) {
                        blurEvent = $.Event("blur");
                        blurEvent.target = blurEvent.currentTarget = this;
                        that.close(blurEvent, true);
                    }
                    if (parent.attr("title")) {
                        parent.uniqueId();
                        that.parents[this.id] = {
                            element: this,
                            title: parent.attr("title")
                        };
                        parent.attr("title", "");
                    }
                });
            }

            this._registerCloseHandlers(event, target);
            this._updateContent(target, event);
        },

        _updateContent: function (target, event) {
            var content,
                contentOption = this.options.content,
                that = this,
                eventType = event ? event.type : null;

            if (typeof contentOption === "string" || contentOption.nodeType ||
                contentOption.jquery) {
                return this._open(event, target, contentOption);
            }

            content = contentOption.call(target[0], function (response) {

                // IE may instantly serve a cached response for ajax requests
                // delay this call to _open so the other call to _open runs first
                that._delay(function () {

                    // Ignore async response if tooltip was closed already
                    if (!target.data("ui-tooltip-open")) {
                        return;
                    }

                    // JQuery creates a special event for focusin when it doesn't
                    // exist natively. To improve performance, the native event
                    // object is reused and the type is changed. Therefore, we can't
                    // rely on the type being correct after the event finished
                    // bubbling, so we set it back to the previous value. (#8740)
                    if (event) {
                        event.type = eventType;
                    }
                    this._open(event, target, response);
                });
            });
            if (content) {
                this._open(event, target, content);
            }
        },

        _open: function (event, target, content) {
            var tooltipData, tooltip, delayedShow, a11yContent,
                positionOption = $.extend({}, this.options.position);

            if (!content) {
                return;
            }

            // Content can be updated multiple times. If the tooltip already
            // exists, then just update the content and bail.
            tooltipData = this._find(target);
            if (tooltipData) {
                tooltipData.tooltip.find(".ui-tooltip-content").html(content);
                return;
            }

            // If we have a title, clear it to prevent the native tooltip
            // we have to check first to avoid defining a title if none exists
            // (we don't want to cause an element to start matching [title])
            //
            // We use removeAttr only for key events, to allow IE to export the correct
            // accessible attributes. For mouse events, set to empty string to avoid
            // native tooltip showing up (happens only when removing inside mouseover).
            if (target.is("[title]")) {
                if (event && event.type === "mouseover") {
                    target.attr("title", "");
                } else {
                    target.removeAttr("title");
                }
            }

            tooltipData = this._tooltip(target);
            tooltip = tooltipData.tooltip;
            this._addDescribedBy(target, tooltip.attr("id"));
            tooltip.find(".ui-tooltip-content").html(content);

            // Support: Voiceover on OS X, JAWS on IE <= 9
            // JAWS announces deletions even when aria-relevant="additions"
            // Voiceover will sometimes re-read the entire log region's contents from the beginning
            this.liveRegion.children().hide();
            a11yContent = $("<div>").html(tooltip.find(".ui-tooltip-content").html());
            a11yContent.removeAttr("name").find("[name]").removeAttr("name");
            a11yContent.removeAttr("id").find("[id]").removeAttr("id");
            a11yContent.appendTo(this.liveRegion);

            function position(event) {
                positionOption.of = event;
                if (tooltip.is(":hidden")) {
                    return;
                }
                tooltip.position(positionOption);
            }
            if (this.options.track && event && /^mouse/.test(event.type)) {
                this._on(this.document, {
                    mousemove: position
                });

                // trigger once to override element-relative positioning
                position(event);
            } else {
                tooltip.position($.extend({
                    of: target
                }, this.options.position));
            }

            tooltip.hide();

            this._show(tooltip, this.options.show);

            // Handle tracking tooltips that are shown with a delay (#8644). As soon
            // as the tooltip is visible, position the tooltip using the most recent
            // event.
            // Adds the check to add the timers only when both delay and track options are set (#14682)
            if (this.options.track && this.options.show && this.options.show.delay) {
                delayedShow = this.delayedShow = setInterval(function () {
                    if (tooltip.is(":visible")) {
                        position(positionOption.of);
                        clearInterval(delayedShow);
                    }
                }, $.fx.interval);
            }

            this._trigger("open", event, { tooltip: tooltip });
        },

        _registerCloseHandlers: function (event, target) {
            var events = {
                keyup: function (event) {
                    if (event.keyCode === $.ui.keyCode.ESCAPE) {
                        var fakeEvent = $.Event(event);
                        fakeEvent.currentTarget = target[0];
                        this.close(fakeEvent, true);
                    }
                }
            };

            // Only bind remove handler for delegated targets. Non-delegated
            // tooltips will handle this in destroy.
            if (target[0] !== this.element[0]) {
                events.remove = function () {
                    this._removeTooltip(this._find(target).tooltip);
                };
            }

            if (!event || event.type === "mouseover") {
                events.mouseleave = "close";
            }
            if (!event || event.type === "focusin") {
                events.focusout = "close";
            }
            this._on(true, target, events);
        },

        close: function (event) {
            var tooltip,
                that = this,
                target = $(event ? event.currentTarget : this.element),
                tooltipData = this._find(target);

            // The tooltip may already be closed
            if (!tooltipData) {

                // We set ui-tooltip-open immediately upon open (in open()), but only set the
                // additional data once there's actually content to show (in _open()). So even if the
                // tooltip doesn't have full data, we always remove ui-tooltip-open in case we're in
                // the period between open() and _open().
                target.removeData("ui-tooltip-open");
                return;
            }

            tooltip = tooltipData.tooltip;

            // Disabling closes the tooltip, so we need to track when we're closing
            // to avoid an infinite loop in case the tooltip becomes disabled on close
            if (tooltipData.closing) {
                return;
            }

            // Clear the interval for delayed tracking tooltips
            clearInterval(this.delayedShow);

            // Only set title if we had one before (see comment in _open())
            // If the title attribute has changed since open(), don't restore
            if (target.data("ui-tooltip-title") && !target.attr("title")) {
                target.attr("title", target.data("ui-tooltip-title"));
            }

            this._removeDescribedBy(target);

            tooltipData.hiding = true;
            tooltip.stop(true);
            this._hide(tooltip, this.options.hide, function () {
                that._removeTooltip($(this));
            });

            target.removeData("ui-tooltip-open");
            this._off(target, "mouseleave focusout keyup");

            // Remove 'remove' binding only on delegated targets
            if (target[0] !== this.element[0]) {
                this._off(target, "remove");
            }
            this._off(this.document, "mousemove");

            if (event && event.type === "mouseleave") {
                $.each(this.parents, function (id, parent) {
                    $(parent.element).attr("title", parent.title);
                    delete that.parents[id];
                });
            }

            tooltipData.closing = true;
            this._trigger("close", event, { tooltip: tooltip });
            if (!tooltipData.hiding) {
                tooltipData.closing = false;
            }
        },

        _tooltip: function (element) {
            var tooltip = $("<div>").attr("role", "tooltip"),
                content = $("<div>").appendTo(tooltip),
                id = tooltip.uniqueId().attr("id");

            this._addClass(content, "ui-tooltip-content");
            this._addClass(tooltip, "ui-tooltip", "ui-widget ui-widget-content");

            tooltip.appendTo(this._appendTo(element));

            return this.tooltips[id] = {
                element: element,
                tooltip: tooltip
            };
        },

        _find: function (target) {
            var id = target.data("ui-tooltip-id");
            return id ? this.tooltips[id] : null;
        },

        _removeTooltip: function (tooltip) {
            tooltip.remove();
            delete this.tooltips[tooltip.attr("id")];
        },

        _appendTo: function (target) {
            var element = target.closest(".ui-front, dialog");

            if (!element.length) {
                element = this.document[0].body;
            }

            return element;
        },

        _destroy: function () {
            var that = this;

            // Close open tooltips
            $.each(this.tooltips, function (id, tooltipData) {

                // Delegate to close method to handle common cleanup
                var event = $.Event("blur"),
                    element = tooltipData.element;
                event.target = event.currentTarget = element[0];
                that.close(event, true);

                // Remove immediately; destroying an open tooltip doesn't use the
                // hide animation
                $("#" + id).remove();

                // Restore the title
                if (element.data("ui-tooltip-title")) {

                    // If the title attribute has changed since open(), don't restore
                    if (!element.attr("title")) {
                        element.attr("title", element.data("ui-tooltip-title"));
                    }
                    element.removeData("ui-tooltip-title");
                }
            });
            this.liveRegion.remove();
        }
    });

    // DEPRECATED
    // TODO: Switch return back to widget declaration at top of file when this is removed
    if ($.uiBackCompat !== false) {

        // Backcompat for tooltipClass option
        $.widget("ui.tooltip", $.ui.tooltip, {
            options: {
                tooltipClass: null
            },
            _tooltip: function () {
                var tooltipData = this._superApply(arguments);
                if (this.options.tooltipClass) {
                    tooltipData.tooltip.addClass(this.options.tooltipClass);
                }
                return tooltipData;
            }
        });
    }

    var widgetsTooltip = $.ui.tooltip;


    /*!
     * jQuery UI Effects 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Effects Core
    //>>group: Effects
    // jscs:disable maximumLineLength
    //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects.
    // jscs:enable maximumLineLength
    //>>docs: http://api.jqueryui.com/category/effects-core/
    //>>demos: http://jqueryui.com/effect/



    var dataSpace = "ui-effects-",
        dataSpaceStyle = "ui-effects-style",
        dataSpaceAnimated = "ui-effects-animated",

        // Create a local jQuery because jQuery Color relies on it and the
        // global may not exist with AMD and a custom build (#10199)
        jQuery = $;

    $.effects = {
        effect: {}
    };

    /*!
     * jQuery Color Animations v2.1.2
     * https://github.com/jquery/jquery-color
     *
     * Copyright 2014 jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     *
     * Date: Wed Jan 16 08:47:09 2013 -0600
     */
    (function (jQuery, undefined) {

        var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " +
            "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",

            // Plusequals test for += 100 -= 100
            rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,

            // A set of RE's that can match strings and generate color tuples.
            stringParsers = [{
                re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
                parse: function (execResult) {
                    return [
                        execResult[1],
                        execResult[2],
                        execResult[3],
                        execResult[4]
                    ];
                }
            }, {
                re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
                parse: function (execResult) {
                    return [
                        execResult[1] * 2.55,
                        execResult[2] * 2.55,
                        execResult[3] * 2.55,
                        execResult[4]
                    ];
                }
            }, {

                // This regex ignores A-F because it's compared against an already lowercased string
                re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
                parse: function (execResult) {
                    return [
                        parseInt(execResult[1], 16),
                        parseInt(execResult[2], 16),
                        parseInt(execResult[3], 16)
                    ];
                }
            }, {

                // This regex ignores A-F because it's compared against an already lowercased string
                re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
                parse: function (execResult) {
                    return [
                        parseInt(execResult[1] + execResult[1], 16),
                        parseInt(execResult[2] + execResult[2], 16),
                        parseInt(execResult[3] + execResult[3], 16)
                    ];
                }
            }, {
                re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
                space: "hsla",
                parse: function (execResult) {
                    return [
                        execResult[1],
                        execResult[2] / 100,
                        execResult[3] / 100,
                        execResult[4]
                    ];
                }
            }],

            // JQuery.Color( )
            color = jQuery.Color = function (color, green, blue, alpha) {
                return new jQuery.Color.fn.parse(color, green, blue, alpha);
            },
            spaces = {
                rgba: {
                    props: {
                        red: {
                            idx: 0,
                            type: "byte"
                        },
                        green: {
                            idx: 1,
                            type: "byte"
                        },
                        blue: {
                            idx: 2,
                            type: "byte"
                        }
                    }
                },

                hsla: {
                    props: {
                        hue: {
                            idx: 0,
                            type: "degrees"
                        },
                        saturation: {
                            idx: 1,
                            type: "percent"
                        },
                        lightness: {
                            idx: 2,
                            type: "percent"
                        }
                    }
                }
            },
            propTypes = {
                "byte": {
                    floor: true,
                    max: 255
                },
                "percent": {
                    max: 1
                },
                "degrees": {
                    mod: 360,
                    floor: true
                }
            },
            support = color.support = {},

            // Element for support tests
            supportElem = jQuery("<p>")[0],

            // Colors = jQuery.Color.names
            colors,

            // Local aliases of functions called often
            each = jQuery.each;

        // Determine rgba support immediately
        supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
        support.rgba = supportElem.style.backgroundColor.indexOf("rgba") > -1;

        // Define cache name and alpha properties
        // for rgba and hsla spaces
        each(spaces, function (spaceName, space) {
            space.cache = "_" + spaceName;
            space.props.alpha = {
                idx: 3,
                type: "percent",
                def: 1
            };
        });

        function clamp(value, prop, allowEmpty) {
            var type = propTypes[prop.type] || {};

            if (value == null) {
                return (allowEmpty || !prop.def) ? null : prop.def;
            }

            // ~~ is an short way of doing floor for positive numbers
            value = type.floor ? ~~value : parseFloat(value);

            // IE will pass in empty strings as value for alpha,
            // which will hit this case
            if (isNaN(value)) {
                return prop.def;
            }

            if (type.mod) {

                // We add mod before modding to make sure that negatives values
                // get converted properly: -10 -> 350
                return (value + type.mod) % type.mod;
            }

            // For now all property types without mod have min and max
            return 0 > value ? 0 : type.max < value ? type.max : value;
        }

        function stringParse(string) {
            var inst = color(),
                rgba = inst._rgba = [];

            string = string.toLowerCase();

            each(stringParsers, function (i, parser) {
                var parsed,
                    match = parser.re.exec(string),
                    values = match && parser.parse(match),
                    spaceName = parser.space || "rgba";

                if (values) {
                    parsed = inst[spaceName](values);

                    // If this was an rgba parse the assignment might happen twice
                    // oh well....
                    inst[spaces[spaceName].cache] = parsed[spaces[spaceName].cache];
                    rgba = inst._rgba = parsed._rgba;

                    // Exit each( stringParsers ) here because we matched
                    return false;
                }
            });

            // Found a stringParser that handled it
            if (rgba.length) {

                // If this came from a parsed string, force "transparent" when alpha is 0
                // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
                if (rgba.join() === "0,0,0,0") {
                    jQuery.extend(rgba, colors.transparent);
                }
                return inst;
            }

            // Named colors
            return colors[string];
        }

        color.fn = jQuery.extend(color.prototype, {
            parse: function (red, green, blue, alpha) {
                if (red === undefined) {
                    this._rgba = [null, null, null, null];
                    return this;
                }
                if (red.jquery || red.nodeType) {
                    red = jQuery(red).css(green);
                    green = undefined;
                }

                var inst = this,
                    type = jQuery.type(red),
                    rgba = this._rgba = [];

                // More than 1 argument specified - assume ( red, green, blue, alpha )
                if (green !== undefined) {
                    red = [red, green, blue, alpha];
                    type = "array";
                }

                if (type === "string") {
                    return this.parse(stringParse(red) || colors._default);
                }

                if (type === "array") {
                    each(spaces.rgba.props, function (key, prop) {
                        rgba[prop.idx] = clamp(red[prop.idx], prop);
                    });
                    return this;
                }

                if (type === "object") {
                    if (red instanceof color) {
                        each(spaces, function (spaceName, space) {
                            if (red[space.cache]) {
                                inst[space.cache] = red[space.cache].slice();
                            }
                        });
                    } else {
                        each(spaces, function (spaceName, space) {
                            var cache = space.cache;
                            each(space.props, function (key, prop) {

                                // If the cache doesn't exist, and we know how to convert
                                if (!inst[cache] && space.to) {

                                    // If the value was null, we don't need to copy it
                                    // if the key was alpha, we don't need to copy it either
                                    if (key === "alpha" || red[key] == null) {
                                        return;
                                    }
                                    inst[cache] = space.to(inst._rgba);
                                }

                                // This is the only case where we allow nulls for ALL properties.
                                // call clamp with alwaysAllowEmpty
                                inst[cache][prop.idx] = clamp(red[key], prop, true);
                            });

                            // Everything defined but alpha?
                            if (inst[cache] &&
                                jQuery.inArray(null, inst[cache].slice(0, 3)) < 0) {

                                // Use the default of 1
                                inst[cache][3] = 1;
                                if (space.from) {
                                    inst._rgba = space.from(inst[cache]);
                                }
                            }
                        });
                    }
                    return this;
                }
            },
            is: function (compare) {
                var is = color(compare),
                    same = true,
                    inst = this;

                each(spaces, function (_, space) {
                    var localCache,
                        isCache = is[space.cache];
                    if (isCache) {
                        localCache = inst[space.cache] || space.to && space.to(inst._rgba) || [];
                        each(space.props, function (_, prop) {
                            if (isCache[prop.idx] != null) {
                                same = (isCache[prop.idx] === localCache[prop.idx]);
                                return same;
                            }
                        });
                    }
                    return same;
                });
                return same;
            },
            _space: function () {
                var used = [],
                    inst = this;
                each(spaces, function (spaceName, space) {
                    if (inst[space.cache]) {
                        used.push(spaceName);
                    }
                });
                return used.pop();
            },
            transition: function (other, distance) {
                var end = color(other),
                    spaceName = end._space(),
                    space = spaces[spaceName],
                    startColor = this.alpha() === 0 ? color("transparent") : this,
                    start = startColor[space.cache] || space.to(startColor._rgba),
                    result = start.slice();

                end = end[space.cache];
                each(space.props, function (key, prop) {
                    var index = prop.idx,
                        startValue = start[index],
                        endValue = end[index],
                        type = propTypes[prop.type] || {};

                    // If null, don't override start value
                    if (endValue === null) {
                        return;
                    }

                    // If null - use end
                    if (startValue === null) {
                        result[index] = endValue;
                    } else {
                        if (type.mod) {
                            if (endValue - startValue > type.mod / 2) {
                                startValue += type.mod;
                            } else if (startValue - endValue > type.mod / 2) {
                                startValue -= type.mod;
                            }
                        }
                        result[index] = clamp((endValue - startValue) * distance + startValue, prop);
                    }
                });
                return this[spaceName](result);
            },
            blend: function (opaque) {

                // If we are already opaque - return ourself
                if (this._rgba[3] === 1) {
                    return this;
                }

                var rgb = this._rgba.slice(),
                    a = rgb.pop(),
                    blend = color(opaque)._rgba;

                return color(jQuery.map(rgb, function (v, i) {
                    return (1 - a) * blend[i] + a * v;
                }));
            },
            toRgbaString: function () {
                var prefix = "rgba(",
                    rgba = jQuery.map(this._rgba, function (v, i) {
                        return v == null ? (i > 2 ? 1 : 0) : v;
                    });

                if (rgba[3] === 1) {
                    rgba.pop();
                    prefix = "rgb(";
                }

                return prefix + rgba.join() + ")";
            },
            toHslaString: function () {
                var prefix = "hsla(",
                    hsla = jQuery.map(this.hsla(), function (v, i) {
                        if (v == null) {
                            v = i > 2 ? 1 : 0;
                        }

                        // Catch 1 and 2
                        if (i && i < 3) {
                            v = Math.round(v * 100) + "%";
                        }
                        return v;
                    });

                if (hsla[3] === 1) {
                    hsla.pop();
                    prefix = "hsl(";
                }
                return prefix + hsla.join() + ")";
            },
            toHexString: function (includeAlpha) {
                var rgba = this._rgba.slice(),
                    alpha = rgba.pop();

                if (includeAlpha) {
                    rgba.push(~~(alpha * 255));
                }

                return "#" + jQuery.map(rgba, function (v) {

                    // Default to 0 when nulls exist
                    v = (v || 0).toString(16);
                    return v.length === 1 ? "0" + v : v;
                }).join("");
            },
            toString: function () {
                return this._rgba[3] === 0 ? "transparent" : this.toRgbaString();
            }
        });
        color.fn.parse.prototype = color.fn;

        // Hsla conversions adapted from:
        // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021

        function hue2rgb(p, q, h) {
            h = (h + 1) % 1;
            if (h * 6 < 1) {
                return p + (q - p) * h * 6;
            }
            if (h * 2 < 1) {
                return q;
            }
            if (h * 3 < 2) {
                return p + (q - p) * ((2 / 3) - h) * 6;
            }
            return p;
        }

        spaces.hsla.to = function (rgba) {
            if (rgba[0] == null || rgba[1] == null || rgba[2] == null) {
                return [null, null, null, rgba[3]];
            }
            var r = rgba[0] / 255,
                g = rgba[1] / 255,
                b = rgba[2] / 255,
                a = rgba[3],
                max = Math.max(r, g, b),
                min = Math.min(r, g, b),
                diff = max - min,
                add = max + min,
                l = add * 0.5,
                h, s;

            if (min === max) {
                h = 0;
            } else if (r === max) {
                h = (60 * (g - b) / diff) + 360;
            } else if (g === max) {
                h = (60 * (b - r) / diff) + 120;
            } else {
                h = (60 * (r - g) / diff) + 240;
            }

            // Chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
            // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
            if (diff === 0) {
                s = 0;
            } else if (l <= 0.5) {
                s = diff / add;
            } else {
                s = diff / (2 - add);
            }
            return [Math.round(h) % 360, s, l, a == null ? 1 : a];
        };

        spaces.hsla.from = function (hsla) {
            if (hsla[0] == null || hsla[1] == null || hsla[2] == null) {
                return [null, null, null, hsla[3]];
            }
            var h = hsla[0] / 360,
                s = hsla[1],
                l = hsla[2],
                a = hsla[3],
                q = l <= 0.5 ? l * (1 + s) : l + s - l * s,
                p = 2 * l - q;

            return [
                Math.round(hue2rgb(p, q, h + (1 / 3)) * 255),
                Math.round(hue2rgb(p, q, h) * 255),
                Math.round(hue2rgb(p, q, h - (1 / 3)) * 255),
                a
            ];
        };

        each(spaces, function (spaceName, space) {
            var props = space.props,
                cache = space.cache,
                to = space.to,
                from = space.from;

            // Makes rgba() and hsla()
            color.fn[spaceName] = function (value) {

                // Generate a cache for this space if it doesn't exist
                if (to && !this[cache]) {
                    this[cache] = to(this._rgba);
                }
                if (value === undefined) {
                    return this[cache].slice();
                }

                var ret,
                    type = jQuery.type(value),
                    arr = (type === "array" || type === "object") ? value : arguments,
                    local = this[cache].slice();

                each(props, function (key, prop) {
                    var val = arr[type === "object" ? key : prop.idx];
                    if (val == null) {
                        val = local[prop.idx];
                    }
                    local[prop.idx] = clamp(val, prop);
                });

                if (from) {
                    ret = color(from(local));
                    ret[cache] = local;
                    return ret;
                } else {
                    return color(local);
                }
            };

            // Makes red() green() blue() alpha() hue() saturation() lightness()
            each(props, function (key, prop) {

                // Alpha is included in more than one space
                if (color.fn[key]) {
                    return;
                }
                color.fn[key] = function (value) {
                    var vtype = jQuery.type(value),
                        fn = (key === "alpha" ? (this._hsla ? "hsla" : "rgba") : spaceName),
                        local = this[fn](),
                        cur = local[prop.idx],
                        match;

                    if (vtype === "undefined") {
                        return cur;
                    }

                    if (vtype === "function") {
                        value = value.call(this, cur);
                        vtype = jQuery.type(value);
                    }
                    if (value == null && prop.empty) {
                        return this;
                    }
                    if (vtype === "string") {
                        match = rplusequals.exec(value);
                        if (match) {
                            value = cur + parseFloat(match[2]) * (match[1] === "+" ? 1 : -1);
                        }
                    }
                    local[prop.idx] = value;
                    return this[fn](local);
                };
            });
        });

        // Add cssHook and .fx.step function for each named hook.
        // accept a space separated string of properties
        color.hook = function (hook) {
            var hooks = hook.split(" ");
            each(hooks, function (i, hook) {
                jQuery.cssHooks[hook] = {
                    set: function (elem, value) {
                        var parsed, curElem,
                            backgroundColor = "";

                        if (value !== "transparent" && (jQuery.type(value) !== "string" ||
                            (parsed = stringParse(value)))) {
                            value = color(parsed || value);
                            if (!support.rgba && value._rgba[3] !== 1) {
                                curElem = hook === "backgroundColor" ? elem.parentNode : elem;
                                while (
                                    (backgroundColor === "" || backgroundColor === "transparent") &&
                                    curElem && curElem.style
                                ) {
                                    try {
                                        backgroundColor = jQuery.css(curElem, "backgroundColor");
                                        curElem = curElem.parentNode;
                                    } catch (e) {
                                    }
                                }

                                value = value.blend(backgroundColor && backgroundColor !== "transparent" ?
                                    backgroundColor :
                                    "_default");
                            }

                            value = value.toRgbaString();
                        }
                        try {
                            elem.style[hook] = value;
                        } catch (e) {

                            // Wrapped to prevent IE from throwing errors on "invalid" values like
                            // 'auto' or 'inherit'
                        }
                    }
                };
                jQuery.fx.step[hook] = function (fx) {
                    if (!fx.colorInit) {
                        fx.start = color(fx.elem, hook);
                        fx.end = color(fx.end);
                        fx.colorInit = true;
                    }
                    jQuery.cssHooks[hook].set(fx.elem, fx.start.transition(fx.end, fx.pos));
                };
            });

        };

        color.hook(stepHooks);

        jQuery.cssHooks.borderColor = {
            expand: function (value) {
                var expanded = {};

                each(["Top", "Right", "Bottom", "Left"], function (i, part) {
                    expanded["border" + part + "Color"] = value;
                });
                return expanded;
            }
        };

        // Basic color names only.
        // Usage of any of the other color names requires adding yourself or including
        // jquery.color.svg-names.js.
        colors = jQuery.Color.names = {

            // 4.1. Basic color keywords
            aqua: "#00ffff",
            black: "#000000",
            blue: "#0000ff",
            fuchsia: "#ff00ff",
            gray: "#808080",
            green: "#008000",
            lime: "#00ff00",
            maroon: "#800000",
            navy: "#000080",
            olive: "#808000",
            purple: "#800080",
            red: "#ff0000",
            silver: "#c0c0c0",
            teal: "#008080",
            white: "#ffffff",
            yellow: "#ffff00",

            // 4.2.3. "transparent" color keyword
            transparent: [null, null, null, 0],

            _default: "#ffffff"
        };

    })(jQuery);

    /******************************************************************************/
    /****************************** CLASS ANIMATIONS ******************************/
    /******************************************************************************/
    (function () {

        var classAnimationActions = ["add", "remove", "toggle"],
            shorthandStyles = {
                border: 1,
                borderBottom: 1,
                borderColor: 1,
                borderLeft: 1,
                borderRight: 1,
                borderTop: 1,
                borderWidth: 1,
                margin: 1,
                padding: 1
            };

        $.each(
            ["borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle"],
            function (_, prop) {
                $.fx.step[prop] = function (fx) {
                    if (fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr) {
                        jQuery.style(fx.elem, prop, fx.end);
                        fx.setAttr = true;
                    }
                };
            }
        );

        function getElementStyles(elem) {
            var key, len,
                style = elem.ownerDocument.defaultView ?
                    elem.ownerDocument.defaultView.getComputedStyle(elem, null) :
                    elem.currentStyle,
                styles = {};

            if (style && style.length && style[0] && style[style[0]]) {
                len = style.length;
                while (len--) {
                    key = style[len];
                    if (typeof style[key] === "string") {
                        styles[$.camelCase(key)] = style[key];
                    }
                }

                // Support: Opera, IE <9
            } else {
                for (key in style) {
                    if (typeof style[key] === "string") {
                        styles[key] = style[key];
                    }
                }
            }

            return styles;
        }

        function styleDifference(oldStyle, newStyle) {
            var diff = {},
                name, value;

            for (name in newStyle) {
                value = newStyle[name];
                if (oldStyle[name] !== value) {
                    if (!shorthandStyles[name]) {
                        if ($.fx.step[name] || !isNaN(parseFloat(value))) {
                            diff[name] = value;
                        }
                    }
                }
            }

            return diff;
        }

        // Support: jQuery <1.8
        if (!$.fn.addBack) {
            $.fn.addBack = function (selector) {
                return this.add(selector == null ?
                    this.prevObject : this.prevObject.filter(selector)
                );
            };
        }

        $.effects.animateClass = function (value, duration, easing, callback) {
            var o = $.speed(duration, easing, callback);

            return this.queue(function () {
                var animated = $(this),
                    baseClass = animated.attr("class") || "",
                    applyClassChange,
                    allAnimations = o.children ? animated.find("*").addBack() : animated;

                // Map the animated objects to store the original styles.
                allAnimations = allAnimations.map(function () {
                    var el = $(this);
                    return {
                        el: el,
                        start: getElementStyles(this)
                    };
                });

                // Apply class change
                applyClassChange = function () {
                    $.each(classAnimationActions, function (i, action) {
                        if (value[action]) {
                            animated[action + "Class"](value[action]);
                        }
                    });
                };
                applyClassChange();

                // Map all animated objects again - calculate new styles and diff
                allAnimations = allAnimations.map(function () {
                    this.end = getElementStyles(this.el[0]);
                    this.diff = styleDifference(this.start, this.end);
                    return this;
                });

                // Apply original class
                animated.attr("class", baseClass);

                // Map all animated objects again - this time collecting a promise
                allAnimations = allAnimations.map(function () {
                    var styleInfo = this,
                        dfd = $.Deferred(),
                        opts = $.extend({}, o, {
                            queue: false,
                            complete: function () {
                                dfd.resolve(styleInfo);
                            }
                        });

                    this.el.animate(this.diff, opts);
                    return dfd.promise();
                });

                // Once all animations have completed:
                $.when.apply($, allAnimations.get()).done(function () {

                    // Set the final class
                    applyClassChange();

                    // For each animated element,
                    // clear all css properties that were animated
                    $.each(arguments, function () {
                        var el = this.el;
                        $.each(this.diff, function (key) {
                            el.css(key, "");
                        });
                    });

                    // This is guarnteed to be there if you use jQuery.speed()
                    // it also handles dequeuing the next anim...
                    o.complete.call(animated[0]);
                });
            });
        };

        $.fn.extend({
            addClass: (function (orig) {
                return function (classNames, speed, easing, callback) {
                    return speed ?
                        $.effects.animateClass.call(this,
                            { add: classNames }, speed, easing, callback) :
                        orig.apply(this, arguments);
                };
            })($.fn.addClass),

            removeClass: (function (orig) {
                return function (classNames, speed, easing, callback) {
                    return arguments.length > 1 ?
                        $.effects.animateClass.call(this,
                            { remove: classNames }, speed, easing, callback) :
                        orig.apply(this, arguments);
                };
            })($.fn.removeClass),

            toggleClass: (function (orig) {
                return function (classNames, force, speed, easing, callback) {
                    if (typeof force === "boolean" || force === undefined) {
                        if (!speed) {

                            // Without speed parameter
                            return orig.apply(this, arguments);
                        } else {
                            return $.effects.animateClass.call(this,
                                (force ? { add: classNames } : { remove: classNames }),
                                speed, easing, callback);
                        }
                    } else {

                        // Without force parameter
                        return $.effects.animateClass.call(this,
                            { toggle: classNames }, force, speed, easing);
                    }
                };
            })($.fn.toggleClass),

            switchClass: function (remove, add, speed, easing, callback) {
                return $.effects.animateClass.call(this, {
                    add: add,
                    remove: remove
                }, speed, easing, callback);
            }
        });

    })();

    /******************************************************************************/
    /*********************************** EFFECTS **********************************/
    /******************************************************************************/

    (function () {

        if ($.expr && $.expr.filters && $.expr.filters.animated) {
            $.expr.filters.animated = (function (orig) {
                return function (elem) {
                    return !!$(elem).data(dataSpaceAnimated) || orig(elem);
                };
            })($.expr.filters.animated);
        }

        if ($.uiBackCompat !== false) {
            $.extend($.effects, {

                // Saves a set of properties in a data storage
                save: function (element, set) {
                    var i = 0, length = set.length;
                    for (; i < length; i++) {
                        if (set[i] !== null) {
                            element.data(dataSpace + set[i], element[0].style[set[i]]);
                        }
                    }
                },

                // Restores a set of previously saved properties from a data storage
                restore: function (element, set) {
                    var val, i = 0, length = set.length;
                    for (; i < length; i++) {
                        if (set[i] !== null) {
                            val = element.data(dataSpace + set[i]);
                            element.css(set[i], val);
                        }
                    }
                },

                setMode: function (el, mode) {
                    if (mode === "toggle") {
                        mode = el.is(":hidden") ? "show" : "hide";
                    }
                    return mode;
                },

                // Wraps the element around a wrapper that copies position properties
                createWrapper: function (element) {

                    // If the element is already wrapped, return it
                    if (element.parent().is(".ui-effects-wrapper")) {
                        return element.parent();
                    }

                    // Wrap the element
                    var props = {
                        width: element.outerWidth(true),
                        height: element.outerHeight(true),
                        "float": element.css("float")
                    },
                        wrapper = $("<div></div>")
                            .addClass("ui-effects-wrapper")
                            .css({
                                fontSize: "100%",
                                background: "transparent",
                                border: "none",
                                margin: 0,
                                padding: 0
                            }),

                        // Store the size in case width/height are defined in % - Fixes #5245
                        size = {
                            width: element.width(),
                            height: element.height()
                        },
                        active = document.activeElement;

                    // Support: Firefox
                    // Firefox incorrectly exposes anonymous content
                    // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
                    try {
                        active.id;
                    } catch (e) {
                        active = document.body;
                    }

                    element.wrap(wrapper);

                    // Fixes #7595 - Elements lose focus when wrapped.
                    if (element[0] === active || $.contains(element[0], active)) {
                        $(active).trigger("focus");
                    }

                    // Hotfix for jQuery 1.4 since some change in wrap() seems to actually
                    // lose the reference to the wrapped element
                    wrapper = element.parent();

                    // Transfer positioning properties to the wrapper
                    if (element.css("position") === "static") {
                        wrapper.css({ position: "relative" });
                        element.css({ position: "relative" });
                    } else {
                        $.extend(props, {
                            position: element.css("position"),
                            zIndex: element.css("z-index")
                        });
                        $.each(["top", "left", "bottom", "right"], function (i, pos) {
                            props[pos] = element.css(pos);
                            if (isNaN(parseInt(props[pos], 10))) {
                                props[pos] = "auto";
                            }
                        });
                        element.css({
                            position: "relative",
                            top: 0,
                            left: 0,
                            right: "auto",
                            bottom: "auto"
                        });
                    }
                    element.css(size);

                    return wrapper.css(props).show();
                },

                removeWrapper: function (element) {
                    var active = document.activeElement;

                    if (element.parent().is(".ui-effects-wrapper")) {
                        element.parent().replaceWith(element);

                        // Fixes #7595 - Elements lose focus when wrapped.
                        if (element[0] === active || $.contains(element[0], active)) {
                            $(active).trigger("focus");
                        }
                    }

                    return element;
                }
            });
        }

        $.extend($.effects, {
            version: "1.12.1",

            define: function (name, mode, effect) {
                if (!effect) {
                    effect = mode;
                    mode = "effect";
                }

                $.effects.effect[name] = effect;
                $.effects.effect[name].mode = mode;

                return effect;
            },

            scaledDimensions: function (element, percent, direction) {
                if (percent === 0) {
                    return {
                        height: 0,
                        width: 0,
                        outerHeight: 0,
                        outerWidth: 0
                    };
                }

                var x = direction !== "horizontal" ? ((percent || 100) / 100) : 1,
                    y = direction !== "vertical" ? ((percent || 100) / 100) : 1;

                return {
                    height: element.height() * y,
                    width: element.width() * x,
                    outerHeight: element.outerHeight() * y,
                    outerWidth: element.outerWidth() * x
                };

            },

            clipToBox: function (animation) {
                return {
                    width: animation.clip.right - animation.clip.left,
                    height: animation.clip.bottom - animation.clip.top,
                    left: animation.clip.left,
                    top: animation.clip.top
                };
            },

            // Injects recently queued functions to be first in line (after "inprogress")
            unshift: function (element, queueLength, count) {
                var queue = element.queue();

                if (queueLength > 1) {
                    queue.splice.apply(queue,
                        [1, 0].concat(queue.splice(queueLength, count)));
                }
                element.dequeue();
            },

            saveStyle: function (element) {
                element.data(dataSpaceStyle, element[0].style.cssText);
            },

            restoreStyle: function (element) {
                element[0].style.cssText = element.data(dataSpaceStyle) || "";
                element.removeData(dataSpaceStyle);
            },

            mode: function (element, mode) {
                var hidden = element.is(":hidden");

                if (mode === "toggle") {
                    mode = hidden ? "show" : "hide";
                }
                if (hidden ? mode === "hide" : mode === "show") {
                    mode = "none";
                }
                return mode;
            },

            // Translates a [top,left] array into a baseline value
            getBaseline: function (origin, original) {
                var y, x;

                switch (origin[0]) {
                    case "top":
                        y = 0;
                        break;
                    case "middle":
                        y = 0.5;
                        break;
                    case "bottom":
                        y = 1;
                        break;
                    default:
                        y = origin[0] / original.height;
                }

                switch (origin[1]) {
                    case "left":
                        x = 0;
                        break;
                    case "center":
                        x = 0.5;
                        break;
                    case "right":
                        x = 1;
                        break;
                    default:
                        x = origin[1] / original.width;
                }

                return {
                    x: x,
                    y: y
                };
            },

            // Creates a placeholder element so that the original element can be made absolute
            createPlaceholder: function (element) {
                var placeholder,
                    cssPosition = element.css("position"),
                    position = element.position();

                // Lock in margins first to account for form elements, which
                // will change margin if you explicitly set height
                // see: http://jsfiddle.net/JZSMt/3/ https://bugs.webkit.org/show_bug.cgi?id=107380
                // Support: Safari
                element.css({
                    marginTop: element.css("marginTop"),
                    marginBottom: element.css("marginBottom"),
                    marginLeft: element.css("marginLeft"),
                    marginRight: element.css("marginRight")
                })
                    .outerWidth(element.outerWidth())
                    .outerHeight(element.outerHeight());

                if (/^(static|relative)/.test(cssPosition)) {
                    cssPosition = "absolute";

                    placeholder = $("<" + element[0].nodeName + ">").insertAfter(element).css({

                        // Convert inline to inline block to account for inline elements
                        // that turn to inline block based on content (like img)
                        display: /^(inline|ruby)/.test(element.css("display")) ?
                            "inline-block" :
                            "block",
                        visibility: "hidden",

                        // Margins need to be set to account for margin collapse
                        marginTop: element.css("marginTop"),
                        marginBottom: element.css("marginBottom"),
                        marginLeft: element.css("marginLeft"),
                        marginRight: element.css("marginRight"),
                        "float": element.css("float")
                    })
                        .outerWidth(element.outerWidth())
                        .outerHeight(element.outerHeight())
                        .addClass("ui-effects-placeholder");

                    element.data(dataSpace + "placeholder", placeholder);
                }

                element.css({
                    position: cssPosition,
                    left: position.left,
                    top: position.top
                });

                return placeholder;
            },

            removePlaceholder: function (element) {
                var dataKey = dataSpace + "placeholder",
                    placeholder = element.data(dataKey);

                if (placeholder) {
                    placeholder.remove();
                    element.removeData(dataKey);
                }
            },

            // Removes a placeholder if it exists and restores
            // properties that were modified during placeholder creation
            cleanUp: function (element) {
                $.effects.restoreStyle(element);
                $.effects.removePlaceholder(element);
            },

            setTransition: function (element, list, factor, value) {
                value = value || {};
                $.each(list, function (i, x) {
                    var unit = element.cssUnit(x);
                    if (unit[0] > 0) {
                        value[x] = unit[0] * factor + unit[1];
                    }
                });
                return value;
            }
        });

        // Return an effect options object for the given parameters:
        function _normalizeArguments(effect, options, speed, callback) {

            // Allow passing all options as the first parameter
            if ($.isPlainObject(effect)) {
                options = effect;
                effect = effect.effect;
            }

            // Convert to an object
            effect = { effect: effect };

            // Catch (effect, null, ...)
            if (options == null) {
                options = {};
            }

            // Catch (effect, callback)
            if ($.isFunction(options)) {
                callback = options;
                speed = null;
                options = {};
            }

            // Catch (effect, speed, ?)
            if (typeof options === "number" || $.fx.speeds[options]) {
                callback = speed;
                speed = options;
                options = {};
            }

            // Catch (effect, options, callback)
            if ($.isFunction(speed)) {
                callback = speed;
                speed = null;
            }

            // Add options to effect
            if (options) {
                $.extend(effect, options);
            }

            speed = speed || options.duration;
            effect.duration = $.fx.off ? 0 :
                typeof speed === "number" ? speed :
                    speed in $.fx.speeds ? $.fx.speeds[speed] :
                        $.fx.speeds._default;

            effect.complete = callback || options.complete;

            return effect;
        }

        function standardAnimationOption(option) {

            // Valid standard speeds (nothing, number, named speed)
            if (!option || typeof option === "number" || $.fx.speeds[option]) {
                return true;
            }

            // Invalid strings - treat as "normal" speed
            if (typeof option === "string" && !$.effects.effect[option]) {
                return true;
            }

            // Complete callback
            if ($.isFunction(option)) {
                return true;
            }

            // Options hash (but not naming an effect)
            if (typeof option === "object" && !option.effect) {
                return true;
            }

            // Didn't match any standard API
            return false;
        }

        $.fn.extend({
            effect: function ( /* effect, options, speed, callback */) {
                var args = _normalizeArguments.apply(this, arguments),
                    effectMethod = $.effects.effect[args.effect],
                    defaultMode = effectMethod.mode,
                    queue = args.queue,
                    queueName = queue || "fx",
                    complete = args.complete,
                    mode = args.mode,
                    modes = [],
                    prefilter = function (next) {
                        var el = $(this),
                            normalizedMode = $.effects.mode(el, mode) || defaultMode;

                        // Sentinel for duck-punching the :animated psuedo-selector
                        el.data(dataSpaceAnimated, true);

                        // Save effect mode for later use,
                        // we can't just call $.effects.mode again later,
                        // as the .show() below destroys the initial state
                        modes.push(normalizedMode);

                        // See $.uiBackCompat inside of run() for removal of defaultMode in 1.13
                        if (defaultMode && (normalizedMode === "show" ||
                            (normalizedMode === defaultMode && normalizedMode === "hide"))) {
                            el.show();
                        }

                        if (!defaultMode || normalizedMode !== "none") {
                            $.effects.saveStyle(el);
                        }

                        if ($.isFunction(next)) {
                            next();
                        }
                    };

                if ($.fx.off || !effectMethod) {

                    // Delegate to the original method (e.g., .show()) if possible
                    if (mode) {
                        return this[mode](args.duration, complete);
                    } else {
                        return this.each(function () {
                            if (complete) {
                                complete.call(this);
                            }
                        });
                    }
                }

                function run(next) {
                    var elem = $(this);

                    function cleanup() {
                        elem.removeData(dataSpaceAnimated);

                        $.effects.cleanUp(elem);

                        if (args.mode === "hide") {
                            elem.hide();
                        }

                        done();
                    }

                    function done() {
                        if ($.isFunction(complete)) {
                            complete.call(elem[0]);
                        }

                        if ($.isFunction(next)) {
                            next();
                        }
                    }

                    // Override mode option on a per element basis,
                    // as toggle can be either show or hide depending on element state
                    args.mode = modes.shift();

                    if ($.uiBackCompat !== false && !defaultMode) {
                        if (elem.is(":hidden") ? mode === "hide" : mode === "show") {

                            // Call the core method to track "olddisplay" properly
                            elem[mode]();
                            done();
                        } else {
                            effectMethod.call(elem[0], args, done);
                        }
                    } else {
                        if (args.mode === "none") {

                            // Call the core method to track "olddisplay" properly
                            elem[mode]();
                            done();
                        } else {
                            effectMethod.call(elem[0], args, cleanup);
                        }
                    }
                }

                // Run prefilter on all elements first to ensure that
                // any showing or hiding happens before placeholder creation,
                // which ensures that any layout changes are correctly captured.
                return queue === false ?
                    this.each(prefilter).each(run) :
                    this.queue(queueName, prefilter).queue(queueName, run);
            },

            show: (function (orig) {
                return function (option) {
                    if (standardAnimationOption(option)) {
                        return orig.apply(this, arguments);
                    } else {
                        var args = _normalizeArguments.apply(this, arguments);
                        args.mode = "show";
                        return this.effect.call(this, args);
                    }
                };
            })($.fn.show),

            hide: (function (orig) {
                return function (option) {
                    if (standardAnimationOption(option)) {
                        return orig.apply(this, arguments);
                    } else {
                        var args = _normalizeArguments.apply(this, arguments);
                        args.mode = "hide";
                        return this.effect.call(this, args);
                    }
                };
            })($.fn.hide),

            toggle: (function (orig) {
                return function (option) {
                    if (standardAnimationOption(option) || typeof option === "boolean") {
                        return orig.apply(this, arguments);
                    } else {
                        var args = _normalizeArguments.apply(this, arguments);
                        args.mode = "toggle";
                        return this.effect.call(this, args);
                    }
                };
            })($.fn.toggle),

            cssUnit: function (key) {
                var style = this.css(key),
                    val = [];

                $.each(["em", "px", "%", "pt"], function (i, unit) {
                    if (style.indexOf(unit) > 0) {
                        val = [parseFloat(style), unit];
                    }
                });
                return val;
            },

            cssClip: function (clipObj) {
                if (clipObj) {
                    return this.css("clip", "rect(" + clipObj.top + "px " + clipObj.right + "px " +
                        clipObj.bottom + "px " + clipObj.left + "px)");
                }
                return parseClip(this.css("clip"), this);
            },

            transfer: function (options, done) {
                var element = $(this),
                    target = $(options.to),
                    targetFixed = target.css("position") === "fixed",
                    body = $("body"),
                    fixTop = targetFixed ? body.scrollTop() : 0,
                    fixLeft = targetFixed ? body.scrollLeft() : 0,
                    endPosition = target.offset(),
                    animation = {
                        top: endPosition.top - fixTop,
                        left: endPosition.left - fixLeft,
                        height: target.innerHeight(),
                        width: target.innerWidth()
                    },
                    startPosition = element.offset(),
                    transfer = $("<div class='ui-effects-transfer'></div>")
                        .appendTo("body")
                        .addClass(options.className)
                        .css({
                            top: startPosition.top - fixTop,
                            left: startPosition.left - fixLeft,
                            height: element.innerHeight(),
                            width: element.innerWidth(),
                            position: targetFixed ? "fixed" : "absolute"
                        })
                        .animate(animation, options.duration, options.easing, function () {
                            transfer.remove();
                            if ($.isFunction(done)) {
                                done();
                            }
                        });
            }
        });

        function parseClip(str, element) {
            var outerWidth = element.outerWidth(),
                outerHeight = element.outerHeight(),
                clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/,
                values = clipRegex.exec(str) || ["", 0, outerWidth, outerHeight, 0];

            return {
                top: parseFloat(values[1]) || 0,
                right: values[2] === "auto" ? outerWidth : parseFloat(values[2]),
                bottom: values[3] === "auto" ? outerHeight : parseFloat(values[3]),
                left: parseFloat(values[4]) || 0
            };
        }

        $.fx.step.clip = function (fx) {
            if (!fx.clipInit) {
                fx.start = $(fx.elem).cssClip();
                if (typeof fx.end === "string") {
                    fx.end = parseClip(fx.end, fx.elem);
                }
                fx.clipInit = true;
            }

            $(fx.elem).cssClip({
                top: fx.pos * (fx.end.top - fx.start.top) + fx.start.top,
                right: fx.pos * (fx.end.right - fx.start.right) + fx.start.right,
                bottom: fx.pos * (fx.end.bottom - fx.start.bottom) + fx.start.bottom,
                left: fx.pos * (fx.end.left - fx.start.left) + fx.start.left
            });
        };

    })();

    /******************************************************************************/
    /*********************************** EASING ***********************************/
    /******************************************************************************/

    (function () {

        // Based on easing equations from Robert Penner (http://www.robertpenner.com/easing)

        var baseEasings = {};

        $.each(["Quad", "Cubic", "Quart", "Quint", "Expo"], function (i, name) {
            baseEasings[name] = function (p) {
                return Math.pow(p, i + 2);
            };
        });

        $.extend(baseEasings, {
            Sine: function (p) {
                return 1 - Math.cos(p * Math.PI / 2);
            },
            Circ: function (p) {
                return 1 - Math.sqrt(1 - p * p);
            },
            Elastic: function (p) {
                return p === 0 || p === 1 ? p :
                    -Math.pow(2, 8 * (p - 1)) * Math.sin(((p - 1) * 80 - 7.5) * Math.PI / 15);
            },
            Back: function (p) {
                return p * p * (3 * p - 2);
            },
            Bounce: function (p) {
                var pow2,
                    bounce = 4;

                while (p < ((pow2 = Math.pow(2, --bounce)) - 1) / 11) { }
                return 1 / Math.pow(4, 3 - bounce) - 7.5625 * Math.pow((pow2 * 3 - 2) / 22 - p, 2);
            }
        });

        $.each(baseEasings, function (name, easeIn) {
            $.easing["easeIn" + name] = easeIn;
            $.easing["easeOut" + name] = function (p) {
                return 1 - easeIn(1 - p);
            };
            $.easing["easeInOut" + name] = function (p) {
                return p < 0.5 ?
                    easeIn(p * 2) / 2 :
                    1 - easeIn(p * -2 + 2) / 2;
            };
        });

    })();

    var effect = $.effects;


    /*!
     * jQuery UI Effects Blind 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Blind Effect
    //>>group: Effects
    //>>description: Blinds the element.
    //>>docs: http://api.jqueryui.com/blind-effect/
    //>>demos: http://jqueryui.com/effect/



    var effectsEffectBlind = $.effects.define("blind", "hide", function (options, done) {
        var map = {
            up: ["bottom", "top"],
            vertical: ["bottom", "top"],
            down: ["top", "bottom"],
            left: ["right", "left"],
            horizontal: ["right", "left"],
            right: ["left", "right"]
        },
            element = $(this),
            direction = options.direction || "up",
            start = element.cssClip(),
            animate = { clip: $.extend({}, start) },
            placeholder = $.effects.createPlaceholder(element);

        animate.clip[map[direction][0]] = animate.clip[map[direction][1]];

        if (options.mode === "show") {
            element.cssClip(animate.clip);
            if (placeholder) {
                placeholder.css($.effects.clipToBox(animate));
            }

            animate.clip = start;
        }

        if (placeholder) {
            placeholder.animate($.effects.clipToBox(animate), options.duration, options.easing);
        }

        element.animate(animate, {
            queue: false,
            duration: options.duration,
            easing: options.easing,
            complete: done
        });
    });


    /*!
     * jQuery UI Effects Bounce 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Bounce Effect
    //>>group: Effects
    //>>description: Bounces an element horizontally or vertically n times.
    //>>docs: http://api.jqueryui.com/bounce-effect/
    //>>demos: http://jqueryui.com/effect/



    var effectsEffectBounce = $.effects.define("bounce", function (options, done) {
        var upAnim, downAnim, refValue,
            element = $(this),

            // Defaults:
            mode = options.mode,
            hide = mode === "hide",
            show = mode === "show",
            direction = options.direction || "up",
            distance = options.distance,
            times = options.times || 5,

            // Number of internal animations
            anims = times * 2 + (show || hide ? 1 : 0),
            speed = options.duration / anims,
            easing = options.easing,

            // Utility:
            ref = (direction === "up" || direction === "down") ? "top" : "left",
            motion = (direction === "up" || direction === "left"),
            i = 0,

            queuelen = element.queue().length;

        $.effects.createPlaceholder(element);

        refValue = element.css(ref);

        // Default distance for the BIGGEST bounce is the outer Distance / 3
        if (!distance) {
            distance = element[ref === "top" ? "outerHeight" : "outerWidth"]() / 3;
        }

        if (show) {
            downAnim = { opacity: 1 };
            downAnim[ref] = refValue;

            // If we are showing, force opacity 0 and set the initial position
            // then do the "first" animation
            element
                .css("opacity", 0)
                .css(ref, motion ? -distance * 2 : distance * 2)
                .animate(downAnim, speed, easing);
        }

        // Start at the smallest distance if we are hiding
        if (hide) {
            distance = distance / Math.pow(2, times - 1);
        }

        downAnim = {};
        downAnim[ref] = refValue;

        // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
        for (; i < times; i++) {
            upAnim = {};
            upAnim[ref] = (motion ? "-=" : "+=") + distance;

            element
                .animate(upAnim, speed, easing)
                .animate(downAnim, speed, easing);

            distance = hide ? distance * 2 : distance / 2;
        }

        // Last Bounce when Hiding
        if (hide) {
            upAnim = { opacity: 0 };
            upAnim[ref] = (motion ? "-=" : "+=") + distance;

            element.animate(upAnim, speed, easing);
        }

        element.queue(done);

        $.effects.unshift(element, queuelen, anims + 1);
    });


    /*!
     * jQuery UI Effects Clip 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Clip Effect
    //>>group: Effects
    //>>description: Clips the element on and off like an old TV.
    //>>docs: http://api.jqueryui.com/clip-effect/
    //>>demos: http://jqueryui.com/effect/



    var effectsEffectClip = $.effects.define("clip", "hide", function (options, done) {
        var start,
            animate = {},
            element = $(this),
            direction = options.direction || "vertical",
            both = direction === "both",
            horizontal = both || direction === "horizontal",
            vertical = both || direction === "vertical";

        start = element.cssClip();
        animate.clip = {
            top: vertical ? (start.bottom - start.top) / 2 : start.top,
            right: horizontal ? (start.right - start.left) / 2 : start.right,
            bottom: vertical ? (start.bottom - start.top) / 2 : start.bottom,
            left: horizontal ? (start.right - start.left) / 2 : start.left
        };

        $.effects.createPlaceholder(element);

        if (options.mode === "show") {
            element.cssClip(animate.clip);
            animate.clip = start;
        }

        element.animate(animate, {
            queue: false,
            duration: options.duration,
            easing: options.easing,
            complete: done
        });

    });


    /*!
     * jQuery UI Effects Drop 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Drop Effect
    //>>group: Effects
    //>>description: Moves an element in one direction and hides it at the same time.
    //>>docs: http://api.jqueryui.com/drop-effect/
    //>>demos: http://jqueryui.com/effect/



    var effectsEffectDrop = $.effects.define("drop", "hide", function (options, done) {

        var distance,
            element = $(this),
            mode = options.mode,
            show = mode === "show",
            direction = options.direction || "left",
            ref = (direction === "up" || direction === "down") ? "top" : "left",
            motion = (direction === "up" || direction === "left") ? "-=" : "+=",
            oppositeMotion = (motion === "+=") ? "-=" : "+=",
            animation = {
                opacity: 0
            };

        $.effects.createPlaceholder(element);

        distance = options.distance ||
            element[ref === "top" ? "outerHeight" : "outerWidth"](true) / 2;

        animation[ref] = motion + distance;

        if (show) {
            element.css(animation);

            animation[ref] = oppositeMotion + distance;
            animation.opacity = 1;
        }

        // Animate
        element.animate(animation, {
            queue: false,
            duration: options.duration,
            easing: options.easing,
            complete: done
        });
    });


    /*!
     * jQuery UI Effects Explode 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Explode Effect
    //>>group: Effects
    // jscs:disable maximumLineLength
    //>>description: Explodes an element in all directions into n pieces. Implodes an element to its original wholeness.
    // jscs:enable maximumLineLength
    //>>docs: http://api.jqueryui.com/explode-effect/
    //>>demos: http://jqueryui.com/effect/



    var effectsEffectExplode = $.effects.define("explode", "hide", function (options, done) {

        var i, j, left, top, mx, my,
            rows = options.pieces ? Math.round(Math.sqrt(options.pieces)) : 3,
            cells = rows,
            element = $(this),
            mode = options.mode,
            show = mode === "show",

            // Show and then visibility:hidden the element before calculating offset
            offset = element.show().css("visibility", "hidden").offset(),

            // Width and height of a piece
            width = Math.ceil(element.outerWidth() / cells),
            height = Math.ceil(element.outerHeight() / rows),
            pieces = [];

        // Children animate complete:
        function childComplete() {
            pieces.push(this);
            if (pieces.length === rows * cells) {
                animComplete();
            }
        }

        // Clone the element for each row and cell.
        for (i = 0; i < rows; i++) { // ===>
            top = offset.top + i * height;
            my = i - (rows - 1) / 2;

            for (j = 0; j < cells; j++) { // |||
                left = offset.left + j * width;
                mx = j - (cells - 1) / 2;

                // Create a clone of the now hidden main element that will be absolute positioned
                // within a wrapper div off the -left and -top equal to size of our pieces
                element
                    .clone()
                    .appendTo("body")
                    .wrap("<div></div>")
                    .css({
                        position: "absolute",
                        visibility: "visible",
                        left: -j * width,
                        top: -i * height
                    })

                    // Select the wrapper - make it overflow: hidden and absolute positioned based on
                    // where the original was located +left and +top equal to the size of pieces
                    .parent()
                    .addClass("ui-effects-explode")
                    .css({
                        position: "absolute",
                        overflow: "hidden",
                        width: width,
                        height: height,
                        left: left + (show ? mx * width : 0),
                        top: top + (show ? my * height : 0),
                        opacity: show ? 0 : 1
                    })
                    .animate({
                        left: left + (show ? 0 : mx * width),
                        top: top + (show ? 0 : my * height),
                        opacity: show ? 1 : 0
                    }, options.duration || 500, options.easing, childComplete);
            }
        }

        function animComplete() {
            element.css({
                visibility: "visible"
            });
            $(pieces).remove();
            done();
        }
    });


    /*!
     * jQuery UI Effects Fade 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Fade Effect
    //>>group: Effects
    //>>description: Fades the element.
    //>>docs: http://api.jqueryui.com/fade-effect/
    //>>demos: http://jqueryui.com/effect/



    var effectsEffectFade = $.effects.define("fade", "toggle", function (options, done) {
        var show = options.mode === "show";

        $(this)
            .css("opacity", show ? 0 : 1)
            .animate({
                opacity: show ? 1 : 0
            }, {
                    queue: false,
                    duration: options.duration,
                    easing: options.easing,
                    complete: done
                });
    });


    /*!
     * jQuery UI Effects Fold 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Fold Effect
    //>>group: Effects
    //>>description: Folds an element first horizontally and then vertically.
    //>>docs: http://api.jqueryui.com/fold-effect/
    //>>demos: http://jqueryui.com/effect/



    var effectsEffectFold = $.effects.define("fold", "hide", function (options, done) {

        // Create element
        var element = $(this),
            mode = options.mode,
            show = mode === "show",
            hide = mode === "hide",
            size = options.size || 15,
            percent = /([0-9]+)%/.exec(size),
            horizFirst = !!options.horizFirst,
            ref = horizFirst ? ["right", "bottom"] : ["bottom", "right"],
            duration = options.duration / 2,

            placeholder = $.effects.createPlaceholder(element),

            start = element.cssClip(),
            animation1 = { clip: $.extend({}, start) },
            animation2 = { clip: $.extend({}, start) },

            distance = [start[ref[0]], start[ref[1]]],

            queuelen = element.queue().length;

        if (percent) {
            size = parseInt(percent[1], 10) / 100 * distance[hide ? 0 : 1];
        }
        animation1.clip[ref[0]] = size;
        animation2.clip[ref[0]] = size;
        animation2.clip[ref[1]] = 0;

        if (show) {
            element.cssClip(animation2.clip);
            if (placeholder) {
                placeholder.css($.effects.clipToBox(animation2));
            }

            animation2.clip = start;
        }

        // Animate
        element
            .queue(function (next) {
                if (placeholder) {
                    placeholder
                        .animate($.effects.clipToBox(animation1), duration, options.easing)
                        .animate($.effects.clipToBox(animation2), duration, options.easing);
                }

                next();
            })
            .animate(animation1, duration, options.easing)
            .animate(animation2, duration, options.easing)
            .queue(done);

        $.effects.unshift(element, queuelen, 4);
    });


    /*!
     * jQuery UI Effects Highlight 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Highlight Effect
    //>>group: Effects
    //>>description: Highlights the background of an element in a defined color for a custom duration.
    //>>docs: http://api.jqueryui.com/highlight-effect/
    //>>demos: http://jqueryui.com/effect/



    var effectsEffectHighlight = $.effects.define("highlight", "show", function (options, done) {
        var element = $(this),
            animation = {
                backgroundColor: element.css("backgroundColor")
            };

        if (options.mode === "hide") {
            animation.opacity = 0;
        }

        $.effects.saveStyle(element);

        element
            .css({
                backgroundImage: "none",
                backgroundColor: options.color || "#ffff99"
            })
            .animate(animation, {
                queue: false,
                duration: options.duration,
                easing: options.easing,
                complete: done
            });
    });


    /*!
     * jQuery UI Effects Size 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Size Effect
    //>>group: Effects
    //>>description: Resize an element to a specified width and height.
    //>>docs: http://api.jqueryui.com/size-effect/
    //>>demos: http://jqueryui.com/effect/



    var effectsEffectSize = $.effects.define("size", function (options, done) {

        // Create element
        var baseline, factor, temp,
            element = $(this),

            // Copy for children
            cProps = ["fontSize"],
            vProps = ["borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"],
            hProps = ["borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight"],

            // Set options
            mode = options.mode,
            restore = mode !== "effect",
            scale = options.scale || "both",
            origin = options.origin || ["middle", "center"],
            position = element.css("position"),
            pos = element.position(),
            original = $.effects.scaledDimensions(element),
            from = options.from || original,
            to = options.to || $.effects.scaledDimensions(element, 0);

        $.effects.createPlaceholder(element);

        if (mode === "show") {
            temp = from;
            from = to;
            to = temp;
        }

        // Set scaling factor
        factor = {
            from: {
                y: from.height / original.height,
                x: from.width / original.width
            },
            to: {
                y: to.height / original.height,
                x: to.width / original.width
            }
        };

        // Scale the css box
        if (scale === "box" || scale === "both") {

            // Vertical props scaling
            if (factor.from.y !== factor.to.y) {
                from = $.effects.setTransition(element, vProps, factor.from.y, from);
                to = $.effects.setTransition(element, vProps, factor.to.y, to);
            }

            // Horizontal props scaling
            if (factor.from.x !== factor.to.x) {
                from = $.effects.setTransition(element, hProps, factor.from.x, from);
                to = $.effects.setTransition(element, hProps, factor.to.x, to);
            }
        }

        // Scale the content
        if (scale === "content" || scale === "both") {

            // Vertical props scaling
            if (factor.from.y !== factor.to.y) {
                from = $.effects.setTransition(element, cProps, factor.from.y, from);
                to = $.effects.setTransition(element, cProps, factor.to.y, to);
            }
        }

        // Adjust the position properties based on the provided origin points
        if (origin) {
            baseline = $.effects.getBaseline(origin, original);
            from.top = (original.outerHeight - from.outerHeight) * baseline.y + pos.top;
            from.left = (original.outerWidth - from.outerWidth) * baseline.x + pos.left;
            to.top = (original.outerHeight - to.outerHeight) * baseline.y + pos.top;
            to.left = (original.outerWidth - to.outerWidth) * baseline.x + pos.left;
        }
        element.css(from);

        // Animate the children if desired
        if (scale === "content" || scale === "both") {

            vProps = vProps.concat(["marginTop", "marginBottom"]).concat(cProps);
            hProps = hProps.concat(["marginLeft", "marginRight"]);

            // Only animate children with width attributes specified
            // TODO: is this right? should we include anything with css width specified as well
            element.find("*[width]").each(function () {
                var child = $(this),
                    childOriginal = $.effects.scaledDimensions(child),
                    childFrom = {
                        height: childOriginal.height * factor.from.y,
                        width: childOriginal.width * factor.from.x,
                        outerHeight: childOriginal.outerHeight * factor.from.y,
                        outerWidth: childOriginal.outerWidth * factor.from.x
                    },
                    childTo = {
                        height: childOriginal.height * factor.to.y,
                        width: childOriginal.width * factor.to.x,
                        outerHeight: childOriginal.height * factor.to.y,
                        outerWidth: childOriginal.width * factor.to.x
                    };

                // Vertical props scaling
                if (factor.from.y !== factor.to.y) {
                    childFrom = $.effects.setTransition(child, vProps, factor.from.y, childFrom);
                    childTo = $.effects.setTransition(child, vProps, factor.to.y, childTo);
                }

                // Horizontal props scaling
                if (factor.from.x !== factor.to.x) {
                    childFrom = $.effects.setTransition(child, hProps, factor.from.x, childFrom);
                    childTo = $.effects.setTransition(child, hProps, factor.to.x, childTo);
                }

                if (restore) {
                    $.effects.saveStyle(child);
                }

                // Animate children
                child.css(childFrom);
                child.animate(childTo, options.duration, options.easing, function () {

                    // Restore children
                    if (restore) {
                        $.effects.restoreStyle(child);
                    }
                });
            });
        }

        // Animate
        element.animate(to, {
            queue: false,
            duration: options.duration,
            easing: options.easing,
            complete: function () {

                var offset = element.offset();

                if (to.opacity === 0) {
                    element.css("opacity", from.opacity);
                }

                if (!restore) {
                    element
                        .css("position", position === "static" ? "relative" : position)
                        .offset(offset);

                    // Need to save style here so that automatic style restoration
                    // doesn't restore to the original styles from before the animation.
                    $.effects.saveStyle(element);
                }

                done();
            }
        });

    });


    /*!
     * jQuery UI Effects Scale 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Scale Effect
    //>>group: Effects
    //>>description: Grows or shrinks an element and its content.
    //>>docs: http://api.jqueryui.com/scale-effect/
    //>>demos: http://jqueryui.com/effect/



    var effectsEffectScale = $.effects.define("scale", function (options, done) {

        // Create element
        var el = $(this),
            mode = options.mode,
            percent = parseInt(options.percent, 10) ||
                (parseInt(options.percent, 10) === 0 ? 0 : (mode !== "effect" ? 0 : 100)),

            newOptions = $.extend(true, {
                from: $.effects.scaledDimensions(el),
                to: $.effects.scaledDimensions(el, percent, options.direction || "both"),
                origin: options.origin || ["middle", "center"]
            }, options);

        // Fade option to support puff
        if (options.fade) {
            newOptions.from.opacity = 1;
            newOptions.to.opacity = 0;
        }

        $.effects.effect.size.call(this, newOptions, done);
    });


    /*!
     * jQuery UI Effects Puff 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Puff Effect
    //>>group: Effects
    //>>description: Creates a puff effect by scaling the element up and hiding it at the same time.
    //>>docs: http://api.jqueryui.com/puff-effect/
    //>>demos: http://jqueryui.com/effect/



    var effectsEffectPuff = $.effects.define("puff", "hide", function (options, done) {
        var newOptions = $.extend(true, {}, options, {
            fade: true,
            percent: parseInt(options.percent, 10) || 150
        });

        $.effects.effect.scale.call(this, newOptions, done);
    });


    /*!
     * jQuery UI Effects Pulsate 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Pulsate Effect
    //>>group: Effects
    //>>description: Pulsates an element n times by changing the opacity to zero and back.
    //>>docs: http://api.jqueryui.com/pulsate-effect/
    //>>demos: http://jqueryui.com/effect/



    var effectsEffectPulsate = $.effects.define("pulsate", "show", function (options, done) {
        var element = $(this),
            mode = options.mode,
            show = mode === "show",
            hide = mode === "hide",
            showhide = show || hide,

            // Showing or hiding leaves off the "last" animation
            anims = ((options.times || 5) * 2) + (showhide ? 1 : 0),
            duration = options.duration / anims,
            animateTo = 0,
            i = 1,
            queuelen = element.queue().length;

        if (show || !element.is(":visible")) {
            element.css("opacity", 0).show();
            animateTo = 1;
        }

        // Anims - 1 opacity "toggles"
        for (; i < anims; i++) {
            element.animate({ opacity: animateTo }, duration, options.easing);
            animateTo = 1 - animateTo;
        }

        element.animate({ opacity: animateTo }, duration, options.easing);

        element.queue(done);

        $.effects.unshift(element, queuelen, anims + 1);
    });


    /*!
     * jQuery UI Effects Shake 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Shake Effect
    //>>group: Effects
    //>>description: Shakes an element horizontally or vertically n times.
    //>>docs: http://api.jqueryui.com/shake-effect/
    //>>demos: http://jqueryui.com/effect/



    var effectsEffectShake = $.effects.define("shake", function (options, done) {

        var i = 1,
            element = $(this),
            direction = options.direction || "left",
            distance = options.distance || 20,
            times = options.times || 3,
            anims = times * 2 + 1,
            speed = Math.round(options.duration / anims),
            ref = (direction === "up" || direction === "down") ? "top" : "left",
            positiveMotion = (direction === "up" || direction === "left"),
            animation = {},
            animation1 = {},
            animation2 = {},

            queuelen = element.queue().length;

        $.effects.createPlaceholder(element);

        // Animation
        animation[ref] = (positiveMotion ? "-=" : "+=") + distance;
        animation1[ref] = (positiveMotion ? "+=" : "-=") + distance * 2;
        animation2[ref] = (positiveMotion ? "-=" : "+=") + distance * 2;

        // Animate
        element.animate(animation, speed, options.easing);

        // Shakes
        for (; i < times; i++) {
            element
                .animate(animation1, speed, options.easing)
                .animate(animation2, speed, options.easing);
        }

        element
            .animate(animation1, speed, options.easing)
            .animate(animation, speed / 2, options.easing)
            .queue(done);

        $.effects.unshift(element, queuelen, anims + 1);
    });


    /*!
     * jQuery UI Effects Slide 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Slide Effect
    //>>group: Effects
    //>>description: Slides an element in and out of the viewport.
    //>>docs: http://api.jqueryui.com/slide-effect/
    //>>demos: http://jqueryui.com/effect/



    var effectsEffectSlide = $.effects.define("slide", "show", function (options, done) {
        var startClip, startRef,
            element = $(this),
            map = {
                up: ["bottom", "top"],
                down: ["top", "bottom"],
                left: ["right", "left"],
                right: ["left", "right"]
            },
            mode = options.mode,
            direction = options.direction || "left",
            ref = (direction === "up" || direction === "down") ? "top" : "left",
            positiveMotion = (direction === "up" || direction === "left"),
            distance = options.distance ||
                element[ref === "top" ? "outerHeight" : "outerWidth"](true),
            animation = {};

        $.effects.createPlaceholder(element);

        startClip = element.cssClip();
        startRef = element.position()[ref];

        // Define hide animation
        animation[ref] = (positiveMotion ? -1 : 1) * distance + startRef;
        animation.clip = element.cssClip();
        animation.clip[map[direction][1]] = animation.clip[map[direction][0]];

        // Reverse the animation if we're showing
        if (mode === "show") {
            element.cssClip(animation.clip);
            element.css(ref, animation[ref]);
            animation.clip = startClip;
            animation[ref] = startRef;
        }

        // Actually animate
        element.animate(animation, {
            queue: false,
            duration: options.duration,
            easing: options.easing,
            complete: done
        });
    });


    /*!
     * jQuery UI Effects Transfer 1.12.1
     * http://jqueryui.com
     *
     * Copyright jQuery Foundation and other contributors
     * Released under the MIT license.
     * http://jquery.org/license
     */

    //>>label: Transfer Effect
    //>>group: Effects
    //>>description: Displays a transfer effect from one element to another.
    //>>docs: http://api.jqueryui.com/transfer-effect/
    //>>demos: http://jqueryui.com/effect/



    var effect;
    if ($.uiBackCompat !== false) {
        effect = $.effects.define("transfer", function (options, done) {
            $(this).transfer(options, done);
        });
    }
    var effectsEffectTransfer = effect;




}));
define('binding-handlers/datepicker', ['jquery', 'knockout', 'context', 'dateUtils', 'jquerybrowser', 'jqueryui'],
    function ($, ko, context, dateUtils, jqueryBrowser, jqueryui) {
        var dateSelected = function (valueAccessor, dateString, datepicker) {
            var boundDate = valueAccessor().date;
            if (ko.isObservable(boundDate)) {
                var isDate = dateUtils.isDate(boundDate());
                var hours = isDate ? boundDate().hours() : 12;
                var minutes = isDate ? boundDate().minutes() : 0;
                var newDate = dateUtils.newDate(datepicker.selectedYear, datepicker.selectedMonth, datepicker.selectedDay, hours, minutes);
                boundDate(newDate);
            }
        };

            
        var disableDates = entryDataContext.DateSetting;

        var mobileScrollTop = function () {
            $('body').scrollTop(0);
        };

        var buttonObj = {};

        function insertMessage() {
            var config = buttonObj.config;
            var valueAccessor = buttonObj.valueAccessor;
            var $el = buttonObj.$el;

            clearTimeout(insertMessage.timer);

            var additions = additionsForDatePickerButtons(valueAccessor().date());
            var $customButtons = $('\
                <div class="ui-datepicker-buttonpane custom-buttons clearfix">\
                    <button type="button" class="first ui-datepicker-current ui-state-default' + additions.today.cssClass + '" data-handler="today" data-event="click" ' + additions.today.attr + '>' + config.currentText + '</button><!--\
                    --><button type="button" class="last ui-datepicker-current ui-state-default' + additions.tomorrow.cssClass + '" data-handler="tomorrow" data-event="click"' + additions.tomorrow.attr + '>' + config.tomorrowText + '</button>\
                </div>\
            ');

            if ($('#ui-datepicker-div .ui-datepicker-calendar').is(':visible')) {
                $('#ui-datepicker-div').prepend($customButtons);

                $customButtons.on('click', 'button', function () {
                    var handler = $(this).data('handler');
                    var newDateFormat = '';
                    var newDate = dateUtils.currentDate().clone();
                    switch (handler) {
                        case 'tomorrow':
                            newDateFormat = '+1d';
                            newDate = newDate.add(1, 'days');
                            break;
                        case 'today':
                            newDateFormat = '+0d';
                            break;
                    };
                    if (newDateFormat) {
                        dateSelected(valueAccessor, newDate.format(context.dateFormat.shortDayOfMonth), { selectedYear: newDate.year(), selectedMonth: newDate.month(), selectedDay: newDate.date() });
                    }

                    $el.trigger('change').blur();
                    $el.datepicker("hide");
                });

                $customButtons.on('mouseenter', removeTodayTomorrowStyle)
                $customButtons.on('mouseleave', applyTodayTomorrowStyle)
            }
            else {
                insertMessage.timer = setTimeout(insertMessage, 10);
            }
        }

        function applyTodayTomorrowStyle() {
            $(this).children("[data-selected=true]").addClass("selected");
        }
        function removeTodayTomorrowStyle() {
            $(this).children("[data-selected=true]").removeClass("selected");
        }

        function additionsForDatePickerButtons(newDate) {
            var isToday = !newDate || (newDate.format("L") === dateUtils.currentDate().format("L"));
            var isTomorrow = newDate && (newDate.format("L") === dateUtils.currentDate().add(1, 'days').format("L"));

            var rtn = {
                today: { cssClass: '', attr: '' },
                tomorrow: { cssClass: '', attr: '' }
            }

            var selectedAddition = { cssClass: ' selected', attr: 'data-selected = true' };
            if (isToday) {
                rtn.today = selectedAddition;
            }
            if (isTomorrow) {
                rtn.tomorrow = selectedAddition;
            }
            return rtn;
        }
        function isMobileSafari() {
            return navigator.userAgent.match(/(iPod|iPhone)/) && navigator.userAgent.match(/AppleWebKit/);
        }

        function initialise(element, valueAccessor) {

           

            var options = valueAccessor().options || {},
                    $el = $(element);

            var isDesktop = jqueryBrowser.desktop || $('body').innerWidth() > 767 || false;

            if (isMobileSafari()) {
                isDesktop = false; // double check safari mobile is not considered a desktop
            }

            var isTouch = !jqueryBrowser.desktop;
            var defaultConfig = {
                numberOfMonths: isDesktop ? 2 : 1,
                dateFormat: 'D d M',
                dayNamesMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
                setDate: '+1d',
                firstDay: 1,
                minDate: 0,
                maxDate: '+182d',
                showButtonPanel: false,
                currentText: 'Today',
                tomorrowText: 'Tomorrow',
                showTodayButton: false,
                onSelect: $.proxy(dateSelected, null, valueAccessor)
            };

            var config = $.extend({}, defaultConfig, options);

            if (isDesktop) {
                config.beforeShow = function (input, datepicker) {
                    buttonObj = {
                        config: config,
                        valueAccessor: valueAccessor,
                        $el: $el
                    };
                    insertMessage();
                };

                $(document).on('click', '.ui-datepicker-prev, .ui-datepicker-next', function (e) {
                    e.preventDefault();
                    if (!$('.ui-datepicker-buttonpane').is(':visible')) {
                        insertMessage();
                    }
                });

            } else {
                var $body = $('body');
                var modalOpenClass = 'modal-open';
                var modalOpenNoRemoveClass = 'datepicker-leave-modal-open';

                config.onChangeMonthYear = function () {
                    $body.addClass(modalOpenClass);
                    setTimeout(mobileScrollTop, 0);
                };
                config.beforeShow = function (input) {
                    var hasOpenModal = $body.hasClass(modalOpenClass);
                    if (hasOpenModal) {
                        $body.addClass(modalOpenNoRemoveClass);
                    } else {
                        $body.addClass(modalOpenClass);
                    }

                    $el.data('scrollTop', $body.scrollTop());
                    setTimeout(mobileScrollTop, 350);
                };
                config.onClose = function (input) {
                    var shouldLeaveModalOpen = $body.hasClass(modalOpenNoRemoveClass);

                    $body.removeClass(modalOpenNoRemoveClass);

                    if (!shouldLeaveModalOpen) {
                        $body.removeClass(modalOpenClass);
                    }

                    $body.scrollTop($el.data('scrollTop'));
                };
               
            }

            if (isTouch) {
                $el.on('click', function (e) {
                    e.preventDefault();
                });
                $el.attr('readonly', 'readonly');
            }

            if (disableDates) {
                config.beforeShowDay = function (date) {
                    var string = $.datepicker.formatDate('yy-mm-dd', date);
                    return [disableDates.indexOf(string) == -1];
                };
            };

            $el.datepicker(config);

            var $datepicker = $el.datepicker("widget");

            //handle disposal (if KO removes by the template binding)
            ko.utils.domNodeDisposal.addDisposeCallback(element, function () {
                $el.datepicker("destroy");
            });
        }
		
		var update = function (element, valueAccessor) {
            var options = valueAccessor().options;
            if (options.minDate && options.minDate != 0)
			{ 
		      $(element).datepicker('option', 'minDate', options.minDate);
			  $(element).datepicker('setDate', options.minDate);
			  $(element).datepicker('option','dateFormat', 'dd/mm/yy');
			}	 
        };

		
        ko.bindingHandlers.datepicker = {
            init: initialise,
			 update: update
        };
    }
);
// This file is the same as fancyselect as at
// https://github.com/octopuscreative/FancySelect/commit/8429d48ec2a9a8c9939df869074f793eb5769734
// except a few small commented changes taken from
// https://github.com/typoworx-de/FancySelect/ and
// https://github.com/octopuscreative/FancySelect/issues/37
// Generated by CoffeeScript 1.4.0
(function() {
  var $;

  $ = window.jQuery || window.Zepto || window.$;

  $.fn.fancySelect = function(opts) {
    var isiOS, settings;
    if (opts == null) {
      opts = {};
    }
    settings = $.extend({
      forceiOS: false,
      includeBlank: false,
      optionTemplate: function(optionEl) {
        return optionEl.text();
      },
      triggerTemplate: function(optionEl) {
        return optionEl.text();
      }
    }, opts);
    isiOS = !!navigator.userAgent.match(/iP(hone|od|ad)/i);
    return this.each(function() {
      var copyOptionsToList, disabled, options, sel, trigger, updateTriggerText, wrapper;
      sel = $(this);
      if (sel.hasClass('fancified') || sel[0].tagName !== 'SELECT') {
        return;
      }

      /*
       * https://github.com/octopuscreative/FancySelect/issues/37
       * https://github.com/typoworx-de/FancySelect/
       * @author TYPOWORX <info@typoworx.de>
       * Add close on body-click
      */
      $('body').on('click', function(e) {
        if( $('.fancy-select > .trigger.open').length >= 1) {
          $('.fancy-select > .trigger.open').not( $(e.target) ).trigger('close.fs');
        }
      });

      sel.addClass('fancified');
      sel.css({
        width: 1,
        height: 1,
        display: 'block',
        position: 'absolute',
        top: 0,
        left: 0,
        opacity: 0
      });
      sel.wrap('<div class="fancy-select">');
      wrapper = sel.parent();
      if (sel.data('class')) {
        wrapper.addClass(sel.data('class'));
      }
      wrapper.append('<div class="trigger">');
      if (!(isiOS && !settings.forceiOS)) {
        wrapper.append('<ul class="options">');
      }
      trigger = wrapper.find('.trigger');
      options = wrapper.find('.options');
      disabled = sel.prop('disabled');
      if (disabled) {
        wrapper.addClass('disabled');
      }
      updateTriggerText = function() {
        var triggerHtml;
        triggerHtml = settings.triggerTemplate(sel.find(':selected'));
        return trigger.html(triggerHtml);
      };
      sel.on('blur.fs', function() {
        if (trigger.hasClass('open')) {
          return setTimeout(function() {
            return trigger.trigger('close.fs');
          }, 120);
        }
      });
      trigger.on('close.fs', function() {
        trigger.removeClass('open');
        return options.removeClass('open');
      });
      trigger.on('click.fs', function() {
        var offParent, parent;
        if (!disabled) {
          trigger.toggleClass('open');
          if (isiOS && !settings.forceiOS) {
            if (trigger.hasClass('open')) {
              return sel.focus();
            }
          } else {
            if (trigger.hasClass('open')) {
              parent = trigger.parent();
              offParent = parent.offsetParent();
              if ((parent.offset().top + parent.outerHeight() + options.outerHeight() + 20) > $(window).height() + $(window).scrollTop()) {
                options.addClass('overflowing');
              } else {
                options.removeClass('overflowing');
              }
            }
            options.toggleClass('open');

            /*
             * https://github.com/typoworx-de/FancySelect/
             * @author TYPOWORX <info@typoworx.de>
             * Bugfix, don't use will close on scroll!
            */
            //if (!isiOS) {
            //  return sel.focus();
            //}
          }
        }
      });
      sel.on('enable', function() {
        sel.prop('disabled', false);
        wrapper.removeClass('disabled');
        disabled = false;
        return copyOptionsToList();
      });
      sel.on('disable', function() {
        sel.prop('disabled', true);
        wrapper.addClass('disabled');
        return disabled = true;
      });
      sel.on('change.fs', function (e) {
          //make sure that actual selected item is reflected in fancyselect
          var value = sel.find('option:selected').val();
          options.find('li').removeClass('selected');
          options.find('li[data-raw-value="' + value + '"]').addClass('selected');
         if (e.originalEvent && e.originalEvent.isTrusted && !isiOS) {
          return e.stopPropagation();
        } else {
          return updateTriggerText();
        }
      });
      sel.on('keydown', function(e) {
        var hovered, newHovered, w;
        w = e.which;
        hovered = options.find('.hover');
        hovered.removeClass('hover');
        if (!options.hasClass('open')) {
          if (w === 13 || w === 32 || w === 38 || w === 40) {
            e.preventDefault();
            return trigger.trigger('click.fs');
          }
        } else {
          if (w === 38) {
            e.preventDefault();
            if (hovered.length && hovered.index() > 0) {
              hovered.prev().addClass('hover');
            } else {
              options.find('li:last-child').addClass('hover');
            }
          } else if (w === 40) {
            e.preventDefault();
            if (hovered.length && hovered.index() < options.find('li').length - 1) {
              hovered.next().addClass('hover');
            } else {
              options.find('li:first-child').addClass('hover');
            }
          } else if (w === 27) {
            e.preventDefault();
            trigger.trigger('click.fs');
          } else if (w === 13 || w === 32) {
            e.preventDefault();
            hovered.trigger('click.fs');
          } else if (w === 9) {
            if (trigger.hasClass('open')) {
              trigger.trigger('close.fs');
            }
          }
          newHovered = options.find('.hover');
          if (newHovered.length) {
            options.scrollTop(0);
            return options.scrollTop(newHovered.position().top - 12);
          }
        }
      });
      options.on('click.fs', 'li', function(e) {
        var clicked;
        clicked = $(this);
        sel.val(clicked.data('raw-value'));
        if (!isiOS) {
          sel.trigger('blur.fs').trigger('focus.fs');
        }
        options.find('.selected').removeClass('selected');
        clicked.addClass('selected');
        trigger.addClass('selected');
        return sel.val(clicked.data('raw-value')).trigger('change.fs').trigger('blur.fs').trigger('focus.fs');
      });
      options.on('mouseenter.fs', 'li', function() {
        var hovered, nowHovered;
        nowHovered = $(this);
        hovered = options.find('.hover');
        hovered.removeClass('hover');
        return nowHovered.addClass('hover');
      });
      options.on('mouseleave.fs', 'li', function() {
        return options.find('.hover').removeClass('hover');
      });
      copyOptionsToList = function() {
        var selOpts;
        updateTriggerText();
        if (isiOS && !settings.forceiOS) {
          return;
        }
        selOpts = sel.find('option');
        return sel.find('option').each(function(i, opt) {
          var optHtml;
          opt = $(opt);
          if (!opt.prop('disabled') && (opt.val() || settings.includeBlank)) {
            optHtml = settings.optionTemplate(opt);
            if (opt.prop('selected')) {
              return options.append("<li data-raw-value=\"" + (opt.val()) + "\" class=\"selected\">" + optHtml + "</li>");
            } else {
              return options.append("<li data-raw-value=\"" + (opt.val()) + "\">" + optHtml + "</li>");
            }
          }
        });
      };
      sel.on('update.fs', function() {
        wrapper.find('.options').empty();
        return copyOptionsToList();
      });
      return copyOptionsToList();
    });
  };

}).call(this);
define("fancyselect", ["jquery"], (function (global) {
    return function () {
        var ret, fn;
        return ret || global.$;
    };
}(this)));

define('binding-handlers/fancySelect', ['jquery', 'knockout', 'utils', 'fancyselect', 'jquerybrowser'],
    function ($, ko, utils, fancyselect, jqueryBrowser) {

        var defaultConfig = {
            setWidth: false,
            suffixes: false,
            desktopOnly: false,
            includeBlank: false
        };

        function getSpaceBelowInputField($dropdownGroup) {
            var viewportHeight = $(window).height();
            var rect = $dropdownGroup[0].getBoundingClientRect();
            var dropdownHeight = getDropDownHeight($dropdownGroup);

            return viewportHeight - (rect.top + dropdownHeight );
        }

        function getSpaceAboveInputField($dropdownGroup) {
            var rect = $dropdownGroup[0].getBoundingClientRect();
            return rect.top;
        }
        function getOptionsHeight($options) {
            return  $options[0].offsetHeight;
        }

        function getDropDownHeight($dropdown) {
            return $dropdown[0].getBoundingClientRect().height;
        }

        function removeClasses($el, classesToRemove) {
            $el.removeClass(classesToRemove.join(' '));
        }

        // check position of input field and position
        // options accordingly
        function positionOptions($options, $dropdownGroup) {

            var aboveClassName = 'above';
            var belowClassName = 'below';

            removeClasses($options, [aboveClassName, belowClassName]);

            var orientationClassName; // either 'above' or 'below'

            var spaceBelow = getSpaceBelowInputField($dropdownGroup);
            var spaceAbove = getSpaceAboveInputField($dropdownGroup);

            var optionsHeight = getOptionsHeight($options);

            if(spaceBelow >= optionsHeight) {
                orientationClassName = belowClassName;
            } else if(spaceAbove >= optionsHeight) {
                orientationClassName = aboveClassName;
            } else {
                orientationClassName = spaceBelow > spaceAbove ? belowClassName : aboveClassName;
            }
            $options.addClass(orientationClassName);
        }
       
        function initialise(element, valueAccessor) {
            var options = ko.utils.unwrapObservable(valueAccessor());          
            var config = $.extend({}, defaultConfig, options);            
            var dropdownGroup = $(element).parent();

            var applySuffix = function () {
                if (config.suffixes) {
                    var appliedSuffixText;
                    var value = parseInt($(element).find('option:selected').val());
                    if (value > 9) {
                        value = value + '+';
                        appliedSuffixText = utils.numericSuffix(value, config.suffixes);   
                    }
                    else {
                         appliedSuffixText = utils.numericSuffix(value, config.suffixes);
                    }
                    
                    $(element).siblings('.trigger').html(appliedSuffixText);
                }
            };

            // Set the item as a fancy select item
            var fancySelect = $(element);                       

            // trigger the DOM's change event when changing FancySelect
            fancySelect.fancySelect({includeBlank: config.includeBlank}).on('change.fs', function () {                
                applySuffix();
                $(this).trigger('change.$');
            });

            if (config.desktopOnly && jqueryBrowser.mobile) {
                
                $(element).addClass('disabled').attr('disabled', 'disabled').attr('readonly', 'readonly').siblings('.trigger').on('click', function (e) {
                    e.preventDefault(); e.stopImmediatePropagation();
                });
            }

            applySuffix();            
            
            if (config.setWidth) {
                // even widths regardless of viewport
                dropdownGroup.on('click', function () {
                    var $optionsElement = dropdownGroup.find('ul.options');
                    if($optionsElement.length) {
                        positionOptions($optionsElement, dropdownGroup);

                        var width = $(this).find('.trigger').outerWidth();
                        $optionsElement.width(width);
                    }
                });
            }

            /*
            *   When options drop opens up, find selected item and scroll to it
            */
            dropdownGroup.find('.trigger').on('click', function () {
                var optionsElement = dropdownGroup.find('ul.options');
                var selected = optionsElement.find('.selected');
                if (selected.length > 0) {
                    var optionHeight = selected[0].clientHeight;
                    var offset = selected.index() * optionHeight;
                    optionsElement[0].scrollTop = offset;
                }
            });

            $(element).focus(function () {
                dropdownGroup.find('.trigger').click();
            });

            var boundValue = options.selectedValue;
            if (ko.isObservable(boundValue)) {
                $(element).change(function () {
                    var newValue = this.value;
                    if (newValue == ' ') {
                        newValue = '';
                    }

                    boundValue(newValue);
                });

                var setValue = function (value) {
                    $(element).val(value).trigger('change');                    
                };

                boundValue.subscribe(function (newValue) {
                    setValue(newValue);
                });

                setValue(boundValue());
            }
        }        

        ko.bindingHandlers.fancySelect = {
            init: initialise            
        };
    }
);
/*	
 * jQuery mmenu v5.2.0
 * @requires jQuery 1.7.0 or later
 *
 * mmenu.frebsite.nl
 *	
 * Copyright (c) Fred Heusschen
 * www.frebsite.nl
 *
 * Licensed under the MIT license:
 * http://en.wikipedia.org/wiki/MIT_License
 */
!function(e){function t(){e[n].glbl||(r={$wndw:e(window),$html:e("html"),$body:e("body")},a={},i={},l={},e.each([a,i,l],function(e,t){t.add=function(e){e=e.split(" ");for(var n=0,s=e.length;s>n;n++)t[e[n]]=t.mm(e[n])}}),a.mm=function(e){return"mm-"+e},a.add("wrapper menu vertical panel nopanel current highest opened subopened navbar hasnavbar title btn prev next first last listview nolistview selected divider spacer hidden fullsubopen"),a.umm=function(e){return"mm-"==e.slice(0,3)&&(e=e.slice(3)),e},i.mm=function(e){return"mm-"+e},i.add("parent sub"),l.mm=function(e){return e+".mm"},l.add("transitionend webkitTransitionEnd mousedown mouseup touchstart touchmove touchend click keydown"),e[n]._c=a,e[n]._d=i,e[n]._e=l,e[n].glbl=r)}var n="mmenu",s="5.2.0";if(!e[n]){e[n]=function(e,t,n){this.$menu=e,this._api=["bind","init","update","setSelected","getInstance","openPanel","closePanel","closeAllPanels"],this.opts=t,this.conf=n,this.vars={},this.cbck={},"function"==typeof this.___deprecated&&this.___deprecated(),this._initMenu(),this._initAnchors();var s=this.$menu.children(this.conf.panelNodetype);return this._initAddons(),this.init(s),"function"==typeof this.___debug&&this.___debug(),this},e[n].version=s,e[n].addons={},e[n].uniqueId=0,e[n].defaults={extensions:[],navbar:{title:"Menu",titleLink:"panel"},onClick:{setSelected:!0},slidingSubmenus:!0},e[n].configuration={classNames:{panel:"Panel",vertical:"Vertical",selected:"Selected",divider:"Divider",spacer:"Spacer"},clone:!1,openingInterval:25,panelNodetype:"ul, ol, div",transitionDuration:400},e[n].prototype={init:function(e){e=e.not("."+a.nopanel),e=this._initPanels(e),this.trigger("init",e),this.trigger("update")},update:function(){this.trigger("update")},setSelected:function(e){this.$menu.find("."+a.listview).children().removeClass(a.selected),e.addClass(a.selected),this.trigger("setSelected",e)},openPanel:function(t){var n=t.parent();if(n.hasClass(a.vertical)){var s=n.parents("."+a.subopened);if(s.length)return this.openPanel(s.first());n.addClass(a.opened)}else{if(t.hasClass(a.current))return;var i=e(this.$menu).children("."+a.panel),l=i.filter("."+a.current);i.removeClass(a.highest).removeClass(a.current).not(t).not(l).not("."+a.vertical).addClass(a.hidden),t.hasClass(a.opened)?l.addClass(a.highest).removeClass(a.opened).removeClass(a.subopened):(t.addClass(a.highest),l.addClass(a.subopened)),t.removeClass(a.hidden).addClass(a.current),setTimeout(function(){t.removeClass(a.subopened).addClass(a.opened)},this.conf.openingInterval)}this.trigger("openPanel",t)},closePanel:function(e){var t=e.parent();t.hasClass(a.vertical)&&(t.removeClass(a.opened),this.trigger("closePanel",e))},closeAllPanels:function(){this.$menu.find("."+a.listview).children().removeClass(a.selected).filter("."+a.vertical).removeClass(a.opened);var e=this.$menu.children("."+a.panel),t=e.first();this.$menu.children("."+a.panel).not(t).removeClass(a.subopened).removeClass(a.opened).removeClass(a.current).removeClass(a.highest).addClass(a.hidden),this.openPanel(t)},togglePanel:function(e){var t=e.parent();t.hasClass(a.vertical)&&this[t.hasClass(a.opened)?"closePanel":"openPanel"](e)},getInstance:function(){return this},bind:function(e,t){this.cbck[e]=this.cbck[e]||[],this.cbck[e].push(t)},trigger:function(){var e=this,t=Array.prototype.slice.call(arguments),n=t.shift();if(this.cbck[n])for(var s=0,a=this.cbck[n].length;a>s;s++)this.cbck[n][s].apply(e,t)},_initMenu:function(){this.opts.offCanvas&&this.conf.clone&&(this.$menu=this.$menu.clone(!0),this.$menu.add(this.$menu.find("[id]")).filter("[id]").each(function(){e(this).attr("id",a.mm(e(this).attr("id")))})),this.$menu.contents().each(function(){3==e(this)[0].nodeType&&e(this).remove()}),this.$menu.parent().addClass(a.wrapper);var t=[a.menu];this.opts.slidingSubmenus||t.push(a.vertical),this.opts.extensions=this.opts.extensions.length?"mm-"+this.opts.extensions.join(" mm-"):"",this.opts.extensions&&t.push(this.opts.extensions),this.$menu.addClass(t.join(" "))},_initPanels:function(t){var n=this;this.__findAddBack(t,"ul, ol").not("."+a.nolistview).addClass(a.listview);var s=this.__findAddBack(t,"."+a.listview).children();this.__refactorClass(s,this.conf.classNames.selected,"selected"),this.__refactorClass(s,this.conf.classNames.divider,"divider"),this.__refactorClass(s,this.conf.classNames.spacer,"spacer"),this.__refactorClass(this.__findAddBack(t,"."+this.conf.classNames.panel),this.conf.classNames.panel,"panel");var l=e(),r=t.add(t.find("."+a.panel)).add(this.__findAddBack(t,"."+a.listview).children().children(this.conf.panelNodetype)).not("."+a.nopanel);this.__refactorClass(r,this.conf.classNames.vertical,"vertical"),this.opts.slidingSubmenus||r.addClass(a.vertical),r.each(function(){var t=e(this),s=t;t.is("ul, ol")?(t.wrap('<div class="'+a.panel+'" />'),s=t.parent()):s.addClass(a.panel);var i=t.attr("id");t.removeAttr("id"),s.attr("id",i||n.__getUniqueId()),t.hasClass(a.vertical)&&(t.removeClass(n.conf.classNames.vertical),s.add(s.parent()).addClass(a.vertical)),l=l.add(s);var r=s.children().first(),d=s.children().last();r.is("."+a.listview)&&r.addClass(a.first),d.is("."+a.listview)&&d.addClass(a.last)});var d=e("."+a.panel,this.$menu);l.each(function(){var t=e(this),s=t.parent(),l=s.children("a, span").first();if(s.is("."+a.menu)||(s.data(i.sub,t),t.data(i.parent,s)),!s.children("."+a.next).length&&s.parent().is("."+a.listview)){var r=t.attr("id"),d=e('<a class="'+a.next+'" href="#'+r+'" data-target="#'+r+'" />').insertBefore(l);l.is("span")&&d.addClass(a.fullsubopen)}if(!t.children("."+a.navbar).length&&!s.hasClass(a.vertical)){if(s.parent().is("."+a.listview))var s=s.closest("."+a.panel);else var l=s.closest("."+a.panel).find('a[href="#'+t.attr("id")+'"]').first(),s=l.closest("."+a.panel);var o=e('<div class="'+a.navbar+'" />');if(s.length){var r=s.attr("id");switch(n.opts.navbar.titleLink){case"anchor":_url=l.attr("href");break;case"panel":case"parent":_url="#"+r;break;case"none":default:_url=!1}o.append('<a class="'+a.btn+" "+a.prev+'" href="#'+r+'" data-target="#'+r+'"></a>').append('<a class="'+a.title+'"'+(_url?' href="'+_url+'"':"")+">"+l.text()+"</a>").prependTo(t),t.addClass(a.hasnavbar)}else n.opts.navbar.title&&(o.append('<a class="'+a.title+'">'+n.opts.navbar.title+"</a>").prependTo(t),t.addClass(a.hasnavbar))}});var o=this.__findAddBack(t,"."+a.listview).children("."+a.selected).removeClass(a.selected).last().addClass(a.selected);o.add(o.parentsUntil("."+a.menu,"li")).filter("."+a.vertical).addClass(a.opened).end().not("."+a.vertical).each(function(){e(this).parentsUntil("."+a.menu,"."+a.panel).not("."+a.vertical).first().addClass(a.opened).parentsUntil("."+a.menu,"."+a.panel).not("."+a.vertical).first().addClass(a.opened).addClass(a.subopened)}),o.children("."+a.panel).not("."+a.vertical).addClass(a.opened).parentsUntil("."+a.menu,"."+a.panel).not("."+a.vertical).first().addClass(a.opened).addClass(a.subopened);var c=d.filter("."+a.opened);return c.length||(c=l.first()),c.addClass(a.opened).last().addClass(a.current),l.not("."+a.vertical).not(c.last()).addClass(a.hidden).end().appendTo(this.$menu),l},_initAnchors:function(){var t=this;r.$body.on(l.click+"-oncanvas","a[href]",function(s){var i=e(this),l=!1,d=t.$menu.find(i).length;for(var o in e[n].addons)if(l=e[n].addons[o].clickAnchor.call(t,i,d))break;if(!l&&d){var c=i.attr("href");if(c.length>1&&"#"==c.slice(0,1)){var h=e(c,t.$menu);h.is("."+a.panel)&&(l=!0,t[i.parent().hasClass(a.vertical)?"togglePanel":"openPanel"](h))}}if(l&&s.preventDefault(),!l&&d&&i.is("."+a.listview+" > li > a")&&!i.is('[rel="external"]')&&!i.is('[target="_blank"]')){t.__valueOrFn(t.opts.onClick.setSelected,i)&&t.setSelected(e(s.target).parent());var u=t.__valueOrFn(t.opts.onClick.preventDefault,i,"#"==c.slice(0,1));u&&s.preventDefault(),t.__valueOrFn(t.opts.onClick.blockUI,i,!u)&&r.$html.addClass(a.blocking),t.__valueOrFn(t.opts.onClick.close,i,u)&&t.close()}})},_initAddons:function(){for(var t in e[n].addons)e[n].addons[t].add.call(this),e[n].addons[t].add=function(){};for(var t in e[n].addons)e[n].addons[t].setup.call(this)},__api:function(){var t=this,n={};return e.each(this._api,function(){var e=this;n[e]=function(){var s=t[e].apply(t,arguments);return"undefined"==typeof s?n:s}}),n},__valueOrFn:function(e,t,n){return"function"==typeof e?e.call(t[0]):"undefined"==typeof e&&"undefined"!=typeof n?n:e},__refactorClass:function(e,t,n){return e.filter("."+t).removeClass(t).addClass(a[n])},__findAddBack:function(e,t){return e.find(t).add(e.filter(t))},__filterListItems:function(e){return e.not("."+a.divider).not("."+a.hidden)},__transitionend:function(e,t,n){var s=!1,a=function(){s||t.call(e[0]),s=!0};e.one(l.transitionend,a),e.one(l.webkitTransitionEnd,a),setTimeout(a,1.1*n)},__getUniqueId:function(){return a.mm(e[n].uniqueId++)}},e.fn[n]=function(s,a){return t(),s=e.extend(!0,{},e[n].defaults,s),a=e.extend(!0,{},e[n].configuration,a),this.each(function(){var t=e(this);if(!t.data(n)){var i=new e[n](t,s,a);t.data(n,i.__api())}})},e[n].support={touch:"ontouchstart"in window||navigator.msMaxTouchPoints};var a,i,l,r}}(jQuery);
/*	
 * jQuery mmenu offCanvas addon
 * mmenu.frebsite.nl
 *
 * Copyright (c) Fred Heusschen
 */
!function(t){var e="mmenu",o="offCanvas";t[e].addons[o]={setup:function(){if(this.opts[o]){var n=this.opts[o],i=this.conf[o];a=t[e].glbl,this._api=t.merge(this._api,["open","close","setPage"]),("top"==n.position||"bottom"==n.position)&&(n.zposition="front"),"string"!=typeof i.pageSelector&&(i.pageSelector="> "+i.pageNodetype),a.$allMenus=(a.$allMenus||t()).add(this.$menu),this.vars.opened=!1;var r=[s.offcanvas];"left"!=n.position&&r.push(s.mm(n.position)),"back"!=n.zposition&&r.push(s.mm(n.zposition)),this.$menu.addClass(r.join(" ")).parent().removeClass(s.wrapper),this.setPage(a.$page),this._initBlocker(),this["_initWindow_"+o](),this.$menu[i.menuInjectMethod+"To"](i.menuWrapperSelector)}},add:function(){s=t[e]._c,n=t[e]._d,i=t[e]._e,s.add("offcanvas slideout modal background opening blocker page"),n.add("style"),i.add("resize")},clickAnchor:function(t){if(!this.opts[o])return!1;var e=this.$menu.attr("id");if(e&&e.length&&(this.conf.clone&&(e=s.umm(e)),t.is('[href="#'+e+'"]')))return this.open(),!0;if(a.$page){var e=a.$page.first().attr("id");return e&&e.length&&t.is('[href="#'+e+'"]')?(this.close(),!0):!1}}},t[e].defaults[o]={position:"left",zposition:"back",modal:!1,moveBackground:!0},t[e].configuration[o]={pageNodetype:"div",pageSelector:null,wrapPageIfNeeded:!0,menuWrapperSelector:"body",menuInjectMethod:"prepend"},t[e].prototype.open=function(){if(!this.vars.opened){var t=this;this._openSetup(),setTimeout(function(){t._openFinish()},this.conf.openingInterval),this.trigger("open")}},t[e].prototype._openSetup=function(){var e=this;this.closeAllOthers(),a.$page.each(function(){t(this).data(n.style,t(this).attr("style")||"")}),a.$wndw.trigger(i.resize+"-offcanvas",[!0]);var r=[s.opened];this.opts[o].modal&&r.push(s.modal),this.opts[o].moveBackground&&r.push(s.background),"left"!=this.opts[o].position&&r.push(s.mm(this.opts[o].position)),"back"!=this.opts[o].zposition&&r.push(s.mm(this.opts[o].zposition)),this.opts.extensions&&r.push(this.opts.extensions),a.$html.addClass(r.join(" ")),setTimeout(function(){e.vars.opened=!0},this.conf.openingInterval),this.$menu.addClass(s.current+" "+s.opened)},t[e].prototype._openFinish=function(){var t=this;this.__transitionend(a.$page.first(),function(){t.trigger("opened")},this.conf.transitionDuration),a.$html.addClass(s.opening),this.trigger("opening")},t[e].prototype.close=function(){if(this.vars.opened){var e=this;this.__transitionend(a.$page.first(),function(){e.$menu.removeClass(s.current).removeClass(s.opened),a.$html.removeClass(s.opened).removeClass(s.modal).removeClass(s.background).removeClass(s.mm(e.opts[o].position)).removeClass(s.mm(e.opts[o].zposition)),e.opts.extensions&&a.$html.removeClass(e.opts.extensions),a.$page.each(function(){t(this).attr("style",t(this).data(n.style))}),e.vars.opened=!1,e.trigger("closed")},this.conf.transitionDuration),a.$html.removeClass(s.opening),this.trigger("close"),this.trigger("closing")}},t[e].prototype.closeAllOthers=function(){a.$allMenus.not(this.$menu).each(function(){var o=t(this).data(e);o&&o.close&&o.close()})},t[e].prototype.setPage=function(e){var n=this,i=this.conf[o];e&&e.length||(e=a.$body.find(i.pageSelector),e.length>1&&i.wrapPageIfNeeded&&(e=e.wrapAll("<"+this.conf[o].pageNodetype+" />").parent())),e.each(function(){t(this).attr("id",t(this).attr("id")||n.__getUniqueId())}),e.addClass(s.page+" "+s.slideout),a.$page=e,this.trigger("setPage",e)},t[e].prototype["_initWindow_"+o]=function(){a.$wndw.off(i.keydown+"-offcanvas").on(i.keydown+"-offcanvas",function(t){return a.$html.hasClass(s.opened)&&9==t.keyCode?(t.preventDefault(),!1):void 0});var t=0;a.$wndw.off(i.resize+"-offcanvas").on(i.resize+"-offcanvas",function(e,o){if(1==a.$page.length&&(o||a.$html.hasClass(s.opened))){var n=a.$wndw.height();(o||n!=t)&&(t=n,a.$page.css("minHeight",n))}})},t[e].prototype._initBlocker=function(){var e=this;a.$blck||(a.$blck=t('<div id="'+s.blocker+'" class="'+s.slideout+'" />')),a.$blck.appendTo(a.$body).off(i.touchstart+"-offcanvas "+i.touchmove+"-offcanvas").on(i.touchstart+"-offcanvas "+i.touchmove+"-offcanvas",function(t){t.preventDefault(),t.stopPropagation(),a.$blck.trigger(i.mousedown+"-offcanvas")}).off(i.mousedown+"-offcanvas").on(i.mousedown+"-offcanvas",function(t){t.preventDefault(),a.$html.hasClass(s.modal)||(e.closeAllOthers(),e.close())})};var s,n,i,a}(jQuery);
/*	
 * jQuery mmenu autoHeight addon
 * mmenu.frebsite.nl
 *
 * Copyright (c) Fred Heusschen
 */
!function(t){var e="mmenu",i="autoHeight";t[e].addons[i]={setup:function(){if(this.opts.offCanvas){switch(this.opts.offCanvas.position){case"left":case"right":return}var n=this,o=this.opts[i];if(this.conf[i],h=t[e].glbl,"boolean"==typeof o&&o&&(o={height:"auto"}),"object"!=typeof o&&(o={}),o=this.opts[i]=t.extend(!0,{},t[e].defaults[i],o),"auto"==o.height){this.$menu.addClass(s.autoheight);var u=function(t){var e=this.$menu.children("."+s.current);_top=parseInt(e.css("top"),10)||0,_bot=parseInt(e.css("bottom"),10)||0,this.$menu.addClass(s.measureheight),t=t||this.$menu.children("."+s.current),t.is("."+s.vertical)&&(t=t.parents("."+s.panel).not("."+s.vertical).first()),this.$menu.height(t.outerHeight()+_top+_bot).removeClass(s.measureheight)};this.bind("update",u),this.bind("openPanel",u),this.bind("closePanel",u),this.bind("open",u),h.$wndw.off(a.resize+"-autoheight").on(a.resize+"-autoheight",function(){u.call(n)})}}},add:function(){s=t[e]._c,n=t[e]._d,a=t[e]._e,s.add("autoheight measureheight"),a.add("resize")},clickAnchor:function(){}},t[e].defaults[i]={height:"default"};var s,n,a,h}(jQuery);
/*	
 * jQuery mmenu backButton addon
 * mmenu.frebsite.nl
 *
 * Copyright (c) Fred Heusschen
 */
!function(o){var t="mmenu",n="backButton";o[t].addons[n]={setup:function(){if(this.opts.offCanvas){var i=this,e=this.opts[n];if(this.conf[n],a=o[t].glbl,"boolean"==typeof e&&(e={close:e}),"object"!=typeof e&&(e={}),e=o.extend(!0,{},o[t].defaults[n],e),e.close){var c="#"+i.$menu.attr("id");this.bind("opened",function(){location.hash!=c&&history.pushState(null,document.title,c)}),o(window).on("popstate",function(o){a.$html.hasClass(s.opened)?(o.stopPropagation(),i.close()):location.hash==c&&(o.stopPropagation(),i.open())})}}},add:function(){return window.history&&window.history.pushState?(s=o[t]._c,i=o[t]._d,e=o[t]._e,void 0):(o[t].addons[n].setup=function(){},void 0)},clickAnchor:function(){}},o[t].defaults[n]={close:!1};var s,i,e,a}(jQuery);
/*	
 * jQuery mmenu counters addon
 * mmenu.frebsite.nl
 *
 * Copyright (c) Fred Heusschen
 */
!function(t){var n="mmenu",e="counters";t[n].addons[e]={setup:function(){var c=this,o=this.opts[e];this.conf[e],s=t[n].glbl,"boolean"==typeof o&&(o={add:o,update:o}),"object"!=typeof o&&(o={}),o=this.opts[e]=t.extend(!0,{},t[n].defaults[e],o),this.bind("init",function(n){this.__refactorClass(t("em",n),this.conf.classNames[e].counter,"counter")}),o.add&&this.bind("init",function(n){n.each(function(){var n=t(this).data(a.parent);n&&(n.children("em."+i.counter).length||n.prepend(t('<em class="'+i.counter+'" />')))})}),o.update&&this.bind("update",function(){this.$menu.find("."+i.panel).each(function(){var n=t(this),e=n.data(a.parent);if(e){var s=e.children("em."+i.counter);s.length&&(n=n.children("."+i.listview),n.length&&s.html(c.__filterListItems(n.children()).length))}})})},add:function(){i=t[n]._c,a=t[n]._d,c=t[n]._e,i.add("counter search noresultsmsg")},clickAnchor:function(){}},t[n].defaults[e]={add:!1,update:!1},t[n].configuration.classNames[e]={counter:"Counter"};var i,a,c,s}(jQuery);
/*	
 * jQuery mmenu dividers addon
 * mmenu.frebsite.nl
 *
 * Copyright (c) Fred Heusschen
 */
!function(i){var e="mmenu",s="dividers";i[e].addons[s]={setup:function(){var n=this,a=this.opts[s];if(this.conf[s],l=i[e].glbl,"boolean"==typeof a&&(a={add:a,fixed:a}),"object"!=typeof a&&(a={}),a=this.opts[s]=i.extend(!0,{},i[e].defaults[s],a),this.bind("init",function(){this.__refactorClass(i("li",this.$menu),this.conf.classNames[s].collapsed,"collapsed")}),a.add&&this.bind("init",function(e){switch(a.addTo){case"panels":var s=e;break;default:var s=i(a.addTo,this.$menu).filter("."+d.panel)}i("."+d.divider,s).remove(),s.find("."+d.listview).not("."+d.vertical).each(function(){var e="";n.__filterListItems(i(this).children()).each(function(){var s=i.trim(i(this).children("a, span").text()).slice(0,1).toLowerCase();s!=e&&s.length&&(e=s,i('<li class="'+d.divider+'">'+s+"</li>").insertBefore(this))})})}),a.collapse&&this.bind("init",function(e){i("."+d.divider,e).each(function(){var e=i(this),s=e.nextUntil("."+d.divider,"."+d.collapsed);s.length&&(e.children("."+d.subopen).length||(e.wrapInner("<span />"),e.prepend('<a href="#" class="'+d.subopen+" "+d.fullsubopen+'" />')))})}),a.fixed){var o=function(e){e=e||this.$menu.children("."+d.current);var s=e.find("."+d.divider).not("."+d.hidden);if(s.length){this.$menu.addClass(d.hasdividers);var n=e.scrollTop()||0,t="";e.is(":visible")&&e.find("."+d.divider).not("."+d.hidden).each(function(){i(this).position().top+n<n+1&&(t=i(this).text())}),this.$fixeddivider.text(t)}else this.$menu.removeClass(d.hasdividers)};this.$fixeddivider=i('<ul class="'+d.listview+" "+d.fixeddivider+'"><li class="'+d.divider+'"></li></ul>').prependTo(this.$menu).children(),this.bind("openPanel",o),this.bind("init",function(e){e.off(t.scroll+"-dividers "+t.touchmove+"-dividers").on(t.scroll+"-dividers "+t.touchmove+"-dividers",function(){o.call(n,i(this))})})}},add:function(){d=i[e]._c,n=i[e]._d,t=i[e]._e,d.add("collapsed uncollapsed fixeddivider hasdividers"),t.add("scroll")},clickAnchor:function(i,e){if(this.opts[s].collapse&&e){var n=i.parent();if(n.is("."+d.divider)){var t=n.nextUntil("."+d.divider,"."+d.collapsed);return n.toggleClass(d.opened),t[n.hasClass(d.opened)?"addClass":"removeClass"](d.uncollapsed),!0}}return!1}},i[e].defaults[s]={add:!1,addTo:"panels",fixed:!1,collapse:!1},i[e].configuration.classNames[s]={collapsed:"Collapsed"};var d,n,t,l}(jQuery);
/*	
 * jQuery mmenu dragOpen addon
 * mmenu.frebsite.nl
 *
 * Copyright (c) Fred Heusschen
 */
!function(e){function t(e,t,n){return t>e&&(e=t),e>n&&(e=n),e}var n="mmenu",o="dragOpen";e[n].addons[o]={setup:function(){if(this.opts.offCanvas){var i=this,a=this.opts[o],p=this.conf[o];if(r=e[n].glbl,"boolean"==typeof a&&(a={open:a}),"object"!=typeof a&&(a={}),a=this.opts[o]=e.extend(!0,{},e[n].defaults[o],a),a.open){var d,f,c,u,h,l={},m=0,g=!1,v=!1,w=0,_=0;switch(this.opts.offCanvas.position){case"left":case"right":l.events="panleft panright",l.typeLower="x",l.typeUpper="X",v="width";break;case"top":case"bottom":l.events="panup pandown",l.typeLower="y",l.typeUpper="Y",v="height"}switch(this.opts.offCanvas.position){case"right":case"bottom":l.negative=!0,u=function(e){e>=r.$wndw[v]()-a.maxStartPos&&(m=1)};break;default:l.negative=!1,u=function(e){e<=a.maxStartPos&&(m=1)}}switch(this.opts.offCanvas.position){case"left":l.open_dir="right",l.close_dir="left";break;case"right":l.open_dir="left",l.close_dir="right";break;case"top":l.open_dir="down",l.close_dir="up";break;case"bottom":l.open_dir="up",l.close_dir="down"}switch(this.opts.offCanvas.zposition){case"front":h=function(){return this.$menu};break;default:h=function(){return e("."+s.slideout)}}var b=this.__valueOrFn(a.pageNode,this.$menu,r.$page);"string"==typeof b&&(b=e(b));var y=new Hammer(b[0],a.vendors.hammer);y.on("panstart",function(e){u(e.center[l.typeLower]),r.$slideOutNodes=h(),g=l.open_dir}).on(l.events+" panend",function(e){m>0&&e.preventDefault()}).on(l.events,function(e){if(d=e["delta"+l.typeUpper],l.negative&&(d=-d),d!=w&&(g=d>=w?l.open_dir:l.close_dir),w=d,w>a.threshold&&1==m){if(r.$html.hasClass(s.opened))return;m=2,i._openSetup(),i.trigger("opening"),r.$html.addClass(s.dragging),_=t(r.$wndw[v]()*p[v].perc,p[v].min,p[v].max)}2==m&&(f=t(w,10,_)-("front"==i.opts.offCanvas.zposition?_:0),l.negative&&(f=-f),c="translate"+l.typeUpper+"("+f+"px )",r.$slideOutNodes.css({"-webkit-transform":"-webkit-"+c,transform:c}))}).on("panend",function(){2==m&&(r.$html.removeClass(s.dragging),r.$slideOutNodes.css("transform",""),i[g==l.open_dir?"_openFinish":"close"]()),m=0})}}},add:function(){return"function"!=typeof Hammer||Hammer.VERSION<2?(e[n].addons[o].setup=function(){},void 0):(s=e[n]._c,i=e[n]._d,a=e[n]._e,s.add("dragging"),void 0)},clickAnchor:function(){}},e[n].defaults[o]={open:!1,maxStartPos:100,threshold:50,vendors:{hammer:{}}},e[n].configuration[o]={width:{perc:.8,min:140,max:440},height:{perc:.8,min:140,max:880}};var s,i,a,r}(jQuery);
/*	
 * jQuery mmenu fixedElements addon
 * mmenu.frebsite.nl
 *
 * Copyright (c) Fred Heusschen
 */
!function(i){var s="mmenu",n="fixedElements";i[s].addons[n]={setup:function(){if(this.opts.offCanvas){this.opts[n],this.conf[n],o=i[s].glbl;var a=function(i){var s=this.conf.classNames[n].fixed;this.__refactorClass(i.find("."+s),s,"slideout").appendTo(o.$body)};a.call(this,o.$page),this.bind("setPage",a)}},add:function(){a=i[s]._c,t=i[s]._d,e=i[s]._e,a.add("fixed")},clickAnchor:function(){}},i[s].configuration.classNames[n]={fixed:"Fixed"};var a,t,e,o}(jQuery);
/*	
 * jQuery mmenu navbar addon
 * mmenu.frebsite.nl
 *
 * Copyright (c) Fred Heusschen
 */
!function(n){var a="mmenu",t="navbars";n[a].addons[t]={setup:function(){var r=this,s=this.opts[t];if(this.conf[t],i=n[a].glbl,"undefined"!=typeof s){s instanceof Array||(s=[s]);var d={};n.each(s,function(i){var c=s[i];"boolean"==typeof c&&c&&(c={}),"object"!=typeof c&&(c={}),"undefined"==typeof c.content&&(c.content=["prev","title"]),c.content instanceof Array||(c.content=[c.content]),c=n.extend(!0,{},r.opts.navbar,c);var o=c.position;"bottom"!=o&&(o="top"),d[o]||(d[o]=0),d[o]++;for(var l=n("<div />").addClass(e.navbar).addClass(e.navbar+"-"+o).addClass(e.navbar+"-"+o+"-"+d[o]),h=0,f=c.content.length;f>h;h++){var v=n[a].addons[t][c.content[h]]||!1;v?v.call(r,l,c):(v=c.content[h],v instanceof n||(v=n(c.content[h])),v.each(function(){l.append(n(this))}))}var u=l.children().not("."+e.btn).length;u>1&&l.addClass(e.navbar+"-"+u),l.children("."+e.btn).length&&l.addClass(e.hasbtns),l.prependTo(r.$menu)});for(var c in d)r.$menu.addClass(e.hasnavbar+"-"+c+"-"+d[c])}},add:function(){e=n[a]._c,r=n[a]._d,s=n[a]._e,e.add("close hasbtns")},clickAnchor:function(){}},n[a].configuration.classNames[t]={panelTitle:"Title",panelNext:"Next",panelPrev:"Prev"};var e,r,s,i}(jQuery),/*	
 * jQuery mmenu navbar addon close content
 * mmenu.frebsite.nl
 *
 * Copyright (c) Fred Heusschen
 */
function(n){var a="mmenu",t="navbars",e="close";n[a].addons[t][e]=function(t){var e=n[a]._c,r=n[a].glbl;t.append('<a class="'+e.close+" "+e.btn+'" href="#"></a>');var s=function(n){t.find("."+e.close).attr("href","#"+n.attr("id"))};s.call(this,r.$page),this.bind("setPage",s)}}(jQuery),/*	
 * jQuery mmenu navbar addon next content
 * mmenu.frebsite.nl
 *
 * Copyright (c) Fred Heusschen
 */
function(n){var a="mmenu",t="navbars",e="next";n[a].addons[t][e]=function(e){var r=n[a]._c;e.append('<a class="'+r.next+" "+r.btn+'" href="#"></a>');var s=function(n){n=n||this.$menu.children("."+r.current);var a=e.find("."+r.next),s=n.find("."+this.conf.classNames[t].panelNext),i=s.attr("href"),d=s.html();a[i?"attr":"removeAttr"]("href",i),a[i||d?"removeClass":"addClass"](r.hidden),a.html(d)};this.bind("openPanel",s),this.bind("init",function(){s.call(this)})}}(jQuery),/*	
 * jQuery mmenu navbar addon prev content
 * mmenu.frebsite.nl
 *
 * Copyright (c) Fred Heusschen
 */
function(n){var a="mmenu",t="navbars",e="prev";n[a].addons[t][e]=function(e){var r=n[a]._c;e.append('<a class="'+r.prev+" "+r.btn+'" href="#"></a>'),this.bind("init",function(n){n.removeClass(r.hasnavbar)});var s=function(n){n=n||this.$menu.children("."+r.current);var a=e.find("."+r.prev),s=n.find("."+this.conf.classNames[t].panelPrev);s.length||(s=n.children("."+r.navbar).children("."+r.prev));var i=s.attr("href"),d=s.html();a[i?"attr":"removeAttr"]("href",i),a[i||d?"removeClass":"addClass"](r.hidden),a.html(d)};this.bind("openPanel",s),this.bind("init",function(){s.call(this)})}}(jQuery),/*	
 * jQuery mmenu navbar addon searchfield content
 * mmenu.frebsite.nl
 *
 * Copyright (c) Fred Heusschen
 */
function(n){var a="mmenu",t="navbars",e="searchfield";n[a].addons[t][e]=function(t){var e=n[a]._c,r=n('<div class="'+e.search+'" />').appendTo(t);"object"!=typeof this.opts.searchfield&&(this.opts.searchfield={}),this.opts.searchfield.add=!0,this.opts.searchfield.addTo=r}}(jQuery),/*	
 * jQuery mmenu navbar addon title content
 * mmenu.frebsite.nl
 *
 * Copyright (c) Fred Heusschen
 */
function(n){var a="mmenu",t="navbars",e="title";n[a].addons[t][e]=function(e,r){var s=n[a]._c;e.append('<a class="'+s.title+'"></a>');var i=function(n){n=n||this.$menu.children("."+s.current);var a=e.find("."+s.title),i=n.find("."+this.conf.classNames[t].panelTitle);i.length||(i=n.children("."+s.navbar).children("."+s.title));var d=i.attr("href"),c=i.html()||r.title;a[d?"attr":"removeAttr"]("href",d),a[d||c?"removeClass":"addClass"](s.hidden),a.html(c)};this.bind("openPanel",i),this.bind("init",function(){i.call(this)})}}(jQuery);
/*	
 * jQuery mmenu searchfield addon
 * mmenu.frebsite.nl
 *
 * Copyright (c) Fred Heusschen
 */
!function(e){function s(e){switch(e){case 9:case 16:case 17:case 18:case 37:case 38:case 39:case 40:return!0}return!1}var n="mmenu",a="searchfield";e[n].addons[a]={setup:function(){var o=this,d=this.opts[a],c=this.conf[a];r=e[n].glbl,"boolean"==typeof d&&(d={add:d}),"object"!=typeof d&&(d={}),d=this.opts[a]=e.extend(!0,{},e[n].defaults[a],d),this.bind("close",function(){this.$menu.find("."+l.search).find("input").blur()}),this.bind("init",function(n){if(d.add){switch(d.addTo){case"panels":var a=n;break;default:var a=e(d.addTo,this.$menu)}a.each(function(){var s=e(this);if(!s.is("."+l.panel)||!s.is("."+l.vertical)){if(!s.children("."+l.search).length){var n=c.form?"form":"div",a=e("<"+n+' class="'+l.search+'" />');if(c.form&&"object"==typeof c.form)for(var t in c.form)a.attr(t,c.form[t]);a.append('<input placeholder="'+d.placeholder+'" type="text" autocomplete="off" />'),s.hasClass(l.search)?s.replaceWith(a):s.prepend(a).addClass(l.hassearch)}if(d.noResults){var i=s.closest("."+l.panel).length;if(i||(s=o.$menu.children("."+l.panel).first()),!s.children("."+l.noresultsmsg).length){var r=s.children("."+l.listview);e('<div class="'+l.noresultsmsg+'" />').append(d.noResults)[r.length?"insertBefore":"prependTo"](r.length?r:s)}}}}),d.search&&e("."+l.search,this.$menu).each(function(){var n=e(this),a=n.closest("."+l.panel).length;if(a)var r=n.closest("."+l.panel),c=r;else var r=e("."+l.panel,o.$menu),c=o.$menu;var h=n.children("input"),u=o.__findAddBack(r,"."+l.listview).children("li"),f=u.filter("."+l.divider),p=o.__filterListItems(u),v="> a",m=v+", > span",b=function(){var s=h.val().toLowerCase();r.scrollTop(0),p.add(f).addClass(l.hidden).find("."+l.fullsubopensearch).removeClass(l.fullsubopen).removeClass(l.fullsubopensearch),p.each(function(){var n=e(this),a=v;(d.showTextItems||d.showSubPanels&&n.find("."+l.next))&&(a=m),e(a,n).text().toLowerCase().indexOf(s)>-1&&n.add(n.prevAll("."+l.divider).first()).removeClass(l.hidden)}),d.showSubPanels&&r.each(function(){var s=e(this);o.__filterListItems(s.find("."+l.listview).children()).each(function(){var s=e(this),n=s.data(t.sub);s.removeClass(l.nosubresults),n&&n.find("."+l.listview).children().removeClass(l.hidden)})}),e(r.get().reverse()).each(function(s){var n=e(this),i=n.data(t.parent);i&&(o.__filterListItems(n.find("."+l.listview).children()).length?(i.hasClass(l.hidden)&&i.children("."+l.next).not("."+l.fullsubopen).addClass(l.fullsubopen).addClass(l.fullsubopensearch),i.removeClass(l.hidden).removeClass(l.nosubresults).prevAll("."+l.divider).first().removeClass(l.hidden)):a||(n.hasClass(l.opened)&&setTimeout(function(){o.openPanel(i.closest("."+l.panel))},1.5*(s+1)*o.conf.openingInterval),i.addClass(l.nosubresults)))}),c[p.not("."+l.hidden).length?"removeClass":"addClass"](l.noresults),this.update()};h.off(i.keyup+"-searchfield "+i.change+"-searchfield").on(i.keyup+"-searchfield",function(e){s(e.keyCode)||b.call(o)}).on(i.change+"-searchfield",function(){b.call(o)})})}})},add:function(){l=e[n]._c,t=e[n]._d,i=e[n]._e,l.add("search hassearch noresultsmsg noresults nosubresults fullsubopensearch"),i.add("change keyup")},clickAnchor:function(){}},e[n].defaults[a]={add:!1,addTo:"panels",search:!0,placeholder:"Search",noResults:"No results found.",showTextItems:!1,showSubPanels:!0},e[n].configuration[a]={form:!1};var l,t,i,r}(jQuery);
/*	
 * jQuery mmenu sectionIndexer addon
 * mmenu.frebsite.nl
 *
 * Copyright (c) Fred Heusschen
 */
!function(e){var a="mmenu",r="sectionIndexer";e[a].addons[r]={setup:function(){var n=this,d=this.opts[r];this.conf[r],t=e[a].glbl,"boolean"==typeof d&&(d={add:d}),"object"!=typeof d&&(d={}),d=this.opts[r]=e.extend(!0,{},e[a].defaults[r],d),this.bind("init",function(a){if(d.add){switch(d.addTo){case"panels":var r=a;break;default:var r=e(d.addTo,this.$menu).filter("."+i.panel)}r.find("."+i.divider).closest("."+i.panel).addClass(i.hasindexer)}if(!this.$indexer&&this.$menu.children("."+i.hasindexer).length){this.$indexer=e('<div class="'+i.indexer+'" />').prependTo(this.$menu).append('<a href="#a">a</a><a href="#b">b</a><a href="#c">c</a><a href="#d">d</a><a href="#e">e</a><a href="#f">f</a><a href="#g">g</a><a href="#h">h</a><a href="#i">i</a><a href="#j">j</a><a href="#k">k</a><a href="#l">l</a><a href="#m">m</a><a href="#n">n</a><a href="#o">o</a><a href="#p">p</a><a href="#q">q</a><a href="#r">r</a><a href="#s">s</a><a href="#t">t</a><a href="#u">u</a><a href="#v">v</a><a href="#w">w</a><a href="#x">x</a><a href="#y">y</a><a href="#z">z</a>'),this.$indexer.children().on(s.mouseover+"-searchfield "+i.touchstart+"-searchfield",function(){var a=e(this).attr("href").slice(1),r=n.$menu.children("."+i.current),s=r.find("."+i.listview),t=!1,d=r.scrollTop(),h=s.position().top+parseInt(s.css("margin-top"),10)+parseInt(s.css("padding-top"),10)+d;r.scrollTop(0),s.children("."+i.divider).not("."+i.hidden).each(function(){t===!1&&a==e(this).text().slice(0,1).toLowerCase()&&(t=e(this).position().top+h)}),r.scrollTop(t!==!1?t:d)});var t=function(e){n.$menu[(e.hasClass(i.hasindexer)?"add":"remove")+"Class"](i.hasindexer)};this.bind("openPanel",t),t.call(this,this.$menu.children("."+i.current))}})},add:function(){i=e[a]._c,n=e[a]._d,s=e[a]._e,i.add("indexer hasindexer"),s.add("mouseover touchstart")},clickAnchor:function(e){return e.parent().is("."+i.indexer)?!0:void 0}},e[a].defaults[r]={add:!1,addTo:"panels"};var i,n,s,t}(jQuery);
/*	
 * jQuery mmenu toggles addon
 * mmenu.frebsite.nl
 *
 * Copyright (c) Fred Heusschen
 */
!function(t){var e="mmenu",c="toggles";t[e].addons[c]={setup:function(){var n=this;this.opts[c],this.conf[c],l=t[e].glbl,this.bind("init",function(e){this.__refactorClass(t("input",e),this.conf.classNames[c].toggle,"toggle"),this.__refactorClass(t("input",e),this.conf.classNames[c].check,"check"),t("input."+s.toggle+", input."+s.check,e).each(function(){var e=t(this),c=e.closest("li"),i=e.hasClass(s.toggle)?"toggle":"check",l=e.attr("id")||n.__getUniqueId();c.children('label[for="'+l+'"]').length||(e.attr("id",l),c.prepend(e),t('<label for="'+l+'" class="'+s[i]+'"></label>').insertBefore(c.children("a, span").last()))})})},add:function(){s=t[e]._c,n=t[e]._d,i=t[e]._e,s.add("toggle check")},clickAnchor:function(){}},t[e].configuration.classNames[c]={toggle:"Toggle",check:"Check"};var s,n,i,l}(jQuery);
define("jQuerymmenu", ["jquery"], (function (global) {
    return function () {
        var ret, fn;
        return ret || global.$;
    };
}(this)));

define('binding-handlers/mmenu', ['jquery', 'knockout', 'context', 'jQuerymmenu'],
    function ($, ko, context, jQuerymmenu) {

        var defaultConfig = {
            offCanvas: false,
            extensions: ["iconbar"],
            navbars: {
                content: ["searchfield"]
            },
            searchfield: {
                noResults: "",
                placeholder: "Search",
                add: true,
                search: false
            }
        };

        function initialise(element, valueAccessor) {            
            var settings = ko.utils.unwrapObservable(valueAccessor());

            $(element).click(function () {
                $('body, html').toggleClass('mm-menu-active');
            });

            if (!settings.showSearch) {
                defaultConfig.navbars.content = [];
                defaultConfig.searchfield = {};
                $('body').addClass('mm-no-search');
            }

            $(settings.target).mmenu(defaultConfig);

            function onClick(){
                window.location.href = context.environment.searchPageUrl + '#query=' + $(settings.target + " .mm-search input").val();
                $('body, html').removeClass('mm-menu-active');
            }

            $(settings.target + " .mm-search").append('<span class="gwr-icon icon-search"/>');

            $(settings.target + " .mm-search .icon-search").on( "click", function() {
                onClick();
            });

            $(settings.target + " .mm-search input").keyup(function (e) {
                if (e.keyCode == 13) {
                    onClick();
                }
            });
        }

        ko.bindingHandlers.mmenu = {
            init: initialise
        };
    }
);
define('keyboard-events',[],function () {

    var TAB         = 9;
    var ENTER       = 13;
    var ESCAPE      = 27;
    var SPACE_BAR   = 32;
    var LEFT_ARROW  = 37;
    var UP_ARROW    = 38;
    var RIGHT_ARROW = 39;
    var DOWN_ARROW  = 40;


    return {

        TAB         : TAB,
        ENTER       : ENTER      ,
        ESCAPE      : ESCAPE     ,
        SPACE_BAR   : SPACE_BAR  ,
        LEFT_ARROW  : LEFT_ARROW ,
        UP_ARROW    : UP_ARROW   ,
        RIGHT_ARROW : RIGHT_ARROW,
        DOWN_ARROW  : DOWN_ARROW
    };
});
define('binding-handlers/navbar', ['jquery', 'underscore', 'knockout', 'keyboard-events'],
    function ($, _, ko, keyboardEvents) {

        function initialise(element, valueAccessor) {

            var navDelay = 750;
            var delayForMenu = 250;
            var $menuBarEl = $(element);
            var $navMainContent = $('.nav-main-content');
            var navMainContentHeight = 0;
            var $currentSubPanel;
            var subpanelTimerId;
            var $closeButton = $('.btn-close', $navMainContent);
            var focusedElementBeforeClose; // stores element before focus on close button so we can navigate back to it.

            //  menu bar trigger handler



            $menuBarEl.find('[data-trigger]')
                .focus(onMenuBarTrigger)
                /*.blur(offMenuBarTrigger)*/

                .mouseenter(onMenuBarTrigger)
                .mouseleave(offMenuBarTrigger)


            $('.closemenubar').focus(function (event) {
                clearTimeout(menuBarTimeoutId);
                $('.Ticketsandsaving').attr("tabindex", "0");
                subpanelTimerId = setTimeout(function () {
                    closeSubPanel(true);
                }, 100);
            });

            $('#expanded-btn-new').focus(function (event) {
                    clearTimeout(menuBarTimeoutId);
                    $('.Ticketsandsaving').attr("tabindex", "0");
                    subpanelTimerId = setTimeout(function () {
                        closeSubPanel(true);
                    }, 100);
                });
            /*.focus(onMenuBarTrigger);*/


            var parentid = -1
            var childrencount = 0;
            var lastchildpos=0;
            var lastchildname = "";

            
            $('.Ticketsandsaving').keydown(function (event) { 
                if (event.which == 40) {
                    parentid = $(this).attr("parent-indexing");
                    childrencount = $(this).attr("parent-child-count");
                    lastchildpos = childrencount-1;
                    $('.Ticketsandsaving').attr("tabindex", "-1");
                    $(".subchild").attr('tabindex', '0');
                    $menuBarEl.find('[data-trigger]')
                        .focus(onMenuBarTrigger);
                    $navMainContent.find('[data-sub-panel-content] [data-trigger]').focus(onSubPanelTrigger)
                    $('.closemenubar').attr('tabindex', '-1');
                    $("[child-indexing='0']").eq(parentid).focus();
                }
            });

           

            var specificchild = 0;
            var subchildcount = -1;
            var childnum = 0;
            var lastgrandchildpos = 0;
            
            $('.subchild').keydown(function (event) {
                subchildcount++;
                var curchilpos = $(this).attr("child-indexing");
                var noofgrandchild = $(this).attr("grandchild-count");

                if (noofgrandchild > 0) {

                    lastgrandchildpos = noofgrandchild - 1;
                    if (event.which == 39) {

                        $(".subchild").attr('tabindex', '-1');
                        $('.subsubchild').attr("tabindex", "0");

                        specificchild = $(this).attr("child-indexing");
                        childnum = $(this).attr("child-number");
                       
                        $navMainContent.find('[data-sub-panel-content] [data-trigger]').focus(onSubPanelTrigger);
                        $navMainContent.find('[data-sub-sub-panel] [data-trigger]').focus(onSubPanelTrigger);
                       

                       
                        $("[grandchildnumbering='0']").eq(childnum).focus();

                    }
                    else if (curchilpos == lastchildpos) {
                        if (event.which == 9) {
                            $('.Ticketsandsaving').eq(parentid).focus();
                        }
                    }

                } else if (curchilpos == lastchildpos) {
                    if (event.which == 9) {
                        $('.Ticketsandsaving').eq(parentid).focus();
                    }
                } 
            });

            $('.subchild').keydown(function (event) {
             if (event.which == 37) {

                    $('.Ticketsandsaving').attr("tabindex", "0");
                    $(".subchild").attr('tabindex', '-1');
                    $('.Ticketsandsaving').eq(parentid).focus();
                    $('.closemenubar').attr('tabindex', '0');
                }
            });


            

            $('.subsubchild').keydown(function (event) {

                var curgrandpos = $(this).attr("grandchildnumbering");
                

                if (curgrandpos == lastgrandchildpos || curgrandpos>7 ) {
                    if (event.which == 9) {
                        $('.Ticketsandsaving').attr("tabindex", "0");
                        $(".subchild").attr('tabindex', '-1');
                        $('.Ticketsandsaving').eq(parentid).focus();
                        $('.closemenubar').attr('tabindex', '0');
                       
                    }
                }else if (event.which == 37) {

                    $(".subchild").attr('tabindex', '0');
                    $('.subsubchild').attr("tabindex", "-1");
                    

                    $("[child-indexing ="+specificchild+"]").eq(parentid).focus();

                } 
            });

        


            //.keyup(onMenuBarTriggerKeyEvent)
            //.keypress(disableEvents([keyboardEvents.ENTER, keyboardEvents.TAB, 0])) // for some reason in FF, keycode for tab is 0!
            //.keydown(disableEvents([keyboardEvents.ENTER, keyboardEvents.TAB]));




            // nav main content event handlers
            $navMainContent.mouseenter(onNavMainEnter);
           $navMainContent.mouseleave(onNavMainLeave);

            //  sub panel trigger handler binding
            $navMainContent.find('[data-sub-panel-content] [data-trigger]')
                .mouseover(onSubPanelTrigger)
            /*.focus(onSubPanelTrigger)*/


            /*.keyup(onSubPanelTriggerKeyEvent)*/
            //       .keypress(disableEvents())
            //.keydown(disableEvents());











            //  sub sub panel trigger handlers
            $navMainContent.find('[data-sub-sub-panel] [data-trigger]')
                .mouseover(onSubPanelTrigger)
            // .focus(onSubPanelTrigger)
            //.blur(onSubPanelTriggerKeyEvent)
            //.keyup(onSubPanelTriggerKeyEvent)
            //.keypress(disableEvents())
            //.keydown(disableEvents());

            $navMainContent.find('[data-sub-sub-sub-panel] [data-trigger]')
                .mouseover(onSubSubPanelTrigger)
            //.keyup(onSubSubSubPanelTriggerKeyEvent)
            //.keypress(disableEvents())
            //.keydown(disableEvents());

            $closeButton.on("click", closeSubPanel)
                .keyup(onCloseKeyEvent)
                .keypress(disableEvents([keyboardEvents.TAB]))
                .keydown(disableEvents([keyboardEvents.TAB]));


            //  handlers

            var menuBarTimeoutId;

            function onMenuBarTrigger(event) {
                clearTimeout(subpanelTimerId);
                hideSubSubPanels();
                hideSubSubSubPanels();


                menuBarTimeoutId = setTimeout(function () {
                    var triggerId = getTriggerId(event.currentTarget);
                    if (triggerId && triggerId.length) {
                        hideSubPanels();
                        $currentSubPanel = getSubPanel(triggerId);
                        $currentSubPanel.css("opacity", "1");
                        setTimeout(function () {
                            $currentSubPanel.show();
                        }, 200);
                        navMainContentHeight = $currentSubPanel.height();
                        runAfterReflow(openSubPanel);
                    } else {
                        runAfterReflow(closeSubPanel);
                    }
                }, delayForMenu);
            }

            function offMenuBarTrigger(event) {
                clearTimeout(menuBarTimeoutId);
                subpanelTimerId = setTimeout(function () {
                    closeSubPanel(true);
                }, navDelay);
            }






            function onNavMainEnter(event) {
                clearTimeout(subpanelTimerId);
            }

            function onNavMainLeave(event) {
                subpanelTimerId = setTimeout(function () {
                    closeSubPanel(true);
                }, navDelay);
            }

            function onSubPanelTrigger(event, keyboard) {
                var trigger = event.currentTarget;
                var triggerId = getTriggerId(trigger);
                var checkAttribute = event.currentTarget.getAttribute('data-section');
                if (checkAttribute == "parent") {
                    hideSubSubSubPanels();
                    removeActiveStateFromSubPanelItems();
                    if (triggerId) {
                        $(trigger).addClass('active');
                        var subsubSubPanel = getSubSubSubPanel(triggerId);
                        subsubSubPanel.css("opacity", "1");
                        setTimeout(function () {
                            subsubSubPanel.show();
                            var heightof3Panel = $('.nav-sub-sub-item ').height();
                            $navMainContent.height($(trigger).closest('.nav-sub-item').height() + heightof3Panel);
                        }, 220);

                        runAfterReflow(openSubSubSubPanel);
                        if (keyboard) {
                            $('li', subsubSubPanel).first().find('a').focus();
                        }
                    } else if (keyboard) {
                        navigateToCloseButton(event.currentTarget);
                    }
                }
                else {
                    hideSubSubSubPanels();
                    hideSubSubPanels();
                    removeActiveStateFromSubPanelItems();
                    if (triggerId) {
                        $(trigger).addClass('active');
                        var subSubPanel = getSubSubPanel(triggerId);
                        subSubPanel.css("opacity", "1");
                        setTimeout(function () {
                            subSubPanel.show();
                            $navMainContent.height($(trigger).closest('.nav-sub-item').height());
                        }, 220);

                        runAfterReflow(openSubSubPanel);
                        if (keyboard) {
                            $('li', subSubPanel).first().find('a').focus();
                        }
                    } else if (keyboard) {
                        navigateToCloseButton(event.currentTarget);
                    }

                }

            }

            function onSubSubPanelTrigger(event, keyboard) {
                var trigger = event.currentTarget;
                var triggerId = getTriggerId(trigger);
                // hideSubSubSubPanels();
                removeActiveStateFromSubPanelItems();
                if (triggerId) {
                    $(trigger).addClass('active');
                    var subSubPanel = getSubSubPanel(triggerId);
                    subSubPanel.css("opacity", "1");
                    setTimeout(function () {
                        subSubPanel.show();
                        $navMainContent.height($(trigger).closest('.nav-sub-item').height());
                    }, 220);

                    runAfterReflow(openSubSubPanel);
                    if (keyboard) {
                        $('li', subSubPanel).first().find('a').focus();
                    }
                } else if (keyboard) {
                    navigateToCloseButton(event.currentTarget);
                }
            }

            //  key event handlers

            function onMenuBarTriggerKeyEvent(event) {
                switch (event.which) {
                    case keyboardEvents.SPACE_BAR:
                        navigateIntoSubMenu(event.currentTarget);
                        break;
                    case keyboardEvents.ESCAPE:
                        focusOnGWRHomeLink();
                        break;
                    case keyboardEvents.DOWN_ARROW:
                        navigateIntoSubMenu(event.currentTarget);
                        break;
                    case keyboardEvents.UP_ARROW:
                        focusOnGWRHomeLink();
                        break;
                    case keyboardEvents.RIGHT_ARROW:
                        focusOnNextMenuItem($(event.currentTarget));
                        break;
                    case keyboardEvents.LEFT_ARROW:
                        focusOnPreviousMenuItem($(event.currentTarget));
                        break;
                    default:
                    // do nothing
                }

                return false;
            }

            function onSubPanelTriggerKeyEvent(event) {
                switch (event.which) {
                    case keyboardEvents.TAB:
                        if (event.shiftKey) {
                            focusOnPreviousMenuItem($(event.currentTarget));
                        }
                        else {
                            focusOnNextMenuItem($(event.currentTarget));
                        }
                        break;
                    case keyboardEvents.SPACE_BAR:
                        onSubPanelTrigger(event, true);
                        break;
                    case keyboardEvents.ESCAPE:
                        navigateBackToMenuBar(event.currentTarget);
                        break;
                    case keyboardEvents.DOWN_ARROW:
                        focusOnNextMenuItem($(event.currentTarget));
                        break;
                    case keyboardEvents.UP_ARROW:
                        focusOnPreviousMenuItem($(event.currentTarget));
                        break;
                    case keyboardEvents.RIGHT_ARROW:
                        onSubPanelTrigger(event, true);
                        break;
                    case keyboardEvents.LEFT_ARROW:
                        navigateBackToMenuBar(event.currentTarget);
                        break;
                    default:
                    // do nothing
                }

                return false;
            }

            function onSubSubPanelTriggerKeyEvent(event) {
                switch (event.which) {
                    case keyboardEvents.TAB:
                        if (event.shiftKey) {
                            focusOnPreviousMenuItem($(event.currentTarget));
                        }
                        else {
                            focusOnNextMenuItem($(event.currentTarget));
                        }
                        break;
                    case keyboardEvents.ESCAPE:
                        navigateBackToSubMenu(event.currentTarget)
                        break;
                    case keyboardEvents.DOWN_ARROW:
                        focusOnNextMenuItem($(event.currentTarget));
                        break;
                    case keyboardEvents.UP_ARROW:
                        focusOnPreviousMenuItem($(event.currentTarget));
                        break;
                    case keyboardEvents.LEFT_ARROW:
                        navigateBackToSubMenu(event.currentTarget)
                        break;
                    case keyboardEvents.SPACE_BAR:
                        navigateToCloseButton(event.currentTarget);
                        break;
                    case keyboardEvents.RIGHT_ARROW:
                        navigateToCloseButton(event.currentTarget);
                        break;
                    default:
                    // do nothing
                }
                return false;
            }

            function onSubSubSubPanelTriggerKeyEvent(event) {
                switch (event.which) {
                    case keyboardEvents.TAB:
                        if (event.shiftKey) {
                            focusOnPreviousMenuItem($(event.currentTarget));
                        }
                        else {
                            focusOnNextMenuItem($(event.currentTarget));
                        }
                        break;
                    case keyboardEvents.ESCAPE:
                        navigateBackToSubMenu(event.currentTarget)
                        break;
                    case keyboardEvents.DOWN_ARROW:
                        focusOnNextMenuItem($(event.currentTarget));
                        break;
                    case keyboardEvents.UP_ARROW:
                        focusOnPreviousMenuItem($(event.currentTarget));
                        break;
                    case keyboardEvents.LEFT_ARROW:
                        navigateBackToSubMenu(event.currentTarget)
                        break;
                    case keyboardEvents.SPACE_BAR:
                        navigateToCloseButton(event.currentTarget);
                        break;
                    case keyboardEvents.RIGHT_ARROW:
                        navigateToCloseButton(event.currentTarget);
                        break;
                    default:
                    // do nothing
                }
                return false;
            }

            function onCloseKeyEvent(event) {
                switch (event.which) {
                    case keyboardEvents.ENTER:
                        closeSubPanel();
                        break;
                    case keyboardEvents.LEFT_ARROW:
                        if (focusedElementBeforeClose) {
                            focusedElementBeforeClose.focus();
                        }
                        break;
                }
            }

            function navigateIntoSubMenu(el) {
                clearTimeout(subpanelTimerId);
                hideSubPanels();
                hideSubSubPanels();
                $currentSubPanel = getSubPanel(getTriggerId(el));
                $currentSubPanel.show();
                runAfterReflow(openSubPanel);
                focusOnTrigger($('[data-trigger]', $currentSubPanel).first());
            }

            function navigateBackToMenuBar(el) {
                var panelId = getSubPanelId(el);
                closeSubPanel();
                $('[data-trigger=' + panelId + ']', $menuBarEl).focus();
            }

            function navigateBackToSubMenu(el) {
                hideSubSubPanels();
                var panelId = getSubSubPanelId(el);
                focusOnTrigger($('[data-trigger=' + panelId + ']', $currentSubPanel));
            }

            function navigateToCloseButton(el) {
                focusedElementBeforeClose = el;
                $closeButton.focus();
            }

            function focusOnPreviousMenuItem($item) {
                var $containingLi = $item.closest('li');
                if ($containingLi.size() > 0) {
                    var $previousSibling = $containingLi.prev();
                    var $trigger;
                    if ($previousSibling.size() > 0) {
                        $trigger = $previousSibling.find('[data-trigger]');
                    } else {
                        $trigger = $containingLi.closest('ul').children('li').last().find('[data-trigger]');
                    }
                    focusOnTrigger($trigger);
                }
            }

            function focusOnNextMenuItem($item) {
                var $containingLi = $item.closest('li');
                if ($containingLi.size() > 0) {
                    var $nextSibling = $containingLi.next();
                    var $trigger;
                    if ($nextSibling.size() > 0) {
                        $trigger = $nextSibling.find('[data-trigger]');
                    } else {
                        $trigger = $containingLi.closest('ul').children('li').first().find('[data-trigger]')
                    }
                    focusOnTrigger($trigger);
                }
            }

            function focusOnTrigger($trigger) {
                $trigger.focus();
            }

            function focusOnGWRHomeLink() {
                $('#desktop-home-link').focus();
            }

            function openSubPanel() {
                $navMainContent.height(navMainContentHeight);
                $navMainContent.addClass("open");
            }

            function closeSubPanel(mouse) {
                hideSubPanels();
                removeActiveStateFromSubPanelItems();
                $navMainContent.height(0);
                $navMainContent.removeClass("open");
                if (!mouse) {
                    focusOnGWRHomeLink();
                }
            }

            function hideSubPanels() {
                $('[data-sub-panel]').css("opacity", "0");
                setTimeout(function () {
                    $('[data-sub-panel]').hide();
                }, 200);
            }

            function removeActiveStateFromSubPanelItems() {
                $('.active', '[data-sub-panel]').removeClass('active');
            }

            function openSubSubPanel(event) {
                $('.nav-sub-content', $currentSubPanel).addClass('open');
            }

            function hideSubSubPanels() {
                $('[data-sub-sub-panel]').css("opacity", "0");
                setTimeout(function () {
                    $('[data-sub-sub-panel]').hide();
                }, 200);
                $('.nav-sub-content').removeClass('open');
            }

            function openSubSubSubPanel(event) {
                $('.nav-sub-sub-content', $currentSubPanel).addClass('open');
            }
            function hideSubSubSubPanels() {
                $('[data-sub-sub-sub-panel]').css("opacity", "0");
                setTimeout(function () {
                    $('[data-sub-sub-sub-panel]').hide();
                }, 200);
                $('.nav-sub-sub-content').removeClass('open');
            }

            //  get item using data stored in class of this element.
            function getSubPanel(id) {
                return $('[data-sub-panel=' + id + ']');
            }

            function getSubSubPanel(id) {
                return $('[data-sub-sub-panel=' + id + ']');
            }
            function getSubSubSubPanel(id) {
                return $('[data-sub-sub-sub-panel=' + id + ']');
            }

            function getTriggerId(el) {
                return $(el).data('trigger');
            }

            function getSubPanelId(el) {
                return $(el).closest('[data-sub-panel]').data('sub-panel');
            }

            function getSubSubPanelId(el) {
                return $(el).closest('[data-sub-sub-panel]').data('sub-sub-panel');
            }

            function getSubSubSubPanelId(el) {
                return $(el).closest('[data-sub-sub-sub-panel]').data('sub-sub-sub-panel');
            }
            //  returns an event handler which disables events that are not in the white list
            function disableEvents(whiteList) {
                var whiteList = whiteList || [keyboardEvents.ENTER];
                return function (event) {
                    if (eventIsNotInWhiteList(event, whiteList)) {
                        event.stopPropagation();
                        event.preventDefault();
                    }
                }
            }

            function eventIsNotInWhiteList(event, whiteList) {
                return !_.contains(whiteList, event.which);
            }

            function runAfterReflow(runner) {
                element.clientWidth;  // prompts browser to reflow page
                runner();
            }
        }

        ko.bindingHandlers.navbar = {
            init: initialise
        };
    }
);

/*!
 * Select2 4.0.0
 * https://select2.github.io
 *
 * Released under the MIT license
 * https://github.com/select2/select2/blob/master/LICENSE.md
 */
(function (factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define('select2',['jquery'], factory);
  } else if (typeof exports === 'object') {
    // Node/CommonJS
    factory(require('jquery'));
  } else {
    // Browser globals
    factory(jQuery);
  }
}(function (jQuery) {
  // This is needed so we can catch the AMD loader configuration and use it
  // The inner file should be wrapped (by `banner.start.js`) in a function that
  // returns the AMD loader references.
  var S2 =
(function () {
  // Restore the Select2 AMD loader so it can be used
  // Needed mostly in the language files, where the loader is not inserted
  if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
    var S2 = jQuery.fn.select2.amd;
  }
var S2;(function () { if (!S2 || !S2.requirejs) {
if (!S2) { S2 = {}; } else { require = S2; }
/**
 * @license almond 0.2.9 Copyright (c) 2011-2014, The Dojo Foundation All Rights Reserved.
 * Available via the MIT or new BSD license.
 * see: http://github.com/jrburke/almond for details
 */
//Going sloppy to avoid 'use strict' string cost, but strict practices should
//be followed.
/*jslint sloppy: true */
/*global setTimeout: false */

var requirejs, require, define;
(function (undef) {
    var main, req, makeMap, handlers,
        defined = {},
        waiting = {},
        config = {},
        defining = {},
        hasOwn = Object.prototype.hasOwnProperty,
        aps = [].slice,
        jsSuffixRegExp = /\.js$/;

    function hasProp(obj, prop) {
        return hasOwn.call(obj, prop);
    }

    /**
     * Given a relative module name, like ./something, normalize it to
     * a real name that can be mapped to a path.
     * @param {String} name the relative name
     * @param {String} baseName a real name that the name arg is relative
     * to.
     * @returns {String} normalized name
     */
    function normalize(name, baseName) {
        var nameParts, nameSegment, mapValue, foundMap, lastIndex,
            foundI, foundStarMap, starI, i, j, part,
            baseParts = baseName && baseName.split("/"),
            map = config.map,
            starMap = (map && map['*']) || {};

        //Adjust any relative paths.
        if (name && name.charAt(0) === ".") {
            //If have a base name, try to normalize against it,
            //otherwise, assume it is a top-level require that will
            //be relative to baseUrl in the end.
            if (baseName) {
                //Convert baseName to array, and lop off the last part,
                //so that . matches that "directory" and not name of the baseName's
                //module. For instance, baseName of "one/two/three", maps to
                //"one/two/three.js", but we want the directory, "one/two" for
                //this normalization.
                baseParts = baseParts.slice(0, baseParts.length - 1);
                name = name.split('/');
                lastIndex = name.length - 1;

                // Node .js allowance:
                if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
                    name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
                }

                name = baseParts.concat(name);

                //start trimDots
                for (i = 0; i < name.length; i += 1) {
                    part = name[i];
                    if (part === ".") {
                        name.splice(i, 1);
                        i -= 1;
                    } else if (part === "..") {
                        if (i === 1 && (name[2] === '..' || name[0] === '..')) {
                            //End of the line. Keep at least one non-dot
                            //path segment at the front so it can be mapped
                            //correctly to disk. Otherwise, there is likely
                            //no path mapping for a path starting with '..'.
                            //This can still fail, but catches the most reasonable
                            //uses of ..
                            break;
                        } else if (i > 0) {
                            name.splice(i - 1, 2);
                            i -= 2;
                        }
                    }
                }
                //end trimDots

                name = name.join("/");
            } else if (name.indexOf('./') === 0) {
                // No baseName, so this is ID is resolved relative
                // to baseUrl, pull off the leading dot.
                name = name.substring(2);
            }
        }

        //Apply map config if available.
        if ((baseParts || starMap) && map) {
            nameParts = name.split('/');

            for (i = nameParts.length; i > 0; i -= 1) {
                nameSegment = nameParts.slice(0, i).join("/");

                if (baseParts) {
                    //Find the longest baseName segment match in the config.
                    //So, do joins on the biggest to smallest lengths of baseParts.
                    for (j = baseParts.length; j > 0; j -= 1) {
                        mapValue = map[baseParts.slice(0, j).join('/')];

                        //baseName segment has  config, find if it has one for
                        //this name.
                        if (mapValue) {
                            mapValue = mapValue[nameSegment];
                            if (mapValue) {
                                //Match, update name to the new value.
                                foundMap = mapValue;
                                foundI = i;
                                break;
                            }
                        }
                    }
                }

                if (foundMap) {
                    break;
                }

                //Check for a star map match, but just hold on to it,
                //if there is a shorter segment match later in a matching
                //config, then favor over this star map.
                if (!foundStarMap && starMap && starMap[nameSegment]) {
                    foundStarMap = starMap[nameSegment];
                    starI = i;
                }
            }

            if (!foundMap && foundStarMap) {
                foundMap = foundStarMap;
                foundI = starI;
            }

            if (foundMap) {
                nameParts.splice(0, foundI, foundMap);
                name = nameParts.join('/');
            }
        }

        return name;
    }

    function makeRequire(relName, forceSync) {
        return function () {
            //A version of a require function that passes a moduleName
            //value for items that may need to
            //look up paths relative to the moduleName
            return req.apply(undef, aps.call(arguments, 0).concat([relName, forceSync]));
        };
    }

    function makeNormalize(relName) {
        return function (name) {
            return normalize(name, relName);
        };
    }

    function makeLoad(depName) {
        return function (value) {
            defined[depName] = value;
        };
    }

    function callDep(name) {
        if (hasProp(waiting, name)) {
            var args = waiting[name];
            delete waiting[name];
            defining[name] = true;
            main.apply(undef, args);
        }

        if (!hasProp(defined, name) && !hasProp(defining, name)) {
            throw new Error('No ' + name);
        }
        return defined[name];
    }

    //Turns a plugin!resource to [plugin, resource]
    //with the plugin being undefined if the name
    //did not have a plugin prefix.
    function splitPrefix(name) {
        var prefix,
            index = name ? name.indexOf('!') : -1;
        if (index > -1) {
            prefix = name.substring(0, index);
            name = name.substring(index + 1, name.length);
        }
        return [prefix, name];
    }

    /**
     * Makes a name map, normalizing the name, and using a plugin
     * for normalization if necessary. Grabs a ref to plugin
     * too, as an optimization.
     */
    makeMap = function (name, relName) {
        var plugin,
            parts = splitPrefix(name),
            prefix = parts[0];

        name = parts[1];

        if (prefix) {
            prefix = normalize(prefix, relName);
            plugin = callDep(prefix);
        }

        //Normalize according
        if (prefix) {
            if (plugin && plugin.normalize) {
                name = plugin.normalize(name, makeNormalize(relName));
            } else {
                name = normalize(name, relName);
            }
        } else {
            name = normalize(name, relName);
            parts = splitPrefix(name);
            prefix = parts[0];
            name = parts[1];
            if (prefix) {
                plugin = callDep(prefix);
            }
        }

        //Using ridiculous property names for space reasons
        return {
            f: prefix ? prefix + '!' + name : name, //fullName
            n: name,
            pr: prefix,
            p: plugin
        };
    };

    function makeConfig(name) {
        return function () {
            return (config && config.config && config.config[name]) || {};
        };
    }

    handlers = {
        require: function (name) {
            return makeRequire(name);
        },
        exports: function (name) {
            var e = defined[name];
            if (typeof e !== 'undefined') {
                return e;
            } else {
                return (defined[name] = {});
            }
        },
        module: function (name) {
            return {
                id: name,
                uri: '',
                exports: defined[name],
                config: makeConfig(name)
            };
        }
    };

    main = function (name, deps, callback, relName) {
        var cjsModule, depName, ret, map, i,
            args = [],
            callbackType = typeof callback,
            usingExports;

        //Use name if no relName
        relName = relName || name;

        //Call the callback to define the module, if necessary.
        if (callbackType === 'undefined' || callbackType === 'function') {
            //Pull out the defined dependencies and pass the ordered
            //values to the callback.
            //Default to [require, exports, module] if no deps
            deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
            for (i = 0; i < deps.length; i += 1) {
                map = makeMap(deps[i], relName);
                depName = map.f;

                //Fast path CommonJS standard dependencies.
                if (depName === "require") {
                    args[i] = handlers.require(name);
                } else if (depName === "exports") {
                    //CommonJS module spec 1.1
                    args[i] = handlers.exports(name);
                    usingExports = true;
                } else if (depName === "module") {
                    //CommonJS module spec 1.1
                    cjsModule = args[i] = handlers.module(name);
                } else if (hasProp(defined, depName) ||
                           hasProp(waiting, depName) ||
                           hasProp(defining, depName)) {
                    args[i] = callDep(depName);
                } else if (map.p) {
                    map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
                    args[i] = defined[depName];
                } else {
                    throw new Error(name + ' missing ' + depName);
                }
            }

            ret = callback ? callback.apply(defined[name], args) : undefined;

            if (name) {
                //If setting exports via "module" is in play,
                //favor that over return value and exports. After that,
                //favor a non-undefined return value over exports use.
                if (cjsModule && cjsModule.exports !== undef &&
                        cjsModule.exports !== defined[name]) {
                    defined[name] = cjsModule.exports;
                } else if (ret !== undef || !usingExports) {
                    //Use the return value from the function.
                    defined[name] = ret;
                }
            }
        } else if (name) {
            //May just be an object definition for the module. Only
            //worry about defining if have a module name.
            defined[name] = callback;
        }
    };

    requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
        if (typeof deps === "string") {
            if (handlers[deps]) {
                //callback in this case is really relName
                return handlers[deps](callback);
            }
            //Just return the module wanted. In this scenario, the
            //deps arg is the module name, and second arg (if passed)
            //is just the relName.
            //Normalize module name, if it contains . or ..
            return callDep(makeMap(deps, callback).f);
        } else if (!deps.splice) {
            //deps is a config object, not an array.
            config = deps;
            if (config.deps) {
                req(config.deps, config.callback);
            }
            if (!callback) {
                return;
            }

            if (callback.splice) {
                //callback is an array, which means it is a dependency list.
                //Adjust args if there are dependencies
                deps = callback;
                callback = relName;
                relName = null;
            } else {
                deps = undef;
            }
        }

        //Support require(['a'])
        callback = callback || function () {};

        //If relName is a function, it is an errback handler,
        //so remove it.
        if (typeof relName === 'function') {
            relName = forceSync;
            forceSync = alt;
        }

        //Simulate async callback;
        if (forceSync) {
            main(undef, deps, callback, relName);
        } else {
            //Using a non-zero value because of concern for what old browsers
            //do, and latest browsers "upgrade" to 4 if lower value is used:
            //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
            //If want a value immediately, use require('id') instead -- something
            //that works in almond on the global level, but not guaranteed and
            //unlikely to work in other AMD implementations.
            setTimeout(function () {
                main(undef, deps, callback, relName);
            }, 4);
        }

        return req;
    };

    /**
     * Just drops the config on the floor, but returns req in case
     * the config return value is used.
     */
    req.config = function (cfg) {
        return req(cfg);
    };

    /**
     * Expose module registry for debugging and tooling
     */
    requirejs._defined = defined;

    define = function (name, deps, callback) {

        //This module may not have dependencies
        if (!deps.splice) {
            //deps is not an array, so probably means
            //an object literal or factory function for
            //the value. Adjust args.
            callback = deps;
            deps = [];
        }

        if (!hasProp(defined, name) && !hasProp(waiting, name)) {
            waiting[name] = [name, deps, callback];
        }
    };

    define.amd = {
        jQuery: true
    };
}());

S2.requirejs = requirejs;S2.require = require;S2.define = define;
}
}());
S2.define("almond", function(){});

/* global jQuery:false, $:false */
S2.define('jquery',[],function () {
  var _$ = jQuery || $;

  if (_$ == null && console && console.error) {
    console.error(
      'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
      'found. Make sure that you are including jQuery before Select2 on your ' +
      'web page.'
    );
  }

  return _$;
});

S2.define('select2/utils',[
  'jquery'
], function ($) {
  var Utils = {};

  Utils.Extend = function (ChildClass, SuperClass) {
    var __hasProp = {}.hasOwnProperty;

    function BaseConstructor () {
      this.constructor = ChildClass;
    }

    for (var key in SuperClass) {
      if (__hasProp.call(SuperClass, key)) {
        ChildClass[key] = SuperClass[key];
      }
    }

    BaseConstructor.prototype = SuperClass.prototype;
    ChildClass.prototype = new BaseConstructor();
    ChildClass.__super__ = SuperClass.prototype;

    return ChildClass;
  };

  function getMethods (theClass) {
    var proto = theClass.prototype;

    var methods = [];

    for (var methodName in proto) {
      var m = proto[methodName];

      if (typeof m !== 'function') {
        continue;
      }

      if (methodName === 'constructor') {
        continue;
      }

      methods.push(methodName);
    }

    return methods;
  }

  Utils.Decorate = function (SuperClass, DecoratorClass) {
    var decoratedMethods = getMethods(DecoratorClass);
    var superMethods = getMethods(SuperClass);

    function DecoratedClass () {
      var unshift = Array.prototype.unshift;

      var argCount = DecoratorClass.prototype.constructor.length;

      var calledConstructor = SuperClass.prototype.constructor;

      if (argCount > 0) {
        unshift.call(arguments, SuperClass.prototype.constructor);

        calledConstructor = DecoratorClass.prototype.constructor;
      }

      calledConstructor.apply(this, arguments);
    }

    DecoratorClass.displayName = SuperClass.displayName;

    function ctr () {
      this.constructor = DecoratedClass;
    }

    DecoratedClass.prototype = new ctr();

    for (var m = 0; m < superMethods.length; m++) {
        var superMethod = superMethods[m];

        DecoratedClass.prototype[superMethod] =
          SuperClass.prototype[superMethod];
    }

    var calledMethod = function (methodName) {
      // Stub out the original method if it's not decorating an actual method
      var originalMethod = function () {};

      if (methodName in DecoratedClass.prototype) {
        originalMethod = DecoratedClass.prototype[methodName];
      }

      var decoratedMethod = DecoratorClass.prototype[methodName];

      return function () {
        var unshift = Array.prototype.unshift;

        unshift.call(arguments, originalMethod);

        return decoratedMethod.apply(this, arguments);
      };
    };

    for (var d = 0; d < decoratedMethods.length; d++) {
      var decoratedMethod = decoratedMethods[d];

      DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
    }

    return DecoratedClass;
  };

  var Observable = function () {
    this.listeners = {};
  };

  Observable.prototype.on = function (event, callback) {
    this.listeners = this.listeners || {};

    if (event in this.listeners) {
      this.listeners[event].push(callback);
    } else {
      this.listeners[event] = [callback];
    }
  };

  Observable.prototype.trigger = function (event) {
    var slice = Array.prototype.slice;

    this.listeners = this.listeners || {};

    if (event in this.listeners) {
      this.invoke(this.listeners[event], slice.call(arguments, 1));
    }

    if ('*' in this.listeners) {
      this.invoke(this.listeners['*'], arguments);
    }
  };

  Observable.prototype.invoke = function (listeners, params) {
    for (var i = 0, len = listeners.length; i < len; i++) {
      listeners[i].apply(this, params);
    }
  };

  Utils.Observable = Observable;

  Utils.generateChars = function (length) {
    var chars = '';

    for (var i = 0; i < length; i++) {
      var randomChar = Math.floor(Math.random() * 36);
      chars += randomChar.toString(36);
    }

    return chars;
  };

  Utils.bind = function (func, context) {
    return function () {
      func.apply(context, arguments);
    };
  };

  Utils._convertData = function (data) {
    for (var originalKey in data) {
      var keys = originalKey.split('-');

      var dataLevel = data;

      if (keys.length === 1) {
        continue;
      }

      for (var k = 0; k < keys.length; k++) {
        var key = keys[k];

        // Lowercase the first letter
        // By default, dash-separated becomes camelCase
        key = key.substring(0, 1).toLowerCase() + key.substring(1);

        if (!(key in dataLevel)) {
          dataLevel[key] = {};
        }

        if (k == keys.length - 1) {
          dataLevel[key] = data[originalKey];
        }

        dataLevel = dataLevel[key];
      }

      delete data[originalKey];
    }

    return data;
  };

  Utils.hasScroll = function (index, el) {
    // Adapted from the function created by @ShadowScripter
    // and adapted by @BillBarry on the Stack Exchange Code Review website.
    // The original code can be found at
    // http://codereview.stackexchange.com/q/13338
    // and was designed to be used with the Sizzle selector engine.

    var $el = $(el);
    var overflowX = el.style.overflowX;
    var overflowY = el.style.overflowY;

    //Check both x and y declarations
    if (overflowX === overflowY &&
        (overflowY === 'hidden' || overflowY === 'visible')) {
      return false;
    }

    if (overflowX === 'scroll' || overflowY === 'scroll') {
      return true;
    }

    return ($el.innerHeight() < el.scrollHeight ||
      $el.innerWidth() < el.scrollWidth);
  };

  Utils.escapeMarkup = function (markup) {
    var replaceMap = {
      '\\': '&#92;',
      '&': '&amp;',
      '<': '&lt;',
      '>': '&gt;',
      '"': '&quot;',
      '\'': '&#39;',
      '/': '&#47;'
    };

    // Do not try to escape the markup if it's not a string
    if (typeof markup !== 'string') {
      return markup;
    }

    return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
      return replaceMap[match];
    });
  };

  // Append an array of jQuery nodes to a given element.
  Utils.appendMany = function ($element, $nodes) {
    // jQuery 1.7.x does not support $.fn.append() with an array
    // Fall back to a jQuery object collection using $.fn.add()
    if ($.fn.jquery.substr(0, 3) === '1.7') {
      var $jqNodes = $();

      $.map($nodes, function (node) {
        $jqNodes = $jqNodes.add(node);
      });

      $nodes = $jqNodes;
    }

    $element.append($nodes);
  };

  return Utils;
});

S2.define('select2/results',[
  'jquery',
  './utils'
], function ($, Utils) {
  function Results ($element, options, dataAdapter) {
    this.$element = $element;
    this.data = dataAdapter;
    this.options = options;

    Results.__super__.constructor.call(this);
  }

  Utils.Extend(Results, Utils.Observable);

  Results.prototype.render = function () {
    var $results = $(
      '<ul class="select2-results__options" role="tree"></ul>'
    );

    if (this.options.get('multiple')) {
      $results.attr('aria-multiselectable', 'true');
    }

    this.$results = $results;

    return $results;
  };

  Results.prototype.clear = function () {
    this.$results.empty();
  };

  Results.prototype.displayMessage = function (params) {
    var escapeMarkup = this.options.get('escapeMarkup');

    this.clear();
    this.hideLoading();

    var $message = $(
      '<li role="treeitem" class="select2-results__option"></li>'
    );

    var message = this.options.get('translations').get(params.message);

    $message.append(
      escapeMarkup(
        message(params.args)
      )
    );

    this.$results.append($message);
  };

  Results.prototype.append = function (data) {
    this.hideLoading();

    var $options = [];

    if (data.results == null || data.results.length === 0) {
      if (this.$results.children().length === 0) {
        this.trigger('results:message', {
          message: 'noResults'
        });
      }

      return;
    }

    data.results = this.sort(data.results);

    for (var d = 0; d < data.results.length; d++) {
      var item = data.results[d];

      var $option = this.option(item);

      $options.push($option);
    }

    this.$results.append($options);
  };

  Results.prototype.position = function ($results, $dropdown) {
    var $resultsContainer = $dropdown.find('.select2-results');
    $resultsContainer.append($results);
  };

  Results.prototype.sort = function (data) {
    var sorter = this.options.get('sorter');

    return sorter(data);
  };

  Results.prototype.setClasses = function () {
    var self = this;

    this.data.current(function (selected) {
      var selectedIds = $.map(selected, function (s) {
        return s.id.toString();
      });

      var $options = self.$results
        .find('.select2-results__option[aria-selected]');

      $options.each(function () {
        var $option = $(this);

        var item = $.data(this, 'data');

        // id needs to be converted to a string when comparing
        var id = '' + item.id;

        if ((item.element != null && item.element.selected) ||
            (item.element == null && $.inArray(id, selectedIds) > -1)) {
          $option.attr('aria-selected', 'true');
        } else {
          $option.attr('aria-selected', 'false');
        }
      });

      var $selected = $options.filter('[aria-selected=true]');

      // Check if there are any selected options
      if ($selected.length > 0) {
        // If there are selected options, highlight the first
        $selected.first().trigger('mouseenter');
      } else {
        // If there are no selected options, highlight the first option
        // in the dropdown
        $options.first().trigger('mouseenter');
      }
    });
  };

  Results.prototype.showLoading = function (params) {
    this.hideLoading();

    var loadingMore = this.options.get('translations').get('searching');

    var loading = {
      disabled: true,
      loading: true,
      text: loadingMore(params)
    };
    var $loading = this.option(loading);
    $loading.className += ' loading-results';

    this.$results.prepend($loading);
  };

  Results.prototype.hideLoading = function () {
    this.$results.find('.loading-results').remove();
  };

  Results.prototype.option = function (data) {
    var option = document.createElement('li');
    option.className = 'select2-results__option';

    var attrs = {
      'role': 'treeitem',
      'aria-selected': 'false'
    };

    if (data.disabled) {
      delete attrs['aria-selected'];
      attrs['aria-disabled'] = 'true';
    }

    if (data.id == null) {
      delete attrs['aria-selected'];
    }

    if (data._resultId != null) {
      option.id = data._resultId;
    }

    if (data.title) {
      option.title = data.title;
    }

    if (data.children) {
      attrs.role = 'group';
      attrs['aria-label'] = data.text;
      delete attrs['aria-selected'];
    }

    for (var attr in attrs) {
      var val = attrs[attr];

      option.setAttribute(attr, val);
    }

    if (data.children) {
      var $option = $(option);

      var label = document.createElement('strong');
      label.className = 'select2-results__group';

      var $label = $(label);
      this.template(data, label);

      var $children = [];

      for (var c = 0; c < data.children.length; c++) {
        var child = data.children[c];

        var $child = this.option(child);

        $children.push($child);
      }

      var $childrenContainer = $('<ul></ul>', {
        'class': 'select2-results__options select2-results__options--nested'
      });

      $childrenContainer.append($children);

      $option.append(label);
      $option.append($childrenContainer);
    } else {
      this.template(data, option);
    }

    $.data(option, 'data', data);

    return option;
  };

  Results.prototype.bind = function (container, $container) {
    var self = this;

    var id = container.id + '-results';

    this.$results.attr('id', id);

    container.on('results:all', function (params) {
      self.clear();
      self.append(params.data);

      if (container.isOpen()) {
        self.setClasses();
      }
    });

    container.on('results:append', function (params) {
      self.append(params.data);

      if (container.isOpen()) {
        self.setClasses();
      }
    });

    container.on('query', function (params) {
      self.showLoading(params);
    });

    container.on('select', function () {
      if (!container.isOpen()) {
        return;
      }

      self.setClasses();
    });

    container.on('unselect', function () {
      if (!container.isOpen()) {
        return;
      }

      self.setClasses();
    });

    container.on('open', function () {
      // When the dropdown is open, aria-expended="true"
      self.$results.attr('aria-expanded', 'true');
      self.$results.attr('aria-hidden', 'false');

      self.setClasses();
      self.ensureHighlightVisible();
    });

    container.on('close', function () {
      // When the dropdown is closed, aria-expended="false"
      self.$results.attr('aria-expanded', 'false');
      self.$results.attr('aria-hidden', 'true');
      self.$results.removeAttr('aria-activedescendant');
    });

    container.on('results:toggle', function () {
      var $highlighted = self.getHighlightedResults();

      if ($highlighted.length === 0) {
        return;
      }

      $highlighted.trigger('mouseup');
    });

    container.on('results:select', function () {
      var $highlighted = self.getHighlightedResults();

      if ($highlighted.length === 0) {
        return;
      }

      var data = $highlighted.data('data');

      if ($highlighted.attr('aria-selected') == 'true') {
        self.trigger('close');
      } else {
        self.trigger('select', {
          data: data
        });
      }
    });

    container.on('results:previous', function () {
      var $highlighted = self.getHighlightedResults();

      var $options = self.$results.find('[aria-selected]');

      var currentIndex = $options.index($highlighted);

      // If we are already at te top, don't move further
      if (currentIndex === 0) {
        return;
      }

      var nextIndex = currentIndex - 1;

      // If none are highlighted, highlight the first
      if ($highlighted.length === 0) {
        nextIndex = 0;
      }

      var $next = $options.eq(nextIndex);

      $next.trigger('mouseenter');

      var currentOffset = self.$results.offset().top;
      var nextTop = $next.offset().top;
      var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);

      if (nextIndex === 0) {
        self.$results.scrollTop(0);
      } else if (nextTop - currentOffset < 0) {
        self.$results.scrollTop(nextOffset);
      }
    });

    container.on('results:next', function () {
      var $highlighted = self.getHighlightedResults();

      var $options = self.$results.find('[aria-selected]');

      var currentIndex = $options.index($highlighted);

      var nextIndex = currentIndex + 1;

      // If we are at the last option, stay there
      if (nextIndex >= $options.length) {
        return;
      }

      var $next = $options.eq(nextIndex);

      $next.trigger('mouseenter');

      var currentOffset = self.$results.offset().top +
        self.$results.outerHeight(false);
      var nextBottom = $next.offset().top + $next.outerHeight(false);
      var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;

      if (nextIndex === 0) {
        self.$results.scrollTop(0);
      } else if (nextBottom > currentOffset) {
        self.$results.scrollTop(nextOffset);
      }
    });

    container.on('results:focus', function (params) {
      params.element.addClass('select2-results__option--highlighted');
    });

    container.on('results:message', function (params) {
      self.displayMessage(params);
    });

    if ($.fn.mousewheel) {
      this.$results.on('mousewheel', function (e) {
        var top = self.$results.scrollTop();

        var bottom = (
          self.$results.get(0).scrollHeight -
          self.$results.scrollTop() +
          e.deltaY
        );

        var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
        var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();

        if (isAtTop) {
          self.$results.scrollTop(0);

          e.preventDefault();
          e.stopPropagation();
        } else if (isAtBottom) {
          self.$results.scrollTop(
            self.$results.get(0).scrollHeight - self.$results.height()
          );

          e.preventDefault();
          e.stopPropagation();
        }
      });
    }

    this.$results.on('mouseup', '.select2-results__option[aria-selected]',
      function (evt) {
      var $this = $(this);

      var data = $this.data('data');

      if ($this.attr('aria-selected') === 'true') {
        if (self.options.get('multiple')) {
          self.trigger('unselect', {
            originalEvent: evt,
            data: data
          });
        } else {
          self.trigger('close');
        }

        return;
      }

      self.trigger('select', {
        originalEvent: evt,
        data: data
      });
    });

    this.$results.on('mouseenter', '.select2-results__option[aria-selected]',
      function (evt) {
      var data = $(this).data('data');

      self.getHighlightedResults()
          .removeClass('select2-results__option--highlighted');

      self.trigger('results:focus', {
        data: data,
        element: $(this)
      });
    });
  };

  Results.prototype.getHighlightedResults = function () {
    var $highlighted = this.$results
    .find('.select2-results__option--highlighted');

    return $highlighted;
  };

  Results.prototype.destroy = function () {
    this.$results.remove();
  };

  Results.prototype.ensureHighlightVisible = function () {
    var $highlighted = this.getHighlightedResults();

    if ($highlighted.length === 0) {
      return;
    }

    var $options = this.$results.find('[aria-selected]');

    var currentIndex = $options.index($highlighted);

    var currentOffset = this.$results.offset().top;
    var nextTop = $highlighted.offset().top;
    var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);

    var offsetDelta = nextTop - currentOffset;
    nextOffset -= $highlighted.outerHeight(false) * 2;

    if (currentIndex <= 2) {
      this.$results.scrollTop(0);
    } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
      this.$results.scrollTop(nextOffset);
    }
  };

  Results.prototype.template = function (result, container) {
    var template = this.options.get('templateResult');
    var escapeMarkup = this.options.get('escapeMarkup');

    var content = template(result);

    if (content == null) {
      container.style.display = 'none';
    } else if (typeof content === 'string') {
      container.innerHTML = escapeMarkup(content);
    } else {
      $(container).append(content);
    }
  };

  return Results;
});

S2.define('select2/keys',[

], function () {
  var KEYS = {
    BACKSPACE: 8,
    TAB: 9,
    ENTER: 13,
    SHIFT: 16,
    CTRL: 17,
    ALT: 18,
    ESC: 27,
    SPACE: 32,
    PAGE_UP: 33,
    PAGE_DOWN: 34,
    END: 35,
    HOME: 36,
    LEFT: 37,
    UP: 38,
    RIGHT: 39,
    DOWN: 40,
    DELETE: 46
  };

  return KEYS;
});

S2.define('select2/selection/base',[
  'jquery',
  '../utils',
  '../keys'
], function ($, Utils, KEYS) {
  function BaseSelection ($element, options) {
    this.$element = $element;
    this.options = options;

    BaseSelection.__super__.constructor.call(this);
  }

  Utils.Extend(BaseSelection, Utils.Observable);

  BaseSelection.prototype.render = function () {
    var $selection = $(
      '<span class="select2-selection" role="combobox" ' +
      'aria-autocomplete="list" aria-haspopup="true" aria-expanded="false">' +
      '</span>'
    );

    this._tabindex = 0;

    if (this.$element.data('old-tabindex') != null) {
      this._tabindex = this.$element.data('old-tabindex');
    } else if (this.$element.attr('tabindex') != null) {
      this._tabindex = this.$element.attr('tabindex');
    }

    $selection.attr('title', this.$element.attr('title'));
    $selection.attr('tabindex', this._tabindex);

    this.$selection = $selection;

    return $selection;
  };

  BaseSelection.prototype.bind = function (container, $container) {
    var self = this;

    var id = container.id + '-container';
    var resultsId = container.id + '-results';

    this.container = container;
    window.select2Container = container;//stash it for window use

    this.$selection.on('focus', function (evt) {
      self.trigger('focus', evt);
    });

    this.$selection.on('blur', function (evt) {
      self.trigger('blur', evt);
    });

    this.$selection.on('keydown', function (evt) {
      self.trigger('keypress', evt);

      if (evt.which === KEYS.SPACE) {
        evt.preventDefault();
      }
    });

    container.on('results:focus', function (params) {
      self.$selection.attr('aria-activedescendant', params.data._resultId);
    });

    container.on('selection:update', function (params) {
      self.update(params.data);
    });

    container.on('open', function () {
      // When the dropdown is open, aria-expanded="true"
      self.$selection.attr('aria-expanded', 'true');
      self.$selection.attr('aria-owns', resultsId);

      self._attachCloseHandler(container);
    });

    container.on('close', function () {
      // When the dropdown is closed, aria-expanded="false"
      self.$selection.attr('aria-expanded', 'false');
      self.$selection.removeAttr('aria-activedescendant');
      self.$selection.removeAttr('aria-owns');

      self.isClosing = true;
      self.$selection.focus();

      self._detachCloseHandler(container);
    });

    container.on('enable', function () {
      self.$selection.attr('tabindex', self._tabindex);
    });

    container.on('disable', function () {
      self.$selection.attr('tabindex', '-1');
    });
  };

  BaseSelection.prototype._attachCloseHandler = function (container) {
    var self = this;

    $(document.body).on('mousedown.select2.' + container.id, function (e) {
      var $target = $(e.target);

      var $select = $target.closest('.select2');

      var $all = $('.select2.select2-container--open');

      $all.each(function () {
        var $this = $(this);

        if (this == $select[0]) {
          return;
        }

        var $element = $this.data('element');

        $element.select2('close');
      });
    });
  };

  BaseSelection.prototype._detachCloseHandler = function (container) {
    $(document.body).off('mousedown.select2.' + container.id);
  };

  BaseSelection.prototype.position = function ($selection, $container) {
    var $selectionContainer = $container.find('.selection');
    $selectionContainer.append($selection);
  };

  BaseSelection.prototype.destroy = function () {
    this._detachCloseHandler(this.container);
  };

  BaseSelection.prototype.update = function (data) {
    throw new Error('The `update` method must be defined in child classes.');
  };

  return BaseSelection;
});

S2.define('select2/selection/single',[
  'jquery',
  './base',
  '../utils',
  '../keys'
], function ($, BaseSelection, Utils, KEYS) {
  function SingleSelection () {
    SingleSelection.__super__.constructor.apply(this, arguments);
  }

  Utils.Extend(SingleSelection, BaseSelection);

  SingleSelection.prototype.render = function () {
    var $selection = SingleSelection.__super__.render.call(this);

    $selection.addClass('select2-selection--single');

    $selection.html(
      '<span class="select2-selection__rendered"></span>' +
      '<span class="select2-selection__arrow" role="presentation">' +
        '<b role="presentation"></b>' +
      '</span>'
    );

    return $selection;
  };

  SingleSelection.prototype.bind = function (container, $container) {
    var self = this;

    //Fix issue with select2 not working in modals in IE8
    $.fn.modal.Constructor.prototype.enforceFocus = function () { };

    SingleSelection.__super__.bind.apply(this, arguments);

    var id = container.id + '-container';

    this.$selection.find('.select2-selection__rendered').attr('id', id);
    this.$selection.attr('aria-labelledby', id);

    this.$selection.on('touchend, mousedown', function (evt) {
      // Only respond to left clicks
      if (evt.which !== 1) {
        return;
      }

      self.trigger('toggle', {
        originalEvent: evt
      });
    });
    this.$selection.on('click', function (evt) {
        $( '#' + self.$element.attr('id') + '_search').focus();
    });

    this.$selection.on('focus', function (evt) {
        if (!self.isClosing && !self.container.isOpen()) {
            self.container.trigger('open');
        }
        // User focuses on the container
    });

    this.$selection.on('blur', function (evt) {
      // User exits the container
    });

    container.on('selection:update', function (params) {
      self.update(params.data);
    });
  };

  SingleSelection.prototype.clear = function () {
    this.$selection.find('.select2-selection__rendered').empty();
  };

  SingleSelection.prototype.display = function (data) {
    var template = this.options.get('templateSelection');
    var escapeMarkup = this.options.get('escapeMarkup');

    return escapeMarkup(template(data));
  };

  SingleSelection.prototype.selectionContainer = function () {
    return $('<span></span>');
  };

  SingleSelection.prototype.update = function (data) {
    if (data.length === 0) {
      this.clear();
      return;
    }

    var selection = data[0];

    var formatted = this.display(selection);

    var $rendered = this.$selection.find('.select2-selection__rendered');
    $rendered.empty().append(formatted);
    $rendered.prop('title', selection.title || selection.text);
  };

  return SingleSelection;
});

S2.define('select2/selection/multiple',[
  'jquery',
  './base',
  '../utils'
], function ($, BaseSelection, Utils) {
  function MultipleSelection ($element, options) {
    MultipleSelection.__super__.constructor.apply(this, arguments);
  }

  Utils.Extend(MultipleSelection, BaseSelection);

  MultipleSelection.prototype.render = function () {
    var $selection = MultipleSelection.__super__.render.call(this);

    $selection.addClass('select2-selection--multiple');

    $selection.html(
      '<ul class="select2-selection__rendered"></ul>'
    );

    return $selection;
  };

  MultipleSelection.prototype.bind = function (container, $container) {
    var self = this;

    MultipleSelection.__super__.bind.apply(this, arguments);

    this.$selection.on('click', function (evt) {
      self.trigger('toggle', {
        originalEvent: evt
      });
    });

    this.$selection.on('click', '.select2-selection__choice__remove',
      function (evt) {
      var $remove = $(this);
      var $selection = $remove.parent();

      var data = $selection.data('data');

      self.trigger('unselect', {
        originalEvent: evt,
        data: data
      });
    });
  };

  MultipleSelection.prototype.clear = function () {
    this.$selection.find('.select2-selection__rendered').empty();
  };

  MultipleSelection.prototype.display = function (data) {
    var template = this.options.get('templateSelection');
    var escapeMarkup = this.options.get('escapeMarkup');

    return escapeMarkup(template(data));
  };

  MultipleSelection.prototype.selectionContainer = function () {
    var $container = $(
      '<li class="select2-selection__choice">' +
        '<span class="select2-selection__choice__remove" role="presentation">' +
          '&times;' +
        '</span>' +
      '</li>'
    );

    return $container;
  };

  MultipleSelection.prototype.update = function (data) {
    this.clear();

    if (data.length === 0) {
      return;
    }

    var $selections = [];

    for (var d = 0; d < data.length; d++) {
      var selection = data[d];

      var formatted = this.display(selection);
      var $selection = this.selectionContainer();

      $selection.append(formatted);
      $selection.prop('title', selection.title || selection.text);

      $selection.data('data', selection);

      $selections.push($selection);
    }

    var $rendered = this.$selection.find('.select2-selection__rendered');

    Utils.appendMany($rendered, $selections);
  };

  return MultipleSelection;
});

S2.define('select2/selection/placeholder',[
  '../utils'
], function (Utils) {
  function Placeholder (decorated, $element, options) {
    this.placeholder = this.normalizePlaceholder(options.get('placeholder'));

    decorated.call(this, $element, options);
  }

  Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
    if (typeof placeholder === 'string') {
      placeholder = {
        id: '',
        text: placeholder
      };
    }

    return placeholder;
  };

  Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
    var $placeholder = this.selectionContainer();

    $placeholder.html(this.display(placeholder));
    $placeholder.addClass('select2-selection__placeholder')
                .removeClass('select2-selection__choice');

    return $placeholder;
  };

  Placeholder.prototype.update = function (decorated, data) {
    var singlePlaceholder = (
      data.length == 1 && data[0].id != this.placeholder.id
    );
    var multipleSelections = data.length > 1;

    if (multipleSelections || singlePlaceholder) {
      return decorated.call(this, data);
    }

    this.clear();

    var $placeholder = this.createPlaceholder(this.placeholder);

    this.$selection.find('.select2-selection__rendered').append($placeholder);
  };

  return Placeholder;
});

S2.define('select2/selection/allowClear',[
  'jquery',
  '../keys'
], function ($, KEYS) {
  function AllowClear () { }

  AllowClear.prototype.bind = function (decorated, container, $container) {
    var self = this;

    decorated.call(this, container, $container);

    if (this.placeholder == null) {
      if (this.options.get('debug') && window.console && console.error) {
        console.error(
          'Select2: The `allowClear` option should be used in combination ' +
          'with the `placeholder` option.'
        );
      }
    }

    this.$selection.on('mousedown', '.select2-selection__clear',
      function (evt) {
        self._handleClear(evt);
    });

    container.on('keypress', function (evt) {
      self._handleKeyboardClear(evt, container);
    });
  };

  AllowClear.prototype._handleClear = function (_, evt) {
    // Ignore the event if it is disabled
    if (this.options.get('disabled')) {
      return;
    }

    var $clear = this.$selection.find('.select2-selection__clear');

    // Ignore the event if nothing has been selected
    if ($clear.length === 0) {
      return;
    }

    evt.stopPropagation();

    var data = $clear.data('data');

    for (var d = 0; d < data.length; d++) {
      var unselectData = {
        data: data[d]
      };

      // Trigger the `unselect` event, so people can prevent it from being
      // cleared.
      this.trigger('unselect', unselectData);

      // If the event was prevented, don't clear it out.
      if (unselectData.prevented) {
        return;
      }
    }

    this.$element.val(this.placeholder.id).trigger('change');

    this.trigger('toggle');
  };

  AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
    if (container.isOpen()) {
      return;
    }

    if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
      this._handleClear(evt);
    }
  };

  AllowClear.prototype.update = function (decorated, data) {
    decorated.call(this, data);

    if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
        data.length === 0) {
      return;
    }

    var $remove = $(
      '<span class="select2-selection__clear">' +
        '&times;' +
      '</span>'
    );
    $remove.data('data', data);

    this.$selection.find('.select2-selection__rendered').prepend($remove);
  };

  return AllowClear;
});

S2.define('select2/selection/search',[
  'jquery',
  '../utils',
  '../keys'
], function ($, Utils, KEYS) {
  function Search (decorated, $element, options) {
    decorated.call(this, $element, options);
  }

  Search.prototype.render = function (decorated) {
    var $search = $(
      '<li class="select2-search select2-search--inline">' +
        '<input class="select2-search__field" type="search" tabindex="-1"' +
        ' autocomplete="off" autocorrect="off" autocapitalize="off"' +
        ' spellcheck="false" role="textbox" />' +
      '</li>'
    );

    this.$searchContainer = $search;
    this.$search = $search.find('input');

    var $rendered = decorated.call(this);

    return $rendered;
  };

  Search.prototype.bind = function (decorated, container, $container) {
    var self = this;

    decorated.call(this, container, $container);

    container.on('open', function () {
      self.$search.attr('tabindex', 0);

      self.$search.focus();
    });

    container.on('close', function () {
      self.$search.attr('tabindex', -1);

      self.$search.val('');
      self.$search.focus();
    });

    container.on('enable', function () {
      self.$search.prop('disabled', false);
    });

    container.on('disable', function () {
      self.$search.prop('disabled', true);
    });

    this.$selection.on('focusin', '.select2-search--inline', function (evt) {
        self.trigger('focus', evt);
    });

    this.$selection.on('focusout', '.select2-search--inline', function (evt) {
        self.trigger('blur', evt);
    });

    this.$selection.on('keydown', '.select2-search--inline', function (evt) {
      evt.stopPropagation();

      self.trigger('keypress', evt);

      self._keyUpPrevented = evt.isDefaultPrevented();

      var key = evt.which;

      if (key === KEYS.BACKSPACE && self.$search.val() === '') {
        var $previousChoice = self.$searchContainer
          .prev('.select2-selection__choice');

        if ($previousChoice.length > 0) {
          var item = $previousChoice.data('data');

          self.searchRemoveChoice(item);

          evt.preventDefault();
        }
      }
    });

    // Workaround for browsers which do not support the `input` event
    // This will prevent double-triggering of events for browsers which support
    // both the `keyup` and `input` events.
    this.$selection.on('input', '.select2-search--inline', function (evt) {
      // Unbind the duplicated `keyup` event
      self.$selection.off('keyup.search');
    });

    this.$selection.on('keyup.search input', '.select2-search--inline',
        function (evt) {
      self.handleSearch(evt);
    });
  };

  Search.prototype.createPlaceholder = function (decorated, placeholder) {
    this.$search.attr('placeholder', placeholder.text);
  };

  Search.prototype.update = function (decorated, data) {
    this.$search.attr('placeholder', '');

    decorated.call(this, data);

    this.$selection.find('.select2-selection__rendered')
                   .append(this.$searchContainer);

    this.resizeSearch();
  };

  Search.prototype.handleSearch = function () {
    this.resizeSearch();

    if (!this._keyUpPrevented) {
      var input = this.$search.val();

      this.trigger('query', {
        term: input
      });
    }

    this._keyUpPrevented = false;
  };

  Search.prototype.searchRemoveChoice = function (decorated, item) {
    this.trigger('unselect', {
      data: item
    });

    this.trigger('open');

    this.$search.val(item.text + ' ');
  };

  Search.prototype.resizeSearch = function () {
    this.$search.css('width', '25px');

    var width = '';

    if (this.$search.attr('placeholder') !== '') {
      width = this.$selection.find('.select2-selection__rendered').innerWidth();
    } else {
      var minimumWidth = this.$search.val().length + 1;

      width = (minimumWidth * 0.75) + 'em';
    }

    this.$search.css('width', width);
  };

  return Search;
});

S2.define('select2/selection/eventRelay',[
  'jquery'
], function ($) {
  function EventRelay () { }

  EventRelay.prototype.bind = function (decorated, container, $container) {
    var self = this;
    var relayEvents = [
      'open', 'opening',
      'close', 'closing',
      'select', 'selecting',
      'unselect', 'unselecting'
    ];

    var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];

    decorated.call(this, container, $container);

    container.on('*', function (name, params) {
      // Ignore events that should not be relayed
      if ($.inArray(name, relayEvents) === -1) {
        return;
      }

      // The parameters should always be an object
      params = params || {};

      // Generate the jQuery event for the Select2 event
      var evt = $.Event('select2:' + name, {
        params: params
      });

      self.$element.trigger(evt);

      // Only handle preventable events if it was one
      if ($.inArray(name, preventableEvents) === -1) {
        return;
      }

      params.prevented = evt.isDefaultPrevented();
    });
  };

  return EventRelay;
});

S2.define('select2/translation',[
  'jquery',
  'require'
], function ($, require) {
  function Translation (dict) {
    this.dict = dict || {};
  }

  Translation.prototype.all = function () {
    return this.dict;
  };

  Translation.prototype.get = function (key) {
    return this.dict[key];
  };

  Translation.prototype.extend = function (translation) {
    this.dict = $.extend({}, translation.all(), this.dict);
  };

  // Static functions

  Translation._cache = {};

  Translation.loadPath = function (path) {
    if (!(path in Translation._cache)) {
      var translations = require(path);

      Translation._cache[path] = translations;
    }

    return new Translation(Translation._cache[path]);
  };

  return Translation;
});

S2.define('select2/diacritics',[

], function () {
  var diacritics = {
    '\u24B6': 'A',
    '\uFF21': 'A',
    '\u00C0': 'A',
    '\u00C1': 'A',
    '\u00C2': 'A',
    '\u1EA6': 'A',
    '\u1EA4': 'A',
    '\u1EAA': 'A',
    '\u1EA8': 'A',
    '\u00C3': 'A',
    '\u0100': 'A',
    '\u0102': 'A',
    '\u1EB0': 'A',
    '\u1EAE': 'A',
    '\u1EB4': 'A',
    '\u1EB2': 'A',
    '\u0226': 'A',
    '\u01E0': 'A',
    '\u00C4': 'A',
    '\u01DE': 'A',
    '\u1EA2': 'A',
    '\u00C5': 'A',
    '\u01FA': 'A',
    '\u01CD': 'A',
    '\u0200': 'A',
    '\u0202': 'A',
    '\u1EA0': 'A',
    '\u1EAC': 'A',
    '\u1EB6': 'A',
    '\u1E00': 'A',
    '\u0104': 'A',
    '\u023A': 'A',
    '\u2C6F': 'A',
    '\uA732': 'AA',
    '\u00C6': 'AE',
    '\u01FC': 'AE',
    '\u01E2': 'AE',
    '\uA734': 'AO',
    '\uA736': 'AU',
    '\uA738': 'AV',
    '\uA73A': 'AV',
    '\uA73C': 'AY',
    '\u24B7': 'B',
    '\uFF22': 'B',
    '\u1E02': 'B',
    '\u1E04': 'B',
    '\u1E06': 'B',
    '\u0243': 'B',
    '\u0182': 'B',
    '\u0181': 'B',
    '\u24B8': 'C',
    '\uFF23': 'C',
    '\u0106': 'C',
    '\u0108': 'C',
    '\u010A': 'C',
    '\u010C': 'C',
    '\u00C7': 'C',
    '\u1E08': 'C',
    '\u0187': 'C',
    '\u023B': 'C',
    '\uA73E': 'C',
    '\u24B9': 'D',
    '\uFF24': 'D',
    '\u1E0A': 'D',
    '\u010E': 'D',
    '\u1E0C': 'D',
    '\u1E10': 'D',
    '\u1E12': 'D',
    '\u1E0E': 'D',
    '\u0110': 'D',
    '\u018B': 'D',
    '\u018A': 'D',
    '\u0189': 'D',
    '\uA779': 'D',
    '\u01F1': 'DZ',
    '\u01C4': 'DZ',
    '\u01F2': 'Dz',
    '\u01C5': 'Dz',
    '\u24BA': 'E',
    '\uFF25': 'E',
    '\u00C8': 'E',
    '\u00C9': 'E',
    '\u00CA': 'E',
    '\u1EC0': 'E',
    '\u1EBE': 'E',
    '\u1EC4': 'E',
    '\u1EC2': 'E',
    '\u1EBC': 'E',
    '\u0112': 'E',
    '\u1E14': 'E',
    '\u1E16': 'E',
    '\u0114': 'E',
    '\u0116': 'E',
    '\u00CB': 'E',
    '\u1EBA': 'E',
    '\u011A': 'E',
    '\u0204': 'E',
    '\u0206': 'E',
    '\u1EB8': 'E',
    '\u1EC6': 'E',
    '\u0228': 'E',
    '\u1E1C': 'E',
    '\u0118': 'E',
    '\u1E18': 'E',
    '\u1E1A': 'E',
    '\u0190': 'E',
    '\u018E': 'E',
    '\u24BB': 'F',
    '\uFF26': 'F',
    '\u1E1E': 'F',
    '\u0191': 'F',
    '\uA77B': 'F',
    '\u24BC': 'G',
    '\uFF27': 'G',
    '\u01F4': 'G',
    '\u011C': 'G',
    '\u1E20': 'G',
    '\u011E': 'G',
    '\u0120': 'G',
    '\u01E6': 'G',
    '\u0122': 'G',
    '\u01E4': 'G',
    '\u0193': 'G',
    '\uA7A0': 'G',
    '\uA77D': 'G',
    '\uA77E': 'G',
    '\u24BD': 'H',
    '\uFF28': 'H',
    '\u0124': 'H',
    '\u1E22': 'H',
    '\u1E26': 'H',
    '\u021E': 'H',
    '\u1E24': 'H',
    '\u1E28': 'H',
    '\u1E2A': 'H',
    '\u0126': 'H',
    '\u2C67': 'H',
    '\u2C75': 'H',
    '\uA78D': 'H',
    '\u24BE': 'I',
    '\uFF29': 'I',
    '\u00CC': 'I',
    '\u00CD': 'I',
    '\u00CE': 'I',
    '\u0128': 'I',
    '\u012A': 'I',
    '\u012C': 'I',
    '\u0130': 'I',
    '\u00CF': 'I',
    '\u1E2E': 'I',
    '\u1EC8': 'I',
    '\u01CF': 'I',
    '\u0208': 'I',
    '\u020A': 'I',
    '\u1ECA': 'I',
    '\u012E': 'I',
    '\u1E2C': 'I',
    '\u0197': 'I',
    '\u24BF': 'J',
    '\uFF2A': 'J',
    '\u0134': 'J',
    '\u0248': 'J',
    '\u24C0': 'K',
    '\uFF2B': 'K',
    '\u1E30': 'K',
    '\u01E8': 'K',
    '\u1E32': 'K',
    '\u0136': 'K',
    '\u1E34': 'K',
    '\u0198': 'K',
    '\u2C69': 'K',
    '\uA740': 'K',
    '\uA742': 'K',
    '\uA744': 'K',
    '\uA7A2': 'K',
    '\u24C1': 'L',
    '\uFF2C': 'L',
    '\u013F': 'L',
    '\u0139': 'L',
    '\u013D': 'L',
    '\u1E36': 'L',
    '\u1E38': 'L',
    '\u013B': 'L',
    '\u1E3C': 'L',
    '\u1E3A': 'L',
    '\u0141': 'L',
    '\u023D': 'L',
    '\u2C62': 'L',
    '\u2C60': 'L',
    '\uA748': 'L',
    '\uA746': 'L',
    '\uA780': 'L',
    '\u01C7': 'LJ',
    '\u01C8': 'Lj',
    '\u24C2': 'M',
    '\uFF2D': 'M',
    '\u1E3E': 'M',
    '\u1E40': 'M',
    '\u1E42': 'M',
    '\u2C6E': 'M',
    '\u019C': 'M',
    '\u24C3': 'N',
    '\uFF2E': 'N',
    '\u01F8': 'N',
    '\u0143': 'N',
    '\u00D1': 'N',
    '\u1E44': 'N',
    '\u0147': 'N',
    '\u1E46': 'N',
    '\u0145': 'N',
    '\u1E4A': 'N',
    '\u1E48': 'N',
    '\u0220': 'N',
    '\u019D': 'N',
    '\uA790': 'N',
    '\uA7A4': 'N',
    '\u01CA': 'NJ',
    '\u01CB': 'Nj',
    '\u24C4': 'O',
    '\uFF2F': 'O',
    '\u00D2': 'O',
    '\u00D3': 'O',
    '\u00D4': 'O',
    '\u1ED2': 'O',
    '\u1ED0': 'O',
    '\u1ED6': 'O',
    '\u1ED4': 'O',
    '\u00D5': 'O',
    '\u1E4C': 'O',
    '\u022C': 'O',
    '\u1E4E': 'O',
    '\u014C': 'O',
    '\u1E50': 'O',
    '\u1E52': 'O',
    '\u014E': 'O',
    '\u022E': 'O',
    '\u0230': 'O',
    '\u00D6': 'O',
    '\u022A': 'O',
    '\u1ECE': 'O',
    '\u0150': 'O',
    '\u01D1': 'O',
    '\u020C': 'O',
    '\u020E': 'O',
    '\u01A0': 'O',
    '\u1EDC': 'O',
    '\u1EDA': 'O',
    '\u1EE0': 'O',
    '\u1EDE': 'O',
    '\u1EE2': 'O',
    '\u1ECC': 'O',
    '\u1ED8': 'O',
    '\u01EA': 'O',
    '\u01EC': 'O',
    '\u00D8': 'O',
    '\u01FE': 'O',
    '\u0186': 'O',
    '\u019F': 'O',
    '\uA74A': 'O',
    '\uA74C': 'O',
    '\u01A2': 'OI',
    '\uA74E': 'OO',
    '\u0222': 'OU',
    '\u24C5': 'P',
    '\uFF30': 'P',
    '\u1E54': 'P',
    '\u1E56': 'P',
    '\u01A4': 'P',
    '\u2C63': 'P',
    '\uA750': 'P',
    '\uA752': 'P',
    '\uA754': 'P',
    '\u24C6': 'Q',
    '\uFF31': 'Q',
    '\uA756': 'Q',
    '\uA758': 'Q',
    '\u024A': 'Q',
    '\u24C7': 'R',
    '\uFF32': 'R',
    '\u0154': 'R',
    '\u1E58': 'R',
    '\u0158': 'R',
    '\u0210': 'R',
    '\u0212': 'R',
    '\u1E5A': 'R',
    '\u1E5C': 'R',
    '\u0156': 'R',
    '\u1E5E': 'R',
    '\u024C': 'R',
    '\u2C64': 'R',
    '\uA75A': 'R',
    '\uA7A6': 'R',
    '\uA782': 'R',
    '\u24C8': 'S',
    '\uFF33': 'S',
    '\u1E9E': 'S',
    '\u015A': 'S',
    '\u1E64': 'S',
    '\u015C': 'S',
    '\u1E60': 'S',
    '\u0160': 'S',
    '\u1E66': 'S',
    '\u1E62': 'S',
    '\u1E68': 'S',
    '\u0218': 'S',
    '\u015E': 'S',
    '\u2C7E': 'S',
    '\uA7A8': 'S',
    '\uA784': 'S',
    '\u24C9': 'T',
    '\uFF34': 'T',
    '\u1E6A': 'T',
    '\u0164': 'T',
    '\u1E6C': 'T',
    '\u021A': 'T',
    '\u0162': 'T',
    '\u1E70': 'T',
    '\u1E6E': 'T',
    '\u0166': 'T',
    '\u01AC': 'T',
    '\u01AE': 'T',
    '\u023E': 'T',
    '\uA786': 'T',
    '\uA728': 'TZ',
    '\u24CA': 'U',
    '\uFF35': 'U',
    '\u00D9': 'U',
    '\u00DA': 'U',
    '\u00DB': 'U',
    '\u0168': 'U',
    '\u1E78': 'U',
    '\u016A': 'U',
    '\u1E7A': 'U',
    '\u016C': 'U',
    '\u00DC': 'U',
    '\u01DB': 'U',
    '\u01D7': 'U',
    '\u01D5': 'U',
    '\u01D9': 'U',
    '\u1EE6': 'U',
    '\u016E': 'U',
    '\u0170': 'U',
    '\u01D3': 'U',
    '\u0214': 'U',
    '\u0216': 'U',
    '\u01AF': 'U',
    '\u1EEA': 'U',
    '\u1EE8': 'U',
    '\u1EEE': 'U',
    '\u1EEC': 'U',
    '\u1EF0': 'U',
    '\u1EE4': 'U',
    '\u1E72': 'U',
    '\u0172': 'U',
    '\u1E76': 'U',
    '\u1E74': 'U',
    '\u0244': 'U',
    '\u24CB': 'V',
    '\uFF36': 'V',
    '\u1E7C': 'V',
    '\u1E7E': 'V',
    '\u01B2': 'V',
    '\uA75E': 'V',
    '\u0245': 'V',
    '\uA760': 'VY',
    '\u24CC': 'W',
    '\uFF37': 'W',
    '\u1E80': 'W',
    '\u1E82': 'W',
    '\u0174': 'W',
    '\u1E86': 'W',
    '\u1E84': 'W',
    '\u1E88': 'W',
    '\u2C72': 'W',
    '\u24CD': 'X',
    '\uFF38': 'X',
    '\u1E8A': 'X',
    '\u1E8C': 'X',
    '\u24CE': 'Y',
    '\uFF39': 'Y',
    '\u1EF2': 'Y',
    '\u00DD': 'Y',
    '\u0176': 'Y',
    '\u1EF8': 'Y',
    '\u0232': 'Y',
    '\u1E8E': 'Y',
    '\u0178': 'Y',
    '\u1EF6': 'Y',
    '\u1EF4': 'Y',
    '\u01B3': 'Y',
    '\u024E': 'Y',
    '\u1EFE': 'Y',
    '\u24CF': 'Z',
    '\uFF3A': 'Z',
    '\u0179': 'Z',
    '\u1E90': 'Z',
    '\u017B': 'Z',
    '\u017D': 'Z',
    '\u1E92': 'Z',
    '\u1E94': 'Z',
    '\u01B5': 'Z',
    '\u0224': 'Z',
    '\u2C7F': 'Z',
    '\u2C6B': 'Z',
    '\uA762': 'Z',
    '\u24D0': 'a',
    '\uFF41': 'a',
    '\u1E9A': 'a',
    '\u00E0': 'a',
    '\u00E1': 'a',
    '\u00E2': 'a',
    '\u1EA7': 'a',
    '\u1EA5': 'a',
    '\u1EAB': 'a',
    '\u1EA9': 'a',
    '\u00E3': 'a',
    '\u0101': 'a',
    '\u0103': 'a',
    '\u1EB1': 'a',
    '\u1EAF': 'a',
    '\u1EB5': 'a',
    '\u1EB3': 'a',
    '\u0227': 'a',
    '\u01E1': 'a',
    '\u00E4': 'a',
    '\u01DF': 'a',
    '\u1EA3': 'a',
    '\u00E5': 'a',
    '\u01FB': 'a',
    '\u01CE': 'a',
    '\u0201': 'a',
    '\u0203': 'a',
    '\u1EA1': 'a',
    '\u1EAD': 'a',
    '\u1EB7': 'a',
    '\u1E01': 'a',
    '\u0105': 'a',
    '\u2C65': 'a',
    '\u0250': 'a',
    '\uA733': 'aa',
    '\u00E6': 'ae',
    '\u01FD': 'ae',
    '\u01E3': 'ae',
    '\uA735': 'ao',
    '\uA737': 'au',
    '\uA739': 'av',
    '\uA73B': 'av',
    '\uA73D': 'ay',
    '\u24D1': 'b',
    '\uFF42': 'b',
    '\u1E03': 'b',
    '\u1E05': 'b',
    '\u1E07': 'b',
    '\u0180': 'b',
    '\u0183': 'b',
    '\u0253': 'b',
    '\u24D2': 'c',
    '\uFF43': 'c',
    '\u0107': 'c',
    '\u0109': 'c',
    '\u010B': 'c',
    '\u010D': 'c',
    '\u00E7': 'c',
    '\u1E09': 'c',
    '\u0188': 'c',
    '\u023C': 'c',
    '\uA73F': 'c',
    '\u2184': 'c',
    '\u24D3': 'd',
    '\uFF44': 'd',
    '\u1E0B': 'd',
    '\u010F': 'd',
    '\u1E0D': 'd',
    '\u1E11': 'd',
    '\u1E13': 'd',
    '\u1E0F': 'd',
    '\u0111': 'd',
    '\u018C': 'd',
    '\u0256': 'd',
    '\u0257': 'd',
    '\uA77A': 'd',
    '\u01F3': 'dz',
    '\u01C6': 'dz',
    '\u24D4': 'e',
    '\uFF45': 'e',
    '\u00E8': 'e',
    '\u00E9': 'e',
    '\u00EA': 'e',
    '\u1EC1': 'e',
    '\u1EBF': 'e',
    '\u1EC5': 'e',
    '\u1EC3': 'e',
    '\u1EBD': 'e',
    '\u0113': 'e',
    '\u1E15': 'e',
    '\u1E17': 'e',
    '\u0115': 'e',
    '\u0117': 'e',
    '\u00EB': 'e',
    '\u1EBB': 'e',
    '\u011B': 'e',
    '\u0205': 'e',
    '\u0207': 'e',
    '\u1EB9': 'e',
    '\u1EC7': 'e',
    '\u0229': 'e',
    '\u1E1D': 'e',
    '\u0119': 'e',
    '\u1E19': 'e',
    '\u1E1B': 'e',
    '\u0247': 'e',
    '\u025B': 'e',
    '\u01DD': 'e',
    '\u24D5': 'f',
    '\uFF46': 'f',
    '\u1E1F': 'f',
    '\u0192': 'f',
    '\uA77C': 'f',
    '\u24D6': 'g',
    '\uFF47': 'g',
    '\u01F5': 'g',
    '\u011D': 'g',
    '\u1E21': 'g',
    '\u011F': 'g',
    '\u0121': 'g',
    '\u01E7': 'g',
    '\u0123': 'g',
    '\u01E5': 'g',
    '\u0260': 'g',
    '\uA7A1': 'g',
    '\u1D79': 'g',
    '\uA77F': 'g',
    '\u24D7': 'h',
    '\uFF48': 'h',
    '\u0125': 'h',
    '\u1E23': 'h',
    '\u1E27': 'h',
    '\u021F': 'h',
    '\u1E25': 'h',
    '\u1E29': 'h',
    '\u1E2B': 'h',
    '\u1E96': 'h',
    '\u0127': 'h',
    '\u2C68': 'h',
    '\u2C76': 'h',
    '\u0265': 'h',
    '\u0195': 'hv',
    '\u24D8': 'i',
    '\uFF49': 'i',
    '\u00EC': 'i',
    '\u00ED': 'i',
    '\u00EE': 'i',
    '\u0129': 'i',
    '\u012B': 'i',
    '\u012D': 'i',
    '\u00EF': 'i',
    '\u1E2F': 'i',
    '\u1EC9': 'i',
    '\u01D0': 'i',
    '\u0209': 'i',
    '\u020B': 'i',
    '\u1ECB': 'i',
    '\u012F': 'i',
    '\u1E2D': 'i',
    '\u0268': 'i',
    '\u0131': 'i',
    '\u24D9': 'j',
    '\uFF4A': 'j',
    '\u0135': 'j',
    '\u01F0': 'j',
    '\u0249': 'j',
    '\u24DA': 'k',
    '\uFF4B': 'k',
    '\u1E31': 'k',
    '\u01E9': 'k',
    '\u1E33': 'k',
    '\u0137': 'k',
    '\u1E35': 'k',
    '\u0199': 'k',
    '\u2C6A': 'k',
    '\uA741': 'k',
    '\uA743': 'k',
    '\uA745': 'k',
    '\uA7A3': 'k',
    '\u24DB': 'l',
    '\uFF4C': 'l',
    '\u0140': 'l',
    '\u013A': 'l',
    '\u013E': 'l',
    '\u1E37': 'l',
    '\u1E39': 'l',
    '\u013C': 'l',
    '\u1E3D': 'l',
    '\u1E3B': 'l',
    '\u017F': 'l',
    '\u0142': 'l',
    '\u019A': 'l',
    '\u026B': 'l',
    '\u2C61': 'l',
    '\uA749': 'l',
    '\uA781': 'l',
    '\uA747': 'l',
    '\u01C9': 'lj',
    '\u24DC': 'm',
    '\uFF4D': 'm',
    '\u1E3F': 'm',
    '\u1E41': 'm',
    '\u1E43': 'm',
    '\u0271': 'm',
    '\u026F': 'm',
    '\u24DD': 'n',
    '\uFF4E': 'n',
    '\u01F9': 'n',
    '\u0144': 'n',
    '\u00F1': 'n',
    '\u1E45': 'n',
    '\u0148': 'n',
    '\u1E47': 'n',
    '\u0146': 'n',
    '\u1E4B': 'n',
    '\u1E49': 'n',
    '\u019E': 'n',
    '\u0272': 'n',
    '\u0149': 'n',
    '\uA791': 'n',
    '\uA7A5': 'n',
    '\u01CC': 'nj',
    '\u24DE': 'o',
    '\uFF4F': 'o',
    '\u00F2': 'o',
    '\u00F3': 'o',
    '\u00F4': 'o',
    '\u1ED3': 'o',
    '\u1ED1': 'o',
    '\u1ED7': 'o',
    '\u1ED5': 'o',
    '\u00F5': 'o',
    '\u1E4D': 'o',
    '\u022D': 'o',
    '\u1E4F': 'o',
    '\u014D': 'o',
    '\u1E51': 'o',
    '\u1E53': 'o',
    '\u014F': 'o',
    '\u022F': 'o',
    '\u0231': 'o',
    '\u00F6': 'o',
    '\u022B': 'o',
    '\u1ECF': 'o',
    '\u0151': 'o',
    '\u01D2': 'o',
    '\u020D': 'o',
    '\u020F': 'o',
    '\u01A1': 'o',
    '\u1EDD': 'o',
    '\u1EDB': 'o',
    '\u1EE1': 'o',
    '\u1EDF': 'o',
    '\u1EE3': 'o',
    '\u1ECD': 'o',
    '\u1ED9': 'o',
    '\u01EB': 'o',
    '\u01ED': 'o',
    '\u00F8': 'o',
    '\u01FF': 'o',
    '\u0254': 'o',
    '\uA74B': 'o',
    '\uA74D': 'o',
    '\u0275': 'o',
    '\u01A3': 'oi',
    '\u0223': 'ou',
    '\uA74F': 'oo',
    '\u24DF': 'p',
    '\uFF50': 'p',
    '\u1E55': 'p',
    '\u1E57': 'p',
    '\u01A5': 'p',
    '\u1D7D': 'p',
    '\uA751': 'p',
    '\uA753': 'p',
    '\uA755': 'p',
    '\u24E0': 'q',
    '\uFF51': 'q',
    '\u024B': 'q',
    '\uA757': 'q',
    '\uA759': 'q',
    '\u24E1': 'r',
    '\uFF52': 'r',
    '\u0155': 'r',
    '\u1E59': 'r',
    '\u0159': 'r',
    '\u0211': 'r',
    '\u0213': 'r',
    '\u1E5B': 'r',
    '\u1E5D': 'r',
    '\u0157': 'r',
    '\u1E5F': 'r',
    '\u024D': 'r',
    '\u027D': 'r',
    '\uA75B': 'r',
    '\uA7A7': 'r',
    '\uA783': 'r',
    '\u24E2': 's',
    '\uFF53': 's',
    '\u00DF': 's',
    '\u015B': 's',
    '\u1E65': 's',
    '\u015D': 's',
    '\u1E61': 's',
    '\u0161': 's',
    '\u1E67': 's',
    '\u1E63': 's',
    '\u1E69': 's',
    '\u0219': 's',
    '\u015F': 's',
    '\u023F': 's',
    '\uA7A9': 's',
    '\uA785': 's',
    '\u1E9B': 's',
    '\u24E3': 't',
    '\uFF54': 't',
    '\u1E6B': 't',
    '\u1E97': 't',
    '\u0165': 't',
    '\u1E6D': 't',
    '\u021B': 't',
    '\u0163': 't',
    '\u1E71': 't',
    '\u1E6F': 't',
    '\u0167': 't',
    '\u01AD': 't',
    '\u0288': 't',
    '\u2C66': 't',
    '\uA787': 't',
    '\uA729': 'tz',
    '\u24E4': 'u',
    '\uFF55': 'u',
    '\u00F9': 'u',
    '\u00FA': 'u',
    '\u00FB': 'u',
    '\u0169': 'u',
    '\u1E79': 'u',
    '\u016B': 'u',
    '\u1E7B': 'u',
    '\u016D': 'u',
    '\u00FC': 'u',
    '\u01DC': 'u',
    '\u01D8': 'u',
    '\u01D6': 'u',
    '\u01DA': 'u',
    '\u1EE7': 'u',
    '\u016F': 'u',
    '\u0171': 'u',
    '\u01D4': 'u',
    '\u0215': 'u',
    '\u0217': 'u',
    '\u01B0': 'u',
    '\u1EEB': 'u',
    '\u1EE9': 'u',
    '\u1EEF': 'u',
    '\u1EED': 'u',
    '\u1EF1': 'u',
    '\u1EE5': 'u',
    '\u1E73': 'u',
    '\u0173': 'u',
    '\u1E77': 'u',
    '\u1E75': 'u',
    '\u0289': 'u',
    '\u24E5': 'v',
    '\uFF56': 'v',
    '\u1E7D': 'v',
    '\u1E7F': 'v',
    '\u028B': 'v',
    '\uA75F': 'v',
    '\u028C': 'v',
    '\uA761': 'vy',
    '\u24E6': 'w',
    '\uFF57': 'w',
    '\u1E81': 'w',
    '\u1E83': 'w',
    '\u0175': 'w',
    '\u1E87': 'w',
    '\u1E85': 'w',
    '\u1E98': 'w',
    '\u1E89': 'w',
    '\u2C73': 'w',
    '\u24E7': 'x',
    '\uFF58': 'x',
    '\u1E8B': 'x',
    '\u1E8D': 'x',
    '\u24E8': 'y',
    '\uFF59': 'y',
    '\u1EF3': 'y',
    '\u00FD': 'y',
    '\u0177': 'y',
    '\u1EF9': 'y',
    '\u0233': 'y',
    '\u1E8F': 'y',
    '\u00FF': 'y',
    '\u1EF7': 'y',
    '\u1E99': 'y',
    '\u1EF5': 'y',
    '\u01B4': 'y',
    '\u024F': 'y',
    '\u1EFF': 'y',
    '\u24E9': 'z',
    '\uFF5A': 'z',
    '\u017A': 'z',
    '\u1E91': 'z',
    '\u017C': 'z',
    '\u017E': 'z',
    '\u1E93': 'z',
    '\u1E95': 'z',
    '\u01B6': 'z',
    '\u0225': 'z',
    '\u0240': 'z',
    '\u2C6C': 'z',
    '\uA763': 'z',
    '\u0386': '\u0391',
    '\u0388': '\u0395',
    '\u0389': '\u0397',
    '\u038A': '\u0399',
    '\u03AA': '\u0399',
    '\u038C': '\u039F',
    '\u038E': '\u03A5',
    '\u03AB': '\u03A5',
    '\u038F': '\u03A9',
    '\u03AC': '\u03B1',
    '\u03AD': '\u03B5',
    '\u03AE': '\u03B7',
    '\u03AF': '\u03B9',
    '\u03CA': '\u03B9',
    '\u0390': '\u03B9',
    '\u03CC': '\u03BF',
    '\u03CD': '\u03C5',
    '\u03CB': '\u03C5',
    '\u03B0': '\u03C5',
    '\u03C9': '\u03C9',
    '\u03C2': '\u03C3'
  };

  return diacritics;
});

S2.define('select2/data/base',[
  '../utils'
], function (Utils) {
  function BaseAdapter ($element, options) {
    BaseAdapter.__super__.constructor.call(this);
  }

  Utils.Extend(BaseAdapter, Utils.Observable);

  BaseAdapter.prototype.current = function (callback) {
    throw new Error('The `current` method must be defined in child classes.');
  };

  BaseAdapter.prototype.query = function (params, callback) {
    throw new Error('The `query` method must be defined in child classes.');
  };

  BaseAdapter.prototype.bind = function (container, $container) {
    // Can be implemented in subclasses
  };

  BaseAdapter.prototype.destroy = function () {
    // Can be implemented in subclasses
  };

  BaseAdapter.prototype.generateResultId = function (container, data) {
    var id = container.id + '-result-';

    id += Utils.generateChars(4);

    if (data.id != null) {
      id += '-' + data.id.toString();
    } else {
      id += '-' + Utils.generateChars(4);
    }
    return id;
  };

  return BaseAdapter;
});

S2.define('select2/data/select',[
  './base',
  '../utils',
  'jquery'
], function (BaseAdapter, Utils, $) {
  function SelectAdapter ($element, options) {
    this.$element = $element;
    this.options = options;

    SelectAdapter.__super__.constructor.call(this);
  }

  Utils.Extend(SelectAdapter, BaseAdapter);

  SelectAdapter.prototype.current = function (callback) {
    var data = [];
    var self = this;

    this.$element.find(':selected').each(function () {
      var $option = $(this);

      var option = self.item($option);

      data.push(option);
    });

    callback(data);
  };

  SelectAdapter.prototype.select = function (data) {
    var self = this;

    data.selected = true;

    // If data.element is a DOM node, use it instead
    if ($(data.element).is('option')) {
      data.element.selected = true;

      this.$element.trigger('change');

      return;
    }

    if (this.$element.prop('multiple')) {
      this.current(function (currentData) {
        var val = [];

        data = [data];
        data.push.apply(data, currentData);

        for (var d = 0; d < data.length; d++) {
          var id = data[d].id;

          if ($.inArray(id, val) === -1) {
            val.push(id);
          }
        }

        self.$element.val(val);
        self.$element.trigger('change');
      });
    } else {
      var val = data.id;

      this.$element.val(val);
      this.$element.trigger('change');
    }
  };

  SelectAdapter.prototype.unselect = function (data) {
    var self = this;

    if (!this.$element.prop('multiple')) {
      return;
    }

    data.selected = false;

    if ($(data.element).is('option')) {
      data.element.selected = false;

      this.$element.trigger('change');

      return;
    }

    this.current(function (currentData) {
      var val = [];

      for (var d = 0; d < currentData.length; d++) {
        var id = currentData[d].id;

        if (id !== data.id && $.inArray(id, val) === -1) {
          val.push(id);
        }
      }

      self.$element.val(val);

      self.$element.trigger('change');
    });
  };

  SelectAdapter.prototype.bind = function (container, $container) {
    var self = this;

    this.container = container;

    container.on('select', function (params) {
      self.select(params.data);
    });

    container.on('unselect', function (params) {
      self.unselect(params.data);
    });
  };

  SelectAdapter.prototype.destroy = function () {
    // Remove anything added to child elements
    this.$element.find('*').each(function () {
      // Remove any custom data set by Select2
      $.removeData(this, 'data');
    });
  };

  SelectAdapter.prototype.query = function (params, callback) {
    var data = [];
    var self = this;

    var $options = this.$element.children();

    $options.each(function () {
      var $option = $(this);

      if (!$option.is('option') && !$option.is('optgroup')) {
        return;
      }

      var option = self.item($option);

      var matches = self.matches(params, option);

      if (matches !== null) {
        data.push(matches);
      }
    });

    callback({
      results: data
    });
  };

  SelectAdapter.prototype.addOptions = function ($options) {
    Utils.appendMany(this.$element, $options);
  };

  SelectAdapter.prototype.option = function (data) {
    var option;

    if (data.children) {
      option = document.createElement('optgroup');
      option.label = data.text;
    } else {
      option = document.createElement('option');

      if (option.textContent !== undefined) {
        option.textContent = data.text;
      } else {
        option.innerText = data.text;
      }
    }

    if (data.id) {
      option.value = data.id;
    }

    if (data.disabled) {
      option.disabled = true;
    }

    if (data.selected) {
      option.selected = true;
    }

    if (data.title) {
      option.title = data.title;
    }

    var $option = $(option);

    var normalizedData = this._normalizeItem(data);
    normalizedData.element = option;

    // Override the option's data with the combined data
    $.data(option, 'data', normalizedData);

    return $option;
  };

  SelectAdapter.prototype.item = function ($option) {
    var data = {};

    data = $.data($option[0], 'data');

    if (data != null) {
      return data;
    }

    if ($option.is('option')) {
      data = {
        id: $option.val(),
        text: $option.text(),
        disabled: $option.prop('disabled'),
        selected: $option.prop('selected'),
        title: $option.prop('title')
      };
    } else if ($option.is('optgroup')) {
      data = {
        text: $option.prop('label'),
        children: [],
        title: $option.prop('title')
      };

      var $children = $option.children('option');
      var children = [];

      for (var c = 0; c < $children.length; c++) {
        var $child = $($children[c]);

        var child = this.item($child);

        children.push(child);
      }

      data.children = children;
    }

    data = this._normalizeItem(data);
    data.element = $option[0];

    $.data($option[0], 'data', data);

    return data;
  };

  SelectAdapter.prototype._normalizeItem = function (item) {
    if (!$.isPlainObject(item)) {
      item = {
        id: item,
        text: item
      };
    }

    item = $.extend({}, {
      text: ''
    }, item);

    var defaults = {
      selected: false,
      disabled: false
    };

    if (item.id != null) {
      item.id = item.id.toString();
    }

    if (item.text != null) {
      item.text = item.text.toString();
    }

    if (item._resultId == null && item.id && this.container != null) {
      item._resultId = this.generateResultId(this.container, item);
    }

    return $.extend({}, defaults, item);
  };

  SelectAdapter.prototype.matches = function (params, data) {
    var matcher = this.options.get('matcher');

    return matcher(params, data);
  };

  return SelectAdapter;
});

S2.define('select2/data/array',[
  './select',
  '../utils',
  'jquery'
], function (SelectAdapter, Utils, $) {
  function ArrayAdapter ($element, options) {
    var data = options.get('data') || [];

    ArrayAdapter.__super__.constructor.call(this, $element, options);

    this.addOptions(this.convertToOptions(data));
  }

  Utils.Extend(ArrayAdapter, SelectAdapter);

  ArrayAdapter.prototype.select = function (data) {
    var $option = this.$element.find('option').filter(function (i, elm) {
      return elm.value == data.id.toString();
    });

    if ($option.length === 0) {
      $option = this.option(data);

      this.addOptions($option);
    }

    ArrayAdapter.__super__.select.call(this, data);
  };

  ArrayAdapter.prototype.convertToOptions = function (data) {
    var self = this;

    var $existing = this.$element.find('option');
    var existingIds = $existing.map(function () {
      return self.item($(this)).id;
    }).get();

    var $options = [];

    // Filter out all items except for the one passed in the argument
    function onlyItem (item) {
      return function () {
        return $(this).val() == item.id;
      };
    }

    for (var d = 0; d < data.length; d++) {
      var item = this._normalizeItem(data[d]);

      // Skip items which were pre-loaded, only merge the data
      if ($.inArray(item.id, existingIds) >= 0) {
        var $existingOption = $existing.filter(onlyItem(item));

        var existingData = this.item($existingOption);
        var newData = $.extend(true, {}, existingData, item);

        var $newOption = this.option(existingData);

        $existingOption.replaceWith($newOption);

        continue;
      }

      var $option = this.option(item);

      if (item.children) {
        var $children = this.convertToOptions(item.children);

        Utils.appendMany($option, $children);
      }

      $options.push($option);
    }

    return $options;
  };

  return ArrayAdapter;
});

S2.define('select2/data/ajax',[
  './array',
  '../utils',
  'jquery'
], function (ArrayAdapter, Utils, $) {
  function AjaxAdapter ($element, options) {
    this.ajaxOptions = this._applyDefaults(options.get('ajax'));

    if (this.ajaxOptions.processResults != null) {
      this.processResults = this.ajaxOptions.processResults;
    }

    ArrayAdapter.__super__.constructor.call(this, $element, options);
  }

  Utils.Extend(AjaxAdapter, ArrayAdapter);

  AjaxAdapter.prototype._applyDefaults = function (options) {
    var defaults = {
      data: function (params) {
        return {
          q: params.term
        };
      },
      transport: function (params, success, failure) {
        var $request = $.ajax(params);

        $request.then(success);
        $request.fail(failure);

        return $request;
      }
    };

    return $.extend({}, defaults, options, true);
  };

  AjaxAdapter.prototype.processResults = function (results) {
    return results;
  };

  AjaxAdapter.prototype.query = function (params, callback) {
    var matches = [];
    var self = this;

    if (this._request != null) {
      // JSONP requests cannot always be aborted
      if ($.isFunction(this._request.abort)) {
        this._request.abort();
      }

      this._request = null;
    }

    var options = $.extend({
      type: 'GET'
    }, this.ajaxOptions);

    if (typeof options.url === 'function') {
      options.url = options.url(params);
    }

    if (typeof options.data === 'function') {
      options.data = options.data(params);
    }

    function request () {
      var $request = options.transport(options, function (data) {
        var results = self.processResults(data, params);

        if (self.options.get('debug') && window.console && console.error) {
          // Check to make sure that the response included a `results` key.
          if (!results || !results.results || !$.isArray(results.results)) {
            console.error(
              'Select2: The AJAX results did not return an array in the ' +
              '`results` key of the response.'
            );
          }
        }

        callback(results);
      }, function () {
        // TODO: Handle AJAX errors
      });

      self._request = $request;
    }

    if (this.ajaxOptions.delay && params.term !== '') {
      if (this._queryTimeout) {
        window.clearTimeout(this._queryTimeout);
      }

      this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
    } else {
      request();
    }
  };

  return AjaxAdapter;
});

S2.define('select2/data/tags',[
  'jquery'
], function ($) {
  function Tags (decorated, $element, options) {
    var tags = options.get('tags');

    var createTag = options.get('createTag');

    if (createTag !== undefined) {
      this.createTag = createTag;
    }

    decorated.call(this, $element, options);

    if ($.isArray(tags)) {
      for (var t = 0; t < tags.length; t++) {
        var tag = tags[t];
        var item = this._normalizeItem(tag);

        var $option = this.option(item);

        this.$element.append($option);
      }
    }
  }

  Tags.prototype.query = function (decorated, params, callback) {
    var self = this;

    this._removeOldTags();

    if (params.term == null || params.page != null) {
      decorated.call(this, params, callback);
      return;
    }

    function wrapper (obj, child) {
      var data = obj.results;

      for (var i = 0; i < data.length; i++) {
        var option = data[i];

        var checkChildren = (
          option.children != null &&
          !wrapper({
            results: option.children
          }, true)
        );

        var checkText = option.text === params.term;

        if (checkText || checkChildren) {
          if (child) {
            return false;
          }

          obj.data = data;
          callback(obj);

          return;
        }
      }

      if (child) {
        return true;
      }

      var tag = self.createTag(params);

      if (tag != null) {
        var $option = self.option(tag);
        $option.attr('data-select2-tag', true);

        self.addOptions([$option]);

        self.insertTag(data, tag);
      }

      obj.results = data;

      callback(obj);
    }

    decorated.call(this, params, wrapper);
  };

  Tags.prototype.createTag = function (decorated, params) {
    var term = $.trim(params.term);

    if (term === '') {
      return null;
    }

    return {
      id: term,
      text: term
    };
  };

  Tags.prototype.insertTag = function (_, data, tag) {
    data.unshift(tag);
  };

  Tags.prototype._removeOldTags = function (_) {
    var tag = this._lastTag;

    var $options = this.$element.find('option[data-select2-tag]');

    $options.each(function () {
      if (this.selected) {
        return;
      }

      $(this).remove();
    });
  };

  return Tags;
});

S2.define('select2/data/tokenizer',[
  'jquery'
], function ($) {
  function Tokenizer (decorated, $element, options) {
    var tokenizer = options.get('tokenizer');

    if (tokenizer !== undefined) {
      this.tokenizer = tokenizer;
    }

    decorated.call(this, $element, options);
  }

  Tokenizer.prototype.bind = function (decorated, container, $container) {
    decorated.call(this, container, $container);

    this.$search =  container.dropdown.$search || container.selection.$search ||
      $container.find('.select2-search__field');
  };

  Tokenizer.prototype.query = function (decorated, params, callback) {
    var self = this;

    function select (data) {
      self.select(data);
    }

    params.term = params.term || '';

    var tokenData = this.tokenizer(params, this.options, select);

    if (tokenData.term !== params.term) {
      // Replace the search term if we have the search box
      if (this.$search.length) {
        this.$search.val(tokenData.term);
        this.$search.focus();
      }

      params.term = tokenData.term;
    }

    decorated.call(this, params, callback);
  };

  Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
    var separators = options.get('tokenSeparators') || [];
    var term = params.term;
    var i = 0;

    var createTag = this.createTag || function (params) {
      return {
        id: params.term,
        text: params.term
      };
    };

    while (i < term.length) {
      var termChar = term[i];

      if ($.inArray(termChar, separators) === -1) {
        i++;

        continue;
      }

      var part = term.substr(0, i);
      var partParams = $.extend({}, params, {
        term: part
      });

      var data = createTag(partParams);

      callback(data);

      // Reset the term to not include the tokenized portion
      term = term.substr(i + 1) || '';
      i = 0;
    }

    return {
      term: term
    };
  };

  return Tokenizer;
});

S2.define('select2/data/minimumInputLength',[

], function () {
  function MinimumInputLength (decorated, $e, options) {
    this.minimumInputLength = options.get('minimumInputLength');

    decorated.call(this, $e, options);
  }

  MinimumInputLength.prototype.query = function (decorated, params, callback) {
    params.term = params.term || '';

    if (params.term.length < this.minimumInputLength) {
      this.trigger('results:message', {
        message: 'inputTooShort',
        args: {
          minimum: this.minimumInputLength,
          input: params.term,
          params: params
        }
      });
      
      //Force select2 to resize itself, which should fix the bug with detached floating boxes
      this.container.dropdown._positionDropdown();
      this.container.dropdown._resizeDropdown();

      return;
    }

    decorated.call(this, params, callback);
  };

  return MinimumInputLength;
});

 
jQuery(window).resize(function() {
    setTimeout(function(){  
        //Force select2 to resize itself, which should fix the bug with detached floating boxes
        if (window.select2Container && window.select2Container.dropdown) {
            window.select2Container.dropdown._positionDropdown();
            window.select2Container.dropdown._resizeDropdown();
        }
    }, 700);
    //alert("resize");
});



S2.define('select2/data/maximumInputLength',[

], function () {
  function MaximumInputLength (decorated, $e, options) {
    this.maximumInputLength = options.get('maximumInputLength');

    decorated.call(this, $e, options);
  }

  MaximumInputLength.prototype.query = function (decorated, params, callback) {
    params.term = params.term || '';

    if (this.maximumInputLength > 0 &&
        params.term.length > this.maximumInputLength) {
      this.trigger('results:message', {
        message: 'inputTooLong',
        args: {
          maximum: this.maximumInputLength,
          input: params.term,
          params: params
        }
      });

        //Force select2 to resize itself, which should fix the bug with detached floating boxes
      this.container.dropdown._positionDropdown();
      this.container.dropdown._resizeDropdown();

      return;
    }

    decorated.call(this, params, callback);
  };

  return MaximumInputLength;
});

S2.define('select2/data/maximumSelectionLength',[

], function (){
  function MaximumSelectionLength (decorated, $e, options) {
    this.maximumSelectionLength = options.get('maximumSelectionLength');

    decorated.call(this, $e, options);
  }

  MaximumSelectionLength.prototype.query =
    function (decorated, params, callback) {
      var self = this;

      this.current(function (currentData) {
        var count = currentData != null ? currentData.length : 0;
        if (self.maximumSelectionLength > 0 &&
          count >= self.maximumSelectionLength) {
          self.trigger('results:message', {
            message: 'maximumSelected',
            args: {
              maximum: self.maximumSelectionLength
            }
          });
          return;
        }
        decorated.call(self, params, callback);
      });
  };

  return MaximumSelectionLength;
});

S2.define('select2/dropdown',[
  'jquery',
  './utils'
], function ($, Utils) {
  function Dropdown ($element, options) {
    this.$element = $element;
    this.options = options;

    Dropdown.__super__.constructor.call(this);
  }

  Utils.Extend(Dropdown, Utils.Observable);

  Dropdown.prototype.render = function () {
    var $dropdown = $(
      '<span class="select2-dropdown">' +
        '<span class="select2-results"></span>' +
      '</span>'
    );

    $dropdown.attr('dir', this.options.get('dir'));

    this.$dropdown = $dropdown;

    return $dropdown;
  };

  Dropdown.prototype.position = function ($dropdown, $container) {
    // Should be implmented in subclasses
  };

  Dropdown.prototype.destroy = function () {
    // Remove the dropdown from the DOM
    this.$dropdown.remove();
  };

  return Dropdown;
});

S2.define('select2/dropdown/search',[
  'jquery',
  '../utils'
], function ($, Utils) {
  function Search () { }

  Search.prototype.render = function (decorated) {
    var $rendered = decorated.call(this);
    var $search = $(
      '<span class="select2-search select2-search--dropdown">' +
        '<input id="' + this.$element.attr('id') + '_search" class="select2-search__field" type="search" tabindex="-1"' +
        ' autocomplete="off" autocorrect="off" autocapitalize="off"' +
        ' spellcheck="false" role="textbox" />' +
      '</span>'
    );
    this.$searchContainer = $search;
    this.$search = $search.find('input');

    var searchCssClass = this.options.options.searchCssClass || '';
    $rendered.prepend($search).addClass( searchCssClass );

    return $rendered;
  };

  Search.prototype.bind = function (decorated, container, $container) {
    var self = this;

    decorated.call(this, container, $container);

    this.$search.on('keydown', function (evt) {
      self.trigger('keypress', evt);

      self._keyUpPrevented = evt.isDefaultPrevented();
    });

    // Workaround for browsers which do not support the `input` event
    // This will prevent double-triggering of events for browsers which support
    // both the `keyup` and `input` events.
    this.$search.on('input', function (evt) {
      // Unbind the duplicated `keyup` event
      $(this).off('keyup');
    });

    this.$search.on('keyup input', function (evt) {
      self.handleSearch(evt);
    });

    container.on('open', function () {
      self.$search.attr('tabindex', 0);

      self.$search.focus();

      window.setTimeout(function () {
        self.$search.focus();
      }, 0);
    });

    container.on('close', function () {
      self.$search.attr('tabindex', -1);

      self.$search.val('');
    });

    container.on('results:all', function (params) {
      if (params.query.term == null || params.query.term === '') {
        var showSearch = self.showSearch(params);

        if (showSearch) {
          self.$searchContainer.removeClass('select2-search--hide');
        } else {
          self.$searchContainer.addClass('select2-search--hide');
        }
      }
    });
  };

  Search.prototype.handleSearch = function (evt) {
    if (!this._keyUpPrevented) {
      var input = this.$search.val();

      this.trigger('query', {
        term: input
      });
    }

    this._keyUpPrevented = false;
  };

  Search.prototype.showSearch = function (_, params) {
    return true;
  };

  return Search;
});

S2.define('select2/dropdown/hidePlaceholder',[

], function () {
  function HidePlaceholder (decorated, $element, options, dataAdapter) {
    this.placeholder = this.normalizePlaceholder(options.get('placeholder'));

    decorated.call(this, $element, options, dataAdapter);
  }

  HidePlaceholder.prototype.append = function (decorated, data) {
    data.results = this.removePlaceholder(data.results);

    decorated.call(this, data);
  };

  HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
    if (typeof placeholder === 'string') {
      placeholder = {
        id: '',
        text: placeholder
      };
    }

    return placeholder;
  };

  HidePlaceholder.prototype.removePlaceholder = function (_, data) {
    var modifiedData = data.slice(0);

    for (var d = data.length - 1; d >= 0; d--) {
      var item = data[d];

      if (this.placeholder.id === item.id) {
        modifiedData.splice(d, 1);
      }
    }

    return modifiedData;
  };

  return HidePlaceholder;
});

S2.define('select2/dropdown/infiniteScroll',[
  'jquery'
], function ($) {
  function InfiniteScroll (decorated, $element, options, dataAdapter) {
    this.lastParams = {};

    decorated.call(this, $element, options, dataAdapter);

    this.$loadingMore = this.createLoadingMore();
    this.loading = false;
  }

  InfiniteScroll.prototype.append = function (decorated, data) {
    this.$loadingMore.remove();
    this.loading = false;

    decorated.call(this, data);

    if (this.showLoadingMore(data)) {
      this.$results.append(this.$loadingMore);
    }
  };

  InfiniteScroll.prototype.bind = function (decorated, container, $container) {
    var self = this;

    decorated.call(this, container, $container);

    container.on('query', function (params) {
      self.lastParams = params;
      self.loading = true;
    });

    container.on('query:append', function (params) {
      self.lastParams = params;
      self.loading = true;
    });

    this.$results.on('scroll', function () {
      var isLoadMoreVisible = $.contains(
        document.documentElement,
        self.$loadingMore[0]
      );

      if (self.loading || !isLoadMoreVisible) {
        return;
      }

      var currentOffset = self.$results.offset().top +
        self.$results.outerHeight(false);
      var loadingMoreOffset = self.$loadingMore.offset().top +
        self.$loadingMore.outerHeight(false);

      if (currentOffset + 50 >= loadingMoreOffset) {
        self.loadMore();
      }
    });
  };

  InfiniteScroll.prototype.loadMore = function () {
    this.loading = true;

    var params = $.extend({}, {page: 1}, this.lastParams);

    params.page++;

    this.trigger('query:append', params);
  };

  InfiniteScroll.prototype.showLoadingMore = function (_, data) {
    return data.pagination && data.pagination.more;
  };

  InfiniteScroll.prototype.createLoadingMore = function () {
    var $option = $(
      '<li class="option load-more" role="treeitem"></li>'
    );

    var message = this.options.get('translations').get('loadingMore');

    $option.html(message(this.lastParams));

    return $option;
  };

  return InfiniteScroll;
});

S2.define('select2/dropdown/attachBody',[
  'jquery',
  '../utils'
], function ($, Utils) {
  function AttachBody (decorated, $element, options) {
    this.$dropdownParent = options.get('dropdownParent') || document.body;

    decorated.call(this, $element, options);
  }

  AttachBody.prototype.bind = function (decorated, container, $container) {
    var self = this;

    var setupResultsEvents = false;

    decorated.call(this, container, $container);

    container.on('open', function () {
      self._showDropdown();
      self._attachPositioningHandler(container);

      if (!setupResultsEvents) {
        setupResultsEvents = true;

        container.on('results:all', function () {
          self._positionDropdown();
          self._resizeDropdown();
        });

        container.on('results:append', function () {
          self._positionDropdown();
          self._resizeDropdown();
        });
      }
    });

    container.on('close', function () {
      self._hideDropdown();
      self._detachPositioningHandler(container);
    });

    this.$dropdownContainer.on('mousedown', function (evt) {
      evt.stopPropagation();
    });
  };

  AttachBody.prototype.position = function (decorated, $dropdown, $container) {
    // Clone all of the container classes
    $dropdown.attr('class', $container.attr('class'));

    $dropdown.removeClass('select2');
    $dropdown.addClass('select2-container--open');

    $dropdown.css({
      position: 'absolute',
      top: -999999
    });

    this.$container = $container;
  };

  AttachBody.prototype.render = function (decorated) {
    var $container = $('<span></span>');

    var $dropdown = decorated.call(this);
    $container.append($dropdown);

    this.$dropdownContainer = $container;

    return $container;
  };

  AttachBody.prototype._hideDropdown = function (decorated) {
    this.$dropdownContainer.detach();
  };

  AttachBody.prototype._attachPositioningHandler = function (container) {
    var self = this;

    var scrollEvent = 'scroll.select2.' + container.id;
    var resizeEvent = 'resize.select2.' + container.id;
    var orientationEvent = 'orientationchange.select2.' + container.id;

    var $watchers = this.$container.parents().filter(Utils.hasScroll);
    $watchers.each(function () {
      $(this).data('select2-scroll-position', {
        x: $(this).scrollLeft(),
        y: $(this).scrollTop()
      });
    });

    $watchers.on(scrollEvent, function (ev) {
      var position = $(this).data('select2-scroll-position');
      $(this).scrollTop(position.y);
    });

    $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
      function (e) {
      self._positionDropdown();
      self._resizeDropdown();
    });
  };

  AttachBody.prototype._detachPositioningHandler = function (container) {
    var scrollEvent = 'scroll.select2.' + container.id;
    var resizeEvent = 'resize.select2.' + container.id;
    var orientationEvent = 'orientationchange.select2.' + container.id;

    var $watchers = this.$container.parents().filter(Utils.hasScroll);
    $watchers.off(scrollEvent);

    $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
  };

  AttachBody.prototype._positionDropdown = function () {
    var $window = $(window);

    var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
    var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');

    var newDirection = null;

    var position = this.$container.position();
    var offset = this.$container.offset();

    offset.bottom = offset.top + this.$container.outerHeight(false);

    var container = {
      height: this.$container.outerHeight(false)
    };

    container.top = offset.top;
    container.bottom = offset.top + container.height;

    var dropdown = {
      height: this.$dropdown.outerHeight(false)
    };

    var viewport = {
      top: $window.scrollTop(),
      bottom: $window.scrollTop() + $window.height()
    };

    var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
    var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);

    var css = {
      left: offset.left,
      top: container.bottom
    };

    if (!isCurrentlyAbove && !isCurrentlyBelow) {
      newDirection = 'below';
    }

    if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
      newDirection = 'above';
    } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
      newDirection = 'below';
    }

    if (newDirection == 'above' ||
      (isCurrentlyAbove && newDirection !== 'below')) {
      css.top = container.top - dropdown.height;
    }

    if (newDirection != null) {
      this.$dropdown
        .removeClass('select2-dropdown--below select2-dropdown--above')
        .addClass('select2-dropdown--' + newDirection);
      this.$container
        .removeClass('select2-container--below select2-container--above')
        .addClass('select2-container--' + newDirection);
    }

    this.$dropdownContainer.css(css);
  };

  AttachBody.prototype._resizeDropdown = function () {
    this.$dropdownContainer.width();

    var css = {
      width: this.$container.outerWidth(false) + 'px'
    };

    if (this.options.get('dropdownAutoWidth')) {
      css.minWidth = css.width;
      css.width = 'auto';
    }

    this.$dropdown.css(css);
  };

  AttachBody.prototype._showDropdown = function (decorated) {
    this.$dropdownContainer.appendTo(this.$dropdownParent);

    this._positionDropdown();
    this._resizeDropdown();
  };

  return AttachBody;
});

S2.define('select2/dropdown/minimumResultsForSearch',[

], function () {
  function countResults (data) {
    var count = 0;

    for (var d = 0; d < data.length; d++) {
      var item = data[d];

      if (item.children) {
        count += countResults(item.children);
      } else {
        count++;
      }
    }

    return count;
  }

  function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
    this.minimumResultsForSearch = options.get('minimumResultsForSearch');

    if (this.minimumResultsForSearch < 0) {
      this.minimumResultsForSearch = Infinity;
    }

    decorated.call(this, $element, options, dataAdapter);
  }

  MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
    if (countResults(params.data.results) < this.minimumResultsForSearch) {
      return false;
    }

    return decorated.call(this, params);
  };

  return MinimumResultsForSearch;
});

S2.define('select2/dropdown/selectOnClose',[

], function () {
  function SelectOnClose () { }

  SelectOnClose.prototype.bind = function (decorated, container, $container) {
    var self = this;

    decorated.call(this, container, $container);

    container.on('close', function () {
      self._handleSelectOnClose();
    });
  };

  SelectOnClose.prototype._handleSelectOnClose = function () {
    var $highlightedResults = this.getHighlightedResults();

    if ($highlightedResults.length < 1) {
      return;
    }

    this.trigger('select', {
        suppressClose: true,
        data: $highlightedResults.data('data')
    });
  };

  return SelectOnClose;
});

S2.define('select2/dropdown/closeOnSelect',[

], function () {
  function CloseOnSelect () { }

  CloseOnSelect.prototype.bind = function (decorated, container, $container) {
    var self = this;

    decorated.call(this, container, $container);

    container.on('select', function (evt) {
      // preventing inifite loop when both selectOnClose and closeOnSelect options are set to true
      if (evt && evt.suppressClose === true) {
         return;
      }
      self._selectTriggered(evt);
    });

    container.on('unselect', function (evt) {
      self._selectTriggered(evt);
    });
  };

  CloseOnSelect.prototype._selectTriggered = function (_, evt) {
    var originalEvent = evt.originalEvent;

    // Don't close if the control key is being held
    if (originalEvent && originalEvent.ctrlKey) {
      return;
    }

    this.trigger('close');
  };

  return CloseOnSelect;
});

S2.define('select2/i18n/en',[],function () {
  // English
  return {
    errorLoading: function () {
      return 'The results could not be loaded.';
    },
    inputTooLong: function (args) {
      var overChars = args.input.length - args.maximum;

      var message = 'Please delete ' + overChars + ' character';

      if (overChars != 1) {
        message += 's';
      }

      return message;
    },
    inputTooShort: function (args) {
      var remainingChars = args.minimum - args.input.length;

      var message = 'Please enter ' + remainingChars + ' or more characters';

      return message;
    },
    loadingMore: function () {
      return 'Loading more results…';
    },
    maximumSelected: function (args) {
      var message = 'You can only select ' + args.maximum + ' item';

      if (args.maximum != 1) {
        message += 's';
      }

      return message;
    },
    noResults: function () {
      return 'No results found';
    },
    searching: function () {
      return 'Searching…';
    }
  };
});

S2.define('select2/defaults',[
  'jquery',
  'require',

  './results',

  './selection/single',
  './selection/multiple',
  './selection/placeholder',
  './selection/allowClear',
  './selection/search',
  './selection/eventRelay',

  './utils',
  './translation',
  './diacritics',

  './data/select',
  './data/array',
  './data/ajax',
  './data/tags',
  './data/tokenizer',
  './data/minimumInputLength',
  './data/maximumInputLength',
  './data/maximumSelectionLength',

  './dropdown',
  './dropdown/search',
  './dropdown/hidePlaceholder',
  './dropdown/infiniteScroll',
  './dropdown/attachBody',
  './dropdown/minimumResultsForSearch',
  './dropdown/selectOnClose',
  './dropdown/closeOnSelect',

  './i18n/en'
], function ($, require,

             ResultsList,

             SingleSelection, MultipleSelection, Placeholder, AllowClear,
             SelectionSearch, EventRelay,

             Utils, Translation, DIACRITICS,

             SelectData, ArrayData, AjaxData, Tags, Tokenizer,
             MinimumInputLength, MaximumInputLength, MaximumSelectionLength,

             Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
             AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,

             EnglishTranslation) {
  function Defaults () {
    this.reset();
  }

  Defaults.prototype.apply = function (options) {
    options = $.extend({}, this.defaults, options);

    if (options.dataAdapter == null) {
      if (options.ajax != null) {
        options.dataAdapter = AjaxData;
      } else if (options.data != null) {
        options.dataAdapter = ArrayData;
      } else {
        options.dataAdapter = SelectData;
      }

      if (options.minimumInputLength > 0) {
        options.dataAdapter = Utils.Decorate(
          options.dataAdapter,
          MinimumInputLength
        );
      }

      if (options.maximumInputLength > 0) {
        options.dataAdapter = Utils.Decorate(
          options.dataAdapter,
          MaximumInputLength
        );
      }

      if (options.maximumSelectionLength > 0) {
        options.dataAdapter = Utils.Decorate(
          options.dataAdapter,
          MaximumSelectionLength
        );
      }

      if (options.tags) {
        options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
      }

      if (options.tokenSeparators != null || options.tokenizer != null) {
        options.dataAdapter = Utils.Decorate(
          options.dataAdapter,
          Tokenizer
        );
      }

      if (options.query != null) {
        var Query = require(options.amdBase + 'compat/query');

        options.dataAdapter = Utils.Decorate(
          options.dataAdapter,
          Query
        );
      }

      if (options.initSelection != null) {
        var InitSelection = require(options.amdBase + 'compat/initSelection');

        options.dataAdapter = Utils.Decorate(
          options.dataAdapter,
          InitSelection
        );
      }
    }

    if (options.resultsAdapter == null) {
      options.resultsAdapter = ResultsList;

      if (options.ajax != null) {
        options.resultsAdapter = Utils.Decorate(
          options.resultsAdapter,
          InfiniteScroll
        );
      }

      if (options.placeholder != null) {
        options.resultsAdapter = Utils.Decorate(
          options.resultsAdapter,
          HidePlaceholder
        );
      }

      if (options.selectOnClose) {
        options.resultsAdapter = Utils.Decorate(
          options.resultsAdapter,
          SelectOnClose
        );
      }
    }

    if (options.dropdownAdapter == null) {
      if (options.multiple) {
        options.dropdownAdapter = Dropdown;
      } else {
        var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);

        options.dropdownAdapter = SearchableDropdown;
      }

      if (options.minimumResultsForSearch !== 0) {
        options.dropdownAdapter = Utils.Decorate(
          options.dropdownAdapter,
          MinimumResultsForSearch
        );
      }

      if (options.closeOnSelect) {
        options.dropdownAdapter = Utils.Decorate(
          options.dropdownAdapter,
          CloseOnSelect
        );
      }

      if (
        options.dropdownCssClass != null ||
        options.dropdownCss != null ||
        options.adaptDropdownCssClass != null
      ) {
        var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');

        options.dropdownAdapter = Utils.Decorate(
          options.dropdownAdapter,
          DropdownCSS
        );
      }

      options.dropdownAdapter = Utils.Decorate(
        options.dropdownAdapter,
        AttachBody
      );
    }

    if (options.selectionAdapter == null) {
      if (options.multiple) {
        options.selectionAdapter = MultipleSelection;
      } else {
        options.selectionAdapter = SingleSelection;
      }

      // Add the placeholder mixin if a placeholder was specified
      if (options.placeholder != null) {
        options.selectionAdapter = Utils.Decorate(
          options.selectionAdapter,
          Placeholder
        );
      }

      if (options.allowClear) {
        options.selectionAdapter = Utils.Decorate(
          options.selectionAdapter,
          AllowClear
        );
      }

      if (options.multiple) {
        options.selectionAdapter = Utils.Decorate(
          options.selectionAdapter,
          SelectionSearch
        );
      }

      if (
        options.containerCssClass != null ||
        options.containerCss != null ||
        options.adaptContainerCssClass != null
      ) {
        var ContainerCSS = require(options.amdBase + 'compat/containerCss');

        options.selectionAdapter = Utils.Decorate(
          options.selectionAdapter,
          ContainerCSS
        );
      }

      options.selectionAdapter = Utils.Decorate(
        options.selectionAdapter,
        EventRelay
      );
    }

    if (typeof options.language === 'string') {
      // Check if the language is specified with a region
      if (options.language.indexOf('-') > 0) {
        // Extract the region information if it is included
        var languageParts = options.language.split('-');
        var baseLanguage = languageParts[0];

        options.language = [options.language, baseLanguage];
      } else {
        options.language = [options.language];
      }
    }

    if ($.isArray(options.language)) {
      var languages = new Translation();
      options.language.push('en');

      var languageNames = options.language;

      for (var l = 0; l < languageNames.length; l++) {
        var name = languageNames[l];
        var language = {};

        try {
          // Try to load it with the original name
          language = Translation.loadPath(name);
        } catch (e) {
          try {
            // If we couldn't load it, check if it wasn't the full path
            name = this.defaults.amdLanguageBase + name;
            language = Translation.loadPath(name);
          } catch (ex) {
            // The translation could not be loaded at all. Sometimes this is
            // because of a configuration problem, other times this can be
            // because of how Select2 helps load all possible translation files.
            if (options.debug && window.console && console.warn) {
              console.warn(
                'Select2: The language file for "' + name + '" could not be ' +
                'automatically loaded. A fallback will be used instead.'
              );
            }

            continue;
          }
        }

        languages.extend(language);
      }

      options.translations = languages;
    } else {
      var baseTranslation = Translation.loadPath(
        this.defaults.amdLanguageBase + 'en'
      );
      var customTranslation = new Translation(options.language);

      customTranslation.extend(baseTranslation);

      options.translations = customTranslation;
    }

    return options;
  };

  Defaults.prototype.reset = function () {
    function stripDiacritics (text) {
      // Used 'uni range + named function' from http://jsperf.com/diacritics/18
      function match(a) {
        return DIACRITICS[a] || a;
      }

      return text.replace(/[^\u0000-\u007E]/g, match);
    }

    function matcher (params, data) {
      // Always return the object if there is nothing to compare
      if ($.trim(params.term) === '') {
        return data;
      }

      // Do a recursive check for options with children
      if (data.children && data.children.length > 0) {
        // Clone the data object if there are children
        // This is required as we modify the object to remove any non-matches
        var match = $.extend(true, {}, data);

        // Check each child of the option
        for (var c = data.children.length - 1; c >= 0; c--) {
          var child = data.children[c];

          var matches = matcher(params, child);

          // If there wasn't a match, remove the object in the array
          if (matches == null) {
            match.children.splice(c, 1);
          }
        }

        // If any children matched, return the new object
        if (match.children.length > 0) {
          return match;
        }

        // If there were no matching children, check just the plain object
        return matcher(params, match);
      }

      var original = stripDiacritics(data.text).toUpperCase();
      var term = stripDiacritics(params.term).toUpperCase();

      // Check if the text contains the term
      if (original.indexOf(term) > -1) {
        return data;
      }

      // If it doesn't contain the term, don't return anything
      return null;
    }

    this.defaults = {
      amdBase: './',
      amdLanguageBase: './i18n/',
      closeOnSelect: true,
      debug: false,
      dropdownAutoWidth: false,
      escapeMarkup: Utils.escapeMarkup,
      language: EnglishTranslation,
      matcher: matcher,
      minimumInputLength: 0,
      maximumInputLength: 0,
      maximumSelectionLength: 0,
      minimumResultsForSearch: 0,
      selectOnClose: false,
      sorter: function (data) {
        return data;
      },
      templateResult: function (result) {
        return result.text;
      },
      templateSelection: function (selection) {
        return selection.text;
      },
      theme: 'default',
      width: 'resolve'
    };
  };

  Defaults.prototype.set = function (key, value) {
    var camelKey = $.camelCase(key);

    var data = {};
    data[camelKey] = value;

    var convertedData = Utils._convertData(data);

    $.extend(this.defaults, convertedData);
  };

  var defaults = new Defaults();

  return defaults;
});

S2.define('select2/options',[
  'require',
  'jquery',
  './defaults',
  './utils'
], function (require, $, Defaults, Utils) {
  function Options (options, $element) {
    this.options = options;

    if ($element != null) {
      this.fromElement($element);
    }

    this.options = Defaults.apply(this.options);

    if ($element && $element.is('input')) {
      var InputCompat = require(this.get('amdBase') + 'compat/inputData');

      this.options.dataAdapter = Utils.Decorate(
        this.options.dataAdapter,
        InputCompat
      );
    }
  }

  Options.prototype.fromElement = function ($e) {
    var excludedData = ['select2'];

    if (this.options.multiple == null) {
      this.options.multiple = $e.prop('multiple');
    }

    if (this.options.disabled == null) {
      this.options.disabled = $e.prop('disabled');
    }

    if (this.options.language == null) {
      if ($e.prop('lang')) {
        this.options.language = $e.prop('lang').toLowerCase();
      } else if ($e.closest('[lang]').prop('lang')) {
        this.options.language = $e.closest('[lang]').prop('lang');
      }
    }

    if (this.options.dir == null) {
      if ($e.prop('dir')) {
        this.options.dir = $e.prop('dir');
      } else if ($e.closest('[dir]').prop('dir')) {
        this.options.dir = $e.closest('[dir]').prop('dir');
      } else {
        this.options.dir = 'ltr';
      }
    }

    $e.prop('disabled', this.options.disabled);
    $e.prop('multiple', this.options.multiple);

    if ($e.data('select2Tags')) {
      if (this.options.debug && window.console && console.warn) {
        console.warn(
          'Select2: The `data-select2-tags` attribute has been changed to ' +
          'use the `data-data` and `data-tags="true"` attributes and will be ' +
          'removed in future versions of Select2.'
        );
      }

      $e.data('data', $e.data('select2Tags'));
      $e.data('tags', true);
    }

    if ($e.data('ajaxUrl')) {
      if (this.options.debug && window.console && console.warn) {
        console.warn(
          'Select2: The `data-ajax-url` attribute has been changed to ' +
          '`data-ajax--url` and support for the old attribute will be removed' +
          ' in future versions of Select2.'
        );
      }

      $e.attr('ajax--url', $e.data('ajaxUrl'));
      $e.data('ajax--url', $e.data('ajaxUrl'));
    }

    var dataset = {};

    // Prefer the element's `dataset` attribute if it exists
    // jQuery 1.x does not correctly handle data attributes with multiple dashes
    if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
      dataset = $.extend(true, {}, $e[0].dataset, $e.data());
    } else {
      dataset = $e.data();
    }

    var data = $.extend(true, {}, dataset);

    data = Utils._convertData(data);

    for (var key in data) {
      if ($.inArray(key, excludedData) > -1) {
        continue;
      }

      if ($.isPlainObject(this.options[key])) {
        $.extend(this.options[key], data[key]);
      } else {
        this.options[key] = data[key];
      }
    }

    return this;
  };

  Options.prototype.get = function (key) {
    return this.options[key];
  };

  Options.prototype.set = function (key, val) {
    this.options[key] = val;
  };

  return Options;
});

S2.define('select2/core',[
  'jquery',
  './options',
  './utils',
  './keys'
], function ($, Options, Utils, KEYS) {
  var Select2 = function ($element, options) {
    if ($element.data('select2') != null) {
      $element.data('select2').destroy();
    }

    this.$element = $element;

    this.id = this._generateId($element);

    options = options || {};

    this.options = new Options(options, $element);

    Select2.__super__.constructor.call(this);

    // Set up the tabindex

    var tabindex = $element.attr('tabindex') || 0;
    $element.data('old-tabindex', tabindex);
    $element.attr('tabindex', '-1');

    // Set up containers and adapters

    var DataAdapter = this.options.get('dataAdapter');
    this.dataAdapter = new DataAdapter($element, this.options);

    var $container = this.render();

    this._placeContainer($container);

    var SelectionAdapter = this.options.get('selectionAdapter');
    this.selection = new SelectionAdapter($element, this.options);
    this.$selection = this.selection.render();

    this.selection.position(this.$selection, $container);

    var DropdownAdapter = this.options.get('dropdownAdapter');
    this.dropdown = new DropdownAdapter($element, this.options);
    this.$dropdown = this.dropdown.render();

    this.dropdown.position(this.$dropdown, $container);

    var ResultsAdapter = this.options.get('resultsAdapter');
    this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
    this.$results = this.results.render();

    this.results.position(this.$results, this.$dropdown);

    // Bind events

    var self = this;

    // Bind the container to all of the adapters
    this._bindAdapters();

    // Register any DOM event handlers
    this._registerDomEvents();

    // Register any internal event handlers
    this._registerDataEvents();
    this._registerSelectionEvents();
    this._registerDropdownEvents();
    this._registerResultsEvents();
    this._registerEvents();

    // Set the initial state
    this.dataAdapter.current(function (initialData) {
      self.trigger('selection:update', {
        data: initialData
      });
    });

    // Hide the original select
    $element.addClass('select2-hidden-accessible');
	
	$element.attr('aria-hidden', 'true');
	//Added Reciteme attribute with class "select2-hidden-accessible"
	$(".select2-hidden-accessible").attr("data-recite-translate-skip", "true");
    // Synchronize any monitored attributes
    this._syncAttributes();

    $element.data('select2', this);
  };

  Utils.Extend(Select2, Utils.Observable);

  Select2.prototype._generateId = function ($element) {
    var id = '';

    if ($element.attr('id') != null) {
      id = $element.attr('id');
    } else if ($element.attr('name') != null) {
      id = $element.attr('name') + '-' + Utils.generateChars(2);
    } else {
      id = Utils.generateChars(4);
    }

    id = 'select2-' + id;

    return id;
  };

  Select2.prototype._placeContainer = function ($container) {
    $container.insertAfter(this.$element);

    var width = this._resolveWidth(this.$element, this.options.get('width'));

    if (width != null) {
      $container.css('width', width);
    }
  };

  Select2.prototype._resolveWidth = function ($element, method) {
    var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;

    if (method == 'resolve') {
      var styleWidth = this._resolveWidth($element, 'style');

      if (styleWidth != null) {
        return styleWidth;
      }

      return this._resolveWidth($element, 'element');
    }

    if (method == 'element') {
      var elementWidth = $element.outerWidth(false);

      if (elementWidth <= 0) {
        return 'auto';
      }

      return elementWidth + 'px';
    }

    if (method == 'style') {
      var style = $element.attr('style');

      if (typeof(style) !== 'string') {
        return null;
      }

      var attrs = style.split(';');

      for (var i = 0, l = attrs.length; i < l; i = i + 1) {
        var attr = attrs[i].replace(/\s/g, '');
        var matches = attr.match(WIDTH);

        if (matches !== null && matches.length >= 1) {
          return matches[1];
        }
      }

      return null;
    }

    return method;
  };

  Select2.prototype._bindAdapters = function () {
    this.dataAdapter.bind(this, this.$container);
    this.selection.bind(this, this.$container);

    this.dropdown.bind(this, this.$container);
    this.results.bind(this, this.$container);
  };

  Select2.prototype._registerDomEvents = function () {
    var self = this;

    this.$element.on('change.select2', function () {
      self.dataAdapter.current(function (data) {
        self.trigger('selection:update', {
          data: data
        });
      });
    });

    this._sync = Utils.bind(this._syncAttributes, this);

    if (this.$element[0].attachEvent) {
      this.$element[0].attachEvent('onpropertychange', this._sync);
    }

    var observer = window.MutationObserver ||
      window.WebKitMutationObserver ||
      window.MozMutationObserver
    ;

    if (observer != null) {
      this._observer = new observer(function (mutations) {
        $.each(mutations, self._sync);
      });
      this._observer.observe(this.$element[0], {
        attributes: true,
        subtree: false
      });
    } else if (this.$element[0].addEventListener) {
      this.$element[0].addEventListener('DOMAttrModified', self._sync, false);
    }
  };

  Select2.prototype._registerDataEvents = function () {
    var self = this;

    this.dataAdapter.on('*', function (name, params) {
      self.trigger(name, params);
    });
  };

  Select2.prototype._registerSelectionEvents = function () {
    var self = this;
    var nonRelayEvents = ['toggle'];

    this.selection.on('toggle', function () {
      self.toggleDropdown();
    });

    this.selection.on('*', function (name, params) {
      if ($.inArray(name, nonRelayEvents) !== -1) {
        return;
      }

      self.trigger(name, params);
    });
  };

  Select2.prototype._registerDropdownEvents = function () {
    var self = this;

    this.dropdown.on('*', function (name, params) {
      self.trigger(name, params);
    });
  };

  Select2.prototype._registerResultsEvents = function () {
    var self = this;

    this.results.on('*', function (name, params) {
      self.trigger(name, params);
    });
  };

  Select2.prototype._registerEvents = function () {
    var self = this;

    this.on('open', function () {
      self.$container.addClass('select2-container--open');
    });

    this.on('close', function () {
      self.$container.removeClass('select2-container--open');
    });

    this.on('enable', function () {
      self.$container.removeClass('select2-container--disabled');
    });

    this.on('disable', function () {
      self.$container.addClass('select2-container--disabled');
    });

    this.on('focus', function (evt) {
      self.$container.addClass('select2-container--focus');
    });

    this.on('blur', function () {
      self.$container.removeClass('select2-container--focus');
    });

    this.on('query', function (params) {
      if (!self.isOpen()) {
        self.trigger('open');
      }

      this.dataAdapter.query(params, function (data) {
        self.trigger('results:all', {
          data: data,
          query: params
        });
      });
    });

    this.on('query:append', function (params) {
      this.dataAdapter.query(params, function (data) {
        self.trigger('results:append', {
          data: data,
          query: params
        });
      });
    });

    this.on('keypress', function (evt) {
      var key = evt.which;

      if (self.isOpen()) {
        if (key === KEYS.ENTER) {
          self.trigger('results:select');
          evt.preventDefault();
        } else if ((key === KEYS.SPACE && evt.ctrlKey)) {
          self.trigger('results:toggle');

          evt.preventDefault();
        } else if (key === KEYS.UP) {
          self.trigger('results:previous');

          evt.preventDefault();
        } else if (key === KEYS.DOWN) {
          self.trigger('results:next');

          evt.preventDefault();
        } else if (key === KEYS.ESC || key === KEYS.TAB) {
          self.close();
          //evt.preventDefault();
        }
      } else {
        if (key === KEYS.ENTER || key === KEYS.SPACE ||
            ((key === KEYS.DOWN || key === KEYS.UP) && evt.altKey)) {
          self.open();

          evt.preventDefault();
        }
      }
    });
  };

  Select2.prototype._syncAttributes = function () {
    this.options.set('disabled', this.$element.prop('disabled'));

    if (this.options.get('disabled')) {
      if (this.isOpen()) {
        this.close();
      }

      this.trigger('disable');
    } else {
      this.trigger('enable');
    }
  };

  /**
   * Override the trigger method to automatically trigger pre-events when
   * there are events that can be prevented.
   */
  Select2.prototype.trigger = function (name, args) {
    var actualTrigger = Select2.__super__.trigger;
    var preTriggerMap = {
      'open': 'opening',
      'close': 'closing',
      'select': 'selecting',
      'unselect': 'unselecting'
    };

    if (name in preTriggerMap) {
      var preTriggerName = preTriggerMap[name];
      var preTriggerArgs = {
        prevented: false,
        name: name,
        args: args
      };

      actualTrigger.call(this, preTriggerName, preTriggerArgs);

      if (preTriggerArgs.prevented) {
        args.prevented = true;

        return;
      }
    }

    actualTrigger.call(this, name, args);
  };

  Select2.prototype.toggleDropdown = function () {
    if (this.options.get('disabled')) {
      return;
    }

    if (this.isOpen()) {
      this.close();
    } else {
      this.open();
    }
  };

  Select2.prototype.open = function () {
    if (this.isOpen()) {
      return;
    }

    this.trigger('query', {});
  };

  Select2.prototype.close = function () {
    if (!this.isOpen()) {
      return;
    }

    this.trigger('close');
  };

  Select2.prototype.isOpen = function () {
    return this.$container.hasClass('select2-container--open');
  };

  Select2.prototype.enable = function (args) {
    if (this.options.get('debug') && window.console && console.warn) {
      console.warn(
        'Select2: The `select2("enable")` method has been deprecated and will' +
        ' be removed in later Select2 versions. Use $element.prop("disabled")' +
        ' instead.'
      );
    }

    if (args == null || args.length === 0) {
      args = [true];
    }

    var disabled = !args[0];

    this.$element.prop('disabled', disabled);
  };

  Select2.prototype.data = function () {
    if (this.options.get('debug') &&
        arguments.length > 0 && window.console && console.warn) {
      console.warn(
        'Select2: Data can no longer be set using `select2("data")`. You ' +
        'should consider setting the value instead using `$element.val()`.'
      );
    }

    var data = [];

    this.dataAdapter.current(function (currentData) {
      data = currentData;
    });

    return data;
  };

  Select2.prototype.val = function (args) {
    if (this.options.get('debug') && window.console && console.warn) {
      console.warn(
        'Select2: The `select2("val")` method has been deprecated and will be' +
        ' removed in later Select2 versions. Use $element.val() instead.'
      );
    }

    if (args == null || args.length === 0) {
      return this.$element.val();
    }

    var newVal = args[0];

    if ($.isArray(newVal)) {
      newVal = $.map(newVal, function (obj) {
        return obj.toString();
      });
    }

    this.$element.val(newVal).trigger('change');
  };

  Select2.prototype.destroy = function () {
    this.$container.remove();

    if (this.$element[0].detachEvent) {
      this.$element[0].detachEvent('onpropertychange', this._sync);
    }

    if (this._observer != null) {
      this._observer.disconnect();
      this._observer = null;
    } else if (this.$element[0].removeEventListener) {
      this.$element[0]
        .removeEventListener('DOMAttrModified', this._sync, false);
    }

    this._sync = null;

    this.$element.off('.select2');
    this.$element.attr('tabindex', this.$element.data('old-tabindex'));

    this.$element.removeClass('select2-hidden-accessible');
	this.$element.attr('aria-hidden', 'false');
    this.$element.removeData('select2');

    this.dataAdapter.destroy();
    this.selection.destroy();
    this.dropdown.destroy();
    this.results.destroy();

    this.dataAdapter = null;
    this.selection = null;
    this.dropdown = null;
    this.results = null;
  };

  Select2.prototype.render = function () {
    var $container = $(
      '<span class="select2 select2-container">' +
        '<span class="selection"></span>' +
        '<span class="dropdown-wrapper" aria-hidden="true"></span>' +
      '</span>'
    );

    $container.attr('dir', this.options.get('dir'));

    this.$container = $container;

    this.$container.addClass('select2-container--' + this.options.get('theme'));

    $container.data('element', this.$element);

    return $container;
  };

  return Select2;
});

S2.define('jquery.select2',[
  'jquery',
  'require',

  './select2/core',
  './select2/defaults'
], function ($, require, Select2, Defaults) {
  // Force jQuery.mousewheel to be loaded if it hasn't already
  require('jquery.mousewheel');

  if ($.fn.select2 == null) {
    // All methods that should return the element
    var thisMethods = ['open', 'close', 'destroy'];

    $.fn.select2 = function (options) {
      options = options || {};

      if (typeof options === 'object') {
        this.each(function () {
          var instanceOptions = $.extend({}, options, true);

          var instance = new Select2($(this), instanceOptions);
        });

        return this;
      } else if (typeof options === 'string') {
        var instance = this.data('select2');

        if (instance == null && window.console && console.error) {
          console.error(
            'The select2(\'' + options + '\') method was called on an ' +
            'element that is not using Select2.'
          );
        }

        var args = Array.prototype.slice.call(arguments, 1);

        var ret = instance[options](args);

        // Check if we should be returning `this`
        if ($.inArray(options, thisMethods) > -1) {
          return this;
        }

        return ret;
      } else {
        throw new Error('Invalid arguments for Select2: ' + options);
      }
    };
  }

  if ($.fn.select2.defaults == null) {
    $.fn.select2.defaults = Defaults;
  }

  return Select2;
});

S2.define('jquery.mousewheel',[
  'jquery'
], function ($) {
  // Used to shim jQuery.mousewheel for non-full builds.
  return $;
});

  // Return the AMD loader configuration so it can be used outside of this file
  return {
    define: S2.define,
    require: S2.require
  };
}());

  // Autoload the jQuery bindings
  // We know that all of the modules exist above this, so we're safe
  var select2 = S2.require('jquery.select2');

  // Hold the AMD module references on the jQuery function that was just loaded
  // This allows Select2 to use the internal loader outside of this file, such
  // as in the language files.
  jQuery.fn.select2.amd = S2;

  // Return the Select2 instance for anyone who is importing it.
  return select2;
}));
define('binding-handlers/select2', ['jquery', 'knockout', 'utils', 'select2', 'jquerybrowser'],
    function ($, ko, utils, select2, jqueryBrowser) {

        var matcher = function(params, data) {
            //make searchTerm available for sort function
            if (!params.term || $.trim(params.term) === '' || data.text.toLowerCase().indexOf(params.term.toLowerCase()) > -1) {
                data.searchTerm = params.term;
                return data;
            }

            return null;
        };
		
		 var popularStations  = [];
		
        var sorter = function (results) {

            var inputElem = $('.select2-search__field');
            var CurrentURL = $(location).attr('href');

            var arraysplit = CurrentURL.split('/');

            if (arraysplit[arraysplit.length - 1] == "group-travel-form") {
                var DDStationID = $('.select2-search__field').attr('id');
                if (DDStationID.indexOf('departureStation') != -1) {
                    var inputElem = $('.select2-search__field').attr('aria-labelledby', 'departureStation');
                }
                else {
                    var inputElem = $('.select2-search__field').attr('aria-labelledby', 'destinationStation');
                }


            }
            else {
                var inputElem = $('.select2-search__field').attr('aria-labelledby', 'SearchStation');
            }
           
            var searchTerm = (results && results.length > 0) ? results[0].searchTerm : false;
			
			 var myPreferencesResponse = localStorage.getItem('myPreferencesResponse');
			 if(myPreferencesResponse != undefined && myPreferencesResponse != null && myPreferencesResponse.length > 0)
			 {
				var myPrefernecesJSON = JSON.parse(myPreferencesResponse);
				popularStations = myPrefernecesJSON.FavouriteStationsList;
			 }
      
            if (searchTerm) {
                //Unwrap
                $(inputElem).parent().removeClass('qtt-placeholder').removeAttr('data-placeholder');              
                var resultsStartingWith = [];
                var resultsWithCRS = [];
                var otherResults = [];
                searchTerm = searchTerm.toLowerCase();
                $.each(results, function (index, item) {
                    if (searchTerm.length === 1) {
                        var a = 2 + 2;
                    }
                    else if (searchTerm.length <= 3 && item.text.toLowerCase().indexOf('(' + searchTerm + ')') != -1) {
                        resultsWithCRS.push(item);
                    } else if (utils.startsWith(item.text.toLowerCase(), searchTerm)) {
                        resultsStartingWith.push(item);
                    } else {
                        otherResults.push(item);
                    }


                });
                var finalList = movePupularStationToTop(resultsWithCRS.concat(resultsStartingWith.concat(otherResults)), searchTerm);
                return finalList;
            }
            else {
                //Wrap
                $(inputElem).parent().addClass('qtt-placeholder').attr('data-placeholder', 'Please enter 2 or more character');
                if (popularStations !=null && popularStations.length !== 0) {
                    $('.select2-results__options').prepend('<strong class="Popular-Station-Text" >Favourite Stations</strong>');
                }
               
                var popularStationArray = [];

                for (var i = 0; i < popularStations.length; i++) {
                    for (var j = 0; j < results.length; j++) {
                        if (results[j].text.indexOf(popularStations[i]) > -1) {
                            popularStationArray.push(results[j]);
                        }
                        else {
                            continue;
                        }
                    }
                }

                //for (var i = 0; i < results.length; i++) {
                //    for (var j = 0; j < popularStations.length; j++) {
                //        if (results[i].text.indexOf(popularStations[j]) > -1) {
                //            popularStationArray.push(results[i]);
                //        }
                //        else {
                //            continue;
                //        }
                //    }
                //}
                return popularStationArray;
            }       
        };

        function movePupularStationToTop(allStations, searchTerm) {
            var matchedPopularStation = null;
			if (popularStations !=null && popularStations.length !== 0) {
            for (var i = 0; i < popularStations.length; i++) {
                if (popularStations[i].toLowerCase().indexOf(searchTerm) > -1) {
                    matchedPopularStation = popularStations[i];
                    break;
                }
            }
			}
            if (matchedPopularStation != null) {
                for (var i = 0; i < allStations.length; i++) {
                    if (allStations[i].text.indexOf(matchedPopularStation) > -1) {
                        var matchedStation = allStations[i];
                        allStations.splice(allStations.indexOf(allStations[i]), 1);
                        allStations.unshift(matchedStation);
                    }
                }
            }
            return allStations;
        }

        var subscribeToValueChange = function ($element, observable) {
            var _base;
            if (observable && typeof (_base = observable).subscribe === "function") {
                _base.subscribe(function (val) {
                    return $element.select2('val', val);
                });
            }
        };

        function initialiseSelect2($element, settings) {
            $element.select2(settings);

            if (settings.selectedId && settings.selectedId() && settings.dataSource) {
                /*
                In select2 v 4.0 it is difficult to set an initial value when
                also using "data"
                - Option #1 is to prepopulate the <select> with all the options
                  and set one to selected. You can do this via javascript or just
                  outputting the select in the markup
                - Option #2 is to use their ridiculous new adapters which are
                  poorly documented and add extra code for little need in this
                  scenario. https://select2.github.io/options.html

                #1 is not possible given we are dealing with 3K+ stations. So here
                we are taking this simplest approach possible to get an initial value
                */
                $element.select2('val', settings.selectedId());
            }
        }


        // The select2 binding can work under two different scenarios
        // 1. Where the underlying select list already has options (bound by ko or not)
        // 2. Where we have a dataSource to use

        function init(element, valueAccessor, allBindingsAccessor) {
            var settings = valueAccessor(),
                allBindings = allBindingsAccessor(),
                $element = $(element);
            

            var defaultConfig = {
                minimumInputLength: 0,
                matchPreference: 'start',
                selectOnClose: true
            };
            if (jqueryBrowser.platform == 'ipad' || jqueryBrowser.platform == 'iphone') {
                defaultConfig.searchCssClass = 'ios-search';
            }
            settings = $.extend(defaultConfig, settings);

            if (ko.isObservable(settings.selectedId) || ko.isObservable(settings.selectedText)) {
                $element.on("select2:select", function(e) {
                    var selectedData = e.params.data;

                    if (settings.selectedId) {
                        settings.selectedId(selectedData.id);
                    }

                    if (settings.selectedText) {
                        settings.selectedText(selectedData.text);
                    }
                });
            }

            if (settings.matchPreference == 'start') {
                settings.matcher = matcher;
                settings.sorter = sorter;
            }

            if (settings.dataSource) {
                settings.data = ko.utils.unwrapObservable(settings.dataSource);
                if (settings.data.length === 0) {
                    settings.placeholder = 'Loading stations...';
                } else {
                    settings.placeholder = settings.originalPlaceholder;
                }
                settings.dataSource.subscribe(function (newVal) {
                    if (settings.data.length != newVal.length) {
                        settings.data = newVal;
                        if (settings.data.length === 0) {
                            settings.placeholder = 'Loading stations...';
                        } else {
                            settings.placeholder = settings.originalPlaceholder;
                        }
                        initialiseSelect2($element, settings);
                    }
                });
            }
            if (settings.placeholder && settings.dataSource) {
                // Where we are using a data source, select2 requires
                // an empty option for the placeholder to work
                $element.prepend("<option></option>");
            }
            initialiseSelect2($element, settings);

            if (allBindings.value) {
                subscribeToValueChange($element, allBindings.value);
            }
            if (settings.selectedId) {
                subscribeToValueChange($element, settings.selectedId);
            }


            // force keyboard to open on ios
            if (jqueryBrowser.platform == 'ipad' || jqueryBrowser.platform == 'iphone') {
                
                $(".select2-container, select").click(function() {

                    $('.select2-search__field').trigger('click').trigger('focus');

                });
            }

            $element.on("select2:open", function (e) {
               // force keyboard open on ios
                if (jqueryBrowser.platform == 'ipad' || jqueryBrowser.platform == 'iphone') {

                    $('.select2-search__field').trigger('click').trigger('focus');
                
                }

                if (jqueryBrowser.desktop || $('body').innerWidth() > 767) {


                    var select2 = $(this);
                    var qttHome = $(e.target[0]).closest('.qtt-tabbed');
                    var qttHomeAnimate = $(e.target[0]).closest('.qtt-tabbed .qtt__search-bottom');

                    if (qttHome.hasClass('complete')) {
                        return;
                    }

                    if (qttHome.length) {

                    qttHomeAnimate.one('webkitTransitionEnd mozTransitionEnd oTransitionEnd otransitionend transitionend', function(e)
                        {
                            if (qttHome.hasClass('active')) {
                                
                                if (jqueryBrowser.platform == 'ipad' || jqueryBrowser.platform == 'iphone') {
                                    $(window).scrollTop($(window).scrollTop()+1);
                                    $('span.select2-results').attr('style', 'display: block!important');
                                    $('.select2-container--open .select2-dropdown').attr('style', 'left:0');
                                }
                                else{
                                    var $elem = $('[data-filter="#tabbed-qtt-component-tab-2"]');
                                    if (!$elem.hasClass('active')) 
                                        select2.select2('open');
                                }
                                qttHome.addClass('complete');
                            }

                        });

                        if (!qttHome.hasClass('active') ) {
                           
                            if (jqueryBrowser.platform == 'ipad' || jqueryBrowser.platform == 'iphone') {
                               
                                $(window).scrollTop($(window).scrollTop()+1);
                                $('span.select2-results').attr('style', 'display: none!important');
                                $('.select2-container--open .select2-dropdown').attr('style', 'left:-9999px');
                            }
                             else{
                                select2.select2("close");
                            }
                        }

                        qttHome.addClass('active');
                    }
                }
            });


            return ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
                return $element.select2('destroy');
            });
        }

        function update(element) {
            $(element).trigger('change');
        }

        ko.bindingHandlers.select2 = {
            init: init,
            update: update
        };
    }
);
define('binding-handlers/tabs', ['jquery', 'knockout'],
    function ($, ko) {

        function update(element, valueAccessor) {
            var config = ko.utils.unwrapObservable(valueAccessor());

            var scope = $(element).parents(config.scope),
                items = scope.find(config.itemScope),
                tabs = scope.find('.tab-thumb');

            var activateTab = function (tab) {
                items.addClass('hidden');
                tabs.removeClass('active');

                var currentFilter = $(tab).data('filter');
                var matchingItems = scope.find(currentFilter);

                var maxItemsPerTab = config.itemsPerTab;
                if (maxItemsPerTab === 0 || maxItemsPerTab > matchingItems.length) {
                    maxItemsPerTab = matchingItems.length;
                }
                matchingItems.slice(0, maxItemsPerTab).removeClass('hidden');

                $(tab).addClass('active');

                $(element).find('.dropdown-toggle').text($(tab).text());
            };

            if (tabs.length > 0) {
                activateTab(tabs.get(0));
            } else {
                items.removeClass('hidden');
            }

            tabs.each(function () {
                var self = this;
                var link = $(self).find('a').get(0);
                ko.applyBindingsToNode(link, {
                    click: function () {
                        activateTab(self);
                    }
                });
            });
        }

        ko.bindingHandlers.tabs = {
            update: update
        };
    }
);
define('binding-handlers/timeList', ['jquery', 'knockout', 'dateUtils', 'context'],
    function ($, ko, dateUtils, context) {

        var defaultConfig = {
            start: '00:00',
            end: '24:00',
            increment: 30,
            setNearestTimeChunk: true
        };

        function afterRender(option, dataItem, defaultItem) {
            if (defaultItem) {
                var boundTime = ko.utils.unwrapObservable(defaultItem);
                if (dateUtils.isDate( boundTime) && (dataItem === boundTime.format(context.dateFormat.time))) {
                    $(option).prop('selected', true);
                }
            }
        }

        function preprocess(value, name, addBindingCallback) {
            addBindingCallback('optionsAfterRender', 'function(option, dataItem){ko.bindingHandlers.timeList.afterRender(option, dataItem, ' + value + '.time);}');
            return value;
        }

        function ensureValidSelection(boundTimeObservable, config) {
            if (config.setNearestTimeChunk) {
                var boundTime = ko.utils.unwrapObservable(boundTimeObservable);
                var date = boundTime || dateUtils.currentDate();

                var nextDateTimeValue = dateUtils.setNearestTimeChunk(date.clone(), config.increment);
                if (!dateUtils.isSame(nextDateTimeValue, date)) {
                    boundTimeObservable(nextDateTimeValue);
                }
            }
        }

        function init(element, valueAccessor, allBindings, viewModel, bindingContext) {            
            var options = valueAccessor().options || {};
            var config = $.extend({}, defaultConfig, options);

            var boundTimeObservable = valueAccessor().time;
            if (ko.isObservable(boundTimeObservable)) {
                ensureValidSelection(boundTimeObservable, config);

                $(element).change(function() {
                    var boundTime = ko.utils.unwrapObservable(boundTimeObservable);
                    var timeSegments = ($(element).val() || '').split(':');
                    if (dateUtils.isDate(boundTime) && timeSegments.length == 2) {
                        var newDate = boundTime.hour(timeSegments[0]).minute(timeSegments[1]);
                        boundTimeObservable(newDate);
                    }
                });
            }

            var timeList = dateUtils.incrementTime(config.start, config.end, config.increment);
            var newValueAccessor = function () {
                return timeList;
            };
            ko.bindingHandlers.options.update(element, newValueAccessor, allBindings, viewModel, bindingContext);
        }

        function update(element, valueAccessor, allBindings, viewModel, bindingContext) {            
            var options = valueAccessor().options || {};
            var config = $.extend({}, defaultConfig, options);                        

            var boundTimeObservable = valueAccessor().time;
            if (ko.isObservable(boundTimeObservable)) {
                ensureValidSelection(boundTimeObservable, config);

                var boundTime = ko.utils.unwrapObservable(boundTimeObservable);
                $(element).val(boundTime.format(context.dateFormat.time));
                $(element).trigger('change');
            }            
        }

        ko.bindingHandlers.timeList = {
            afterRender: afterRender,
            preprocess: preprocess,
            update: update,
            init: init
        };
    }
);

/*
    apply to element wrapping an input field. When field has focus 'has-focus' class will be applied to element
*/
define('binding-handlers/inputFieldFocusFlag', ['jquery', 'knockout'],
function ($, ko) {

    function initialise(element, valueAccessor) {
        $(element).on('focus', 'input', function () {
            $(element).addClass('has-focus');
        });
        $(element).on('blur', 'input', function () {
            $(element).removeClass('has-focus');
        });
    }
    ko.bindingHandlers.inputFieldFocusFlag = {
        init: initialise
    };
});
/*
*  simple way of truncating an elements inner text. Because clamp doesn't work on pre elements
*/
define('binding-handlers/truncateText', ['knockout'],
    function (ko) {

        function init(element, valueAccessor) {
            var config = ko.utils.unwrapObservable(valueAccessor);

            var limit = 10;
            if(config().limit){
            	limit = config().limit;
            }
            var text = element.textContent;
            if(text.length > limit) {
                element.innerHTML = text.substring(0,limit) + '...';
            }
        }

        ko.bindingHandlers.truncateText = {
            init: init
        };
    }
);
define('autoCompleteService', ['jquery', 'mapHelper'], function ($, mapHelper) {

	var service;

	var makeRequest = function(params, success, failure){

		if (service) {
			service.getQueryPredictions({
				input: params.data.q,
				location: new google.maps.LatLng(51.508742,-0.120850), // todo: get dynamically
				radius: 50000,
				components: { country: 'uk' }
			}, function (responseData, responseStatus) {
				if(responseStatus == 'OK') {
					success(responseData);
				} else {
					failure(responseData);
				}
			});
		}
	};

	mapHelper.init().done(function(){
		service = new google.maps.places.AutocompleteService();
	});

	return {
		makeRequest : makeRequest
	};
});
define('binding-handlers/selectAutocomplete', ['jquery', 'knockout','autoCompleteService'], function ($, ko, autoCompleteService) {

	"use strict";

	function init(element, valueAccessor) {

		var $element = $(element);
		var settings = valueAccessor();
		var placeholderText = settings.placeholderText;

		var selectHandler = settings.selectHandler;

		//  selectHandler takes selected value and will do something like set it into the model
		$element.on( "select2:select", selectHandler );

		function formatRepo (repo) {
			return repo.description;
		}

		function formatRepoSelection (repo) {
			return repo.description;
		}

		$element.select2({
			placeholder : {
				id : 'placeholder',
				description : placeholderText
			},
			ajax: {
				dataType: 'json',
				delay: 250,
				transport: function (params, success, failure) {
					autoCompleteService.makeRequest(params, success, failure);
				},
				processResults: function (data, params) {
					return {
						results: data
					};
				},
				cache: true
			},
			minimumInputLength: 2,
			templateResult: formatRepo,
			templateSelection: formatRepoSelection,
			selectOnClose: true
		});
	}

	ko.bindingHandlers.selectAutocomplete = {
			init: init
	};
});

define('binding-handlers/tabbedQtt', ['jquery', 'knockout'],
    function ($, ko) {

        var brakpoint = 768;
        var tabsItems = ['#tabbed-qtt-component-tab-1', '#tabbed-qtt-component-tab-2'];
        var tabsSubitems = ['.component-journey-check-form', '.component-live-departures-form'];
        var className = 'tab-pane';
        var previous = true;
        var vertical = null;
        var isOpened = false;

        var $qttform = $('.qtt-tabbed');
        var $closeQtt = $qttform.find('.qtt-form-close');
        var $tabCheck = $qttform.find('.tab-check');
        var $tabQtt = $qttform.find('.tab-qtt');
        var $tabLink = $('.tab-qtt a');

        var checkYourJourneyNavElementSelector = '.check-your-journey .accordion-thumb';
        var $checkYourJourneyNavElement = null;
        var getCheckYourJourneyNavElement = function() {
            if ($checkYourJourneyNavElement == null || ($checkYourJourneyNavElement != null&&!$checkYourJourneyNavElement.length))
                $checkYourJourneyNavElement = $(checkYourJourneyNavElementSelector);
            return $checkYourJourneyNavElement;
        }

        var checkYourJourneyContentElementSelector = '.component-journey-check-form';
        var $checkYourJourneyContentElement = null;
        var getCheckYourJourneyContentElement = function () {
            if ($checkYourJourneyContentElement == null || ($checkYourJourneyContentElement != null && !$checkYourJourneyContentElement.length))
                $checkYourJourneyContentElement = $(checkYourJourneyContentElementSelector);
            return $checkYourJourneyContentElement;
        }

        var componentSelector = '#tabbed-qtt-component';
        var verticalClass = 'vertical';

        function viewport() {
            var e = window, a = 'inner';
            if (!('innerWidth' in window)) {
                a = 'client';
                e = document.documentElement || document.body;
            }
            return { width: e[a + 'Width'], height: e[a + 'Height'] };
        }

        var isVertical = function () {
            if (!$(componentSelector).length)
                return false;

            if (vertical == null)
                vertical = $(componentSelector).hasClass(verticalClass);

            return vertical;
        }

        var checkYourJourneyExpand = function () {
            getCheckYourJourneyNavElement().addClass('open');
            getCheckYourJourneyContentElement().css('display', 'block');
            getCheckYourJourneyContentElement().addClass('open');
            isOpened = true;
        }

        var update = function () {
            // $closeQtt.trigger('click');
            // $tabLink.trigger('click');
        }

        var qttStateHandler = function() {

            $closeQtt.on('click', function(e) {
                $tabLink.trigger('click');
                $qttform.removeClass('active complete qtt-tabbed--journey-check');
                $qttform.addClass('closing');

                $qttform.one('webkitTransitionEnd mozTransitionEnd oTransitionEnd otransitionend transitionend', function() {
                    $qttform.removeClass('closing');
                });
            });

            $tabCheck.on('click', function(e) {
                $qttform.addClass('active qtt-tabbed--journey-check qtt-search--purple');
            });

            $tabQtt.on('click', function(e) {
                $qttform.removeClass('qtt-tabbed--journey-check qtt-search--purple');
            });
        }

        var init = function () {
            qttStateHandler();
            // window.addEventListener('resize', update );
        }

        init();

        ko.bindingHandlers.tabbedQtt = {
            update: update
        };
    }
);

define('reCaptchaHelper', ['jquery', 'knockout', 'utils'],
    function ($, ko, utils) {
        
        
        var isGoogleApiLoaded = false;

        window.captchaApiLoaded = function () {
            isGoogleApiLoaded = true;
            def.resolve();
        };

        window.captchaRepo = [];

        function loadCaptchaApi() {
            $(document).ready(function () {
                var script = document.createElement('script');
                script.type = 'text/javascript';
                script.src = 'https://www.google.com/recaptcha/api.js?onload=captchaApiLoaded&render=explicit';
                document.body.appendChild(script);
            });
        };

        var Captcha = function (elementId, widgetId, invisible, parameters) {
            var self = {};

            var isValid = ko.observable(false),
                isValidated = ko.observable(false),
                isPendingToken = ko.observable(false),
                invisible = invisible,
                siteKey = (parameters || {}).sitekey,
                hasError = ko.computed(function() {
                    return isValidated() && !isValid();
                }),

                executeDeferred = null,
                getExecuteDeferred = function() {
                    return executeDeferred;
                },

                getToken = function () {
                    var resolveToken = function(token, deferred) {
                        isValidated(true);
                        isValid(token.length > 0);

                        isPendingToken(false);

                        if (token) {
                            deferred.resolve(token)
                            return;
                        }

                        deferred.reject();
                    };

                    return $.Deferred(function (deferred) {
                        // reject if captcha widget is not found in the DOM, or if there is an other pending Captcha widget waiting for token
                        if (!hasElement(elementId) || getPendingCaptcha()) {
                            deferred.reject();
                            return;
                        }
                        isPendingToken(true);

                        if (invisible) {
                            executeDeferred = $.Deferred();
                            executeDeferred.promise().done(function (token) {
                                resolveToken(token, deferred);
                            })

                            grecaptcha.execute(widgetId);
                            return;
                        } else {
                            var captchaToken = grecaptcha.getResponse(widgetId);
                            resolveToken(captchaToken, deferred);
                            return;
                        }

                    }).promise();
                },

                reset = function() {
                    if (hasElement(elementId)) {
                        grecaptcha.reset(widgetId);
                    } else {
                        console.log('Failed to reset captcha: Element with id ' + elementId + 'not found');
                    }
                };

            return {
                id: widgetId,
                elementId: elementId,
                invisible: invisible,
                siteKey: siteKey,
                parameters: parameters,
                isPendingToken: isPendingToken,
                hasError: hasError,
                getExecuteDeferred: getExecuteDeferred,
                getToken: getToken,
                reset: reset
            }
        }

        var def;

        var init = function () {
            if (!def) {
                def = $.Deferred(function () {
                    if (isGoogleApiLoaded) {
                        def.resolve();
                        return;
                    }
                    utils.checkFunctionalCookieConsent(function (callback) {  
                        if (callback != null) {
                            loadCaptchaApi();
                        }
                        else {
                            setTimeout(function () {
                                var message = 'In order to submit this form we need to enable recaptcha to make sure you are not a robot. To allow this you need to enable all cookies using the Cookie Preferences settings in the bottom left of this page';
                                var alertMessageDiv = $('<div></div>').addClass('recaptcha-alert');
                                var alertIcon = $('<i></i>').addClass('recaptcha-alert-icon fa fa-exclamation-triangle');
                                var alertMessageSpan = $('<span></span>').addClass('recaptcha-alert-message').html(message);
                                alertMessageDiv.append(alertIcon);
                                alertMessageDiv.append(alertMessageSpan);
                                $(".component-grouptravel-form").prepend(alertMessageDiv);
                                console.log("assisted-travel-form", $(".component-assistedtravel-form"));
                                $(".component-assistedtravel-form").prepend(alertMessageDiv);
                                $('.responsive-captcha').append("<span class='validation-error-message'>Could not load recaptcha</span>")
                            }, 1000)
                            
                        }
                    });
                });
            }

            return def.promise();
        };

        init();

        var render = function (elementId, parameters) {
            if (hasElement(elementId)) {
                var invisible = (parameters || {}).size === 'invisible';

                if (invisible) {
                    window.captchaDataCallBack = function (token) {
                        var pendingCaptcha = getPendingCaptcha();
                        pendingCaptcha.getExecuteDeferred().resolve(token);
                    }
                    parameters.callback = 'captchaDataCallBack';
                }

                var widgetId = grecaptcha.render(elementId, parameters);

                var captcha = new Captcha(elementId, widgetId, invisible, parameters);
                window.captchaRepo.push(captcha);

                return captcha;
            } else {
                console.log('Failed to render captcha: Element with id ' + elementId + 'not found');
            }

            return null;
        }


        var getPendingCaptcha = function() {
            return utils.findInArray(window.captchaRepo, (function(captcha) {
                return captcha.isPendingToken() === true;
            }));
        }

        var hasElement = function (elementId) {
            return $('#' + elementId).length > 0;
        }

        return {
            init: init,
            render: render
        };
    });
define('binding-handlers/recaptcha', ['jquery', 'knockout', 'utils', 'reCaptchaHelper'],
    function ($, ko, utils, reCaptchaHelper) {

        function initialise(element, valueAccessor) {
            var config = ko.utils.unwrapObservable(valueAccessor());

            reCaptchaHelper.init().done(function () {
                var id = 'captcha_' + utils.randomString(30);
                
                var $captchaContainer = $('<div id="' + id + '" />');
                
                $captchaContainer.on('mouseover', function() {
                    $(this).addClass('hover');
                }).on('mouseout', function() {
                    $(this).removeClass('hover');
                });

                var $target = $captchaContainer.prependTo($(element));
                
                var parameters = {
                    'sitekey': config.sitekey
                };

                if (config.invisible === true) {
                    parameters['size'] = 'invisible';
                }

                var captcha = reCaptchaHelper.render(id, parameters);

                if (config.setInstance instanceof Function) {
                    config.setInstance(captcha);
                }

                captcha.hasError.subscribe(function (newValue) {
                    var $element = $(element);
                    var $validationMessage = $element.find('.validation-error-message');

                    if (newValue) {
                        $element.addClass('validation-error');
                        $validationMessage.show();
                    } else {
                        $element.removeClass('validation-error');
                        $validationMessage.hide();
                    }
                });
            });
        }

        ko.bindingHandlers.recaptcha = {
            init: initialise
        };
    }
);
define('koBindingHandlers', [
    'jquery',
    'knockout',
    'uiEffectHelper',
    'devbridgeautocomplete',
    'jquerysticky',
    'mapHelper',
    //'slickcarousel',
    'utils',
    //'binding-handlers/carousel',
    //'binding-handlers/checkList',
    'binding-handlers/datepicker',
    //'binding-handlers/dynamicFiltering',
    'binding-handlers/fancySelect',
    'binding-handlers/mmenu',
    'binding-handlers/navbar',
    'binding-handlers/select2',
    'binding-handlers/tabs',
    'binding-handlers/timeList',
    //'binding-handlers/fileUpload',
    //'binding-handlers/complexClassToggle',
    //'binding-handlers/scrollablepane',
    //'binding-handlers/clamp',
    //'binding-handlers/infiniteScroll',
    'binding-handlers/inputFieldFocusFlag',
    'binding-handlers/truncateText',
    //'binding-handlers/side-sticky',
    //'binding-handlers/v-sticky',
    'binding-handlers/selectAutocomplete',
    'binding-handlers/tabbedQtt',
    //'binding-handlers/lightboxLity',
    //'binding-handlers/routeToService',
    //'binding-handlers/datetextfield',
    'binding-handlers/recaptcha'
],
    function (
    $,
    ko,
    uiEffectHelper,
    /*additional dependencies: */
    devbridgeautocomplete,
    jquerysticky,
    mapHelper,
    //slickcarousel,
    utils,
    //carousel,
    //checkList,
    datepicker,
    //dynamicFiltering,
    fancySelect,
    mmenu,
    navbar,
    select2,
    tabs,
    timeList,
    //fileUpload,
    //complexClassToggle,
    //scrollablepane,
    //clamp,
    //infiniteScroll,
    inputFieldFocusFlag,
    truncateText,
    //sidesticky,
    //vsticky,
    selectAutocomplete,
    tabbedQtt,
    //lightboxLity,
    //routeToService,
    //datetextfield,
    recaptcha
  ) {
        ko.bindingHandlers.toggleElement = {
            update: function (element, valueAccessor, allBindings) {
                var value = ko.utils.unwrapObservable(valueAccessor());
                uiEffectHelper.toggleElement(element, value);
            }
        };

        ko.bindingHandlers.accordion = {
            update: function (element, valueAccessor, allBindings) {
                var value = ko.utils.unwrapObservable(valueAccessor());
                uiEffectHelper.accordion(element, value);
            }
        };

        ko.bindingHandlers.scrollToElement = {
            update: function (element, valueAccessor, allBindings) {
                var value = ko.utils.unwrapObservable(valueAccessor());
                uiEffectHelper.scrollToElement(element, value);
            }
        };

        ko.bindingHandlers.fadeVisible = {
            init: function (element, valueAccessor) {
                // Initially set the element to be instantly visible/hidden depending on the value
                var options = valueAccessor();
                $(element).toggle(ko.unwrap(options.value)); // Use "unwrapObservable" so we can handle values that may or may not be observable
            },
            update: function (element, valueAccessor) {
                // Whenever the value subsequently changes, slowly fade the element in or out
                var options = valueAccessor();
                var duration = options.duration || 'slow';
                ko.unwrap(options.value) ? $(element).fadeIn(duration) : $(element).fadeOut(duration);
            }
        };

        ko.bindingHandlers.stopBinding = {
            init: function () {
                return { controlsDescendantBindings: true };
            }
        };
        ko.virtualElements.allowedBindings.stopBinding = true;

        ko.bindingHandlers.phoneNumber = {
            update: function (element, valueAccessor) {
                ko.bindingHandlers.tel.update(element, valueAccessor);
                ko.bindingHandlers.text.update(element, valueAccessor);
            }
        };

        ko.bindingHandlers.tel = {
            update: function (element, valueAccessor) {
                var phoneNumber = ko.utils.unwrapObservable(valueAccessor());
                ko.bindingHandlers.attr.update(element, function () {
                    return { href: 'tel:' + phoneNumber.replace(/\D/g, '') };
                });
            }
        };

        ko.bindingHandlers.autocomplete = {
            init: function (element, valueAccessor) {
                var settings = valueAccessor();

                if (settings.selectedValue && ko.isObservable(settings.selectedValue)) {
                    settings.onSelect = function (suggestion) {
                        $(element).data('has-autocomplete-selection', true);
                        settings.selectedValue(suggestion.value);
                    };

                    settings.onInvalidateSelection = function () {
                        $(element).data('has-autocomplete-selection', false);
                        settings.selectedValue('');
                    };

                    settings.onHide = function(container) {
                        if (!$(element).data('has-autocomplete-selection')) {
                            $(element).val('');
                            settings.selectedValue('');
                        }
                    }
                }

                $(element).devbridgeAutocomplete(ko.toJS(settings));
            }
        };

        ko.bindingHandlers.sticky = {
            init: function (element, valueAccessor) {
                var value = ko.utils.unwrapObservable(valueAccessor());
                $(element).sticky(value);
            }
        };

        ko.bindingHandlers.map = {
            init: function (element, valueAccessor) {
                var config = ko.utils.unwrapObservable(valueAccessor());

                mapHelper.init().done(function () {
                    mapHelper.showMap(element, config.latitude, config.longitude);
                });
            }
        };

        ko.bindingHandlers.blurOnEnter = {
            init: function (element) {
                ko.applyBindingsToNode(element, {
                    event: {
                        keyup: function (data, event) {
                            //if user hits enter, set editing to false, which makes field lose focus
                            if (event.keyCode === 13) {
                                element.blur(); //force the input to lose focus
                                return false;
                            }

                            return true;
                        }
                    }
                });
            }
        };

        ko.bindingHandlers.showAndScrollToView = {
            update: function (element, valueAccessor) {
                var defaultOptions = {
                    when: false,
                    offset: 100
                };

                var config = ko.utils.unwrapObservable(valueAccessor());
                var options = $.extend({}, defaultOptions, config);

                if (ko.utils.unwrapObservable(options.when) === true) {
                    $(element).show();
                    $('html, body').animate({
                        scrollTop: parseInt($(element).offset().top - options.offset)
                    }, 0);
                } else {
                    $(element).hide();
                }
            }
        };

        ko.bindingHandlers.altRouteFinder = {

             init : function () {

                  var iframe = document.getElementById('alt-route-finder-iframe');
                  if(iframe && iframe.addEventListener) { //  just a bit of overzealous error checking!
                    iframe.addEventListener('load', function () {
                        if (iframe.contentWindow) {
                            iframe.contentWindow.focus();
                        }
                    });
                  }
             }
        }


        ko.bindingHandlers.valueWithInit = {
            init: function (element, valueAccessor) {
                var observable = valueAccessor(),
                    value = element.value;

                //create the observable, if it doesn't exist
                if (!ko.isWriteableObservable(observable)) {
                    console.log("Not observable");
                    return;
                }

                observable(value);

                ko.applyBindingsToNode(element, { value: observable });
            }
        };
    });

define('qubitEnabler', ['jquery', 'knockout', 'utils'],
    function ($, ko, utils) {
        function loadQubit() {
            $(document).ready(function () {
                var script = document.createElement('script');
                script.type = 'text/javascript';
                script.src = 'https://static.goqubit.com/smartserve-5830.js';
                document.head.appendChild(script);
            });
        }
        var init = function (EnableQubit) {
            if (EnableQubit.toLowerCase() === "true") {
                utils.checkFunctionalCookieConsent(function (callback) {
                    if (callback != null) {
                        loadQubit();
                    }
                });
            }            
        }
        return {
            init: init
        };
});
/*!
 * jQuery Cookie Plugin v1.4.1
 * https://github.com/carhartl/jquery-cookie
 *
 * Copyright 2013 Klaus Hartl
 * Released under the MIT license
 */
(function (factory) {
	if (typeof define === 'function' && define.amd) {
		// AMD
		define('jquerycookie',['jquery'], factory);
	} else if (typeof exports === 'object') {
		// CommonJS
		factory(require('jquery'));
	} else {
		// Browser globals
		factory(jQuery);
	}
}(function ($) {

	var pluses = /\+/g;

	function encode(s) {
		return config.raw ? s : encodeURIComponent(s);
	}

	function decode(s) {
		return config.raw ? s : decodeURIComponent(s);
	}

	function stringifyCookieValue(value) {
		return encode(config.json ? JSON.stringify(value) : String(value));
	}

	function parseCookieValue(s) {
		if (s.indexOf('"') === 0) {
			// This is a quoted cookie as according to RFC2068, unescape...
			s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
		}

		try {
			// Replace server-side written pluses with spaces.
			// If we can't decode the cookie, ignore it, it's unusable.
			// If we can't parse the cookie, ignore it, it's unusable.
			s = decodeURIComponent(s.replace(pluses, ' '));
			return config.json ? JSON.parse(s) : s;
		} catch(e) {}
	}

	function read(s, converter) {
		var value = config.raw ? s : parseCookieValue(s);
		return $.isFunction(converter) ? converter(value) : value;
	}

	var config = $.cookie = function (key, value, options) {

		// Write

		if (value !== undefined && !$.isFunction(value)) {
			options = $.extend({}, config.defaults, options);

			if (typeof options.expires === 'number') {
				var days = options.expires, t = options.expires = new Date();
				t.setTime(+t + days * 864e+5);
			}

			return (document.cookie = [
				encode(key), '=', stringifyCookieValue(value),
				options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
				options.path    ? '; path=' + options.path : '',
				options.domain  ? '; domain=' + options.domain : '',
				options.secure  ? '; secure' : ''
			].join(''));
		}

		// Read

		var result = key ? undefined : {};

		// To prevent the for loop in the first place assign an empty array
		// in case there are no cookies at all. Also prevents odd result when
		// calling $.cookie().
		var cookies = document.cookie ? document.cookie.split('; ') : [];

		for (var i = 0, l = cookies.length; i < l; i++) {
			var parts = cookies[i].split('=');
			var name = decode(parts.shift());
			var cookie = parts.join('=');

			if (key && key === name) {
				// If second argument (value) is a function it's a converter...
				result = read(cookie, value);
				break;
			}

			// Prevent storing a cookie that we couldn't decode.
			if (!key && (cookie = read(cookie)) !== undefined) {
				result[name] = cookie;
			}
		}

		return result;
	};

	config.defaults = {};

	$.removeCookie = function (key, options) {
		if ($.cookie(key) === undefined) {
			return false;
		}

		// Must not alter options, thus extending a fresh object...
		$.cookie(key, '', $.extend({}, options, { expires: -1 }));
		return !$.cookie(key);
	};

}));

define('integrationRoutingService', ['context', 'utils', 'browserHelper', 'jquery', 'jquerycookie'],
    function (context, utils, browserHelper, $) {

        var serviceTypes = {
            myaccount: 'myaccount'
        };

        var isWithinThreshold = function (cookieName, threshold) {
            if (!$.cookie(cookieName)) {
                $.cookie(cookieName, Math.round(Math.random() * (10000 - 1) + 1) / 100, { expires: 365, path: '/' });
            }

            return $.cookie(cookieName) <= Math.max(0, threshold);
        };       

        var isWithinIntegratedServicesThreshold = function () {                       
            if (!browserHelper.supportsWebComponents()) {
                return false;
            }

            return isWithinThreshold('userJourney-integration', context.environment.integratedServicesThreshold);
        };

        var isWithinMixingDeckThreshold = function () {
            // Send to WebTis in case web components are not supported or visit is from a mobile device
            if (!browserHelper.supportsWebComponents() || browserHelper.isMobile()) {
                return false;
            }

            return isWithinThreshold('mixingDeck', context.environment.booking.mdThreshold);
        };

        var getServiceUrl = function (serviceType) {

            var targetUrl = '';
            switch (serviceType) {

                case serviceTypes.myaccount:

                    targetUrl = context.environment.webtisMyAccountUrl;
                    // TODO: Uncomment the below once ORM MyAccount is released for SWR
                    //if (isWithinIntegratedServicesThreshold()) {
                    //    targetUrl = '/myaccount';
                    //}
                    
                    break;
                default:
                    console.log('Routing for service type "' + serviceType + '" is not supported');
                    break;
            }

            return targetUrl;
        };

        return {                        
            isWithinIntegratedServicesThreshold: isWithinIntegratedServicesThreshold,
            isWithinMixingDeckThreshold: isWithinMixingDeckThreshold,
            getServiceUrl: getServiceUrl
        };
    });
define('viewmodels/SkipNavigation', ['jquery','context','integrationRoutingService','jquerycookie'],
    function ($, context, integrationRoutingService) {
        var init = function () {
            bindEvents();
        };

        var bindEvents = function () {
            $(document).ready(function () {
                $(".skipNavigation").click(function (event) {
                    var skipTo = "#" + this.href.split('#')[1];
                    $(skipTo).attr('tabindex', -1).on('blur focusout', function () {
                        $(this).removeAttr('tabindex');
                    }).focus();
                });
            });
        };
        return {
            init: init
        }
});

define('models/liveDeparturesCriteria', ['knockout', 'validationHelper'],
    function (ko, validationHelper) {
        return function () {
            var self = this;

            self.stationName = ko.observable().extend({ required: { params: true, message: 'Please enter a station on Avanti Westcoast network to continue' } });

            // Validation check!!
            self.isValid = function () {
                return validationHelper.validate(self, { deep: true });
            };
        };
    });

/*!
 * Knockout Mapping plugin v2.5.0
 * (c) 2013 Steven Sanderson, Roy Jacobs - http://knockoutjs.com/
 * License: MIT (http://www.opensource.org/licenses/mit-license.php)
 */
(function(factory) {
    'use strict';

    /*jshint sub:true,curly:false*/
    /*global ko,require,exports,define,module*/

    if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
        // CommonJS or Node: hard-coded dependency on "knockout"
        factory(require("knockout"), exports);
    }
    else if (typeof define === "function" && define["amd"]) {
        // AMD anonymous module with hard-coded dependency on "knockout"
        define('bowerknockoutmapping',["knockout", "exports"], factory);
    }
    else {
        // <script> tag: use the global `ko` object, attaching a `mapping` property
        if (typeof ko === 'undefined') {
            throw new Error('Knockout is required, please ensure it is loaded before loading this mapping plug-in');
        }
        factory(ko, ko.mapping = {});
    }
}(function(ko, exports) {
    /*jshint sub:true,curly:false*/
    'use strict';

    ko.mapping = exports;

    var DEBUG=true;
    var mappingProperty = "__ko_mapping__";
    var realKoDependentObservable = ko.dependentObservable;
    var mappingNesting = 0;
    var dependentObservables;
    var visitedObjects;
    var recognizedRootProperties = ["create", "update", "key", "arrayChanged"];
    var emptyReturn = {};

    var _defaultOptions = {
        include: ["_destroy"],
        ignore: [],
        copy: [],
        observe: []
    };
    var defaultOptions = _defaultOptions;

    function unionArrays() {
        var args = arguments,
            l = args.length,
            obj = {},
            res = [],
            i, j, k;

        while (l--) {
            k = args[l];
            i = k.length;

            while (i--) {
                j = k[i];
                if (!obj[j]) {
                    obj[j] = 1;
                    res.push(j);
                }
            }
        }

        return res;
    }

    function extendObject(destination, source) {
        var destType;

        for (var key in source) {
            if (source.hasOwnProperty(key) && source[key]) {
                destType = exports.getType(destination[key]);
                if (key && destination[key] && destType !== "array" && destType !== "string") {
                    extendObject(destination[key], source[key]);
                }
                else {
                    var bothArrays = exports.getType(destination[key]) === "array" && exports.getType(source[key]) === "array";
                    if (bothArrays) {
                        destination[key] = unionArrays(destination[key], source[key]);
                    }
                    else {
                        destination[key] = source[key];
                    }
                }
            }
        }
    }

    function merge(obj1, obj2) {
        var merged = {};
        extendObject(merged, obj1);
        extendObject(merged, obj2);

        return merged;
    }

    exports.isMapped = function(viewModel) {
        var unwrapped = ko.utils.unwrapObservable(viewModel);
        return unwrapped && unwrapped[mappingProperty];
    };

    exports.fromJS = function(jsObject /*, inputOptions, target*/) {
        if (arguments.length === 0) {
            throw new Error("When calling ko.fromJS, pass the object you want to convert.");
        }
        try {
            if (!mappingNesting) {
                dependentObservables = [];
                visitedObjects = new ObjectLookup();
            }
            mappingNesting++;

            var options;
            var target;

            if (arguments.length === 2) {
                if (arguments[1][mappingProperty]) {
                    target = arguments[1];
                }
                else {
                    options = arguments[1];
                }
            }
            if (arguments.length === 3) {
                options = arguments[1];
                target = arguments[2];
            }

            if (target) {
                options = merge(options, target[mappingProperty]);
            }
            options = fillOptions(options);

            var result = updateViewModel(target, jsObject, options);
            if (target) {
                result = target;
            }

            // Evaluate any dependent observables that were proxied.
            // Do this after the model's observables have been created
            if (!--mappingNesting) {
                while (dependentObservables.length) {
                    var DO = dependentObservables.pop();
                    if (DO) {
                        DO();
                        // Move this magic property to the underlying dependent observable
                        DO.__DO["throttleEvaluation"] = DO["throttleEvaluation"];
                    }
                }
            }

            // Save any new mapping options in the view model, so that updateFromJS can use them later.
            result[mappingProperty] = merge(result[mappingProperty], options);

            return result;
        }
        catch (e) {
            mappingNesting = 0;
            throw e;
        }
    };

    exports.fromJSON = function(jsonString /*, options, target*/) {
        var args = Array.prototype.slice.call(arguments, 0);
        args[0] = ko.utils.parseJson(jsonString);
        return exports.fromJS.apply(this, args);
    };

    exports.toJS = function(rootObject, options) {
        if (!defaultOptions) exports.resetDefaultOptions();

        if (arguments.length === 0) throw new Error("When calling ko.mapping.toJS, pass the object you want to convert.");
        if (exports.getType(defaultOptions.ignore) !== "array") throw new Error("ko.mapping.defaultOptions().ignore should be an array.");
        if (exports.getType(defaultOptions.include) !== "array") throw new Error("ko.mapping.defaultOptions().include should be an array.");
        if (exports.getType(defaultOptions.copy) !== "array") throw new Error("ko.mapping.defaultOptions().copy should be an array.");

        // Merge in the options used in fromJS
        options = fillOptions(options, rootObject[mappingProperty]);

        // We just unwrap everything at every level in the object graph
        return exports.visitModel(rootObject, function(x) {
            return ko.utils.unwrapObservable(x);
        }, options);
    };

    exports.toJSON = function(rootObject, options) {
        var plainJavaScriptObject = exports.toJS(rootObject, options);
        return ko.utils.stringifyJson(plainJavaScriptObject);
    };

    exports.defaultOptions = function() {
        if (arguments.length > 0) {
            defaultOptions = arguments[0];
        }
        else {
            return defaultOptions;
        }
    };

    exports.resetDefaultOptions = function() {
        defaultOptions = {
            include: _defaultOptions.include.slice(0),
            ignore: _defaultOptions.ignore.slice(0),
            copy: _defaultOptions.copy.slice(0),
            observe: _defaultOptions.observe.slice(0)
        };
    };

    exports.getType = function(x) {
        if ((x) && (typeof (x) === "object")) {
            if (x.constructor === Date) return "date";
            if (x.constructor === Array) return "array";
        }
        return typeof x;
    };

    function fillOptions(rawOptions, otherOptions) {
        var options = merge({}, rawOptions);

        // Move recognized root-level properties into a root namespace
        for (var i = recognizedRootProperties.length - 1; i >= 0; i--) {
            var property = recognizedRootProperties[i];

            // Carry on, unless this property is present
            if (!options[property]) continue;

            // Move the property into the root namespace
            if (!(options[""] instanceof Object)) options[""] = {};
            options[""][property] = options[property];
            delete options[property];
        }

        if (otherOptions) {
            options.ignore = mergeArrays(otherOptions.ignore, options.ignore);
            options.include = mergeArrays(otherOptions.include, options.include);
            options.copy = mergeArrays(otherOptions.copy, options.copy);
            options.observe = mergeArrays(otherOptions.observe, options.observe);
        }
        options.ignore = mergeArrays(options.ignore, defaultOptions.ignore);
        options.include = mergeArrays(options.include, defaultOptions.include);
        options.copy = mergeArrays(options.copy, defaultOptions.copy);
        options.observe = mergeArrays(options.observe, defaultOptions.observe);

        options.mappedProperties = options.mappedProperties || {};
        options.copiedProperties = options.copiedProperties || {};
        return options;
    }

    function mergeArrays(a, b) {
        if (exports.getType(a) !== "array") {
            if (exports.getType(a) === "undefined") a = [];
            else a = [a];
        }
        if (exports.getType(b) !== "array") {
            if (exports.getType(b) === "undefined") b = [];
            else b = [b];
        }

        return ko.utils.arrayGetDistinctValues(a.concat(b));
    }

    // When using a 'create' callback, we proxy the dependent observable so that it doesn't immediately evaluate on creation.
    // The reason is that the dependent observables in the user-specified callback may contain references to properties that have not been mapped yet.
    function withProxyDependentObservable(dependentObservables, callback) {
        var localDO = ko.dependentObservable;
        ko.dependentObservable = function(read, owner, options) {
            options = options || {};

            if (read && typeof read === "object") { // mirrors condition in knockout implementation of DO's
                options = read;
            }

            var realDeferEvaluation = options.deferEvaluation;

            var isRemoved = false;

            // We wrap the original dependent observable so that we can remove it from the 'dependentObservables' list we need to evaluate after mapping has
            // completed if the user already evaluated the DO themselves in the meantime.
            var wrap = function(DO) {
                // Temporarily revert ko.dependentObservable, since it is used in ko.isWriteableObservable
                var tmp = ko.dependentObservable;
                ko.dependentObservable = realKoDependentObservable;
                var isWriteable = ko.isWriteableObservable(DO);
                ko.dependentObservable = tmp;

                var wrapped = realKoDependentObservable({
                    read: function() {
                        if (!isRemoved) {
                            ko.utils.arrayRemoveItem(dependentObservables, DO);
                            isRemoved = true;
                        }
                        return DO.apply(DO, arguments);
                    },
                    write: isWriteable && function(val) {
                        return DO(val);
                    },
                    deferEvaluation: true
                });
                if (DEBUG) wrapped._wrapper = true;
                wrapped.__DO = DO;
                return wrapped;
            };

            options.deferEvaluation = true; // will either set for just options, or both read/options.
            var realDependentObservable = realKoDependentObservable(read, owner, options);

            if (!realDeferEvaluation) {
                realDependentObservable = wrap(realDependentObservable);
                dependentObservables.push(realDependentObservable);
            }

            return realDependentObservable;
        };
        ko.dependentObservable.fn = realKoDependentObservable.fn;
        ko.computed = ko.dependentObservable;
        var result = callback();
        ko.dependentObservable = localDO;
        ko.computed = ko.dependentObservable;
        return result;
    }

    function updateViewModel(mappedRootObject, rootObject, options, parentName, parent, parentPropertyName, mappedParent) {
        var isArray = exports.getType(ko.utils.unwrapObservable(rootObject)) === "array";

        parentPropertyName = parentPropertyName || "";

        // If this object was already mapped previously, take the options from there and merge them with our existing ones.
        if (exports.isMapped(mappedRootObject)) {
            var previousMapping = ko.utils.unwrapObservable(mappedRootObject)[mappingProperty];
            options = merge(previousMapping, options);
        }

        var callbackParams = {
            data: rootObject,
            parent: mappedParent || parent
        };

        var hasCreateCallback = function() {
            return options[parentName] && options[parentName].create instanceof Function;
        };

        var createCallback = function(data) {
            return withProxyDependentObservable(dependentObservables, function() {

                if (ko.utils.unwrapObservable(parent) instanceof Array) {
                    return options[parentName].create({
                        data: data || callbackParams.data,
                        parent: callbackParams.parent,
                        skip: emptyReturn
                    });
                }
                else {
                    return options[parentName].create({
                        data: data || callbackParams.data,
                        parent: callbackParams.parent
                    });
                }
            });
        };

        var hasUpdateCallback = function() {
            return options[parentName] && options[parentName].update instanceof Function;
        };

        var updateCallback = function(obj, data) {
            var params = {
                data: data || callbackParams.data,
                parent: callbackParams.parent,
                target: ko.utils.unwrapObservable(obj)
            };

            if (ko.isWriteableObservable(obj)) {
                params.observable = obj;
            }

            return options[parentName].update(params);
        };

        var alreadyMapped = visitedObjects.get(rootObject);
        if (alreadyMapped) {
            return alreadyMapped;
        }

        parentName = parentName || "";

        if (!isArray) {
            // For atomic types, do a direct update on the observable
            if (!canHaveProperties(rootObject)) {
                switch (exports.getType(rootObject)) {
                    case "function":
                        if (hasUpdateCallback()) {
                            if (ko.isWriteableObservable(rootObject)) {
                                rootObject(updateCallback(rootObject));
                                mappedRootObject = rootObject;
                            }
                            else {
                                mappedRootObject = updateCallback(rootObject);
                            }
                        }
                        else {
                            mappedRootObject = rootObject;
                        }
                        break;
                    default:
                        if (ko.isWriteableObservable(mappedRootObject)) {
                            var valueToWrite;
                            if (hasUpdateCallback()) {
                                valueToWrite = updateCallback(mappedRootObject);
                                mappedRootObject(valueToWrite);
                                return valueToWrite;
                            }
                            else {
                                valueToWrite = ko.utils.unwrapObservable(rootObject);
                                mappedRootObject(valueToWrite);
                                return valueToWrite;
                            }
                        }
                        else {
                            var hasCreateOrUpdateCallback = hasCreateCallback() || hasUpdateCallback();

                            if (hasCreateCallback()) {
                                mappedRootObject = createCallback();
                            }
                            else {
                                mappedRootObject = ko.observable(ko.utils.unwrapObservable(rootObject));
                            }

                            if (hasUpdateCallback()) {
                                mappedRootObject(updateCallback(mappedRootObject));
                            }

                            if (hasCreateOrUpdateCallback) return mappedRootObject;
                        }
                }

            }
            else {
                mappedRootObject = ko.utils.unwrapObservable(mappedRootObject);
                if (!mappedRootObject) {
                    if (hasCreateCallback()) {
                        var result = createCallback();

                        if (hasUpdateCallback()) {
                            result = updateCallback(result);
                        }
                        return result;
                    }
                    else {
                        if (hasUpdateCallback()) {
                            //Removed ambiguous parameter result
                            return updateCallback();
                        }
                        mappedRootObject = {};
                    }
                }

                if (hasUpdateCallback()) {
                    mappedRootObject = updateCallback(mappedRootObject);
                }

                visitedObjects.save(rootObject, mappedRootObject);
                if (hasUpdateCallback()) return mappedRootObject;

                // For non-atomic types, visit all properties and update recursively
                visitPropertiesOrArrayEntries(rootObject, function(indexer) {
                    var fullPropertyName = parentPropertyName.length ? parentPropertyName + "." + indexer : indexer;

                    if (ko.utils.arrayIndexOf(options.ignore, fullPropertyName) !== -1) {
                        return;
                    }

                    if (ko.utils.arrayIndexOf(options.copy, fullPropertyName) !== -1) {
                        mappedRootObject[indexer] = rootObject[indexer];
                        return;
                    }

                    if (typeof rootObject[indexer] !== "object" && exports.getType(rootObject[indexer]) !== "array" && options.observe.length > 0 && ko.utils.arrayIndexOf(options.observe, fullPropertyName) === -1) {
                        mappedRootObject[indexer] = rootObject[indexer];
                        options.copiedProperties[fullPropertyName] = true;
                        return;
                    }

                    // In case we are adding an already mapped property, fill it with the previously mapped property value to prevent recursion.
                    // If this is a property that was generated by fromJS, we should use the options specified there
                    var prevMappedProperty = visitedObjects.get(rootObject[indexer]);
                    var retval = updateViewModel(mappedRootObject[indexer], rootObject[indexer], options, indexer, mappedRootObject, fullPropertyName, mappedRootObject);
                    var value = prevMappedProperty || retval;

                    if (options.observe.length > 0 && ko.utils.arrayIndexOf(options.observe, fullPropertyName) === -1) {
                        mappedRootObject[indexer] = ko.utils.unwrapObservable(value);
                        options.copiedProperties[fullPropertyName] = true;
                        return;
                    }

                    if (ko.isWriteableObservable(mappedRootObject[indexer])) {
                        value = ko.utils.unwrapObservable(value);
                        if (mappedRootObject[indexer]() !== value) {
                            mappedRootObject[indexer](value);
                        }
                    }
                    else {
                        value = mappedRootObject[indexer] === undefined ? value : ko.utils.unwrapObservable(value);
                        mappedRootObject[indexer] = value;
                    }

                    options.mappedProperties[fullPropertyName] = true;
                });
            }
        }
        else { //mappedRootObject is an array
            var changes = [];

            var hasKeyCallback = false;
            var keyCallback = function(x) {
                return x;
            };
            if (options[parentName] && options[parentName].key) {
                keyCallback = options[parentName].key;
                hasKeyCallback = true;
            }

            if (!ko.isObservable(mappedRootObject)) {
                // When creating the new observable array, also add a bunch of utility functions that take the 'key' of the array items into account.
                mappedRootObject = ko.observableArray([]);

                mappedRootObject.mappedRemove = function(valueOrPredicate) {
                    var predicate = typeof valueOrPredicate === "function" ? valueOrPredicate : function(value) {
                        return value === keyCallback(valueOrPredicate);
                    };
                    return mappedRootObject.remove(function(item) {
                        return predicate(keyCallback(item));
                    });
                };

                mappedRootObject.mappedRemoveAll = function(arrayOfValues) {
                    var arrayOfKeys = filterArrayByKey(arrayOfValues, keyCallback);
                    return mappedRootObject.remove(function(item) {
                        return ko.utils.arrayIndexOf(arrayOfKeys, keyCallback(item)) !== -1;
                    });
                };

                mappedRootObject.mappedDestroy = function(valueOrPredicate) {
                    var predicate = typeof valueOrPredicate === "function" ? valueOrPredicate : function(value) {
                        return value === keyCallback(valueOrPredicate);
                    };
                    return mappedRootObject.destroy(function(item) {
                        return predicate(keyCallback(item));
                    });
                };

                mappedRootObject.mappedDestroyAll = function(arrayOfValues) {
                    var arrayOfKeys = filterArrayByKey(arrayOfValues, keyCallback);
                    return mappedRootObject.destroy(function(item) {
                        return ko.utils.arrayIndexOf(arrayOfKeys, keyCallback(item)) !== -1;
                    });
                };

                mappedRootObject.mappedIndexOf = function(item) {
                    var keys = filterArrayByKey(mappedRootObject(), keyCallback);
                    var key = keyCallback(item);
                    return ko.utils.arrayIndexOf(keys, key);
                };

                mappedRootObject.mappedGet = function(item) {
                    return mappedRootObject()[mappedRootObject.mappedIndexOf(item)];
                };

                mappedRootObject.mappedCreate = function(value) {
                    if (mappedRootObject.mappedIndexOf(value) !== -1) {
                        throw new Error("There already is an object with the key that you specified.");
                    }
                    var item = hasCreateCallback() ? createCallback(value) : value;
                    if (hasUpdateCallback()) {
                        var newValue = updateCallback(item, value);
                        if (ko.isWriteableObservable(item)) {
                            item(newValue);
                        }
                        else {
                            item = newValue;
                        }
                    }
                    mappedRootObject.push(item);
                    return item;
                };
            }

            var currentArrayKeys = filterArrayByKey(ko.utils.unwrapObservable(mappedRootObject), keyCallback).sort();
            var newArrayKeys = filterArrayByKey(rootObject, keyCallback);
            if (hasKeyCallback) newArrayKeys.sort();
            var editScript = ko.utils.compareArrays(currentArrayKeys, newArrayKeys);

            var ignoreIndexOf = {};

            var i, j, key;

            var unwrappedRootObject = ko.utils.unwrapObservable(rootObject);
            var itemsByKey = {};
            var optimizedKeys = true;
            for (i = 0, j = unwrappedRootObject.length; i < j; i++) {
                key = keyCallback(unwrappedRootObject[i]);
                if (key === undefined || key instanceof Object) {
                    optimizedKeys = false;
                    break;
                }
                itemsByKey[key] = unwrappedRootObject[i];
            }

            var newContents = [];
            var passedOver = 0;
            var item, index;

            for (i = 0, j = editScript.length; i < j; i++) {
                key = editScript[i];
                var mappedItem;
                var fullPropertyName = parentPropertyName + "[" + i + "]";
                switch (key.status) {
                    case "added":
                        item = optimizedKeys ? itemsByKey[key.value] : getItemByKey(ko.utils.unwrapObservable(rootObject), key.value, keyCallback);
                        mappedItem = updateViewModel(undefined, item, options, parentName, mappedRootObject, fullPropertyName, parent);
                        if (!hasCreateCallback()) {
                            mappedItem = ko.utils.unwrapObservable(mappedItem);
                        }

                        index = ignorableIndexOf(ko.utils.unwrapObservable(rootObject), item, ignoreIndexOf);

                        if (mappedItem === emptyReturn) {
                            passedOver++;
                        }
                        else {
                            newContents[index - passedOver] = mappedItem;
                        }

                        ignoreIndexOf[index] = true;
                        break;
                    case "retained":
                        item = optimizedKeys ? itemsByKey[key.value] : getItemByKey(ko.utils.unwrapObservable(rootObject), key.value, keyCallback);
                        mappedItem = getItemByKey(mappedRootObject, key.value, keyCallback);
                        updateViewModel(mappedItem, item, options, parentName, mappedRootObject, fullPropertyName, parent);

                        index = ignorableIndexOf(ko.utils.unwrapObservable(rootObject), item, ignoreIndexOf);
                        newContents[index] = mappedItem;
                        ignoreIndexOf[index] = true;
                        break;
                    case "deleted":
                        mappedItem = getItemByKey(mappedRootObject, key.value, keyCallback);
                        break;
                }

                changes.push({
                    event: key.status,
                    item: mappedItem
                });
            }

            mappedRootObject(newContents);

            if (options[parentName] && options[parentName].arrayChanged) {
                ko.utils.arrayForEach(changes, function(change) {
                    options[parentName].arrayChanged(change.event, change.item);
                });
            }
        }

        return mappedRootObject;
    }

    function ignorableIndexOf(array, item, ignoreIndices) {
        for (var i = 0, j = array.length; i < j; i++) {
            if (ignoreIndices[i] === true) continue;
            if (array[i] === item) return i;
        }
        return null;
    }

    function mapKey(item, callback) {
        var mappedItem;
        if (callback) mappedItem = callback(item);
        if (exports.getType(mappedItem) === "undefined") mappedItem = item;

        return ko.utils.unwrapObservable(mappedItem);
    }

    function getItemByKey(array, key, callback) {
        array = ko.utils.unwrapObservable(array);
        for (var i = 0, j = array.length; i < j; i++) {
            var item = array[i];
            if (mapKey(item, callback) === key) return item;
        }

        throw new Error("When calling ko.update*, the key '" + key + "' was not found!");
    }

    function filterArrayByKey(array, callback) {
        return ko.utils.arrayMap(ko.utils.unwrapObservable(array), function(item) {
            if (callback) {
                return mapKey(item, callback);
            }
            else {
                return item;
            }
        });
    }

    function visitPropertiesOrArrayEntries(rootObject, visitorCallback) {
        if (exports.getType(rootObject) === "array") {
            for (var i = 0; i < rootObject.length; i++)
                visitorCallback(i);
        }
        else {
            for (var propertyName in rootObject) {
                if (rootObject.hasOwnProperty(propertyName)) {
                    visitorCallback(propertyName);
                }
            }
        }
    }

    function canHaveProperties(object) {
        var type = exports.getType(object);
        return ((type === "object") || (type === "array")) && (object !== null);
    }

    // Based on the parentName, this creates a fully classified name of a property

    function getPropertyName(parentName, parent, indexer) {
        var propertyName = parentName || "";
        if (exports.getType(parent) === "array") {
            if (parentName) {
                propertyName += "[" + indexer + "]";
            }
        }
        else {
            if (parentName) {
                propertyName += ".";
            }
            propertyName += indexer;
        }
        return propertyName;
    }

    exports.visitModel = function(rootObject, callback, options) {
        options = options || {};
        options.visitedObjects = options.visitedObjects || new ObjectLookup();

        var mappedRootObject;
        var unwrappedRootObject = ko.utils.unwrapObservable(rootObject);

        if (!canHaveProperties(unwrappedRootObject)) {
            return callback(rootObject, options.parentName);
        }
        else {
            options = fillOptions(options, unwrappedRootObject[mappingProperty]);

            // Only do a callback, but ignore the results
            callback(rootObject, options.parentName);
            mappedRootObject = exports.getType(unwrappedRootObject) === "array" ? [] : {};
        }

        options.visitedObjects.save(rootObject, mappedRootObject);

        var parentName = options.parentName;
        visitPropertiesOrArrayEntries(unwrappedRootObject, function(indexer) {
            if (options.ignore && ko.utils.arrayIndexOf(options.ignore, indexer) !== -1) return;

            var propertyValue = unwrappedRootObject[indexer];
            options.parentName = getPropertyName(parentName, unwrappedRootObject, indexer);

            // If we don't want to explicitly copy the unmapped property...
            if (ko.utils.arrayIndexOf(options.copy, indexer) === -1) {
                // ...find out if it's a property we want to explicitly include
                if (ko.utils.arrayIndexOf(options.include, indexer) === -1) {
                    // The mapped properties object contains all the properties that were part of the original object.
                    // If a property does not exist, and it is not because it is part of an array (e.g. "myProp[3]"), then it should not be unmapped.
                    if (unwrappedRootObject[mappingProperty] &&
                        unwrappedRootObject[mappingProperty].mappedProperties && !unwrappedRootObject[mappingProperty].mappedProperties[indexer] &&
                        unwrappedRootObject[mappingProperty].copiedProperties && !unwrappedRootObject[mappingProperty].copiedProperties[indexer] && (exports.getType(unwrappedRootObject) !== "array")) {
                        return;
                    }
                }
            }

            switch (exports.getType(ko.utils.unwrapObservable(propertyValue))) {
                case "object":
                case "array":
                case "undefined":
                    var previouslyMappedValue = options.visitedObjects.get(propertyValue);
                    mappedRootObject[indexer] = (exports.getType(previouslyMappedValue) !== "undefined") ? previouslyMappedValue : exports.visitModel(propertyValue, callback, options);
                    break;
                default:
                    mappedRootObject[indexer] = callback(propertyValue, options.parentName);
            }
        });

        return mappedRootObject;
    };

    function SimpleObjectLookup() {
        var keys = [];
        var values = [];
        this.save = function(key, value) {
            var existingIndex = ko.utils.arrayIndexOf(keys, key);
            if (existingIndex >= 0) values[existingIndex] = value;
            else {
                keys.push(key);
                values.push(value);
            }
        };
        this.get = function(key) {
            var existingIndex = ko.utils.arrayIndexOf(keys, key);
            var value = (existingIndex >= 0) ? values[existingIndex] : undefined;
            return value;
        };
    }

    function ObjectLookup() {
        var buckets = {};

        var findBucket = function(key) {
            var bucketKey;
            try {
                bucketKey = key;//JSON.stringify(key);
            }
            catch (e) {
                bucketKey = "$$$";
            }

            var bucket = buckets[bucketKey];
            if (bucket === undefined) {
                bucket = new SimpleObjectLookup();
                buckets[bucketKey] = bucket;
            }
            return bucket;
        };

        this.save = function(key, value) {
            findBucket(key).save(key, value);
        };
        this.get = function(key) {
            return findBucket(key).get(key);
        };
    }
}));

(function ($) {
	// encapsulate variables that need only be defined once
	var pl = /\+/g,  // Regex for replacing addition symbol with a space
		searchStrict = /([^&=]+)=+([^&]*)/g,
		searchTolerant = /([^&=]+)=?([^&]*)/g,
		decode = function (s) {
			return decodeURIComponent(s.replace(pl, " "));
		};
	
	// parses a query string. by default, will only match good k/v pairs.
	// if the tolerant option is truthy, then it will also set keys without values to ''
	$.parseQuery = function(query, options) {
		var match,
			o = {},
			opts = options || {},
			search = opts.tolerant ? searchTolerant : searchStrict;
		
		if ('?' === query.substring(0, 1)) {
			query  = query.substring(1);
		}
		
		// each match is a query parameter, add them to the object
		while (match = search.exec(query)) {
			o[decode(match[1])] = decode(match[2]);
		}
		
		return o;
	}
	
	// parse this URLs query string
	$.getQuery = function(options) {
		return $.parseQuery(window.location.search, options);
	}

    $.fn.parseQuery = function (options) {
        return $.parseQuery($(this).serialize(), options);
    };
}(jQuery));
define("jquery.queryParser", ["jquery"], (function (global) {
    return function () {
        var ret, fn;
        return ret || global.$;
    };
}(this)));

define('queryStringHelper', ['jquery', 'jquery.queryParser'],
    function ($) {
        
        var getParsedQueryString = function (href) {
            var queryStringStartPosition = href.indexOf('?');
            var hasQueryString = queryStringStartPosition > -1;
            var queryString = hasQueryString ? href.substring(queryStringStartPosition) : '';
            return $.parseQuery(queryString);
        };
        
        var setValue = function (key, value, url) {
            var queryString;
            
            if (!url) {
                url = $(location).attr('href');
                queryString = $.getQuery();
            }
            else queryString = getParsedQueryString(url);
            
            var queryStringStartIndex = url.indexOf('?');
            var hasQueryString = queryStringStartIndex > -1;

            queryString[key] = value;

            var updatedQueryString = '?' + $.param(queryString);

            return hasQueryString === true ? url.substring(0, queryStringStartIndex).concat(updatedQueryString) : url.concat(updatedQueryString);
        };

        var getValue = function(key) {
            var queryString = $.getQuery();

            return queryString[key];
        };        

        return {            
            setValue: setValue,
            getValue: getValue,
            getQuery: $.getQuery
        };
    });
define('models/journeyCheckCriteria', ['knockout', 'validationHelper'],
    function (ko, validationHelper) {
        return function () {
            var self = this;

            self.departureStation = ko.observable().extend({ 
                required: { params: true, message: 'Please enter a valid station name' }
            });
            self.arrivalStation = ko.observable().extend({ 
                required: { params: true, message: 'Please enter a valid station name' },
                differentThan: { params: self.departureStation, message: 'Destination and origin have to be different' }
            });

            self.departureDate = ko.observable().extend({ required: true, futureDate: true, noMoreThan3Months: true });
            self.departureType = ko.observable().extend({ required: true });

            self.isValid = function () {
                return validationHelper.validate(self, { deep: true });
            };
        };
    });
define('models/ticketSearchCriteria', ['knockout', 'validationHelper'],
    function (ko, validationHelper) {
        return function () {
            var self = this;

            self.departureStation = ko.observable().extend({
                required: { params: true, message: 'Please enter a valid station name' }
            });
            self.arrivalStation = ko.observable().extend({
                required: { params: true, message: 'Please enter a valid station name' },
                crsDifferentThan: { params: self.departureStation, message: 'Destination and origin have to be different' }
            });

            self.departureDate = ko.observable().extend({ required: true, futureDate: true, noMoreThan3Months: true });
            self.departureType = ko.observable().extend({ required: true });
            self.isPopularArrival = ko.observable(false);
            self.isPopularDeparture = ko.observable(false);
            self.isReturnJourney = ko.observable();
            self.isOpenReturn = ko.observable();
			
			self.isSingleReturn = ko.observable(true);
			self.isSeasionTicket = ko.observable(false);
			self.isFlexi = ko.observable(false);

            self.journeySelection = ko.observable();
			self.journeySelectionType = ko.observable();
			self.journeySelectionTypeText = ko.observable();
			self.seasonTicketRailcards = ko.observable('');

            self.returnDate = ko.observable().extend({
                required: {
                    onlyIf: function () {
                        return (self.isReturnJourney() === true && !self.isOpenReturn());
                    }
                },
                dateLaterThan: {
                    onlyIf: function () {
                        return (self.isReturnJourney() === true && !self.isOpenReturn());
                    },
                    params: self.departureDate, message: 'Return must take place after outbound journey'
                },
                noMoreThan3Months: {
                    onlyIf: function () {
                        return (self.isReturnJourney() === true && !self.isOpenReturn());
                    }
                }
            });
            self.returnType = ko.observable().extend({
                required: {
                    onlyIf: function () {
                        return (self.isReturnJourney() === true && !self.isOpenReturn());
                    }
                }
            });

            self.numberOfAdults = ko.observable(1);
            //self.numberOfAdultsreturn = ko.observable(1);
            //self.numberOfAdultsopenreturn = ko.observable(1);

            self.promocode = ko.observable('');
            self.numberOfChildren = ko.observable(0);
            //self.numberOfChildrenreturn = ko.observable(0);
            //self.numberOfChildrenopenreturn = ko.observable(0);

            self.viaAvoidType = ko.observable();
            self.viaAvoidTypes = { Via: 'vnlc', Avoid: 'nvnlc' };

            self.viaAvoidStation = ko.observable().extend({
                crsDifferentThan: { params: [ self.departureStation, self.arrivalStation ], message: 'This station can not be the same as departure or arrival station' },
            });

            self.railcard = ko.observable();
            self.railcardQuantity = ko.observable(0).extend({
                min: {
                    params: 1,
                    onlyIf: function () {
                        return self.railcard() && self.railcard().length > 0;
                    },
                    message: 'Please select number of railcards'
                },
                maxAggregatedSum: {
                    params: [self.numberOfAdults, self.numberOfChildren],
                    onlyIf: function () {
                        return self.railcard() && self.railcard().length > 0;
                    },
                    message: 'Number of railcards cannot be more than number of passengers.'
                }
            });

            self.isValid = function () {
                return validationHelper.validate(self, { deep: true });
            };
			
			self.isMonthlySeason =  ko.observable(true); 
			self.isWeeklySeason =  ko.observable(true); 
			self.isAnnulaySeason =  ko.observable(true); 
			self.isCustomSeason =  ko.observable(false);
	        self.flexiPassengerType = ko.observable().extend({ required: true });
			self.startDate = ko.observable().extend({ required: true, futureDate: true, noMoreThan15Days: true });
			self.endMinDate = ko.observable();
					
			
            self.endDate = ko.observable().extend({
                required: {
                    onlyIf: function () {
                        return (self.isCustomSeason() === true );
                    },
					
                },
				
                dateLaterThan: {
                    onlyIf: function () {
                        return (self.isCustomSeason() === true );
                    },
                    params: self.startDate, message: 'Start date must be less than End Date.'
                },
                noMoreThan3Months: {
                    onlyIf: function () {
                        return (self.isCustomSeason() === true);
                    }
                }
				
            });
        };
				
    });

define('mapper', ['jquery', 'knockout', 'bowerknockoutmapping', 'context', 'queryStringHelper', 'dateUtils', 'stationService', 'models/journeyCheckCriteria', 'models/ticketSearchCriteria'],
    function ($, ko, koMapper, context, queryStringHelper, dateUtils, stationService, JourneyCheckCriteria, TicketSearchCriteria) {
        var formSubmissionToDto = function(data, settingId) {
            return {
                Enquiry: koMapper.toJS(data),
                SettingId: koMapper.toJS(settingId)
            };
        };

        /**
         * Mutates the Enquiry object
         * @param  {object} data The Enquiry object
         */
        var getPICOStationID = function (StationName, CRScode) {

            var allstationsPICO = localStorage.getItem("AllstationsPICO");
            allstationsPICO = JSON.parse(allstationsPICO);

            for (var i = 0; i < allstationsPICO.length; i++) {
                if (allstationsPICO[i].Name.indexOf("(" + CRScode + ")") > -1) {
                    return allstationsPICO[i].CrsCode;
                }
            }

        }
        var journeyDetailsToDto = function (data) {
            var outboundDate = ko.utils.unwrapObservable(data.outboundJourney.date);
            data.outboundJourney = koMapper.toJS(data.outboundJourney);
            data.outboundJourney.date = outboundDate.utc().toISOString();

            if (ko.utils.unwrapObservable(data.outboundJourney.transportToStation) === 'Other') {
                data.outboundJourney.transportToStation = ko.utils.unwrapObservable(data.outboundJourney.otherTransportToStation)
            }

            if (ko.utils.unwrapObservable(data.outboundJourney.transportFromStation) === 'Other') {
                data.outboundJourney.transportFromStation = ko.utils.unwrapObservable(data.outboundJourney.transportFromStation)
            }

            if (ko.utils.unwrapObservable(data.isReturnJourney)) {
                var returnDate = ko.utils.unwrapObservable(data.returnJourney.date);
                data.returnJourney = koMapper.toJS(data.returnJourney);
                data.returnJourney.date = returnDate.utc().toISOString();

                if (ko.utils.unwrapObservable(data.outboundJourney.transportToStation) === 'Other') {
                    data.outboundJourney.transportToStation = ko.utils.unwrapObservable(data.outboundJourney.otherTransportToStation)
                }

                if (ko.utils.unwrapObservable(data.outboundJourney.transportFromStation) === 'Other') {
                    data.outboundJourney.transportFromStation = ko.utils.unwrapObservable(data.outboundJourney.otherTransportFromStation)
                }
            }
            else {
                data.returnJourney = null;
            }
        };

        var compensationJourneyDetailsToDto = function (data) {
            data.travelFormattedDate = momentToIsoDate(data.travelDate);
            data.scheduledDepartureIsoTime = momentToIsoDate(data.scheduledDepartureTime);
            data.scheduledArrivalIsoTime = momentToIsoDate(data.scheduledArrivalTime);            
        };

        var momentToIsoDate = function(momentDate){
            if (!momentDate) {
                return null;
            }

            var unwrappedMomentDate = ko.utils.unwrapObservable(momentDate);
            if (!unwrappedMomentDate) {
                return null;
            }

            return unwrappedMomentDate.utc().toISOString();
        };
		
        var bindDatainUrl =function(data,url){
			var stationDeparture =$('.departure-station ').find('.select2-selection__rendered').attr('title').split('(');
					var departureStationCode= stationDeparture[stationDeparture.length-1].split(')');
					
					var stationArrival =$('.arrival-station ').find('.select2-selection__rendered').attr('title').split('(');
					var arrivalStationCode=stationArrival[stationArrival.length-1].split(')');
		
					url+='?oriCode='+departureStationCode[0]+'&destCode='+arrivalStationCode[0]+'';
			var departureType=data.departureType() === 'DepartAfter' ? 'Leave After' : 'Arrive Before';
			 url +='&oadInd='+departureType+'&override_handoff=MATRIX';
			 if(data.departureDate()!=""){
				 var outboundhours = data.departureDate().format('HH');
				 var outboundMinutes=data.departureDate().format('mm');
				 var outbounddate=data.departureDate().format('DD/MM/YY');
				 url+='&outHourField='+outboundhours+'&outMinuteField='+outboundMinutes+'&outDate='+outbounddate+'';
			 }
			 if(!data.isOpenReturn()&& !data.isReturnJourney()){
				 url+='&jt=Single&noa='+data.numberOfAdults()+'&noc='+data.numberOfChildren()+'' 
			 }
			  if(data.isOpenReturn()){
				  url+='&jt=Open&noa='+data.numberOfAdultsopenreturn()+'&noc='+data.numberOfChildrenopenreturn()+'' ;
				 
			 }
			 if(data.isReturnJourney() && !data.isOpenReturn()){
				  var returnhours = data.returnDate().format('HH');
				 var returnMinutes=data.returnDate().format('mm');
				 var returnDate=data.returnDate().format('DD/MM/YY');
				  url+='&jt=Return&noa='+data.numberOfAdultsreturn()+'&noc='+data.numberOfChildrenreturn()+'&inHourField='+returnhours+'&inMinuteField='+returnMinutes+'&inDate='+returnDate+'';
			 }
			 if(data.railcards().length>0){
				 var length=data.railcards().length;
				 for(var i=0;i<length;i++){
					 if(i==0){
						  url +='&rcNum='+data.railcards()[i].quantity()+'&rcCode='+data.railcards()[''+i+''].code()
						  +'&rcNoa='+data.railcards()[''+i+''].adults()+'&rcNoc='+data.railcards()[''+i+''].children()+'';
					 }
					else{
						 url +='&rcNum'+(i+1)+'='+data.railcards()[i].quantity()+'&rcCode'+(i+1)+'='+data.railcards()[''+i+''].code()
						 +'&rcNoa'+(i+1)+'='+data.railcards()[''+i+''].adults()+'&rcNoc'+(i+1)+'='+data.railcards()[''+i+''].children()+'';
					}
				 }
			 }
			
			return url;
		}
		
		var bindDatainUrlPico =function(data,url){
			
		
            var stationDepartureName =$('.departure-station ').find('.select2-selection__rendered').attr('title');
			var departureStationCode= data.departureStation();
			var stationArrivalName =$('.arrival-station ').find('.select2-selection__rendered').attr('title');
			var arrivalStationCode= data.arrivalStation();
			
			url+='?oriCode='+departureStationCode+'&oriName='+stationDepartureName+'&destCode='+arrivalStationCode+'&destName='+stationArrivalName+'';
			var departureType=data.departureType() === 'DepartAfter' ? 'Leave After' : 'Arrive Before';
			 url +='&oadInd='+departureType+'&override_handoff=MATRIX';
					 
	         if(data.isSingleReturn())
			 {
				if(data.departureDate()!=""){
					 var outboundhours = data.departureDate().format('HH');
					 var outboundMinutes=data.departureDate().format('mm');
					 var outbounddate=data.departureDate().format('DD/MM/YYYY');
					 url+='&outHourField='+outboundhours+'&outMinuteField='+outboundMinutes+'&outDate='+outbounddate+'';
				 }	 
				 if(!data.isOpenReturn()&& !data.isReturnJourney()){
					 url+='&jt=Single&noa='+data.numberOfAdults()+'&noc='+data.numberOfChildren()+'' 
				 }
				  if(data.isOpenReturn()){
					  url+='&jt=Open&noa='+data.numberOfAdults()+'&noc='+data.numberOfChildren()+'' ;
					 
				 }
				 if(data.isReturnJourney()&& !data.isOpenReturn()){
					  var returnhours = data.returnDate().format('HH');
					 var returnMinutes=data.returnDate().format('mm');
					 var returnDate=data.returnDate().format('DD/MM/YYYY');
					  url+='&jt=Return&noa='+data.numberOfAdults()+'&noc='+data.numberOfChildren()+'&inHourField='+returnhours+'&inMinuteField='+returnMinutes+'&inDate='+returnDate+'';
				   var returnType=data.returnType() === 'DepartAfter' ? 'Leave After' : 'Arrive Before';
					url +='&oadIndReturn='+returnType+'';
				 }	 
				 
				  if(data.railcards().length>0){
				 var length=data.railcards().length;
				 for(var i=0;i<length;i++){
					  // if(i==0){
						  // url +='&rcNum='+data.railcards()[i].quantity()+'&rcCode='+data.railcards()[''+i+''].code()
						  // +'&rcNoa='+data.railcards()[''+i+''].adults()+'&rcNoc='+data.railcards()[''+i+''].children()+'';
					 // }
					// else{
						 // url +='&rcNum'+(i+1)+'='+data.railcards()[i].quantity()+'&rcCode'+(i+1)+'='+data.railcards()[''+i+''].code()
						 // +'&rcNoa'+(i+1)+'='+data.railcards()[''+i+''].adults()+'&rcNoc'+(i+1)+'='+data.railcards()[''+i+''].children()+'';
					// }
					
					 url +='&rcNum'+(i+1)+'='+data.railcards()[i].quantity()+'&rcCode'+(i+1)+'='+data.railcards()[''+i+''].code()
						 +'&rcNoa'+(i+1)+'='+data.railcards()[''+i+''].adults()+'&rcNoc'+(i+1)+'='+data.railcards()[''+i+''].children()+'';
				 }
			   url+='&rJson='+JSON.stringify(data.railcards())+'&rCount='+data.railcards().length+'';
				
			 }
			 }
			 else if(data.isSeasionTicket())
			 {
				 url = url.replace("search-results", "season-search-results");
				 if(data.startDate()!=""){
					var startdate = data.startDate().format('DD/MM/YYYY');
					 url+='&startDate='+startdate+'';
				 }	 
				 if( data.isCustomSeason() && data.endDate()!=""){
					var endDate = data.endDate().format('DD/MM/YYYY');
					 url+='&endDate='+endDate+'';
				 }
 
    			url+='&jt=Season&noa='+(data.flexiPassengerType()=='Adult'?1:0)+'&noc='+(data.flexiPassengerType()=='Child'?1:0)+'';
				url+='&isW='+data.isWeeklySeason()+'&isM='+data.isMonthlySeason()+'&isA='+data.isAnnulaySeason()+'&isC='+data.isCustomSeason()+'';
				url +='&rcNum='+(data.flexiPassengerType()=='Child'?1:0)+'&rcCode='+ data.seasonTicketRailcards()
			         +'&rcNoa='+(data.flexiPassengerType()=='Adult'?1:0)+'&rcNoc='+(data.flexiPassengerType()=='Child'?1:0)+'';
			   url+='&rJson='+JSON.stringify(data.railcards())+'&rCount='+(data.seasonTicketRailcards()=='TSU' && data.flexiPassengerType()=='Adult'?1:0)+'';

			 }
			 else if(data.isFlexi())
			 {
				url = url.replace("search-results", "flexi-search-results");
				 
			    url+='&jt=Flexi&noa='+(data.flexiPassengerType()=='Adult'?1:0)+'&noc='+(data.flexiPassengerType()=='Child'?1:0)+''
				
			 }
	   				 
			
			 					
			 //localStorage.setItem('searchQueryString',url);
			 
			return url;
		}
		
		 var bindDatainMobileUrl =function(data,url){
			 	var stationDeparture =$('.departure-station').find('.select2-selection__rendered').attr('title').split('(');
					var departureStationCode= stationDeparture[stationDeparture.length-1].split(')');
					
					var stationArrival =$('.arrival-station ').find('.select2-selection__rendered').attr('title').split('(');
					var arrivalStationCode=stationArrival[stationArrival.length-1].split(')');
		
					url+='?Origin='+departureStationCode[0]+'&Destination='+arrivalStationCode[0]+'';
			var departureType=data.departureType() === 'DepartAfter' ? 'DepartAt' : 'arriveBy';
			
			 if(data.departureDate()!=""){
				 var outboundhours = data.departureDate().format('HH');
				 var outboundMinutes=data.departureDate().format('mm');
				 var outbounddate=data.departureDate().format('DD/MM/YY');
                 url += '&OutboundTime=' + outboundhours + '-' + outboundMinutes + '&OutboundDate=' + data.departureDate().year() + '-' + ('0' + (data.departureDate().month() + 1)).slice(-2) +'-'+('0' + data.departureDate().date() ).slice(-2);
			 }
			 if(!data.isOpenReturn()&& !data.isReturnJourney()){
				 url+='&OutboundSearchType='+departureType+'&TicketType=Single&NumberOfAdults='+data.numberOfAdults()+'&NumberOfChildren='+data.numberOfChildren()+'' ;
			 }
			  if(data.isOpenReturn()){
				  url+='&TicketType=OpenReturn&NumberOfAdults='+data.numberOfAdults()+'&NumberOfChildren='+data.numberOfChildren()+'' ;
				 
			 }
			 if(data.isReturnJourney()){
				  var returnhours = data.returnDate().format('HH');
				 var returnMinutes=data.returnDate().format('mm');
				 var returnDate=data.returnDate().format('DD-MM-YY');
				  url+='&TicketType=Return&NumberOfAdults='+data.numberOfAdults()+'&NumberOfChildren='+data.numberOfChildren()+'&ReturnTime='+returnhours+'-'+returnMinutes+'&ReturnDate='+data.returnDate().year()+'-'+('0'+(data.returnDate().month()+1)).slice(-2)+'-'+('0'+data.returnDate().date()).slice(-2);
			 }
			 if(data.railcards().length>0){
				 var length=data.railcards().length;
				 
				 for(var i=0;i<length;i++){
					 url +='&Railcards='+data.railcards()[''+i+''].code()+'';
				 }
			 }
			return url;
		}
		
		
		
        var webtisMapper = function (data, ignoreDates) {
            
			
            if (!ignoreDates) {
                mappedData = $.extend(mappedData, {
                    'outm': data.departureDate().format('MM'),
                    'outd': data.departureDate().format('DD'),
                    'outh': data.departureDate().format('HH'),
                    'outmi': data.departureDate().format('mm'),
                });
            }

            //via/avoid
            if (data.viaAvoidType() && data.viaAvoidStation()) {
                var viaAvoid = data.viaAvoidTypes[data.viaAvoidType()];
                mappedData[viaAvoid] =stationService.findStationByNlc(data.viaAvoidStation()).id;
            }

            if (data.railcard()) {
                mappedData = $.extend(mappedData, {
                    //railcard
                    'rc': data.railcard(),
                    'rcn': data.railcardQuantity()
                });
            }

            if (data.railcards) {
                _railcards = data.railcards()
                if (_railcards.length > 0) {
                    mappedDataRc = [];
                    mappedDataRcn = [];
                    mappedDataRca = [];
                    mappedDataRcc = [];
                    for (var index in _railcards) {
                        var _railcard = _railcards[index];
                        if (_railcard.code()) {
                            mappedDataRc.push(_railcard.code());
                            mappedDataRcn.push(_railcard.quantity());
                            mappedDataRca.push(_railcard.adults());
                            mappedDataRcc.push(_railcard.children());
                        }
                    }
                    mappedData = $.extend(mappedData, {
                        //railcards
                        'rc': mappedDataRc.join(','),
                        'rcn': mappedDataRcn.join(','),
                        'rca': mappedDataRca.join(','),
                        'rcc': mappedDataRcc.join(',')
                    });
                }
            }

            if (data.isReturnJourney() && !data.isOpenReturn()) {
                mappedData = $.extend(mappedData, {
                    // return departure - arrival
                    'retm': data.returnDate().format('MM'),
                    'retd': data.returnDate().format('DD'),
                    'reth': data.returnDate().format('HH'),
                    'retmi': data.returnDate().format('mm'),
                    'retda': data.returnType() === 'DepartAfter' ? 'y' : 'n'
                });
            }

            return mappedData;
        };

        return {
            journeyCheckCriteria: {
                toDictionary: function(data) {
                    var coreData = koMapper.toJS(data);
                    return {
                        'from': coreData.departureStation,
                        'to': coreData.arrivalStation,
                        'departureTime': data.departureDate().format(context.dateFormat.longDate),
                        'type': coreData.departureType
                    };
                },
                fromQueryString: function() {
                    var parsedQuery = queryStringHelper.getQuery();

                    var criteria = new JourneyCheckCriteria();
                    criteria.departureStation(parsedQuery.from);
                    criteria.arrivalStation(parsedQuery.to);
                    criteria.departureDate(dateUtils.parseDate(parsedQuery.departureTime, context.dateFormat.longDate));
                    criteria.departureType(parsedQuery.type);

                    return criteria;
                },
                toDto: function(data) {
                    var coreData = koMapper.toJS(data);

                    return {
                        FromCrsCode: coreData.departureStation,
                        ToCrsCode: coreData.arrivalStation,
                        DepartureDate: data.departureDate().utc().toISOString(),
                        DepartureType: coreData.departureType
                    };
                }
            },
            ticketSearchCriteria: {
                toMDFormat: function (data) {
                    var journeyType = data.isReturnJourney()? (data.isOpenReturn()? 'O' : 'R') : 'N';

                    var railcardNumberOfAdults = data.railcardQuantity() < data.numberOfAdults() ? data.railcardQuantity() : data.numberOfAdults();
                    var railcardNumberOfChildren = data.railcardQuantity() - railcardNumberOfAdults;

                    var mappedData = {
                        //outbound departure - arrival
                        'depatureNLC': data.departureStation().split('_')[0],
                        'arrivalNLC': data.arrivalStation().split('_')[0],

                        //depature date
                        'departureDate': data.departureDate().format('YYYY-MM-DD'),
                        'departureTime': (data.departureType() === 'DepartAfter'? 'D' : 'A') + data.departureDate().format('HH:mm'),

                        //return date
                        'returnDate': journeyType,
                        'returnTime': journeyType,

                        //passengers
                        'numAdults': data.numberOfAdults(),
                        'numChilds': data.numberOfChildren(),

                        //preset new MD parameters
                        'direct': 0,
                        'standardclass': 1,
                        'firstclass': 1,

                        'viaAvoid': 'N',

                        //railcards
                        'railcard': 'N'
                    };

                    if (journeyType === 'R') {
                        mappedData = $.extend(mappedData, {
                            'returnDate': data.returnDate().format('YYYY-MM-DD'),
                            'returnTime': (data.returnType() === 'DepartAfter' ? 'D' : 'A') + data.returnDate().format('HH:mm')
                        });
                    }

                    if (data.railcard()) mappedData['railcard'] = data.railcard() + ':' + data.railcardQuantity() + ':' + railcardNumberOfAdults + ':' + railcardNumberOfChildren;

                    if (data.railcards) {
                        var _railcards = data.railcards();
                        if (_railcards.length > 0) {
                            mappedData['railcard'] = [];
                            for (var index in _railcards) {
                                var _railcard = _railcards[index];
                                if (_railcard.code()) {
                                    mappedData['railcard'].push([_railcard.code(), _railcard.quantity(), _railcard.adults(), _railcard.children()].join(':'));
                                }
                            }
                            mappedData['railcard'] = mappedData['railcard'].join('/');
                        }
                    }

                    //via/avoid
                    if (data.viaAvoidType() && data.viaAvoidStation()) {
                        mappedData['viaAvoid'] = data.viaAvoidType().toString()[0] + stationService.findStationByNlc(data.viaAvoidStation()).id;
                    }

                    // Keep IE8 happy
                    var pathVars = [];
                    for (var key in mappedData) {
                      if (mappedData.hasOwnProperty(key)) {
                        pathVars.push(mappedData[key]);
                      }
                    }
                    return "/" + pathVars.join("/");
                },
                toNewQTTFormat: function (data) {
                    var mappedData = {
                        //outbound departure - arrival
                        'DepartureStation': data.departureStation,
                        'ArrivalStation': data.arrivalStation,

                        //depature date
                        'DepartureDate': data.departureDate.split(" ")[0],
                        'DepartureTime': data.departureDate.split(" ")[1],


                        //passengers
                        'NumberOfAdults': data.numberOfAdults,
                        'NumberOfChildren': data.numberOfChildren,

                    };






                    if (data.returnDate != null) {
                        mappedData = $.extend(mappedData, {
                            'ReturnDate': data.returnDate.split(" ")[0],
                            'ReturnTime': data.returnDate.split(" ")[1],
                        });
                    }

                    // if (data.railcard()) mappedData['Railcard'] = data.railcard() + ':' + data.railcardQuantity() + ':' + railcardNumberOfAdults + ':' + railcardNumberOfChildren;

                    if (data.specialRailcard) {
                        var _railcards = data.specialRailcard;
                        if (_railcards.length > 0) {
                            mappedData['Railcard'] = [];
                            for (var index in _railcards) {
                                var _railcard = _railcards[index];
                                if (_railcard) {
                                    mappedData['Railcard'].push([_railcard]);
                                }
                            }

                        }
                    }

                    //via/avoid
                    // if (data.viaAvoidType() && data.viaAvoidStation()) {
                    //     mappedData['viaAvoid'] = data.viaAvoidType().toString()[0] + stationService.findStationByNlc(data.viaAvoidStation()).id;
                    //  }

                    // Keep IE8 happy

                    return mappedData;
                },
                toWebtisFormat: function (data,device) {
                    var mappedData ="";
					var targetUrl="";
					var targetModifiedUrl="";
					targetUrl = context.environment.booking.PICOWebtisEngineUrl;
					targetModifiedUrl = bindDatainUrlPico(data,targetUrl);
					localStorage.setItem('searchQueryString',targetModifiedUrl);
					localStorage.setItem('isRedirectFromHomePage',true);
                    window.location.href = targetModifiedUrl.split('?')[0]; 
                    
                },
                saveAWSData: function (data) {
                    return {
                        'DepartureStation': data.departureStation,
                        'ArrivalStation': data.arrivalStation
                    }
                },
				 toPlanmyjourneyWebtis: function (data,device) {
                     var mappedData = "";
                     var currentUrl = $(location).attr('href');
                     var splittedUrl = currentUrl.split("/");
                     var stationDeparture = splittedUrl[splittedUrl.length - 2];
                     var stationArrival = splittedUrl[splittedUrl.length - 1];
                     if (stationDeparture.indexOf("-") !== -1) {
                         stationDeparture = stationDeparture.replace(/-/g, " ");
                         
                     }
                     if (stationArrival.indexOf("-") !== -1) {
                         stationArrival = stationArrival.replace(/-/g, " ");
                         
                     }
                     stationDeparture = stationDeparture.toLowerCase().replace(/\b(\w)/g, s => s.toUpperCase());
                     stationDeparture += " ";
                     stationArrival = stationArrival.toLowerCase().replace(/\b(\w)/g, s => s.toUpperCase());
                     stationArrival += " ";
                     var DepartureStationID = getPICOStationID(stationDeparture, data.Origin);
                     var ArrivalStationID = getPICOStationID(stationArrival, data.Destination);
                     var url = context.environment.booking.PICOWebtisEngineUrl;
                     url += '?oriCode=' + DepartureStationID + '&oriName=' + stationDeparture + "(" + data.Origin + ")";
                     url += '&destCode=' + + ArrivalStationID + '&destName=' + stationArrival + "(" + data.Destination + ")";
                     url += '&oadInd=Leave After&override_handoff=MATRIX';
                     var departureDate = new Date(data.ScheduledDepartureTime);
                     var outboundhours = departureDate.getHours();
                     outboundhours = ("0" + outboundhours).slice(-2);
                     var outboundMinutes = departureDate.getMinutes();
                     outboundMinutes = ("0" + outboundMinutes).slice(-2);
                     var date = departureDate.getDate();
                     date = ("0" + date).slice(-2);
                     var month = departureDate.getMonth() + 1;
                     month = ('0' + month).slice(-2);
                     var outbounddate = date + '/' + month + '/' + departureDate.getFullYear();
                     url += '&outHourField=' + outboundhours + '&outMinuteField=' + outboundMinutes + '&outDate=' + outbounddate;
                     url += "&jt=Single&noa=1&noc=0";
                     localStorage.setItem("searchQueryString", url);
                     localStorage.setItem("isRedirectFromHomePage", 'true');
                     window.location.href = context.environment.booking.PICOWebtisEngineUrl;
                },
                toWebtisMobileFormat: function (data) {
                    var mappedData = webtisMapper(data, data.ignoreDatesOnMobile);

                    $.extend(mappedData, {
                        //stations
                        'onlc': data.departureStation().split('_')[0],
                        'dnlc': data.arrivalStation().split('_')[0]
                    });

                    return mappedData;
                },
                toPlannedWorksDto: function(data) {
                    var mappedData = {
                        StationCodes: [data.departureStation(), data.arrivalStation()],
                        OutwardJourneyDate: data.departureDate().format(),
                        ReturnJourneyDate: null,
                        IsOpenReturn: data.isOpenReturn(),
                        UseNlc: true,
                        DisplayMode: 'Qtt'
                    };

                    if (data.isReturnJourney()) {
                        if (!data.isOpenReturn()) {
                            mappedData = $.extend(mappedData, {
                                ReturnJourneyDate: data.returnDate().format()
                            });
                        }
                    }

                    return mappedData;
                },
                fromJourneyData: function(data) {
                    var searchCriteria = new TicketSearchCriteria();

                    var departureStation = stationService.findStationByCrs(data.Origin);
                    var arrivalStation = stationService.findStationByCrs(data.Destination);

                    searchCriteria.departureStation(departureStation.NationalLocationCode);
                    searchCriteria.arrivalStation(arrivalStation.NationalLocationCode);
                    searchCriteria.departureDate(dateUtils.parseDate(data.ScheduledDepartureTime));
                    searchCriteria.departureType('DepartAfter');
                    searchCriteria.isReturnJourney(false);
                    searchCriteria.numberOfAdults(1);
                    searchCriteria.numberOfChildren(0);

                    return searchCriteria;
                },
                fromRedirectionData: function (data) {

                    map = {
                        departureStation: {
                            keys: ['departureStation', 'onlc'],
                        },
                        arrivalStation: {
                            keys: ['arrivalStation', 'dnlc'],
                        },
                        departureDateMonth: {
                            keys: ['departureDateMonth', 'outm'],
                        },
                        departureDateDay: {
                            keys: ['departureDateDay', 'outd'],
                        },
                        departureDateHours: {
                            keys: ['departureDateHours', 'outh'],
                        },
                        departureDateMinutes: {
                            keys: ['departureDateMinutes', 'outmi'],
                        },
                        departureType: {
                            keys: ['departureType', 'outda'],
                            defaultValue: 'DepartAfter'
                        },
                        numberOfAdults: {
                            keys: ['numberOfAdults', 'nad'],
                            defaultValue: '1'
                        },
                        numberOfChildren: {
                            keys: ['numberOfChildren', 'nch'],
                            defaultValue: '0'
                        }
                    }

                    var mapData = function (key) {
                        var result = map[key].defaultValue;
                        $.each(map[key].keys, function (index, value) {
                            if (data[value])
                                result = data[value];
                        });
                        return result;
                    }

                    var searchCriteria = new TicketSearchCriteria();
                    searchCriteria.departureStation(mapData('departureStation'));
                    searchCriteria.arrivalStation(mapData('arrivalStation'));
                    searchCriteria.departureDate(dateUtils.newDate(new Date().getFullYear(), mapData('departureDateMonth'), mapData('departureDateDay'), mapData('departureDateHours'), mapData('departureDateMinutes')));
                    var departureType = mapData('departureType');
                    if(departureType=='y')
                        departureType=map.departureType.defaultValue
                    searchCriteria.departureType(departureType);
                    searchCriteria.numberOfAdults(mapData('numberOfAdults'));
                    searchCriteria.numberOfChildren(mapData('numberOfChildren'));
                    return searchCriteria;
                }
            },
            stationRequest: {
                toDto: function(data) {
                    return {
                        'stationName': data
                    };
                }
            },
            formSubmission: {
                toDto: formSubmissionToDto,
                compensation: {
                    toDto: function (data, settingId) {
                        var coreData = $.extend({}, data);

                        compensationJourneyDetailsToDto(coreData.outwardJourney);
                        compensationJourneyDetailsToDto(coreData.returnJourney);

                        return formSubmissionToDto(coreData, settingId);
                    }
                },
                complaint: {
                    toDto: function (data, settingId) {
                        var coreData = $.extend({}, data);
                        coreData.outwardDepartureDate = momentToIsoDate(data.departureDate);
                        coreData.returnDepartureDate = momentToIsoDate(data.returnDate);
                        return formSubmissionToDto(coreData, settingId);
                    }
                },
                contactus: {
                    toDto: function (data, settingId) {
                        var coreData = $.extend({}, data);
                        coreData.outwardDepartureDate = momentToIsoDate(data.departureDate);
                        coreData.returnDepartureDate = momentToIsoDate(data.returnDate);
                        return formSubmissionToDto(coreData, settingId);
                    }
                },
                filmingRequest: {
                    toDto: function (data, settingId) {
                        var coreData = $.extend({}, data);                        
                        coreData.filmingDate = momentToIsoDate(data.filmingDate);
                        return formSubmissionToDto(coreData, settingId);
                    }
                },
                smartApplicationRequest: {
                    toDto: function (data, settingId) {
                        var coreData = $.extend({}, data);
                        return formSubmissionToDto(coreData, settingId);
                    }
                },
                businessTravelBooking: {
                    toDto: function (data, settingId) {
                        var coreData = $.extend({}, data);
                        coreData.outboundDate = momentToIsoDate(data.outboundDate);
                        coreData.returnDate = momentToIsoDate(data.returnDate);
                        return formSubmissionToDto(coreData, settingId);
                    }
                },
                groupTravelData: {
                    toDto: function (data, settingId) {
                        var coreData = $.extend({}, data);
                        coreData.outboundDate = momentToIsoDate(data.outboundDate);
                        coreData.returnDate = momentToIsoDate(data.returnDate);
                      
                        return formSubmissionToDto(coreData, settingId);
                    }
                },
                assistedTravel: {
                    toDto: function (data, settingId) {
                        var coreData = $.extend({}, data);
                        if (data.ticketBookedWith()===true) {
                            coreData.outboundDate = null;
                            coreData.returnDate = null;
                            coreData.outboundTime = "";
                            coreData.ReturnTime = "";
                        }
                        else {
                            coreData.outboundDate = momentToIsoDate(data.outboundDate);
                            if (data.typeOfJourney() === false) {
                                coreData.returnDate = momentToIsoDate(data.returnDate);
                            }
                            else {
                                coreData.returnDate = null;
                                coreData.ReturnTime = "";
                            }
                            
                        }
                      
                        return formSubmissionToDto(coreData, settingId);
                    }
                },
                lostProperty: {
                    toDo: function (data, settingId) {
                        var coreData = $.extend({}, data);
                        coreData.propertyWasLostDate = momentToIsoDate(data.propertyLostDate);
                        coreData.departureIsoTime = momentToIsoDate(data.departureTime);
                        coreData.arrivalIsoTime = momentToIsoDate(data.arrivalTime);
                        return formSubmissionToDto(coreData, settingId);
                    }
                }
            },
            filterGroups: {
                toDto: function(filterGroups) {
                    return koMapper.toJS(filterGroups);
                }
            },
            getTravelMode: function (item) {

                var travelModeMap = {
                    ScheduledBus: 'Bus',
                    ReplacementBus: 'Bus',
                    Walk: "Walk",
                    Train: null
                };

                var travelModes = [];
                $.each(item.Legs, function (index, leg) {
                    if (leg.TravelMode && travelModeMap[leg.TravelMode] && !travelModes.indexOf(travelModeMap[leg.TravelMode]) !== -1)
                        travelModes.push(travelModeMap[leg.TravelMode]);
                });
                return item.Platform ? ' | ' + travelModes.join(' | ') : travelModes.join(' | ');
            }
    };
});

define('dataService', ['jquery', 'amplify', 'mapper', 'requests'],
    function ($, amplify, mapper, requests) {

        
        var RailcardForPICO = function (request) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'RailcardForPICO',
                    data: JSON.stringify(request),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject;
                    }
                });
            }).promise();
        }
        var allstationForPICO = function (request) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'allstationForPICO',
                    data: JSON.stringify(request),
                    success: function (response) {
                        var arr = ChangeJSONPropertyForPICO(response);
                        def.resolve(arr);
                    },
                    error: function () {
                        def.reject();
                    }

                });
            }).promise();
        }
        var getGwrStations = function () {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'stations',
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var getRailcards = function () {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'railcards',
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var getRouteStatus = function () {
            return $.Deferred(function(def) {
                amplify.request({
                    resourceId: 'routeStatus',
                    success: function(response) {
                        def.resolve(response);
                    },
                    error: function() {
                        def.reject();
                    }
                });
            }).promise();
        };

        var getPlannedworksForJourney = function (request) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'plannedworks',
                    data: JSON.stringify(request),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var sendDataAWS = function (request) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'sendDataToAWS',
                    data: JSON.stringify(request),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };


        var getStationArrivals = function (request) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'stationArrivals',
                    data: request,
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var getStationDepartures = function (request) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'stationDepartures',
                    data: request,
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var getJourneyServices = function (request) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'journeyServices',
                    data: JSON.stringify(request),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var getIndexedStations = function (resource,request) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: resource,
                    data: request,
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var journeySearch = function (request) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'journeySearch',
                    data: JSON.stringify(request),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var getCallingPoints = function (request) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'callingPoints',
                    data: JSON.stringify(request),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var getGridArticles = function (take, skip, filters) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'gridArticles',
                    data: JSON.stringify({take: take || 0, skip: skip || 0, filters: filters || []}),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var getSearchResults = function (request) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'search',
                    data: JSON.stringify(request),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var getSeatAvailability = function (resource, request) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: resource,
                    data: request,
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var saveCompetitionData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'competitionForm',
                    data: JSON.stringify(mapper.formSubmission.toDto(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var saveNewsletterData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'newsletterForm',
                    data: JSON.stringify(mapper.formSubmission.toDto(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var saveSignupData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'signupForm',
                    data: JSON.stringify(mapper.formSubmission.toDto(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var saveCompensationData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'compensationForm',
                    data: JSON.stringify(mapper.formSubmission.compensation.toDto(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var saveAssistedTravelData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'assistedTravelForm',
                    data: JSON.stringify(mapper.formSubmission.assistedTravel.toDto(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var saveInAws = function (request) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'sendDataToAWS',
                    data: JSON.stringify(mapper.ticketSearchCriteria.toMDFormat(request)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };
        var saveInAwsNewQTT = function (request) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'sendDataToAWS',
                    data: JSON.stringify(mapper.ticketSearchCriteria.toNewQTTFormat(request)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var saveComplaintData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'complaintForm',
                    data: JSON.stringify(mapper.formSubmission.complaint.toDto(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };


        var saveContactUsData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'contactusForm',
                    data: JSON.stringify(mapper.formSubmission.contactus.toDto(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var saveFaultReportData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'faultReportForm',
                    data: JSON.stringify(mapper.formSubmission.faultReport.toDto(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };
        var saveOfferFormData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'offerForm',
                    data: JSON.stringify(mapper.formSubmission.toDto(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var saveReportACrimeFormData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'reportACrimeForm',
                    data: JSON.stringify(mapper.formSubmission.toDto(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var saveFilmingRequestData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'filmingRequestForm',
                    data: JSON.stringify(mapper.formSubmission.filmingRequest.toDto(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var saveBusinessTravelBookingData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'saveBusinessTravelBookingDataForm',
                    data: JSON.stringify(mapper.formSubmission.businessTravelBooking.toDto(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var saveGroupTravelData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'saveGroupTravelForm',
                    data: JSON.stringify(mapper.formSubmission.groupTravelData.toDto(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var saveBusinessTravelOpenAccountData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'businessTravelOpenAccountDataForm',
                    data: JSON.stringify(mapper.formSubmission.toDto(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var saveLostPropertyFormData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'lostPropertyForm',
                    data: JSON.stringify(mapper.formSubmission.lostProperty.toDo(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var saveNewsLetterSignupFormData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'newsLetterSignupForm',
                    data: JSON.stringify(mapper.formSubmission.lostProperty.toDo(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };

        var getLiveInformationBoard = function () {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'liveInformationBoard',
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };        

        var saveSmartApplicationFormData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'smartApplicationForm',
                    data: JSON.stringify(mapper.formSubmission.smartApplicationRequest.toDto(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };
		 var saveCheapTicketFormData = function (request, settingId) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'cheapTicketForm',
                    data: JSON.stringify(mapper.formSubmission.lostProperty.toDo(request, settingId)),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function () {
                        def.reject();
                    }
                });
            }).promise();
        };
       
        //change property name
        var ChangeJSONPropertyForPICO = function (response) {
            var arr = [];
            if (response != null) {
                for (var i = 0; i < response.Data.length; i++) {
                    arr.push({ "Name": response.Data[i].Name, "CrsCode": response.Data[i].Id });
                }
            }
            
            return arr;
		};

		var allEventLocations = function (request) {
			return $.Deferred(function (def) {
				amplify.request({
					resourceId: 'allEventLocations',
					data: JSON.stringify(request),
					success: function (response) {
						var arr = (response);
						def.resolve(arr);
					},
					error: function () {
						def.reject();
					}

				});
			}).promise();
        }
        var allEventCategories = function (request) {
			return $.Deferred(function (def) {
				amplify.request({
                    resourceId: 'allEventCategories',
					data: JSON.stringify(request),
					success: function (response) {
						var arr = (response);
						def.resolve(arr);
					},
					error: function () {
						def.reject();
					}

				});
			}).promise();
        }
        var allEventSubCategories = function (request) {
			return $.Deferred(function (def) {
				amplify.request({
                    resourceId: 'allEventSubCategories',		
                 
					success: function (response) {
						var arr = (response);
						def.resolve(arr);
					},
					error: function () {
						def.reject();
					}

				});
			}).promise();
        }


        var getEventFromVenue = function (request) {
			return $.Deferred(function (def) {
				amplify.request({
                    resourceId: 'getEventFromVenue',
                    data:request,
					success: function (response) {
						var arr = (response);
						def.resolve(arr);
					},
					error: function () {
						def.reject();
                    }
                });
            }).promise();
        }
        var saveVenueData = function (request) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'EventVenues',
                    data: JSON.stringify(request),
                    success: function (response) {
                        def.resolve(response);
                    },
                    error: function (data, status) {
                        def.reject(data);
                    }
                });
            }).promise();
        };

				
        
       
        var createEvent = function (request) {
            return $.Deferred(function (def) {
                amplify.request({
                    resourceId: 'createEvent',
                    data: JSON.stringify(request),
                    success: function (response) {
                        var arr = (response);
                        def.resolve(arr);
                    },
                    error: function (data, status) {
                        def.reject(data);
                    }

                });
            }).promise();
        }

        return {
            getGwrStations: getGwrStations,
            getRailcards: getRailcards,
            getRouteStatus: getRouteStatus,
            getPlannedworksForJourney: getPlannedworksForJourney,
            getStationArrivals: getStationArrivals,
            getStationDepartures: getStationDepartures,
            getJourneyServices: getJourneyServices,
            journeySearch: journeySearch,
            getCallingPoints: getCallingPoints,
            getGridArticles: getGridArticles,
            getSearchResults: getSearchResults,
            getSeatAvailability: getSeatAvailability,
            getLiveInformationBoard: getLiveInformationBoard,
            getIndexedStations: getIndexedStations,

            saveCompetitionData: saveCompetitionData,
            saveNewsletterData: saveNewsletterData,
            saveSignupData: saveSignupData,
            saveCompensationData: saveCompensationData,
            saveAssistedTravelData: saveAssistedTravelData,
            saveComplaintData: saveComplaintData,
            saveContactUsData: saveContactUsData,
            saveOfferFormData: saveOfferFormData,
            saveFilmingRequestData: saveFilmingRequestData,
            saveReportACrimeFormData: saveReportACrimeFormData,
            saveLostPropertyFormData: saveLostPropertyFormData,
            saveBusinessTravelOpenAccountData: saveBusinessTravelOpenAccountData,
            saveBusinessTravelBookingData: saveBusinessTravelBookingData,
            saveGroupTravelData: saveGroupTravelData,
            saveSmartApplicationFormData: saveSmartApplicationFormData,
            saveNewsLetterSignupFormData: saveNewsLetterSignupFormData,
            saveFaultReportData: saveFaultReportData,
            sendDataAWS: sendDataAWS,
            saveInAws: saveInAws,
            saveInAwsNewQTT: saveInAwsNewQTT,
            saveCheapTicketFormData: saveCheapTicketFormData,
            allstationForPICO: allstationForPICO,
            allEventLocations: allEventLocations,
            allEventCategories: allEventCategories,
            allEventSubCategories: allEventSubCategories,
            createEvent: createEvent,
            getEventFromVenue: getEventFromVenue,
            saveVenueData: saveVenueData,
            RailcardForPICO: RailcardForPICO 
        };
    });

define('viewmodels/stationSelectorFormUi', [
    'jquery',
    'knockout',
    'models/liveDeparturesCriteria',
    'dataService',
    'context'
],
function (
    $,
    ko,
    LiveDeparturesCriteria,
    dataService,
    context
) {
    var searchCriteria = new LiveDeparturesCriteria();
    var stations = ko.observableArray();

    var init = function () {
        // Get a station list
        
        dataService.getGwrStations().done(function (data) {
            var st = [];
            $(data).each(function (index, item) {
                st.push({ text: item.Name + ' (' + item.CrsCode + ')', id: item.EncodedName });
            });
            stations(st);
        });
    };

    var submit = function () {
        if (!searchCriteria.isValid()) {
            return;
        }
        window.location.href = context.environment.stationDetailsPageUrl + '/' + searchCriteria.stationName();
    };

    return {
        stations: stations,
        searchCriteria: searchCriteria,
        init: init,
        submit: submit
    };
});
define('koExtenders', ['jquery', 'knockout'],
    function ($, ko) {
        ko.observableArray.fn.filterByProperty = function (propName, matchValue) {
            return ko.pureComputed(function () {
                var allItems = this(), matchingItems = [];
                for (var i = 0; i < allItems.length; i++) {
                    var current = allItems[i];
                    if (ko.unwrap(current[propName]) === matchValue)
                        matchingItems.push(current);
                }
                return matchingItems;
            }, this);
        },
            ko.observableArray.fn.where = function (predicate, context) {
            return ko.pureComputed(function () {
                    var array = [];
                    var l = this().length;
                for (var i = 0; i < l; i++)
                    if (predicate.call(context, this()[i], i, this()) === true) array.push(this()[i]);
                    return array;
                }, this);
            },
            ko.observableArray.fn.select = function (selector, context) {
                return ko.pureComputed(function () {
                    var array = [];
                    var l = this().length;
                    for (var i = 0; i < l; i++)
                        array.push(selector.call(context, this()[i], i, this()));
                    return array;
                }, this);
            },
        ko.extenders.paging = function(target, pageSize) {

            var _pageSize = ko.observable(pageSize || 10),
                _currentPage = ko.observable(1);

            target.pageSize = ko.computed({
                read: _pageSize,
                write: function(newValue) {
                    if (newValue > 0) {
                        _pageSize(newValue);
                    } else {
                        _pageSize(10);
                    }
                }
            });

            target.currentPage = ko.computed({
                read: _currentPage,
                write: function(newValue) {
                    if (newValue > target.pageCount()) {
                        _currentPage(target.pageCount());
                    } else if (newValue <= 0) {
                        _currentPage(1);
                    } else {
                        _currentPage(newValue);
                    }
                }
            });

            target.pageCount = ko.computed(function() {
                return Math.ceil(target().length / target.pageSize()) || 1;
            });

            target.pageArray = ko.computed(function() {
                var count = [];
                for (var i = 1; i <= target.pageCount(); i++) {
                    count.push(i);
                }
                return count;
            });

            target.currentPageData = ko.computed(function() {
                var pageSize = _pageSize(),
                    pageIndex = _currentPage(),
                    startIndex = pageSize * (pageIndex - 1),
                    endIndex = pageSize * pageIndex;

                return target().slice(startIndex, endIndex);
            });

            target.moveTo = function(page) {
                target.currentPage(page);
            };
            target.moveFirst = function() {
                target.currentPage(1);
            };
            target.movePrevious = function() {
                target.currentPage(target.currentPage() - 1);
            };
            target.moveNext = function() {
                target.currentPage(target.currentPage() + 1);
            };
            target.moveLast = function() {
                target.currentPage(target.pageCount());
            };

            return target;
        };
    });

define('viewmodels/liveDeparturesResultsUi', [
    'jquery',
    'knockout',
    'dataService',
    'dateUtils',
    'context',
    'mapper',
    'koExtenders'
],
    function (
        $,
        ko,
        dataService,
        dateUtils,
        context,
        mapper,
        koExtenders
    ) {

        var trains = ko.observableArray([]).extend({ paging: 10 });
        var isDeparturesMode = ko.observable(true);
        var selectedStation = ko.observable('');
        var selectedRoute = ko.observable();
        var isLoading = ko.observable(false);

        var stationColumnHeader = ko.computed(function () {
            return isDeparturesMode() ? 'Destination' : 'Origin';
        });

        var getFormattedDate = function (dateString) {
            return dateUtils.parseDate(dateString).local().format(context.dateFormat.shortDayMonthTime);
        };

        var isDelayed = function (trainService) {
            if (dateUtils.parseDate(trainService.EstimatedTime, context.dateFormat.time).isValid()) {
                // If the date is valid, and maybe if the date is later than the current date.
                return true;
            }
            return false;
        };

        var isCancelled = function (trainService) {
            if (trainService.EstimatedTime === "Cancelled") {
                return true;
            }
            return false;
        };

        var changeMode = function (newMode) {
            var currentMode = isDeparturesMode();

            if (currentMode != newMode) {
                isDeparturesMode(newMode);
                trains.moveFirst();
                getTrainServices();
            }
        };

        var getTrainServices = function () {
            if (selectedStation()) {
                var updateMethod = isDeparturesMode() ? dataService.getStationDepartures : dataService.getStationArrivals;

                updateMethod(mapper.stationRequest.toDto(selectedStation()))
                    .done(
                        function (data) {
                            $.each(data.Items, function (index, value) {
                                var item = data.Items[index];
                                item.IsDelayed = isDelayed(value);
                                item.IsCancelled = isCancelled(value);
                                item.Stops = ko.observableArray([]);
                                item.LastLocation = ko.observable();
                                item.LastUpdated = ko.observable(getFormattedDate(data.GeneratedAt));
                            });

                            trains(data.Items);
                            isLoading(false);
                        })
                    .fail(function (data) {
                        isLoading(false);
                        // console.log("Live departures - Data load error!", data);
                    });

            } else {
                // console.log('Live departures - No station selected');
            }
        };

        var selectRoute = function (route) {
            selectedRoute(route);
            getSelectedRouteDetails();
        };

        var getSelectedRouteDetails = function () {
            var route = selectedRoute();

            dataService.getJourneyServices({ 'ServiceId': route.Id })
                .done(function (data) {
                    var now = dateUtils.currentDate();
                    var inFuture = false;

                    $.each(data.CallingPoints, function (index, cp) {
                        //Use the same scheduled and estimated dates for the selected station callingpoint item as at route level
                        //The remote service returning callingpoints only returns arrival dates and this could cause a discrepancy on the UI
                        if (cp.Station.CrsCode === selectedStation()) {
                            cp.ScheduledTime = route.ScheduledTime;
                            cp.EstimatedTime = route.EstimatedTime;
                        }

                        cp.IsDelayed = isDelayed(cp);
                        if (!inFuture) {
                            var realTime = (cp.EstimatedTime === null) ? cp.ScheduledTime : cp.EstimatedTime;
                            cp.HasPassed = cp.IsVisited || (dateUtils.parseDate(realTime) < now);

                            if (data.LastLocation !== null) {
                                cp.IsCurrent = cp.Station.CrsCode === data.LastLocation.CrsCode;
                            }
                            if (cp.IsCurrent) {
                                inFuture = true;
                            }
                        }

                        cp.IsLast = (index === data.CallingPoints.length - 1);
                    });

                    route.LastLocation(data.LastLocation ? data.LastLocation.CrsCode : '');
                    route.Stops(data.CallingPoints);
                    route.LastUpdated(getFormattedDate(data.GeneratedAt));
                });
        };

        var init = function (station) {
            selectedStation(station);
            getTrainServices();

            if (window.location.href.indexOf("live-status-update") > -1) {
                isLoading(true);
                $("html, body").scrollTop($('#ld-results').offset().top - 30);
            }
        };

        return {
            init: init,
            trains: trains,
            stationColumnHeader: stationColumnHeader,
            isDeparturesMode: isDeparturesMode,
            selectedStation: selectedStation,
            changeMode: changeMode,
            selectRoute: selectRoute,
            isLoading: isLoading,
            getSelectedRouteDetails: getSelectedRouteDetails
        };
    });

(function($){

    $.session = {

        _id: null,

        _cookieCache: undefined,

        _init: function()
        {
            if (!window.name) {
                window.name = Math.random();
            }
            this._id = window.name;
            this._initCache();

            // See if we've changed protcols

            var matches = (new RegExp(this._generatePrefix() + "=([^;]+);")).exec(document.cookie);
            if (matches && document.location.protocol !== matches[1]) {
               this._clearSession();
               for (var key in this._cookieCache) {
                   try {
                   window.sessionStorage.setItem(key, this._cookieCache[key]);
                   } catch (e) {};
               }
            }

            document.cookie = this._generatePrefix() + "=" + document.location.protocol + ';path=/;expires=' + (new Date((new Date).getTime() + 120000)).toUTCString();

        },

        _generatePrefix: function()
        {
            return '__session:' + this._id + ':';
        },

        _initCache: function()
        {
            var cookies = document.cookie.split(';');
            this._cookieCache = {};
            for (var i in cookies) {
                var kv = cookies[i].split('=');
                if ((new RegExp(this._generatePrefix() + '.+')).test(kv[0]) && kv[1]) {
                    this._cookieCache[kv[0].split(':', 3)[2]] = kv[1];
                }
            }
        },

        _setFallback: function(key, value, onceOnly)
        {
            var cookie = this._generatePrefix() + key + "=" + value + "; path=/";
            if (onceOnly) {
                cookie += "; expires=" + (new Date(Date.now() + 120000)).toUTCString();
            }
            document.cookie = cookie;
            this._cookieCache[key] = value;
            return this;
        },

        _getFallback: function(key)
        {
            if (!this._cookieCache) {
                this._initCache();
            }
            return this._cookieCache[key];
        },

        _clearFallback: function()
        {
            for (var i in this._cookieCache) {
                document.cookie = this._generatePrefix() + i + '=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
            }
            this._cookieCache = {};
        },

        _deleteFallback: function(key)
        {
            document.cookie = this._generatePrefix() + key + '=; path=/; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
            delete this._cookieCache[key];
        },

        get: function(key)
        {
            return window.sessionStorage.getItem(key) || this._getFallback(key);
        },

        set: function(key, value, onceOnly)
        {
            try {
                window.sessionStorage.setItem(key, value);
            } catch (e) {}
            this._setFallback(key, value, onceOnly || false);
            return this;
        },
        
        'delete': function(key){
            return this.remove(key);
        },

        remove: function(key)
        {
            try {
            window.sessionStorage.removeItem(key);
            } catch (e) {};
            this._deleteFallback(key);
            return this;
        },

        _clearSession: function()
        {
          try {
                window.sessionStorage.clear();
            } catch (e) {
                for (var i in window.sessionStorage) {
                    window.sessionStorage.removeItem(i);
                }
            }
        },

        clear: function()
        {
            this._clearSession();
            this._clearFallback();
            return this;
        }

    };

    $.session._init();

})(jQuery);
define("jquery.session", ["jquery"], function(){});

define('viewmodels/journeyCheckFormUi', ['jquery', 'knockout', 'models/journeyCheckCriteria', 'stationService', 'dateUtils', 'mapper', 'utils', 'context', 'jquery.session'],
    function ($, ko, JourneyCheckCriteria, stationService, dateUtils, mapper, utils, context) {

        var journeyCriteria = new JourneyCheckCriteria(),
            stations = ko.observableArray();

        var formattedDepartureDate = ko.computed(function() {
            if (!journeyCriteria.departureDate()) {
                return '';
            }
            return journeyCriteria.departureDate().format(context.dateFormat.shortDayOfMonth);
        });

        var formattedDepartureTime = ko.computed(function () {
            if (!journeyCriteria.departureDate()) {
                return '';
            }
            return journeyCriteria.departureDate().format(context.dateFormat.time);
        });

        var swapStationDirections = function () {
             var currDepart = journeyCriteria.departureStation(),
                currArriv = journeyCriteria.arrivalStation();
           
            journeyCriteria.departureStation("");
            journeyCriteria.departureStation(currArriv);
            journeyCriteria.arrivalStation("");
            journeyCriteria.arrivalStation(currDepart);
            //till here stations are swapped

            //now swapping title also from swapped stations
            var arrivalName = stationService.findStationByCrs(journeyCriteria.arrivalStation());
            var departureName = stationService.findStationByCrs(journeyCriteria.departureStation());
            $('.arrival-station').find('.select2-selection__rendered').attr('title', arrivalName.Name + ' (' + arrivalName.CrsCode + ')');
            $('.departure-station').find('.select2-selection__rendered').attr('title', departureName.Name + ' (' + departureName.CrsCode + ')');

        };

        var init = function (prepopulationConfig) {
              if (prepopulationConfig && (prepopulationConfig.departureStation || prepopulationConfig.arrivalStation)) {
                if (prepopulationConfig.departureStation)
                    journeyCriteria.departureStation(prepopulationConfig.departureStation.crsCode);
                if (prepopulationConfig.arrivalStation)
                    journeyCriteria.arrivalStation(prepopulationConfig.arrivalStation.crsCode);
                journeyCriteria.departureType('DepartAfter');
                journeyCriteria.departureDate(dateUtils.currentDate().clone());

            } else {

                //If valid criteria is passed in the querystring, initialize form with that
                var queryCriteria = mapper.journeyCheckCriteria.fromQueryString();

                if (queryCriteria && queryCriteria.isValid()) {
                    journeyCriteria.departureStation(queryCriteria.departureStation());
                    journeyCriteria.arrivalStation(queryCriteria.arrivalStation());
                    journeyCriteria.departureDate(queryCriteria.departureDate());
                    journeyCriteria.departureType(queryCriteria.departureType());
                }
                else {
                    var currentUrl = $(location).attr('href');
                    var splittedUrl = currentUrl.split("/");
                    var departure = splittedUrl[splittedUrl.length - 2];
                    var arrival = splittedUrl[splittedUrl.length - 1];
                    if (departure.indexOf("-") !== -1) {
                        departure = departure.replace(/-/g, " ");
                    }
                    if (arrival.indexOf("-") !== -1) {
                        arrival = arrival.replace(/-/g, " ");
                    }
                    var departureCri = stationService.findStationByName(departure);
                    var arrivalCri = stationService.findStationByName(arrival);

                    journeyCriteria.departureStation(departureCri.CrsCode);
                    journeyCriteria.arrivalStation(arrivalCri.CrsCode);
                    journeyCriteria.departureType('DepartAfter');
                    journeyCriteria.departureDate(dateUtils.currentDate().clone());
                }
            }

            var path = window.location.pathname === '/' ? 'homepage' : 'content';

            $('.qtt-tabbed .qtt__search-bottom').on('webkitTransitionEnd mozTransitionEnd oTransitionEnd otransitionend transitionend', function (e) {
                if (stations().length != allStations().length && $('#tabbed-qtt-component-tab-1').hasClass('hidden') && path === 'homepage') {
                    stations(allStations());
                }
            });

            // Get a station list
            stationService.getStationsForAutocomplete().done(function (data) {
                if (path === 'homepage') {
                    allStations = ko.observableArray(data).where(function (t) { return t.text.indexOf('(Any)') === -1 });
                }
                else {
                    var filteredData = ko.observableArray(data).where(function (t) { return t.text.indexOf('!') === -1 })();
                    stations(filteredData);
                }
            });
            stationService.getStationsForAutocompletePICO().done(function (data) {
                localStorage.setItem("AllstationsPICO", JSON.stringify(data));
            });
            
        };

         var invalidSearchParamsJourneyCheck = ko.pureComputed(function () {
            return !this.departureStation.isValid() || !this.arrivalStation.isValid()
        }, journeyCriteria);

        var submit = function() {
            if (!journeyCriteria.isValid())
                return;
            if (invalidSearchParamsJourneyCheck()) return;
            var departureStationElement = $('.departure-station-journeycheckform').find('.select2-selection__rendered').attr('title'),
                arrivalStationElement = $('.arrival-station-journeycheckform').find('.select2-selection__rendered').attr('title');
            var departureStationArr = departureStationElement.substring(0, departureStationElement.lastIndexOf('('));
            var arrivalStationArr = arrivalStationElement.substring(0, arrivalStationElement.lastIndexOf('('));
            var departureStaion = $.trim(departureStationArr.toLocaleLowerCase());
            departureStaion = departureStaion.replace(/(\s|\()+/g, '-').replace(')', '').toLowerCase();
            var arrivalStation = $.trim(arrivalStationArr.toLocaleLowerCase());
            arrivalStation = arrivalStation.replace(/(\s|\()+/g, '-').replace(')', '').toLowerCase();
           
            //utils.redirect(context.environment.journeyCheckPageUrl + '/' + departureStaion + '/' + arrivalStation);
            //$.cookie.json = true;
            //$.cookie('journeyFormData', JSON.stringify(mapper.journeyCheckCriteria.toDictionary(journeyCriteria)), { expires: 730 } );
            $.session.set('departureStation', JSON.stringify(mapper.journeyCheckCriteria.toDictionary(journeyCriteria)));
            utils.redirect(context.environment.journeyCheckPageUrl + '/' + departureStaion + '/' + arrivalStation);

            // scroll to position of the form taking into account the sticky nav offset.
            $("html, body").scrollTop($('#jc-results').offset().top - 30);
        };

        /*QTT Popular stations start*/
        window.guid = "";

        var selectedDepStation = function () {
            var $this = $(event.target);
            journeyCriteria.departureStation($this.attr('data-crsCode'));

            
            qttFormUi.searchCriteria.departureStation($this.attr('data-crsCode'));
            if (journeyCriteria.searchCriteria.departureStation() !== "") {
                journeyCriteria.searchCriteria.isPopularDeparture(true); 
            }
            $('.departure-station').find('.select2-selection__rendered').attr('title', $this.text() + " (" + $this.attr('data-crsCode') + ")");
            $('.departure-station').find('.select2-selection__rendered').text($this.text() + " (" + $this.attr('data-crsCode') + ")");

            $('#select2-qtt_out_dep_st_' + guid + '-container').html($this.text() + " (" + $this.attr('data-crsCode') + ")");
            $('#qtt_out_dep_st_' + guid).val($this.attr('data-nationalLocationCode'));
            $('#select2-qtt_out_dep_st_0-container').attr('title', $this.text() + " (" + $this.attr('data-crsCode') + ")");
            $('#depart-popular-station').css('display', 'none');


        };
        var selectedArrStation = function () {
            var $this = $(event.target);
            journeyCriteria.arrivalStation($this.attr('data-crsCode'));


            if (journeyCriteria.searchCriteria.arrivalStation() !== "") {
                journeyCriteria.searchCriteria.isPopularArrival(true);   
            }
            $('.arrival-station').find('.select2-selection__rendered').attr('title', $this.text() + " (" + $this.attr('data-crsCode') + ")");
            $('.arrival-station').find('.select2-selection__rendered').text($this.text() + " (" + $this.attr('data-crsCode') + ")");
            $('#select2-qtt_out_arr_st_' + guid + '-container').html($this.text() + " (" + $this.attr('data-crsCode') + ")");
            $('#qtt_out_arr_st_' + guid).val($this.attr('data-nationalLocationCode'));
            $('#select2-qtt_out_arr_st_0-container').attr('title', $this.text() + " (" + $this.attr('data-crsCode') + ")");
            $('#arrival-popular-station').css('display', 'none');

        };

        function calWidth(selectorIndex) {
            var width = 0;
            if (selectorIndex == 1) {
                if (($('#qtt_out_arr_st_' + guid).next()[0] != "") && ($('#qtt_out_arr_st_' + guid).next()[0] != undefined)) {
                    width = $('#qtt_out_arr_st_' + guid).next()[0].style.width;
                }
            }
            else {
                if (($('#qtt_out_dep_st_' + guid).next()[0] != "") && ($('#qtt_out_dep_st_' + guid).next()[0] != undefined)) {
                    width = $('#qtt_out_dep_st_' + guid).next()[0].style.width;
                }
            }
            return width;
        }

        function depclick() {
            var arrwidth = calWidth(1);
            var depwidth = calWidth(0);
            $('#depart-popular-station_' + guid).css('width', depwidth);
            $('#arrival-popular-station_' + guid).css('width', arrwidth);

            $('#depart-popular-station_' + guid).css('display', 'block');
            $('#arrival-popular-station_' + guid).css('display', 'none');
        }
        function arrclick() {
            var arrwidth = calWidth(1);
            var depwidth = calWidth(0);
            $('#depart-popular-station_' + guid).css('width', depwidth);
            $('#arrival-popular-station_' + guid).css('width', arrwidth);
            $('#arrival-popular-station_' + guid).css('display', 'block');
            $('#depart-popular-station_' + guid).css('display', 'none');
        }



        $(document).on('keyup', function (e) {
            var arrwidth = calWidth(1);
            var depwidth = calWidth(0);
            if ($('#qtt_out_dep_st_' + guid + '_search')[0] != "" && $('#qtt_out_dep_st_' + guid + '_search')[0] != undefined) {
                if ($('#qtt_out_dep_st_' + guid + '_search')[0].value != "" || $('#qtt_out_dep_st_' + guid + '_search')[0].value != undefined) {
                    $('#depart-popular-station_' + guid).css('display', 'none');
                    $('.select2-results').css('display', 'block');
                }
                else {
                    $('#depart-popular-station_' + guid).css('width', depwidth);
                    $('#arrival-popular-station_' + guid).css('width', arrwidth);
                    $('#depart-popular-station_' + guid).css('display', 'block');
                    $('#arrival-popular-station_' + guid).css('display', 'none');
                }
            }
            if ($('#qtt_out_arr_st_' + guid + '_search')[0] != "" && $('#qtt_out_arr_st_' + guid + '_search')[0] != undefined) {
                if ($('#qtt_out_arr_st_' + guid + '_search')[0].value != "" || $('#qtt_out_arr_st_' + guid + '_search').value != undefined) {
                    $('#arrival-popular-station_' + guid).css('display', 'none');
                    $('.select2-results').css('display', 'block');
                }
                else {
                    $('#arrival-popular-station_' + guid).css('display', 'block');
                    $('#depart-popular-station').css('display', 'none');
                }
            }
        });




        $(document).on('click', function (e) {
           
          
            var arrwidth = 0;
            var depwidth = 0;
            if ($(this)[0].activeElement.id != "" && $(this)[0].activeElement.id != undefined) {
                if ($(this)[0].activeElement.id.indexOf("_st_") == -1) {
                    return false;
                }
                var id = $(this)[0].activeElement.id.split('_st_')[0];
                window.guid = $(this)[0].activeElement.id.split('_st_')[1].split('_search')[0];
                if (id.trim() == "qtt_out_dep") {
                    depclick();
                } else if (id.trim() == "qtt_out_arr") {
                    arrclick();
                }
            }
            else {
                if (e.target.className.length != undefined && e.target.className.length != "") {
                    if (($('#depart-popular-station_' + guid).css('display') !== 'none' && e.target.id !== "qtt_out_dep_st_" + guid + "_search" && e.target.className.trim() != "hasQTTwithImage") || (e.target.id == "qtt_out_arr_st_" + guid + "_search")) {
                        arrwidth = calWidth(1);
                        depwidth = calWidth(0);
                        $('#depart-popular-station_' + guid).css('width', depwidth);
                        $('#arrival-popular-station_' + guid).css('width', arrwidth);
                        $('#depart-popular-station_' + guid).css('display', 'none');
                    }
                    if ($('#arrival-popular-station' + guid).css('display') !== 'none' && e.target.id !== "qtt_out_arr_st_" + guid + "_search" && e.target.className.trim() != "hasQTTwithImage") {
                        arrwidth = calWidth(1);
                        depwidth = calWidth(0);
                        $('#depart-popular-station_' + guid).css('width', depwidth);
                        $('#arrival-popular-station_' + guid).css('width', arrwidth);
                        $('#arrival-popular-station_' + guid).css('display', 'none');
                    }
                }
            }
        });

        /*QTT Popular stations end*/
        return {
            journeyCriteria: journeyCriteria,
            formattedDepartureDate: formattedDepartureDate,
            formattedDepartureTime: formattedDepartureTime,
            stations: stations,
            init: init,
            submit: submit,
            swapStationDirections: swapStationDirections,
            selectedDepStation: selectedDepStation,
            selectedArrStation: selectedArrStation,
            invalidSearchParamsJourneyCheck: invalidSearchParamsJourneyCheck
        };
    });

/**
 * jQuery CSS Customizable Scrollbar
 *
 * Copyright 2015, Yuriy Khabarov
 * Dual licensed under the MIT or GPL Version 2 licenses.
 *
 * If you found bug, please contact me via email <13real008@gmail.com>
 *
 * @author Yuriy Khabarov aka Gromo
 * @version 0.2.11
 * @url https://github.com/gromo/jquery.scrollbar/
 *
 */
;
(function (root, factory) {
    if (typeof define === 'function' && define.amd) {
        define('jqueryscrollbar',['jquery'], factory);
    } else if (typeof exports !== "undefined") {
        factory(require('jquery'));
    } else {
        factory(root.jQuery);
    }
}(this, function ($) {
    'use strict';

    // init flags & variables
    var debug = false;

    var browser = {
        data: {
            index: 0,
            name: 'scrollbar'
        },
        firefox: /firefox/i.test(navigator.userAgent),
        macosx: /mac/i.test(navigator.platform),
        msedge: /edge\/\d+/i.test(navigator.userAgent),
        msie: /(msie|trident)/i.test(navigator.userAgent),
        mobile: /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent),
        overlay: null,
        scroll: null,
        scrolls: [],
        webkit: /webkit/i.test(navigator.userAgent) && !/edge\/\d+/i.test(navigator.userAgent)
    };

    browser.scrolls.add = function (instance) {
        this.remove(instance).push(instance);
    };
    browser.scrolls.remove = function (instance) {
        while ($.inArray(instance, this) >= 0) {
            this.splice($.inArray(instance, this), 1);
        }
        return this;
    };

    var defaults = {
        autoScrollSize: true, // automatically calculate scrollsize
        autoUpdate: true, // update scrollbar if content/container size changed
        debug: false, // debug mode
        disableBodyScroll: false, // disable body scroll if mouse over container
        duration: 200, // scroll animate duration in ms
        ignoreMobile: false, // ignore mobile devices
        ignoreOverlay: false, // ignore browsers with overlay scrollbars (mobile, MacOS)
        isRtl: false, // is RTL
        scrollStep: 30, // scroll step for scrollbar arrows
        showArrows: false, // add class to show arrows
        stepScrolling: true, // when scrolling to scrollbar mousedown position

        scrollx: null, // horizontal scroll element
        scrolly: null, // vertical scroll element

        onDestroy: null, // callback function on destroy,
        onFallback: null, // callback function if scrollbar is not initialized
        onInit: null, // callback function on first initialization
        onScroll: null, // callback function on content scrolling
        onUpdate: null            // callback function on init/resize (before scrollbar size calculation)
    };


    var BaseScrollbar = function (container) {

        if (!browser.scroll) {
            browser.overlay = isScrollOverlaysContent();
            browser.scroll = getBrowserScrollSize();
            updateScrollbars();

            $(window).resize(function () {
                var forceUpdate = false;
                if (browser.scroll && (browser.scroll.height || browser.scroll.width)) {
                    var scroll = getBrowserScrollSize();
                    if (scroll.height !== browser.scroll.height || scroll.width !== browser.scroll.width) {
                        browser.scroll = scroll;
                        forceUpdate = true; // handle page zoom
                    }
                }
                updateScrollbars(forceUpdate);
            });
        }

        this.container = container;
        this.namespace = '.scrollbar_' + browser.data.index++;
        this.options = $.extend({}, defaults, window.jQueryScrollbarOptions || {});
        this.scrollTo = null;
        this.scrollx = {};
        this.scrolly = {};

        container.data(browser.data.name, this);
        browser.scrolls.add(this);
    };

    BaseScrollbar.prototype = {
        destroy: function () {

            if (!this.wrapper) {
                return;
            }

            this.container.removeData(browser.data.name);
            browser.scrolls.remove(this);

            // init variables
            var scrollLeft = this.container.scrollLeft();
            var scrollTop = this.container.scrollTop();

            this.container.insertBefore(this.wrapper).css({
                "height": "",
                "margin": "",
                "max-height": ""
            })
                .removeClass('scroll-content scroll-scrollx_visible scroll-scrolly_visible')
                .off(this.namespace)
                .scrollLeft(scrollLeft)
                .scrollTop(scrollTop);

            this.scrollx.scroll.removeClass('scroll-scrollx_visible').find('div').addBack().off(this.namespace);
            this.scrolly.scroll.removeClass('scroll-scrolly_visible').find('div').addBack().off(this.namespace);

            this.wrapper.remove();

            $(document).add('body').off(this.namespace);

            if ($.isFunction(this.options.onDestroy)) {
                this.options.onDestroy.apply(this, [this.container]);
            }
        },
        init: function (options) {

            // init variables
            var S = this,
                c = this.container,
                cw = this.containerWrapper || c,
                namespace = this.namespace,
                o = $.extend(this.options, options || {}),
                s = {x: this.scrollx, y: this.scrolly},
            w = this.wrapper,
                cssOptions = {};

            var initScroll = {
                scrollLeft: c.scrollLeft(),
                scrollTop: c.scrollTop()
            };

            // do not init if in ignorable browser
            if ((browser.mobile && o.ignoreMobile)
                || (browser.overlay && o.ignoreOverlay)
                || (browser.macosx && !browser.webkit) // still required to ignore nonWebKit browsers on Mac
                ) {
                if ($.isFunction(o.onFallback)) {
                    o.onFallback.apply(this, [c]);
                }
                return false;
            }

            // init scroll container
            if (!w) {
                this.wrapper = w = $('<div>').addClass('scroll-wrapper').addClass(c.attr('class'))
                    .css('position', c.css('position') === 'absolute' ? 'absolute' : 'relative')
                    .insertBefore(c).append(c);

                if (o.isRtl) {
                    w.addClass('scroll--rtl');
                }

                if (c.is('textarea')) {
                    this.containerWrapper = cw = $('<div>').insertBefore(c).append(c);
                    w.addClass('scroll-textarea');
                }

                cssOptions = {
                    "height": "auto",
                    "margin-bottom": browser.scroll.height * -1 + 'px',
                    "max-height": ""
                };
                cssOptions[o.isRtl ? 'margin-left' : 'margin-right'] = browser.scroll.width * -1 + 'px';

                cw.addClass('scroll-content').css(cssOptions);

                c.on('scroll' + namespace, function (event) {
                    var scrollLeft = c.scrollLeft();
                    var scrollTop = c.scrollTop();
                    if (o.isRtl) {
                        // webkit   0:100
                        // ie/edge  100:0
                        // firefox -100:0
                        switch (true) {
                            case browser.firefox:
                                scrollLeft = Math.abs(scrollLeft);
                            case browser.msedge || browser.msie:
                                scrollLeft = c[0].scrollWidth - c[0].clientWidth - scrollLeft;
                                break;
                        }
                    }
                    if ($.isFunction(o.onScroll)) {
                        o.onScroll.call(S, {
                            maxScroll: s.y.maxScrollOffset,
                            scroll: scrollTop,
                            size: s.y.size,
                            visible: s.y.visible
                        }, {
                            maxScroll: s.x.maxScrollOffset,
                            scroll: scrollLeft,
                            size: s.x.size,
                            visible: s.x.visible
                        });
                    }
                    s.x.isVisible && s.x.scroll.bar.css('left', scrollLeft * s.x.kx + 'px');
                    s.y.isVisible && s.y.scroll.bar.css('top', scrollTop * s.y.kx + 'px');
                });

                /* prevent native scrollbars to be visible on #anchor click */
                w.on('scroll' + namespace, function () {
                    w.scrollTop(0).scrollLeft(0);
                });

                if (o.disableBodyScroll) {
                    var handleMouseScroll = function (event) {
                        isVerticalScroll(event) ?
                            s.y.isVisible && s.y.mousewheel(event) :
                            s.x.isVisible && s.x.mousewheel(event);
                    };
                    w.on('MozMousePixelScroll' + namespace, handleMouseScroll);
                    w.on('mousewheel' + namespace, handleMouseScroll);

                    if (browser.mobile) {
                        w.on('touchstart' + namespace, function (event) {
                            var touch = event.originalEvent.touches && event.originalEvent.touches[0] || event;
                            var originalTouch = {
                                pageX: touch.pageX,
                                pageY: touch.pageY
                            };
                            var originalScroll = {
                                left: c.scrollLeft(),
                                top: c.scrollTop()
                            };
                            $(document).on('touchmove' + namespace, function (event) {
                                var touch = event.originalEvent.targetTouches && event.originalEvent.targetTouches[0] || event;
                                c.scrollLeft(originalScroll.left + originalTouch.pageX - touch.pageX);
                                c.scrollTop(originalScroll.top + originalTouch.pageY - touch.pageY);
                                event.preventDefault();
                            });
                            $(document).on('touchend' + namespace, function () {
                                $(document).off(namespace);
                            });
                        });
                    }
                }
                if ($.isFunction(o.onInit)) {
                    o.onInit.apply(this, [c]);
                }
            } else {
                cssOptions = {
                    "height": "auto",
                    "margin-bottom": browser.scroll.height * -1 + 'px',
                    "max-height": ""
                };
                cssOptions[o.isRtl ? 'margin-left' : 'margin-right'] = browser.scroll.width * -1 + 'px';
                cw.css(cssOptions);
            }

            // init scrollbars & recalculate sizes
            $.each(s, function (d, scrollx) {

                var scrollCallback = null;
                var scrollForward = 1;
                var scrollOffset = (d === 'x') ? 'scrollLeft' : 'scrollTop';
                var scrollStep = o.scrollStep;
                var scrollTo = function () {
                    var currentOffset = c[scrollOffset]();
                    c[scrollOffset](currentOffset + scrollStep);
                    if (scrollForward == 1 && (currentOffset + scrollStep) >= scrollToValue)
                        currentOffset = c[scrollOffset]();
                    if (scrollForward == -1 && (currentOffset + scrollStep) <= scrollToValue)
                        currentOffset = c[scrollOffset]();
                    if (c[scrollOffset]() == currentOffset && scrollCallback) {
                        scrollCallback();
                    }
                }
                var scrollToValue = 0;

                if (!scrollx.scroll) {

                    scrollx.scroll = S._getScroll(o['scroll' + d]).addClass('scroll-' + d);

                    if (o.showArrows) {
                        scrollx.scroll.addClass('scroll-element_arrows_visible');
                    }

                    scrollx.mousewheel = function (event) {

                        if (!scrollx.isVisible || (d === 'x' && isVerticalScroll(event))) {
                            return true;
                        }
                        if (d === 'y' && !isVerticalScroll(event)) {
                            s.x.mousewheel(event);
                            return true;
                        }

                        var delta = event.originalEvent.wheelDelta * -1 || event.originalEvent.detail;
                        var maxScrollValue = scrollx.size - scrollx.visible - scrollx.offset;

                        // fix new mozilla
                        if (!delta) {
                            if (d === 'x' && !!event.originalEvent.deltaX) {
                                delta = event.originalEvent.deltaX * 40;
                            } else if (d === 'y' && !!event.originalEvent.deltaY) {
                                delta = event.originalEvent.deltaY * 40;
                            }
                        }

                        if ((delta > 0 && scrollToValue < maxScrollValue) || (delta < 0 && scrollToValue > 0)) {
                            scrollToValue = scrollToValue + delta;
                            if (scrollToValue < 0)
                                scrollToValue = 0;
                            if (scrollToValue > maxScrollValue)
                                scrollToValue = maxScrollValue;

                            S.scrollTo = S.scrollTo || {};
                            S.scrollTo[scrollOffset] = scrollToValue;
                            setTimeout(function () {
                                if (S.scrollTo) {
                                    c.stop().animate(S.scrollTo, 240, 'linear', function () {
                                        scrollToValue = c[scrollOffset]();
                                    });
                                    S.scrollTo = null;
                                }
                            }, 1);
                        }

                        event.preventDefault();
                        return false;
                    };

                    scrollx.scroll
                        .on('MozMousePixelScroll' + namespace, scrollx.mousewheel)
                        .on('mousewheel' + namespace, scrollx.mousewheel)
                        .on('mouseenter' + namespace, function () {
                            scrollToValue = c[scrollOffset]();
                        });

                    // handle arrows & scroll inner mousedown event
                    scrollx.scroll.find('.scroll-arrow, .scroll-element_track')
                        .on('mousedown' + namespace, function (event) {

                            if (event.which != 1) // lmb
                                return true;

                            scrollForward = 1;

                            var data = {
                                eventOffset: event[(d === 'x') ? 'pageX' : 'pageY'],
                                maxScrollValue: scrollx.size - scrollx.visible - scrollx.offset,
                                scrollbarOffset: scrollx.scroll.bar.offset()[(d === 'x') ? 'left' : 'top'],
                                scrollbarSize: scrollx.scroll.bar[(d === 'x') ? 'outerWidth' : 'outerHeight']()
                            };
                            var timeout = 0, timer = 0;

                            if ($(this).hasClass('scroll-arrow')) {
                                scrollForward = $(this).hasClass("scroll-arrow_more") ? 1 : -1;
                                scrollStep = o.scrollStep * scrollForward;
                                scrollToValue = scrollForward > 0 ? data.maxScrollValue : 0;
                                if (o.isRtl) {
                                    switch(true){
                                        case browser.firefox:
                                            scrollToValue = scrollForward > 0 ? 0: data.maxScrollValue * -1;
                                            break;
                                        case browser.msie || browser.msedge:
                                            break;
                                    }
                                }
                            } else {
                                scrollForward = (data.eventOffset > (data.scrollbarOffset + data.scrollbarSize) ? 1
                                    : (data.eventOffset < data.scrollbarOffset ? -1 : 0));
                                if(d === 'x' && o.isRtl && (browser.msie || browser.msedge))
                                    scrollForward = scrollForward * -1;
                                scrollStep = Math.round(scrollx.visible * 0.75) * scrollForward;
                                scrollToValue = (data.eventOffset - data.scrollbarOffset -
                                    (o.stepScrolling ? (scrollForward == 1 ? data.scrollbarSize : 0)
                                        : Math.round(data.scrollbarSize / 2)));
                                scrollToValue = c[scrollOffset]() + (scrollToValue / scrollx.kx);
                            }

                            S.scrollTo = S.scrollTo || {};
                            S.scrollTo[scrollOffset] = o.stepScrolling ? c[scrollOffset]() + scrollStep : scrollToValue;

                            if (o.stepScrolling) {
                                scrollCallback = function () {
                                    scrollToValue = c[scrollOffset]();
                                    clearInterval(timer);
                                    clearTimeout(timeout);
                                    timeout = 0;
                                    timer = 0;
                                };
                                timeout = setTimeout(function () {
                                    timer = setInterval(scrollTo, 40);
                                }, o.duration + 100);
                            }

                            setTimeout(function () {
                                if (S.scrollTo) {
                                    c.animate(S.scrollTo, o.duration);
                                    S.scrollTo = null;
                                }
                            }, 1);

                            return S._handleMouseDown(scrollCallback, event);
                        });

                    // handle scrollbar drag'n'drop
                    scrollx.scroll.bar.on('mousedown' + namespace, function (event) {

                        if (event.which != 1) // lmb
                            return true;

                        var eventPosition = event[(d === 'x') ? 'pageX' : 'pageY'];
                        var initOffset = c[scrollOffset]();

                        scrollx.scroll.addClass('scroll-draggable');

                        $(document).on('mousemove' + namespace, function (event) {
                            var diff = parseInt((event[(d === 'x') ? 'pageX' : 'pageY'] - eventPosition) / scrollx.kx, 10);
                            if (d === 'x' && o.isRtl && (browser.msie || browser.msedge))
                                diff = diff * -1;
                            c[scrollOffset](initOffset + diff);
                        });

                        return S._handleMouseDown(function () {
                            scrollx.scroll.removeClass('scroll-draggable');
                            scrollToValue = c[scrollOffset]();
                        }, event);
                    });
                }
            });

            // remove classes & reset applied styles
            $.each(s, function (d, scrollx) {
                var scrollClass = 'scroll-scroll' + d + '_visible';
                var scrolly = (d == "x") ? s.y : s.x;

                scrollx.scroll.removeClass(scrollClass);
                scrolly.scroll.removeClass(scrollClass);
                cw.removeClass(scrollClass);
            });

            // calculate init sizes
            $.each(s, function (d, scrollx) {
                $.extend(scrollx, (d == "x") ? {
                    offset: parseInt(c.css('left'), 10) || 0,
                    size: c.prop('scrollWidth'),
                    visible: w.width()
                } : {
                    offset: parseInt(c.css('top'), 10) || 0,
                    size: c.prop('scrollHeight'),
                    visible: w.height()
                });
            });

            // update scrollbar visibility/dimensions
            this._updateScroll('x', this.scrollx);
            this._updateScroll('y', this.scrolly);

            if ($.isFunction(o.onUpdate)) {
                o.onUpdate.apply(this, [c]);
            }

            // calculate scroll size
            $.each(s, function (d, scrollx) {

                var cssOffset = (d === 'x') ? 'left' : 'top';
                var cssFullSize = (d === 'x') ? 'outerWidth' : 'outerHeight';
                var cssSize = (d === 'x') ? 'width' : 'height';
                var offset = parseInt(c.css(cssOffset), 10) || 0;

                var AreaSize = scrollx.size;
                var AreaVisible = scrollx.visible + offset;

                var scrollSize = scrollx.scroll.size[cssFullSize]() + (parseInt(scrollx.scroll.size.css(cssOffset), 10) || 0);

                if (o.autoScrollSize) {
                    scrollx.scrollbarSize = parseInt(scrollSize * AreaVisible / AreaSize, 10);
                    scrollx.scroll.bar.css(cssSize, scrollx.scrollbarSize + 'px');
                }

                scrollx.scrollbarSize = scrollx.scroll.bar[cssFullSize]();
                scrollx.kx = ((scrollSize - scrollx.scrollbarSize) / (AreaSize - AreaVisible)) || 1;
                scrollx.maxScrollOffset = AreaSize - AreaVisible;
            });

            c.scrollLeft(initScroll.scrollLeft).scrollTop(initScroll.scrollTop).trigger('scroll');
        },
        /**
         * Get scrollx/scrolly object
         *
         * @param {Mixed} scroll
         * @returns {jQuery} scroll object
         */
        _getScroll: function (scroll) {
            var types = {
                advanced: [
                    '<div class="scroll-element">',
                    '<div class="scroll-element_corner"></div>',
                    '<div class="scroll-arrow scroll-arrow_less"></div>',
                    '<div class="scroll-arrow scroll-arrow_more"></div>',
                    '<div class="scroll-element_outer">',
                    '<div class="scroll-element_size"></div>', // required! used for scrollbar size calculation !
                    '<div class="scroll-element_inner-wrapper">',
                    '<div class="scroll-element_inner scroll-element_track">', // used for handling scrollbar click
                    '<div class="scroll-element_inner-bottom"></div>',
                    '</div>',
                    '</div>',
                    '<div class="scroll-bar">', // required
                    '<div class="scroll-bar_body">',
                    '<div class="scroll-bar_body-inner"></div>',
                    '</div>',
                    '<div class="scroll-bar_bottom"></div>',
                    '<div class="scroll-bar_center"></div>',
                    '</div>',
                    '</div>',
                    '</div>'
                ].join(''),
                simple: [
                    '<div class="scroll-element">',
                    '<div class="scroll-element_outer">',
                    '<div class="scroll-element_size"></div>', // required! used for scrollbar size calculation !
                    '<div class="scroll-element_track"></div>', // used for handling scrollbar click
                    '<div class="scroll-bar"></div>', // required
                    '</div>',
                    '</div>'
                ].join('')
            };
            if (types[scroll]) {
                scroll = types[scroll];
            }
            if (!scroll) {
                scroll = types['simple'];
            }
            if (typeof (scroll) == 'string') {
                scroll = $(scroll).appendTo(this.wrapper);
            } else {
                scroll = $(scroll);
            }
            $.extend(scroll, {
                bar: scroll.find('.scroll-bar'),
                size: scroll.find('.scroll-element_size'),
                track: scroll.find('.scroll-element_track')
            });
            return scroll;
        },
        _handleMouseDown: function (callback, event) {

            var namespace = this.namespace;

            $(document).on('blur' + namespace, function () {
                $(document).add('body').off(namespace);
                callback && callback();
            });
            $(document).on('dragstart' + namespace, function (event) {
                event.preventDefault();
                return false;
            });
            $(document).on('mouseup' + namespace, function () {
                $(document).add('body').off(namespace);
                callback && callback();
            });
            $('body').on('selectstart' + namespace, function (event) {
                event.preventDefault();
                return false;
            });

            event && event.preventDefault();
            return false;
        },
        _updateScroll: function (d, scrollx) {

            var container = this.container,
                containerWrapper = this.containerWrapper || container,
                scrollClass = 'scroll-scroll' + d + '_visible',
                scrolly = (d === 'x') ? this.scrolly : this.scrollx,
                offset = parseInt(this.container.css((d === 'x') ? 'left' : 'top'), 10) || 0,
                wrapper = this.wrapper;

            var AreaSize = scrollx.size;
            var AreaVisible = scrollx.visible + offset;

            scrollx.isVisible = (AreaSize - AreaVisible) > 1; // bug in IE9/11 with 1px diff
            if (scrollx.isVisible) {
                scrollx.scroll.addClass(scrollClass);
                scrolly.scroll.addClass(scrollClass);
                containerWrapper.addClass(scrollClass);
            } else {
                scrollx.scroll.removeClass(scrollClass);
                scrolly.scroll.removeClass(scrollClass);
                containerWrapper.removeClass(scrollClass);
            }

            if (d === 'y') {
                if (container.is('textarea') || AreaSize < AreaVisible) {
                    containerWrapper.css({
                        "height": (AreaVisible + browser.scroll.height) + 'px',
                        "max-height": "none"
                    });
                } else {
                    containerWrapper.css({
                        //"height": "auto", // do not reset height value: issue with height:100%!
                        "max-height": (AreaVisible + browser.scroll.height) + 'px'
                    });
                }
            }

            if (scrollx.size != container.prop('scrollWidth')
                || scrolly.size != container.prop('scrollHeight')
                || scrollx.visible != wrapper.width()
                || scrolly.visible != wrapper.height()
                || scrollx.offset != (parseInt(container.css('left'), 10) || 0)
                || scrolly.offset != (parseInt(container.css('top'), 10) || 0)
                ) {
                $.extend(this.scrollx, {
                    offset: parseInt(container.css('left'), 10) || 0,
                    size: container.prop('scrollWidth'),
                    visible: wrapper.width()
                });
                $.extend(this.scrolly, {
                    offset: parseInt(container.css('top'), 10) || 0,
                    size: this.container.prop('scrollHeight'),
                    visible: wrapper.height()
                });
                this._updateScroll(d === 'x' ? 'y' : 'x', scrolly);
            }
        }
    };

    var CustomScrollbar = BaseScrollbar;

    /*
     * Extend jQuery as plugin
     *
     * @param {Mixed} command to execute
     * @param {Mixed} arguments as Array
     * @return {jQuery}
     */
    $.fn.scrollbar = function (command, args) {
        if (typeof command !== 'string') {
            args = command;
            command = 'init';
        }
        if (typeof args === 'undefined') {
            args = [];
        }
        if (!$.isArray(args)) {
            args = [args];
        }
        this.not('body, .scroll-wrapper').each(function () {
            var element = $(this),
                instance = element.data(browser.data.name);
            if (instance || command === 'init') {
                if (!instance) {
                    instance = new CustomScrollbar(element);
                }
                if (instance[command]) {
                    instance[command].apply(instance, args);
                }
            }
        });
        return this;
    };

    /**
     * Connect default options to global object
     */
    $.fn.scrollbar.options = defaults;


    /**
     * Check if scroll content/container size is changed
     */

    var updateScrollbars = (function () {
        var timer = 0,
            timerCounter = 0;

        return function (force) {
            var i, container, options, scroll, wrapper, scrollx, scrolly;
            for (i = 0; i < browser.scrolls.length; i++) {
                scroll = browser.scrolls[i];
                container = scroll.container;
                options = scroll.options;
                wrapper = scroll.wrapper;
                scrollx = scroll.scrollx;
                scrolly = scroll.scrolly;
                if (force || (options.autoUpdate && wrapper && wrapper.is(':visible') &&
                    (container.prop('scrollWidth') != scrollx.size || container.prop('scrollHeight') != scrolly.size || wrapper.width() != scrollx.visible || wrapper.height() != scrolly.visible))) {
                    scroll.init();

                    if (options.debug) {
                        window.console && console.log({
                            scrollHeight: container.prop('scrollHeight') + ':' + scroll.scrolly.size,
                            scrollWidth: container.prop('scrollWidth') + ':' + scroll.scrollx.size,
                            visibleHeight: wrapper.height() + ':' + scroll.scrolly.visible,
                            visibleWidth: wrapper.width() + ':' + scroll.scrollx.visible
                        }, true);
                        timerCounter++;
                    }
                }
            }
            if (debug && timerCounter > 10) {
                window.console && console.log('Scroll updates exceed 10');
                updateScrollbars = function () {};
            } else {
                clearTimeout(timer);
                timer = setTimeout(updateScrollbars, 300);
            }
        };
    })();

    /* ADDITIONAL FUNCTIONS */
    /**
     * Get native browser scrollbar size (height/width)
     *
     * @param {Boolean} actual size or CSS size, default - CSS size
     * @returns {Object} with height, width
     */
    function getBrowserScrollSize(actualSize) {

        if (browser.webkit && !actualSize) {
            return {
                height: 0,
                width: 0
            };
        }

        if (!browser.data.outer) {
            var css = {
                "border": "none",
                "box-sizing": "content-box",
                "height": "200px",
                "margin": "0",
                "padding": "0",
                "width": "200px"
            };
            browser.data.inner = $("<div>").css($.extend({}, css));
            browser.data.outer = $("<div>").css($.extend({
                "left": "-1000px",
                "overflow": "scroll",
                "position": "absolute",
                "top": "-1000px"
            }, css)).append(browser.data.inner).appendTo("body");
        }

        browser.data.outer.scrollLeft(1000).scrollTop(1000);

        return {
            height: Math.ceil((browser.data.outer.offset().top - browser.data.inner.offset().top) || 0),
            width: Math.ceil((browser.data.outer.offset().left - browser.data.inner.offset().left) || 0)
        };
    }

    /**
     * Check if native browser scrollbars overlay content
     *
     * @returns {Boolean}
     */
    function isScrollOverlaysContent() {
        var scrollSize = getBrowserScrollSize(true);
        return !(scrollSize.height || scrollSize.width);
    }

    function isVerticalScroll(event) {
        var e = event.originalEvent;
        if (e.axis && e.axis === e.HORIZONTAL_AXIS)
            return false;
        if (e.wheelDeltaX)
            return false;
        return true;
    }


    /**
     * Extend AngularJS as UI directive
     * and expose a provider for override default config
     *
     */
    if (window.angular) {
        (function (angular) {
            angular.module('jQueryScrollbar', [])
                .provider('jQueryScrollbar', function () {
                    var defaultOptions = defaults;
                    return {
                        setOptions: function (options) {
                            angular.extend(defaultOptions, options);
                        },
                        $get: function () {
                            return {
                                options: angular.copy(defaultOptions)
                            };
                        }
                    };
                })
                .directive('jqueryScrollbar', ['jQueryScrollbar', '$parse', function (jQueryScrollbar, $parse) {
                        return {
                            restrict: "AC",
                            link: function (scope, element, attrs) {
                                var model = $parse(attrs.jqueryScrollbar),
                                    options = model(scope);
                                element.scrollbar(options || jQueryScrollbar.options)
                                    .on('$destroy', function () {
                                        element.scrollbar('destroy');
                                    });
                            }
                        };
                    }]);
        })(window.angular);
    }
}));

/*!
 * Bootstrap v3.4.1 (https://getbootstrap.com/)
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under the MIT license
 */

if (typeof jQuery === 'undefined') {
  throw new Error('Bootstrap\'s JavaScript requires jQuery')
}

+function ($) {
  'use strict';
  var version = $.fn.jquery.split(' ')[0].split('.')
  if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) {
    throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4')
  }
}(jQuery);

/* ========================================================================
 * Bootstrap: transition.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#transitions
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // CSS TRANSITION SUPPORT (Shoutout: https://modernizr.com/)
  // ============================================================

  function transitionEnd() {
    var el = document.createElement('bootstrap')

    var transEndEventNames = {
      WebkitTransition : 'webkitTransitionEnd',
      MozTransition    : 'transitionend',
      OTransition      : 'oTransitionEnd otransitionend',
      transition       : 'transitionend'
    }

    for (var name in transEndEventNames) {
      if (el.style[name] !== undefined) {
        return { end: transEndEventNames[name] }
      }
    }

    return false // explicit for ie8 (  ._.)
  }

  // https://blog.alexmaccaw.com/css-transitions
  $.fn.emulateTransitionEnd = function (duration) {
    var called = false
    var $el = this
    $(this).one('bsTransitionEnd', function () { called = true })
    var callback = function () { if (!called) $($el).trigger($.support.transition.end) }
    setTimeout(callback, duration)
    return this
  }

  $(function () {
    $.support.transition = transitionEnd()

    if (!$.support.transition) return

    $.event.special.bsTransitionEnd = {
      bindType: $.support.transition.end,
      delegateType: $.support.transition.end,
      handle: function (e) {
        if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)
      }
    }
  })

}(jQuery);

/* ========================================================================
 * Bootstrap: alert.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#alerts
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // ALERT CLASS DEFINITION
  // ======================

  var dismiss = '[data-dismiss="alert"]'
  var Alert   = function (el) {
    $(el).on('click', dismiss, this.close)
  }

  Alert.VERSION = '3.4.1'

  Alert.TRANSITION_DURATION = 150

  Alert.prototype.close = function (e) {
    var $this    = $(this)
    var selector = $this.attr('data-target')

    if (!selector) {
      selector = $this.attr('href')
      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
    }

    selector    = selector === '#' ? [] : selector
    var $parent = $(document).find(selector)

    if (e) e.preventDefault()

    if (!$parent.length) {
      $parent = $this.closest('.alert')
    }

    $parent.trigger(e = $.Event('close.bs.alert'))

    if (e.isDefaultPrevented()) return

    $parent.removeClass('in')

    function removeElement() {
      // detach from parent, fire event then clean up data
      $parent.detach().trigger('closed.bs.alert').remove()
    }

    $.support.transition && $parent.hasClass('fade') ?
      $parent
        .one('bsTransitionEnd', removeElement)
        .emulateTransitionEnd(Alert.TRANSITION_DURATION) :
      removeElement()
  }


  // ALERT PLUGIN DEFINITION
  // =======================

  function Plugin(option) {
    return this.each(function () {
      var $this = $(this)
      var data  = $this.data('bs.alert')

      if (!data) $this.data('bs.alert', (data = new Alert(this)))
      if (typeof option == 'string') data[option].call($this)
    })
  }

  var old = $.fn.alert

  $.fn.alert             = Plugin
  $.fn.alert.Constructor = Alert


  // ALERT NO CONFLICT
  // =================

  $.fn.alert.noConflict = function () {
    $.fn.alert = old
    return this
  }


  // ALERT DATA-API
  // ==============

  $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)

}(jQuery);

/* ========================================================================
 * Bootstrap: button.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#buttons
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // BUTTON PUBLIC CLASS DEFINITION
  // ==============================

  var Button = function (element, options) {
    this.$element  = $(element)
    this.options   = $.extend({}, Button.DEFAULTS, options)
    this.isLoading = false
  }

  Button.VERSION  = '3.4.1'

  Button.DEFAULTS = {
    loadingText: 'loading...'
  }

  Button.prototype.setState = function (state) {
    var d    = 'disabled'
    var $el  = this.$element
    var val  = $el.is('input') ? 'val' : 'html'
    var data = $el.data()

    state += 'Text'

    if (data.resetText == null) $el.data('resetText', $el[val]())

    // push to event loop to allow forms to submit
    setTimeout($.proxy(function () {
      $el[val](data[state] == null ? this.options[state] : data[state])

      if (state == 'loadingText') {
        this.isLoading = true
        $el.addClass(d).attr(d, d).prop(d, true)
      } else if (this.isLoading) {
        this.isLoading = false
        $el.removeClass(d).removeAttr(d).prop(d, false)
      }
    }, this), 0)
  }

  Button.prototype.toggle = function () {
    var changed = true
    var $parent = this.$element.closest('[data-toggle="buttons"]')

    if ($parent.length) {
      var $input = this.$element.find('input')
      if ($input.prop('type') == 'radio') {
        if ($input.prop('checked')) changed = false
        $parent.find('.active').removeClass('active')
        this.$element.addClass('active')
      } else if ($input.prop('type') == 'checkbox') {
        if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false
        this.$element.toggleClass('active')
      }
      $input.prop('checked', this.$element.hasClass('active'))
      if (changed) $input.trigger('change')
    } else {
      this.$element.attr('aria-pressed', !this.$element.hasClass('active'))
      this.$element.toggleClass('active')
    }
  }


  // BUTTON PLUGIN DEFINITION
  // ========================

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.button')
      var options = typeof option == 'object' && option

      if (!data) $this.data('bs.button', (data = new Button(this, options)))

      if (option == 'toggle') data.toggle()
      else if (option) data.setState(option)
    })
  }

  var old = $.fn.button

  $.fn.button             = Plugin
  $.fn.button.Constructor = Button


  // BUTTON NO CONFLICT
  // ==================

  $.fn.button.noConflict = function () {
    $.fn.button = old
    return this
  }


  // BUTTON DATA-API
  // ===============

  $(document)
    .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
      var $btn = $(e.target).closest('.btn')
      Plugin.call($btn, 'toggle')
      if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) {
        // Prevent double click on radios, and the double selections (so cancellation) on checkboxes
        e.preventDefault()
        // The target component still receive the focus
        if ($btn.is('input,button')) $btn.trigger('focus')
        else $btn.find('input:visible,button:visible').first().trigger('focus')
      }
    })
    .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) {
      $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))
    })

}(jQuery);

/* ========================================================================
 * Bootstrap: carousel.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#carousel
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // CAROUSEL CLASS DEFINITION
  // =========================

  var Carousel = function (element, options) {
    this.$element    = $(element)
    this.$indicators = this.$element.find('.carousel-indicators')
    this.options     = options
    this.paused      = null
    this.sliding     = null
    this.interval    = null
    this.$active     = null
    this.$items      = null

    this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))

    this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element
      .on('mouseenter.bs.carousel', $.proxy(this.pause, this))
      .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))
  }

  Carousel.VERSION  = '3.4.1'

  Carousel.TRANSITION_DURATION = 600

  Carousel.DEFAULTS = {
    interval: 5000,
    pause: 'hover',
    wrap: true,
    keyboard: true
  }

  Carousel.prototype.keydown = function (e) {
    if (/input|textarea/i.test(e.target.tagName)) return
    switch (e.which) {
      case 37: this.prev(); break
      case 39: this.next(); break
      default: return
    }

    e.preventDefault()
  }

  Carousel.prototype.cycle = function (e) {
    e || (this.paused = false)

    this.interval && clearInterval(this.interval)

    this.options.interval
      && !this.paused
      && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))

    return this
  }

  Carousel.prototype.getItemIndex = function (item) {
    this.$items = item.parent().children('.item')
    return this.$items.index(item || this.$active)
  }

  Carousel.prototype.getItemForDirection = function (direction, active) {
    var activeIndex = this.getItemIndex(active)
    var willWrap = (direction == 'prev' && activeIndex === 0)
                || (direction == 'next' && activeIndex == (this.$items.length - 1))
    if (willWrap && !this.options.wrap) return active
    var delta = direction == 'prev' ? -1 : 1
    var itemIndex = (activeIndex + delta) % this.$items.length
    return this.$items.eq(itemIndex)
  }

  Carousel.prototype.to = function (pos) {
    var that        = this
    var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))

    if (pos > (this.$items.length - 1) || pos < 0) return

    if (this.sliding)       return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
    if (activeIndex == pos) return this.pause().cycle()

    return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
  }

  Carousel.prototype.pause = function (e) {
    e || (this.paused = true)

    if (this.$element.find('.next, .prev').length && $.support.transition) {
      this.$element.trigger($.support.transition.end)
      this.cycle(true)
    }

    this.interval = clearInterval(this.interval)

    return this
  }

  Carousel.prototype.next = function () {
    if (this.sliding) return
    return this.slide('next')
  }

  Carousel.prototype.prev = function () {
    if (this.sliding) return
    return this.slide('prev')
  }

  Carousel.prototype.slide = function (type, next) {
    var $active   = this.$element.find('.item.active')
    var $next     = next || this.getItemForDirection(type, $active)
    var isCycling = this.interval
    var direction = type == 'next' ? 'left' : 'right'
    var that      = this

    if ($next.hasClass('active')) return (this.sliding = false)

    var relatedTarget = $next[0]
    var slideEvent = $.Event('slide.bs.carousel', {
      relatedTarget: relatedTarget,
      direction: direction
    })
    this.$element.trigger(slideEvent)
    if (slideEvent.isDefaultPrevented()) return

    this.sliding = true

    isCycling && this.pause()

    if (this.$indicators.length) {
      this.$indicators.find('.active').removeClass('active')
      var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])
      $nextIndicator && $nextIndicator.addClass('active')
    }

    var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid"
    if ($.support.transition && this.$element.hasClass('slide')) {
      $next.addClass(type)
      if (typeof $next === 'object' && $next.length) {
        $next[0].offsetWidth // force reflow
      }
      $active.addClass(direction)
      $next.addClass(direction)
      $active
        .one('bsTransitionEnd', function () {
          $next.removeClass([type, direction].join(' ')).addClass('active')
          $active.removeClass(['active', direction].join(' '))
          that.sliding = false
          setTimeout(function () {
            that.$element.trigger(slidEvent)
          }, 0)
        })
        .emulateTransitionEnd(Carousel.TRANSITION_DURATION)
    } else {
      $active.removeClass('active')
      $next.addClass('active')
      this.sliding = false
      this.$element.trigger(slidEvent)
    }

    isCycling && this.cycle()

    return this
  }


  // CAROUSEL PLUGIN DEFINITION
  // ==========================

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.carousel')
      var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)
      var action  = typeof option == 'string' ? option : options.slide

      if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))
      if (typeof option == 'number') data.to(option)
      else if (action) data[action]()
      else if (options.interval) data.pause().cycle()
    })
  }

  var old = $.fn.carousel

  $.fn.carousel             = Plugin
  $.fn.carousel.Constructor = Carousel


  // CAROUSEL NO CONFLICT
  // ====================

  $.fn.carousel.noConflict = function () {
    $.fn.carousel = old
    return this
  }


  // CAROUSEL DATA-API
  // =================

  var clickHandler = function (e) {
    var $this   = $(this)
    var href    = $this.attr('href')
    if (href) {
      href = href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7
    }

    var target  = $this.attr('data-target') || href
    var $target = $(document).find(target)

    if (!$target.hasClass('carousel')) return

    var options = $.extend({}, $target.data(), $this.data())
    var slideIndex = $this.attr('data-slide-to')
    if (slideIndex) options.interval = false

    Plugin.call($target, options)

    if (slideIndex) {
      $target.data('bs.carousel').to(slideIndex)
    }

    e.preventDefault()
  }

  $(document)
    .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)
    .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)

  $(window).on('load', function () {
    $('[data-ride="carousel"]').each(function () {
      var $carousel = $(this)
      Plugin.call($carousel, $carousel.data())
    })
  })

}(jQuery);

/* ========================================================================
 * Bootstrap: collapse.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#collapse
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

/* jshint latedef: false */

+function ($) {
  'use strict';

  // COLLAPSE PUBLIC CLASS DEFINITION
  // ================================

  var Collapse = function (element, options) {
    this.$element      = $(element)
    this.options       = $.extend({}, Collapse.DEFAULTS, options)
    this.$trigger      = $('[data-toggle="collapse"][href="#' + element.id + '"],' +
                           '[data-toggle="collapse"][data-target="#' + element.id + '"]')
    this.transitioning = null

    if (this.options.parent) {
      this.$parent = this.getParent()
    } else {
      this.addAriaAndCollapsedClass(this.$element, this.$trigger)
    }

    if (this.options.toggle) this.toggle()
  }

  Collapse.VERSION  = '3.4.1'

  Collapse.TRANSITION_DURATION = 350

  Collapse.DEFAULTS = {
    toggle: true
  }

  Collapse.prototype.dimension = function () {
    var hasWidth = this.$element.hasClass('width')
    return hasWidth ? 'width' : 'height'
  }

  Collapse.prototype.show = function () {
    if (this.transitioning || this.$element.hasClass('in')) return

    var activesData
    var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')

    if (actives && actives.length) {
      activesData = actives.data('bs.collapse')
      if (activesData && activesData.transitioning) return
    }

    var startEvent = $.Event('show.bs.collapse')
    this.$element.trigger(startEvent)
    if (startEvent.isDefaultPrevented()) return

    if (actives && actives.length) {
      Plugin.call(actives, 'hide')
      activesData || actives.data('bs.collapse', null)
    }

    var dimension = this.dimension()

    this.$element
      .removeClass('collapse')
      .addClass('collapsing')[dimension](0)
      .attr('aria-expanded', true)

    this.$trigger
      .removeClass('collapsed')
      .attr('aria-expanded', true)

    this.transitioning = 1

    var complete = function () {
      this.$element
        .removeClass('collapsing')
        .addClass('collapse in')[dimension]('')
      this.transitioning = 0
      this.$element
        .trigger('shown.bs.collapse')
    }

    if (!$.support.transition) return complete.call(this)

    var scrollSize = $.camelCase(['scroll', dimension].join('-'))

    this.$element
      .one('bsTransitionEnd', $.proxy(complete, this))
      .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])
  }

  Collapse.prototype.hide = function () {
    if (this.transitioning || !this.$element.hasClass('in')) return

    var startEvent = $.Event('hide.bs.collapse')
    this.$element.trigger(startEvent)
    if (startEvent.isDefaultPrevented()) return

    var dimension = this.dimension()

    this.$element[dimension](this.$element[dimension]())[0].offsetHeight

    this.$element
      .addClass('collapsing')
      .removeClass('collapse in')
      .attr('aria-expanded', false)

    this.$trigger
      .addClass('collapsed')
      .attr('aria-expanded', false)

    this.transitioning = 1

    var complete = function () {
      this.transitioning = 0
      this.$element
        .removeClass('collapsing')
        .addClass('collapse')
        .trigger('hidden.bs.collapse')
    }

    if (!$.support.transition) return complete.call(this)

    this.$element
      [dimension](0)
      .one('bsTransitionEnd', $.proxy(complete, this))
      .emulateTransitionEnd(Collapse.TRANSITION_DURATION)
  }

  Collapse.prototype.toggle = function () {
    this[this.$element.hasClass('in') ? 'hide' : 'show']()
  }

  Collapse.prototype.getParent = function () {
    return $(document).find(this.options.parent)
      .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]')
      .each($.proxy(function (i, element) {
        var $element = $(element)
        this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)
      }, this))
      .end()
  }

  Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {
    var isOpen = $element.hasClass('in')

    $element.attr('aria-expanded', isOpen)
    $trigger
      .toggleClass('collapsed', !isOpen)
      .attr('aria-expanded', isOpen)
  }

  function getTargetFromTrigger($trigger) {
    var href
    var target = $trigger.attr('data-target')
      || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7

    return $(document).find(target)
  }


  // COLLAPSE PLUGIN DEFINITION
  // ==========================

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.collapse')
      var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)

      if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false
      if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))
      if (typeof option == 'string') data[option]()
    })
  }

  var old = $.fn.collapse

  $.fn.collapse             = Plugin
  $.fn.collapse.Constructor = Collapse


  // COLLAPSE NO CONFLICT
  // ====================

  $.fn.collapse.noConflict = function () {
    $.fn.collapse = old
    return this
  }


  // COLLAPSE DATA-API
  // =================

  $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) {
    var $this   = $(this)

    if (!$this.attr('data-target')) e.preventDefault()

    var $target = getTargetFromTrigger($this)
    var data    = $target.data('bs.collapse')
    var option  = data ? 'toggle' : $this.data()

    Plugin.call($target, option)
  })

}(jQuery);

/* ========================================================================
 * Bootstrap: dropdown.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#dropdowns
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // DROPDOWN CLASS DEFINITION
  // =========================

  var backdrop = '.dropdown-backdrop'
  var toggle   = '[data-toggle="dropdown"]'
  var Dropdown = function (element) {
    $(element).on('click.bs.dropdown', this.toggle)
  }

  Dropdown.VERSION = '3.4.1'

  function getParent($this) {
    var selector = $this.attr('data-target')

    if (!selector) {
      selector = $this.attr('href')
      selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
    }

    var $parent = selector !== '#' ? $(document).find(selector) : null

    return $parent && $parent.length ? $parent : $this.parent()
  }

  function clearMenus(e) {
    if (e && e.which === 3) return
    $(backdrop).remove()
    $(toggle).each(function () {
      var $this         = $(this)
      var $parent       = getParent($this)
      var relatedTarget = { relatedTarget: this }

      if (!$parent.hasClass('open')) return

      if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return

      $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))

      if (e.isDefaultPrevented()) return

      $this.attr('aria-expanded', 'false')
      $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))
    })
  }

  Dropdown.prototype.toggle = function (e) {
    var $this = $(this)

    if ($this.is('.disabled, :disabled')) return

    var $parent  = getParent($this)
    var isActive = $parent.hasClass('open')

    clearMenus()

    if (!isActive) {
      if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {
        // if mobile we use a backdrop because click events don't delegate
        $(document.createElement('div'))
          .addClass('dropdown-backdrop')
          .insertAfter($(this))
          .on('click', clearMenus)
      }

      var relatedTarget = { relatedTarget: this }
      $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))

      if (e.isDefaultPrevented()) return

      $this
        .trigger('focus')
        .attr('aria-expanded', 'true')

      $parent
        .toggleClass('open')
        .trigger($.Event('shown.bs.dropdown', relatedTarget))
    }

    return false
  }

  Dropdown.prototype.keydown = function (e) {
    if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return

    var $this = $(this)

    e.preventDefault()
    e.stopPropagation()

    if ($this.is('.disabled, :disabled')) return

    var $parent  = getParent($this)
    var isActive = $parent.hasClass('open')

    if (!isActive && e.which != 27 || isActive && e.which == 27) {
      if (e.which == 27) $parent.find(toggle).trigger('focus')
      return $this.trigger('click')
    }

    var desc = ' li:not(.disabled):visible a'
    var $items = $parent.find('.dropdown-menu' + desc)

    if (!$items.length) return

    var index = $items.index(e.target)

    if (e.which == 38 && index > 0)                 index--         // up
    if (e.which == 40 && index < $items.length - 1) index++         // down
    if (!~index)                                    index = 0

    $items.eq(index).trigger('focus')
  }


  // DROPDOWN PLUGIN DEFINITION
  // ==========================

  function Plugin(option) {
    return this.each(function () {
      var $this = $(this)
      var data  = $this.data('bs.dropdown')

      if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))
      if (typeof option == 'string') data[option].call($this)
    })
  }

  var old = $.fn.dropdown

  $.fn.dropdown             = Plugin
  $.fn.dropdown.Constructor = Dropdown


  // DROPDOWN NO CONFLICT
  // ====================

  $.fn.dropdown.noConflict = function () {
    $.fn.dropdown = old
    return this
  }


  // APPLY TO STANDARD DROPDOWN ELEMENTS
  // ===================================

  $(document)
    .on('click.bs.dropdown.data-api', clearMenus)
    .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })
    .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)
    .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)
    .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)

}(jQuery);

/* ========================================================================
 * Bootstrap: modal.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#modals
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // MODAL CLASS DEFINITION
  // ======================

  var Modal = function (element, options) {
    this.options = options
    this.$body = $(document.body)
    this.$element = $(element)
    this.$dialog = this.$element.find('.modal-dialog')
    this.$backdrop = null
    this.isShown = null
    this.originalBodyPad = null
    this.scrollbarWidth = 0
    this.ignoreBackdropClick = false
    this.fixedContent = '.navbar-fixed-top, .navbar-fixed-bottom'

    if (this.options.remote) {
      this.$element
        .find('.modal-content')
        .load(this.options.remote, $.proxy(function () {
          this.$element.trigger('loaded.bs.modal')
        }, this))
    }
  }

  Modal.VERSION = '3.4.1'

  Modal.TRANSITION_DURATION = 300
  Modal.BACKDROP_TRANSITION_DURATION = 150

  Modal.DEFAULTS = {
    backdrop: true,
    keyboard: true,
    show: true
  }

  Modal.prototype.toggle = function (_relatedTarget) {
    return this.isShown ? this.hide() : this.show(_relatedTarget)
  }

  Modal.prototype.show = function (_relatedTarget) {
    var that = this
    var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })

    this.$element.trigger(e)

    if (this.isShown || e.isDefaultPrevented()) return

    this.isShown = true

    this.checkScrollbar()
    this.setScrollbar()
    this.$body.addClass('modal-open')

    this.escape()
    this.resize()

    this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this))

    this.$dialog.on('mousedown.dismiss.bs.modal', function () {
      that.$element.one('mouseup.dismiss.bs.modal', function (e) {
        if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true
      })
    })

    this.backdrop(function () {
      var transition = $.support.transition && that.$element.hasClass('fade')

      if (!that.$element.parent().length) {
        that.$element.appendTo(that.$body) // don't move modals dom position
      }

      that.$element
        .show()
        .scrollTop(0)

      that.adjustDialog()

      if (transition) {
        that.$element[0].offsetWidth // force reflow
      }

      that.$element.addClass('in')

      that.enforceFocus()

      var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })

      transition ?
        that.$dialog // wait for modal to slide in
          .one('bsTransitionEnd', function () {
            that.$element.trigger('focus').trigger(e)
          })
          .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
        that.$element.trigger('focus').trigger(e)
    })
  }

  Modal.prototype.hide = function (e) {
    if (e) e.preventDefault()

    e = $.Event('hide.bs.modal')

    this.$element.trigger(e)

    if (!this.isShown || e.isDefaultPrevented()) return

    this.isShown = false

    this.escape()
    this.resize()

    $(document).off('focusin.bs.modal')

    this.$element
      .removeClass('in')
      .off('click.dismiss.bs.modal')
      .off('mouseup.dismiss.bs.modal')

    this.$dialog.off('mousedown.dismiss.bs.modal')

    $.support.transition && this.$element.hasClass('fade') ?
      this.$element
        .one('bsTransitionEnd', $.proxy(this.hideModal, this))
        .emulateTransitionEnd(Modal.TRANSITION_DURATION) :
      this.hideModal()
  }

  Modal.prototype.enforceFocus = function () {
    $(document)
      .off('focusin.bs.modal') // guard against infinite focus loop
      .on('focusin.bs.modal', $.proxy(function (e) {
        if (document !== e.target &&
          this.$element[0] !== e.target &&
          !this.$element.has(e.target).length) {
          this.$element.trigger('focus')
        }
      }, this))
  }

  Modal.prototype.escape = function () {
    if (this.isShown && this.options.keyboard) {
      this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {
        e.which == 27 && this.hide()
      }, this))
    } else if (!this.isShown) {
      this.$element.off('keydown.dismiss.bs.modal')
    }
  }

  Modal.prototype.resize = function () {
    if (this.isShown) {
      $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))
    } else {
      $(window).off('resize.bs.modal')
    }
  }

  Modal.prototype.hideModal = function () {
    var that = this
    this.$element.hide()
    this.backdrop(function () {
      that.$body.removeClass('modal-open')
      that.resetAdjustments()
      that.resetScrollbar()
      that.$element.trigger('hidden.bs.modal')
    })
  }

  Modal.prototype.removeBackdrop = function () {
    this.$backdrop && this.$backdrop.remove()
    this.$backdrop = null
  }

  Modal.prototype.backdrop = function (callback) {
    var that = this
    var animate = this.$element.hasClass('fade') ? 'fade' : ''

    if (this.isShown && this.options.backdrop) {
      var doAnimate = $.support.transition && animate

      this.$backdrop = $(document.createElement('div'))
        .addClass('modal-backdrop ' + animate)
        .appendTo(this.$body)

      this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {
        if (this.ignoreBackdropClick) {
          this.ignoreBackdropClick = false
          return
        }
        if (e.target !== e.currentTarget) return
        this.options.backdrop == 'static'
          ? this.$element[0].focus()
          : this.hide()
      }, this))

      if (doAnimate) this.$backdrop[0].offsetWidth // force reflow

      this.$backdrop.addClass('in')

      if (!callback) return

      doAnimate ?
        this.$backdrop
          .one('bsTransitionEnd', callback)
          .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
        callback()

    } else if (!this.isShown && this.$backdrop) {
      this.$backdrop.removeClass('in')

      var callbackRemove = function () {
        that.removeBackdrop()
        callback && callback()
      }
      $.support.transition && this.$element.hasClass('fade') ?
        this.$backdrop
          .one('bsTransitionEnd', callbackRemove)
          .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :
        callbackRemove()

    } else if (callback) {
      callback()
    }
  }

  // these following methods are used to handle overflowing modals

  Modal.prototype.handleUpdate = function () {
    this.adjustDialog()
  }

  Modal.prototype.adjustDialog = function () {
    var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight

    this.$element.css({
      paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',
      paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''
    })
  }

  Modal.prototype.resetAdjustments = function () {
    this.$element.css({
      paddingLeft: '',
      paddingRight: ''
    })
  }

  Modal.prototype.checkScrollbar = function () {
    var fullWindowWidth = window.innerWidth
    if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8
      var documentElementRect = document.documentElement.getBoundingClientRect()
      fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)
    }
    this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth
    this.scrollbarWidth = this.measureScrollbar()
  }

  Modal.prototype.setScrollbar = function () {
    var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
    this.originalBodyPad = document.body.style.paddingRight || ''
    var scrollbarWidth = this.scrollbarWidth
    if (this.bodyIsOverflowing) {
      this.$body.css('padding-right', bodyPad + scrollbarWidth)
      $(this.fixedContent).each(function (index, element) {
        var actualPadding = element.style.paddingRight
        var calculatedPadding = $(element).css('padding-right')
        $(element)
          .data('padding-right', actualPadding)
          .css('padding-right', parseFloat(calculatedPadding) + scrollbarWidth + 'px')
      })
    }
  }

  Modal.prototype.resetScrollbar = function () {
    this.$body.css('padding-right', this.originalBodyPad)
    $(this.fixedContent).each(function (index, element) {
      var padding = $(element).data('padding-right')
      $(element).removeData('padding-right')
      element.style.paddingRight = padding ? padding : ''
    })
  }

  Modal.prototype.measureScrollbar = function () { // thx walsh
    var scrollDiv = document.createElement('div')
    scrollDiv.className = 'modal-scrollbar-measure'
    this.$body.append(scrollDiv)
    var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth
    this.$body[0].removeChild(scrollDiv)
    return scrollbarWidth
  }


  // MODAL PLUGIN DEFINITION
  // =======================

  function Plugin(option, _relatedTarget) {
    return this.each(function () {
      var $this = $(this)
      var data = $this.data('bs.modal')
      var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)

      if (!data) $this.data('bs.modal', (data = new Modal(this, options)))
      if (typeof option == 'string') data[option](_relatedTarget)
      else if (options.show) data.show(_relatedTarget)
    })
  }

  var old = $.fn.modal

  $.fn.modal = Plugin
  $.fn.modal.Constructor = Modal


  // MODAL NO CONFLICT
  // =================

  $.fn.modal.noConflict = function () {
    $.fn.modal = old
    return this
  }


  // MODAL DATA-API
  // ==============

  $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) {
    var $this = $(this)
    var href = $this.attr('href')
    var target = $this.attr('data-target') ||
      (href && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7

    var $target = $(document).find(target)
    var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())

    if ($this.is('a')) e.preventDefault()

    $target.one('show.bs.modal', function (showEvent) {
      if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown
      $target.one('hidden.bs.modal', function () {
        $this.is(':visible') && $this.trigger('focus')
      })
    })
    Plugin.call($target, option, this)
  })

}(jQuery);

/* ========================================================================
 * Bootstrap: tooltip.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#tooltip
 * Inspired by the original jQuery.tipsy by Jason Frame
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

+function ($) {
  'use strict';

  var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']

  var uriAttrs = [
    'background',
    'cite',
    'href',
    'itemtype',
    'longdesc',
    'poster',
    'src',
    'xlink:href'
  ]

  var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i

  var DefaultWhitelist = {
    // Global attributes allowed on any supplied element below.
    '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
    a: ['target', 'href', 'title', 'rel'],
    area: [],
    b: [],
    br: [],
    col: [],
    code: [],
    div: [],
    em: [],
    hr: [],
    h1: [],
    h2: [],
    h3: [],
    h4: [],
    h5: [],
    h6: [],
    i: [],
    img: ['src', 'alt', 'title', 'width', 'height'],
    li: [],
    ol: [],
    p: [],
    pre: [],
    s: [],
    small: [],
    span: [],
    sub: [],
    sup: [],
    strong: [],
    u: [],
    ul: []
  }

  /**
   * A pattern that recognizes a commonly useful subset of URLs that are safe.
   *
   * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
   */
  var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi

  /**
   * A pattern that matches safe data URLs. Only matches image, video and audio types.
   *
   * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
   */
  var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i

  function allowedAttribute(attr, allowedAttributeList) {
    var attrName = attr.nodeName.toLowerCase()

    if ($.inArray(attrName, allowedAttributeList) !== -1) {
      if ($.inArray(attrName, uriAttrs) !== -1) {
        return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN))
      }

      return true
    }

    var regExp = $(allowedAttributeList).filter(function (index, value) {
      return value instanceof RegExp
    })

    // Check if a regular expression validates the attribute.
    for (var i = 0, l = regExp.length; i < l; i++) {
      if (attrName.match(regExp[i])) {
        return true
      }
    }

    return false
  }

  function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {
    if (unsafeHtml.length === 0) {
      return unsafeHtml
    }

    if (sanitizeFn && typeof sanitizeFn === 'function') {
      return sanitizeFn(unsafeHtml)
    }

    // IE 8 and below don't support createHTMLDocument
    if (!document.implementation || !document.implementation.createHTMLDocument) {
      return unsafeHtml
    }

    var createdDocument = document.implementation.createHTMLDocument('sanitization')
    createdDocument.body.innerHTML = unsafeHtml

    var whitelistKeys = $.map(whiteList, function (el, i) { return i })
    var elements = $(createdDocument.body).find('*')

    for (var i = 0, len = elements.length; i < len; i++) {
      var el = elements[i]
      var elName = el.nodeName.toLowerCase()

      if ($.inArray(elName, whitelistKeys) === -1) {
        el.parentNode.removeChild(el)

        continue
      }

      var attributeList = $.map(el.attributes, function (el) { return el })
      var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])

      for (var j = 0, len2 = attributeList.length; j < len2; j++) {
        if (!allowedAttribute(attributeList[j], whitelistedAttributes)) {
          el.removeAttribute(attributeList[j].nodeName)
        }
      }
    }

    return createdDocument.body.innerHTML
  }

  // TOOLTIP PUBLIC CLASS DEFINITION
  // ===============================

  var Tooltip = function (element, options) {
    this.type       = null
    this.options    = null
    this.enabled    = null
    this.timeout    = null
    this.hoverState = null
    this.$element   = null
    this.inState    = null

    this.init('tooltip', element, options)
  }

  Tooltip.VERSION  = '3.4.1'

  Tooltip.TRANSITION_DURATION = 150

  Tooltip.DEFAULTS = {
    animation: true,
    placement: 'top',
    selector: false,
    template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
    trigger: 'hover focus',
    title: '',
    delay: 0,
    html: false,
    container: false,
    viewport: {
      selector: 'body',
      padding: 0
    },
    sanitize : true,
    sanitizeFn : null,
    whiteList : DefaultWhitelist
  }

  Tooltip.prototype.init = function (type, element, options) {
    this.enabled   = true
    this.type      = type
    this.$element  = $(element)
    this.options   = this.getOptions(options)
    this.$viewport = this.options.viewport && $(document).find($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
    this.inState   = { click: false, hover: false, focus: false }

    if (this.$element[0] instanceof document.constructor && !this.options.selector) {
      throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
    }

    var triggers = this.options.trigger.split(' ')

    for (var i = triggers.length; i--;) {
      var trigger = triggers[i]

      if (trigger == 'click') {
        this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
      } else if (trigger != 'manual') {
        var eventIn  = trigger == 'hover' ? 'mouseenter' : 'focusin'
        var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'

        this.$element.on(eventIn  + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
        this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
      }
    }

    this.options.selector ?
      (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
      this.fixTitle()
  }

  Tooltip.prototype.getDefaults = function () {
    return Tooltip.DEFAULTS
  }

  Tooltip.prototype.getOptions = function (options) {
    var dataAttributes = this.$element.data()

    for (var dataAttr in dataAttributes) {
      if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) {
        delete dataAttributes[dataAttr]
      }
    }

    options = $.extend({}, this.getDefaults(), dataAttributes, options)

    if (options.delay && typeof options.delay == 'number') {
      options.delay = {
        show: options.delay,
        hide: options.delay
      }
    }

    if (options.sanitize) {
      options.template = sanitizeHtml(options.template, options.whiteList, options.sanitizeFn)
    }

    return options
  }

  Tooltip.prototype.getDelegateOptions = function () {
    var options  = {}
    var defaults = this.getDefaults()

    this._options && $.each(this._options, function (key, value) {
      if (defaults[key] != value) options[key] = value
    })

    return options
  }

  Tooltip.prototype.enter = function (obj) {
    var self = obj instanceof this.constructor ?
      obj : $(obj.currentTarget).data('bs.' + this.type)

    if (!self) {
      self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
      $(obj.currentTarget).data('bs.' + this.type, self)
    }

    if (obj instanceof $.Event) {
      self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true
    }

    if (self.tip().hasClass('in') || self.hoverState == 'in') {
      self.hoverState = 'in'
      return
    }

    clearTimeout(self.timeout)

    self.hoverState = 'in'

    if (!self.options.delay || !self.options.delay.show) return self.show()

    self.timeout = setTimeout(function () {
      if (self.hoverState == 'in') self.show()
    }, self.options.delay.show)
  }

  Tooltip.prototype.isInStateTrue = function () {
    for (var key in this.inState) {
      if (this.inState[key]) return true
    }

    return false
  }

  Tooltip.prototype.leave = function (obj) {
    var self = obj instanceof this.constructor ?
      obj : $(obj.currentTarget).data('bs.' + this.type)

    if (!self) {
      self = new this.constructor(obj.currentTarget, this.getDelegateOptions())
      $(obj.currentTarget).data('bs.' + this.type, self)
    }

    if (obj instanceof $.Event) {
      self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false
    }

    if (self.isInStateTrue()) return

    clearTimeout(self.timeout)

    self.hoverState = 'out'

    if (!self.options.delay || !self.options.delay.hide) return self.hide()

    self.timeout = setTimeout(function () {
      if (self.hoverState == 'out') self.hide()
    }, self.options.delay.hide)
  }

  Tooltip.prototype.show = function () {
    var e = $.Event('show.bs.' + this.type)

    if (this.hasContent() && this.enabled) {
      this.$element.trigger(e)

      var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])
      if (e.isDefaultPrevented() || !inDom) return
      var that = this

      var $tip = this.tip()

      var tipId = this.getUID(this.type)

      this.setContent()
      $tip.attr('id', tipId)
      this.$element.attr('aria-describedby', tipId)

      if (this.options.animation) $tip.addClass('fade')

      var placement = typeof this.options.placement == 'function' ?
        this.options.placement.call(this, $tip[0], this.$element[0]) :
        this.options.placement

      var autoToken = /\s?auto?\s?/i
      var autoPlace = autoToken.test(placement)
      if (autoPlace) placement = placement.replace(autoToken, '') || 'top'

      $tip
        .detach()
        .css({ top: 0, left: 0, display: 'block' })
        .addClass(placement)
        .data('bs.' + this.type, this)

      this.options.container ? $tip.appendTo($(document).find(this.options.container)) : $tip.insertAfter(this.$element)
      this.$element.trigger('inserted.bs.' + this.type)

      var pos          = this.getPosition()
      var actualWidth  = $tip[0].offsetWidth
      var actualHeight = $tip[0].offsetHeight

      if (autoPlace) {
        var orgPlacement = placement
        var viewportDim = this.getPosition(this.$viewport)

        placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top'    :
                    placement == 'top'    && pos.top    - actualHeight < viewportDim.top    ? 'bottom' :
                    placement == 'right'  && pos.right  + actualWidth  > viewportDim.width  ? 'left'   :
                    placement == 'left'   && pos.left   - actualWidth  < viewportDim.left   ? 'right'  :
                    placement

        $tip
          .removeClass(orgPlacement)
          .addClass(placement)
      }

      var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)

      this.applyPlacement(calculatedOffset, placement)

      var complete = function () {
        var prevHoverState = that.hoverState
        that.$element.trigger('shown.bs.' + that.type)
        that.hoverState = null

        if (prevHoverState == 'out') that.leave(that)
      }

      $.support.transition && this.$tip.hasClass('fade') ?
        $tip
          .one('bsTransitionEnd', complete)
          .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
        complete()
    }
  }

  Tooltip.prototype.applyPlacement = function (offset, placement) {
    var $tip   = this.tip()
    var width  = $tip[0].offsetWidth
    var height = $tip[0].offsetHeight

    // manually read margins because getBoundingClientRect includes difference
    var marginTop = parseInt($tip.css('margin-top'), 10)
    var marginLeft = parseInt($tip.css('margin-left'), 10)

    // we must check for NaN for ie 8/9
    if (isNaN(marginTop))  marginTop  = 0
    if (isNaN(marginLeft)) marginLeft = 0

    offset.top  += marginTop
    offset.left += marginLeft

    // $.fn.offset doesn't round pixel values
    // so we use setOffset directly with our own function B-0
    $.offset.setOffset($tip[0], $.extend({
      using: function (props) {
        $tip.css({
          top: Math.round(props.top),
          left: Math.round(props.left)
        })
      }
    }, offset), 0)

    $tip.addClass('in')

    // check to see if placing tip in new offset caused the tip to resize itself
    var actualWidth  = $tip[0].offsetWidth
    var actualHeight = $tip[0].offsetHeight

    if (placement == 'top' && actualHeight != height) {
      offset.top = offset.top + height - actualHeight
    }

    var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)

    if (delta.left) offset.left += delta.left
    else offset.top += delta.top

    var isVertical          = /top|bottom/.test(placement)
    var arrowDelta          = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight
    var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'

    $tip.offset(offset)
    this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)
  }

  Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {
    this.arrow()
      .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')
      .css(isVertical ? 'top' : 'left', '')
  }

  Tooltip.prototype.setContent = function () {
    var $tip  = this.tip()
    var title = this.getTitle()

    if (this.options.html) {
      if (this.options.sanitize) {
        title = sanitizeHtml(title, this.options.whiteList, this.options.sanitizeFn)
      }

      $tip.find('.tooltip-inner').html(title)
    } else {
      $tip.find('.tooltip-inner').text(title)
    }

    $tip.removeClass('fade in top bottom left right')
  }

  Tooltip.prototype.hide = function (callback) {
    var that = this
    var $tip = $(this.$tip)
    var e    = $.Event('hide.bs.' + this.type)

    function complete() {
      if (that.hoverState != 'in') $tip.detach()
      if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.
        that.$element
          .removeAttr('aria-describedby')
          .trigger('hidden.bs.' + that.type)
      }
      callback && callback()
    }

    this.$element.trigger(e)

    if (e.isDefaultPrevented()) return

    $tip.removeClass('in')

    $.support.transition && $tip.hasClass('fade') ?
      $tip
        .one('bsTransitionEnd', complete)
        .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :
      complete()

    this.hoverState = null

    return this
  }

  Tooltip.prototype.fixTitle = function () {
    var $e = this.$element
    if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {
      $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
    }
  }

  Tooltip.prototype.hasContent = function () {
    return this.getTitle()
  }

  Tooltip.prototype.getPosition = function ($element) {
    $element   = $element || this.$element

    var el     = $element[0]
    var isBody = el.tagName == 'BODY'

    var elRect    = el.getBoundingClientRect()
    if (elRect.width == null) {
      // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093
      elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })
    }
    var isSvg = window.SVGElement && el instanceof window.SVGElement
    // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.
    // See https://github.com/twbs/bootstrap/issues/20280
    var elOffset  = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())
    var scroll    = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }
    var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null

    return $.extend({}, elRect, scroll, outerDims, elOffset)
  }

  Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {
    return placement == 'bottom' ? { top: pos.top + pos.height,   left: pos.left + pos.width / 2 - actualWidth / 2 } :
           placement == 'top'    ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :
           placement == 'left'   ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :
        /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }

  }

  Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {
    var delta = { top: 0, left: 0 }
    if (!this.$viewport) return delta

    var viewportPadding = this.options.viewport && this.options.viewport.padding || 0
    var viewportDimensions = this.getPosition(this.$viewport)

    if (/right|left/.test(placement)) {
      var topEdgeOffset    = pos.top - viewportPadding - viewportDimensions.scroll
      var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight
      if (topEdgeOffset < viewportDimensions.top) { // top overflow
        delta.top = viewportDimensions.top - topEdgeOffset
      } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow
        delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset
      }
    } else {
      var leftEdgeOffset  = pos.left - viewportPadding
      var rightEdgeOffset = pos.left + viewportPadding + actualWidth
      if (leftEdgeOffset < viewportDimensions.left) { // left overflow
        delta.left = viewportDimensions.left - leftEdgeOffset
      } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow
        delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset
      }
    }

    return delta
  }

  Tooltip.prototype.getTitle = function () {
    var title
    var $e = this.$element
    var o  = this.options

    title = $e.attr('data-original-title')
      || (typeof o.title == 'function' ? o.title.call($e[0]) :  o.title)

    return title
  }

  Tooltip.prototype.getUID = function (prefix) {
    do prefix += ~~(Math.random() * 1000000)
    while (document.getElementById(prefix))
    return prefix
  }

  Tooltip.prototype.tip = function () {
    if (!this.$tip) {
      this.$tip = $(this.options.template)
      if (this.$tip.length != 1) {
        throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')
      }
    }
    return this.$tip
  }

  Tooltip.prototype.arrow = function () {
    return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))
  }

  Tooltip.prototype.enable = function () {
    this.enabled = true
  }

  Tooltip.prototype.disable = function () {
    this.enabled = false
  }

  Tooltip.prototype.toggleEnabled = function () {
    this.enabled = !this.enabled
  }

  Tooltip.prototype.toggle = function (e) {
    var self = this
    if (e) {
      self = $(e.currentTarget).data('bs.' + this.type)
      if (!self) {
        self = new this.constructor(e.currentTarget, this.getDelegateOptions())
        $(e.currentTarget).data('bs.' + this.type, self)
      }
    }

    if (e) {
      self.inState.click = !self.inState.click
      if (self.isInStateTrue()) self.enter(self)
      else self.leave(self)
    } else {
      self.tip().hasClass('in') ? self.leave(self) : self.enter(self)
    }
  }

  Tooltip.prototype.destroy = function () {
    var that = this
    clearTimeout(this.timeout)
    this.hide(function () {
      that.$element.off('.' + that.type).removeData('bs.' + that.type)
      if (that.$tip) {
        that.$tip.detach()
      }
      that.$tip = null
      that.$arrow = null
      that.$viewport = null
      that.$element = null
    })
  }

  Tooltip.prototype.sanitizeHtml = function (unsafeHtml) {
    return sanitizeHtml(unsafeHtml, this.options.whiteList, this.options.sanitizeFn)
  }

  // TOOLTIP PLUGIN DEFINITION
  // =========================

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.tooltip')
      var options = typeof option == 'object' && option

      if (!data && /destroy|hide/.test(option)) return
      if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))
      if (typeof option == 'string') data[option]()
    })
  }

  var old = $.fn.tooltip

  $.fn.tooltip             = Plugin
  $.fn.tooltip.Constructor = Tooltip


  // TOOLTIP NO CONFLICT
  // ===================

  $.fn.tooltip.noConflict = function () {
    $.fn.tooltip = old
    return this
  }

}(jQuery);

/* ========================================================================
 * Bootstrap: popover.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#popovers
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // POPOVER PUBLIC CLASS DEFINITION
  // ===============================

  var Popover = function (element, options) {
    this.init('popover', element, options)
  }

  if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')

  Popover.VERSION  = '3.4.1'

  Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
    placement: 'right',
    trigger: 'click',
    content: '',
    template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
  })


  // NOTE: POPOVER EXTENDS tooltip.js
  // ================================

  Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)

  Popover.prototype.constructor = Popover

  Popover.prototype.getDefaults = function () {
    return Popover.DEFAULTS
  }

  Popover.prototype.setContent = function () {
    var $tip    = this.tip()
    var title   = this.getTitle()
    var content = this.getContent()

    if (this.options.html) {
      var typeContent = typeof content

      if (this.options.sanitize) {
        title = this.sanitizeHtml(title)

        if (typeContent === 'string') {
          content = this.sanitizeHtml(content)
        }
      }

      $tip.find('.popover-title').html(title)
      $tip.find('.popover-content').children().detach().end()[
        typeContent === 'string' ? 'html' : 'append'
      ](content)
    } else {
      $tip.find('.popover-title').text(title)
      $tip.find('.popover-content').children().detach().end().text(content)
    }

    $tip.removeClass('fade top bottom left right in')

    // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do
    // this manually by checking the contents.
    if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()
  }

  Popover.prototype.hasContent = function () {
    return this.getTitle() || this.getContent()
  }

  Popover.prototype.getContent = function () {
    var $e = this.$element
    var o  = this.options

    return $e.attr('data-content')
      || (typeof o.content == 'function' ?
        o.content.call($e[0]) :
        o.content)
  }

  Popover.prototype.arrow = function () {
    return (this.$arrow = this.$arrow || this.tip().find('.arrow'))
  }


  // POPOVER PLUGIN DEFINITION
  // =========================

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.popover')
      var options = typeof option == 'object' && option

      if (!data && /destroy|hide/.test(option)) return
      if (!data) $this.data('bs.popover', (data = new Popover(this, options)))
      if (typeof option == 'string') data[option]()
    })
  }

  var old = $.fn.popover

  $.fn.popover             = Plugin
  $.fn.popover.Constructor = Popover


  // POPOVER NO CONFLICT
  // ===================

  $.fn.popover.noConflict = function () {
    $.fn.popover = old
    return this
  }

}(jQuery);

/* ========================================================================
 * Bootstrap: scrollspy.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#scrollspy
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // SCROLLSPY CLASS DEFINITION
  // ==========================

  function ScrollSpy(element, options) {
    this.$body          = $(document.body)
    this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)
    this.options        = $.extend({}, ScrollSpy.DEFAULTS, options)
    this.selector       = (this.options.target || '') + ' .nav li > a'
    this.offsets        = []
    this.targets        = []
    this.activeTarget   = null
    this.scrollHeight   = 0

    this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))
    this.refresh()
    this.process()
  }

  ScrollSpy.VERSION  = '3.4.1'

  ScrollSpy.DEFAULTS = {
    offset: 10
  }

  ScrollSpy.prototype.getScrollHeight = function () {
    return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)
  }

  ScrollSpy.prototype.refresh = function () {
    var that          = this
    var offsetMethod  = 'offset'
    var offsetBase    = 0

    this.offsets      = []
    this.targets      = []
    this.scrollHeight = this.getScrollHeight()

    if (!$.isWindow(this.$scrollElement[0])) {
      offsetMethod = 'position'
      offsetBase   = this.$scrollElement.scrollTop()
    }

    this.$body
      .find(this.selector)
      .map(function () {
        var $el   = $(this)
        var href  = $el.data('target') || $el.attr('href')
        var $href = /^#./.test(href) && $(href)

        return ($href
          && $href.length
          && $href.is(':visible')
          && [[$href[offsetMethod]().top + offsetBase, href]]) || null
      })
      .sort(function (a, b) { return a[0] - b[0] })
      .each(function () {
        that.offsets.push(this[0])
        that.targets.push(this[1])
      })
  }

  ScrollSpy.prototype.process = function () {
    var scrollTop    = this.$scrollElement.scrollTop() + this.options.offset
    var scrollHeight = this.getScrollHeight()
    var maxScroll    = this.options.offset + scrollHeight - this.$scrollElement.height()
    var offsets      = this.offsets
    var targets      = this.targets
    var activeTarget = this.activeTarget
    var i

    if (this.scrollHeight != scrollHeight) {
      this.refresh()
    }

    if (scrollTop >= maxScroll) {
      return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)
    }

    if (activeTarget && scrollTop < offsets[0]) {
      this.activeTarget = null
      return this.clear()
    }

    for (i = offsets.length; i--;) {
      activeTarget != targets[i]
        && scrollTop >= offsets[i]
        && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])
        && this.activate(targets[i])
    }
  }

  ScrollSpy.prototype.activate = function (target) {
    this.activeTarget = target

    this.clear()

    var selector = this.selector +
      '[data-target="' + target + '"],' +
      this.selector + '[href="' + target + '"]'

    var active = $(selector)
      .parents('li')
      .addClass('active')

    if (active.parent('.dropdown-menu').length) {
      active = active
        .closest('li.dropdown')
        .addClass('active')
    }

    active.trigger('activate.bs.scrollspy')
  }

  ScrollSpy.prototype.clear = function () {
    $(this.selector)
      .parentsUntil(this.options.target, '.active')
      .removeClass('active')
  }


  // SCROLLSPY PLUGIN DEFINITION
  // ===========================

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.scrollspy')
      var options = typeof option == 'object' && option

      if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))
      if (typeof option == 'string') data[option]()
    })
  }

  var old = $.fn.scrollspy

  $.fn.scrollspy             = Plugin
  $.fn.scrollspy.Constructor = ScrollSpy


  // SCROLLSPY NO CONFLICT
  // =====================

  $.fn.scrollspy.noConflict = function () {
    $.fn.scrollspy = old
    return this
  }


  // SCROLLSPY DATA-API
  // ==================

  $(window).on('load.bs.scrollspy.data-api', function () {
    $('[data-spy="scroll"]').each(function () {
      var $spy = $(this)
      Plugin.call($spy, $spy.data())
    })
  })

}(jQuery);

/* ========================================================================
 * Bootstrap: tab.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#tabs
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // TAB CLASS DEFINITION
  // ====================

  var Tab = function (element) {
    // jscs:disable requireDollarBeforejQueryAssignment
    this.element = $(element)
    // jscs:enable requireDollarBeforejQueryAssignment
  }

  Tab.VERSION = '3.4.1'

  Tab.TRANSITION_DURATION = 150

  Tab.prototype.show = function () {
    var $this    = this.element
    var $ul      = $this.closest('ul:not(.dropdown-menu)')
    var selector = $this.data('target')

    if (!selector) {
      selector = $this.attr('href')
      selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7
    }

    if ($this.parent('li').hasClass('active')) return

    var $previous = $ul.find('.active:last a')
    var hideEvent = $.Event('hide.bs.tab', {
      relatedTarget: $this[0]
    })
    var showEvent = $.Event('show.bs.tab', {
      relatedTarget: $previous[0]
    })

    $previous.trigger(hideEvent)
    $this.trigger(showEvent)

    if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return

    var $target = $(document).find(selector)

    this.activate($this.closest('li'), $ul)
    this.activate($target, $target.parent(), function () {
      $previous.trigger({
        type: 'hidden.bs.tab',
        relatedTarget: $this[0]
      })
      $this.trigger({
        type: 'shown.bs.tab',
        relatedTarget: $previous[0]
      })
    })
  }

  Tab.prototype.activate = function (element, container, callback) {
    var $active    = container.find('> .active')
    var transition = callback
      && $.support.transition
      && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)

    function next() {
      $active
        .removeClass('active')
        .find('> .dropdown-menu > .active')
        .removeClass('active')
        .end()
        .find('[data-toggle="tab"]')
        .attr('aria-expanded', false)

      element
        .addClass('active')
        .find('[data-toggle="tab"]')
        .attr('aria-expanded', true)

      if (transition) {
        element[0].offsetWidth // reflow for transition
        element.addClass('in')
      } else {
        element.removeClass('fade')
      }

      if (element.parent('.dropdown-menu').length) {
        element
          .closest('li.dropdown')
          .addClass('active')
          .end()
          .find('[data-toggle="tab"]')
          .attr('aria-expanded', true)
      }

      callback && callback()
    }

    $active.length && transition ?
      $active
        .one('bsTransitionEnd', next)
        .emulateTransitionEnd(Tab.TRANSITION_DURATION) :
      next()

    $active.removeClass('in')
  }


  // TAB PLUGIN DEFINITION
  // =====================

  function Plugin(option) {
    return this.each(function () {
      var $this = $(this)
      var data  = $this.data('bs.tab')

      if (!data) $this.data('bs.tab', (data = new Tab(this)))
      if (typeof option == 'string') data[option]()
    })
  }

  var old = $.fn.tab

  $.fn.tab             = Plugin
  $.fn.tab.Constructor = Tab


  // TAB NO CONFLICT
  // ===============

  $.fn.tab.noConflict = function () {
    $.fn.tab = old
    return this
  }


  // TAB DATA-API
  // ============

  var clickHandler = function (e) {
    e.preventDefault()
    Plugin.call($(this), 'show')
  }

  $(document)
    .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler)
    .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler)

}(jQuery);

/* ========================================================================
 * Bootstrap: affix.js v3.4.1
 * https://getbootstrap.com/docs/3.4/javascript/#affix
 * ========================================================================
 * Copyright 2011-2019 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */


+function ($) {
  'use strict';

  // AFFIX CLASS DEFINITION
  // ======================

  var Affix = function (element, options) {
    this.options = $.extend({}, Affix.DEFAULTS, options)

    var target = this.options.target === Affix.DEFAULTS.target ? $(this.options.target) : $(document).find(this.options.target)

    this.$target = target
      .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))
      .on('click.bs.affix.data-api',  $.proxy(this.checkPositionWithEventLoop, this))

    this.$element     = $(element)
    this.affixed      = null
    this.unpin        = null
    this.pinnedOffset = null

    this.checkPosition()
  }

  Affix.VERSION  = '3.4.1'

  Affix.RESET    = 'affix affix-top affix-bottom'

  Affix.DEFAULTS = {
    offset: 0,
    target: window
  }

  Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {
    var scrollTop    = this.$target.scrollTop()
    var position     = this.$element.offset()
    var targetHeight = this.$target.height()

    if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false

    if (this.affixed == 'bottom') {
      if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'
      return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'
    }

    var initializing   = this.affixed == null
    var colliderTop    = initializing ? scrollTop : position.top
    var colliderHeight = initializing ? targetHeight : height

    if (offsetTop != null && scrollTop <= offsetTop) return 'top'
    if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'

    return false
  }

  Affix.prototype.getPinnedOffset = function () {
    if (this.pinnedOffset) return this.pinnedOffset
    this.$element.removeClass(Affix.RESET).addClass('affix')
    var scrollTop = this.$target.scrollTop()
    var position  = this.$element.offset()
    return (this.pinnedOffset = position.top - scrollTop)
  }

  Affix.prototype.checkPositionWithEventLoop = function () {
    setTimeout($.proxy(this.checkPosition, this), 1)
  }

  Affix.prototype.checkPosition = function () {
    if (!this.$element.is(':visible')) return

    var height       = this.$element.height()
    var offset       = this.options.offset
    var offsetTop    = offset.top
    var offsetBottom = offset.bottom
    var scrollHeight = Math.max($(document).height(), $(document.body).height())

    if (typeof offset != 'object')         offsetBottom = offsetTop = offset
    if (typeof offsetTop == 'function')    offsetTop    = offset.top(this.$element)
    if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)

    var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)

    if (this.affixed != affix) {
      if (this.unpin != null) this.$element.css('top', '')

      var affixType = 'affix' + (affix ? '-' + affix : '')
      var e         = $.Event(affixType + '.bs.affix')

      this.$element.trigger(e)

      if (e.isDefaultPrevented()) return

      this.affixed = affix
      this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null

      this.$element
        .removeClass(Affix.RESET)
        .addClass(affixType)
        .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')
    }

    if (affix == 'bottom') {
      this.$element.offset({
        top: scrollHeight - height - offsetBottom
      })
    }
  }


  // AFFIX PLUGIN DEFINITION
  // =======================

  function Plugin(option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.affix')
      var options = typeof option == 'object' && option

      if (!data) $this.data('bs.affix', (data = new Affix(this, options)))
      if (typeof option == 'string') data[option]()
    })
  }

  var old = $.fn.affix

  $.fn.affix             = Plugin
  $.fn.affix.Constructor = Affix


  // AFFIX NO CONFLICT
  // =================

  $.fn.affix.noConflict = function () {
    $.fn.affix = old
    return this
  }


  // AFFIX DATA-API
  // ==============

  $(window).on('load', function () {
    $('[data-spy="affix"]').each(function () {
      var $spy = $(this)
      var data = $spy.data()

      data.offset = data.offset || {}

      if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom
      if (data.offsetTop    != null) data.offset.top    = data.offsetTop

      Plugin.call($spy, data)
    })
  })

}(jQuery);

define("bootstrap", ["jquery"], function(){});

define('popupHelper', [
    'jquery',
    'jqueryscrollbar',
    'knockout', 
    'underscore', 
    'bootstrap'
],
function (
    $,
    scrollbar,
    ko,
    _
) {
    var activeDialogs = [];

    var onShown = function (event) {
        var dialog = event.target;

        if (shouldHideMainScrollbar(dialog)) {
            $('html').addClass('scroll-lock');
        }

        activeDialogs.push(dialog);
        stackDialogs();
    };

    var onHidden = function (event, confirmCallback, cancelCallback) {
        var dialog = event.target;

        activeDialogs.pop();
        adjustModalBackground();

        if (shouldHideMainScrollbar(dialog)) {
            $('html').removeClass('scroll-lock');
        }

        var dialogResult = $(dialog).data('result');
        $(dialog).removeData('result');

        if (dialogResult === 'confirm') {
            if (_.isFunction(confirmCallback)) {
                confirmCallback();
            }

            return;
        }

        if (_.isFunction(cancelCallback)) {
            cancelCallback();
        }
    };

    var showDialog = function (templateId, data, confirmCallback, closeCallback) {
        var popupElement = $('#' + templateId);

        if (data) {
            ko.cleanNode(popupElement[0]);
            ko.applyBindings({ modalData: data }, popupElement[0]);
        }

        var dialog = popupElement.one('show.bs.modal', onShown).one('hidden.bs.modal', function (e) { onHidden(e, confirmCallback, closeCallback); }).modal('show');        
       
        //confirm callback
        popupElement.find('[data-confirm="modal"]').click(function() {
            $(dialog).data('result', 'confirm');
            closeDialog(dialog);            
        });

        //close callback
        popupElement.find('[data-dismiss="modal"]').click(function () {
            $(dialog).data('result', 'dissmiss');
            closeDialog(dialog);
        });        
    };

    var closeDialog = function(dialog) {
        if (dialog) {
            dialog.modal('hide');            
        }
    };

    var stackDialogs = function() {
        if (activeDialogs.length > 1) {
            var lastDialog = activeDialogs[activeDialogs.length - 1];            
            var prevZIndex = $(activeDialogs[activeDialogs.length-2]).zIndex();            
            $(lastDialog).zIndex(prevZIndex + 2);

            adjustModalBackground();
        }
    };

    var adjustModalBackground = function() {
        if (activeDialogs.length > 0) {
            var lastDialogZIndex = $(activeDialogs[activeDialogs.length - 1]).zIndex();
            var modalBackground = $('.modal-backdrop')[0];
            $(modalBackground).zIndex(lastDialogZIndex - 1);
        }
    };

    var shouldHideMainScrollbar = function(dialog) {
        return $(dialog).data('main-scrollbar') === "hide";
    };

    return {
        showDialog: showDialog,
        closeDialog: closeDialog        
    };
});

define('gtmService', ['jquery'], function ($) {

    var dataLayer = window.dataLayer || [];

    var push = function (item) {        
        dataLayer.push(item);
    };    

    return {        
        push: push
    };
});

define('ticketingService', ['context', 'mapper', 'browserHelper', 'utils', 'dataService', 'popupHelper', 'jquery', 'gtmService', 'dateUtils', 'integrationRoutingService', 'jquerycookie'],
    function (context, mapper, browserHelper, utils, dataService, popupHelper, $, gtmService, dateUtils, integrationRoutingService) {

        var bookingEngineTypes = {
            mixingDeck: 'mixingDeck',
            webtis: 'webtis',
            webtisMobile: 'webtisMobile'
        };

        var init = function() {
            gtmService.push({
                'bookingEngineType': determineBookingEngineType()
            });
        };

        var redirectToBookingEngine = function (searchCriteria, isPICO) { 
            var bookingEngineToUse = determineBookingEngineType();
            sendData(searchCriteria);
            if (isPICO) {
                mapper.ticketSearchCriteria.toPICOWebtisFormat(searchCriteria, bookingEngineToUse)
            }
            else {
                mapper.ticketSearchCriteria.toWebtisFormat(searchCriteria, bookingEngineToUse)
            }

        };
        var sendDataNewQTT = function (searchCriteria) {


            dataService.saveInAwsNewQTT(searchCriteria).done(function () {
                console.log("done with aws");
            }).fail(function () {

                isProcessingRequest(false);

                if (this.captcha) {
                    this.captcha.reset();
                }
                popupHelper.showDialog('formSubmissionErrorDialog', { message: "Sorry, there has been an error and your form can't be submitted at the moment. Please try again later, or contact us by phone or email." });
            });
        };


        var sendData = function (searchCriteria) {
         

                dataService.saveInAws(searchCriteria).done(function () {
                console.log("done with aws");
            }).fail(function () {

                isProcessingRequest(false);

                if (this.captcha) {
                    this.captcha.reset();
                }
                popupHelper.showDialog('formSubmissionErrorDialog', { message: "Sorry, there has been an error and your form can't be submitted at the moment. Please try again later, or contact us by phone or email." });
            });
        };

        var findTickets = function (searchCriteria, isPICO) {
            if (searchCriteria.isValid()) {
                var plannedWorksRequest = mapper.ticketSearchCriteria.toPlannedWorksDto(searchCriteria);
                dataService.getPlannedworksForJourney(plannedWorksRequest).done(function (data) {
                    if (data && data.length > 0) {
                        popupHelper.showDialog('plannedWorksModal', data, function () {
                            redirectToBookingEngine(searchCriteria, isPICO);
                        });
                    } else {
                        redirectToBookingEngine(searchCriteria, isPICO);
                    }
                }).fail(function () {
                    redirectToBookingEngine(searchCriteria, isPICO);
                });
            }
        };

        var determineBookingEngineType = function() {
            var useNewMixingDeck = integrationRoutingService.isWithinMixingDeckThreshold();

            if (useNewMixingDeck || location.href.indexOf('NMD=true') !== -1) {
                $.cookie('UsedNewMixingDeck', "true", { path: '/', expires: 365 });

                return bookingEngineTypes.mixingDeck;
            }

            return browserHelper.isDesktop() ? bookingEngineTypes.webtis : bookingEngineTypes.webtisMobile;
        };

        var redirectToBookingEngineHome = function () {
            var bookingEngineToUse = determineBookingEngineType();
            var targetUrl;

            switch (bookingEngineToUse) {
                case bookingEngineTypes.mixingDeck:
                    targetUrl = context.environment.booking.mdInternalUrl;
                    $.cookie('md-params', 'clear', { path: '/', expires: 1 });
                    break;

                case bookingEngineTypes.webtisMobile:
                    targetUrl = context.environment.booking.webtisMobileHomeUrl;
                    break;

                case bookingEngineTypes.webtis:
                default:
                    targetUrl = context.environment.booking.webtisHomeUrl;
                    break;
            }

            utils.redirect(targetUrl, null, 'GET');
        };

        var findTicketsForPlanmyJourney = function (searchCriteria) {
            var bookingEngineToUse = determineBookingEngineType();

            mapper.ticketSearchCriteria.toPlanmyjourneyWebtis(searchCriteria, bookingEngineToUse);

        };

        init();

        return {
            findTickets: findTickets,
            determineBookingEngineType: determineBookingEngineType,
            findTicketsForPlanmyJourney: findTicketsForPlanmyJourney,
            redirectToBookingEngineHome: redirectToBookingEngineHome,
            redirectToBookingEngine: redirectToBookingEngine,
            sendData: sendData,
            sendDataNewQTT: sendDataNewQTT
        };
    });
define('viewmodels/journeyCheckResultsUi',
    [
        'jquery',
        'knockout',
        'dataService',
        'stationService',
        'ticketingService',
        'models/journeyCheckCriteria',
        'dateUtils',
        'mapper',
        'context',
        'browserHelper',
        'jquery.session',
        'moment'
    ],
    function ($, ko, dataService, stationService, ticketingService, JourneyCheckCriteria, dateUtils, mapper, context, browserHelper,moment) {
        var traintimedata;
        var traintimeproduct;
        var departures = ko.observableArray([]);
        var departureStationName = ko.observable();
        var arrivalStationName = ko.observable();
        var departureDateFormatted = ko.observable();
        var searchCriteria = new JourneyCheckCriteria();
        var searchCriteriaTrainTimesWeekDay = new JourneyCheckCriteria();
        var searchCriteriaTrainTimesWeekEnd = new JourneyCheckCriteria();
        var ScriptNameproductschema = ko.observable();
        var ScriptDescriptionproductschema = ko.observable();
        var ScriptNameTrainTrip = ko.observable();
        var ScriptDescriptionTrainTrip = ko.observable();
        var GenericTrainTimesMetaTitle = ko.observable();
        var GenericTrainTimesMetaDescription = ko.observable();
        var BusRoutesCMS = ko.observableArray([]);
        var lastUpdated = ko.observable();
        var gwrStations = {};
        var hasEarlierTrains = ko.observable(true);
        var hasLaterTrains = ko.observable(true);
        var hasValidCriteria = ko.observable(false);
        var isLoading = ko.observable(false);
        var noMatchingJourney = ko.observable(false);
        var tpeStation = ko.observable(false);
        var weekdayFirstTrain = ko.observable();
        var weekdayLastTrain = ko.observable();
        var weekEndFirstTrain = ko.observable();
        var weekEndLastTrain = ko.observable();
        var numberOfChanges = ko.observable(Number.MAX_VALUE);
        var journeyDuration = ko.observable(new Date());

        var init = function (initData) {
            var KeyFromUrl = false;
            BusRoutesCMS(initData.busRoutes);

            if ($.session.get('departureStation') !== undefined) {
                var seoScriptData = initData.seOscriptdata;
                var TrainTimemetadata = initData.traintimemetadata;
                var initdata = JSON.parse($.session.get('departureStation'))
                initdata.from = isNaN(initdata.from) ? initdata.from : stationService.findStationByCrs(initdata.from).CrsCodeAny;
                initdata.to = isNaN(initdata.to) ? initdata.to : stationService.findStationByCrs(initdata.to).CrsCodeAny;

                stationService.findStationByCrs(searchCriteria.departureStation())
                initData = initdata;
                initData.seOscriptdata = seoScriptData;
                initData.traintimemetadata = TrainTimemetadata;
            }
            else {
                var currentUrl = $(location).attr('href');
                var splittedUrl = currentUrl.split("/");
                var departure = splittedUrl[splittedUrl.length - 2];
                var arrival = splittedUrl[splittedUrl.length - 1];
                KeyFromUrl = true;
                if (departure.indexOf("-") !== -1) {
                    departure = departure.replace(/-/g, " ");
                }
                if (arrival.indexOf("-") !== -1) {
                    arrival = arrival.replace(/-/g, " ");
                }
                var departureCri = stationService.findStationByName(departure);
                var arrivalCri = stationService.findStationByName(arrival);
                initData.from = isNaN(departureCri.CrsCode) ? departureCri.CrsCode : departureCri.CrsCodeAny;
                initData.to = isNaN(arrivalCri.CrsCode) ? arrivalCri.CrsCode : arrivalCri.CrsCodeAny;
                var trainLineData = getLocalStotageKeyWithExpiry("trainlineData")
                if (trainLineData) {

                    var dt = trainLineData.date.substring(0, trainLineData.date.indexOf(' ')).split("-");
                    var time = trainLineData.date.substring(trainLineData.date.indexOf(' ') + 1, trainLineData.date.length).split(':')

                    initData.departureTime = dt[2] + "-" + dt[1] + "-" + dt[0] + "T" + time[0] + time[1];
                    initData.type = trainLineData.movementType == "D" ? "DepartAfter" : "ArriveBy";
                }
                else {
                    var d = new Date();
                    var time = d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate() + "T" + d.getHours() + "" + d.getMinutes();
                    initData.departureTime = time;
                    initData.type = "DepartAfter";

                }

            }


            noMatchingJourney(false);
            if (initData.from != null && initData.to != null) {
                searchCriteria.departureStation(initData.from.toUpperCase());
                searchCriteria.arrivalStation(initData.to.toUpperCase());
            }
            else {
                searchCriteria.departureStation(initData.from);
                searchCriteria.arrivalStation(initData.to);
            }

            searchCriteria.departureDate(initData.departureTime ? dateUtils.parseDate(initData.departureTime, context.dateFormat.atomDate) : dateUtils.currentDate().add(5, 'seconds'));
            searchCriteria.departureType(initData.type);

            if (searchCriteria.isValid() || (searchCriteria.departureStation != undefined && searchCriteria.arrivalStation() != undefined)) {
                var departureStationCritera = stationService.findStationByCrs(searchCriteria.departureStation());
                var arrivalStationCritera = stationService.findStationByCrs(searchCriteria.arrivalStation());

                if (departureStationCritera && arrivalStationCritera) {
                    hasValidCriteria(true);

                    departureStationName(departureStationCritera.Name);
                    arrivalStationName(arrivalStationCritera.Name);
                    departureDateFormatted(dateUtils.getFormattedDate(searchCriteria.departureDate(), "YYYY/MM/DD"))

                    dataService.getGwrStations().done(function (data) {
                        gwrStations = data;
                    });

                    populateJourneys(searchCriteria);
                    $("html, body").scrollTop($('#jc-results').offset().top - 30);
                    $.session.remove("departureStation");
                }
            }
            if (initData.seOscriptdata != null || initData.seOscriptdata != undefined) {
                ScriptNameTrainTrip(initData.seOscriptdata.scriptNameTrainTrip.replace("[Departurestation]", departureStationName()).replace("[ArrivalStation]", arrivalStationName()));
                ScriptDescriptionproductschema(initData.seOscriptdata.scriptDescriptionTrainTrip.replace("[Departurestation]", departureStationName()).replace("[ArrivalStation]", arrivalStationName()));
                ScriptNameproductschema(initData.seOscriptdata.scriptNameproductschema.replace("[Departurestation]", departureStationName()).replace("[ArrivalStation]", arrivalStationName()));
                ScriptDescriptionTrainTrip(initData.seOscriptdata.scriptDescriptionproductschema.replace("[Departurestation]", departureStationName()).replace("[ArrivalStation]", arrivalStationName()));
                GenericTrainTimesMetaTitle(initData.traintimemetadata.genericTrainTimesMetaTitle.replace("[Departure station name]", departureStationName()).replace("[Destination station name]", arrivalStationName()));
                GenericTrainTimesMetaDescription(initData.traintimemetadata.genericTrainTimesMetaDescription.replace("[Departure station name]", departureStationName()).replace("[Destination station name]", arrivalStationName()));
            }
            DynamicTraintimes();
        };
        var DynamicTraintimes = function () {
            var currentUrl = $(location).attr('href');
            var splittedUrl = currentUrl.split("/");
            var departure = splittedUrl[splittedUrl.length - 2];
            var arrival = splittedUrl[splittedUrl.length - 1];
            KeyFromUrl = true;
            if (departure.indexOf("-") !== -1) {
                departure = departure.replace(/-/g, " ");
            }
            if (arrival.indexOf("-") !== -1) {
                arrival = arrival.replace(/-/g, " ");
            }
            var departureCri = stationService.findStationByName(departure);
            var arrivalCri = stationService.findStationByName(arrival);
            if (departureCri.CrsCode != undefined && arrivalCri.CrsCode != undefined) {

                var originDestinationInfo = document.getElementById("originDestinationInfo");
                var str = originDestinationInfo.innerHTML;
                str=str.replace("'Origin'", departureCri.Name);
                str=str.replace("'Destination'", arrivalCri.Name);
                document.getElementById("originDestinationInfo").innerHTML = str;
                originDestinationInfo.style.display = "block";
                document.getElementById("departureStation").innerHTML = departureCri.Name
                document.getElementById("arrivalStation").innerHTML = arrivalCri.Name

                searchCriteriaTrainTimesWeekDay.departureStation(departureCri.CrsCode.toUpperCase());
                searchCriteriaTrainTimesWeekDay.arrivalStation(arrivalCri.CrsCode.toUpperCase());
                searchCriteriaTrainTimesWeekDay.departureType("DepartAfter");

                searchCriteriaTrainTimesWeekEnd.departureStation(departureCri.CrsCode.toUpperCase());
                searchCriteriaTrainTimesWeekEnd.arrivalStation(arrivalCri.CrsCode.toUpperCase());
                searchCriteriaTrainTimesWeekEnd.departureType("DepartAfter");
                getFirstAndLastWeekDayTrain(searchCriteriaTrainTimesWeekDay);
                getFirstAndLastWeekendTrain(searchCriteriaTrainTimesWeekEnd);
            }
           
            
        }
        function getNextDayOfWeek(date, dayOfWeek) {
            // Code to check that date and dayOfWeek are valid left as an exercise ;)

            var resultDate = new Date(date.getTime());

            resultDate.setDate(date.getDate() + (7 + dayOfWeek - date.getDay()) % 7);

            return resultDate;
        }
        var getFirstAndLastWeekendTrain = function (searchCriteriaTrainTimesWeekEnd) {
            var date = new Date();
            var nextSunday;
            if (date.getDay() != 0 && date.getDay()!=6) {
                nextSunday = getNextDayOfWeek(date, 0);
                nextSunday.setHours(00, 00, 00, 00);
                //console.log(nextmonday);
            }
            else {
                date.setDate(date.getDate() + 2);
                nextSunday = getNextDayOfWeek(date, 0);
                nextSunday.setHours(00, 00, 00, 00);
            }

            var time = nextSunday.getFullYear() + "-" + (nextSunday.getMonth() + 1) + "-" + nextSunday.getDate() + "T" + nextSunday.getHours() + "" + nextSunday.getMinutes();
            searchCriteriaTrainTimesWeekEnd.departureDate(dateUtils.parseDate(time, context.dateFormat.atomDate));
            //dataService.journeySearch(mapper.journeyCheckCriteria.toDto(searchCriteriaTrainTimesWeekEnd)).done(function (data) {
            //    if (data != null && data.Items.length != 0) {
            //        formatTimes(data.Items[0]);
            //        weekEndFirstTrain(data.Items[0].FormattedScheduledDepartureTime);
            //        document.getElementById("weekEndFirstTrain").innerHTML = data.Items[0].FormattedScheduledDepartureTime;

            //        for (var i = 0; i < data.Items.length - 1; i++) {
            //            //debugger;
            //            if (data.Items[i].Changes < numberOfChanges()) {
            //                numberOfChanges(data.Items[i].Changes);
            //                document.getElementById('numberOfChanges').innerHTML = numberOfChanges() == 0 ? "Direct" : numberOfChanges() == 1 ? "1 Change" : numberOfChanges()+" Changes"
            //            }
            //            var timeDuration = data.Items[i].Duration;
            //            var duration = timeDuration.split(" ");
            //            var hours = duration[0].replace("hr", "");
            //            var mints = duration[1].replace("mins", "");
            //            var TrainJourneyDuration = new Date(0, 0, 0, hours, mints)

                        
            //            if (TrainJourneyDuration.getTime() < journeyDuration().getTime()) {
            //                journeyDuration(TrainJourneyDuration)
            //                document.getElementById('journeyDuration').innerHTML = hours + "hr" + mints + "mins";
            //            }
            //        }

            //        var firstTrainthatDay = data.Items[0].ScheduledArrivalTime;
            //        searchCriteriaTrainTimesWeekEnd.departureDate(dateUtils.parseDate(firstTrainthatDay));
            //        searchCriteriaTrainTimesWeekEnd.departureType('ArriveBy');



            //        dataService.journeySearch(mapper.journeyCheckCriteria.toDto(searchCriteriaTrainTimesWeekEnd)).done(function (data2) {
            //            if (data2 != null && data2.Items.length != 0) {
            //                var m = searchCriteriaTrainTimesWeekEnd.departureDate();
            //                var date = m.month() + 1 + '/' + m.date() + '/' + m.year();
            //                for (var i = 4; i >= 0; i--) {
            //                    var currDate = new Date(data2.Items[i].ScheduledDepartureTime.substring(0, 10));

            //                    if (date != currDate.getMonth() + 1 + '/' + currDate.getDate() + '/' + currDate.getFullYear()) {
            //                        console.log('sdfs');
            //                        formatTimes(data2.Items[i]);
            //                        weekEndLastTrain(data2.Items[i].FormattedScheduledDepartureTime);
            //                        document.getElementById("weekEndLastTrain").innerHTML = data2.Items[i].FormattedScheduledDepartureTime;
            //                        break;
            //                    }

            //                }
            //                for (var i = 0; i < data2.Items.length - 1; i++) {
            //                    if (data2.Items[i].Changes < numberOfChanges()) {
            //                        numberOfChanges(data2.Items[i].Changes);
            //                        document.getElementById('numberOfChanges').innerHTML = numberOfChanges() == 0 ? "Direct" : numberOfChanges() == 1 ? "1 Change" : numberOfChanges() + " Changes"
            //                    }
            //                    var timeDuration = data.Items[i].Duration;
            //                    var duration = timeDuration.split(" ");
            //                    var hours = duration[0].replace("hr", "");
            //                    var mints = duration[1].replace("mins", "");
            //                    var TrainJourneyDuration = new Date(0, 0, 0, hours, mints)


            //                    if (TrainJourneyDuration.getTime() < journeyDuration().getTime()) {
            //                        journeyDuration(TrainJourneyDuration)
            //                        document.getElementById('journeyDuration').innerHTML = hours + "hr" + mints + "mins";
            //                    }
            //                }
            //            }
                        

            //        }).fail(function () {
            //            $("#quickFacts").hide();
            //            console.log("failed to fetch the WeekEnd train data");
            //        });
            //    }
                
            //}).fail(function () {
            //    $("#quickFacts").hide();
            //    console.log("failed to fetch the WeekEnd train data");
            //});
        }
        var getFirstAndLastWeekDayTrain = function (searchCriteriaTrainTimesWeekDay) {
            //debugger;
            var date = new Date();
            var nextMonday;
            if (date.getDay() != 2 && date.getDay()!=1) {
                nextMonday = getNextDayOfWeek(date, 2);
                nextMonday.setHours(00, 00, 00, 00);
                //console.log(nextmonday);
            }
            else {
                date.setDate(date.getDate() + 2);
                nextMonday = getNextDayOfWeek(date, 2);
                nextMonday.setHours(00, 00, 00, 00);
            }

            var time = nextMonday.getFullYear() + "-" + (nextMonday.getMonth() + 1) + "-" + nextMonday.getDate() + "T" + nextMonday.getHours() + "" + nextMonday.getMinutes();
            searchCriteriaTrainTimesWeekDay.departureDate(dateUtils.parseDate(time, context.dateFormat.atomDate));
            dataService.journeySearch(mapper.journeyCheckCriteria.toDto(searchCriteriaTrainTimesWeekDay)).done(function (data) {
                if (data != null && data.Items.length != 0) {
                    for (var i = 0; i < data.Items.length - 1; i++) {
                        //debugger;
                        if (data.Items[i].Changes < numberOfChanges()) {
                            numberOfChanges(data.Items[i].Changes);
                            document.getElementById('numberOfChanges').innerHTML = numberOfChanges() == 0 ? "Direct" : numberOfChanges() == 1 ? "1 Change" : numberOfChanges() + " Changes"
                        }
                        var timeDuration = data.Items[i].Duration;
                        var duration = timeDuration.split(" ");
                        var hours = duration[0].replace("hr", "");
                        var mints = duration[1].replace("mins", "");
                        var TrainJourneyDuration = new Date(0, 0, 0, hours, mints)


                        if (TrainJourneyDuration.getTime() < journeyDuration().getTime()) {
                            journeyDuration(TrainJourneyDuration)
                            document.getElementById('journeyDuration').innerHTML = hours + "hr" + mints + "mins";
                        }
                    }


                    formatTimes(data.Items[0]);
                    weekdayFirstTrain(data.Items[0].FormattedScheduledDepartureTime);
                    document.getElementById("weekDayFirstTrain").innerHTML = data.Items[0].FormattedScheduledDepartureTime;



                    var firstTrainthatDay = data.Items[0].ScheduledArrivalTime;
                    searchCriteriaTrainTimesWeekDay.departureDate(dateUtils.parseDate(firstTrainthatDay));
                    searchCriteriaTrainTimesWeekDay.departureType('ArriveBy');



                    dataService.journeySearch(mapper.journeyCheckCriteria.toDto(searchCriteriaTrainTimesWeekDay)).done(function (data2) {
                        if (data2 != null && data2.Items.length != 0) {

                            var m = searchCriteriaTrainTimesWeekDay.departureDate();
                            var date = m.month() + 1 + '/' + m.date() + '/' + m.year();
                            for (var i = data2.Items.length - 1; i >= 0; i--) {
                                var currDate = new Date(data2.Items[i].ScheduledDepartureTime.substring(0, 10));
                                if (date != currDate.getMonth() + 1 + '/' + currDate.getDate() + '/' + currDate.getFullYear()) {
                                    console.log('sdfs');
                                    formatTimes(data2.Items[i]);
                                    weekdayLastTrain(data2.Items[i].FormattedScheduledDepartureTime);
                                    document.getElementById("weekDayLastTrain").innerHTML = data2.Items[i].FormattedScheduledDepartureTime;
                                    break;
                                }
                            }
                            for (var i = 0; i < data2.Items.length - 1; i++) {
                                if (data2.Items[i].Changes < numberOfChanges()) {
                                    numberOfChanges(data2.Items[i].Changes);
                                     document.getElementById('numberOfChanges').innerHTML = numberOfChanges() == 0 ? "Direct" : numberOfChanges() == 1 ? "1 Change" : numberOfChanges()+" Changes"
                                }
                                var timeDuration = data.Items[i].Duration;
                                var duration = timeDuration.split(" ");
                                var hours = duration[0].replace("hr", "");
                                var mints = duration[1].replace("mins", "");
                                var TrainJourneyDuration = new Date(0, 0, 0, hours, mints)


                                if (TrainJourneyDuration.getTime() < journeyDuration().getTime()) {
                                    journeyDuration(TrainJourneyDuration)
                                    document.getElementById('journeyDuration').innerHTML = hours + "hr" + mints + "mins";
                                }
                            }
                        }
                        

                    }).fail(function () {
                        $("#quickFacts").hide();
                        console.log("failed to fetch the Week Day train data");
                    });
                }
            }).fail(function () {
                $("#quickFacts").hide();
                console.log("failed to fetch the Week Day train data");
            });
        }
        var getLocalStotageKeyWithExpiry = function (key) {
            const itemStr = localStorage.getItem(key)
            // if the item doesn't exist, return null
            if (!itemStr) {
                return null
            }
            const item = JSON.parse(itemStr)
            const now = new Date()

            if (now.getTime() > item.expiry) {
                localStorage.removeItem(key)
                return null
            }
            return item.value
        }
        var populateJourneys = function (params) {
            var now = dateUtils.currentDate();

            if (params.departureDate() < now) {
                params.departureDate(now);
                hasEarlierTrains(false);
            } else {
                hasEarlierTrains(true);
            }

            hasLaterTrains(true);

            isLoading(true);

            dataService.journeySearch(mapper.journeyCheckCriteria.toDto(params)).done(function (data) {
                if (data == null) {
                    isLoading(false);
                    noMatchingJourney(true);
                    return;
                }

                lastUpdated(dateUtils.parseDate(data.GeneratedAt).local().format(context.dateFormat.time));
                departures.removeAll();

                var scriptproduct = document.createElement("script");
                scriptproduct.type = "application/ld+json";

                var productschema = {
                    "@context": "http://schema.org/",
                    "@type": "Product",
                    "name": ScriptNameproductschema(),
                    "description": ScriptDescriptionproductschema(),
                    "brand": {
                        "@type": "Thing",
                        "name": "Avanti West Coast"
                    }

                };
                traintimeproduct = JSON.stringify(productschema, null, 2);
                scriptproduct.innerHTML = traintimeproduct;
                $("head").append(scriptproduct);

                var traintimemetatitle = document.createElement('meta');
                traintimemetatitle.name = "title";
                traintimemetatitle.content = GenericTrainTimesMetaTitle();
                $("head").append(traintimemetatitle);
                var traintimemetadescription = document.createElement('meta');
                traintimemetadescription.name = "description";
                traintimemetadescription.content = GenericTrainTimesMetaDescription();
                $("head").append(traintimemetadescription);


                var scriptTag = document.createElement("script");
                scriptTag.type = "application/ld+json";
                var obj = {

                    "@context": "http//schema.org",
                    "@type": "ItemList",
                    "name": ScriptNameTrainTrip(),
                    "description": ScriptDescriptionTrainTrip(),
                    "itemListElement": []
                };

                $.each(data.Items, function (index, item) {


                    formatTimes(item);

                    item.LegDetails = ko.observableArray([]);

                    item.HasDeparted = (dateUtils.parseDate(item.ScheduledDepartureTime) <= dateUtils.currentDate());
                    item.Weekday = dateUtils.parseDate(item.ScheduledDepartureTime).format('ddd');
                    item.Duration = item.Duration.replace('mins', 'm');
                    item.ID = item.Origin + '_' + item.Destination + '_' + index;
                    item.TravelMode = data.Items == 1 ? CheckBusRoutes(item, false) ? 'Bus' : mapper.getTravelMode(item) : mapper.getTravelMode(item);
                    item.displayStatusPanel = item.HasDeparted || item.TravelMode.indexOf('Bus') !== -1 || (item.Disruptions && item.Disruptions.length > 0);
                    item.ScheduledArrivalDate = (dateUtils.parseDate(item.ScheduledDepartureTime).format(context.dateFormat.shortDate));
                    if (item.Legs && item.Legs.length > 0) {
                        for (var leg = 0; leg < item.Legs.length; leg++) {

                            item.Legs[leg].TravelMode = CheckBusRoutes(item.Legs[leg], true) ? 'Bus' : item.Legs[leg].TravelMode;
                        } 

                    }
                    item.statusIcon = getStatusIcon(item);

                    departures.push(item);

                    obj.itemListElement.push({
                        "@type": "ListItem",
                        "position": index + 1,
                        "item": {
                            "@type": "TrainTrip",
                            "departureStation": {
                                "@Type": "TrainStation",
                                "name": departureStationName()
                            },
                            "departureTime": item.ScheduledDepartureTime,
                            "departurePlateform": item.DeparturePlatform,
                            "arrivalStation": {
                                "@Type": "TrainStation",
                                "name": arrivalStationName()
                            },
                            "arrivalTime": item.ScheduledArrivalTime,
                            "provider": {
                                "type": "Organization",
                                "name": "Avanti West Coast",
                                "url": window.location.protocol + "//" + window.location.hostname
                            },
                            "url": window.location.href + "#" + (index + 1)
                        }
                    });




                    isLoading(false);
                });
                traintimedata = JSON.stringify(obj, null, 2);
                scriptTag.innerHTML = traintimedata;
                $("#jc-results").after(scriptTag);


                noMatchingJourney(false);
            }).fail(function (data) {
                console.log('fail');
                isLoading(false);
                noMatchingJourney(true);
            });
        };
        var CheckBusRoutes = function (item, isLeg) {
            var hasBus = false;
            var localisLeg = isLeg;
            var temp = BusRoutesCMS();
            for (var leg = 0; leg < temp.length; leg++)
            {
                var x = temp[leg];
                if (localisLeg) {
                    if (x.stationFromCRSCode == item.StationBoard && x.stationToCRSCode == item.StationAlight) {
                        hasBus = true;
                    }
                }
                else {
                    if (x.stationFromCRSCode == item.Origin && x.stationToCRSCode == item.Destination) {
                        hasBus = true;
                    }
                }
            }
            return hasBus;
        }


        var formatTimes = function (item, timeKeys) {
            if (typeof timeKeys == 'undefined') {
                timeKeys = ['ScheduledArrivalTime', 'ScheduledDepartureTime', 'RealTimeArrivalTime', 'RealTimeDepartureTime'];
            }

            for (var key in timeKeys) {
                item['Formatted' + timeKeys[key]] = (item[timeKeys[key]] == null) ? '' : dateUtils.parseDate(item[timeKeys[key]]).format(context.dateFormat.time);
            }
        };

        var getRouteBreakdown = function (journey) {
            var routeData = {
                FromCrsCode: journey.Origin,
                ToCrsCode: journey.Destination,
                DepartureDate: journey.ScheduledDepartureTime,
                ArrivalDate: journey.ScheduledArrivalTime
            };

            dataService.getCallingPoints(routeData).done(function (data) {
                journey.LegDetails.removeAll();

                if (data === null) {
                    journey.HasDeparted = true;
                    return;
                }

                journey.HasDeparted = false;
                var now = dateUtils.currentDate();
                $.each(data.Legs, function (index, leg) {

                    $.each(leg.CallingPoints, function (i, callingPoint) {
                        var gwrCallingStation = stationService.findStationByCrs(callingPoint.StationCrsCode, gwrStations);
                        callingPoint.StationName = stationService.findStationByCrs(callingPoint.StationCrsCode).Name;
                        callingPoint.IsHostedStation = gwrCallingStation.hasOwnProperty('EncodedName');
                        callingPoint.StationPageUrl = callingPoint.IsHostedStation ? context.environment.stationDetailsPageUrl + '/' + gwrCallingStation.EncodedName : '';

                        var time = callingPoint.IsAlightStation ?
                            callingPoint.RealTimeArrivalTime || callingPoint.ScheduledArrivalTime :
                            callingPoint.RealTimeDepartureTime || callingPoint.ScheduledDepartureTime;

                        callingPoint.HasPassed = callingPoint.HasPassed || (dateUtils.parseDate(time) < now);

                        callingPoint.IsLast = (i === leg.CallingPoints.length - 1);
                        formatTimes(callingPoint);
                    });

                    var journeyLegs = $.grep(journey.Legs, function (item) {
                        return item.LegNumber === leg.LegNumber;
                    });

                    var firstLeg = journeyLegs[0];
                    var travelMode = firstLeg ? firstLeg.TravelMode : '';

                    leg.operatorName = firstLeg ? (firstLeg.OperatorName ? firstLeg.OperatorName : false) : false;

                    leg.ServiceName = (travelMode === 'Train') ? leg.operatorName + ' train' : travelMode;
                    leg.IsLast = index == (data.Legs.length - 1);
                    journey.LegDetails.push(leg);
                });
            });
        };

        var findTickets = function (journey, event) {
            ticketingService.findTicketsForPlanmyJourney(journey);


            event.stopPropagation();
        };

        var viewEarlierTrains = function () {
            var firstArrivalOnBoard = departures()[0].ScheduledArrivalTime;
            searchCriteria.departureDate(dateUtils.parseDate(firstArrivalOnBoard));
            searchCriteria.departureType('ArriveBy');
            populateJourneys(searchCriteria);
        };

        var viewLaterTrains = function () {
            var lastDepartureOnBoard = departures()[departures().length - 1].ScheduledDepartureTime;
            searchCriteria.departureDate(dateUtils.parseDate(lastDepartureOnBoard));
            searchCriteria.departureType('DepartAfter');
            populateJourneys(searchCriteria);
        };

        var refreshData = function () {
            init();
        };

        var getStatusIcon = function (item) {
            if (item.IsCancelled) {
                return 'icon-status_major';
            }
            else if ((item.Disruptions && item.Disruptions.length > 0) || (item.TravelMode && item.TravelMode.indexOf("Bus") !== -1)) {
                return 'icon-status_minor';
            }
            else if (item.IsOnTime) {
                return 'icon-good';
            }
            else {
                return '';
            }
        }

        return {
            departureStationName: departureStationName,
            arrivalStationName: arrivalStationName,
            departureDateFormatted: departureDateFormatted,
            BusRoutesCMS: BusRoutesCMS,
            departures: departures,
            lastUpdated: lastUpdated,
            hasEarlierTrains: hasEarlierTrains,
            hasLaterTrains: hasLaterTrains,
            hasValidCriteria: hasValidCriteria,
            refreshData: refreshData,
            init: init,
            populateJourneys: populateJourneys,
            getRouteBreakdown: getRouteBreakdown,
            findTickets: findTickets,
            viewEarlierTrains: viewEarlierTrains,
            viewLaterTrains: viewLaterTrains,
            isLoading: isLoading,
            noMatchingJourney: noMatchingJourney,
            weekdayFirstTrain: weekdayFirstTrain,
            weekdayLastTrain: weekdayLastTrain,
            weekEndFirstTrain: weekEndFirstTrain,
            weekEndLastTrain: weekEndLastTrain
        };
    });


define('viewmodels/globalServiceInfoUi', ['jquery', 'knockout', 'dataService', 'dateUtils', 'context', 'jquerycookie'],
    function ($, ko, dataService, dateUtils, context,
            /*additional dependencies: */ jquerycookie) {
        var globalInfoHiddenByUserCookieName = 'hideGlobalServiceInfo';

            var status = ko.observable('');
            var summary = ko.observable();
            var onlyLineUpdates = ko.observable();
            var allUpdates = ko.observableArray([]);
            var lineUpdates = ko.observableArray([]);
            var serviceUpdates = ko.observableArray([]);
            var lastUpdated = ko.observable();
            var isOverwriteFeedStatus = ko.observable(false);
            var showLoadingBars = ko.observable(true);
            var statusSeverity = ko.computed(function () {
                switch (status()) {
                    case 'GoodService':
                        return 'good';
                    case 'ModerateDisruption':
                        return 'minor';
                    case 'MajorDisruption':
                        return 'major';
                    case 'ExtremeDisruption':
                        return 'major';
                    default:
                        return 'good';
                }
            });
            var allowVisibilityChanges = ko.observable(false);
            var hasMultipleDisruptions = ko.observable(false);
            var isNotificationForCurrentStatusMuted = ko.observable(false);
            var hideOnGoodStatus = ko.observable(false);
            var feedUnavailable = ko.observable(false);
            var isVisible = ko.pureComputed(function () {
                if (isNotificationForCurrentStatusMuted())
                    return false;
                else if (hideOnGoodStatus() && statusSeverity() === 'good') {
                    return false;
                } else if (allowVisibilityChanges()) {
                    removeAllStatusInfoCookies();
                    return true;
                }

                return false;
            });

        //CUSTOMBANNER & NEXUSAlPHA BANNER
        $(document).ready(function () {
            $(".expanded-btn").click(function () {
                $(".expanded-content").toggle(500);
            });
        });
        $(document).ready(function () {
            $(".expanded-btn").click(function () {
                $(this).toggleClass("highlight");
            });
        });
        $(document).ready(function () {
        $(".nexus-btn").click(function () {
            $(".nexus-content").toggle(500);
            });
        });
        $(document).ready(function () {
            $(".nexus-btn").click(function () {
                $(this).toggleClass("highlight");
            });
        });

       //CUSTOMBANNER & NEXUSAlPHA BANNER

        var getStatusInfoCookieName = function () {
            return globalInfoHiddenByUserCookieName + '_' + statusSeverity();
        };

        var checkNotificationCookies = function () {
            isNotificationForCurrentStatusMuted($.cookie(getStatusInfoCookieName()) === 'true');
        };

        
        status.subscribe(function (newValue) {
            checkNotificationCookies();
        });

        var refreshStatus = function () {
            dataService.getRouteStatus().done(function (data) {
                if (data.Status === "GoodService") {
                    $('#routes-dropdown').addClass('hide-summary');
                    $('.check-summary-icon').css('display', 'none');
                } else {
                    $('#routes-dropdown').removeClass('hide-summary');
                    $('.check-summary-icon').css('display', 'block');
                }
                feedUnavailable(false);
                showLoadingBars(false);
                status(data.Status);
                if (data.Summary == null) {
                    summary("No Service Updates");
                }
                else {
                    summary(data.Summary);
                }
                isOverwriteFeedStatus(data.IsOverwriteFeedStatus)
                hasMultipleDisruptions((data.LineUpdates || []).length > 1);
                lastUpdated(dateUtils.currentDate().local().format(context.dateFormat.time));

                allUpdates.removeAll();
                lineUpdates.removeAll();
                serviceUpdates.removeAll();
                $.each(data.LineUpdates || [], function (i, update) {

                    var dateTime = update.UpdatedTime.split(' ');
                    var wholeTime = dateTime[0].split(':');
                    var time = wholeTime[0] + ":" + wholeTime[1];
                    var date = dateTime[1];
                    update.UpdatedTime = date + " " + time;
                    if (update.FurtherInfo !== "") {
                        update.FurtherInfo = "Further Information: </br>" + update.FurtherInfo;
                    }
                    update.Details.replace("Additional Information:", '<div style="margin-top:15px;"></div>Additional Information:')
                    $('.line-update-heading-icon').css('display', 'block');
                    //lineUpdates.push(update);
                    allUpdates.push(update);
                });
                onlyLineUpdates(data.onlyLineUpdates);
            }).fail(function () {
                feedUnavailable(true);
            });
        };

        // click to hide the component, remember that the user has closed it, we may not want to kill the connection at this point
        var hideNotificationBar = function (data, event) {
            $.cookie(getStatusInfoCookieName(), 'true', { expires: 365, path: '/' });
            isNotificationForCurrentStatusMuted(true);
            event.preventDefault();
        };

        var removeAllStatusInfoCookies = function () {
            $.each($.cookie(), function (cookie) {
                if (cookie.indexOf(globalInfoHiddenByUserCookieName) > -1) {
                    $.removeCookie(cookie);
                }
            });
            isNotificationForCurrentStatusMuted(false);
            console.log('PIDD visibility cookies removed');
        };

        var getStatusFromSeverity = function (severity) {
            switch (severity) {
                case 'good':
                    return 'GoodService';
                case 'minor':
                    return 'ModerateDisruption';
                case 'major':
                    return 'MajorDisruption';
                default:
                    return 'GoodService';
            }
        };

        var initData = function (initialGlobalServiceInfo) {
            status(getStatusFromSeverity(initialGlobalServiceInfo.status));
            
            if (initialGlobalServiceInfo.summary == null) {
                summary("Good service on our network");
            }
            else {
                summary(initialGlobalServiceInfo.summary);
            }
            hideOnGoodStatus(initialGlobalServiceInfo.setting.hideOnGoodStatus);
            feedUnavailable(initialGlobalServiceInfo.isServiceUnavailable);
            lastUpdated(dateUtils.currentDate().local().format(context.dateFormat.time));
            allowVisibilityChanges(true);
			
        };

        var init = function () {
            refreshStatus();
            setInterval(refreshStatus, 60000);
        };

        init();

        return {
            initData: initData,
            status: status,
            summary: summary,
            allUpdates: allUpdates,
            lastUpdated: lastUpdated,
            onlyLineUpdates: onlyLineUpdates,
            statusSeverity: statusSeverity,
            hasMultipleDisruptions: hasMultipleDisruptions,
            isVisible: isVisible,
            feedUnavailable: feedUnavailable,
            hideNotificationBar: hideNotificationBar,
            showLoadingBars: showLoadingBars,
            isOverwriteFeedStatus: isOverwriteFeedStatus
        };
    });

define('models/cookieNotification', ['knockout'],
    function (ko) {
        return function (id) {
            var self = this;

            self.id = id;
            self.isVisible = ko.observable(false);            
        };
    });

define('viewmodels/notificationBarUi', [
    'jquery',
    'knockout',
    'models/cookieNotification',
    'jquerycookie'
],
function (
    $,
    ko,
    CookieNotification,
    jquerycookie
) {
    var notifications = [];
    var cookieMessage = "";

    var getNotification = function (id) {
        var results = $.grep(notifications, function (notification) {
            return notification.id === id;
        });

        return results.length > 0 ? results[0] : null;
    };

    var useNotification = function (id) {
        var notification = getNotification(id);

        if (!notification) {
            notification = new CookieNotification(id);
            notifications.push(notification);
        }

        return notification;
    };

    var init = function (notificationIds) {
       
        $.each(notificationIds, function (i, id) {
            var notification = useNotification(id);
            notification.isVisible($.cookie(notification.id) !== cookieMessage);
        });
    };

    var closeNotification = function (notification) {
        notification.isVisible(false);
        $.cookie(notification.id, cookieMessage, { expires: 365 });
        //set cookie to be hidden
    };

    return {
        init: init,
        useNotification: useNotification,
        closeNotification: closeNotification
    };
});

define('viewmodels/navigationUi', [
        'jquery',
        'knockout',
        'context',
        'popupHelper',
        'ticketingService',
        'jquery.queryParser'
],
    function ($, ko, context, popupHelper, ticketingService) {
        var searchTerm = ko.observable('');
        var isBookingDialogOpen = ko.observable(false);

        searchTerm.subscribe(function (newValue) {
            if (newValue.length > 0) {
                newValue = ("" + newValue).replace(/[`~!@#$%^&*()_|+\-=?;:,.<>\{\}\[\]\\\/]/gi, '');
                window.location.href = context.environment.searchPageUrl + '#query=' + newValue;
            }

            //clear searchterm
            searchTerm('');
        });

        var showBookingDialog = function () {
            isBookingDialogOpen(true);
            popupHelper.showDialog('qttFormDialog', null, null, function () {
                isBookingDialogOpen(false);
            });
        };

        var redirectToBookingEngineHome = function() {
            ticketingService.redirectToBookingEngineHome();
        };

        return {
            searchTerm: searchTerm,
            isBookingDialogOpen: isBookingDialogOpen,

            showBookingDialog: showBookingDialog,
            redirectToBookingEngineHome: redirectToBookingEngineHome
        };
    }
);
define('viewmodels/shareButtonUi', [
        'jquery',
        'knockout'
    ],
    function(
        jquery,
        ko
    ){
        var _isOpen = ko.observable(false);
        var _toggle = function(){
            _isOpen(!_isOpen());
            console.log("toggle: ", _isOpen());
        };

        var _close = function(){
            _isOpen(false);
        };

        return{
            isOpen: _isOpen,
            toggle: _toggle,
            close: _close
        };
    }
);
define('viewmodels/seatAvailabilityCheckerUi', ['jquery', 'knockout', 'dataService', 'uiEffectHelper'],
  function ($, ko, dataService, uiEffectHelper) {
    var resultsPerPage = 8;
    var totalResults = 1;
    var skipResults = ko.observable(0);
    var stations = ko.observableArray([]);
    var fromStation = ko.observable('Woking');
    var fromStationSearched = ko.observable(fromStation());
    var toStation = ko.observable('London Waterloo');
    var results = ko.observableArray([]);
    var moreResultsAvailable = ko.observable();
    var noAvailableResults = ko.observable(false);
    var showLoader = ko.observable(true);

    var resultsTitle = ko.pureComputed(function() {
      return fromStationSearched() + ' to ' + toStation();
    });

    var getSeatAvailabilityStations = function () {
      dataService.getSeatAvailability(
        'seatAvailabilityStations',
        {
          'toStation': encodeURI(toStation())
        }
      ).done(function (data) {
        if (data.indexOf(fromStation()) === -1 && data.length > 0) {
          fromStation(data[0]);
        }
        stations(data);
        getSeatAvailabilityResults();
      }).fail(function (error) {
        console.log('error', error);
      });
    };

    var getSeatAvailabilityResults = function () {
      dataService.getSeatAvailability(
        'seatAvailabilityResults',
        {
          'fromStation': encodeURI(fromStation()),
          'toStation': encodeURI(toStation()),
          'skip': skipResults(),
          'take': resultsPerPage
        }
      ).done(function (data) {
        noAvailableResults(!data.hasOwnProperty('Items') || data.Items.length < 1);
        if (!noAvailableResults()) {
          results(data.Items);
          totalResults = data.TotalResults;
          moreResultsAvailable((skipResults() + resultsPerPage) < totalResults);
        }
        showLoader(false);
        fromStationSearched(fromStation());
      }).fail(function (error) {
        noAvailableResults(true);
        console.log('error results', error);
      });
    };

    var scrollToResults = function() {
      var offset = $('.seat-availability-titles').offset();
      var height = $('.seat-availability-titles').height();
      $('html, body').animate({
          scrollTop: offset.top - height
      }, 800);
    }

    var refreshResults = function(skipResultsBy, scroll) {
      if (skipResultsBy >= 0 && skipResultsBy < totalResults) {
        skipResults(skipResultsBy);
        getSeatAvailabilityResults();
        if (scroll) {
          scrollToResults();
        }
      }
    }

    var showEarlier = function() {
      refreshResults(skipResults() - resultsPerPage, false);
    };

    var showLater = function() {
      refreshResults(skipResults() + resultsPerPage, true);
    };

    var submit = function() {
      var newSearchQuery = fromStation() !== fromStationSearched();
      if (newSearchQuery) {
        refreshResults(0, true);
      }
    }

    var init = function (config) {
      if (config.hasOwnProperty('destinationStationName') && config.destinationStationName.length > 0) {
        toStation(config.destinationStationName);
      }
      getSeatAvailabilityStations();
    };

    return {
      skipResults: skipResults,
      stations: stations,
      fromStation: fromStation,
      results: results,
      moreResultsAvailable: moreResultsAvailable,
      noAvailableResults: noAvailableResults,
      showLoader: showLoader,

      resultsTitle: resultsTitle,
      showEarlier: showEarlier,
      showLater: showLater,
      submit: submit,

      init: init
    }
  });
define('viewmodels/engineeringWorkUi', ['jquery', 'context', 'knockout'],
    function ($, context, ko) {

        var days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
        var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];

        this.selectedDate = ko.observable()
        this.selectedDay = ko.observable();
        var dateSelected = function (data, event, date) {
            console.log("selected date: ", date)
            var dateFromParameter = new Date(date);
            var dateFormatted = days[dateFromParameter.getDay()] + " " + dateFromParameter.getDate() + " " + months[dateFromParameter.getMonth()] + " " + dateFromParameter.getFullYear()
            selectedDay(dateFromParameter.getDate());
            selectedDate(dateFormatted);
            scrollToAnchor('summary');
        }
        function scrollToAnchor(aid) {
            var aTag = $("#" + aid);
            $('html,body').animate({ scrollTop: aTag.offset().top - 150 }, 'slow');
        }
        var prev = function () {
            var year = getUrlParameter('year');
            var month = getUrlParameter('month');
            var currentDate;
            if (year && month) {
                currentDate = new Date(year, month-1);
            }
            else {
                currentDate = new Date();
            }
            var nextMonthDate = new Date(currentDate.setMonth(currentDate.getMonth() - 1));
            window.location.href = window.location.href.split('?')[0] + "?year=" + nextMonthDate.getFullYear() + "&month=" + (nextMonthDate.getMonth() + 1);
        }

        var next = function () {
            var year = getUrlParameter('year');
            var month = getUrlParameter('month');
            var currentDate;
            if (year && month) {
                currentDate = new Date(year, month-1);
            }
            else {
                currentDate = new Date();
            }
            var nextMonthDate = new Date(currentDate.setMonth(currentDate.getMonth() + 1));
            window.location.href = window.location.href.split('?')[0] + "?year=" + nextMonthDate.getFullYear() + "&month=" + (nextMonthDate.getMonth() + 1);
        }

        var loadPartialPage = function () {
            var url = "/Travel/EventDetail";
            $('#searchResults').load(url, { searchText: keyWord });
        }

        function getUrlParameter(name) {
            name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
            var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
            var results = regex.exec(location.search);
            return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
        };

        return {
            dateSelected: dateSelected,
            prev: prev,
            next: next
        }
    });
define('viewmodels/StationEventListUI', ['jquery', 'knockout', 'validationHelper', 'utils', 'dataService', 'moment', 'dateUtils', 'context'],
    function ($, ko, vh, utils, dataService, moment, dateUtils, context) {
        var events = ko.observableArray([]);
        var isProcessingRequestModel= ko.observable(true);
        var init =   function () {
            dataService.allEventLocations().done(function (data) {
                var splitUrl = window.location.href.split('/');
                var stationActual = splitUrl[splitUrl.length - 1];
                var station = splitUrl[splitUrl.length - 1].replace(/-/g, ' ');
              
                var Events = [];
                var counter = 0;
                var counterApi = 0;
                var VenueMatched = false;
                for (var t = 0; t < data.venues.length; t++) {
                   
                    if (data.venues[t].name.toLowerCase() == station || data.venues[t].name.toLowerCase() == stationActual) {
                        VenueMatched = true;
                        counter++;
                      
                        dataService.getEventFromVenue({ venue_id: data.venues[t].id }).done(function (event) {
                            counterApi++;
                          
                            if (event.events.length > 0) {
                                for (var eve = 0; eve < event.events.length; eve++)
                                {
                                    var element = event.events[eve];
                                    for (var ven = 0; ven < data.venues.length; ven++)
                                    {
                                       var  venue = data.venues[ven];
                                        if (venue.id ==element.venue_id) {
                                            element.venue = venue;
                                        }
                                        
                                    }
                                    
                                    var dt= moment(element.start.utc, 'YYYY-MM-DD HH:mm'); 
                                    element.formattedStartDate = dateUtils.getFormattedDate(dt, context.dateFormat.tinyDate);
                                    element.formattedEndDate = dateUtils.getFormattedDate(moment(element.end.utc, 'YYYY-MM-DD HH:mm'), context.dateFormat.tinyDate);

                                }
                                Events = Events.concat(event.events);
                             
                            }
                           
                            if (counter == counterApi) {
                                events(Events);
                                console.log(events());
                                isProcessingRequestModel(false);
                            }
                        });
                      
                    }
                   
                }
              
                if (!VenueMatched) {
                    isProcessingRequestModel(false);
                }
               
            });
        };

        return {
            isProcessingRequestModel: isProcessingRequestModel,
            init: init
        };
    });

define('models/personalInfo', ['knockout', 'validationHelper'],
    function (ko, validationHelper) {
        return function () {
            var self = this;

            self.baseTitle = ko.observable('').extend({ required: { message: 'Please select title' }});
            self.customTitle = ko.observable('').extend({
                required: {
                    onlyIf: function () {
                        return self.baseTitle() === 'Other';
                    }
                }
            });

            self.title = ko.pureComputed(function() {
                return self.baseTitle() === 'Other' ? self.customTitle() : self.baseTitle();
            }, self);

            self.firstName = ko.observable().extend({ required: { message: 'Please enter first name' }});
            self.lastName = ko.observable().extend({ required: { message: 'Please enter last name' } });

            self.isValid = function () {
                return validationHelper.validate(self, { deep: true });
            };
        };
    });

define('models/contactDetails', ['knockout', 'validationHelper'],
    function (ko, validationHelper) {
        return function (requirePhoneNumber, requireAddress) {
            var self = this;

            //set default value for boolean parameters if they are not provided
            self.requirePhoneNumber = requirePhoneNumber !== false;
            self.requireAddress = requireAddress !== false;
            self.repeatEmail = ko.observable().extend({ required: true,  email: true });
            self.email = ko.observable().extend({ required: true , email: true});
            self.postcode = ko.observable().extend({ required: true});
            self.address1 = ko.observable();
            self.address2 = ko.observable();
            self.county = ko.observable();
            self.city = ko.observable().extend({ required: self.requireAddress });
            self.ContactNumber = ko.observable().extend({ required: self.requirePhoneNumber, validPhoneNumber: true });
            self.mobileNumber = ko.observable().extend({ validPhoneNumber: true, required: false });
            self.isValid = function () {
                return validationHelper.validate(self, { deep: true });
            };
        };
    });

define('models/assistedJourneyDetails', ['knockout', 'validationHelper'],
    function (ko, validationHelper) {
        return function () {
            var self = this;

            self.from = ko.observable().extend({ required: true });
            self.fromName = ko.observable();
            self.to = ko.observable().extend({ required: true });
            self.toName = ko.observable();
            self.via = ko.observable();
            self.viaName = ko.observable();

            self.date = ko.observable().extend({ required: true });
            self.departureTime = ko.observable().extend({isTime: { params: self.date } });

            self.carriageAndSeatNumber = ko.observable();

            self.transportToStation = ko.observable();
            self.otherTransportToStation = ko.observable().extend({
                required: {
                    onlyIf: function () {
                        return self.transportToStation() === 'Other';
                    }
                }
            });

            self.transportFromStation = ko.observable();
            self.otherTransportFromStation = ko.observable().extend({
                required: {
                    onlyIf: function () {
                        return self.transportFromStation() === 'Other';
                    }
                }
            });

            self.isValid = function () {
                return validationHelper.validate(self, { deep: true });
            };
        };
    });

define('koUtils', ['knockout'],
    function (ko) {

        var decorateBooleanObservableForEditing = function(observable, owner){
            observable.ForEditing = ko.computed({
                read: function() {
                    try{
                        return observable().toString();
                    }
                    catch(err){
                        return '';
                    }
                },
                write: function(newValue) {
                     observable(newValue === "true");
                },
                owner: owner
            });
        }

        return {
            decorateBooleanObservableForEditing: decorateBooleanObservableForEditing
        };
    });
define('models/formData/assistedTravel', ['knockout', 'validationHelper', 'models/personalInfo', 'models/contactDetails', 'models/assistedJourneyDetails', 'dateUtils', 'koUtils'],
    function (ko, validationHelper, PersonalInfo, ContactDetails, AssistedJourneyDetails, dateUtils, koUtils) {
        return function () {
            var self = this;

            self.personalInfo = new PersonalInfo();
            self.contactDetails = new ContactDetails(/*requirePhoneNumber:*/ true, /*requireAddress:*/ false);
            self.ticketBookedWith = ko.observable(true);
            self.bookingReferenceNumber = ko.observable().extend({
                required: {
                    onlyIf: self.ticketBookedWith
                }
            });
            self.typeOfJourney = ko.observable(false);
            koUtils.decorateBooleanObservableForEditing(self.ticketBookedWith, self);
            koUtils.decorateBooleanObservableForEditing(self.typeOfJourney, self);
            self.outwardArriving = ko.observable();
            self.outwardDeparting = ko.observable();

            self.returnArriving = ko.observable();
            self.returnDeparting = ko.observable();

            self.assistanceDog = ko.observable().extend({ required: true });
            self.assistanceDogYes = ko.computed(
                {
                    read: function () {
                        return self.assistanceDog() == true;
                    },
                    write: function (value) {
                        if (value)
                            self.assistanceDog(true);
                    }
                }
                , self);
            self.assistanceDogNo = ko.computed(
                {
                    read: function () {
                        return self.assistanceDog() == false;
                    },
                    write: function (value) {
                        if (value)
                            self.assistanceDog(false);
                    }
                }
                , this);
            self.takesurvey = ko.observable().extend({ required: true });
            self.takesurveyYes = ko.computed(
                {
                    read: function () {
                        return self.takesurvey() == true;
                    },
                    write: function (value) {
                        if (value)
                            self.takesurvey(true);
                    }
                }
                , self);
            self.takesurveyNo = ko.computed(
                {
                    read: function () {
                        return self.takesurvey() == false;
                    },
                    write: function (value) {
                        if (value)
                            self.takesurvey(false);
                    }
                }
                , this);
            //self.whiteCan = ko.observable(false);
            self.whiteCan = ko.observable().extend({ required: true });
            self.whiteCanYes = ko.computed(
                {
                    read: function () {
                        return self.whiteCan() === true;
                    },
                    write: function (value) {
                        if (value)
                            self.whiteCan(true);
                    }
                }
                , self);
            self.whiteCanNo = ko.computed(
                {
                    read: function () {
                        return self.whiteCan() === false;
                    },
                    write: function (value) {
                        if (value)
                            self.whiteCan(false);
                    }
                }
                , this);
            self.useBuggy = ko.observable().extend({ required: true });
            self.useBuggyYes = ko.computed(
                {
                    read: function () {
                        return self.useBuggy() == true;
                    },
                    write: function (value) {
                        if (value)
                            self.useBuggy(true);
                    }
                }
                , self);
            self.useBuggyNo = ko.computed(
                {
                    read: function () {
                        return self.useBuggy() == false;
                    },
                    write: function (value) {
                        if (value)
                            self.useBuggy(false);
                    }
                }
                , this);



            self.useWheelChair = ko.observable().extend({ required: true });
            self.useWheelChairYes = ko.computed(
                {
                    read: function () {

                        return self.useWheelChair() === true;
                    },
                    write: function (value) {
                        if (value)
                            self.useWheelChair(true);
                    }
                }
                , self);


            self.useWheelChairNo = ko.computed(
                {
                    read: function () {
                        return self.useWheelChair() === false;
                    },
                    write: function (value) {
                        if (value)
                            self.useWheelChair(false);
                    }
                }
                , this);
            self.WheelchairScooterDimensionsConfirmed = ko.observable().extend({
            
                validation: {
                    validator: function (val, otherDate) {
                        if (val !== undefined || otherDate !== undefined) {
                            if (val=="false" && ((self.useWheelChair() == "Scooter") || (self.useWheelChair() == "Wheelchair"))) {
                                return false;
                              }
                        }

                        return true;

                    },
                    message: 'You will not be able to travel on our service if your wheelchair/ schooter is wider than 70cm or longer than 120cm',
                    params: self.useWheelChair
                }


            });
            self.remainInWheelChair = ko.observable(false);
            self.wheelchairFold = ko.observable(false);
            self.requireLiftHelp = ko.observable().extend({ required: true });
            self.requireLiftHelpYes = ko.computed(
                {
                    read: function () {
                        return self.requireLiftHelp() == true;
                    },
                    write: function (value) {
                        if (value)
                            self.requireLiftHelp(true);
                    }
                }
                , self);
            self.requireLiftHelpYesNo = ko.computed(
                {
                    read: function () {
                        return self.requireLiftHelp() === false;
                    },
                    write: function (value) {
                        if (value)
                            self.requireLiftHelp(false);
                    }
                }
                , this);

            self.requireLuggageHelp = ko.observable().extend({ required: true });
            self.requireLuggageHelpYes = ko.computed(
                {
                    read: function () {
                        return self.requireLuggageHelp() == true;
                    },
                    write: function (value) {
                        if (value)
                            self.requireLuggageHelp(true);
                    }
                }
                , self);
            self.requireLuggageHelpNo = ko.computed(
                {
                    read: function () {
                        return self.requireLuggageHelp() == false;
                    },
                    write: function (value) {
                        if (value)
                            self.requireLuggageHelp(false);
                    }
                }
                , this);

            self.requireRamp = ko.observable().extend({ required: true });
            self.requireRampYes = ko.computed(
                {
                    read: function () {
                        return self.requireRamp() == true;
                    },
                    write: function (value) {
                        if (value)
                            self.requireRamp(true);
                    }
                }
                , self);
            self.requireRampNo = ko.computed(
                {
                    read: function () {
                        return self.requireRamp() == false;
                    },
                    write: function (value) {
                        if (value)
                            self.requireRamp(false);
                    }
                }
                , this);

            //self.requireLuggageHelp = ko.observable(false);

            //self.requireLiftHelp = ko.observable(false);

            //self.requireRamp = ko.observable(false);
            self.numberofAssistance = ko.observable('').extend({ required: true });
            self.additionalInfo = ko.observable();
            self.outboundfrom = ko.observable().extend({
                differentThan: {
                    onlyIf: function () {
                        return self.ticketBookedWith() === false;
                    },
                    params: self.outboundfrom, message: 'Destination and origin have to be different'
                }
            });
            self.outboundfromName = ko.observable();
            self.outboundto = ko.observable().extend({
                differentThan: {
                    onlyIf: function () {
                        return self.ticketBookedWith() === false;
                    },
                    params: self.outboundfrom, message: 'Destination and origin have to be different'
                }
            });
            self.outboundtoName = ko.observable();
            self.outboundDate = ko.observable().extend({ required: true });
            self.OutboundSeatReservation = ko.observable();
            self.outboundTime = ko.observable().extend({ isTime: { params: self.outboundDate } });
            //self.OutBoundseatReservation = ko.observable(false);
            self.OutBoundcoach = ko.observable();
            self.OutBoundseatNumber = ko.observable('');

            self.Returnfrom = ko.observable().extend({
                differentThan: {
                    onlyIf: function () {
                        return (self.typeOfJourney() === false && self.ticketBookedWith() === false);
                    },
                    params: self.Returnfrom || self.outboundfrom, message: 'Outward and return Departure station should not be same'

                }

            });
            self.ReturnfromName = ko.observable();

            self.Returnto = ko.observable().extend({
                differentThan: {
                    onlyIf: function () {
                        return (self.typeOfJourney() === false && self.ticketBookedWith() === false);
                    },
                    params: self.Returnfrom, message: 'Destination and origin have to be different'
                }
            });
            self.ReturntoName = ko.observable();
            self.returnDate = ko.observable().extend({
                required: {
                    onlyIf: function () {
                        return (self.typeOfJourney() === false && self.ticketBookedWith() === false);
                    }
                },
                validation: {
                    validator: function (val, otherDate) {
                        if (self.typeOfJourney() === false && self.ticketBookedWith() === false && self.returnDate() !== undefined && val !== undefined) {


                            if (val == "" || typeof val === 'undefined' || self.typeOfJourney() === false)
                                return true;
                            var value = ko.utils.unwrapObservable(val);
                            var otherDateValue = ko.utils.unwrapObservable(otherDate);
                            if (value && value._isAMomentObject && otherDateValue && otherDateValue._isAMomentObject) {

                                return value > otherDateValue;
                            }

                            return false;
                        }
                        return true;

                    },
                    message: 'Return must take place after outbound journey',
                    params: self.outboundDate
                }

            });
            self.ReturnSeatReservation = ko.observable();
            self.ReturnTime = ko.observable().extend({
                isTime: { params: self.ReturnDate },
                required: {
                    onlyIf: function () {
                        return (self.typeOfJourney() === false && self.ticketBookedWith() === false);
                    }
                },
                validation: {
                    validator: function (val, otherDate) {
                        if (self.typeOfJourney() === false && self.returnDate() !== undefined && val !== undefined) {
                            var returnDate = self.returnDate().toDate();
                            var outBoundDate = otherDate.toDate();
                            var outBoundTime = self.outboundTime().split(":");
                            outBoundDate.setHours(outBoundTime[0]);
                            outBoundDate.setMinutes(outBoundTime[1]);
                            var currentVal = val.split(":");
                            returnDate.setHours(currentVal[0]);
                            returnDate.setMinutes(currentVal[1]);
                            var value = ko.utils.unwrapObservable(val);
                            var otherDateValue = ko.utils.unwrapObservable(otherDate);
                            if (outBoundDate > returnDate || outBoundDate == returnDate) {

                                return false;
                            }

                        }
                        return true;

                    },
                    message: 'Return must take place after outbound journey',
                    params: self.outboundDate
                }

            });
            //self.ReturnseatReservation = ko.observable(false);
            self.Returncoach = ko.observable();
            self.ReturnseatNumber = ko.observable();
            self.agreeTermsAndConditions = ko.observable(false).extend({ isChecked: true });
            self.experienceContactResearchAgreement = ko.observable(false);
            self.passengerAssistBookingSystemAgreement = ko.observable(false);

            koUtils.decorateBooleanObservableForEditing(self.experienceContactResearchAgreement, self);
            koUtils.decorateBooleanObservableForEditing(self.passengerAssistBookingSystemAgreement, self);

            self.isValid = function () {
                return validationHelper.validate(self, { deep: true });
            };
        };
    });

define('viewmodels/forms/assistedTravelFormUi', ['jquery', 'knockout', 'models/formData/assistedTravel', 'dataService', 'stationService', 'popupHelper', 'dateUtils', 'context'],
    function ($, ko, AssistedTravelFormData, dataService, stationService, popupHelper, dateUtils, context) {

        var assistedTravelFormData = new AssistedTravelFormData();
        var formSettingId = ko.observable();
        var isSubmitted = ko.observable(false);
        var stations = ko.observableArray([]);
        var isProcessingRequest = ko.observable(false);
        var captcha = null;

        var formattedOutboundDate = ko.computed(function () {
            return dateUtils.getFormattedDate(assistedTravelFormData.outboundDate(), context.dateFormat.shortDate);
        });

        var formattedReturnDate = ko.computed(function () {
            return dateUtils.getFormattedDate(assistedTravelFormData.returnDate(), context.dateFormat.shortDate);
        });

        var init = function (settingId) {
            formSettingId(settingId);
            stationService.getStationsForAutocomplete().done(function (data) {
                stations(data);
            });
            var dt = new Date();
            var time = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
            var outboundDate = dateUtils.currentDate().clone().add(0, 'days').hour(dt.getHours()).minute(dt.getMinutes() );
            var returnDate = dateUtils.currentDate().clone().add(0, 'days').hour(dt.getHours()).minute(dt.getMinutes()+1);
            assistedTravelFormData.outboundTime(outboundDate.format('HH:mm'));
            assistedTravelFormData.outboundDate(outboundDate);
         
            assistedTravelFormData.returnDate(returnDate);

        };
        var scrollToValidationError = function () {
            var mainContainer = $("body,html");
            var firstValidationError = $(".component-assistedtravel-form").find(".validation-error-message:visible:first");
            var msgHeight = $(".validation-error-message:visible:first").height();
            var windowHeight = $(window).height();
            firstValidationError.length > 0 && mainContainer.animate({
                scrollTop: firstValidationError.offset().top - (windowHeight - msgHeight) / 2,
                scrollLeft: 0
            }, 300)
        };

        var submit = function () {
            isProcessingRequest(true);
            if (!assistedTravelFormData.isValid()) {

                isProcessingRequest(false);
                scrollToValidationError();
                CheckValidation();
                return;
            }
            if (CheckValidation()) {
                isProcessingRequest(false);
                scrollToValidationError();
                return;
            }

            if (this.captcha) {
                this.captcha.getToken().done(function (token) {
                    assistedTravelFormData.captchaToken = token;

                    sendData();
                    return;
                }).fail(function () {
                    isProcessingRequest(false);
                    return;
                });
            } else {
                sendData();
            }
        };

        var CheckValidation = function () {
            if (assistedTravelFormData.contactDetails.email() !== assistedTravelFormData.contactDetails.repeatEmail()) {
                $('.same-email-error-box').css('display', 'block');
                $('.same-email-error-box').text('Email id should be same');
                return true;
            }
            //if ((assistedTravelFormData.useWheelChair() == "Wheelchair" || assistedTravelFormData.useWheelChair() == "Scooter") && assistedTravelFormData.WheelchairScooterDimensionsConfirmed()=="false") {
            //    $('.wheelchair-size').css('display', 'block');
            //    $('.wheelchair-size').text('You will not be able to travel on our service if your wheelchair/ schooter is wider than 70cm or longer than 120cm');
            //    return true;
            //}
        };

      

        var sendData = function () {
         
            dataService.saveAssistedTravelData(assistedTravelFormData, formSettingId).done(function () {
                isSubmitted(true);
            }).fail(function () {

                isProcessingRequest(false);

                if (this.captcha) {
                    this.captcha.reset();
                }
                popupHelper.showDialog('formSubmissionErrorDialog', { message: "Sorry, there has been an error and your form can't be submitted at the moment. Please try again later, or contact us by phone or email." });
            });
        };

        return {
            data: assistedTravelFormData,
            stations: stations,
            isSubmitted: isSubmitted,
            isProcessingRequest: isProcessingRequest,
            formattedOutboundDate: formattedOutboundDate,
            captcha: captcha,
            formattedReturnDate: formattedReturnDate,
            init: init,
            submit: submit
        };
    });
define('models/formData/groupTravel', ['knockout', 'models/personalInfo', 'validationHelper', 'koUtils'],
    function (ko, PersonalInfo, validationHelper, koUtils) {
        return function () {
            var self = this;


            self.email = ko.observable().extend({ required: { message: 'Please enter Email address' }, email: true });
            self.postcode = ko.observable().extend({ required: {message: 'Please enter Postcode'} });
            self.address1 = ko.observable().extend({ required: { message: 'Please enter your Address' } });
            self.address2 = ko.observable();
            self.city = ko.observable().extend({ required: { message: 'Please enter Town / City' } });

            self.contactnumber = ko.observable().extend({
                required: { message: 'Please enter Contact number' },

                pattern: {
                    message: 'Please enter a valid phone number in ###-###-#### format',
                    params: /(\+|00){0,2}(9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\d{1,14}$/,

                }
            });
            /**end */

            self.personalInfo = new PersonalInfo();
            // self.contactDetails = new ContactDetails(/*requirePhoneNumber:*/ true, /*requireAddress:*/ false);

            self.numberOfAdults = ko.observable('1').extend({ /*required: true, digit: { message: 'You must enter a number into this field.' }*/ });
            //self.numberOf16and17yearsOld = ko.observable().extend({ required: true, digit: { message: 'You must enter a number into this field.' } });
            self.numberOfChildren = ko.observable('0').extend({
                //required: true, digit: { message: 'You must enter a number into this field.' },

                //validation: {
                //    validator: function (val, someOtherVal) {
                //        var val1 = (typeof self.numberOfAdults() === 'undefined' || self.numberOfAdults() == "" || isNaN(parseInt(self.numberOfAdults()))) ? 0 : parseInt(self.numberOfAdults())
                //        var val2 = (typeof val === 'undefined' || val == "" || isNaN(parseInt(val))) ? 0 : parseInt(val)

                //        var sum = val1 + val2;

                //        return sum > someOtherVal;
                //    },
                //    message: 'Minumum Number of Passengers Allowed are 10',
                //    params: 9
                //}
            });
            self.totalpassengers = ko.computed(function () {
                return parseInt(self.numberOfChildren()) + parseInt(self.numberOfAdults());
            }, self).extend({
                validation: {
                    validator: function (val, someOtherVal) {



                        return parseInt(val) > someOtherVal;
                    },
                    message: 'Minumum Number of Passengers Allowed are 10',
                    params: 9
                }


            });
            self.from = ko.observable().extend({
                required: { message: 'Please select Departure station' }, differentThan: {
                    params: self.from, message: 'Destination and origin have to be different'
                }
            });
            self.fromName = ko.observable();
            self.to = ko.observable().extend({
                required: { message: 'Please select Destination station' }, differentThan: {
                    params: self.from, message: 'Destination and origin have to be different'
                }
            });
            self.travelclass = ko.observable('').extend({ required: { message: 'Please select class of travel' } });
            self.country = ko.observable();



            self.ScheduleDeparture = ko.observable('').extend({ required: true });
            self.toName = ko.observable();

            self.viaName = ko.observable();
            self.isReturnJourney = ko.observable(false);
            koUtils.decorateBooleanObservableForEditing(self.isReturnJourney, self);

            self.outboundDate = ko.observable().extend({ required: true });
            self.outboundTime = ko.observable().extend({ isTime: { params: self.outboundDate } });

            self.returnDate = ko.observable().extend({
                required: { onlyIf: self.isReturnJourney },


                validation: {
                    validator: function (val, otherDate) {
                        if (val == "" || typeof val === 'undefined' || !self.isReturnJourney)
                            return true;
                        var value = ko.utils.unwrapObservable(val);
                        var otherDateValue = ko.utils.unwrapObservable(otherDate);
                        if (value && value._isAMomentObject && otherDateValue && otherDateValue._isAMomentObject) {

                            return value > otherDateValue;
                        }
                        
                        return false;

                    },
                    message: 'Return must take place after outbound journey',
                    params: self.outboundDate
                }

            });

            self.returnTime = ko.observable().extend({
                isTime: { params: self.returnDate }, required: {
                    onlyIf: self.isReturnJourney
                }
            });
            self.ScheduleReturn = ko.observable('').extend({ required: { onlyIf: self.isReturnJourney } });

            self.prefferedCommmunication = ko.observable().extend({ required: { message: 'Please choose your preferred method of contact' } });;
            self.Emailselect = ko.computed(
                {
                    read: function () {
                        return self.prefferedCommmunication() == "Email";
                    },
                    write: function (value) {
                        if (value)
                            self.prefferedCommmunication("Email");
                    }
                }
                , self);
            self.Telephone = ko.computed(
                {
                    read: function () {
                        return self.prefferedCommmunication() == "Telephone";
                    },
                    write: function (value) {
                        if (value)
                            self.prefferedCommmunication("Telephone");
                    }
                }
                , this);
            self.notes = ko.observable('');
            self.agreeTermsAndConditions = ko.observable(false).extend({ isChecked: { message: 'I agree to the terms and conditions is required' } });
            self.awcinformation = ko.observable(false);
            self.marketing_opt_in = ko.observable('');
               
           
            self.isValid = function () {
                return validationHelper.validate(self, { deep: true });
            };

        };

    });
define('viewmodels/forms/groupTravelFormUi', ['jquery', 'knockout', 'models/formData/groupTravel', 'dataService', 'stationService', 'popupHelper', 'dateUtils', 'context'],
    function ($, ko, GroupTravel, dataService, stationService, popupHelper, dateUtils, context) {

        var data = new GroupTravel();
        var formSettingId = ko.observable();
        var isSubmitted = ko.observable(false);
        var stations = ko.observableArray([]);
        var isProcessingRequest = ko.observable(false);
        var captcha = null;

        var formattedOutboundDate = ko.computed(function () {
            return dateUtils.getFormattedDate(data.outboundDate(), context.dateFormat.shortDate);
        });

        var formattedReturnDate = ko.computed(function () {
            return dateUtils.getFormattedDate(data.returnDate(), context.dateFormat.shortDate);
        });

        var scrollToValidationError = function () {
            var mainContainer = $("body,html");
            var firstValidationError = $(".component-grouptravel-form").find(".validation-error-message:visible:first");
            var msgHeight = $(".validation-error-message:visible:first").height();
            var windowHeight = $(window).height();
            firstValidationError.length > 0 && mainContainer.animate({
                scrollTop: firstValidationError.offset().top - (windowHeight - msgHeight) / 2,
                scrollLeft: 0
            }, 300)
        };

        var init = function (settingId) {
            var outboundDate = dateUtils.currentDate().clone().add(1, 'days').hour(12).minute(0);

            formSettingId(settingId);

            data.outboundDate(outboundDate);
            data.outboundTime(outboundDate.format('HH:mm'));



            stationService.getStationsForAutocomplete().done(function (data) {
                stations(data);
            });
        };

        var submit = function () {
            isProcessingRequest(true);
           
            
            if (!data.isValid()) {
                isProcessingRequest(false);
                scrollToValidationError();
                return;
            }

            if (this.captcha) {
                this.captcha.getToken().done(function (token) {
                    data.captchaToken = token;
                    if (data.awcinformation() == false) {
                        data.marketing_opt_in("No");
                    }
                    else {
                        data.marketing_opt_in("Yes");
                    }
                    sendData();
                    return;
                }).fail(function () {
                    isProcessingRequest(false);
                    return;
                });
            } else {
                sendData();
            }
        };

        var sendData = function () {
            dataService.saveGroupTravelData(data, formSettingId).done(function () {
                isSubmitted(true);
            }).fail(function () {
                isProcessingRequest(false);
                if (this.captcha) {
                    this.captcha.reset();
                }
                popupHelper.showDialog('formSubmissionErrorDialog', { message: "Sorry, there has been an error and your form can't be submitted at the moment. Please try again later, or contact us by phone or email." });
            });
        };

        return {
            data: data,
            stations: stations,
            isSubmitted: isSubmitted,
            isProcessingRequest: isProcessingRequest,
            formattedOutboundDate: formattedOutboundDate,
            formattedReturnDate: formattedReturnDate,
            captcha: captcha,

            init: init,
            submit: submit
        };
    });

define('models/formData/createEventData', ['knockout', 'validationHelper', 'koUtils'],
    function (ko, validationHelper, koUtils) {
        return function () {
            var self = this;

         
			self.title = ko.observable().extend({ required: true });

            self.eventDate = ko.observable(); self.eventEndDate = ko.observable();
            self.location = ko.observable().extend();;
            self.category = ko.observable().extend({ required: true });;
            self.subCategory = ko.observable().extend({ required: true });;
            self.description = ko.observable().extend({ required: true });;
            self.onlineEvent = ko.observable(false);
            self.freeEvent = ko.observable(false);
            self.filesUploaded = [];
			self.isValid = function () {
				return validationHelper.validate(self, { deep: true });
			};
          
        };
    });

define('models/base64Attachment', ['knockout'],
    function (ko) {
        return function () {
            var self = this;
            self.fileName = ko.observable();
            self.content = ko.observable();
        };
    });

define('viewmodels/forms/createEventFormUI', ['jquery', 'knockout', 'models/formData/createEventData', 'models/base64Attachment', 'dataService', 'stationService', 'popupHelper', 'utils', 'dateUtils', 'validationHelper', 'context'],
    function ($, ko, CreateEventData, Base64Attachment, dataService, stationService, popupHelper, utils, dateUtils, validationHelper, context) {

        var eventData = new CreateEventData();
        var apiError = ko.observable();
        var isProcessingRequest = ko.observable(false);
        var isSubmitted = ko.observable(false);
        var categories = ko.observableArray([]);
        var subcategories = ko.observableArray([]);
        var locations = ko.observableArray([]);
        var formattedOutwardEventDate = ko.computed(function () {
            return dateUtils.getFormattedDate(eventData.eventDate(), context.dateFormat.shortDate);
        });

        var formattedOutwardEventEndDate = ko.computed(function () {
            return dateUtils.getFormattedDate(eventData.eventEndDate(), context.dateFormat.shortDate);
        });

        var submitEvent = function () {
          
            isProcessingRequest(true);

			if (!eventData.isValid()) {
				isProcessingRequest(false);
				return;
            }
            apiError("");
            //var m = eventData.eventDate().utcOffset(0);
            //m.set({ hour: 0, minute: 0, second: 0});
            //m.toISOString();
            //m.format();
            //m = eventData.eventEndDate().utcOffset(0);
            //m.set({ hour: 0, minute: 0, second: 0});
            //m.toISOString();
            //m.format();
           var startdate= dateUtils.convertDateToUtc(eventData.eventDate()).toISOString();
            startdate = startdate.substr(0, startdate.indexOf('.')) +'Z';
            var enddate = dateUtils.convertDateToUtc(eventData.eventEndDate()).toISOString();
            enddate = enddate.substr(0, enddate.indexOf('.')) + 'Z';

            var postData = {
                event :{
                    "name": {
                      
                        "html": "<p>" + eventData.title() + "</p>"
                    },
                    "description": {
                       
                        "html": "<p>" + eventData.description() + "</p>"
                    },
                    "start": {
                        "timezone": "Europe/London",
                        "utc": startdate,

                    },
                    "end": {
                        "timezone": "Europe/London",
                        "utc": enddate,

                    },
                    "currency": "EUR",
                    "category_id": eventData.category(),
                    "subcategory_id": eventData.subCategory(),
                    "venue_id": eventData.location(),
                    "online_event": eventData.onlineEvent(),
                }
               
                
                
            }
            console.log(postData);
            dataService.createEvent(postData).done(function (data) {
                isSubmitted(true);
                
            }).fail(function (error) {
                error = JSON.parse(error);
                isProcessingRequest(false);
                apiError(error.error_description);
            });
        };
      
		var init = function () {
            eventData.eventDate(dateUtils.incrementDate(2, 'days'));
            eventData.eventEndDate(dateUtils.incrementDate(3, 'days'));
            dataService.allEventCategories().done(function (data) {
                categories(data.categories);
                
				});
            dataService.allEventLocations().done(function (data) {
                locations(data.venues);
                
            });
            dataService.allEventSubCategories().done(function (data) {
                subcategories(data.subcategories);
                
            });

        };
        return {
            eventData: eventData,
            isSubmitted: isSubmitted,
            categories: categories,
            subcategories: subcategories,
            formattedOutwardEventEndDate: formattedOutwardEventEndDate,
            locations: locations,
            formattedOutwardEventDate: formattedOutwardEventDate,
            isProcessingRequest: isProcessingRequest,
            apiError: apiError,
            init: init,
			submitEvent: submitEvent
        };

    });


define('models/formData/createVenueData', ['knockout', 'validationHelper', 'koUtils'],
    function (ko, validationHelper, koUtils) {
        return function () {
            var self = this;

         
			self.name = ko.observable().extend({ required: true });

            self.address1 = ko.observable();
            self.address2 = ko.observable();
            self.city = ko.observable();
            self.region = ko.observable();
            self.postalcode = ko.observable();
            self.country = ko.observable();
            self.latitude = ko.observable();
            self.longitude = ko.observable();
            self.agerestriction = ko.observable();
            self.capacity = ko.observable();
			self.isValid = function () {
				return validationHelper.validate(self, { deep: true });
			};
          
        };
    });

define('viewmodels/forms/createVenueFormUI', ['jquery', 'knockout', 'models/formData/createVenueData', 'models/base64Attachment', 'dataService', 'stationService', 'popupHelper', 'utils', 'dateUtils', 'validationHelper', 'context'],
    function ($, ko, CreateVenueData, Base64Attachment, dataService, stationService, popupHelper, utils, dateUtils, validationHelper, context) {

        var venueData = new CreateVenueData();
        var apiError = ko.observable();
		var isProcessingRequest = ko.observable(false);
        
        
        var isSubmitted = ko.observable(false);
        
        var submitVenue = function () {
          
            isProcessingRequest(true);

            if (!venueData.isValid()) {
				isProcessingRequest(false);
				return;
            }
            apiError("");
            var SendData = {
                venue: {
                    "name": venueData.name(),
                    "address": {

                        "address_1": venueData.address1(),
                        "address_2": venueData.address2(),
                        "city": venueData.city(),
                        "region": venueData.region(),
                        "postal_code": venueData.postalcode(),
                        "country": venueData.country(),

                    },
                    "age_restriction": venueData.agerestriction(),
                    "capacity": venueData.capacity(),

                    "latitude": venueData.latitude(),
                    "longitude": venueData.longitude()
                }



            }
            console.log(SendData);
            dataService.saveVenueData(SendData).done(function (data) {
                isSubmitted(true);
            }).fail(function (error) {
                error = JSON.parse(error);
                apiError(error.error_description);
                isProcessingRequest(false);

            });
            
            

        };
      
        var init = function () {

        };
        return {
            venueData: venueData,
            submitVenue: submitVenue,
            isSubmitted: isSubmitted,
            isProcessingRequest: isProcessingRequest,
            apiError: apiError,
            init: init

        };

    });


define('customJS/Autosuggest', ['jquery', 'browserHelper', 'utils'],
    function ($, browserHelper, utils) {
        function handleMessage(e) {
            try {
                var json = JSON.parse(e.data);
            }
            catch (ex) {

            }
            if (json.message == "submit_preferences") {
                removeTrustArcOverlay();
            }
            if (json &&
                json.PrivacyManagerAPI) {
                switch (json.PrivacyManagerAPI.consent) {
                    case "denied":
                        break;
                    case "approved":
                        break;
                };
            }
        }
        var inputVal = "";
        var previousSiblingId = "";

        function addTrustArcOverlay() {
            $('#trustarc-overlay').addClass('trustarc-wall');
            $('body').css('overflow-y', 'hidden');
        }

        function removeTrustArcOverlay() {
            $('#trustarc-overlay').removeClass('trustarc-wall');
            $('body').css('overflow-y', 'scroll');
        }
        var init = function () {
            var loggedIn = false;
            var webtisType = $('#WebTISType');
            var useSignin = false;
            if (webtisType !== undefined && webtisType != null) {
                useSignin = webtisType.data("usesignin");
                var customerKey = localStorage.getItem('CustomerKey');
                if (customerKey !== undefined && customerKey !== "" && customerKey !== null) {
                    loggedIn = true;
                }
            }


            if (!loggedIn && useSignin) {
                $("#myAccount").css("display", "none");
                $("#signIn").css("display", "block");
                $("#myAccountD").css("display", "none");
                $("#signInD").css("display", "block");

            }
            else {
                $("#myAccount").css("display", "block");
                $("#signIn").css("display", "none");
                $("#myAccountD").css("display", "block");
                $("#signInD").css("display", "none");
            }
        };
        $(document).ready(function () {

            $(document).on('click', '.tab-nav span', function () {
                $([$(this).parent()[0], $($(this).data('href'))[0]]).addClass('active').siblings('.active').removeClass('active');
            });

            utils.checkIfTrusteConsentGiven(function (callback) {
                if (callback) {
                    window.addEventListener("message", handleMessage, false);
                    addTrustArcOverlay();
                    $(document).on('click', '#truste-consent-button', function () {
                        removeTrustArcOverlay();
                    })
                }
            });
        });
        var serviceUrl = "//api.reciteme.com/asset/js?key=";
        var serviceKey = "20259f6edf403200cfd297d98561b454a06424bc";

        var options = {
            Language: {
                Translate: {
                    disallowedTags: ['SCRIPT', 'STYLE', 'NOSCRIPT']
                }
            },
            TextMode: {
                hideElements: ['img', 'iframe', 'object', 'embed', 'svg', '.mobile-header'],
                disableInlineStyles: (true),
                disableStylesheets: (true)
            }
        };

        // Options can be added as needed
        var autoLoad = false;
        var enableFragment = "#reciteEnable";

        var loaded = [],
            frag = !1;
        window.location.hash === enableFragment && (frag = !0);

        function loadScript(c, b) {
            var a = document.createElement("script");
            a.type = "text/javascript";
            a.readyState ? a.onreadystatechange = function () {
                if ("loaded" == a.readyState || "complete" == a.readyState) a.onreadystatechange = null, void 0 != b && b()
            } : void 0 != b && (a.onload = function () {
                b()
            });
            a.src = c;
            document.getElementsByTagName("head")[0].appendChild(a)
        }

        function _rc(c) {
            c += "=";
            for (var b = document.cookie.split(";"), a = 0; a < b.length; a++) {
                for (var d = b[a];
                    " " == d.charAt(0);) d = d.substring(1, d.length);
                if (0 == d.indexOf(c)) return d.substring(c.length, d.length)
            }
            return null
        }

        function loadService(c) {
            for (var b = serviceUrl + serviceKey, a = 0; a < loaded.length; a++)
                if (loaded[a] == b) return;
            loaded.push(b);
            loadScript(serviceUrl + serviceKey, function () {
                "function" === typeof _reciteLoaded && _reciteLoaded();
                "function" == typeof c && c();
                Recite.load(options);
                Recite.Event.subscribe("Recite:load", function () {
                    Recite.enable()
                })
            })
        }
        "true" == _rc("Recite.Persist") && loadService();
        (autoLoad && "false" != _rc("Recite.Persist") || frag) && loadService();

        document.addEventListener("DOMContentLoaded", function (e) {
            var b = !1;
            if (window.top == window.self) {
                var c = {
                    data: "recite_frame_enabler"
                };
                b = !0
            } else c = {
                data: "recite_frame_parent_communicator"
            };
            window.top.postMessage(JSON.stringify(c), "*");
            window.addEventListener("message", function (a) {
                try {
                    var d = JSON.parse(a.data);
                    "undefined" != typeof a.source && (b && "recite_frame_parent_communicator" == d.data ? "undefined" != typeof Recite && null != a.source && a.source.postMessage(JSON.stringify(c), "*") : b || "recite_frame_enabler" != d.data || loadService())
                }
                catch (ex) {

                }
            })
        });

        function _reciteLoaded() {
            Recite.Event.subscribe('Preferences:load', _syncLanguage);
            Recite.Event.subscribe('Preferences:set', _syncLanguage);
            Recite.Event.subscribe('Preferences:reset', _syncLanguage);
        }

        function _syncLanguage() {
            // Sync Recite settingds and local storage
            var lang = Recite.Preferences.get('language');
            var storedLang = localStorage.getItem("user_lang");
            if (storedLang == "undefined" || lang != storedLang && lang != null) {
                // set the lang 
                localStorage.setItem("user_lang", lang);
            }
            setUiElements(lang);
        }

        var reciteLoading = false;
        jQuery(document).ready(function () {
            //attach the translation listener
            jQuery(document).on("click", ".lang", function () {
                _handleLanguageClick(jQuery(this).data("lang"))
            });
            // add a on click to load the full recite me service 
            jQuery(document).on("click", ".reciteme", function () {
                loadService();
                return false;
            });
        });


        if (_rc("Recite.Persist") === "false" || _rc("Recite.Persist") === null || _rc("Recite.Persist") == "null") {

            $(document).ready(function () { //check for and handle storage language
                var storedLang = localStorage.getItem("user_lang");
                storedLang = localStorage.getItem("adminPage_lang");
                if (storedLang != "undefined") {
                    setUiElements(storedLang);
                    _handleLanguageClick(storedLang);
                }
            });
        }

        function _handleLanguageClick(lang) {
            if (lang === null || lang == "null")
                return;

            if (typeof (Recite) != "undefined") {
                reciteLoading = false;
                //set the localstorage lang for subsequent page requests.
                localStorage.setItem("user_lang", lang);

                Recite.Language.Translate.translate(jQuery("body")[0], lang);
                Recite.Preferences.set('language', lang);
            } else {
                //check that we haven’t already requested this - 
                if (!reciteLoading) {
                    loadAndTranslate(lang);
                }
            }
        }

        function loadAndTranslate(lang) {
            reciteLoading = true;
            loadScript(serviceUrl + serviceKey, function () {
                _handleLanguageClick(lang); //this is in the script load callback so no ‘looping’ 
            });
        }

        function setUiElements(lang) {
            if (lang != "undefined" && lang != null) {
                if (lang == "en") {
                    $("#Id_en").text("English");
                    $("#selectedFlag").attr("src", "/Assets/img/flag/en.png");
                } else if (lang == "zh") {
                    $("#Id_en").text("中国简化");
                    $("#selectedFlag").attr("src", "/Assets/img/flag/zh.png");
                } else if (lang == "fr") {
                    $("#Id_en").text("Français");
                    $("#selectedFlag").attr("src", "/Assets/img/flag/fr.png");
                } else if (lang == "nl") {
                    $("#Id_en").text("Nederlands");
                    $("#selectedFlag").attr("src", "/Assets/img/flag/nl.png");
                } else if (lang == "de") {
                    $("#Id_en").text("Deutsch");
                    $("#selectedFlag").attr("src", "/Assets/img/flag/de.png");
                } else if (lang == "it") {
                    $("#Id_en").text("Italiano");
                    $("#selectedFlag").attr("src", "/Assets/img/flag/it.png");
                } else if (lang == "es") {
                    $("#Id_en").text("Español");
                    $("#selectedFlag").attr("src", "/Assets/img/flag/es.png");
                } else if (lang == "pl") {
                    $("#Id_en").text("Polski");
                    $("#selectedFlag").attr("src", "/Assets/img/flag/pl.png");
                } else if (lang == "pt") {
                    $("#Id_en").text("Português");
                    $("#selectedFlag").attr("src", "/Assets/img/flag/pt.png");
                } else if (lang == "cy") {
                    $("#Id_en").text("Cymraeg");
                    $("#selectedFlag").attr("src", "/Assets/img/flag/cy.png");
                }

                applyCss(lang);
            }
        }

        $(function () {
            var li = $('div.mm-dropdown > ul > li.input-option')

            var $menu = $('.input-option'); //.cntrynav
            var $menubtn = $('.textfirst');
            var $mmdropdown = $('div.mm-dropdown');

            $(document).on('click', function (e) {
                if ($menubtn.has(e.target).length === 0 &&
                    $menu.has(e.target).length === 0 &&
                    $mmdropdown.has(e.target).length === 0) {
                    li.hide('fast');
                    $('.textfirst').removeClass('showcntry');
                }
            });

            $(document).on('click', ".textfirst", function () {
                li.toggle('fast');
                $('.textfirst').toggleClass('showcntry');

            });

            window.onscroll = function () {
                if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
                    li.hide('fast');
                    $('.textfirst').removeClass('showcntry');
                }
            };

            // Insert Data
            $(document).on("click", ".input-option", function () {
                // hide
                li.toggle('fast');
                $('.textfirst').removeClass('showcntry');
                var livImgPath = $(this).find("img").attr("src").trim();
                $('#selectedFlag').attr("src", livImgPath);

                var liText = $(this).find("span").text().trim();
                var langCode = $(this).data("lang");

                if (langCode != "") {
                    $("#Id_en").text('');
                    $("#Id_en").text(liText);
                }
                applyCss(langCode);

            });
        });
        //js for language dropdown end

        function applyCss(langCode) {
            if (langCode == "fr" || langCode == "nl" || langCode == "de" || langCode == "it" || langCode == "es" || langCode == "pl" || langCode == "pt" || langCode == "cy") {

                $(".enggwrks li").css("margin-bottom", "5px");
                $(".card.card--blue-top-light p").css("font-size", "13px");
            } else {

                $(".enggwrks li").css("margin-bottom", "10px");
                //$(".card.card--blue-top-light p").css("font-size", "1.6em");
            }

            if (langCode == "de" || langCode == "it" || langCode == "pl") {
                jQuery(".necatar-notice__text p").css("font-size", "13px");
                jQuery(".nav__tabs__item a").css("font-size", "13px");
            } else {
                jQuery(".necatar-notice__text p").css("font-size", "14px");
                if (window.matchMedia('(max-width: 480px)').matches) {
                    jQuery(".nav__tabs__item a").css("");
                } else {
                    jQuery(".nav__tabs__item a").css("font-size", "16px");
                }
            }
        }
        setTimeout(function () {
            $(".select2-hidden-accessible").attr("data-recite-translate-skip", "true");
        }, 300);



        $(document).ready(function () {
            init();
            if (browserHelper.isTablet()) {
                $.cookie('tabletCookie', 'Yes', { expires: 730 });
            };

            $(document).on("click", "#bookmark-this", function () {
                var bookmarkURL = window.location.href;
                var bookmarkTitle = document.title;

                if ('addToHomescreen' in window && addToHomescreen.isCompatible) {
                    // Mobile browsers
                    addToHomescreen({ autostart: false, startDelay: 0 }).show(true);
                } else if (window.sidebar && window.sidebar.addPanel) {
                    // Firefox <=22
                    window.sidebar.addPanel(bookmarkTitle, bookmarkURL, '');
                } else if ((window.sidebar && /Firefox/i.test(navigator.userAgent)) || (window.opera && window.print)) {
                    // Firefox 23+ and Opera <=14
                    $(this).attr({
                        href: bookmarkURL,
                        title: bookmarkTitle,
                        rel: 'sidebar'
                    }).off(e);
                    return true;
                } else if (window.external && ('AddFavorite' in window.external)) {
                    // IE Favorites
                    window.external.AddFavorite(bookmarkURL, bookmarkTitle);
                } else {
                    // Other browsers (mainly WebKit & Blink - Safari, Chrome, Opera 15+)
                    alert('Press ' + (/Mac/i.test(navigator.platform) ? 'Cmd' : 'Ctrl') + '+D to bookmark this page.');
                }

                return false;

            });

        });


        return {
            init: init
        };
    });
define("customJS/AutoSuggest", function(){});

define('customJS/BannerOverlay', ['jquery'],
    function ($) {
        var init = function () {
            bindEvents();
            var delayTime = $('#banner-overlay-delay').val() * 1000;
            if ($('.banner-transparent').length > 0) {
                $('#banner-overlay-background').css("display", "block");
            }
            $('#banner-div').delay(delayTime).fadeIn(1);
        }

        var bindEvents = function () {
            $(document).ready(function () {
                $('#banner-overlay-close').on('click', function () {
                    $('#banner-div').css("display", "none");
                    $('#banner-overlay-background').css("display", "none");
                });
            });
        }


        return {
            init: init
        };
    });
define('customJS/offerData', ['jquery'],
function ($) {
    var CurrentPage;
    var desktopFilterItems = [];
	var desktopFilterIds = [];
	var mobileFilterIds=[];
    var specificFilterItems = [];
    var oldPageYOffset = 0;
    var appliedfilter = false;
    var totalCount = "";
    var pageNumber = 1;
    var specificDataCount = 6;
    var mobilePagenumber = 1;
	var overAllCount=6;

    $(document).on('click', '#load-more-button', function (e) {
      specificFilterItems.length = 0;
        var filterName = $(this).children().val();
		var arr=$(this).parent().prevUntil('#filter-section');
		var index= arr.length-1;
		arr.splice(index,1);
        LoadMoreData(arr,event,specificDataCount,'over-all-filter');
    });

    $(document).on('click', '#load-more-button-all', function (e) {
        specificFilterItems.length = 0;
        var filterName = $(this).children().val();
        var specificCountData= Number($(this).children().attr('name'));
        specificFilterItems.push(filterName);
		var arr=$(this).parent().prevUntil('#filter-section1');
        LoadMoreData(arr,event,specificCountData,'specific-filter');
    });
	
	function LoadMoreData(arr,event,specificCountData,filterType){
		var array =arr;
		var count=0;
	   for (var i = array.length-1; i >=0; i--) {
           var a =arr[i];
		  if(count<6){
			  if($(a).hasClass('hide-offers')){
			  
                  if (count < 6) {
                      $(a).removeClass('hide-offers');
                  }
		    count++;
		   }
		   }
		  
		   else{
			   break;
		   }
        }
		  if(filterType=='specific-filter')
		  {
			   specificCountData+=count;
			     event.target.children[0].setAttribute('name',specificCountData);
				  HideLoadMoreButton(specificCountData,array.length,event);
		  }
		  else{
			  specificDataCount+=count;
			   HideLoadMoreButton(specificDataCount,array.length,event);
			   $('#showing-results').text(specificDataCount);
		  }
		
		  
	};

  

    function LoadMoreItem(filterItems, pageNumber, condition, e) {
        $.ajax({
            url: "/api/sitecore/OfferSearch/FilteredOffer",
            type: "GET",
            dataType: "json",
            data: { filterItems: filterItems, PageNumber: pageNumber },
            traditional: true,
            success: function (response) {
                if (condition == "filter-loadMore") {
                    BindLoadMoreData(response, e);
                }
                else {
                    BindSpecificLoadMoreData(response, e,pageNumber);
                }
            },
            error: function (xhr, status, error) {
                alert(xhr.responseText);
            }
        });
    }

    
    function BindLoadMoreData(response, e) {
        var data = response.data;
        var totalItems = response.totalItems;
        var tr = e.target.parentElement.previousElementSibling;
		var arr=$(this).parent().prevUntil('#filter-section1');
        var html = "";
        for (var i = 0; i < data.length; i++) {
            html += "<div class='col-lg-4 col-md-6 col-sm-12 col-xs-12  animated zoomIn'><div class='offers-promo yellow-theme height_350 no_padding'>" +
                  "<img src='" + data[i].OfferImage + "' class='img-responsive' style='width:100%;height:61%'><a href='" + data[i].URL + "' target='_blank'>"
             + "<div class='offers-title'>" + data[i].OfferTitle + "</div>"
            + "<p>" + data[i].OfferSubtitle + "</p></a></div></div>";
        }
        $(html).insertAfter(tr);
        ChangeNumberOfItemsAppeared(data.length);
    }

    function BindSpecificLoadMoreData(response, e,pageNumber) {
        var data = response.data;
        specificDataCount += data.length;
        var totalItems = response.totalItems;
		pageNumber=pageNumber*6;
        var tr = e.target.parentElement.previousElementSibling;
		var arr = $(this).parent().prevUntil('#filter-section1');
        for (var i = 0; i < pageNumber; i++) {
            var html = "<div class='col-lg-4 col-md-6 col-sm-12 col-xs-12  animated zoomIn'><div class='offers-promo yellow-theme height_350 no_padding'>" +
                     "<img src='" + data[i].OfferImage + "' class='img-responsive' style='width:100%;height:61%'><a href='" + data[i].URL + "' target='_blank'>"
                + "<div class='offers-title'>" + data[i].OfferTitle + "</div>"
               + "<p>" + data[i].OfferSubtitle + "</p></a></div></div>";
            $(html).insertAfter(tr);
        }
        HideLoadMoreButton(specificDataCount, totalItems, e)
    }

    function HideLoadMoreButton(appeared, total,event) {
        var button = event.target.parentElement;
        if (appeared == total) {
            button.style.display = 'none';
        }
        else {
            button.style.display = 'block';
        }
    }
    function ChangeNumberOfItemsAppeared(showeditmsLength) {
        var dta = Number($('#showing-results').text());
        showeditmsLength += dta;
        $('#showing-results').text(showeditmsLength);
        var totalItms = Number($('#totalResultApi').text());
        if (totalItms == showeditmsLength) {
            $('.load-more').css('display', 'none');
        }
        else {
            $('.load-more').css('display', 'block');
        }
    }

   $(document).on("click", "#desktopLocationFilters", function (e) {
       GetDesktopFilteredData(e.target.getAttribute('name'), e.target.getAttribute('value'),e);
	   specificDataCount=6;
	    $('html, body').animate({
            scrollTop: $(".offers-section").offset().top-110
        }, 0);
	    $('#filtered-results').html("<div class='network-status-loading-bars'><ul class='loading-icon  loading-icon-offers'><li></li><li></li><li></li><li></li><li></li></ul></div>");
    });
	
	 $(document).on("click", "#desktopRegionFilters", function (e) {
	    GetDesktopFilteredData(e.target.getAttribute('name'), e.target.getAttribute('value'),e);
		 specificDataCount=6;
		  $('html, body').animate({
            scrollTop: $(".offers-section").offset().top-110
        }, 0);
		 $('#filtered-results').html("<div class='network-status-loading-bars'><ul class='loading-icon loading-icon-offers'><li></li><li></li><li></li><li></li><li></li></ul></div>");
    });
	 $(document).on("click", "#mobileLocationFilters", function (e) {
	     GetMobileFilteredData(e.target.getAttribute('name'),e.target.value, e);
		  specificDataCount=6;
    });
	
	 $(document).on("click", "#mobileRegionFilters", function (e) {
	     GetMobileFilteredData(e.target.getAttribute('name'),e.target.value, e);
		  specificDataCount=6;
		 
    });
	
	 $(document).on("click", "#mobileApplyButton", function (e) {
	     getMobileFilteredItems(e.target.getAttribute('name'), e);
		 
		 $('#filtered-results').html("<div class='network-status-loading-bars'><ul class='loading-icon loading-icon-offers'><li></li><li></li><li></li><li></li><li></li></ul></div>");
    });
	
 function GetDesktopFilteredData(name,id, event) {
	     pageNumber = 1;
	     if (event.target.checked == true)
		 {
			 PushDesktopFilterName(name);
			 PushDesktopFilterID(id);
		 }   
	     else
		 {
			 PopDesktopFilterName(name);
			 PopDesktopFilterID(id);
		 }
	         
	     GetDesktopFilteredItems(desktopFilterItems, desktopFilterIds,pageNumber,event);
	     if (desktopFilterItems.length == 0) {
	         appliedfilter = false;
	     }
	 }

    function PushDesktopFilterName(name) {
        desktopFilterItems.push(name);
    }

    function PopDesktopFilterName(name) {
        RemoveDesktopFilterName(desktopFilterItems, name);

    }
    function RemoveDesktopFilterName(arr, removeItem) {
        arr = $.grep(arr, function (value) {
            return value != removeItem;
        });
        return desktopFilterItems = arr;
    }
		function PushDesktopFilterID(name) {
        desktopFilterIds.push(name);
    }

    function PopDesktopFilterID(name) {
        RemoveDesktopFilterID(desktopFilterIds, name);

    }
    function RemoveDesktopFilterID(arr, removeItem) {
        arr = $.grep(arr, function (value) {
            return value != removeItem;
        });
        return desktopFilterIds = arr;
    }



    function GetDesktopFilteredItems(filterItems,filterId, pageNumber,event) {
        appliedfilter = true;
        var url = ReturnHitUrl(desktopFilterItems);
        $.ajax({
            url: url,
            type: "GET",
            dataType: "json",
          data: { filterItems: desktopFilterItems, PageNumber: pageNumber,listOfFilterIDs:filterId },
            traditional: true,
            success: function (response) {
                if (ShowNoResultDiv(response.data.length))
                    return;
                if (filterItems.length != 0) {
                    $('.clear-all-filters-filterSection').css('display', 'block');
                    BindDesktopData(response);
                }
                else {
                    $('.clear-all-filters-filterSection').css('display', 'none');
                    BindDesktopAllData(response);
                }
            },
            error: function (xhr, status, error) {
                alert(xhr.responseText);
            }
        });
    }

    function BindDesktopData(response) {
        var data = response.data;
		var incrementalCount=0;
		 $('html, body').animate({
            scrollTop: $(".offers-section").offset().top-110
        }, 0);
        var totalItems = response.totalItems;
        var tr = $('#filtered-results');
        var filteredItems = "";
        for (var i = 0; i < data.length; i++) {
			if(i<6){
				  if (i == 0) {
                if (desktopFilterItems.length == 0 && mobileFilterItems.length == 0)
                    filteredItems += "<div class='explore-results-message'>Showing 1- <b id='showing-results'>" + data.length + "</b> of total result <b id='totalResultApi'>" + totalCount + "</b></div>";
                else
                    filteredItems += "<div class='explore-results-message'>Showing 1- <b id='showing-results'>" + data.length + "</b> of total result <b id='totalResultApi'>" + totalItems + "</b></div>";
            }
            filteredItems += "<div class='col-lg-4 col-md-6 col-sm-12 col-xs-12  animated zoomIn'><div class='offers-promo yellow-theme height_350 no_padding'>" +
                     "<img src='" + data[i].OfferImage + "' class='img-responsive' style='width:100%;height:61%'><a href='" + data[i].URL + "' target='_blank'>"
                + "<div class='offers-title'>" + data[i].OfferTitle + "</div>"
               + "<p>" + data[i].OfferSubtitle + "</p></a></div></div>";
			   incrementalCount++;
			}
			else{
				  filteredItems += "<div class='col-lg-4 col-md-6 col-sm-12 col-xs-12  animated hide-offers zoomIn'><div class='offers-promo yellow-theme height_350 no_padding'>" +
                     "<img src='" + data[i].OfferImage + "' class='img-responsive' style='width:100%;height:61%'><a href='" + data[i].URL + "' target='_blank'>"
                + "<div class='offers-title'>" + data[i].OfferTitle + "</div>"
               + "<p>" + data[i].OfferSubtitle + "</p></a></div></div>";
				
			}
          
        }
        filteredItems += "<div class='col-md-12 load-more-all-button' style='display:none'><button id='load-more-button' class='load-more'>Load more</button></div>"
        $('#filtered-results').html(filteredItems);
		$('#showing-results').text(incrementalCount);
        ShowLoadMoreButton(totalItems);
    }


    function BindDesktopAllData(response) {
        $('.load-more-all-button').css('display', 'none');
        var data = response.data;
        var tr = $('#filtered-results');
        var filteredItems = "";
        for (var i = 0; i < data.length; i++) {
            var property = data[i].property;
            property = property.split('*');
            var count = property[1];
            var filter_name = property[2];
            var offers = data[i].value;
            if (offers != null && count>0) {
				var classAdd='hide-offers';
                filteredItems += "<div id='filter-section1' class='filter-section-offers1 padd_border'>" + property[0] + " - (" + count + ")</div>";
                for (var j = 0; j < offers.length; j++) {
					if(j>5){
						classAdd='hide-offers';
					}
					else{
						classAdd='';
					}
                    filteredItems += "<div class='col-lg-4 col-md-6 col-sm-12 col-xs-12   animated "+classAdd+" zoomIn'><div class='offers-promo yellow-theme height_350 no_padding'>" +
                    "<img src='" + offers[j].OfferImage + "' class='img-responsive' style='width:100%;height:61%'><a href='"+offers[j].OfferURL+"' target='_blank'>"
                     + "<div class='offers-title'>" + offers[j].OfferTitle + "</div>"
                     + "<p>" + offers[j].OfferSubtitle + "</p></a></div></div>";
                }
                if (count > 6) {
                    filteredItems += "<div class='col-md-12 load-more-specific-offers'><button id='load-more-button-all' class='load-more'>Load more<input type='hidden' class='specific-load-more' value='" + filter_name + "' name='6'></button></div>"
                }
            }
        }
        $('#filtered-results').html(filteredItems);
    }

    function ShowLoadMoreButton(itemLength) {
        if (itemLength < 6 || itemLength==6) {
            $('.load-more-all-button').css('display', 'none');
        }
        else {
            $('.load-more-all-button').css('display', 'block');
			
        }
    }

    // Mobile JS Starts from here

    var mobileFilterItems = [];
    var mobileFilterCategoryValue = [];
    var mobileFilterRegionValue = [];
	var mobileFilterIds=[];

    function GetMobileFilteredData(name,value, event) {
        if (event.target.checked == true) {
			mobileFilterIds =PushMobileFilterName(mobileFilterIds,event.target.nextElementSibling.value);
            mobileFilterItems = PushMobileFilterName(mobileFilterItems, name);
            if (name.indexOf('a=') != -1) {
                mobileFilterCategoryValue = PushMobileFilterName(mobileFilterCategoryValue, value);
				
                ShowFilterNameInAttractionBar(mobileFilterCategoryValue);
            }
            else {
                mobileFilterRegionValue = PushMobileFilterName(mobileFilterRegionValue, value);
                ShowFilterNameInRegionsBar(mobileFilterRegionValue);
				
            }

        }
        else {
			mobileFilterIds =PopMobileFilterName(mobileFilterIds,event.target.nextElementSibling.value);
            mobileFilterItems = PopMobileFilterName(mobileFilterItems, name);
            if (name.indexOf('a=') != -1) {
                mobileFilterCategoryValue = PopMobileFilterName(mobileFilterCategoryValue, value);
                ShowFilterNameInAttractionBar(mobileFilterCategoryValue);
            }
            else {
                mobileFilterRegionValue = PopMobileFilterName(mobileFilterRegionValue, value);
                ShowFilterNameInRegionsBar(mobileFilterRegionValue);
                ShowFilterNameInRegionsBar(mobileFilterRegionValue);
            }

        }
           
        if (mobileFilterItems.length == 0) {
            appliedfilter = false;
        }
        if(mobileFilterCategoryValue.length==0 && mobileFilterRegionValue.length==0)
            $('.clear-all-filters-filterSection-mobile').css('display', 'none');
    }

    function ShowFilterNameInAttractionBar(array) {
        if (array.length != 0) {
            var text = "";
            for (var i = 0; i < array.length; i++) {
                if (i == 0) {
                    text += array[i];
                }
                else { text += ", " + array[i] }
                $('.applied-filters-attraction').text(text);
            }
            $('.clear-all-filters-filterSection-mobile').css('display', 'block');
        }
        else {
            $('.applied-filters-attraction').text("");
        }
    }
    function ShowFilterNameInRegionsBar(array) {
        if (array.length != 0) {
            var text = "";
            for (var i = 0; i < array.length; i++) {
                if (i == 0) {
                    text += array[i];
                }
                else { text += ", " + array[i] }
                $('.applied-filters-regions').text(text);
            }
            $('.clear-all-filters-filterSection-mobile').css('display', 'block');
        }
        else {
            $('.applied-filters-regions').text("");
        }
    }
    function PushMobileFilterName(array,name) {
        array.push(name);
        return array;
    }

    function PopMobileFilterName(array,name) {
        return(RemoveMobileFilterName(array, name));
    }

    function RemoveMobileFilterName(arr, removeItem) {
        arr = $.grep(arr, function (value) {
            return value != removeItem;
        });
        return  arr;
    }
	
	
    function getMobileFilteredItems() {
        var url = ReturnHitUrl(mobileFilterItems);
        $.ajax({
            url: url,
            type: "GET",
            dataType: "json",
            data: { filterItems: mobileFilterItems, PageNumber: mobilePagenumber,listOfFilterIDs: mobileFilterIds},
            traditional: true,
            success: function (response) {
                if (ShowNoResultDiv(response.data.length))
                    return;
                if (mobileFilterItems.length != 0) {
                    BindDesktopData(response);
                }
                else {
                    BindDesktopAllData(response);
                }
            },
            error: function (xhr, status, error) {
                alert(xhr.responseText);
            }
        });
    }

	$(document).on("click", "#mobileRegionFilter", function () {
       var e = document.getElementById('RegionFilter');
        if (e.style.display == 'block')
            e.style.display = 'none';
        else
            e.style.display = 'block';
    });
	
    $(document).on("click", "#mobileLocationFilter", function () {
       var e = document.getElementById('LocationFilter');
        if (e.style.display == 'block')
            e.style.display = 'none';
        else
            e.style.display = 'block';
    });

    function ReturnHitUrl(arrayFilter) {
        var url = "";
        if (arrayFilter.length != 0) {
            url = "/api/sitecore/OfferSearch/FilteredOffer";
        }
        else {
            url = "/api/sitecore/OfferSearch/GetSpecificAllAttractions";
        }
        return url;
    }

    function ShowNoResultDiv(dataLength) {
        if (dataLength == 0) {
            var html = "<div class='col-lg-9 col-md-6 col-sm-12 col-xs-12 no-result-found'>Sorry, we couldn't find what you were looking for.<span id='Clear-all-filters'> Clear All Filters</span> and try again</div>";
            $('#filtered-results').html(html);
            $('.load-more-all-button').css('display', 'none');
			 $('html, body').animate({
            scrollTop: $(".offers-section").offset().top-110
        }, 0);
            return true;
        }
    }

    $(document).on('click', '.clear-all-filters-filterSection', function (e) {
        ClearAllFilters();
    });

    $(document).on('click', '.clear-all-filters-filterSection-mobile', function (e) {
        ClearAllFilters();
    });

    $(document).ready(function () {
        $(document).on('click', '#Clear-all-filters', function (e) {
            ClearAllFilters();
        });

    })
    function ClearAllFilters() {
        desktopFilterItems.length = 0;
        RemoveCheckedFilterForDesktop();
        GetDesktopFilteredItems(desktopFilterItems, 1);
        RemoveCheckedFilterForMobile();
    }
    
    function RemoveCheckedFilterForDesktop() {
        $('.checkbox-wrapper .filter-checkbox #desktopLocationFilters').each(function (index) {
            if ($(this).prop('checked') == true) {
                $(this).prop('checked', false);
            }
        });
        $('.checkbox-wrapper .filter-checkbox #desktopRegionFilters').each(function (index) {
            if ($(this).prop('checked') == true) {
                $(this).prop('checked', false);
            }
        });

        $('.clear-all-filters-filterSection').css('display', 'none');
    }

    function RemoveCheckedFilterForMobile() {
        mobileFilterRegionValue.length = 0;
        mobileFilterCategoryValue.length = 0;
        mobileFilterItems.length = 0;
        $('.checkbox-wrapper .filter-checkbox #mobileLocationFilters').each(function (index) {
            if ($(this).prop('checked') == true) {
                $(this).prop('checked', false);
            }
        });
        $('.checkbox-wrapper .filter-checkbox #mobileRegionFilters').each(function (index) {
            if ($(this).prop('checked') == true) {
                $(this).prop('checked', false);
            }
        });
        $('.clear-all-filters-filterSection-mobile').css('display', 'none');
        $('.applied-filters-regions').text("");
        $('.applied-filters-attraction').text("");
    }

   
    $(function () {
        $('body').append($('.offer-filters'))
    });
	
	    // $(window).scroll(function (e) {
        // // Get the position of the location where the scroller starts.
        // var scroller_anchor = $(".scroller_anchor").offset().top;
		
		
        // if ($(this).scrollTop() < (scroller_anchor - 200) && $('.scroller').css('position') != 'fixed') {
            // $('.dekstop-filter.hidden-xs').css({
                // 'position': 'relative',
                // 'top': '0'
            // });
            // //jQuery('.scroller_anchor').css('height', '50px');
        // }
		
        // else if ($(this).scrollTop() >= (scroller_anchor - 200) && $('.scroller').css('position') != 'relative') {
            // //jQuery('.scroller_anchor').css('height', '0px');
            // $('.dekstop-filter.hidden-xs').css({
                // 'position': 'fixed',
                // 'top': '90px'
            // });
        // }
		  // if ($(window).scrollTop() >= $('.footer').offset().top - window.innerHeight) {
            // $('.dekstop-filter.hidden-xs').css({
                // 'position': 'relative',
                // 'top': '0'
            // });
        // }
    // });
	
	var $body   = $(document.body);
	var navHeight = $('.nav-main-wrapper').outerHeight(true) -200;

	// $('#sidebar').affix({
		  // offset: {
			// top: 245,
			// bottom: navHeight
		  // }
	// });


	// $body.scrollspy({
		// target: '#leftCol',
		// offset: navHeight
	// });
	$(window).scroll(function (e) {
		var scroller_anchor = $(".scroller_anchor").offset().top;
		if ($(this).scrollTop() < (scroller_anchor - 200) && $('.scroller').css('position') != 'fixed') {
             $('.dekstop-filter.hidden-xs').css({
                 'position': 'relative',
                 'top': '0',
				 'width': '250px'
             });
            // //jQuery('.scroller_anchor').css('height', '50px');
         }
		if ($(window).scrollTop() >= $('.footer').offset().top - window.innerHeight) {
             $('.dekstop-filter.hidden-xs').css({
                'position': 'relative',
                'top': '0'
           });
		}
		else{
			if ($(this).scrollTop() >= (scroller_anchor - 200) && $('.scroller').css('position') != 'relative')
			{
		$('.dekstop-filter.hidden-xs').css({
                 'position': 'fixed',
                 'top': '90px'
           });
			}
			
		}
		});
	

    var init = function () {
        $(document).ready(function () {
            totalCount = $('#totalResultApi').text();
        })
    }

    return {
        init: init
    };
});


define("customJS/OfferData", function(){});

define('customJS/GADataLayer', ['jquery'], function ($) {
    var init = function () {
        LoadGADataLayer();
    }
    var LoadGADataLayer = function () {
        window.dataLayer = window.dataLayer || [];
        var environment = 'prod';
        var pageType = 'article';
        var city = '';
        var country = '';
        var fullURL = window.location.href;
        var fullPath = window.location.pathname;
        var fullURL_lower = fullURL.toLowerCase();
        var arr = fullPath.split('/');
        var gaTrackingID = 'UA-152623638-1';
        var gtmCode = 'GTM-WB2ZTJ8';
        var title = $(document).find('title').text();
        var BaseUrl = window.location.origin.toLowerCase();
        var email = localStorage.getItem('Email');
        var customerKey = localStorage.getItem('CustomerKey');
        if (customerKey == null) {
            customerKey = '';
        }
        var loggedIn = (customerKey != null && email != null) ? true : false;
        var customerLoginResponse = localStorage.getItem('customerLoginResponse');
        if (customerLoginResponse != null) {
            var defaultAddress = customerLoginResponse.CustomerDetail.Addresses.filter(x => x.IsDefault);
            if (defaultAddress != null && defaultAddress.length > 0) {
                city = defaultAddress[0].Address.City;
                country = defaultAddress[0].Address.Country;
            }
        }
        if (BaseUrl.includes('dev')) {
            environment = 'dev';
        }
        else if (BaseUrl.includes('staging')) {
            environment = 'staging';
        }
        else if (BaseUrl.includes('picouat')) {
            environment = 'uat';
        }
        if ((fullURL_lower == 'https://wc.dev.local/') ||(fullURL_lower == 'https://dev.avantiwestcoast.co.uk/') || (fullURL_lower == 'https://staging.avantiwestcoast.co.uk/') || (fullURL_lower == 'https://picouat.avantiwestcoast.co.uk/') || (fullURL_lower == 'https://www.avantiwestcoast.co.uk/')) {
            pageType = 'home';
        }
        const scriptGTMDataLayer = document.createElement('script');
        scriptGTMDataLayer.innerHTML =
            dataLayer.push({
                'event': 'pageMetaData',
                'page': {
                    'type': pageType,
                    'country': 'gb',
                    'environment': environment,
                    'language': 'en',
                    'fullURL': fullURL,
                    'fullPath': fullPath,
                    'path1': (arr[0] == undefined ? '' : arr[0]),
                    'path2': (arr[1] == undefined ? '' : arr[1]),
                    'path3': (arr[2] == undefined ? '' : arr[2]),
                    'path4': (arr[3] == undefined ? '' : arr[3]),
                    'title': title,
                    'createdDate': '',
                    'lastUpdated': '',
                    'author': '',
                    'version': '1',
                    'experimentID': '',
                    'experimentName': '',
                    'variantID': '',
                    'variantName': '',
                    'gaTrackingId': gaTrackingID,
                    'gtmTrackingId': gtmCode,
                    'firstViewed': true,
                },
                'user': {
                    'id': customerKey,
                    'hasTransacted': '',
                    'loggedIn': loggedIn,
                    'segments': '',
                    'country': country,
                    'city': city,
                    'isOnboardSession': ''
                }
            });
        document.getElementsByTagName('head')[0].appendChild(scriptGTMDataLayer);
    }
    return {
        init: init
    };
});
define('customJS/QttFormViewModelForPICO', ['jquery', 'moment'], function ($, moment) {
    function QTTForm() {
        this.NowDate = new Date();
        this.arrivalStation = null;
        this.departureStation = null;
        this.arrivalStationCRSCode = null;
        this.departureStationCRSCode = null;
           
        this.numberOfAdults = 1; //for passenger count
        this.numberOfChildren = 0;//for passenger count
        this.journeyType = 'Single';
        

        this.ChildrenCount = 0;// for added railcard
        this.AdultCount = 0;// for added railcard

        this.railcards = [];
        this.specialRailcard = [];

        this.departureTime = null;
        this.returnTime = null;
        this.departureDate = null;
        this.returnDate = null;
        this.departureOption = null;
        this.returnOption = null;
        this.numberOfRailcard = 0;
        this.departureDateTime = function () {
            // return moment(this.departureDate.getDate() + '-' + this.departureDate.getMonth() + '-' + this.departureDate.getFullYear() + ' ' + this.departureTime, 'DD-MM-YYYY HH:mm');
            return moment(this.departureDate, "DD-MM-YYYY HH:mm");
        }; 
        this.returnDateTime = function () {
            // return moment(this.returnDate.getDate() + '-' + this.returnDate.getMonth() + '-' + this.returnDate.getFullYear() + ' ' + this.returnTime, 'DD-MM-YYYY HH:mm');
            return moment(this.returnDate, "DD-MM-YYYY HH:mm");
        };
        this.getTotalPassenger = function () {
            return this.numberOfAdults + this.numberOfChildren;
        };
        this.ValidateDepartureStation = function () {
            if (this.departureStation == null || this.departureStation == '') {
                // result.errors.push(createErrorMessage('error-departure-station', 'Departure station cannot be empty'));
                $('.error-departureStation').show();
            }
            else {
                $('.error-departureStation').hide();
            }
        }
        this.ValidateArrivalStation = function () {
            if (this.arrivalStation == null || this.arrivalStation == '') {
                //result.errors.push(createErrorMessage('error-arrival-station', 'Arrival station cannot be empty'));
                $('.error-arrivalStation').show();
            }
            else {
                $('.error-arrivalStation').hide();
            }
        }
        this.ValidateDepartureDate = function () {
            if (this.departureDate == null || this.departureDate == '') {
                // result.errors.push(createErrorMessage('error-departure-date', 'Departure date cannot be empty', true));
                $('.error-departureDate').show();
            }
            else {
                $('.error-departureDate').hide();
            }
        }
        this.ValidateReturnDate = function () {
            if (this.returnDate == null || this.returnDate == '') {
                $('.error-arrivalDate').show();
            }
            else {
                $('.error-arrivalDate').hide();
            }
        }
        this.validateStations = function () {
            var result = { errors: [], valid: false };
            if (this.departureStation == null || this.departureStation == '') {
                result.errors.push(createErrorMessage('error-departure-station', 'Departure station cannot be empty'));
               // $('#error-departureStation').show();
            }
            if (this.arrivalStation == null || this.arrivalStation == '') {
                result.errors.push(createErrorMessage('error-arrival-station', 'Arrival station cannot be empty'));
               // $('#error-arrivalStation').show();
            }
            if (this.departureStation != null && this.arrivalStation != null && this.departureStation == this.arrivalStation) {
                result.errors.push(createErrorMessage('error-stations', 'Departure station and Arrival stations cannot be same'));
            }
            if (result.errors.length == 0) {
                result.valid = true;
              //  $('#error-departureStation').hide();
                //$('#error-arrivalStation').hide();
            }
            return result;
        }

        this.validateDates = function () {
            var result = { errors: [], valid: false };
            if (this.departureDate == null || this.departureDate == '') {
                result.errors.push(createErrorMessage('error-departure-date', 'Departure date cannot be empty', true));
            }
            //if (this.returnDate == null || this.returnDate == '') {
            //    result.errors.push(createErrorMessage('error-arrival-date', 'Arrival date cannot be empty', true));
            //}
            if (this.returnDateTime().isBefore(this.departureDateTime()) || this.returnDateTime().isSame(this.departureDateTime())) {
                result.errors.push(createErrorMessage('error-date', 'Return date must be after departure date', false));
            }
            if (this.departureDateTime() <= new Date($.now()) || this.returnDateTime() <= new Date($.now())) {
                result.errors.push(createErrorMessage('error-date', 'Departure date must only be in future', false));
            }
            if (result.errors.length == 0) {
                result.valid = true;
            }
            return result;
        }

        this.validateRailcards = function () {
            var result = { errors: [], valid: false };
            var countA = 0, countC = 0;

            $.each(this.specialRailcard, function (index, card) {
                countA += parseInt(card.Adults);
                countC += parseInt(card.Childrens);
            });
            if (this.specialRailcard.length > 0) {
                if (this.getTotalPassenger() < countA + countC) {
                    result.errors.push(createErrorMessage('error-railcard-quantity', 'Number of railcards should be less or equal to total number of passengers', false));
                }
                else {
                    result.valid = true;
                }
            }
            else {
                result.valid = true;
            }
            return result;
        }

        this.Validate = function () {
            var result = { errors: [], valid: false };
            this.ValidateDepartureStation();
            this.ValidateArrivalStation();
            this.ValidateDepartureDate();
            //this.ValidateReturnDate();
            var stationResult = this.validateStations();
            var datesResult = this.validateDates();
            var railcardResult = this.validateRailcards();
            if (!stationResult.valid)
                result.errors.push.apply(result.errors, stationResult.errors);
            if (!datesResult.valid)
                result.errors.push.apply(result.errors, datesResult.errors);
            if (!railcardResult.valid)
                result.errors.push.apply(result.errors, railcardResult.errors);
            if (result.errors.length == 0) {
                result.valid = true;
            }
            return result;

        };

        var createErrorMessage = function (key, value, onSubmit) {
            if (!onSubmit) {
                onSubmit = false;
            }
            return { key: key, message: value, onSubmit: onSubmit };
        }
    }
    return {
        QttForm: QTTForm
    };
});

define('customJS/QttUtilityForPICO', ['jquery', 'jqueryui', 'context', 'moment'], function ($, jqueryUi, context, moment) {

    var DATETIME_FORMAT = "DD-MM-YYYY HH:mm", DATE_FORMAT = "DD-MM-YYYY", TIME_FORMAT = "HH:mm", DISPLAY_DATE_TIME_FORMAT = "ddd DD MMM, HH:mm";
    var PopularStationFromSitecore = entryDataContext.PopularStationsForHomeQtt;


   
    var getPopularStationForPICO = function (allstations) {
        var PopularStationList = [];
        if (PopularStationFromSitecore != null && PopularStationFromSitecore.length != 0) {
            for (var i = 0; i < PopularStationFromSitecore.length; i++) {
                $.each(allstations, function (index, station) {
                    if (PopularStationFromSitecore[i].Name + ' (' + PopularStationFromSitecore[i].CRS + ')' == station.Name) {
                        PopularStationList.push({ "Name": station.Name, "CRS": station.CrsCode });
                    }
                });
            }
        }
        return PopularStationList;
    }
   
    var getFavouriteStationForPICO = function (allstations) {
        
        var FavouriteStationPICO = [];
        var myPreferencesResponse = localStorage.getItem('myPreferencesResponse');
        if (myPreferencesResponse != undefined && myPreferencesResponse != null && myPreferencesResponse.length > 0) {
            var myPrefernecesJSON = JSON.parse(myPreferencesResponse);
            FavouriteStationPICO = myPrefernecesJSON.FavouriteStationsList;
        }
        var FavouriteStation = [];
        if (FavouriteStationPICO != null && FavouriteStationPICO.length != 0) {
            for (var i = 0; i < FavouriteStationPICO.length; i++) {
                $.each(allstations, function (index, station) {
                    if (FavouriteStationPICO[i] == station.Name) {
                        FavouriteStation.push({ "Name": station.Name, "CRS": station.CrsCode })
                    }
                });
            }
        }
        return FavouriteStation;
    }
    var disjointPopularAndFavouriteStation = function (PopularStation, FavouriteStation) {

        if (FavouriteStation.length == 0) {
            return PopularStation;
        }
        else {
            if (PopularStation.length != 0 && FavouriteStation.length != 0) {
                for (var i = PopularStation.length - 1; i >= 0; i--) {
                    for (var j = 0; j < FavouriteStation.length; j++) {
                        if (PopularStation[i] && (PopularStation[i].CRS === FavouriteStation[j].CRS)) {
                            PopularStation.splice(i, 1);
                        }
                    }
                }
            }
            return PopularStation;
        }
       
    }
    var sampleData = {
        "arrivalStation": "Salford Central (SFD)", "departureStation": "Manchester Piccadilly (MAN)",
        "numberOfAdults": 2, "numberOfChildren": 0, "railcards": ["NGC", "YNG"], "departureTime": null,
        "returnTime": null, "departureDate": "19-05-2020 10:00", "returnDate": "20-05-2020 10:00",
        "departureOption": "D", "returnOption": "D", "numberOfRailcard": 2
    };


    var getDateOnly = function (date, format) {
        if (format == null) {
            return moment([date.getFullYear(), date.getMonth(), date.getDate()]).format(DATE_FORMAT);
        }
        else {
            return moment([date.getFullYear(), date.getMonth(), date.getDate()]).format(format);
        }
    }

    var getDateTime = function (date, format) {
        if (format == null) {
            return moment([date.getFullYear(), date.getMonth(), date.getDate()]).format(DATETIME_FORMAT);
        }
        else {
            return moment([date.getFullYear(), date.getMonth(), date.getDate()]).format(format);
        }
    }

    var getTime = function (date, format) {
        if (format == null) {
            return moment([date.getFullYear(), date.getMonth(), date.getDate()]).format(TIME_FORMAT);
        }
        else {
            return moment([date.getFullYear(), date.getMonth(), date.getDate()]).format(format);
        }
    }

    var getCustomizedDateTime = function (date, format) {
        if (format == null) {
            throw "format must be provided";
        }
        else {
            return moment([date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(),date.getMinutes()]).format(format);
        }
    }

    var addDaysInDate = function (date, numberOfDays, format) {
        if (format == null)
            return moment([date.getFullYear(), date.getMonth(), date.getDate()]).add(numberOfDays, 'days').format(DATE_FORMAT);
        else
            return moment([date.getFullYear(), date.getMonth(), date.getDate()]).add(numberOfDays, 'days').format(format);
    }



    var handOffDekstop = function (data, url, promocode) {
        //data = sampleData;
        var hitURl = url;
        
        var arrivalStation = "", departureStation = "", railCardsLength = data.railcards.length;
        arrivalStation = data.arrivalStation;
        departureStation = data.departureStation;
        
        
        url += '?oriCode=' + data.departureStationCRSCode + '&oriName=' + departureStation + '&destCode=' + data.arrivalStationCRSCode + '&destName=' + arrivalStation + '&oadInd=' + getArrivalDepartureIndicator(data.departureOption) + '&override_handoff=MATRIX';
        var dateFormatted = getDateFormat(data.departureDate);
        url += '&outHourField=' + dateFormatted[1] + '&outMinuteField=' + dateFormatted[2] + '&outDate=' + dateFormatted[0];
        if (promocode !== "") {
            url += '&prmCode=' + promocode;
        }


        if (data.returnDate != null && data.returnDate != "") {
            var returnDateFormatted = getDateFormat(data.returnDate);
            url += '&jt=Return&noa=' + data.numberOfAdults + '&noc=' + data.numberOfChildren + '&inHourField=' + returnDateFormatted[1] + '&inMinuteField=' + returnDateFormatted[2]
                + '&inDate=' + returnDateFormatted[0] + '&oadIndReturn=' + getArrivalDepartureIndicator(data.returnOption);

        }
       
        else {
            url += '&jt=' + data.journeyType + '&noa=' + data.numberOfAdults + '&noc=' + data.numberOfChildren;
        }

        
        if (data.specialRailcard.length > 0) {
            for (var i = 0; i < data.specialRailcard.length; i++)
            {
                url += '&rcNum' + (i + 1) + '=' + data.specialRailcard[i].Quantity + '&rcCode' + (i + 1) + '=' + data.specialRailcard[i].railcardcode + '&rcNoa' + (i + 1) + '=' + data.specialRailcard[i].Adults;
                url += '&rcNoc' + (i + 1) + '=' + data.specialRailcard[i].Childrens;
                 
            }
            var emptyobjArry = '&rJson=[';
            for (var i = 0; i < data.specialRailcard.length; i++) {
                if (i != 0) {
                    emptyobjArry += ',';
                }
                emptyobjArry += "{}";

            }
            emptyobjArry += ']';
            url += emptyobjArry;
            url += '&rCount=' + data.specialRailcard.length;
        }
        localStorage.setItem("searchQueryString", url);
        localStorage.setItem("isRedirectFromHomePage", 'true');
        console.log(url);
        //alert();
        window.location.href = hitURl;

    }










    var handOffMobile = function (data, url) {
        //data = sampleData;
        var hitURl = url;

        var arrivalStation = "", departureStation = "", railCardsLength = data.railcards.length;
        arrivalStation = data.arrivalStation;
        departureStation = data.departureStation;


        url += '?oriCode=' + data.departureStationCRSCode + '&oriName=' + departureStation + '&destCode=' + data.arrivalStationCRSCode + '&destName=' + arrivalStation + '&oadInd=' + getArrivalDepartureIndicator(data.departureOption) + '&override_handoff=MATRIX';
        var dateFormatted = getDateFormat(data.departureDate);
        url += '&outHourField=' + dateFormatted[1] + '&outMinuteField=' + dateFormatted[2] + '&outDate=' + dateFormatted[0];


        if (data.returnDate != null && data.returnDate != "") {
            var returnDateFormatted = getDateFormat(data.returnDate);
            url += '&jt=Return&noa=' + data.numberOfAdults + '&noc=' + data.numberOfChildren + '&inHourField=' + returnDateFormatted[1] + '&inMinuteField=' + returnDateFormatted[2]
                + '&inDate=' + returnDateFormatted[0] + '&oadIndReturn=' + getArrivalDepartureIndicator(data.returnOption);

        }

        else {
            url += '&jt=' + data.journeyType + '&noa=' + data.numberOfAdults + '&noc=' + data.numberOfChildren;
        }


        if (data.specialRailcard.length > 0) {
            for (var i = 0; i < data.specialRailcard.length; i++) {
                url += '&rcNum' + (i + 1) + '=' + data.specialRailcard[i].Quantity + '&rcCode' + (i + 1) + '=' + data.specialRailcard[i].railcardcode + '&rcNoa' + (i + 1) + '=' + data.specialRailcard[i].Adults;
                url += '&rcNoc' + (i + 1) + '=' + data.specialRailcard[i].Childrens;

            }
            var emptyobjArry = '&rJson=[';
            for (var i = 0; i < data.specialRailcard.length; i++) {
                if (i != 0) {
                    emptyobjArry += ',';
                }
                emptyobjArry += "{}";

            }
            emptyobjArry += ']';
            url += emptyobjArry;
            url += '&rCount=' + data.specialRailcard.length;
        }
        localStorage.setItem("searchQueryString", url);
        localStorage.setItem("isRedirectFromHomePage", 'true');
        console.log(url);
        window.location.href = hitURl;

    }


    function getDateFormat(date) {
        var DateArr = [];
        DateArr.push(date.split("-").join("/").substring(0, date.indexOf(' ')));
        var minDay = date.substring(date.indexOf(' ') + 1, date.length).split(':')
        minDay.forEach(function (x) { return DateArr.push(x) });
        return DateArr;
    }


    function getArrivalDepartureIndicator(option) {

        return option === 'D' ? 'Leave After' : 'Arrive Before';
    }

    function getRailCardsSimplified(railcards) {
        var railCardsArray = [];
        for (var i = 0; i < railcards.length; i++) {
            var added = true;
            for (var j = 0; j < railCardsArray.length; j++) {

                if (railCardsArray[j].card === railcards[i]) {
                    railCardsArray[j].count = railCardsArray[j].count + 1;
                    added = false;
                    break;
                }
            }
            if (added) {
                railCardsArray.push({ card: railcards[i], count: 1 });
            }

        }
        return railCardsArray;

    }

    return {
        handOffMobile: handOffMobile,
        handOffDekstop: handOffDekstop,
        getDateOnly: getDateOnly,
        getDateTime: getDateTime,
        getTime: getTime,
        getCustomizedDateTime: getCustomizedDateTime,
        addDaysInDate: addDaysInDate,
        getFavouriteStationForPICO: getFavouriteStationForPICO,
        getPopularStationForPICO: getPopularStationForPICO,
        disjointPopularAndFavouriteStation: disjointPopularAndFavouriteStation
    };

});
define('customJS/QttModuleForPICO', ['jquery', 'jqueryui', 'customJS/QttFormViewModelForPICO', 'context', 'moment', 'dataService', 'customJS/QttUtilityForPICO', 'ticketingService', 'customJS/Qttv2'], function ($, jqueryUi, QttFormVM, context, moment, dataService, Utility, ticketingService, qttv2) {

    var disableDates = entryDataContext.DateSetting;
    var Outdaterange = entryDataContext.DateSettingFordisabledate;
    var allstations = [];
    var promotioncodeApplied = "";
    var selectedDepartureDate = null, selectedArrivalDate = null;
    var DATETIME_FORMAT = "DD-MM-YYYY HH:mm", DATE_FORMAT = "DD-MM-YYYY", TIME_FORMAT = "HH:mm", DISPLAY_DATE_TIME_FORMAT = "ddd DD MMM, HH:mm";
    var qttForm = new QttFormVM.QttForm();
    var railcardForPICO = [];
    var ut = Utility;
    var PopularStations = [];//= entryDataContext.PopularStationsForHomeQtt;
    var index;
    var maxDepartDateWeb = Outdaterange.QttDate;
    var maxArriveDateWeb = Outdaterange.QttDate;
    var handoff = $('.desktop-qtt').attr('handoff');
    var submitted = false;
    var newDates = [];
    var FavouriteStation = [];
    var normalRailcardFlag = true;
    var maxAdults = 0, minAdults = 0, maxChildren = 0, minChildren = 0;
    var totalAdultRailcard = 0, totalChildrenRailcard = 0;

    function GetFormattedDate(date) {
        return moment.utc(date).format(DATE_FORMAT);
    }
    for (var i = 0; i < disableDates.length; i++) {
        var date = GetFormattedDate(disableDates[i].Date);
        newDates.push({ "Date": date, "Disabledatemessage": disableDates[i].Disabledatehoverstatemessage, "hoverstate": disableDates[i].Addhoverstate, "Unavailabledatemessage": disableDates[i].Unavailabledatemessage, "ShowUnavailabledate": disableDates[i].ShowUnavailabledatemessage });
    }
    var init = function (stations, promotionCode) {
        allstations = stations;
        checkStationAPIWorking(allstations);
        bindEvents();
        promotioncodeApplied = promotionCode;
        fillPopularStationList();
        defaultDepartureDate();
        getStationbyCookie();
        setPopularAndFavouriteStation();
        getPICORailcards();

    };

    var checkStationAPIWorking = function (data) {
        if (data.length != 0) {
            $("#stationAPICheck").hide();
        }
        else {
            $("#stationAPICheck").show();
        }
    }
    var getPICORailcards = function () {

        dataService.RailcardForPICO().done(function (data) {
            railcardForPICO = data.Railcard;
            bindRailcards();
        });

    }

    var setPopularStation = function () {
        if (PopularStations.length != 0) {
            fillPopularStationList();
        }
    }
    var setFavouriteStation = function () {

        if (FavouriteStation.length != 0) {
            $('#departFavouriteStationHeading').show();
            $('#arriveFavouriteStationHeading').show();
            FillFavouriteStationList();
        }
        else {
            $('#departFavouriteStationHeading').hide();
            $('#arriveFavouriteStationHeading').hide();
        }

    }
    var setPopularAndFavouriteStation = function () {
        // getFavouriteStationList();
        FavouriteStation = ut.getFavouriteStationForPICO(allstations);
        //getPopularStations();
        PopularStations = ut.getPopularStationForPICO(allstations);
        PopularStations = ut.disjointPopularAndFavouriteStation(PopularStations, FavouriteStation);
        setPopularStation();
        setFavouriteStation();
    }
    var getStationbyCookie = function () {

        var x = document.cookie.split(";");
        for (i = 0; i < x.length; i++) {
            var cookiepair = x[i].split("=");
            if ('Beta_LeavingFrom' == cookiepair[0].trim()) {
                qttForm.departureStation = decodeURIComponent(cookiepair[1]);
                $('#departingFromPopup').val(qttForm.departureStation);
            }
            if ('Beta_LeavingFromCode' == cookiepair[0].trim()) {
                qttForm.departureStationCRSCode = decodeURIComponent(cookiepair[1]);
                //  $('#departingFromPopup').val(qttForm.departureStation);
            }
            if ('Beta_GoingTo' == cookiepair[0].trim()) {
                qttForm.arrivalStation = decodeURIComponent(cookiepair[1]);
                $('#arrivingToPopup').val(qttForm.arrivalStation);
            }
            if ('Beta_GoingToCode' == cookiepair[0].trim()) {
                qttForm.arrivalStationCRSCode = decodeURIComponent(cookiepair[1]);
                //$('#arrivingToPopup').val(qttForm.arrivalStation);
            }
        }

    }
    var defaultDepartureDate = function () {
        var date = moment().format(DATE_FORMAT);

        for (var i = 0; i < newDates.length; i++) {
            if (newDates[i] == date) {
                return;
            }
        }

        var departureType = 'D';
        var selectedTimeOneHour = moment().add(0, 'days').add(1, 'hours').minute(0);
        var DateTimeToDisplay = selectedTimeOneHour.format(DISPLAY_DATE_TIME_FORMAT);
        var setDefaultDepat = setDateTime(date, selectedTimeOneHour);
        selectedDepartureDate = setDefaultDepat;
        qttForm.departureDate = setDefaultDepat;
        qttForm.departureOption = departureType;
        $('#departureJourneyDateTime').val(DateTimeToDisplay);
        $('.tooltip-default-message').show();

    }
    var bindRailcards = function () {
        $('#SelectedRailcard').empty();

        $.each(railcardForPICO, function (index, railcard) {
            var railcardOption = $('<option></option>');
            railcardOption.val(railcard.railcardcode);
            railcardOption.html(railcard.railcarddescription);
            railcardOption.attr('position', index);
            railcardOption.attr('minadults', railcard.minadults);
            railcardOption.attr('maxadults', railcard.maxadults);
            railcardOption.attr('minchildren', railcard.minchildren);
            railcardOption.attr('maxchildren', railcard.maxchildren);
            $('#SelectedRailcard').append(railcardOption);
        });
        $("#SelectedRailcard").trigger("change");

        //dataService.getRailcards().then(function (railcards) {
        //    $.each(railcards.data, function (index, railcard) {
        //        var railcardOption = $('<option></option>');
        //        railcardOption.val(railcard.railcardcode);
        //        railcardOption.html(railcard.railcarddescription);
        //        railcardOption.attr('position', index);
        //        $('#SelectedRailcard').append(railcardOption);
        //    });

        //});


    }

    var getStationColumns = function (journeyType, stationName, stationCode) {
        var disabled = false;
        if (journeyType == 'depart') {
            disabled = qttForm.arrivalStation != null && stationName == qttForm.arrivalStation;
        }
        else {
            disabled = qttForm.departureStation != null && stationName == qttForm.departureStation;
        }
        var valueAttribute = journeyType == 'depart' ? 'departcrsdatabind' : 'arrivecrsdatabind';
        var columnElement = $('<div></div>').addClass('column');
        var stationElement = $('<div></div>').addClass('return-stations ' + journeyType).attr(valueAttribute, stationCode);
        if (disabled)
            stationElement.addClass('station-disabled').removeAttr(valueAttribute);
        var stationNameElement = $('<div></div>').addClass('return-station-name').html(stationName);
        var stationCodeElement = $('<div></div>').addClass('return-station-shortcode').html();//html(stationCode);
        stationElement.append(stationNameElement).append(stationCodeElement);
        columnElement.append(stationElement);
        return columnElement;
    }

    var bindPopularStations = function (journeyType, stationName, stationCode) {
        if (stationCode != undefined && stationCode != "") {
            var columnElement = getStationColumns(journeyType, stationName, stationCode);
            if (journeyType == "depart") {
                $("#Departing-Popular-station").append(columnElement);
            }
            else {
                $("#Arriving-Popular-station").append(columnElement);
            }
        }


    }
    var bindFavouriteStations = function (journeyType, stationName, stationCode) {
        if (stationCode != undefined && stationCode != "") {
            var columnElement = getStationColumns(journeyType, stationName, stationCode);
            if (journeyType == "depart") {
                $("#Departing-Favourite-station").append(columnElement);
            }
            else {
                $("#Arriving-Favourite-station").append(columnElement);
            }
        }


    }

    var clearMoreStations = function (journeyType) {
        if (journeyType == "arrive") {
            $("#Arriving-Popular-station").empty();
        }
        else {
            $("#Departing-Popular-station").empty();
        }
    }

    var clearPopularStations = function (journeyType) {

        if (journeyType == "arrive") {
            $('#filtersearchArrival').empty();
        }
        else {
            $('#filtersearchDeparture').empty();
        }
    }
    var clearFavouriteStations = function (journeyType) {

        if (journeyType == "arrive") {
            $("#Arriving-Favourite-station").empty();
        }
        else {
            $('#Departing-Favourite-station').empty();

        }
    }

    var bindAllStations = function (journeyType, stationName, stationCode) {
        var columnElement = getStationColumns(journeyType, stationName, stationCode);
        if (journeyType == "depart") {
            $('#filtersearchDeparture').append(columnElement);
        }
        else {
            $('#filtersearchArrival').append(columnElement);
        }
    }

    var bindStationKeyUpEvents = function (journeyType, searchField) {

        var popularHeadingElement, moreHeadingElement, FavouriteHeadingElement;
        if (journeyType == "arrive") {
            FavouriteHeadingElement = $('#arriveFavouriteStationHeading');
            popularHeadingElement = $('#arrivePopularStationHeading');
            moreHeadingElement = $('#arriveMoreStationHeading');
        }
        else {
            FavouriteHeadingElement = $('#departFavouriteStationHeading');
            popularHeadingElement = $('#departPopularStationHeading');
            moreHeadingElement = $('#departMoreStationHeading');
        }
        clearFavouriteStations(journeyType);
        clearPopularStations(journeyType);
        clearMoreStations(journeyType);
        if (searchField.length > 2) {
            //Load Favourite stations which are filtered
            var filteredFavouriteStations = filterStations(FavouriteStation, searchField);

            $.each(filteredFavouriteStations, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });

            //Load popular stations which are filtered
            var filteredPopularStations = filterStations(PopularStations, searchField);
            $.each(filteredPopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            //Load more stations
            var filteredStations = filterStations(allstations, searchField);
            $.each(filteredStations, function (index, station) {
                bindAllStations(journeyType, station.Name, station.CrsCode);
            });

            manageStationHeading(FavouriteHeadingElement, filteredFavouriteStations);
            manageStationHeading(popularHeadingElement, filteredPopularStations);
            manageStationHeading(moreHeadingElement, filteredStations);
        }
        else if (searchField.length == 0) {
            //filter favourite stations
            $.each(FavouriteStation, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            //filter popular stations
            $.each(PopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            manageStationHeading(FavouriteHeadingElement, FavouriteStation);
            manageStationHeading(popularHeadingElement, PopularStations);
            manageStationHeading(moreHeadingElement, null);
        }
        else {
            //Load Favourite stations which are filtered
            var filteredFavouriteStations = filterStations(FavouriteStation, searchField);
            $.each(filteredFavouriteStations, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            //Load popular stations which are filtered
            var filteredPopularStations = filterStations(PopularStations, searchField);
            $.each(filteredPopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            //clearMoreStations();
            manageStationHeading(FavouriteHeadingElement, filteredFavouriteStations);
            manageStationHeading(popularHeadingElement, filteredPopularStations);
            manageStationHeading(moreHeadingElement, null);
        }
    }

    var manageStationHeading = function (element, stations) {
        if (stations != null && stations.length > 0)
            element.show();
        else
            element.hide();
    }

    var filterStations = function (stations, searchText) {
        var filteredStations = [];
        var matchedCRSstationIndex = 0;
        var matchedStationwithCRS = false;
        for (var i = 0; i < stations.length; i++) {
            if (stations[i].Name.substring(stations[i].Name.lastIndexOf('(')).replace('(', '').replace(')', '') == searchText.toUpperCase()) {
                matchedCRSstationIndex = i;
                matchedStationwithCRS = true;
            }
            else if (stations[i].Name.toLowerCase().indexOf(searchText.toLowerCase()) > -1) {
                filteredStations.push(stations[i]);
            }
            else {
                continue;
            }
        }
        if (matchedStationwithCRS) {
            filteredStations.unshift(stations[matchedCRSstationIndex]);
        }

        return filteredStations;
    }

    var datePrefixSelection = function (element) {
        var currentTab = $(element).closest('.ui-widget-content');
        $(currentTab).find('.departby-radio').removeClass('active');
        setTimeout(function () {
            $(element).addClass('active');
        }, 100)

    }

    var FillFavouriteStationList = function () {
        //Favourite station list 
        clearPopularStations('depart');
        clearMoreStations('arrive');
        clearFavouriteStations('depart');
        manageStationHeading($('#departMoreStationHeading'), null);
        manageStationHeading($('#departMoreStationHeading'), null);
        manageStationHeading($('#arriveMoreStationHeading'), null);
        manageStationHeading($('#arriveMoreStationHeading'), null);
        manageStationHeading($('#departFavouriteStationHeading'), null);
        manageStationHeading($('#arriveFavouriteStationHeading'), null);
        for (var i = 0; i < FavouriteStation.length; i++) {
            bindFavouriteStations('depart', FavouriteStation[i].Name, FavouriteStation[i].CRS);
            bindFavouriteStations('arrive', FavouriteStation[i].Name, FavouriteStation[i].CRS);

        }

    };

    var fillPopularStationList = function () {
        //Popular station list 
        clearPopularStations('depart');
        clearMoreStations('arrive');

        manageStationHeading($('#departMoreStationHeading'), null);
        manageStationHeading($('#departMoreStationHeading'), null);
        manageStationHeading($('#arriveMoreStationHeading'), null);
        manageStationHeading($('#arriveMoreStationHeading'), null);
        manageStationHeading($('#departFavouriteStationHeading'), null);
        manageStationHeading($('#arriveFavouriteStationHeading'), null);

        for (var i = 0; i < PopularStations.length; i++) {
            bindPopularStations('depart', PopularStations[i].Name, PopularStations[i].CRS);
            bindPopularStations('arrive', PopularStations[i].Name, PopularStations[i].CRS);

        }

    };



    var padLeft = function (nr, n, str) {
        return Array(n - String(nr).length + 1).join(str || '0') + nr;
    }

    var buildTimeData = function () {
        var i = 0, j = 0, times = [];
        while (i < 24) {
            if (j == 0) {
                var time = padLeft(i, 2) + ":" + padLeft(j, 2);
                times.push(time);
                j += 30;
                continue;
            }
            else {
                var time = padLeft(i, 2) + ":" + padLeft(j, 2);
                times.push(time);
                j = 0;
                i += 1;
                continue;
            }
        }
        return times;
    }

    var departureDateSelected = function (date) {
        qttForm.departureDate = date;
    }

    var arrivalDateSelected = function (date) {
        qttForm.returnDate = date;
    }

    var getDateOnly = function (date) {
        date = new Date(date);
        return ut.getDateOnly(date);
    }


    var setDateTime = function (date, time) {
        date = moment.utc(date, DATE_FORMAT),
            time = moment(time, 'HH:mm');

        date.set({
            hour: time.get('hour'),
            minute: time.get('minute'),
            second: time.get('second')
        });

        return date.format(DATETIME_FORMAT);
    }

    var refreshDatePickers = function () {
        $('#anytime-date-calendar1').datepicker('refresh');
        $('#specific-date-calendar').datepicker('refresh');
    }


    var checkRailcard = function () {
        if (qttForm.getTotalPassenger() > totalAdultRailcard + totalChildrenRailcard) {
            $('#addRailcardText').show();
        }
        else
            $('#addRailcardText').hide();
        $('.dropdown-menu').hide();

    }


    var AddSpecialRailcard = function (Name, Adult, children, Code, Amount) {
        qttForm.specialRailcard.push({ "railcardcode": Code, "railcardName": Name, "Adults": Adult, "Childrens": children, "Quantity": Amount });
        //  console.log(qttForm.specialRailcard);

        var countA = 0, countC = 0;

        $.each(qttForm.specialRailcard, function (index, card) {
            countA += parseInt(card.Adults);
            countC += parseInt(card.Childrens);
        });
        totalAdultRailcard = countA;
        totalChildrenRailcard = countC;
        // console.log("total adults", countA);
        //console.log("total children", countC);
        checkSpecialRailcardValidation();

    }
    var removeRailcard = function (railcardcode, quantity) {

        $.each(qttForm.specialRailcard, function (index, railcard) {

            if (railcard.railcardcode == railcardcode && railcard.Quantity == quantity) {
                totalAdultRailcard -= railcard.Adults;
                totalChildrenRailcard -= railcard.Childrens;
                qttForm.specialRailcard.splice(index, 1);
                // console.log("after deletion", qttForm.specialRailcard);
                //console.log("adults", totalAdultRailcard, "children", totalChildrenRailcard);
                return false;
            }
        });
    }



    var createRailcardListItem = function (name, code, quantity) {
        var railcardMainElement = $('<div></div>');
        var railcardTitleDevElement = $('<div></div>');
        var railcardRemoveDivElement = $('<div></div>');
        var railcardIconElement = $('<i></i>');
        var railcardTitleSpanElement = $('<span></span>');
        var removeAnchorElement = $('<a></a>');

        railcardTitleSpanElement.html(" " + name);
        railcardIconElement.addClass('fa fa-window-maximize').attr('aria-hidden', 'true');
        railcardTitleDevElement.append(railcardIconElement).append(railcardTitleSpanElement).addClass('railcard-visuals');
        removeAnchorElement.attr('ref-code', code).html('Remove').addClass('remove-railcard-btn');
        removeAnchorElement.attr('Amount', quantity);
        railcardRemoveDivElement.append(removeAnchorElement).addClass('remove-railcard');
        railcardMainElement.append(railcardTitleDevElement).append(railcardRemoveDivElement).addClass('remove-railcard-section').attr('railcard-code', code);
        return railcardMainElement;
    }

    var findWithAttr = function (array, attr, value) {
        for (var i = 0; i < array.length; i += 1) {
            if (array[i][attr] === value) {
                return i;
            }
        }
        return -1;
    }

    //var groupRailcards = function (railcards) {
    //    var groupedRailcards = [];
    //    for (var i = 0; i < railcards.length; i++) {
    //        var index = findWithAttr(groupedRailcards, 'name', railcards[i]);
    //        if (index > -1) {
    //            groupedRailcards[index].occurence += 1;
    //        }
    //        else {
    //            var groupRailcard = { name: railcards[i], occurence: 1 };
    //            groupedRailcards.push(groupRailcard);
    //        }
    //    }
    //    return groupedRailcards;
    //}

    var populateUngroupedRailcardPanel = function (groupedRailcards) {
        $.each(groupedRailcards, function (index, railcard) {
            //  var displayName = $('#SelectedRailcard').children("option[value=" + railcard.railcardName + "]").html();
            var displayName = railcard.railcardName;

            if (railcard.Quantity > 1) {
                displayName = "(" + railcard.Quantity + ") " + displayName;
            }
            $(".railcardDiv").prepend(createRailcardListItem(displayName, railcard.railcardcode, railcard.Quantity));
        })
    }


    var populateGroupedRailcardPanel = function (groupedRailcards) {
        var TotalQuantity = 0;
        $.each(groupedRailcards, function (index, railcard) {
            TotalQuantity += railcard.Quantity;
        });
        var columnElement = $('<div></div>').addClass('column');
        var viewRailcardSectionElement = $('<div></div>').addClass('view-railcard-section');
        var railcardVisualElement = $('<div></div>').addClass('railcard-visuals');
        var faIconClass = $('<i></i>').addClass('fa fa-window-maximize');
        var railcardTitleElement = $('<span></span>').html(" " + TotalQuantity + " Railcards");
        var viewRailcardElement = $('<div><div>').addClass('view-railcard');
        var viewLinkElement = $('<a></a>').addClass('view').html('View');
        var viewDropDownElement = $('<div></div>').addClass('view-dropdown');
        railcardVisualElement.append(faIconClass).append(railcardTitleElement);
        viewRailcardSectionElement.append(railcardVisualElement);
        viewRailcardElement.append(viewLinkElement);
        $.each(groupedRailcards, function (index, railcard) {
            // var displayName = $('#SelectedRailcard').children("option[value=" + railcard.railcardName + "]").html();
            var displayName = railcard.railcardName;
            if (railcard.Quantity > 1) {
                displayName = "(" + railcard.Quantity + ") " + displayName;
            }
            viewDropDownElement.prepend(createRailcardListItem(displayName, railcard.railcardcode, railcard.Quantity));
        });
        viewRailcardSectionElement.append(viewRailcardElement);
        viewRailcardSectionElement.append(viewDropDownElement);
        columnElement.append(viewRailcardSectionElement);
        $('.railcardDiv').prepend(columnElement);
        $(".view-dropdown").hide();
    }

    var bindSelectedRailcards = function () {
        $(".railcardDiv").find('.remove-railcard-section').each(function (i, obj) {
            $(obj).remove();
        });
        $(".railcardDiv").find('.view-railcard-section').each(function (i, obj) {
            $(obj).remove();
        });
        var TotalQuantity = 0;
        $.each(qttForm.specialRailcard, function (index, railcard) {
            TotalQuantity += railcard.Quantity;
        });
        //var groupedRailcards = groupRailcards(qttForm.specialRailcard.reverse());
        var groupedRailcards = qttForm.specialRailcard.reverse();
        if (TotalQuantity > 4) {
            populateGroupedRailcardPanel(groupedRailcards);
        }
        else {
            populateUngroupedRailcardPanel(groupedRailcards);
        }
    }

    //var updateRailcardAddOptions = function () {
    //    if (qttForm.getTotalPassenger() >= qttForm.numberOfRailcard) {
    //        //Add more railcard button should be disabled
    //        $('#AddRailcardBtn').show();
    //    }
    //    else {
    //        //Add more railcard button should be enabled
    //        $('#AddRailcardBtn').hide();
    //    }
    //}

    var resetRailcardPopover = function () {
        $('#SelectedRailcard').val($('#SelectedRailcard option:first').val());
        var firstelem = $('#SelectedRailcard option:first');
        normalRailcardFlag = true;
        minAdults = firstelem.attr('minadults');
        maxAdults = firstelem.attr('maxadults');
        minChildren = firstelem.attr('minchildren');
        maxChildren = firstelem.attr('maxchildren');
        $('#amountOfRailcard').val(minAdults);
        $('#amountOfRailcard').html(minAdults);
        $('#AdultandChildren').hide();
        $('#RailcardLimitError').hide();
        //$('#numberofRailcard').val(1);
        //qttForm.numberOfRailcard = qttForm.railcards.length;
        //updateRailcardAddOptions();
        if (totalAdultRailcard < qttForm.numberOfAdults) {
            $('#AddSubRailcardBtn').prop('disabled', false);
            $('#error-railcard-quantity').hide();
        }
        else {
            $('#AddSubRailcardBtn').prop('disabled', true);
            $('#error-railcard-quantity').show();
        }

        $(".view-dropdown").hide();
    }

    var ShowHideRailcardAddText = function () {
        resetRailcardPopover();
        $('.railcardDiv .dropdown-menu').hide();
        if (qttForm.getTotalPassenger() > totalAdultRailcard + totalChildrenRailcard) {
            //Add more railcard button should be disabled
            $('#addRailcardText').show();
        }
        else {
            //Add more railcard button should be enabled
            $('#addRailcardText').hide();
        }
    }

    var updateGroupBooking = function () {
        if (qttForm.getTotalPassenger() >= 10) {
            $('#groupBooking').show();
            $('#buyNowBtn').prop('disabled', true);
            $('#LessThanZeroError').hide();
            $('#GroupTravel3To9Message').hide();
        }
        else {
            $('#groupBooking').hide();

        }
    }
    var checkLessThanZeroError = function () {
        if (qttForm.getTotalPassenger() <= 0) {
            $('#LessThanZeroError').show();
            $('#buyNowBtn').prop('disabled', true);
            $('#groupBooking').hide();
            $('#GroupTravel3To9Message').hide();
        }
        else {
            $('#LessThanZeroError').hide();
            $('#buyNowBtn').removeAttr("disabled");
        }
    }
    var checkGroupTravel3To9Passenger = function () {
        if (qttForm.getTotalPassenger() >= 3 && qttForm.getTotalPassenger() <= 9) {
            $('#GroupTravel3To9Message').show();
            $('#buyNowBtn').removeAttr("disabled");
            $('#groupBooking').hide();
            $('#LessThanZeroError').hide();
        }
        else {
            $('#GroupTravel3To9Message').hide();
        }
    }

    var validateDates = function (onSubmit) {
        $('.error-message.journey-dates').hide();
        var error = qttForm.validateDates();
        if (!error.valid) {
            //Show date errors
            for (var i = 0; i < error.errors.length; i++) {
                if (error.errors[i].onSubmit == onSubmit) {
                    $('#' + error.errors[i].key).first().html(error.errors[i].message);
                    $('.error-message.journey-dates').show();
                }
            }
        }
        else {

        }
    }

    var updateRailcardValidation = function (onSubmit) {
        $('.error-message.railcard').hide();
        var error = qttForm.validateRailcards();
        if (!error.valid) {
            //Show date errors
            for (var i = 0; i < error.errors.length; i++) {
                if (error.errors[i].onSubmit == onSubmit) {
                    $('#' + error.errors[i].key).first().html(error.errors[i].message);
                    $('.error-message.railcard').show();
                }
            }
        }
        else {
        }
    }
    var setDefaultRailcard = function (minAdults, minChildren) {
        if (normalRailcardFlag == true) {
            //set the amount limit for normal railcards
        }
        // qttForm.numberofAdultRailcard = minAdults;
        $('#numberofAdultRailcard').val(minAdults);
        //qttForm.numberofChildrenRailcard = minChildren;
        $('#numberofChildrenRailcard').val(minChildren);
        $('#RailcardCountError').hide();

    }
    var checkSpecialRailcardValidation = function () {
        if (totalAdultRailcard > qttForm.numberOfAdults || totalChildrenRailcard > qttForm.numberOfChildren) {
            //show error
            $('.error-message.railcard').show();
        }
        else {
            //hide error
            $('.error-message.railcard').hide();
        }
    }
    var AddDisabledatediv = function (el) {
        var date = el.parentElement.firstElementChild.textContent;
        var month = el.parentElement.parentElement.parentElement.parentElement.parentElement.firstElementChild.lastElementChild.firstElementChild.textContent;
        var year = el.parentElement.parentElement.parentElement.parentElement.parentElement.firstElementChild.lastElementChild.lastElementChild.textContent;
        var Disabledate = new Date(date + month + year);
        $.each(newDates, function (index, value) {
            var splitDates = value.Date.split("-");
            var dates = splitDates[1] + "-" + splitDates[0] + "-" + splitDates[2];
            var dateN = new Date(dates);
            var unavailabledate = value.Unavailabledatemessage;
            if (Disabledate.getTime() === dateN.getTime()) {
                if (value.ShowUnavailabledate == true && unavailabledate != "") {
                    $(".tooltip-disabldate-message").append(unavailabledate);
                    $(".tooltip-disabldate-message").show();
                }
                else {
                    $(".tooltip-disabldate-message").hide();
                }
            }
        });
        var currentdate = moment().subtract(1, "days", DATE_FORMAT);
        var enddate = moment().add(maxDepartDateWeb, "day", DATE_FORMAT);
        if (Disabledate < currentdate) {
            if (Outdaterange.ShowPastdatemessage && Outdaterange.Pastdatemessage != "") {
                $(".tooltip-disabldate-message").append(Outdaterange.Pastdatemessage);
                $(".tooltip-disabldate-message").show();
            }
            else {
                $(".tooltip-disabldate-message").hide();
            }
        }
        if (Disabledate > enddate) {
            if (Outdaterange.ShowFuturedatemessage && Outdaterange.Futuredatemessage != "") {
                $(".tooltip-disabldate-message").append(Outdaterange.Futuredatemessage);
                $(".tooltip-disabldate-message").show();
            }
            else {
                $(".tooltip-disabldate-message").hide();
            }
        }

    }
    var AddToolTip = function () {
        $(".ui-state-disabled").each(function () {
            var element = $(this).find(".ui-state-default");
            var element2 = $(this).find(".tooltip-checker");
            if (element.length != 0 && element2.length == 0) {
                $.each(newDates, function (index, value) {
                    var splitDates = value.Date.split("-");
                    var dates = splitDates[1] + "-" + splitDates[0] + "-" + splitDates[2];
                    var dateN = new Date(dates);
                    var month = dateN.getMonth();
                    var year = dateN.getFullYear();
                    var message = value.Disabledatemessage;

                    if ($(element).parent().parent().find("[data-month='" + month + "']").length != 0 && $(element).parent().parent().find("[data-year='" + year + "']").length != 0 && element.text() == dateN.getDate().toString()) {
                        if (value.hoverstate == true && message != "") {
                            $("<div class='tooltip-checker'>" + message + "</div>").insertAfter($(element));
                        }
                    }
                });
            }
        });
    }



    var AddNextprevbtnmsg = function () {
           
        var Elementnext = $(".ui-datepicker-next").attr("data-title");
        var Elementprev = $(".ui-datepicker-prev").attr("data-title");

        //$("div.div_after").remove();
        //$("div.div_after1").remove();
       

        $(".ui-datepicker-next").after("<div class='ui-datepicker-next-title div_after nextui'>" + Elementnext + "</div>");
        $(".ui-datepicker-prev").after("<div class='ui-datepicker-prev-title div_after1 prevui'>" + Elementprev + "</div>");

        $(".div_after").hide();
        $(".div_after1").hide();
        

    }
    var bindEvents = function () {
        $(document).ready(function () {
            $('#tabs5').tabs();
            $('#tabs3').tabs();
            $('#tabs2').tabs();
            $('#tabs1').tabs();
            index = $('#tabs').attr('default-tab');
            $("#tabs").tabs({ active: index });
            $("#tabs").show();
            // $('#tabs-2').show();
            // $('#w-traintimes-tab-heading').show();

            $('#tabsMobile').tabs();
            $('#tabsMobile1').tabs();
            $('#tabsMobile2').tabs();
            $('#tabsMobile3').tabs();


            $("#tab-arrival-date").tabs();
            //$("#mob-tabs").tabs();


            $("#specific-date-calendar").datepicker({
                minDate: 0,
                maxDate: maxDepartDateWeb, firstDay: 1,
                numberOfMonths: 2,
                beforeShowDay: function (date) {
                    if (newDates) {
                        var status = true;
                        for (var i = 0; i < newDates.length; i++) {
                            if (newDates[i].Date.indexOf(ut.getDateOnly(date)) > -1) {
                                status = false;
                                return [status, '',];
                            }
                        }
                        return [status, ''];
                    }
                },
                onSelect: function (date, inst) {
                    inst.inline = false;
                    selectedDepartureDate = getDateOnly(date);
                    AddToolTip();
                    
                    $('.tooltip-default-message').hide();
                    $('.tooltip-disabldate-message').hide();
                    $('.tooltip-enabldate-message').show();
                    var _day = inst.selectedDay;
                    var _month = inst.selectedMonth;

                    var calenderBody = $('#specific-date-calendar *[data-month="'+_month+'"]').parents('tbody');
                   
                    var element = $(calenderBody).find('td').not(".ui-datepicker-other-month");
                    if (element) {
                        $('.ui-state-active').removeClass('ui-state-active');
                        $(element[_day - 1]).children().addClass('ui-state-active');
                    }

                }
            });
            $("#anytime-date-calendar1").datepicker({
                minDate: 0,
                maxDate: maxArriveDateWeb, firstDay: 1,
                numberOfMonths: 2,
                beforeShowDay: function (date) {
                    var m_selectedDepartureDate = selectedDepartureDate == null ? null : moment(selectedDepartureDate, DATETIME_FORMAT);
                    var m_selectedArrivalDate = selectedArrivalDate == null ? null : moment(selectedArrivalDate, DATETIME_FORMAT);
                    var m_date = moment(ut.getDateOnly(date), "DD-MM-YYYY");
                    var cssClass = '';
                    var selectable = true;
                    if (newDates) {
                        for (var i = 0; i < newDates.length; i++) {
                            if (newDates[i].Date.indexOf(ut.getDateOnly(date)) > -1) {
                                selectable = false;
                            }
                        }
                    }
                    if (m_selectedDepartureDate != null) {
                        selectable = m_date.toDate() >= m_selectedDepartureDate.toDate() && selectable;
                        if (m_selectedArrivalDate != null && m_date.toDate() >= m_selectedDepartureDate.toDate() && m_date.toDate() < m_selectedArrivalDate.toDate()) {
                            cssClass = 'ui-state-active';
                            return [selectable, cssClass];
                        }
                        else if (m_selectedDepartureDate.format("DDMMYYYY") == m_date.format("DDMMYYYY")) {
                            cssClass = 'ui-state-active x-ui-current-selected-date';
                            selectable = true;
                        }
                        else {
                            cssClass = m_date.format("DD/MM/YYYY") == m_selectedDepartureDate.format("DD/MM/YYYY") ? 'ui-state-active' : '';
                        }
                        return [selectable, cssClass];
                    }


                    else {
                        return [selectable, '']
                    }
                },
                onSelect: function (dateText, inst) {
                   // inst.inline = false;
                    selectedArrivalDate = getDateOnly(dateText);
                    $(this).datepicker();
                    AddToolTip()
                    $('.tooltip-default-message').hide();
                    $('.tooltip-disabldate-message').hide();
                    $('.tooltip-enabldate-message').show();
                    //var _day = inst.selectedDay;
                    //var _month = inst.selectedMonth;

                    //var calenderBody = $('#anytime-date-calendar1 *[data-month="' + _month + '"]').parents('tbody');

                    //var element = $(calenderBody).find('td').not(".ui-datepicker-other-month");
                    //if (element) {
                    //    $('.ui-state-active').removeClass('ui-state-active');
                    //    $(element[_day - 1]).children().addClass('ui-state-active');
                    //}
                }
            });

          

            $('#taintimeli').attr('tabindex', '-1');
            $('#taintimeli1').attr('tabindex', '-1');
            $('#taintimesnew123').attr('tabindex', '0');
            $('#taintimesnew122').attr('tabindex', '0');
            $('#taintimesnew12').attr('tabindex', '0');

            $('#taintimesnew123').keyup(function (event) {
                var keyCode = (event.keyCode ? event.keyCode : event.which);
                if (keyCode == 13) {
                    $('#taintimesnew122').attr('tabindex', '-1');
                    $('#taintimesnew12').attr('tabindex', '-1');
                }
                else {
                    $('#taintimesnew123').attr('tabindex', '0');
                    $('#taintimesnew122').attr('tabindex', '0');
                    $('#taintimesnew12').attr('tabindex', '0');
                }
            });
            

            $('#taintimesnew122').keyup(function (event) {
                var keyCode = (event.keyCode ? event.keyCode : event.which);
                if (keyCode == 13) {
                    $('#taintimesnew123').attr('tabindex', '-1');
                    $('#taintimesnew12').attr('tabindex', '-1');
                }
                else {
                    $('#taintimesnew123').attr('tabindex', '0');
                    $('#taintimesnew122').attr('tabindex', '0');
                    $('#taintimesnew12').attr('tabindex', '0');
                }
            });
           


            $('#taintimesnew12').keyup(function (event) {
                var keyCode = (event.keyCode ? event.keyCode : event.which);
                if (keyCode == 13) {
                    $('#taintimesnew122').attr('tabindex', '-1');
                    $('#taintimesnew123').attr('tabindex', '-1');
                }
                else {
                    $('#taintimesnew123').attr('tabindex', '0');
                    $('#taintimesnew122').attr('tabindex', '0');
                    $('#taintimesnew12').attr('tabindex', '0');
                }
            });


           

            $('#departingFromPopup').on('focus', function () {
               /* $(this).css('border', '1px dotted red');*/
                /*$(this).blur();*/
            });

            $('#close_depart_model_t').keyup(function (event) {
                var keyCode = (event.keyCode ? event.keyCode : event.which);
                if (keyCode == 13) {
                    $('#departureDatePopup').hide();
                }

            });

            $('#QttArrivalDatemodelSpan').keyup(function (event) {
                var keyCode = (event.keyCode ? event.keyCode : event.which);
                if (keyCode == 13) {
                    $('#returnJourneyPopup').hide();
                }
               

            });

            $('#departingFromPopup').keyup(function (event) {
                var keyCode = (event.keyCode ? event.keyCode : event.which);
                if (keyCode == 13) {
                    $('#departingFromPopup').trigger('click');
                }
            });

            $('#arrivingToPopup').on('focus', function () {
               /* $(this).css('border', '1px dotted red');*/
                /*$(this).blur();*/
            });

            $('#arrivingToPopup').keyup(function (event) {
                var keyCode = (event.keyCode ? event.keyCode : event.which);
                if (keyCode == 13) {
                    $('#arrivingToPopup').trigger('click');
                }
            });

            //$('#departureJourneyDateTime').on('focus', function () {
            //    /*$(this).css('border', '1px dotted red');*/
            //    /*$(this).blur();*/
            //});

            //$('#departureJourneyDateTime').keyup(function (event) {
            //    var keyCode = (event.keyCode ? event.keyCode : event.which);
            //    if (keyCode == 13) {
            //        $('#departureJourneyDateTime').trigger('click');
            //    }
            //});

            //$('#returnJourneyDateTime').on('focus', function () {
            //   /* $(this).css('border', '1px dotted red');*/
            //    /*$(this).blur();*/
            //});

            //$('#returnJourneyDateTime').keyup(function (event) {
            //    var keyCode = (event.keyCode ? event.keyCode : event.which);
            //    if (keyCode == 13) {
            //        $('#returnJourneyDateTime').trigger('click');
            //    }
            //});

          


          



          
            
           
            $('#numberofAdults').on('focus', function () {
                $(this).blur();
            });
            $('#numberofChildren').on('focus', function () {
                $(this).blur();
            });
            $('#numberofRailcard').on('focus', function () {
                $(this).blur();
            });
            $('#numberofChildrenRailcard').on('focus', function () {
                $(this).blur();
            });
            $('#numberofAdultRailcard').on('focus', function () {
                $(this).blur();
            });
            $('#amountOfRailcard').on('focus', function () {
                $(this).blur();
            });
            $('.specific-date-time-selector').on('click', function () {
                datePrefixSelection(this);
            })
            $('.today-time-selector').on('click', function () {
                datePrefixSelection(this);
            })
            $('.tomorrow-time-selector').on('click', function () {
                datePrefixSelection(this);
            })
            $(".view").click(function () {
                $(".view-dropdown").toggle(500);
            });


            //$(".ui-state-default").mouseover(function () {
            //    $(this).next().css("display", "block");
            //});

            //$(".ui-state-default").mouseout(function () {
            //    $(this).next().css("display", "none");
            //});
            $(document).on('mouseout', " .ui-state-disabled .ui-state-default", function () {
                $(this).next().css("display", "none");
            });
            $(document).on('mouseover', ".ui-state-disabled .ui-state-default", function () {
                $(this).next().css("display", "block");
            });

            $(document).on('mouseout', " .ui-datepicker-next", function () {
                $(".ui-datepicker-next-title ").css("display", "none");
            });
            $(document).on('mouseover', ".ui-datepicker-next", function () {
                $(".ui-datepicker-next-title ").css("display", "block");
            });

            $(document).on('mouseout', " .ui-datepicker-prev", function () {
                $(".ui-datepicker-prev-title").css("display", "none");
            });
            $(document).on('mouseover', ".ui-datepicker-prev", function () {
                $(".ui-datepicker-prev-title").css("display", "block");
            });



            $(document).on('click', ".ui-state-disabled .ui-state-default", function () {
                $(".tooltip-disabldate-message").empty();
                $('.tooltip-default-message').hide();
                $('.tooltip-enabldate-message').hide();
                AddDisabledatediv(this);
            });
            
            $('.ui-datepicker-prev').attr("tabindex", "0");
            $('.ui-datepicker-next').attr("tabindex", "0");
            $(".ui-datepicker-next").attr("data-title", "Next");
            $(".ui-datepicker-prev").attr("data-title", "Prev");

            
            $(document).on('click', ".ui-datepicker-next", function () {
                
                $(".ui-datepicker-next").removeAttr("title");
                $(".ui-datepicker-prev").removeAttr("title");
                $(".ui-datepicker-next").attr("data-title", "Next");
                $('.ui-datepicker-next').attr('tabindex', '0');
                $('.ui-datepicker-prev').attr('tabindex', '0');
                $(".ui-datepicker-prev").attr("data-title", "Prev");
                AddNextprevbtnmsg();

                AddToolTip();
            });

            $(document).on('click', ".ui-datepicker-prev", function () {

               
                $(".ui-datepicker-prev").removeAttr("title");
                $(".ui-datepicker-next").removeAttr("title");
                $(".ui-datepicker-prev").attr("data-title", "Prev");
                $(".ui-datepicker-next").attr("data-title", "Next");
                $('.ui-datepicker-next').attr('tabindex', '0');
                $('.ui-datepicker-prev').attr('tabindex', '0');
                AddNextprevbtnmsg();

                AddToolTip();
            });
            $("Specificdate_return").attr("tabindex", "-1");


            $(document).on('keydown', ".ui-datepicker-prev", function (e) {
                if (e.which == 13) {
                    if (!$(".div_after1").hasClass("prevui")) {
                        $(".div_after1").addClass("prevui");
                    }
                    //$(".ui-datepicker-prev").after("<div class='ui-datepicker-prev-title div__after1 prevui'> </div>");
                    $(this).trigger("click");
                }
                
                
            });

           

            $(document).on('keydown', ".ui-datepicker-next", function (e) {
                if (e.which == 13) {
                    if (!$(".div_after").hasClass("nextui")) {
                        $(".div_after").addClass("nextui");
                    }
                   
                   /* $(".ui-datepicker-next").after("<div class='ui-datepicker-next-title div__after nextui'> </div>");*/
                    $(this).trigger("click");
                }


            });
            //$(document).on('click', ".ui-datepicker-prev", function () {
            //    AddToolTip();
            //});


           


            $('[data-modal-close]').on('click', function () {
                var modalId = $(this).data('modal-close');
                if (modalId == "close_railcard") {
                    $('#' + modalId).hide();
                    //$('#RailcardLimitError').hide();
                    $('#error-railcard-quantity').hide();
                }
                else {
                    $('#' + modalId).modal('hide');
                    //$('#RailcardLimitError').hide();
                    $('#error-railcard-quantity').hide();
                }

            })

            $('#departingFromPopup').on('click', function () {
                $('#departingFrom').val("").trigger('keyup');
                $('#DepartPopup').modal('show');
                $('#departingFrom').focus();
                $('#departingFrom').keydown(function (objEvent) {
                   if (objEvent.keyCode == 9) {  
                       objEvent.preventDefault();
                       
                  }
                })

               
            });

          
            $('#arrivingToPopup').on('click', function () {

                $('#arrivingTo').val("").trigger('keyup');
                $('#ArrivalPopup').modal('show');
                $('#arrivingTo').focus();
                $('#arrivingTo').keydown(function (objEvent) {
                    if (objEvent.keyCode == 9) {
                        objEvent.preventDefault();
                    }
                })
            });
            $('.w_arrive_date').on('click', function () {
                var selectedTab = $('#tab-arrival-date').tabs('option', 'active');
                selectedTab = 2;
                var date = new Date();
                var timetype;
                switch (selectedTab) {
                    case 0: {
                        //Today
                        selectedArrivalDate = ut.getDateOnly(date);
                        break;
                    }
                    case 1: {
                        //Tomorrow
                        selectedArrivalDate = ut.addDaysInDate(date, 1);
                        break;
                    }
                    default: {
                        //Specific Date
                        
                        var departuredate = moment(selectedDepartureDate, DATE_FORMAT);
                        if (selectedArrivalDate != null) {
                            var arrivaldate = moment(selectedArrivalDate, DATE_FORMAT);
                        }
                        if (selectedArrivalDate == null || arrivaldate < departuredate) {
                            selectedArrivalDate = selectedDepartureDate;
                                //ut.getDateOnly(date);
                        }
                        break;
                    }
                }
                var selectedTime = $('#w_arr_time_index_' + selectedTab).val();
                selectedArrivalDate = setDateTime(selectedArrivalDate, selectedTime);
                timetype = $('#w_arr_btns_index_' + selectedTab + " > .active").data("j-time");
                qttForm.returnDate = selectedArrivalDate;
                qttForm.returnOption = timetype;
                $('#returnJourneyDateTime').val(moment(selectedArrivalDate, DATETIME_FORMAT).format("ddd DD MMM, HH:mm"));
                $('#returnJourneyPopup').modal('hide');
                $("#anytime-date-calendar1").datepicker('setDate', moment(selectedArrivalDate, DATETIME_FORMAT).toDate());
                refreshDatePickers();
                validateDates(false);
            })

            $('.w_depart_date').on('click', function () {
               
                var selectedTab = $('#tabs1').tabs('option', 'active');
                selectedTab = 2;
                var date = new Date();
                var timetype;
                switch (selectedTab) {
                    case 0: {
                        //Today
                        selectedDepartureDate = ut.getDateOnly(date);
                        break;
                    }
                    case 1: {
                        //Tomorrow
                        selectedDepartureDate = ut.addDaysInDate(date, 1);
                        break;
                    }
                    default: {
                        //Specific Date
                        if (selectedDepartureDate == null) {
                            selectedDepartureDate = ut.getDateOnly(date);
                        }
                        break;
                    }
                }
                var selectedTime = $('#w_dep_time_index_' + selectedTab).val();
                selectedDepartureDate = setDateTime(selectedDepartureDate, selectedTime);
                timetype = $('#w_dep_btns_index_' + selectedTab + " > .active").data("j-time");
                qttForm.departureDate = selectedDepartureDate;
                qttForm.departureOption = timetype;
                $('#departureJourneyDateTime').val(moment(selectedDepartureDate, DATETIME_FORMAT).format("ddd DD MMM, HH:mm"));
                $('#departureDatePopup').modal('hide');
               
                $("#specific-date-calendar").datepicker('setDate', moment(selectedDepartureDate, DATETIME_FORMAT).toDate());
                refreshDatePickers();
                validateDates(false);
                qttForm.ValidateDepartureDate();
                
            })


            

            $("#departureJourneyDateTime").on('click', function () { //initializing elements such as date time

                $('.tooltip-default-message').show();
                $(".tooltip-disabldate-message").hide();
                $(".ui-datepicker-next").removeAttr("title");
                $('.ui-datepicker-prev').removeAttr("title");
               
                $('.ui-datepicker-prev').attr("tabindex", "0");
                $('.ui-datepicker-next').attr("tabindex", "0");
                $(".ui-datepicker-next").attr("data-title", "Next");
                $(".ui-datepicker-prev").attr("data-title", "Prev");
                
                
                
                $('.tooltip-enabldate-message').hide();
                var times = buildTimeData();
                $('.depart-time-form select').empty();
                for (var i = 0; i < times.length; i++) {
                    var option = $('<option></option>');
                    option.attr("value", times[i]).html(times[i]);
                    $('.depart-time-form select').append($(option));
                }
                if (selectedDepartureDate != null) {
                    $('.depart-time-form select').val(moment(selectedDepartureDate, DATETIME_FORMAT).format(TIME_FORMAT));
                }
                else {
                    var defaultSelectedDepTime = moment().add(0, 'days').add(1, 'hours').minute(0);

                    $('.depart-time-form select').val(defaultSelectedDepTime.format(TIME_FORMAT));
                }
                var date = new Date();
                for (i = 0; i < newDates.length; i++) {
                    if (newDates[i] == ut.getDateOnly(date)) {
                        $('#w_depart_date_0 .w_depart_date').prop("disabled", true);
                        $('#disableTodayDateMessage').show();
                    }
                    if (newDates[i] == ut.addDaysInDate(date, 1)) {
                        $('#w_depart_date_1 .w_depart_date').prop("disabled", true);
                        $('#disableTomDateMessage').show();
                    }
                }

                //window.open('F:\AWC\awc_sitecore_migration\src\Feature\Travel\code\Views\Travel\_DepartureDateModal.cshtml',
                //    'newwindow', 'width=700,height=500');
                AddNextprevbtnmsg();
                $('#departureDatePopup').modal('show');

                AddToolTip();
                //changenext();
                
              
            });

            
            $("#returnJourneyDateTime").on('click', function () {
                $(".tooltip-disabldate-message").hide();
                $(".ui-datepicker-next").removeAttr("title");
                $('.ui-datepicker-prev').removeAttr("title");
                
                $('.ui-datepicker-prev').attr("tabindex", "0");
                $('.ui-datepicker-next').attr("tabindex", "0");
                $(".ui-datepicker-next").attr("data-title", "Next");
                $(".ui-datepicker-prev").attr("data-title", "Prev");
                $('.tooltip-default-message').show();
                $('.tooltip-enabldate-message').hide();
                $('.arrive-time-form select').empty();
                var times = buildTimeData();
                for (var i = 0; i < times.length; i++) {
                    var option = $('<option></option>');
                    option.attr("value", times[i]).html(times[i]);
                    $('.arrive-time-form select').append($(option));
                }
                //var defaultSelectedArrTime = defaultSelectedDepTime.clone().add(2, 'hours');
                if (selectedArrivalDate != null) {
                    $('.arrive-time-form select').val(moment(selectedArrivalDate, DATETIME_FORMAT).format(TIME_FORMAT))
                }
                else {
                    var defaultSelectedDepTime = moment().add(0, 'days').add(2, 'hours').minute(0);
                    var defaultSelectedArrTime = defaultSelectedDepTime.clone().add(2, 'hours');
                    $('.arrive-time-form select').val(defaultSelectedArrTime.format(TIME_FORMAT))
                }
                var date = new Date();
                for (var i = 0; i < newDates.length; i++) {
                    if (newDates[i] == ut.getDateOnly(date)) {
                        $('#w_arrive_date_0 .w_arrive_date').prop("disabled", true);
                        $('#disableTodayReturnDateMessage').show();
                    }
                    if (newDates[i] == ut.addDaysInDate(date, 1)) {
                        $('#w_arrive_date_1 .w_arrive_date').prop("disabled", true);
                        $('#disableTomReturnDateMessage').show()
                    }
                }
                
                $('#ui-id-6_tt').attr('tabindex', '0');
                $('#ui-id-7').attr('tabindex', '0');
                AddNextprevbtnmsg();
                $('#returnJourneyPopup').modal('show');
                AddToolTip();

            });
            $('.w_open_return').on('click', function () {
                $('#returnJourneyDateTime').val('Open Return');
                qttForm.journeyType = 'Open';
                $('#returnJourneyPopup').modal('hide');

            });
            $("#departingFrom").on('keyup', function (e) {
                var searchField = $(this).val();
                bindStationKeyUpEvents('depart', searchField);
                if (e.keyCode === 13) {
                    var firstStation = $('.return-stations.depart').first();
                    $(firstStation).click();
                   
                }
                else {
                    var firstStation = $('.return-stations.depart').first();
                    $(firstStation).removeClass('focused');
                    $(firstStation).addClass('focused');
                   
                }
            })
            $("#arrivingTo").on('keyup', function (e) {
                var searchField = $(this).val();
                bindStationKeyUpEvents('arrive', searchField);
                if (e.keyCode === 13) {
                    var firstStation = $('.return-stations.arrive').first();
                    $(firstStation).click();
                }
                else {
                    var firstStation = $('.return-stations.arrive').first();
                    $(firstStation).removeClass('focused');
                    $(firstStation).addClass('focused');
                }
            })
            $(document).on('click', "#DepartPopup div.depart", function () {
                var stationCode = $(this).attr('departcrsdatabind');
                var stationName = $(this).children('div.return-station-name').text();
                if (stationCode != null && stationCode != '') {

                    qttForm.departureStation = stationName;
                    qttForm.departureStationCRSCode = stationCode;
                    $("#departingFrom").val(stationName);
                    $('#departingFromPopup').val(stationName);
                    $('#DepartPopup').modal('hide');

                    qttForm.ValidateDepartureStation();
                    $('#departingFromPopup').focus();
                }
            });

            // Departure Station selection from search and binding ends here
            $(document).on('click', "#ArrivalPopup div.arrive", function () {
                var stationCode = $(this).attr('arrivecrsdatabind');
                var stationName = $(this).children('div.return-station-name').text();
                if (stationCode != null && stationCode != '') {
                    qttForm.arrivalStation = stationName;
                    qttForm.arrivalStationCRSCode = stationCode;
                    $("#arrivingTo").val(stationName);
                    $('#arrivingToPopup').val(stationName);
                    $('#ArrivalPopup').modal('hide');
                    qttForm.ValidateArrivalStation();
                    $('#arrivingToPopup').focus();
                }
            });
            //swapping station functionality
            $('#SwapStation').on('click', function () {
                if ((!qttForm.arrivalStation) || (!qttForm.departureStation)) {
                    return;
                }
                else {
                    var currArr = qttForm.arrivalStation;
                    var currDep = qttForm.departureStation;
                    var currArrCode = qttForm.arrivalStationCRSCode;
                    var currDepCode = qttForm.departureStationCRSCode;

                    qttForm.arrivalStationCRSCode = currDepCode;
                    qttForm.departureStationCRSCode = currArrCode;
                    qttForm.arrivalStation = currDep;
                    qttForm.departureStation = currArr;
                    $('#arrivingToPopup').val(qttForm.arrivalStation);
                    $('#departingFromPopup').val(qttForm.departureStation);
                }

            });
            //number of adults
            $('#incrementAdult').on('click', function () {
                var adults = parseInt($('#numberofAdults').val()) + 1;
                if (adults >= 10) {
                    $(this).prop('disable', true);
                    $('#numberofAdults').val("10+");
                    qttForm.numberOfAdults = 10;
                }
                else {
                    qttForm.numberOfAdults = adults;
                    $('#numberofAdults').val(adults);
                }
                ShowHideRailcardAddText();

                checkLessThanZeroError();
                checkGroupTravel3To9Passenger();
                updateGroupBooking();
                updateRailcardValidation(false);
                checkSpecialRailcardValidation();
            });
            $('#decrementAdult').on('click', function () {
                var adults = parseInt($('#numberofAdults').val());
                if (adults <= 0) {
                    $(this).prop('disable', true);
                }
                else {
                    adults -= 1;
                    qttForm.numberOfAdults = adults;
                    $('#numberofAdults').val(adults);
                }
                ShowHideRailcardAddText();

                checkLessThanZeroError();
                checkGroupTravel3To9Passenger();
                updateGroupBooking();
                updateRailcardValidation(false);
                checkSpecialRailcardValidation();
            });
            //number of children
            $('#incrementChildren').on('click', function () {
                var children = parseInt($('#numberofChildren').val()) + 1;
                if (children >= 10) {
                    $(this).prop('disable', true);
                    $('#numberofChildren').val("10+");
                    qttForm.numberOfChildren = 10;
                }
                else {
                    qttForm.numberOfChildren = children;
                    $('#numberofChildren').val(children);
                }
                ShowHideRailcardAddText();

                checkLessThanZeroError();
                checkGroupTravel3To9Passenger();
                updateGroupBooking();
                updateRailcardValidation(false);
                checkSpecialRailcardValidation();
            });
            $('#decrementChildren').on('click', function () {
                var children = parseInt($('#numberofChildren').val());
                if (qttForm.numberOfChildren <= 0) {
                    $(this).prop('disable', true);
                }
                else {
                    children -= 1;
                    qttForm.numberOfChildren = children;
                    $('#numberofChildren').val(children);
                }
                ShowHideRailcardAddText();

                checkLessThanZeroError();
                checkGroupTravel3To9Passenger();
                updateGroupBooking();
                updateRailcardValidation(false);
                checkSpecialRailcardValidation();
            });

            $('#SelectedRailcard').change(function () {
                var elem = $(this).find('option:selected');
                $('#error-railcard-quantity').hide();
                $('#RailcardLimitError').hide();

                //if condition for sub railcards
                if (elem.attr('maxadults') !== elem.attr('minadults') || elem.attr('minchildren') !== elem.attr('maxchildren')) {

                    $('#AdultandChildren').show();
                    normalRailcardFlag = false;

                    maxAdults = elem.attr('maxadults');
                    minAdults = elem.attr('minadults');
                    maxChildren = elem.attr('maxchildren');
                    minChildren = elem.attr('minchildren');
                    setDefaultRailcard(minAdults, minChildren);
                    var RailcardAmount = parseInt($('#amountOfRailcard').val());
                    $('#amountOfRailcard').val(1);
                    $('#amountOfRailcard').html(1);



                    //to active the add button
                    if (totalAdultRailcard + parseInt($('#numberofAdultRailcard').val()) <= qttForm.numberOfAdults
                        && totalChildrenRailcard + parseInt($('#numberofChildrenRailcard').val()) <= qttForm.numberOfChildren && RailcardAmount <= qttForm.getTotalPassenger()) {
                        $('#AddSubRailcardBtn').prop('disabled', false);
                        $('#error-railcard-quantity').hide();
                        $('#AdultandChildren *').prop('disabled', false);

                        //For Disabled persons raicard
                        if ($('#SelectedRailcard').val() == 'DIS') {
                            if (qttForm.numberOfAdults <= maxAdults && qttForm.numberOfChildren <= maxChildren) {
                                parseInt($('#numberofAdultRailcard').val(qttForm.numberOfAdults));
                                parseInt($('#numberofChildrenRailcard').val(qttForm.numberOfChildren));
                            }
                            else {
                                if (qttForm.numberOfAdults > maxAdults) {
                                    parseInt($('#numberofAdultRailcard').val(maxAdults));
                                    $('#RailcardLimitError span').html('To use your railcard number of adults must be between ' + minAdults + ' and ' + maxAdults);
                                    $('#RailcardLimitError').show();
                                    if (qttForm.numberOfChildren >= maxChildren) {
                                        parseInt($('#numberofChildrenRailcard').val(maxChildren));
                                        if (qttForm.numberOfChildren > maxChildren) {
                                            $('#RailcardLimitError span').html('To use your railcard number of adults must be between ' + minAdults + ' and ' + maxAdults + '<br> To use your railcard number of children must be between ' + minChildren + ' and ' + maxChildren);
                                            $('#RailcardLimitError').show();
                                        }
                                    }


                                }
                                else {
                                    parseInt($('#numberofAdultRailcard').val(qttForm.numberOfAdults));
                                    parseInt($('#numberofChildrenRailcard').val(maxChildren));
                                    $('#RailcardLimitError span').html('To use your railcard number of children must be between ' + minChildren + ' and ' + maxChildren);
                                    $('#RailcardLimitError').show();

                                }
                            }

                        }

                    }
                    else {// to deactiveate the add button
                        $('#AddSubRailcardBtn').prop('disabled', true);
                        $('#error-railcard-quantity').show();
                        $('#AdultandChildren *').prop('disabled', true);
                    }

                }
                else {// normal basic railcard 

                    minAdults = parseInt(elem.attr('minadults'));
                    maxAdults = parseInt(elem.attr('maxadults'));
                    $('#amountOfRailcard').val(1);
                    $('#amountOfRailcard').html(1);

                    normalRailcardFlag = true;
                    $('#AdultandChildren').hide();
                    if (totalAdultRailcard + parseInt($('#amountOfRailcard').val() * minAdults) <= qttForm.numberOfAdults) {
                        $('#AddSubRailcardBtn').prop('disabled', false);
                        $('#error-railcard-quantity').hide();
                    }
                    else {
                        $('#AddSubRailcardBtn').prop('disabled', true);
                        $('#error-railcard-quantity').show();
                    }

                }

            });
            //increment sub railcard adult
            $('#incrementAdultRailcard').on('click', function () {
                if ($('#numberofAdultRailcard').val() < maxAdults && $('#numberofAdultRailcard').val() >= minAdults
                    && parseInt($('#numberofAdultRailcard').val()) + totalAdultRailcard < qttForm.numberOfAdults
                    && $('#numberofAdultRailcard').val() < qttForm.numberOfAdults) {
                    var railcardCount = parseInt($('#numberofAdultRailcard').val()) + 1;
                    $('#numberofAdultRailcard').val(railcardCount);
                    // qttForm.numberofAdultRailcard = railcardCount;
                    $('#RailcardLimitError').hide();
                    $('#error-railcard-quantity').hide();
                    $('#AddSubRailcardBtn').prop('disabled', false);
                }
                else {

                    if (parseInt($('#numberofAdultRailcard').val()) + 1 + totalAdultRailcard > qttForm.numberOfAdults
                        && parseInt($('#numberofAdultRailcard').val()) < maxAdults &&
                        parseInt($('#numberofAdultRailcard').val()) > minChildren) {
                        //show passenger count error
                        $('#RailcardLimitError').hide();
                        $('#error-railcard-quantity').show();
                        // $('#AddSubRailcardBtn').prop('disabled', true);
                    }
                    else {
                        $('#RailcardLimitError span').html('To use your railcard number of adults must be between ' + minAdults + ' and ' + maxAdults);
                        $('#RailcardLimitError').show();
                        // $('#AddSubRailcardBtn').prop('disabled', true);
                    }

                }
                //alert();
            });
            $('#decrementAdultRailcard').on('click', function () {
                if ($('#numberofAdultRailcard').val() <= maxAdults && $('#numberofAdultRailcard').val() > minAdults
                    //&& parseInt($('#numberofAdultRailcard').val())  + qttForm.numberOfRailcard < qttForm.numberOfAdults
                    && parseInt($('#numberofAdultRailcard').val()) <= qttForm.numberOfAdults) {
                    var railcardCount = parseInt($('#numberofAdultRailcard').val()) - 1;
                    $('#numberofAdultRailcard').val(railcardCount);
                    //  qttForm.numberofAdultRailcard = railcardCount;
                    $('#RailcardLimitError').hide();
                    $('#error-railcard-quantity').hide();
                    $('#AddSubRailcardBtn').prop('disabled', false);
                }
                else {

                    if (parseInt($('#numberofAdultRailcard').val()) + qttForm.numberOfRailcard > qttForm.numberOfAdults
                        && parseInt($('#numberofAdultRailcard').val()) < maxAdults
                        && parseInt($('#numberofAdultRailcard').val()) > minAdults) {
                        //show passenger count error
                        $('#RailcardLimitError').hide();
                        $('#error-railcard-quantity').show();
                        //$('#AddSubRailcardBtn').prop('disabled', true);
                    }
                    else {
                        $('#RailcardLimitError span').html('To use your railcard number of adults must be between ' + minAdults + ' and ' + maxAdults);
                        $('#RailcardLimitError').show();
                        // $('#AddSubRailcardBtn').prop('disabled', true);
                    }

                }
                //alert();

            });
            //increment sub railcard children
            $('#incrementChildrenRailcard').on('click', function () {
                if ($('#numberofChildrenRailcard').val() < maxChildren && $('#numberofChildrenRailcard').val() >= minChildren
                    && parseInt($('#numberofChildrenRailcard').val()) + totalChildrenRailcard < qttForm.numberOfChildren
                    && $('#numberofChildrenRailcard').val() < qttForm.numberOfChildren) {
                    var railcardCount = parseInt($('#numberofChildrenRailcard').val()) + 1;
                    $('#numberofChildrenRailcard').val(railcardCount);
                    // qttForm.numberofChildrenRailcard = railcardCount;
                    $('#RailcardLimitError').hide();
                    $('#error-railcard-quantity').hide();
                    $('#AddSubRailcardBtn').prop('disabled', false);
                }
                else {
                    if (parseInt($('#numberofChildrenRailcard').val()) + 1 + totalChildrenRailcard > qttForm.numberOfChildren
                        && parseInt($('#numberofChildrenRailcard').val()) < maxChildren &&
                        parseInt($('#numberofChildrenRailcard').val()) >= minChildren) {   //show passenger count error
                        $('#RailcardLimitError').hide();
                        // alert("passenger and railcard unequal");
                        $('#error-railcard-quantity').show();
                        // $('#AddSubRailcardBtn').prop('disabled', true);
                    }
                    else {
                        $('#RailcardLimitError span').html('To use your railcard number of children must be between ' + minChildren + ' and ' + maxChildren);
                        $('#RailcardLimitError').show();
                        //$('#AddSubRailcardBtn').prop('disabled', true);
                    }
                }

                // alert();

            });
            $('#decrementChildrenRailcard').on('click', function () {
                if (parseInt($('#numberofChildrenRailcard').val()) <= maxChildren && parseInt($('#numberofChildrenRailcard').val()) > minChildren
                    // && parseInt($('#numberofChildrenRailcard').val())  + qttForm.numberOfRailcard < qttForm.numberOfChildren
                    && parseInt($('#numberofChildrenRailcard').val()) <= qttForm.numberOfChildren) {
                    var railcardCount = parseInt($('#numberofChildrenRailcard').val()) - 1;
                    $('#numberofChildrenRailcard').val(railcardCount);
                    // qttForm.numberofChildrenRailcard = railcardCount;
                    $('#RailcardLimitError').hide();
                    $('#error-railcard-quantity').hide();
                    $('#AddSubRailcardBtn').prop('disabled', false);
                }
                else {
                    if ($('#numberofChildrenRailcard').val() + qttForm.numberOfRailcard > qttForm.numberOfChildren) {   //show passenger count error
                        $('#RailcardLimitError').hide();
                        $('#error-railcard-quantity').show();
                        // $('#AddSubRailcardBtn').prop('disabled', true);
                    }
                    else {
                        $('#RailcardLimitError span').html('To use your railcard number of children must be between ' + minChildren + ' and ' + maxChildren);
                        $('#RailcardLimitError').show();
                        // $('#AddSubRailcardBtn').prop('disabled', true);
                    }
                }
                // alert();
            });
            $('#incrementAmount').on('click', function () {
                var amount = parseInt($('#amountOfRailcard').val());
                if (minAdults == maxAdults && normalRailcardFlag == true) {
                    if (//qttForm.numberOfAdults % minAdults != 0&& 
                        totalAdultRailcard + amount * minAdults < qttForm.numberOfAdults
                        && totalAdultRailcard + (amount + 1) * minAdults <= qttForm.numberOfAdults) {
                        amount++;
                        $('#amountOfRailcard').val(amount);
                        $('#amountOfRailcard').html(amount);
                        $('#RailcardLimitError').hide();
                        return;
                    }
                    else {
                        $('#RailcardLimitError span').html('To use your railcard number of Adult must be less than or equal to ' + qttForm.numberOfAdults);
                        $('#RailcardLimitError').show();
                        return;
                    }
                }
                //if (minAdults == maxAdults) {
                //    $('#RailcardLimitError span').html('To use your railcard number of Adult must only be ' + maxAdults);
                //    $('#RailcardLimitError').show();
                //    return;
                //}
                if (amount >= 1 && amount < 9 && amount + totalAdultRailcard < qttForm.numberOfAdults + qttForm.numberOfChildren) {
                    amount++;
                    $('#amountOfRailcard').val(amount);
                    $('#amountOfRailcard').html(amount);
                    var SelectRC = $('#SelectedRailcard option:selected');
                    var MAdult = SelectRC.attr('maxadults');
                    var MChildren = SelectRC.attr('maxchildren');
                    maxAdults = MAdult * amount;
                    maxChildren = MChildren * amount;
                    $('#AddSubRailcardBtn').prop('disabled', false);
                    $('.error-message.railcard').hide();
                }
                else {
                    // $('#AddSubRailcardBtn').prop('disabled', true); 
                    $('.error-message.railcard').show();
                }
            });
            $('#decrementAmount').on('click', function () {
                var amount = parseInt($('#amountOfRailcard').val());
                if (minAdults == maxAdults && normalRailcardFlag == true) {
                    if (//qttForm.numberOfAdults % minAdults != 0 &&
                        totalAdultRailcard + amount * minAdults <= qttForm.numberOfAdults
                        && totalAdultRailcard + (amount - 1) * minAdults <= qttForm.numberOfAdults && amount >= 2) {
                        amount--;
                        $('#amountOfRailcard').val(amount);
                        $('#amountOfRailcard').html(amount);
                        $('#RailcardLimitError').hide();
                        return;
                    }
                    else {
                        $('#RailcardLimitError span').html('To use your railcard number of Adult must be less than or equal to ' + qttForm.numberOfAdults);
                        $('#RailcardLimitError').show();
                        return;
                    }
                }
                //if (minAdults == maxAdults) {
                //    $('#RailcardLimitError span').html('To use your railcard number of Adult must only be ' + maxAdults);
                //    $('#RailcardLimitError').show();
                //    return;
                //}
                if (amount > 1 && amount <= 9 && amount + totalAdultRailcard <= qttForm.numberOfAdults + qttForm.numberOfChildren) {
                    amount--;
                    $('#amountOfRailcard').val(amount);
                    $('#amountOfRailcard').html(amount);
                    var SelectRC = $('#SelectedRailcard option:selected');
                    var MAdult = SelectRC.attr('maxadults');
                    var MChildren = SelectRC.attr('maxchildren');
                    maxAdults = MAdult * amount;
                    maxChildren = MChildren * amount;
                    $('#AddSubRailcardBtn').prop('disabled', false);
                    $('.error-message.railcard').hide();
                }
                else {
                    //$('#AddSubRailcardBtn').prop('disabled', true);
                    $('.error-message.railcard').show();
                }
            });
            $('#AddSubRailcardBtn').on('click', function () {

                var RailcardN = $('#SelectedRailcard option:selected').html();
                var RailcardCode = $('#SelectedRailcard option:selected').val();
                //console.log(RailcardCode);
                var adultCards = parseInt($('#numberofAdultRailcard').val());
                var childrenCards = parseInt($('#numberofChildrenRailcard').val());
                var RailcardAmount = parseInt($('#amountOfRailcard').val());
                // qttForm.AdultCount = $('#numberofAdultRailcard').val();
                //qttForm.ChildrenCount = $('#numberofChildrenRailcard').val();
                qttForm.numberOfRailcard = parseInt($('#numberofAdultRailcard').val()) + parseInt($('#numberofChildrenRailcard').val());
                if (normalRailcardFlag != true) { //for subrailcards
                    AddSpecialRailcard(RailcardN, adultCards, childrenCards, RailcardCode, RailcardAmount);
                    bindSelectedRailcards();
                }
                else {  //for normal railcards
                    AddSpecialRailcard(RailcardN, minAdults * RailcardAmount, 0, RailcardCode, RailcardAmount);
                    bindSelectedRailcards();
                }
                // resetRailcardPopover();
                //checkSpecialRailcardValidation();
                checkRailcard();
                $('.dropdown-menu').hide();
            });
            //number of railcard
            //$('#incrementRailcard').on('click', function () {
            //    var railcardCount = parseInt($('#numberofRailcard').val()) + 1;
            //    $('#numberofRailcard').val(railcardCount);
            //    qttForm.numberOfRailcard = qttForm.railcards.length + railcardCount;
            //    updateRailcardAddOptions();
            //});
            //$('#decrementRailcard').on('click', function () {
            //    var railcardCount = parseInt($('#numberofRailcard').val()) - 1;
            //    if (railcardCount <= 0) {
            //        $(this).prop('disable', true);
            //    }
            //    else {
            //        $('#numberofRailcard').val(railcardCount);
            //        qttForm.numberOfRailcard -= 1;
            //    }
            //    updateRailcardAddOptions();
            //});

            //$('#AddRailcardBtn').on('click', function () {
            //    var railcard = $('#SelectedRailcard').val();
            //    var amount = parseInt($('#numberofRailcard').val());
            //  //  AddSpecialRailcard($('#SelectedRailcard option:selected').html(), amount, 0, railcard);
            //    if (qttForm.numberOfRailcard <= qttForm.getTotalPassenger()) {
            //        addRailcard(amount, railcard);
            //        //qttForm.railcards.sort();
            //        bindSelectedRailcards();
            //        checkRailcard();
            //        if (qttForm.railcards.length >= 1) {
            //            $('#addRailcardText').html("+ Add another railcard");
            //        }
            //        else if (qttForm.railcards.length < 1) {
            //            $('#addRailcardText').html("+ Add railcard");
            //        }
            //    }
            //    else {
            //        $('#AddRailcardBtn').attr('disabled', 'disabled')
            //    }
            //    updateRailcardAddButton();
            //});
            $(document).on('click', '.desktop-qtt a.remove-railcard-btn', function () {
              
                var code = $(this).attr('ref-code');
                var quantity = $(this).attr('Amount');
                removeRailcard(code, quantity);
                bindSelectedRailcards();
                ShowHideRailcardAddText();
                updateRailcardValidation();

            })
            $("#addRailcardText").click(function () {
                $(".dropdown-menu.qttrailcard").toggle(500);
                $("span.close").focus();
                setTimeout(function () {
                    // resetRailcardPopover();
                }, 500)
            });
            $('#SelectedRailcard').on('focus', function () {
                //$(this).css('border', '1px dotted red');
                /*$(this).blur();*/
            });
            $(document).on('click', '.view-railcard .view', function () {
                $(".view-dropdown").toggle(500);
            })
            //Buy ticket binding
            $('#buyNowBtn').on('click', function () {
                submitted = true;


                var validationResult = qttForm.Validate();

                ticketingService.sendDataNewQTT(qttForm);
                //  showErrorMessage();
                var urltest = "https://www.avantiwestcoast.co.uk/train-tickets/search-results";
                if (validationResult.valid) {
                    document.cookie = 'Beta_LeavingFromCode=' + qttForm.departureStationCRSCode;
                    document.cookie = 'Beta_GoingToCode=' + qttForm.arrivalStationCRSCode;
                    document.cookie = 'Beta_LeavingFrom=' + qttForm.departureStation;
                    document.cookie = 'Beta_GoingTo=' + qttForm.arrivalStation;
                    ut.handOffDekstop(qttForm, entryDataContext.PICOWebtisEngineUrl, promotioncodeApplied);
                    $('.desktop-qtt form').trigger('reset');

                }
                else {
                    //Handle errors
                    // alert("There are some validation errors");
                }
            });
        })
        //disabling the inputs

    };

    
    

    return {
        init: init
    }

});


define('customJS/QttMobileModuleForPICO', ['jquery', 'jqueryui', 'customJS/QttFormViewModelForPICO', 'context', 'moment', 'dataService', 'customJS/QttUtilityForPICO', 'ticketingService'], function ($, jqueryUi, QttFormVM, context, moment, dataService, Utility, ticketingService) {

    var disableDates = entryDataContext.DateSetting;
    var Outdaterange = entryDataContext.DateSettingFordisabledate;
    var allstations = [];
    var promotioncodeApplied = "";
    var railcardForPICO = [];
    var ut = Utility;
    var index;
    var selectedDepartureDate = null, selectedArrivalDate = null;
    var selectedNumberOfRailcard = 0;
    var DATETIME_FORMAT = "DD-MM-YYYY HH:mm", DATE_FORMAT = "DD-MM-YYYY", TIME_FORMAT = "HH:mm", DISPLAY_DATE_TIME_FORMAT = "ddd DD MMM, HH:mm";
    var qttForm = new QttFormVM.QttForm();
    var PopularStations = [];// entryDataContext.PopularStationsForHomeQtt;
    var submitted = false;
    var maxDepartDate = Outdaterange.QttDate;
    var maxArriveDate = Outdaterange.QttDate;
    var backupQttForm = null;
    var normalRailcardFlag = true;
    var FavouriteStation = [];
    //for railcards

    var maxAdults = 0, minAdults = 0, maxChildren = 0, minChildren = 0;
    var totalAdultRailcard = 0, totalChildrenRailcard = 0;

    var newDates = [];

    function GetFormattedDate(date) {
        return moment.utc(date).format(DATE_FORMAT);
    }
    for (var i = 0; i < disableDates.length; i++) {
        var date = GetFormattedDate(disableDates[i].Date);
        newDates.push({ "Date": date, "Disabledatemessage": disableDates[i].Disabledatehoverstatemessage, "hoverstate": disableDates[i].Addhoverstate, "Unavailabledatemessage": disableDates[i].Unavailabledatemessage, "ShowUnavailabledate": disableDates[i].ShowUnavailabledatemessage });
    }

    var init = function (stations, promotionCode) {
        allstations = stations;
        m_checkStationAPIWorking(stations);
        bindEvents();
        promotioncodeApplied = promotionCode;
        fillPopularStationList();
        defaultDepartureDate();
        getStationbyCookie();
        getPICORailcards();
        showDefaultPassenger();
        setPopularAndFavouriteStation();
    };
    var m_checkStationAPIWorking = function (data) {
        if (data.length !=0 ) {
            $("#m_stationAPICheck").hide();
        }
        else {
            $("#m_stationAPICheck").show();
        }
    }
    var getPICORailcards = function () {

        dataService.RailcardForPICO().done(function (data) {
            railcardForPICO = data.Railcard;
            bindRailcards();
        });

    }
    var setPopularStation = function () {
        if (PopularStations.length != 0) {
            fillPopularStationList();
        }
    }
    var setFavouriteStation = function () {

        if (FavouriteStation.length != 0) {
            $('#m_departFavouriteStationHeading').show();
            $('#m_arriveFavouriteStationHeading').show();
            FillFavouriteStationList();
        }
        else {
            $('#m_departFavouriteStationHeading').hide();
            $('#m_arriveFavouriteStationHeading').hide();
        }

    }
    var setPopularAndFavouriteStation = function () {

        FavouriteStation = ut.getFavouriteStationForPICO(allstations);
        PopularStations = ut.getPopularStationForPICO(allstations);
        PopularStations = ut.disjointPopularAndFavouriteStation(PopularStations, FavouriteStation);
        setPopularStation();
        setFavouriteStation();
    }
    var showDefaultPassenger = function () {
        var DefaultPassengerInfo = qttForm.numberOfAdults + ' Adults, ' + qttForm.numberOfRailcard + ' Railcards';
        $('#peopleandRailCards').val(DefaultPassengerInfo);

    }

    var getStationbyCookie = function () {

        var x = document.cookie.split(";");
        for (i = 0; i < x.length; i++) {
            var cookiepair = x[i].split("=");
            if ('Beta_LeavingFrom' == cookiepair[0].trim()) {
                qttForm.departureStation = decodeURIComponent(cookiepair[1]);
                $('#m_txt_departure_station').val(qttForm.departureStation);
            }
            if ('Beta_LeavingFromCode' == cookiepair[0].trim()) {
                qttForm.departureStationCRSCode = decodeURIComponent(cookiepair[1]);
                // $('#m_txt_departure_station').val(qttForm.departureStation);
            }
            if ('Beta_GoingTo' == cookiepair[0].trim()) {
                qttForm.arrivalStation = decodeURIComponent(cookiepair[1]);
                $('#m_txt_arrival_station').val(qttForm.arrivalStation);
            }
            if ('Beta_GoingToCode' == cookiepair[0].trim()) {
                qttForm.arrivalStationCRSCode = decodeURIComponent(cookiepair[1]);
                //$('#m_txt_arrival_station').val(qttForm.arrivalStation);
            }
        }

    }

    var defaultDepartureDate = function () {
        var date = moment().format(DATE_FORMAT);
        for (var i = 0; i < newDates.length; i++) {
            if (newDates[i] == date) {
                return;
            }
        }
        var departureType = 'D';
        var selectedTimeOneHour = moment().add(0, 'days').add(2, 'hours').minute(0);
        var DateTimeToDisplay = selectedTimeOneHour.format(DISPLAY_DATE_TIME_FORMAT);
        var setDefaultDepat = setDateTime(date, selectedTimeOneHour);
        selectedDepartureDate = setDefaultDepat;
        qttForm.departureDate = setDefaultDepat;
        qttForm.departureOption = departureType;
        $('#m_txt_departure_date').val(DateTimeToDisplay);
        $('.m_tooltip-default-message').show();

    }

    var bindRailcards = function () {
        $('#m_SelectedRailcard').empty();
        $('#m_SelectedRailcard').append("<option value='' selected minadults='0' maxadults='0'>--Select-- </option>");
        $.each(railcardForPICO, function (index, railcard) {
            var railcardOption = $('<option></option>');
            railcardOption.val(railcard.railcardcode);
            railcardOption.html(railcard.railcarddescription);
            railcardOption.attr('minadults', railcard.minadults);
            railcardOption.attr('maxadults', railcard.maxadults);
            railcardOption.attr('minchildren', railcard.minchildren);
            railcardOption.attr('maxchildren', railcard.maxchildren);
            railcardOption.attr('position', index);
            $('#m_SelectedRailcard').append(railcardOption);
        });

        //dataService.getRailcards().then(function (railcards) {
        //    $.each(railcards.data, function (index, railcard) {
        //        var railcardOption = $('<option></option>');
        //        railcardOption.val(railcard.railcardcode);
        //        railcardOption.html(railcard.railcarddescription);
        //        railcardOption.attr('position', index);
        //        $('#m_SelectedRailcard').append(railcardOption);
        //    });

        //});
    }

    var getStationColumns = function (journeyType, stationName, stationCode) {
        var disabled = false;
        if (journeyType == 'depart') {
            disabled = qttForm.arrivalStation != null && stationName == qttForm.arrivalStation;
        }
        else {
            disabled = qttForm.departureStation != null && stationName == qttForm.departureStation;
        }
        var valueAttribute = journeyType == 'depart' ? 'departcrsdatabind' : 'arrivecrsdatabind';
        var columnElement = $('<div></div>').addClass('column');
        var stationElement = $('<div></div>').addClass('return-stations ' + journeyType).attr(valueAttribute, stationCode);
        if (disabled)
            stationElement.addClass('station-disabled').removeAttr(valueAttribute);
        var stationNameElement = $('<div></div>').addClass('return-station-name').html(stationName);
        var stationCodeElement = $('<div></div>').addClass('return-station-shortcode').html();//html(stationCode);
        stationElement.append(stationNameElement).append(stationCodeElement);
        columnElement.append(stationElement);
        return columnElement;
    }
    var bindFavouriteStations = function (journeyType, stationName, stationCode) {
        if (stationCode != undefined && stationCode != "") {
            var columnElement = getStationColumns(journeyType, stationName, stationCode);
            if (journeyType == "depart") {
                $("#m-departing-favourite-stations").append(columnElement);
            }
            else {
                $("#m-arriving-favourite-stations").append(columnElement);
            }
        }


    }

    var bindPopularStations = function (journeyType, stationName, stationCode) {
        if (stationCode != undefined && stationCode != '') {
            var columnElement = getStationColumns(journeyType, stationName, stationCode);
            if (journeyType == "depart") {
                $("#m-departing-popular-stations").append(columnElement);
            }
            else {
                $("#m-arriving-popular-stations").append(columnElement);
            }
        }
    }

    var clearMoreStations = function (journeyType) {
        if (journeyType == "arrive") {
            $("#m-arriving-popular-stations").empty();
        }
        else {
            $("#m-departing-popular-stations").empty();
        }
    }

    var clearFavouriteStations = function (journeyType) {

        if (journeyType == "arrive") {
            $("#m-arriving-favourite-stations").empty();
        }
        else {
            $('#m-departing-favourite-stations').empty();

        }
    }

    var clearPopularStations = function (journeyType) {
        if (journeyType == "arrive") {
            $('#m_filtersearchArrival').empty();
        }
        else {
            $('#m_filtersearchDeparture').empty();
        }
    }

    var bindAllStations = function (journeyType, stationName, stationCode) {
        var columnElement = getStationColumns(journeyType, stationName, stationCode);
        if (journeyType == "depart") {
            $('#m_filtersearchDeparture').append(columnElement);
        }
        else {
            $('#m_filtersearchArrival').append(columnElement);
        }
    }

    var bindStationKeyUpEvents = function (journeyType, searchField) {
        var popularHeadingElement, moreHeadingElement, favouriteHeadingElement;
        if (journeyType == "arrive") {
            popularHeadingElement = $('#m_arrivePopularStationHeading');
            moreHeadingElement = $('#m_arriveMoreStationHeading');
            favouriteHeadingElement = $('#m_arriveFavouriteStationHeading');
        }
        else {
            popularHeadingElement = $('#m_departPopularStationHeading');
            moreHeadingElement = $('#m_departMoreStationHeading');
            favouriteHeadingElement = $('#m_departFavouriteStationHeading');
        }
        clearPopularStations(journeyType);
        clearMoreStations(journeyType);
        clearFavouriteStations(journeyType);
        if (searchField.length > 2) {
            //Load favourite stations which are filtered
            var filteredFavouriteStations = filterStations(FavouriteStation, searchField);
            $.each(filteredFavouriteStations, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
            });
            //Load popular stations which are filtered
            var filteredPopularStations = filterStations(PopularStations, searchField);
            $.each(filteredPopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
            });
            //Load more stations
            var filteredStations = filterStations(allstations, searchField);
            $.each(filteredStations, function (index, station) {
                bindAllStations(journeyType, station.Name, station.CrsCode);
            });
            manageStationHeading(favouriteHeadingElement, filteredFavouriteStations);
            manageStationHeading(popularHeadingElement, filteredPopularStations);
            manageStationHeading(moreHeadingElement, filteredStations);
        }
        else if (searchField.length == 0) {
            //filter favourite stations
            $.each(FavouriteStation, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            //filter popular stations
            $.each(PopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
            });
            manageStationHeading(favouriteHeadingElement, FavouriteStation);
            manageStationHeading(popularHeadingElement, PopularStations);
            manageStationHeading(moreHeadingElement, null);
        }
        else {
            //Load Favourite stations which are filtered
            var filteredFavouriteStations = filterStations(FavouriteStation, searchField);
            $.each(filteredFavouriteStations, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            //Load popular stations which are filtered
            var filteredPopularStations = filterStations(PopularStations, searchField);
            $.each(filteredPopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
            });
            //clearMoreStations();
            manageStationHeading(favouriteHeadingElement, filteredFavouriteStations);
            manageStationHeading(popularHeadingElement, filteredPopularStations);
            manageStationHeading(moreHeadingElement, null);
        }
    }

    var manageStationHeading = function (element, stations) {
        if (stations != null && stations.length > 0)
            element.show();
        else
            element.hide();
    }

    var filterStations = function (stations, searchText) {
        var filteredStations = [];
        var matchedCRSstationIndex = 0;
        var matchedStationwithCRS = false;
        for (var i = 0; i < stations.length; i++) {
            if (stations[i].Name.substring(stations[i].Name.lastIndexOf('(')).replace('(', '').replace(')', '') == searchText.toUpperCase()) {
                matchedCRSstationIndex = i;
                matchedStationwithCRS = true;
            }
            else if (stations[i].Name.toLowerCase().indexOf(searchText.toLowerCase()) > -1) {
                filteredStations.push(stations[i]);
            }
            else {
                continue;
            }
        }
        if (matchedStationwithCRS) {
            filteredStations.unshift(stations[matchedCRSstationIndex]);
        }

        return filteredStations;
    }

    var datePrefixSelection = function (element) {
        var currentTab = $(element).closest('.ui-widget-content');
        $(currentTab).find('.mobile-departby-radio').removeClass('active');
        setTimeout(function () {
            $(element).addClass('active');
        }, 100)
    }
    var FillFavouriteStationList = function () {
        //Favourite station list 
        clearPopularStations('depart');
        clearMoreStations('arrive');
        clearFavouriteStations('depart');
        manageStationHeading($('#departMoreStationHeading'), null);
        manageStationHeading($('#departMoreStationHeading'), null);
        manageStationHeading($('#arriveMoreStationHeading'), null);
        manageStationHeading($('#arriveMoreStationHeading'), null);
        manageStationHeading($('#departFavouriteStationHeading'), null);
        manageStationHeading($('#arriveFavouriteStationHeading'), null);
        for (var i = 0; i < FavouriteStation.length; i++) {
            bindFavouriteStations('depart', FavouriteStation[i].Name, FavouriteStation[i].CRS);
            bindFavouriteStations('arrive', FavouriteStation[i].Name, FavouriteStation[i].CRS);

        }

    };
    var fillPopularStationList = function () {
        //Popular station list 
        clearPopularStations('depart');
        clearMoreStations('arrive');

        manageStationHeading($('#departMoreStationHeading'), null);
        manageStationHeading($('#departMoreStationHeading'), null);
        manageStationHeading($('#arriveMoreStationHeading'), null);
        manageStationHeading($('#arriveMoreStationHeading'), null);

        for (var i = 0; i < PopularStations.length; i++) {
            bindPopularStations('depart', PopularStations[i].Name, PopularStations[i].CRS);
            bindPopularStations('arrive', PopularStations[i].Name, PopularStations[i].CRS);

        }
    };

    var groupBooking = function () {
        var passenger = qttForm.getTotalPassenger();
        if (passenger >= 10) {
            $('#groupBooking').show();
        }
        else {
            $('#groupBooking').hide();
        }
    }

    var padLeft = function (nr, n, str) {
        return Array(n - String(nr).length + 1).join(str || '0') + nr;
    }

    var buildTimeData = function () {
        var i = 0, j = 0, times = [];
        while (i < 24) {
            if (j == 0) {
                var time = padLeft(i, 2) + ":" + padLeft(j, 2);
                times.push(time);
                j += 30;
                continue;
            }
            else {
                var time = padLeft(i, 2) + ":" + padLeft(j, 2);
                times.push(time);
                j = 0;
                i += 1;
                continue;
            }
        }
        return times;
    }

    var departureDateSelected = function (date) {
        qttForm.departureDate = date;
    }

    var arrivalDateSelected = function (date) {
        qttForm.returnDate = date;
    }

    var getDateOnly = function (date) {
        date = new Date(date);
        return ut.getDateOnly(date);
    }

    var setDateTime = function (date, time) {
        date = moment.utc(date, DATE_FORMAT),
            time = moment(time, 'HH:mm');

        date.set({
            hour: time.get('hour'),
            minute: time.get('minute'),
            second: time.get('second')
        });

        return date.format(DATETIME_FORMAT);
    }

    var refreshDatePickers = function () {
        $('#m_anytime-date-calendar').datepicker('refresh');
        $('#m_specific-date-calendar').datepicker('refresh');
    }

    var checkRailcard = function () {
        if (qttForm.validateRailcards().valid) {
            $('#addRailcardText').show();
        }
        else
            $('#addRailcardText').hide();
        $('.dropdown-menu').hide();

    }

    var addRailcard = function (amount, railcard) {
        for (var i = 0; i < amount; i++) {
            qttForm.railcards.push(railcard);
        }
        qttForm.numberOfRailcard = qttForm.railcards.length;
    }

    var removeRailcard = function (railcardcode, quantity) {
        $.each(qttForm.specialRailcard, function (index, railcard) {
            if (railcard.railcardcode == railcardcode && railcard.Quantity == quantity) {
                totalAdultRailcard -= railcard.Adults;
                totalChildrenRailcard -= railcard.Childrens;
                qttForm.specialRailcard.splice(index, 1);
                //   console.log("after deletion", qttForm.specialRailcard);
                // console.log("adults", totalAdultRailcard, "children", totalChildrenRailcard);
                return false;
            }
        });
    }

    var createRailcardListItem = function (name, code, quantity) {
        var railcardMainElement = $('<div></div>');
        var railcardTitleDevElement = $('<div></div>');
        var railcardRemoveDivElement = $('<div></div>');
        var railcardIconElement = $('<i></i>');
        var railcardTitleSpanElement = $('<span></span>');
        var removeAnchorElement = $('<a></a>');

        railcardTitleSpanElement.html(" " + name);
        railcardIconElement.addClass('fa fa-window-maximize').attr('aria-hidden', 'true');
        railcardTitleDevElement.append(railcardIconElement).append(railcardTitleSpanElement).addClass('railcard-visuals');
        removeAnchorElement.attr('ref-code', code).html('Remove').addClass('remove-railcard-btn');
        removeAnchorElement.attr('Amount', quantity);
        railcardRemoveDivElement.append(removeAnchorElement).addClass('remove-railcard');
        railcardMainElement.append(railcardTitleDevElement).append(railcardRemoveDivElement).addClass('remove-railcard-section').attr('railcard-code', code);
        return railcardMainElement;
    }

    var findWithAttr = function (array, attr, value) {
        for (var i = 0; i < array.length; i += 1) {
            if (array[i][attr] === value) {
                return i;
            }
        }
        return -1;
    }

    var groupRailcards = function (railcards) {
        var groupedRailcards = [];
        for (var i = 0; i < railcards.length; i++) {
            var index = findWithAttr(groupedRailcards, 'name', railcards[i]);
            if (index > -1) {
                groupedRailcards[index].occurence += 1;
            }
            else {
                var groupRailcard = { name: railcards[i], occurence: 1 };
                groupedRailcards.push(groupRailcard);
            }
        }
        return groupedRailcards;
    }

    var populateUngroupedRailcardPanel = function (groupedRailcards) {
        $.each(groupedRailcards, function (index, railcard) {
            //var displayName = $('#m_SelectedRailcard').children("option[value=" + railcard.name + "]").html();
            var displayName = railcard.railcardName;
            if (railcard.Quantity > 1) {
                displayName = "(" + railcard.Quantity + ") " + displayName;
            }
            $(".railcardDiv").prepend(createRailcardListItem(displayName, railcard.railcardcode, railcard.Quantity));
        })
    }

    var populateGroupedRailcardPanel = function (groupedRailcards) {
        var TotalQuantity = 0;
        $.each(groupedRailcards, function (index, railcard) {
            TotalQuantity += railcard.Quantity;
        });
        var columnElement = $('<div></div>').addClass('column');
        var viewRailcardSectionElement = $('<div></div>').addClass('view-railcard-section');
        var railcardVisualElement = $('<div></div>').addClass('railcard-visuals');
        var faIconClass = $('<i></i>').addClass('fa fa-window-maximize');
        var railcardTitleElement = $('<span></span>').html(" " + TotalQuantity + " Railcards");
        var viewRailcardElement = $('<div><div>').addClass('view-railcard');
        var viewLinkElement = $('<a></a>').addClass('view').html('View');
        var viewDropDownElement = $('<div></div>').addClass('view-dropdown');
        railcardVisualElement.append(faIconClass).append(railcardTitleElement);
        viewRailcardSectionElement.append(railcardVisualElement);
        viewRailcardElement.append(viewLinkElement);
        $.each(groupedRailcards, function (index, railcard) {
            // var displayName = $('#SelectedRailcard').children("option[value=" + railcard.name + "]").html();
            var displayName = railcard.railcardName;
            if (railcard.Quantity > 1) {
                displayName = "(" + railcard.Quantity + ") " + displayName;
            }
            viewDropDownElement.prepend(createRailcardListItem(displayName, railcard.railcardcode, railcard.Quantity));
        });
        viewRailcardSectionElement.append(viewRailcardElement);
        viewRailcardSectionElement.append(viewDropDownElement);
        columnElement.append(viewRailcardSectionElement);
        $('.railcardDiv').prepend(columnElement);
        $(".view-dropdown").hide();
    }

    var bindSelectedRailcards = function () {
        $(".railcardDiv").find('.remove-railcard-section').each(function (i, obj) {
            $(obj).remove();
        });
        $(".railcardDiv").find('.view-railcard-section').each(function (i, obj) {
            $(obj).remove();
        });
        var TotalQuantity = 0;
        $.each(qttForm.specialRailcard, function (index, railcard) {
            TotalQuantity += railcard.Quantity;
        });
        //var groupedRailcards = groupRailcards(qttForm.specialRailcard.reverse());
        var groupedRailcards = qttForm.specialRailcard.reverse();
        if (TotalQuantity > 4) {
            populateGroupedRailcardPanel(groupedRailcards);
        }
        else {
            populateUngroupedRailcardPanel(groupedRailcards);
        }
    }

    var updateRailcardAddOptions = function (numberOfRailcards) {
        if (qttForm.getTotalPassenger() >= qttForm.numberOfRailcard + numberOfRailcards) {
            //Add more railcard button should be disabled
            $('#m_AddRailcardBtn').show();
        }
        else {
            //Add more railcard button should be enabled
            $('#m_AddRailcardBtn').hide();
        }
    }

    var RefreshRailcardAmount = function () {
        // $('#m_numberofRailcard').val(1);
        if ($('#m_SelectedRailcard').val() == null || $('#m_SelectedRailcard').val() == "") {
            $('#m_amountOfRailcard').val(0);
            $('#m_AddSubRailcardBtn').prop('disabled', true);
        }

    }

    //var resetRailcardPopover = function () {
    //    $('#numberofRailcard').val(1);
    //    qttForm.numberOfRailcard = qttForm.railcards.length;
    //    updateRailcardAddOptions();
    //    $(".view-dropdown").hide();
    //}

    var updateRailcardAddButton = function () {
        resetRailcardPopover();
        $('.railcardDiv .dropdown-menu').hide();
        if (qttForm.getTotalPassenger() > qttForm.numberOfRailcard) {
            //Add more railcard button should be disabled
            $('#m_AddRailcardBtn').show();
        }
        else {
            //Add more railcard button should be enabled
            $('#m_AddRailcardBtn').hide();
        }
    }


    var updateGroupBooking = function () {
        if (qttForm.getTotalPassenger() >= 10) {
            $('#m_groupBooking').show();
            //$('#applyRailcard').prop('disabled', true);
            $('#m_LessThanZeroError').hide();
            $('#m_GroupTravel3To9Message').hide();
        }
        else {
            $('#m_groupBooking').hide();

        }
    }
    var checkLessThanZeroError = function () {
        if (qttForm.getTotalPassenger() <= 0) {
            $('#m_LessThanZeroError').show();
            //  $('#applyRailcard').prop('disabled', true);
            $('#m_groupBooking').hide();
            $('#m_GroupTravel3To9Message').hide();
        }
        else {
            $('#m_LessThanZeroError').hide();
            //  $('#applyRailcard').removeAttr("disabled");
        }
    }
    var checkGroupTravel3To9Passenger = function () {
        if (qttForm.getTotalPassenger() >= 3 && qttForm.getTotalPassenger() <= 9) {
            $('#m_GroupTravel3To9Message').show();
            // $('#applyRailcard').removeAttr("disabled");
            $('#m_groupBooking').hide();
            $('#m_LessThanZeroError').hide();
        }
        else {
            $('#m_GroupTravel3To9Message').hide();

        }
    }
    var disableCheck = function () {
        if (qttForm.getTotalPassenger() == qttForm.numberOfRailcard && qttForm.getTotalPassenger() < 10) {
            if (qttForm.getTotalPassenger() <= 0) {
                $('#applyRailcard').prop('disabled', true);
                return;
            }
            else {
                $('#applyRailcard').removeAttr("disabled");
                return;
            }
        }
        if (qttForm.getTotalPassenger() <= qttForm.numberOfRailcard || qttForm.getTotalPassenger() > 9) {
            $('#applyRailcard').prop('disabled', true);
            return;
        }
        else {
            $('#applyRailcard').removeAttr("disabled");
            return;
        }
    }

    var validateDates = function (onSubmit) {
        $('.error-message.journey-dates').hide();
        var error = qttForm.validateDates();
        if (!error.valid) {
            //Show date errors
            for (var i = 0; i < error.errors.length; i++) {
                if (error.errors[i].onSubmit == onSubmit) {
                    $('#m_' + error.errors[i].key).first().html(error.errors[i].message);
                    $('.error-message.journey-dates').show();
                }
            }

        }
        else {
        }
    }

    var updateRailcardValidation = function (onSubmit) {
        $('.error-message.railcard').hide();
        var error = qttForm.validateRailcards();
        if (!error.valid) {
            //Show date errors
            for (var i = 0; i < error.errors.length; i++) {
                if (error.errors[i].onSubmit == onSubmit) {
                    $('#m_' + error.errors[i].key).first().html(error.errors[i].message);
                    $('.error-message.railcard').show();
                    //$('#applyRailcard').prop('disabled', true);
                    //$('#applyRailcard').addClass('disabled');
                }
            }

        }
        else {
            //$('#applyRailcard').prop('disabled', false);
            //$('#applyRailcard').removeClass('disabled');
        }
    }
    var AddSpecialRailcard = function (Name, Adult, children, Code, Amount) {
        qttForm.specialRailcard.push({ "railcardcode": Code, "railcardName": Name, "Adults": Adult, "Childrens": children, "Quantity": Amount });
        //  console.log(qttForm.specialRailcard);

        var countA = 0, countC = 0;

        $.each(qttForm.specialRailcard, function (index, card) {
            countA += parseInt(card.Adults);
            countC += parseInt(card.Childrens);
        });
        totalAdultRailcard = countA;
        totalChildrenRailcard = countC;
        // console.log("total adults", countA);
        //console.log("total children", countC);
        checkSpecialRailcardValidation();

    }
    var checkSpecialRailcardValidation = function () {
        if (totalAdultRailcard > qttForm.numberOfAdults || totalChildrenRailcard > qttForm.numberOfChildren) {
            //show error
            $('.error-message.railcard').show();
        }
        else {
            //hide error
            $('.error-message.railcard').hide();
        }
    }

    var resetRailcardPopover = function () {
        $('#m_SelectedRailcard').val($('#m_SelectedRailcard option:first').val());
        var firstelem = $('#m_SelectedRailcard option:first');
        normalRailcardFlag = true;
        minAdults = firstelem.attr('minadults');
        maxAdults = firstelem.attr('maxadults');
        minChildren = firstelem.attr('minchildren');
        maxChildren = firstelem.attr('maxchildren');
        $('#m_amountOfRailcard').val(minAdults);
        $('#m_amountOfRailcard').html(minAdults);
        $('#m_AdultandChildren').hide();
        $('#m_RailcardLimitError').hide();
        //$('#numberofRailcard').val(1);
        //qttForm.numberOfRailcard = qttForm.railcards.length;
        //updateRailcardAddOptions();
        if (totalAdultRailcard < qttForm.numberOfAdults) {
            $('#m_AddSubRailcardBtn').prop('disabled', false);
            $('#m_suggestionError').hide();

            if ($('#m_SelectedRailcard').val() == null || $('#m_SelectedRailcard').val() == "") {
                $('#m_amountOfRailcard').val(0);
                $('#m_AddSubRailcardBtn').prop('disabled', true);
                $('#applyRailcard').removeClass('btn-secondary').addClass('btn-primary').prop('disabled', false);

            }
            else {
                if ($('#m_AddSubRailcardBtn').prop('disabled', false)) {
                    $('#applyRailcard').removeClass('btn-primary').addClass('btn-secondary').prop('disabled', true);
                }
            }

        }
        else {
            $('#m_AddSubRailcardBtn').prop('disabled', true);
            $('#applyRailcard').removeClass('btn-secondary').addClass('btn-primary').prop('disabled', false);
            $('#m_suggestionError').show();
        }

        $(".view-dropdown").hide();
    }
    var setDefaultRailcard = function (minAdults, minChildren) {
        if (normalRailcardFlag == true) {
            //set the amount limit for normal railcards
        }
        // qttForm.numberofAdultRailcard = minAdults;
        $('#m_numberofAdultRailcard').val(minAdults);
        //qttForm.numberofChildrenRailcard = minChildren;
        $('#m_numberofChildrenRailcard').val(minChildren);
        $('#RailcardCountError').hide();

    }

    var m_AddDisabledatediv = function (el) {
        var date = el.parentElement.firstElementChild.textContent;
        var month = el.parentElement.parentElement.parentElement.parentElement.parentElement.firstElementChild.lastElementChild.firstElementChild.textContent;
        var year = el.parentElement.parentElement.parentElement.parentElement.parentElement.firstElementChild.lastElementChild.lastElementChild.textContent;
        var Disabledate = new Date(date + month + year);
        $.each(newDates, function (index, value) {
            var splitDates = value.Date.split("-");
            var dates = splitDates[1] + "-" + splitDates[0] + "-" + splitDates[2];
            var dateN = new Date(dates);
            var unavailabledate = value.Unavailabledatemessage;
            if (Disabledate.getTime() === dateN.getTime()) {
                if (value.ShowUnavailabledate == true && unavailabledate != "") {
                    $(".m_tooltip-disabldate-message").append(unavailabledate);
                    $(".m_tooltip-disabldate-message").show();
                }
                else {
                    $(".m_tooltip-disabldate-message").hide();
                }
            }
        });
        var currentdate = moment().subtract(1, "days", DATE_FORMAT);
        var enddate = moment().add(maxDepartDate, "day", DATE_FORMAT);
        if (Disabledate < currentdate) {
            if (Outdaterange.ShowPastdatemessage && Outdaterange.Pastdatemessage != "") {
                $(".m_tooltip-disabldate-message").append(Outdaterange.Pastdatemessage);
                $(".m_tooltip-disabldate-message").show();
            }
            else {
                $(".m_tooltip-disabldate-message").hide();
            }
        }
        if (Disabledate > enddate) {
            if (Outdaterange.ShowFuturedatemessage && Outdaterange.Futuredatemessage != "") {
                $(".m_tooltip-disabldate-message").append(Outdaterange.Futuredatemessage);
                $(".m_tooltip-disabldate-message").show();
            }
            else {
                $(".m_tooltip-disabldate-message").hide();
            }
        }

    }
    var bindEvents = function () {
        $(document).ready(function () {
            $('#traintimes-tab-heading').show();
            index = $('#mob-tabs').attr('default-tab');
            $('#mob-tabs').tabs({ active: index });
            $('#mob-tabs').show();
            //$('#mobile-tabs-2').show();
            $('#m-arrival-date-tabs').tabs();
            $("#m_specific-date-calendar").datepicker({
                minDate: 0,
                maxDate: maxArriveDate, firstDay: 1,
                numberOfMonths: 1,
                beforeShowDay: function (date) {
                    if (newDates) {
                        var status = true;
                        for (var i = 0; i < newDates.length; i++) {
                            if (newDates[i].Date.indexOf(ut.getDateOnly(date)) > -1) {
                                status = false;
                                return [status, '',];
                            }
                        }
                        return [status, ''];
                    }
                },
                onSelect: function (date, inst) {
                    selectedDepartureDate = getDateOnly(date);
                    $('.m_tooltip-default-message').hide();
                    $('.m_tooltip-disabldate-message').hide();
                    $('.m_tooltip-enabldate-message').show();
                }
            });
            $("#m_anytime-date-calendar").datepicker({
                minDate: 0,
                maxDate: maxDepartDate, firstDay: 1,
                numberOfMonths: 1,
                beforeShowDay: function (date) {
                    var m_selectedDepartureDate = selectedDepartureDate == null ? null : moment(selectedDepartureDate, DATETIME_FORMAT);
                    var m_selectedArrivalDate = selectedArrivalDate == null ? null : moment(selectedArrivalDate, DATETIME_FORMAT);
                    var m_date = moment(ut.getDateOnly(date), "DD-MM-YYYY");
                    var cssClass = '';
                    var selectable = true;
                    if (newDates) {
                        for (var i = 0; i < newDates.length; i++) {
                            if (newDates[i].Date.indexOf(ut.getDateOnly(date)) > -1) {
                                selectable = false;
                            }
                        }
                    }
                    if (m_selectedDepartureDate != null) {
                        selectable = m_date.toDate() >= m_selectedDepartureDate.toDate() && selectable;
                        if (m_selectedArrivalDate != null && m_date.toDate() >= m_selectedDepartureDate.toDate() && m_date.toDate() < m_selectedArrivalDate.toDate()) {
                            cssClass = 'ui-state-active';
                            return [selectable, cssClass];
                        }
                        else if (m_selectedDepartureDate.format("DDMMYYYY") == m_date.format("DDMMYYYY")) {
                            cssClass = 'ui-state-active x-ui-current-selected-date';
                            selectable = true;
                        }
                        else {
                            cssClass = m_date.format("DD/MM/YYYY") == m_selectedDepartureDate.format("DD/MM/YYYY") ? 'ui-state-active' : '';
                        }
                        return [selectable, cssClass];
                    }


                    else {
                        return [selectable, '']
                    }
                },
                onSelect: function (dateText, inst) {
                    selectedArrivalDate = getDateOnly(dateText);
                    $(this).datepicker();
                    $('.m_tooltip-default-message').hide();
                    $('.m_tooltip-disabldate-message').hide();
                    $('.m_tooltip-enabldate-message').show();
                }
            });
            //disabling the inputs
            $('#m_txt_departure_station').on('focus', function () {
                $(this).blur();
            });
            $('#m_txt_arrival_station').on('focus', function () {
                $(this).blur();
            });
            $("#m_txt_departure_date").on('focus', function () {
                $(this).blur();
            });
            $("#m_txt_arrival_date").on('focus', function () {
                $(this).blur();
            });
            $('#m_numberofAdults').on('focus', function () {
                $(this).blur();
            });
            $('#m_numberofChildren').on('focus', function () {
                $(this).blur();
            });
            $('#m_numberofRailcard').on('focus', function () {
                $(this).blur();
            });
            $('#m_numberofRailcard').on('focus', function () {
                $(this).blur();
            });
            $('#peopleandRailCards').on('focus', function () {
                $(this).blur();
            });
            $('#m_amountOfRailcard').on('focus', function () {
                $(this).blur();
            });
            $('.specific-date-time-selector').on('click', function () {
                datePrefixSelection(this);
            })
            $('.today-time-selector').on('click', function () {
                datePrefixSelection(this);
            })
            $('.tomorrow-time-selector').on('click', function () {
                datePrefixSelection(this);
            })
            //$(".view").click(function () {
            //    $(".view-dropdown").toggle(500);
            //});
            $(document).on('click', ".ui-state-disabled .ui-state-default", function () {
                $(".m_tooltip-disabldate-message").empty();
                $('.m_tooltip-default-message').hide();
                $('.m_tooltip-enabldate-message').hide();
                m_AddDisabledatediv(this);
            });

            $('[data-modal-close]').on('click', function () {
                var modalId = $(this).data('modal-close');
                $('#' + modalId).modal('hide');
            })

            $('#m_txt_departure_station').on('click', function () {
                $('#m_txt_departing_station_search').val("").trigger('keyup');
                $('#mobile-departing-popup').modal('show');
                $('#m_txt_departing_station_search').focus();

            });
            $('#m_txt_arrival_station').on('click', function () {
                $('#m_txt_returning_station_search').val("").trigger('keyup');
                $('#mobile-returning-popup').modal('show');
                $('#m_txt_returning_station_search').focus();
            });

            $('.m_depart_date').on('click', function () {
                var selectedTab = $('#tabsMobile1').tabs('option', 'active');
                selectedTab = 2;
                var date = new Date();
                var timetype;
                switch (selectedTab) {
                    case 0: {
                        //Today
                        selectedDepartureDate = ut.getDateOnly(date);
                        break;
                    }
                    case 1: {
                        //Tomorrow
                        selectedDepartureDate = ut.addDaysInDate(date, 1);
                        break;
                    }
                    default: {
                        //Specific Date
                        if (selectedDepartureDate == null) {
                            selectedDepartureDate = ut.getDateOnly(date);
                        }
                        break;
                    }
                }
                var selectedTime = $('#m_dep_time_index_' + selectedTab).val();
                selectedDepartureDate = setDateTime(selectedDepartureDate, selectedTime);
                timetype = $('#m_dep_btns_index_' + selectedTab + " > .active").data("j-time");
                qttForm.departureDate = selectedDepartureDate;
                qttForm.departureOption = timetype;
                $('#m_txt_departure_date').val(moment(selectedDepartureDate, DATETIME_FORMAT).format(DISPLAY_DATE_TIME_FORMAT));
                $('#mobile-departing-date-popup').modal('hide');
                $("#m_specific-date-calendar").datepicker('setDate', moment(selectedDepartureDate, DATETIME_FORMAT).toDate());
                refreshDatePickers();
                validateDates(false);
                qttForm.ValidateDepartureDate();
            })
            $('.m_arrive_date').on('click', function () {
                var selectedTab = $('#m-arrival-date-tabs').tabs('option', 'active');
                selectedTab = 2;
                var date = new Date();
                var timetype;
                switch (selectedTab) {
                    case 0: {
                        //Today
                        selectedArrivalDate = ut.getDateOnly(date);
                        break;
                    }
                    case 1: {
                        //Tomorrow
                        selectedArrivalDate = ut.addDaysInDate(date, 1);
                        break;
                    }
                    default: {
                        //Specific Date
                        var departuredate = moment(selectedDepartureDate, DATE_FORMAT);
                        if (selectedArrivalDate != null) {
                            var arrivaldate = moment(selectedArrivalDate, DATE_FORMAT);
                        }
                        if (selectedArrivalDate == null || arrivaldate < departuredate) {
                            selectedArrivalDate = selectedDepartureDate;
                            //ut.getDateOnly(date);
                        }
                        break;
                    }
                }
                var selectedTime = $('#m_arr_time_index_' + selectedTab).val();
                selectedArrivalDate = setDateTime(selectedArrivalDate, selectedTime);
                timetype = $('#m_arr_btns_index_' + selectedTab + " > .active").data("j-time");
                qttForm.returnDate = selectedArrivalDate;
                qttForm.returnOption = timetype;
                $('#m_txt_arrival_date').val(moment(selectedArrivalDate, DATETIME_FORMAT).format(DISPLAY_DATE_TIME_FORMAT));
                $('#mobile-arrival-date-popup').modal('hide');
                $("#m_anytime-date-calendar").datepicker('setDate', moment(selectedArrivalDate, DATETIME_FORMAT).toDate());
                refreshDatePickers();
                validateDates(false);
            });
            $('.m_open_return').on('click', function () {
                qttForm.journeyType = 'Open';
                $('#m_txt_arrival_date').val('Open Return');
                $('#mobile-arrival-date-popup').modal('hide');

            });
            $("#m_txt_departure_date").on('click', function () { //initializing elements such as date time
                $(".m_tooltip-disabldate-message").hide();
                $('.m_tooltip-default-message').show();
                $('.m_tooltip-enabldate-message').hide();
                var times = buildTimeData();
                $('.depart-time-form select').empty();
                for (var i = 0; i < times.length; i++) {
                    var option = $('<option></option>');
                    option.attr("value", times[i]).html(times[i]);
                    $('.depart-time-form select').append($(option));
                }
                if (selectedDepartureDate != null) {
                    $('.depart-time-form select').val(moment(selectedDepartureDate, DATETIME_FORMAT).format(TIME_FORMAT));
                }
                else {
                    var defaultSelectedDepTime = moment().add(0, 'days').add(1, 'hours').minute(0);

                    $('.depart-time-form select').val(defaultSelectedDepTime.format(TIME_FORMAT));
                }
                var date = new Date();
                for (i = 0; i < newDates.length; i++) {
                    if (newDates[i] == ut.getDateOnly(date)) {
                        $('#m_depart_date_0 .m_depart_date').prop("disabled", true);
                        $('#m_disableTodayDepartDateMessage').show();
                    }
                    if (newDates[i] == ut.addDaysInDate(date, 1)) {
                        $('#m_depart_date_1 .m_depart_date').prop("disabled", true);
                        $('#m_disableTomDepartDateMessage').show();
                    }
                }
                $('#mobile-departing-date-popup').modal('show');

            });
            $("#m_txt_arrival_date").on('click', function () {
                $('.arrive-time-form select').empty();
                var times = buildTimeData();
                for (var i = 0; i < times.length; i++) {
                    var option = $('<option></option>');
                    option.attr("value", times[i]).html(times[i]);
                    $('.arrive-time-form select').append($(option));
                }
                //var defaultSelectedArrTime = defaultSelectedDepTime.clone().add(2, 'hours');
                if (selectedArrivalDate != null) {
                    $('.arrive-time-form select').val(moment(selectedArrivalDate, DATETIME_FORMAT).format(TIME_FORMAT))
                }
                else {
                    var defaultSelectedDepTime = moment().add(0, 'days').add(2, 'hours').minute(0);
                    var defaultSelectedArrTime = defaultSelectedDepTime.clone().add(2, 'hours');
                    $('.arrive-time-form select').val(defaultSelectedArrTime.format(TIME_FORMAT))
                }
                var date = new Date();
                for (i = 0; i < newDates.length; i++) {
                    if (newDates[i] == ut.getDateOnly(date)) {
                        $('#m_arrive_date_0 .m_arrive_date').prop("disabled", true);
                        $('#m_disableTodayReturnDateMessage').show();
                    }
                    if (newDates[i] == ut.addDaysInDate(date, 1)) {
                        $('#m_arrive_date_1 .m_arrive_date').prop("disabled", true);
                        $('#m_disableTomReturnDateMessage').show();
                    }
                }

                $('#mobile-arrival-date-popup').modal('show');

            });
            $("#m_txt_departing_station_search").on('keyup', function () {
                var searchField = $(this).val();
                bindStationKeyUpEvents('depart', searchField);
            })
            $("#m_txt_returning_station_search").on('keyup', function () {
                var searchField = $(this).val();
                bindStationKeyUpEvents('arrive', searchField);
            })
            $(document).on('click', "#mobile-departing-popup div.depart", function () {
                var stationCode = $(this).attr('departcrsdatabind');
                var stationName = $(this).children('div.return-station-name').text();
                if (stationCode != null && stationCode != '') {
                    qttForm.departureStation = stationName;
                    qttForm.departureStationCRSCode = stationCode;
                    $("#m_txt_departure_station").val(stationName);
                    $('#mobile-departing-popup').modal('hide');
                    qttForm.ValidateDepartureStation();
                }

            });

            // Departure Station selection from search and binding ends here
            $(document).on('click', "#mobile-returning-popup div.arrive", function () {
                var stationCode = $(this).attr('arrivecrsdatabind');
                var stationName = $(this).children('div.return-station-name').text();
                if (stationCode != null && stationCode != '') {
                    qttForm.arrivalStation = stationName;
                    qttForm.arrivalStationCRSCode = stationCode;
                    $('#m_txt_arrival_station').val(stationName);
                    $('#mobile-returning-popup').modal('hide');
                    qttForm.ValidateArrivalStation();
                }
            });
            //swapping station functionality
            $('#m_SwapStation').on('click', function () {
                if ((!qttForm.arrivalStation) || (!qttForm.departureStation)) {
                    return;
                }
                else {
                    var currArr = qttForm.arrivalStation;
                    var currDep = qttForm.departureStation;
                    var currArrCode = qttForm.arrivalStationCRSCode;
                    var currDepCode = qttForm.departureStationCRSCode;

                    qttForm.arrivalStationCRSCode = currDepCode;
                    qttForm.departureStationCRSCode = currArrCode;
                    qttForm.arrivalStation = currDep;
                    qttForm.departureStation = currArr;
                    $('#m_txt_arrival_station').val(qttForm.arrivalStation);
                    $('#m_txt_departure_station').val(qttForm.departureStation);
                }

            });
            //number of adults
            $('#m_incrementAdult').on('click', function () {
                var adults = parseInt($('#m_numberofAdults').val()) + 1;
                if (adults >= 10) {
                    $(this).prop('disable', true);
                    $('#m_numberofAdults').val("10+");
                    qttForm.numberOfAdults = 10;
                }
                else {
                    qttForm.numberOfAdults = adults;
                    $('#m_numberofAdults').val(adults);
                }
                updateRailcardAddButton();
                updateGroupBooking();
                checkLessThanZeroError();
                checkGroupTravel3To9Passenger();
                updateRailcardValidation(false);
                checkSpecialRailcardValidation();
                disableCheck();
                RefreshRailcardAmount();
            });
            $('#m_decrementAdult').on('click', function () {
                var adults = parseInt($('#m_numberofAdults').val());
                if (adults <= 0) {
                    $(this).prop('disable', true);
                }
                else {
                    adults -= 1;
                    qttForm.numberOfAdults = adults;
                    $('#m_numberofAdults').val(adults);
                }
                updateRailcardAddButton();
                updateGroupBooking();
                checkLessThanZeroError();
                checkGroupTravel3To9Passenger();
                updateRailcardValidation(false);
                checkSpecialRailcardValidation();
                disableCheck();
                RefreshRailcardAmount();
            });
            //number of children
            $('#m_incrementChildren').on('click', function () {
                var children = parseInt($('#m_numberofChildren').val()) + 1;
                if (children >= 10) {
                    $(this).prop('disable', true);
                    $('#m_numberofChildren').val("10+");
                    qttForm.numberOfChildren = 10;
                }
                else {
                    qttForm.numberOfChildren = children;
                    $('#m_numberofChildren').val(children);
                }
                updateRailcardAddButton();
                updateGroupBooking();
                checkLessThanZeroError();
                checkGroupTravel3To9Passenger();
                updateRailcardValidation(false);
                checkSpecialRailcardValidation();
                disableCheck();
                RefreshRailcardAmount();
            });
            $('#m_decrementChildren').on('click', function () {
                var children = parseInt($('#m_numberofChildren').val());
                if (qttForm.numberOfChildren <= 0) {
                    $(this).prop('disable', true);
                }
                else {
                    children -= 1;
                    qttForm.numberOfChildren = children;
                    $('#m_numberofChildren').val(children);
                }
                updateRailcardAddButton();
                updateGroupBooking();
                checkLessThanZeroError();
                checkGroupTravel3To9Passenger();
                updateRailcardValidation(false);
                checkSpecialRailcardValidation();
                disableCheck();
                RefreshRailcardAmount();
            });
            //number of railcard
            $('#m_incrementRailcard').on('click', function () {
                $('#m_decrementRailcard').prop('disabled', false);
                var railcardCount = parseInt($('#m_numberofRailcard').val()) + 1;
                $('#m_numberofRailcard').val(railcardCount);
                //qttForm.numberOfRailcard = qttForm.railcards.length + railcardCount;
                selectedNumberOfRailcard = railcardCount;
                updateRailcardAddOptions(selectedNumberOfRailcard);
            });
            $('#m_decrementRailcard').on('click', function () {
                var railcardCount = parseInt($('#m_numberofRailcard').val()) - 1;
                if (railcardCount <= 0) {
                    $(this).prop('disabled', true);
                    //updateRailcardAddOptions(0);
                }
                else {
                    $('#m_numberofRailcard').val(railcardCount);
                    selectedNumberOfRailcard = railcardCount;

                }
                if (selectedNumberOfRailcard > 0)
                    updateRailcardAddOptions(selectedNumberOfRailcard);
            });
            $('#m_SelectedRailcard').change(function () {
                var elem = $(this).find('option:selected');
                $('#m_error-railcard-quantity').hide();
                $('#m_RailcardLimitError').hide();


                //if condition for sub railcards
                if (elem.attr('maxadults') !== elem.attr('minadults') || elem.attr('minchildren') !== elem.attr('maxchildren')) {

                    $('#m_AdultandChildren').show();
                    normalRailcardFlag = false;
                    maxAdults = elem.attr('maxadults');
                    minAdults = elem.attr('minadults');
                    maxChildren = elem.attr('maxchildren');
                    minChildren = elem.attr('minchildren');
                    setDefaultRailcard(minAdults, minChildren);
                    var RailcardAmount = parseInt($('#m_amountOfRailcard').val());
                    $('#m_amountOfRailcard').val(1);
                    $('#m_amountOfRailcard').html(1);

                    //to active the add button
                    if (totalAdultRailcard + parseInt($('#m_numberofAdultRailcard').val()) <= qttForm.numberOfAdults
                        && totalChildrenRailcard + parseInt($('#m_numberofChildrenRailcard').val()) <= qttForm.numberOfChildren && RailcardAmount <= qttForm.getTotalPassenger()) {
                        $('#m_AddSubRailcardBtn').prop('disabled', false);
                        $('#m_error-railcard-quantity').hide();
                        $('#m_AdultandChildren *').prop('disabled', false);
                        $('#applyRailcard').removeClass('btn-primary').addClass('btn-secondary').prop('disabled', true);

                        //For Disabled persons raicard
                        if ($('#m_SelectedRailcard').val() == 'DIS') {
                            if (qttForm.numberOfAdults <= maxAdults && qttForm.numberOfChildren <= maxChildren) {
                                parseInt($('#m_numberofAdultRailcard').val(qttForm.numberOfAdults));
                                parseInt($('#m_numberofChildrenRailcard').val(qttForm.numberOfChildren));
                            }
                            else {
                                if (qttForm.numberOfAdults > maxAdults) {
                                    parseInt($('#m_numberofAdultRailcard').val(maxAdults));
                                    $('#m_RailcardLimitError span').html('To use your railcard number of adults must be between ' + minAdults + ' and ' + maxAdults);
                                    $('#m_RailcardLimitError').show();
                                    if (qttForm.numberOfChildren >= maxChildren) {
                                        parseInt($('#m_numberofChildrenRailcard').val(maxChildren));
                                        if (qttForm.numberOfChildren > maxChildren) {
                                            $('#m_RailcardLimitError span').html('To use your railcard number of adults must be between ' + minAdults + ' and ' + maxAdults + '<br> To use your railcard number of children must be between ' + minChildren + ' and ' + maxChildren);
                                            $('#m_RailcardLimitError').show();
                                        }
                                    }

                                }
                                else {
                                    parseInt($('#m_numberofAdultRailcard').val(qttForm.numberOfAdults));
                                    parseInt($('#m_numberofChildrenRailcard').val(maxChildren));
                                    $('#m_RailcardLimitError span').html('To use your railcard number of children must be between ' + minChildren + ' and ' + maxChildren);
                                    $('#m_RailcardLimitError').show();

                                }
                            }

                        }

                    }
                    else {// to deactiveate the add button
                        $('#m_AddSubRailcardBtn').prop('disabled', true);
                        $('#m_error-railcard-quantity').show();
                        $('#m_AdultandChildren *').prop('disabled', true);
                        $('#applyRailcard').removeClass('btn-secondary').addClass('btn-primary').prop('disabled', false);
                    }

                }
                else {// normal basic railcard 

                    minAdults = parseInt(elem.attr('minadults'));
                    maxAdults = parseInt(elem.attr('maxadults'));
                    $('#m_amountOfRailcard').val(1);
                    $('#m_amountOfRailcard').html(1);

                    normalRailcardFlag = true;
                    $('#m_AdultandChildren').hide();
                    if (totalAdultRailcard + parseInt($('#m_amountOfRailcard').val() * minAdults) <= qttForm.numberOfAdults) {
                        $('#m_AddSubRailcardBtn').prop('disabled', false);
                        $('#m_error-railcard-quantity').hide();

                        //for choose railcard option
                        if ($('#m_SelectedRailcard').val() == null || $('#m_SelectedRailcard').val() == "") {
                            $('#m_amountOfRailcard').val(0);
                            $('#m_AddSubRailcardBtn').prop('disabled', true);
                            $('#applyRailcard').removeClass('btn-secondary').addClass('btn-primary').prop('disabled', false);
                        }
                        else {
                            if ($('#m_AddSubRailcardBtn').prop('disabled', false)) {
                                $('#applyRailcard').removeClass('btn-primary').addClass('btn-secondary').prop('disabled', true);
                            }
                        }

                    }
                    else {
                        $('#m_AddSubRailcardBtn').prop('disabled', true);
                        $('#m_error-railcard-quantity').show();
                    }

                }


            });
            //increment sub railcard adult
            $('#m_incrementAdultRailcard').on('click', function () {
                if ($('#m_numberofAdultRailcard').val() < maxAdults && $('#m_numberofAdultRailcard').val() >= minAdults
                    && parseInt($('#m_numberofAdultRailcard').val()) + totalAdultRailcard < qttForm.numberOfAdults
                    && $('#m_numberofAdultRailcard').val() < qttForm.numberOfAdults) {
                    var railcardCount = parseInt($('#m_numberofAdultRailcard').val()) + 1;
                    $('#m_numberofAdultRailcard').val(railcardCount);
                    // qttForm.numberofAdultRailcard = railcardCount;
                    $('#m_RailcardLimitError').hide();
                    $('#m_error-railcard-quantity').hide();
                    $('#m_AddSubRailcardBtn').prop('disabled', false);
                }
                else {
                    if (parseInt($('#m_numberofAdultRailcard').val()) + 1 + totalAdultRailcard > qttForm.numberOfAdults
                        && parseInt($('#m_numberofAdultRailcard').val()) < maxAdults &&
                        parseInt($('#m_numberofAdultRailcard').val()) > minChildren) {
                        //show passenger count error
                        $('#m_RailcardLimitError').hide();
                        $('#m_error-railcard-quantity').show();
                        $('#m_AddSubRailcardBtn').prop('disabled', true);
                    }
                    else {
                        $('#m_RailcardLimitError span').html('To use your railcard number of adults must be between ' + minAdults + ' and ' + maxAdults);
                        $('#m_RailcardLimitError').show();
                        $('#m_AddSubRailcardBtn').prop('disabled', true);
                    }

                }
                //alert();
            });
            $('#m_decrementAdultRailcard').on('click', function () {
                if ($('#m_numberofAdultRailcard').val() <= maxAdults && $('#m_numberofAdultRailcard').val() > minAdults
                    //&& parseInt($('#numberofAdultRailcard').val())  + qttForm.numberOfRailcard < qttForm.numberOfAdults
                    && parseInt($('#m_numberofAdultRailcard').val()) <= qttForm.numberOfAdults) {
                    var railcardCount = parseInt($('#m_numberofAdultRailcard').val()) - 1;
                    $('#m_numberofAdultRailcard').val(railcardCount);
                    //  qttForm.numberofAdultRailcard = railcardCount;
                    $('#m_RailcardLimitError').hide();
                    $('#m_error-railcard-quantity').hide();
                    $('#m_AddSubRailcardBtn').prop('disabled', false);
                }
                else {
                    if (parseInt($('#m_numberofAdultRailcard').val()) + qttForm.numberOfRailcard > qttForm.numberOfAdults
                        && parseInt($('#m_numberofAdultRailcard').val()) < maxAdults
                        && parseInt($('#m_numberofAdultRailcard').val()) > minAdults) {
                        //show passenger count error
                        $('#m_RailcardLimitError').hide();
                        $('#m_error-railcard-quantity').show();
                        $('#m_AddSubRailcardBtn').prop('disabled', true);
                    }
                    else {
                        $('#m_RailcardLimitError span').html('To use your railcard number of adults must be between ' + minAdults + ' and ' + maxAdults);
                        $('#m_RailcardLimitError').show();
                        $('#m_AddSubRailcardBtn').prop('disabled', true);
                    }

                }
                //alert();

            });
            //increment sub railcard children
            $('#m_incrementChildrenRailcard').on('click', function () {
                if ($('#m_numberofChildrenRailcard').val() < maxChildren && $('#m_numberofChildrenRailcard').val() >= minChildren
                    && parseInt($('#m_numberofChildrenRailcard').val()) + totalChildrenRailcard < qttForm.numberOfChildren
                    && $('#m_numberofChildrenRailcard').val() < qttForm.numberOfChildren) {
                    var railcardCount = parseInt($('#m_numberofChildrenRailcard').val()) + 1;
                    $('#m_numberofChildrenRailcard').val(railcardCount);
                    // qttForm.numberofChildrenRailcard = railcardCount;
                    $('#m_RailcardLimitError').hide();
                    $('#m_error-railcard-quantity').hide();
                    $('#AddSubRailcardBtn').prop('disabled', false);
                }
                else {
                    if (parseInt($('#m_numberofChildrenRailcard').val()) + 1 + totalChildrenRailcard > qttForm.numberOfChildren
                        && parseInt($('#m_numberofChildrenRailcard').val()) < maxChildren &&
                        parseInt($('#m_numberofChildrenRailcard').val()) >= minChildren) {   //show passenger count error
                        $('#m_RailcardLimitError').hide();
                        // alert("passenger and railcard unequal");
                        $('#m_error-railcard-quantity').show();
                        $('#m_AddSubRailcardBtn').prop('disabled', true);
                    }
                    else {
                        $('#m_RailcardLimitError span').html('To use your railcard number of children must be between ' + minChildren + ' and ' + maxChildren);
                        $('#m_RailcardLimitError').show();
                        $('#m_AddSubRailcardBtn').prop('disabled', true);
                    }
                }

                // alert();

            });
            $('#m_decrementChildrenRailcard').on('click', function () {
                if (parseInt($('#m_numberofChildrenRailcard').val()) <= maxChildren && parseInt($('#m_numberofChildrenRailcard').val()) > minChildren
                    // && parseInt($('#numberofChildrenRailcard').val())  + qttForm.numberOfRailcard < qttForm.numberOfChildren
                    && parseInt($('#m_numberofChildrenRailcard').val()) <= qttForm.numberOfChildren) {
                    var railcardCount = parseInt($('#m_numberofChildrenRailcard').val()) - 1;
                    $('#m_numberofChildrenRailcard').val(railcardCount);
                    // qttForm.numberofChildrenRailcard = railcardCount;
                    $('#m_RailcardLimitError').hide();
                    $('#m_error-railcard-quantity').hide();
                    $('#m_AddSubRailcardBtn').prop('disabled', false);
                }
                else {
                    if ($('#m_numberofChildrenRailcard').val() + qttForm.numberOfRailcard > qttForm.numberOfChildren) {   //show passenger count error
                        $('#m_RailcardLimitError').hide();
                        $('#m_error-railcard-quantity').show();
                        $('#m_AddSubRailcardBtn').prop('disabled', true);
                    }
                    else {
                        $('#m_RailcardLimitError span').html('To use your railcard number of children must be between ' + minChildren + ' and ' + maxChildren);
                        $('#m_RailcardLimitError').show();
                        $('#m_AddSubRailcardBtn').prop('disabled', true);
                    }
                }
                // alert();
            });
            $('#m_incrementAmount').on('click', function () {
                var amount = parseInt($('#m_amountOfRailcard').val());
                if (minAdults == maxAdults && normalRailcardFlag == true) {
                    if (//qttForm.numberOfAdults % minAdults != 0&& 
                        totalAdultRailcard + amount * minAdults < qttForm.numberOfAdults
                        && totalAdultRailcard + (amount + 1) * minAdults <= qttForm.numberOfAdults) {
                        amount++;
                        $('#m_amountOfRailcard').val(amount);
                        $('#m_amountOfRailcard').html(amount);
                        $('#m_RailcardLimitError').hide();
                        return;
                    }
                    else {
                        $('#m_RailcardLimitError span').html('To use your railcard number of Adult must be less than or equal to ' + qttForm.numberOfAdults);
                        $('#m_RailcardLimitError').show();
                        return;
                    }
                }
                //if (minAdults == maxAdults) {
                //    $('#RailcardLimitError span').html('To use your railcard number of Adult must only be ' + maxAdults);
                //    $('#RailcardLimitError').show();
                //    return;
                //}
                if (amount >= 1 && amount < 9 && amount + totalAdultRailcard < qttForm.numberOfAdults) {
                    amount++;
                    $('#m_amountOfRailcard').val(amount);
                    $('#m_amountOfRailcard').html(amount);
                    var SelectRC = $('#m_SelectedRailcard option:selected');
                    var MAdult = SelectRC.attr('maxadults');
                    var MChildren = SelectRC.attr('maxchildren');
                    maxAdults = MAdult * amount;
                    maxChildren = MChildren * amount;
                    $('#m_AddSubRailcardBtn').prop('disabled', false);
                    $('.error-message.railcard').hide();
                }
                else {
                    $('#m_AddSubRailcardBtn').prop('disabled', true);
                    $('.error-message.railcard').show();
                }
            });
            $('#m_decrementAmount').on('click', function () {
                var amount = parseInt($('#m_amountOfRailcard').val());
                if (minAdults == maxAdults && normalRailcardFlag == true) {
                    if (//qttForm.numberOfAdults % minAdults != 0 &&
                        totalAdultRailcard + amount * minAdults <= qttForm.numberOfAdults
                        && totalAdultRailcard + (amount - 1) * minAdults <= qttForm.numberOfAdults && amount >= 2) {
                        amount--;
                        $('#m_amountOfRailcard').val(amount);
                        $('#m_amountOfRailcard').html(amount);
                        $('#m_RailcardLimitError').hide();
                        return;
                    }
                    else {
                        $('#m_RailcardLimitError span').html('To use your railcard number of Adult must be less than or equal to ' + qttForm.numberOfAdults);
                        $('#m_RailcardLimitError').show();
                        return;
                    }
                }
                //if (minAdults == maxAdults) {
                //    $('#RailcardLimitError span').html('To use your railcard number of Adult must only be ' + maxAdults);
                //    $('#RailcardLimitError').show();
                //    return;
                //}
                if (amount > 1 && amount <= 9 && amount + totalAdultRailcard <= qttForm.numberOfAdults) {
                    amount--;
                    $('#m_amountOfRailcard').val(amount);
                    $('#m_amountOfRailcard').html(amount);
                    var SelectRC = $('#m_SelectedRailcard option:selected');
                    var MAdult = SelectRC.attr('maxadults');
                    var MChildren = SelectRC.attr('maxchildren');
                    maxAdults = MAdult * amount;
                    maxChildren = MChildren * amount;
                    $('#m_AddSubRailcardBtn').prop('disabled', false);
                    $('.error-message.railcard').hide();
                }
                else {
                    $('#m_AddSubRailcardBtn').prop('disabled', true);
                    $('.error-message.railcard').show();
                }
            });
            $('#m_AddSubRailcardBtn').on('click', function () {
                var RailcardN = $('#m_SelectedRailcard option:selected').html();
                var RailcardCode = $('#m_SelectedRailcard option:selected').val();
                // console.log(RailcardCode);
                var adultCards = parseInt($('#m_numberofAdultRailcard').val());
                var childrenCards = parseInt($('#m_numberofChildrenRailcard').val());
                var RailcardAmount = parseInt($('#m_amountOfRailcard').val());
                // qttForm.AdultCount = $('#numberofAdultRailcard').val();
                //qttForm.ChildrenCount = $('#numberofChildrenRailcard').val();
                qttForm.numberOfRailcard = parseInt($('#m_numberofAdultRailcard').val()) + parseInt($('#m_numberofChildrenRailcard').val());
                if (normalRailcardFlag != true) { //for subrailcards
                    AddSpecialRailcard(RailcardN, adultCards, childrenCards, RailcardCode, RailcardAmount);
                    bindSelectedRailcards();
                }
                else {  //for normal railcards
                    AddSpecialRailcard(RailcardN, minAdults * RailcardAmount, 0, RailcardCode, RailcardAmount);
                    bindSelectedRailcards();
                }
                // resetRailcardPopover();
                //checkSpecialRailcardValidation();
                checkRailcard();
                resetRailcardPopover();
                $('.dropdown-menu').hide();
            });
            $('#m_AddRailcardBtn').on('click', function () {
                var railcard = $('#m_SelectedRailcard').val();
                var amount = parseInt($('#m_numberofRailcard').val());
                if (qttForm.numberOfRailcard <= qttForm.getTotalPassenger()) {
                    addRailcard(amount, railcard);
                    //qttForm.railcards.sort();
                    bindSelectedRailcards();
                    checkRailcard();
                    if (qttForm.railcards.length >= 1) {
                        $('#addRailcardText').html("+ Add another railcard");
                    }
                    else if (qttForm.railcards.length < 1) {
                        $('#addRailcardText').html("+ Add railcard");
                    }
                }
                else {
                    $('#m_AddRailcardBtn').attr('disabled', 'disabled')
                }
                updateRailcardAddButton();
                RefreshRailcardAmount();
            });
            $(document).on('click', '.mobile-qtt a.remove-railcard-btn', function () {
                var code = $(this).attr('ref-code');
                var quantity = $(this).attr('Amount');
                removeRailcard(code, quantity);
                bindSelectedRailcards();
                updateRailcardAddButton();
                updateRailcardValidation();
            })

            $('.close-railcard-mobile-pop').on('click', function () {
                qttForm = $.extend(true, {}, backupQttForm);
            })

            $('#peopleandRailCards').on('click', function () {
                backupQttForm = $.extend(true, {}, qttForm);
                $('#m_numberofAdults').val(qttForm.numberOfAdults);
                $('#m_numberofChildren').val(qttForm.numberOfChildren);
                bindSelectedRailcards();
                updateGroupBooking();
                resetRailcardPopover();
                $('#railcard-mobile-pop').modal('show');
                $("#m_SelectedRailcard").trigger("change");
            })

            $('#applyRailcard').on('click', function () {
                qttForm.numberOfRailcard = qttForm.railcards.length;
                var totalRailcardQuantity = 0;
                $.each(qttForm.specialRailcard, function (index, railcard) {
                    totalRailcardQuantity += railcard.Quantity;
                });

                var railcardTextToDisplay = qttForm.numberOfAdults + ' Adults, ' + qttForm.numberOfChildren + ' Children, ' + totalRailcardQuantity + ' Railcards';
                $('#peopleandRailCards').val(railcardTextToDisplay);
                $('#railcard-mobile-pop').modal('hide');
            });
            //$(".main-drop").click(function () {
            //    $(".dropdown-menu").toggle(500);
            //    setTimeout(function () {
            //        resetRailcardPopover();
            //    }, 500)
            //});
            //$(document).on('click', '.view-railcard .view', function () {
            //    $(".view-dropdown").toggle(500);
            //})
            //Buy ticket binding
            $('#m_buyNowBtn').on('click', function () {
                submitted = true;
                var validationResult = qttForm.Validate();
                ticketingService.sendDataNewQTT(qttForm);
                if (validationResult.valid) {
                    document.cookie = 'Beta_LeavingFromCode=' + qttForm.departureStationCRSCode;
                    document.cookie = 'Beta_GoingToCode=' + qttForm.arrivalStationCRSCode;
                    document.cookie = 'Beta_LeavingFrom=' + qttForm.departureStation;
                    document.cookie = 'Beta_GoingTo=' + qttForm.arrivalStation;
                    ut.handOffDekstop(qttForm, entryDataContext.PICOWebtisEngineUrl, promotioncodeApplied);
                    $('.mobile-qtt form').trigger('reset');

                }
                else {
                    //Handle errors
                    // alert("There are some validation errors");
                }
            });
        })


    };
    //init();
    return {
        init: init
    }

});
define('customJS/SeasonTicketViewModel', ['jquery', 'moment'], function ($, moment) {
    function SeasonTicket() {
        this.NowDate = new Date();
        this.arrivalStation = null;
        this.departureStation = null;
        this.arrivalStationCRSCode = null;
        this.departureStationCRSCode = null;

        this.numberOfAdults = 1;
        this.numberOfChildren = 0;
        this.railcards = [];
        this.departureTime = null;
        this.returnTime = null;
        this.departureDate = null;
        this.returnDate = null;
        this.departureOption = null;
        this.returnOption = null;
        this.numberOfRailcard = 0;
        this.journeyType = 'single';
        this.weekly = true;
        this.monthly = true;
        this.annual = true;
        this.custom = false;
        this.adult = true;
        this.child = false;
        this.departureDateTime = function () {
            // return moment(this.departureDate.getDate() + '-' + this.departureDate.getMonth() + '-' + this.departureDate.getFullYear() + ' ' + this.departureTime, 'DD-MM-YYYY HH:mm');
            return moment(this.departureDate, "DD-MM-YYYY HH:mm");
        }; 
        this.returnDateTime = function () {
            // return moment(this.returnDate.getDate() + '-' + this.returnDate.getMonth() + '-' + this.returnDate.getFullYear() + ' ' + this.returnTime, 'DD-MM-YYYY HH:mm');
            return moment(this.returnDate, "DD-MM-YYYY HH:mm");
        };
        this.getTotalPassenger = function () {
            return this.numberOfAdults + this.numberOfChildren;
        };
        this.ValidateDepartureStation = function () {
            if (this.departureStation == null || this.departureStation == '') {
                // result.errors.push(createErrorMessage('error-departure-station', 'Departure station cannot be empty'));
                $('.error-departureStation_ST').show();
            }
            else {
                $('.error-departureStation_ST').hide();
            }
        }
        this.ValidateArrivalStation = function () {
            if (this.arrivalStation == null || this.arrivalStation == '') {
                //result.errors.push(createErrorMessage('error-arrival-station', 'Arrival station cannot be empty'));
                $('.error-arrivalStation_ST').show();
            }
            else {
                $('.error-arrivalStation_ST').hide();
            }
        }
        this.ValidateDepartureDate = function () {
            if (this.departureDate == null || this.departureDate == '') {
                // result.errors.push(createErrorMessage('error-departure-date', 'Departure date cannot be empty', true));
                $('.error-departureDate_ST').show();
            }
            else {
                $('.error-departureDate_ST').hide();
            }
        }
        this.ValidateReturnDate = function () {
            if (this.returnDate == null || this.returnDate == '') {
                $('.error-arrivalDate').show();
            }
            else {
                $('.error-arrivalDate').hide();
            }
        }
        this.validateStations = function () {
            var result = { errors: [], valid: false };
            if (this.departureStation == null || this.departureStation == '') {
                result.errors.push(createErrorMessage('error-departure-station', 'Departure station cannot be empty'));
               // $('#error-departureStation').show();
            }
            if (this.arrivalStation == null || this.arrivalStation == '') {
                result.errors.push(createErrorMessage('error-arrival-station', 'Arrival station cannot be empty'));
               // $('#error-arrivalStation').show();
            }
            if (this.departureStation != null && this.arrivalStation != null && this.departureStation == this.arrivalStation) {
                result.errors.push(createErrorMessage('error-stations', 'Departure station and Arrival stations cannot be same'));
            }
            if (result.errors.length == 0) {
                result.valid = true;
              //  $('#error-departureStation').hide();
                //$('#error-arrivalStation').hide();
            }
            return result;
        }

        this.validateDates = function () {
            var result = { errors: [], valid: false };
            if (this.departureDate == null || this.departureDate == '') {
                result.errors.push(createErrorMessage('error-departure-date', 'Departure date cannot be empty', true));
            }
            //if (this.returnDate == null || this.returnDate == '') {
            //    result.errors.push(createErrorMessage('error-arrival-date', 'Arrival date cannot be empty', true));
            //}
            //if (this.returnDateTime().isBefore(this.departureDateTime()) || this.returnDateTime().isSame(this.departureDateTime())) {
            //    result.errors.push(createErrorMessage('error-date_ST', 'Return date must be after departure date', false));
            //}
            //if (this.departureDateTime() <= new Date($.now()) || this.returnDateTime() <= new Date($.now())) {
            //    result.errors.push(createErrorMessage('error-date_ST', 'Departure date must only be in future', false));
            //}
            if (result.errors.length == 0) {
                result.valid = true;
            }
            return result;
        }

        this.validateRailcards = function () {
            var result = { errors: [], valid: false };
            if (this.numberOfRailcard > 0) {
                if (this.getTotalPassenger() < this.numberOfRailcard) {
                    result.errors.push(createErrorMessage('error-railcard-quantity', 'Number of railcards should be less or equal to total number of passengers', false));
                }
                else {
                    result.valid = true;
                }
            }
            else {
                result.valid = true;
            }
            return result;
        }

        this.Validate = function () {
            var result = { errors: [], valid: false };
            this.ValidateDepartureStation();
            this.ValidateArrivalStation();
            this.ValidateDepartureDate();
            
            var stationResult = this.validateStations();
            var datesResult = this.validateDates();
            var railcardResult = this.validateRailcards();
            if (!stationResult.valid)
                result.errors.push.apply(result.errors, stationResult.errors);
            if (!datesResult.valid)
                result.errors.push.apply(result.errors, datesResult.errors);
            if (!railcardResult.valid)
                result.errors.push.apply(result.errors, railcardResult.errors);
            if (result.errors.length == 0) {
                result.valid = true;
            }
            return result;

        };

        var createErrorMessage = function (key, value, onSubmit) {
            if (!onSubmit) {
                onSubmit = false;
            }
            return { key: key, message: value, onSubmit: onSubmit };
        }
    }
    return {
        Seasonticket: SeasonTicket
    };
});


define("json!mock/SeasonTicketRailcard.json", function(){ return {
  "data": [
    {
      "railcardcode": "TSU",
      "railcarddescription": "16-17 Saver",
      "mustspecifynumber": true,
      "minadults": 1,
      "maxadults": 1,
      "minchildren": 0,
      "maxchildren": 0
    },
    {
      "railcardcode": "JCP",
      "railcarddescription": "Jobcentre Plus Travel Discount Card",
      "mustspecifynumber": true,
      "minadults": 1,
      "maxadults": 1,
      "minchildren": 0,
      "maxchildren": 0
    }
  ]
};});

define('customJS/SeasonTicketUtility', ['jquery', 'jqueryui', 'context', 'moment'], function ($, jqueryUi, context, moment) {

    var DATETIME_FORMAT = "DD-MM-YYYY HH:mm", DATE_FORMAT = "DD-MM-YYYY", TIME_FORMAT = "HH:mm", DISPLAY_DATE_TIME_FORMAT = "ddd DD MMM, HH:mm"; 
    var PopularStationFromSitecore = entryDataContext.PopularStationsForHomeQtt;



    var getPopularStationForPICO = function (allstations) {
        var PopularStationList = [];
        if (PopularStationFromSitecore != null && PopularStationFromSitecore.length != 0) {
            for (var i = 0; i < PopularStationFromSitecore.length; i++) {
                $.each(allstations, function (index, station) {
                    if (PopularStationFromSitecore[i].Name + ' (' + PopularStationFromSitecore[i].CRS + ')' == station.Name) {
                        PopularStationList.push({ "Name": station.Name, "CRS": station.CrsCode });
                    }
                });
            }
        }
        return PopularStationList;
    }

    var getFavouriteStationForPICO = function (allstations) {

        var FavouriteStationPICO = [];
        var myPreferencesResponse = localStorage.getItem('myPreferencesResponse');
        if (myPreferencesResponse != undefined && myPreferencesResponse != null && myPreferencesResponse.length > 0) {
            var myPrefernecesJSON = JSON.parse(myPreferencesResponse);
            FavouriteStationPICO = myPrefernecesJSON.FavouriteStationsList;
        }
        var FavouriteStation = [];
        if (FavouriteStationPICO != null && FavouriteStationPICO.length != 0) {
            for (var i = 0; i < FavouriteStationPICO.length; i++) {
                $.each(allstations, function (index, station) {
                    if (FavouriteStationPICO[i] == station.Name) {
                        FavouriteStation.push({ "Name": station.Name, "CRS": station.CrsCode })
                    }
                });
            }
        }
        
        return FavouriteStation;
    }
    var disjointPopularAndFavouriteStation = function (PopularStation, FavouriteStation) {

        if (FavouriteStation.length == 0) {
            return PopularStation;
        }
        else {
            if (PopularStation.length != 0 && FavouriteStation.length != 0) {
                for (var i = PopularStation.length - 1; i >= 0; i--) {
                    for (var j = 0; j < FavouriteStation.length; j++) {
                        if (PopularStation[i] && (PopularStation[i].CRS === FavouriteStation[j].CRS)) {
                            PopularStation.splice(i, 1);
                        }
                    }
                }
            }
            return PopularStation;
        }

    }
    var sampleData = {
        "arrivalStation": "Salford Central (SFD)", "departureStation": "Manchester Piccadilly (MAN)",
        "numberOfAdults": 2, "numberOfChildren": 0, "railcards": ["NGC", "YNG"], "departureTime": null,
        "returnTime": null, "departureDate": "19-05-2020 10:00", "returnDate": "20-05-2020 10:00",
        "departureOption": "D", "returnOption": "D", "numberOfRailcard": 2
    };

    var getDateOnly = function (date, format) {
        if (format == null) {
            return moment([date.getFullYear(), date.getMonth(), date.getDate()]).format(DATE_FORMAT);
        }
        else {
            return moment([date.getFullYear(), date.getMonth(), date.getDate()]).format(format);
        }
    }

    var getDateTime = function (date, format) {
        if (format == null) {
            return moment([date.getFullYear(), date.getMonth(), date.getDate()]).format(DATETIME_FORMAT);
        }
        else {
            return moment([date.getFullYear(), date.getMonth(), date.getDate()]).format(format);
        }
    }

    var getTime = function (date, format) {
        if (format == null) {
            return moment([date.getFullYear(), date.getMonth(), date.getDate()]).format(TIME_FORMAT);
        }
        else {
            return moment([date.getFullYear(), date.getMonth(), date.getDate()]).format(format);
        }
    }

    var getCustomizedDateTime = function (date, format) {
        if (format == null) {
            throw "format must be provided";
        }
        else {
            return moment([date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(),date.getMinutes()]).format(format);
        }
    }

    var addDaysInDate = function (date, numberOfDays, format) {
        if (format == null)
            return moment([date.getFullYear(), date.getMonth(), date.getDate()]).add(numberOfDays, 'days').format(DATE_FORMAT);
        else
            return moment([date.getFullYear(), date.getMonth(), date.getDate()]).add(numberOfDays, 'days').format(format);
    }

    


    var handOffDekstop = function (data, url) {
        var noa = getnoa(data.adult);
        var noc = getnoc(data.child);
        var hitURL = url;
        //data = sampleData;
        

        //var arrivalStation = "", departureStation = "",
            var railCardsLength = data.railcards.length;
        //arrivalStation = data.arrivalStation.substring(data.arrivalStation.lastIndexOf('(') + 1, data.arrivalStation.lastIndexOf(')'));
        //departureStation = data.departureStation.substring(data.departureStation.lastIndexOf('(') + 1, data.departureStation.lastIndexOf(')'));
        url += '?oriCode=' + data.departureStationCRSCode + '&oriName=' + data.departureStation + '&destCode=' + data.arrivalStationCRSCode + '&destName=' + data.arrivalStation + '&oadInd=' + getArrivalDepartureIndicator(data.departureOption) + '&override_handoff=MATRIX';
        var dateFormatted = getDateFormat(data.departureDate);
        //url += '&outHourField=' + dateFormatted[1] + '&outMinuteField=' + dateFormatted[2] + '&outDate=' + dateFormatted[0];
        url +=  '&startDate=' + dateFormatted[0];

        //if (data.returnDate != null && data.returnDate != "" && data.journeyType=="Return") {
        if (data.returnDate != null && data.returnDate != "" && data.custom != false) {
            var returnDateFormatted = getDateFormat(data.returnDate);
            //url += '&jt=Return
            url += '&endDate=' + returnDateFormatted[0] + '&jt=Season&noa=' + noa + '&noc=' + noc +
                //& noa=' + data.numberOfAdults + ' & noc=' + data.numberOfChildren
                //+ ' & inHourField=' + returnDateFormatted[1] + ' & inMinuteField=' + returnDateFormatted[2]
                 
                //'&iadInd=' + getArrivalDepartureIndicator(data.returnOption) +
                
                //'&isC=' + data.custom;
                '&isW=true&isM=true&isA=true&isF=true'

        }
        //else if (data.journeyType == "OpenReturn") {

        //    url += '&jt=Open Return&noa=' + data.numberOfAdults + '&noc=' + data.numberOfChildren;
        //}

        //else {
        //    url += '&jt=Single&noa=' + data.numberOfAdults + '&noc=' + data.numberOfChildren;
        //}
        else {

            url += '&jt=Season&noa=' + noa + '&noc=' + noc +
                '&isW=true&isM=true&isA=true&isF=true'
            //'&isC=' + data.custom;
        }
        url += '&rcNum=' + noc;
        if (railCardsLength >= 0) {
            var railCardsSimplified = getRailCardsSimplified(data.railcards)
            var rjson = { json: "[]" };
           
            if (railCardsLength == 0) {
                url += '&rcCode=' + 'Choose Railcard..' + '' + '&rcNoa=' + noa + '&rcNoc=' + noc + '&rJson=' + rjson.json + '&rCount=' + railCardsLength;
            }
            else {
                
                for (var i = 0; i < railCardsSimplified.length; i++) {
                   
                    if (i == 0) {
                        url += '&rcCode=' + railCardsSimplified[i].card.RailcardCode + '' + '&rcNoa=' + noa + '&rcNoc=' + noc + '&rJson=' + rjson.json + '&rCount=' + railCardsSimplified[i].count;
                    }
                    else {
                        url += '&rcNum' + (i + 1) + '=' + railCardsSimplified[i].count + '&rcCode' + (i + 1) + '=' + railCardsSimplified[i].card.RailcardCode + '' + '&rcNoa=' + noa + '&rcNoc=' + noc + '&rJson=' + rjson.json + '&rCount=' + railCardsSimplified[i].count;
                    }
                }
            }
        }

        hitURL = hitURL.replace("search-results", "season-search-results");
        url = url.replace("search-results", "season-search-results");
        localStorage.setItem('isRedirectFromHomePage', 'true');
        localStorage.setItem('searchQueryString', url);
        window.location.href = hitURL;

    }










    var handOffMobile = function (data, url) {
        //data = sampleData;
        var arrivalStation = data.arrivalStation.substring(data.arrivalStation.lastIndexOf('(') + 1, data.arrivalStation.lastIndexOf(')'));
        var departureStation = data.departureStation.substring(data.departureStation.lastIndexOf('(') + 1, data.departureStation.lastIndexOf(')'));
        url += '?Origin=' + departureStation + '&Destination=' + arrivalStation + '';
        var departureType = data.departureType === 'D' ? 'DepartAt' : 'ArriveBy';
        var dateFormatted = getDateFormat(data.departureDate);
        var dateSplitted = dateFormatted[0].split('/');
        url += '&OutboundTime=' + dateFormatted[1] + '-' + dateFormatted[2] + '&OutboundDate=' + dateSplitted[2] + '-' + dateSplitted[1] + '-' + dateSplitted[0];
        
        
        if (data.returnDate != null && data.returnDate != "" && data.journeyType == 'Return') {
       
            var dateFormattedReturn = getDateFormat(data.returnDate);
            var dateSplittedReturn = dateFormattedReturn[0].split('/');
            var returnType = data.returnType === 'D' ? 'DepartAt' : 'ArriveBy';
            url += '&TicketType=Return&NumberOfAdults=' + data.numberOfAdults + '&NumberOfChildren=' + data.numberOfChildren +
                '&ReturnTime=' + dateFormattedReturn[1] + '-' + dateFormattedReturn[2] + '&ReturnSearchType='+ returnType + '&ReturnDate=' + dateSplittedReturn[2] + '-' + dateSplittedReturn[1] + '-' + dateSplittedReturn[0];

        }
        else if (data.journeyType == "OpenReturn") {
            url += '&NumberOfAdults=' + data.numberOfAdults + '&NumberOfChildren=' + data.numberOfChildren + '&TicketType=OpenReturn';
           
        }
        else {

            url += '&OutboundSearchType=' + departureType + '&TicketType=Single&NumberOfAdults=' + data.numberOfAdults + '&NumberOfChildren=' + data.numberOfChildren + '';
        }
        if (data.railcards.length > 0) {
            var length = data.railcards.length;
            for (var i = 0; i < length; i++) {
                url += '&Railcards=' + data.railcards[i] + '';
            }
        }

        window.location.href = url;

    }


    function getDateFormat(date) {
        var DateArr = [];
        DateArr.push(date.split("-").join("/").substring(0, date.indexOf(' ')));
        var minDay = date.substring(date.indexOf(' ') + 1, date.length).split(':')
        minDay.forEach(function (x) { return DateArr.push(x) });
        return DateArr;
    }


    function getArrivalDepartureIndicator(option) {

        return option === 'D' ? 'Leave After' : 'Arrive Before';
    }

    function getRailCardsSimplified(railcards) {
        var railCardsArray = [];
        for (var i = 0; i < railcards.length; i++) {
            var added = true;
            for (var j = 0; j < railCardsArray.length; j++) {

                if (railCardsArray[j].card === railcards[i]) {
                    railCardsArray[j].count = railCardsArray[j].count + 1;
                    added = false;
                    break;
                }
            }
            if (added) {
                railCardsArray.push({ card: railcards[i], count: 1 });
            }

        }
        return railCardsArray;

    }
    function getnoa(adult) {
        var noadult = 1;
        if (adult == true) {
            noadult = 1;
        }
            else {
            noadult = 0;
            }

        return noadult;
    }
    function getnoc(child) {
        var nochild = 0;
        if (child == true) {
            nochild = 1;
        }
            else {
            child = 0;
            }

        return nochild;
    }

    return {
        handOffMobile: handOffMobile,
        handOffDekstop: handOffDekstop,
        getDateOnly: getDateOnly,
        getDateTime: getDateTime,
        getTime: getTime,
        getCustomizedDateTime: getCustomizedDateTime,
        addDaysInDate: addDaysInDate,
        getPopularStationForPICO: getPopularStationForPICO,
        getFavouriteStationForPICO: getFavouriteStationForPICO,
        disjointPopularAndFavouriteStation: disjointPopularAndFavouriteStation
    };

});
define('customJS/SeasonTicketModule', ['jquery', 'jqueryui', 'customJS/SeasonTicketViewModel', 'json!mock/SeasonTicketRailcard.json', 'context', 'moment', 'dataService', 'customJS/SeasonTicketUtility', 'ticketingService'], function ($, jqueryUi, QttFormVM, railcard, context, moment, dataService, Utility_ST, ticketingService) {

    var disableDates = entryDataContext.DateSetting;
    var Outdaterange = entryDataContext.DateSettingFordisabledate;
    var selectedDepartureDate = null, selectedArrivalDate = null;
    var DATETIME_FORMAT = "DD-MM-YYYY HH:mm", DATE_FORMAT = "DD-MM-YYYY", TIME_FORMAT = "HH:mm", DISPLAY_DATE_TIME_FORMAT_ST = "ddd DD MMM, YYYY";
    var qttForm = new QttFormVM.Seasonticket();
    var ut = Utility_ST;
    var PopularStations = [];// entryDataContext.PopularStationsForHomeQtt;
    var maxDepartDateWeb = Outdaterange.SeasonTicketDepartureMaxDate;
    var minDepartDateWeb = Outdaterange.SeasonTicketDepartureMinDate;
    var maxArriveDateWeb = Outdaterange.SeasonTicketArrivalMaxDate;
    var minArriveDateWeb = Outdaterange.SeasonTicketArrivalMinDate;
    var submitted = false;
    var newDates = [];
    var allstations = [];
    var FavouriteStation = [];
    function GetFormattedDate(date) {
        return moment.utc(date).format(DATE_FORMAT);
    }
    for (var i = 0; i < disableDates.length; i++) {
        var date = GetFormattedDate(disableDates[i].Date);
        newDates.push({ "Date": date, "Disabledatemessage": disableDates[i].Disabledatehoverstatemessage, "hoverstate": disableDates[i].Addhoverstate, "Unavailabledatemessage": disableDates[i].Unavailabledatemessage, "ShowUnavailabledate": disableDates[i].ShowUnavailabledatemessage });
    }
    var init = function (data) {
        allstations = data;
        bindEvents();
        bindRailcards();
        defaultDepartureDate();
        getStationbyCookie();
        setPopularAndFavouriteStation();
    };

    var setPopularStation = function () {
        if (PopularStations.length != 0) {
            fillPopularStationList();
        }
    }
    var setFavouriteStation = function () {

        if (FavouriteStation.length != 0) {
            $('#departFavouriteStationHeading_ST').show();
            $('#arriveFavouriteStationHeading_ST').show();
            FillFavouriteStationList();
        }
        else {
            $('#departFavouriteStationHeading_ST').hide();
            $('#arriveFavouriteStationHeading_ST').hide();
        }

    }
    var setPopularAndFavouriteStation = function () {

        FavouriteStation = ut.getFavouriteStationForPICO(allstations);
        PopularStations = ut.getPopularStationForPICO(allstations);
        PopularStations = ut.disjointPopularAndFavouriteStation(PopularStations, FavouriteStation);
        setPopularStation();
        setFavouriteStation();
    }

    var getStationbyCookie = function () {
        var x = document.cookie.split(";");
        for (i = 0; i < x.length; i++) {
            var cookiepair = x[i].split("=");
            if ('LeavingFrom' == cookiepair[0].trim()) {
                qttForm.departureStation = decodeURIComponent(cookiepair[1]);
                $('#departingFromPopup_ST').val(qttForm.departureStation);
            }
            if ('LeavingFromCode' == cookiepair[0].trim()) {
                qttForm.departureStationCRSCode = decodeURIComponent(cookiepair[1]);

            }
            if ('GoingTo' == cookiepair[0].trim()) {
                qttForm.arrivalStation = decodeURIComponent(cookiepair[1]);
                $('#arrivingToPopup_ST').val(qttForm.arrivalStation);
            }
            if ('GoingToCode' == cookiepair[0].trim()) {
                qttForm.arrivalStationCRSCode = decodeURIComponent(cookiepair[1]);

            }
        }

    }
    var defaultDepartureDate = function () {
        var Depdate = moment().format(DATE_FORMAT);
        var arrdate = moment().add(1, 'months').add(1, 'days').format(DATE_FORMAT);

        //for (var i = 0; i < newDates.length; i++) {
        //    if (newDates[i] == Depdate) {
        //        return;    
        //    }
        //}
        //for (var i = 0; i < newDates.length; i++) {
        //    if (newDates[i] == arrdate) {
        //        return;    
        //    }
        //}

        var departureType = 'D';
        var selectedTimeOneHour = moment().add(0, 'days');
        //.add(1, 'hours').minute(0);
        var DateTimeToDisplay = selectedTimeOneHour.format(DISPLAY_DATE_TIME_FORMAT_ST);
        var setDefaultDepat = setDateTime(Depdate, selectedTimeOneHour);
        selectedDepartureDate = setDefaultDepat;
        qttForm.departureDate = setDefaultDepat;
        qttForm.departureOption = departureType;
        $('#departureJourneyDateTime_ST').val(DateTimeToDisplay);
        $('.tooltip-default-message_ST').show();

        // ArrivalDefaultdate

        var selectedOnemonth = moment().add(1, 'months').add(1, 'days');
        //.add(0, 'hours').minute(0);
        var ArrivalDateTimeToDisplay = selectedOnemonth.format(DISPLAY_DATE_TIME_FORMAT_ST);
        var setDefaultArrival = setDateTime(arrdate, selectedOnemonth);
        selectedArrivalDate = setDefaultArrival;
        qttForm.returnDate = setDefaultArrival;
        qttForm.returnOption = departureType;
        $('#returnJourneyDateTime_ST').val(ArrivalDateTimeToDisplay);

    }
    var bindRailcards = function () {
        $('#selectrailcard_ST').empty();
        $.each(railcard.data, function (index, railcard) {
            var railcardOption = $('<option></option>');
            railcardOption.val(railcard.railcardcode);
            railcardOption.html(railcard.railcarddescription);
            railcardOption.attr('position', index);
            $('#selectrailcard_ST').append(railcardOption);
        });
        //dataService.getRailcards().then(function (railcards) {
        //    $.each(railcards.data, function (index, railcard) {
        //        var railcardOption = $('<option></option>');
        //        railcardOption.val(railcard.railcardcode);
        //        railcardOption.html(railcard.railcarddescription);
        //        railcardOption.attr('position', index);
        //        $('#selectrailcard_ST').append(railcardOption);
        //    });

        //});
    }

    var getStationColumns = function (journeyType, stationName, stationCode) {
        var disabled = false;

        if (journeyType == 'depart') {
            disabled = qttForm.arrivalStation != null && stationName == qttForm.arrivalStation;
        }
        else {
            disabled = qttForm.departureStation != null && stationName == qttForm.departureStation;
        }
        var valueAttribute = journeyType == 'depart' ? 'departcrsdatabind' : 'arrivecrsdatabind';
        var columnElement = $('<div></div>').addClass('column');
        var stationElement = $('<div></div>').addClass('return-stations ' + journeyType + ' ST').attr(valueAttribute, stationCode);// + ' (' + stationCode + ')');
        if (disabled)
            stationElement.addClass('station-disabled').removeAttr(valueAttribute);
        var stationNameElement = $('<div></div>').addClass('return-station-name').html(stationName);
        var stationCodeElement = $('<div></div>').addClass('return-station-shortcode').html();//html(stationCode);
        stationElement.append(stationNameElement).append(stationCodeElement);
        columnElement.append(stationElement);
        return columnElement;
    }

    var bindPopularStations = function (journeyType, stationName, stationCode) {
        if (stationCode != undefined && stationCode != '') {
            var columnElement = getStationColumns(journeyType, stationName, stationCode);
            if (journeyType == "depart") {
                $("#Departing-Popular-station_ST").append(columnElement);
            }
            else {
                $("#Arriving-Popular-station_ST").append(columnElement);
            };
        }

    }
    var bindFavouriteStations = function (journeyType, stationName, stationCode) {
        if (stationCode != undefined && stationCode != "") {
            var columnElement = getStationColumns(journeyType, stationName, stationCode);
            if (journeyType == "depart") {
                $("#Departing-Favourite-station_ST").append(columnElement);
            }
            else {
                $("#Arriving-Favourite-station_ST").append(columnElement);
            }
        }


    }

    var clearMoreStations = function (journeyType) {
        if (journeyType == "arrive") {
            $("#Arriving-Popular-station_ST").empty();
        }
        else {
            $("#Departing-Popular-station_ST").empty();
        }
    }

    var clearPopularStations = function (journeyType) {
        if (journeyType == "arrive") {
            $('#filtersearchArrival_ST').empty();
        }
        else {
            $('#filtersearchDeparture_ST').empty();
        }
    }
    var clearFavouriteStations = function (journeyType) {

        if (journeyType == "arrive") {
            $("#Arriving-Favourite-station_ST").empty();
        }
        else {
            $('#Departing-Favourite-station_ST').empty();

        }
    }

    var bindAllStations = function (journeyType, stationName, stationCode) {
        var columnElement = getStationColumns(journeyType, stationName, stationCode);
        if (journeyType == "depart") {
            $('#filtersearchDeparture_ST').append(columnElement);
        }
        else {
            $('#filtersearchArrival_ST').append(columnElement);
        }
    }

    var bindStationKeyUpEvents = function (journeyType, searchField) {
        var popularHeadingElement, moreHeadingElement, FavouriteHeadingElement;
        if (journeyType == "arrive") {
            popularHeadingElement = $('#arrivePopularStationHeading_ST');
            moreHeadingElement = $('#arriveMoreStationHeading_ST');
            FavouriteHeadingElement = $('#arriveFavouriteStationHeading_ST');
        }
        else {
            FavouriteHeadingElement = $('#departFavouriteStationHeading_ST');
            popularHeadingElement = $('#departPopularStationHeading_ST');
            moreHeadingElement = $('#departMoreStationHeading_ST');
        }
        clearPopularStations(journeyType);
        clearMoreStations(journeyType);
        clearFavouriteStations(journeyType);
        if (searchField.length > 2) {
            //load favourite station which are filtered
            var filteredFavouriteStations = filterStations(FavouriteStation, searchField);
            $.each(filteredFavouriteStations, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            //Load popular stations which are filtered
            var filteredPopularStations = filterStations(PopularStations, searchField);
            $.each(filteredPopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
            });
            //Load more stations
            var filteredStations = filterStations(allstations, searchField);
            $.each(filteredStations, function (index, station) {
                bindAllStations(journeyType, station.Name, station.CrsCode);
            });

            manageStationHeading(FavouriteHeadingElement, filteredFavouriteStations);
            manageStationHeading(popularHeadingElement, filteredPopularStations);
            manageStationHeading(moreHeadingElement, filteredStations);
        }
        else if (searchField.length == 0) {
            //filter favourite stations
            $.each(FavouriteStation, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            //filter popular stations
            $.each(PopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
            });
            manageStationHeading(FavouriteHeadingElement, FavouriteStation);
            manageStationHeading(popularHeadingElement, PopularStations);
            manageStationHeading(moreHeadingElement, null);
        }
        else {
            //Load Favourite stations which are filtered
            var filteredFavouriteStations = filterStations(FavouriteStation, searchField);
            $.each(filteredFavouriteStations, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            //Load popular stations which are filtered
            var filteredPopularStations = filterStations(PopularStations, searchField);
            $.each(filteredPopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
            });
            //clearMoreStations();
            manageStationHeading(FavouriteHeadingElement, filteredFavouriteStations);
            manageStationHeading(popularHeadingElement, filteredPopularStations);
            manageStationHeading(moreHeadingElement, null);
        }
    }

    var manageStationHeading = function (element, stations) {
        if (stations != null && stations.length > 0)
            element.show();
        else
            element.hide();
    }

    var filterStations = function (stations, searchText) {
        var filteredStations = [];
        for (var i = 0; i < stations.length; i++) {
            if (stations[i].Name.toLowerCase().indexOf(searchText.toLowerCase()) > -1) {
                filteredStations.push(stations[i]);
            }
            else {
                continue;
            }
        }
        return filteredStations;
    }

    var datePrefixSelection = function (element) {
        var currentTab = $(element).closest('.ui-widget-content');
        $(currentTab).find('.departby-radio').removeClass('active');
        setTimeout(function () {
            $(element).addClass('active');
        }, 100)

    }
    var FillFavouriteStationList = function () {
        //Favourite station list 
        clearPopularStations('depart');
        clearMoreStations('arrive');
        clearFavouriteStations('depart');
        manageStationHeading($('#departMoreStationHeading_ST'), null);
        manageStationHeading($('#arriveMoreStationHeading'), null);
        // manageStationHeading($('#departFavouriteStationHeading_ST'), null);
        //manageStationHeading($('#arriveFavouriteStationHeading_ST'), null);
        for (var i = 0; i < FavouriteStation.length; i++) {
            bindFavouriteStations('depart', FavouriteStation[i].Name, FavouriteStation[i].CRS);
            bindFavouriteStations('arrive', FavouriteStation[i].Name, FavouriteStation[i].CRS);

        }

    };
    var fillPopularStationList = function () {
        //Popular station list 
        clearPopularStations('depart');
        clearMoreStations('arrive');

        manageStationHeading($('#departPopularStationHeading_ST'), null);
        manageStationHeading($('#departMoreStationHeading_ST'), null);
        manageStationHeading($('#arrivePopularStationHeading_ST'), null);
        manageStationHeading($('#arriveMoreStationHeading_ST'), null);

        for (var i = 0; i < PopularStations.length; i++) {
            bindPopularStations('depart', PopularStations[i].Name, PopularStations[i].CRS);
            bindPopularStations('arrive', PopularStations[i].Name, PopularStations[i].CRS);

        }
    };



    var padLeft = function (nr, n, str) {
        return Array(n - String(nr).length + 1).join(str || '0') + nr;
    }

    var buildTimeData = function () {
        var i = 0, j = 0, times = [];
        while (i < 24) {
            if (j == 0) {
                var time = padLeft(i, 2) + ":" + padLeft(j, 2);
                times.push(time);
                j += 30;
                continue;
            }
            else {
                var time = padLeft(i, 2) + ":" + padLeft(j, 2);
                times.push(time);
                j = 0;
                i += 1;
                continue;
            }
        }
        return times;
    }

    var departureDateSelected = function (date) {
        qttForm.departureDate = date;
    }

    var arrivalDateSelected = function (date) {
        qttForm.returnDate = date;
    }

    var getDateOnly = function (date) {
        date = new Date(date);
        return ut.getDateOnly(date);
    }


    var setDateTime = function (date, time) {
        date = moment.utc(date, DATE_FORMAT),
            time = moment(time, 'HH:mm');

        date.set({
            hour: time.get('hour'),
            minute: time.get('minute'),
            second: time.get('second')
        });

        return date.format(DATETIME_FORMAT);
    }

    var refreshDatePickers = function () {
        $('#anytime-date-calendar1_ST').datepicker('refresh');
        $('#specific-date-calendar_ST').datepicker('refresh');
    }

    var checkRailcard = function () {
        //if (qttForm.validateRailcards().valid) {
        //    $('#addRailcardText_ST').show();
        //}
        //else
        $('#addRailcardText_ST').hide();
        $('.dropdown-menu').hide();

    }

    var addRailcard = function (railcardcode, railcardname) {

        qttForm.railcards.push({ "RailcardName": railcardname, "RailcardCode": railcardcode });

    }

    var removeRailcard = function (railcard) {
        $.each(qttForm.railcards, function (index, RC) {
            if (RC.RailcardCode == railcard);
            {
                qttForm.railcards.splice(index, 1);
            }
        });
        //qttForm.numberOfRailcard = qttForm.railcards.length;
    }

    var createRailcardListItem = function (name, code) {
        var railcardMainElement = $('<div></div>');
        var railcardTitleDevElement = $('<div></div>');
        var railcardRemoveDivElement = $('<div></div>');
        var railcardIconElement = $('<i></i>');
        var railcardTitleSpanElement = $('<span></span>');
        var removeAnchorElement = $('<a></a>');

        railcardTitleSpanElement.html(" " + name);
        railcardIconElement.addClass('fa fa-window-maximize').attr('aria-hidden', 'true');
        railcardTitleDevElement.append(railcardIconElement).append(railcardTitleSpanElement).addClass('railcard-visuals');
        removeAnchorElement.attr('ref-code', code).html('Remove').addClass('remove-railcard-btn').attr('id', 'Removebtn').attr('tabindex','0');
        railcardRemoveDivElement.append(removeAnchorElement).addClass('remove-railcard');
        railcardMainElement.append(railcardTitleDevElement).append(railcardRemoveDivElement).addClass('remove-railcard-section').attr('railcard-code', code);
        return railcardMainElement;
    }

    //var findWithAttr = function (array, attr, value) {
    //    for (var i = 0; i < array.length; i += 1) {
    //        if (array[i][attr] === value) {
    //            return i;
    //        }
    //    }
    //    return -1;
    //}

    //var groupRailcards = function (railcards) {
    //    debugger;
    //    var groupedRailcards = [];
    //    for (var i = 0; i < railcards.length; i++) {
    //        var index = findWithAttr(groupedRailcards, 'name', railcards[i]);
    //        if (index > -1) {
    //            groupedRailcards[index].occurence += 1;
    //        }
    //        else {
    //            var groupRailcard = { name: railcards[i], occurence: 1 };
    //            groupedRailcards.push(groupRailcard);
    //        }
    //    }
    //    return groupedRailcards;
    //}

    var populateUngroupedRailcardPanel = function (groupedRailcards) {
        $.each(groupedRailcards, function (index, railcard) {

            $(".railcardDivST").prepend(createRailcardListItem(railcard.RailcardName, railcard.RailcardCode));

        })
    }

    //var populateGroupedRailcardPanel = function (groupedRailcards) {
    //    var columnElement = $('<div></div>').addClass('column');
    //    var viewRailcardSectionElement = $('<div></div>').addClass('view-railcard-section');
    //    var railcardVisualElement = $('<div></div>').addClass('railcard-visuals');
    //    var faIconClass = $('<i></i>').addClass('fa fa-window-maximize');
    //    var railcardTitleElement = $('<span></span>').html(" " + qttForm.railcards.length + " Railcards");
    //    var viewRailcardElement = $('<div><div>').addClass('view-railcard');
    //    var viewLinkElement = $('<a></a>').addClass('view').html('View');
    //    var viewDropDownElement = $('<div></div>').addClass('view-dropdown');
    //    railcardVisualElement.append(faIconClass).append(railcardTitleElement);
    //    viewRailcardSectionElement.append(railcardVisualElement);
    //    viewRailcardElement.append(viewLinkElement);
    //    $.each(groupedRailcards, function (index, railcard) {
    //        var displayName = $('#SelectedRailcard').children("option[value=" + railcard.name + "]").html();
    //        if (railcard.occurence > 1) {
    //            displayName = "(" + railcard.occurence + ") " + displayName;
    //        }
    //        viewDropDownElement.prepend(createRailcardListItem(displayName, railcard.name));
    //    });

    //    viewRailcardElement.append(viewDropDownElement);
    //    viewRailcardSectionElement.append(viewRailcardElement);
    //    columnElement.append(viewRailcardSectionElement);
    //    $('.railcardDiv').prepend(columnElement);
    //    $(".view-dropdown").hide();
    //}

    var bindSelectedRailcards = function () {
        $(".railcardDivST").find('.remove-railcard-section').each(function (i, obj) {
            $(obj).remove();
        });
        $(".railcardDivST").find('.view-railcard-section').each(function (i, obj) {
            $(obj).remove();
        });

        //var groupedRailcards = groupRailcards(qttForm.railcards.reverse());
        //if (qttForm.railcards.length > 4) {
        // populateGroupedRailcardPanel(groupedRailcards);
        //}
        //else {
        populateUngroupedRailcardPanel(qttForm.railcards);
        //}
    }

    //var updateRailcardAddOptions = function () {
    //    if (qttForm.getTotalPassenger() >= qttForm.numberOfRailcard) {
    //        //Add more railcard button should be disabled
    //        $('#AddRailcardBtn_ST').show();
    //    }
    //    else {
    //        //Add more railcard button should be enabled
    //        $('#AddRailcardBtn_ST').hide();
    //    }
    //}

    //var resetRailcardPopover = function () {
    //    $('#numberofRailcard').val(1);
    //    qttForm.numberOfRailcard = qttForm.railcards.length;
    //    updateRailcardAddOptions();
    //    $(".view-dropdown").hide();
    //}

    var updateRailcardAddButton = function () {
        //resetRailcardPopover();
        $('.railcardDivST .dropdown-menu').hide();
        if (qttForm.adult && qttForm.railcards.length == 0) {
            //Add more railcard button should be disabled
            $('#addRailcardText_ST').show();
        }
        else {
            //Add more railcard button should be enabled
            $('#addRailcardText_ST').hide();
        }
    }

    //var updateGroupBooking = function () {
    //    if (qttForm.getTotalPassenger() >= 10) {
    //        $('#groupBooking').show();
    //        $('#buyNowBtn_ST').prop('disabled', true);
    //        $('#LessThanZeroError').hide();
    //        $('#GroupTravel3To9Message').hide();
    //    }
    //    else {
    //        $('#groupBooking').hide();

    //    }
    //}
    //var checkLessThanZeroError = function () {
    //    if (qttForm.getTotalPassenger() <= 0) {
    //        $('#LessThanZeroError').show();
    //        $('#buyNowBtn_ST').prop('disabled', true);
    //        $('#groupBooking').hide();
    //        $('#GroupTravel3To9Message').hide();
    //    }
    //    else {
    //        $('#LessThanZeroError').hide();
    //        $('#buyNowBtn_ST').removeAttr("disabled");
    //    }
    //}
    //var checkGroupTravel3To9Passenger = function () {
    //    if (qttForm.getTotalPassenger() >= 3 && qttForm.getTotalPassenger() <= 9) {
    //        $('#GroupTravel3To9Message').show();
    //        $('#buyNowBtn_ST').removeAttr("disabled");
    //        $('#groupBooking').hide();
    //        $('#LessThanZeroError').hide();
    //    }
    //    else {
    //        $('#GroupTravel3To9Message').hide();
    //    }
    //}

    var validateDates = function (onSubmit) {
        $('.error-message.journey-dates').hide();
        var error = qttForm.validateDates();
        if (!error.valid) {
            //Show date errors
            for (var i = 0; i < error.errors.length; i++) {
                if (error.errors[i].onSubmit == onSubmit) {
                    $('#' + error.errors[i].key).first().html(error.errors[i].message);
                    $('.error-message.journey-dates').show();
                }
            }
        }
        else {

        }
    }

    var updateRailcardValidation = function (onSubmit) {
        $('.error-message.railcard').hide();
        var error = qttForm.validateRailcards();
        if (!error.valid) {
            //Show date errors
            for (var i = 0; i < error.errors.length; i++) {
                if (error.errors[i].onSubmit == onSubmit) {
                    $('#' + error.errors[i].key).first().html(error.errors[i].message);
                    $('.error-message.railcard').show();
                }
            }
        }
        else {
        }
    }
    //var ChangeArrivaldate = function () {

    //    // var Depdate = moment().format(DATE_FORMAT);
    //    var arrdate = moment(selectedDepartureDate, DATE_FORMAT).add(1, 'months').add(1, 'days').format(DATE_FORMAT);


    //    //for (var i = 0; i < newDates.length; i++) {
    //    //    if (newDates[i] == arrdate) {
    //    //        return;
    //    //    }
    //    //}
    //    var selectedOnemonth = moment(selectedDepartureDate, DATE_FORMAT).add(1, 'months').add(1, 'days');
    //    //.add(0, 'hours').minute(0);
    //    var ArrivalDateTimeToDisplay = selectedOnemonth.format("ddd DD MMM, YYYY");
    //    var setDefaultArrival = setDateTime(arrdate, selectedOnemonth);
    //    selectedArrivalDate = setDefaultArrival;
    //    qttForm.returnDate = setDefaultArrival;
    //    //qttForm.returnOption = departureType;
    //    $('#returnJourneyDateTime_ST').val(ArrivalDateTimeToDisplay);

    //}
    var DeparturedateMessage = function () {


        //var today = new Date();
        //var end14Days = new Date();
        //end14Days.setDate(today.getDate() + parseInt(minDepartDateWeb) + 14 );
        //end14Days = ut.getDateOnly(end14Days);
        //end14Days = setDateTime(end14Days,);
        //end14Days = moment(end14Days, DATETIME_FORMAT);
        //SelectedDate = moment(qttForm.departureDate, DATETIME_FORMAT);

        var end14Days = moment().add(parseInt(minDepartDateWeb) + 14, "day", DATE_FORMAT);
        var SelectedDate = moment(qttForm.departureDate, DATE_FORMAT);

        if (end14Days < SelectedDate) {
            $(".message-departureDate_ST").show();
        }
        else {
            $(".message-departureDate_ST").hide();
        }
    }

    var AddDisabledatediv_ST = function (el) {
        var date = el.parentElement.firstElementChild.textContent;
        var month = el.parentElement.parentElement.parentElement.parentElement.parentElement.firstElementChild.lastElementChild.firstElementChild.textContent;
        var year = el.parentElement.parentElement.parentElement.parentElement.parentElement.firstElementChild.lastElementChild.lastElementChild.textContent;
        var Disabledate = new Date(date + month + year);
        $.each(newDates, function (index, value) {
            var splitDates = value.Date.split("-");
            var dates = splitDates[1] + "-" + splitDates[0] + "-" + splitDates[2];
            var dateN = new Date(dates);
            var unavailabledate = value.Unavailabledatemessage;
            if (Disabledate.getTime() === dateN.getTime()) {
                if (value.ShowUnavailabledate == true && unavailabledate != "") {
                    $(".tooltip-disabldate-message_ST").append(unavailabledate);
                    $(".tooltip-disabldate-message_ST").show();
                }
                else {
                    $(".tooltip-disabldate-message_ST").hide();
                }
            }
        });
        var currentdate = moment().subtract(1, "days", DATE_FORMAT);
        var enddate = moment().add(maxDepartDateWeb, "day", DATE_FORMAT);
        if (Disabledate < currentdate) {
            if (Outdaterange.ShowPastdatemessage && Outdaterange.Pastdatemessage != "") {
                $(".tooltip-disabldate-message_ST").append(Outdaterange.Pastdatemessage);
                $(".tooltip-disabldate-message_ST").show();
            }
            else {
                $(".tooltip-disabldate-message_ST").hide();
            }
        }
        if (Disabledate > enddate) {
            if (Outdaterange.ShowFuturedatemessage && Outdaterange.Futuredatemessage != "") {
                $(".tooltip-disabldate-message_ST").append(Outdaterange.Futuredatemessage);
                $(".tooltip-disabldate-message_ST").show();
            }
            else {
                $(".tooltip-disabldate-message_ST").hide();
            }
        }

    }
    var AddToolTip_ST = function () {

        $(".ui-state-disabled").each(function () {
            var element = $(this).find(".ui-state-default")
            var element2 = $(this).find(".tooltip-checker");
            if (element.length != 0 && element2.length == 0) {

                $.each(newDates, function (index, value) {
                    var splitDates = value.Date.split("-");
                    var dates = splitDates[1] + "-" + splitDates[0] + "-" + splitDates[2];
                    var dateN = new Date(dates);

                    var month = dateN.getMonth();
                    var year = dateN.getFullYear();

                    var message = value.Disabledatemessage;

                    if ($(element).parent().parent().find("[data-month='" + month + "']").length != 0 && $(element).parent().parent().find("[data-year='" + year + "']").length != 0 && element.text() == dateN.getDate().toString()) {
                        if (value.hoverstate == true && message != "") {
                            $("<div class='tooltip-checker'>" + message + "</div>").insertAfter($(element));
                        }


                    }
                });
            }
        });
    }
    var bindEvents = function () {
        $(document).ready(function () {
            $('#tabs5').tabs();
            $('#tabs3_ST').tabs();
            $('#tabs2_ST').tabs();
            $('#tabs1_ST').tabs();
            $('#tabs7').tabs();
            $('#tabs4_ST').tabs();
            $("#tabs").tabs();
            $("#tabs").show();
            //$('#tabs-2').show();
            //$('#w-traintimes-tab-heading').show();

            $('#tabsMobile').tabs();
            $('#tabsMobile1').tabs();
            $('#tabsMobile2').tabs();
            $('#tabsMobile3').tabs();


            $("#tab-arrival-date_ST").tabs();
            //$("#mob-tabs").tabs();

            $("#specific-date-calendar_ST").datepicker({
                minDate: minDepartDateWeb,
                maxDate: maxDepartDateWeb, firstDay: 1,
                numberOfMonths: 2,
                beforeShowDay: function (date) {
                    if (newDates) {
                        var status = true;
                        for (var i = 0; i < newDates.length; i++) {
                            if (newDates[i].Date.indexOf(ut.getDateOnly(date)) > -1) {
                                status = false;
                                return [status, '',];
                            }
                        }
                        return [status, ''];
                    }
                },
                onSelect: function (date, inst) {
                    inst.inline = false;
                    selectedDepartureDate = getDateOnly(date);
                    AddToolTip_ST();
                    $('.tooltip-default-message_ST').hide();
                    $('.tooltip-disabldate-message_ST').hide();
                    $('.tooltip-enabldate-message_ST').show();
                    var _day = inst.selectedDay;
                    var _month = inst.selectedMonth;

                    var calenderBody = $('#specific-date-calendar_ST *[data-month="' + _month + '"]').parents('tbody');

                    var element = $(calenderBody).find('td').not(".ui-datepicker-other-month");
                    if (element) {
                        $('.ui-state-active').removeClass('ui-state-active');
                        $(element[_day - 1]).children().addClass('ui-state-active');
                    }

                }
            });

            $("#anytime-date-calendar1_ST").datepicker({
                minDate: "+" + minArriveDateWeb + "m" + "+" + minArriveDateWeb + "d",
                maxDate: "+" + minArriveDateWeb + "m" + "+" + minArriveDateWeb + "d" + "+" + maxArriveDateWeb + "d",
                numberOfMonths: 2, firstDay: 1,
                beforeShowDay: function (date) {
                    var m_selectedDepartureDate = selectedDepartureDate == null ? null : moment(selectedDepartureDate, DATETIME_FORMAT);
                    var m_selectedArrivalDate = selectedArrivalDate == null ? null : moment(selectedArrivalDate, DATETIME_FORMAT);
                    var m_date = moment(ut.getDateOnly(date), "DD-MM-YYYY");
                    var cssClass = '';
                    var selectable = true;
                    if (newDates) {
                        if (newDates.indexOf(ut.getDateOnly(date)) > -1) {
                            selectable = false;
                        }
                    }
                    if (m_selectedDepartureDate != null) {
                        selectable = m_date.toDate() >= m_selectedDepartureDate.toDate() && selectable;
                        if (m_selectedArrivalDate != null && m_date.toDate() >= m_selectedDepartureDate.toDate() && m_date.toDate() < m_selectedArrivalDate.toDate()) {
                            cssClass = '';
                            return [selectable, cssClass];
                        }
                        else if (m_selectedDepartureDate.format("DDMMYYYY") == m_date.format("DDMMYYYY")) {
                            cssClass = 'ui-state-active x-ui-current-selected-date';
                            selectable = true;
                        }
                        else {
                            cssClass = m_date.format("DD/MM/YYYY") == m_selectedDepartureDate.format("DD/MM/YYYY") ? 'ui-state-active' : '';
                        }
                        return [selectable, cssClass];
                    }


                    else {
                        return [selectable, '']
                    }
                },
                onSelect: function (dateText, inst) {
                    selectedArrivalDate = getDateOnly(dateText);
                    $(this).datepicker();
                }
            });

            $("#SpecfiSec1").removeAttr("tabindex");

            $('#departingFromPopup_ST').on('focus', function () {
                //$(this).css('border', '1px dotted red');
                /*$(this).blur();*/
            });

            $('#departingFromPopup_ST').keyup(function (event) {
                var keyCode = (event.keyCode ? event.keyCode : event.which);
                if (keyCode == 13) {
                    $('#departingFromPopup_ST').trigger('click');
                }
            });

            $('#arrivingToPopup_ST').on('focus', function () {
                //$(this).css('border', '1px dotted red');
                /*$(this).blur();*/
            });
            
            $('.ui-datepicker-prev').attr("tabindex", "0");
            $('.ui-datepicker-next').attr("tabindex", "0");
            $(".ui-datepicker-next").attr("data-title", "Next");
            $(".ui-datepicker-prev").attr("data-title", "Prev");


            $(document).on('click', ".ui-datepicker-next", function () {

                $(".ui-datepicker-next").removeAttr("title");
                $(".ui-datepicker-prev").removeAttr("title");
                $(".ui-datepicker-next").attr("data-title", "Next");
                $('.ui-datepicker-next').attr('tabindex', '0');
                $('.ui-datepicker-prev').attr('tabindex', '0');
                $(".ui-datepicker-prev").attr("data-title", "Prev");
                AddNextprevbtnmsg();

                AddToolTip_ST();
            });

            $(document).on('click', ".ui-datepicker-prev", function () {


                $(".ui-datepicker-prev").removeAttr("title");
                $(".ui-datepicker-next").removeAttr("title");
                $(".ui-datepicker-prev").attr("data-title", "Prev");
                $(".ui-datepicker-next").attr("data-title", "Next");
                $('.ui-datepicker-next').attr('tabindex', '0');
                $('.ui-datepicker-prev').attr('tabindex', '0');
                AddNextprevbtnmsg();

                AddToolTip_ST();
            });

            var AddNextprevbtnmsg = function () {

                var Elementnext = $(".ui-datepicker-next").attr("data-title");
                var Elementprev = $(".ui-datepicker-prev").attr("data-title");

                //$("div.div__after").remove();
                //$("div.div__after1").remove();


                $(".ui-datepicker-next").after("<div class='ui-datepicker-next-title div_after nextui'>" + Elementnext + "</div>");
                $(".ui-datepicker-prev").after("<div class='ui-datepicker-prev-title div_after1 prevui'>" + Elementprev + "</div>");

                $(".div_after").hide();
                $(".div_after1").hide();


            }

            $(document).on('keydown', ".ui-datepicker-prev", function (e) {
                if (e.which == 13) {
                    if (!$(".div_after1").hasClass("prevui")) {
                        $(".div_after1").addClass("prevui");
                    }
                    //$(".ui-datepicker-prev").after("<div class='ui-datepicker-prev-title div__after1 prevui'> </div>");
                    $(this).trigger("click");
                }


            });



            $(document).on('keydown', ".ui-datepicker-next", function (e) {
                if (e.which == 13) {
                    if (!$(".div_after").hasClass("nextui")) {
                        $(".div_after").addClass("nextui");
                    }

                    /* $(".ui-datepicker-next").after("<div class='ui-datepicker-next-title div__after nextui'> </div>");*/
                    $(this).trigger("click");
                }


            });

            $(document).on('mouseout', " .ui-datepicker-next", function () {
                $(".ui-datepicker-next-title").css("display", "none");
            });
            $(document).on('mouseover', ".ui-datepicker-next", function () {
                $(".ui-datepicker-next-title").css("display", "block");
            });

            $(document).on('mouseout', " .ui-datepicker-prev", function () {
                $(".ui-datepicker-prev-title").css("display", "none");
            });
            $(document).on('mouseover', ".ui-datepicker-prev", function () {
                $(".ui-datepicker-prev-title").css("display", "block");
            });

            $('#close_depart_model_STime').keyup(function (event) {
                var keyCode = (event.keyCode ? event.keyCode : event.which);
                if (keyCode == 13) {
                    $('#departureDatePopup_tt').hide();
                }

            });

            $('#arrivingToPopup_ST').keyup(function (event) {
                var keyCode = (event.keyCode ? event.keyCode : event.which);
                if (keyCode == 13) {
                    $('#arrivingToPopup_ST').trigger('click');
                }
            });

            $('#Removebtn').on('focus', function () {
                //$(this).css('border', '1px dotted red');
                /*$(this).blur();*/
            });

            $(document).on('keypress','a.remove-railcard-btn',function (event) {
               
                var keyCode = (event.keyCode ? event.keyCode : event.which);
                if (keyCode == 13) {
                   
                    /*$(document).on('click', '.desktop-qtt a.remove-railcard-btn', function () {*/
                        var code = $(this).attr('ref-code');
                        removeRailcard(code);
                        bindSelectedRailcards();
                        updateRailcardAddButton();
                        updateRailcardValidation();
                  /*  })*/
                   
                }
            });


            

            //$('#departureJourneyDateTime_ST').on('focus', function () {
            //    //$(this).css('border', '1px dotted red');
            //    /*$(this).blur();*/
            //});

            //$('#departureJourneyDateTime_ST').keyup(function (event) {
            //    var keyCode = (event.keyCode ? event.keyCode : event.which);
            //    if (keyCode == 13) {
            //        $('#departureJourneyDateTime_ST').trigger('click');
            //    }
            //});

            $('#returnJourneyDateTime_ST').on('focus', function () {
                //$(this).css('border', '1px dotted red');
                /*$(this).blur();*/
            });

            $('#returnJourneyDateTime_ST').keyup(function (event) {
                var keyCode = (event.keyCode ? event.keyCode : event.which);
                if (keyCode == 13) {
                    $('#returnJourneyDateTime_ST').trigger('click');
                }
            });


            $('#addRailcardText_ST').on('focus', function () {
                //$(this).css('border', '1px dotted red');
                /*$(this).blur();*/
            });

            $('#addRailcardText_ST').keyup(function (event) {
                var keyCode = (event.keyCode ? event.keyCode : event.which);
                if (keyCode == 13) {
                    $('#addRailcardText_ST').trigger('click');
                }
            });


            


            $("#adult_ST input[name='a']").on('focus', function () {
                //$(this).css('border', '3px dotted black');
                /*$(this).blur();*/
            });

           



            //$('#departingFromPopup_ST').on('focus', function () {
            //    $(this).blur();
            //});
            //$('#arrivingToPopup_ST').on('focus', function () {
            //    $(this).blur();
            //});
            //$("#departureJourneyDateTime_ST").on('focus', function () {
            //    $(this).blur();
            //});
            //$("#returnJourneyDateTime_ST").on('focus', function () {
            //    $(this).blur();
            //});
            $('#numberofAdults').on('focus', function () {
                $(this).blur();
            });
            $('#numberofChildren').on('focus', function () {
                $(this).blur();
            });
            $('#numberofRailcard').on('focus', function () {
                $(this).blur();
            });
            $('.specific-date-time-selector').on('click', function () {
                datePrefixSelection(this);
            })
            $('.today-time-selector').on('click', function () {
                datePrefixSelection(this);
            })
            $('.tomorrow-time-selector').on('click', function () {
                datePrefixSelection(this);
            })
            //$(".view").click(function () {
            //    $(".view-dropdown").toggle(500);
            //});
            $(document).on('mouseout', ".ui-state-default", function () {
                $(this).next().css("display", "none");
            });
            $(document).on('mouseover', ".ui-state-default", function () {
                $(this).next().css("display", "block");
            });
            $(document).on('click', ".ui-state-disabled .ui-state-default", function () {
                $(".tooltip-disabldate-message_ST").empty();
                $('.tooltip-default-message_ST').hide();
                $('.tooltip-enabldate-message_ST').hide();
                AddDisabledatediv_ST(this);
            });
            $(document).on('click', ".ui-datepicker-next", function () {
                AddToolTip_ST();
            });
            $(document).on('click', ".ui-datepicker-prev", function () {
                AddToolTip_ST();
            });
            $('[data-modal-close]').on('click', function () {
                var modalId = $(this).data('modal-close');
                $('#' + modalId).modal('hide');
            })

            $('#departingFromPopup_ST').on('click', function () {
                $('#departingFrom_ST').val("").trigger('keyup');
                $('#DepartPopup_ST').modal('show');
                $('#departingFrom_ST').focus();
                $('#departingFrom_ST').keydown(function (objEvent) {
                    if (objEvent.keyCode == 9) {
                        objEvent.preventDefault();
                    }
                })
            });

            //For Custom Option
            $('#custom_ST input').on('change', function () {
                if ($(this).prop("checked") == true) {
                    $("#returndatetime_ST").show();
                    qttForm.custom = $(this).prop("checked");

                }
                else if ($(this).prop("checked") == false) {
                    $("#returndatetime_ST").hide();
                    qttForm.custom = $(this).prop("checked");
                }
            });
            $('#annual_ST input').on('change', function () {
                qttForm.annual = $(this).prop("checked");
            });
            $('#monthly_ST input').on('change', function () {
                qttForm.monthly = $(this).prop("checked");
            });
            $('#weekly_ST input').on('change', function () {
                qttForm.weekly = $(this).prop("checked");
            });


            $('#arrivingToPopup_ST').on('click', function () {

                $('#arrivingTo_ST').val("").trigger('keyup');
                $('#ArrivalPopup_ST').modal('show');
                $('#arrivingTo_ST').focus();
                $('#arrivingTo_ST').keydown(function (objEvent) {
                    if (objEvent.keyCode == 9) {
                        objEvent.preventDefault();
                    }
                })
            });
            $('.w_arrive_date_ST').on('click', function () {
                var selectedTab = $('#tab-arrival-date_ST').tabs('option', 'active');
                var selectedTab = 2;
                var date = new Date();
                var timetype;
                switch (selectedTab) {
                    case 0: {
                        //Today
                        selectedArrivalDate = ut.getDateOnly(date);
                        break;
                    }
                    case 1: {
                        //Tomorrow
                        selectedArrivalDate = ut.addDaysInDate(date, 1);
                        break;
                    }
                    default: {
                        //Specific Date
                        if (selectedArrivalDate == null) {
                            selectedArrivalDate = ut.getDateOnly(date);
                        }
                        break;
                    }
                }
                var selectedTime = $('#w_arr_time_index_ST_' + selectedTab).val();
                selectedArrivalDate = setDateTime(selectedArrivalDate, selectedTime);
                timetype = $('#w_arr_btns_index_ST_' + selectedTab + " > .active").data("j-time");
                qttForm.returnDate = selectedArrivalDate;
                qttForm.returnOption = timetype;
                qttForm.journeyType = 'Return';
                $('#returnJourneyDateTime_ST').val(moment(selectedArrivalDate, DATETIME_FORMAT).format("ddd DD MMM, YYYY"));
                $('#returnJourneyPopup_ST').modal('hide');
                $("#anytime-date-calendar1_ST").datepicker('setDate', moment(selectedArrivalDate, DATETIME_FORMAT).toDate());
                refreshDatePickers();
                validateDates(false);
            })
            $('.w_depart_date_ST').on('click', function () {
                
                var selectedTab = $('#tabs1_ST').tabs('option', 'active');
                selectedTab = 2;
                var date = new Date();
                var timetype;
                switch (selectedTab) {
                    case 0: {
                        //Today
                        selectedDepartureDate = ut.getDateOnly(date);
                        break;
                    }
                    case 1: {
                        //Tomorrow
                        selectedDepartureDate = ut.addDaysInDate(date, 1);
                        break;
                    }
                    default: {
                        //Specific Date
                        if (selectedDepartureDate == null) {
                            selectedDepartureDate = ut.getDateOnly(date);
                        }
                        break;
                    }
                }
                var selectedTime = $('#w_dep_time_index_ST_' + selectedTab).val();
                selectedDepartureDate = setDateTime(selectedDepartureDate, selectedTime);

                //if (selectedDepartureDate != qttForm.departureDate) {
                //    ChangeArrivaldate();
                //}
                timetype = $('#w_dep_btns_index_ST_' + selectedTab + " > .active").data("j-time");
                qttForm.departureDate = selectedDepartureDate;

                qttForm.departureOption = timetype;
                $('#departureJourneyDateTime_ST').val(moment(selectedDepartureDate, DATE_FORMAT).format("ddd DD MMM, YYYY"));
                $('#departureDatePopup_ST').modal('hide');
                $("#anytime-date-calendar1_ST").datepicker('option', 'minDate', moment(selectedDepartureDate, DATE_FORMAT).add(1, 'month').add(1, 'day').toDate());
                $("#specific-date-calendar_ST").datepicker('setDate', moment(selectedDepartureDate, DATETIME_FORMAT).toDate());
                refreshDatePickers();
                validateDates(false);
                qttForm.ValidateDepartureDate();
                DeparturedateMessage();
            })

            $('.w_open_return_ST').on('click', function () {
                $('#returnJourneyDateTime_ST').val('Open Return');
                qttForm.journeyType = 'OpenReturn';
                $('#returnJourneyPopup_ST').modal('hide');

            });

            $("#departureJourneyDateTime_ST").on('click', function () { //initializing elements such as date time
                $(".tooltip-disabldate-message_ST").hide();
               
                $('.ui-datepicker-prev').attr("tabindex", "0");
                $('.ui-datepicker-next').attr("tabindex", "0");
                $(".ui-datepicker-next").attr("data-title", "Next");
                $(".ui-datepicker-prev").attr("data-title", "Prev");
                $(".ui-datepicker-next").removeAttr("title");
                $(".ui-datepicker-prev").removeAttr("title");

                $('.tooltip-default-message_ST').show();
                $('.tooltip-enabldate-message_ST').hide();
                var times = buildTimeData();
                $('.depart-time-form select').empty();
                for (var i = 0; i < times.length; i++) {
                    var option = $('<option></option>');
                    option.attr("value", times[i]).html(times[i]);
                    $('.depart-time-form select').append($(option));
                }
                if (selectedDepartureDate != null) {
                    $('.depart-time-form select').val(moment(selectedDepartureDate, DATETIME_FORMAT).format(TIME_FORMAT));
                }
                else {
                    var defaultSelectedDepTime = moment().add(0, 'days').add(1, 'hours').minute(0);

                    $('.depart-time-form select').val(defaultSelectedDepTime.format(TIME_FORMAT));
                }
                var date = new Date();
                for (i = 0; i < newDates.length; i++) {
                    if (newDates[i] == ut.getDateOnly(date)) {
                        $('#w_depart_date_ST_0 .w_depart_date_ST').prop("disabled", true);
                        $('#disableTodayDateMessage').show();
                    }
                    if (newDates[i] == ut.addDaysInDate(date, 1)) {
                        $('#w_depart_date_ST_1 .w_depart_date_ST').prop("disabled", true);
                        $('#disableTomDateMessage').show();
                    }
                }
                AddNextprevbtnmsg();
                $('#departureDatePopup_ST').modal('show');
                AddToolTip_ST();
            });
            $("#returnJourneyDateTime_ST").on('click', function () {
                $('.arrive-time-form select').empty();
                var times = buildTimeData();
                for (var i = 0; i < times.length; i++) {
                    var option = $('<option></option>');
                    option.attr("value", times[i]).html(times[i]);
                    $('.arrive-time-form select').append($(option));
                }
                //var defaultSelectedArrTime = defaultSelectedDepTime.clone().add(2, 'hours');
                if (selectedArrivalDate != null) {
                    $('.arrive-time-form select').val(moment(selectedArrivalDate, DATETIME_FORMAT).format(TIME_FORMAT))
                }
                else {
                    var defaultSelectedDepTime = moment().add(0, 'days').add(2, 'hours').minute(0);
                    var defaultSelectedArrTime = defaultSelectedDepTime.clone().add(2, 'hours');
                    $('.arrive-time-form select').val(defaultSelectedArrTime.format(TIME_FORMAT))
                }
                var date = new Date();
                for (var i = 0; i < newDates.length; i++) {
                    if (newDates[i] == ut.getDateOnly(date)) {
                        $('#w_arrive_date_0 .w_arrive_date').prop("disabled", true);
                        $('#disableTodayReturnDateMessage').show();
                    }
                    if (newDates[i] == ut.addDaysInDate(date, 1)) {
                        $('#w_arrive_date_1 .w_arrive_date').prop("disabled", true);
                        $('#disableTomReturnDateMessage').show()
                    }
                }

                $('#returnJourneyPopup_ST').modal('show');

            });
            $("#departingFrom_ST").on('keyup', function (e) {
                var searchField = $(this).val();
                bindStationKeyUpEvents('depart', searchField);
                if (e.keyCode === 13) {
                    var firstStation = $('.return-stations.depart.ST').first();
                    $(firstStation).click();
                }
                else {
                    var firstStation = $('.return-stations.depart.ST').first();
                    $(firstStation).removeClass('focused');
                    $(firstStation).addClass('focused');
                }

            });
            $("#arrivingTo_ST").on('keyup', function (e) {
                var searchField = $(this).val();
                bindStationKeyUpEvents('arrive', searchField);
                if (e.keyCode === 13) {
                    var firstStation = $('.return-stations.arrive.ST').first();
                    $(firstStation).click();
                }
                else {
                    var firstStation = $('.return-stations.arrive.ST').first();
                    $(firstStation).removeClass('focused');
                    $(firstStation).addClass('focused');
                }
            })
            $(document).on('click', "#DepartPopup_ST div.depart", function () {
                var stationCode = $(this).attr('departcrsdatabind');
                var stationName = $(this).children('div.return-station-name').text();

                if (stationCode != null && stationCode != '') {
                    qttForm.departureStation = stationName;
                    qttForm.departureStationCRSCode = stationCode;
                    $("#departingFrom_ST").val(stationName);
                    $('#departingFromPopup_ST').val(stationName);
                    $('#DepartPopup_ST').modal('hide');
                    qttForm.ValidateDepartureStation();
                    $('#departingFromPopup_ST').focus();
                }
            });

            // Departure Station selection from search and binding ends here
            $(document).on('click', "#ArrivalPopup_ST div.arrive", function () {
                var stationCode = $(this).attr('arrivecrsdatabind');
                var stationName = $(this).children('div.return-station-name').text();
                if (stationCode != null && stationCode != '') {
                    qttForm.arrivalStation = stationName;
                    qttForm.arrivalStationCRSCode = stationCode;
                    $("#arrivingTo_ST").val(stationName);
                    $('#arrivingToPopup_ST').val(stationName);
                    $('#ArrivalPopup_ST').modal('hide');
                    qttForm.ValidateArrivalStation();
                    $('#arrivingToPopup_ST').focus();
                }
            });
            //swapping station functionality
            $('#SwapStation_ST').on('click', function () {
                if ((!qttForm.arrivalStation) || (!qttForm.departureStation)) {
                    return;
                }
                else {
                    var currArr = qttForm.arrivalStation;
                    var currDep = qttForm.departureStation;
                    var currArrCode = qttForm.arrivalStationCRSCode;
                    var currDepCode = qttForm.departureStationCRSCode;

                    qttForm.arrivalStationCRSCode = currDepCode;
                    qttForm.departureStationCRSCode = currArrCode;
                    qttForm.arrivalStation = currDep;
                    qttForm.departureStation = currArr;
                    $('#arrivingToPopup_ST').val(qttForm.arrivalStation);
                    $('#departingFromPopup_ST').val(qttForm.departureStation);
                }

            });
            //number of adults
            //$("#adult_ST input[name='a']").attr('checked', 'checked')

            if ($("#adult_ST input[name='a']").prop("checked", true)) {
                qttForm.adult = true;
               
                $('#addRailcardText_ST').show();
            }
            $("#adult_ST input[name='a']").on("click", function () {

                qttForm.adult = true;
                qttForm.child = false;
                $('#addRailcardText_ST').show();
            });
            //number of child
            $("#child_ST input[name='a']").on("click", function () {

                qttForm.adult = false;
                qttForm.child = true;
                $('.dropdown-menu').hide();
                $('#addRailcardText_ST').hide();
                qttForm.railcards.splice(0, 1);
                bindSelectedRailcards();
            });



            $('#child_ST').keydown(function (event) {

                var adult = document.getElementById("adultstnew");
                var child = document.getElementById("childstnew");


                // 9 represents the tab keycode of the document keydown event. 

                event.preventDefault(); // this prevents the tab from doing its default action.

                if (event.keyCode == 9 && adult.checked == false && child.checked == false) {
                    adult.checked = true; // This checks the radio option.
                }
                else if (event.keyCode == 9 && adult.checked == true) {
                    child.checked = true;
                    adult.checked == false;
                }
                else if (event.keyCode == 9 && child.checked == true) {
                    adult.checked = true;
                    child.checked == true;
                }


                adult.blur();
                child.blur();
            });











            $('#AddRailcardBtn_ST').on('click', function () {
                var railcardcode = $('#selectrailcard_ST').val();
                var railcardname = $('#selectrailcard_ST :selected').html();
                addRailcard(railcardcode, railcardname);
                bindSelectedRailcards();
                checkRailcard();
                bindRailcards();
                //if (qttForm.railcards.length >= 1) {
                //    $('#addRailcardText_ST').html("+ Add another railcard");
                //}
                //else if (qttForm.railcards.length < 1) {


                //    $('#addRailcardText_ST').html("+ Add railcard");
                //}
            });

            $(document).on('click', '.desktop-qtt a.remove-railcard-btn', function () {
                var code = $(this).attr('ref-code');
                removeRailcard(code);
                bindSelectedRailcards();
                updateRailcardAddButton();
                updateRailcardValidation();
            })
            $("#addRailcardText_ST").click(function () {
                $(".dropdown-menu.seasonTRC").toggle(500);
                setTimeout(function () {
                    //resetRailcardPopover();
                }, 500)
            });
            //$(document).on('click', '.view-railcard .view', function () {
            //    $(".view-dropdown").toggle(500);
            //})
            //Buy ticket binding
            $('#buyNowBtn_ST').on('click', function () {
                submitted = true;
                var validationResult = qttForm.Validate();
                setTimeout(function () {
                    ticketingService.sendDataNewQTT(qttForm);
                }, 500);
                //  showErrorMessage();
                if (validationResult.valid) {
                    //var urltest = "https://www.buytickets.avantiwestcoast.co.uk/datapassedin.aspx";

                    //ut.handOffDekstop(qttForm, entryDataContext.WebtisBookingEngineUrl);

                    document.cookie = 'LeavingFrom=' + qttForm.departureStation;
                    document.cookie = 'LeavingFromCode=' + qttForm.departureStationCRSCode;
                    document.cookie = 'GoingTo=' + qttForm.arrivalStation;
                    document.cookie = 'GoingToCode=' + qttForm.arrivalStationCRSCode;
                    ut.handOffDekstop(qttForm, entryDataContext.PICOWebtisEngineUrl);
                    $('.desktop-qtt form').trigger('reset');
                }
                else {
                    //Handle errors
                    // alert("There are some validation errors");
                }
            });
        })
        //disabling the inputs

    };

    //init();
    return {
        init: init
    }


});
define('customJS/SeasonTicketMobileModule', ['jquery', 'jqueryui', 'customJS/SeasonTicketViewModel', 'json!mock/SeasonTicketRailcard.json', 'context', 'moment', 'dataService', 'customJS/SeasonTicketUtility', 'ticketingService'], function ($, jqueryUi, QttFormVM, seasonTicketRailcard, context, moment, dataService, Utility_ST, ticketingService) {

    var disableDates = entryDataContext.DateSetting;
    var Outdaterange = entryDataContext.DateSettingFordisabledate;
    var selectedDepartureDate = null, selectedArrivalDate = null;
    var selectedNumberOfRailcard = 0;
    var ut = Utility_ST;
    var DATETIME_FORMAT = "DD-MM-YYYY HH:mm", DATE_FORMAT = "DD-MM-YYYY", TIME_FORMAT = "HH:mm", m_DISPLAY_DATE_TIME_FORMAT_ST = "ddd DD MMM, YYYY";
    var qttForm = new QttFormVM.Seasonticket();
    var PopularStations = [];//entryDataContext.PopularStationsForHomeQtt;
    var submitted = false;
    var maxDepartDate = Outdaterange.SeasonTicketDepartureMaxDate;
    var minDepartDate = Outdaterange.SeasonTicketDepartureMinDate;
    var maxArriveDate = Outdaterange.SeasonTicketArrivalMaxDate;
    var minArriveDate = Outdaterange.SeasonTicketArrivalMinDate;
    var allstations = [];
    var FavouriteStation = [];
    var backupQttForm = null;

    var newDates = [];


    function GetFormattedDate(date) {
        return moment.utc(date).format(DATE_FORMAT);
    }
    for (var i = 0; i < disableDates.length; i++) {
        var date = GetFormattedDate(disableDates[i].Date);
        newDates.push({ "Date": date, "Disabledatemessage": disableDates[i].Disabledatehoverstatemessage, "hoverstate": disableDates[i].Addhoverstate, "Unavailabledatemessage": disableDates[i].Unavailabledatemessage, "ShowUnavailabledate": disableDates[i].ShowUnavailabledatemessage });
    }

    var init = function (stations) {
        allstations = stations;
        bindEvents();
        bindRailcards();
        defaultDepartureDate();
        getStationbyCookie();
        showDefaultPassenger();
        setPopularAndFavouriteStation();
    };
    var setPopularAndFavouriteStation = function () {

        FavouriteStation = ut.getFavouriteStationForPICO(allstations);
        PopularStations = ut.getPopularStationForPICO(allstations);
        PopularStations = ut.disjointPopularAndFavouriteStation(PopularStations, FavouriteStation);
        setPopularStation();
        setFavouriteStation();
    }
    var setPopularStation = function () {
        if (PopularStations.length != 0) {
            fillPopularStationList();
        }
    }
    var setFavouriteStation = function () {

        if (FavouriteStation.length != 0) {
            $('#m_departFavouriteStationHeading_ST').show();
            $('#m_arriveFavouriteStationHeading_ST').show();
            FillFavouriteStationList();
        }
        else {
            $('#m_departFavouriteStationHeading_ST').hide();
            $('#m_arriveFavouriteStationHeading_ST').hide();
        }

    }
    var bindFavouriteStations = function (journeyType, stationName, stationCode) {
        if (stationCode != undefined && stationCode != "") {
            var columnElement = getStationColumns(journeyType, stationName, stationCode);
            if (journeyType == "depart") {
                $("#m-departing-favourite-stations_ST").append(columnElement);
            }
            else {
                $("#m-arriving-favourite-stations_ST").append(columnElement);
            }
        }


    }
    var FillFavouriteStationList = function () {
        //Favourite station list 
        clearPopularStations('depart');
        clearMoreStations('arrive');
        clearFavouriteStations('depart');
        manageStationHeading($('#departMoreStationHeading_ST'), null);
        manageStationHeading($('#arriveMoreStationHeading'), null);
        // manageStationHeading($('#departFavouriteStationHeading_ST'), null);
        //manageStationHeading($('#arriveFavouriteStationHeading_ST'), null);
        for (var i = 0; i < FavouriteStation.length; i++) {
            bindFavouriteStations('depart', FavouriteStation[i].Name, FavouriteStation[i].CRS);
            bindFavouriteStations('arrive', FavouriteStation[i].Name, FavouriteStation[i].CRS);

        }

    };
    var showDefaultPassenger = function () {
        var DefaultPassengerInfo = qttForm.numberOfAdults + ' Adults, ' + qttForm.numberOfRailcard + ' Railcards';
        $('#peopleandRailCards').val(DefaultPassengerInfo);

    }

    var getStationbyCookie = function () {
        var x = document.cookie.split(";");
        for (i = 0; i < x.length; i++) {
            var cookiepair = x[i].split("=");
            if ('LeavingFrom' == cookiepair[0].trim()) {
                qttForm.departureStation = decodeURIComponent(cookiepair[1]);
                $('#m_txt_departure_station_ST').val(qttForm.departureStation);
            }
            if ('LeavingFromCode' == cookiepair[0].trim()) {
                qttForm.departureStationCRSCode = decodeURIComponent(cookiepair[1]);

            }
            if ('GoingTo' == cookiepair[0].trim()) {
                qttForm.arrivalStation = decodeURIComponent(cookiepair[1]);
                $('#m_txt_arrival_station_ST').val(qttForm.arrivalStation);
            }
            if ('GoingToCode' == cookiepair[0].trim()) {
                qttForm.arrivalStationCRSCode = decodeURIComponent(cookiepair[1]);

            }
        }

    }

    var defaultDepartureDate = function () {

        var Depdate = moment().format(DATE_FORMAT);
        var arrdate = moment().add(1, 'months').add(1, 'days').format(DATE_FORMAT);

        for (var i = 0; i < newDates.length; i++) {
            if (newDates[i] == Depdate) {
                return;
            }
        }
        for (var i = 0; i < newDates.length; i++) {
            if (newDates[i] == arrdate) {
                return;
            }
        }

        var departureType = 'D';
        var selectedTimeOneHour = moment().add(0, 'days');
        //.add(1, 'hours').minute(0);
        var DateTimeToDisplay = selectedTimeOneHour.format(m_DISPLAY_DATE_TIME_FORMAT_ST);
        var setDefaultDepat = setDateTime(Depdate, selectedTimeOneHour);
        selectedDepartureDate = setDefaultDepat;
        qttForm.departureDate = setDefaultDepat;
        qttForm.departureOption = departureType;
        $('#m_txt_departure_date_ST').val(DateTimeToDisplay);
        $('.m_tooltip-default-message_ST').show();

        // ArrivalDefaultdate

        var selectedOnemonth = moment().add(1, 'months').add(1, 'days');
        //.add(0, 'hours').minute(0);
        var ArrivalDateTimeToDisplay = selectedOnemonth.format(m_DISPLAY_DATE_TIME_FORMAT_ST);
        var setDefaultArrival = setDateTime(arrdate, selectedOnemonth);
        selectedArrivalDate = setDefaultArrival;
        qttForm.returnDate = setDefaultArrival;
        qttForm.returnOption = departureType;
        $('#m_txt_arrival_date_ST').val(ArrivalDateTimeToDisplay);



    }

    var bindRailcards = function () {
        $('#m_Selectrailcard_ST').empty();
        $('#m_Selectrailcard_ST').append("<option value='' selected minadults='0' maxadults='0'>--Select-- </option>");
        //var dummyselect = "<option disabled>choose a railcard</option>";
        //$('#m_Selectrailcard_ST').append(dummyselect);
        $.each(seasonTicketRailcard.data, function (index, railcard) {
            var railcardOption = $('<option></option>');
            railcardOption.val(railcard.railcardcode);
            railcardOption.html(railcard.railcarddescription);
            railcardOption.attr('position', index);
            $('#m_Selectrailcard_ST').append(railcardOption);
        });


    }

    var getStationColumns = function (journeyType, stationName, stationCode) {
        var disabled = false;
        if (journeyType == 'depart') {
            disabled = qttForm.arrivalStation != null && stationName == qttForm.arrivalStation;
        }
        else {
            disabled = qttForm.departureStation != null && stationName == qttForm.departureStation;
        }
        var valueAttribute = journeyType == 'depart' ? 'departcrsdatabind' : 'arrivecrsdatabind';
        var columnElement = $('<div></div>').addClass('column');
        var stationElement = $('<div></div>').addClass('return-stations ' + journeyType).attr(valueAttribute, stationCode);
        if (disabled)
            stationElement.addClass('station-disabled').removeAttr(valueAttribute);
        var stationNameElement = $('<div></div>').addClass('return-station-name').html(stationName);
        var stationCodeElement = $('<div></div>').addClass('return-station-shortcode').html();//.html(stationCode);
        stationElement.append(stationNameElement).append(stationCodeElement);
        columnElement.append(stationElement);
        return columnElement;
    }

    var bindPopularStations = function (journeyType, stationName, stationCode) {
        if (stationCode != undefined && stationCode != '') {
            var columnElement = getStationColumns(journeyType, stationName, stationCode);
            if (journeyType == "depart") {
                $("#m-departing-popular-stations_ST").append(columnElement);
            }
            else {
                $("#m-arriving-popular-stations_ST").append(columnElement);
            }
        }
    }

    var clearMoreStations = function (journeyType) {
        if (journeyType == "arrive") {
            $("#m-arriving-popular-stations_ST").empty();
        }
        else {
            $("#m-departing-popular-stations_ST").empty();
        }
    }

    var clearPopularStations = function (journeyType) {
        if (journeyType == "arrive") {
            $('#m_filtersearchArrival_ST').empty();
        }
        else {
            $('#m_filtersearchDeparture_ST').empty();
        }
    }
    var clearFavouriteStations = function (journeyType) {

        if (journeyType == "arrive") {
            $("#m-arriving-favourite-stations_ST").empty();
        }
        else {
            $('#m-departing-favourite-stations_ST').empty();

        }
    }
    var bindAllStations = function (journeyType, stationName, stationCode) {

        var columnElement = getStationColumns(journeyType, stationName, stationCode);
        if (journeyType == "depart") {
            $('#m_filtersearchDeparture_ST').append(columnElement);
        }
        else {
            $('#m_filtersearchArrival_ST').append(columnElement);
        }
    }

    var bindStationKeyUpEvents = function (journeyType, searchField) {
        var popularHeadingElement, moreHeadingElement, FavouriteHeadingElement;
        if (journeyType == "arrive") {
            FavouriteHeadingElement = $('#m_arriveFavouriteStationHeading_ST');
            popularHeadingElement = $('#m_arrivePopularStationHeading_ST');
            moreHeadingElement = $('#m_arriveMoreStationHeading_ST');
        }
        else {
            FavouriteHeadingElement = $('#m_departFavouriteStationHeading_ST');
            popularHeadingElement = $('#m_departPopularStationHeading_ST');
            moreHeadingElement = $('#m_departMoreStationHeading_ST');
        }
        clearPopularStations(journeyType);
        clearMoreStations(journeyType);
        clearFavouriteStations(journeyType);
        if (searchField.length > 2) {
            //load favourite station which are filtered
            var filteredFavouriteStations = filterStations(FavouriteStation, searchField);
            $.each(filteredFavouriteStations, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            //Load popular stations which are filtered
            var filteredPopularStations = filterStations(PopularStations, searchField);
            $.each(filteredPopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
            });
            //Load more stations
            var filteredStations = filterStations(allstations, searchField);
            $.each(filteredStations, function (index, station) {
                bindAllStations(journeyType, station.Name, station.CrsCode);
            });
            manageStationHeading(FavouriteHeadingElement, filteredFavouriteStations);
            manageStationHeading(popularHeadingElement, filteredPopularStations);
            manageStationHeading(moreHeadingElement, filteredStations);
        }
        else if (searchField.length == 0) {
            //filter favourite stations
            $.each(FavouriteStation, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            //filter popular stations
            $.each(PopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
            });
            manageStationHeading(FavouriteHeadingElement, FavouriteStation);
            manageStationHeading(popularHeadingElement, PopularStations);
            manageStationHeading(moreHeadingElement, null);
        }
        else {
            //Load Favourite stations which are filtered
            var filteredFavouriteStations = filterStations(FavouriteStation, searchField);
            $.each(filteredFavouriteStations, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            //Load popular stations which are filtered
            var filteredPopularStations = filterStations(PopularStations, searchField);
            $.each(filteredPopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
            });
            //clearMoreStations();
            manageStationHeading(FavouriteHeadingElement, filteredFavouriteStations);
            manageStationHeading(popularHeadingElement, filteredPopularStations);
            manageStationHeading(moreHeadingElement, null);
        }
    }

    var manageStationHeading = function (element, stations) {
        if (stations != null && stations.length > 0)
            element.show();
        else
            element.hide();
    }

    var filterStations = function (stations, searchText) {
        var filteredStations = [];
        for (var i = 0; i < stations.length; i++) {
            if (stations[i].Name.toLowerCase().indexOf(searchText.toLowerCase()) > -1) {
                filteredStations.push(stations[i]);
            }
            else {
                continue;
            }
        }
        return filteredStations;
    }

    var datePrefixSelection = function (element) {
        var currentTab = $(element).closest('.ui-widget-content');
        $(currentTab).find('.mobile-departby-radio').removeClass('active');
        setTimeout(function () {
            $(element).addClass('active');
        }, 100)
    }

    var fillPopularStationList = function () {
        //Popular station list 
        clearPopularStations('depart');
        clearMoreStations('arrive');

        manageStationHeading($('#departMoreStationHeading'), null);
        manageStationHeading($('#departMoreStationHeading'), null);
        manageStationHeading($('#arriveMoreStationHeading'), null);
        manageStationHeading($('#arriveMoreStationHeading'), null);

        for (var i = 0; i < PopularStations.length; i++) {
            bindPopularStations('depart', PopularStations[i].Name, PopularStations[i].CRS);
            bindPopularStations('arrive', PopularStations[i].Name, PopularStations[i].CRS);

        }
    };

    var groupBooking = function () {
        var passenger = qttForm.getTotalPassenger();
        if (passenger >= 10) {
            $('#groupBooking').show();
        }
        else {
            $('#groupBooking').hide();
        }
    }

    var padLeft = function (nr, n, str) {
        return Array(n - String(nr).length + 1).join(str || '0') + nr;
    }

    var buildTimeData = function () {
        var i = 0, j = 0, times = [];
        while (i < 24) {
            if (j == 0) {
                var time = padLeft(i, 2) + ":" + padLeft(j, 2);
                times.push(time);
                j += 30;
                continue;
            }
            else {
                var time = padLeft(i, 2) + ":" + padLeft(j, 2);
                times.push(time);
                j = 0;
                i += 1;
                continue;
            }
        }
        return times;
    }

    var departureDateSelected = function (date) {
        qttForm.departureDate = date;
    }

    var arrivalDateSelected = function (date) {
        qttForm.returnDate = date;
    }

    var getDateOnly = function (date) {
        date = new Date(date);
        return ut.getDateOnly(date);
    }

    var setDateTime = function (date, time) {
        date = moment.utc(date, DATE_FORMAT),
            time = moment(time, 'HH:mm');

        date.set({
            hour: time.get('hour'),
            minute: time.get('minute'),
            second: time.get('second')
        });

        return date.format(DATETIME_FORMAT);
    }

    var refreshDatePickers = function () {
        $('#m_anytime-date-calendar_ST').datepicker('refresh');
        $('#m_specific-date-calendar_ST').datepicker('refresh');
    }

    var checkRailcard = function () {
        if (qttForm.validateRailcards().valid) {
            $('#addRailcardText').show();
        }
        else
            $('#addRailcardText').hide();
        $('.dropdown-menu').hide();

    }

    var addRailcard = function (railcardname, railcardcode) {

        qttForm.railcards.push({ "RailcardName": railcardname, "RailcardCode": railcardcode });
    }

    var removeRailcard = function (railcardCode) {
        $.each(qttForm.railcards, function (index, railcard) {
            if (railcard.RailcardCode == railcardCode)
                qttForm.railcards.splice(index, 1);
        });
        qttForm.numberOfRailcard = qttForm.railcards.length;
    }

    var createRailcardListItem = function (name, code) {
        var railcardMainElement = $('<div></div>');
        var railcardTitleDevElement = $('<div></div>');
        var railcardRemoveDivElement = $('<div></div>');
        var railcardIconElement = $('<i></i>');
        var railcardTitleSpanElement = $('<span></span>');
        var removeAnchorElement = $('<a></a>');

        railcardTitleSpanElement.html(" " + name);
        railcardIconElement.addClass('fa fa-window-maximize').attr('aria-hidden', 'true');
        railcardTitleDevElement.append(railcardIconElement).append(railcardTitleSpanElement).addClass('railcard-visuals');
        removeAnchorElement.attr('ref-code', code).html('Remove').addClass('remove-railcard-btn');
        railcardRemoveDivElement.append(removeAnchorElement).addClass('remove-railcard');
        railcardMainElement.append(railcardTitleDevElement).append(railcardRemoveDivElement).addClass('remove-railcard-section').attr('railcard-code', code);
        return railcardMainElement;
    }

    var findWithAttr = function (array, attr, value) {
        for (var i = 0; i < array.length; i += 1) {
            if (array[i][attr] === value) {
                return i;
            }
        }
        return -1;
    }

    var groupRailcards = function (railcards) {
        var groupedRailcards = [];
        for (var i = 0; i < railcards.length; i++) {
            var index = findWithAttr(groupedRailcards, 'name', railcards[i]);
            if (index > -1) {
                groupedRailcards[index].occurence += 1;
            }
            else {
                var groupRailcard = { name: railcards[i], occurence: 1 };
                groupedRailcards.push(groupRailcard);
            }
        }
        return groupedRailcards;
    }

    var populateUngroupedRailcardPanel = function (groupedRailcards) {
        $.each(groupedRailcards, function (index, railcard) {

            $(".m_railcardDivST").prepend(createRailcardListItem(railcard.RailcardName, railcard.RailcardCode));

        })
    }

    //var populateGroupedRailcardPanel = function (groupedRailcards) {
    //    var columnElement = $('<div></div>').addClass('column');
    //    var viewRailcardSectionElement = $('<div></div>').addClass('view-railcard-section');
    //    var railcardVisualElement = $('<div></div>').addClass('railcard-visuals');
    //    var faIconClass = $('<i></i>').addClass('fa fa-window-maximize');
    //    var railcardTitleElement = $('<span></span>').html(" " + qttForm.railcards.length + " Railcards");
    //    var viewRailcardElement = $('<div><div>').addClass('view-railcard');
    //    var viewLinkElement = $('<a></a>').addClass('view').html('View');
    //    var viewDropDownElement = $('<div></div>').addClass('view-dropdown');
    //    railcardVisualElement.append(faIconClass).append(railcardTitleElement);
    //    viewRailcardSectionElement.append(railcardVisualElement);
    //    viewRailcardElement.append(viewLinkElement);
    //    $.each(groupedRailcards, function (index, railcard) {
    //        var displayName = $('#SelectedRailcard').children("option[value=" + railcard.name + "]").html();
    //        if (railcard.occurence > 1) {
    //            displayName = "(" + railcard.occurence + ") " + displayName;
    //        }
    //        viewDropDownElement.prepend(createRailcardListItem(displayName, railcard.name));
    //    });
    //    viewRailcardElement.append(viewDropDownElement);
    //    viewRailcardSectionElement.append(viewRailcardElement);
    //    columnElement.append(viewRailcardSectionElement);
    //    $('.railcardDiv').prepend(columnElement);
    //    $(".view-dropdown").hide();
    //}

    var bindSelectedRailcards = function () {
        $(".m_railcardDivST").find('.remove-railcard-section').each(function (i, obj) {
            $(obj).remove();
        });
        $(".m_railcardDivST").find('.view-railcard-section').each(function (i, obj) {
            $(obj).remove();
        });

        //var groupedRailcards = groupRailcards(qttForm.railcards.reverse());
        //if (qttForm.railcards.length > 4) {
        // populateGroupedRailcardPanel(groupedRailcards);
        //}
        //else {
        populateUngroupedRailcardPanel(qttForm.railcards);
        //}
    }

    var updateRailcardAddOptions = function (numberOfRailcards) {
        if (qttForm.getTotalPassenger() >= qttForm.numberOfRailcard + numberOfRailcards) {
            //Add more railcard button should be disabled
            $('#m_AddRailcardBtn').show();
        }
        else {
            //Add more railcard button should be enabled
            $('#m_AddRailcardBtn').hide();
        }
    }

    var RefreshRailcardAmount = function () {
        $('#m_numberofRailcard').val(1);
    }

    //var resetRailcardPopover = function () {
    //    $('#numberofRailcard').val(1);
    //    qttForm.numberOfRailcard = qttForm.railcards.length;
    //    updateRailcardAddOptions();
    //    $(".view-dropdown").hide();
    //}

    var updateRailcardAddButton = function () {
        if (qttForm.railcards.length == 1) {
            $('#seasonTicketRailcard').hide();
        }
        else {
            $('#seasonTicketRailcard').show();
            if ($('#m_Selectrailcard_ST').val() == null || $('#m_Selectrailcard_ST').val() == "") {
                $('#m_addRailcardBtn_ST').hide();
            }
            else {
                $('#m_addRailcardBtn_ST').show();
            }
        }
        //resetRailcardPopover();
        //$('.railcardDiv .dropdown-menu').hide();
        //if (qttForm.getTotalPassenger() > qttForm.numberOfRailcard) {
        //    //Add more railcard button should be disabled
        //    $('#m_AddRailcardBtn').show();
        //}
        //else {
        //    //Add more railcard button should be enabled
        //    $('#m_AddRailcardBtn').hide();
        //}
    }


    var updateGroupBooking = function () {
        if (qttForm.getTotalPassenger() >= 10) {
            $('#m_groupBooking').show();
            //$('#applyRailcard').prop('disabled', true);
            $('#m_LessThanZeroError').hide();
            $('#m_GroupTravel3To9Message').hide();
        }
        else {
            $('#m_groupBooking').hide();

        }
    }
    var checkLessThanZeroError = function () {
        if (qttForm.getTotalPassenger() <= 0) {
            $('#m_LessThanZeroError').show();
            //  $('#applyRailcard').prop('disabled', true);
            $('#m_groupBooking').hide();
            $('#m_GroupTravel3To9Message').hide();
        }
        else {
            $('#m_LessThanZeroError').hide();
            //  $('#applyRailcard').removeAttr("disabled");
        }
    }
    var checkGroupTravel3To9Passenger = function () {
        if (qttForm.getTotalPassenger() >= 3 && qttForm.getTotalPassenger() <= 9) {
            $('#m_GroupTravel3To9Message').show();
            // $('#applyRailcard').removeAttr("disabled");
            $('#m_groupBooking').hide();
            $('#m_LessThanZeroError').hide();
        }
        else {
            $('#m_GroupTravel3To9Message').hide();

        }
    }
    var disableCheck = function () {
        if (qttForm.getTotalPassenger() == qttForm.numberOfRailcard && qttForm.getTotalPassenger() < 10) {
            if (qttForm.getTotalPassenger() <= 0) {
                $('#applyRailcard').prop('disabled', true);
                return;
            }
            else {
                $('#applyRailcard').removeAttr("disabled");
                return;
            }
        }
        if (qttForm.getTotalPassenger() <= qttForm.numberOfRailcard || qttForm.getTotalPassenger() > 9) {
            $('#applyRailcard').prop('disabled', true);
            return;
        }
        else {
            $('#applyRailcard').removeAttr("disabled");
            return;
        }
    }

    var validateDates = function (onSubmit) {
        $('.error-message.journey-dates').hide();
        var error = qttForm.validateDates();
        if (!error.valid) {
            //Show date errors
            for (var i = 0; i < error.errors.length; i++) {
                if (error.errors[i].onSubmit == onSubmit) {
                    $('#m_' + error.errors[i].key).first().html(error.errors[i].message);
                    $('.error-message.journey-dates').show();
                }
            }

        }
        else {
        }
    }

    var updateRailcardValidation = function (onSubmit) {
        $('.error-message.railcard').hide();
        var error = qttForm.validateRailcards();
        if (!error.valid) {
            //Show date errors
            for (var i = 0; i < error.errors.length; i++) {
                if (error.errors[i].onSubmit == onSubmit) {
                    $('#m_' + error.errors[i].key).first().html(error.errors[i].message);
                    $('.error-message.railcard').show();
                    //$('#applyRailcard').prop('disabled', true);
                    //$('#applyRailcard').addClass('disabled');
                }
            }

        }
        else {
            //$('#applyRailcard').prop('disabled', false);
            //$('#applyRailcard').removeClass('disabled');
        }
    }
    //var ChangeArrivaldate = function () {

    //    // var Depdate = moment().format(DATE_FORMAT);
    //    var arrdate = moment(selectedDepartureDate, DATE_FORMAT).add(1, 'months').add(1, 'days').format(DATE_FORMAT);


    //    //for (var i = 0; i < newDates.length; i++) {
    //    //    if (newDates[i] == arrdate) {
    //    //        return;
    //    //    }
    //    //}
    //    var selectedOnemonth = moment(selectedDepartureDate, DATE_FORMAT).add(1, 'months').add(1, 'days');
    //    //.add(0, 'hours').minute(0);
    //    var ArrivalDateTimeToDisplay = selectedOnemonth.format("ddd DD MMM, YYYY");
    //    var setDefaultArrival = setDateTime(arrdate, selectedOnemonth);
    //    selectedArrivalDate = setDefaultArrival;
    //    qttForm.returnDate = setDefaultArrival;
    //    //qttForm.returnOption = departureType;
    //    $('#m_txt_arrival_date_ST').val(ArrivalDateTimeToDisplay);

    //}
    var DeparturedateMessage = function () {


        var end14Days = moment().add(parseInt(minDepartDate) + 14, "day", DATE_FORMAT);
        var SelectedDate = moment(qttForm.departureDate, DATE_FORMAT);

        if (end14Days < SelectedDate) {
            $(".m_message-departureDate_ST").show();
        }
        else {
            $(".m_message-departureDate_ST").hide();
        }
    }
    var m_AddDisabledatediv_ST = function (el) {
        var date = el.parentElement.firstElementChild.textContent;
        var month = el.parentElement.parentElement.parentElement.parentElement.parentElement.firstElementChild.lastElementChild.firstElementChild.textContent;
        var year = el.parentElement.parentElement.parentElement.parentElement.parentElement.firstElementChild.lastElementChild.lastElementChild.textContent;
        var Disabledate = new Date(date + month + year);
        $.each(newDates, function (index, value) {
            var splitDates = value.Date.split("-");
            var dates = splitDates[1] + "-" + splitDates[0] + "-" + splitDates[2];
            var dateN = new Date(dates);
            var unavailabledate = value.Unavailabledatemessage;
            if (Disabledate.getTime() === dateN.getTime()) {
                if (value.ShowUnavailabledate == true && unavailabledate != "") {
                    $(".m_tooltip-disabldate-message_ST").append(unavailabledate);
                    $(".m_tooltip-disabldate-message_ST").show();
                }
                else {
                    $(".m_tooltip-disabldate-message_ST").hide();
                }
            }
        });
        var currentdate = moment().subtract(1, "days", DATE_FORMAT);
        var enddate = moment().add(maxDepartDate, "day", DATE_FORMAT);
        if (Disabledate < currentdate) {
            if (Outdaterange.ShowPastdatemessage && Outdaterange.Pastdatemessage != "") {
                $(".m_tooltip-disabldate-message_ST").append(Outdaterange.Pastdatemessage);
                $(".m_tooltip-disabldate-message_ST").show();
            }
            else {
                $(".m_tooltip-disabldate-message_ST").hide();
            }
        }
        if (Disabledate > enddate) {
            if (Outdaterange.ShowFuturedatemessage && Outdaterange.Futuredatemessage != "") {
                $(".m_tooltip-disabldate-message_ST").append(Outdaterange.Futuredatemessage);
                $(".m_tooltip-disabldate-message_ST").show();
            }
            else {
                $(".m_tooltip-disabldate-message_ST").hide();
            }
        }

    }
    var bindEvents = function () {
        $(document).ready(function () {
            $('#traintimes-tab-heading').show();
            $('#mob-tabs').tabs();
            $('#mob-tabs').show();
            $('#tabsMobile1_ST').tabs();
            $('#tabsMobile').tabs();
            $('#tabsMobile1').tabs();
            $('#tabsMobile2').tabs();
            $('#tabsMobile3').tabs();
            //$('#mobile-tabs-2').show();
            $('#m-arrival-date-tabs_ST').tabs();
            $('#m-arrival-date-tabs').tabs();
            $('#m-arrival-date-tabs-4').tabs();
            $('#m-arrival-date-tabs-5').tabs();
            $('#m-arrival-date-tabs-6').tabs();
            $('#m-arrival-date-tabs-7').tabs();

            //$('#m-arrival-date-tabs-6').tabs();
            $("#m_specific-date-calendar_ST").datepicker({
                minDate: minDepartDate,
                maxDate: maxDepartDate, firstDay: 1,
                numberOfMonths: 1,
                beforeShowDay: function (date) {
                    if (newDates) {
                        var status = true;
                        for (var i = 0; i < newDates.length; i++) {
                            if (newDates[i].Date.indexOf(ut.getDateOnly(date)) > -1) {
                                status = false;
                                return [status, '',];
                            }
                        }
                        return [status, ''];
                    }
                },
                onSelect: function (date, inst) {
                    selectedDepartureDate = getDateOnly(date);
                    $('.m_tooltip-default-message_ST').hide();
                    $('.m_tooltip-disabldate-message_ST').hide();
                    $('.m_tooltip-enabldate-message_ST').show();
                }
            });
            $("#m_anytime-date-calendar_ST").datepicker({
                minDate: "+" + minArriveDate + "m", //+ "+" + minArriveDate + "d",
                maxDate: "+" + minArriveDate + "m" + "+" + minArriveDate + "d" + "+" + maxArriveDate + "d",
                numberOfMonths: 1, firstDay: 1,
                beforeShowDay: function (date) {
                    var m_selectedDepartureDate = selectedDepartureDate == null ? null : moment(selectedDepartureDate, DATETIME_FORMAT);
                    var m_selectedArrivalDate = selectedArrivalDate == null ? null : moment(selectedArrivalDate, DATETIME_FORMAT);
                    var m_date = moment(ut.getDateOnly(date), "DD-MM-YYYY");
                    var cssClass = '';
                    var selectable = true;
                    if (newDates) {
                        if (newDates.indexOf(ut.getDateOnly(date)) > -1) {
                            selectable = false;
                        }
                    }
                    if (m_selectedDepartureDate != null) {
                        selectable = m_date.toDate() >= m_selectedDepartureDate.toDate() && selectable;
                        if (m_selectedArrivalDate != null && m_date.toDate() >= m_selectedDepartureDate.toDate() && m_date.toDate() < m_selectedArrivalDate.toDate()) {
                            cssClass = '';
                            return [selectable, cssClass];
                        }
                        else if (m_selectedDepartureDate.format("DDMMYYYY") == m_date.format("DDMMYYYY")) {
                            cssClass = 'ui-state-active x-ui-current-selected-date';
                            selectable = true;
                        }
                        else {
                            cssClass = m_date.format("DD/MM/YYYY") == m_selectedDepartureDate.format("DD/MM/YYYY") ? 'ui-state-active' : '';
                        }
                        return [selectable, cssClass];
                    }


                    else {
                        return [selectable, '']
                    }
                },
                onSelect: function (dateText, inst) {
                    selectedArrivalDate = getDateOnly(dateText);
                    $(this).datepicker();
                }
            });
            //For Custom Option
            $('#m_custom_ST input').on('change', function () {

                if ($(this).prop("checked") == true) {
                    $("#m_returndatetime_ST").show();
                    qttForm.custom = $(this).prop("checked");

                }
                else if ($(this).prop("checked") == false) {
                    $("#m_returndatetime_ST").hide();
                    qttForm.custom = $(this).prop("checked");
                }
            });
            $('#m_annual_ST input').on('change', function () {
                qttForm.annual = $(this).prop("checked");
            });
            $('#m_monthly_ST input').on('change', function () {
                qttForm.monthly = $(this).prop("checked");
            });
            $('#m_weekly_ST input').on('change', function () {
                qttForm.weekly = $(this).prop("checked");
            });
            //disabling the inputs
            $('#m_txt_departure_station_ST').on('focus', function () {
                $(this).blur();
            });
            $('#m_txt_arrival_station_ST').on('focus', function () {
                $(this).blur();
            });
            $("#m_txt_departure_date_ST").on('focus', function () {
                $(this).blur();
            });
            $("#m_txt_arrival_date_ST").on('focus', function () {
                $(this).blur();
            });
            $('#m_numberofAdults').on('focus', function () {
                $(this).blur();
            });
            $('#m_numberofChildren').on('focus', function () {
                $(this).blur();
            });
            $('#m_numberofRailcard').on('focus', function () {
                $(this).blur();
            });
            $('#m_numberofRailcard').on('focus', function () {
                $(this).blur();
            });
            $('#peopleandRailCards').on('focus', function () {
                $(this).blur();
            });
            $('.specific-date-time-selector').on('click', function () {
                datePrefixSelection(this);
            })
            $('.today-time-selector').on('click', function () {
                datePrefixSelection(this);
            })
            $('.tomorrow-time-selector').on('click', function () {
                datePrefixSelection(this);
            })
            //$(".view").click(function () {
            //    $(".view-dropdown").toggle(500);
            //});
            $(document).on('click', ".ui-state-disabled .ui-state-default", function () {
                $(".m_tooltip-disabldate-message_ST").empty();
                $('.m_tooltip-default-message_ST').hide();
                $('.m_tooltip-enabldate-message_ST').hide();
                m_AddDisabledatediv_ST(this);
            });
            $('[data-modal-close]').on('click', function () {
                var modalId = $(this).data('modal-close');
                $('#' + modalId).modal('hide');
            })
            if ($('#m_adult_ST').prop('checked', true)) {
                if ($('#m_Selectrailcard_ST').val() == null || $('#m_Selectrailcard_ST').val() == "") {
                    $('#m_addRailcardBtn_ST').hide();
                }
                else {
                    $('#m_addRailcardBtn_ST').show();
                }
                $("#m_Selectrailcard_ST").trigger("change");
            }

            $('#m_Selectrailcard_ST').change(function () {
                if ($('#m_Selectrailcard_ST').val() == null || $('#m_Selectrailcard_ST').val() == "") {
                    $('#m_addRailcardBtn_ST').hide();
                }
                else {
                    $('#m_addRailcardBtn_ST').show();
                }

            });

            $("#m_adult_ST input[name='a']").on("click", function () {
                bindRailcards();
                $('#seasonTicketRailcard').show();

                qttForm.adult = true;
                qttForm.child = false;
                $('.m_railcardDivST').show();
                updateRailcardAddButton();
                //  $('#addRailcardText_ST').show();
            });
            $("#m_child_ST input[name='a']").on("click", function () {
                $('.m_railcardDivST').hide();
                qttForm.adult = false;
                qttForm.child = true;
                $('#seasonTicketRailcard').hide();
                $('#m_Selectrailcard_ST').empty();
                qttForm.railcards.splice(0, 1);
                bindSelectedRailcards();

                // $('#addRailcardText_ST').show();
            });
            $('#m_txt_departure_station_ST').on('click', function () {
                $('#m_txt_departing_station_search_ST').val("").trigger('keyup');
                $('#mobile-departing-popup_ST').modal('show');
                $('#m_txt_departing_station_search_ST').focus();
            });
            $('#m_txt_arrival_station_ST').on('click', function () {
                $('#m_txt_returning_station_search_ST').val("").trigger('keyup');
                $('#mobile-returning-popup_ST').modal('show');
                $('#m_txt_returning_station_search_ST').focus();
            });

            $('.m_depart_date_ST').on('click', function () {
                var selectedTab = $('#tabsMobile1_ST').tabs('option', 'active');
                selectedTab = 2;
                var date = new Date();
                var timetype;
                switch (selectedTab) {
                    case 0: {
                        //Today
                        selectedDepartureDate = ut.getDateOnly(date);
                        break;
                    }
                    case 1: {
                        //Tomorrow
                        selectedDepartureDate = ut.addDaysInDate(date, 1);
                        break;
                    }
                    default: {
                        //Specific Date
                        if (selectedDepartureDate == null) {
                            selectedDepartureDate = ut.getDateOnly(date);
                        }
                        break;
                    }
                }
                var selectedTime = $('#m_dep_time_index_ST_' + selectedTab).val();
                selectedDepartureDate = setDateTime(selectedDepartureDate, selectedTime);
                //if (selectedDepartureDate != qttForm.departureDate) {
                //    ChangeArrivaldate();
                //}
                timetype = $('#m_dep_btns_index_ST_' + selectedTab + " > .active").data("j-time");
                qttForm.departureDate = selectedDepartureDate;
                qttForm.departureOption = timetype;
                $('#m_txt_departure_date_ST').val(moment(selectedDepartureDate, DATETIME_FORMAT).format("ddd DD MMM, YYYY"));
                $('#mobile-departing-date-popup_ST').modal('hide');
                $("#m_anytime-date-calendar_ST").datepicker('option', 'minDate', moment(selectedDepartureDate, DATE_FORMAT).add(1, 'month').add(1, 'day').toDate());
                $("#m_specific-date-calendar_ST").datepicker('setDate', moment(selectedDepartureDate, DATETIME_FORMAT).toDate());
                refreshDatePickers();
                validateDates(false);
                qttForm.ValidateDepartureDate();
                DeparturedateMessage();
            })
            $('.m_arrive_date_ST').on('click', function () {
                var selectedTab = $('#m-arrival-date-tabs_ST').tabs('option', 'active');
                selectedTab = 2;
                var date = new Date();
                var timetype;
                switch (selectedTab) {
                    case 0: {
                        //Today
                        selectedArrivalDate = ut.getDateOnly(date);
                        break;
                    }
                    case 1: {
                        //Tomorrow
                        selectedArrivalDate = ut.addDaysInDate(date, 1);
                        break;
                    }
                    default: {
                        //Specific Date
                        if (selectedArrivalDate == null) {
                            selectedArrivalDate = ut.getDateOnly(date);
                        }
                        break;
                    }
                }
                //var selectedTime = $('#m_arr_time_index_' + selectedTab).val();
                var selectedTime = "00:00";
                selectedArrivalDate = setDateTime(selectedArrivalDate, selectedTime);
                timetype = $('#m_arr_btns_index_' + selectedTab + " > .active").data("j-time");
                qttForm.returnDate = selectedArrivalDate;
                qttForm.returnOption = timetype;
                qttForm.journeyType = "Return";
                $('#m_txt_arrival_date_ST').val(moment(selectedArrivalDate, DATETIME_FORMAT).format("ddd DD MMM, YYYY"));
                $('#mobile-arrival-date-popup_ST').modal('hide');
                $("#m_anytime-date-calendar_ST").datepicker('setDate', moment(selectedArrivalDate, DATETIME_FORMAT).toDate());
                refreshDatePickers();
                validateDates(false);
            });
            $('.m_open_return').on('click', function () {
                qttForm.journeyType = 'OpenReturn';
                $('#m_txt_arrival_date_ST').val('Open Return');
                $('#mobile-arrival-date-popup_ST').modal('hide');

            });
            $("#m_txt_departure_date_ST").on('click', function () { //initializing elements such as date time
                $(".m_tooltip-disabldate-message_ST").hide();
                $('.m_tooltip-default-message_ST').show();
                $('.m_tooltip-enabldate-message_ST').hide();
                var times = buildTimeData();
                $('.depart-time-form select').empty();
                for (var i = 0; i < times.length; i++) {
                    var option = $('<option></option>');
                    option.attr("value", times[i]).html(times[i]);
                    $('.depart-time-form select').append($(option));
                }
                if (selectedDepartureDate != null) {
                    $('.depart-time-form select').val(moment(selectedDepartureDate, DATETIME_FORMAT).format(TIME_FORMAT));
                }
                else {
                    var defaultSelectedDepTime = moment().add(0, 'days').add(1, 'hours').minute(0);

                    $('.depart-time-form select').val(defaultSelectedDepTime.format(TIME_FORMAT));
                }
                var date = new Date();
                for (i = 0; i < newDates.length; i++) {
                    if (newDates[i] == ut.getDateOnly(date)) {
                        $('#m_depart_date_ST_0 .m_depart_date_ST').prop("disabled", true);
                        $('#m_disableTodayDepartDateMessage').show();
                    }
                    if (newDates[i] == ut.addDaysInDate(date, 1)) {
                        $('#m_depart_date_ST_1 .m_depart_date_ST').prop("disabled", true);
                        $('#m_disableTomDepartDateMessage').show();
                    }
                }
                $('#mobile-departing-date-popup_ST').modal('show');
            });
            $("#m_txt_arrival_date_ST").on('click', function () {
                $('.arrive-time-form select').empty();
                var times = buildTimeData();
                for (var i = 0; i < times.length; i++) {
                    var option = $('<option></option>');
                    option.attr("value", times[i]).html(times[i]);
                    $('.arrive-time-form select').append($(option));
                }
                //var defaultSelectedArrTime = defaultSelectedDepTime.clone().add(2, 'hours');
                if (selectedArrivalDate != null) {
                    $('.arrive-time-form select').val(moment(selectedArrivalDate, DATETIME_FORMAT).format(TIME_FORMAT))
                }
                else {
                    var defaultSelectedDepTime = moment().add(0, 'days').add(2, 'hours').minute(0);
                    var defaultSelectedArrTime = defaultSelectedDepTime.clone().add(2, 'hours');
                    $('.arrive-time-form select').val(defaultSelectedArrTime.format(TIME_FORMAT))
                }
                var date = new Date();
                for (i = 0; i < newDates.length; i++) {
                    if (newDates[i] == ut.getDateOnly(date)) {
                        $('#m_arrive_date_ST_0 .m_arrive_date_ST').prop("disabled", true);
                        $('#m_disableTodayReturnDateMessage').show();
                    }
                    if (newDates[i] == ut.addDaysInDate(date, 1)) {
                        $('#m_arrive_date_ST_1 .m_arrive_date_ST').prop("disabled", true);
                        $('#m_disableTomReturnDateMessage').show();
                    }
                }
                $('#mobile-arrival-date-popup_ST').modal('show');


            });
            $("#m_txt_departing_station_search_ST").on('keyup', function () {
                var searchField = $(this).val();
                bindStationKeyUpEvents('depart', searchField);
            })
            $("#m_txt_returning_station_search_ST").on('keyup', function () {
                var searchField = $(this).val();
                bindStationKeyUpEvents('arrive', searchField);
            })
            $(document).on('click', "#mobile-departing-popup_ST div.depart", function () {
                var stationCode = $(this).attr('departcrsdatabind');
                var stationName = $(this).children('div.return-station-name').text();

                if (stationCode != null && stationCode != '') {
                    qttForm.departureStation = stationName;
                    qttForm.departureStationCRSCode = stationCode;
                    $("#m_txt_departure_station_ST").val(stationName);
                    $("#m_txt_departing_station_search_ST").val(stationName);
                    $('#mobile-departing-popup_ST').modal('hide');
                    qttForm.ValidateDepartureStation();
                }

            });

            // Departure Station selection from search and binding ends here
            $(document).on('click', "#mobile-returning-popup_ST div.arrive", function () {
                var stationCode = $(this).attr('arrivecrsdatabind');
                var stationName = $(this).children('div.return-station-name').text();
                if (stationCode != null && stationCode != '') {
                    qttForm.arrivalStation = stationName;
                    qttForm.arrivalStationCRSCode = stationCode;
                    $('#m_txt_arrival_station_ST').val(stationName);
                    $('#m_txt_returning_station_search_ST').val(stationName);
                    $('#mobile-returning-popup_ST').modal('hide');
                    qttForm.ValidateArrivalStation();
                }
            });
            //swapping station functionality
            $('#m_SwapStation_ST').on('click', function () {
                if ((!qttForm.arrivalStation) || (!qttForm.departureStation)) {
                    return;
                }
                else {
                    var currArr = qttForm.arrivalStation;
                    var currDep = qttForm.departureStation;
                    var currArrCode = qttForm.arrivalStationCRSCode;
                    var currDepCode = qttForm.departureStationCRSCode;

                    qttForm.arrivalStationCRSCode = currDepCode;
                    qttForm.departureStationCRSCode = currArrCode;
                    qttForm.arrivalStation = currDep;
                    qttForm.departureStation = currArr;
                    $('#m_txt_arrival_station_ST').val(qttForm.arrivalStation);
                    $('#m_txt_departure_station_ST').val(qttForm.departureStation);
                }

            });
            //number of adults
            //$('#m_incrementAdult').on('click', function () {
            //    var adults = parseInt($('#m_numberofAdults').val()) + 1;
            //    if (adults >= 10) {
            //        $(this).prop('disable', true);
            //        $('#m_numberofAdults').val("10+");
            //        qttForm.numberOfAdults = 10;
            //    }
            //    else {
            //        qttForm.numberOfAdults = adults;
            //        $('#m_numberofAdults').val(adults);
            //    }
            //    updateRailcardAddButton();
            //    updateGroupBooking();
            //    checkLessThanZeroError();
            //    checkGroupTravel3To9Passenger();
            //    updateRailcardValidation(false);
            //    disableCheck();
            //    RefreshRailcardAmount();
            //});
            //$('#m_decrementAdult').on('click', function () {
            //    var adults = parseInt($('#m_numberofAdults').val());
            //    if (adults <= 0) {
            //        $(this).prop('disable', true);
            //    }
            //    else {
            //        adults -= 1;
            //        qttForm.numberOfAdults = adults;
            //        $('#m_numberofAdults').val(adults);
            //    }
            //    updateRailcardAddButton();
            //    updateGroupBooking();
            //    checkLessThanZeroError();
            //    checkGroupTravel3To9Passenger();
            //    updateRailcardValidation(false);
            //    disableCheck();
            //    RefreshRailcardAmount();
            //});
            //number of children
            //$('#m_incrementChildren').on('click', function () {
            //    var children = parseInt($('#m_numberofChildren').val()) + 1;
            //    if (children >= 10) {
            //        $(this).prop('disable', true);
            //        $('#m_numberofChildren').val("10+");
            //        qttForm.numberOfChildren = 10;
            //    }
            //    else {
            //        qttForm.numberOfChildren = children;
            //        $('#m_numberofChildren').val(children);
            //    }
            //    updateRailcardAddButton();
            //    updateGroupBooking();
            //    checkLessThanZeroError();
            //    checkGroupTravel3To9Passenger();
            //    updateRailcardValidation(false);
            //    disableCheck();
            //    RefreshRailcardAmount();
            //});
            //$('#m_decrementChildren').on('click', function () {
            //    var children = parseInt($('#m_numberofChildren').val());
            //    if (qttForm.numberOfChildren <= 0) {
            //        $(this).prop('disable', true);
            //    }
            //    else {
            //        children -= 1;
            //        qttForm.numberOfChildren = children;
            //        $('#m_numberofChildren').val(children);
            //    }
            //    updateRailcardAddButton();
            //    updateGroupBooking();
            //    checkLessThanZeroError();
            //    checkGroupTravel3To9Passenger();
            //    updateRailcardValidation(false);
            //    disableCheck();
            //    RefreshRailcardAmount();
            //});
            //number of railcard
            //$('#m_incrementRailcard').on('click', function () {
            //    $('#m_decrementRailcard').prop('disabled', false);
            //    var railcardCount = parseInt($('#m_numberofRailcard').val()) + 1;
            //    $('#m_numberofRailcard').val(railcardCount);
            //    //qttForm.numberOfRailcard = qttForm.railcards.length + railcardCount;
            //    selectedNumberOfRailcard = railcardCount;
            //    updateRailcardAddOptions(selectedNumberOfRailcard);
            //});
            //$('#m_decrementRailcard').on('click', function () {
            //    var railcardCount = parseInt($('#m_numberofRailcard').val()) - 1;
            //    if (railcardCount <= 0) {
            //        $(this).prop('disabled', true);
            //        //updateRailcardAddOptions(0);
            //    }
            //    else {
            //        $('#m_numberofRailcard').val(railcardCount);
            //        selectedNumberOfRailcard = railcardCount;

            //    }
            //    if (selectedNumberOfRailcard > 0)
            //        updateRailcardAddOptions(selectedNumberOfRailcard);
            //});
            $('#m_addRailcardBtn_ST').on('click', function () {
                var railcardCode = $('#m_Selectrailcard_ST').val();
                var railcardName = $('#m_Selectrailcard_ST :selected').html();
                //var amount = parseInt($('#m_numberofRailcard').val());
                if (railcardCode != undefined && railcardName != undefined) {
                    addRailcard(railcardName, railcardCode);
                }

                //qttForm.railcards.sort();
                bindSelectedRailcards();
                // checkRailcard();

                $('#m_Selectrailcard_ST').empty();


                updateRailcardAddButton();
                //RefreshRailcardAmount();
            });
            $(document).on('click', '.mobile-qtt a.remove-railcard-btn', function () {
                var code = $(this).attr('ref-code');
                removeRailcard(code);
                bindRailcards();
                bindSelectedRailcards();
                updateRailcardAddButton();
                updateRailcardValidation();
            })

            $('.close-railcard-mobile-pop').on('click', function () {
                qttForm = $.extend(true, {}, backupQttForm);
            })

            //$('#peopleandRailCards').on('click', function () {
            //    backupQttForm = $.extend(true, {}, qttForm);
            //    $('#m_numberofAdults').val(qttForm.numberOfAdults);
            //    $('#m_numberofChildren').val(qttForm.numberOfChildren);
            //    bindSelectedRailcards();
            //    updateGroupBooking();
            //    $('#railcard-mobile-pop').show();
            //})

            //$('#applyRailcard').on('click', function () {
            //    qttForm.numberOfRailcard = qttForm.railcards.length;
            //    var railcardTextToDisplay = qttForm.numberOfAdults + ' Adults, ' + qttForm.numberOfChildren + ' Children, ' + qttForm.numberOfRailcard + ' Railcards';
            //    $('#peopleandRailCards').val(railcardTextToDisplay);
            //    $('#railcard-mobile-pop').hide();
            //});
            //$(".main-drop").click(function () {
            //    $(".dropdown-menu").toggle(500);
            //    setTimeout(function () {
            //        resetRailcardPopover();
            //    }, 500)
            //});
            //$(document).on('click', '.view-railcard .view', function () {
            //    $(".view-dropdown").toggle(500);
            //})
            //Buy ticket binding
            $('#m_buyNowBtn_ST').on('click', function () {
                submitted = true;
                var validationResult = qttForm.Validate();
                setTimeout(function () { ticketingService.sendDataNewQTT(qttForm); }, 500);
                if (validationResult.valid) {
                    //var urltest = "https://m.buytickets.avantiwestcoast.co.uk/datapassedin";


                    document.cookie = 'LeavingFrom=' + qttForm.departureStation;
                    document.cookie = 'LeavingFromCode=' + qttForm.departureStationCRSCode;
                    document.cookie = 'GoingTo=' + qttForm.arrivalStation;
                    document.cookie = 'GoingToCode=' + qttForm.arrivalStationCRSCode;
                    ut.handOffDekstop(qttForm, entryDataContext.PICOWebtisEngineUrl);
                    $('.mobile-qtt form').trigger('reset');
                }
                else {
                    //Handle errors
                    // alert("There are some validation errors");
                }
            });
        })


    };

    //  init();
    return {
        init: init
    }

});
define('customJS/QttTraintimeModule', ['jquery', 'jqueryui', 'customJS/QttFormViewModelForPICO', 'context', 'moment', 'dataService', 'customJS/QttUtilityForPICO', 'utils'], function ($, jqueryUi, QttFormVM, context, moment, dataService, Utility, utils) {

    var disableDates = entryDataContext.DateSetting;
    var Outdaterange = entryDataContext.DateSettingFordisabledate;
    var allstations = [];
    var selectedDepartureDate = null, selectedArrivalDate = null;
    var DATETIME_FORMAT = "DD-MM-YYYY HH:mm", DATE_FORMAT = "DD-MM-YYYY", TIME_FORMAT = "HH:mm", DISPLAY_DATE_TIME_FORMAT = "ddd DD MMM, HH:mm";
    var qttForm = new QttFormVM.QttForm();
    var PopularStations = [];// entryDataContext.PopularStationsForHomeQtt;
    var maxDepartDateTT = Outdaterange.QttDate;
    var maxArriveDateWeb = Outdaterange.QttDate;
    var submitted = false;
    var newDates = [];
    var ut = Utility;
    var FavouriteStation = [];
    var journeyCheckPageBaseURL = context.environment.journeyCheckPageUrl;


    function GetFormattedDate(date) {
        return new moment.utc(date).format(DATE_FORMAT);
    }
    for (var i = 0; i < disableDates.length; i++) {
        var date = GetFormattedDate(disableDates[i].Date);
        newDates.push({ "Date": date, "Disabledatemessage": disableDates[i].Disabledatehoverstatemessage, "hoverstate": disableDates[i].Addhoverstate, "Unavailabledatemessage": disableDates[i].Unavailabledatemessage, "ShowUnavailabledate": disableDates[i].ShowUnavailabledatemessage });
    }
    var init = function (stations) {
        allstations = stations;
        bindEvents();
        defaultDepartureDate();
        setPopularAndFavouriteStation();
    };
    var setPopularAndFavouriteStation = function () {

        FavouriteStation = ut.getFavouriteStationForPICO(allstations);

        PopularStations = ut.getPopularStationForPICO(allstations);
        PopularStations = ut.disjointPopularAndFavouriteStation(PopularStations, FavouriteStation);
        setPopularStation();
        setFavouriteStation();
    }
    var setPopularStation = function () {
        if (PopularStations.length != 0) {
            fillPopularStationList();
        }
    }
    var setFavouriteStation = function () {

        if (FavouriteStation.length != 0) {
            $('#departFavouriteStationHeading_tt').show();
            $('#arriveFavouriteStationHeading_tt').show();
            $('#m_arriveFavouriteStationHeading_tt').show();
            $('#m_departFavouriteStationHeading_tt').show();
            FillFavouriteStationList();
        }
        else {
            $('#departFavouriteStationHeading_tt').hide();
            $('#arriveFavouriteStationHeading_tt').hide();
            $('#m_arriveFavouriteStationHeading_tt').hide();
            $('#m_departFavouriteStationHeading_tt').hide();
        }

    }
    var defaultDepartureDate = function () {
        var date = moment().format(DATE_FORMAT);
        var departureType = 'D';
        var selectedTimeOneHour = moment().add(0, 'days').add(0, 'hours').minute(0);
        var DateTimeToDisplay = selectedTimeOneHour.format(DISPLAY_DATE_TIME_FORMAT);
        var setDefaultDepat = setDateTime(date, selectedTimeOneHour);
        selectedDepartureDate = setDefaultDepat;
        qttForm.departureDate = setDefaultDepat;
        qttForm.departureOption = departureType;
        $('#departureJourneyDateTime_tt').val(DateTimeToDisplay);
        $('#m_departureJourneyDateTime_tt').val(DateTimeToDisplay);
        $('.tooltip-default-message_tt').show();
        $('.m_tooltip-default-message_tt').show();

    }

    var getStationColumns = function (journeyType, stationName, stationCode) {
        var disabled = false;
        if (journeyType == 'depart') {
            disabled = qttForm.arrivalStation != null && stationName == qttForm.arrivalStation;
        }
        else {
            disabled = qttForm.departureStation != null && stationName == qttForm.departureStation;
        }
        var valueAttribute = journeyType == 'depart' ? 'departcrsdatabind' : 'arrivecrsdatabind';
        var columnElement = $('<div></div>').addClass('column');
        var stationElement = $('<div></div>').addClass('return-stations ' + journeyType + ' tt').attr(valueAttribute, stationName);
        if (disabled)
            stationElement.addClass('station-disabled').removeAttr(valueAttribute);
        var stationNameElement = $('<div></div>').addClass('return-station-name').html(stationName);
        var stationCodeElement = $('<div></div>').addClass('return-station-shortcode').html();//html(stationCode);
        stationElement.append(stationNameElement).append(stationCodeElement);
        columnElement.append(stationElement);
        return columnElement;
    }

    var bindPopularStations = function (journeyType, stationName, stationCode) {
        if (stationCode != undefined && stationCode != "") {
            var columnElement = getStationColumns(journeyType, stationName, stationCode);
            if (journeyType == "depart") {
                $("#Departing-Popular-station_tt").append(columnElement);
            }
            else {
                $("#Arriving-Popular-station_tt").append(columnElement);
            }
        }


    }
    var m_bindPopularStations = function (journeyType, stationName, stationCode) {
        var columnElement = getStationColumns(journeyType, stationName, stationCode);
        if (journeyType == "depart") {

            $("#m_departing-popular-station_tt").append(columnElement);
        }
        else {
            $("#m-arriving-popular-stations_tt").append(columnElement);
        }
    }
    var bindFavouriteStations = function (journeyType, stationName, stationCode) {
        if (stationCode != undefined && stationCode != "") {
            var columnElement = getStationColumns(journeyType, stationName, stationCode);
            if (journeyType == "depart") {
                $("#Departing-Favourite-station_tt").append(columnElement);
            }
            else {
                $("#Arriving-Favourite-station_tt").append(columnElement);
            }
        }


    }
    var m_bindFavouriteStations = function (journeyType, stationName, stationCode) {
        if (stationCode != undefined && stationCode != "") {
            var columnElement = getStationColumns(journeyType, stationName, stationCode);
            if (journeyType == "depart") {
                $("#m_departing-favourite-station_tt").append(columnElement);
            }
            else {
                $("#m-arriving-favourite-stations_tt").append(columnElement);
            }
        }


    }
    var clearMoreStations = function (journeyType) {
        if (journeyType == "arrive") {
            $("#Arriving-Popular-station_tt").empty();
        }
        else {
            $("#Departing-Popular-station_tt").empty();

        }
    }
    var m_clearMoreStations = function (journeyType) {
        if (journeyType == "arrive") {
            $("#m_filtersearchArrival_tt").empty();
        }
        else {

            $("#m_filtersearchDeparture_tt").empty();
        }
    }

    var clearPopularStations = function (journeyType) {
        if (journeyType == "arrive") {
            $('#filtersearchArrival_tt').empty();

        }
        else {
            $('#filtersearchDeparture_tt').empty();

        }
    }
    var m_clearPopularStations = function (journeyType) {
        if (journeyType == "arrive") {
            $('#m-arriving-popular-stations_tt').empty();
        }
        else {

            $('#m_departing-popular-station_tt').empty();
        }
    }
    var clearFavouriteStations = function (journeyType) {

        if (journeyType == "arrive") {
            $("#Arriving-Favourite-station_tt").empty();
        }
        else {
            $('#Departing-Favourite-station_tt').empty();

        }
    }
    var m_clearFavouriteStations = function (journeyType) {

        if (journeyType == "arrive") {
            $("#m-arriving-favourite-stations_tt").empty();
        }
        else {
            $('#m_departing-favourite-station_tt').empty();

        }
    }

    var bindAllStations = function (journeyType, stationName, stationCode) {
        var columnElement = getStationColumns(journeyType, stationName, stationCode);
        if (journeyType == "depart") {
            $('#filtersearchDeparture_tt').append(columnElement);
        }
        else {
            $('#filtersearchArrival_tt').append(columnElement);
        }
    }
    var m_bindAllStations = function (journeyType, stationName, stationCode) {
        var columnElement = getStationColumns(journeyType, stationName, stationCode);
        if (journeyType == "depart") {
            $('#m_filtersearchDeparture_tt').append(columnElement);
        }
        else {
            $('#m_filtersearchArrival_tt').append(columnElement);
        }
    }

    var bindStationKeyUpEvents = function (journeyType, searchField) {
        var popularHeadingElement, moreHeadingElement, FavouriteHeadingElement;
        if (journeyType == "arrive") {
            FavouriteHeadingElement = $('#arriveFavouriteStationHeading_tt');
            popularHeadingElement = $('#arrivePopularStationHeading_tt');
            moreHeadingElement = $('#arriveMoreStationHeading_tt');
        }
        else {
            FavouriteHeadingElement = $('#departFavouriteStationHeading_tt');
            popularHeadingElement = $('#departPopularStationHeading_tt');
            moreHeadingElement = $('#departMoreStationHeading_tt');
        }
        clearFavouriteStations(journeyType);
        clearPopularStations(journeyType);
        clearMoreStations(journeyType);
        if (searchField.length > 2) {
            //Load Favourite stations which are filtered
            var filteredFavouriteStations = filterStations(FavouriteStation, searchField);

            $.each(filteredFavouriteStations, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });

            //Load popular stations which are filtered
            var filteredPopularStations = filterStations(PopularStations, searchField);
            $.each(filteredPopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
            });
            //Load more stations
            var filteredStations = filterStations(allstations, searchField);
            $.each(filteredStations, function (index, station) {
                bindAllStations(journeyType, station.Name, station.CrsCode);
            });
            manageStationHeading(FavouriteHeadingElement, filteredFavouriteStations);
            manageStationHeading(popularHeadingElement, filteredPopularStations);
            manageStationHeading(moreHeadingElement, filteredStations);
        }
        else if (searchField.length == 0) {
            //filter favourite stations
            $.each(FavouriteStation, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            //filter popular stations
            $.each(PopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
            });
            manageStationHeading(FavouriteHeadingElement, FavouriteStation);
            manageStationHeading(popularHeadingElement, PopularStations);
            manageStationHeading(moreHeadingElement, null);
        }
        else {
            //Load Favourite stations which are filtered
            var filteredFavouriteStations = filterStations(FavouriteStation, searchField);
            $.each(filteredFavouriteStations, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            //Load popular stations which are filtered
            var filteredPopularStations = filterStations(PopularStations, searchField);
            $.each(filteredPopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
            });
            //clearMoreStations();
            manageStationHeading(FavouriteHeadingElement, filteredFavouriteStations);
            manageStationHeading(popularHeadingElement, filteredPopularStations);
            manageStationHeading(moreHeadingElement, null);
        }
    }
    //for mobile bindstation binding
    var m_bindStationKeyUpEvents = function (journeyType, searchField) {
        var popularHeadingElement, moreHeadingElement, FavouriteHeadingElement;
        if (journeyType == "arrive") {
            popularHeadingElement = $('#m_arrivePopularStationHeading_tt');
            moreHeadingElement = $('#m_arriveMoreStationHeading_tt');
            FavouriteHeadingElement = $('#m_arriveFavouriteStationHeading_tt');
        }
        else {
            popularHeadingElement = $('#m_departPopularStationHeading_tt');
            moreHeadingElement = $('#m_departMoreStationHeading_tt');
            FavouriteHeadingElement = $('#m_departFavouriteStationHeading_tt');
        }
        m_clearPopularStations(journeyType);
        m_clearMoreStations(journeyType);
        m_clearFavouriteStations(journeyType)
        if (searchField.length > 2) {
            //Load favourite stations which are filtered
            var filteredFavouriteStations = filterStations(FavouriteStation, searchField);
            $.each(filteredFavouriteStations, function (index, station) {
                m_bindFavouriteStations(journeyType, station.Name, station.CRS);
            });
            //Load popular stations which are filtered
            var filteredPopularStations = filterStations(PopularStations, searchField);
            $.each(filteredPopularStations, function (index, station) {
                m_bindPopularStations(journeyType, station.Name, station.CRS);
            });
            //Load more stations
            var filteredStations = filterStations(allstations, searchField);
            $.each(filteredStations, function (index, station) {
                m_bindAllStations(journeyType, station.Name, station.CrsCode);
            });

            manageStationHeading(popularHeadingElement, filteredPopularStations);
            manageStationHeading(moreHeadingElement, filteredStations);
            manageStationHeading(FavouriteHeadingElement, filteredFavouriteStations);
        }
        else if (searchField.length == 0) {
            //filter favourite stations
            $.each(FavouriteStation, function (index, station) {
                m_bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            //filter popular stations
            $.each(PopularStations, function (index, station) {
                m_bindPopularStations(journeyType, station.Name, station.CRS);
            });
            manageStationHeading(FavouriteHeadingElement, FavouriteStation);
            manageStationHeading(popularHeadingElement, PopularStations);
            manageStationHeading(moreHeadingElement, null);
        }
        else {
            //Load Favourite stations which are filtered
            var filteredFavouriteStations = filterStations(FavouriteStation, searchField);
            $.each(filteredFavouriteStations, function (index, station) {
                m_bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            //Load popular stations which are filtered
            var filteredPopularStations = filterStations(PopularStations, searchField);
            $.each(filteredPopularStations, function (index, station) {
                m_bindPopularStations(journeyType, station.Name, station.CRS);
            });
            //clearMoreStations();
            manageStationHeading(FavouriteHeadingElement, filteredFavouriteStations);
            manageStationHeading(popularHeadingElement, filteredPopularStations);
            manageStationHeading(moreHeadingElement, null);
        }
    }
    var manageStationHeading = function (element, stations) {
        if (stations != null && stations.length > 0)
            element.show();
        else
            element.hide();
    }

    var filterStations = function (stations, searchText) {
        var filteredStations = [];
        for (var i = 0; i < stations.length; i++) {
            if (stations[i].Name.toLowerCase().indexOf(searchText.toLowerCase()) > -1) {
                filteredStations.push(stations[i]);
            }
            else {
                continue;
            }
        }
        return filteredStations;
    }

    var datePrefixSelection = function (element) {
        var currentTab = $(element).closest('.ui-widget-content');
        $(currentTab).find('.departby-radio').removeClass('active');
        setTimeout(function () {
            $(element).addClass('active');
        }, 100)
    }

    var fillPopularStationList = function () {
        //Popular station list 
        clearPopularStations('depart');
        clearMoreStations('arrive');
        m_clearPopularStations('depart');
        m_clearMoreStations('arrive');

        manageStationHeading($('#departMoreStationHeading_tt'), null);
        manageStationHeading($('#m_departMoreStationHeading_tt'), null);
        manageStationHeading($('#m_arriveMoreStationHeading_tt'), null);
        manageStationHeading($('#arriveMoreStationHeading_tt'), null);
        //manageStationHeading($('#departFavouriteStationHeading_tt'), null);
        //manageStationHeading($('#arriveFavouriteStationHeading_tt'), null);

        for (var i = 0; i < PopularStations.length; i++) {
            bindPopularStations('depart', PopularStations[i].Name, PopularStations[i].CRS);
            bindPopularStations('arrive', PopularStations[i].Name, PopularStations[i].CRS);
            m_bindPopularStations('depart', PopularStations[i].Name, PopularStations[i].CRS);
            m_bindPopularStations('arrive', PopularStations[i].Name, PopularStations[i].CRS);

        }
    };
    var FillFavouriteStationList = function () {
        //Favourite station list 
        //clearPopularStations('depart');
        clearMoreStations('arrive');
        clearFavouriteStations('depart');
        m_clearMoreStations('arrive');
        m_clearFavouriteStations('depart');

        //clearing  departing more station mobile and desktop
        manageStationHeading($('#departMoreStationHeading_tt'), null);
        manageStationHeading($('#m_departMoreStationHeading_tt'), null);

        //clearing arrival more station mobile and desktop
        manageStationHeading($('#arriveMoreStationHeading_tt'), null);
        manageStationHeading($('#m_arriveMoreStationHeading_tt'), null);

        for (var i = 0; i < FavouriteStation.length; i++) {
            bindFavouriteStations('depart', FavouriteStation[i].Name, FavouriteStation[i].CRS);
            bindFavouriteStations('arrive', FavouriteStation[i].Name, FavouriteStation[i].CRS);
            m_bindFavouriteStations('depart', FavouriteStation[i].Name, FavouriteStation[i].CRS);
            m_bindFavouriteStations('arrive', FavouriteStation[i].Name, FavouriteStation[i].CRS);

        }

    };

    var padLeft = function (nr, n, str) {
        return Array(n - String(nr).length + 1).join(str || '0') + nr;
    }

    var buildTimeData = function () {
        var i = 0, j = 0, times = [];
        while (i < 24) {
            if (j == 0) {
                var time = padLeft(i, 2) + ":" + padLeft(j, 2);
                times.push(time);
                j += 30;
                continue;
            }
            else {
                var time = padLeft(i, 2) + ":" + padLeft(j, 2);
                times.push(time);
                j = 0;
                i += 1;
                continue;
            }
        }
        return times;
    }



    var getDateOnly = function (date) {
        date = new Date(date);
        return moment.utc([date.getFullYear(), date.getMonth(), date.getDate()]).format(DATE_FORMAT);
    }


    var getDateTime = function (date, originalFormat, newFormat) {
        return moment.utc(date, originalFormat).format(newFormat);
    }

    var setDateTime = function (date, time) {
        date = moment.utc(date, DATE_FORMAT),
            time = moment(time, 'HH:mm');

        date.set({
            hour: time.get('hour'),
            minute: time.get('minute'),
            second: time.get('second')
        });

        return date.format(DATETIME_FORMAT);
    }

    var refreshDatePickers = function () {
        // $('#anytime-date-calendar1').datepicker('refresh');
        $('#m_specific-date-calendar_tt').datepicker('refresh');
    }



    var validateDates = function (onSubmit) {
        $('.error-message.journey-dates').hide();
        var error = qttForm.validateDates();
        if (!error.valid) {
            //Show date errors
            for (var i = 0; i < error.errors.length; i++) {
                if (error.errors[i].onSubmit == onSubmit) {
                    $('#' + error.errors[i].key).first().html(error.errors[i].message);
                    $('.error-message.journey-dates').show();
                }
            }

        }
        else {

        }
    }
    var setWithExpiry = function (key, value, ttl) {
        const now = new Date()

        // `item` is an object which contains the original value
        // as well as the time when it's supposed to expire
        const item = {
            value: value,
            expiry: now.getTime() + ttl
        }
        localStorage.setItem(key, JSON.stringify(item))
    }
    var GenerateRedirectURL = function () {
        var DepartureStationElement = qttForm.departureStation;
        var ArrivalStationElement = qttForm.arrivalStation;
        var departureArr = DepartureStationElement.substring(0, DepartureStationElement.lastIndexOf('('));
        var arriveArr = ArrivalStationElement.substring(0, ArrivalStationElement.lastIndexOf('('));
        var departureStationName = $.trim(departureArr.toLowerCase());
        var arrivalStationName = $.trim(arriveArr.toLowerCase());
        departureStationName = departureStationName.replace(/(\s|\()+/g, '-').replace(')', '').toLowerCase();
        arrivalStationName = arrivalStationName.replace(/(\s|\()+/g, '-').replace(')', '').toLowerCase();
        setWithExpiry("trainlineData", { date: qttForm.departureDate, movementType: qttForm.departureOption }, 14400000);
        var URL = journeyCheckPageBaseURL + '/' + departureStationName + '/' + arrivalStationName;
        utils.redirect(context.environment.journeyCheckPageUrl + '/' + departureStationName + '/' + arrivalStationName);
        $("html, body").scrollTop($('#jc-results').offset().top - 30);

        //return URL;
    }

    var AddDisabledatediv_tt = function (el) {
        var date = el.parentElement.firstElementChild.textContent;
        var month = el.parentElement.parentElement.parentElement.parentElement.parentElement.firstElementChild.lastElementChild.firstElementChild.textContent;
        var year = el.parentElement.parentElement.parentElement.parentElement.parentElement.firstElementChild.lastElementChild.lastElementChild.textContent;
        var Disabledate = new Date(date + month + year);
        $.each(newDates, function (index, value) {
            var splitDates = value.Date.split("-");
            var dates = splitDates[1] + "-" + splitDates[0] + "-" + splitDates[2];
            var dateN = new Date(dates);
            var unavailabledate = value.Unavailabledatemessage;
            if (Disabledate.getTime() === dateN.getTime()) {
                if (value.ShowUnavailabledate == true && unavailabledate != "") {
                    $(".tooltip-disabldate-message_tt").append(unavailabledate);
                    $(".tooltip-disabldate-message_tt").show();
                }
                else {
                    $(".tooltip-disabldate-message_tt").hide();
                }
            }
        });
        var currentdate = moment().subtract(1, "days", DATE_FORMAT);
        var enddate = moment().add(maxDepartDateTT, "day", DATE_FORMAT);
        if (Disabledate < currentdate) {
            if (Outdaterange.ShowPastdatemessage && Outdaterange.Pastdatemessage != "") {
                $(".tooltip-disabldate-message_tt").append(Outdaterange.Pastdatemessage);
                $(".tooltip-disabldate-message_tt").show();
            }
            else {
                $(".tooltip-disabldate-message_tt").hide();
            }
        }
        if (Disabledate > enddate) {
            if (Outdaterange.ShowFuturedatemessage && Outdaterange.Futuredatemessage != "") {
                $(".tooltip-disabldate-message_tt").append(Outdaterange.Futuredatemessage);
                $(".tooltip-disabldate-message_tt").show();
            }
            else {
                $(".tooltip-disabldate-message_tt").hide();
            }
        }

    }
    var m_AddDisabledatediv_tt = function (el) {
        var date = el.parentElement.firstElementChild.textContent;
        var month = el.parentElement.parentElement.parentElement.parentElement.parentElement.firstElementChild.lastElementChild.firstElementChild.textContent;
        var year = el.parentElement.parentElement.parentElement.parentElement.parentElement.firstElementChild.lastElementChild.lastElementChild.textContent;
        var Disabledate = new Date(date + month + year);
        $.each(newDates, function (index, value) {
            var splitDates = value.Date.split("-");
            var dates = splitDates[1] + "-" + splitDates[0] + "-" + splitDates[2];
            var dateN = new Date(dates);
            var unavailabledate = value.Unavailabledatemessage;
            if (Disabledate.getTime() === dateN.getTime()) {
                if (value.ShowUnavailabledate == true && unavailabledate != "") {
                    $(".m_tooltip-disabldate-message_tt").append(unavailabledate);
                    $(".m_tooltip-disabldate-message_tt").show();
                }
                else {
                    $(".m_tooltip-disabldate-message_tt").hide();
                }
            }
        });
        var currentdate = moment().subtract(1, "days", DATE_FORMAT);
        var enddate = moment().add(maxDepartDateTT, "day", DATE_FORMAT);
        if (Disabledate < currentdate) {
            if (Outdaterange.ShowPastdatemessage && Outdaterange.Pastdatemessage != "") {
                $(".m_tooltip-disabldate-message_tt").append(Outdaterange.Pastdatemessage);
                $(".m_tooltip-disabldate-message_tt").show();
            }
            else {
                $(".m_tooltip-disabldate-message_tt").hide();
            }
        }
        if (Disabledate > enddate) {
            if (Outdaterange.ShowFuturedatemessage && Outdaterange.Futuredatemessage != "") {
                $(".m_tooltip-disabldate-message_tt").append(Outdaterange.Futuredatemessage);
                $(".m_tooltip-disabldate-message_tt").show();
            }
            else {
                $(".m_tooltip-disabldate-message_tt").hide();
            }
        }

    }


   
    $('.ui-datepicker-prev').attr("tabindex", "0");
    $('.ui-datepicker-next').attr("tabindex", "0");
    $(".ui-datepicker-next").attr("data-title", "Next");
    $(".ui-datepicker-prev").attr("data-title", "Prev");


    $(document).on('click', ".ui-datepicker-next", function () {

        $(".ui-datepicker-next").removeAttr("title");
        $(".ui-datepicker-prev").removeAttr("title");
        $(".ui-datepicker-next").attr("data-title", "Next");
        $('.ui-datepicker-next').attr('tabindex', '0');
        $('.ui-datepicker-prev').attr('tabindex', '0');
        $(".ui-datepicker-prev").attr("data-title", "Prev");
        AddNextprevbtnmsg();

        AddToolTip_tt();
    });

    $(document).on('click', ".ui-datepicker-prev", function () {


        $(".ui-datepicker-prev").removeAttr("title");
        $(".ui-datepicker-next").removeAttr("title");
        $(".ui-datepicker-prev").attr("data-title", "Prev");
        $(".ui-datepicker-next").attr("data-title", "Next");
        $('.ui-datepicker-next').attr('tabindex', '0');
        $('.ui-datepicker-prev').attr('tabindex', '0');
        AddNextprevbtnmsg();

        AddToolTip_tt();
    });

    $(document).on('keydown', ".ui-datepicker-prev", function (e) {
        if (e.which == 13) {
            if (!$(".div_after1").hasClass("prevui")) {
                $(".div_after1").addClass("prevui");
            }
            //$(".ui-datepicker-prev").after("<div class='ui-datepicker-prev-title div__after1 prevui'> </div>");
            $(this).trigger("click");
        }


    });



    $(document).on('keydown', ".ui-datepicker-next", function (e) {
        if (e.which == 13) {
            if (!$(".div_after").hasClass("nextui")) {
                $(".div_after").addClass("nextui");
            }

            /* $(".ui-datepicker-next").after("<div class='ui-datepicker-next-title div__after nextui'> </div>");*/
            $(this).trigger("click");
        }


    });
    var AddToolTip_tt = function () {

        $(".ui-state-disabled").each(function () {
            var element = $(this).find(".ui-state-default")
            var element2 = $(this).find(".tooltip-checker");
            if (element.length != 0 && element2.length == 0) {

                $.each(newDates, function (index, value) {
                    var splitDates = value.Date.split("-");
                    var dates = splitDates[1] + "-" + splitDates[0] + "-" + splitDates[2];
                    var dateN = new Date(dates);

                    var month = dateN.getMonth();
                    var year = dateN.getFullYear();

                    var message = value.Disabledatemessage;

                    if ($(element).parent().parent().find("[data-month='" + month + "']").length != 0 && $(element).parent().parent().find("[data-year='" + year + "']").length != 0 && element.text() == dateN.getDate().toString()) {
                        if (value.hoverstate == true && message != "") {
                            $("<div class='tooltip-checker'>" + message + "</div>").insertAfter($(element));
                        }
                    }
                });
            }
        });
    }

    var AddNextprevbtnmsg = function () {

        var Elementnext = $(".ui-datepicker-next").attr("data-title");
        var Elementprev = $(".ui-datepicker-prev").attr("data-title");

        //$("div.div__after").remove();
        //$("div.div__after1").remove();


        $(".ui-datepicker-next").after("<div class='ui-datepicker-next-title div_after nextui'>" + Elementnext + "</div>");
        $(".ui-datepicker-prev").after("<div class='ui-datepicker-prev-title div_after1 prevui'>" + Elementprev + "</div>");

        $(".div_after").hide();
        $(".div_after1").hide();


    }
    var bindEvents = function () {
        $(document).ready(function () {
            $('#tabs2_tt').tabs();
            $('#tabs3_tt').tabs();
            $('#tabs5').tabs();
            $('#tabs3').tabs();
            $('#tabs2').tabs();
            $('#tabs1').tabs();
            $('#tabs1_tt').tabs();
            $('#tabsMobile1_tt').tabs();
            $("#tabs").tabs();
            $('#tabs').show();
            $('#tabsMobile').tabs();
            $('#tabsMobile1').tabs();
            $('#tabsMobile2').tabs();
            $('#tabsMobile3').tabs();


            $("#tab-arrival-date").tabs();
            $("#mob-tabs").tabs();

            $('#m_txt_departure_station_tt').on('focus', function () {
                $(this).blur();
            });
            $('#m_txt_arrival_station_tt').on('focus', function () {
                $(this).blur();
            });


            $('#departingFromPopup_tt').on('focus', function () {
              /*  $(this).css('border', '1px dotted red');*/
                /*$(this).blur();*/
            });

            $('#departingFromPopup_tt').keyup(function (event) {
                var keyCode = (event.keyCode ? event.keyCode : event.which);
                if (keyCode == 13) {
                    $('#departingFromPopup_tt').trigger('click');
                }
            });

            $('#arrivingToPopup_tt').on('focus', function () {
                //$(this).css('border', '1px dotted red');
                /*$(this).blur();*/
            });

            $('#arrivingToPopup_tt').keyup(function (event) {
                var keyCode = (event.keyCode ? event.keyCode : event.which);
                if (keyCode == 13) {
                    $('#arrivingToPopup_tt').trigger('click');
                }
            });

            //$('#departureJourneyDateTime_tt').on('focus', function () {
            //    //$(this).css('border', '1px dotted red');
            //    /*$(this).blur();*/
            //});

            //$('#departureJourneyDateTime_tt').keyup(function (event) {
            //    var keyCode = (event.keyCode ? event.keyCode : event.which);
            //    if (keyCode == 13) {
            //        $('#departureJourneyDateTime_tt').trigger('click');
            //    }
            //});


            $('#close_depart_model_ttime').keyup(function (event) {
                var keyCode = (event.keyCode ? event.keyCode : event.which);
                if (keyCode == 13) {
                    $('#departureDatePopup_tt').hide();
                }

            });



            //$('#departingFromPopup_tt').on('focus', function () {
            //    $(this).blur();
            //});
            //$('#arrivingToPopup_tt').on('focus', function () {
            //    $(this).blur();
            //});
            //$("#departureJourneyDateTime_tt").on('focus', function () {
            //    $(this).blur();
            //});
            $("#m_departureJourneyDateTime_tt").on('focus', function () {
                $(this).blur();
            });
            $('.specific-date-time-selector').on('click', function () {
                datePrefixSelection(this);
            })
            $('.today-time-selector').on('click', function () {
                datePrefixSelection(this);
            })
            $('.tomorrow-time-selector').on('click', function () {
                datePrefixSelection(this);
            })
            $(document).on('mouseout', ".ui-state-default", function () {
                $(this).next().css("display", "none");
            });
            $(document).on('mouseover', ".ui-state-default", function () {
                $(this).next().css("display", "block");
            });

            $(document).on('mouseout', " .ui-datepicker-next", function () {
                $(".ui-datepicker-next-title").css("display", "none");
            });
            $(document).on('mouseover', ".ui-datepicker-next", function () {
                $(".ui-datepicker-next-title").css("display", "block");
            });

            $(document).on('mouseout', " .ui-datepicker-prev", function () {
                $(".ui-datepicker-prev-title").css("display", "none");
            });
            $(document).on('mouseover', ".ui-datepicker-prev", function () {
                $(".ui-datepicker-prev-title").css("display", "block");
            });


            $(document).on('click', ".ui-state-disabled .ui-state-default", function () {
                $(".tooltip-disabldate-message_tt").empty();
                $('.tooltip-default-message_tt').hide();
                $('.tooltip-enabldate-message_tt').hide();
                $(".m_tooltip-disabldate-message_tt").empty();
                $('.m_tooltip-default-message_tt').hide();
                $('.m_tooltip-enabldate-message_tt').hide();
                AddDisabledatediv_tt(this);
                m_AddDisabledatediv_tt(this);


            });
            $(document).on('click', ".ui-datepicker-next", function () {
                AddToolTip_tt();
            });
            $(document).on('click', ".ui-datepicker-prev", function () {
                AddToolTip_tt();
            });
            $('[data-modal-close]').on('click', function () {
                $(".tooltip-disabldate-message_tt").hide();
                $('.tooltip-default-message_tt').show();
                var modalId = $(this).data('modal-close');
                $('#' + modalId).modal('hide');
            })
            $("#specific-date-calendar_tt").datepicker({
                minDate: 0,
                maxDate: maxDepartDateTT, firstDay: 1,

                numberOfMonths: 2,
                beforeShowDay: function (date) {
                    if (newDates) {
                        var status = true;
                        for (var i = 0; i < newDates.length; i++) {
                            if (newDates[i].Date.indexOf(ut.getDateOnly(date)) > -1) {
                                status = false;
                                return [status, '',];
                            }
                        }
                        //for (i = 0; i < newDates.length; i++) {

                        //    var dateNew = new moment.utc(date).format(DATE_FORMAT);
                        //    if (moment.utc(newDates[i], 'DD-MM-YYYY').isSame(moment.utc(dateNew, 'DD-MM-YYYY'))) {
                        //        status = false;
                        //        break;
                        //    }

                        //}
                        return [status, ''];
                    }
                },
                onSelect: function (date, inst) {
                    inst.inline = false;
                    selectedDepartureDate = getDateOnly(date);
                    AddToolTip_tt();
                    $('.tooltip-default-message_tt').hide();
                    $('.tooltip-disabldate-message_tt').hide();
                    $('.tooltip-enabldate-message_tt').show();
                    var _day = inst.selectedDay;
                    var _month = inst.selectedMonth;

                    var calenderBody = $('#specific-date-calendar_tt *[data-month="' + _month + '"]').parents('tbody');

                    var element = $(calenderBody).find('td').not(".ui-datepicker-other-month");
                    if (element) {
                        $('.ui-state-active').removeClass('ui-state-active');
                        $(element[_day - 1]).children().addClass('ui-state-active');
                    }
                }
            });
            $("#m_specific-date-calendar_tt").datepicker({
                minDate: 0,
                maxDate: maxDepartDateTT, firstDay: 1,

                numberOfMonths: 1,
                beforeShowDay: function (date) {
                    if (newDates) {
                        var status = true;
                        for (var i = 0; i < newDates.length; i++) {
                            if (newDates[i].Date.indexOf(ut.getDateOnly(date)) > -1) {
                                status = false;
                                return [status, '',];
                            }
                        }
                        //for (i = 0; i < newDates.length; i++) {

                        //    var dateNew = new moment.utc(date).format(DATE_FORMAT);
                        //    if (moment.utc(newDates[i], 'DD-MM-YYYY').isSame(moment.utc(dateNew, 'DD-MM-YYYY'))) {
                        //        status = false;
                        //        break;
                        //    }

                        //}
                        return [status, ''];
                    }
                },
                onSelect: function (date, inst) {

                    selectedDepartureDate = getDateOnly(date);
                    $('.m_tooltip-default-message_tt').hide();
                    $('.m_tooltip-disabldate-message_tt').hide();
                    $('.m_tooltip-enabldate-message_tt').show();
                }
            });

            $('#departingFromPopup_tt').on('click', function () {
                $('#departingFrom_tt').val("").trigger('keyup');
                $('#DepartPopup_tt').modal('show');
                $('#departingFrom_tt').focus();
                $('#departingFrom_tt').keydown(function (objEvent) {
                    if (objEvent.keyCode == 9) {
                        objEvent.preventDefault();
                    }
                })
            });
            $('#arrivingToPopup_tt').on('click', function () {

                $('#arrivingTo_tt').val("").trigger('keyup');
                $('#ArrivalPopup_tt').modal('show');
                $('#arrivingTo_tt').focus();
                $('#arrivingTo_tt').keydown(function (objEvent) {
                    if (objEvent.keyCode == 9) {
                        objEvent.preventDefault();
                    }
                })
            });

            //for mobile view
            $('#m_txt_departure_station_tt').on('click', function () {
                $('#m_txt_departing_station_search_tt').val("").trigger('keyup');
                $('#mobile-departing-popup_tt').modal('show');
                $('#m_txt_departing_station_search_tt').focus();
            });
            $('#m_txt_arrival_station_tt').on('click', function () {
                $('#m_txt_returning_station_search_tt').val("").trigger('keyup');
                $('#mobile-returning-popup_tt').modal('show');
                $('#m_txt_returning_station_search_tt').focus();
            });
            $('.w_depart_date_tt').on('click', function () {
                var selectedTab = $('#tabs1_tt').tabs('option', 'active');
                selectedTab = 2;
                var date = new Date();
                var timetype;
                switch (selectedTab) {
                    case 0: {
                        //Today
                        selectedDepartureDate = moment.utc(date).format(DATE_FORMAT);
                        break;
                    }
                    case 1: {
                        //Tomorrow
                        selectedDepartureDate = moment.utc(date).add(1, 'days').format(DATE_FORMAT);
                        break;
                    }
                    default: {
                        //Specific Date

                        break;
                    }
                }
                var selectedTime = $('#w_dep_time_index_tt_' + selectedTab).val();
                selectedDepartureDate = setDateTime(selectedDepartureDate, selectedTime);
                timetype = $('#w_dep_btns_index_tt_' + selectedTab + " > .active").data("j-time");
                qttForm.departureDate = selectedDepartureDate;
                qttForm.departureOption = timetype;
                $('#departureJourneyDateTime_tt').val(moment(selectedDepartureDate, DATETIME_FORMAT).format(DISPLAY_DATE_TIME_FORMAT));
                $('#departureDatePopup_tt').modal('hide');
                $("#specific-date-calendar_tt").datepicker('setDate', moment(selectedDepartureDate, DATETIME_FORMAT).toDate());
                refreshDatePickers();
                validateDates(false);
            })
            $("#departureJourneyDateTime_tt").on('click', function () { //initializing elements such as date time
                $(".tooltip-disabldate-message_tt").hide();

                $(".ui-datepicker-next").removeAttr("title");
                $('.ui-datepicker-prev').removeAttr("title");
                $('.ui-datepicker-prev').attr("tabindex", "0");
                $('.ui-datepicker-next').attr("tabindex", "0");
                $(".ui-datepicker-next").attr("data-title", "Next");
                $(".ui-datepicker-prev").attr("data-title", "Prev");
                $('.tooltip-default-message_tt').show();
                $('.tooltip-enabldate-message_tt').hide();
                var times = buildTimeData();
                $('.depart-time-form select').empty();
                for (var i = 0; i < times.length; i++) {
                    var option = $('<option></option>');
                    option.attr("value", times[i]).html(times[i]);
                    $('.depart-time-form select').append($(option));
                }
                if (selectedDepartureDate != null) {
                    $('.depart-time-form select').val(moment(selectedDepartureDate, DATETIME_FORMAT).format(TIME_FORMAT));
                }
                else {
                    var defaultSelectedDepTime = moment().add(0, 'days').add(2, 'hours').minute(0);

                    $('.depart-time-form select').val(defaultSelectedDepTime.format(TIME_FORMAT));
                }
                AddNextprevbtnmsg();
                $('#departureDatePopup_tt').modal('show');
                AddToolTip_tt();
            });

            $("#Specfic1").removeAttr("tabindex");
            //for mobileView
            $('.m_depart_date_tt').on('click', function () {
                var selectedTab = $('#tabsMobile1_tt').tabs('option', 'active');
                selectedTab = 2;
                var date = new Date();
                var timetype;
                switch (selectedTab) {
                    case 0: {
                        //Today
                        selectedDepartureDate = moment.utc(date).format(DATE_FORMAT);
                        break;
                    }
                    case 1: {
                        //Tomorrow
                        selectedDepartureDate = moment.utc(date).add(1, 'days').format(DATE_FORMAT);
                        break;
                    }
                    default: {
                        //Specific Date

                        break;
                    }
                }
                var selectedTime = $('#m_dep_time_index_tt_' + selectedTab).val();
                selectedDepartureDate = setDateTime(selectedDepartureDate, selectedTime);
                timetype = $('#m_dep_btns_index_tt_' + selectedTab + " > .active").data("j-time");
                qttForm.departureDate = selectedDepartureDate;
                qttForm.departureOption = timetype;
                $('#m_departureJourneyDateTime_tt').val(moment(selectedDepartureDate, DATETIME_FORMAT).format(DISPLAY_DATE_TIME_FORMAT));
                $('#m_departureDatePopup_tt').modal('hide');
                $("#m_specific-date-calendar_tt").datepicker('setDate', moment(selectedDepartureDate, DATETIME_FORMAT).toDate());
                refreshDatePickers();
                validateDates(false);
            })

            $("#m_departureJourneyDateTime_tt").on('click', function () { //initializing elements such as date time
                $(".m_tooltip-disabldate-message_tt").hide();
                $('.m_tooltip-default-message_tt').show();
                $('.m_tooltip-enabldate-message_tt').hide();
                var times = buildTimeData();
                $('.depart-time-form select').empty();
                for (var i = 0; i < times.length; i++) {
                    var option = $('<option></option>');
                    option.attr("value", times[i]).html(times[i]);
                    $('.depart-time-form select').append($(option));
                }
                if (selectedDepartureDate != null) {
                    $('.depart-time-form select').val(moment(selectedDepartureDate, DATETIME_FORMAT).format(TIME_FORMAT));
                }
                else {
                    var defaultSelectedDepTime = moment().add(0, 'days').add(2, 'hours').minute(0);

                    $('.depart-time-form select').val(defaultSelectedDepTime.format(TIME_FORMAT));
                }
                $('#m_departureDatePopup_tt').modal('show');
            });

            

            $("#departingFrom_tt").on('keyup', function (e) {
                var searchField = $(this).val();
                bindStationKeyUpEvents('depart', searchField);
                if (e.keyCode === 13) {
                    var firstStation = $('.return-stations.depart.tt').first();
                    $(firstStation).click();
                }
                else {
                    var firstStation = $('.return-stations.depart.tt').first();
                    $(firstStation).removeClass('focused');
                    $(firstStation).addClass('focused');
                }
            });
            $("#arrivingTo_tt").on('keyup', function (e) {
                var searchField = $(this).val();
                bindStationKeyUpEvents('arrive', searchField);
                if (e.keyCode === 13) {
                    var firstStation = $('.return-stations.arrive.tt').first();
                    $(firstStation).click();
                }
                else {
                    var firstStation = $('.return-stations.arrive.tt').first();
                    $(firstStation).removeClass('focused');
                    $(firstStation).addClass('focused');
                }
            });

            //for mobile
            $("#m_txt_departing_station_search_tt").on('keyup', function () {
                var searchField = $(this).val();
                m_bindStationKeyUpEvents('depart', searchField);
            })
            $("#m_txt_returning_station_search_tt").on('keyup', function () {
                var searchField = $(this).val();
                m_bindStationKeyUpEvents('arrive', searchField);
            })

            $(document).on('click', "#DepartPopup_tt div.depart", function () {
                var station = $(this).attr('departcrsdatabind');
                if (station != null && station != '') {
                    qttForm.departureStation = station;
                    $("#departingFrom_tt").val(station);
                    $('#departingFromPopup_tt').val(station);
                    $('#DepartPopup_tt').modal('hide');
                    $('#departingFromPopup_tt').focus();
                }
            });

            // Departure Station selection from search and binding ends here
            $(document).on('click', "#ArrivalPopup_tt div.arrive", function () {
                var station = $(this).attr('arrivecrsdatabind');
                if (station != null && station != '') {
                    qttForm.arrivalStation = station;
                    $("#arrivingTo_tt").val(station);
                    $('#arrivingToPopup_tt').val(station);
                    $('#ArrivalPopup_tt').modal('hide');
                    $('#arrivingToPopup_tt').focus();
                }
            });

            //mobile data binding
            $(document).on('click', "#mobile-departing-popup_tt div.depart", function () {
                var station = $(this).attr('departcrsdatabind');
                if (station != null && station != '') {
                    qttForm.departureStation = station;
                    $("#m_txt_departure_station_tt").val(station);
                    $('#mobile-departing-popup_tt').modal('hide');
                }
            });

            // Departure Station selection from search and binding ends here
            $(document).on('click', "#mobile-returning-popup_tt div.arrive", function () {
                var station = $(this).attr('arrivecrsdatabind');
                if (station != null && station != '') {
                    qttForm.arrivalStation = station;
                    $('#m_txt_arrival_station_tt').val(station);
                    $('#mobile-returning-popup_tt').modal('hide');
                }
            });

            //swapping station functionality
            $('#SwapStation_tt').on('click', function () {
                if ((!qttForm.arrivalStation) || (!qttForm.departureStation)) {
                    return;
                }
                else {
                    var currArr = qttForm.arrivalStation;
                    var currDep = qttForm.departureStation;
                    qttForm.arrivalStation = currDep;
                    qttForm.departureStation = currArr;
                    $('#arrivingToPopup_tt').val(qttForm.arrivalStation);
                    $('#departingFromPopup_tt').val(qttForm.departureStation);
                }

            });
            $('#m_SwapStation_tt').on('click', function () {
                if ((!qttForm.arrivalStation) || (!qttForm.departureStation)) {
                    return;
                }
                else {
                    var currArr = qttForm.arrivalStation;
                    var currDep = qttForm.departureStation;
                    qttForm.arrivalStation = currDep;
                    qttForm.departureStation = currArr;
                    $('#m_txt_arrival_station_tt').val(qttForm.arrivalStation);
                    $('#m_txt_departure_station_tt').val(qttForm.departureStation);
                }

            });


            $('#checkTrainTime').on('click', function () {

                var Validationresult = qttForm.Validate();

                submitted = true;
                localStorage.setItem("AllstationsPICO", JSON.stringify(allstations));
                GenerateRedirectURL();
                // window.location.replace(GenerateRedirectURL());
                //$("html, body").scrollTop($('#jc-results').offset().top - 30);
            });
            $('#m_checkTrainTime').on('click', function () {

                var Validationresult = qttForm.Validate();

                submitted = true;
                localStorage.setItem("AllstationsPICO", JSON.stringify(allstations));
                window.location.replace(GenerateRedirectURL());
            });
        })
        //disabling the inputs

    };

    return {
        init: init
    }

});
define("customJS/Qttv2", ['dataService',
    'customJS/QttModuleForPICO',
    'customJS/QttMobileModuleForPICO',
    'customJS/SeasonTicketModule',
    'customJS/SeasonTicketMobileModule',
'customJS/QttTraintimeModule'], function (dataService, buyTicket,buyTicketMobile,seasonTicket,seasonTicketMobile,trainTimes) {
   
    var init = function (Promocode) {


        dataService.allstationForPICO().done(function (data) {
            allstations = data;

            buyTicket.init(allstations, Promocode);
            buyTicketMobile.init(allstations, Promocode);
            seasonTicket.init(allstations);
            seasonTicketMobile.init(allstations);
            trainTimes.init(allstations);
        }).fail(function () {
            allstations = [];
            buyTicket.init(allstations, Promocode);
            buyTicketMobile.init(allstations, Promocode);
            seasonTicket.init(allstations);
            seasonTicketMobile.init(allstations);
            trainTimes.init(allstations);
        });
    }
    return {
        init: init
    }
});
define('customJS/SideQTTModulePICO', ['jquery', 'dataService', 'customJS/QttUtilityForPICO', 'customJS/QttFormViewModelForPICO', 'moment', 'context','utils'], function ($, dataService,Utility,QttFormVM,moment,context,utils) {
    var allstations = [];
    var ut = Utility;
    var qttForm = new QttFormVM.QttForm();
    var PopularStations = [];
    var FavouriteStation = [];
    var DATETIME_FORMAT = "DD-MM-YYYY HH:mm", DATE_FORMAT = "DD-MM-YYYY";
    var TIME_FORMAT = "HH:mm"; DISPLAY_DATE_TIME_FORMAT = "ddd DD MMM, HH:mm";
    var departureDatetime = null;
    var init = function () {
        utils.waitForElement('#SideQttDepartFromPopup', function () {
            bindEvents();
        });
        //utils.waitForElement('#SideQttArrivingToPopup', function () {
        //    bindEvents();
        //}); // no need to call it twice as all the elements will be rendered by then
        getStations();
        getStationbyCookie();
        initializeJourney();
        console.log("this is Pico");
    }
    var getStations = function () {

        dataService.allstationForPICO().done(function (data) {
            allstations=data;
            setPopularAndFavouriteStation();
            
        });
       
    }
    var getStationbyCookie = function () {
        
        var x = document.cookie.split(";");
        for (i = 0; i < x.length; i++) {
            var cookiepair = x[i].split("=");
            if ('SideqttLeavingFrom' == cookiepair[0].trim()) {
                qttForm.departureStation = decodeURIComponent(cookiepair[1]);
                $('#SideQttDepartFromPopup').val(qttForm.departureStation);
            }
            if ('SideqttLeavingFromCode' == cookiepair[0].trim()) {
                qttForm.departureStationCRSCode = decodeURIComponent(cookiepair[1]);

            }
            if ('SideqttGoingTo' == cookiepair[0].trim()) {
                qttForm.arrivalStation = decodeURIComponent(cookiepair[1]);
                $('#SideQttArrivingToPopup').val(qttForm.arrivalStation);
            }
            if ('SideqttGoingToCode' == cookiepair[0].trim()) {
                qttForm.arrivalStationCRSCode = decodeURIComponent(cookiepair[1]);

            }
        }

    }
    var initializeJourney = function () {
        var date = moment().format(DATE_FORMAT);
        var time = moment().add(0, 'days').add(1, 'hours').minute(0);
        departureDatetime = setDateTime(date, time);
        qttForm.departureDate = departureDatetime;
        qttForm.departureOption = 'D';
        
    }
    var FillFavouriteStationList = function () {
        //Favourite station list 
        clearPopularStations('depart');
        clearMoreStations('arrive');
        clearFavouriteStations('depart');
        manageStationHeading($('#SideQttdepartMoreStationHeading'), null);
        manageStationHeading($('#SideQttdepartMoreStationHeading'), null);
        manageStationHeading($('#SideQttarriveMoreStationHeading'), null);
        manageStationHeading($('#SideQttarriveMoreStationHeading'), null);
        manageStationHeading($('#SideQttdepartFavouriteStationHeading'), null);
        manageStationHeading($('#SideQttarriveFavouriteStationHeading'), null);
        for (var i = 0; i < FavouriteStation.length; i++) {
            bindFavouriteStations('depart', FavouriteStation[i].Name, FavouriteStation[i].CRS);
            bindFavouriteStations('arrive', FavouriteStation[i].Name, FavouriteStation[i].CRS);

        }

    };
    var setDateTime = function (date, time) {
        date = moment.utc(date, DATE_FORMAT),
            time = moment(time, 'HH:mm');

        date.set({
            hour: time.get('hour'),
            minute: time.get('minute'),
            second: time.get('second')
        });

        return date.format(DATETIME_FORMAT);
    }
    var fillPopularStationList = function () {
        //Popular station list 
        clearPopularStations('depart');
        clearMoreStations('arrive');
        manageStationHeading($('#SideQttdepartMoreStationHeading'), null);
        manageStationHeading($('#SideQttdepartMoreStationHeading'), null);
        manageStationHeading($('#SideQttarriveMoreStationHeading'), null);
        manageStationHeading($('#SideQttarriveMoreStationHeading'), null);
        manageStationHeading($('#SideQttdepartFavouriteStationHeading'), null);
        manageStationHeading($('#SideQttarriveFavouriteStationHeading'), null);
        for (var i = 0; i < PopularStations.length; i++) {
            bindPopularStations('depart', PopularStations[i].Name, PopularStations[i].CRS);
            bindPopularStations('arrive', PopularStations[i].Name, PopularStations[i].CRS);

        }

    };
    var setFavouriteStation = function () {
        if (FavouriteStation.length != 0) {
            $('#SideQttdepartFavouriteStationHeading').show();
            $('#SideQttarriveFavouriteStationHeading').show();
            FillFavouriteStationList();
        }
        else {
            $('#SideQttdepartFavouriteStationHeading').hide();
            $('#SideQttarriveFavouriteStationHeading').hide();
        }

    }
    var setPopularStation = function () {
        if (PopularStations.length != 0) {
            fillPopularStationList();
        }

    }
    var setPopularAndFavouriteStation = function () {
        FavouriteStation = ut.getFavouriteStationForPICO(allstations);
        PopularStations = ut.getPopularStationForPICO(allstations);
        PopularStations = ut.disjointPopularAndFavouriteStation(PopularStations, FavouriteStation);
        setPopularStation();
        setFavouriteStation();
    }
    var filterStations = function (stations, searchText) {
        var filteredStations = [];
        var matchedCRSstationIndex = 0;
        var matchedStationwithCRS = false;
        for (var i = 0; i < stations.length; i++) {
            if (stations[i].Name.substring(stations[i].Name.lastIndexOf('(')).replace('(', '').replace(')', '') == searchText.toUpperCase()) {
                matchedCRSstationIndex = i;
                matchedStationwithCRS = true;
            }
            else if (stations[i].Name.toLowerCase().indexOf(searchText.toLowerCase()) > -1) {
                filteredStations.push(stations[i]);
            }
            else {
                continue;
            }
        }
        if (matchedStationwithCRS) {
            filteredStations.unshift(stations[matchedCRSstationIndex]);
        }
        return filteredStations;
    }
    var getStationColumns = function (journeyType, stationName, stationCode) {
        var disabled = false;
        if (journeyType == 'depart') {
            disabled = qttForm.arrivalStation != null && stationName == qttForm.arrivalStation;
        }
        else {
            disabled = qttForm.departureStation != null && stationName == qttForm.departureStation;
        }
        var valueAttribute = journeyType == 'depart' ? 'departcrsdatabind' : 'arrivecrsdatabind';
        var columnElement = $('<div></div>').addClass('column');
        var stationElement = $('<div></div>').addClass('return-stations ' + journeyType).attr(valueAttribute, stationCode);
        if (disabled)
            stationElement.addClass('station-disabled').removeAttr(valueAttribute);
        var stationNameElement = $('<div></div>').addClass('return-station-name').html(stationName);
        var stationCodeElement = $('<div></div>').addClass('return-station-shortcode').html();//html(stationCode);
        stationElement.append(stationNameElement).append(stationCodeElement);
        columnElement.append(stationElement);
        return columnElement;
    }
    var manageStationHeading = function (element, stations) {
        if (stations != null && stations.length > 0)
            element.show();
        else
            element.hide();
    }
    var bindPopularStations = function (journeyType, stationName, stationCode) {
        if (stationCode != undefined && stationCode != "") {
            var columnElement = getStationColumns(journeyType, stationName, stationCode);
            if (journeyType == "depart") {
                $("#SideQtt-Departing-Popular-station").append(columnElement);
            }
            else {
                $("#SideQtt-Arriving-Popular-station").append(columnElement);
            }
        }


    }
    var bindFavouriteStations = function (journeyType, stationName, stationCode) {
        if (stationCode != undefined && stationCode != "") {
            var columnElement = getStationColumns(journeyType, stationName, stationCode);
            if (journeyType == "depart") {
                $("#SideQtt-Departing-Favourite-station").append(columnElement);
                $('#SideQttdepartFavouriteStationHeading').show();
            }
            else {
                $("#SideQtt-Arriving-Favourite-station").append(columnElement);
                $('#SideQttarriveFavouriteStationHeading').show();
            }
        }


    }
    var bindAllStations = function (journeyType, stationName, stationCode) {
        var columnElement = getStationColumns(journeyType, stationName, stationCode);
        if (journeyType == "depart") {
            $('#SideQttfiltersearchDeparture').append(columnElement);
        }
        else {
            $('#SideQttfiltersearchArrival').append(columnElement);
        }
    }
    var clearMoreStations = function (journeyType) {
        if (journeyType == "arrive") {
            $('#SideQttfiltersearchArrival').empty();
        }
        else {
            $('#SideQttfiltersearchDeparture').empty();
        }
    }

    var clearPopularStations = function (journeyType) {

        if (journeyType == "arrive") {
            $("#SideQtt-Arriving-Popular-station").empty();
        }
        else {
            $("#SideQtt-Departing-Popular-station").empty();
        }
    }
    var clearFavouriteStations = function (journeyType) {

        if (journeyType == "arrive") {
            $("#SideQtt-Arriving-Favourite-station").empty();
        }
        else {
            $('#SideQtt-Departing-Favourite-station').empty();

        }
    }
    var bindStationKeyUpEvents = function (journeyType, searchField) {

        var popularHeadingElement, moreHeadingElement, FavouriteHeadingElement;
        if (journeyType == "arrive") {
            FavouriteHeadingElement = $('#SideQttarriveFavouriteStationHeading');
            popularHeadingElement = $('#SideQttarrivePopularStationHeading');
            moreHeadingElement = $('#SideQttarriveMoreStationHeading');
        }
        else {
            FavouriteHeadingElement = $('#SideQttdepartFavouriteStationHeading');
            popularHeadingElement = $('#SideQttdepartPopularStationHeading');
            moreHeadingElement = $('#SideQttdepartMoreStationHeading');
        }
        
        clearFavouriteStations(journeyType);
        clearPopularStations(journeyType);
        clearMoreStations(journeyType);
        if (searchField.length > 2) {
            //Load Favourite stations which are filtered
            var filteredFavouriteStations = filterStations(FavouriteStation, searchField);
            $.each(filteredFavouriteStations, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
            });

            //Load popular stations which are filtered
            var filteredPopularStations = filterStations(PopularStations, searchField);
            $.each(filteredPopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
            });
            //Load more stations
            var filteredStations = filterStations(allstations, searchField);
            $.each(filteredStations, function (index, station) {
                bindAllStations(journeyType, station.Name, station.CrsCode);
            });

            manageStationHeading(FavouriteHeadingElement, filteredFavouriteStations);
            manageStationHeading(popularHeadingElement, filteredPopularStations);
            manageStationHeading(moreHeadingElement, filteredStations);
        }
        else if (searchField.length == 0) {
            //filter favourite stations
            $.each(FavouriteStation, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            ////filter popular stations
            $.each(PopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
                //commmented this for just removing popular stations for the time being
            });
            manageStationHeading(FavouriteHeadingElement, FavouriteStation);
            manageStationHeading(popularHeadingElement, PopularStations);
            manageStationHeading(moreHeadingElement, null);
        }
        else {
            //Load Favourite stations which are filtered
            var filteredFavouriteStations = filterStations(FavouriteStation, searchField);
            $.each(filteredFavouriteStations, function (index, station) {
                bindFavouriteStations(journeyType, station.Name, station.CRS);
            });
            //Load popular stations which are filtered
            var filteredPopularStations = filterStations(PopularStations, searchField);
            $.each(filteredPopularStations, function (index, station) {
                bindPopularStations(journeyType, station.Name, station.CRS);
            });
            //clearMoreStations();
            manageStationHeading(FavouriteHeadingElement, filteredFavouriteStations);
            manageStationHeading(popularHeadingElement, filteredPopularStations);
            manageStationHeading(moreHeadingElement, null);
        }
    }
    var bindEvents = function () {
        $(document).ready(function () {
            $("#SideQttDepartFromPopup").on('focus', function () {
                $(this).blur();
            });
            $("#SideQttArrivingToPopup").on('focus', function () {
                $(this).blur();
            });
            $("#SideQttDepartFromPopup").on('click', function () {
                $('#SideQttdepartingFrom').val("").trigger('keyup'); // this is done to refresh search history
                $('#SideQttDepartPopup').show();
                $('#SideQttdepartingFrom').focus();
            });
            $("#SideQttdepartingFrom").on('keyup', function () {
                var searchField = $(this).val();
                bindStationKeyUpEvents('depart', searchField);
            });
            $("#SideQttarrivingTo").on('keyup', function () {
                var searchField = $(this).val();
                bindStationKeyUpEvents('arrive', searchField);
            });
            $("#SideQttArrivingToPopup").on('click',  function () {
                $('#SideQttarrivingTo').val("").trigger('keyup');// this is done to refresh search history
                $('#SideQttArrivalPopup').show();
                $('#SideQttarrivingTo').focus();
            });
            $('[data-modal-close]').on('click', function () {
                var modalId = $(this).data('modal-close');
                $('#' + modalId).hide();
                $('#error-railcard-quantity').hide();
            });
            $(document).on('click', "#SideQttDepartPopup div.depart", function () {
                var stationCode = $(this).attr('departcrsdatabind');
                var stationName = $(this).children('div.return-station-name').html();
                if (stationCode != null && stationCode != '') {

                    qttForm.departureStation = stationName;
                    qttForm.departureStationCRSCode = stationCode;
                    $("#SideQttDepartFromPopup").val(stationName);
                    $('#SideQttdepartingFromPopup').val(stationName);
                    $('#SideQttDepartPopup').hide();
                    //qttForm.ValidateDepartureStation();
                }
            });

            // Departure Station selection from search and binding ends here
            $(document).on('click', "#SideQttArrivalPopup div.arrive", function () {
                var stationCode = $(this).attr('arrivecrsdatabind');
                var stationName = $(this).children('div.return-station-name').html();
                if (stationCode != null && stationCode != '') {
                    qttForm.arrivalStation = stationName;
                    qttForm.arrivalStationCRSCode = stationCode;
                    $("#SideQttarrivingTo").val(stationName);
                    $('#SideQttArrivingToPopup').val(stationName);
                    $('#SideQttArrivalPopup').hide();
                   // qttForm.ValidateArrivalStation();
                }
            });
            $('#SideQttSwapStation').on('click', function () {
                if ((!qttForm.arrivalStation) || (!qttForm.departureStation)) {
                    return;
                }
                else {
                    var currArr = qttForm.arrivalStation;
                    var currDep = qttForm.departureStation;
                    qttForm.arrivalStation = currDep;
                    qttForm.departureStation = currArr;
                    $('#SideQttArrivingToPopup').val(qttForm.arrivalStation);
                    $('#SideQttDepartFromPopup').val(qttForm.departureStation);
                }

            });
            $('#append-button-here-smallqtt').on('click', function () {
                var validationResult = qttForm.Validate();
                if (validationResult.valid) {
                    

                    document.cookie = 'SideqttLeavingFrom=' + qttForm.departureStation;
                    document.cookie = 'SideqttLeavingFromCode=' + qttForm.departureStationCRSCode;
                    document.cookie = 'SideqttGoingTo=' + qttForm.arrivalStation;
                    document.cookie = 'SideqttGoingToCode=' + qttForm.arrivalStationCRSCode;
                    ut.handOffDekstop(qttForm, entryDataContext.PICOWebtisEngineUrl);
                    $('.sidebar form').trigger('reset');
                    
                }
                else {
                    //Handle errors
                    // alert("There are some validation errors");
                }
                //ut.handOffDekstop(qttForm, entryDataContext.PICOWebtisEngineUrl);
            });
            
        });
    }

    return {
        init: init
    }
});
define('customJS/SmartAppBannerMain', ['require'],function (smartAppBanner) {

    var init = function () {
        banner = undefined;
        if (navigator.userAgent.match(/Android/i)
            || navigator.userAgent.match(/webOS/i)
            || navigator.userAgent.match(/iPhone/i)
            || navigator.userAgent.match(/iPad/i)
            || navigator.userAgent.match(/iPod/i)
            || navigator.userAgent.match(/BlackBerry/i)
            || navigator.userAgent.match(/Windows Phone/i)) {

            var homefullURL = window.location.href;
            var homePagePath = homefullURL.toLowerCase();
            if ((homePagePath == "https://wc.dev.local/") || (homePagePath == "https://dev.avantiwestcoast.co.uk/") || (homePagePath == "https://staging.avantiwestcoast.co.uk/") || (homePagePath == "https://picouat.avantiwestcoast.co.uk/") || (homePagePath == "https://www.avantiwestcoast.co.uk/")) {
                if (navigator.userAgent.match(/Android/i)) {

                    var fallbackToStore = function () {
                        run('android');
                        //window.location.replace('https://play.google.com/store/apps/details?id=com.avantiwestcoast&hl=en_GB&gl=US');
                    };
                    var openApp = function () {
                        window.location.replace('intent://app/SplashScreen#Intent;scheme=app_;package=com.sdf.android.dsds;end');
                    };
                    var triggerAppOpen = function () {
                        //openApp();
                        setTimeout(fallbackToStore, 700);
                    };
                    triggerAppOpen();
                }
                else if (navigator.userAgent.match(/iPhone/i)
                    || navigator.userAgent.match(/iPad/i)
                    || navigator.userAgent.match(/iPod/i)) {
                    //run('ios');
                }
            }
        }
    }
    var run = function (force) {
        var n = document.querySelector('.smartbanner');
        if (n) {
            n.parentNode.removeChild(n);
        }
        new SmartBanner({
            daysHidden: 30, // days to hide banner after close button is clicked (defaults to 15)
            daysReminder: 30, // days to hide banner after "VIEW" button is clicked (defaults to 90)
            appStoreLanguage: 'gb', // language code for the App Store (defaults to user's browser language)
            title: 'Avanti West Coast',
            author: 'Avanti West Coast',
            button: 'View',
            force: force
        });
    };
    return {
        init: init
    }

});
define('binder', [
    'jquery',
    'knockout',
    'koBindingHandlers',
    'qubitEnabler',
    'viewmodels/SkipNavigation',
    //'viewmodels/qttRailcardsFormUi',
    //'viewmodels/qttRailcardsFormUiAWC',
    'viewmodels/stationSelectorFormUi',
    //'viewmodels/liveDeparturesFormUi',
    'viewmodels/liveDeparturesResultsUi',
    'viewmodels/journeyCheckFormUi',
    'viewmodels/journeyCheckResultsUi',
    'viewmodels/globalServiceInfoUi',
    //'viewmodels/exploreTheWestUi',
    'viewmodels/notificationBarUi',
    //'viewmodels/searchUi',
    //'viewmodels/popularRoutesUi',
    'viewmodels/navigationUi',
    
    //'viewmodels/journeyDisruptionsUi',
    //'viewmodels/liveDeparturesAndArrivalsUi',
    'viewmodels/shareButtonUi',
    //'viewmodels/basketSessionUi',
    
    'viewmodels/seatAvailabilityCheckerUi',
    //'viewmodels/liveInformationBoardUi',
    //'viewmodels/smartAppBanner',
    'viewmodels/engineeringWorkUi',
    //'viewmodels/stationsListUi',
    'viewmodels/StationEventListUI',
    //Forms
    'viewmodels/forms/assistedTravelFormUi',
    'viewmodels/forms/groupTravelFormUi',
    'viewmodels/forms/createEventFormUI',
    'viewmodels/forms/createVenueFormUI',
    //CustomJS
    'customJS/AutoSuggest',
    'customJS/BannerOverlay',
    'customJS/OfferData',
    'customJS/GADataLayer',
    'customJS/QttFormViewModelForPICO',
    'customJS/Qttv2',
    'customJS/QttModuleForPICO',
    'customJS/QttTraintimeModule',
    'customJS/QttMobileModuleForPICO',
    'customJS/QttUtilityForPICO',
    'customJS/SeasonTicketViewModel',
    'customJS/SeasonTicketModule',
    'customJS/SeasonTicketUtility',
    'customJS/SeasonTicketMobileModule',
    'customJS/SideQTTModulePICO',
    'customJS/SmartAppBannerMain'
     
    ],
function (
    $,
    ko,
    koBindingHandlers,
    qubitEnabler,
    SkipNavigation,
    //GADataLayer,
    //qttFormUi,
    //qttFormUiAWC,
    stationSelectorFormUi,
    //liveDeparturesFormUi,
    liveDeparturesResultsUi,
    journeyCheckFormUi,
    journeyCheckResultsUi,
    globalServiceInfoUi,
    //exploreTheWestUi,
    notificationBarUi,
    //searchUi,
    //popularRoutesUi,
    navigationUi,
  
    //journeyDisruptionsUi,
    //liveDeparturesAndArrivalsUi,
    shareButtonUi,
   // basketSessionUi,
  
    seatAvailabilityCheckerUi,
    //liveInformationBoardUi,
    //smartAppBanner,
    engineeringWorkUi,
    StationEventListUI,
    //stationsListUi,
    //forms
    assistedTravelFormUi,
    groupTravelFormUi,
    createEventFormUI,
    createVenueFormUI
   ) {
        var applyClassWideBindings = function (className, viewModel, options) {
            $(className).each(function (index, element) {
                var deleteBindings = true;
                if (options && options.keepExistingBindings === true) {
                    deleteBindings = false;
                }

                if (deleteBindings) {
                    ko.cleanNode(element);
                }
                try {
                    ko.applyBindings(viewModel, element);
                }
                catch (ex) {
                     // do nothing;
                }
            });
        };

        var applyAllBindings = function () {
            $(document).ready(function () {
                ko.applyBindings();
                //applyClassWideBindings('.component-qtt-form-pico', qttFormUi);
                //applyClassWideBindings('.component-qtt-form', qttFormUiAWC);
                applyClassWideBindings('.component-detailed-network-status', globalServiceInfoUi);
                applyClassWideBindings('.component-journey-check-form', journeyCheckFormUi);
                applyClassWideBindings('.component-journey-check-results', journeyCheckResultsUi);
                applyClassWideBindings('.component-station-selector-form', stationSelectorFormUi);
                //applyClassWideBindings('.component-live-departures-form', liveDeparturesFormUi);
                applyClassWideBindings('.component-live-departures-results', liveDeparturesResultsUi);
                applyClassWideBindings('.component-global-service-info', globalServiceInfoUi);
                //applyClassWideBindings('.component-explore-west', exploreTheWestUi);
                applyClassWideBindings('.component-cookie-notification', notificationBarUi);
                //applyClassWideBindings('.component-search-results-listing', searchUi);
                //applyClassWideBindings('.component-popular-routes', popularRoutesUi);
                applyClassWideBindings('.main-navigation', navigationUi);
               
                //applyClassWideBindings('.component-journey-disruptions', journeyDisruptionsUi);
                //applyClassWideBindings('.component-live-departures-and-arrivals', liveDeparturesAndArrivalsUi);
                applyClassWideBindings('.component-social-sharing', shareButtonUi);
                //applyClassWideBindings('.basket-status', basketSessionUi);
             
                applyClassWideBindings('.component-seat-availability-form', seatAvailabilityCheckerUi);
                applyClassWideBindings('.component-seat-availability-results', seatAvailabilityCheckerUi);
                //applyClassWideBindings('.component-live-information-board', liveInformationBoardUi);
                //applyClassWideBindings('.component-smart-app-banner', smartAppBanner);
                applyClassWideBindings('.component-engineering-work-calendar', engineeringWorkUi);
                applyClassWideBindings('.component-StationEventListUI', StationEventListUI);
                //applyClassWideBindings('.indexed-station-list', stationsListUi);
                //forms
              
                applyClassWideBindings('.component-assistedtravel-form', assistedTravelFormUi);
                applyClassWideBindings('.component-grouptravel-form', groupTravelFormUi);
                applyClassWideBindings('.component-createEvent-form', createEventFormUI);
                applyClassWideBindings('.component-createVenue-form', createVenueFormUI);
             
            });
        };

        return {
            applyClassWideBindings: applyClassWideBindings,
            applyAllBindings: applyAllBindings,
            applyBindings: ko.applyBindings
        };
    }
);

/*! Lity - v2.3.1 - 2018-04-20
* http://sorgalla.com/lity/
* Copyright (c) 2015-2018 Jan Sorgalla; Licensed MIT */

!function(a,b){"function"==typeof define&&define.amd?define('lity',["jquery"],function(c){return b(a,c)}):"object"==typeof module&&"object"==typeof module.exports?module.exports=b(a,require("jquery")):a.lity=b(a,a.jQuery||a.Zepto)}("undefined"!=typeof window?window:this,function(a,b){"use strict";function c(a){var b=B();return N&&a.length?(a.one(N,b.resolve),setTimeout(b.resolve,500)):b.resolve(),b.promise()}function d(a,c,d){if(1===arguments.length)return b.extend({},a);if("string"==typeof c){if(void 0===d)return void 0===a[c]?null:a[c];a[c]=d}else b.extend(a,c);return this}function e(a){for(var b,c=decodeURI(a.split("#")[0]).split("&"),d={},e=0,f=c.length;e<f;e++)c[e]&&(b=c[e].split("="),d[b[0]]=b[1]);return d}function f(a,c){return a+(a.indexOf("?")>-1?"&":"?")+b.param(c)}function g(a,b){var c=a.indexOf("#");return-1===c?b:(c>0&&(a=a.substr(c)),b+a)}function h(a){return b('<span class="lity-error"/>').append(a)}function i(a,c){var d=c.opener()&&c.opener().data("lity-desc")||"Image with no description",e=b('<img src="'+a+'" alt="'+d+'"/>'),f=B(),g=function(){f.reject(h("Failed loading image"))};return e.on("load",function(){if(0===this.naturalWidth)return g();f.resolve(e)}).on("error",g),f.promise()}function j(a,c){var d,e,f;try{d=b(a)}catch(a){return!1}return!!d.length&&(e=b('<i style="display:none !important"/>'),f=d.hasClass("lity-hide"),c.element().one("lity:remove",function(){e.before(d).remove(),f&&!d.closest(".lity-content").length&&d.addClass("lity-hide")}),d.removeClass("lity-hide").after(e))}function k(a){var c=J.exec(a);return!!c&&o(g(a,f("https://www.youtube"+(c[2]||"")+".com/embed/"+c[4],b.extend({autoplay:1},e(c[5]||"")))))}function l(a){var c=K.exec(a);return!!c&&o(g(a,f("https://player.vimeo.com/video/"+c[3],b.extend({autoplay:1},e(c[4]||"")))))}function m(a){var c=M.exec(a);return!!c&&(0!==a.indexOf("http")&&(a="https:"+a),o(g(a,f("https://www.facebook.com/plugins/video.php?href="+a,b.extend({autoplay:1},e(c[4]||""))))))}function n(a){var b=L.exec(a);return!!b&&o(g(a,f("https://www.google."+b[3]+"/maps?"+b[6],{output:b[6].indexOf("layer=c")>0?"svembed":"embed"})))}function o(a){return'<div class="lity-iframe-container"><iframe frameborder="0" allowfullscreen src="'+a+'"/></div>'}function p(){return z.documentElement.clientHeight?z.documentElement.clientHeight:Math.round(A.height())}function q(a){var b=v();b&&(27===a.keyCode&&b.options("esc")&&b.close(),9===a.keyCode&&r(a,b))}function r(a,b){var c=b.element().find(G),d=c.index(z.activeElement);a.shiftKey&&d<=0?(c.get(c.length-1).focus(),a.preventDefault()):a.shiftKey||d!==c.length-1||(c.get(0).focus(),a.preventDefault())}function s(){b.each(D,function(a,b){b.resize()})}function t(a){1===D.unshift(a)&&(C.addClass("lity-active"),A.on({resize:s,keydown:q})),b("body > *").not(a.element()).addClass("lity-hidden").each(function(){var a=b(this);void 0===a.data(F)&&a.data(F,a.attr(E)||null)}).attr(E,"true")}function u(a){var c;a.element().attr(E,"true"),1===D.length&&(C.removeClass("lity-active"),A.off({resize:s,keydown:q})),D=b.grep(D,function(b){return a!==b}),c=D.length?D[0].element():b(".lity-hidden"),c.removeClass("lity-hidden").each(function(){var a=b(this),c=a.data(F);c?a.attr(E,c):a.removeAttr(E),a.removeData(F)})}function v(){return 0===D.length?null:D[0]}function w(a,c,d,e){var f,g="inline",h=b.extend({},d);return e&&h[e]?(f=h[e](a,c),g=e):(b.each(["inline","iframe"],function(a,b){delete h[b],h[b]=d[b]}),b.each(h,function(b,d){return!d||(!(!d.test||d.test(a,c))||(f=d(a,c),!1!==f?(g=b,!1):void 0))})),{handler:g,content:f||""}}function x(a,e,f,g){function h(a){k=b(a).css("max-height",p()+"px"),j.find(".lity-loader").each(function(){var a=b(this);c(a).always(function(){a.remove()})}),j.removeClass("lity-loading").find(".lity-content").empty().append(k),m=!0,k.trigger("lity:ready",[l])}var i,j,k,l=this,m=!1,n=!1;e=b.extend({},H,e),j=b(e.template),l.element=function(){return j},l.opener=function(){return f},l.options=b.proxy(d,l,e),l.handlers=b.proxy(d,l,e.handlers),l.resize=function(){m&&!n&&k.css("max-height",p()+"px").trigger("lity:resize",[l])},l.close=function(){if(m&&!n){n=!0,u(l);var a=B();if(g&&(z.activeElement===j[0]||b.contains(j[0],z.activeElement)))try{g.focus()}catch(a){}return k.trigger("lity:close",[l]),j.removeClass("lity-opened").addClass("lity-closed"),c(k.add(j)).always(function(){k.trigger("lity:remove",[l]),j.remove(),j=void 0,a.resolve()}),a.promise()}},i=w(a,l,e.handlers,e.handler),j.attr(E,"false").addClass("lity-loading lity-opened lity-"+i.handler).appendTo("body").focus().on("click","[data-lity-close]",function(a){b(a.target).is("[data-lity-close]")&&l.close()}).trigger("lity:open",[l]),t(l),b.when(i.content).always(h)}function y(a,c,d){a.preventDefault?(a.preventDefault(),d=b(this),a=d.data("lity-target")||d.attr("href")||d.attr("src")):d=b(d);var e=new x(a,b.extend({},d.data("lity-options")||d.data("lity"),c),d,z.activeElement);if(!a.preventDefault)return e}var z=a.document,A=b(a),B=b.Deferred,C=b("html"),D=[],E="aria-hidden",F="lity-"+E,G='a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,[contenteditable],[tabindex]:not([tabindex^="-"])',H={esc:!0,handler:null,handlers:{image:i,inline:j,youtube:k,vimeo:l,googlemaps:n,facebookvideo:m,iframe:o},template:'<div class="lity" role="dialog" aria-label="Dialog Window (Press escape to close)" tabindex="-1"><div class="lity-wrap" data-lity-close role="document"><div class="lity-loader" aria-hidden="true">Loading...</div><div class="lity-container"><div class="lity-content"></div><button class="lity-close" type="button" aria-label="Close (Press escape to close)" data-lity-close>&times;</button></div></div></div>'},I=/(^data:image\/)|(\.(png|jpe?g|gif|svg|webp|bmp|ico|tiff?)(\?\S*)?$)/i,J=/(youtube(-nocookie)?\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?([\w-]{11})(.*)?/i,K=/(vimeo(pro)?.com)\/(?:[^\d]+)?(\d+)\??(.*)?$/,L=/((maps|www)\.)?google\.([^\/\?]+)\/?((maps\/?)?\?)(.*)/i,M=/(facebook\.com)\/([a-z0-9_-]*)\/videos\/([0-9]*)(.*)?$/i,N=function(){var a=z.createElement("div"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return b[c];return!1}();return i.test=function(a){return I.test(a)},y.version="2.3.1",y.options=b.proxy(d,y,H),y.handlers=b.proxy(d,y,H.handlers),y.current=v,b(z).on("click.lity","[data-lity]",y),y});
define('htmlContentInit', ['jquery', 'mapper', 'ticketingService', 'lity', 'popupHelper', 'dateUtils'],
    function ($, mapper, ticketingService, lity, popupHelper, dateUtils) {
        var init = function () {
            $('body').on('click', '.disabled', function(e) {
                e.preventDefault();
                return false;
            });

            $('body').on('click', '.promo, .destination', function(e) {
                if (e.target.tagName != 'A') {
                    var $firstLink = $(this).find('a.main-link');
                    if ($firstLink.length > 0) {
                        if (($firstLink.attr('href') != '') && ($firstLink.attr('href') != '#') || ($firstLink.hasClass('with-lightbox'))) {
                            $firstLink[0].click();
                        }
                    }
                    e.preventDefault(); e.stopPropagation();
                }
            });

            var updateValidationStatus = function( $elem ) {
                $elem.parents('.form-group').toggleClass('has-validation-error', $elem.hasClass('validation-error'));
            };

            $('table').each(function (index, table) {
                if ($(table).closest('.table-scroll-wrapper').length == 0) {
                    $(table).wrap('<div class="table-scroll-wrapper"></div>');
                }
            });

            $('.unavailable')
                .on('click', 'a', function(e) {
                    e.preventDefault();
                });

            $('form')
                .on('gwr-validated', function() {
                    $('select, input, textarea').each(function() { updateValidationStatus($(this)); });
                })

                .on('change', 'select', function() {
                    var $this = $(this);
                    updateValidationStatus($this);
                })
                .on('click', 'input[type="checkbox"]', function() {
                    $(this).parents('.checkbox-wrapper').parent().toggleClass('checked', $(this).is(':checked'));
                    updateValidationStatus($(this));
                })
                .on('click', '#via-avoid-wrapper > input:first-of-type', function () {
                    $(this).blur();
                })
                .on('click', 'input[type="radio"]', function() {
                    $(this).parents('.ul-radio-wrapper').find('input[type="radio"]').each(
                        function() {
                            $(this).parents('.radio-wrapper').parent().toggleClass('checked', $(this).is(':checked'));
                        }
                    );
                    updateValidationStatus($(this));
                })
                .on('click', '.btn-submit', function(e) {
                    var $form = $(e.target).parents('form');
                    $form.trigger('gwr-validated');
                    e.preventDefault();
                    e.stopImmediatePropagation();
                    //setTimeout( function() { $form.submit() }, 400);
                })
                .on('click', '.icon-search', function(e) {
                    var $form = $(e.target).parents('form');
                    if ($form.attr('role') == 'search') {
                        $form.submit();
                    }
                });

            $("a[href*='#resolve-booking-engine']").click(function (event) {
                var url = $(this).attr('href').split('#')[0];
                var queryString = $(this).attr('href').split('?')[1];
                if (!queryString) queryString = url;
                $(this).attr('href','#');
                var parameters = queryString.split("&").map(function (n) { return n = n.split("="), this[n[0]] = n[1], this }.bind({}))[0];
                var ticketSearchCriteria = mapper.ticketSearchCriteria.fromRedirectionData(parameters);
                if(parameters.departureDate === "now"){
                    ticketSearchCriteria.departureDate(dateUtils.currentDate().add(1, 'hour'));
                }
                if (ticketSearchCriteria.isValid())
                    ticketingService.findTickets(ticketSearchCriteria);
                else
                    ticketingService.redirectToBookingEngineHome();
                event.preventDefault();
                return false;
            });

            $("a[href*='#journeyplanner']").click(function (event) {
                var viewModel = {
                    altRouteFinderIFrameSrc : 'https://www.tpexpress.co.uk/door-to-door-planner',
                };

                popupHelper.showDialog('altRouteFinderModal', viewModel, null, function () {});
                event.preventDefault();
            });

            $(".expandable-panel").each(function(index) {
                var $panel = $(this);
                var $expandLink = $('<a class="expandable-panel-link">Read more...</a>');
                $panel.after($expandLink);
                
                var openClassName = 'open';
                $expandLink.click(function(){
                    if($panel.hasClass(openClassName)){
                        $panel.removeClass(openClassName);
                        $expandLink.text('Read more...');
                    }
                    else{
                        $panel.addClass(openClassName);
                        $expandLink.text('Read less...');
                    }
                    return false;
                });
            });
        };


        return {
            init: function() {
                $(document).ready(init);
            }
        };
    });

require([
    'validationHelper',
    'binder',
    'htmlContentInit',        
    'koExtenders',
    'koBindingHandlers'
],
function (
    validationHelper,
    binder,
    htmlContentInit,    
    /* additional dependencies: */
    koExtenders,
    koBindingHandlers
) {
    validationHelper.init();
    binder.applyAllBindings();
    htmlContentInit.init();    
});

define("index", function(){});