Explorar o código

Set up Grunt tasks to build web and Node versions of CyberChef using webpack

n1474335 %!s(int64=8) %!d(string=hai) anos
pai
achega
885fbe13ac
Modificáronse 56 ficheiros con 299 adicións e 29138 borrados
  1. 1 0
      .babelrc
  2. 1 0
      .gitignore
  3. 73 139
      Gruntfile.js
  4. 16 4
      package.json
  5. 4 1
      src/js/.eslintrc.json
  6. 1 1
      src/js/core/Chef.js
  7. 4 0
      src/js/core/FlowControl.js
  8. 7 2
      src/js/core/Recipe.js
  9. 1 33
      src/js/core/Utils.js
  10. 0 1271
      src/js/lib/Sortable.js
  11. 0 2372
      src/js/lib/bootstrap-3.3.6.js
  12. 0 1116
      src/js/lib/bootstrap-colorpicker.js
  13. 0 583
      src/js/lib/bootstrap-switch.js
  14. 1 1
      src/js/lib/bzip2.js
  15. 1 1
      src/js/lib/canvascomponents.js
  16. 0 1055
      src/js/lib/diff.js
  17. 0 1159
      src/js/lib/es6-promise.auto.js
  18. 0 9192
      src/js/lib/jquery-2.1.1.js
  19. 0 1658
      src/js/lib/prettify.js
  20. 0 585
      src/js/lib/split.js
  21. 3 1
      src/js/lib/uas_parser.js
  22. 0 8466
      src/js/lib/xpath.js
  23. 0 1231
      src/js/lib/yahoo.js
  24. 3 3
      src/js/operations/ByteRepr.js
  25. 11 21
      src/js/operations/Code.js
  26. 1 1
      src/js/operations/Compress.js
  27. 0 3
      src/js/operations/DateTime.js
  28. 1 1
      src/js/operations/HTTP.js
  29. 1 1
      src/js/operations/Hexdump.js
  30. 9 4
      src/js/views/html/ControlsWaiter.js
  31. 8 2
      src/js/views/html/HTMLApp.js
  32. 1 1
      src/js/views/html/HTMLCategory.js
  33. 1 1
      src/js/views/html/HTMLIngredient.js
  34. 4 1
      src/js/views/html/HTMLOperation.js
  35. 4 1
      src/js/views/html/HighlighterWaiter.js
  36. 4 1
      src/js/views/html/InputWaiter.js
  37. 12 1
      src/js/views/html/Manager.js
  38. 4 2
      src/js/views/html/OperationsWaiter.js
  39. 1 1
      src/js/views/html/OptionsWaiter.js
  40. 4 1
      src/js/views/html/OutputWaiter.js
  41. 6 3
      src/js/views/html/RecipeWaiter.js
  42. 1 1
      src/js/views/html/SeasonalWaiter.js
  43. 1 1
      src/js/views/html/WindowWaiter.js
  44. 9 2
      src/js/views/html/main.js
  45. 9 22
      src/js/views/node/index.js
  46. 0 24
      test/NodeRunner.js
  47. 0 99
      test/PhantomRunner.js
  48. 3 1
      test/TestRegister.js
  49. 78 24
      test/TestRunner.js
  50. 0 33
      test/test.html
  51. 2 0
      test/tests/operations/Base58.js
  52. 2 0
      test/tests/operations/Compress.js
  53. 2 0
      test/tests/operations/FlowControl.js
  54. 2 0
      test/tests/operations/MorseCode.js
  55. 2 0
      test/tests/operations/StrUtils.js
  56. 0 11
      webpack.config.js

+ 1 - 0
.babelrc

@@ -0,0 +1 @@
+{ "presets": [ "es2015" ] }

+ 1 - 0
.gitignore

@@ -2,6 +2,7 @@ node_modules
 npm-debug.log
 build/dev
 build/test
+build/node
 docs/*
 !docs/*.conf.json
 !docs/*.ico

+ 73 - 139
Gruntfile.js

@@ -1,4 +1,4 @@
-/* eslint-env node */
+var webpack = require("webpack");
 
 module.exports = function(grunt) {
     grunt.file.defaultEncoding = "utf8";
@@ -7,16 +7,20 @@ module.exports = function(grunt) {
     // Tasks
     grunt.registerTask("dev",
         "A persistent task which creates a development build whenever source files are modified.",
-        ["clean:dev", "concat:css", "concat:js", "copy:htmlDev", "copy:staticDev", "chmod:build", "watch"]);
+        ["clean:dev", "concat:css", "webpack:web", "copy:htmlDev", "copy:staticDev", "chmod:build", "watch"]);
+
+    grunt.registerTask("node",
+        "Compiles CyberChef into a single NodeJS module.",
+        ["clean:node", "webpack:node", "chmod:build"]);
 
     grunt.registerTask("test",
         "A task which runs all the tests in test/tests.",
-        ["clean:test", "concat:jsTest", "copy:htmlTest", "chmod:build", "execute:test"]);
+        ["clean:test", "webpack:tests", "chmod:build", "execute:test"]);
 
     grunt.registerTask("prod",
         "Creates a production-ready build. Use the --msg flag to add a compile message.",
-        ["eslint", "exec:stats", "clean", "jsdoc", "concat", "copy:htmlDev", "copy:htmlProd", "copy:htmlInline",
-         "copy:staticDev", "copy:staticProd", "cssmin", "uglify:prod", "inline", "htmlmin", "chmod", "test"]);
+        ["eslint", "test", "exec:stats", "clean", "jsdoc", "webpack:web", "concat", "copy:htmlDev", "copy:htmlProd", "copy:htmlInline",
+         "copy:staticDev", "copy:staticProd", "cssmin", "uglify:prod", "inline", "htmlmin", "docs", "chmod"]);
 
     grunt.registerTask("docs",
         "Compiles documentation in the /docs directory.",
@@ -43,6 +47,7 @@ module.exports = function(grunt) {
     grunt.loadNpmTasks("grunt-eslint");
     grunt.loadNpmTasks("grunt-jsdoc");
     grunt.loadNpmTasks("grunt-contrib-clean");
+    grunt.loadNpmTasks("grunt-webpack");
     grunt.loadNpmTasks("grunt-contrib-concat");
     grunt.loadNpmTasks("grunt-contrib-copy");
     grunt.loadNpmTasks("grunt-contrib-uglify");
@@ -55,125 +60,6 @@ module.exports = function(grunt) {
     grunt.loadNpmTasks("grunt-contrib-watch");
 
 
-    // JS includes
-    var jsIncludes = [
-        // Third party framework libraries
-        "src/js/lib/jquery-2.1.1.js",
-        "src/js/lib/bootstrap-3.3.6.js",
-        "src/js/lib/split.js",
-        "src/js/lib/bootstrap-switch.js",
-        "src/js/lib/yahoo.js",
-        "src/js/lib/snowfall.jquery.js",
-
-        // Third party operation libraries
-        "src/js/lib/cryptojs/core.js",
-        "src/js/lib/cryptojs/x64-core.js",
-        "src/js/lib/cryptojs/enc-base64.js",
-        "src/js/lib/cryptojs/enc-utf16.js",
-        "src/js/lib/cryptojs/md5.js",
-        "src/js/lib/cryptojs/evpkdf.js",
-        "src/js/lib/cryptojs/cipher-core.js",
-        "src/js/lib/cryptojs/mode-cfb.js",
-        "src/js/lib/cryptojs/mode-ctr-gladman.js",
-        "src/js/lib/cryptojs/mode-ctr.js",
-        "src/js/lib/cryptojs/mode-ecb.js",
-        "src/js/lib/cryptojs/mode-ofb.js",
-        "src/js/lib/cryptojs/format-hex.js",
-        "src/js/lib/cryptojs/lib-typedarrays.js",
-        "src/js/lib/cryptojs/pad-ansix923.js",
-        "src/js/lib/cryptojs/pad-iso10126.js",
-        "src/js/lib/cryptojs/pad-iso97971.js",
-        "src/js/lib/cryptojs/pad-nopadding.js",
-        "src/js/lib/cryptojs/pad-zeropadding.js",
-        "src/js/lib/cryptojs/aes.js",
-        "src/js/lib/cryptojs/hmac.js",
-        "src/js/lib/cryptojs/rabbit-legacy.js",
-        "src/js/lib/cryptojs/rabbit.js",
-        "src/js/lib/cryptojs/ripemd160.js",
-        "src/js/lib/cryptojs/sha1.js",
-        "src/js/lib/cryptojs/sha256.js",
-        "src/js/lib/cryptojs/sha224.js",
-        "src/js/lib/cryptojs/sha512.js",
-        "src/js/lib/cryptojs/sha384.js",
-        "src/js/lib/cryptojs/sha3.js",
-        "src/js/lib/cryptojs/tripledes.js",
-        "src/js/lib/cryptojs/rc4.js",
-        "src/js/lib/cryptojs/pbkdf2.js",
-        "src/js/lib/cryptoapi/crypto-api.js",
-        "src/js/lib/cryptoapi/hasher.md2.js",
-        "src/js/lib/cryptoapi/hasher.md4.js",
-        "src/js/lib/cryptoapi/hasher.sha0.js",
-        "src/js/lib/jsbn/jsbn.js",
-        "src/js/lib/jsbn/jsbn2.js",
-        "src/js/lib/jsbn/base64.js",
-        "src/js/lib/jsbn/ec.js",
-        "src/js/lib/jsbn/prng4.js",
-        "src/js/lib/jsbn/rng.js",
-        "src/js/lib/jsbn/rsa.js",
-        "src/js/lib/jsbn/sec.js",
-        "src/js/lib/jsrasign/asn1-1.0.js",
-        "src/js/lib/jsrasign/asn1hex-1.1.js",
-        "src/js/lib/jsrasign/asn1x509-1.0.js",
-        "src/js/lib/jsrasign/base64x-1.1.js",
-        "src/js/lib/jsrasign/crypto-1.1.js",
-        "src/js/lib/jsrasign/dsa-modified-1.0.js",
-        "src/js/lib/jsrasign/ecdsa-modified-1.0.js",
-        "src/js/lib/jsrasign/ecparam-1.0.js",
-        "src/js/lib/jsrasign/keyutil-1.0.js",
-        "src/js/lib/jsrasign/x509-1.1.js",
-        "src/js/lib/blowfish.dojo.js",
-        "src/js/lib/rawdeflate.js",
-        "src/js/lib/rawinflate.js",
-        "src/js/lib/zip.js",
-        "src/js/lib/unzip.js",
-        "src/js/lib/zlib_and_gzip.js",
-        "src/js/lib/bzip2.js",
-        "src/js/lib/punycode.js",
-        "src/js/lib/uas_parser.js",
-        "src/js/lib/esprima.js",
-        "src/js/lib/escodegen.browser.js",
-        "src/js/lib/esmangle.min.js",
-        "src/js/lib/diff.js",
-        "src/js/lib/moment.js",
-        "src/js/lib/moment-timezone.js",
-        "src/js/lib/prettify.js",
-        "src/js/lib/vkbeautify.js",
-        "src/js/lib/Sortable.js",
-        "src/js/lib/bootstrap-colorpicker.js",
-        "src/js/lib/es6-promise.auto.js",
-        "src/js/lib/xpath.js",
-
-        // Custom libraries
-        "src/js/lib/canvascomponents.js",
-
-        // Utility functions
-        "src/js/core/Utils.js",
-
-        // Operation objects
-        "src/js/operations/*.js",
-
-        // Core framework objects
-        "src/js/core/*.js",
-        "src/js/config/Categories.js",
-        "src/js/config/OperationConfig.js",
-
-        // HTML view objects
-        "src/js/views/html/*.js",
-        "!src/js/views/html/main.js",
-
-    ];
-
-    var jsAppFiles = jsIncludes.concat([
-        // Start the main app!
-        "src/js/views/html/main.js",
-    ]);
-
-    var jsTestFiles = jsIncludes.concat([
-        "test/TestRegister.js",
-        "test/tests/**/*.js",
-        "test/TestRunner.js",
-    ]);
-
     var banner = '/**\n\
  * CyberChef - The Cyber Swiss Army Knife\n\
  *\n\
@@ -235,8 +121,70 @@ module.exports = function(grunt) {
             dev: ["build/dev/*"],
             prod: ["build/prod/*"],
             test: ["build/test/*"],
+            node: ["build/node/*"],
             docs: ["docs/*", "!docs/*.conf.json", "!docs/*.ico"],
         },
+        webpack: {
+            options: {
+                plugins: [
+                    new webpack.ProvidePlugin({
+                        $: "jquery",
+                        jQuery: "jquery",
+                        moment: "moment-timezone"
+                    }),
+                ],
+                resolve: {
+                    alias: {
+                        jquery: "jquery/src/jquery"
+                    }
+                },
+                module: {
+                    loaders: [{
+                        test: /\.js$/,
+                        exclude: /node_modules/,
+                        loader: "babel-loader?compact=false"
+                    }]
+                }
+            },
+            web: {
+                target: "web",
+                entry: "./src/js/views/html/main.js",
+                output: {
+                    filename: "scripts.js",
+                    path: "build/dev"
+                },
+            },
+            tests: {
+                target: "node",
+                entry: "./test/TestRunner.js",
+                output: {
+                    filename: "index.js",
+                    path: "build/test"
+                },
+                module: {
+                    loaders: [{
+                        test: /prettify\.min\.js$/,
+                        use: "imports-loader?window=>global"
+                    }]
+                }
+            },
+            node: {
+                target: "node",
+                entry: "./src/js/views/node/index.js",
+                output: {
+                    filename: "CyberChef.js",
+                    path: "build/node",
+                    library: "CyberChef",
+                    libraryTarget: "commonjs2"
+                },
+                module: {
+                    loaders: [{
+                        test: /prettify\.min\.js$/,
+                        use: "imports-loader?window=>global"
+                    }]
+                }
+            }
+        },
         concat: {
             options: {
                 process: templateOptions
@@ -256,20 +204,6 @@ module.exports = function(grunt) {
                     "src/css/themes/classic.css"
                 ],
                 dest: "build/dev/styles.css"
-            },
-            js: {
-                options: {
-                    banner: '"use strict";\n'
-                },
-                src: jsAppFiles,
-                dest: "build/dev/scripts.js"
-            },
-            jsTest: {
-                options: {
-                    banner: '"use strict";\n'
-                },
-                src: jsTestFiles,
-                dest: "build/test/tests.js"
             }
         },
         copy: {
@@ -491,7 +425,7 @@ module.exports = function(grunt) {
             }
         },
         execute: {
-            test: "test/NodeRunner.js"
+            test: "build/test/index.js"
         },
         watch: {
             css: {

+ 16 - 4
package.json

@@ -25,11 +25,12 @@
     "type": "git",
     "url": "https://github.com/gchq/CyberChef/"
   },
-  "scripts": {
-    "build": "webpack"
-  },
   "devDependencies": {
-    "grunt": "~1.0.1",
+    "babel-core": "^6.24.0",
+    "babel-loader": "^6.4.0",
+    "babel-preset-es2015": "^6.24.0",
+    "exports-loader": "^0.6.4",
+    "grunt": ">=0.4.5",
     "grunt-chmod": "~1.1.1",
     "grunt-contrib-clean": "~1.0.0",
     "grunt-contrib-concat": "~1.0.0",
@@ -43,11 +44,18 @@
     "grunt-execute": "^0.2.2",
     "grunt-inline-alt": "~0.3.10",
     "grunt-jsdoc": "^2.1.0",
+    "grunt-webpack": "^2.0.1",
+    "import-loader": "^1.0.1",
+    "imports-loader": "^0.7.1",
     "ink-docstrap": "^1.1.4",
     "phantomjs-prebuilt": "^2.1.14",
     "webpack": "^2.2.1"
   },
   "dependencies": {
+    "babel-polyfill": "^6.23.0",
+    "bootstrap": "^3.3.7",
+    "bootstrap-colorpicker": "^2.5.1",
+    "bootstrap-switch": "^3.3.4",
     "crypto-api": "^0.6.2",
     "crypto-js": "^3.1.9-1",
     "diff": "^3.2.0",
@@ -61,7 +69,11 @@
     "moment": "^2.17.1",
     "moment-timezone": "^0.5.11",
     "sladex-blowfish": "^0.8.1",
+    "sortablejs": "^1.5.1",
+    "split.js": "^1.2.0",
     "vkbeautify": "^0.99.1",
+    "xmldom": "^0.1.27",
+    "xpath": "0.0.24",
     "zlibjs": "^0.2.0"
   }
 }

+ 4 - 1
src/js/.eslintrc.json

@@ -7,7 +7,6 @@
     },
     "env": {
         "browser": true,
-        "jquery": true,
         "es6": true,
         "commonjs": true,
         "node": true
@@ -88,6 +87,10 @@
         "space-in-parens": "error"
     },
     "globals": {
+        "$": false,
+        "jQuery": false,
+        "moment": false,
+
         /* core/* */
         "Chef": false,
         "Dish": false,

+ 1 - 1
src/js/core/Chef.js

@@ -24,7 +24,7 @@ var Chef = module.exports = function() {
  * @param {Object} options - The options object storing various user choices
  * @param {boolean} options.attempHighlight - Whether or not to attempt highlighting
  * @param {number} progress - The position in the recipe to start from
- * @param {number} [step] - The number of operations to execute
+ * @param {number} [step] - Whether to only execute one operation in the recipe
  *
  * @returns {Object} response
  * @returns {string} response.result - The output of the recipe

+ 4 - 0
src/js/core/FlowControl.js

@@ -1,3 +1,7 @@
+var Recipe = require("./Recipe.js"),
+    Dish = require("./Dish.js");
+
+
 /**
  * Flow Control operations.
  *

+ 7 - 2
src/js/core/Recipe.js

@@ -1,5 +1,5 @@
-var OperationConfig = require("../config/OperationConfig.js"),
-    Operation = require("./Operation.js");
+var Operation = require("./Operation.js");
+// OperationConfig required at the bottom of this file to prevent circular dependency errors
 
 
 /**
@@ -216,3 +216,8 @@ Recipe.prototype.fromString = function(recipeStr) {
     var recipeConfig = JSON.parse(recipeStr);
     this._parseConfig(recipeConfig);
 };
+
+
+// Required here to prevent circular dependency where Recipe returns an empty object
+// See http://stackoverflow.com/a/30390378
+var OperationConfig = require("../config/OperationConfig.js");

+ 1 - 33
src/js/core/Utils.js

@@ -1,6 +1,4 @@
-var CryptoJS = require("crypto-js"),
-    moment = require("moment"),
-    $ = require("jquery");
+var CryptoJS = require("crypto-js");
 
 
 /**
@@ -1172,36 +1170,6 @@ var Utils = module.exports = {
 };
 
 
-/**
- * A jQuery function to select a range of text.
- *
- * @param {number} start
- * @param {number} end
- *
- * @example
- * // Highlights the 4th, 5th and 6th characters in the element #input-text.
- * $("#input-text").selectRange(3,5);
- *
- * // Places the cursor at the beginning of the element #input-text.
- * $("#input-text").selectRange(0);
- */
-// $.fn.selectRange = function(start, end) {
-//     if (!end) end = start;
-//     return this.each(function() {
-//         if (this.setSelectionRange) {
-//             this.focus();
-//             this.setSelectionRange(start, end);
-//         } else if (this.createTextRange) {
-//             var range = this.createTextRange();
-//             range.collapse(true);
-//             range.moveEnd("character", end);
-//             range.moveStart("character", start);
-//             range.select();
-//         }
-//     });
-// };
-
-
 /**
  * Removes all duplicates from an array.
  *

+ 0 - 1271
src/js/lib/Sortable.js

@@ -1,1271 +0,0 @@
-/** @license
-========================================================================
-  Sortable
-  @author	RubaXa   <trash@rubaxa.org>
-  @license MIT
-*/
-
-(function (factory) {
-	"use strict";
-
-	if (typeof define === "function" && define.amd) {
-		define(factory);
-	}
-	else if (typeof module != "undefined" && typeof module.exports != "undefined") {
-		module.exports = factory();
-	}
-	else if (typeof Package !== "undefined") {
-		Sortable = factory();  // export for Meteor.js
-	}
-	else {
-		/* jshint sub:true */
-		window["Sortable"] = factory();
-	}
-})(function () {
-	"use strict";
-	
-	if (typeof window == "undefined" || typeof window.document == "undefined") {
-		return function() {
-			throw new Error( "Sortable.js requires a window with a document" );
-		}
-	}
-
-	var dragEl,
-		parentEl,
-		ghostEl,
-		cloneEl,
-		rootEl,
-		nextEl,
-
-		scrollEl,
-		scrollParentEl,
-
-		lastEl,
-		lastCSS,
-		lastParentCSS,
-
-		oldIndex,
-		newIndex,
-
-		activeGroup,
-		autoScroll = {},
-
-		tapEvt,
-		touchEvt,
-
-		moved,
-
-		/** @const */
-		RSPACE = /\s+/g,
-
-		expando = 'Sortable' + (new Date).getTime(),
-
-		win = window,
-		document = win.document,
-		parseInt = win.parseInt,
-
-		supportDraggable = !!('draggable' in document.createElement('div')),
-		supportCssPointerEvents = (function (el) {
-			el = document.createElement('x');
-			el.style.cssText = 'pointer-events:auto';
-			return el.style.pointerEvents === 'auto';
-		})(),
-
-		_silent = false,
-
-		abs = Math.abs,
-		slice = [].slice,
-
-		touchDragOverListeners = [],
-
-		_autoScroll = _throttle(function (/**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
-			// Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
-			if (rootEl && options.scroll) {
-				var el,
-					rect,
-					sens = options.scrollSensitivity,
-					speed = options.scrollSpeed,
-
-					x = evt.clientX,
-					y = evt.clientY,
-
-					winWidth = window.innerWidth,
-					winHeight = window.innerHeight,
-
-					vx,
-					vy
-				;
-
-				// Delect scrollEl
-				if (scrollParentEl !== rootEl) {
-					scrollEl = options.scroll;
-					scrollParentEl = rootEl;
-
-					if (scrollEl === true) {
-						scrollEl = rootEl;
-
-						do {
-							if ((scrollEl.offsetWidth < scrollEl.scrollWidth) ||
-								(scrollEl.offsetHeight < scrollEl.scrollHeight)
-							) {
-								break;
-							}
-							/* jshint boss:true */
-						} while (scrollEl = scrollEl.parentNode);
-					}
-				}
-
-				if (scrollEl) {
-					el = scrollEl;
-					rect = scrollEl.getBoundingClientRect();
-					vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
-					vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
-				}
-
-
-				if (!(vx || vy)) {
-					vx = (winWidth - x <= sens) - (x <= sens);
-					vy = (winHeight - y <= sens) - (y <= sens);
-
-					/* jshint expr:true */
-					(vx || vy) && (el = win);
-				}
-
-
-				if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
-					autoScroll.el = el;
-					autoScroll.vx = vx;
-					autoScroll.vy = vy;
-
-					clearInterval(autoScroll.pid);
-
-					if (el) {
-						autoScroll.pid = setInterval(function () {
-							if (el === win) {
-								win.scrollTo(win.pageXOffset + vx * speed, win.pageYOffset + vy * speed);
-							} else {
-								vy && (el.scrollTop += vy * speed);
-								vx && (el.scrollLeft += vx * speed);
-							}
-						}, 24);
-					}
-				}
-			}
-		}, 30),
-
-		_prepareGroup = function (options) {
-			var group = options.group;
-
-			if (!group || typeof group != 'object') {
-				group = options.group = {name: group};
-			}
-
-			['pull', 'put'].forEach(function (key) {
-				if (!(key in group)) {
-					group[key] = true;
-				}
-			});
-
-			options.groups = ' ' + group.name + (group.put.join ? ' ' + group.put.join(' ') : '') + ' ';
-		}
-	;
-
-
-
-	/**
-	 * @class  Sortable
-	 * @param  {HTMLElement}  el
-	 * @param  {Object}       [options]
-	 */
-	function Sortable(el, options) {
-		if (!(el && el.nodeType && el.nodeType === 1)) {
-			throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
-		}
-
-		this.el = el; // root element
-		this.options = options = _extend({}, options);
-
-
-		// Export instance
-		el[expando] = this;
-
-
-		// Default options
-		var defaults = {
-			group: Math.random(),
-			sort: true,
-			disabled: false,
-			store: null,
-			handle: null,
-			scroll: true,
-			scrollSensitivity: 30,
-			scrollSpeed: 10,
-			draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
-			ghostClass: 'sortable-ghost',
-			chosenClass: 'sortable-chosen',
-			ignore: 'a, img',
-			filter: null,
-			animation: 0,
-			setData: function (dataTransfer, dragEl) {
-				dataTransfer.setData('Text', dragEl.textContent);
-			},
-			dropBubble: false,
-			dragoverBubble: false,
-			dataIdAttr: 'data-id',
-			delay: 0,
-			forceFallback: false,
-			fallbackClass: 'sortable-fallback',
-			fallbackOnBody: false
-		};
-
-
-		// Set default options
-		for (var name in defaults) {
-			!(name in options) && (options[name] = defaults[name]);
-		}
-
-		_prepareGroup(options);
-
-		// Bind all private methods
-		for (var fn in this) {
-			if (fn.charAt(0) === '_') {
-				this[fn] = this[fn].bind(this);
-			}
-		}
-
-		// Setup drag mode
-		this.nativeDraggable = options.forceFallback ? false : supportDraggable;
-
-		// Bind events
-		_on(el, 'mousedown', this._onTapStart);
-		_on(el, 'touchstart', this._onTapStart);
-
-		if (this.nativeDraggable) {
-			_on(el, 'dragover', this);
-			_on(el, 'dragenter', this);
-		}
-
-		touchDragOverListeners.push(this._onDragOver);
-
-		// Restore sorting
-		options.store && this.sort(options.store.get(this));
-	}
-
-
-	Sortable.prototype = /** @lends Sortable.prototype */ {
-		constructor: Sortable,
-
-		_onTapStart: function (/** Event|TouchEvent */evt) {
-			var _this = this,
-				el = this.el,
-				options = this.options,
-				type = evt.type,
-				touch = evt.touches && evt.touches[0],
-				target = (touch || evt).target,
-				originalTarget = target,
-				filter = options.filter;
-
-
-			if (type === 'mousedown' && evt.button !== 0 || options.disabled) {
-				return; // only left button or enabled
-			}
-
-			target = _closest(target, options.draggable, el);
-
-			if (!target) {
-				return;
-			}
-
-			// get the index of the dragged element within its parent
-			oldIndex = _index(target, options.draggable);
-
-			// Check filter
-			if (typeof filter === 'function') {
-				if (filter.call(this, evt, target, this)) {
-					_dispatchEvent(_this, originalTarget, 'filter', target, el, oldIndex);
-					evt.preventDefault();
-					return; // cancel dnd
-				}
-			}
-			else if (filter) {
-				filter = filter.split(',').some(function (criteria) {
-					criteria = _closest(originalTarget, criteria.trim(), el);
-
-					if (criteria) {
-						_dispatchEvent(_this, criteria, 'filter', target, el, oldIndex);
-						return true;
-					}
-				});
-
-				if (filter) {
-					//evt.preventDefault();
-					return; // cancel dnd
-				}
-			}
-
-
-			if (options.handle && !_closest(originalTarget, options.handle, el)) {
-				return;
-			}
-
-
-			// Prepare `dragstart`
-			this._prepareDragStart(evt, touch, target);
-		},
-
-		_prepareDragStart: function (/** Event */evt, /** Touch */touch, /** HTMLElement */target) {
-			var _this = this,
-				el = _this.el,
-				options = _this.options,
-				ownerDocument = el.ownerDocument,
-				dragStartFn;
-
-			if (target && !dragEl && (target.parentNode === el)) {
-				tapEvt = evt;
-
-				rootEl = el;
-				dragEl = target;
-				parentEl = dragEl.parentNode;
-				nextEl = dragEl.nextSibling;
-				activeGroup = options.group;
-
-				dragStartFn = function () {
-					// Delayed drag has been triggered
-					// we can re-enable the events: touchmove/mousemove
-					_this._disableDelayedDrag();
-
-					// Make the element draggable
-					dragEl.draggable = true;
-
-					// Chosen item
-					_toggleClass(dragEl, _this.options.chosenClass, true);
-
-					// Bind the events: dragstart/dragend
-					_this._triggerDragStart(touch);
-				};
-
-				// Disable "draggable"
-				options.ignore.split(',').forEach(function (criteria) {
-					_find(dragEl, criteria.trim(), _disableDraggable);
-				});
-
-				_on(ownerDocument, 'mouseup', _this._onDrop);
-				_on(ownerDocument, 'touchend', _this._onDrop);
-				_on(ownerDocument, 'touchcancel', _this._onDrop);
-
-				if (options.delay) {
-					// If the user moves the pointer or let go the click or touch
-					// before the delay has been reached:
-					// disable the delayed drag
-					_on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
-					_on(ownerDocument, 'touchend', _this._disableDelayedDrag);
-					_on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
-					_on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
-					_on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
-
-					_this._dragStartTimer = setTimeout(dragStartFn, options.delay);
-				} else {
-					dragStartFn();
-				}
-			}
-		},
-
-		_disableDelayedDrag: function () {
-			var ownerDocument = this.el.ownerDocument;
-
-			clearTimeout(this._dragStartTimer);
-			_off(ownerDocument, 'mouseup', this._disableDelayedDrag);
-			_off(ownerDocument, 'touchend', this._disableDelayedDrag);
-			_off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
-			_off(ownerDocument, 'mousemove', this._disableDelayedDrag);
-			_off(ownerDocument, 'touchmove', this._disableDelayedDrag);
-		},
-
-		_triggerDragStart: function (/** Touch */touch) {
-			if (touch) {
-				// Touch device support
-				tapEvt = {
-					target: dragEl,
-					clientX: touch.clientX,
-					clientY: touch.clientY
-				};
-
-				this._onDragStart(tapEvt, 'touch');
-			}
-			else if (!this.nativeDraggable) {
-				this._onDragStart(tapEvt, true);
-			}
-			else {
-				_on(dragEl, 'dragend', this);
-				_on(rootEl, 'dragstart', this._onDragStart);
-			}
-
-			try {
-				if (document.selection) {
-					document.selection.empty();
-				} else {
-					window.getSelection().removeAllRanges();
-				}
-			} catch (err) {
-			}
-		},
-
-		_dragStarted: function () {
-			if (rootEl && dragEl) {
-				// Apply effect
-				_toggleClass(dragEl, this.options.ghostClass, true);
-
-				Sortable.active = this;
-
-				// Drag start event
-				_dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
-			}
-		},
-
-		_emulateDragOver: function () {
-			if (touchEvt) {
-				if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
-					return;
-				}
-
-				this._lastX = touchEvt.clientX;
-				this._lastY = touchEvt.clientY;
-
-				if (!supportCssPointerEvents) {
-					_css(ghostEl, 'display', 'none');
-				}
-
-				var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
-					parent = target,
-					groupName = ' ' + this.options.group.name + '',
-					i = touchDragOverListeners.length;
-
-				if (parent) {
-					do {
-						if (parent[expando] && parent[expando].options.groups.indexOf(groupName) > -1) {
-							while (i--) {
-								touchDragOverListeners[i]({
-									clientX: touchEvt.clientX,
-									clientY: touchEvt.clientY,
-									target: target,
-									rootEl: parent
-								});
-							}
-
-							break;
-						}
-
-						target = parent; // store last element
-					}
-					/* jshint boss:true */
-					while (parent = parent.parentNode);
-				}
-
-				if (!supportCssPointerEvents) {
-					_css(ghostEl, 'display', '');
-				}
-			}
-		},
-
-
-		_onTouchMove: function (/**TouchEvent*/evt) {
-			if (tapEvt) {
-				// only set the status to dragging, when we are actually dragging
-				if (!Sortable.active) {
-					this._dragStarted();
-				}
-
-				// as well as creating the ghost element on the document body
-				this._appendGhost();
-
-				var touch = evt.touches ? evt.touches[0] : evt,
-					dx = touch.clientX - tapEvt.clientX,
-					dy = touch.clientY - tapEvt.clientY,
-					translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
-
-				moved = true;
-				touchEvt = touch;
-
-				_css(ghostEl, 'webkitTransform', translate3d);
-				_css(ghostEl, 'mozTransform', translate3d);
-				_css(ghostEl, 'msTransform', translate3d);
-				_css(ghostEl, 'transform', translate3d);
-
-				evt.preventDefault();
-			}
-		},
-
-		_appendGhost: function () {
-			if (!ghostEl) {
-				var rect = dragEl.getBoundingClientRect(),
-					css = _css(dragEl),
-					options = this.options,
-					ghostRect;
-
-				ghostEl = dragEl.cloneNode(true);
-
-				_toggleClass(ghostEl, options.ghostClass, false);
-				_toggleClass(ghostEl, options.fallbackClass, true);
-
-				_css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
-				_css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
-				_css(ghostEl, 'width', rect.width);
-				_css(ghostEl, 'height', rect.height);
-				_css(ghostEl, 'opacity', '0.8');
-				_css(ghostEl, 'position', 'fixed');
-				_css(ghostEl, 'zIndex', '100000');
-				_css(ghostEl, 'pointerEvents', 'none');
-
-				options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
-
-				// Fixing dimensions.
-				ghostRect = ghostEl.getBoundingClientRect();
-				_css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
-				_css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
-			}
-		},
-
-		_onDragStart: function (/**Event*/evt, /**boolean*/useFallback) {
-			var dataTransfer = evt.dataTransfer,
-				options = this.options;
-
-			this._offUpEvents();
-
-			if (activeGroup.pull == 'clone') {
-				cloneEl = dragEl.cloneNode(true);
-				_css(cloneEl, 'display', 'none');
-				rootEl.insertBefore(cloneEl, dragEl);
-			}
-
-			if (useFallback) {
-
-				if (useFallback === 'touch') {
-					// Bind touch events
-					_on(document, 'touchmove', this._onTouchMove);
-					_on(document, 'touchend', this._onDrop);
-					_on(document, 'touchcancel', this._onDrop);
-				} else {
-					// Old brwoser
-					_on(document, 'mousemove', this._onTouchMove);
-					_on(document, 'mouseup', this._onDrop);
-				}
-
-				this._loopId = setInterval(this._emulateDragOver, 50);
-			}
-			else {
-				if (dataTransfer) {
-					dataTransfer.effectAllowed = 'move';
-					options.setData && options.setData.call(this, dataTransfer, dragEl);
-				}
-
-				_on(document, 'drop', this);
-				setTimeout(this._dragStarted, 0);
-			}
-		},
-
-		_onDragOver: function (/**Event*/evt) {
-			var el = this.el,
-				target,
-				dragRect,
-				revert,
-				options = this.options,
-				group = options.group,
-				groupPut = group.put,
-				isOwner = (activeGroup === group),
-				canSort = options.sort;
-
-			if (evt.preventDefault !== void 0) {
-				evt.preventDefault();
-				!options.dragoverBubble && evt.stopPropagation();
-			}
-
-			moved = true;
-
-			if (activeGroup && !options.disabled &&
-				(isOwner
-					? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
-					: activeGroup.pull && groupPut && (
-						(activeGroup.name === group.name) || // by Name
-						(groupPut.indexOf && ~groupPut.indexOf(activeGroup.name)) // by Array
-					)
-				) &&
-				(evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
-			) {
-				// Smart auto-scrolling
-				_autoScroll(evt, options, this.el);
-
-				if (_silent) {
-					return;
-				}
-
-				target = _closest(evt.target, options.draggable, el);
-				dragRect = dragEl.getBoundingClientRect();
-
-				if (revert) {
-					_cloneHide(true);
-
-					if (cloneEl || nextEl) {
-						rootEl.insertBefore(dragEl, cloneEl || nextEl);
-					}
-					else if (!canSort) {
-						rootEl.appendChild(dragEl);
-					}
-
-					return;
-				}
-
-
-				if ((el.children.length === 0) || (el.children[0] === ghostEl) ||
-					(el === evt.target) && (target = _ghostIsLast(el, evt))
-				) {
-
-					if (target) {
-						if (target.animated) {
-							return;
-						}
-
-						targetRect = target.getBoundingClientRect();
-					}
-
-					_cloneHide(isOwner);
-
-					if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect) !== false) {
-						if (!dragEl.contains(el)) {
-							el.appendChild(dragEl);
-							parentEl = el; // actualization
-						}
-
-						this._animate(dragRect, dragEl);
-						target && this._animate(targetRect, target);
-					}
-				}
-				else if (target && !target.animated && target !== dragEl && (target.parentNode[expando] !== void 0)) {
-					if (lastEl !== target) {
-						lastEl = target;
-						lastCSS = _css(target);
-						lastParentCSS = _css(target.parentNode);
-					}
-
-
-					var targetRect = target.getBoundingClientRect(),
-						width = targetRect.right - targetRect.left,
-						height = targetRect.bottom - targetRect.top,
-						floating = /left|right|inline/.test(lastCSS.cssFloat + lastCSS.display)
-							|| (lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0),
-						isWide = (target.offsetWidth > dragEl.offsetWidth),
-						isLong = (target.offsetHeight > dragEl.offsetHeight),
-						halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
-						nextSibling = target.nextElementSibling,
-						moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect),
-						after
-					;
-
-					if (moveVector !== false) {
-						_silent = true;
-						setTimeout(_unsilent, 30);
-
-						_cloneHide(isOwner);
-
-						if (moveVector === 1 || moveVector === -1) {
-							after = (moveVector === 1);
-						}
-						else if (floating) {
-							var elTop = dragEl.offsetTop,
-								tgTop = target.offsetTop;
-
-							if (elTop === tgTop) {
-								after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide;
-							} else {
-								after = tgTop > elTop;
-							}
-						} else {
-							after = (nextSibling !== dragEl) && !isLong || halfway && isLong;
-						}
-
-						if (!dragEl.contains(el)) {
-							if (after && !nextSibling) {
-								el.appendChild(dragEl);
-							} else {
-								target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
-							}
-						}
-
-						parentEl = dragEl.parentNode; // actualization
-
-						this._animate(dragRect, dragEl);
-						this._animate(targetRect, target);
-					}
-				}
-			}
-		},
-
-		_animate: function (prevRect, target) {
-			var ms = this.options.animation;
-
-			if (ms) {
-				var currentRect = target.getBoundingClientRect();
-
-				_css(target, 'transition', 'none');
-				_css(target, 'transform', 'translate3d('
-					+ (prevRect.left - currentRect.left) + 'px,'
-					+ (prevRect.top - currentRect.top) + 'px,0)'
-				);
-
-				target.offsetWidth; // repaint
-
-				_css(target, 'transition', 'all ' + ms + 'ms');
-				_css(target, 'transform', 'translate3d(0,0,0)');
-
-				clearTimeout(target.animated);
-				target.animated = setTimeout(function () {
-					_css(target, 'transition', '');
-					_css(target, 'transform', '');
-					target.animated = false;
-				}, ms);
-			}
-		},
-
-		_offUpEvents: function () {
-			var ownerDocument = this.el.ownerDocument;
-
-			_off(document, 'touchmove', this._onTouchMove);
-			_off(ownerDocument, 'mouseup', this._onDrop);
-			_off(ownerDocument, 'touchend', this._onDrop);
-			_off(ownerDocument, 'touchcancel', this._onDrop);
-		},
-
-		_onDrop: function (/**Event*/evt) {
-			var el = this.el,
-				options = this.options;
-
-			clearInterval(this._loopId);
-			clearInterval(autoScroll.pid);
-			clearTimeout(this._dragStartTimer);
-
-			// Unbind events
-			_off(document, 'mousemove', this._onTouchMove);
-
-			if (this.nativeDraggable) {
-				_off(document, 'drop', this);
-				_off(el, 'dragstart', this._onDragStart);
-			}
-
-			this._offUpEvents();
-
-			if (evt) {
-				if (moved) {
-					evt.preventDefault();
-					!options.dropBubble && evt.stopPropagation();
-				}
-
-				ghostEl && ghostEl.parentNode.removeChild(ghostEl);
-
-				if (dragEl) {
-					if (this.nativeDraggable) {
-						_off(dragEl, 'dragend', this);
-					}
-
-					_disableDraggable(dragEl);
-
-					// Remove class's
-					_toggleClass(dragEl, this.options.ghostClass, false);
-					_toggleClass(dragEl, this.options.chosenClass, false);
-
-					if (rootEl !== parentEl) {
-						newIndex = _index(dragEl, options.draggable);
-
-						if (newIndex >= 0) {
-							// drag from one list and drop into another
-							_dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
-							_dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
-
-							// Add event
-							_dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);
-
-							// Remove event
-							_dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
-						}
-					}
-					else {
-						// Remove clone
-						cloneEl && cloneEl.parentNode.removeChild(cloneEl);
-
-						if (dragEl.nextSibling !== nextEl) {
-							// Get the index of the dragged element within its parent
-							newIndex = _index(dragEl, options.draggable);
-
-							if (newIndex >= 0) {
-								// drag & drop within the same list
-								_dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
-								_dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
-							}
-						}
-					}
-
-					if (Sortable.active) {
-						if (newIndex === null || newIndex === -1) {
-							newIndex = oldIndex;
-						}
-
-						_dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
-
-						// Save sorting
-						this.save();
-					}
-				}
-
-			}
-			this._nulling();
-		},
-
-		_nulling: function() {
-			// Nulling
-			rootEl =
-			dragEl =
-			parentEl =
-			ghostEl =
-			nextEl =
-			cloneEl =
-
-			scrollEl =
-			scrollParentEl =
-
-			tapEvt =
-			touchEvt =
-
-			moved =
-			newIndex =
-
-			lastEl =
-			lastCSS =
-
-			activeGroup =
-			Sortable.active = null;
-		},
-
-		handleEvent: function (/**Event*/evt) {
-			var type = evt.type;
-
-			if (type === 'dragover' || type === 'dragenter') {
-				if (dragEl) {
-					this._onDragOver(evt);
-					_globalDragOver(evt);
-				}
-			}
-			else if (type === 'drop' || type === 'dragend') {
-				this._onDrop(evt);
-			}
-		},
-
-
-		/**
-		 * Serializes the item into an array of string.
-		 * @returns {String[]}
-		 */
-		toArray: function () {
-			var order = [],
-				el,
-				children = this.el.children,
-				i = 0,
-				n = children.length,
-				options = this.options;
-
-			for (; i < n; i++) {
-				el = children[i];
-				if (_closest(el, options.draggable, this.el)) {
-					order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
-				}
-			}
-
-			return order;
-		},
-
-
-		/**
-		 * Sorts the elements according to the array.
-		 * @param  {String[]}  order  order of the items
-		 */
-		sort: function (order) {
-			var items = {}, rootEl = this.el;
-
-			this.toArray().forEach(function (id, i) {
-				var el = rootEl.children[i];
-
-				if (_closest(el, this.options.draggable, rootEl)) {
-					items[id] = el;
-				}
-			}, this);
-
-			order.forEach(function (id) {
-				if (items[id]) {
-					rootEl.removeChild(items[id]);
-					rootEl.appendChild(items[id]);
-				}
-			});
-		},
-
-
-		/**
-		 * Save the current sorting
-		 */
-		save: function () {
-			var store = this.options.store;
-			store && store.set(this);
-		},
-
-
-		/**
-		 * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
-		 * @param   {HTMLElement}  el
-		 * @param   {String}       [selector]  default: `options.draggable`
-		 * @returns {HTMLElement|null}
-		 */
-		closest: function (el, selector) {
-			return _closest(el, selector || this.options.draggable, this.el);
-		},
-
-
-		/**
-		 * Set/get option
-		 * @param   {string} name
-		 * @param   {*}      [value]
-		 * @returns {*}
-		 */
-		option: function (name, value) {
-			var options = this.options;
-
-			if (value === void 0) {
-				return options[name];
-			} else {
-				options[name] = value;
-
-				if (name === 'group') {
-					_prepareGroup(options);
-				}
-			}
-		},
-
-
-		/**
-		 * Destroy
-		 */
-		destroy: function () {
-			var el = this.el;
-
-			el[expando] = null;
-
-			_off(el, 'mousedown', this._onTapStart);
-			_off(el, 'touchstart', this._onTapStart);
-
-			if (this.nativeDraggable) {
-				_off(el, 'dragover', this);
-				_off(el, 'dragenter', this);
-			}
-
-			// Remove draggable attributes
-			Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
-				el.removeAttribute('draggable');
-			});
-
-			touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
-
-			this._onDrop();
-
-			this.el = el = null;
-		}
-	};
-
-
-	function _cloneHide(state) {
-		if (cloneEl && (cloneEl.state !== state)) {
-			_css(cloneEl, 'display', state ? 'none' : '');
-			!state && cloneEl.state && rootEl.insertBefore(cloneEl, dragEl);
-			cloneEl.state = state;
-		}
-	}
-
-
-	function _closest(/**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
-		if (el) {
-			ctx = ctx || document;
-
-			do {
-				if (
-					(selector === '>*' && el.parentNode === ctx)
-					|| _matches(el, selector)
-				) {
-					return el;
-				}
-			}
-			while (el !== ctx && (el = el.parentNode));
-		}
-
-		return null;
-	}
-
-
-	function _globalDragOver(/**Event*/evt) {
-		if (evt.dataTransfer) {
-			evt.dataTransfer.dropEffect = 'move';
-		}
-		evt.preventDefault();
-	}
-
-
-	function _on(el, event, fn) {
-		el.addEventListener(event, fn, false);
-	}
-
-
-	function _off(el, event, fn) {
-		el.removeEventListener(event, fn, false);
-	}
-
-
-	function _toggleClass(el, name, state) {
-		if (el) {
-			if (el.classList) {
-				el.classList[state ? 'add' : 'remove'](name);
-			}
-			else {
-				var className = (' ' + el.className + ' ').replace(RSPACE, ' ').replace(' ' + name + ' ', ' ');
-				el.className = (className + (state ? ' ' + name : '')).replace(RSPACE, ' ');
-			}
-		}
-	}
-
-
-	function _css(el, prop, val) {
-		var style = el && el.style;
-
-		if (style) {
-			if (val === void 0) {
-				if (document.defaultView && document.defaultView.getComputedStyle) {
-					val = document.defaultView.getComputedStyle(el, '');
-				}
-				else if (el.currentStyle) {
-					val = el.currentStyle;
-				}
-
-				return prop === void 0 ? val : val[prop];
-			}
-			else {
-				if (!(prop in style)) {
-					prop = '-webkit-' + prop;
-				}
-
-				style[prop] = val + (typeof val === 'string' ? '' : 'px');
-			}
-		}
-	}
-
-
-	function _find(ctx, tagName, iterator) {
-		if (ctx) {
-			var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length;
-
-			if (iterator) {
-				for (; i < n; i++) {
-					iterator(list[i], i);
-				}
-			}
-
-			return list;
-		}
-
-		return [];
-	}
-
-
-
-	function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
-		var evt = document.createEvent('Event'),
-			options = (sortable || rootEl[expando]).options,
-			onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
-
-		evt.initEvent(name, true, true);
-
-		evt.to = rootEl;
-		evt.from = fromEl || rootEl;
-		evt.item = targetEl || rootEl;
-		evt.clone = cloneEl;
-
-		evt.oldIndex = startIndex;
-		evt.newIndex = newIndex;
-
-		rootEl.dispatchEvent(evt);
-
-		if (options[onName]) {
-			options[onName].call(sortable, evt);
-		}
-	}
-
-
-	function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect) {
-		var evt,
-			sortable = fromEl[expando],
-			onMoveFn = sortable.options.onMove,
-			retVal;
-
-		evt = document.createEvent('Event');
-		evt.initEvent('move', true, true);
-
-		evt.to = toEl;
-		evt.from = fromEl;
-		evt.dragged = dragEl;
-		evt.draggedRect = dragRect;
-		evt.related = targetEl || toEl;
-		evt.relatedRect = targetRect || toEl.getBoundingClientRect();
-
-		fromEl.dispatchEvent(evt);
-
-		if (onMoveFn) {
-			retVal = onMoveFn.call(sortable, evt);
-		}
-
-		return retVal;
-	}
-
-
-	function _disableDraggable(el) {
-		el.draggable = false;
-	}
-
-
-	function _unsilent() {
-		_silent = false;
-	}
-
-
-	/** @returns {HTMLElement|false} */
-	function _ghostIsLast(el, evt) {
-		var lastEl = el.lastElementChild,
-				rect = lastEl.getBoundingClientRect();
-
-		return ((evt.clientY - (rect.top + rect.height) > 5) || (evt.clientX - (rect.right + rect.width) > 5)) && lastEl; // min delta
-	}
-
-
-	/**
-	 * Generate id
-	 * @param   {HTMLElement} el
-	 * @returns {String}
-	 * @private
-	 */
-	function _generateId(el) {
-		var str = el.tagName + el.className + el.src + el.href + el.textContent,
-			i = str.length,
-			sum = 0;
-
-		while (i--) {
-			sum += str.charCodeAt(i);
-		}
-
-		return sum.toString(36);
-	}
-
-	/**
-	 * Returns the index of an element within its parent for a selected set of
-	 * elements
-	 * @param  {HTMLElement} el
-	 * @param  {selector} selector
-	 * @return {number}
-	 */
-	function _index(el, selector) {
-		var index = 0;
-
-		if (!el || !el.parentNode) {
-			return -1;
-		}
-
-		while (el && (el = el.previousElementSibling)) {
-			if (el.nodeName.toUpperCase() !== 'TEMPLATE'
-					&& _matches(el, selector)) {
-				index++;
-			}
-		}
-
-		return index;
-	}
-
-	function _matches(/**HTMLElement*/el, /**String*/selector) {
-		if (el) {
-			selector = selector.split('.');
-
-			var tag = selector.shift().toUpperCase(),
-				re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
-
-			return (
-				(tag === '' || el.nodeName.toUpperCase() == tag) &&
-				(!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length)
-			);
-		}
-
-		return false;
-	}
-
-	function _throttle(callback, ms) {
-		var args, _this;
-
-		return function () {
-			if (args === void 0) {
-				args = arguments;
-				_this = this;
-
-				setTimeout(function () {
-					if (args.length === 1) {
-						callback.call(_this, args[0]);
-					} else {
-						callback.apply(_this, args);
-					}
-
-					args = void 0;
-				}, ms);
-			}
-		};
-	}
-
-	function _extend(dst, src) {
-		if (dst && src) {
-			for (var key in src) {
-				if (src.hasOwnProperty(key)) {
-					dst[key] = src[key];
-				}
-			}
-		}
-
-		return dst;
-	}
-
-
-	// Export utils
-	Sortable.utils = {
-		on: _on,
-		off: _off,
-		css: _css,
-		find: _find,
-		is: function (el, selector) {
-			return !!_closest(el, selector, el);
-		},
-		extend: _extend,
-		throttle: _throttle,
-		closest: _closest,
-		toggleClass: _toggleClass,
-		index: _index
-	};
-
-
-	/**
-	 * Create sortable instance
-	 * @param {HTMLElement}  el
-	 * @param {Object}      [options]
-	 */
-	Sortable.create = function (el, options) {
-		return new Sortable(el, options);
-	};
-
-
-	// Export
-	Sortable.version = '1.4.2';
-	return Sortable;
-});

+ 0 - 2372
src/js/lib/bootstrap-3.3.6.js

@@ -1,2372 +0,0 @@
-/** @license
-========================================================================
-  Bootstrap v3.3.6 (http://getbootstrap.com)
-  Copyright 2011-2016 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] > 2)) {
-    throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3')
-  }
-}(jQuery);
-
-/* ========================================================================
- * Bootstrap: transition.js v3.3.6
- * http://getbootstrap.com/javascript/#transitions
- * ========================================================================
- * Copyright 2011-2016 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- * ======================================================================== */
-
-
-+function ($) {
-  'use strict';
-
-  // CSS TRANSITION SUPPORT (Shoutout: http://www.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 (  ._.)
-  }
-
-  // http://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.3.6
- * http://getbootstrap.com/javascript/#alerts
- * ========================================================================
- * Copyright 2011-2016 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.3.6'
-
-  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
-    }
-
-    var $parent = $(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.3.6
- * http://getbootstrap.com/javascript/#buttons
- * ========================================================================
- * Copyright 2011-2016 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.3.6'
-
-  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)
-      } else if (this.isLoading) {
-        this.isLoading = false
-        $el.removeClass(d).removeAttr(d)
-      }
-    }, 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.3.6
- * http://getbootstrap.com/javascript/#carousel
- * ========================================================================
- * Copyright 2011-2016 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.3.6'
-
-  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)
-      $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 href
-    var $this   = $(this)
-    var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7
-    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.3.6
- * http://getbootstrap.com/javascript/#collapse
- * ========================================================================
- * Copyright 2011-2016 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.3.6'
-
-  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 $(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 $(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.3.6
- * http://getbootstrap.com/javascript/#dropdowns
- * ========================================================================
- * Copyright 2011-2016 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.3.6'
-
-  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 && $(selector)
-
-    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.3.6
- * http://getbootstrap.com/javascript/#modals
- * ========================================================================
- * Copyright 2011-2016 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
-
-    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.3.6'
-
-  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 || ''
-    if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
-  }
-
-  Modal.prototype.resetScrollbar = function () {
-    this.$body.css('padding-right', this.originalBodyPad)
-  }
-
-  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 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.3.6
- * http://getbootstrap.com/javascript/#tooltip
- * Inspired by the original jQuery.tipsy by Jason Frame
- * ========================================================================
- * Copyright 2011-2016 Twitter, Inc.
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
- * ======================================================================== */
-
-
-+function ($) {
-  'use strict';
-
-  // 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.3.6'
-
-  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
-    }
-  }
-
-  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 && $($.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) {
-    options = $.extend({}, this.getDefaults(), this.$element.data(), options)
-
-    if (options.delay && typeof options.delay == 'number') {
-      options.delay = {
-        show: options.delay,
-        hide: options.delay
-      }
-    }
-
-    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(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()
-
-    $tip.find('.tooltip-inner')[this.options.html ? 'html' : '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()
-      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 elOffset  = isBody ? { top: 0, left: 0 } : $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
-    })
-  }
-
-
-  // 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.3.6
- * http://getbootstrap.com/javascript/#popovers
- * ========================================================================
- * Copyright 2011-2016 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.3.6'
-
-  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()
-
-    $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title)
-    $tip.find('.popover-content').children().detach().end()[ // we use append for html objects to maintain js events
-      this.options.html ? (typeof content == 'string' ? 'html' : 'append') : '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.3.6
- * http://getbootstrap.com/javascript/#scrollspy
- * ========================================================================
- * Copyright 2011-2016 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.3.6'
-
-  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.3.6
- * http://getbootstrap.com/javascript/#tabs
- * ========================================================================
- * Copyright 2011-2016 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.3.6'
-
-  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 = $(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.3.6
- * http://getbootstrap.com/javascript/#affix
- * ========================================================================
- * Copyright 2011-2016 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)
-
-    this.$target = $(this.options.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.3.6'
-
-  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);

+ 0 - 1116
src/js/lib/bootstrap-colorpicker.js

@@ -1,1116 +0,0 @@
-/*!
- * Bootstrap Colorpicker v2.3.6
- * https://itsjavi.com/bootstrap-colorpicker/
- *
- * Originally written by (c) 2012 Stefan Petre
- * Licensed under the Apache License v2.0
- * http://www.apache.org/licenses/LICENSE-2.0.txt
- *
- */
-
-(function(factory) {
-  "use strict";
-  if (typeof exports === 'object') {
-    module.exports = factory(window.jQuery);
-  } else if (typeof define === 'function' && define.amd) {
-    define(['jquery'], factory);
-  } else if (window.jQuery && !window.jQuery.fn.colorpicker) {
-    factory(window.jQuery);
-  }
-}(function($) {
-  'use strict';
-
-  /**
-   * Color manipulation helper class
-   *
-   * @param {Object|String} val
-   * @param {Object} predefinedColors
-   * @constructor
-   */
-  var Color = function(val, predefinedColors) {
-    this.value = {
-      h: 0,
-      s: 0,
-      b: 0,
-      a: 1
-    };
-    this.origFormat = null; // original string format
-    if (predefinedColors) {
-      $.extend(this.colors, predefinedColors);
-    }
-    if (val) {
-      if (val.toLowerCase !== undefined) {
-        // cast to string
-        val = val + '';
-        this.setColor(val);
-      } else if (val.h !== undefined) {
-        this.value = val;
-      }
-    }
-  };
-
-  Color.prototype = {
-    constructor: Color,
-    // 140 predefined colors from the HTML Colors spec
-    colors: {
-      "aliceblue": "#f0f8ff",
-      "antiquewhite": "#faebd7",
-      "aqua": "#00ffff",
-      "aquamarine": "#7fffd4",
-      "azure": "#f0ffff",
-      "beige": "#f5f5dc",
-      "bisque": "#ffe4c4",
-      "black": "#000000",
-      "blanchedalmond": "#ffebcd",
-      "blue": "#0000ff",
-      "blueviolet": "#8a2be2",
-      "brown": "#a52a2a",
-      "burlywood": "#deb887",
-      "cadetblue": "#5f9ea0",
-      "chartreuse": "#7fff00",
-      "chocolate": "#d2691e",
-      "coral": "#ff7f50",
-      "cornflowerblue": "#6495ed",
-      "cornsilk": "#fff8dc",
-      "crimson": "#dc143c",
-      "cyan": "#00ffff",
-      "darkblue": "#00008b",
-      "darkcyan": "#008b8b",
-      "darkgoldenrod": "#b8860b",
-      "darkgray": "#a9a9a9",
-      "darkgreen": "#006400",
-      "darkkhaki": "#bdb76b",
-      "darkmagenta": "#8b008b",
-      "darkolivegreen": "#556b2f",
-      "darkorange": "#ff8c00",
-      "darkorchid": "#9932cc",
-      "darkred": "#8b0000",
-      "darksalmon": "#e9967a",
-      "darkseagreen": "#8fbc8f",
-      "darkslateblue": "#483d8b",
-      "darkslategray": "#2f4f4f",
-      "darkturquoise": "#00ced1",
-      "darkviolet": "#9400d3",
-      "deeppink": "#ff1493",
-      "deepskyblue": "#00bfff",
-      "dimgray": "#696969",
-      "dodgerblue": "#1e90ff",
-      "firebrick": "#b22222",
-      "floralwhite": "#fffaf0",
-      "forestgreen": "#228b22",
-      "fuchsia": "#ff00ff",
-      "gainsboro": "#dcdcdc",
-      "ghostwhite": "#f8f8ff",
-      "gold": "#ffd700",
-      "goldenrod": "#daa520",
-      "gray": "#808080",
-      "green": "#008000",
-      "greenyellow": "#adff2f",
-      "honeydew": "#f0fff0",
-      "hotpink": "#ff69b4",
-      "indianred": "#cd5c5c",
-      "indigo": "#4b0082",
-      "ivory": "#fffff0",
-      "khaki": "#f0e68c",
-      "lavender": "#e6e6fa",
-      "lavenderblush": "#fff0f5",
-      "lawngreen": "#7cfc00",
-      "lemonchiffon": "#fffacd",
-      "lightblue": "#add8e6",
-      "lightcoral": "#f08080",
-      "lightcyan": "#e0ffff",
-      "lightgoldenrodyellow": "#fafad2",
-      "lightgrey": "#d3d3d3",
-      "lightgreen": "#90ee90",
-      "lightpink": "#ffb6c1",
-      "lightsalmon": "#ffa07a",
-      "lightseagreen": "#20b2aa",
-      "lightskyblue": "#87cefa",
-      "lightslategray": "#778899",
-      "lightsteelblue": "#b0c4de",
-      "lightyellow": "#ffffe0",
-      "lime": "#00ff00",
-      "limegreen": "#32cd32",
-      "linen": "#faf0e6",
-      "magenta": "#ff00ff",
-      "maroon": "#800000",
-      "mediumaquamarine": "#66cdaa",
-      "mediumblue": "#0000cd",
-      "mediumorchid": "#ba55d3",
-      "mediumpurple": "#9370d8",
-      "mediumseagreen": "#3cb371",
-      "mediumslateblue": "#7b68ee",
-      "mediumspringgreen": "#00fa9a",
-      "mediumturquoise": "#48d1cc",
-      "mediumvioletred": "#c71585",
-      "midnightblue": "#191970",
-      "mintcream": "#f5fffa",
-      "mistyrose": "#ffe4e1",
-      "moccasin": "#ffe4b5",
-      "navajowhite": "#ffdead",
-      "navy": "#000080",
-      "oldlace": "#fdf5e6",
-      "olive": "#808000",
-      "olivedrab": "#6b8e23",
-      "orange": "#ffa500",
-      "orangered": "#ff4500",
-      "orchid": "#da70d6",
-      "palegoldenrod": "#eee8aa",
-      "palegreen": "#98fb98",
-      "paleturquoise": "#afeeee",
-      "palevioletred": "#d87093",
-      "papayawhip": "#ffefd5",
-      "peachpuff": "#ffdab9",
-      "peru": "#cd853f",
-      "pink": "#ffc0cb",
-      "plum": "#dda0dd",
-      "powderblue": "#b0e0e6",
-      "purple": "#800080",
-      "red": "#ff0000",
-      "rosybrown": "#bc8f8f",
-      "royalblue": "#4169e1",
-      "saddlebrown": "#8b4513",
-      "salmon": "#fa8072",
-      "sandybrown": "#f4a460",
-      "seagreen": "#2e8b57",
-      "seashell": "#fff5ee",
-      "sienna": "#a0522d",
-      "silver": "#c0c0c0",
-      "skyblue": "#87ceeb",
-      "slateblue": "#6a5acd",
-      "slategray": "#708090",
-      "snow": "#fffafa",
-      "springgreen": "#00ff7f",
-      "steelblue": "#4682b4",
-      "tan": "#d2b48c",
-      "teal": "#008080",
-      "thistle": "#d8bfd8",
-      "tomato": "#ff6347",
-      "turquoise": "#40e0d0",
-      "violet": "#ee82ee",
-      "wheat": "#f5deb3",
-      "white": "#ffffff",
-      "whitesmoke": "#f5f5f5",
-      "yellow": "#ffff00",
-      "yellowgreen": "#9acd32",
-      "transparent": "transparent"
-    },
-    _sanitizeNumber: function(val) {
-      if (typeof val === 'number') {
-        return val;
-      }
-      if (isNaN(val) || (val === null) || (val === '') || (val === undefined)) {
-        return 1;
-      }
-      if (val === '') {
-        return 0;
-      }
-      if (val.toLowerCase !== undefined) {
-        if (val.match(/^\./)) {
-          val = "0" + val;
-        }
-        return Math.ceil(parseFloat(val) * 100) / 100;
-      }
-      return 1;
-    },
-    isTransparent: function(strVal) {
-      if (!strVal) {
-        return false;
-      }
-      strVal = strVal.toLowerCase().trim();
-      return (strVal === 'transparent') || (strVal.match(/#?00000000/)) || (strVal.match(/(rgba|hsla)\(0,0,0,0?\.?0\)/));
-    },
-    rgbaIsTransparent: function(rgba) {
-      return ((rgba.r === 0) && (rgba.g === 0) && (rgba.b === 0) && (rgba.a === 0));
-    },
-    //parse a string to HSB
-    setColor: function(strVal) {
-      strVal = strVal.toLowerCase().trim();
-      if (strVal) {
-        if (this.isTransparent(strVal)) {
-          this.value = {
-            h: 0,
-            s: 0,
-            b: 0,
-            a: 0
-          };
-        } else {
-          this.value = this.stringToHSB(strVal) || {
-            h: 0,
-            s: 0,
-            b: 0,
-            a: 1
-          }; // if parser fails, defaults to black
-        }
-      }
-    },
-    stringToHSB: function(strVal) {
-      strVal = strVal.toLowerCase();
-      var alias;
-      if (typeof this.colors[strVal] !== 'undefined') {
-        strVal = this.colors[strVal];
-        alias = 'alias';
-      }
-      var that = this,
-        result = false;
-      $.each(this.stringParsers, function(i, parser) {
-        var match = parser.re.exec(strVal),
-          values = match && parser.parse.apply(that, [match]),
-          format = alias || parser.format || 'rgba';
-        if (values) {
-          if (format.match(/hsla?/)) {
-            result = that.RGBtoHSB.apply(that, that.HSLtoRGB.apply(that, values));
-          } else {
-            result = that.RGBtoHSB.apply(that, values);
-          }
-          that.origFormat = format;
-          return false;
-        }
-        return true;
-      });
-      return result;
-    },
-    setHue: function(h) {
-      this.value.h = 1 - h;
-    },
-    setSaturation: function(s) {
-      this.value.s = s;
-    },
-    setBrightness: function(b) {
-      this.value.b = 1 - b;
-    },
-    setAlpha: function(a) {
-      this.value.a = Math.round((parseInt((1 - a) * 100, 10) / 100) * 100) / 100;
-    },
-    toRGB: function(h, s, b, a) {
-      if (!h) {
-        h = this.value.h;
-        s = this.value.s;
-        b = this.value.b;
-      }
-      h *= 360;
-      var R, G, B, X, C;
-      h = (h % 360) / 60;
-      C = b * s;
-      X = C * (1 - Math.abs(h % 2 - 1));
-      R = G = B = b - C;
-
-      h = ~~h;
-      R += [C, X, 0, 0, X, C][h];
-      G += [X, C, C, X, 0, 0][h];
-      B += [0, 0, X, C, C, X][h];
-      return {
-        r: Math.round(R * 255),
-        g: Math.round(G * 255),
-        b: Math.round(B * 255),
-        a: a || this.value.a
-      };
-    },
-    toHex: function(h, s, b, a) {
-      var rgb = this.toRGB(h, s, b, a);
-      if (this.rgbaIsTransparent(rgb)) {
-        return 'transparent';
-      }
-      return '#' + ((1 << 24) | (parseInt(rgb.r) << 16) | (parseInt(rgb.g) << 8) | parseInt(rgb.b)).toString(16).substr(1);
-    },
-    toHSL: function(h, s, b, a) {
-      h = h || this.value.h;
-      s = s || this.value.s;
-      b = b || this.value.b;
-      a = a || this.value.a;
-
-      var H = h,
-        L = (2 - s) * b,
-        S = s * b;
-      if (L > 0 && L <= 1) {
-        S /= L;
-      } else {
-        S /= 2 - L;
-      }
-      L /= 2;
-      if (S > 1) {
-        S = 1;
-      }
-      return {
-        h: isNaN(H) ? 0 : H,
-        s: isNaN(S) ? 0 : S,
-        l: isNaN(L) ? 0 : L,
-        a: isNaN(a) ? 0 : a
-      };
-    },
-    toAlias: function(r, g, b, a) {
-      var rgb = this.toHex(r, g, b, a);
-      for (var alias in this.colors) {
-        if (this.colors[alias] === rgb) {
-          return alias;
-        }
-      }
-      return false;
-    },
-    RGBtoHSB: function(r, g, b, a) {
-      r /= 255;
-      g /= 255;
-      b /= 255;
-
-      var H, S, V, C;
-      V = Math.max(r, g, b);
-      C = V - Math.min(r, g, b);
-      H = (C === 0 ? null :
-        V === r ? (g - b) / C :
-        V === g ? (b - r) / C + 2 :
-        (r - g) / C + 4
-      );
-      H = ((H + 360) % 6) * 60 / 360;
-      S = C === 0 ? 0 : C / V;
-      return {
-        h: this._sanitizeNumber(H),
-        s: S,
-        b: V,
-        a: this._sanitizeNumber(a)
-      };
-    },
-    HueToRGB: function(p, q, h) {
-      if (h < 0) {
-        h += 1;
-      } else if (h > 1) {
-        h -= 1;
-      }
-      if ((h * 6) < 1) {
-        return p + (q - p) * h * 6;
-      } else if ((h * 2) < 1) {
-        return q;
-      } else if ((h * 3) < 2) {
-        return p + (q - p) * ((2 / 3) - h) * 6;
-      } else {
-        return p;
-      }
-    },
-    HSLtoRGB: function(h, s, l, a) {
-      if (s < 0) {
-        s = 0;
-      }
-      var q;
-      if (l <= 0.5) {
-        q = l * (1 + s);
-      } else {
-        q = l + s - (l * s);
-      }
-
-      var p = 2 * l - q;
-
-      var tr = h + (1 / 3);
-      var tg = h;
-      var tb = h - (1 / 3);
-
-      var r = Math.round(this.HueToRGB(p, q, tr) * 255);
-      var g = Math.round(this.HueToRGB(p, q, tg) * 255);
-      var b = Math.round(this.HueToRGB(p, q, tb) * 255);
-      return [r, g, b, this._sanitizeNumber(a)];
-    },
-    toString: function(format) {
-      format = format || 'rgba';
-      var c = false;
-      switch (format) {
-        case 'rgb':
-          {
-            c = this.toRGB();
-            if (this.rgbaIsTransparent(c)) {
-              return 'transparent';
-            }
-            return 'rgb(' + c.r + ',' + c.g + ',' + c.b + ')';
-          }
-          break;
-        case 'rgba':
-          {
-            c = this.toRGB();
-            return 'rgba(' + c.r + ',' + c.g + ',' + c.b + ',' + c.a + ')';
-          }
-          break;
-        case 'hsl':
-          {
-            c = this.toHSL();
-            return 'hsl(' + Math.round(c.h * 360) + ',' + Math.round(c.s * 100) + '%,' + Math.round(c.l * 100) + '%)';
-          }
-          break;
-        case 'hsla':
-          {
-            c = this.toHSL();
-            return 'hsla(' + Math.round(c.h * 360) + ',' + Math.round(c.s * 100) + '%,' + Math.round(c.l * 100) + '%,' + c.a + ')';
-          }
-          break;
-        case 'hex':
-          {
-            return this.toHex();
-          }
-          break;
-        case 'alias':
-          return this.toAlias() || this.toHex();
-        default:
-          {
-            return c;
-          }
-          break;
-      }
-    },
-    // a set of RE's that can match strings and generate color tuples.
-    // from John Resig color plugin
-    // https://github.com/jquery/jquery-color/
-    stringParsers: [{
-      re: /rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*?\)/,
-      format: 'rgb',
-      parse: function(execResult) {
-        return [
-          execResult[1],
-          execResult[2],
-          execResult[3],
-          1
-        ];
-      }
-    }, {
-      re: /rgb\(\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*?\)/,
-      format: 'rgb',
-      parse: function(execResult) {
-        return [
-          2.55 * execResult[1],
-          2.55 * execResult[2],
-          2.55 * execResult[3],
-          1
-        ];
-      }
-    }, {
-      re: /rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/,
-      format: 'rgba',
-      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*)?\)/,
-      format: 'rgba',
-      parse: function(execResult) {
-        return [
-          2.55 * execResult[1],
-          2.55 * execResult[2],
-          2.55 * execResult[3],
-          execResult[4]
-        ];
-      }
-    }, {
-      re: /hsl\(\s*(\d*(?:\.\d+)?)\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*?\)/,
-      format: 'hsl',
-      parse: function(execResult) {
-        return [
-          execResult[1] / 360,
-          execResult[2] / 100,
-          execResult[3] / 100,
-          execResult[4]
-        ];
-      }
-    }, {
-      re: /hsla\(\s*(\d*(?:\.\d+)?)\s*,\s*(\d*(?:\.\d+)?)\%\s*,\s*(\d*(?:\.\d+)?)\%\s*(?:,\s*(\d*(?:\.\d+)?)\s*)?\)/,
-      format: 'hsla',
-      parse: function(execResult) {
-        return [
-          execResult[1] / 360,
-          execResult[2] / 100,
-          execResult[3] / 100,
-          execResult[4]
-        ];
-      }
-    }, {
-      re: /#?([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/,
-      format: 'hex',
-      parse: function(execResult) {
-        return [
-          parseInt(execResult[1], 16),
-          parseInt(execResult[2], 16),
-          parseInt(execResult[3], 16),
-          1
-        ];
-      }
-    }, {
-      re: /#?([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/,
-      format: 'hex',
-      parse: function(execResult) {
-        return [
-          parseInt(execResult[1] + execResult[1], 16),
-          parseInt(execResult[2] + execResult[2], 16),
-          parseInt(execResult[3] + execResult[3], 16),
-          1
-        ];
-      }
-    }],
-    colorNameToHex: function(name) {
-      if (typeof this.colors[name.toLowerCase()] !== 'undefined') {
-        return this.colors[name.toLowerCase()];
-      }
-      return false;
-    }
-  };
-
-  /*
-   * Default plugin options
-   */
-  var defaults = {
-    horizontal: false, // horizontal mode layout ?
-    inline: false, //forces to show the colorpicker as an inline element
-    color: false, //forces a color
-    format: false, //forces a format
-    input: 'input', // children input selector
-    container: false, // container selector
-    component: '.add-on, .input-group-addon', // children component selector
-    sliders: {
-      saturation: {
-        maxLeft: 100,
-        maxTop: 100,
-        callLeft: 'setSaturation',
-        callTop: 'setBrightness'
-      },
-      hue: {
-        maxLeft: 0,
-        maxTop: 100,
-        callLeft: false,
-        callTop: 'setHue'
-      },
-      alpha: {
-        maxLeft: 0,
-        maxTop: 100,
-        callLeft: false,
-        callTop: 'setAlpha'
-      }
-    },
-    slidersHorz: {
-      saturation: {
-        maxLeft: 100,
-        maxTop: 100,
-        callLeft: 'setSaturation',
-        callTop: 'setBrightness'
-      },
-      hue: {
-        maxLeft: 100,
-        maxTop: 0,
-        callLeft: 'setHue',
-        callTop: false
-      },
-      alpha: {
-        maxLeft: 100,
-        maxTop: 0,
-        callLeft: 'setAlpha',
-        callTop: false
-      }
-    },
-    template: '<div class="colorpicker dropdown-menu">' +
-      '<div class="colorpicker-saturation"><i><b></b></i></div>' +
-      '<div class="colorpicker-hue"><i></i></div>' +
-      '<div class="colorpicker-alpha"><i></i></div>' +
-      '<div class="colorpicker-color"><div /></div>' +
-      '<div class="colorpicker-selectors"></div>' +
-      '</div>',
-    align: 'right',
-    customClass: null,
-    colorSelectors: null
-  };
-
-  /**
-   * Colorpicker component class
-   *
-   * @param {Object|String} element
-   * @param {Object} options
-   * @constructor
-   */
-  var Colorpicker = function(element, options) {
-    this.element = $(element).addClass('colorpicker-element');
-    this.options = $.extend(true, {}, defaults, this.element.data(), options);
-    this.component = this.options.component;
-    this.component = (this.component !== false) ? this.element.find(this.component) : false;
-    if (this.component && (this.component.length === 0)) {
-      this.component = false;
-    }
-    this.container = (this.options.container === true) ? this.element : this.options.container;
-    this.container = (this.container !== false) ? $(this.container) : false;
-
-    // Is the element an input? Should we search inside for any input?
-    this.input = this.element.is('input') ? this.element : (this.options.input ?
-      this.element.find(this.options.input) : false);
-    if (this.input && (this.input.length === 0)) {
-      this.input = false;
-    }
-    // Set HSB color
-    this.color = new Color(this.options.color !== false ? this.options.color : this.getValue(), this.options.colorSelectors);
-    this.format = this.options.format !== false ? this.options.format : this.color.origFormat;
-
-    if (this.options.color !== false) {
-      this.updateInput(this.color);
-      this.updateData(this.color);
-    }
-
-    // Setup picker
-    this.picker = $(this.options.template);
-    if (this.options.customClass) {
-      this.picker.addClass(this.options.customClass);
-    }
-    if (this.options.inline) {
-      this.picker.addClass('colorpicker-inline colorpicker-visible');
-    } else {
-      this.picker.addClass('colorpicker-hidden');
-    }
-    if (this.options.horizontal) {
-      this.picker.addClass('colorpicker-horizontal');
-    }
-    if (this.format === 'rgba' || this.format === 'hsla' || this.options.format === false) {
-      this.picker.addClass('colorpicker-with-alpha');
-    }
-    if (this.options.align === 'right') {
-      this.picker.addClass('colorpicker-right');
-    }
-    if (this.options.inline === true) {
-      this.picker.addClass('colorpicker-no-arrow');
-    }
-    if (this.options.colorSelectors) {
-      var colorpicker = this;
-      $.each(this.options.colorSelectors, function(name, color) {
-        var $btn = $('<i />').css('background-color', color).data('class', name);
-        $btn.click(function() {
-          colorpicker.setValue($(this).css('background-color'));
-        });
-        colorpicker.picker.find('.colorpicker-selectors').append($btn);
-      });
-      this.picker.find('.colorpicker-selectors').show();
-    }
-    this.picker.on('mousedown.colorpicker touchstart.colorpicker', $.proxy(this.mousedown, this));
-    this.picker.appendTo(this.container ? this.container : $('body'));
-
-    // Bind events
-    if (this.input !== false) {
-      this.input.on({
-        'keyup.colorpicker': $.proxy(this.keyup, this)
-      });
-      this.input.on({
-        'change.colorpicker': $.proxy(this.change, this)
-      });
-      if (this.component === false) {
-        this.element.on({
-          'focus.colorpicker': $.proxy(this.show, this)
-        });
-      }
-      if (this.options.inline === false) {
-        this.element.on({
-          'focusout.colorpicker': $.proxy(this.hide, this)
-        });
-      }
-    }
-
-    if (this.component !== false) {
-      this.component.on({
-        'click.colorpicker': $.proxy(this.show, this)
-      });
-    }
-
-    if ((this.input === false) && (this.component === false)) {
-      this.element.on({
-        'click.colorpicker': $.proxy(this.show, this)
-      });
-    }
-
-    // for HTML5 input[type='color']
-    if ((this.input !== false) && (this.component !== false) && (this.input.attr('type') === 'color')) {
-
-      this.input.on({
-        'click.colorpicker': $.proxy(this.show, this),
-        'focus.colorpicker': $.proxy(this.show, this)
-      });
-    }
-    this.update();
-
-    $($.proxy(function() {
-      this.element.trigger('create');
-    }, this));
-  };
-
-  Colorpicker.Color = Color;
-
-  Colorpicker.prototype = {
-    constructor: Colorpicker,
-    destroy: function() {
-      this.picker.remove();
-      this.element.removeData('colorpicker', 'color').off('.colorpicker');
-      if (this.input !== false) {
-        this.input.off('.colorpicker');
-      }
-      if (this.component !== false) {
-        this.component.off('.colorpicker');
-      }
-      this.element.removeClass('colorpicker-element');
-      this.element.trigger({
-        type: 'destroy'
-      });
-    },
-    reposition: function() {
-      if (this.options.inline !== false || this.options.container) {
-        return false;
-      }
-      var type = this.container && this.container[0] !== document.body ? 'position' : 'offset';
-      var element = this.component || this.element;
-      var offset = element[type]();
-      if (this.options.align === 'right') {
-        offset.left -= this.picker.outerWidth() - element.outerWidth();
-      }
-      this.picker.css({
-        top: offset.top + element.outerHeight(),
-        left: offset.left
-      });
-    },
-    show: function(e) {
-      if (this.isDisabled()) {
-        return false;
-      }
-      this.picker.addClass('colorpicker-visible').removeClass('colorpicker-hidden');
-      this.reposition();
-      $(window).on('resize.colorpicker', $.proxy(this.reposition, this));
-      if (e && (!this.hasInput() || this.input.attr('type') === 'color')) {
-        if (e.stopPropagation && e.preventDefault) {
-          e.stopPropagation();
-          e.preventDefault();
-        }
-      }
-      if ((this.component || !this.input) && (this.options.inline === false)) {
-        $(window.document).on({
-          'mousedown.colorpicker': $.proxy(this.hide, this)
-        });
-      }
-      this.element.trigger({
-        type: 'showPicker',
-        color: this.color
-      });
-    },
-    hide: function() {
-      this.picker.addClass('colorpicker-hidden').removeClass('colorpicker-visible');
-      $(window).off('resize.colorpicker', this.reposition);
-      $(document).off({
-        'mousedown.colorpicker': this.hide
-      });
-      this.update();
-      this.element.trigger({
-        type: 'hidePicker',
-        color: this.color
-      });
-    },
-    updateData: function(val) {
-      val = val || this.color.toString(this.format);
-      this.element.data('color', val);
-      return val;
-    },
-    updateInput: function(val) {
-      val = val || this.color.toString(this.format);
-      if (this.input !== false) {
-        if (this.options.colorSelectors) {
-          var color = new Color(val, this.options.colorSelectors);
-          var alias = color.toAlias();
-          if (typeof this.options.colorSelectors[alias] !== 'undefined') {
-            val = alias;
-          }
-        }
-        this.input.prop('value', val);
-      }
-      return val;
-    },
-    updatePicker: function(val) {
-      if (val !== undefined) {
-        this.color = new Color(val, this.options.colorSelectors);
-      }
-      var sl = (this.options.horizontal === false) ? this.options.sliders : this.options.slidersHorz;
-      var icns = this.picker.find('i');
-      if (icns.length === 0) {
-        return;
-      }
-      if (this.options.horizontal === false) {
-        sl = this.options.sliders;
-        icns.eq(1).css('top', sl.hue.maxTop * (1 - this.color.value.h)).end()
-          .eq(2).css('top', sl.alpha.maxTop * (1 - this.color.value.a));
-      } else {
-        sl = this.options.slidersHorz;
-        icns.eq(1).css('left', sl.hue.maxLeft * (1 - this.color.value.h)).end()
-          .eq(2).css('left', sl.alpha.maxLeft * (1 - this.color.value.a));
-      }
-      icns.eq(0).css({
-        'top': sl.saturation.maxTop - this.color.value.b * sl.saturation.maxTop,
-        'left': this.color.value.s * sl.saturation.maxLeft
-      });
-      this.picker.find('.colorpicker-saturation').css('backgroundColor', this.color.toHex(this.color.value.h, 1, 1, 1));
-      this.picker.find('.colorpicker-alpha').css('backgroundColor', this.color.toHex());
-      this.picker.find('.colorpicker-color, .colorpicker-color div').css('backgroundColor', this.color.toString(this.format));
-      return val;
-    },
-    updateComponent: function(val) {
-      val = val || this.color.toString(this.format);
-      if (this.component !== false) {
-        var icn = this.component.find('i').eq(0);
-        if (icn.length > 0) {
-          icn.css({
-            'backgroundColor': val
-          });
-        } else {
-          this.component.css({
-            'backgroundColor': val
-          });
-        }
-      }
-      return val;
-    },
-    update: function(force) {
-      var val;
-      if ((this.getValue(false) !== false) || (force === true)) {
-        // Update input/data only if the current value is not empty
-        val = this.updateComponent();
-        this.updateInput(val);
-        this.updateData(val);
-        this.updatePicker(); // only update picker if value is not empty
-      }
-      return val;
-
-    },
-    setValue: function(val) { // set color manually
-      this.color = new Color(val, this.options.colorSelectors);
-      this.update(true);
-      this.element.trigger({
-        type: 'changeColor',
-        color: this.color,
-        value: val
-      });
-    },
-    getValue: function(defaultValue) {
-      defaultValue = (defaultValue === undefined) ? '#000000' : defaultValue;
-      var val;
-      if (this.hasInput()) {
-        val = this.input.val();
-      } else {
-        val = this.element.data('color');
-      }
-      if ((val === undefined) || (val === '') || (val === null)) {
-        // if not defined or empty, return default
-        val = defaultValue;
-      }
-      return val;
-    },
-    hasInput: function() {
-      return (this.input !== false);
-    },
-    isDisabled: function() {
-      if (this.hasInput()) {
-        return (this.input.prop('disabled') === true);
-      }
-      return false;
-    },
-    disable: function() {
-      if (this.hasInput()) {
-        this.input.prop('disabled', true);
-        this.element.trigger({
-          type: 'disable',
-          color: this.color,
-          value: this.getValue()
-        });
-        return true;
-      }
-      return false;
-    },
-    enable: function() {
-      if (this.hasInput()) {
-        this.input.prop('disabled', false);
-        this.element.trigger({
-          type: 'enable',
-          color: this.color,
-          value: this.getValue()
-        });
-        return true;
-      }
-      return false;
-    },
-    currentSlider: null,
-    mousePointer: {
-      left: 0,
-      top: 0
-    },
-    mousedown: function(e) {
-      if (!e.pageX && !e.pageY && e.originalEvent && e.originalEvent.touches) {
-        e.pageX = e.originalEvent.touches[0].pageX;
-        e.pageY = e.originalEvent.touches[0].pageY;
-      }
-      e.stopPropagation();
-      e.preventDefault();
-
-      var target = $(e.target);
-
-      //detect the slider and set the limits and callbacks
-      var zone = target.closest('div');
-      var sl = this.options.horizontal ? this.options.slidersHorz : this.options.sliders;
-      if (!zone.is('.colorpicker')) {
-        if (zone.is('.colorpicker-saturation')) {
-          this.currentSlider = $.extend({}, sl.saturation);
-        } else if (zone.is('.colorpicker-hue')) {
-          this.currentSlider = $.extend({}, sl.hue);
-        } else if (zone.is('.colorpicker-alpha')) {
-          this.currentSlider = $.extend({}, sl.alpha);
-        } else {
-          return false;
-        }
-        var offset = zone.offset();
-        //reference to guide's style
-        this.currentSlider.guide = zone.find('i')[0].style;
-        this.currentSlider.left = e.pageX - offset.left;
-        this.currentSlider.top = e.pageY - offset.top;
-        this.mousePointer = {
-          left: e.pageX,
-          top: e.pageY
-        };
-        //trigger mousemove to move the guide to the current position
-        $(document).on({
-          'mousemove.colorpicker': $.proxy(this.mousemove, this),
-          'touchmove.colorpicker': $.proxy(this.mousemove, this),
-          'mouseup.colorpicker': $.proxy(this.mouseup, this),
-          'touchend.colorpicker': $.proxy(this.mouseup, this)
-        }).trigger('mousemove');
-      }
-      return false;
-    },
-    mousemove: function(e) {
-      if (!e.pageX && !e.pageY && e.originalEvent && e.originalEvent.touches) {
-        e.pageX = e.originalEvent.touches[0].pageX;
-        e.pageY = e.originalEvent.touches[0].pageY;
-      }
-      e.stopPropagation();
-      e.preventDefault();
-      var left = Math.max(
-        0,
-        Math.min(
-          this.currentSlider.maxLeft,
-          this.currentSlider.left + ((e.pageX || this.mousePointer.left) - this.mousePointer.left)
-        )
-      );
-      var top = Math.max(
-        0,
-        Math.min(
-          this.currentSlider.maxTop,
-          this.currentSlider.top + ((e.pageY || this.mousePointer.top) - this.mousePointer.top)
-        )
-      );
-      this.currentSlider.guide.left = left + 'px';
-      this.currentSlider.guide.top = top + 'px';
-      if (this.currentSlider.callLeft) {
-        this.color[this.currentSlider.callLeft].call(this.color, left / this.currentSlider.maxLeft);
-      }
-      if (this.currentSlider.callTop) {
-        this.color[this.currentSlider.callTop].call(this.color, top / this.currentSlider.maxTop);
-      }
-      // Change format dynamically
-      // Only occurs if user choose the dynamic format by
-      // setting option format to false
-      if (this.currentSlider.callTop === 'setAlpha' && this.options.format === false) {
-
-        // Converting from hex / rgb to rgba
-        if (this.color.value.a !== 1) {
-          this.format = 'rgba';
-          this.color.origFormat = 'rgba';
-        }
-
-        // Converting from rgba to hex
-        else {
-          this.format = 'hex';
-          this.color.origFormat = 'hex';
-        }
-      }
-      this.update(true);
-
-      this.element.trigger({
-        type: 'changeColor',
-        color: this.color
-      });
-      return false;
-    },
-    mouseup: function(e) {
-      e.stopPropagation();
-      e.preventDefault();
-      $(document).off({
-        'mousemove.colorpicker': this.mousemove,
-        'touchmove.colorpicker': this.mousemove,
-        'mouseup.colorpicker': this.mouseup,
-        'touchend.colorpicker': this.mouseup
-      });
-      return false;
-    },
-    change: function(e) {
-      this.keyup(e);
-    },
-    keyup: function(e) {
-      if ((e.keyCode === 38)) {
-        if (this.color.value.a < 1) {
-          this.color.value.a = Math.round((this.color.value.a + 0.01) * 100) / 100;
-        }
-        this.update(true);
-      } else if ((e.keyCode === 40)) {
-        if (this.color.value.a > 0) {
-          this.color.value.a = Math.round((this.color.value.a - 0.01) * 100) / 100;
-        }
-        this.update(true);
-      } else {
-        this.color = new Color(this.input.val(), this.options.colorSelectors);
-        // Change format dynamically
-        // Only occurs if user choose the dynamic format by
-        // setting option format to false
-        if (this.color.origFormat && this.options.format === false) {
-          this.format = this.color.origFormat;
-        }
-        if (this.getValue(false) !== false) {
-          this.updateData();
-          this.updateComponent();
-          this.updatePicker();
-        }
-      }
-      this.element.trigger({
-        type: 'changeColor',
-        color: this.color,
-        value: this.input.val()
-      });
-    }
-  };
-
-  $.colorpicker = Colorpicker;
-
-  $.fn.colorpicker = function(option) {
-    var apiArgs = Array.prototype.slice.call(arguments, 1),
-      isSingleElement = (this.length === 1),
-      returnValue = null;
-
-    var $jq = this.each(function() {
-      var $this = $(this),
-        inst = $this.data('colorpicker'),
-        options = ((typeof option === 'object') ? option : {});
-
-      if (!inst) {
-        inst = new Colorpicker(this, options);
-        $this.data('colorpicker', inst);
-      }
-
-      if (typeof option === 'string') {
-        if ($.isFunction(inst[option])) {
-          returnValue = inst[option].apply(inst, apiArgs);
-        } else { // its a property ?
-          if (apiArgs.length) {
-            // set property
-            inst[option] = apiArgs[0];
-          }
-          returnValue = inst[option];
-        }
-      } else {
-        returnValue = $this;
-      }
-    });
-    return isSingleElement ? returnValue : $jq;
-  };
-
-  $.fn.colorpicker.constructor = Colorpicker;
-
-}));

+ 0 - 583
src/js/lib/bootstrap-switch.js

@@ -1,583 +0,0 @@
-/** @license
-========================================================================
-  bootstrap-switch - v3.1.0
-  http://www.bootstrap-switch.org
-  Copyright 2012-2013 Mattia Larentis
- 
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
- 
-      http://www.apache.org/licenses/LICENSE-2.0
- 
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-*/
-
-(function() {
-  var __slice = [].slice;
-
-  (function($, window) {
-    "use strict";
-    var BootstrapSwitch;
-    BootstrapSwitch = (function() {
-      function BootstrapSwitch(element, options) {
-        if (options == null) {
-          options = {};
-        }
-        this.$element = $(element);
-        this.options = $.extend({}, $.fn.bootstrapSwitch.defaults, {
-          state: this.$element.is(":checked"),
-          size: this.$element.data("size"),
-          animate: this.$element.data("animate"),
-          disabled: this.$element.is(":disabled"),
-          readonly: this.$element.is("[readonly]"),
-          indeterminate: this.$element.data("indeterminate"),
-          inverse: this.$element.data("inverse"),
-          radioAllOff: this.$element.data("radio-all-off"),
-          onColor: this.$element.data("on-color"),
-          offColor: this.$element.data("off-color"),
-          onText: this.$element.data("on-text"),
-          offText: this.$element.data("off-text"),
-          labelText: this.$element.data("label-text"),
-          baseClass: this.$element.data("base-class"),
-          wrapperClass: this.$element.data("wrapper-class")
-        }, options);
-        this.$wrapper = $("<div>", {
-          "class": (function(_this) {
-            return function() {
-              var classes;
-              classes = ["" + _this.options.baseClass].concat(_this._getClasses(_this.options.wrapperClass));
-              classes.push(_this.options.state ? "" + _this.options.baseClass + "-on" : "" + _this.options.baseClass + "-off");
-              if (_this.options.size != null) {
-                classes.push("" + _this.options.baseClass + "-" + _this.options.size);
-              }
-              if (_this.options.animate) {
-                classes.push("" + _this.options.baseClass + "-animate");
-              }
-              if (_this.options.disabled) {
-                classes.push("" + _this.options.baseClass + "-disabled");
-              }
-              if (_this.options.readonly) {
-                classes.push("" + _this.options.baseClass + "-readonly");
-              }
-              if (_this.options.indeterminate) {
-                classes.push("" + _this.options.baseClass + "-indeterminate");
-              }
-              if (_this.options.inverse) {
-                classes.push("" + _this.options.baseClass + "-inverse");
-              }
-              if (_this.$element.attr("id")) {
-                classes.push("" + _this.options.baseClass + "-id-" + (_this.$element.attr("id")));
-              }
-              return classes.join(" ");
-            };
-          })(this)()
-        });
-        this.$container = $("<div>", {
-          "class": "" + this.options.baseClass + "-container"
-        });
-        this.$on = $("<span>", {
-          html: this.options.onText,
-          "class": "" + this.options.baseClass + "-handle-on " + this.options.baseClass + "-" + this.options.onColor
-        });
-        this.$off = $("<span>", {
-          html: this.options.offText,
-          "class": "" + this.options.baseClass + "-handle-off " + this.options.baseClass + "-" + this.options.offColor
-        });
-        this.$label = $("<label>", {
-          html: this.options.labelText,
-          "class": "" + this.options.baseClass + "-label"
-        });
-        if (this.options.indeterminate) {
-          this.$element.prop("indeterminate", true);
-        }
-        this.$element.on("init.bootstrapSwitch", (function(_this) {
-          return function() {
-            return _this.options.onInit.apply(element, arguments);
-          };
-        })(this));
-        this.$element.on("switchChange.bootstrapSwitch", (function(_this) {
-          return function() {
-            return _this.options.onSwitchChange.apply(element, arguments);
-          };
-        })(this));
-        this.$container = this.$element.wrap(this.$container).parent();
-        this.$wrapper = this.$container.wrap(this.$wrapper).parent();
-        this.$element.before(this.options.inverse ? this.$off : this.$on).before(this.$label).before(this.options.inverse ? this.$on : this.$off).trigger("init.bootstrapSwitch");
-        this._elementHandlers();
-        this._handleHandlers();
-        this._labelHandlers();
-        this._formHandler();
-      }
-
-      BootstrapSwitch.prototype._constructor = BootstrapSwitch;
-
-      BootstrapSwitch.prototype.state = function(value, skip) {
-        if (typeof value === "undefined") {
-          return this.options.state;
-        }
-        if (this.options.disabled || this.options.readonly) {
-          return this.$element;
-        }
-        if (this.options.state && !this.options.radioAllOff && this.$element.is(':radio')) {
-          return this.$element;
-        }
-        if (this.options.indeterminate) {
-          this.indeterminate(false);
-          value = true;
-        } else {
-          value = !!value;
-        }
-        this.$element.prop("checked", value).trigger("change.bootstrapSwitch", skip);
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.toggleState = function(skip) {
-        if (this.options.disabled || this.options.readonly) {
-          return this.$element;
-        }
-        if (this.options.indeterminate) {
-          this.indeterminate(false);
-          return this.state(true);
-        } else {
-          return this.$element.prop("checked", !this.options.state).trigger("change.bootstrapSwitch", skip);
-        }
-      };
-
-      BootstrapSwitch.prototype.size = function(value) {
-        if (typeof value === "undefined") {
-          return this.options.size;
-        }
-        if (this.options.size != null) {
-          this.$wrapper.removeClass("" + this.options.baseClass + "-" + this.options.size);
-        }
-        if (value) {
-          this.$wrapper.addClass("" + this.options.baseClass + "-" + value);
-        }
-        this.options.size = value;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.animate = function(value) {
-        if (typeof value === "undefined") {
-          return this.options.animate;
-        }
-        value = !!value;
-        this.$wrapper[value ? "addClass" : "removeClass"]("" + this.options.baseClass + "-animate");
-        this.options.animate = value;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.toggleAnimate = function() {
-        this.$wrapper.toggleClass("" + this.options.baseClass + "-animate");
-        this.options.animate = !this.options.animate;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.disabled = function(value) {
-        if (typeof value === "undefined") {
-          return this.options.disabled;
-        }
-        value = !!value;
-        this.$wrapper[value ? "addClass" : "removeClass"]("" + this.options.baseClass + "-disabled");
-        this.$element.prop("disabled", value);
-        this.options.disabled = value;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.toggleDisabled = function() {
-        this.$element.prop("disabled", !this.options.disabled);
-        this.$wrapper.toggleClass("" + this.options.baseClass + "-disabled");
-        this.options.disabled = !this.options.disabled;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.readonly = function(value) {
-        if (typeof value === "undefined") {
-          return this.options.readonly;
-        }
-        value = !!value;
-        this.$wrapper[value ? "addClass" : "removeClass"]("" + this.options.baseClass + "-readonly");
-        this.$element.prop("readonly", value);
-        this.options.readonly = value;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.toggleReadonly = function() {
-        this.$element.prop("readonly", !this.options.readonly);
-        this.$wrapper.toggleClass("" + this.options.baseClass + "-readonly");
-        this.options.readonly = !this.options.readonly;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.indeterminate = function(value) {
-        if (typeof value === "undefined") {
-          return this.options.indeterminate;
-        }
-        value = !!value;
-        this.$wrapper[value ? "addClass" : "removeClass"]("" + this.options.baseClass + "-indeterminate");
-        this.$element.prop("indeterminate", value);
-        this.options.indeterminate = value;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.toggleIndeterminate = function() {
-        this.$element.prop("indeterminate", !this.options.indeterminate);
-        this.$wrapper.toggleClass("" + this.options.baseClass + "-indeterminate");
-        this.options.indeterminate = !this.options.indeterminate;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.inverse = function(value) {
-        var $off, $on;
-        if (typeof value === "undefined") {
-          return this.options.inverse;
-        }
-        value = !!value;
-        this.$wrapper[value ? "addClass" : "removeClass"]("" + this.options.baseClass + "-inverse");
-        $on = this.$on.clone(true);
-        $off = this.$off.clone(true);
-        this.$on.replaceWith($off);
-        this.$off.replaceWith($on);
-        this.$on = $off;
-        this.$off = $on;
-        this.options.inverse = value;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.toggleInverse = function() {
-        var $off, $on;
-        this.$wrapper.toggleClass("" + this.options.baseClass + "-inverse");
-        $on = this.$on.clone(true);
-        $off = this.$off.clone(true);
-        this.$on.replaceWith($off);
-        this.$off.replaceWith($on);
-        this.$on = $off;
-        this.$off = $on;
-        this.options.inverse = !this.options.inverse;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.onColor = function(value) {
-        var color;
-        color = this.options.onColor;
-        if (typeof value === "undefined") {
-          return color;
-        }
-        if (color != null) {
-          this.$on.removeClass("" + this.options.baseClass + "-" + color);
-        }
-        this.$on.addClass("" + this.options.baseClass + "-" + value);
-        this.options.onColor = value;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.offColor = function(value) {
-        var color;
-        color = this.options.offColor;
-        if (typeof value === "undefined") {
-          return color;
-        }
-        if (color != null) {
-          this.$off.removeClass("" + this.options.baseClass + "-" + color);
-        }
-        this.$off.addClass("" + this.options.baseClass + "-" + value);
-        this.options.offColor = value;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.onText = function(value) {
-        if (typeof value === "undefined") {
-          return this.options.onText;
-        }
-        this.$on.html(value);
-        this.options.onText = value;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.offText = function(value) {
-        if (typeof value === "undefined") {
-          return this.options.offText;
-        }
-        this.$off.html(value);
-        this.options.offText = value;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.labelText = function(value) {
-        if (typeof value === "undefined") {
-          return this.options.labelText;
-        }
-        this.$label.html(value);
-        this.options.labelText = value;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.baseClass = function(value) {
-        return this.options.baseClass;
-      };
-
-      BootstrapSwitch.prototype.wrapperClass = function(value) {
-        if (typeof value === "undefined") {
-          return this.options.wrapperClass;
-        }
-        if (!value) {
-          value = $.fn.bootstrapSwitch.defaults.wrapperClass;
-        }
-        this.$wrapper.removeClass(this._getClasses(this.options.wrapperClass).join(" "));
-        this.$wrapper.addClass(this._getClasses(value).join(" "));
-        this.options.wrapperClass = value;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.radioAllOff = function(value) {
-        if (typeof value === "undefined") {
-          return this.options.radioAllOff;
-        }
-        this.options.radioAllOff = value;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.onInit = function(value) {
-        if (typeof value === "undefined") {
-          return this.options.onInit;
-        }
-        if (!value) {
-          value = $.fn.bootstrapSwitch.defaults.onInit;
-        }
-        this.options.onInit = value;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.onSwitchChange = function(value) {
-        if (typeof value === "undefined") {
-          return this.options.onSwitchChange;
-        }
-        if (!value) {
-          value = $.fn.bootstrapSwitch.defaults.onSwitchChange;
-        }
-        this.options.onSwitchChange = value;
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype.destroy = function() {
-        var $form;
-        $form = this.$element.closest("form");
-        if ($form.length) {
-          $form.off("reset.bootstrapSwitch").removeData("bootstrap-switch");
-        }
-        this.$container.children().not(this.$element).remove();
-        this.$element.unwrap().unwrap().off(".bootstrapSwitch").removeData("bootstrap-switch");
-        return this.$element;
-      };
-
-      BootstrapSwitch.prototype._elementHandlers = function() {
-        return this.$element.on({
-          "change.bootstrapSwitch": (function(_this) {
-            return function(e, skip) {
-              var checked;
-              e.preventDefault();
-              e.stopImmediatePropagation();
-              checked = _this.$element.is(":checked");
-              if (checked === _this.options.state) {
-                return;
-              }
-              _this.options.state = checked;
-              _this.$wrapper.removeClass(checked ? "" + _this.options.baseClass + "-off" : "" + _this.options.baseClass + "-on").addClass(checked ? "" + _this.options.baseClass + "-on" : "" + _this.options.baseClass + "-off");
-              if (!skip) {
-                if (_this.$element.is(":radio")) {
-                  $("[name='" + (_this.$element.attr('name')) + "']").not(_this.$element).prop("checked", false).trigger("change.bootstrapSwitch", true);
-                }
-                return _this.$element.trigger("switchChange.bootstrapSwitch", [checked]);
-              }
-            };
-          })(this),
-          "focus.bootstrapSwitch": (function(_this) {
-            return function(e) {
-              e.preventDefault();
-              return _this.$wrapper.addClass("" + _this.options.baseClass + "-focused");
-            };
-          })(this),
-          "blur.bootstrapSwitch": (function(_this) {
-            return function(e) {
-              e.preventDefault();
-              return _this.$wrapper.removeClass("" + _this.options.baseClass + "-focused");
-            };
-          })(this),
-          "keydown.bootstrapSwitch": (function(_this) {
-            return function(e) {
-              if (!e.which || _this.options.disabled || _this.options.readonly) {
-                return;
-              }
-              switch (e.which) {
-                case 37:
-                  e.preventDefault();
-                  e.stopImmediatePropagation();
-                  return _this.state(false);
-                case 39:
-                  e.preventDefault();
-                  e.stopImmediatePropagation();
-                  return _this.state(true);
-              }
-            };
-          })(this)
-        });
-      };
-
-      BootstrapSwitch.prototype._handleHandlers = function() {
-        this.$on.on("click.bootstrapSwitch", (function(_this) {
-          return function(e) {
-            _this.state(false);
-            return _this.$element.trigger("focus.bootstrapSwitch");
-          };
-        })(this));
-        return this.$off.on("click.bootstrapSwitch", (function(_this) {
-          return function(e) {
-            _this.state(true);
-            return _this.$element.trigger("focus.bootstrapSwitch");
-          };
-        })(this));
-      };
-
-      BootstrapSwitch.prototype._labelHandlers = function() {
-        return this.$label.on({
-          "mousemove.bootstrapSwitch touchmove.bootstrapSwitch": (function(_this) {
-            return function(e) {
-              var left, pageX, percent, right;
-              if (!_this.isLabelDragging) {
-                return;
-              }
-              e.preventDefault();
-              _this.isLabelDragged = true;
-              pageX = e.pageX || e.originalEvent.touches[0].pageX;
-              percent = ((pageX - _this.$wrapper.offset().left) / _this.$wrapper.width()) * 100;
-              left = 25;
-              right = 75;
-              if (_this.options.animate) {
-                _this.$wrapper.removeClass("" + _this.options.baseClass + "-animate");
-              }
-              if (percent < left) {
-                percent = left;
-              } else if (percent > right) {
-                percent = right;
-              }
-              _this.$container.css("margin-left", "" + (percent - right) + "%");
-              return _this.$element.trigger("focus.bootstrapSwitch");
-            };
-          })(this),
-          "mousedown.bootstrapSwitch touchstart.bootstrapSwitch": (function(_this) {
-            return function(e) {
-              if (_this.isLabelDragging || _this.options.disabled || _this.options.readonly) {
-                return;
-              }
-              e.preventDefault();
-              _this.isLabelDragging = true;
-              return _this.$element.trigger("focus.bootstrapSwitch");
-            };
-          })(this),
-          "mouseup.bootstrapSwitch touchend.bootstrapSwitch": (function(_this) {
-            return function(e) {
-              var state;
-              if (!_this.isLabelDragging) {
-                return;
-              }
-              e.preventDefault();
-              if (_this.isLabelDragged) {
-                state = parseInt(_this.$container.css("margin-left"), 10) > -(_this.$container.width() / 6);
-                _this.isLabelDragged = false;
-                _this.state(_this.options.inverse ? !state : state);
-                if (_this.options.animate) {
-                  _this.$wrapper.addClass("" + _this.options.baseClass + "-animate");
-                }
-                _this.$container.css("margin-left", "");
-              } else {
-                _this.state(!_this.options.state);
-              }
-              return _this.isLabelDragging = false;
-            };
-          })(this),
-          "mouseleave.bootstrapSwitch": (function(_this) {
-            return function(e) {
-              return _this.$label.trigger("mouseup.bootstrapSwitch");
-            };
-          })(this)
-        });
-      };
-
-      BootstrapSwitch.prototype._formHandler = function() {
-        var $form;
-        $form = this.$element.closest("form");
-        if ($form.data("bootstrap-switch")) {
-          return;
-        }
-        return $form.on("reset.bootstrapSwitch", function() {
-          return window.setTimeout(function() {
-            return $form.find("input").filter(function() {
-              return $(this).data("bootstrap-switch");
-            }).each(function() {
-              return $(this).bootstrapSwitch("state", this.checked);
-            });
-          }, 1);
-        }).data("bootstrap-switch", true);
-      };
-
-      BootstrapSwitch.prototype._getClasses = function(classes) {
-        var c, cls, _i, _len;
-        if (!$.isArray(classes)) {
-          return ["" + this.options.baseClass + "-" + classes];
-        }
-        cls = [];
-        for (_i = 0, _len = classes.length; _i < _len; _i++) {
-          c = classes[_i];
-          cls.push("" + this.options.baseClass + "-" + c);
-        }
-        return cls;
-      };
-
-      return BootstrapSwitch;
-
-    })();
-    $.fn.bootstrapSwitch = function() {
-      var args, option, ret;
-      option = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
-      ret = this;
-      this.each(function() {
-        var $this, data;
-        $this = $(this);
-        data = $this.data("bootstrap-switch");
-        if (!data) {
-          $this.data("bootstrap-switch", data = new BootstrapSwitch(this, option));
-        }
-        if (typeof option === "string") {
-          return ret = data[option].apply(data, args);
-        }
-      });
-      return ret;
-    };
-    $.fn.bootstrapSwitch.Constructor = BootstrapSwitch;
-    return $.fn.bootstrapSwitch.defaults = {
-      state: true,
-      size: null,
-      animate: true,
-      disabled: false,
-      readonly: false,
-      indeterminate: false,
-      inverse: false,
-      radioAllOff: false,
-      onColor: "primary",
-      offColor: "default",
-      onText: "ON",
-      offText: "OFF",
-      labelText: "&nbsp;",
-      baseClass: "bootstrap-switch",
-      wrapperClass: "wrapper",
-      onInit: function() {},
-      onSwitchChange: function() {}
-    };
-  })(window.jQuery, window);
-
-}).call(this);

+ 1 - 1
src/js/lib/bzip2.js

@@ -28,7 +28,7 @@
 */
 "use strict";
 
-var bzip2 = module.exports = {};
+var bzip2 = {};
 
 bzip2.array = function(bytes){
   var bit = 0, byte = 0;

+ 1 - 1
src/js/lib/canvascomponents.js

@@ -10,7 +10,7 @@
  * @constant
  * @namespace
  */
-var CanvasComponents = {
+var CanvasComponents = module.exports = {
 
     drawLine: function(ctx, startX, startY, endX, endY) {
         ctx.beginPath();

+ 0 - 1055
src/js/lib/diff.js

@@ -1,1055 +0,0 @@
-/** @license
-========================================================================
-  JsDiff v2.0.1
-  
-  Software License Agreement (BSD License)
-  
-  Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
-  All rights reserved.
-  
-  Redistribution and use of this software in source and binary forms, with or without modification,
-  are permitted provided that the following conditions are met:
-  
-  * Redistributions of source code must retain the above
-    copyright notice, this list of conditions and the
-    following disclaimer.
-  
-  * Redistributions in binary form must reproduce the above
-    copyright notice, this list of conditions and the
-    following disclaimer in the documentation and/or other
-    materials provided with the distribution.
-  
-  * Neither the name of Kevin Decker nor the names of its
-    contributors may be used to endorse or promote products
-    derived from this software without specific prior
-    written permission.
-  
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
-  IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-  FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
-  IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-"use strict";
-
-(function webpackUniversalModuleDefinition(root, factory) {
-	if(typeof exports === 'object' && typeof module === 'object')
-		module.exports = factory();
-	else if(typeof define === 'function' && define.amd)
-		define(factory);
-	else if(typeof exports === 'object')
-		exports["JsDiff"] = factory();
-	else
-		root["JsDiff"] = factory();
-})(this, function() {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ 	// The module cache
-/******/ 	var installedModules = {};
-
-/******/ 	// The require function
-/******/ 	function __webpack_require__(moduleId) {
-
-/******/ 		// Check if module is in cache
-/******/ 		if(installedModules[moduleId])
-/******/ 			return installedModules[moduleId].exports;
-
-/******/ 		// Create a new module (and put it into the cache)
-/******/ 		var module = installedModules[moduleId] = {
-/******/ 			exports: {},
-/******/ 			id: moduleId,
-/******/ 			loaded: false
-/******/ 		};
-
-/******/ 		// Execute the module function
-/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-
-/******/ 		// Flag the module as loaded
-/******/ 		module.loaded = true;
-
-/******/ 		// Return the exports of the module
-/******/ 		return module.exports;
-/******/ 	}
-
-
-/******/ 	// expose the modules object (__webpack_modules__)
-/******/ 	__webpack_require__.m = modules;
-
-/******/ 	// expose the module cache
-/******/ 	__webpack_require__.c = installedModules;
-
-/******/ 	// __webpack_public_path__
-/******/ 	__webpack_require__.p = "";
-
-/******/ 	// Load entry module and return exports
-/******/ 	return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ function(module, exports, __webpack_require__) {
-
-	/* See LICENSE file for terms of use */
-
-	/*
-	 * Text diff implementation.
-	 *
-	 * This library supports the following APIS:
-	 * JsDiff.diffChars: Character by character diff
-	 * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
-	 * JsDiff.diffLines: Line based diff
-	 *
-	 * JsDiff.diffCss: Diff targeted at CSS content
-	 *
-	 * These methods are based on the implementation proposed in
-	 * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
-	 * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
-	 */
-	'use strict';
-
-	exports.__esModule = true;
-	// istanbul ignore next
-
-	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-	var _diffBase = __webpack_require__(1);
-
-	var _diffBase2 = _interopRequireDefault(_diffBase);
-
-	var _diffCharacter = __webpack_require__(3);
-
-	var _diffWord = __webpack_require__(4);
-
-	var _diffLine = __webpack_require__(5);
-
-	var _diffSentence = __webpack_require__(6);
-
-	var _diffCss = __webpack_require__(7);
-
-	var _diffJson = __webpack_require__(8);
-
-	// var _patchApply = __webpack_require__(9);
-
-	// var _patchCreate = __webpack_require__(10);
-
-	// var _convertDmp = __webpack_require__(12);
-
-	// var _convertXml = __webpack_require__(13);
-
-	exports.Diff = _diffBase2['default'];
-	exports.diffChars = _diffCharacter.diffChars;
-	exports.diffWords = _diffWord.diffWords;
-	exports.diffWordsWithSpace = _diffWord.diffWordsWithSpace;
-	exports.diffLines = _diffLine.diffLines;
-	exports.diffTrimmedLines = _diffLine.diffTrimmedLines;
-	exports.diffSentences = _diffSentence.diffSentences;
-	exports.diffCss = _diffCss.diffCss;
-	exports.diffJson = _diffJson.diffJson;
-	// exports.structuredPatch = _patchCreate.structuredPatch;
-	// exports.createTwoFilesPatch = _patchCreate.createTwoFilesPatch;
-	// exports.createPatch = _patchCreate.createPatch;
-	// exports.applyPatch = _patchApply.applyPatch;
-	// exports.convertChangesToDMP = _convertDmp.convertChangesToDMP;
-	// exports.convertChangesToXML = _convertXml.convertChangesToXML;
-	exports.canonicalize = _diffJson.canonicalize;
-
-
-/***/ },
-/* 1 */
-/***/ function(module, exports, __webpack_require__) {
-
-	'use strict';
-
-	exports.__esModule = true;
-	exports['default'] = Diff;
-	// istanbul ignore next
-
-	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-	var _utilMap = __webpack_require__(2);
-
-	var _utilMap2 = _interopRequireDefault(_utilMap);
-
-	function Diff(ignoreWhitespace) {
-	  this.ignoreWhitespace = ignoreWhitespace;
-	}
-
-	Diff.prototype = {
-	  diff: function diff(oldString, newString, callback) {
-	    var self = this;
-
-	    function done(value) {
-	      if (callback) {
-	        setTimeout(function () {
-	          callback(undefined, value);
-	        }, 0);
-	        return true;
-	      } else {
-	        return value;
-	      }
-	    }
-
-	    // Allow subclasses to massage the input prior to running
-	    oldString = this.castInput(oldString);
-	    newString = this.castInput(newString);
-
-	    // Handle the identity case (this is due to unrolling editLength == 0
-	    if (newString === oldString) {
-	      return done([{ value: newString }]);
-	    }
-	    if (!newString) {
-	      return done([{ value: oldString, removed: true }]);
-	    }
-	    if (!oldString) {
-	      return done([{ value: newString, added: true }]);
-	    }
-
-	    newString = this.removeEmpty(this.tokenize(newString));
-	    oldString = this.removeEmpty(this.tokenize(oldString));
-
-	    var newLen = newString.length,
-	        oldLen = oldString.length;
-	    var editLength = 1;
-	    var maxEditLength = newLen + oldLen;
-	    var bestPath = [{ newPos: -1, components: [] }];
-
-	    // Seed editLength = 0, i.e. the content starts with the same values
-	    var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
-	    if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
-	      // Identity per the equality and tokenizer
-	      return done([{ value: newString.join('') }]);
-	    }
-
-	    // Main worker method. checks all permutations of a given edit length for acceptance.
-	    function execEditLength() {
-	      for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
-	        var basePath = undefined;
-	        var addPath = bestPath[diagonalPath - 1],
-	            removePath = bestPath[diagonalPath + 1],
-	            _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
-	        if (addPath) {
-	          // No one else is going to attempt to use this value, clear it
-	          bestPath[diagonalPath - 1] = undefined;
-	        }
-
-	        var canAdd = addPath && addPath.newPos + 1 < newLen,
-	            canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
-	        if (!canAdd && !canRemove) {
-	          // If this path is a terminal then prune
-	          bestPath[diagonalPath] = undefined;
-	          continue;
-	        }
-
-	        // Select the diagonal that we want to branch from. We select the prior
-	        // path whose position in the new string is the farthest from the origin
-	        // and does not pass the bounds of the diff graph
-	        if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
-	          basePath = clonePath(removePath);
-	          self.pushComponent(basePath.components, undefined, true);
-	        } else {
-	          basePath = addPath; // No need to clone, we've pulled it from the list
-	          basePath.newPos++;
-	          self.pushComponent(basePath.components, true, undefined);
-	        }
-
-	        _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
-
-	        // If we have hit the end of both strings, then we are done
-	        if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
-	          return done(buildValues(basePath.components, newString, oldString, self.useLongestToken));
-	        } else {
-	          // Otherwise track this path as a potential candidate and continue.
-	          bestPath[diagonalPath] = basePath;
-	        }
-	      }
-
-	      editLength++;
-	    }
-
-	    // Performs the length of edit iteration. Is a bit fugly as this has to support the
-	    // sync and async mode which is never fun. Loops over execEditLength until a value
-	    // is produced.
-	    if (callback) {
-	      (function exec() {
-	        setTimeout(function () {
-	          // This should not happen, but we want to be safe.
-	          /* istanbul ignore next */
-	          if (editLength > maxEditLength) {
-	            return callback();
-	          }
-
-	          if (!execEditLength()) {
-	            exec();
-	          }
-	        }, 0);
-	      })();
-	    } else {
-	      while (editLength <= maxEditLength) {
-	        var ret = execEditLength();
-	        if (ret) {
-	          return ret;
-	        }
-	      }
-	    }
-	  },
-
-	  pushComponent: function pushComponent(components, added, removed) {
-	    var last = components[components.length - 1];
-	    if (last && last.added === added && last.removed === removed) {
-	      // We need to clone here as the component clone operation is just
-	      // as shallow array clone
-	      components[components.length - 1] = { count: last.count + 1, added: added, removed: removed };
-	    } else {
-	      components.push({ count: 1, added: added, removed: removed });
-	    }
-	  },
-	  extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
-	    var newLen = newString.length,
-	        oldLen = oldString.length,
-	        newPos = basePath.newPos,
-	        oldPos = newPos - diagonalPath,
-	        commonCount = 0;
-	    while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
-	      newPos++;
-	      oldPos++;
-	      commonCount++;
-	    }
-
-	    if (commonCount) {
-	      basePath.components.push({ count: commonCount });
-	    }
-
-	    basePath.newPos = newPos;
-	    return oldPos;
-	  },
-
-	  equals: function equals(left, right) {
-	    var reWhitespace = /\S/;
-	    return left === right || this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
-	  },
-	  removeEmpty: function removeEmpty(array) {
-	    var ret = [];
-	    for (var i = 0; i < array.length; i++) {
-	      if (array[i]) {
-	        ret.push(array[i]);
-	      }
-	    }
-	    return ret;
-	  },
-	  castInput: function castInput(value) {
-	    return value;
-	  },
-	  tokenize: function tokenize(value) {
-	    return value.split('');
-	  }
-	};
-
-	function buildValues(components, newString, oldString, useLongestToken) {
-	  var componentPos = 0,
-	      componentLen = components.length,
-	      newPos = 0,
-	      oldPos = 0;
-
-	  for (; componentPos < componentLen; componentPos++) {
-	    var component = components[componentPos];
-	    if (!component.removed) {
-	      if (!component.added && useLongestToken) {
-	        var value = newString.slice(newPos, newPos + component.count);
-	        value = _utilMap2['default'](value, function (value, i) {
-	          var oldValue = oldString[oldPos + i];
-	          return oldValue.length > value.length ? oldValue : value;
-	        });
-
-	        component.value = value.join('');
-	      } else {
-	        component.value = newString.slice(newPos, newPos + component.count).join('');
-	      }
-	      newPos += component.count;
-
-	      // Common case
-	      if (!component.added) {
-	        oldPos += component.count;
-	      }
-	    } else {
-	      component.value = oldString.slice(oldPos, oldPos + component.count).join('');
-	      oldPos += component.count;
-
-	      // Reverse add and remove so removes are output first to match common convention
-	      // The diffing algorithm is tied to add then remove output and this is the simplest
-	      // route to get the desired output with minimal overhead.
-	      if (componentPos && components[componentPos - 1].added) {
-	        var tmp = components[componentPos - 1];
-	        components[componentPos - 1] = components[componentPos];
-	        components[componentPos] = tmp;
-	      }
-	    }
-	  }
-
-	  return components;
-	}
-
-	function clonePath(path) {
-	  return { newPos: path.newPos, components: path.components.slice(0) };
-	}
-	module.exports = exports['default'];
-
-
-/***/ },
-/* 2 */
-/***/ function(module, exports) {
-
-	// Following this pattern to make sure the ignore next is in the correct place after babel builds
-	"use strict";
-
-	exports.__esModule = true;
-	exports["default"] = map;
-
-	/* istanbul ignore next */
-	function map(arr, mapper, that) {
-	  if (Array.prototype.map) {
-	    return Array.prototype.map.call(arr, mapper, that);
-	  }
-
-	  var other = new Array(arr.length);
-
-	  for (var i = 0, n = arr.length; i < n; i++) {
-	    other[i] = mapper.call(that, arr[i], i, arr);
-	  }
-	  return other;
-	}
-	module.exports = exports["default"];
-
-
-/***/ },
-/* 3 */
-/***/ function(module, exports, __webpack_require__) { // diffChars
-
-	'use strict';
-
-	exports.__esModule = true;
-	exports.diffChars = diffChars;
-	// istanbul ignore next
-
-	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-	var _base = __webpack_require__(1);
-
-	var _base2 = _interopRequireDefault(_base);
-
-	var characterDiff = new _base2['default']();
-	exports.characterDiff = characterDiff;
-
-	function diffChars(oldStr, newStr, callback) {
-	  return characterDiff.diff(oldStr, newStr, callback);
-	}
-
-
-/***/ },
-/* 4 */
-/***/ function(module, exports, __webpack_require__) { // diffWords
-
-	'use strict';
-
-	exports.__esModule = true;
-	exports.diffWords = diffWords;
-	exports.diffWordsWithSpace = diffWordsWithSpace;
-	// istanbul ignore next
-
-	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-	var _base = __webpack_require__(1);
-
-	// Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
-	//
-	// Ranges and exceptions:
-	// Latin-1 Supplement, 0080 - 00FF
-	//  - U+00D7  Multiplication sign
-	//  - U+00F7  Division sign
-	// Latin Extended-A, 0100 - 017F
-	// Latin Extended-B, 0180 - 024F
-	// IPA Extensions, 0250 - 02AF
-	// Spacing Modifier Letters, 02B0 - 02FF
-	//  - U+02C7  &#711;  Caron
-	//  - U+02D8  &#728;  Breve
-	//  - U+02D9  &#729;  Dot Above
-	//  - U+02DA  &#730;  Ring Above
-	//  - U+02DB  &#731;  Ogonek
-	//  - U+02DC  &#732;  Small Tilde
-	//  - U+02DD  &#733;  Double Acute Accent
-	// Latin Extended Additional, 1E00 - 1EFF
-
-	var _base2 = _interopRequireDefault(_base);
-
-	var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
-
-	var wordDiff = new _base2['default'](true);
-	exports.wordDiff = wordDiff;
-	var wordWithSpaceDiff = new _base2['default']();
-	exports.wordWithSpaceDiff = wordWithSpaceDiff;
-	wordDiff.tokenize = wordWithSpaceDiff.tokenize = function (value) {
-	  var tokens = value.split(/(\s+|\b)/);
-
-	  // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
-	  for (var i = 0; i < tokens.length - 1; i++) {
-	    // If we have an empty string in the next field and we have only word chars before and after, merge
-	    if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
-	      tokens[i] += tokens[i + 2];
-	      tokens.splice(i + 1, 2);
-	      i--;
-	    }
-	  }
-
-	  return tokens;
-	};
-
-	function diffWords(oldStr, newStr, callback) {
-	  return wordDiff.diff(oldStr, newStr, callback);
-	}
-
-	function diffWordsWithSpace(oldStr, newStr, callback) {
-	  return wordWithSpaceDiff.diff(oldStr, newStr, callback);
-	}
-
-
-/***/ },
-/* 5 */
-/***/ function(module, exports, __webpack_require__) { // diffLines
-
-	'use strict';
-
-	exports.__esModule = true;
-	exports.diffLines = diffLines;
-	exports.diffTrimmedLines = diffTrimmedLines;
-	// istanbul ignore next
-
-	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-	var _base = __webpack_require__(1);
-
-	var _base2 = _interopRequireDefault(_base);
-
-	var lineDiff = new _base2['default']();
-	exports.lineDiff = lineDiff;
-	var trimmedLineDiff = new _base2['default']();
-	exports.trimmedLineDiff = trimmedLineDiff;
-	trimmedLineDiff.ignoreTrim = true;
-
-	lineDiff.tokenize = trimmedLineDiff.tokenize = function (value) {
-	  var retLines = [],
-	      lines = value.split(/^/m);
-	  for (var i = 0; i < lines.length; i++) {
-	    var line = lines[i],
-	        lastLine = lines[i - 1],
-	        lastLineLastChar = lastLine && lastLine[lastLine.length - 1];
-
-	    // Merge lines that may contain windows new lines
-	    if (line === '\n' && lastLineLastChar === '\r') {
-	      retLines[retLines.length - 1] = retLines[retLines.length - 1].slice(0, -1) + '\r\n';
-	    } else {
-	      if (this.ignoreTrim) {
-	        line = line.trim();
-	        // add a newline unless this is the last line.
-	        if (i < lines.length - 1) {
-	          line += '\n';
-	        }
-	      }
-	      retLines.push(line);
-	    }
-	  }
-
-	  return retLines;
-	};
-
-	function diffLines(oldStr, newStr, callback) {
-	  return lineDiff.diff(oldStr, newStr, callback);
-	}
-
-	function diffTrimmedLines(oldStr, newStr, callback) {
-	  return trimmedLineDiff.diff(oldStr, newStr, callback);
-	}
-
-
-/***/ },
-/* 6 */
-/***/ function(module, exports, __webpack_require__) { // diffSentences
-
-	'use strict';
-
-	exports.__esModule = true;
-	exports.diffSentences = diffSentences;
-	// istanbul ignore next
-
-	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-	var _base = __webpack_require__(1);
-
-	var _base2 = _interopRequireDefault(_base);
-
-	var sentenceDiff = new _base2['default']();
-	exports.sentenceDiff = sentenceDiff;
-	sentenceDiff.tokenize = function (value) {
-	  return value.split(/(\S.+?[.!?])(?=\s+|$)/);
-	};
-
-	function diffSentences(oldStr, newStr, callback) {
-	  return sentenceDiff.diff(oldStr, newStr, callback);
-	}
-
-
-/***/ },
-/* 7 */
-/***/ function(module, exports, __webpack_require__) { // diffCss
-
-	'use strict';
-
-	exports.__esModule = true;
-	exports.diffCss = diffCss;
-	// istanbul ignore next
-
-	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-	var _base = __webpack_require__(1);
-
-	var _base2 = _interopRequireDefault(_base);
-
-	var cssDiff = new _base2['default']();
-	exports.cssDiff = cssDiff;
-	cssDiff.tokenize = function (value) {
-	  return value.split(/([{}:;,]|\s+)/);
-	};
-
-	function diffCss(oldStr, newStr, callback) {
-	  return cssDiff.diff(oldStr, newStr, callback);
-	}
-
-
-/***/ },
-/* 8 */
-/***/ function(module, exports, __webpack_require__) { // diffJson
-
-	'use strict';
-
-	exports.__esModule = true;
-	exports.diffJson = diffJson;
-	exports.canonicalize = canonicalize;
-	// istanbul ignore next
-
-	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-	var _base = __webpack_require__(1);
-
-	var _base2 = _interopRequireDefault(_base);
-
-	var _line = __webpack_require__(5);
-
-	var objectPrototypeToString = Object.prototype.toString;
-
-	var jsonDiff = new _base2['default']();
-	// Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
-	// dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
-	exports.jsonDiff = jsonDiff;
-	jsonDiff.useLongestToken = true;
-
-	jsonDiff.tokenize = _line.lineDiff.tokenize;
-	jsonDiff.castInput = function (value) {
-	  return typeof value === 'string' ? value : JSON.stringify(canonicalize(value), undefined, '  ');
-	};
-	jsonDiff.equals = function (left, right) {
-	  return _base2['default'].prototype.equals(left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'));
-	};
-
-	function diffJson(oldObj, newObj, callback) {
-	  return jsonDiff.diff(oldObj, newObj, callback);
-	}
-
-	// This function handles the presence of circular references by bailing out when encountering an
-	// object that is already on the "stack" of items being processed.
-
-	function canonicalize(obj, stack, replacementStack) {
-	  stack = stack || [];
-	  replacementStack = replacementStack || [];
-
-	  var i = undefined;
-
-	  for (i = 0; i < stack.length; i += 1) {
-	    if (stack[i] === obj) {
-	      return replacementStack[i];
-	    }
-	  }
-
-	  var canonicalizedObj = undefined;
-
-	  if ('[object Array]' === objectPrototypeToString.call(obj)) {
-	    stack.push(obj);
-	    canonicalizedObj = new Array(obj.length);
-	    replacementStack.push(canonicalizedObj);
-	    for (i = 0; i < obj.length; i += 1) {
-	      canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack);
-	    }
-	    stack.pop();
-	    replacementStack.pop();
-	  } else if (typeof obj === 'object' && obj !== null) {
-	    stack.push(obj);
-	    canonicalizedObj = {};
-	    replacementStack.push(canonicalizedObj);
-	    var sortedKeys = [],
-	        key = undefined;
-	    for (key in obj) {
-	      /* istanbul ignore else */
-	      if (obj.hasOwnProperty(key)) {
-	        sortedKeys.push(key);
-	      }
-	    }
-	    sortedKeys.sort();
-	    for (i = 0; i < sortedKeys.length; i += 1) {
-	      key = sortedKeys[i];
-	      canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack);
-	    }
-	    stack.pop();
-	    replacementStack.pop();
-	  } else {
-	    canonicalizedObj = obj;
-	  }
-	  return canonicalizedObj;
-	}
-
-
-/***/ },
-/* 9 */
-/* function(module, exports) { // applyPatch
-
-	'use strict';
-
-	exports.__esModule = true;
-	exports.applyPatch = applyPatch;
-
-	function applyPatch(oldStr, uniDiff) {
-	  var diffstr = uniDiff.split('\n'),
-	      hunks = [],
-	      i = 0,
-	      remEOFNL = false,
-	      addEOFNL = false;
-
-	  // Skip to the first change hunk
-	  while (i < diffstr.length && !/^@@/.test(diffstr[i])) {
-	    i++;
-	  }
-
-	  // Parse the unified diff
-	  for (; i < diffstr.length; i++) {
-	    if (diffstr[i][0] === '@') {
-	      var chnukHeader = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);
-	      hunks.unshift({
-	        start: chnukHeader[3],
-	        oldlength: +chnukHeader[2],
-	        removed: [],
-	        newlength: chnukHeader[4],
-	        added: []
-	      });
-	    } else if (diffstr[i][0] === '+') {
-	      hunks[0].added.push(diffstr[i].substr(1));
-	    } else if (diffstr[i][0] === '-') {
-	      hunks[0].removed.push(diffstr[i].substr(1));
-	    } else if (diffstr[i][0] === ' ') {
-	      hunks[0].added.push(diffstr[i].substr(1));
-	      hunks[0].removed.push(diffstr[i].substr(1));
-	    } else if (diffstr[i][0] === '\\') {
-	      if (diffstr[i - 1][0] === '+') {
-	        remEOFNL = true;
-	      } else if (diffstr[i - 1][0] === '-') {
-	        addEOFNL = true;
-	      }
-	    }
-	  }
-
-	  // Apply the diff to the input
-	  var lines = oldStr.split('\n');
-	  for (i = hunks.length - 1; i >= 0; i--) {
-	    var hunk = hunks[i];
-	    // Sanity check the input string. Bail if we don't match.
-	    for (var j = 0; j < hunk.oldlength; j++) {
-	      if (lines[hunk.start - 1 + j] !== hunk.removed[j]) {
-	        return false;
-	      }
-	    }
-	    Array.prototype.splice.apply(lines, [hunk.start - 1, hunk.oldlength].concat(hunk.added));
-	  }
-
-	  // Handle EOFNL insertion/removal
-	  if (remEOFNL) {
-	    while (!lines[lines.length - 1]) {
-	      lines.pop();
-	    }
-	  } else if (addEOFNL) {
-	    lines.push('');
-	  }
-	  return lines.join('\n');
-	}
-
-
-/* },
-/* 10 */
-/* function(module, exports, __webpack_require__) { // structuredPatch, createTwoFilesPatch, createPatch
-
-	'use strict';
-
-	exports.__esModule = true;
-	exports.structuredPatch = structuredPatch;
-	exports.createTwoFilesPatch = createTwoFilesPatch;
-	exports.createPatch = createPatch;
-	// istanbul ignore next
-
-	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-	var _diffPatch = __webpack_require__(11);
-
-	var _utilMap = __webpack_require__(2);
-
-	var _utilMap2 = _interopRequireDefault(_utilMap);
-
-	function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
-	  if (!options) {
-	    options = { context: 4 };
-	  }
-
-	  var diff = _diffPatch.patchDiff.diff(oldStr, newStr);
-	  diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier
-
-	  function contextLines(lines) {
-	    return _utilMap2['default'](lines, function (entry) {
-	      return ' ' + entry;
-	    });
-	  }
-
-	  var hunks = [];
-	  var oldRangeStart = 0,
-	      newRangeStart = 0,
-	      curRange = [],
-	      oldLine = 1,
-	      newLine = 1;
-
-	  var _loop = function (i) {
-	    var current = diff[i],
-	        lines = current.lines || current.value.replace(/\n$/, '').split('\n');
-	    current.lines = lines;
-
-	    if (current.added || current.removed) {
-	      // If we have previous context, start with that
-	      if (!oldRangeStart) {
-	        var prev = diff[i - 1];
-	        oldRangeStart = oldLine;
-	        newRangeStart = newLine;
-
-	        if (prev) {
-	          curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
-	          oldRangeStart -= curRange.length;
-	          newRangeStart -= curRange.length;
-	        }
-	      }
-
-	      // Output our changes
-	      curRange.push.apply(curRange, _utilMap2['default'](lines, function (entry) {
-	        return (current.added ? '+' : '-') + entry;
-	      }));
-
-	      // Track the updated file position
-	      if (current.added) {
-	        newLine += lines.length;
-	      } else {
-	        oldLine += lines.length;
-	      }
-	    } else {
-	      // Identical context lines. Track line changes
-	      if (oldRangeStart) {
-	        // Close out any changes that have been output (or join overlapping)
-	        if (lines.length <= options.context * 2 && i < diff.length - 2) {
-	          // Overlapping
-	          curRange.push.apply(curRange, contextLines(lines));
-	        } else {
-	          // end the range and output
-	          var contextSize = Math.min(lines.length, options.context);
-	          curRange.push.apply(curRange, contextLines(lines.slice(0, contextSize)));
-
-	          var hunk = {
-	            oldStart: oldRangeStart,
-	            oldLines: oldLine - oldRangeStart + contextSize,
-	            newStart: newRangeStart,
-	            newLines: newLine - newRangeStart + contextSize,
-	            lines: curRange
-	          };
-	          if (i >= diff.length - 2 && lines.length <= options.context) {
-	            // EOF is inside this hunk
-	            var oldEOFNewline = /\n$/.test(oldStr);
-	            var newEOFNewline = /\n$/.test(newStr);
-	            if (lines.length == 0 && !oldEOFNewline) {
-	              // special case: old has no eol and no trailing context; no-nl can end up before adds
-	              curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
-	            } else if (!oldEOFNewline || !newEOFNewline) {
-	              curRange.push('\\ No newline at end of file');
-	            }
-	          }
-	          hunks.push(hunk);
-
-	          oldRangeStart = 0;
-	          newRangeStart = 0;
-	          curRange = [];
-	        }
-	      }
-	      oldLine += lines.length;
-	      newLine += lines.length;
-	    }
-	  };
-
-	  for (var i = 0; i < diff.length; i++) {
-	    _loop(i);
-	  }
-
-	  return {
-	    oldFileName: oldFileName, newFileName: newFileName,
-	    oldHeader: oldHeader, newHeader: newHeader,
-	    hunks: hunks
-	  };
-	}
-
-	function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
-	  var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
-
-	  var ret = [];
-	  if (oldFileName == newFileName) {
-	    ret.push('Index: ' + oldFileName);
-	  }
-	  ret.push('===================================================================');
-	  ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
-	  ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
-
-	  for (var i = 0; i < diff.hunks.length; i++) {
-	    var hunk = diff.hunks[i];
-	    ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
-	    ret.push.apply(ret, hunk.lines);
-	  }
-
-	  return ret.join('\n') + '\n';
-	}
-
-	function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
-	  return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
-	}
-
-
-/* },
-/* 11 */
-/* function(module, exports, __webpack_require__) { // patchDiff
-
-	'use strict';
-
-	exports.__esModule = true;
-	// istanbul ignore next
-
-	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
-
-	var _base = __webpack_require__(1);
-
-	var _base2 = _interopRequireDefault(_base);
-
-	var patchDiff = new _base2['default']();
-	exports.patchDiff = patchDiff;
-	patchDiff.tokenize = function (value) {
-	  var ret = [],
-	      linesAndNewlines = value.split(/(\n|\r\n)/);
-
-	  // Ignore the final empty token that occurs if the string ends with a new line
-	  if (!linesAndNewlines[linesAndNewlines.length - 1]) {
-	    linesAndNewlines.pop();
-	  }
-
-	  // Merge the content and line separators into single tokens
-	  for (var i = 0; i < linesAndNewlines.length; i++) {
-	    var line = linesAndNewlines[i];
-
-	    if (i % 2) {
-	      ret[ret.length - 1] += line;
-	    } else {
-	      ret.push(line);
-	    }
-	  }
-	  return ret;
-	};
-
-
-/* },
-/* 12 */
-/* function(module, exports) { // convertChangesToDMP
-
-	// See: http://code.google.com/p/google-diff-match-patch/wiki/API
-	"use strict";
-
-	exports.__esModule = true;
-	exports.convertChangesToDMP = convertChangesToDMP;
-
-	function convertChangesToDMP(changes) {
-	  var ret = [],
-	      change = undefined,
-	      operation = undefined;
-	  for (var i = 0; i < changes.length; i++) {
-	    change = changes[i];
-	    if (change.added) {
-	      operation = 1;
-	    } else if (change.removed) {
-	      operation = -1;
-	    } else {
-	      operation = 0;
-	    }
-
-	    ret.push([operation, change.value]);
-	  }
-	  return ret;
-	}
-
-
-/* },
-/* 13 */
-/* function(module, exports) { // convertChangesToXML
-
-	'use strict';
-
-	exports.__esModule = true;
-	exports.convertChangesToXML = convertChangesToXML;
-
-	function convertChangesToXML(changes) {
-	  var ret = [];
-	  for (var i = 0; i < changes.length; i++) {
-	    var change = changes[i];
-	    if (change.added) {
-	      ret.push('<ins>');
-	    } else if (change.removed) {
-	      ret.push('<del>');
-	    }
-
-	    ret.push(escapeHTML(change.value));
-
-	    if (change.added) {
-	      ret.push('</ins>');
-	    } else if (change.removed) {
-	      ret.push('</del>');
-	    }
-	  }
-	  return ret.join('');
-	}
-
-	function escapeHTML(s) {
-	  var n = s;
-	  n = n.replace(/&/g, '&amp;');
-	  n = n.replace(/</g, '&lt;');
-	  n = n.replace(/>/g, '&gt;');
-	  n = n.replace(/"/g, '&quot;');
-
-	  return n;
-	}
-
-
-/* }
-/******/ ])
-});
-;

+ 0 - 1159
src/js/lib/es6-promise.auto.js

@@ -1,1159 +0,0 @@
-/*!
- * @overview es6-promise - a tiny implementation of Promises/A+.
- * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
- * @license   Licensed under MIT license
- *            See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
- * @version   4.0.5
- */
-
-(function (global, factory) {
-    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
-    typeof define === 'function' && define.amd ? define(factory) :
-    (global.ES6Promise = factory());
-}(this, (function () { 'use strict';
-
-function objectOrFunction(x) {
-  return typeof x === 'function' || typeof x === 'object' && x !== null;
-}
-
-function isFunction(x) {
-  return typeof x === 'function';
-}
-
-var _isArray = undefined;
-if (!Array.isArray) {
-  _isArray = function (x) {
-    return Object.prototype.toString.call(x) === '[object Array]';
-  };
-} else {
-  _isArray = Array.isArray;
-}
-
-var isArray = _isArray;
-
-var len = 0;
-var vertxNext = undefined;
-var customSchedulerFn = undefined;
-
-var asap = function asap(callback, arg) {
-  queue[len] = callback;
-  queue[len + 1] = arg;
-  len += 2;
-  if (len === 2) {
-    // If len is 2, that means that we need to schedule an async flush.
-    // If additional callbacks are queued before the queue is flushed, they
-    // will be processed by this flush that we are scheduling.
-    if (customSchedulerFn) {
-      customSchedulerFn(flush);
-    } else {
-      scheduleFlush();
-    }
-  }
-};
-
-function setScheduler(scheduleFn) {
-  customSchedulerFn = scheduleFn;
-}
-
-function setAsap(asapFn) {
-  asap = asapFn;
-}
-
-var browserWindow = typeof window !== 'undefined' ? window : undefined;
-var browserGlobal = browserWindow || {};
-var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
-var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
-
-// test for web worker but not in IE10
-var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
-
-// node
-function useNextTick() {
-  // node version 0.10.x displays a deprecation warning when nextTick is used recursively
-  // see https://github.com/cujojs/when/issues/410 for details
-  return function () {
-    return process.nextTick(flush);
-  };
-}
-
-// vertx
-function useVertxTimer() {
-  if (typeof vertxNext !== 'undefined') {
-    return function () {
-      vertxNext(flush);
-    };
-  }
-
-  return useSetTimeout();
-}
-
-function useMutationObserver() {
-  var iterations = 0;
-  var observer = new BrowserMutationObserver(flush);
-  var node = document.createTextNode('');
-  observer.observe(node, { characterData: true });
-
-  return function () {
-    node.data = iterations = ++iterations % 2;
-  };
-}
-
-// web worker
-function useMessageChannel() {
-  var channel = new MessageChannel();
-  channel.port1.onmessage = flush;
-  return function () {
-    return channel.port2.postMessage(0);
-  };
-}
-
-function useSetTimeout() {
-  // Store setTimeout reference so es6-promise will be unaffected by
-  // other code modifying setTimeout (like sinon.useFakeTimers())
-  var globalSetTimeout = setTimeout;
-  return function () {
-    return globalSetTimeout(flush, 1);
-  };
-}
-
-var queue = new Array(1000);
-function flush() {
-  for (var i = 0; i < len; i += 2) {
-    var callback = queue[i];
-    var arg = queue[i + 1];
-
-    callback(arg);
-
-    queue[i] = undefined;
-    queue[i + 1] = undefined;
-  }
-
-  len = 0;
-}
-
-function attemptVertx() {
-  try {
-    var r = require;
-    var vertx = r('vertx');
-    vertxNext = vertx.runOnLoop || vertx.runOnContext;
-    return useVertxTimer();
-  } catch (e) {
-    return useSetTimeout();
-  }
-}
-
-var scheduleFlush = undefined;
-// Decide what async method to use to triggering processing of queued callbacks:
-if (isNode) {
-  scheduleFlush = useNextTick();
-} else if (BrowserMutationObserver) {
-  scheduleFlush = useMutationObserver();
-} else if (isWorker) {
-  scheduleFlush = useMessageChannel();
-} else if (browserWindow === undefined && typeof require === 'function') {
-  scheduleFlush = attemptVertx();
-} else {
-  scheduleFlush = useSetTimeout();
-}
-
-function then(onFulfillment, onRejection) {
-  var _arguments = arguments;
-
-  var parent = this;
-
-  var child = new this.constructor(noop);
-
-  if (child[PROMISE_ID] === undefined) {
-    makePromise(child);
-  }
-
-  var _state = parent._state;
-
-  if (_state) {
-    (function () {
-      var callback = _arguments[_state - 1];
-      asap(function () {
-        return invokeCallback(_state, child, callback, parent._result);
-      });
-    })();
-  } else {
-    subscribe(parent, child, onFulfillment, onRejection);
-  }
-
-  return child;
-}
-
-/**
-  `Promise.resolve` returns a promise that will become resolved with the
-  passed `value`. It is shorthand for the following:
-
-  ```javascript
-  let promise = new Promise(function(resolve, reject){
-    resolve(1);
-  });
-
-  promise.then(function(value){
-    // value === 1
-  });
-  ```
-
-  Instead of writing the above, your code now simply becomes the following:
-
-  ```javascript
-  let promise = Promise.resolve(1);
-
-  promise.then(function(value){
-    // value === 1
-  });
-  ```
-
-  @method resolve
-  @static
-  @param {Any} value value that the returned promise will be resolved with
-  Useful for tooling.
-  @return {Promise} a promise that will become fulfilled with the given
-  `value`
-*/
-function resolve(object) {
-  /*jshint validthis:true */
-  var Constructor = this;
-
-  if (object && typeof object === 'object' && object.constructor === Constructor) {
-    return object;
-  }
-
-  var promise = new Constructor(noop);
-  _resolve(promise, object);
-  return promise;
-}
-
-var PROMISE_ID = Math.random().toString(36).substring(16);
-
-function noop() {}
-
-var PENDING = void 0;
-var FULFILLED = 1;
-var REJECTED = 2;
-
-var GET_THEN_ERROR = new ErrorObject();
-
-function selfFulfillment() {
-  return new TypeError("You cannot resolve a promise with itself");
-}
-
-function cannotReturnOwn() {
-  return new TypeError('A promises callback cannot return that same promise.');
-}
-
-function getThen(promise) {
-  try {
-    return promise.then;
-  } catch (error) {
-    GET_THEN_ERROR.error = error;
-    return GET_THEN_ERROR;
-  }
-}
-
-function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
-  try {
-    then.call(value, fulfillmentHandler, rejectionHandler);
-  } catch (e) {
-    return e;
-  }
-}
-
-function handleForeignThenable(promise, thenable, then) {
-  asap(function (promise) {
-    var sealed = false;
-    var error = tryThen(then, thenable, function (value) {
-      if (sealed) {
-        return;
-      }
-      sealed = true;
-      if (thenable !== value) {
-        _resolve(promise, value);
-      } else {
-        fulfill(promise, value);
-      }
-    }, function (reason) {
-      if (sealed) {
-        return;
-      }
-      sealed = true;
-
-      _reject(promise, reason);
-    }, 'Settle: ' + (promise._label || ' unknown promise'));
-
-    if (!sealed && error) {
-      sealed = true;
-      _reject(promise, error);
-    }
-  }, promise);
-}
-
-function handleOwnThenable(promise, thenable) {
-  if (thenable._state === FULFILLED) {
-    fulfill(promise, thenable._result);
-  } else if (thenable._state === REJECTED) {
-    _reject(promise, thenable._result);
-  } else {
-    subscribe(thenable, undefined, function (value) {
-      return _resolve(promise, value);
-    }, function (reason) {
-      return _reject(promise, reason);
-    });
-  }
-}
-
-function handleMaybeThenable(promise, maybeThenable, then$$) {
-  if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
-    handleOwnThenable(promise, maybeThenable);
-  } else {
-    if (then$$ === GET_THEN_ERROR) {
-      _reject(promise, GET_THEN_ERROR.error);
-    } else if (then$$ === undefined) {
-      fulfill(promise, maybeThenable);
-    } else if (isFunction(then$$)) {
-      handleForeignThenable(promise, maybeThenable, then$$);
-    } else {
-      fulfill(promise, maybeThenable);
-    }
-  }
-}
-
-function _resolve(promise, value) {
-  if (promise === value) {
-    _reject(promise, selfFulfillment());
-  } else if (objectOrFunction(value)) {
-    handleMaybeThenable(promise, value, getThen(value));
-  } else {
-    fulfill(promise, value);
-  }
-}
-
-function publishRejection(promise) {
-  if (promise._onerror) {
-    promise._onerror(promise._result);
-  }
-
-  publish(promise);
-}
-
-function fulfill(promise, value) {
-  if (promise._state !== PENDING) {
-    return;
-  }
-
-  promise._result = value;
-  promise._state = FULFILLED;
-
-  if (promise._subscribers.length !== 0) {
-    asap(publish, promise);
-  }
-}
-
-function _reject(promise, reason) {
-  if (promise._state !== PENDING) {
-    return;
-  }
-  promise._state = REJECTED;
-  promise._result = reason;
-
-  asap(publishRejection, promise);
-}
-
-function subscribe(parent, child, onFulfillment, onRejection) {
-  var _subscribers = parent._subscribers;
-  var length = _subscribers.length;
-
-  parent._onerror = null;
-
-  _subscribers[length] = child;
-  _subscribers[length + FULFILLED] = onFulfillment;
-  _subscribers[length + REJECTED] = onRejection;
-
-  if (length === 0 && parent._state) {
-    asap(publish, parent);
-  }
-}
-
-function publish(promise) {
-  var subscribers = promise._subscribers;
-  var settled = promise._state;
-
-  if (subscribers.length === 0) {
-    return;
-  }
-
-  var child = undefined,
-      callback = undefined,
-      detail = promise._result;
-
-  for (var i = 0; i < subscribers.length; i += 3) {
-    child = subscribers[i];
-    callback = subscribers[i + settled];
-
-    if (child) {
-      invokeCallback(settled, child, callback, detail);
-    } else {
-      callback(detail);
-    }
-  }
-
-  promise._subscribers.length = 0;
-}
-
-function ErrorObject() {
-  this.error = null;
-}
-
-var TRY_CATCH_ERROR = new ErrorObject();
-
-function tryCatch(callback, detail) {
-  try {
-    return callback(detail);
-  } catch (e) {
-    TRY_CATCH_ERROR.error = e;
-    return TRY_CATCH_ERROR;
-  }
-}
-
-function invokeCallback(settled, promise, callback, detail) {
-  var hasCallback = isFunction(callback),
-      value = undefined,
-      error = undefined,
-      succeeded = undefined,
-      failed = undefined;
-
-  if (hasCallback) {
-    value = tryCatch(callback, detail);
-
-    if (value === TRY_CATCH_ERROR) {
-      failed = true;
-      error = value.error;
-      value = null;
-    } else {
-      succeeded = true;
-    }
-
-    if (promise === value) {
-      _reject(promise, cannotReturnOwn());
-      return;
-    }
-  } else {
-    value = detail;
-    succeeded = true;
-  }
-
-  if (promise._state !== PENDING) {
-    // noop
-  } else if (hasCallback && succeeded) {
-      _resolve(promise, value);
-    } else if (failed) {
-      _reject(promise, error);
-    } else if (settled === FULFILLED) {
-      fulfill(promise, value);
-    } else if (settled === REJECTED) {
-      _reject(promise, value);
-    }
-}
-
-function initializePromise(promise, resolver) {
-  try {
-    resolver(function resolvePromise(value) {
-      _resolve(promise, value);
-    }, function rejectPromise(reason) {
-      _reject(promise, reason);
-    });
-  } catch (e) {
-    _reject(promise, e);
-  }
-}
-
-var id = 0;
-function nextId() {
-  return id++;
-}
-
-function makePromise(promise) {
-  promise[PROMISE_ID] = id++;
-  promise._state = undefined;
-  promise._result = undefined;
-  promise._subscribers = [];
-}
-
-function Enumerator(Constructor, input) {
-  this._instanceConstructor = Constructor;
-  this.promise = new Constructor(noop);
-
-  if (!this.promise[PROMISE_ID]) {
-    makePromise(this.promise);
-  }
-
-  if (isArray(input)) {
-    this._input = input;
-    this.length = input.length;
-    this._remaining = input.length;
-
-    this._result = new Array(this.length);
-
-    if (this.length === 0) {
-      fulfill(this.promise, this._result);
-    } else {
-      this.length = this.length || 0;
-      this._enumerate();
-      if (this._remaining === 0) {
-        fulfill(this.promise, this._result);
-      }
-    }
-  } else {
-    _reject(this.promise, validationError());
-  }
-}
-
-function validationError() {
-  return new Error('Array Methods must be provided an Array');
-};
-
-Enumerator.prototype._enumerate = function () {
-  var length = this.length;
-  var _input = this._input;
-
-  for (var i = 0; this._state === PENDING && i < length; i++) {
-    this._eachEntry(_input[i], i);
-  }
-};
-
-Enumerator.prototype._eachEntry = function (entry, i) {
-  var c = this._instanceConstructor;
-  var resolve$$ = c.resolve;
-
-  if (resolve$$ === resolve) {
-    var _then = getThen(entry);
-
-    if (_then === then && entry._state !== PENDING) {
-      this._settledAt(entry._state, i, entry._result);
-    } else if (typeof _then !== 'function') {
-      this._remaining--;
-      this._result[i] = entry;
-    } else if (c === Promise) {
-      var promise = new c(noop);
-      handleMaybeThenable(promise, entry, _then);
-      this._willSettleAt(promise, i);
-    } else {
-      this._willSettleAt(new c(function (resolve$$) {
-        return resolve$$(entry);
-      }), i);
-    }
-  } else {
-    this._willSettleAt(resolve$$(entry), i);
-  }
-};
-
-Enumerator.prototype._settledAt = function (state, i, value) {
-  var promise = this.promise;
-
-  if (promise._state === PENDING) {
-    this._remaining--;
-
-    if (state === REJECTED) {
-      _reject(promise, value);
-    } else {
-      this._result[i] = value;
-    }
-  }
-
-  if (this._remaining === 0) {
-    fulfill(promise, this._result);
-  }
-};
-
-Enumerator.prototype._willSettleAt = function (promise, i) {
-  var enumerator = this;
-
-  subscribe(promise, undefined, function (value) {
-    return enumerator._settledAt(FULFILLED, i, value);
-  }, function (reason) {
-    return enumerator._settledAt(REJECTED, i, reason);
-  });
-};
-
-/**
-  `Promise.all` accepts an array of promises, and returns a new promise which
-  is fulfilled with an array of fulfillment values for the passed promises, or
-  rejected with the reason of the first passed promise to be rejected. It casts all
-  elements of the passed iterable to promises as it runs this algorithm.
-
-  Example:
-
-  ```javascript
-  let promise1 = resolve(1);
-  let promise2 = resolve(2);
-  let promise3 = resolve(3);
-  let promises = [ promise1, promise2, promise3 ];
-
-  Promise.all(promises).then(function(array){
-    // The array here would be [ 1, 2, 3 ];
-  });
-  ```
-
-  If any of the `promises` given to `all` are rejected, the first promise
-  that is rejected will be given as an argument to the returned promises's
-  rejection handler. For example:
-
-  Example:
-
-  ```javascript
-  let promise1 = resolve(1);
-  let promise2 = reject(new Error("2"));
-  let promise3 = reject(new Error("3"));
-  let promises = [ promise1, promise2, promise3 ];
-
-  Promise.all(promises).then(function(array){
-    // Code here never runs because there are rejected promises!
-  }, function(error) {
-    // error.message === "2"
-  });
-  ```
-
-  @method all
-  @static
-  @param {Array} entries array of promises
-  @param {String} label optional string for labeling the promise.
-  Useful for tooling.
-  @return {Promise} promise that is fulfilled when all `promises` have been
-  fulfilled, or rejected if any of them become rejected.
-  @static
-*/
-function all(entries) {
-  return new Enumerator(this, entries).promise;
-}
-
-/**
-  `Promise.race` returns a new promise which is settled in the same way as the
-  first passed promise to settle.
-
-  Example:
-
-  ```javascript
-  let promise1 = new Promise(function(resolve, reject){
-    setTimeout(function(){
-      resolve('promise 1');
-    }, 200);
-  });
-
-  let promise2 = new Promise(function(resolve, reject){
-    setTimeout(function(){
-      resolve('promise 2');
-    }, 100);
-  });
-
-  Promise.race([promise1, promise2]).then(function(result){
-    // result === 'promise 2' because it was resolved before promise1
-    // was resolved.
-  });
-  ```
-
-  `Promise.race` is deterministic in that only the state of the first
-  settled promise matters. For example, even if other promises given to the
-  `promises` array argument are resolved, but the first settled promise has
-  become rejected before the other promises became fulfilled, the returned
-  promise will become rejected:
-
-  ```javascript
-  let promise1 = new Promise(function(resolve, reject){
-    setTimeout(function(){
-      resolve('promise 1');
-    }, 200);
-  });
-
-  let promise2 = new Promise(function(resolve, reject){
-    setTimeout(function(){
-      reject(new Error('promise 2'));
-    }, 100);
-  });
-
-  Promise.race([promise1, promise2]).then(function(result){
-    // Code here never runs
-  }, function(reason){
-    // reason.message === 'promise 2' because promise 2 became rejected before
-    // promise 1 became fulfilled
-  });
-  ```
-
-  An example real-world use case is implementing timeouts:
-
-  ```javascript
-  Promise.race([ajax('foo.json'), timeout(5000)])
-  ```
-
-  @method race
-  @static
-  @param {Array} promises array of promises to observe
-  Useful for tooling.
-  @return {Promise} a promise which settles in the same way as the first passed
-  promise to settle.
-*/
-function race(entries) {
-  /*jshint validthis:true */
-  var Constructor = this;
-
-  if (!isArray(entries)) {
-    return new Constructor(function (_, reject) {
-      return reject(new TypeError('You must pass an array to race.'));
-    });
-  } else {
-    return new Constructor(function (resolve, reject) {
-      var length = entries.length;
-      for (var i = 0; i < length; i++) {
-        Constructor.resolve(entries[i]).then(resolve, reject);
-      }
-    });
-  }
-}
-
-/**
-  `Promise.reject` returns a promise rejected with the passed `reason`.
-  It is shorthand for the following:
-
-  ```javascript
-  let promise = new Promise(function(resolve, reject){
-    reject(new Error('WHOOPS'));
-  });
-
-  promise.then(function(value){
-    // Code here doesn't run because the promise is rejected!
-  }, function(reason){
-    // reason.message === 'WHOOPS'
-  });
-  ```
-
-  Instead of writing the above, your code now simply becomes the following:
-
-  ```javascript
-  let promise = Promise.reject(new Error('WHOOPS'));
-
-  promise.then(function(value){
-    // Code here doesn't run because the promise is rejected!
-  }, function(reason){
-    // reason.message === 'WHOOPS'
-  });
-  ```
-
-  @method reject
-  @static
-  @param {Any} reason value that the returned promise will be rejected with.
-  Useful for tooling.
-  @return {Promise} a promise rejected with the given `reason`.
-*/
-function reject(reason) {
-  /*jshint validthis:true */
-  var Constructor = this;
-  var promise = new Constructor(noop);
-  _reject(promise, reason);
-  return promise;
-}
-
-function needsResolver() {
-  throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
-}
-
-function needsNew() {
-  throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
-}
-
-/**
-  Promise objects represent the eventual result of an asynchronous operation. The
-  primary way of interacting with a promise is through its `then` method, which
-  registers callbacks to receive either a promise's eventual value or the reason
-  why the promise cannot be fulfilled.
-
-  Terminology
-  -----------
-
-  - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
-  - `thenable` is an object or function that defines a `then` method.
-  - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
-  - `exception` is a value that is thrown using the throw statement.
-  - `reason` is a value that indicates why a promise was rejected.
-  - `settled` the final resting state of a promise, fulfilled or rejected.
-
-  A promise can be in one of three states: pending, fulfilled, or rejected.
-
-  Promises that are fulfilled have a fulfillment value and are in the fulfilled
-  state.  Promises that are rejected have a rejection reason and are in the
-  rejected state.  A fulfillment value is never a thenable.
-
-  Promises can also be said to *resolve* a value.  If this value is also a
-  promise, then the original promise's settled state will match the value's
-  settled state.  So a promise that *resolves* a promise that rejects will
-  itself reject, and a promise that *resolves* a promise that fulfills will
-  itself fulfill.
-
-
-  Basic Usage:
-  ------------
-
-  ```js
-  let promise = new Promise(function(resolve, reject) {
-    // on success
-    resolve(value);
-
-    // on failure
-    reject(reason);
-  });
-
-  promise.then(function(value) {
-    // on fulfillment
-  }, function(reason) {
-    // on rejection
-  });
-  ```
-
-  Advanced Usage:
-  ---------------
-
-  Promises shine when abstracting away asynchronous interactions such as
-  `XMLHttpRequest`s.
-
-  ```js
-  function getJSON(url) {
-    return new Promise(function(resolve, reject){
-      let xhr = new XMLHttpRequest();
-
-      xhr.open('GET', url);
-      xhr.onreadystatechange = handler;
-      xhr.responseType = 'json';
-      xhr.setRequestHeader('Accept', 'application/json');
-      xhr.send();
-
-      function handler() {
-        if (this.readyState === this.DONE) {
-          if (this.status === 200) {
-            resolve(this.response);
-          } else {
-            reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
-          }
-        }
-      };
-    });
-  }
-
-  getJSON('/posts.json').then(function(json) {
-    // on fulfillment
-  }, function(reason) {
-    // on rejection
-  });
-  ```
-
-  Unlike callbacks, promises are great composable primitives.
-
-  ```js
-  Promise.all([
-    getJSON('/posts'),
-    getJSON('/comments')
-  ]).then(function(values){
-    values[0] // => postsJSON
-    values[1] // => commentsJSON
-
-    return values;
-  });
-  ```
-
-  @class Promise
-  @param {function} resolver
-  Useful for tooling.
-  @constructor
-*/
-function Promise(resolver) {
-  this[PROMISE_ID] = nextId();
-  this._result = this._state = undefined;
-  this._subscribers = [];
-
-  if (noop !== resolver) {
-    typeof resolver !== 'function' && needsResolver();
-    this instanceof Promise ? initializePromise(this, resolver) : needsNew();
-  }
-}
-
-Promise.all = all;
-Promise.race = race;
-Promise.resolve = resolve;
-Promise.reject = reject;
-Promise._setScheduler = setScheduler;
-Promise._setAsap = setAsap;
-Promise._asap = asap;
-
-Promise.prototype = {
-  constructor: Promise,
-
-  /**
-    The primary way of interacting with a promise is through its `then` method,
-    which registers callbacks to receive either a promise's eventual value or the
-    reason why the promise cannot be fulfilled.
-  
-    ```js
-    findUser().then(function(user){
-      // user is available
-    }, function(reason){
-      // user is unavailable, and you are given the reason why
-    });
-    ```
-  
-    Chaining
-    --------
-  
-    The return value of `then` is itself a promise.  This second, 'downstream'
-    promise is resolved with the return value of the first promise's fulfillment
-    or rejection handler, or rejected if the handler throws an exception.
-  
-    ```js
-    findUser().then(function (user) {
-      return user.name;
-    }, function (reason) {
-      return 'default name';
-    }).then(function (userName) {
-      // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
-      // will be `'default name'`
-    });
-  
-    findUser().then(function (user) {
-      throw new Error('Found user, but still unhappy');
-    }, function (reason) {
-      throw new Error('`findUser` rejected and we're unhappy');
-    }).then(function (value) {
-      // never reached
-    }, function (reason) {
-      // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
-      // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
-    });
-    ```
-    If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
-  
-    ```js
-    findUser().then(function (user) {
-      throw new PedagogicalException('Upstream error');
-    }).then(function (value) {
-      // never reached
-    }).then(function (value) {
-      // never reached
-    }, function (reason) {
-      // The `PedgagocialException` is propagated all the way down to here
-    });
-    ```
-  
-    Assimilation
-    ------------
-  
-    Sometimes the value you want to propagate to a downstream promise can only be
-    retrieved asynchronously. This can be achieved by returning a promise in the
-    fulfillment or rejection handler. The downstream promise will then be pending
-    until the returned promise is settled. This is called *assimilation*.
-  
-    ```js
-    findUser().then(function (user) {
-      return findCommentsByAuthor(user);
-    }).then(function (comments) {
-      // The user's comments are now available
-    });
-    ```
-  
-    If the assimliated promise rejects, then the downstream promise will also reject.
-  
-    ```js
-    findUser().then(function (user) {
-      return findCommentsByAuthor(user);
-    }).then(function (comments) {
-      // If `findCommentsByAuthor` fulfills, we'll have the value here
-    }, function (reason) {
-      // If `findCommentsByAuthor` rejects, we'll have the reason here
-    });
-    ```
-  
-    Simple Example
-    --------------
-  
-    Synchronous Example
-  
-    ```javascript
-    let result;
-  
-    try {
-      result = findResult();
-      // success
-    } catch(reason) {
-      // failure
-    }
-    ```
-  
-    Errback Example
-  
-    ```js
-    findResult(function(result, err){
-      if (err) {
-        // failure
-      } else {
-        // success
-      }
-    });
-    ```
-  
-    Promise Example;
-  
-    ```javascript
-    findResult().then(function(result){
-      // success
-    }, function(reason){
-      // failure
-    });
-    ```
-  
-    Advanced Example
-    --------------
-  
-    Synchronous Example
-  
-    ```javascript
-    let author, books;
-  
-    try {
-      author = findAuthor();
-      books  = findBooksByAuthor(author);
-      // success
-    } catch(reason) {
-      // failure
-    }
-    ```
-  
-    Errback Example
-  
-    ```js
-  
-    function foundBooks(books) {
-  
-    }
-  
-    function failure(reason) {
-  
-    }
-  
-    findAuthor(function(author, err){
-      if (err) {
-        failure(err);
-        // failure
-      } else {
-        try {
-          findBoooksByAuthor(author, function(books, err) {
-            if (err) {
-              failure(err);
-            } else {
-              try {
-                foundBooks(books);
-              } catch(reason) {
-                failure(reason);
-              }
-            }
-          });
-        } catch(error) {
-          failure(err);
-        }
-        // success
-      }
-    });
-    ```
-  
-    Promise Example;
-  
-    ```javascript
-    findAuthor().
-      then(findBooksByAuthor).
-      then(function(books){
-        // found books
-    }).catch(function(reason){
-      // something went wrong
-    });
-    ```
-  
-    @method then
-    @param {Function} onFulfilled
-    @param {Function} onRejected
-    Useful for tooling.
-    @return {Promise}
-  */
-  then: then,
-
-  /**
-    `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
-    as the catch block of a try/catch statement.
-  
-    ```js
-    function findAuthor(){
-      throw new Error('couldn't find that author');
-    }
-  
-    // synchronous
-    try {
-      findAuthor();
-    } catch(reason) {
-      // something went wrong
-    }
-  
-    // async with promises
-    findAuthor().catch(function(reason){
-      // something went wrong
-    });
-    ```
-  
-    @method catch
-    @param {Function} onRejection
-    Useful for tooling.
-    @return {Promise}
-  */
-  'catch': function _catch(onRejection) {
-    return this.then(null, onRejection);
-  }
-};
-
-function polyfill() {
-    var local = undefined;
-
-    if (typeof global !== 'undefined') {
-        local = global;
-    } else if (typeof self !== 'undefined') {
-        local = self;
-    } else {
-        try {
-            local = Function('return this')();
-        } catch (e) {
-            throw new Error('polyfill failed because global object is unavailable in this environment');
-        }
-    }
-
-    var P = local.Promise;
-
-    if (P) {
-        var promiseToString = null;
-        try {
-            promiseToString = Object.prototype.toString.call(P.resolve());
-        } catch (e) {
-            // silently ignored
-        }
-
-        if (promiseToString === '[object Promise]' && !P.cast) {
-            return;
-        }
-    }
-
-    local.Promise = Promise;
-}
-
-// Strange compat..
-Promise.polyfill = polyfill;
-Promise.Promise = Promise;
-
-return Promise;
-
-})));
-
-ES6Promise.polyfill();
-//# sourceMappingURL=es6-promise.auto.map

+ 0 - 9192
src/js/lib/jquery-2.1.1.js

@@ -1,9192 +0,0 @@
-/** @license
-========================================================================
-  jQuery JavaScript Library v2.1.1
-  http://jquery.com/
- 
-  Includes Sizzle.js
-  http://sizzlejs.com/
- 
-  Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
-  Released under the MIT license
-  http://jquery.org/license
- 
-  Date: 2014-05-01T17:11Z
-*/
-"use strict";
-
-(function( global, factory ) {
-
-	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 inherently posses a window with a document
-		// (such as Node.js), expose a jQuery-making 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 ) {
-
-// Can't do this because several apps including ASP.NET trace
-// the stack via arguments.caller.callee and Firefox dies if
-// you try to trace through "use strict" call chains. (#13335)
-// Support: Firefox 18+
-//
-
-var arr = [];
-
-var slice = arr.slice;
-
-var concat = arr.concat;
-
-var push = arr.push;
-
-var indexOf = arr.indexOf;
-
-var class2type = {};
-
-var toString = class2type.toString;
-
-var hasOwn = class2type.hasOwnProperty;
-
-var support = {};
-
-
-
-var
-	// Use the correct document accordingly with window argument (sandbox)
-	document = window.document,
-
-	version = "2.1.1",
-
-	// 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 );
-	},
-
-	// Support: Android<4.1
-	// Make sure we trim BOM and NBSP
-	rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
-
-	// Matches dashed string for camelizing
-	rmsPrefix = /^-ms-/,
-	rdashAlpha = /-([\da-z])/gi,
-
-	// Used by jQuery.camelCase as callback to replace()
-	fcamelCase = function( all, letter ) {
-		return letter.toUpperCase();
-	};
-
-jQuery.fn = jQuery.prototype = {
-	// The current version of jQuery being used
-	jquery: version,
-
-	constructor: jQuery,
-
-	// Start with an empty selector
-	selector: "",
-
-	// 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 num != null ?
-
-			// Return just the one element from the set
-			( num < 0 ? this[ num + this.length ] : this[ num ] ) :
-
-			// Return all the elements in a clean array
-			slice.call( this );
-	},
-
-	// 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;
-		ret.context = this.context;
-
-		// Return the newly-formed element set
-		return ret;
-	},
-
-	// Execute a callback for every element in the matched set.
-	// (You can seed the arguments with an array of args, but this is
-	// only used internally.)
-	each: function( callback, args ) {
-		return jQuery.each( this, callback, args );
-	},
-
-	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 );
-	},
-
-	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(null);
-	},
-
-	// 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" && !jQuery.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 ) {
-				src = target[ name ];
-				copy = options[ name ];
-
-				// Prevent never-ending loop
-				if ( target === copy ) {
-					continue;
-				}
-
-				// Recurse if we're merging plain objects or arrays
-				if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
-					if ( copyIsArray ) {
-						copyIsArray = false;
-						clone = src && jQuery.isArray(src) ? src : [];
-
-					} else {
-						clone = src && jQuery.isPlainObject(src) ? src : {};
-					}
-
-					// 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() {},
-
-	// See test/unit/core.js for details concerning isFunction.
-	// Since version 1.3, DOM methods and functions like alert
-	// aren't supported. They return false on IE (#2968).
-	isFunction: function( obj ) {
-		return jQuery.type(obj) === "function";
-	},
-
-	isArray: Array.isArray,
-
-	isWindow: function( obj ) {
-		return obj != null && obj === obj.window;
-	},
-
-	isNumeric: function( obj ) {
-		// parseFloat NaNs numeric-cast false positives (null|true|false|"")
-		// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
-		// subtraction forces infinities to NaN
-		return !jQuery.isArray( obj ) && obj - parseFloat( obj ) >= 0;
-	},
-
-	isPlainObject: function( obj ) {
-		// Not plain objects:
-		// - Any object or value whose internal [[Class]] property is not "[object Object]"
-		// - DOM nodes
-		// - window
-		if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
-			return false;
-		}
-
-		if ( obj.constructor &&
-				!hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
-			return false;
-		}
-
-		// If the function hasn't returned already, we're confident that
-		// |obj| is a plain object, created by {} or constructed with new Object
-		return true;
-	},
-
-	isEmptyObject: function( obj ) {
-		var name;
-		for ( name in obj ) {
-			return false;
-		}
-		return true;
-	},
-
-	type: function( obj ) {
-		if ( obj == null ) {
-			return obj + "";
-		}
-		// Support: Android < 4.0, iOS < 6 (functionish RegExp)
-		return typeof obj === "object" || typeof obj === "function" ?
-			class2type[ toString.call(obj) ] || "object" :
-			typeof obj;
-	},
-
-	// Evaluates a script in a global context
-	globalEval: function( code ) {
-		var script,
-			indirect = eval;
-
-		code = jQuery.trim( code );
-
-		if ( code ) {
-			// If the code includes a valid, prologue position
-			// strict mode pragma, execute code by injecting a
-			// script tag into the document.
-			if ( code.indexOf("use strict") === 1 ) {
-				script = document.createElement("script");
-				script.text = code;
-				document.head.appendChild( script ).parentNode.removeChild( script );
-			} else {
-			// Otherwise, avoid the DOM node creation, insertion
-			// and removal by using an indirect global eval
-				indirect( code );
-			}
-		}
-	},
-
-	// Convert dashed to camelCase; used by the css and data modules
-	// Microsoft forgot to hump their vendor prefix (#9572)
-	camelCase: function( string ) {
-		return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
-	},
-
-	nodeName: function( elem, name ) {
-		return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
-	},
-
-	// args is for internal usage only
-	each: function( obj, callback, args ) {
-		var value,
-			i = 0,
-			length = obj.length,
-			isArray = isArraylike( obj );
-
-		if ( args ) {
-			if ( isArray ) {
-				for ( ; i < length; i++ ) {
-					value = callback.apply( obj[ i ], args );
-
-					if ( value === false ) {
-						break;
-					}
-				}
-			} else {
-				for ( i in obj ) {
-					value = callback.apply( obj[ i ], args );
-
-					if ( value === false ) {
-						break;
-					}
-				}
-			}
-
-		// A special, fast, case for the most common use of each
-		} else {
-			if ( isArray ) {
-				for ( ; i < length; i++ ) {
-					value = callback.call( obj[ i ], i, obj[ i ] );
-
-					if ( value === false ) {
-						break;
-					}
-				}
-			} else {
-				for ( i in obj ) {
-					value = callback.call( obj[ i ], i, obj[ i ] );
-
-					if ( value === false ) {
-						break;
-					}
-				}
-			}
-		}
-
-		return obj;
-	},
-
-	// Support: Android<4.1
-	trim: function( text ) {
-		return text == null ?
-			"" :
-			( text + "" ).replace( rtrim, "" );
-	},
-
-	// 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 );
-	},
-
-	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 value,
-			i = 0,
-			length = elems.length,
-			isArray = isArraylike( elems ),
-			ret = [];
-
-		// Go through the array, translating each of the items to their new values
-		if ( isArray ) {
-			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 concat.apply( [], ret );
-	},
-
-	// A global GUID counter for objects
-	guid: 1,
-
-	// Bind a function to a context, optionally partially applying any
-	// arguments.
-	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 ( !jQuery.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;
-	},
-
-	now: Date.now,
-
-	// jQuery.support is not used in Core but other projects attach their
-	// properties to it so it needs to exist.
-	support: support
-});
-
-// Populate the class2type map
-jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
-	class2type[ "[object " + name + "]" ] = name.toLowerCase();
-});
-
-function isArraylike( obj ) {
-	var length = obj.length,
-		type = jQuery.type( obj );
-
-	if ( type === "function" || jQuery.isWindow( obj ) ) {
-		return false;
-	}
-
-	if ( obj.nodeType === 1 && length ) {
-		return true;
-	}
-
-	return type === "array" || length === 0 ||
-		typeof length === "number" && length > 0 && ( length - 1 ) in obj;
-}
-var Sizzle =
-/*!
- * Sizzle CSS Selector Engine v1.10.19
- * http://sizzlejs.com/
- *
- * Copyright 2013 jQuery Foundation, Inc. and other contributors
- * Released under the MIT license
- * http://jquery.org/license
- *
- * Date: 2014-04-18
- */
-(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" + -(new Date()),
-	preferredDoc = window.document,
-	dirruns = 0,
-	done = 0,
-	classCache = createCache(),
-	tokenCache = createCache(),
-	compilerCache = createCache(),
-	sortOrder = function( a, b ) {
-		if ( a === b ) {
-			hasDuplicate = true;
-		}
-		return 0;
-	},
-
-	// General-purpose constants
-	strundefined = typeof undefined,
-	MAX_NEGATIVE = 1 << 31,
-
-	// Instance methods
-	hasOwn = ({}).hasOwnProperty,
-	arr = [],
-	pop = arr.pop,
-	push_native = arr.push,
-	push = arr.push,
-	slice = arr.slice,
-	// Use a stripped-down indexOf if we can't use a native one
-	indexOf = arr.indexOf || function( elem ) {
-		var i = 0,
-			len = this.length;
-		for ( ; i < len; i++ ) {
-			if ( this[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
-
-	// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
-	whitespace = "[\\x20\\t\\r\\n\\f]",
-	// http://www.w3.org/TR/css3-syntax/#characters
-	characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
-
-	// Loosely modeled on CSS identifier characters
-	// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
-	// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
-	identifier = characterEncoding.replace( "w", "w#" ),
-
-	// Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
-	attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
-		// Operator (capture 2)
-		"*([*^$|!~]?=)" + whitespace +
-		// "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
-		"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
-		"*\\]",
-
-	pseudos = ":(" + characterEncoding + ")(?:\\((" +
-		// 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
-	rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
-
-	rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
-	rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
-
-	rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
-
-	rpseudo = new RegExp( pseudos ),
-	ridentifier = new RegExp( "^" + identifier + "$" ),
-
-	matchExpr = {
-		"ID": new RegExp( "^#(" + characterEncoding + ")" ),
-		"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
-		"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
-		"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" )
-	},
-
-	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 = /[+~]/,
-	rescape = /'|\\/g,
-
-	// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
-	runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
-	funescape = function( _, escaped, escapedWhitespace ) {
-		var high = "0x" + escaped - 0x10000;
-		// NaN means non-codepoint
-		// Support: Firefox<24
-		// Workaround erroneous numeric interpretation of +"0x"
-		return high !== high || escapedWhitespace ?
-			escaped :
-			high < 0 ?
-				// BMP codepoint
-				String.fromCharCode( high + 0x10000 ) :
-				// Supplemental Plane codepoint (surrogate pair)
-				String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
-	};
-
-// Optimize for push.apply( _, NodeList )
-try {
-	push.apply(
-		(arr = slice.call( preferredDoc.childNodes )),
-		preferredDoc.childNodes
-	);
-	// Support: Android<4.0
-	// Detect silently failing push.apply
-	arr[ preferredDoc.childNodes.length ].nodeType;
-} catch ( e ) {
-	push = { apply: arr.length ?
-
-		// Leverage slice if possible
-		function( target, els ) {
-			push_native.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 match, elem, m, nodeType,
-		// QSA vars
-		i, groups, old, nid, newContext, newSelector;
-
-	if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
-		setDocument( context );
-	}
-
-	context = context || document;
-	results = results || [];
-
-	if ( !selector || typeof selector !== "string" ) {
-		return results;
-	}
-
-	if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
-		return [];
-	}
-
-	if ( documentIsHTML && !seed ) {
-
-		// Shortcuts
-		if ( (match = rquickExpr.exec( selector )) ) {
-			// Speed-up: Sizzle("#ID")
-			if ( (m = match[1]) ) {
-				if ( nodeType === 9 ) {
-					elem = context.getElementById( m );
-					// Check parentNode to catch when Blackberry 4.6 returns
-					// nodes that are no longer in the document (jQuery #6963)
-					if ( elem && elem.parentNode ) {
-						// Handle the case where IE, Opera, and Webkit return items
-						// by name instead of ID
-						if ( elem.id === m ) {
-							results.push( elem );
-							return results;
-						}
-					} else {
-						return results;
-					}
-				} else {
-					// Context is not a document
-					if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
-						contains( context, elem ) && elem.id === m ) {
-						results.push( elem );
-						return results;
-					}
-				}
-
-			// Speed-up: Sizzle("TAG")
-			} else if ( match[2] ) {
-				push.apply( results, context.getElementsByTagName( selector ) );
-				return results;
-
-			// Speed-up: Sizzle(".CLASS")
-			} else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
-				push.apply( results, context.getElementsByClassName( m ) );
-				return results;
-			}
-		}
-
-		// QSA path
-		if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
-			nid = old = expando;
-			newContext = context;
-			newSelector = nodeType === 9 && selector;
-
-			// qSA works strangely on Element-rooted queries
-			// We can work around this by specifying an extra ID on the root
-			// and working up from there (Thanks to Andrew Dupont for the technique)
-			// IE 8 doesn't work on object elements
-			if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
-				groups = tokenize( selector );
-
-				if ( (old = context.getAttribute("id")) ) {
-					nid = old.replace( rescape, "\\$&" );
-				} else {
-					context.setAttribute( "id", nid );
-				}
-				nid = "[id='" + nid + "'] ";
-
-				i = groups.length;
-				while ( i-- ) {
-					groups[i] = nid + toSelector( groups[i] );
-				}
-				newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
-				newSelector = groups.join(",");
-			}
-
-			if ( newSelector ) {
-				try {
-					push.apply( results,
-						newContext.querySelectorAll( newSelector )
-					);
-					return results;
-				} catch(qsaError) {
-				} finally {
-					if ( !old ) {
-						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 div and expects a boolean result
- */
-function assert( fn ) {
-	var div = document.createElement("div");
-
-	try {
-		return !!fn( div );
-	} catch (e) {
-		return false;
-	} finally {
-		// Remove from its parent by default
-		if ( div.parentNode ) {
-			div.parentNode.removeChild( div );
-		}
-		// release memory in IE
-		div = 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 = attrs.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 &&
-			( ~b.sourceIndex || MAX_NEGATIVE ) -
-			( ~a.sourceIndex || MAX_NEGATIVE );
-
-	// 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 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 !== strundefined && 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 ) {
-	// documentElement is verified for cases where it doesn't yet exist
-	// (such as loading iframes in IE - #4833)
-	var documentElement = elem && (elem.ownerDocument || elem).documentElement;
-	return documentElement ? documentElement.nodeName !== "HTML" : false;
-};
-
-/**
- * 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,
-		doc = node ? node.ownerDocument || node : preferredDoc,
-		parent = doc.defaultView;
-
-	// If no document and documentElement is available, return
-	if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
-		return document;
-	}
-
-	// Set our document
-	document = doc;
-	docElem = doc.documentElement;
-
-	// Support tests
-	documentIsHTML = !isXML( doc );
-
-	// Support: IE>8
-	// If iframe document is assigned to "document" variable and if iframe has been reloaded,
-	// IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
-	// IE6-8 do not support the defaultView property so parent will be undefined
-	if ( parent && parent !== parent.top ) {
-		// IE11 does not have attachEvent, so all must suffer
-		if ( parent.addEventListener ) {
-			parent.addEventListener( "unload", function() {
-				setDocument();
-			}, false );
-		} else if ( parent.attachEvent ) {
-			parent.attachEvent( "onunload", function() {
-				setDocument();
-			});
-		}
-	}
-
-	/* Attributes
-	---------------------------------------------------------------------- */
-
-	// Support: IE<8
-	// Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
-	support.attributes = assert(function( div ) {
-		div.className = "i";
-		return !div.getAttribute("className");
-	});
-
-	/* getElement(s)By*
-	---------------------------------------------------------------------- */
-
-	// Check if getElementsByTagName("*") returns only elements
-	support.getElementsByTagName = assert(function( div ) {
-		div.appendChild( doc.createComment("") );
-		return !div.getElementsByTagName("*").length;
-	});
-
-	// Check if getElementsByClassName can be trusted
-	support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) {
-		div.innerHTML = "<div class='a'></div><div class='a i'></div>";
-
-		// Support: Safari<4
-		// Catch class over-caching
-		div.firstChild.className = "i";
-		// Support: Opera<10
-		// Catch gEBCN failure to find non-leading classes
-		return div.getElementsByClassName("i").length === 2;
-	});
-
-	// Support: IE<10
-	// Check if getElementById returns elements by name
-	// The broken getElementById methods don't pick up programatically-set names,
-	// so use a roundabout getElementsByName test
-	support.getById = assert(function( div ) {
-		docElem.appendChild( div ).id = expando;
-		return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
-	});
-
-	// ID find and filter
-	if ( support.getById ) {
-		Expr.find["ID"] = function( id, context ) {
-			if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
-				var m = context.getElementById( id );
-				// Check parentNode to catch when Blackberry 4.6 returns
-				// nodes that are no longer in the document #6963
-				return m && m.parentNode ? [ m ] : [];
-			}
-		};
-		Expr.filter["ID"] = function( id ) {
-			var attrId = id.replace( runescape, funescape );
-			return function( elem ) {
-				return elem.getAttribute("id") === attrId;
-			};
-		};
-	} else {
-		// Support: IE6/7
-		// getElementById is not reliable as a find shortcut
-		delete Expr.find["ID"];
-
-		Expr.filter["ID"] =  function( id ) {
-			var attrId = id.replace( runescape, funescape );
-			return function( elem ) {
-				var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
-				return node && node.value === attrId;
-			};
-		};
-	}
-
-	// Tag
-	Expr.find["TAG"] = support.getElementsByTagName ?
-		function( tag, context ) {
-			if ( typeof context.getElementsByTagName !== strundefined ) {
-				return context.getElementsByTagName( tag );
-			}
-		} :
-		function( tag, context ) {
-			var elem,
-				tmp = [],
-				i = 0,
-				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 !== strundefined && 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 http://bugs.jquery.com/ticket/13378
-	rbuggyQSA = [];
-
-	if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
-		// Build QSA regex
-		// Regex strategy adopted from Diego Perini
-		assert(function( div ) {
-			// 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
-			// http://bugs.jquery.com/ticket/12359
-			div.innerHTML = "<select msallowclip=''><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
-			// http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
-			if ( div.querySelectorAll("[msallowclip^='']").length ) {
-				rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
-			}
-
-			// Support: IE8
-			// Boolean attributes and "value" are not treated correctly
-			if ( !div.querySelectorAll("[selected]").length ) {
-				rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
-			}
-
-			// 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 ( !div.querySelectorAll(":checked").length ) {
-				rbuggyQSA.push(":checked");
-			}
-		});
-
-		assert(function( div ) {
-			// Support: Windows 8 Native Apps
-			// The type and name attributes are restricted during .innerHTML assignment
-			var input = doc.createElement("input");
-			input.setAttribute( "type", "hidden" );
-			div.appendChild( input ).setAttribute( "name", "D" );
-
-			// Support: IE8
-			// Enforce case-sensitivity of name attribute
-			if ( div.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 ( !div.querySelectorAll(":enabled").length ) {
-				rbuggyQSA.push( ":enabled", ":disabled" );
-			}
-
-			// Opera 10-11 does not throw on post-comma invalid pseudos
-			div.querySelectorAll("*,:x");
-			rbuggyQSA.push(",.*:");
-		});
-	}
-
-	if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
-		docElem.webkitMatchesSelector ||
-		docElem.mozMatchesSelector ||
-		docElem.oMatchesSelector ||
-		docElem.msMatchesSelector) )) ) {
-
-		assert(function( div ) {
-			// Check to see if it's possible to do matchesSelector
-			// on a disconnected node (IE 9)
-			support.disconnectedMatch = matches.call( div, "div" );
-
-			// This should fail with an exception
-			// Gecko does not error, returns false instead
-			matches.call( div, "[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 does not implement inclusive descendent
-	// 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
-		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
-			if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
-				return -1;
-			}
-			if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
-				return 1;
-			}
-
-			// Maintain original order
-			return sortInput ?
-				( indexOf.call( sortInput, a ) - indexOf.call( 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 ) {
-			return a === doc ? -1 :
-				b === doc ? 1 :
-				aup ? -1 :
-				bup ? 1 :
-				sortInput ?
-				( indexOf.call( sortInput, a ) - indexOf.call( 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
-			ap[i] === preferredDoc ? -1 :
-			bp[i] === preferredDoc ? 1 :
-			0;
-	};
-
-	return doc;
-};
-
-Sizzle.matches = function( expr, elements ) {
-	return Sizzle( expr, null, null, elements );
-};
-
-Sizzle.matchesSelector = function( elem, expr ) {
-	// Set document vars if needed
-	if ( ( elem.ownerDocument || elem ) !== document ) {
-		setDocument( elem );
-	}
-
-	// Make sure that attribute selectors are quoted
-	expr = expr.replace( rattributeQuotes, "='$1']" );
-
-	if ( support.matchesSelector && documentIsHTML &&
-		( !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) {}
-	}
-
-	return Sizzle( expr, document, null, [ elem ] ).length > 0;
-};
-
-Sizzle.contains = function( context, elem ) {
-	// Set document vars if needed
-	if ( ( context.ownerDocument || context ) !== document ) {
-		setDocument( context );
-	}
-	return contains( context, elem );
-};
-
-Sizzle.attr = function( elem, name ) {
-	// Set document vars if needed
-	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.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 !== strundefined && 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 += "";
-
-				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 + " " ).indexOf( check ) > -1 :
-					operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
-					false;
-			};
-		},
-
-		"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, outerCache, node, diff, nodeIndex, start,
-						dir = simple !== forward ? "nextSibling" : "previousSibling",
-						parent = elem.parentNode,
-						name = ofType && elem.nodeName.toLowerCase(),
-						useCache = !xml && !ofType;
-
-					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
-							outerCache = parent[ expando ] || (parent[ expando ] = {});
-							cache = outerCache[ type ] || [];
-							nodeIndex = cache[0] === dirruns && cache[1];
-							diff = cache[0] === dirruns && 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 ) {
-									outerCache[ type ] = [ dirruns, nodeIndex, diff ];
-									break;
-								}
-							}
-
-						// Use previously-cached element index if available
-						} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
-							diff = cache[1];
-
-						// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
-						} else {
-							// 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 ) {
-										(node[ expando ] || (node[ expando ] = {}))[ 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.call( 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 );
-					return !results.pop();
-				};
-		}),
-
-		"has": markFunction(function( selector ) {
-			return function( elem ) {
-				return Sizzle( selector, elem ).length > 0;
-			};
-		}),
-
-		"contains": markFunction(function( text ) {
-			return function( elem ) {
-				return ( elem.textContent || elem.innerText || 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": function( elem ) {
-			return elem.disabled === false;
-		},
-
-		"disabled": function( elem ) {
-			return elem.disabled === 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 ) {
-				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;
-			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,
-		checkNonElements = base && dir === "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 );
-				}
-			}
-		} :
-
-		// Check against all ancestor/preceding elements
-		function( elem, context, xml ) {
-			var oldCache, outerCache,
-				newCache = [ dirruns, doneName ];
-
-			// We can't set arbitrary data on XML nodes, so they don't benefit from dir 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 ] = {});
-						if ( (oldCache = outerCache[ dir ]) &&
-							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
-							outerCache[ dir ] = newCache;
-
-							// A match means we're done; a fail means we have to keep checking
-							if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
-								return true;
-							}
-						}
-					}
-				}
-			}
-		};
-}
-
-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.call( 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.call( checkContext, elem ) > -1;
-		}, implicitRelative, true ),
-		matchers = [ function( elem, context, xml ) {
-			return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
-				(checkContext = context).nodeType ?
-					matchContext( elem, context, xml ) :
-					matchAnyContext( elem, context, xml ) );
-		} ];
-
-	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 ) {
-				outermostContext = context !== document && context;
-			}
-
-			// Add elements passing elementMatchers directly to results
-			// Keep `i` a string if there are no elements so `matchedCount` will be "00" below
-			// 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;
-					while ( (matcher = elementMatchers[j++]) ) {
-						if ( matcher( elem, context, 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 );
-					}
-				}
-			}
-
-			// Apply set filters to unmatched elements
-			matchedCount += i;
-			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 no seed and only one group
-	if ( match.length === 1 ) {
-
-		// Take a shortcut and set the context if the root selector is an ID
-		tokens = match[0] = match[0].slice( 0 );
-		if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
-				support.getById && 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,
-		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
-// 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( div1 ) {
-	// Should return 1, but returns 4 (following)
-	return div1.compareDocumentPosition( document.createElement("div") ) & 1;
-});
-
-// Support: IE<8
-// Prevent attribute/property "interpolation"
-// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
-if ( !assert(function( div ) {
-	div.innerHTML = "<a href='#'></a>";
-	return div.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( div ) {
-	div.innerHTML = "<input/>";
-	div.firstChild.setAttribute( "value", "" );
-	return div.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( div ) {
-	return div.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;
-jQuery.expr[":"] = jQuery.expr.pseudos;
-jQuery.unique = Sizzle.uniqueSort;
-jQuery.text = Sizzle.getText;
-jQuery.isXMLDoc = Sizzle.isXML;
-jQuery.contains = Sizzle.contains;
-
-
-
-var rneedsContext = jQuery.expr.match.needsContext;
-
-var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
-
-
-
-var risSimple = /^.[^:#\[\.,]*$/;
-
-// Implement the identical functionality for filter and not
-function winnow( elements, qualifier, not ) {
-	if ( jQuery.isFunction( qualifier ) ) {
-		return jQuery.grep( elements, function( elem, i ) {
-			/* jshint -W018 */
-			return !!qualifier.call( elem, i, elem ) !== not;
-		});
-
-	}
-
-	if ( qualifier.nodeType ) {
-		return jQuery.grep( elements, function( elem ) {
-			return ( elem === qualifier ) !== not;
-		});
-
-	}
-
-	if ( typeof qualifier === "string" ) {
-		if ( risSimple.test( qualifier ) ) {
-			return jQuery.filter( qualifier, elements, not );
-		}
-
-		qualifier = jQuery.filter( qualifier, elements );
-	}
-
-	return jQuery.grep( elements, function( elem ) {
-		return ( indexOf.call( qualifier, elem ) >= 0 ) !== not;
-	});
-}
-
-jQuery.filter = function( expr, elems, not ) {
-	var elem = elems[ 0 ];
-
-	if ( not ) {
-		expr = ":not(" + expr + ")";
-	}
-
-	return elems.length === 1 && elem.nodeType === 1 ?
-		jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
-		jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
-			return elem.nodeType === 1;
-		}));
-};
-
-jQuery.fn.extend({
-	find: function( selector ) {
-		var i,
-			len = this.length,
-			ret = [],
-			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;
-					}
-				}
-			}) );
-		}
-
-		for ( i = 0; i < len; i++ ) {
-			jQuery.find( selector, self[ i ], ret );
-		}
-
-		// Needed because $( selector, context ) becomes $( context ).find( selector )
-		ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
-		ret.selector = this.selector ? this.selector + " " + selector : selector;
-		return 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 <)
-	rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
-
-	init = jQuery.fn.init = function( selector, context ) {
-		var match, elem;
-
-		// HANDLE: $(""), $(null), $(undefined), $(false)
-		if ( !selector ) {
-			return this;
-		}
-
-		// 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;
-
-					// 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 ( jQuery.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] );
-
-					// Check parentNode to catch when Blackberry 4.6 returns
-					// nodes that are no longer in the document #6963
-					if ( elem && elem.parentNode ) {
-						// Inject the element directly into the jQuery object
-						this.length = 1;
-						this[0] = elem;
-					}
-
-					this.context = document;
-					this.selector = selector;
-					return this;
-				}
-
-			// HANDLE: $(expr, $(...))
-			} else if ( !context || context.jquery ) {
-				return ( context || rootjQuery ).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.context = this[0] = selector;
-			this.length = 1;
-			return this;
-
-		// HANDLE: $(function)
-		// Shortcut for document ready
-		} else if ( jQuery.isFunction( selector ) ) {
-			return typeof rootjQuery.ready !== "undefined" ?
-				rootjQuery.ready( selector ) :
-				// Execute immediately if ready is not present
-				selector( jQuery );
-		}
-
-		if ( selector.selector !== undefined ) {
-			this.selector = selector.selector;
-			this.context = selector.context;
-		}
-
-		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.extend({
-	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;
-	},
-
-	sibling: function( n, elem ) {
-		var matched = [];
-
-		for ( ; n; n = n.nextSibling ) {
-			if ( n.nodeType === 1 && n !== elem ) {
-				matched.push( n );
-			}
-		}
-
-		return matched;
-	}
-});
-
-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 = [],
-			pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
-				jQuery( selectors, context || this.context ) :
-				0;
-
-		for ( ; i < l; i++ ) {
-			for ( cur = this[i]; cur && cur !== context; cur = cur.parentNode ) {
-				// Always skip document fragments
-				if ( cur.nodeType < 11 && (pos ?
-					pos.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.unique( matched ) : matched );
-	},
-
-	// Determine the position of an element within
-	// the matched set of elements
-	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.unique(
-				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 jQuery.dir( elem, "parentNode" );
-	},
-	parentsUntil: function( elem, i, until ) {
-		return jQuery.dir( elem, "parentNode", until );
-	},
-	next: function( elem ) {
-		return sibling( elem, "nextSibling" );
-	},
-	prev: function( elem ) {
-		return sibling( elem, "previousSibling" );
-	},
-	nextAll: function( elem ) {
-		return jQuery.dir( elem, "nextSibling" );
-	},
-	prevAll: function( elem ) {
-		return jQuery.dir( elem, "previousSibling" );
-	},
-	nextUntil: function( elem, i, until ) {
-		return jQuery.dir( elem, "nextSibling", until );
-	},
-	prevUntil: function( elem, i, until ) {
-		return jQuery.dir( elem, "previousSibling", until );
-	},
-	siblings: function( elem ) {
-		return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
-	},
-	children: function( elem ) {
-		return jQuery.sibling( elem.firstChild );
-	},
-	contents: function( elem ) {
-		return elem.contentDocument || 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.unique( matched );
-			}
-
-			// Reverse order for parents* and prev-derivatives
-			if ( rparentsprev.test( name ) ) {
-				matched.reverse();
-			}
-		}
-
-		return this.pushStack( matched );
-	};
-});
-var rnotwhite = (/\S+/g);
-
-
-
-// String to Object options format cache
-var optionsCache = {};
-
-// Convert String-formatted options into Object-formatted ones and store in cache
-function createOptions( options ) {
-	var object = optionsCache[ options ] = {};
-	jQuery.each( options.match( rnotwhite ) || [], 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" ?
-		( optionsCache[ options ] || createOptions( options ) ) :
-		jQuery.extend( {}, options );
-
-	var // Last fire value (for non-forgettable lists)
-		memory,
-		// Flag to know if list was already fired
-		fired,
-		// Flag to know if list is currently firing
-		firing,
-		// First callback to fire (used internally by add and fireWith)
-		firingStart,
-		// End of the loop when firing
-		firingLength,
-		// Index of currently firing callback (modified by remove if needed)
-		firingIndex,
-		// Actual callback list
-		list = [],
-		// Stack of fire calls for repeatable lists
-		stack = !options.once && [],
-		// Fire callbacks
-		fire = function( data ) {
-			memory = options.memory && data;
-			fired = true;
-			firingIndex = firingStart || 0;
-			firingStart = 0;
-			firingLength = list.length;
-			firing = true;
-			for ( ; list && firingIndex < firingLength; firingIndex++ ) {
-				if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
-					memory = false; // To prevent further calls using add
-					break;
-				}
-			}
-			firing = false;
-			if ( list ) {
-				if ( stack ) {
-					if ( stack.length ) {
-						fire( stack.shift() );
-					}
-				} else if ( memory ) {
-					list = [];
-				} else {
-					self.disable();
-				}
-			}
-		},
-		// Actual Callbacks object
-		self = {
-			// Add a callback or a collection of callbacks to the list
-			add: function() {
-				if ( list ) {
-					// First, we save the current length
-					var start = list.length;
-					(function add( args ) {
-						jQuery.each( args, function( _, arg ) {
-							var type = jQuery.type( arg );
-							if ( type === "function" ) {
-								if ( !options.unique || !self.has( arg ) ) {
-									list.push( arg );
-								}
-							} else if ( arg && arg.length && type !== "string" ) {
-								// Inspect recursively
-								add( arg );
-							}
-						});
-					})( arguments );
-					// Do we need to add the callbacks to the
-					// current firing batch?
-					if ( firing ) {
-						firingLength = list.length;
-					// With memory, if we're not firing then
-					// we should call right away
-					} else if ( memory ) {
-						firingStart = start;
-						fire( memory );
-					}
-				}
-				return this;
-			},
-			// Remove a callback from the list
-			remove: function() {
-				if ( list ) {
-					jQuery.each( arguments, function( _, arg ) {
-						var index;
-						while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
-							list.splice( index, 1 );
-							// Handle firing indexes
-							if ( firing ) {
-								if ( index <= firingLength ) {
-									firingLength--;
-								}
-								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 && list.length );
-			},
-			// Remove all callbacks from the list
-			empty: function() {
-				list = [];
-				firingLength = 0;
-				return this;
-			},
-			// Have the list do nothing anymore
-			disable: function() {
-				list = stack = memory = undefined;
-				return this;
-			},
-			// Is it disabled?
-			disabled: function() {
-				return !list;
-			},
-			// Lock the list in its current state
-			lock: function() {
-				stack = undefined;
-				if ( !memory ) {
-					self.disable();
-				}
-				return this;
-			},
-			// Is it locked?
-			locked: function() {
-				return !stack;
-			},
-			// Call all callbacks with the given context and arguments
-			fireWith: function( context, args ) {
-				if ( list && ( !fired || stack ) ) {
-					args = args || [];
-					args = [ context, args.slice ? args.slice() : args ];
-					if ( firing ) {
-						stack.push( args );
-					} else {
-						fire( args );
-					}
-				}
-				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;
-};
-
-
-jQuery.extend({
-
-	Deferred: function( func ) {
-		var tuples = [
-				// action, add listener, listener list, final state
-				[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
-				[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
-				[ "notify", "progress", jQuery.Callbacks("memory") ]
-			],
-			state = "pending",
-			promise = {
-				state: function() {
-					return state;
-				},
-				always: function() {
-					deferred.done( arguments ).fail( arguments );
-					return this;
-				},
-				then: function( /* fnDone, fnFail, fnProgress */ ) {
-					var fns = arguments;
-					return jQuery.Deferred(function( newDefer ) {
-						jQuery.each( tuples, function( i, tuple ) {
-							var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
-							// deferred[ done | fail | progress ] for forwarding actions to newDefer
-							deferred[ tuple[1] ](function() {
-								var returned = fn && fn.apply( this, arguments );
-								if ( returned && jQuery.isFunction( returned.promise ) ) {
-									returned.promise()
-										.done( newDefer.resolve )
-										.fail( newDefer.reject )
-										.progress( newDefer.notify );
-								} else {
-									newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
-								}
-							});
-						});
-						fns = null;
-					}).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 = {};
-
-		// Keep pipe for back-compat
-		promise.pipe = promise.then;
-
-		// Add list-specific methods
-		jQuery.each( tuples, function( i, tuple ) {
-			var list = tuple[ 2 ],
-				stateString = tuple[ 3 ];
-
-			// promise[ done | fail | progress ] = list.add
-			promise[ tuple[1] ] = list.add;
-
-			// Handle state
-			if ( stateString ) {
-				list.add(function() {
-					// state = [ resolved | rejected ]
-					state = stateString;
-
-				// [ reject_list | resolve_list ].disable; progress_list.lock
-				}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
-			}
-
-			// deferred[ resolve | reject | notify ]
-			deferred[ tuple[0] ] = function() {
-				deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
-				return this;
-			};
-			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( subordinate /* , ..., subordinateN */ ) {
-		var i = 0,
-			resolveValues = slice.call( arguments ),
-			length = resolveValues.length,
-
-			// the count of uncompleted subordinates
-			remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
-
-			// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
-			deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
-
-			// Update function for both resolve and progress values
-			updateFunc = function( i, contexts, values ) {
-				return function( value ) {
-					contexts[ i ] = this;
-					values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
-					if ( values === progressValues ) {
-						deferred.notifyWith( contexts, values );
-					} else if ( !( --remaining ) ) {
-						deferred.resolveWith( contexts, values );
-					}
-				};
-			},
-
-			progressValues, progressContexts, resolveContexts;
-
-		// add listeners to Deferred subordinates; treat others as resolved
-		if ( length > 1 ) {
-			progressValues = new Array( length );
-			progressContexts = new Array( length );
-			resolveContexts = new Array( length );
-			for ( ; i < length; i++ ) {
-				if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
-					resolveValues[ i ].promise()
-						.done( updateFunc( i, resolveContexts, resolveValues ) )
-						.fail( deferred.reject )
-						.progress( updateFunc( i, progressContexts, progressValues ) );
-				} else {
-					--remaining;
-				}
-			}
-		}
-
-		// if we're not waiting on anything, resolve the master
-		if ( !remaining ) {
-			deferred.resolveWith( resolveContexts, resolveValues );
-		}
-
-		return deferred.promise();
-	}
-});
-
-
-// The deferred used on DOM ready
-var readyList;
-
-jQuery.fn.ready = function( fn ) {
-	// Add the callback
-	jQuery.ready.promise().done( fn );
-
-	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,
-
-	// Hold (or release) the ready event
-	holdReady: function( hold ) {
-		if ( hold ) {
-			jQuery.readyWait++;
-		} else {
-			jQuery.ready( true );
-		}
-	},
-
-	// 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 ] );
-
-		// Trigger any bound ready events
-		if ( jQuery.fn.triggerHandler ) {
-			jQuery( document ).triggerHandler( "ready" );
-			jQuery( document ).off( "ready" );
-		}
-	}
-});
-
-/**
- * The ready event handler and self cleanup method
- */
-function completed() {
-	document.removeEventListener( "DOMContentLoaded", completed, false );
-	window.removeEventListener( "load", completed, false );
-	jQuery.ready();
-}
-
-jQuery.ready.promise = function( obj ) {
-	if ( !readyList ) {
-
-		readyList = jQuery.Deferred();
-
-		// Catch cases where $(document).ready() is called after the browser event has already occurred.
-		// we once tried to use readyState "interactive" here, but it caused issues like the one
-		// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
-		if ( document.readyState === "complete" ) {
-			// Handle it asynchronously to allow scripts the opportunity to delay ready
-			setTimeout( jQuery.ready );
-
-		} else {
-
-			// Use the handy event callback
-			document.addEventListener( "DOMContentLoaded", completed, false );
-
-			// A fallback to window.onload, that will always work
-			window.addEventListener( "load", completed, false );
-		}
-	}
-	return readyList.promise( obj );
-};
-
-// Kick off the DOM ready check even if the user does not
-jQuery.ready.promise();
-
-
-
-
-// Multifunctional method to get and set values of a collection
-// The value/s can optionally be executed if it's a function
-var access = jQuery.access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
-	var i = 0,
-		len = elems.length,
-		bulk = key == null;
-
-	// Sets many values
-	if ( jQuery.type( key ) === "object" ) {
-		chainable = true;
-		for ( i in key ) {
-			jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
-		}
-
-	// Sets one value
-	} else if ( value !== undefined ) {
-		chainable = true;
-
-		if ( !jQuery.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 ) ) );
-			}
-		}
-	}
-
-	return chainable ?
-		elems :
-
-		// Gets
-		bulk ?
-			fn.call( elems ) :
-			len ? fn( elems[0], key ) : emptyGet;
-};
-
-
-/**
- * Determines whether an object can have data
- */
-jQuery.acceptData = function( owner ) {
-	// Accepts only:
-	//  - Node
-	//    - Node.ELEMENT_NODE
-	//    - Node.DOCUMENT_NODE
-	//  - Object
-	//    - Any
-	/* jshint -W018 */
-	return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
-};
-
-
-function Data() {
-	// Support: Android < 4,
-	// Old WebKit does not have Object.preventExtensions/freeze method,
-	// return new empty object instead with no [[set]] accessor
-	Object.defineProperty( this.cache = {}, 0, {
-		get: function() {
-			return {};
-		}
-	});
-
-	this.expando = jQuery.expando + Math.random();
-}
-
-Data.uid = 1;
-Data.accepts = jQuery.acceptData;
-
-Data.prototype = {
-	key: function( owner ) {
-		// We can accept data for non-element nodes in modern browsers,
-		// but we should not, see #8335.
-		// Always return the key for a frozen object.
-		if ( !Data.accepts( owner ) ) {
-			return 0;
-		}
-
-		var descriptor = {},
-			// Check if the owner object already has a cache key
-			unlock = owner[ this.expando ];
-
-		// If not, create one
-		if ( !unlock ) {
-			unlock = Data.uid++;
-
-			// Secure it in a non-enumerable, non-writable property
-			try {
-				descriptor[ this.expando ] = { value: unlock };
-				Object.defineProperties( owner, descriptor );
-
-			// Support: Android < 4
-			// Fallback to a less secure definition
-			} catch ( e ) {
-				descriptor[ this.expando ] = unlock;
-				jQuery.extend( owner, descriptor );
-			}
-		}
-
-		// Ensure the cache object
-		if ( !this.cache[ unlock ] ) {
-			this.cache[ unlock ] = {};
-		}
-
-		return unlock;
-	},
-	set: function( owner, data, value ) {
-		var prop,
-			// There may be an unlock assigned to this node,
-			// if there is no entry for this "owner", create one inline
-			// and set the unlock as though an owner entry had always existed
-			unlock = this.key( owner ),
-			cache = this.cache[ unlock ];
-
-		// Handle: [ owner, key, value ] args
-		if ( typeof data === "string" ) {
-			cache[ data ] = value;
-
-		// Handle: [ owner, { properties } ] args
-		} else {
-			// Fresh assignments by object are shallow copied
-			if ( jQuery.isEmptyObject( cache ) ) {
-				jQuery.extend( this.cache[ unlock ], data );
-			// Otherwise, copy the properties one-by-one to the cache object
-			} else {
-				for ( prop in data ) {
-					cache[ prop ] = data[ prop ];
-				}
-			}
-		}
-		return cache;
-	},
-	get: function( owner, key ) {
-		// Either a valid cache is found, or will be created.
-		// New caches will be created and the unlock returned,
-		// allowing direct access to the newly created
-		// empty data object. A valid owner object must be provided.
-		var cache = this.cache[ this.key( owner ) ];
-
-		return key === undefined ?
-			cache : cache[ key ];
-	},
-	access: function( owner, key, value ) {
-		var stored;
-		// 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) ) {
-
-			stored = this.get( owner, key );
-
-			return stored !== undefined ?
-				stored : this.get( owner, jQuery.camelCase(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, name, camel,
-			unlock = this.key( owner ),
-			cache = this.cache[ unlock ];
-
-		if ( key === undefined ) {
-			this.cache[ unlock ] = {};
-
-		} else {
-			// Support array or space separated string of keys
-			if ( jQuery.isArray( key ) ) {
-				// If "name" is an array of keys...
-				// When data is initially created, via ("key", "val") signature,
-				// keys will be converted to camelCase.
-				// Since there is no way to tell _how_ a key was added, remove
-				// both plain key and camelCase key. #12786
-				// This will only penalize the array argument path.
-				name = key.concat( key.map( jQuery.camelCase ) );
-			} else {
-				camel = jQuery.camelCase( key );
-				// Try the string as a key before any manipulation
-				if ( key in cache ) {
-					name = [ key, camel ];
-				} else {
-					// If a key with the spaces exists, use it.
-					// Otherwise, create an array by matching non-whitespace
-					name = camel;
-					name = name in cache ?
-						[ name ] : ( name.match( rnotwhite ) || [] );
-				}
-			}
-
-			i = name.length;
-			while ( i-- ) {
-				delete cache[ name[ i ] ];
-			}
-		}
-	},
-	hasData: function( owner ) {
-		return !jQuery.isEmptyObject(
-			this.cache[ owner[ this.expando ] ] || {}
-		);
-	},
-	discard: function( owner ) {
-		if ( owner[ this.expando ] ) {
-			delete this.cache[ owner[ this.expando ] ];
-		}
-	}
-};
-var data_priv = new Data();
-
-var data_user = 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 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, "-$1" ).toLowerCase();
-		data = elem.getAttribute( name );
-
-		if ( typeof data === "string" ) {
-			try {
-				data = data === "true" ? true :
-					data === "false" ? false :
-					data === "null" ? null :
-					// Only convert to a number if it doesn't change the string
-					+data + "" === data ? +data :
-					rbrace.test( data ) ? jQuery.parseJSON( data ) :
-					data;
-			} catch( e ) {}
-
-			// Make sure we set the data so it isn't changed later
-			data_user.set( elem, key, data );
-		} else {
-			data = undefined;
-		}
-	}
-	return data;
-}
-
-jQuery.extend({
-	hasData: function( elem ) {
-		return data_user.hasData( elem ) || data_priv.hasData( elem );
-	},
-
-	data: function( elem, name, data ) {
-		return data_user.access( elem, name, data );
-	},
-
-	removeData: function( elem, name ) {
-		data_user.remove( elem, name );
-	},
-
-	// TODO: Now that all calls to _data and _removeData have been replaced
-	// with direct calls to data_priv methods, these can be deprecated.
-	_data: function( elem, name, data ) {
-		return data_priv.access( elem, name, data );
-	},
-
-	_removeData: function( elem, name ) {
-		data_priv.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 = data_user.get( elem );
-
-				if ( elem.nodeType === 1 && !data_priv.get( elem, "hasDataAttrs" ) ) {
-					i = attrs.length;
-					while ( i-- ) {
-
-						// Support: IE11+
-						// The attrs elements can be null (#14894)
-						if ( attrs[ i ] ) {
-							name = attrs[ i ].name;
-							if ( name.indexOf( "data-" ) === 0 ) {
-								name = jQuery.camelCase( name.slice(5) );
-								dataAttr( elem, name, data[ name ] );
-							}
-						}
-					}
-					data_priv.set( elem, "hasDataAttrs", true );
-				}
-			}
-
-			return data;
-		}
-
-		// Sets multiple values
-		if ( typeof key === "object" ) {
-			return this.each(function() {
-				data_user.set( this, key );
-			});
-		}
-
-		return access( this, function( value ) {
-			var data,
-				camelKey = jQuery.camelCase( key );
-
-			// 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
-				// with the key as-is
-				data = data_user.get( elem, key );
-				if ( data !== undefined ) {
-					return data;
-				}
-
-				// Attempt to get data from the cache
-				// with the key camelized
-				data = data_user.get( elem, camelKey );
-				if ( data !== undefined ) {
-					return data;
-				}
-
-				// Attempt to "discover" the data in
-				// HTML5 custom data-* attrs
-				data = dataAttr( elem, camelKey, undefined );
-				if ( data !== undefined ) {
-					return data;
-				}
-
-				// We tried really hard, but the data doesn't exist.
-				return;
-			}
-
-			// Set the data...
-			this.each(function() {
-				// First, attempt to store a copy or reference of any
-				// data that might've been store with a camelCased key.
-				var data = data_user.get( this, camelKey );
-
-				// For HTML5 data-* attribute interop, we have to
-				// store property names with dashes in a camelCase form.
-				// This might not apply to all properties...*
-				data_user.set( this, camelKey, value );
-
-				// *... In the case of properties that might _actually_
-				// have dashes, we need to also store a copy of that
-				// unchanged property.
-				if ( key.indexOf("-") !== -1 && data !== undefined ) {
-					data_user.set( this, key, value );
-				}
-			});
-		}, null, value, arguments.length > 1, null, true );
-	},
-
-	removeData: function( key ) {
-		return this.each(function() {
-			data_user.remove( this, key );
-		});
-	}
-});
-
-
-jQuery.extend({
-	queue: function( elem, type, data ) {
-		var queue;
-
-		if ( elem ) {
-			type = ( type || "fx" ) + "queue";
-			queue = data_priv.get( elem, type );
-
-			// Speed up dequeue by getting out quickly if this is just a lookup
-			if ( data ) {
-				if ( !queue || jQuery.isArray( data ) ) {
-					queue = data_priv.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 intended for public consumption - generates a queueHooks object, or returns the current one
-	_queueHooks: function( elem, type ) {
-		var key = type + "queueHooks";
-		return data_priv.get( elem, key ) || data_priv.access( elem, key, {
-			empty: jQuery.Callbacks("once memory").add(function() {
-				data_priv.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 = data_priv.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 cssExpand = [ "Top", "Right", "Bottom", "Left" ];
-
-var isHidden = function( elem, el ) {
-		// isHidden might be called from jQuery#filter function;
-		// in that case, element will be second argument
-		elem = el || elem;
-		return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
-	};
-
-var rcheckableType = (/^(?:checkbox|radio)$/i);
-
-
-
-(function() {
-	var fragment = document.createDocumentFragment(),
-		div = fragment.appendChild( document.createElement( "div" ) ),
-		input = document.createElement( "input" );
-
-	// #11217 - WebKit loses check when the name is after the checked attribute
-	// Support: Windows Web Apps (WWA)
-	// `name` and `type` need .setAttribute for WWA
-	input.setAttribute( "type", "radio" );
-	input.setAttribute( "checked", "checked" );
-	input.setAttribute( "name", "t" );
-
-	div.appendChild( input );
-
-	// Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
-	// old WebKit doesn't clone checked state correctly in fragments
-	support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
-
-	// Make sure textarea (and checkbox) defaultValue is properly cloned
-	// Support: IE9-IE11+
-	div.innerHTML = "<textarea>x</textarea>";
-	support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
-})();
-var strundefined = typeof undefined;
-
-
-
-support.focusinBubbles = "onfocusin" in window;
-
-
-var
-	rkeyEvent = /^key/,
-	rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/,
-	rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
-	rtypenamespace = /^([^.]*)(?:\.(.+)|)$/;
-
-function returnTrue() {
-	return true;
-}
-
-function returnFalse() {
-	return false;
-}
-
-function safeActiveElement() {
-	try {
-		return document.activeElement;
-	} catch ( err ) { }
-}
-
-/*
- * 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 = data_priv.get( elem );
-
-		// Don't attach events to noData or text/comment nodes (but allow plain objects)
-		if ( !elemData ) {
-			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;
-		}
-
-		// 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 = {};
-		}
-		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 !== strundefined && jQuery.event.triggered !== e.type ?
-					jQuery.event.dispatch.apply( elem, arguments ) : undefined;
-			};
-		}
-
-		// Handle multiple events separated by a space
-		types = ( types || "" ).match( rnotwhite ) || [ "" ];
-		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, false );
-					}
-				}
-			}
-
-			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 = data_priv.hasData( elem ) && data_priv.get( elem );
-
-		if ( !elemData || !(events = elemData.events) ) {
-			return;
-		}
-
-		// Once for each type.namespace in types; type may be omitted
-		types = ( types || "" ).match( rnotwhite ) || [ "" ];
-		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 the expando if it's no longer used
-		if ( jQuery.isEmptyObject( events ) ) {
-			delete elemData.handle;
-			data_priv.remove( elem, "events" );
-		}
-	},
-
-	trigger: function( event, data, elem, onlyHandlers ) {
-
-		var i, cur, tmp, bubbleType, ontype, handle, special,
-			eventPath = [ elem || document ],
-			type = hasOwn.call( event, "type" ) ? event.type : event,
-			namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : [];
-
-		cur = 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(".") >= 0 ) {
-			// 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.namespace_re = 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 && !jQuery.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() ) {
-
-			event.type = i > 1 ?
-				bubbleType :
-				special.bindType || type;
-
-			// jQuery handler
-			handle = ( data_priv.get( cur, "events" ) || {} )[ event.type ] && data_priv.get( cur, "handle" );
-			if ( handle ) {
-				handle.apply( cur, data );
-			}
-
-			// Native handler
-			handle = ontype && cur[ ontype ];
-			if ( handle && handle.apply && jQuery.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) &&
-				jQuery.acceptData( elem ) ) {
-
-				// Call a native DOM method on the target with the same name name as the event.
-				// Don't do default actions on window, that's where global variables be (#6170)
-				if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.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;
-					elem[ type ]();
-					jQuery.event.triggered = undefined;
-
-					if ( tmp ) {
-						elem[ ontype ] = tmp;
-					}
-				}
-			}
-		}
-
-		return event.result;
-	},
-
-	dispatch: function( event ) {
-
-		// Make a writable jQuery.Event from the native event object
-		event = jQuery.event.fix( event );
-
-		var i, j, ret, matched, handleObj,
-			handlerQueue = [],
-			args = slice.call( arguments ),
-			handlers = ( data_priv.get( this, "events" ) || {} )[ event.type ] || [],
-			special = jQuery.event.special[ event.type ] || {};
-
-		// Use the fix-ed jQuery.Event rather than the (read-only) native event
-		args[0] = event;
-		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() ) {
-
-				// Triggered event must either 1) have no namespace, or
-				// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
-				if ( !event.namespace_re || event.namespace_re.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, matches, sel, handleObj,
-			handlerQueue = [],
-			delegateCount = handlers.delegateCount,
-			cur = event.target;
-
-		// Find delegate handlers
-		// Black-hole SVG <use> instance trees (#13180)
-		// Avoid non-left-click bubbling in Firefox (#3861)
-		if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) {
-
-			for ( ; cur !== this; cur = cur.parentNode || this ) {
-
-				// Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
-				if ( cur.disabled !== true || event.type !== "click" ) {
-					matches = [];
-					for ( i = 0; i < delegateCount; i++ ) {
-						handleObj = handlers[ i ];
-
-						// Don't conflict with Object.prototype properties (#13203)
-						sel = handleObj.selector + " ";
-
-						if ( matches[ sel ] === undefined ) {
-							matches[ sel ] = handleObj.needsContext ?
-								jQuery( sel, this ).index( cur ) >= 0 :
-								jQuery.find( sel, this, null, [ cur ] ).length;
-						}
-						if ( matches[ sel ] ) {
-							matches.push( handleObj );
-						}
-					}
-					if ( matches.length ) {
-						handlerQueue.push({ elem: cur, handlers: matches });
-					}
-				}
-			}
-		}
-
-		// Add the remaining (directly-bound) handlers
-		if ( delegateCount < handlers.length ) {
-			handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) });
-		}
-
-		return handlerQueue;
-	},
-
-	// Includes some event props shared by KeyEvent and MouseEvent
-	props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
-
-	fixHooks: {},
-
-	keyHooks: {
-		props: "char charCode key keyCode".split(" "),
-		filter: function( event, original ) {
-
-			// Add which for key events
-			if ( event.which == null ) {
-				event.which = original.charCode != null ? original.charCode : original.keyCode;
-			}
-
-			return event;
-		}
-	},
-
-	mouseHooks: {
-		props: "button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
-		filter: function( event, original ) {
-			var eventDoc, doc, body,
-				button = original.button;
-
-			// Calculate pageX/Y if missing and clientX/Y available
-			if ( event.pageX == null && original.clientX != null ) {
-				eventDoc = event.target.ownerDocument || document;
-				doc = eventDoc.documentElement;
-				body = eventDoc.body;
-
-				event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
-				event.pageY = original.clientY + ( doc && doc.scrollTop  || body && body.scrollTop  || 0 ) - ( doc && doc.clientTop  || body && body.clientTop  || 0 );
-			}
-
-			// Add which for click: 1 === left; 2 === middle; 3 === right
-			// Note: button is not normalized, so don't use it
-			if ( !event.which && button !== undefined ) {
-				event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
-			}
-
-			return event;
-		}
-	},
-
-	fix: function( event ) {
-		if ( event[ jQuery.expando ] ) {
-			return event;
-		}
-
-		// Create a writable copy of the event object and normalize some properties
-		var i, prop, copy,
-			type = event.type,
-			originalEvent = event,
-			fixHook = this.fixHooks[ type ];
-
-		if ( !fixHook ) {
-			this.fixHooks[ type ] = fixHook =
-				rmouseEvent.test( type ) ? this.mouseHooks :
-				rkeyEvent.test( type ) ? this.keyHooks :
-				{};
-		}
-		copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
-
-		event = new jQuery.Event( originalEvent );
-
-		i = copy.length;
-		while ( i-- ) {
-			prop = copy[ i ];
-			event[ prop ] = originalEvent[ prop ];
-		}
-
-		// Support: Cordova 2.5 (WebKit) (#13255)
-		// All events should have a target; Cordova deviceready doesn't
-		if ( !event.target ) {
-			event.target = document;
-		}
-
-		// Support: Safari 6.0+, Chrome < 28
-		// Target should not be a text node (#504, #13143)
-		if ( event.target.nodeType === 3 ) {
-			event.target = event.target.parentNode;
-		}
-
-		return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
-	},
-
-	special: {
-		load: {
-			// Prevent triggered image.load events from bubbling to window.load
-			noBubble: true
-		},
-		focus: {
-			// Fire native event if possible so blur/focus sequence is correct
-			trigger: function() {
-				if ( this !== safeActiveElement() && this.focus ) {
-					this.focus();
-					return false;
-				}
-			},
-			delegateType: "focusin"
-		},
-		blur: {
-			trigger: function() {
-				if ( this === safeActiveElement() && this.blur ) {
-					this.blur();
-					return false;
-				}
-			},
-			delegateType: "focusout"
-		},
-		click: {
-			// For checkbox, fire native event so checked state will be right
-			trigger: function() {
-				if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
-					this.click();
-					return false;
-				}
-			},
-
-			// For cross-browser consistency, don't fire native .click() on links
-			_default: function( event ) {
-				return jQuery.nodeName( event.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;
-				}
-			}
-		}
-	},
-
-	simulate: function( type, elem, event, bubble ) {
-		// Piggyback on a donor event to simulate a different one.
-		// Fake originalEvent to avoid donor's stopPropagation, but if the
-		// simulated event prevents default then we do the same on the donor.
-		var e = jQuery.extend(
-			new jQuery.Event(),
-			event,
-			{
-				type: type,
-				isSimulated: true,
-				originalEvent: {}
-			}
-		);
-		if ( bubble ) {
-			jQuery.event.trigger( e, null, elem );
-		} else {
-			jQuery.event.dispatch.call( elem, e );
-		}
-		if ( e.isDefaultPrevented() ) {
-			event.preventDefault();
-		}
-	}
-};
-
-jQuery.removeEvent = function( elem, type, handle ) {
-	if ( elem.removeEventListener ) {
-		elem.removeEventListener( type, handle, false );
-	}
-};
-
-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 < 4.0
-				src.returnValue === false ?
-			returnTrue :
-			returnFalse;
-
-	// 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 || jQuery.now();
-
-	// Mark it as fixed
-	this[ jQuery.expando ] = true;
-};
-
-// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
-// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
-jQuery.Event.prototype = {
-	isDefaultPrevented: returnFalse,
-	isPropagationStopped: returnFalse,
-	isImmediatePropagationStopped: returnFalse,
-
-	preventDefault: function() {
-		var e = this.originalEvent;
-
-		this.isDefaultPrevented = returnTrue;
-
-		if ( e && e.preventDefault ) {
-			e.preventDefault();
-		}
-	},
-	stopPropagation: function() {
-		var e = this.originalEvent;
-
-		this.isPropagationStopped = returnTrue;
-
-		if ( e && e.stopPropagation ) {
-			e.stopPropagation();
-		}
-	},
-	stopImmediatePropagation: function() {
-		var e = this.originalEvent;
-
-		this.isImmediatePropagationStopped = returnTrue;
-
-		if ( e && e.stopImmediatePropagation ) {
-			e.stopImmediatePropagation();
-		}
-
-		this.stopPropagation();
-	}
-};
-
-// Create mouseenter/leave events using mouseover/out and event-time checks
-// Support: Chrome 15+
-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 mousenter/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;
-		}
-	};
-});
-
-// Create "bubbling" focus and blur events
-// Support: Firefox, Chrome, Safari
-if ( !support.focusinBubbles ) {
-	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 ), true );
-			};
-
-		jQuery.event.special[ fix ] = {
-			setup: function() {
-				var doc = this.ownerDocument || this,
-					attaches = data_priv.access( doc, fix );
-
-				if ( !attaches ) {
-					doc.addEventListener( orig, handler, true );
-				}
-				data_priv.access( doc, fix, ( attaches || 0 ) + 1 );
-			},
-			teardown: function() {
-				var doc = this.ownerDocument || this,
-					attaches = data_priv.access( doc, fix ) - 1;
-
-				if ( !attaches ) {
-					doc.removeEventListener( orig, handler, true );
-					data_priv.remove( doc, fix );
-
-				} else {
-					data_priv.access( doc, fix, attaches );
-				}
-			}
-		};
-	});
-}
-
-jQuery.fn.extend({
-
-	on: function( types, selector, data, fn, /*INTERNAL*/ 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 ) {
-				this.on( type, selector, data, types[ type ], one );
-			}
-			return this;
-		}
-
-		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 this;
-		}
-
-		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 this.each( function() {
-			jQuery.event.add( this, types, fn, data, selector );
-		});
-	},
-	one: function( types, selector, data, fn ) {
-		return this.on( 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 );
-		});
-	},
-
-	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 );
-		}
-	}
-});
-
-
-var
-	rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
-	rtagName = /<([\w:]+)/,
-	rhtml = /<|&#?\w+;/,
-	rnoInnerhtml = /<(?:script|style|link)/i,
-	// checked="checked" or checked
-	rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
-	rscriptType = /^$|\/(?:java|ecma)script/i,
-	rscriptTypeMasked = /^true\/(.*)/,
-	rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,
-
-	// We have to close these tags to support XHTML (#13200)
-	wrapMap = {
-
-		// Support: IE 9
-		option: [ 1, "<select multiple='multiple'>", "</select>" ],
-
-		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, "", "" ]
-	};
-
-// Support: IE 9
-wrapMap.optgroup = wrapMap.option;
-
-wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
-wrapMap.th = wrapMap.td;
-
-// Support: 1.x compatibility
-// Manipulating tables requires a tbody
-function manipulationTarget( elem, content ) {
-	return jQuery.nodeName( elem, "table" ) &&
-		jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ?
-
-		elem.getElementsByTagName("tbody")[0] ||
-			elem.appendChild( elem.ownerDocument.createElement("tbody") ) :
-		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 ) {
-	var match = rscriptTypeMasked.exec( elem.type );
-
-	if ( match ) {
-		elem.type = match[ 1 ];
-	} else {
-		elem.removeAttribute("type");
-	}
-
-	return elem;
-}
-
-// Mark scripts as having already been evaluated
-function setGlobalEval( elems, refElements ) {
-	var i = 0,
-		l = elems.length;
-
-	for ( ; i < l; i++ ) {
-		data_priv.set(
-			elems[ i ], "globalEval", !refElements || data_priv.get( refElements[ i ], "globalEval" )
-		);
-	}
-}
-
-function cloneCopyEvent( src, dest ) {
-	var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
-
-	if ( dest.nodeType !== 1 ) {
-		return;
-	}
-
-	// 1. Copy private data: events, handlers, etc.
-	if ( data_priv.hasData( src ) ) {
-		pdataOld = data_priv.access( src );
-		pdataCur = data_priv.set( dest, pdataOld );
-		events = pdataOld.events;
-
-		if ( events ) {
-			delete pdataCur.handle;
-			pdataCur.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 ( data_user.hasData( src ) ) {
-		udataOld = data_user.access( src );
-		udataCur = jQuery.extend( {}, udataOld );
-
-		data_user.set( dest, udataCur );
-	}
-}
-
-function getAll( context, tag ) {
-	var ret = context.getElementsByTagName ? context.getElementsByTagName( tag || "*" ) :
-			context.querySelectorAll ? context.querySelectorAll( tag || "*" ) :
-			[];
-
-	return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
-		jQuery.merge( [ context ], ret ) :
-		ret;
-}
-
-// Support: IE >= 9
-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;
-	}
-}
-
-jQuery.extend({
-	clone: function( elem, dataAndEvents, deepDataAndEvents ) {
-		var i, l, srcElements, destElements,
-			clone = elem.cloneNode( true ),
-			inPage = jQuery.contains( elem.ownerDocument, elem );
-
-		// Support: IE >= 9
-		// Fix Cloning issues
-		if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
-				!jQuery.isXMLDoc( elem ) ) {
-
-			// We eschew Sizzle here for performance reasons: http://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;
-	},
-
-	buildFragment: function( elems, context, scripts, selection ) {
-		var elem, tmp, tag, wrap, contains, 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 ( jQuery.type( elem ) === "object" ) {
-					// Support: QtWebKit
-					// jQuery.merge because push.apply(_, arraylike) throws
-					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 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
-
-					// Descend through wrappers to the right content
-					j = wrap[ 0 ];
-					while ( j-- ) {
-						tmp = tmp.lastChild;
-					}
-
-					// Support: QtWebKit
-					// jQuery.merge because push.apply(_, arraylike) throws
-					jQuery.merge( nodes, tmp.childNodes );
-
-					// Remember the top-level container
-					tmp = fragment.firstChild;
-
-					// Fixes #12346
-					// Support: Webkit, IE
-					tmp.textContent = "";
-				}
-			}
-		}
-
-		// Remove wrapper from fragment
-		fragment.textContent = "";
-
-		i = 0;
-		while ( (elem = nodes[ i++ ]) ) {
-
-			// #4087 - If origin and destination elements are the same, and this is
-			// that element, do not do anything
-			if ( selection && jQuery.inArray( elem, selection ) !== -1 ) {
-				continue;
-			}
-
-			contains = jQuery.contains( elem.ownerDocument, elem );
-
-			// Append to fragment
-			tmp = getAll( fragment.appendChild( elem ), "script" );
-
-			// Preserve script evaluation history
-			if ( contains ) {
-				setGlobalEval( tmp );
-			}
-
-			// Capture executables
-			if ( scripts ) {
-				j = 0;
-				while ( (elem = tmp[ j++ ]) ) {
-					if ( rscriptType.test( elem.type || "" ) ) {
-						scripts.push( elem );
-					}
-				}
-			}
-		}
-
-		return fragment;
-	},
-
-	cleanData: function( elems ) {
-		var data, elem, type, key,
-			special = jQuery.event.special,
-			i = 0;
-
-		for ( ; (elem = elems[ i ]) !== undefined; i++ ) {
-			if ( jQuery.acceptData( elem ) ) {
-				key = elem[ data_priv.expando ];
-
-				if ( key && (data = data_priv.cache[ key ]) ) {
-					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 );
-							}
-						}
-					}
-					if ( data_priv.cache[ key ] ) {
-						// Discard any remaining `private` data
-						delete data_priv.cache[ key ];
-					}
-				}
-			}
-			// Discard any remaining `user` data
-			delete data_user.cache[ elem[ data_user.expando ] ];
-		}
-	}
-});
-
-jQuery.fn.extend({
-	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 this.domManip( arguments, function( elem ) {
-			if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
-				var target = manipulationTarget( this, elem );
-				target.appendChild( elem );
-			}
-		});
-	},
-
-	prepend: function() {
-		return this.domManip( 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 this.domManip( arguments, function( elem ) {
-			if ( this.parentNode ) {
-				this.parentNode.insertBefore( elem, this );
-			}
-		});
-	},
-
-	after: function() {
-		return this.domManip( arguments, function( elem ) {
-			if ( this.parentNode ) {
-				this.parentNode.insertBefore( elem, this.nextSibling );
-			}
-		});
-	},
-
-	remove: function( selector, keepData /* Internal Use Only */ ) {
-		var elem,
-			elems = selector ? jQuery.filter( selector, this ) : this,
-			i = 0;
-
-		for ( ; (elem = elems[i]) != null; i++ ) {
-			if ( !keepData && elem.nodeType === 1 ) {
-				jQuery.cleanData( getAll( elem ) );
-			}
-
-			if ( elem.parentNode ) {
-				if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) {
-					setGlobalEval( getAll( elem, "script" ) );
-				}
-				elem.parentNode.removeChild( elem );
-			}
-		}
-
-		return this;
-	},
-
-	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 = value.replace( rxhtmlTag, "<$1></$2>" );
-
-				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 arg = arguments[ 0 ];
-
-		// Make the changes, replacing each context element with the new content
-		this.domManip( arguments, function( elem ) {
-			arg = this.parentNode;
-
-			jQuery.cleanData( getAll( this ) );
-
-			if ( arg ) {
-				arg.replaceChild( elem, this );
-			}
-		});
-
-		// Force removal if there was no new content (e.g., from empty arguments)
-		return arg && (arg.length || arg.nodeType) ? this : this.remove();
-	},
-
-	detach: function( selector ) {
-		return this.remove( selector, true );
-	},
-
-	domManip: function( args, callback ) {
-
-		// Flatten any nested arrays
-		args = concat.apply( [], args );
-
-		var fragment, first, scripts, hasScripts, node, doc,
-			i = 0,
-			l = this.length,
-			set = this,
-			iNoClone = l - 1,
-			value = args[ 0 ],
-			isFunction = jQuery.isFunction( value );
-
-		// We can't cloneNode fragments that contain checked, in WebKit
-		if ( isFunction ||
-				( l > 1 && typeof value === "string" &&
-					!support.checkClone && rchecked.test( value ) ) ) {
-			return this.each(function( index ) {
-				var self = set.eq( index );
-				if ( isFunction ) {
-					args[ 0 ] = value.call( this, index, self.html() );
-				}
-				self.domManip( args, callback );
-			});
-		}
-
-		if ( l ) {
-			fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this );
-			first = fragment.firstChild;
-
-			if ( fragment.childNodes.length === 1 ) {
-				fragment = first;
-			}
-
-			if ( first ) {
-				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: QtWebKit
-							// jQuery.merge because push.apply(_, arraylike) throws
-							jQuery.merge( scripts, getAll( node, "script" ) );
-						}
-					}
-
-					callback.call( this[ 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 || "" ) &&
-							!data_priv.access( node, "globalEval" ) && jQuery.contains( doc, node ) ) {
-
-							if ( node.src ) {
-								// Optional AJAX dependency, but won't run scripts if not present
-								if ( jQuery._evalUrl ) {
-									jQuery._evalUrl( node.src );
-								}
-							} else {
-								jQuery.globalEval( node.textContent.replace( rcleanScript, "" ) );
-							}
-						}
-					}
-				}
-			}
-		}
-
-		return this;
-	}
-});
-
-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: QtWebKit
-			// .get() because push.apply(_, arraylike) throws
-			push.apply( ret, elems.get() );
-		}
-
-		return this.pushStack( ret );
-	};
-});
-
-
-var iframe,
-	elemdisplay = {};
-
-/**
- * Retrieve the actual display of a element
- * @param {String} name nodeName of the element
- * @param {Object} doc Document object
- */
-// Called only from within defaultDisplay
-function actualDisplay( name, doc ) {
-	var style,
-		elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
-
-		// getDefaultComputedStyle might be reliably used only on attached element
-		display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
-
-			// Use of this method is a temporary fix (more like optmization) until something better comes along,
-			// since it was removed from specification and supported only in FF
-			style.display : jQuery.css( elem[ 0 ], "display" );
-
-	// We don't have any data stored on the element,
-	// so use "detach" method as fast way to get rid of the element
-	elem.detach();
-
-	return display;
-}
-
-/**
- * Try to determine the default display value of an element
- * @param {String} nodeName
- */
-function defaultDisplay( nodeName ) {
-	var doc = document,
-		display = elemdisplay[ nodeName ];
-
-	if ( !display ) {
-		display = actualDisplay( nodeName, doc );
-
-		// If the simple way fails, read from inside an iframe
-		if ( display === "none" || !display ) {
-
-			// Use the already-created iframe if possible
-			iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement );
-
-			// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
-			doc = iframe[ 0 ].contentDocument;
-
-			// Support: IE
-			doc.write();
-			doc.close();
-
-			display = actualDisplay( nodeName, doc );
-			iframe.detach();
-		}
-
-		// Store the correct default display
-		elemdisplay[ nodeName ] = display;
-	}
-
-	return display;
-}
-var rmargin = (/^margin/);
-
-var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
-
-var getStyles = function( elem ) {
-		return elem.ownerDocument.defaultView.getComputedStyle( elem, null );
-	};
-
-
-
-function curCSS( elem, name, computed ) {
-	var width, minWidth, maxWidth, ret,
-		style = elem.style;
-
-	computed = computed || getStyles( elem );
-
-	// Support: IE9
-	// getPropertyValue is only needed for .css('filter') in IE9, see #12537
-	if ( computed ) {
-		ret = computed.getPropertyValue( name ) || computed[ name ];
-	}
-
-	if ( computed ) {
-
-		if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
-			ret = jQuery.style( elem, name );
-		}
-
-		// Support: iOS < 6
-		// A tribute to the "awesome hack by Dean Edwards"
-		// iOS < 6 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
-		// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
-		if ( rnumnonpx.test( ret ) && rmargin.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
-		// 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.
-				// Since there are no other hooks for marginRight, remove the whole object.
-				delete this.get;
-				return;
-			}
-
-			// Hook needed; redefine it so that the support test is not executed again.
-
-			return (this.get = hookFn).apply( this, arguments );
-		}
-	};
-}
-
-
-(function() {
-	var pixelPositionVal, boxSizingReliableVal,
-		docElem = document.documentElement,
-		container = document.createElement( "div" ),
-		div = document.createElement( "div" );
-
-	if ( !div.style ) {
-		return;
-	}
-
-	div.style.backgroundClip = "content-box";
-	div.cloneNode( true ).style.backgroundClip = "";
-	support.clearCloneStyle = div.style.backgroundClip === "content-box";
-
-	container.style.cssText = "border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;" +
-		"position:absolute";
-	container.appendChild( div );
-
-	// Executing both pixelPosition & boxSizingReliable tests require only one layout
-	// so they're executed at the same time to save the second computation.
-	function computePixelPositionAndBoxSizingReliable() {
-		div.style.cssText =
-			// Support: Firefox<29, Android 2.3
-			// Vendor-prefix box-sizing
-			"-webkit-box-sizing:border-box;-moz-box-sizing:border-box;" +
-			"box-sizing:border-box;display:block;margin-top:1%;top:1%;" +
-			"border:1px;padding:1px;width:4px;position:absolute";
-		div.innerHTML = "";
-		docElem.appendChild( container );
-
-		var divStyle = window.getComputedStyle( div, null );
-		pixelPositionVal = divStyle.top !== "1%";
-		boxSizingReliableVal = divStyle.width === "4px";
-
-		docElem.removeChild( container );
-	}
-
-	// Support: node.js jsdom
-	// Don't assume that getComputedStyle is a property of the global object
-	if ( window.getComputedStyle ) {
-		jQuery.extend( support, {
-			pixelPosition: function() {
-				// This test is executed only once but we still do memoizing
-				// since we can use the boxSizingReliable pre-computing.
-				// No need to check if the test was already performed, though.
-				computePixelPositionAndBoxSizingReliable();
-				return pixelPositionVal;
-			},
-			boxSizingReliable: function() {
-				if ( boxSizingReliableVal == null ) {
-					computePixelPositionAndBoxSizingReliable();
-				}
-				return boxSizingReliableVal;
-			},
-			reliableMarginRight: function() {
-				// Support: Android 2.3
-				// Check if div with explicit width and no margin-right incorrectly
-				// gets computed margin-right based on width of container. (#3333)
-				// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
-				// This support function is only executed once so no memoizing is needed.
-				var ret,
-					marginDiv = div.appendChild( document.createElement( "div" ) );
-
-				// Reset CSS: box-sizing; display; margin; border; padding
-				marginDiv.style.cssText = div.style.cssText =
-					// Support: Firefox<29, Android 2.3
-					// Vendor-prefix box-sizing
-					"-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" +
-					"box-sizing:content-box;display:block;margin:0;border:0;padding:0";
-				marginDiv.style.marginRight = marginDiv.style.width = "0";
-				div.style.width = "1px";
-				docElem.appendChild( container );
-
-				ret = !parseFloat( window.getComputedStyle( marginDiv, null ).marginRight );
-
-				docElem.removeChild( container );
-
-				return ret;
-			}
-		});
-	}
-})();
-
-
-// A method for quickly swapping in/out CSS properties to get correct calculations.
-jQuery.swap = function( elem, options, callback, args ) {
-	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.apply( elem, args || [] );
-
-	// Revert the old values
-	for ( name in options ) {
-		elem.style[ name ] = old[ name ];
-	}
-
-	return ret;
-};
-
-
-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]).+)/,
-	rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
-	rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
-
-	cssShow = { position: "absolute", visibility: "hidden", display: "block" },
-	cssNormalTransform = {
-		letterSpacing: "0",
-		fontWeight: "400"
-	},
-
-	cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
-
-// return a css property mapped to a potentially vendor prefixed property
-function vendorPropName( style, name ) {
-
-	// shortcut for names that are not vendor prefixed
-	if ( name in style ) {
-		return name;
-	}
-
-	// check for vendor prefixed names
-	var capName = name[0].toUpperCase() + name.slice(1),
-		origName = name,
-		i = cssPrefixes.length;
-
-	while ( i-- ) {
-		name = cssPrefixes[ i ] + capName;
-		if ( name in style ) {
-			return name;
-		}
-	}
-
-	return origName;
-}
-
-function setPositiveNumber( elem, value, subtract ) {
-	var matches = rnumsplit.exec( value );
-	return matches ?
-		// Guard against undefined "subtract", e.g., when used as in cssHooks
-		Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
-		value;
-}
-
-function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
-	var i = extra === ( isBorderBox ? "border" : "content" ) ?
-		// If we already have the right measurement, avoid augmentation
-		4 :
-		// Otherwise initialize for horizontal or vertical properties
-		name === "width" ? 1 : 0,
-
-		val = 0;
-
-	for ( ; i < 4; i += 2 ) {
-		// both box models exclude margin, so add it if we want it
-		if ( extra === "margin" ) {
-			val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
-		}
-
-		if ( isBorderBox ) {
-			// border-box includes padding, so remove it if we want content
-			if ( extra === "content" ) {
-				val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
-			}
-
-			// at this point, extra isn't border nor margin, so remove border
-			if ( extra !== "margin" ) {
-				val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
-			}
-		} else {
-			// at this point, extra isn't content, so add padding
-			val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
-
-			// at this point, extra isn't content nor padding, so add border
-			if ( extra !== "padding" ) {
-				val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
-			}
-		}
-	}
-
-	return val;
-}
-
-function getWidthOrHeight( elem, name, extra ) {
-
-	// Start with offset property, which is equivalent to the border-box value
-	var valueIsBorderBox = true,
-		val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
-		styles = getStyles( elem ),
-		isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
-
-	// some non-html elements return undefined for offsetWidth, so check for null/undefined
-	// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
-	// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
-	if ( val <= 0 || val == null ) {
-		// Fall back to computed then uncomputed css if necessary
-		val = curCSS( elem, name, styles );
-		if ( val < 0 || val == null ) {
-			val = elem.style[ name ];
-		}
-
-		// Computed unit is not pixels. Stop here and return.
-		if ( rnumnonpx.test(val) ) {
-			return val;
-		}
-
-		// we need the check for style in case a browser which returns unreliable values
-		// for getComputedStyle silently falls back to the reliable elem.style
-		valueIsBorderBox = isBorderBox &&
-			( support.boxSizingReliable() || val === elem.style[ name ] );
-
-		// Normalize "", auto, and prepare for extra
-		val = parseFloat( val ) || 0;
-	}
-
-	// use the active box-sizing model to add/subtract irrelevant styles
-	return ( val +
-		augmentWidthOrHeight(
-			elem,
-			name,
-			extra || ( isBorderBox ? "border" : "content" ),
-			valueIsBorderBox,
-			styles
-		)
-	) + "px";
-}
-
-function showHide( elements, show ) {
-	var display, elem, hidden,
-		values = [],
-		index = 0,
-		length = elements.length;
-
-	for ( ; index < length; index++ ) {
-		elem = elements[ index ];
-		if ( !elem.style ) {
-			continue;
-		}
-
-		values[ index ] = data_priv.get( elem, "olddisplay" );
-		display = elem.style.display;
-		if ( show ) {
-			// Reset the inline display of this element to learn if it is
-			// being hidden by cascaded rules or not
-			if ( !values[ index ] && display === "none" ) {
-				elem.style.display = "";
-			}
-
-			// Set elements which have been overridden with display: none
-			// in a stylesheet to whatever the default browser style is
-			// for such an element
-			if ( elem.style.display === "" && isHidden( elem ) ) {
-				values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) );
-			}
-		} else {
-			hidden = isHidden( elem );
-
-			if ( display !== "none" || !hidden ) {
-				data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) );
-			}
-		}
-	}
-
-	// Set the display of most of the elements in a second loop
-	// to avoid the constant reflow
-	for ( index = 0; index < length; index++ ) {
-		elem = elements[ index ];
-		if ( !elem.style ) {
-			continue;
-		}
-		if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
-			elem.style.display = show ? values[ index ] || "" : "none";
-		}
-	}
-
-	return elements;
-}
-
-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: {
-		"columnCount": true,
-		"fillOpacity": true,
-		"flexGrow": true,
-		"flexShrink": true,
-		"fontWeight": 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: {
-		// normalize float css property
-		"float": "cssFloat"
-	},
-
-	// 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 = jQuery.camelCase( name ),
-			style = elem.style;
-
-		name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
-
-		// gets hook for the prefixed version
-		// followed by the unprefixed version
-		hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
-
-		// Check if we're setting a value
-		if ( value !== undefined ) {
-			type = typeof value;
-
-			// convert relative number strings (+= or -=) to relative numbers. #7345
-			if ( type === "string" && (ret = rrelNum.exec( value )) ) {
-				value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
-				// Fixes bug #9237
-				type = "number";
-			}
-
-			// Make sure that null and NaN values aren't set. See: #7116
-			if ( value == null || value !== value ) {
-				return;
-			}
-
-			// If a number was passed in, add 'px' to the (except for certain CSS properties)
-			if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
-				value += "px";
-			}
-
-			// Fixes #8908, it can be done more correctly by specifying setters in cssHooks,
-			// but it would mean to define eight (for every problematic property) identical functions
-			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 ) {
-				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 = jQuery.camelCase( name );
-
-		// Make sure that we're working with the right name
-		name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
-
-		// gets hook for the prefixed version
-		// followed by the unprefixed version
-		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 ];
-		}
-
-		// Return, converting to number if forced or a qualifier was provided and val looks numeric
-		if ( extra === "" || extra ) {
-			num = parseFloat( val );
-			return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
-		}
-		return val;
-	}
-});
-
-jQuery.each([ "height", "width" ], function( i, name ) {
-	jQuery.cssHooks[ name ] = {
-		get: function( elem, computed, extra ) {
-			if ( computed ) {
-				// certain elements can have dimension info if we invisibly show them
-				// however, it must have a current display style that would benefit from this
-				return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ?
-					jQuery.swap( elem, cssShow, function() {
-						return getWidthOrHeight( elem, name, extra );
-					}) :
-					getWidthOrHeight( elem, name, extra );
-			}
-		},
-
-		set: function( elem, value, extra ) {
-			var styles = extra && getStyles( elem );
-			return setPositiveNumber( elem, value, extra ?
-				augmentWidthOrHeight(
-					elem,
-					name,
-					extra,
-					jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
-					styles
-				) : 0
-			);
-		}
-	};
-});
-
-// Support: Android 2.3
-jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
-	function( elem, computed ) {
-		if ( computed ) {
-			// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
-			// Work around by temporarily setting element display to inline-block
-			return jQuery.swap( elem, { "display": "inline-block" },
-				curCSS, [ elem, "marginRight" ] );
-		}
-	}
-);
-
-// 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 ( !rmargin.test( prefix ) ) {
-		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 ( jQuery.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 );
-	},
-	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 ( isHidden( this ) ) {
-				jQuery( this ).show();
-			} else {
-				jQuery( this ).hide();
-			}
-		});
-	}
-});
-
-
-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 || "swing";
-		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;
-
-			if ( tween.elem[ tween.prop ] != null &&
-				(!tween.elem.style || 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
-			// so, 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 its
-			// available and use plain properties where available
-			if ( jQuery.fx.step[ tween.prop ] ) {
-				jQuery.fx.step[ tween.prop ]( tween );
-			} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
-				jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
-			} else {
-				tween.elem[ tween.prop ] = tween.now;
-			}
-		}
-	}
-};
-
-// Support: IE9
-// 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;
-	}
-};
-
-jQuery.fx = Tween.prototype.init;
-
-// Back Compat <1.8 extension point
-jQuery.fx.step = {};
-
-
-
-
-var
-	fxNow, timerId,
-	rfxtypes = /^(?:toggle|show|hide)$/,
-	rfxnum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ),
-	rrun = /queueHooks$/,
-	animationPrefilters = [ defaultPrefilter ],
-	tweeners = {
-		"*": [ function( prop, value ) {
-			var tween = this.createTween( prop, value ),
-				target = tween.cur(),
-				parts = rfxnum.exec( value ),
-				unit = parts && parts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
-
-				// Starting value computation is required for potential unit mismatches
-				start = ( jQuery.cssNumber[ prop ] || unit !== "px" && +target ) &&
-					rfxnum.exec( jQuery.css( tween.elem, prop ) ),
-				scale = 1,
-				maxIterations = 20;
-
-			if ( start && start[ 3 ] !== unit ) {
-				// Trust units reported by jQuery.css
-				unit = unit || start[ 3 ];
-
-				// Make sure we update the tween properties later on
-				parts = parts || [];
-
-				// Iteratively approximate from a nonzero starting point
-				start = +target || 1;
-
-				do {
-					// If previous iteration zeroed out, double until we get *something*
-					// Use a string for doubling factor so we don't accidentally see scale as unchanged below
-					scale = scale || ".5";
-
-					// Adjust and apply
-					start = start / scale;
-					jQuery.style( tween.elem, prop, start + unit );
-
-				// Update scale, tolerating zero or NaN from tween.cur()
-				// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
-				} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
-			}
-
-			// Update tween properties
-			if ( parts ) {
-				start = tween.start = +start || +target || 0;
-				tween.unit = unit;
-				// If a +=/-= token was provided, we're doing a relative animation
-				tween.end = parts[ 1 ] ?
-					start + ( parts[ 1 ] + 1 ) * parts[ 2 ] :
-					+parts[ 2 ];
-			}
-
-			return tween;
-		} ]
-	};
-
-// Animations created synchronously will run synchronously
-function createFxNow() {
-	setTimeout(function() {
-		fxNow = undefined;
-	});
-	return ( fxNow = jQuery.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,
-	// if we don't include width, 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 = ( tweeners[ prop ] || [] ).concat( 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 ) {
-	/* jshint validthis: true */
-	var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay,
-		anim = this,
-		orig = {},
-		style = elem.style,
-		hidden = elem.nodeType && isHidden( elem ),
-		dataShow = data_priv.get( elem, "fxshow" );
-
-	// handle queue: false promises
-	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() {
-			// doing this makes sure that the complete handler will be called
-			// before this completes
-			anim.always(function() {
-				hooks.unqueued--;
-				if ( !jQuery.queue( elem, "fx" ).length ) {
-					hooks.empty.fire();
-				}
-			});
-		});
-	}
-
-	// height/width overflow pass
-	if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
-		// Make sure that nothing sneaks out
-		// Record all 3 overflow attributes because IE9-10 do not
-		// change the overflow attribute when overflowX and
-		// overflowY are set to the same value
-		opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
-
-		// Set display property to inline-block for height/width
-		// animations on inline elements that are having width/height animated
-		display = jQuery.css( elem, "display" );
-
-		// Test default display if display is currently "none"
-		checkDisplay = display === "none" ?
-			data_priv.get( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display;
-
-		if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) {
-			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 ];
-		});
-	}
-
-	// show/hide pass
-	for ( prop in props ) {
-		value = props[ prop ];
-		if ( rfxtypes.exec( value ) ) {
-			delete props[ prop ];
-			toggle = toggle || value === "toggle";
-			if ( value === ( hidden ? "hide" : "show" ) ) {
-
-				// If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden
-				if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
-					hidden = true;
-				} else {
-					continue;
-				}
-			}
-			orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
-
-		// Any non-fx value stops us from restoring the original display value
-		} else {
-			display = undefined;
-		}
-	}
-
-	if ( !jQuery.isEmptyObject( orig ) ) {
-		if ( dataShow ) {
-			if ( "hidden" in dataShow ) {
-				hidden = dataShow.hidden;
-			}
-		} else {
-			dataShow = data_priv.access( elem, "fxshow", {} );
-		}
-
-		// store state if its toggle - enables .stop().toggle() to "reverse"
-		if ( toggle ) {
-			dataShow.hidden = !hidden;
-		}
-		if ( hidden ) {
-			jQuery( elem ).show();
-		} else {
-			anim.done(function() {
-				jQuery( elem ).hide();
-			});
-		}
-		anim.done(function() {
-			var prop;
-
-			data_priv.remove( elem, "fxshow" );
-			for ( prop in orig ) {
-				jQuery.style( elem, prop, orig[ prop ] );
-			}
-		});
-		for ( prop in orig ) {
-			tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
-
-			if ( !( prop in dataShow ) ) {
-				dataShow[ prop ] = tween.start;
-				if ( hidden ) {
-					tween.end = tween.start;
-					tween.start = prop === "width" || prop === "height" ? 1 : 0;
-				}
-			}
-		}
-
-	// If this is a noop like .hide().hide(), restore an overwritten display value
-	} else if ( (display === "none" ? defaultDisplay( elem.nodeName ) : display) === "inline" ) {
-		style.display = display;
-	}
-}
-
-function propFilter( props, specialEasing ) {
-	var index, name, easing, value, hooks;
-
-	// camelCase, specialEasing and expand cssHook pass
-	for ( index in props ) {
-		name = jQuery.camelCase( index );
-		easing = specialEasing[ name ];
-		value = props[ index ];
-		if ( jQuery.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 wont overwrite keys already present.
-			// also - reusing 'index' from above 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 = animationPrefilters.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 ),
-				// 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 ( percent < 1 && length ) {
-				return remaining;
-			} else {
-				deferred.resolveWith( elem, [ animation ] );
-				return false;
-			}
-		},
-		animation = deferred.promise({
-			elem: elem,
-			props: jQuery.extend( {}, properties ),
-			opts: jQuery.extend( true, { specialEasing: {} }, 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.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 = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
-		if ( result ) {
-			return result;
-		}
-	}
-
-	jQuery.map( props, createTween, animation );
-
-	if ( jQuery.isFunction( animation.opts.start ) ) {
-		animation.opts.start.call( elem, animation );
-	}
-
-	jQuery.fx.timer(
-		jQuery.extend( tick, {
-			elem: elem,
-			anim: animation,
-			queue: animation.opts.queue
-		})
-	);
-
-	// attach callbacks from options
-	return animation.progress( animation.opts.progress )
-		.done( animation.opts.done, animation.opts.complete )
-		.fail( animation.opts.fail )
-		.always( animation.opts.always );
-}
-
-jQuery.Animation = jQuery.extend( Animation, {
-
-	tweener: function( props, callback ) {
-		if ( jQuery.isFunction( props ) ) {
-			callback = props;
-			props = [ "*" ];
-		} else {
-			props = props.split(" ");
-		}
-
-		var prop,
-			index = 0,
-			length = props.length;
-
-		for ( ; index < length ; index++ ) {
-			prop = props[ index ];
-			tweeners[ prop ] = tweeners[ prop ] || [];
-			tweeners[ prop ].unshift( callback );
-		}
-	},
-
-	prefilter: function( callback, prepend ) {
-		if ( prepend ) {
-			animationPrefilters.unshift( callback );
-		} else {
-			animationPrefilters.push( callback );
-		}
-	}
-});
-
-jQuery.speed = function( speed, easing, fn ) {
-	var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
-		complete: fn || !fn && easing ||
-			jQuery.isFunction( speed ) && speed,
-		duration: speed,
-		easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
-	};
-
-	opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
-		opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ 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 ( jQuery.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( isHidden ).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 || data_priv.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 && type !== false ) {
-			this.queue( type || "fx", [] );
-		}
-
-		return this.each(function() {
-			var dequeue = true,
-				index = type != null && type + "queueHooks",
-				timers = jQuery.timers,
-				data = data_priv.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 = data_priv.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 = jQuery.now();
-
-	for ( ; i < timers.length; i++ ) {
-		timer = timers[ i ];
-		// Checks the timer has not already been removed
-		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 );
-	if ( timer() ) {
-		jQuery.fx.start();
-	} else {
-		jQuery.timers.pop();
-	}
-};
-
-jQuery.fx.interval = 13;
-
-jQuery.fx.start = function() {
-	if ( !timerId ) {
-		timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
-	}
-};
-
-jQuery.fx.stop = function() {
-	clearInterval( timerId );
-	timerId = null;
-};
-
-jQuery.fx.speeds = {
-	slow: 600,
-	fast: 200,
-	// Default speed
-	_default: 400
-};
-
-
-// Based off of the plugin by Clint Helfers, with permission.
-// 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 = setTimeout( next, time );
-		hooks.stop = function() {
-			clearTimeout( timeout );
-		};
-	});
-};
-
-
-(function() {
-	var input = document.createElement( "input" ),
-		select = document.createElement( "select" ),
-		opt = select.appendChild( document.createElement( "option" ) );
-
-	input.type = "checkbox";
-
-	// Support: iOS 5.1, Android 4.x, Android 2.3
-	// Check the default checkbox/radio value ("" on old WebKit; "on" elsewhere)
-	support.checkOn = input.value !== "";
-
-	// Must access the parent to make an option select properly
-	// Support: IE9, IE10
-	support.optSelected = opt.selected;
-
-	// Make sure that the options inside disabled selects aren't marked as disabled
-	// (WebKit marks them as disabled)
-	select.disabled = true;
-	support.optDisabled = !opt.disabled;
-
-	// Check if an input maintains its value after becoming a radio
-	// Support: IE9, IE10
-	input = document.createElement( "input" );
-	input.value = "t";
-	input.type = "radio";
-	support.radioValue = input.value === "t";
-})();
-
-
-var nodeHook, 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 hooks, ret,
-			nType = elem.nodeType;
-
-		// don't get/set attributes on text, comment and attribute nodes
-		if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
-			return;
-		}
-
-		// Fallback to prop when attributes are not supported
-		if ( typeof elem.getAttribute === strundefined ) {
-			return jQuery.prop( elem, name, value );
-		}
-
-		// All attributes are lowercase
-		// Grab necessary hook if one is defined
-		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
-			name = name.toLowerCase();
-			hooks = jQuery.attrHooks[ name ] ||
-				( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook );
-		}
-
-		if ( value !== undefined ) {
-
-			if ( value === null ) {
-				jQuery.removeAttr( elem, name );
-
-			} else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
-				return ret;
-
-			} else {
-				elem.setAttribute( name, value + "" );
-				return value;
-			}
-
-		} else if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
-			return ret;
-
-		} else {
-			ret = jQuery.find.attr( elem, name );
-
-			// Non-existent attributes return null, we normalize to undefined
-			return ret == null ?
-				undefined :
-				ret;
-		}
-	},
-
-	removeAttr: function( elem, value ) {
-		var name, propName,
-			i = 0,
-			attrNames = value && value.match( rnotwhite );
-
-		if ( attrNames && elem.nodeType === 1 ) {
-			while ( (name = attrNames[i++]) ) {
-				propName = jQuery.propFix[ name ] || name;
-
-				// Boolean attributes get special treatment (#10870)
-				if ( jQuery.expr.match.bool.test( name ) ) {
-					// Set corresponding property to false
-					elem[ propName ] = false;
-				}
-
-				elem.removeAttribute( name );
-			}
-		}
-	},
-
-	attrHooks: {
-		type: {
-			set: function( elem, value ) {
-				if ( !support.radioValue && value === "radio" &&
-					jQuery.nodeName( elem, "input" ) ) {
-					// Setting the type on a radio button after the value resets the value in IE6-9
-					// Reset value to default in case type is set after value during creation
-					var val = elem.value;
-					elem.setAttribute( "type", value );
-					if ( val ) {
-						elem.value = val;
-					}
-					return value;
-				}
-			}
-		}
-	}
-});
-
-// 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;
-		if ( !isXML ) {
-			// Avoid an infinite loop by temporarily removing this function from the getter
-			handle = attrHandle[ name ];
-			attrHandle[ name ] = ret;
-			ret = getter( elem, name, isXML ) != null ?
-				name.toLowerCase() :
-				null;
-			attrHandle[ name ] = handle;
-		}
-		return ret;
-	};
-});
-
-
-
-
-var rfocusable = /^(?:input|select|textarea|button)$/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({
-	propFix: {
-		"for": "htmlFor",
-		"class": "className"
-	},
-
-	prop: function( elem, name, value ) {
-		var ret, hooks, notxml,
-			nType = elem.nodeType;
-
-		// don't get/set properties on text, comment and attribute nodes
-		if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
-			return;
-		}
-
-		notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
-		if ( notxml ) {
-			// Fix name and attach hooks
-			name = jQuery.propFix[ name ] || name;
-			hooks = jQuery.propHooks[ name ];
-		}
-
-		if ( value !== undefined ) {
-			return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ?
-				ret :
-				( elem[ name ] = value );
-
-		} else {
-			return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
-				ret :
-				elem[ name ];
-		}
-	},
-
-	propHooks: {
-		tabIndex: {
-			get: function( elem ) {
-				return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ?
-					elem.tabIndex :
-					-1;
-			}
-		}
-	}
-});
-
-// Support: IE9+
-// Selectedness for an option in an optgroup can be inaccurate
-if ( !support.optSelected ) {
-	jQuery.propHooks.selected = {
-		get: function( elem ) {
-			var parent = elem.parentNode;
-			if ( parent && parent.parentNode ) {
-				parent.parentNode.selectedIndex;
-			}
-			return null;
-		}
-	};
-}
-
-jQuery.each([
-	"tabIndex",
-	"readOnly",
-	"maxLength",
-	"cellSpacing",
-	"cellPadding",
-	"rowSpan",
-	"colSpan",
-	"useMap",
-	"frameBorder",
-	"contentEditable"
-], function() {
-	jQuery.propFix[ this.toLowerCase() ] = this;
-});
-
-
-
-
-var rclass = /[\t\r\n\f]/g;
-
-jQuery.fn.extend({
-	addClass: function( value ) {
-		var classes, elem, cur, clazz, j, finalValue,
-			proceed = typeof value === "string" && value,
-			i = 0,
-			len = this.length;
-
-		if ( jQuery.isFunction( value ) ) {
-			return this.each(function( j ) {
-				jQuery( this ).addClass( value.call( this, j, this.className ) );
-			});
-		}
-
-		if ( proceed ) {
-			// The disjunction here is for better compressibility (see removeClass)
-			classes = ( value || "" ).match( rnotwhite ) || [];
-
-			for ( ; i < len; i++ ) {
-				elem = this[ i ];
-				cur = elem.nodeType === 1 && ( elem.className ?
-					( " " + elem.className + " " ).replace( rclass, " " ) :
-					" "
-				);
-
-				if ( cur ) {
-					j = 0;
-					while ( (clazz = classes[j++]) ) {
-						if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
-							cur += clazz + " ";
-						}
-					}
-
-					// only assign if different to avoid unneeded rendering.
-					finalValue = jQuery.trim( cur );
-					if ( elem.className !== finalValue ) {
-						elem.className = finalValue;
-					}
-				}
-			}
-		}
-
-		return this;
-	},
-
-	removeClass: function( value ) {
-		var classes, elem, cur, clazz, j, finalValue,
-			proceed = arguments.length === 0 || typeof value === "string" && value,
-			i = 0,
-			len = this.length;
-
-		if ( jQuery.isFunction( value ) ) {
-			return this.each(function( j ) {
-				jQuery( this ).removeClass( value.call( this, j, this.className ) );
-			});
-		}
-		if ( proceed ) {
-			classes = ( value || "" ).match( rnotwhite ) || [];
-
-			for ( ; i < len; i++ ) {
-				elem = this[ i ];
-				// This expression is here for better compressibility (see addClass)
-				cur = elem.nodeType === 1 && ( elem.className ?
-					( " " + elem.className + " " ).replace( rclass, " " ) :
-					""
-				);
-
-				if ( cur ) {
-					j = 0;
-					while ( (clazz = classes[j++]) ) {
-						// Remove *all* instances
-						while ( cur.indexOf( " " + clazz + " " ) >= 0 ) {
-							cur = cur.replace( " " + clazz + " ", " " );
-						}
-					}
-
-					// only assign if different to avoid unneeded rendering.
-					finalValue = value ? jQuery.trim( cur ) : "";
-					if ( elem.className !== finalValue ) {
-						elem.className = finalValue;
-					}
-				}
-			}
-		}
-
-		return this;
-	},
-
-	toggleClass: function( value, stateVal ) {
-		var type = typeof value;
-
-		if ( typeof stateVal === "boolean" && type === "string" ) {
-			return stateVal ? this.addClass( value ) : this.removeClass( value );
-		}
-
-		if ( jQuery.isFunction( value ) ) {
-			return this.each(function( i ) {
-				jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
-			});
-		}
-
-		return this.each(function() {
-			if ( type === "string" ) {
-				// toggle individual class names
-				var className,
-					i = 0,
-					self = jQuery( this ),
-					classNames = value.match( rnotwhite ) || [];
-
-				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 ( type === strundefined || type === "boolean" ) {
-				if ( this.className ) {
-					// store className if set
-					data_priv.set( this, "__className__", this.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.
-				this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || "";
-			}
-		});
-	},
-
-	hasClass: function( selector ) {
-		var className = " " + selector + " ",
-			i = 0,
-			l = this.length;
-		for ( ; i < l; i++ ) {
-			if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
-				return true;
-			}
-		}
-
-		return false;
-	}
-});
-
-
-
-
-var rreturn = /\r/g;
-
-jQuery.fn.extend({
-	val: function( value ) {
-		var hooks, ret, isFunction,
-			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;
-
-				return typeof ret === "string" ?
-					// handle most common string cases
-					ret.replace(rreturn, "") :
-					// handle cases where value is null/undef or number
-					ret == null ? "" : ret;
-			}
-
-			return;
-		}
-
-		isFunction = jQuery.isFunction( value );
-
-		return this.each(function( i ) {
-			var val;
-
-			if ( this.nodeType !== 1 ) {
-				return;
-			}
-
-			if ( isFunction ) {
-				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 ( jQuery.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: IE10-11+
-					// option.text throws exceptions (#14686, #14858)
-					jQuery.trim( jQuery.text( elem ) );
-			}
-		},
-		select: {
-			get: function( elem ) {
-				var value, option,
-					options = elem.options,
-					index = elem.selectedIndex,
-					one = elem.type === "select-one" || index < 0,
-					values = one ? null : [],
-					max = one ? index + 1 : options.length,
-					i = index < 0 ?
-						max :
-						one ? index : 0;
-
-				// Loop through all the selected options
-				for ( ; i < max; i++ ) {
-					option = options[ i ];
-
-					// IE6-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
-							( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) &&
-							( !option.parentNode.disabled || !jQuery.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 ];
-					if ( (option.selected = jQuery.inArray( option.value, values ) >= 0) ) {
-						optionSet = true;
-					}
-				}
-
-				// 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 ( jQuery.isArray( value ) ) {
-				return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
-			}
-		}
-	};
-	if ( !support.checkOn ) {
-		jQuery.valHooks[ this ].get = function( elem ) {
-			// Support: Webkit
-			// "" is returned instead of "on" if a value isn't specified
-			return elem.getAttribute("value") === null ? "on" : elem.value;
-		};
-	}
-});
-
-
-
-
-// Return jQuery for attributes-only inclusion
-
-
-jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
-	"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
-	"change select submit keydown keypress keyup error 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 );
-	};
-});
-
-jQuery.fn.extend({
-	hover: function( fnOver, fnOut ) {
-		return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
-	},
-
-	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 );
-	}
-});
-
-
-var nonce = jQuery.now();
-
-var rquery = (/\?/);
-
-
-
-// Support: Android 2.3
-// Workaround failure to string-cast null input
-jQuery.parseJSON = function( data ) {
-	return JSON.parse( data + "" );
-};
-
-
-// Cross-browser xml parsing
-jQuery.parseXML = function( data ) {
-	var xml, tmp;
-	if ( !data || typeof data !== "string" ) {
-		return null;
-	}
-
-	// Support: IE9
-	try {
-		tmp = new DOMParser();
-		xml = tmp.parseFromString( data, "text/xml" );
-	} catch ( e ) {
-		xml = undefined;
-	}
-
-	if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
-		jQuery.error( "Invalid XML: " + data );
-	}
-	return xml;
-};
-
-
-var
-	// Document location
-	ajaxLocParts,
-	ajaxLocation,
-
-	rhash = /#.*$/,
-	rts = /([?&])_=[^&]*/,
-	rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
-	// #7653, #8125, #8152: local protocol detection
-	rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
-	rnoContent = /^(?:GET|HEAD)$/,
-	rprotocol = /^\/\//,
-	rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,
-
-	/* 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("*");
-
-// #8138, IE may throw an exception when accessing
-// a field from window.location if document.domain has been set
-try {
-	ajaxLocation = location.href;
-} catch( e ) {
-	// Use the href attribute of an A element
-	// since IE will modify it given document.location
-	ajaxLocation = document.createElement( "a" );
-	ajaxLocation.href = "";
-	ajaxLocation = ajaxLocation.href;
-}
-
-// Segment location into parts
-ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
-
-// 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( rnotwhite ) || [];
-
-		if ( jQuery.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: ajaxLocation,
-		type: "GET",
-		isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
-		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: /xml/,
-			html: /html/,
-			json: /json/
-		},
-
-		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": jQuery.parseJSON,
-
-			// 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,
-			// Cross-domain detection vars
-			parts,
-			// To know if global events are to be dispatched
-			fireGlobals,
-			// Loop variable
-			i,
-			// 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 = {},
-			// The jqXHR state
-			state = 0,
-			// Default abort message
-			strAbort = "canceled",
-			// Fake xhr
-			jqXHR = {
-				readyState: 0,
-
-				// Builds headers hashtable if needed
-				getResponseHeader: function( key ) {
-					var match;
-					if ( state === 2 ) {
-						if ( !responseHeaders ) {
-							responseHeaders = {};
-							while ( (match = rheaders.exec( responseHeadersString )) ) {
-								responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
-							}
-						}
-						match = responseHeaders[ key.toLowerCase() ];
-					}
-					return match == null ? null : match;
-				},
-
-				// Raw string
-				getAllResponseHeaders: function() {
-					return state === 2 ? responseHeadersString : null;
-				},
-
-				// Caches the header
-				setRequestHeader: function( name, value ) {
-					var lname = name.toLowerCase();
-					if ( !state ) {
-						name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
-						requestHeaders[ name ] = value;
-					}
-					return this;
-				},
-
-				// Overrides response content-type header
-				overrideMimeType: function( type ) {
-					if ( !state ) {
-						s.mimeType = type;
-					}
-					return this;
-				},
-
-				// Status-dependent callbacks
-				statusCode: function( map ) {
-					var code;
-					if ( map ) {
-						if ( state < 2 ) {
-							for ( code in map ) {
-								// Lazy-add the new callback in a way that preserves old ones
-								statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
-							}
-						} else {
-							// Execute the appropriate callbacks
-							jqXHR.always( map[ jqXHR.status ] );
-						}
-					}
-					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 ).complete = completeDeferred.add;
-		jqXHR.success = jqXHR.done;
-		jqXHR.error = jqXHR.fail;
-
-		// Remove hash character (#7531: and string promotion)
-		// 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 || ajaxLocation ) + "" ).replace( rhash, "" )
-			.replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
-
-		// Alias method option to type as per ticket #12004
-		s.type = options.method || options.type || s.method || s.type;
-
-		// Extract dataTypes list
-		s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
-
-		// A cross-domain request is in order when we have a protocol:host:port mismatch
-		if ( s.crossDomain == null ) {
-			parts = rurl.exec( s.url.toLowerCase() );
-			s.crossDomain = !!( parts &&
-				( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
-					( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !==
-						( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) )
-			);
-		}
-
-		// 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 ( state === 2 ) {
-			return jqXHR;
-		}
-
-		// We can fire global events as of now if asked to
-		fireGlobals = 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
-		cacheURL = s.url;
-
-		// More options handling for requests with no content
-		if ( !s.hasContent ) {
-
-			// If data is available, append data to url
-			if ( s.data ) {
-				cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data );
-				// #9682: remove data so that it's not used in an eventual retry
-				delete s.data;
-			}
-
-			// Add anti-cache in url if needed
-			if ( s.cache === false ) {
-				s.url = rts.test( cacheURL ) ?
-
-					// If there is already a '_' parameter, set its value
-					cacheURL.replace( rts, "$1_=" + nonce++ ) :
-
-					// Otherwise add one to the end
-					cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++;
-			}
-		}
-
-		// 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 || state === 2 ) ) {
-			// Abort if not done already and return
-			return jqXHR.abort();
-		}
-
-		// aborting is no longer a cancellation
-		strAbort = "abort";
-
-		// Install callbacks on deferreds
-		for ( i in { success: 1, error: 1, complete: 1 } ) {
-			jqXHR[ i ]( s[ i ] );
-		}
-
-		// 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 ] );
-			}
-			// Timeout
-			if ( s.async && s.timeout > 0 ) {
-				timeoutTimer = setTimeout(function() {
-					jqXHR.abort("timeout");
-				}, s.timeout );
-			}
-
-			try {
-				state = 1;
-				transport.send( requestHeaders, done );
-			} catch ( e ) {
-				// Propagate exception as error if not done
-				if ( state < 2 ) {
-					done( -1, e );
-				// Simply rethrow otherwise
-				} else {
-					throw e;
-				}
-			}
-		}
-
-		// Callback for when everything is done
-		function done( status, nativeStatusText, responses, headers ) {
-			var isSuccess, success, error, response, modified,
-				statusText = nativeStatusText;
-
-			// Called once
-			if ( state === 2 ) {
-				return;
-			}
-
-			// State is "done" now
-			state = 2;
-
-			// Clear timeout if it exists
-			if ( timeoutTimer ) {
-				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 );
-			}
-
-			// 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 {
-				// We extract error from statusText
-				// then normalize statusText and status 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 ( jQuery.isFunction( data ) ) {
-			type = type || callback;
-			callback = data;
-			data = undefined;
-		}
-
-		return jQuery.ajax({
-			url: url,
-			type: method,
-			dataType: type,
-			data: data,
-			success: callback
-		});
-	};
-});
-
-// Attach a bunch of functions for handling common AJAX events
-jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
-	jQuery.fn[ type ] = function( fn ) {
-		return this.on( type, fn );
-	};
-});
-
-
-jQuery._evalUrl = function( url ) {
-	return jQuery.ajax({
-		url: url,
-		type: "GET",
-		dataType: "script",
-		async: false,
-		global: false,
-		"throws": true
-	});
-};
-
-
-jQuery.fn.extend({
-	wrapAll: function( html ) {
-		var wrap;
-
-		if ( jQuery.isFunction( html ) ) {
-			return this.each(function( i ) {
-				jQuery( this ).wrapAll( html.call(this, i) );
-			});
-		}
-
-		if ( 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 ( jQuery.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 isFunction = jQuery.isFunction( html );
-
-		return this.each(function( i ) {
-			jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
-		});
-	},
-
-	unwrap: function() {
-		return this.parent().each(function() {
-			if ( !jQuery.nodeName( this, "body" ) ) {
-				jQuery( this ).replaceWith( this.childNodes );
-			}
-		}).end();
-	}
-});
-
-
-jQuery.expr.filters.hidden = function( elem ) {
-	// Support: Opera <= 12.12
-	// Opera reports offsetWidths and offsetHeights less than zero on some elements
-	return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
-};
-jQuery.expr.filters.visible = function( elem ) {
-	return !jQuery.expr.filters.hidden( elem );
-};
-
-
-
-
-var r20 = /%20/g,
-	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 ( jQuery.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" ? i : "" ) + "]", v, traditional, add );
-			}
-		});
-
-	} else if ( !traditional && jQuery.type( 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, value ) {
-			// If value is a function, invoke it and return its value
-			value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
-			s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
-		};
-
-	// Set traditional to true for jQuery <= 1.3.2 behavior.
-	if ( traditional === undefined ) {
-		traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
-	}
-
-	// If an array was passed in, assume that it is an array of form elements.
-	if ( jQuery.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( "&" ).replace( r20, "+" );
-};
-
-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();
-
-			return val == null ?
-				null :
-				jQuery.isArray( val ) ?
-					jQuery.map( val, function( val ) {
-						return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
-					}) :
-					{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
-		}).get();
-	}
-});
-
-
-jQuery.ajaxSettings.xhr = function() {
-	try {
-		return new XMLHttpRequest();
-	} catch( e ) {}
-};
-
-var xhrId = 0,
-	xhrCallbacks = {},
-	xhrSuccessStatus = {
-		// file protocol always yields status code 0, assume 200
-		0: 200,
-		// Support: IE9
-		// #1450: sometimes IE returns 1223 when it should be 204
-		1223: 204
-	},
-	xhrSupported = jQuery.ajaxSettings.xhr();
-
-// Support: IE9
-// Open requests must be manually aborted on unload (#5280)
-if ( window.ActiveXObject ) {
-	jQuery( window ).on( "unload", function() {
-		for ( var key in xhrCallbacks ) {
-			xhrCallbacks[ key ]();
-		}
-	});
-}
-
-support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
-support.ajax = xhrSupported = !!xhrSupported;
-
-jQuery.ajaxTransport(function( options ) {
-	var callback;
-
-	// Cross domain only allowed if supported through XMLHttpRequest
-	if ( support.cors || xhrSupported && !options.crossDomain ) {
-		return {
-			send: function( headers, complete ) {
-				var i,
-					xhr = options.xhr(),
-					id = ++xhrId;
-
-				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 ) {
-							delete xhrCallbacks[ id ];
-							callback = xhr.onload = xhr.onerror = null;
-
-							if ( type === "abort" ) {
-								xhr.abort();
-							} else if ( type === "error" ) {
-								complete(
-									// file: protocol always yields status 0; see #8605, #14207
-									xhr.status,
-									xhr.statusText
-								);
-							} else {
-								complete(
-									xhrSuccessStatus[ xhr.status ] || xhr.status,
-									xhr.statusText,
-									// Support: IE9
-									// Accessing binary-data responseText throws an exception
-									// (#11426)
-									typeof xhr.responseText === "string" ? {
-										text: xhr.responseText
-									} : undefined,
-									xhr.getAllResponseHeaders()
-								);
-							}
-						}
-					};
-				};
-
-				// Listen to events
-				xhr.onload = callback();
-				xhr.onerror = callback("error");
-
-				// Create the abort callback
-				callback = xhrCallbacks[ id ] = 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();
-				}
-			}
-		};
-	}
-});
-
-
-
-
-// Install script dataType
-jQuery.ajaxSetup({
-	accepts: {
-		script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
-	},
-	contents: {
-		script: /(?:java|ecma)script/
-	},
-	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 requests
-	if ( s.crossDomain ) {
-		var script, callback;
-		return {
-			send: function( _, complete ) {
-				script = jQuery("<script>").prop({
-					async: true,
-					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 );
-						}
-					}
-				);
-				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++ ) );
-		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") && 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 = jQuery.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() {
-			// Restore preexisting value
-			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 && jQuery.isFunction( overwritten ) ) {
-				overwritten( responseContainer[ 0 ] );
-			}
-
-			responseContainer = overwritten = undefined;
-		});
-
-		// Delegate to script
-		return "script";
-	}
-});
-
-
-
-
-// data: 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 ( !data || typeof data !== "string" ) {
-		return null;
-	}
-	if ( typeof context === "boolean" ) {
-		keepScripts = context;
-		context = false;
-	}
-	context = context || document;
-
-	var parsed = rsingleTag.exec( data ),
-		scripts = !keepScripts && [];
-
-	// Single tag
-	if ( parsed ) {
-		return [ context.createElement( parsed[1] ) ];
-	}
-
-	parsed = jQuery.buildFragment( [ data ], context, scripts );
-
-	if ( scripts && scripts.length ) {
-		jQuery( scripts ).remove();
-	}
-
-	return jQuery.merge( [], parsed.childNodes );
-};
-
-
-// Keep a copy of the old load method
-var _load = jQuery.fn.load;
-
-/**
- * Load a url into a page
- */
-jQuery.fn.load = function( url, params, callback ) {
-	if ( typeof url !== "string" && _load ) {
-		return _load.apply( this, arguments );
-	}
-
-	var selector, type, response,
-		self = this,
-		off = url.indexOf(" ");
-
-	if ( off >= 0 ) {
-		selector = jQuery.trim( url.slice( off ) );
-		url = url.slice( 0, off );
-	}
-
-	// If it's a function
-	if ( jQuery.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
-			type: type,
-			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 );
-
-		}).complete( callback && function( jqXHR, status ) {
-			self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
-		});
-	}
-
-	return this;
-};
-
-
-
-
-jQuery.expr.filters.animated = function( elem ) {
-	return jQuery.grep(jQuery.timers, function( fn ) {
-		return elem === fn.elem;
-	}).length;
-};
-
-
-
-
-var docElem = window.document.documentElement;
-
-/**
- * Gets a window from an element
- */
-function getWindow( elem ) {
-	return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
-}
-
-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 ( jQuery.isFunction( options ) ) {
-			options = options.call( elem, i, 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 {
-			curElem.css( props );
-		}
-	}
-};
-
-jQuery.fn.extend({
-	offset: function( options ) {
-		if ( arguments.length ) {
-			return options === undefined ?
-				this :
-				this.each(function( i ) {
-					jQuery.offset.setOffset( this, options, i );
-				});
-		}
-
-		var docElem, win,
-			elem = this[ 0 ],
-			box = { top: 0, left: 0 },
-			doc = elem && elem.ownerDocument;
-
-		if ( !doc ) {
-			return;
-		}
-
-		docElem = doc.documentElement;
-
-		// Make sure it's not a disconnected DOM node
-		if ( !jQuery.contains( docElem, elem ) ) {
-			return box;
-		}
-
-		// If we don't have gBCR, just use 0,0 rather than error
-		// BlackBerry 5, iOS 3 (original iPhone)
-		if ( typeof elem.getBoundingClientRect !== strundefined ) {
-			box = elem.getBoundingClientRect();
-		}
-		win = getWindow( doc );
-		return {
-			top: box.top + win.pageYOffset - docElem.clientTop,
-			left: box.left + win.pageXOffset - docElem.clientLeft
-		};
-	},
-
-	position: function() {
-		if ( !this[ 0 ] ) {
-			return;
-		}
-
-		var offsetParent, offset,
-			elem = this[ 0 ],
-			parentOffset = { top: 0, left: 0 };
-
-		// Fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent
-		if ( jQuery.css( elem, "position" ) === "fixed" ) {
-			// We assume that getBoundingClientRect is available when computed position is fixed
-			offset = elem.getBoundingClientRect();
-
-		} else {
-			// Get *real* offsetParent
-			offsetParent = this.offsetParent();
-
-			// Get correct offsets
-			offset = this.offset();
-			if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
-				parentOffset = offsetParent.offset();
-			}
-
-			// Add offsetParent borders
-			parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
-			parentOffset.left += jQuery.css( offsetParent[ 0 ], "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 )
-		};
-	},
-
-	offsetParent: function() {
-		return this.map(function() {
-			var offsetParent = this.offsetParent || docElem;
-
-			while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) {
-				offsetParent = offsetParent.offsetParent;
-			}
-
-			return offsetParent || docElem;
-		});
-	}
-});
-
-// 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 ) {
-			var win = getWindow( elem );
-
-			if ( val === undefined ) {
-				return win ? win[ prop ] : elem[ method ];
-			}
-
-			if ( win ) {
-				win.scrollTo(
-					!top ? val : window.pageXOffset,
-					top ? val : window.pageYOffset
-				);
-
-			} else {
-				elem[ method ] = val;
-			}
-		}, method, val, arguments.length, null );
-	};
-});
-
-// Add the top/left cssHooks using jQuery.fn.position
-// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
-// getComputedStyle returns percent when specified for top/left/bottom/right
-// rather than make the css module depend on the offset module, we 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 ( jQuery.isWindow( elem ) ) {
-					// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
-					// isn't a whole lot we can do. See pull request at this URL for discussion:
-					// https://github.com/jquery/jquery/pull/764
-					return 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, null );
-		};
-	});
-});
-
-
-// The number of elements contained in the matched element set
-jQuery.fn.size = function() {
-	return this.length;
-};
-
-jQuery.fn.andSelf = jQuery.fn.addBack;
-
-
-
-
-// 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 === strundefined ) {
-	window.jQuery = window.$ = jQuery;
-}
-
-
-
-
-return jQuery;
-
-}));

+ 0 - 1658
src/js/lib/prettify.js

@@ -1,1658 +0,0 @@
-/** @license
-========================================================================
-  Google Code Prettify
-  Copyright (C) 2006 Google Inc.
-  
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-  
-       http://www.apache.org/licenses/LICENSE-2.0
-  
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-*/
-
-/**
- * @fileoverview
- * some functions for browser-side pretty printing of code contained in html.
- *
- * <p>
- * For a fairly comprehensive set of languages see the
- * <a href="http://google-code-prettify.googlecode.com/svn/trunk/README.html#langs">README</a>
- * file that came with this source.  At a minimum, the lexer should work on a
- * number of languages including C and friends, Java, Python, Bash, SQL, HTML,
- * XML, CSS, Javascript, and Makefiles.  It works passably on Ruby, PHP and Awk
- * and a subset of Perl, but, because of commenting conventions, doesn't work on
- * Smalltalk, Lisp-like, or CAML-like languages without an explicit lang class.
- * <p>
- * Usage: <ol>
- * <li> include this source file in an html page via
- *   {@code <script type="text/javascript" src="/path/to/prettify.js"></script>}
- * <li> define style rules.  See the example page for examples.
- * <li> mark the {@code <pre>} and {@code <code>} tags in your source with
- *    {@code class=prettyprint.}
- *    You can also use the (html deprecated) {@code <xmp>} tag, but the pretty
- *    printer needs to do more substantial DOM manipulations to support that, so
- *    some css styles may not be preserved.
- * </ol>
- * That's it.  I wanted to keep the API as simple as possible, so there's no
- * need to specify which language the code is in, but if you wish, you can add
- * another class to the {@code <pre>} or {@code <code>} element to specify the
- * language, as in {@code <pre class="prettyprint lang-java">}.  Any class that
- * starts with "lang-" followed by a file extension, specifies the file type.
- * See the "lang-*.js" files in this directory for code that implements
- * per-language file handlers.
- * <p>
- * Change log:<br>
- * cbeust, 2006/08/22
- * <blockquote>
- *   Java annotations (start with "@") are now captured as literals ("lit")
- * </blockquote>
- * @requires console
- */
-
-// JSLint declarations
-/*global console, document, navigator, setTimeout, window, define */
-
-/** @define {boolean} */
-var IN_GLOBAL_SCOPE = true;
-
-/**
- * Split {@code prettyPrint} into multiple timeouts so as not to interfere with
- * UI events.
- * If set to {@code false}, {@code prettyPrint()} is synchronous.
- */
-window['PR_SHOULD_USE_CONTINUATION'] = true;
-
-/**
- * Pretty print a chunk of code.
- * @param {string} sourceCodeHtml The HTML to pretty print.
- * @param {string} opt_langExtension The language name to use.
- *     Typically, a filename extension like 'cpp' or 'java'.
- * @param {number|boolean} opt_numberLines True to number lines,
- *     or the 1-indexed number of the first line in sourceCodeHtml.
- * @return {string} code as html, but prettier
- */
-var prettyPrintOne;
-/**
- * Find all the {@code <pre>} and {@code <code>} tags in the DOM with
- * {@code class=prettyprint} and prettify them.
- *
- * @param {Function} opt_whenDone called when prettifying is done.
- * @param {HTMLElement|HTMLDocument} opt_root an element or document
- *   containing all the elements to pretty print.
- *   Defaults to {@code document.body}.
- */
-var prettyPrint;
-
-
-(function () {
-  var win = window;
-  // Keyword lists for various languages.
-  // We use things that coerce to strings to make them compact when minified
-  // and to defeat aggressive optimizers that fold large string constants.
-  var FLOW_CONTROL_KEYWORDS = ["break,continue,do,else,for,if,return,while"];
-  var C_KEYWORDS = [FLOW_CONTROL_KEYWORDS,"auto,case,char,const,default," + 
-      "double,enum,extern,float,goto,inline,int,long,register,short,signed," +
-      "sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];
-  var COMMON_KEYWORDS = [C_KEYWORDS,"catch,class,delete,false,import," +
-      "new,operator,private,protected,public,this,throw,true,try,typeof"];
-  var CPP_KEYWORDS = [COMMON_KEYWORDS,"alignof,align_union,asm,axiom,bool," +
-      "concept,concept_map,const_cast,constexpr,decltype,delegate," +
-      "dynamic_cast,explicit,export,friend,generic,late_check," +
-      "mutable,namespace,nullptr,property,reinterpret_cast,static_assert," +
-      "static_cast,template,typeid,typename,using,virtual,where"];
-  var JAVA_KEYWORDS = [COMMON_KEYWORDS,
-      "abstract,assert,boolean,byte,extends,final,finally,implements,import," +
-      "instanceof,interface,null,native,package,strictfp,super,synchronized," +
-      "throws,transient"];
-  var CSHARP_KEYWORDS = [JAVA_KEYWORDS,
-      "as,base,by,checked,decimal,delegate,descending,dynamic,event," +
-      "fixed,foreach,from,group,implicit,in,internal,into,is,let," +
-      "lock,object,out,override,orderby,params,partial,readonly,ref,sbyte," +
-      "sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort," +
-      "var,virtual,where"];
-  var COFFEE_KEYWORDS = "all,and,by,catch,class,else,extends,false,finally," +
-      "for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then," +
-      "throw,true,try,unless,until,when,while,yes";
-  var JSCRIPT_KEYWORDS = [COMMON_KEYWORDS,
-      "debugger,eval,export,function,get,null,set,undefined,var,with," +
-      "Infinity,NaN"];
-  var PERL_KEYWORDS = "caller,delete,die,do,dump,elsif,eval,exit,foreach,for," +
-      "goto,if,import,last,local,my,next,no,our,print,package,redo,require," +
-      "sub,undef,unless,until,use,wantarray,while,BEGIN,END";
-  var PYTHON_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "and,as,assert,class,def,del," +
-      "elif,except,exec,finally,from,global,import,in,is,lambda," +
-      "nonlocal,not,or,pass,print,raise,try,with,yield," +
-      "False,True,None"];
-  var RUBY_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "alias,and,begin,case,class," +
-      "def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo," +
-      "rescue,retry,self,super,then,true,undef,unless,until,when,yield," +
-      "BEGIN,END"];
-   var RUST_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "as,assert,const,copy,drop," +
-      "enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv," +
-      "pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"];
-  var SH_KEYWORDS = [FLOW_CONTROL_KEYWORDS, "case,done,elif,esac,eval,fi," +
-      "function,in,local,set,then,until"];
-  var ALL_KEYWORDS = [
-      CPP_KEYWORDS, CSHARP_KEYWORDS, JSCRIPT_KEYWORDS, PERL_KEYWORDS,
-      PYTHON_KEYWORDS, RUBY_KEYWORDS, SH_KEYWORDS];
-  var C_TYPES = /^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;
-
-  // token style names.  correspond to css classes
-  /**
-   * token style for a string literal
-   * @const
-   */
-  var PR_STRING = 'str';
-  /**
-   * token style for a keyword
-   * @const
-   */
-  var PR_KEYWORD = 'kwd';
-  /**
-   * token style for a comment
-   * @const
-   */
-  var PR_COMMENT = 'com';
-  /**
-   * token style for a type
-   * @const
-   */
-  var PR_TYPE = 'typ';
-  /**
-   * token style for a literal value.  e.g. 1, null, true.
-   * @const
-   */
-  var PR_LITERAL = 'lit';
-  /**
-   * token style for a punctuation string.
-   * @const
-   */
-  var PR_PUNCTUATION = 'pun';
-  /**
-   * token style for plain text.
-   * @const
-   */
-  var PR_PLAIN = 'pln';
-
-  /**
-   * token style for an sgml tag.
-   * @const
-   */
-  var PR_TAG = 'tag';
-  /**
-   * token style for a markup declaration such as a DOCTYPE.
-   * @const
-   */
-  var PR_DECLARATION = 'dec';
-  /**
-   * token style for embedded source.
-   * @const
-   */
-  var PR_SOURCE = 'src';
-  /**
-   * token style for an sgml attribute name.
-   * @const
-   */
-  var PR_ATTRIB_NAME = 'atn';
-  /**
-   * token style for an sgml attribute value.
-   * @const
-   */
-  var PR_ATTRIB_VALUE = 'atv';
-
-  /**
-   * A class that indicates a section of markup that is not code, e.g. to allow
-   * embedding of line numbers within code listings.
-   * @const
-   */
-  var PR_NOCODE = 'nocode';
-
-  
-  
-  /**
-   * A set of tokens that can precede a regular expression literal in
-   * javascript
-   * http://web.archive.org/web/20070717142515/http://www.mozilla.org/js/language/js20/rationale/syntax.html
-   * has the full list, but I've removed ones that might be problematic when
-   * seen in languages that don't support regular expression literals.
-   *
-   * <p>Specifically, I've removed any keywords that can't precede a regexp
-   * literal in a syntactically legal javascript program, and I've removed the
-   * "in" keyword since it's not a keyword in many languages, and might be used
-   * as a count of inches.
-   *
-   * <p>The link above does not accurately describe EcmaScript rules since
-   * it fails to distinguish between (a=++/b/i) and (a++/b/i) but it works
-   * very well in practice.
-   *
-   * @private
-   * @const
-   */
-  var REGEXP_PRECEDER_PATTERN = '(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*';
-  
-  // CAVEAT: this does not properly handle the case where a regular
-  // expression immediately follows another since a regular expression may
-  // have flags for case-sensitivity and the like.  Having regexp tokens
-  // adjacent is not valid in any language I'm aware of, so I'm punting.
-  // TODO: maybe style special characters inside a regexp as punctuation.
-
-  /**
-   * Given a group of {@link RegExp}s, returns a {@code RegExp} that globally
-   * matches the union of the sets of strings matched by the input RegExp.
-   * Since it matches globally, if the input strings have a start-of-input
-   * anchor (/^.../), it is ignored for the purposes of unioning.
-   * @param {Array.<RegExp>} regexs non multiline, non-global regexs.
-   * @return {RegExp} a global regex.
-   */
-  function combinePrefixPatterns(regexs) {
-    var capturedGroupIndex = 0;
-  
-    var needToFoldCase = false;
-    var ignoreCase = false;
-    for (var i = 0, n = regexs.length; i < n; ++i) {
-      var regex = regexs[i];
-      if (regex.ignoreCase) {
-        ignoreCase = true;
-      } else if (/[a-z]/i.test(regex.source.replace(
-                     /\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi, ''))) {
-        needToFoldCase = true;
-        ignoreCase = false;
-        break;
-      }
-    }
-  
-    var escapeCharToCodeUnit = {
-      'b': 8,
-      't': 9,
-      'n': 0xa,
-      'v': 0xb,
-      'f': 0xc,
-      'r': 0xd
-    };
-  
-    function decodeEscape(charsetPart) {
-      var cc0 = charsetPart.charCodeAt(0);
-      if (cc0 !== 92 /* \\ */) {
-        return cc0;
-      }
-      var c1 = charsetPart.charAt(1);
-      cc0 = escapeCharToCodeUnit[c1];
-      if (cc0) {
-        return cc0;
-      } else if ('0' <= c1 && c1 <= '7') {
-        return parseInt(charsetPart.substring(1), 8);
-      } else if (c1 === 'u' || c1 === 'x') {
-        return parseInt(charsetPart.substring(2), 16);
-      } else {
-        return charsetPart.charCodeAt(1);
-      }
-    }
-  
-    function encodeEscape(charCode) {
-      if (charCode < 0x20) {
-        return (charCode < 0x10 ? '\\x0' : '\\x') + charCode.toString(16);
-      }
-      var ch = String.fromCharCode(charCode);
-      return (ch === '\\' || ch === '-' || ch === ']' || ch === '^')
-          ? "\\" + ch : ch;
-    }
-  
-    function caseFoldCharset(charSet) {
-      var charsetParts = charSet.substring(1, charSet.length - 1).match(
-          new RegExp(
-              '\\\\u[0-9A-Fa-f]{4}'
-              + '|\\\\x[0-9A-Fa-f]{2}'
-              + '|\\\\[0-3][0-7]{0,2}'
-              + '|\\\\[0-7]{1,2}'
-              + '|\\\\[\\s\\S]'
-              + '|-'
-              + '|[^-\\\\]',
-              'g'));
-      var ranges = [];
-      var inverse = charsetParts[0] === '^';
-  
-      var out = ['['];
-      if (inverse) { out.push('^'); }
-  
-      for (var i = inverse ? 1 : 0, n = charsetParts.length; i < n; ++i) {
-        var p = charsetParts[i];
-        if (/\\[bdsw]/i.test(p)) {  // Don't muck with named groups.
-          out.push(p);
-        } else {
-          var start = decodeEscape(p);
-          var end;
-          if (i + 2 < n && '-' === charsetParts[i + 1]) {
-            end = decodeEscape(charsetParts[i + 2]);
-            i += 2;
-          } else {
-            end = start;
-          }
-          ranges.push([start, end]);
-          // If the range might intersect letters, then expand it.
-          // This case handling is too simplistic.
-          // It does not deal with non-latin case folding.
-          // It works for latin source code identifiers though.
-          if (!(end < 65 || start > 122)) {
-            if (!(end < 65 || start > 90)) {
-              ranges.push([Math.max(65, start) | 32, Math.min(end, 90) | 32]);
-            }
-            if (!(end < 97 || start > 122)) {
-              ranges.push([Math.max(97, start) & ~32, Math.min(end, 122) & ~32]);
-            }
-          }
-        }
-      }
-  
-      // [[1, 10], [3, 4], [8, 12], [14, 14], [16, 16], [17, 17]]
-      // -> [[1, 12], [14, 14], [16, 17]]
-      ranges.sort(function (a, b) { return (a[0] - b[0]) || (b[1]  - a[1]); });
-      var consolidatedRanges = [];
-      var lastRange = [];
-      for (var i = 0; i < ranges.length; ++i) {
-        var range = ranges[i];
-        if (range[0] <= lastRange[1] + 1) {
-          lastRange[1] = Math.max(lastRange[1], range[1]);
-        } else {
-          consolidatedRanges.push(lastRange = range);
-        }
-      }
-  
-      for (var i = 0; i < consolidatedRanges.length; ++i) {
-        var range = consolidatedRanges[i];
-        out.push(encodeEscape(range[0]));
-        if (range[1] > range[0]) {
-          if (range[1] + 1 > range[0]) { out.push('-'); }
-          out.push(encodeEscape(range[1]));
-        }
-      }
-      out.push(']');
-      return out.join('');
-    }
-  
-    function allowAnywhereFoldCaseAndRenumberGroups(regex) {
-      // Split into character sets, escape sequences, punctuation strings
-      // like ('(', '(?:', ')', '^'), and runs of characters that do not
-      // include any of the above.
-      var parts = regex.source.match(
-          new RegExp(
-              '(?:'
-              + '\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]'  // a character set
-              + '|\\\\u[A-Fa-f0-9]{4}'  // a unicode escape
-              + '|\\\\x[A-Fa-f0-9]{2}'  // a hex escape
-              + '|\\\\[0-9]+'  // a back-reference or octal escape
-              + '|\\\\[^ux0-9]'  // other escape sequence
-              + '|\\(\\?[:!=]'  // start of a non-capturing group
-              + '|[\\(\\)\\^]'  // start/end of a group, or line start
-              + '|[^\\x5B\\x5C\\(\\)\\^]+'  // run of other characters
-              + ')',
-              'g'));
-      var n = parts.length;
-  
-      // Maps captured group numbers to the number they will occupy in
-      // the output or to -1 if that has not been determined, or to
-      // undefined if they need not be capturing in the output.
-      var capturedGroups = [];
-  
-      // Walk over and identify back references to build the capturedGroups
-      // mapping.
-      for (var i = 0, groupIndex = 0; i < n; ++i) {
-        var p = parts[i];
-        if (p === '(') {
-          // groups are 1-indexed, so max group index is count of '('
-          ++groupIndex;
-        } else if ('\\' === p.charAt(0)) {
-          var decimalValue = +p.substring(1);
-          if (decimalValue) {
-            if (decimalValue <= groupIndex) {
-              capturedGroups[decimalValue] = -1;
-            } else {
-              // Replace with an unambiguous escape sequence so that
-              // an octal escape sequence does not turn into a backreference
-              // to a capturing group from an earlier regex.
-              parts[i] = encodeEscape(decimalValue);
-            }
-          }
-        }
-      }
-  
-      // Renumber groups and reduce capturing groups to non-capturing groups
-      // where possible.
-      for (var i = 1; i < capturedGroups.length; ++i) {
-        if (-1 === capturedGroups[i]) {
-          capturedGroups[i] = ++capturedGroupIndex;
-        }
-      }
-      for (var i = 0, groupIndex = 0; i < n; ++i) {
-        var p = parts[i];
-        if (p === '(') {
-          ++groupIndex;
-          if (!capturedGroups[groupIndex]) {
-            parts[i] = '(?:';
-          }
-        } else if ('\\' === p.charAt(0)) {
-          var decimalValue = +p.substring(1);
-          if (decimalValue && decimalValue <= groupIndex) {
-            parts[i] = '\\' + capturedGroups[decimalValue];
-          }
-        }
-      }
-  
-      // Remove any prefix anchors so that the output will match anywhere.
-      // ^^ really does mean an anchored match though.
-      for (var i = 0; i < n; ++i) {
-        if ('^' === parts[i] && '^' !== parts[i + 1]) { parts[i] = ''; }
-      }
-  
-      // Expand letters to groups to handle mixing of case-sensitive and
-      // case-insensitive patterns if necessary.
-      if (regex.ignoreCase && needToFoldCase) {
-        for (var i = 0; i < n; ++i) {
-          var p = parts[i];
-          var ch0 = p.charAt(0);
-          if (p.length >= 2 && ch0 === '[') {
-            parts[i] = caseFoldCharset(p);
-          } else if (ch0 !== '\\') {
-            // TODO: handle letters in numeric escapes.
-            parts[i] = p.replace(
-                /[a-zA-Z]/g,
-                function (ch) {
-                  var cc = ch.charCodeAt(0);
-                  return '[' + String.fromCharCode(cc & ~32, cc | 32) + ']';
-                });
-          }
-        }
-      }
-  
-      return parts.join('');
-    }
-  
-    var rewritten = [];
-    for (var i = 0, n = regexs.length; i < n; ++i) {
-      var regex = regexs[i];
-      if (regex.global || regex.multiline) { throw new Error('' + regex); }
-      rewritten.push(
-          '(?:' + allowAnywhereFoldCaseAndRenumberGroups(regex) + ')');
-    }
-  
-    return new RegExp(rewritten.join('|'), ignoreCase ? 'gi' : 'g');
-  }
-
-  /**
-   * Split markup into a string of source code and an array mapping ranges in
-   * that string to the text nodes in which they appear.
-   *
-   * <p>
-   * The HTML DOM structure:</p>
-   * <pre>
-   * (Element   "p"
-   *   (Element "b"
-   *     (Text  "print "))       ; #1
-   *   (Text    "'Hello '")      ; #2
-   *   (Element "br")            ; #3
-   *   (Text    "  + 'World';")) ; #4
-   * </pre>
-   * <p>
-   * corresponds to the HTML
-   * {@code <p><b>print </b>'Hello '<br>  + 'World';</p>}.</p>
-   *
-   * <p>
-   * It will produce the output:</p>
-   * <pre>
-   * {
-   *   sourceCode: "print 'Hello '\n  + 'World';",
-   *   //                     1          2
-   *   //           012345678901234 5678901234567
-   *   spans: [0, #1, 6, #2, 14, #3, 15, #4]
-   * }
-   * </pre>
-   * <p>
-   * where #1 is a reference to the {@code "print "} text node above, and so
-   * on for the other text nodes.
-   * </p>
-   *
-   * <p>
-   * The {@code} spans array is an array of pairs.  Even elements are the start
-   * indices of substrings, and odd elements are the text nodes (or BR elements)
-   * that contain the text for those substrings.
-   * Substrings continue until the next index or the end of the source.
-   * </p>
-   *
-   * @param {Node} node an HTML DOM subtree containing source-code.
-   * @param {boolean} isPreformatted true if white-space in text nodes should
-   *    be considered significant.
-   * @return {Object} source code and the text nodes in which they occur.
-   */
-  function extractSourceSpans(node, isPreformatted) {
-    var nocode = /(?:^|\s)nocode(?:\s|$)/;
-  
-    var chunks = [];
-    var length = 0;
-    var spans = [];
-    var k = 0;
-  
-    function walk(node) {
-      var type = node.nodeType;
-      if (type == 1) {  // Element
-        if (nocode.test(node.className)) { return; }
-        for (var child = node.firstChild; child; child = child.nextSibling) {
-          walk(child);
-        }
-        var nodeName = node.nodeName.toLowerCase();
-        if ('br' === nodeName || 'li' === nodeName) {
-          chunks[k] = '\n';
-          spans[k << 1] = length++;
-          spans[(k++ << 1) | 1] = node;
-        }
-      } else if (type == 3 || type == 4) {  // Text
-        var text = node.nodeValue;
-        if (text.length) {
-          if (!isPreformatted) {
-            text = text.replace(/[ \t\r\n]+/g, ' ');
-          } else {
-            text = text.replace(/\r\n?/g, '\n');  // Normalize newlines.
-          }
-          // TODO: handle tabs here?
-          chunks[k] = text;
-          spans[k << 1] = length;
-          length += text.length;
-          spans[(k++ << 1) | 1] = node;
-        }
-      }
-    }
-  
-    walk(node);
-  
-    return {
-      sourceCode: chunks.join('').replace(/\n$/, ''),
-      spans: spans
-    };
-  }
-
-  /**
-   * Apply the given language handler to sourceCode and add the resulting
-   * decorations to out.
-   * @param {number} basePos the index of sourceCode within the chunk of source
-   *    whose decorations are already present on out.
-   */
-  function appendDecorations(basePos, sourceCode, langHandler, out) {
-    if (!sourceCode) { return; }
-    var job = {
-      sourceCode: sourceCode,
-      basePos: basePos
-    };
-    langHandler(job);
-    out.push.apply(out, job.decorations);
-  }
-
-  var notWs = /\S/;
-
-  /**
-   * Given an element, if it contains only one child element and any text nodes
-   * it contains contain only space characters, return the sole child element.
-   * Otherwise returns undefined.
-   * <p>
-   * This is meant to return the CODE element in {@code <pre><code ...>} when
-   * there is a single child element that contains all the non-space textual
-   * content, but not to return anything where there are multiple child elements
-   * as in {@code <pre><code>...</code><code>...</code></pre>} or when there
-   * is textual content.
-   */
-  function childContentWrapper(element) {
-    var wrapper = undefined;
-    for (var c = element.firstChild; c; c = c.nextSibling) {
-      var type = c.nodeType;
-      wrapper = (type === 1)  // Element Node
-          ? (wrapper ? element : c)
-          : (type === 3)  // Text Node
-          ? (notWs.test(c.nodeValue) ? element : wrapper)
-          : wrapper;
-    }
-    return wrapper === element ? undefined : wrapper;
-  }
-
-  /** Given triples of [style, pattern, context] returns a lexing function,
-    * The lexing function interprets the patterns to find token boundaries and
-    * returns a decoration list of the form
-    * [index_0, style_0, index_1, style_1, ..., index_n, style_n]
-    * where index_n is an index into the sourceCode, and style_n is a style
-    * constant like PR_PLAIN.  index_n-1 <= index_n, and style_n-1 applies to
-    * all characters in sourceCode[index_n-1:index_n].
-    *
-    * The stylePatterns is a list whose elements have the form
-    * [style : string, pattern : RegExp, DEPRECATED, shortcut : string].
-    *
-    * Style is a style constant like PR_PLAIN, or can be a string of the
-    * form 'lang-FOO', where FOO is a language extension describing the
-    * language of the portion of the token in $1 after pattern executes.
-    * E.g., if style is 'lang-lisp', and group 1 contains the text
-    * '(hello (world))', then that portion of the token will be passed to the
-    * registered lisp handler for formatting.
-    * The text before and after group 1 will be restyled using this decorator
-    * so decorators should take care that this doesn't result in infinite
-    * recursion.  For example, the HTML lexer rule for SCRIPT elements looks
-    * something like ['lang-js', /<[s]cript>(.+?)<\/script>/].  This may match
-    * '<script>foo()<\/script>', which would cause the current decorator to
-    * be called with '<script>' which would not match the same rule since
-    * group 1 must not be empty, so it would be instead styled as PR_TAG by
-    * the generic tag rule.  The handler registered for the 'js' extension would
-    * then be called with 'foo()', and finally, the current decorator would
-    * be called with '<\/script>' which would not match the original rule and
-    * so the generic tag rule would identify it as a tag.
-    *
-    * Pattern must only match prefixes, and if it matches a prefix, then that
-    * match is considered a token with the same style.
-    *
-    * Context is applied to the last non-whitespace, non-comment token
-    * recognized.
-    *
-    * Shortcut is an optional string of characters, any of which, if the first
-    * character, gurantee that this pattern and only this pattern matches.
-    *
-    * @param {Array} shortcutStylePatterns patterns that always start with
-    *   a known character.  Must have a shortcut string.
-    * @param {Array} fallthroughStylePatterns patterns that will be tried in
-    *   order if the shortcut ones fail.  May have shortcuts.
-    *
-    * @return {function (Object)} a
-    *   function that takes source code and returns a list of decorations.
-    */
-  function createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns) {
-    var shortcuts = {};
-    var tokenizer;
-    (function () {
-      var allPatterns = shortcutStylePatterns.concat(fallthroughStylePatterns);
-      var allRegexs = [];
-      var regexKeys = {};
-      for (var i = 0, n = allPatterns.length; i < n; ++i) {
-        var patternParts = allPatterns[i];
-        var shortcutChars = patternParts[3];
-        if (shortcutChars) {
-          for (var c = shortcutChars.length; --c >= 0;) {
-            shortcuts[shortcutChars.charAt(c)] = patternParts;
-          }
-        }
-        var regex = patternParts[1];
-        var k = '' + regex;
-        if (!regexKeys.hasOwnProperty(k)) {
-          allRegexs.push(regex);
-          regexKeys[k] = null;
-        }
-      }
-      allRegexs.push(/[\0-\uffff]/);
-      tokenizer = combinePrefixPatterns(allRegexs);
-    })();
-
-    var nPatterns = fallthroughStylePatterns.length;
-
-    /**
-     * Lexes job.sourceCode and produces an output array job.decorations of
-     * style classes preceded by the position at which they start in
-     * job.sourceCode in order.
-     *
-     * @param {Object} job an object like <pre>{
-     *    sourceCode: {string} sourceText plain text,
-     *    basePos: {int} position of job.sourceCode in the larger chunk of
-     *        sourceCode.
-     * }</pre>
-     */
-    var decorate = function (job) {
-      var sourceCode = job.sourceCode, basePos = job.basePos;
-      /** Even entries are positions in source in ascending order.  Odd enties
-        * are style markers (e.g., PR_COMMENT) that run from that position until
-        * the end.
-        * @type {Array.<number|string>}
-        */
-      var decorations = [basePos, PR_PLAIN];
-      var pos = 0;  // index into sourceCode
-      var tokens = sourceCode.match(tokenizer) || [];
-      var styleCache = {};
-
-      for (var ti = 0, nTokens = tokens.length; ti < nTokens; ++ti) {
-        var token = tokens[ti];
-        var style = styleCache[token];
-        var match = void 0;
-
-        var isEmbedded;
-        if (typeof style === 'string') {
-          isEmbedded = false;
-        } else {
-          var patternParts = shortcuts[token.charAt(0)];
-          if (patternParts) {
-            match = token.match(patternParts[1]);
-            style = patternParts[0];
-          } else {
-            for (var i = 0; i < nPatterns; ++i) {
-              patternParts = fallthroughStylePatterns[i];
-              match = token.match(patternParts[1]);
-              if (match) {
-                style = patternParts[0];
-                break;
-              }
-            }
-
-            if (!match) {  // make sure that we make progress
-              style = PR_PLAIN;
-            }
-          }
-
-          isEmbedded = style.length >= 5 && 'lang-' === style.substring(0, 5);
-          if (isEmbedded && !(match && typeof match[1] === 'string')) {
-            isEmbedded = false;
-            style = PR_SOURCE;
-          }
-
-          if (!isEmbedded) { styleCache[token] = style; }
-        }
-
-        var tokenStart = pos;
-        pos += token.length;
-
-        if (!isEmbedded) {
-          decorations.push(basePos + tokenStart, style);
-        } else {  // Treat group 1 as an embedded block of source code.
-          var embeddedSource = match[1];
-          var embeddedSourceStart = token.indexOf(embeddedSource);
-          var embeddedSourceEnd = embeddedSourceStart + embeddedSource.length;
-          if (match[2]) {
-            // If embeddedSource can be blank, then it would match at the
-            // beginning which would cause us to infinitely recurse on the
-            // entire token, so we catch the right context in match[2].
-            embeddedSourceEnd = token.length - match[2].length;
-            embeddedSourceStart = embeddedSourceEnd - embeddedSource.length;
-          }
-          var lang = style.substring(5);
-          // Decorate the left of the embedded source
-          appendDecorations(
-              basePos + tokenStart,
-              token.substring(0, embeddedSourceStart),
-              decorate, decorations);
-          // Decorate the embedded source
-          appendDecorations(
-              basePos + tokenStart + embeddedSourceStart,
-              embeddedSource,
-              langHandlerForExtension(lang, embeddedSource),
-              decorations);
-          // Decorate the right of the embedded section
-          appendDecorations(
-              basePos + tokenStart + embeddedSourceEnd,
-              token.substring(embeddedSourceEnd),
-              decorate, decorations);
-        }
-      }
-      job.decorations = decorations;
-    };
-    return decorate;
-  }
-
-  /** returns a function that produces a list of decorations from source text.
-    *
-    * This code treats ", ', and ` as string delimiters, and \ as a string
-    * escape.  It does not recognize perl's qq() style strings.
-    * It has no special handling for double delimiter escapes as in basic, or
-    * the tripled delimiters used in python, but should work on those regardless
-    * although in those cases a single string literal may be broken up into
-    * multiple adjacent string literals.
-    *
-    * It recognizes C, C++, and shell style comments.
-    *
-    * @param {Object} options a set of optional parameters.
-    * @return {function (Object)} a function that examines the source code
-    *     in the input job and builds the decoration list.
-    */
-  function sourceDecorator(options) {
-    var shortcutStylePatterns = [], fallthroughStylePatterns = [];
-    if (options['tripleQuotedStrings']) {
-      // '''multi-line-string''', 'single-line-string', and double-quoted
-      shortcutStylePatterns.push(
-          [PR_STRING,  /^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,
-           null, '\'"']);
-    } else if (options['multiLineStrings']) {
-      // 'multi-line-string', "multi-line-string"
-      shortcutStylePatterns.push(
-          [PR_STRING,  /^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,
-           null, '\'"`']);
-    } else {
-      // 'single-line-string', "single-line-string"
-      shortcutStylePatterns.push(
-          [PR_STRING,
-           /^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,
-           null, '"\'']);
-    }
-    if (options['verbatimStrings']) {
-      // verbatim-string-literal production from the C# grammar.  See issue 93.
-      fallthroughStylePatterns.push(
-          [PR_STRING, /^@\"(?:[^\"]|\"\")*(?:\"|$)/, null]);
-    }
-    var hc = options['hashComments'];
-    if (hc) {
-      if (options['cStyleComments']) {
-        if (hc > 1) {  // multiline hash comments
-          shortcutStylePatterns.push(
-              [PR_COMMENT, /^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/, null, '#']);
-        } else {
-          // Stop C preprocessor declarations at an unclosed open comment
-          shortcutStylePatterns.push(
-              [PR_COMMENT, /^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,
-               null, '#']);
-        }
-        // #include <stdio.h>
-        fallthroughStylePatterns.push(
-            [PR_STRING,
-             /^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,
-             null]);
-      } else {
-        shortcutStylePatterns.push([PR_COMMENT, /^#[^\r\n]*/, null, '#']);
-      }
-    }
-    if (options['cStyleComments']) {
-      fallthroughStylePatterns.push([PR_COMMENT, /^\/\/[^\r\n]*/, null]);
-      fallthroughStylePatterns.push(
-          [PR_COMMENT, /^\/\*[\s\S]*?(?:\*\/|$)/, null]);
-    }
-    var regexLiterals = options['regexLiterals'];
-    if (regexLiterals) {
-      /**
-       * @const
-       */
-      var regexExcls = regexLiterals > 1
-        ? ''  // Multiline regex literals
-        : '\n\r';
-      /**
-       * @const
-       */
-      var regexAny = regexExcls ? '.' : '[\\S\\s]';
-      /**
-       * @const
-       */
-      var REGEX_LITERAL = (
-          // A regular expression literal starts with a slash that is
-          // not followed by * or / so that it is not confused with
-          // comments.
-          '/(?=[^/*' + regexExcls + '])'
-          // and then contains any number of raw characters,
-          + '(?:[^/\\x5B\\x5C' + regexExcls + ']'
-          // escape sequences (\x5C),
-          +    '|\\x5C' + regexAny
-          // or non-nesting character sets (\x5B\x5D);
-          +    '|\\x5B(?:[^\\x5C\\x5D' + regexExcls + ']'
-          +             '|\\x5C' + regexAny + ')*(?:\\x5D|$))+'
-          // finally closed by a /.
-          + '/');
-      fallthroughStylePatterns.push(
-          ['lang-regex',
-           RegExp('^' + REGEXP_PRECEDER_PATTERN + '(' + REGEX_LITERAL + ')')
-           ]);
-    }
-
-    var types = options['types'];
-    if (types) {
-      fallthroughStylePatterns.push([PR_TYPE, types]);
-    }
-
-    var keywords = ("" + options['keywords']).replace(/^ | $/g, '');
-    if (keywords.length) {
-      fallthroughStylePatterns.push(
-          [PR_KEYWORD,
-           new RegExp('^(?:' + keywords.replace(/[\s,]+/g, '|') + ')\\b'),
-           null]);
-    }
-
-    shortcutStylePatterns.push([PR_PLAIN,       /^\s+/, null, ' \r\n\t\xA0']);
-
-    var punctuation =
-      // The Bash man page says
-
-      // A word is a sequence of characters considered as a single
-      // unit by GRUB. Words are separated by metacharacters,
-      // which are the following plus space, tab, and newline: { }
-      // | & $ ; < >
-      // ...
-      
-      // A word beginning with # causes that word and all remaining
-      // characters on that line to be ignored.
-
-      // which means that only a '#' after /(?:^|[{}|&$;<>\s])/ starts a
-      // comment but empirically
-      // $ echo {#}
-      // {#}
-      // $ echo \$#
-      // $#
-      // $ echo }#
-      // }#
-
-      // so /(?:^|[|&;<>\s])/ is more appropriate.
-
-      // http://gcc.gnu.org/onlinedocs/gcc-2.95.3/cpp_1.html#SEC3
-      // suggests that this definition is compatible with a
-      // default mode that tries to use a single token definition
-      // to recognize both bash/python style comments and C
-      // preprocessor directives.
-
-      // This definition of punctuation does not include # in the list of
-      // follow-on exclusions, so # will not be broken before if preceeded
-      // by a punctuation character.  We could try to exclude # after
-      // [|&;<>] but that doesn't seem to cause many major problems.
-      // If that does turn out to be a problem, we should change the below
-      // when hc is truthy to include # in the run of punctuation characters
-      // only when not followint [|&;<>].
-      '^.[^\\s\\w.$@\'"`/\\\\]*';
-    if (options['regexLiterals']) {
-      punctuation += '(?!\s*\/)';
-    }
-
-    fallthroughStylePatterns.push(
-        // TODO(mikesamuel): recognize non-latin letters and numerals in idents
-        [PR_LITERAL,     /^@[a-z_$][a-z_$@0-9]*/i, null],
-        [PR_TYPE,        /^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/, null],
-        [PR_PLAIN,       /^[a-z_$][a-z_$@0-9]*/i, null],
-        [PR_LITERAL,
-         new RegExp(
-             '^(?:'
-             // A hex number
-             + '0x[a-f0-9]+'
-             // or an octal or decimal number,
-             + '|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)'
-             // possibly in scientific notation
-             + '(?:e[+\\-]?\\d+)?'
-             + ')'
-             // with an optional modifier like UL for unsigned long
-             + '[a-z]*', 'i'),
-         null, '0123456789'],
-        // Don't treat escaped quotes in bash as starting strings.
-        // See issue 144.
-        [PR_PLAIN,       /^\\[\s\S]?/, null],
-        [PR_PUNCTUATION, new RegExp(punctuation), null]);
-
-    return createSimpleLexer(shortcutStylePatterns, fallthroughStylePatterns);
-  }
-
-  var decorateSource = sourceDecorator({
-        'keywords': ALL_KEYWORDS,
-        'hashComments': true,
-        'cStyleComments': true,
-        'multiLineStrings': true,
-        'regexLiterals': true
-      });
-
-  /**
-   * Given a DOM subtree, wraps it in a list, and puts each line into its own
-   * list item.
-   *
-   * @param {Node} node modified in place.  Its content is pulled into an
-   *     HTMLOListElement, and each line is moved into a separate list item.
-   *     This requires cloning elements, so the input might not have unique
-   *     IDs after numbering.
-   * @param {boolean} isPreformatted true iff white-space in text nodes should
-   *     be treated as significant.
-   */
-  function numberLines(node, opt_startLineNum, isPreformatted) {
-    var nocode = /(?:^|\s)nocode(?:\s|$)/;
-    var lineBreak = /\r\n?|\n/;
-  
-    var document = node.ownerDocument;
-  
-    var li = document.createElement('li');
-    while (node.firstChild) {
-      li.appendChild(node.firstChild);
-    }
-    // An array of lines.  We split below, so this is initialized to one
-    // un-split line.
-    var listItems = [li];
-  
-    function walk(node) {
-      var type = node.nodeType;
-      if (type == 1 && !nocode.test(node.className)) {  // Element
-        if ('br' === node.nodeName) {
-          breakAfter(node);
-          // Discard the <BR> since it is now flush against a </LI>.
-          if (node.parentNode) {
-            node.parentNode.removeChild(node);
-          }
-        } else {
-          for (var child = node.firstChild; child; child = child.nextSibling) {
-            walk(child);
-          }
-        }
-      } else if ((type == 3 || type == 4) && isPreformatted) {  // Text
-        var text = node.nodeValue;
-        var match = text.match(lineBreak);
-        if (match) {
-          var firstLine = text.substring(0, match.index);
-          node.nodeValue = firstLine;
-          var tail = text.substring(match.index + match[0].length);
-          if (tail) {
-            var parent = node.parentNode;
-            parent.insertBefore(
-              document.createTextNode(tail), node.nextSibling);
-          }
-          breakAfter(node);
-          if (!firstLine) {
-            // Don't leave blank text nodes in the DOM.
-            node.parentNode.removeChild(node);
-          }
-        }
-      }
-    }
-  
-    // Split a line after the given node.
-    function breakAfter(lineEndNode) {
-      // If there's nothing to the right, then we can skip ending the line
-      // here, and move root-wards since splitting just before an end-tag
-      // would require us to create a bunch of empty copies.
-      while (!lineEndNode.nextSibling) {
-        lineEndNode = lineEndNode.parentNode;
-        if (!lineEndNode) { return; }
-      }
-  
-      function breakLeftOf(limit, copy) {
-        // Clone shallowly if this node needs to be on both sides of the break.
-        var rightSide = copy ? limit.cloneNode(false) : limit;
-        var parent = limit.parentNode;
-        if (parent) {
-          // We clone the parent chain.
-          // This helps us resurrect important styling elements that cross lines.
-          // E.g. in <i>Foo<br>Bar</i>
-          // should be rewritten to <li><i>Foo</i></li><li><i>Bar</i></li>.
-          var parentClone = breakLeftOf(parent, 1);
-          // Move the clone and everything to the right of the original
-          // onto the cloned parent.
-          var next = limit.nextSibling;
-          parentClone.appendChild(rightSide);
-          for (var sibling = next; sibling; sibling = next) {
-            next = sibling.nextSibling;
-            parentClone.appendChild(sibling);
-          }
-        }
-        return rightSide;
-      }
-  
-      var copiedListItem = breakLeftOf(lineEndNode.nextSibling, 0);
-  
-      // Walk the parent chain until we reach an unattached LI.
-      for (var parent;
-           // Check nodeType since IE invents document fragments.
-           (parent = copiedListItem.parentNode) && parent.nodeType === 1;) {
-        copiedListItem = parent;
-      }
-      // Put it on the list of lines for later processing.
-      listItems.push(copiedListItem);
-    }
-  
-    // Split lines while there are lines left to split.
-    for (var i = 0;  // Number of lines that have been split so far.
-         i < listItems.length;  // length updated by breakAfter calls.
-         ++i) {
-      walk(listItems[i]);
-    }
-  
-    // Make sure numeric indices show correctly.
-    if (opt_startLineNum === (opt_startLineNum|0)) {
-      listItems[0].setAttribute('value', opt_startLineNum);
-    }
-  
-    var ol = document.createElement('ol');
-    ol.className = 'linenums';
-    var offset = Math.max(0, ((opt_startLineNum - 1 /* zero index */)) | 0) || 0;
-    for (var i = 0, n = listItems.length; i < n; ++i) {
-      li = listItems[i];
-      // Stick a class on the LIs so that stylesheets can
-      // color odd/even rows, or any other row pattern that
-      // is co-prime with 10.
-      li.className = 'L' + ((i + offset) % 10);
-      if (!li.firstChild) {
-        li.appendChild(document.createTextNode('\xA0'));
-      }
-      ol.appendChild(li);
-    }
-  
-    node.appendChild(ol);
-  }
-  /**
-   * Breaks {@code job.sourceCode} around style boundaries in
-   * {@code job.decorations} and modifies {@code job.sourceNode} in place.
-   * @param {Object} job like <pre>{
-   *    sourceCode: {string} source as plain text,
-   *    sourceNode: {HTMLElement} the element containing the source,
-   *    spans: {Array.<number|Node>} alternating span start indices into source
-   *       and the text node or element (e.g. {@code <BR>}) corresponding to that
-   *       span.
-   *    decorations: {Array.<number|string} an array of style classes preceded
-   *       by the position at which they start in job.sourceCode in order
-   * }</pre>
-   * @private
-   */
-  function recombineTagsAndDecorations(job) {
-    var isIE8OrEarlier = /\bMSIE\s(\d+)/.exec(navigator.userAgent);
-    isIE8OrEarlier = isIE8OrEarlier && +isIE8OrEarlier[1] <= 8;
-    var newlineRe = /\n/g;
-  
-    var source = job.sourceCode;
-    var sourceLength = source.length;
-    // Index into source after the last code-unit recombined.
-    var sourceIndex = 0;
-  
-    var spans = job.spans;
-    var nSpans = spans.length;
-    // Index into spans after the last span which ends at or before sourceIndex.
-    var spanIndex = 0;
-  
-    var decorations = job.decorations;
-    var nDecorations = decorations.length;
-    // Index into decorations after the last decoration which ends at or before
-    // sourceIndex.
-    var decorationIndex = 0;
-  
-    // Remove all zero-length decorations.
-    decorations[nDecorations] = sourceLength;
-    var decPos, i;
-    for (i = decPos = 0; i < nDecorations;) {
-      if (decorations[i] !== decorations[i + 2]) {
-        decorations[decPos++] = decorations[i++];
-        decorations[decPos++] = decorations[i++];
-      } else {
-        i += 2;
-      }
-    }
-    nDecorations = decPos;
-  
-    // Simplify decorations.
-    for (i = decPos = 0; i < nDecorations;) {
-      var startPos = decorations[i];
-      // Conflate all adjacent decorations that use the same style.
-      var startDec = decorations[i + 1];
-      var end = i + 2;
-      while (end + 2 <= nDecorations && decorations[end + 1] === startDec) {
-        end += 2;
-      }
-      decorations[decPos++] = startPos;
-      decorations[decPos++] = startDec;
-      i = end;
-    }
-  
-    nDecorations = decorations.length = decPos;
-  
-    var sourceNode = job.sourceNode;
-    var oldDisplay;
-    if (sourceNode) {
-      oldDisplay = sourceNode.style.display;
-      sourceNode.style.display = 'none';
-    }
-    try {
-      var decoration = null;
-      while (spanIndex < nSpans) {
-        var spanStart = spans[spanIndex];
-        var spanEnd = spans[spanIndex + 2] || sourceLength;
-  
-        var decEnd = decorations[decorationIndex + 2] || sourceLength;
-  
-        var end = Math.min(spanEnd, decEnd);
-  
-        var textNode = spans[spanIndex + 1];
-        var styledText;
-        if (textNode.nodeType !== 1  // Don't muck with <BR>s or <LI>s
-            // Don't introduce spans around empty text nodes.
-            && (styledText = source.substring(sourceIndex, end))) {
-          // This may seem bizarre, and it is.  Emitting LF on IE causes the
-          // code to display with spaces instead of line breaks.
-          // Emitting Windows standard issue linebreaks (CRLF) causes a blank
-          // space to appear at the beginning of every line but the first.
-          // Emitting an old Mac OS 9 line separator makes everything spiffy.
-          if (isIE8OrEarlier) {
-            styledText = styledText.replace(newlineRe, '\r');
-          }
-          textNode.nodeValue = styledText;
-          var document = textNode.ownerDocument;
-          var span = document.createElement('span');
-          span.className = decorations[decorationIndex + 1];
-          var parentNode = textNode.parentNode;
-          parentNode.replaceChild(span, textNode);
-          span.appendChild(textNode);
-          if (sourceIndex < spanEnd) {  // Split off a text node.
-            spans[spanIndex + 1] = textNode
-                // TODO: Possibly optimize by using '' if there's no flicker.
-                = document.createTextNode(source.substring(end, spanEnd));
-            parentNode.insertBefore(textNode, span.nextSibling);
-          }
-        }
-  
-        sourceIndex = end;
-  
-        if (sourceIndex >= spanEnd) {
-          spanIndex += 2;
-        }
-        if (sourceIndex >= decEnd) {
-          decorationIndex += 2;
-        }
-      }
-    } finally {
-      if (sourceNode) {
-        sourceNode.style.display = oldDisplay;
-      }
-    }
-  }
-
-  /** Maps language-specific file extensions to handlers. */
-  var langHandlerRegistry = {};
-  /** Register a language handler for the given file extensions.
-    * @param {function (Object)} handler a function from source code to a list
-    *      of decorations.  Takes a single argument job which describes the
-    *      state of the computation.   The single parameter has the form
-    *      {@code {
-    *        sourceCode: {string} as plain text.
-    *        decorations: {Array.<number|string>} an array of style classes
-    *                     preceded by the position at which they start in
-    *                     job.sourceCode in order.
-    *                     The language handler should assigned this field.
-    *        basePos: {int} the position of source in the larger source chunk.
-    *                 All positions in the output decorations array are relative
-    *                 to the larger source chunk.
-    *      } }
-    * @param {Array.<string>} fileExtensions
-    */
-  function registerLangHandler(handler, fileExtensions) {
-    for (var i = fileExtensions.length; --i >= 0;) {
-      var ext = fileExtensions[i];
-      if (!langHandlerRegistry.hasOwnProperty(ext)) {
-        langHandlerRegistry[ext] = handler;
-      } else if (win['console']) {
-        console['warn']('cannot override language handler %s', ext);
-      }
-    }
-  }
-  function langHandlerForExtension(extension, source) {
-    if (!(extension && langHandlerRegistry.hasOwnProperty(extension))) {
-      // Treat it as markup if the first non whitespace character is a < and
-      // the last non-whitespace character is a >.
-      extension = /^\s*</.test(source)
-          ? 'default-markup'
-          : 'default-code';
-    }
-    return langHandlerRegistry[extension];
-  }
-  registerLangHandler(decorateSource, ['default-code']);
-  registerLangHandler(
-      createSimpleLexer(
-          [],
-          [
-           [PR_PLAIN,       /^[^<?]+/],
-           [PR_DECLARATION, /^<!\w[^>]*(?:>|$)/],
-           [PR_COMMENT,     /^<\!--[\s\S]*?(?:-\->|$)/],
-           // Unescaped content in an unknown language
-           ['lang-',        /^<\?([\s\S]+?)(?:\?>|$)/],
-           ['lang-',        /^<\%([\s\S]+?)(?:%>|$)/],
-           [PR_PUNCTUATION, /^(?:<[%?]|[%?]>)/],
-           ['lang-',        /^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],
-           // Unescaped content in javascript.  (Or possibly vbscript).
-           ['lang-js',      /^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],
-           // Contains unescaped stylesheet content
-           ['lang-css',     /^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],
-           ['lang-in.tag',  /^(<\/?[a-z][^<>]*>)/i]
-          ]),
-      ['default-markup', 'htm', 'html', 'mxml', 'xhtml', 'xml', 'xsl']);
-  registerLangHandler(
-      createSimpleLexer(
-          [
-           [PR_PLAIN,        /^[\s]+/, null, ' \t\r\n'],
-           [PR_ATTRIB_VALUE, /^(?:\"[^\"]*\"?|\'[^\']*\'?)/, null, '\"\'']
-           ],
-          [
-           [PR_TAG,          /^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],
-           [PR_ATTRIB_NAME,  /^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],
-           ['lang-uq.val',   /^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],
-           [PR_PUNCTUATION,  /^[=<>\/]+/],
-           ['lang-js',       /^on\w+\s*=\s*\"([^\"]+)\"/i],
-           ['lang-js',       /^on\w+\s*=\s*\'([^\']+)\'/i],
-           ['lang-js',       /^on\w+\s*=\s*([^\"\'>\s]+)/i],
-           ['lang-css',      /^style\s*=\s*\"([^\"]+)\"/i],
-           ['lang-css',      /^style\s*=\s*\'([^\']+)\'/i],
-           ['lang-css',      /^style\s*=\s*([^\"\'>\s]+)/i]
-           ]),
-      ['in.tag']);
-  registerLangHandler(
-      createSimpleLexer([], [[PR_ATTRIB_VALUE, /^[\s\S]+/]]), ['uq.val']);
-  registerLangHandler(sourceDecorator({
-          'keywords': CPP_KEYWORDS,
-          'hashComments': true,
-          'cStyleComments': true,
-          'types': C_TYPES
-        }), ['c', 'cc', 'cpp', 'cxx', 'cyc', 'm']);
-  registerLangHandler(sourceDecorator({
-          'keywords': 'null,true,false'
-        }), ['json']);
-  registerLangHandler(sourceDecorator({
-          'keywords': CSHARP_KEYWORDS,
-          'hashComments': true,
-          'cStyleComments': true,
-          'verbatimStrings': true,
-          'types': C_TYPES
-        }), ['cs']);
-  registerLangHandler(sourceDecorator({
-          'keywords': JAVA_KEYWORDS,
-          'cStyleComments': true
-        }), ['java']);
-  registerLangHandler(sourceDecorator({
-          'keywords': SH_KEYWORDS,
-          'hashComments': true,
-          'multiLineStrings': true
-        }), ['bash', 'bsh', 'csh', 'sh']);
-  registerLangHandler(sourceDecorator({
-          'keywords': PYTHON_KEYWORDS,
-          'hashComments': true,
-          'multiLineStrings': true,
-          'tripleQuotedStrings': true
-        }), ['cv', 'py', 'python']);
-  registerLangHandler(sourceDecorator({
-          'keywords': PERL_KEYWORDS,
-          'hashComments': true,
-          'multiLineStrings': true,
-          'regexLiterals': 2  // multiline regex literals
-        }), ['perl', 'pl', 'pm']);
-  registerLangHandler(sourceDecorator({
-          'keywords': RUBY_KEYWORDS,
-          'hashComments': true,
-          'multiLineStrings': true,
-          'regexLiterals': true
-        }), ['rb', 'ruby']);
-  registerLangHandler(sourceDecorator({
-          'keywords': JSCRIPT_KEYWORDS,
-          'cStyleComments': true,
-          'regexLiterals': true
-        }), ['javascript', 'js']);
-  registerLangHandler(sourceDecorator({
-          'keywords': COFFEE_KEYWORDS,
-          'hashComments': 3,  // ### style block comments
-          'cStyleComments': true,
-          'multilineStrings': true,
-          'tripleQuotedStrings': true,
-          'regexLiterals': true
-        }), ['coffee']);
-  registerLangHandler(sourceDecorator({
-          'keywords': RUST_KEYWORDS,
-          'cStyleComments': true,
-          'multilineStrings': true
-        }), ['rc', 'rs', 'rust']);
-  registerLangHandler(
-      createSimpleLexer([], [[PR_STRING, /^[\s\S]+/]]), ['regex']);
-
-  function applyDecorator(job) {
-    var opt_langExtension = job.langExtension;
-
-    try {
-      // Extract tags, and convert the source code to plain text.
-      var sourceAndSpans = extractSourceSpans(job.sourceNode, job.pre);
-      /** Plain text. @type {string} */
-      var source = sourceAndSpans.sourceCode;
-      job.sourceCode = source;
-      job.spans = sourceAndSpans.spans;
-      job.basePos = 0;
-
-      // Apply the appropriate language handler
-      langHandlerForExtension(opt_langExtension, source)(job);
-
-      // Integrate the decorations and tags back into the source code,
-      // modifying the sourceNode in place.
-      recombineTagsAndDecorations(job);
-    } catch (e) {
-      if (win['console']) {
-        console['log'](e && e['stack'] || e);
-      }
-    }
-  }
-
-  /**
-   * Pretty print a chunk of code.
-   * @param sourceCodeHtml {string} The HTML to pretty print.
-   * @param opt_langExtension {string} The language name to use.
-   *     Typically, a filename extension like 'cpp' or 'java'.
-   * @param opt_numberLines {number|boolean} True to number lines,
-   *     or the 1-indexed number of the first line in sourceCodeHtml.
-   */
-  function $prettyPrintOne(sourceCodeHtml, opt_langExtension, opt_numberLines) {
-    var container = document.createElement('div');
-    // This could cause images to load and onload listeners to fire.
-    // E.g. <img onerror="alert(1337)" src="nosuchimage.png">.
-    // We assume that the inner HTML is from a trusted source.
-    // The pre-tag is required for IE8 which strips newlines from innerHTML
-    // when it is injected into a <pre> tag.
-    // http://stackoverflow.com/questions/451486/pre-tag-loses-line-breaks-when-setting-innerhtml-in-ie
-    // http://stackoverflow.com/questions/195363/inserting-a-newline-into-a-pre-tag-ie-javascript
-    container.innerHTML = '<pre>' + sourceCodeHtml + '</pre>';
-    container = container.firstChild;
-    if (opt_numberLines) {
-      numberLines(container, opt_numberLines, true);
-    }
-
-    var job = {
-      langExtension: opt_langExtension,
-      numberLines: opt_numberLines,
-      sourceNode: container,
-      pre: 1
-    };
-    applyDecorator(job);
-    return container.innerHTML;
-  }
-
-   /**
-    * Find all the {@code <pre>} and {@code <code>} tags in the DOM with
-    * {@code class=prettyprint} and prettify them.
-    *
-    * @param {Function} opt_whenDone called when prettifying is done.
-    * @param {HTMLElement|HTMLDocument} opt_root an element or document
-    *   containing all the elements to pretty print.
-    *   Defaults to {@code document.body}.
-    */
-  function $prettyPrint(opt_whenDone, opt_root) {
-    var root = opt_root || document.body;
-    var doc = root.ownerDocument || document;
-    function byTagName(tn) { return root.getElementsByTagName(tn); }
-    // fetch a list of nodes to rewrite
-    var codeSegments = [byTagName('pre'), byTagName('code'), byTagName('xmp')];
-    var elements = [];
-    for (var i = 0; i < codeSegments.length; ++i) {
-      for (var j = 0, n = codeSegments[i].length; j < n; ++j) {
-        elements.push(codeSegments[i][j]);
-      }
-    }
-    codeSegments = null;
-
-    var clock = Date;
-    if (!clock['now']) {
-      clock = { 'now': function () { return +(new Date); } };
-    }
-
-    // The loop is broken into a series of continuations to make sure that we
-    // don't make the browser unresponsive when rewriting a large page.
-    var k = 0;
-    var prettyPrintingJob;
-
-    var langExtensionRe = /\blang(?:uage)?-([\w.]+)(?!\S)/;
-    var prettyPrintRe = /\bprettyprint\b/;
-    var prettyPrintedRe = /\bprettyprinted\b/;
-    var preformattedTagNameRe = /pre|xmp/i;
-    var codeRe = /^code$/i;
-    var preCodeXmpRe = /^(?:pre|code|xmp)$/i;
-    var EMPTY = {};
-
-    function doWork() {
-      var endTime = (win['PR_SHOULD_USE_CONTINUATION'] ?
-                     clock['now']() + 250 /* ms */ :
-                     Infinity);
-      for (; k < elements.length && clock['now']() < endTime; k++) {
-        var cs = elements[k];
-
-        // Look for a preceding comment like
-        // <?prettify lang="..." linenums="..."?>
-        var attrs = EMPTY;
-        {
-          for (var preceder = cs; (preceder = preceder.previousSibling);) {
-            var nt = preceder.nodeType;
-            // <?foo?> is parsed by HTML 5 to a comment node (8)
-            // like <!--?foo?-->, but in XML is a processing instruction
-            var value = (nt === 7 || nt === 8) && preceder.nodeValue;
-            if (value
-                ? !/^\??prettify\b/.test(value)
-                : (nt !== 3 || /\S/.test(preceder.nodeValue))) {
-              // Skip over white-space text nodes but not others.
-              break;
-            }
-            if (value) {
-              attrs = {};
-              value.replace(
-                  /\b(\w+)=([\w:.%+-]+)/g,
-                function (_, name, value) { attrs[name] = value; });
-              break;
-            }
-          }
-        }
-
-        var className = cs.className;
-        if ((attrs !== EMPTY || prettyPrintRe.test(className))
-            // Don't redo this if we've already done it.
-            // This allows recalling pretty print to just prettyprint elements
-            // that have been added to the page since last call.
-            && !prettyPrintedRe.test(className)) {
-
-          // make sure this is not nested in an already prettified element
-          var nested = false;
-          for (var p = cs.parentNode; p; p = p.parentNode) {
-            var tn = p.tagName;
-            if (preCodeXmpRe.test(tn)
-                && p.className && prettyPrintRe.test(p.className)) {
-              nested = true;
-              break;
-            }
-          }
-          if (!nested) {
-            // Mark done.  If we fail to prettyprint for whatever reason,
-            // we shouldn't try again.
-            cs.className += ' prettyprinted';
-
-            // If the classes includes a language extensions, use it.
-            // Language extensions can be specified like
-            //     <pre class="prettyprint lang-cpp">
-            // the language extension "cpp" is used to find a language handler
-            // as passed to PR.registerLangHandler.
-            // HTML5 recommends that a language be specified using "language-"
-            // as the prefix instead.  Google Code Prettify supports both.
-            // http://dev.w3.org/html5/spec-author-view/the-code-element.html
-            var langExtension = attrs['lang'];
-            if (!langExtension) {
-              langExtension = className.match(langExtensionRe);
-              // Support <pre class="prettyprint"><code class="language-c">
-              var wrapper;
-              if (!langExtension && (wrapper = childContentWrapper(cs))
-                  && codeRe.test(wrapper.tagName)) {
-                langExtension = wrapper.className.match(langExtensionRe);
-              }
-
-              if (langExtension) { langExtension = langExtension[1]; }
-            }
-
-            var preformatted;
-            if (preformattedTagNameRe.test(cs.tagName)) {
-              preformatted = 1;
-            } else {
-              var currentStyle = cs['currentStyle'];
-              var defaultView = doc.defaultView;
-              var whitespace = (
-                  currentStyle
-                  ? currentStyle['whiteSpace']
-                  : (defaultView
-                     && defaultView.getComputedStyle)
-                  ? defaultView.getComputedStyle(cs, null)
-                  .getPropertyValue('white-space')
-                  : 0);
-              preformatted = whitespace
-                  && 'pre' === whitespace.substring(0, 3);
-            }
-
-            // Look for a class like linenums or linenums:<n> where <n> is the
-            // 1-indexed number of the first line.
-            var lineNums = attrs['linenums'];
-            if (!(lineNums = lineNums === 'true' || +lineNums)) {
-              lineNums = className.match(/\blinenums\b(?::(\d+))?/);
-              lineNums =
-                lineNums
-                ? lineNums[1] && lineNums[1].length
-                  ? +lineNums[1] : true
-                : false;
-            }
-            if (lineNums) { numberLines(cs, lineNums, preformatted); }
-
-            // do the pretty printing
-            prettyPrintingJob = {
-              langExtension: langExtension,
-              sourceNode: cs,
-              numberLines: lineNums,
-              pre: preformatted
-            };
-            applyDecorator(prettyPrintingJob);
-          }
-        }
-      }
-      if (k < elements.length) {
-        // finish up in a continuation
-        setTimeout(doWork, 250);
-      } else if ('function' === typeof opt_whenDone) {
-        opt_whenDone();
-      }
-    }
-
-    doWork();
-  }
-
-  /**
-   * Contains functions for creating and registering new language handlers.
-   * @type {Object}
-   */
-  var PR = win['PR'] = {
-        'createSimpleLexer': createSimpleLexer,
-        'registerLangHandler': registerLangHandler,
-        'sourceDecorator': sourceDecorator,
-        'PR_ATTRIB_NAME': PR_ATTRIB_NAME,
-        'PR_ATTRIB_VALUE': PR_ATTRIB_VALUE,
-        'PR_COMMENT': PR_COMMENT,
-        'PR_DECLARATION': PR_DECLARATION,
-        'PR_KEYWORD': PR_KEYWORD,
-        'PR_LITERAL': PR_LITERAL,
-        'PR_NOCODE': PR_NOCODE,
-        'PR_PLAIN': PR_PLAIN,
-        'PR_PUNCTUATION': PR_PUNCTUATION,
-        'PR_SOURCE': PR_SOURCE,
-        'PR_STRING': PR_STRING,
-        'PR_TAG': PR_TAG,
-        'PR_TYPE': PR_TYPE,
-        'prettyPrintOne':
-           IN_GLOBAL_SCOPE
-             ? (win['prettyPrintOne'] = $prettyPrintOne)
-             : (prettyPrintOne = $prettyPrintOne),
-        'prettyPrint': prettyPrint =
-           IN_GLOBAL_SCOPE
-             ? (win['prettyPrint'] = $prettyPrint)
-             : (prettyPrint = $prettyPrint)
-      };
-
-  // Make PR available via the Asynchronous Module Definition (AMD) API.
-  // Per https://github.com/amdjs/amdjs-api/wiki/AMD:
-  // The Asynchronous Module Definition (AMD) API specifies a
-  // mechanism for defining modules such that the module and its
-  // dependencies can be asynchronously loaded.
-  // ...
-  // To allow a clear indicator that a global define function (as
-  // needed for script src browser loading) conforms to the AMD API,
-  // any global define function SHOULD have a property called "amd"
-  // whose value is an object. This helps avoid conflict with any
-  // other existing JavaScript code that could have defined a define()
-  // function that does not conform to the AMD API.
-  if (typeof define === "function" && define['amd']) {
-    define("google-code-prettify", [], function () {
-      return PR; 
-    });
-  }
-})();

+ 0 - 585
src/js/lib/split.js

@@ -1,585 +0,0 @@
-/** @license
-========================================================================
-  Split.js v1.1.1
-  Copyright (c) 2015 Nathan Cahill
-
-  Permission is hereby granted, free of charge, to any person obtaining a copy
-  of this software and associated documentation files (the "Software"), to deal
-  in the Software without restriction, including without limitation the rights
-  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-  copies of the Software, and to permit persons to whom the Software is
-  furnished to do so, subject to the following conditions:
-  
-  The above copyright notice and this permission notice shall be included in
-  all copies or substantial portions of the Software.
-  
-  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-  THE SOFTWARE.
-*/
-
-
-// The programming goals of Split.js are to deliver readable, understandable and
-// maintainable code, while at the same time manually optimizing for tiny minified file size,
-// browser compatibility without additional requirements, graceful fallback (IE8 is supported)
-// and very few assumptions about the user's page layout.
-//
-// Make sure all browsers handle this JS library correctly with ES5.
-// More information here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode
-'use strict';
-
-// A wrapper function that does a couple things:
-//
-// 1. Doesn't pollute the global namespace. This is important for a library.
-// 2. Allows us to mount the library in different module systems, as well as
-//    directly in the browser.
-(function() {
-
-// Save the global `this` for use later. In this case, since the library only
-// runs in the browser, it will refer to `window`. Also, figure out if we're in IE8
-// or not. IE8 will still render correctly, but will be static instead of draggable.
-//
-// Save a couple long function names that are used frequently.
-// This optimization saves around 400 bytes.
-var global = this
-  , isIE8 = global.attachEvent && !global[addEventListener]
-  , document = global.document
-  , addEventListener = 'addEventListener'
-  , removeEventListener = 'removeEventListener'
-  , getBoundingClientRect = 'getBoundingClientRect'
-
-  // This library only needs two helper functions:
-  //
-  // The first determines which prefixes of CSS calc we need.
-  // We only need to do this once on startup, when this anonymous function is called.
-  // 
-  // Tests -webkit, -moz and -o prefixes. Modified from StackOverflow:
-  // http://stackoverflow.com/questions/16625140/js-feature-detection-to-detect-the-usage-of-webkit-calc-over-calc/16625167#16625167
-  , calc = (function () {
-        var el
-          , prefixes = ["", "-webkit-", "-moz-", "-o-"]
-
-        for (var i = 0; i < prefixes.length; i++) {
-            el = document.createElement('div')
-            el.style.cssText = "width:" + prefixes[i] + "calc(9px)"
-
-            if (el.style.length) {
-                return prefixes[i] + "calc"
-            }
-        }
-    })()
-
-  // The second helper function allows elements and string selectors to be used
-  // interchangeably. In either case an element is returned. This allows us to
-  // do `Split(elem1, elem2)` as well as `Split('#id1', '#id2')`.
-  , elementOrSelector = function (el) {
-        if (typeof el === 'string' || el instanceof String) {
-            return document.querySelector(el)
-        } else {
-            return el
-        }
-    }
-
-  // The main function to initialize a split. Split.js thinks about each pair
-  // of elements as an independant pair. Dragging the gutter between two elements
-  // only changes the dimensions of elements in that pair. This is key to understanding
-  // how the following functions operate, since each function is bound to a pair.
-  // 
-  // A pair object is shaped like this:
-  // 
-  // {
-  //     a: DOM element,
-  //     b: DOM element,
-  //     aMin: Number,
-  //     bMin: Number,
-  //     dragging: Boolean,
-  //     parent: DOM element,
-  //     isFirst: Boolean,
-  //     isLast: Boolean,
-  //     direction: 'horizontal' | 'vertical'
-  // }
-  //
-  // The basic sequence:
-  // 
-  // 1. Set defaults to something sane. `options` doesn't have to be passed at all.
-  // 2. Initialize a bunch of strings based on the direction we're splitting.
-  //    A lot of the behavior in the rest of the library is paramatized down to
-  //    rely on CSS strings and classes.
-  // 3. Define the dragging helper functions, and a few helpers to go with them.
-  // 4. Define a few more functions that "balance" the entire split instance.
-  //    Split.js tries it's best to cope with min sizes that don't add up.
-  // 5. Loop through the elements while pairing them off. Every pair gets an
-  //    `pair` object, a gutter, and special isFirst/isLast properties.
-  // 6. Actually size the pair elements, insert gutters and attach event listeners.
-  // 7. Balance all of the pairs to accomodate min sizes as best as possible.
-  , Split = function (ids, options) {
-    var dimension
-      , i
-      , clientDimension
-      , clientAxis
-      , position
-      , gutterClass
-      , paddingA
-      , paddingB
-      , pairs = []
-
-    // 1. Set defaults to something sane. `options` doesn't have to be passed at all,
-    // so create an options object if none exists. Pixel values 10, 100 and 30 are
-    // arbitrary but feel natural.
-    options = typeof options !== 'undefined' ?  options : {}
-
-    if (typeof options.gutterSize === 'undefined') options.gutterSize = 10
-    if (typeof options.minSize === 'undefined') options.minSize = 100
-    if (typeof options.snapOffset === 'undefined') options.snapOffset = 30
-    if (typeof options.direction === 'undefined') options.direction = 'horizontal'
-
-    // 2. Initialize a bunch of strings based on the direction we're splitting.
-    // A lot of the behavior in the rest of the library is paramatized down to
-    // rely on CSS strings and classes.
-    if (options.direction == 'horizontal') {
-        dimension = 'width'
-        clientDimension = 'clientWidth'
-        clientAxis = 'clientX'
-        position = 'left'
-        gutterClass = 'gutter gutter-horizontal'
-        paddingA = 'paddingLeft'
-        paddingB = 'paddingRight'
-        if (!options.cursor) options.cursor = 'ew-resize'
-    } else if (options.direction == 'vertical') {
-        dimension = 'height'
-        clientDimension = 'clientHeight'
-        clientAxis = 'clientY'
-        position = 'top'
-        gutterClass = 'gutter gutter-vertical'
-        paddingA = 'paddingTop'
-        paddingB = 'paddingBottom'
-        if (!options.cursor) options.cursor = 'ns-resize'
-    }
-
-    // 3. Define the dragging helper functions, and a few helpers to go with them.
-    // Each helper is bound to a pair object that contains it's metadata. This
-    // also makes it easy to store references to listeners that that will be
-    // added and removed.
-    // 
-    // Even though there are no other functions contained in them, aliasing
-    // this to self saves 50 bytes or so since it's used so frequently.
-    //
-    // The pair object saves metadata like dragging state, position and
-    // event listener references.
-    //
-    // startDragging calls `calculateSizes` to store the inital size in the pair object.
-    // It also adds event listeners for mouse/touch events,
-    // and prevents selection while dragging so avoid the selecting text.
-    var startDragging = function (e) {
-            // Alias frequently used variables to save space. 200 bytes.
-            var self = this
-              , a = self.a
-              , b = self.b
-
-            // Call the onDragStart callback.
-            if (!self.dragging && options.onDragStart) {
-                options.onDragStart()
-            }
-
-            // Don't actually drag the element. We emulate that in the drag function.
-            e.preventDefault()
-
-            // Set the dragging property of the pair object.
-            self.dragging = true
-
-            // Create two event listeners bound to the same pair object and store
-            // them in the pair object.
-            self.move = drag.bind(self)
-            self.stop = stopDragging.bind(self)
-
-            // All the binding. `window` gets the stop events in case we drag out of the elements.
-            global[addEventListener]('mouseup', self.stop)
-            global[addEventListener]('touchend', self.stop)
-            global[addEventListener]('touchcancel', self.stop)
-
-            self.parent[addEventListener]('mousemove', self.move)
-            self.parent[addEventListener]('touchmove', self.move)
-
-            // Disable selection. Disable!
-            a[addEventListener]('selectstart', noop)
-            a[addEventListener]('dragstart', noop)
-            b[addEventListener]('selectstart', noop)
-            b[addEventListener]('dragstart', noop)
-
-            a.style.userSelect = 'none'
-            a.style.webkitUserSelect = 'none'
-            a.style.MozUserSelect = 'none'
-            a.style.pointerEvents = 'none'
-
-            b.style.userSelect = 'none'
-            b.style.webkitUserSelect = 'none'
-            b.style.MozUserSelect = 'none'
-            b.style.pointerEvents = 'none'
-
-            // Set the cursor, both on the gutter and the parent element.
-            // Doing only a, b and gutter causes flickering.
-            self.gutter.style.cursor = options.cursor
-            self.parent.style.cursor = options.cursor
-
-            // Cache the initial sizes of the pair.
-            calculateSizes.call(self)
-        }
-
-      // stopDragging is very similar to startDragging in reverse.
-      , stopDragging = function () {
-            var self = this
-              , a = self.a
-              , b = self.b
-
-            if (self.dragging && options.onDragEnd) {
-                options.onDragEnd()
-            }
-
-            self.dragging = false
-
-            // Remove the stored event listeners. This is why we store them.
-            global[removeEventListener]('mouseup', self.stop)
-            global[removeEventListener]('touchend', self.stop)
-            global[removeEventListener]('touchcancel', self.stop)
-
-            self.parent[removeEventListener]('mousemove', self.move)
-            self.parent[removeEventListener]('touchmove', self.move)
-
-            // Delete them once they are removed. I think this makes a difference
-            // in memory usage with a lot of splits on one page. But I don't know for sure.
-            delete self.stop
-            delete self.move
-
-            a[removeEventListener]('selectstart', noop)
-            a[removeEventListener]('dragstart', noop)
-            b[removeEventListener]('selectstart', noop)
-            b[removeEventListener]('dragstart', noop)
-
-            a.style.userSelect = ''
-            a.style.webkitUserSelect = ''
-            a.style.MozUserSelect = ''
-            a.style.pointerEvents = ''
-
-            b.style.userSelect = ''
-            b.style.webkitUserSelect = ''
-            b.style.MozUserSelect = ''
-            b.style.pointerEvents = ''
-
-            self.gutter.style.cursor = ''
-            self.parent.style.cursor = ''
-        }
-
-      // drag, where all the magic happens. The logic is really quite simple:
-      // 
-      // 1. Ignore if the pair is not dragging.
-      // 2. Get the offset of the event.
-      // 3. Snap offset to min if within snappable range (within min + snapOffset).
-      // 4. Actually adjust each element in the pair to offset.
-      // 
-      // ---------------------------------------------------------------------
-      // |    | <- this.aMin               ||              this.bMin -> |    |
-      // |    |  | <- this.snapOffset      ||     this.snapOffset -> |  |    |
-      // |    |  |                         ||                        |  |    |
-      // |    |  |                         ||                        |  |    |
-      // ---------------------------------------------------------------------
-      // | <- this.start                                        this.size -> |
-      , drag = function (e) {
-            var offset
-
-            if (!this.dragging) return
-
-            // Get the offset of the event from the first side of the
-            // pair `this.start`. Supports touch events, but not multitouch, so only the first
-            // finger `touches[0]` is counted.
-            if ('touches' in e) {
-                offset = e.touches[0][clientAxis] - this.start
-            } else {
-                offset = e[clientAxis] - this.start
-            }
-
-            // If within snapOffset of min or max, set offset to min or max.
-            // snapOffset buffers aMin and bMin, so logic is opposite for both.
-            // Include the appropriate gutter sizes to prevent overflows.
-            if (offset <= this.aMin + options.snapOffset + this.aGutterSize) {
-                offset = this.aMin + this.aGutterSize
-            } else if (offset >= this.size - (this.bMin + options.snapOffset + this.bGutterSize)) {
-                offset = this.size - (this.bMin + this.bGutterSize)
-            }
-
-            // Actually adjust the size.
-            adjust.call(this, offset)
-
-            // Call the drag callback continously. Don't do anything too intensive
-            // in this callback.
-            if (options.onDrag) {
-                options.onDrag()
-            }
-        }
-
-      // Cache some important sizes when drag starts, so we don't have to do that
-      // continously:
-      // 
-      // `size`: The total size of the pair. First element + second element + first gutter + second gutter.
-      // `percentage`: The percentage between 0-100 that the pair occupies in the parent.
-      // `start`: The leading side of the first element.
-      //
-      // ------------------------------------------------ - - - - - - - - - - -
-      // |      aGutterSize -> |||                      |                     |
-      // |                     |||                      |                     |
-      // |                     |||                      |                     |
-      // |                     ||| <- bGutterSize       |                     |
-      // ------------------------------------------------ - - - - - - - - - - -
-      // | <- start                             size -> |       parentSize -> |
-      , calculateSizes = function () {
-            // Figure out the parent size minus padding.
-            var computedStyle = global.getComputedStyle(this.parent)
-              , parentSize = this.parent[clientDimension] - parseFloat(computedStyle[paddingA]) - parseFloat(computedStyle[paddingB])
-
-            this.size = this.a[getBoundingClientRect]()[dimension] + this.b[getBoundingClientRect]()[dimension] + this.aGutterSize + this.bGutterSize
-            this.percentage = Math.min(this.size / parentSize * 100, 100)
-            this.start = this.a[getBoundingClientRect]()[position]
-        }
-
-      // Actually adjust the size of elements `a` and `b` to `offset` while dragging.
-      // calc is used to allow calc(percentage + gutterpx) on the whole split instance,
-      // which allows the viewport to be resized without additional logic.
-      // Element a's size is the same as offset. b's size is total size - a size.
-      // Both sizes are calculated from the initial parent percentage, then the gutter size is subtracted.
-      , adjust = function (offset) {
-            this.a.style[dimension] = calc + '(' + (offset / this.size * this.percentage) + '% - ' + this.aGutterSize + 'px)'
-            this.b.style[dimension] = calc + '(' + (this.percentage - (offset / this.size * this.percentage)) + '% - ' + this.bGutterSize + 'px)'
-        }
-
-      // 4. Define a few more functions that "balance" the entire split instance.
-      // Split.js tries it's best to cope with min sizes that don't add up.
-      // At some point this should go away since it breaks out of the calc(% - px) model.
-      // Maybe it's a user error if you pass uncomputable minSizes.
-      , fitMin = function () {
-            var self = this
-              , a = self.a
-              , b = self.b
-
-            if (a[getBoundingClientRect]()[dimension] < self.aMin) {
-                a.style[dimension] = (self.aMin - self.aGutterSize) + 'px'
-                b.style[dimension] = (self.size - self.aMin - self.aGutterSize) + 'px'
-            } else if (b[getBoundingClientRect]()[dimension] < self.bMin) {
-                a.style[dimension] = (self.size - self.bMin - self.bGutterSize) + 'px'
-                b.style[dimension] = (self.bMin - self.bGutterSize) + 'px'
-            }
-        }
-      , fitMinReverse = function () {
-            var self = this
-              , a = self.a
-              , b = self.b
-
-            if (b[getBoundingClientRect]()[dimension] < self.bMin) {
-                a.style[dimension] = (self.size - self.bMin - self.bGutterSize) + 'px'
-                b.style[dimension] = (self.bMin - self.bGutterSize) + 'px'
-            } else if (a[getBoundingClientRect]()[dimension] < self.aMin) {
-                a.style[dimension] = (self.aMin - self.aGutterSize) + 'px'
-                b.style[dimension] = (self.size - self.aMin - self.aGutterSize) + 'px'
-            }
-        }
-      , balancePairs = function (pairs) {
-            for (var i = 0; i < pairs.length; i++) {
-                calculateSizes.call(pairs[i])
-                fitMin.call(pairs[i])
-            }
-
-            for (i = pairs.length - 1; i >= 0; i--) {
-                calculateSizes.call(pairs[i])
-                fitMinReverse.call(pairs[i])
-            }
-        }
-      , setElementSize = function (el, size, gutterSize) {
-            // Split.js allows setting sizes via numbers (ideally), or if you must,
-            // by string, like '300px'. This is less than ideal, because it breaks
-            // the fluid layout that `calc(% - px)` provides. You're on your own if you do that,
-            // make sure you calculate the gutter size by hand.
-            if (typeof size !== 'string' && !(size instanceof String)) {
-                if (!isIE8) {
-                    size = calc + '(' + size + '% - ' + gutterSize + 'px)'
-                } else {
-                    size = options.sizes[i] + '%'
-                }
-            }
-
-            el.style[dimension] = size
-        }
-
-      // No-op function to prevent default. Used to prevent selection.
-      , noop = function () { return false }
-
-      // All DOM elements in the split should have a common parent. We can grab
-      // the first elements parent and hope users read the docs because the
-      // behavior will be whacky otherwise.
-      , parent = elementOrSelector(ids[0]).parentNode
-
-    // Set default options.sizes to equal percentages of the parent element.
-    if (!options.sizes) {
-        var percent = 100 / ids.length
-
-        options.sizes = []
-
-        for (i = 0; i < ids.length; i++) {
-            options.sizes.push(percent)
-        }
-    }
-
-    // Standardize minSize to an array if it isn't already. This allows minSize
-    // to be passed as a number.
-    if (!Array.isArray(options.minSize)) {
-        var minSizes = []
-
-        for (i = 0; i < ids.length; i++) {
-            minSizes.push(options.minSize)
-        }
-
-        options.minSize = minSizes
-    }
-
-    // 5. Loop through the elements while pairing them off. Every pair gets a
-    // `pair` object, a gutter, and isFirst/isLast properties.
-    //
-    // Basic logic:
-    //
-    // - Starting with the second element `i > 0`, create `pair` objects with
-    //   `a = ids[i - 1]` and `b = ids[i]`
-    // - Set gutter sizes based on the _pair_ being first/last. The first and last
-    //   pair have gutterSize / 2, since they only have one half gutter, and not two.
-    // - Create gutter elements and add event listeners.
-    // - Set the size of the elements, minus the gutter sizes.
-    //
-    // -----------------------------------------------------------------------
-    // |     i=0     |         i=1         |        i=2       |      i=3     |
-    // |             |       isFirst       |                  |     isLast   |
-    // |           pair 0                pair 1             pair 2           |
-    // |             |                     |                  |              |
-    // -----------------------------------------------------------------------
-    for (i = 0; i < ids.length; i++) {
-        var el = elementOrSelector(ids[i])
-          , isFirstPair = (i == 1)
-          , isLastPair = (i == ids.length - 1)
-          , size = options.sizes[i]
-          , gutterSize = options.gutterSize
-          , pair
-
-        if (i > 0) {
-            // Create the pair object with it's metadata.
-            pair = {
-                a: elementOrSelector(ids[i - 1]),
-                b: el,
-                aMin: options.minSize[i - 1],
-                bMin: options.minSize[i],
-                dragging: false,
-                parent: parent,
-                isFirst: isFirstPair,
-                isLast: isLastPair,
-                direction: options.direction
-            }
-
-            // For first and last pairs, first and last gutter width is half.
-            pair.aGutterSize = options.gutterSize
-            pair.bGutterSize = options.gutterSize
-
-            if (isFirstPair) {
-                pair.aGutterSize = options.gutterSize / 2
-            }
-
-            if (isLastPair) {
-                pair.bGutterSize = options.gutterSize / 2
-            }
-        }
-
-        // Determine the size of the current element. IE8 is supported by
-        // staticly assigning sizes without draggable gutters. Assigns a string
-        // to `size`.
-        // 
-        // IE9 and above
-        if (!isIE8) {
-            // Create gutter elements for each pair.
-            if (i > 0) {
-                var gutter = document.createElement('div')
-
-                gutter.className = gutterClass
-                gutter.style[dimension] = options.gutterSize + 'px'
-
-                gutter[addEventListener]('mousedown', startDragging.bind(pair))
-                gutter[addEventListener]('touchstart', startDragging.bind(pair))
-
-                parent.insertBefore(gutter, el)
-
-                pair.gutter = gutter
-            }
-
-            // Half-size gutters for first and last elements.
-            if (i === 0 || i == ids.length - 1) {
-                gutterSize = options.gutterSize / 2
-            }
-        }
-
-        // Set the element size to our determined size.
-        setElementSize(el, size, gutterSize)
-
-        // After the first iteration, and we have a pair object, append it to the
-        // list of pairs.
-        if (i > 0) {
-            pairs.push(pair)
-        }
-    }
-
-    // Balance the pairs to try to accomodate min sizes.
-    balancePairs(pairs)
-
-    return {
-        setSizes: function (sizes) {
-            for (var i = 0; i < sizes.length; i++) {
-                if (i > 0) {
-                    var pair = pairs[i - 1]
-
-                    setElementSize(pair.a, sizes[i - 1], pair.aGutterSize)
-                    setElementSize(pair.b, sizes[i], pair.bGutterSize)
-                }
-            }
-        },
-        collapse: function (i) {
-            var pair
-
-            if (i === pairs.length) {
-                pair = pairs[i - 1]
-
-                calculateSizes.call(pair)
-                adjust.call(pair, pair.size - pair.bGutterSize)
-            } else {
-                pair = pairs[i]
-
-                calculateSizes.call(pair)
-                adjust.call(pair, pair.aGutterSize)
-            }
-        },
-        destroy: function () {
-            for (var i = 0; i < pairs.length; i++) {
-                pairs[i].parent.removeChild(pairs[i].gutter)
-                pairs[i].a.style[dimension] = ''
-                pairs[i].b.style[dimension] = ''
-            }
-        }
-    }
-}
-
-// Play nicely with module systems, and the browser too if you include it raw.
-if (typeof exports !== 'undefined') {
-    if (typeof module !== 'undefined' && module.exports) {
-        exports = module.exports = Split
-    }
-    exports.Split = Split
-} else {
-    global.Split = Split
-}
-
-// Call our wrapper function with the current global. In this case, `window`.
-}).call(window);

+ 3 - 1
src/js/lib/uas_parser.js

@@ -26,7 +26,9 @@
 */
 "use strict";
 
-var UAS_parser = module.exports = {
+var Utils = require("../core/Utils.js");
+
+var UAS_parser = {
 	
 	parse: function (userAgent) {
 		var result = {

+ 0 - 8466
src/js/lib/xpath.js

@@ -1,8466 +0,0 @@
-/** @license
-========================================================================
-  XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- 
-  Copyright (c) 2012 Sergey Ilinsky
-  Dual licensed under the MIT and GPL licenses.
-*/
-(function(){
-
-//	Javascript objects
-var cString		= window.String,
-	cBoolean	= window.Boolean,
-	cNumber		= window.Number,
-	cObject		= window.Object,
-	cArray		= window.Array,
-	cRegExp		= window.RegExp,
-	cDate		= window.Date,
-	cFunction	= window.Function,
-	cMath		= window.Math,
-// Error Objects
-	cError		= window.Error,
-	cSyntaxError= window.SyntaxError,
-	cTypeError	= window.TypeError,
-//	misc
-	fIsNaN		= window.isNaN,
-	fIsFinite	= window.isFinite,
-	nNaN		= window.NaN,
-	nInfinity	= window.Infinity,
-	// Functions
-	fWindow_btoa	= window.btoa,
-	fWindow_atob	= window.atob,
-	fWindow_parseInt= window.parseInt,
-	fString_trim	=(function() {
-		return cString.prototype.trim ? function(sValue) {return cString(sValue).trim();} : function(sValue) {
-			return cString(sValue).replace(/^\s+|\s+$/g, '');
-		};
-	})(),
-	fArray_indexOf	=(function() {
-		return cArray.prototype.indexOf ? function(aValue, vItem) {return aValue.indexOf(vItem);} : function(aValue, vItem) {
-			for (var nIndex = 0, nLength = aValue.length; nIndex < nLength; nIndex++)
-				if (aValue[nIndex] === vItem)
-					return nIndex;
-			return -1;
-		};
-	})();
-
-var sNS_XSD	= "http://www.w3.org/2001/XMLSchema",
-	sNS_XPF	= "http://www.w3.org/2005/xpath-functions",
-	sNS_XNS	= "http://www.w3.org/2000/xmlns/",
-	sNS_XML	= "http://www.w3.org/XML/1998/namespace";
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cException(sCode
-
-	) {
-
-	this.code		= sCode;
-	this.message	=
-
-					  oException_messages[sCode];
-};
-
-cException.prototype	= new cError;
-
-// "http://www.w3.org/2005/xqt-errors"
-
-var oException_messages	= {};
-oException_messages["XPDY0002"]	= "Evaluation of an expression relies on some part of the dynamic context that has not been assigned a value.";
-oException_messages["XPST0003"]	= "Expression is not a valid instance of the grammar";
-oException_messages["XPTY0004"]	= "Type is not appropriate for the context in which the expression occurs";
-oException_messages["XPST0008"]	= "Expression refers to an element name, attribute name, schema type name, namespace prefix, or variable name that is not defined in the static context";
-oException_messages["XPST0010"]	= "Axis not supported";
-oException_messages["XPST0017"]	= "Expanded QName and number of arguments in a function call do not match the name and arity of a function signature";
-oException_messages["XPTY0018"]	= "The result of the last step in a path expression contains both nodes and atomic values";
-oException_messages["XPTY0019"]	= "The result of a step (other than the last step) in a path expression contains an atomic value.";
-oException_messages["XPTY0020"]	= "In an axis step, the context item is not a node.";
-oException_messages["XPST0051"]	= "It is a static error if a QName that is used as an AtomicType in a SequenceType is not defined in the in-scope schema types as an atomic type.";
-oException_messages["XPST0081"]	= "A QName used in an expression contains a namespace prefix that cannot be expanded into a namespace URI by using the statically known namespaces.";
-//
-oException_messages["FORG0001"]	= "Invalid value for cast/constructor.";
-oException_messages["FORG0003"]	= "fn:zero-or-one called with a sequence containing more than one item.";
-oException_messages["FORG0004"]	= "fn:one-or-more called with a sequence containing no items.";
-oException_messages["FORG0005"]	= "fn:exactly-one called with a sequence containing zero or more than one item.";
-oException_messages["FORG0006"]	= "Invalid argument type.";
-//
-oException_messages["FODC0001"]	= "No context document.";
-//
-oException_messages["FORX0001"]	= "Invalid regular expression flags.";
-//
-oException_messages["FOCA0002"]	= "Invalid lexical value.";
-//
-oException_messages["FOCH0002"]	= "Unsupported collation.";
-
-oException_messages["FONS0004"]	= "No namespace found for prefix.";
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cLexer(sValue) {
-	var aMatch	= sValue.match(/\$?(?:(?![0-9-])(?:\w[\w.-]*|\*):)?(?![0-9-])(?:\w[\w.-]*|\*)|\(:|:\)|\/\/|\.\.|::|\d+(?:\.\d*)?(?:[eE][+-]?\d+)?|\.\d+(?:[eE][+-]?\d+)?|"[^"]*(?:""[^"]*)*"|'[^']*(?:''[^']*)*'|<<|>>|[!<>]=|(?![0-9-])[\w-]+:\*|\s+|./g);
-	if (aMatch) {
-		var nStack	= 0;
-		for (var nIndex = 0, nLength = aMatch.length; nIndex < nLength; nIndex++)
-			if (aMatch[nIndex] == '(:')
-				nStack++;
-			else
-			if (aMatch[nIndex] == ':)' && nStack)
-				nStack--;
-			else
-			if (!nStack && !/^\s/.test(aMatch[nIndex]))
-				this[this.length++]	= aMatch[nIndex];
-		if (nStack)
-			throw new cException("XPST0003"
-
-			);
-	}
-};
-
-cLexer.prototype.index		= 0;
-cLexer.prototype.length	= 0;
-
-cLexer.prototype.reset	= function() {
-	this.index	= 0;
-};
-
-cLexer.prototype.peek	= function(nOffset) {
-	return this[this.index +(nOffset || 0)] || '';
-};
-
-cLexer.prototype.next	= function(nOffset) {
-	return(this.index+= nOffset || 1) < this.length;
-};
-
-cLexer.prototype.back	= function(nOffset) {
-	return(this.index-= nOffset || 1) > 0;
-};
-
-cLexer.prototype.eof	= function() {
-	return this.index >= this.length;
-};
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cDOMAdapter() {
-
-};
-
-// Custom members
-cDOMAdapter.prototype.isNode		= function(oNode) {
-	return oNode &&!!oNode.nodeType;
-};
-
-cDOMAdapter.prototype.getProperty	= function(oNode, sName) {
-	return oNode[sName];
-};
-
-// Standard members
-cDOMAdapter.prototype.isSameNode	= function(oNode, oNode2) {
-	return oNode == oNode2;
-};
-
-cDOMAdapter.prototype.compareDocumentPosition	= function(oNode, oNode2) {
-	return oNode.compareDocumentPosition(oNode2);
-};
-
-cDOMAdapter.prototype.lookupNamespaceURI	= function(oNode, sPrefix) {
-	return oNode.lookupNamespaceURI(sPrefix);
-};
-
-// Document object members
-cDOMAdapter.prototype.getElementById	= function(oNode, sId) {
-	return oNode.getElementById(sId);
-};
-
-// Element/Document object members
-cDOMAdapter.prototype.getElementsByTagNameNS	= function(oNode, sNameSpaceURI, sLocalName) {
-	return oNode.getElementsByTagNameNS(sNameSpaceURI, sLocalName);
-};
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cDynamicContext(oStaticContext, vItem, oScope, oDOMAdapter) {
-	//
-	this.staticContext	= oStaticContext;
-	//
-	this.item		= vItem;
-	//
-	this.scope		= oScope || {};
-	this.stack		= {};
-	//
-	this.DOMAdapter	= oDOMAdapter || new cDOMAdapter;
-	//
-	var oDate	= new cDate,
-		nOffset	= oDate.getTimezoneOffset();
-	this.dateTime	= new cXSDateTime(oDate.getFullYear(), oDate.getMonth() + 1, oDate.getDate(), oDate.getHours(), oDate.getMinutes(), oDate.getSeconds() + oDate.getMilliseconds() / 1000, -nOffset);
-	this.timezone	= new cXSDayTimeDuration(0, cMath.abs(~~(nOffset / 60)), cMath.abs(nOffset % 60), 0, nOffset > 0);
-};
-
-cDynamicContext.prototype.item		= null;
-cDynamicContext.prototype.position	= 0;
-cDynamicContext.prototype.size		= 0;
-//
-cDynamicContext.prototype.scope		= null;
-cDynamicContext.prototype.stack		= null;	// Variables stack
-//
-cDynamicContext.prototype.dateTime	= null;
-cDynamicContext.prototype.timezone	= null;
-//
-cDynamicContext.prototype.staticContext	= null;
-
-// Stack management
-cDynamicContext.prototype.pushVariable	= function(sName, vValue) {
-	if (!this.stack.hasOwnProperty(sName))
-		this.stack[sName]	= [];
-	this.stack[sName].push(this.scope[sName]);
-	this.scope[sName] = vValue;
-};
-
-cDynamicContext.prototype.popVariable	= function(sName) {
-	if (this.stack.hasOwnProperty(sName)) {
-		this.scope[sName] = this.stack[sName].pop();
-		if (!this.stack[sName].length) {
-			delete this.stack[sName];
-			if (typeof this.scope[sName] == "undefined")
-				delete this.scope[sName];
-		}
-	}
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cStaticContext() {
-	this.dataTypes	= {};
-	this.documents	= {};
-	this.functions	= {};
-	this.collations	= {};
-	this.collections= {};
-};
-
-cStaticContext.prototype.baseURI	= null;
-//
-cStaticContext.prototype.dataTypes	= null;
-cStaticContext.prototype.documents	= null;
-//
-cStaticContext.prototype.functions	= null;
-cStaticContext.prototype.defaultFunctionNamespace	= null;
-//
-cStaticContext.prototype.collations	= null;
-cStaticContext.prototype.defaultCollationName		= sNS_XPF + "/collation/codepoint";
-//
-cStaticContext.prototype.collections	= null;
-//
-cStaticContext.prototype.namespaceResolver	= null;
-cStaticContext.prototype.defaultElementNamespace	= null;
-
-//
-var rStaticContext_uri	= /^(?:\{([^\}]+)\})?(.+)$/;
-//
-cStaticContext.prototype.setDataType		= function(sUri, fFunction) {
-	var aMatch	= sUri.match(rStaticContext_uri);
-	if (aMatch)
-		if (aMatch[1] != sNS_XSD)
-			this.dataTypes[sUri]	= fFunction;
-};
-
-cStaticContext.prototype.getDataType		= function(sUri) {
-	var aMatch	= sUri.match(rStaticContext_uri);
-	if (aMatch)
-		return aMatch[1] == sNS_XSD ? hStaticContext_dataTypes[aMatch[2]] : this.dataTypes[sUri];
-};
-
-cStaticContext.prototype.setDocument		= function(sUri, fFunction) {
-	this.documents[sUri]	= fFunction;
-};
-
-cStaticContext.prototype.getDocument		= function(sUri) {
-	return this.documents[sUri];
-};
-
-cStaticContext.prototype.setFunction		= function(sUri, fFunction) {
-	var aMatch	= sUri.match(rStaticContext_uri);
-	if (aMatch)
-		if (aMatch[1] != sNS_XPF)
-			this.functions[sUri]	= fFunction;
-};
-
-cStaticContext.prototype.getFunction		= function(sUri) {
-	var aMatch	= sUri.match(rStaticContext_uri);
-	if (aMatch)
-		return aMatch[1] == sNS_XPF ? hStaticContext_functions[aMatch[2]] : this.functions[sUri];
-};
-
-cStaticContext.prototype.setCollation		= function(sUri, fFunction) {
-	this.collations[sUri]	= fFunction;
-};
-
-cStaticContext.prototype.getCollation		= function(sUri) {
-	return this.collations[sUri];
-};
-
-cStaticContext.prototype.setCollection	= function(sUri, fFunction) {
-	this.collections[sUri]	= fFunction;
-};
-
-cStaticContext.prototype.getCollection	= function(sUri) {
-	return this.collections[sUri];
-};
-
-cStaticContext.prototype.getURIForPrefix	= function(sPrefix) {
-	var oResolver	= this.namespaceResolver,
-		fResolver	= oResolver && oResolver.lookupNamespaceURI ? oResolver.lookupNamespaceURI : oResolver,
-		sNameSpaceURI;
-	if (fResolver instanceof cFunction && (sNameSpaceURI = fResolver.call(oResolver, sPrefix)))
-		return sNameSpaceURI;
-	if (sPrefix == 'fn')
-		return sNS_XPF;
-	if (sPrefix == 'xs')
-		return sNS_XSD;
-	if (sPrefix == "xml")
-		return sNS_XML;
-	if (sPrefix == "xmlns")
-		return sNS_XNS;
-	//
-	throw new cException("XPST0081"
-
-	);
-};
-
-// Static members
-//Converts non-null JavaScript object to XML Schema object
-cStaticContext.js2xs	= function(vItem) {
-	// Convert types from JavaScript to XPath 2.0
-	if (typeof vItem == "boolean")
-		vItem	= new cXSBoolean(vItem);
-	else
-	if (typeof vItem == "number")
-		vItem	=(fIsNaN(vItem) ||!fIsFinite(vItem)) ? new cXSDouble(vItem) : fNumericLiteral_parseValue(cString(vItem));
-	else
-		vItem	= new cXSString(cString(vItem));
-	//
-	return vItem;
-};
-
-// Converts non-null XML Schema object to JavaScript object
-cStaticContext.xs2js	= function(vItem) {
-	if (vItem instanceof cXSBoolean)
-		vItem	= vItem.valueOf();
-	else
-	if (fXSAnyAtomicType_isNumeric(vItem))
-		vItem	= vItem.valueOf();
-	else
-		vItem	= vItem.toString();
-	//
-	return vItem;
-};
-
-// System functions with signatures, operators and types
-var hStaticContext_functions	= {},
-	hStaticContext_signatures	= {},
-	hStaticContext_dataTypes	= {},
-	hStaticContext_operators	= {};
-
-function fStaticContext_defineSystemFunction(sName, aParameters, fFunction) {
-	// Register function
-	hStaticContext_functions[sName]	= fFunction;
-	// Register signature
-	hStaticContext_signatures[sName]	= aParameters;
-};
-
-function fStaticContext_defineSystemDataType(sName, fFunction) {
-	// Register dataType
-	hStaticContext_dataTypes[sName]	= fFunction;
-};
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cExpression(sExpression, oStaticContext) {
-	var oLexer	= new cLexer(sExpression),
-		oExpr	= fExpr_parse(oLexer, oStaticContext);
-	//
-	if (!oLexer.eof())
-		throw new cException("XPST0003"
-
-		);
-	//
-	if (!oExpr)
-		throw new cException("XPST0003"
-
-		);
-	this.internalExpression	= oExpr;
-};
-
-cExpression.prototype.internalExpression	= null;
-
-// Public methods
-cExpression.prototype.evaluate	= function(oContext) {
-	return this.internalExpression.evaluate(oContext);
-};
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cStringCollator() {
-
-};
-
-cStringCollator.prototype.equals	= function(sValue1, sValue2) {
-	throw "Not implemented";
-};
-
-cStringCollator.prototype.compare	= function(sValue1, sValue2) {
-	throw "Not implemented";
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSConstants(){};
-
-// XML Schema 1.0 Datatypes
-cXSConstants.ANYSIMPLETYPE_DT		= 1;
-cXSConstants.STRING_DT				= 2;
-cXSConstants.BOOLEAN_DT				= 3;
-cXSConstants.DECIMAL_DT				= 4;
-cXSConstants.FLOAT_DT				= 5;
-cXSConstants.DOUBLE_DT				= 6;
-cXSConstants.DURATION_DT			= 7;
-cXSConstants.DATETIME_DT			= 8;
-cXSConstants.TIME_DT				= 9;
-cXSConstants.DATE_DT				= 10;
-cXSConstants.GYEARMONTH_DT			= 11;
-cXSConstants.GYEAR_DT				= 12;
-cXSConstants.GMONTHDAY_DT			= 13;
-cXSConstants.GDAY_DT				= 14;
-cXSConstants.GMONTH_DT				= 15;
-cXSConstants.HEXBINARY_DT			= 16;
-cXSConstants.BASE64BINARY_DT		= 17;
-cXSConstants.ANYURI_DT				= 18;
-cXSConstants.QNAME_DT				= 19;
-cXSConstants.NOTATION_DT			= 20;
-cXSConstants.NORMALIZEDSTRING_DT	= 21;
-cXSConstants.TOKEN_DT				= 22;
-cXSConstants.LANGUAGE_DT			= 23;
-cXSConstants.NMTOKEN_DT				= 24;
-cXSConstants.NAME_DT				= 25;
-cXSConstants.NCNAME_DT				= 26;
-cXSConstants.ID_DT					= 27;
-cXSConstants.IDREF_DT				= 28;
-cXSConstants.ENTITY_DT				= 29;
-cXSConstants.INTEGER_DT				= 30;
-cXSConstants.NONPOSITIVEINTEGER_DT	= 31;
-cXSConstants.NEGATIVEINTEGER_DT		= 32;
-cXSConstants.LONG_DT				= 33;
-cXSConstants.INT_DT					= 34;
-cXSConstants.SHORT_DT				= 35;
-cXSConstants.BYTE_DT				= 36;
-cXSConstants.NONNEGATIVEINTEGER_DT	= 37;
-cXSConstants.UNSIGNEDLONG_DT		= 38;
-cXSConstants.UNSIGNEDINT_DT			= 39;
-cXSConstants.UNSIGNEDSHORT_DT		= 40;
-cXSConstants.UNSIGNEDBYTE_DT		= 41;
-cXSConstants.POSITIVEINTEGER_DT		= 42;
-cXSConstants.LISTOFUNION_DT			= 43;
-cXSConstants.LIST_DT				= 44;
-cXSConstants.UNAVAILABLE_DT			= 45;
-
-// XML Schema 1.1 Datatypes
-cXSConstants.DATETIMESTAMP_DT		= 46;
-cXSConstants.DAYMONTHDURATION_DT	= 47;
-cXSConstants.DAYTIMEDURATION_DT		= 48;
-cXSConstants.PRECISIONDECIMAL_DT	= 49;
-cXSConstants.ANYATOMICTYPE_DT		= 50;
-cXSConstants.ANYTYPE_DT				= 51;
-
-//
-cXSConstants.XT_YEARMONTHDURATION_DT=-1;
-cXSConstants.XT_UNTYPEDATOMIC_DT	=-2;
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cExpr() {
-	this.items	= [];
-};
-
-cExpr.prototype.items	= null;
-
-// Static members
-function fExpr_parse (oLexer, oStaticContext) {
-	var oItem;
-	if (oLexer.eof() ||!(oItem = fExprSingle_parse(oLexer, oStaticContext)))
-		return;
-
-	// Create expression
-	var oExpr	= new cExpr;
-	oExpr.items.push(oItem);
-	while (oLexer.peek() == ',') {
-		oLexer.next();
-		if (oLexer.eof() ||!(oItem = fExprSingle_parse(oLexer, oStaticContext)))
-			throw new cException("XPST0003"
-
-			);
-		oExpr.items.push(oItem);
-	}
-	return oExpr;
-};
-
-// Public members
-cExpr.prototype.evaluate	= function(oContext) {
-	var oSequence	= [];
-	for (var nIndex = 0, nLength = this.items.length; nIndex < nLength; nIndex++)
-		oSequence	= hStaticContext_operators["concatenate"].call(oContext, oSequence, this.items[nIndex].evaluate(oContext));
-	return oSequence;
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cExprSingle() {
-
-};
-
-// Static members
-function fExprSingle_parse (oLexer, oStaticContext) {
-	if (!oLexer.eof())
-		return fIfExpr_parse(oLexer, oStaticContext)
-			|| fForExpr_parse(oLexer, oStaticContext)
-			|| fQuantifiedExpr_parse(oLexer, oStaticContext)
-			|| fOrExpr_parse(oLexer, oStaticContext);
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cForExpr() {
-	this.bindings	= [];
-	this.returnExpr	= null;
-};
-
-cForExpr.prototype.bindings		= null;
-cForExpr.prototype.returnExpr	= null;
-
-// Static members
-function fForExpr_parse (oLexer, oStaticContext) {
-	if (oLexer.peek() == "for" && oLexer.peek(1).substr(0, 1) == '$') {
-		oLexer.next();
-
-		var oForExpr	= new cForExpr,
-			oExpr;
-		do {
-			oForExpr.bindings.push(fSimpleForBinding_parse(oLexer, oStaticContext));
-		}
-		while (oLexer.peek() == ',' && oLexer.next());
-
-		if (oLexer.peek() != "return")
-			throw new cException("XPST0003"
-
-			);
-
-		oLexer.next();
-		if (oLexer.eof() ||!(oExpr = fExprSingle_parse(oLexer, oStaticContext)))
-			throw new cException("XPST0003"
-
-			);
-
-		oForExpr.returnExpr	= oExpr;
-		return oForExpr;
-	}
-};
-
-// Public members
-// for $x in X, $y in Y, $z in Z return $x + $y + $z
-// for $x in X return for $y in Y return for $z in Z return $x + $y + $z
-cForExpr.prototype.evaluate	= function (oContext) {
-	var oSequence	= [];
-	(function(oSelf, nBinding) {
-		var oBinding	= oSelf.bindings[nBinding++],
-			oSequence1	= oBinding.inExpr.evaluate(oContext),
-			sUri	= (oBinding.namespaceURI ? '{' + oBinding.namespaceURI + '}' : '') + oBinding.localName;
-		for (var nIndex = 0, nLength = oSequence1.length; nIndex < nLength; nIndex++) {
-			oContext.pushVariable(sUri, oSequence1[nIndex]);
-			if (nBinding < oSelf.bindings.length)
-				arguments.callee(oSelf, nBinding);
-			else
-				oSequence	= oSequence.concat(oSelf.returnExpr.evaluate(oContext));
-			oContext.popVariable(sUri);
-		}
-	})(this, 0);
-
-	return oSequence;
-};
-
-//
-function cSimpleForBinding(sPrefix, sLocalName, sNameSpaceURI, oInExpr) {
-	this.prefix			= sPrefix;
-	this.localName		= sLocalName;
-	this.namespaceURI	= sNameSpaceURI;
-	this.inExpr		= oInExpr;
-};
-
-cSimpleForBinding.prototype.prefix			= null;
-cSimpleForBinding.prototype.localName		= null;
-cSimpleForBinding.prototype.namespaceURI	= null;
-cSimpleForBinding.prototype.inExpr		= null;
-
-function fSimpleForBinding_parse (oLexer, oStaticContext) {
-	var aMatch	= oLexer.peek().substr(1).match(rNameTest);
-	if (!aMatch)
-		throw new cException("XPST0003"
-
-		);
-
-	if (aMatch[1] == '*' || aMatch[2] == '*')
-		throw new cException("XPST0003"
-
-		);
-
-	oLexer.next();
-	if (oLexer.peek() != "in")
-		throw new cException("XPST0003"
-
-		);
-
-	oLexer.next();
-	var oExpr;
-	if (oLexer.eof() ||!(oExpr = fExprSingle_parse(oLexer, oStaticContext)))
-		throw new cException("XPST0003"
-
-		);
-
-	return new cSimpleForBinding(aMatch[1] || null, aMatch[2], aMatch[1] ? oStaticContext.getURIForPrefix(aMatch[1]) : null, oExpr);
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cIfExpr(oCondExpr, oThenExpr, oElseExpr) {
-	this.condExpr	= oCondExpr;
-	this.thenExpr		= oThenExpr;
-	this.elseExpr		= oElseExpr;
-};
-
-cIfExpr.prototype.condExpr	= null;
-cIfExpr.prototype.thenExpr	= null;
-cIfExpr.prototype.elseExpr	= null;
-
-// Static members
-function fIfExpr_parse (oLexer, oStaticContext) {
-	var oCondExpr,
-		oThenExpr,
-		oElseExpr;
-	if (oLexer.peek() == "if" && oLexer.peek(1) == '(') {
-		oLexer.next(2);
-		//
-		if (oLexer.eof() ||!(oCondExpr = fExpr_parse(oLexer, oStaticContext)))
-			throw new cException("XPST0003"
-
-			);
-		//
-		if (oLexer.peek() != ')')
-			throw new cException("XPST0003"
-
-			);
-
-		oLexer.next();
-		if (oLexer.peek() != "then")
-			throw new cException("XPST0003"
-
-			);
-
-		oLexer.next();
-		if (oLexer.eof() ||!(oThenExpr = fExprSingle_parse(oLexer, oStaticContext)))
-			throw new cException("XPST0003"
-
-			);
-
-		if (oLexer.peek() != "else")
-			throw new cException("XPST0003"
-
-			);
-
-		oLexer.next();
-		if (oLexer.eof() ||!(oElseExpr = fExprSingle_parse(oLexer, oStaticContext)))
-			throw new cException("XPST0003"
-
-			);
-		//
-		return new cIfExpr(oCondExpr, oThenExpr, oElseExpr);
-	}
-};
-
-// Public members
-cIfExpr.prototype.evaluate	= function (oContext) {
-	return this[fFunction_sequence_toEBV(this.condExpr.evaluate(oContext), oContext) ? "thenExpr" : "elseExpr"].evaluate(oContext);
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cQuantifiedExpr(sQuantifier) {
-	this.quantifier		= sQuantifier;
-	this.bindings		= [];
-	this.satisfiesExpr	= null;
-};
-
-cQuantifiedExpr.prototype.bindings		= null;
-cQuantifiedExpr.prototype.quantifier	= null;
-cQuantifiedExpr.prototype.satisfiesExpr	= null;
-
-// Static members
-function fQuantifiedExpr_parse (oLexer, oStaticContext) {
-	var sQuantifier	= oLexer.peek();
-	if ((sQuantifier == "some" || sQuantifier == "every") && oLexer.peek(1).substr(0, 1) == '$') {
-		oLexer.next();
-
-		var oQuantifiedExpr	= new cQuantifiedExpr(sQuantifier),
-			oExpr;
-		do {
-			oQuantifiedExpr.bindings.push(fSimpleQuantifiedBinding_parse(oLexer, oStaticContext));
-		}
-		while (oLexer.peek() == ',' && oLexer.next());
-
-		if (oLexer.peek() != "satisfies")
-			throw new cException("XPST0003"
-
-			);
-
-		oLexer.next();
-		if (oLexer.eof() ||!(oExpr = fExprSingle_parse(oLexer, oStaticContext)))
-			throw new cException("XPST0003"
-
-			);
-
-		oQuantifiedExpr.satisfiesExpr	= oExpr;
-		return oQuantifiedExpr;
-	}
-};
-
-// Public members
-cQuantifiedExpr.prototype.evaluate	= function (oContext) {
-	// TODO: re-factor
-	var bEvery	= this.quantifier == "every",
-		bResult	= bEvery ? true : false;
-	(function(oSelf, nBinding) {
-		var oBinding	= oSelf.bindings[nBinding++],
-			oSequence1	= oBinding.inExpr.evaluate(oContext),
-			sUri	= (oBinding.namespaceURI ? '{' + oBinding.namespaceURI + '}' : '') + oBinding.localName;
-		for (var nIndex = 0, nLength = oSequence1.length; (nIndex < nLength) && (bEvery ? bResult :!bResult); nIndex++) {
-			oContext.pushVariable(sUri, oSequence1[nIndex]);
-			if (nBinding < oSelf.bindings.length)
-				arguments.callee(oSelf, nBinding);
-			else
-				bResult	= fFunction_sequence_toEBV(oSelf.satisfiesExpr.evaluate(oContext), oContext);
-			oContext.popVariable(sUri);
-		}
-	})(this, 0);
-
-	return [new cXSBoolean(bResult)];
-};
-
-
-
-//
-function cSimpleQuantifiedBinding(sPrefix, sLocalName, sNameSpaceURI, oInExpr) {
-	this.prefix			= sPrefix;
-	this.localName		= sLocalName;
-	this.namespaceURI	= sNameSpaceURI;
-	this.inExpr		= oInExpr;
-};
-
-cSimpleQuantifiedBinding.prototype.prefix		= null;
-cSimpleQuantifiedBinding.prototype.localName	= null;
-cSimpleQuantifiedBinding.prototype.namespaceURI	= null;
-cSimpleQuantifiedBinding.prototype.inExpr	= null;
-
-function fSimpleQuantifiedBinding_parse (oLexer, oStaticContext) {
-	var aMatch	= oLexer.peek().substr(1).match(rNameTest);
-	if (!aMatch)
-		throw new cException("XPST0003"
-
-		);
-
-	if (aMatch[1] == '*' || aMatch[2] == '*')
-		throw new cException("XPST0003"
-
-		);
-
-	oLexer.next();
-	if (oLexer.peek() != "in")
-		throw new cException("XPST0003"
-
-		);
-
-	oLexer.next();
-	var oExpr;
-	if (oLexer.eof() ||!(oExpr = fExprSingle_parse(oLexer, oStaticContext)))
-		throw new cException("XPST0003"
-
-		);
-
-	return new cSimpleQuantifiedBinding(aMatch[1] || null, aMatch[2], aMatch[1] ? oStaticContext.getURIForPrefix(aMatch[1]) : null, oExpr);
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cComparisonExpr(oLeft, oRight, sOperator) {
-	this.left	= oLeft;
-	this.right	= oRight;
-	this.operator	= sOperator;
-};
-
-cComparisonExpr.prototype.left	= null;
-cComparisonExpr.prototype.right	= null;
-cComparisonExpr.prototype.operator	= null;
-
-// Static members
-function fComparisonExpr_parse (oLexer, oStaticContext) {
-	var oExpr,
-		oRight;
-	if (oLexer.eof() ||!(oExpr = fRangeExpr_parse(oLexer, oStaticContext)))
-		return;
-	if (!(oLexer.peek() in hComparisonExpr_operators))
-		return oExpr;
-
-	// Comparison expression
-	var sOperator	= oLexer.peek();
-	oLexer.next();
-	if (oLexer.eof() ||!(oRight = fRangeExpr_parse(oLexer, oStaticContext)))
-		throw new cException("XPST0003"
-
-		);
-	return new cComparisonExpr(oExpr, oRight, sOperator);
-};
-
-// Public members
-cComparisonExpr.prototype.evaluate	= function (oContext) {
-	var oResult	= hComparisonExpr_operators[this.operator](this, oContext);
-	return oResult == null ? [] : [oResult];
-};
-
-// General comparison
-function fComparisonExpr_GeneralComp(oExpr, oContext) {
-	var oLeft	= fFunction_sequence_atomize(oExpr.left.evaluate(oContext), oContext);
-	if (!oLeft.length)
-		return new cXSBoolean(false);
-
-	var oRight	= fFunction_sequence_atomize(oExpr.right.evaluate(oContext), oContext);
-	if (!oRight.length)
-		return new cXSBoolean(false);
-
-	var bResult	= false;
-	for (var nLeftIndex = 0, nLeftLength = oLeft.length, bLeft, vLeft; (nLeftIndex < nLeftLength) &&!bResult; nLeftIndex++) {
-		for (var nRightIndex = 0, nRightLength = oRight.length, bRight, vRight; (nRightIndex < nRightLength) &&!bResult; nRightIndex++) {
-
-			vLeft	= oLeft[nLeftIndex];
-			vRight	= oRight[nRightIndex];
-
-			bLeft	= vLeft instanceof cXSUntypedAtomic;
-			bRight	= vRight instanceof cXSUntypedAtomic;
-
-			if (bLeft && bRight) {
-				// cast xs:untypedAtomic to xs:string
-				vLeft	= cXSString.cast(vLeft);
-				vRight	= cXSString.cast(vRight);
-			}
-			else {
-				//
-				if (bLeft) {
-					// Special: durations
-					if (vRight instanceof cXSDayTimeDuration)
-						vLeft	= cXSDayTimeDuration.cast(vLeft);
-					else
-					if (vRight instanceof cXSYearMonthDuration)
-						vLeft	= cXSYearMonthDuration.cast(vLeft);
-					else
-					//
-					if (vRight.primitiveKind)
-						vLeft	= hStaticContext_dataTypes[vRight.primitiveKind].cast(vLeft);
-				}
-				else
-				if (bRight) {
-					// Special: durations
-					if (vLeft instanceof cXSDayTimeDuration)
-						vRight	= cXSDayTimeDuration.cast(vRight);
-					else
-					if (vLeft instanceof cXSYearMonthDuration)
-						vRight	= cXSYearMonthDuration.cast(vRight);
-					else
-					//
-					if (vLeft.primitiveKind)
-						vRight	= hStaticContext_dataTypes[vLeft.primitiveKind].cast(vRight);
-				}
-
-				// cast xs:anyURI to xs:string
-				if (vLeft instanceof cXSAnyURI)
-					vLeft	= cXSString.cast(vLeft);
-				if (vRight instanceof cXSAnyURI)
-					vRight	= cXSString.cast(vRight);
-			}
-
-			bResult	= hComparisonExpr_ValueComp_operators[hComparisonExpr_GeneralComp_map[oExpr.operator]](vLeft, vRight, oContext).valueOf();
-		}
-	}
-	return new cXSBoolean(bResult);
-};
-
-var hComparisonExpr_GeneralComp_map	= {
-	'=':	'eq',
-	'!=':	'ne',
-	'>':	'gt',
-	'<':	'lt',
-	'>=':	'ge',
-	'<=':	'le'
-};
-
-// Value comparison
-function fComparisonExpr_ValueComp(oExpr, oContext) {
-	var oLeft	= fFunction_sequence_atomize(oExpr.left.evaluate(oContext), oContext);
-	if (!oLeft.length)
-		return null;
-	// Assert cardinality
-	fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?'
-
-	);
-
-	var oRight	= fFunction_sequence_atomize(oExpr.right.evaluate(oContext), oContext);
-	if (!oRight.length)
-		return null;
-	// Assert cardinality
-	fFunctionCall_assertSequenceCardinality(oContext, oRight, '?'
-
-	);
-
-	var vLeft	= oLeft[0],
-		vRight	= oRight[0];
-
-	// cast xs:untypedAtomic to xs:string
-	if (vLeft instanceof cXSUntypedAtomic)
-		vLeft	= cXSString.cast(vLeft);
-	if (vRight instanceof cXSUntypedAtomic)
-		vRight	= cXSString.cast(vRight);
-
-	// cast xs:anyURI to xs:string
-	if (vLeft instanceof cXSAnyURI)
-		vLeft	= cXSString.cast(vLeft);
-	if (vRight instanceof cXSAnyURI)
-		vRight	= cXSString.cast(vRight);
-
-	//
-	return hComparisonExpr_ValueComp_operators[oExpr.operator](vLeft, vRight, oContext);
-};
-
-//
-var hComparisonExpr_ValueComp_operators	= {};
-hComparisonExpr_ValueComp_operators['eq']	= function(oLeft, oRight, oContext) {
-	var sOperator	= '';
-
-	if (fXSAnyAtomicType_isNumeric(oLeft)) {
-		if (fXSAnyAtomicType_isNumeric(oRight))
-			sOperator	= "numeric-equal";
-	}
-	else
-	if (oLeft instanceof cXSBoolean) {
-		if (oRight instanceof cXSBoolean)
-			sOperator	= "boolean-equal";
-	}
-	else
-	if (oLeft instanceof cXSString) {
-		if (oRight instanceof cXSString)
-			return hStaticContext_operators["numeric-equal"].call(oContext, hStaticContext_functions["compare"].call(oContext, oLeft, oRight), new cXSInteger(0));
-	}
-	else
-	if (oLeft instanceof cXSDate) {
-		if (oRight instanceof cXSDate)
-			sOperator	= "date-equal";
-	}
-	else
-	if (oLeft instanceof cXSTime) {
-		if (oRight instanceof cXSTime)
-			sOperator	= "time-equal";
-	}
-	else
-	if (oLeft instanceof cXSDateTime) {
-		if (oRight instanceof cXSDateTime)
-			sOperator	= "dateTime-equal";
-	}
-	else
-	if (oLeft instanceof cXSDuration) {
-		if (oRight instanceof cXSDuration)
-			sOperator	= "duration-equal";
-	}
-	else
-	if (oLeft instanceof cXSGYearMonth) {
-		if (oRight instanceof cXSGYearMonth)
-			sOperator	= "gYearMonth-equal";
-	}
-	else
-	if (oLeft instanceof cXSGYear) {
-		if (oRight instanceof cXSGYear)
-			sOperator	= "gYear-equal";
-	}
-	else
-	if (oLeft instanceof cXSGMonthDay) {
-		if (oRight instanceof cXSGMonthDay)
-			sOperator	= "gMonthDay-equal";
-	}
-	else
-	if (oLeft instanceof cXSGMonth) {
-		if (oRight instanceof cXSGMonth)
-			sOperator	= "gMonth-equal";
-	}
-	else
-	if (oLeft instanceof cXSGDay) {
-		if (oRight instanceof cXSGDay)
-			sOperator	= "gDay-equal";
-	}
-	// skipped: xs:anyURI (covered by xs:string)
-	else
-	if (oLeft instanceof cXSQName) {
-		if (oRight instanceof cXSQName)
-			sOperator	= "QName-equal";
-	}
-	else
-	if (oLeft instanceof cXSHexBinary) {
-		if (oRight instanceof cXSHexBinary)
-			sOperator	= "hexBinary-equal";
-	}
-	else
-	if (oLeft instanceof cXSBase64Binary) {
-		if (oRight instanceof cXSBase64Binary)
-			sOperator	= "base64Binary-equal";
-	}
-
-	// Call operator function
-	if (sOperator)
-		return hStaticContext_operators[sOperator].call(oContext, oLeft, oRight);
-
-	// skipped: xs:NOTATION
-	throw new cException("XPTY0004"
-
-	);	// Cannot compare {type1} to {type2}
-};
-hComparisonExpr_ValueComp_operators['ne']	= function(oLeft, oRight, oContext) {
-	return new cXSBoolean(!hComparisonExpr_ValueComp_operators['eq'](oLeft, oRight, oContext).valueOf());
-};
-hComparisonExpr_ValueComp_operators['gt']	= function(oLeft, oRight, oContext) {
-	var sOperator	= '';
-
-	if (fXSAnyAtomicType_isNumeric(oLeft)) {
-		if (fXSAnyAtomicType_isNumeric(oRight))
-			sOperator	= "numeric-greater-than";
-	}
-	else
-	if (oLeft instanceof cXSBoolean) {
-		if (oRight instanceof cXSBoolean)
-			sOperator	= "boolean-greater-than";
-	}
-	else
-	if (oLeft instanceof cXSString) {
-		if (oRight instanceof cXSString)
-			return hStaticContext_operators["numeric-greater-than"].call(oContext, hStaticContext_functions["compare"].call(oContext, oLeft, oRight), new cXSInteger(0));
-	}
-	else
-	if (oLeft instanceof cXSDate) {
-		if (oRight instanceof cXSDate)
-			sOperator	= "date-greater-than";
-	}
-	else
-	if (oLeft instanceof cXSTime) {
-		if (oRight instanceof cXSTime)
-			sOperator	= "time-greater-than";
-	}
-	else
-	if (oLeft instanceof cXSDateTime) {
-		if (oRight instanceof cXSDateTime)
-			sOperator	= "dateTime-greater-than";
-	}
-	else
-	if (oLeft instanceof cXSYearMonthDuration) {
-		if (oRight instanceof cXSYearMonthDuration)
-			sOperator	= "yearMonthDuration-greater-than";
-	}
-	else
-	if (oLeft instanceof cXSDayTimeDuration) {
-		if (oRight instanceof cXSDayTimeDuration)
-			sOperator	= "dayTimeDuration-greater-than";
-	}
-
-	// Call operator function
-	if (sOperator)
-		return hStaticContext_operators[sOperator].call(oContext, oLeft, oRight);
-
-	// skipped: xs:anyURI (covered by xs:string)
-	throw new cException("XPTY0004"
-
-	);	// Cannot compare {type1} to {type2}
-};
-hComparisonExpr_ValueComp_operators['lt']	= function(oLeft, oRight, oContext) {
-	var sOperator	= '';
-
-	if (fXSAnyAtomicType_isNumeric(oLeft)) {
-		if (fXSAnyAtomicType_isNumeric(oRight))
-			sOperator	= "numeric-less-than";
-	}
-	else
-	if (oLeft instanceof cXSBoolean) {
-		if (oRight instanceof cXSBoolean)
-			sOperator	= "boolean-less-than";
-	}
-	else
-	if (oLeft instanceof cXSString) {
-		if (oRight instanceof cXSString)
-			return hStaticContext_operators["numeric-less-than"].call(oContext, hStaticContext_functions["compare"].call(oContext, oLeft, oRight), new cXSInteger(0));
-	}
-	else
-	if (oLeft instanceof cXSDate) {
-		if (oRight instanceof cXSDate)
-			sOperator	= "date-less-than";
-	}
-	else
-	if (oLeft instanceof cXSTime) {
-		if (oRight instanceof cXSTime)
-			sOperator	= "time-less-than";
-	}
-	else
-	if (oLeft instanceof cXSDateTime) {
-		if (oRight instanceof cXSDateTime)
-			sOperator	= "dateTime-less-than";
-	}
-	else
-	if (oLeft instanceof cXSYearMonthDuration) {
-		if (oRight instanceof cXSYearMonthDuration)
-			sOperator	= "yearMonthDuration-less-than";
-	}
-	else
-	if (oLeft instanceof cXSDayTimeDuration) {
-		if (oRight instanceof cXSDayTimeDuration)
-			sOperator	= "dayTimeDuration-less-than";
-	}
-
-	// Call operator function
-	if (sOperator)
-		return hStaticContext_operators[sOperator].call(oContext, oLeft, oRight);
-
-	// skipped: xs:anyURI (covered by xs:string)
-	throw new cException("XPTY0004"
-
-	);	// Cannot compare {type1} to {type2}
-};
-hComparisonExpr_ValueComp_operators['ge']	= function(oLeft, oRight, oContext) {
-	var sOperator	= '';
-
-	if (fXSAnyAtomicType_isNumeric(oLeft)) {
-		if (fXSAnyAtomicType_isNumeric(oRight))
-			sOperator	= "numeric-less-than";
-	}
-	else
-	if (oLeft instanceof cXSBoolean) {
-		if (oRight instanceof cXSBoolean)
-			sOperator	= "boolean-less-than";
-	}
-	else
-	if (oLeft instanceof cXSString) {
-		if (oRight instanceof cXSString)
-			return hStaticContext_operators["numeric-greater-than"].call(oContext, hStaticContext_functions["compare"].call(oContext, oLeft, oRight), new cXSInteger(-1));
-	}
-	else
-	if (oLeft instanceof cXSDate) {
-		if (oRight instanceof cXSDate)
-			sOperator	= "date-less-than";
-	}
-	else
-	if (oLeft instanceof cXSTime) {
-		if (oRight instanceof cXSTime)
-			sOperator	= "time-less-than";
-	}
-	else
-	if (oLeft instanceof cXSDateTime) {
-		if (oRight instanceof cXSDateTime)
-			sOperator	= "dateTime-less-than";
-	}
-	else
-	if (oLeft instanceof cXSYearMonthDuration) {
-		if (oRight instanceof cXSYearMonthDuration)
-			sOperator	= "yearMonthDuration-less-than";
-	}
-	else
-	if (oLeft instanceof cXSDayTimeDuration) {
-		if (oRight instanceof cXSDayTimeDuration)
-			sOperator	= "dayTimeDuration-less-than";
-	}
-
-	// Call operator function
-	if (sOperator)
-		return new cXSBoolean(!hStaticContext_operators[sOperator].call(oContext, oLeft, oRight).valueOf());
-
-	// skipped: xs:anyURI (covered by xs:string)
-	throw new cException("XPTY0004"
-
-	);	// Cannot compare {type1} to {type2}
-};
-hComparisonExpr_ValueComp_operators['le']	= function(oLeft, oRight, oContext) {
-	var sOperator	= '';
-
-	if (fXSAnyAtomicType_isNumeric(oLeft)) {
-		if (fXSAnyAtomicType_isNumeric(oRight))
-			sOperator	= "numeric-greater-than";
-	}
-	else
-	if (oLeft instanceof cXSBoolean) {
-		if (oRight instanceof cXSBoolean)
-			sOperator	= "boolean-greater-than";
-	}
-	else
-	if (oLeft instanceof cXSString) {
-		if (oRight instanceof cXSString)
-			return hStaticContext_operators["numeric-less-than"].call(oContext, hStaticContext_functions["compare"].call(oContext, oLeft, oRight), new cXSInteger(1));
-	}
-	else
-	if (oLeft instanceof cXSDate) {
-		if (oRight instanceof cXSDate)
-			sOperator	= "date-greater-than";
-	}
-	else
-	if (oLeft instanceof cXSTime) {
-		if (oRight instanceof cXSTime)
-			sOperator	= "time-greater-than";
-	}
-	else
-	if (oLeft instanceof cXSDateTime) {
-		if (oRight instanceof cXSDateTime)
-			sOperator	= "dateTime-greater-than";
-	}
-	else
-	if (oLeft instanceof cXSYearMonthDuration) {
-		if (oRight instanceof cXSYearMonthDuration)
-			sOperator	= "yearMonthDuration-greater-than";
-	}
-	else
-	if (oLeft instanceof cXSDayTimeDuration) {
-		if (oRight instanceof cXSDayTimeDuration)
-			sOperator	= "dayTimeDuration-greater-than";
-	}
-
-	// Call operator function
-	if (sOperator)
-		return new cXSBoolean(!hStaticContext_operators[sOperator].call(oContext, oLeft, oRight).valueOf());
-
-	// skipped: xs:anyURI (covered by xs:string)
-	throw new cException("XPTY0004"
-
-	);	// Cannot compare {type1} to {type2}
-};
-
-// Node comparison
-function fComparisonExpr_NodeComp(oExpr, oContext) {
-	var oLeft	= oExpr.left.evaluate(oContext);
-	if (!oLeft.length)
-		return null;
-	// Assert cardinality
-	fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?'
-
-	);
-	// Assert item type
-	fFunctionCall_assertSequenceItemType(oContext, oLeft, cXTNode
-
-	);
-
-	var oRight	= oExpr.right.evaluate(oContext);
-	if (!oRight.length)
-		return null;
-	// Assert cardinality
-	fFunctionCall_assertSequenceCardinality(oContext, oRight, '?'
-
-	);
-	// Assert item type
-	fFunctionCall_assertSequenceItemType(oContext, oRight, cXTNode
-
-	);
-
-	return hComparisonExpr_NodeComp_operators[oExpr.operator](oLeft[0], oRight[0], oContext);
-};
-
-var hComparisonExpr_NodeComp_operators	= {};
-hComparisonExpr_NodeComp_operators['is']	= function(oLeft, oRight, oContext) {
-	return hStaticContext_operators["is-same-node"].call(oContext, oLeft, oRight);
-};
-hComparisonExpr_NodeComp_operators['>>']	= function(oLeft, oRight, oContext) {
-	return hStaticContext_operators["node-after"].call(oContext, oLeft, oRight);
-};
-hComparisonExpr_NodeComp_operators['<<']	= function(oLeft, oRight, oContext) {
-	return hStaticContext_operators["node-before"].call(oContext, oLeft, oRight);
-};
-
-// Operators
-var hComparisonExpr_operators	= {
-	// GeneralComp
-	'=':	fComparisonExpr_GeneralComp,
-	'!=':	fComparisonExpr_GeneralComp,
-	'<':	fComparisonExpr_GeneralComp,
-	'<=':	fComparisonExpr_GeneralComp,
-	'>':	fComparisonExpr_GeneralComp,
-	'>=':	fComparisonExpr_GeneralComp,
-	// ValueComp
-	'eq':	fComparisonExpr_ValueComp,
-	'ne':	fComparisonExpr_ValueComp,
-	'lt':	fComparisonExpr_ValueComp,
-	'le':	fComparisonExpr_ValueComp,
-	'gt':	fComparisonExpr_ValueComp,
-	'ge':	fComparisonExpr_ValueComp,
-	// NodeComp
-	'is':	fComparisonExpr_NodeComp,
-	'>>':	fComparisonExpr_NodeComp,
-	'<<':	fComparisonExpr_NodeComp
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cAdditiveExpr(oExpr) {
-	this.left	= oExpr;
-	this.items	= [];
-};
-
-cAdditiveExpr.prototype.left	= null;
-cAdditiveExpr.prototype.items	= null;
-
-//
-var hAdditiveExpr_operators	= {};
-hAdditiveExpr_operators['+']	= function(oLeft, oRight, oContext) {
-	var sOperator	= '',
-		bReverse	= false;
-
-	if (fXSAnyAtomicType_isNumeric(oLeft)) {
-		if (fXSAnyAtomicType_isNumeric(oRight))
-			sOperator	= "numeric-add";
-	}
-	else
-	if (oLeft instanceof cXSDate) {
-		if (oRight instanceof cXSYearMonthDuration)
-			sOperator	= "add-yearMonthDuration-to-date";
-		else
-		if (oRight instanceof cXSDayTimeDuration)
-			sOperator	= "add-dayTimeDuration-to-date";
-	}
-	else
-	if (oLeft instanceof cXSYearMonthDuration) {
-		if (oRight instanceof cXSDate) {
-			sOperator	= "add-yearMonthDuration-to-date";
-			bReverse	= true;
-		}
-		else
-		if (oRight instanceof cXSDateTime) {
-			sOperator	= "add-yearMonthDuration-to-dateTime";
-			bReverse	= true;
-		}
-		else
-		if (oRight instanceof cXSYearMonthDuration)
-			sOperator	= "add-yearMonthDurations";
-	}
-	else
-	if (oLeft instanceof cXSDayTimeDuration) {
-		if (oRight instanceof cXSDate) {
-			sOperator	= "add-dayTimeDuration-to-date";
-			bReverse	= true;
-		}
-		else
-		if (oRight instanceof cXSTime) {
-			sOperator	= "add-dayTimeDuration-to-time";
-			bReverse	= true;
-		}
-		else
-		if (oRight instanceof cXSDateTime) {
-			sOperator	= "add-dayTimeDuration-to-dateTime";
-			bReverse	= true;
-		}
-		else
-		if (oRight instanceof cXSDayTimeDuration)
-			sOperator	= "add-dayTimeDurations";
-	}
-	else
-	if (oLeft instanceof cXSTime) {
-		if (oRight instanceof cXSDayTimeDuration)
-			sOperator	= "add-dayTimeDuration-to-time";
-	}
-	else
-	if (oLeft instanceof cXSDateTime) {
-		if (oRight instanceof cXSYearMonthDuration)
-			sOperator	= "add-yearMonthDuration-to-dateTime";
-		else
-		if (oRight instanceof cXSDayTimeDuration)
-			sOperator	= "add-dayTimeDuration-to-dateTime";
-	}
-
-	// Call operator function
-	if (sOperator)
-		return hStaticContext_operators[sOperator].call(oContext, bReverse ? oRight : oLeft, bReverse ? oLeft : oRight);
-
-	//
-	throw new cException("XPTY0004"
-
-	);	// Arithmetic operator is not defined for arguments of types ({type1}, {type2})
-};
-hAdditiveExpr_operators['-']	= function (oLeft, oRight, oContext) {
-	var sOperator	= '';
-
-	if (fXSAnyAtomicType_isNumeric(oLeft)) {
-		if (fXSAnyAtomicType_isNumeric(oRight))
-			sOperator	= "numeric-subtract";
-	}
-	else
-	if (oLeft instanceof cXSDate) {
-		if (oRight instanceof cXSDate)
-			sOperator	= "subtract-dates";
-		else
-		if (oRight instanceof cXSYearMonthDuration)
-			sOperator	= "subtract-yearMonthDuration-from-date";
-		else
-		if (oRight instanceof cXSDayTimeDuration)
-			sOperator	= "subtract-dayTimeDuration-from-date";
-	}
-	else
-	if (oLeft instanceof cXSTime) {
-		if (oRight instanceof cXSTime)
-			sOperator	= "subtract-times";
-		else
-		if (oRight instanceof cXSDayTimeDuration)
-			sOperator	= "subtract-dayTimeDuration-from-time";
-	}
-	else
-	if (oLeft instanceof cXSDateTime) {
-		if (oRight instanceof cXSDateTime)
-			sOperator	= "subtract-dateTimes";
-		else
-		if (oRight instanceof cXSYearMonthDuration)
-			sOperator	= "subtract-yearMonthDuration-from-dateTime";
-		else
-		if (oRight instanceof cXSDayTimeDuration)
-			sOperator	= "subtract-dayTimeDuration-from-dateTime";
-	}
-	else
-	if (oLeft instanceof cXSYearMonthDuration) {
-		if (oRight instanceof cXSYearMonthDuration)
-			sOperator	= "subtract-yearMonthDurations";
-	}
-	else
-	if (oLeft instanceof cXSDayTimeDuration) {
-		if (oRight instanceof cXSDayTimeDuration)
-			sOperator	= "subtract-dayTimeDurations";
-	}
-
-	// Call operator function
-	if (sOperator)
-		return hStaticContext_operators[sOperator].call(oContext, oLeft, oRight);
-
-	//
-	throw new cException("XPTY0004"
-
-	);	// Arithmetic operator is not defined for arguments of types ({type1}, {type2})
-};
-
-// Static members
-function fAdditiveExpr_parse (oLexer, oStaticContext) {
-	var oExpr;
-	if (oLexer.eof() ||!(oExpr = fMultiplicativeExpr_parse(oLexer, oStaticContext)))
-		return;
-	if (!(oLexer.peek() in hAdditiveExpr_operators))
-		return oExpr;
-
-	// Additive expression
-	var oAdditiveExpr	= new cAdditiveExpr(oExpr),
-		sOperator;
-	while ((sOperator = oLexer.peek()) in hAdditiveExpr_operators) {
-		oLexer.next();
-		if (oLexer.eof() ||!(oExpr = fMultiplicativeExpr_parse(oLexer, oStaticContext)))
-			throw new cException("XPST0003"
-
-			);
-		oAdditiveExpr.items.push([sOperator, oExpr]);
-	}
-	return oAdditiveExpr;
-};
-
-// Public members
-cAdditiveExpr.prototype.evaluate	= function (oContext) {
-	var oLeft	= fFunction_sequence_atomize(this.left.evaluate(oContext), oContext);
-
-	if (!oLeft.length)
-		return [];
-	// Assert cardinality
-	fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?'
-
-	);
-
-	var vLeft	= oLeft[0];
-	if (vLeft instanceof cXSUntypedAtomic)
-		vLeft	= cXSDouble.cast(vLeft);	// cast to xs:double
-
-	for (var nIndex = 0, nLength = this.items.length, oRight, vRight; nIndex < nLength; nIndex++) {
-		oRight	= fFunction_sequence_atomize(this.items[nIndex][1].evaluate(oContext), oContext);
-
-		if (!oRight.length)
-			return [];
-		// Assert cardinality
-		fFunctionCall_assertSequenceCardinality(oContext, oRight, '?'
-
-		);
-
-		vRight	= oRight[0];
-		if (vRight instanceof cXSUntypedAtomic)
-			vRight	= cXSDouble.cast(vRight);	// cast to xs:double
-
-		vLeft	= hAdditiveExpr_operators[this.items[nIndex][0]](vLeft, vRight, oContext);
-	}
-	return [vLeft];
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cMultiplicativeExpr(oExpr) {
-	this.left	= oExpr;
-	this.items	= [];
-};
-
-cMultiplicativeExpr.prototype.left	= null;
-cMultiplicativeExpr.prototype.items	= null;
-
-//
-var hMultiplicativeExpr_operators	= {};
-hMultiplicativeExpr_operators['*']		= function (oLeft, oRight, oContext) {
-	var sOperator	= '',
-		bReverse	= false;
-
-	if (fXSAnyAtomicType_isNumeric(oLeft)) {
-		if (fXSAnyAtomicType_isNumeric(oRight))
-			sOperator	= "numeric-multiply";
-		else
-		if (oRight instanceof cXSYearMonthDuration) {
-			sOperator	= "multiply-yearMonthDuration";
-			bReverse	= true;
-		}
-		else
-		if (oRight instanceof cXSDayTimeDuration) {
-			sOperator	= "multiply-dayTimeDuration";
-			bReverse	= true;
-		}
-	}
-	else {
-		if (oLeft instanceof cXSYearMonthDuration) {
-			if (fXSAnyAtomicType_isNumeric(oRight))
-				sOperator	= "multiply-yearMonthDuration";
-		}
-		else
-		if (oLeft instanceof cXSDayTimeDuration) {
-			if (fXSAnyAtomicType_isNumeric(oRight))
-				sOperator	= "multiply-dayTimeDuration";
-		}
-	}
-
-	// Call operator function
-	if (sOperator)
-		return hStaticContext_operators[sOperator].call(oContext, bReverse ? oRight : oLeft, bReverse ? oLeft : oRight);
-
-	//
-	throw new cException("XPTY0004"
-
-	);	// Arithmetic operator is not defined for arguments of types ({type1}, {type2})
-};
-hMultiplicativeExpr_operators['div']	= function (oLeft, oRight, oContext) {
-	var sOperator	= '';
-
-	if (fXSAnyAtomicType_isNumeric(oLeft)) {
-		if (fXSAnyAtomicType_isNumeric(oRight))
-			sOperator	= "numeric-divide";
-	}
-	else
-	if (oLeft instanceof cXSYearMonthDuration) {
-		if (fXSAnyAtomicType_isNumeric(oRight))
-			sOperator	= "divide-yearMonthDuration";
-		else
-		if (oRight instanceof cXSYearMonthDuration)
-			sOperator	= "divide-yearMonthDuration-by-yearMonthDuration";
-	}
-	else
-	if (oLeft instanceof cXSDayTimeDuration) {
-		if (fXSAnyAtomicType_isNumeric(oRight))
-			sOperator	= "divide-dayTimeDuration";
-		else
-		if (oRight instanceof cXSDayTimeDuration)
-			sOperator	= "divide-dayTimeDuration-by-dayTimeDuration";
-	}
-	// Call operator function
-	if (sOperator)
-		return hStaticContext_operators[sOperator].call(oContext, oLeft, oRight);
-
-	//
-	throw new cException("XPTY0004"
-
-	);	// Arithmetic operator is not defined for arguments of types ({type1}, {type2})
-};
-hMultiplicativeExpr_operators['idiv']	= function (oLeft, oRight, oContext) {
-	if (fXSAnyAtomicType_isNumeric(oLeft) && fXSAnyAtomicType_isNumeric(oRight))
-		return hStaticContext_operators["numeric-integer-divide"].call(oContext, oLeft, oRight);
-	//
-	throw new cException("XPTY0004"
-
-	);	// Arithmetic operator is not defined for arguments of types ({type1}, {type2})
-};
-hMultiplicativeExpr_operators['mod']	= function (oLeft, oRight, oContext) {
-	if (fXSAnyAtomicType_isNumeric(oLeft) && fXSAnyAtomicType_isNumeric(oRight))
-		return hStaticContext_operators["numeric-mod"].call(oContext, oLeft, oRight);
-	//
-	throw new cException("XPTY0004"
-
-	);	// Arithmetic operator is not defined for arguments of types ({type1}, {type2})
-};
-
-// Static members
-function fMultiplicativeExpr_parse (oLexer, oStaticContext) {
-	var oExpr;
-	if (oLexer.eof() ||!(oExpr = fUnionExpr_parse(oLexer, oStaticContext)))
-		return;
-	if (!(oLexer.peek() in hMultiplicativeExpr_operators))
-		return oExpr;
-
-	// Additive expression
-	var oMultiplicativeExpr	= new cMultiplicativeExpr(oExpr),
-		sOperator;
-	while ((sOperator = oLexer.peek()) in hMultiplicativeExpr_operators) {
-		oLexer.next();
-		if (oLexer.eof() ||!(oExpr = fUnionExpr_parse(oLexer, oStaticContext)))
-			throw new cException("XPST0003"
-
-			);
-		oMultiplicativeExpr.items.push([sOperator, oExpr]);
-	}
-	return oMultiplicativeExpr;
-};
-
-// Public members
-cMultiplicativeExpr.prototype.evaluate	= function (oContext) {
-	var oLeft	= fFunction_sequence_atomize(this.left.evaluate(oContext), oContext);
-
-	//
-	if (!oLeft.length)
-		return [];
-	// Assert cardinality
-	fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?'
-
-	);
-
-	var vLeft	= oLeft[0];
-	if (vLeft instanceof cXSUntypedAtomic)
-		vLeft	= cXSDouble.cast(vLeft);	// cast to xs:double
-
-	for (var nIndex = 0, nLength = this.items.length, oRight, vRight; nIndex < nLength; nIndex++) {
-		oRight	= fFunction_sequence_atomize(this.items[nIndex][1].evaluate(oContext), oContext);
-
-		if (!oRight.length)
-			return [];
-		// Assert cardinality
-		fFunctionCall_assertSequenceCardinality(oContext, oRight, '?'
-
-		);
-
-		vRight	= oRight[0];
-		if (vRight instanceof cXSUntypedAtomic)
-			vRight	= cXSDouble.cast(vRight);	// cast to xs:double
-
-		vLeft	= hMultiplicativeExpr_operators[this.items[nIndex][0]](vLeft, vRight, oContext);
-	}
-	return [vLeft];
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cUnaryExpr(sOperator, oExpr) {
-	this.operator	= sOperator;
-	this.expression	= oExpr;
-};
-
-cUnaryExpr.prototype.operator	= null;
-cUnaryExpr.prototype.expression	= null;
-
-//
-var hUnaryExpr_operators	= {};
-hUnaryExpr_operators['-']	= function(oRight, oContext) {
-	if (fXSAnyAtomicType_isNumeric(oRight))
-		return hStaticContext_operators["numeric-unary-minus"].call(oContext, oRight);
-	//
-	throw new cException("XPTY0004"
-
-	);	// Arithmetic operator is not defined for arguments of types ({type1}, {type2})
-};
-hUnaryExpr_operators['+']	= function(oRight, oContext) {
-	if (fXSAnyAtomicType_isNumeric(oRight))
-		return hStaticContext_operators["numeric-unary-plus"].call(oContext, oRight);
-	//
-	throw new cException("XPTY0004"
-
-	);	// Arithmetic operator is not defined for arguments of types ({type1}, {type2})
-};
-
-// Static members
-// UnaryExpr	:= ("-" | "+")* ValueExpr
-function fUnaryExpr_parse (oLexer, oStaticContext) {
-	if (oLexer.eof())
-		return;
-	if (!(oLexer.peek() in hUnaryExpr_operators))
-		return fValueExpr_parse(oLexer, oStaticContext);
-
-	// Unary expression
-	var sOperator	= '+',
-		oExpr;
-	while (oLexer.peek() in hUnaryExpr_operators) {
-		if (oLexer.peek() == '-')
-			sOperator	= sOperator == '-' ? '+' : '-';
-		oLexer.next();
-	}
-	if (oLexer.eof() ||!(oExpr = fValueExpr_parse(oLexer, oStaticContext)))
-		throw new cException("XPST0003"
-
-		);
-	return new cUnaryExpr(sOperator, oExpr);
-};
-
-cUnaryExpr.prototype.evaluate	= function (oContext) {
-	var oRight	= fFunction_sequence_atomize(this.expression.evaluate(oContext), oContext);
-
-	//
-	if (!oRight.length)
-		return [];
-	// Assert cardinality
-	fFunctionCall_assertSequenceCardinality(oContext, oRight, '?'
-
-	);
-
-	var vRight	= oRight[0];
-	if (vRight instanceof cXSUntypedAtomic)
-		vRight	= cXSDouble.cast(vRight);	// cast to xs:double
-
-	return [hUnaryExpr_operators[this.operator](vRight, oContext)];
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cValueExpr() {
-
-};
-
-// Static members
-function fValueExpr_parse (oLexer, oStaticContext) {
-	return fPathExpr_parse(oLexer, oStaticContext);
-};
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cOrExpr(oExpr) {
-	this.left	= oExpr;
-	this.items	= [];
-};
-
-cOrExpr.prototype.left	= null;
-cOrExpr.prototype.items	= null;
-
-// Static members
-function fOrExpr_parse (oLexer, oStaticContext) {
-	var oExpr;
-	if (oLexer.eof() ||!(oExpr = fAndExpr_parse(oLexer, oStaticContext)))
-		return;
-	if (oLexer.peek() != "or")
-		return oExpr;
-
-	// Or expression
-	var oOrExpr	= new cOrExpr(oExpr);
-	while (oLexer.peek() == "or") {
-		oLexer.next();
-		if (oLexer.eof() ||!(oExpr = fAndExpr_parse(oLexer, oStaticContext)))
-			throw new cException("XPST0003"
-
-			);
-		oOrExpr.items.push(oExpr);
-	}
-	return oOrExpr;
-};
-
-// Public members
-cOrExpr.prototype.evaluate	= function (oContext) {
-	var bValue	= fFunction_sequence_toEBV(this.left.evaluate(oContext), oContext);
-	for (var nIndex = 0, nLength = this.items.length; (nIndex < nLength) && !bValue; nIndex++)
-		bValue	= fFunction_sequence_toEBV(this.items[nIndex].evaluate(oContext), oContext);
-	return [new cXSBoolean(bValue)];
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cAndExpr(oExpr) {
-	this.left	= oExpr;
-	this.items	= [];
-};
-
-cAndExpr.prototype.left		= null;
-cAndExpr.prototype.items	= null;
-
-// Static members
-function fAndExpr_parse (oLexer, oStaticContext) {
-	var oExpr;
-	if (oLexer.eof() ||!(oExpr = fComparisonExpr_parse(oLexer, oStaticContext)))
-		return;
-	if (oLexer.peek() != "and")
-		return oExpr;
-
-	// And expression
-	var oAndExpr	= new cAndExpr(oExpr);
-	while (oLexer.peek() == "and") {
-		oLexer.next();
-		if (oLexer.eof() ||!(oExpr = fComparisonExpr_parse(oLexer, oStaticContext)))
-			throw new cException("XPST0003"
-
-			);
-		oAndExpr.items.push(oExpr);
-	}
-	return oAndExpr;
-};
-
-// Public members
-cAndExpr.prototype.evaluate	= function (oContext) {
-	var bValue	= fFunction_sequence_toEBV(this.left.evaluate(oContext), oContext);
-	for (var nIndex = 0, nLength = this.items.length; (nIndex < nLength) && bValue; nIndex++)
-		bValue	= fFunction_sequence_toEBV(this.items[nIndex].evaluate(oContext), oContext);
-	return [new cXSBoolean(bValue)];
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cStepExpr() {
-
-};
-
-cStepExpr.prototype.predicates	= null;
-
-// Static members
-function fStepExpr_parse (oLexer, oStaticContext) {
-	if (!oLexer.eof())
-		return fFilterExpr_parse(oLexer, oStaticContext)
-			|| fAxisStep_parse(oLexer, oStaticContext);
-};
-
-function fStepExpr_parsePredicates (oLexer, oStaticContext, oStep) {
-	var oExpr;
-	// Parse predicates
-	while (oLexer.peek() == '[') {
-		oLexer.next();
-
-		if (oLexer.eof() ||!(oExpr = fExpr_parse(oLexer, oStaticContext)))
-			throw new cException("XPST0003"
-
-			);
-
-		oStep.predicates.push(oExpr);
-
-		if (oLexer.peek() != ']')
-			throw new cException("XPST0003"
-
-			);
-
-		oLexer.next();
-	}
-};
-
-// Public members
-cStepExpr.prototype.applyPredicates	= function(oSequence, oContext) {
-	var vContextItem	= oContext.item,
-		nContextPosition= oContext.position,
-		nContextSize	= oContext.size;
-	//
-	for (var nPredicateIndex = 0, oSequence1, nPredicateLength = this.predicates.length; nPredicateIndex < nPredicateLength; nPredicateIndex++) {
-		oSequence1	= oSequence;
-		oSequence	= [];
-		for (var nIndex = 0, oSequence2, nLength = oSequence1.length; nIndex < nLength; nIndex++) {
-			// Set new context
-			oContext.item		= oSequence1[nIndex];
-			oContext.position	= nIndex + 1;
-			oContext.size		= nLength;
-			//
-			oSequence2	= this.predicates[nPredicateIndex].evaluate(oContext);
-			//
-			if (oSequence2.length == 1 && fXSAnyAtomicType_isNumeric(oSequence2[0])) {
-				if (oSequence2[0].valueOf() == nIndex + 1)
-					oSequence.push(oSequence1[nIndex]);
-			}
-			else
-			if (fFunction_sequence_toEBV(oSequence2, oContext))
-				oSequence.push(oSequence1[nIndex]);
-		}
-	}
-	// Restore context
-	oContext.item		= vContextItem;
-	oContext.position	= nContextPosition;
-	oContext.size		= nContextSize;
-	//
-	return oSequence;
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cAxisStep(sAxis, oTest) {
-	this.axis	= sAxis;
-	this.test	= oTest;
-	this.predicates	= [];
-};
-
-cAxisStep.prototype	= new cStepExpr;
-
-cAxisStep.prototype.axis		= null;
-cAxisStep.prototype.test		= null;
-
-//
-var hAxisStep_axises	= {};
-// Forward axis
-hAxisStep_axises["attribute"]			= {};
-hAxisStep_axises["child"]				= {};
-hAxisStep_axises["descendant"]			= {};
-hAxisStep_axises["descendant-or-self"]	= {};
-hAxisStep_axises["following"]			= {};
-hAxisStep_axises["following-sibling"]	= {};
-hAxisStep_axises["self"]				= {};
-// hAxisStep_axises["namespace"]			= {};	// deprecated in 2.0
-// Reverse axis
-hAxisStep_axises["ancestor"]			= {};
-hAxisStep_axises["ancestor-or-self"]	= {};
-hAxisStep_axises["parent"]				= {};
-hAxisStep_axises["preceding"]			= {};
-hAxisStep_axises["preceding-sibling"]	= {};
-
-// Static members
-function fAxisStep_parse (oLexer, oStaticContext) {
-	var sAxis	= oLexer.peek(),
-		oExpr,
-		oStep;
-	if (oLexer.peek(1) == '::') {
-		if (!(sAxis in hAxisStep_axises))
-			throw new cException("XPST0003"
-
-			);
-
-		oLexer.next(2);
-		if (oLexer.eof() ||!(oExpr = fNodeTest_parse(oLexer, oStaticContext)))
-			throw new cException("XPST0003"
-
-			);
-		//
-		oStep	= new cAxisStep(sAxis, oExpr);
-	}
-	else
-	if (sAxis == '..') {
-		oLexer.next();
-		oStep	= new cAxisStep("parent", new cKindTest("node"));
-	}
-	else
-	if (sAxis == '@') {
-		oLexer.next();
-		if (oLexer.eof() ||!(oExpr = fNodeTest_parse(oLexer, oStaticContext)))
-			throw new cException("XPST0003"
-
-			);
-		//
-		oStep	= new cAxisStep("attribute", oExpr);
-	}
-	else {
-		if (oLexer.eof() ||!(oExpr = fNodeTest_parse(oLexer, oStaticContext)))
-			return;
-		oStep	= new cAxisStep(oExpr instanceof cKindTest && oExpr.name == "attribute" ? "attribute" : "child", oExpr);
-	}
-	//
-	fStepExpr_parsePredicates(oLexer, oStaticContext, oStep);
-
-	return oStep;
-};
-
-// Public members
-cAxisStep.prototype.evaluate	= function (oContext) {
-	var oItem	= oContext.item;
-
-	if (!oContext.DOMAdapter.isNode(oItem))
-		throw new cException("XPTY0020");
-
-	var oSequence	= [],
-		fGetProperty= oContext.DOMAdapter.getProperty,
-		nType		= fGetProperty(oItem, "nodeType");
-
-	switch (this.axis) {
-		// Forward axis
-		case "attribute":
-			if (nType == 1)
-				for (var aAttributes = fGetProperty(oItem, "attributes"), nIndex = 0, nLength = aAttributes.length; nIndex < nLength; nIndex++)
-					oSequence.push(aAttributes[nIndex]);
-			break;
-
-		case "child":
-			for (var oNode = fGetProperty(oItem, "firstChild"); oNode; oNode = fGetProperty(oNode, "nextSibling"))
-				oSequence.push(oNode);
-			break;
-
-		case "descendant-or-self":
-			oSequence.push(oItem);
-			// No break left intentionally
-		case "descendant":
-			fAxisStep_getChildrenForward(fGetProperty(oItem, "firstChild"), oSequence, fGetProperty);
-			break;
-
-		case "following":
-			// TODO: Attribute node context
-			for (var oParent = oItem, oSibling; oParent; oParent = fGetProperty(oParent, "parentNode"))
-				if (oSibling = fGetProperty(oParent, "nextSibling"))
-					fAxisStep_getChildrenForward(oSibling, oSequence, fGetProperty);
-			break;
-
-		case "following-sibling":
-			for (var oNode = oItem; oNode = fGetProperty(oNode, "nextSibling");)
-				oSequence.push(oNode);
-			break;
-
-		case "self":
-			oSequence.push(oItem);
-			break;
-
-		// Reverse axis
-		case "ancestor-or-self":
-			oSequence.push(oItem);
-			// No break left intentionally
-		case "ancestor":
-			for (var oNode = nType == 2 ? fGetProperty(oItem, "ownerElement") : oItem; oNode = fGetProperty(oNode, "parentNode");)
-				oSequence.push(oNode);
-			break;
-
-		case "parent":
-			var oParent	= nType == 2 ? fGetProperty(oItem, "ownerElement") : fGetProperty(oItem, "parentNode");
-			if (oParent)
-				oSequence.push(oParent);
-			break;
-
-		case "preceding":
-			// TODO: Attribute node context
-			for (var oParent = oItem, oSibling; oParent; oParent = fGetProperty(oParent, "parentNode"))
-				if (oSibling = fGetProperty(oParent, "previousSibling"))
-					fAxisStep_getChildrenBackward(oSibling, oSequence, fGetProperty);
-			break;
-
-		case "preceding-sibling":
-			for (var oNode = oItem; oNode = fGetProperty(oNode, "previousSibling");)
-				oSequence.push(oNode);
-			break;
-	}
-
-	// Apply test
-	if (oSequence.length && !(this.test instanceof cKindTest && this.test.name == "node")) {
-		var oSequence1	= oSequence;
-		oSequence	= [];
-		for (var nIndex = 0, nLength = oSequence1.length; nIndex < nLength; nIndex++) {
-			if (this.test.test(oSequence1[nIndex], oContext))
-				oSequence.push(oSequence1[nIndex]);
-		}
-	}
-
-	// Apply predicates
-	if (oSequence.length && this.predicates.length)
-		oSequence	= this.applyPredicates(oSequence, oContext);
-
-	// Reverse results if reverse axis
-	switch (this.axis) {
-		case "ancestor":
-		case "ancestor-or-self":
-		case "parent":
-		case "preceding":
-		case "preceding-sibling":
-			oSequence.reverse();
-	}
-
-	return oSequence;
-};
-
-//
-function fAxisStep_getChildrenForward(oNode, oSequence, fGetProperty) {
-	for (var oChild; oNode; oNode = fGetProperty(oNode, "nextSibling")) {
-		oSequence.push(oNode);
-		if (oChild = fGetProperty(oNode, "firstChild"))
-			fAxisStep_getChildrenForward(oChild, oSequence, fGetProperty);
-	}
-};
-
-function fAxisStep_getChildrenBackward(oNode, oSequence, fGetProperty) {
-	for (var oChild; oNode; oNode = fGetProperty(oNode, "previousSibling")) {
-		if (oChild = fGetProperty(oNode, "lastChild"))
-			fAxisStep_getChildrenBackward(oChild, oSequence, fGetProperty);
-		oSequence.push(oNode);
-	}
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cPathExpr() {
-	this.items	= [];
-};
-
-cPathExpr.prototype.items	= null;
-
-// Static members
-function fPathExpr_parse (oLexer, oStaticContext) {
-	if (oLexer.eof())
-		return;
-	var sSingleSlash	= '/',
-		sDoubleSlash	= '/' + '/';
-
-	var oPathExpr	= new cPathExpr(),
-		sSlash	= oLexer.peek(),
-		oExpr;
-	// Parse first step
-	if (sSlash == sDoubleSlash || sSlash == sSingleSlash) {
-		oLexer.next();
-		oPathExpr.items.push(new cFunctionCall(null, "root", sNS_XPF));
-		//
-		if (sSlash == sDoubleSlash)
-			oPathExpr.items.push(new cAxisStep("descendant-or-self", new cKindTest("node")));
-	}
-
-	//
-	if (oLexer.eof() ||!(oExpr = fStepExpr_parse(oLexer, oStaticContext))) {
-		if (sSlash == sSingleSlash)
-			return oPathExpr.items[0];	// '/' expression
-		if (sSlash == sDoubleSlash)
-			throw new cException("XPST0003"
-
-			);
-		return;
-	}
-	oPathExpr.items.push(oExpr);
-
-	// Parse other steps
-	while ((sSlash = oLexer.peek()) == sSingleSlash || sSlash == sDoubleSlash) {
-		if (sSlash == sDoubleSlash)
-			oPathExpr.items.push(new cAxisStep("descendant-or-self", new cKindTest("node")));
-		//
-		oLexer.next();
-		if (oLexer.eof() ||!(oExpr = fStepExpr_parse(oLexer, oStaticContext)))
-			throw new cException("XPST0003"
-
-			);
-		//
-		oPathExpr.items.push(oExpr);
-	}
-
-	if (oPathExpr.items.length == 1)
-		return oPathExpr.items[0];
-
-	//
-	return oPathExpr;
-};
-
-// Public members
-cPathExpr.prototype.evaluate	= function (oContext) {
-	var vContextItem	= oContext.item;
-	//
-	var oSequence	= [vContextItem];
-	for (var nItemIndex = 0, nItemLength = this.items.length, oSequence1; nItemIndex < nItemLength; nItemIndex++) {
-		oSequence1	= [];
-		for (var nIndex = 0, nLength = oSequence.length; nIndex < nLength; nIndex++) {
-			// Set new context item
-			oContext.item	= oSequence[nIndex];
-			//
-			for (var nRightIndex = 0, oSequence2 = this.items[nItemIndex].evaluate(oContext), nRightLength = oSequence2.length; nRightIndex < nRightLength; nRightIndex++)
-				if ((nItemIndex < nItemLength - 1) && !oContext.DOMAdapter.isNode(oSequence2[nRightIndex]))
-					throw new cException("XPTY0019");
-				else
-				if (fArray_indexOf(oSequence1, oSequence2[nRightIndex]) ==-1)
-					oSequence1.push(oSequence2[nRightIndex]);
-		}
-		oSequence	= oSequence1;
-	};
-	// Restore context item
-	oContext.item	= vContextItem;
-	//
-	return fFunction_sequence_order(oSequence, oContext);
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cNodeTest() {
-
-};
-
-// Static members
-function fNodeTest_parse (oLexer, oStaticContext) {
-	if (!oLexer.eof())
-		return fKindTest_parse(oLexer, oStaticContext)
-			|| fNameTest_parse(oLexer, oStaticContext);
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cKindTest(sName) {
-	this.name	= sName;
-	this.args	= [];
-};
-
-cKindTest.prototype	= new cNodeTest;
-
-cKindTest.prototype.name	= null;
-cKindTest.prototype.args	= null;
-
-var hKindTest_names	= {};
-//
-hKindTest_names["document-node"]	= {};
-hKindTest_names["element"]			= {};
-hKindTest_names["attribute"]		= {};
-hKindTest_names["processing-instruction"]	= {};
-hKindTest_names["comment"]			= {};
-hKindTest_names["text"]				= {};
-hKindTest_names["node"]				= {};
-//
-hKindTest_names["schema-element"]	= {};
-hKindTest_names["schema-attribute"]	= {};
-
-// Static members
-function fKindTest_parse (oLexer, oStaticContext) {
-	var sName	= oLexer.peek(),
-		oValue;
-	if (oLexer.peek(1) == '(') {
-		//
-		if (!(sName in hKindTest_names))
-			throw new cException("XPST0003"
-
-			);
-
-		//
-		oLexer.next(2);
-		//
-		var oTest	= new cKindTest(sName);
-		if (oLexer.peek() != ')') {
-			if (sName == "document-node") {
-				// TODO: parse test further
-			}
-			else
-			if (sName == "element") {
-				// TODO: parse test further
-			}
-			else
-			if (sName == "attribute") {
-				// TODO: parse test further
-			}
-			else
-			if (sName == "processing-instruction") {
-				oValue = fStringLiteral_parse(oLexer, oStaticContext);
-				if (!oValue) {
-					oValue = new cStringLiteral(new cXSString(oLexer.peek()));
-					oLexer.next();
-				}
-				oTest.args.push(oValue);
-			}
-			else
-			if (sName == "schema-attribute") {
-				// TODO: parse test further
-			}
-			else
-			if (sName == "schema-element") {
-				// TODO: parse test further
-			}
-		}
-		else {
-			if (sName == "schema-attribute")
-				throw new cException("XPST0003"
-
-				);
-			else
-			if (sName == "schema-element")
-				throw new cException("XPST0003"
-
-				);
-		}
-
-		if (oLexer.peek() != ')')
-			throw new cException("XPST0003"
-
-			);
-		oLexer.next();
-
-		return oTest;
-	}
-};
-
-// Public members
-cKindTest.prototype.test	= function (oNode, oContext) {
-	var fGetProperty	= oContext.DOMAdapter.getProperty,
-		nType	= oContext.DOMAdapter.isNode(oNode) ? fGetProperty(oNode, "nodeType") : 0,
-		sTarget;
-	switch (this.name) {
-		// Node type test
-		case "node":			return !!nType;
-		case "attribute":				if (nType != 2)	return false;	break;
-		case "document-node":	return nType == 9;
-		case "element":			return nType == 1;
-		case "processing-instruction":	if (nType != 7)	return false;	break;
-		case "comment":			return nType == 8;
-		case "text":			return nType == 3 || nType == 4;
-
-		// Schema tests
-		case "schema-attribute":
-			throw "KindTest '" + "schema-attribute" + "' not implemented";
-
-		case "schema-element":
-			throw "KindTest '" + "schema-element" + "' not implemented";
-	}
-
-	// Additional tests
-	if (nType == 2)
-		return fGetProperty(oNode, "prefix") != "xmlns" && fGetProperty(oNode, "localName") != "xmlns";
-	if (nType == 7) {
-		sTarget = fGetProperty(oNode, "target");
-		return this.args.length ? sTarget == this.args[0].value : sTarget != "xml";
-	}
-
-	return true;
-};
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cNameTest(sPrefix, sLocalName, sNameSpaceURI) {
-	this.prefix			= sPrefix;
-	this.localName		= sLocalName;
-	this.namespaceURI	= sNameSpaceURI;
-};
-
-cNameTest.prototype	= new cNodeTest;
-
-cNameTest.prototype.prefix			= null;
-cNameTest.prototype.localName		= null;
-cNameTest.prototype.namespaceURI	= null;
-
-// Static members
-var rNameTest	= /^(?:(?![0-9-])(\w[\w.-]*|\*)\:)?(?![0-9-])(\w[\w.-]*|\*)$/;
-function fNameTest_parse (oLexer, oStaticContext) {
-	var aMatch	= oLexer.peek().match(rNameTest);
-	if (aMatch) {
-		if (aMatch[1] == '*' && aMatch[2] == '*')
-			throw new cException("XPST0003"
-
-			);
-		oLexer.next();
-		return new cNameTest(aMatch[1] || null, aMatch[2], aMatch[1] ? aMatch[1] == '*' ? '*' : oStaticContext.getURIForPrefix(aMatch[1]) || null : oStaticContext.defaultElementNamespace);
-	}
-};
-
-// Public members
-cNameTest.prototype.test	= function (oNode, oContext) {
-	var fGetProperty	= oContext.DOMAdapter.getProperty,
-		nType	= fGetProperty(oNode, "nodeType");
-	if (nType == 1 || nType == 2) {
-		if (this.localName == '*')
-			return (nType == 1 || (fGetProperty(oNode, "prefix") != "xmlns" && fGetProperty(oNode, "localName") != "xmlns")) && (!this.prefix || fGetProperty(oNode, "namespaceURI") == this.namespaceURI);
-		if (this.localName == fGetProperty(oNode, "localName"))
-			return this.namespaceURI == '*' || (nType == 2 && !this.prefix && !fGetProperty(oNode, "prefix")) || fGetProperty(oNode, "namespaceURI") == this.namespaceURI;
-	}
-	//
-	return false;
-};
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cPrimaryExpr() {
-
-};
-
-// Static members
-function fPrimaryExpr_parse (oLexer, oStaticContext) {
-	if (!oLexer.eof())
-		return fContextItemExpr_parse(oLexer, oStaticContext)
-			|| fParenthesizedExpr_parse(oLexer, oStaticContext)
-			|| fFunctionCall_parse(oLexer, oStaticContext)
-			|| fVarRef_parse(oLexer, oStaticContext)
-			|| fLiteral_parse(oLexer, oStaticContext);
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cParenthesizedExpr(oExpr) {
-	this.expression	= oExpr;
-};
-
-// Static members
-function fParenthesizedExpr_parse (oLexer, oStaticContext) {
-	if (oLexer.peek() == '(') {
-		oLexer.next();
-		// Check if not empty (allowed)
-		var oExpr	= null;
-		if (oLexer.peek() != ')')
-			oExpr	= fExpr_parse(oLexer, oStaticContext);
-
-		//
-		if (oLexer.peek() != ')')
-			throw new cException("XPST0003"
-
-			);
-
-		oLexer.next();
-
-		//
-		return new cParenthesizedExpr(oExpr);
-	}
-};
-
-// Public members
-cParenthesizedExpr.prototype.evaluate	= function (oContext) {
-	return this.expression ? this.expression.evaluate(oContext) : [];
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cContextItemExpr() {
-
-};
-
-// Static members
-function fContextItemExpr_parse (oLexer, oStaticContext) {
-	if (oLexer.peek() == '.') {
-		oLexer.next();
-		return new cContextItemExpr;
-	}
-};
-
-// Public members
-cContextItemExpr.prototype.evaluate	= function (oContext) {
-	if (oContext.item == null)
-		throw new cException("XPDY0002"
-
-		);
-	//
-	return [oContext.item];
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cLiteral() {
-
-};
-
-cLiteral.prototype.value	= null;
-
-// Static members
-function fLiteral_parse (oLexer, oStaticContext) {
-	if (!oLexer.eof())
-		return fNumericLiteral_parse(oLexer, oStaticContext)
-			|| fStringLiteral_parse(oLexer, oStaticContext);
-};
-
-// Public members
-cLiteral.prototype.evaluate	= function (oContext) {
-	return [this.value];
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cNumericLiteral(oValue) {
-	this.value	= oValue;
-};
-
-cNumericLiteral.prototype	= new cLiteral;
-
-// Integer | Decimal | Double
-var rNumericLiteral	= /^[+\-]?(?:(?:(\d+)(?:\.(\d*))?)|(?:\.(\d+)))(?:[eE]([+-])?(\d+))?$/;
-function fNumericLiteral_parse (oLexer, oStaticContext) {
-	var sValue	= oLexer.peek(),
-		vValue	= fNumericLiteral_parseValue(sValue);
-	if (vValue) {
-		oLexer.next();
-		return new cNumericLiteral(vValue);
-	}
-};
-
-function fNumericLiteral_parseValue(sValue) {
-	var aMatch	= sValue.match(rNumericLiteral);
-	if (aMatch) {
-		var cType	= cXSInteger;
-		if (aMatch[5])
-			cType	= cXSDouble;
-		else
-		if (aMatch[2] || aMatch[3])
-			cType	= cXSDecimal;
-		return new cType(+sValue);
-	}
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cStringLiteral(oValue) {
-	this.value	= oValue;
-};
-
-cStringLiteral.prototype	= new cLiteral;
-
-var rStringLiteral	= /^'([^']*(?:''[^']*)*)'|"([^"]*(?:""[^"]*)*)"$/;
-function fStringLiteral_parse (oLexer, oStaticContext) {
-	var aMatch	= oLexer.peek().match(rStringLiteral);
-	if (aMatch) {
-		oLexer.next();
-		return new cStringLiteral(new cXSString(aMatch[1] ? aMatch[1].replace("''", "'") : aMatch[2] ? aMatch[2].replace('""', '"') : ''));
-	}
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cFilterExpr(oPrimary) {
-	this.expression	= oPrimary;
-	this.predicates	= [];
-};
-
-cFilterExpr.prototype	= new cStepExpr;
-
-cFilterExpr.prototype.expression	= null;
-
-// Static members
-function fFilterExpr_parse (oLexer, oStaticContext) {
-	var oExpr;
-	if (oLexer.eof() ||!(oExpr = fPrimaryExpr_parse(oLexer, oStaticContext)))
-		return;
-
-	var oFilterExpr	= new cFilterExpr(oExpr);
-	// Parse predicates
-	fStepExpr_parsePredicates(oLexer, oStaticContext, oFilterExpr);
-
-	// If no predicates found
-	if (oFilterExpr.predicates.length == 0)
-		return oFilterExpr.expression;
-
-	return oFilterExpr;
-};
-
-// Public members
-cFilterExpr.prototype.evaluate	= function (oContext) {
-	var oSequence	= this.expression.evaluate(oContext);
-	if (this.predicates.length && oSequence.length)
-		oSequence	= this.applyPredicates(oSequence, oContext);
-	return oSequence;
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cVarRef(sPrefix, sLocalName, sNameSpaceURI) {
-	this.prefix			= sPrefix;
-	this.localName		= sLocalName;
-	this.namespaceURI	= sNameSpaceURI;
-};
-
-cVarRef.prototype.prefix		= null;
-cVarRef.prototype.localName		= null;
-cVarRef.prototype.namespaceURI	= null;
-
-// Static members
-function fVarRef_parse (oLexer, oStaticContext) {
-	if (oLexer.peek().substr(0, 1) == '$') {
-		var aMatch	= oLexer.peek().substr(1).match(rNameTest);
-		if (aMatch) {
-			if (aMatch[1] == '*' || aMatch[2] == '*')
-				throw new cException("XPST0003"
-	
-				);
-
-			var oVarRef	= new cVarRef(aMatch[1] || null, aMatch[2], aMatch[1] ? oStaticContext.getURIForPrefix(aMatch[1]) : null);
-			oLexer.next();
-			return oVarRef;
-		}
-	}
-};
-
-// Public members
-cVarRef.prototype.evaluate	= function (oContext) {
-	var sUri	= (this.namespaceURI ? '{' + this.namespaceURI + '}' : '') + this.localName;
-	if (oContext.scope.hasOwnProperty(sUri))
-		return [oContext.scope[sUri]];
-	//
-	throw new cException("XPST0008"
-
-	);
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cFunctionCall(sPrefix, sLocalName, sNameSpaceURI) {
-	this.prefix			= sPrefix;
-	this.localName		= sLocalName;
-	this.namespaceURI	= sNameSpaceURI;
-	this.args	= [];
-};
-
-cFunctionCall.prototype.prefix			= null;
-cFunctionCall.prototype.localName		= null;
-cFunctionCall.prototype.namespaceURI	= null;
-cFunctionCall.prototype.args	= null;
-
-// Static members
-function fFunctionCall_parse (oLexer, oStaticContext) {
-	var aMatch	= oLexer.peek().match(rNameTest);
-	if (aMatch && oLexer.peek(1) == '(') {
-		// Reserved "functions"
-		if (!aMatch[1] && (aMatch[2] in hKindTest_names))
-			return fAxisStep_parse(oLexer, oStaticContext);
-		// Other functions
-		if (aMatch[1] == '*' || aMatch[2] == '*')
-			throw new cException("XPST0003"
-
-			);
-		var oFunctionCallExpr	= new cFunctionCall(aMatch[1] || null, aMatch[2], aMatch[1] ? oStaticContext.getURIForPrefix(aMatch[1]) || null : oStaticContext.defaultFunctionNamespace),
-			oExpr;
-		oLexer.next(2);
-		//
-		if (oLexer.peek() != ')') {
-			do {
-				if (oLexer.eof() ||!(oExpr = fExprSingle_parse(oLexer, oStaticContext)))
-					throw new cException("XPST0003"
-
-					);
-				//
-				oFunctionCallExpr.args.push(oExpr);
-			}
-			while (oLexer.peek() == ',' && oLexer.next());
-			//
-			if (oLexer.peek() != ')')
-				throw new cException("XPST0003"
-
-				);
-		}
-		oLexer.next();
-		return oFunctionCallExpr;
-	}
-};
-
-// Public members
-cFunctionCall.prototype.evaluate	= function (oContext) {
-	var aArguments	= [],
-		aParameters,
-		fFunction;
-
-	// Evaluate arguments
-	for (var nIndex = 0, nLength = this.args.length; nIndex < nLength; nIndex++)
-		aArguments.push(this.args[nIndex].evaluate(oContext));
-
-	var sUri	= (this.namespaceURI ? '{' + this.namespaceURI + '}' : '') + this.localName;
-	// Call function
-	if (this.namespaceURI == sNS_XPF) {
-		if (fFunction = hStaticContext_functions[this.localName]) {
-			// Validate/Cast arguments
-			if (aParameters = hStaticContext_signatures[this.localName])
-				fFunctionCall_prepare(this.localName, aParameters, fFunction, aArguments, oContext);
-			//
-			var vResult	= fFunction.apply(oContext, aArguments);
-			//
-			return vResult == null ? [] : vResult instanceof cArray ? vResult : [vResult];
-		}
-		throw new cException("XPST0017"
-
-		);
-	}
-	else
-	if (this.namespaceURI == sNS_XSD) {
-		if ((fFunction = hStaticContext_dataTypes[this.localName]) && this.localName != "NOTATION" && this.localName != "anyAtomicType") {
-			//
-			fFunctionCall_prepare(this.localName, [[cXSAnyAtomicType, '?']], fFunction, aArguments, oContext);
-			//
-			return aArguments[0] === null ? [] : [fFunction.cast(aArguments[0])];
-		}
-		throw new cException("XPST0017"
-
-		);
-	}
-	else
-	if (fFunction = oContext.staticContext.getFunction(sUri)) {
-		//
-		var vResult	= fFunction.apply(oContext, aArguments);
-		//
-		return vResult == null ? [] : vResult instanceof cArray ? vResult : [vResult];
-	}
-	//
-	throw new cException("XPST0017"
-
-	);
-};
-
-var aFunctionCall_numbers	= ["first", "second", "third", "fourth", "fifth"];
-function fFunctionCall_prepare(sName, aParameters, fFunction, aArguments, oContext) {
-	var oArgument,
-		nArgumentsLength	= aArguments.length,
-		oParameter,
-		nParametersLength	= aParameters.length,
-		nParametersRequired	= 0;
-
-	// Determine amount of parameters required
-	while ((nParametersRequired < aParameters.length) && !aParameters[nParametersRequired][2])
-		nParametersRequired++;
-
-	// Validate arguments length
-	if (nArgumentsLength > nParametersLength)
-		throw new cException("XPST0017"
-
-		);
-	else
-	if (nArgumentsLength < nParametersRequired)
-		throw new cException("XPST0017"
-
-		);
-
-	for (var nIndex = 0; nIndex < nArgumentsLength; nIndex++) {
-		oParameter	= aParameters[nIndex];
-		oArgument	= aArguments[nIndex];
-		// Check sequence cardinality
-		fFunctionCall_assertSequenceCardinality(oContext, oArgument, oParameter[1]
-
-		);
-		// Check sequence items data types consistency
-		fFunctionCall_assertSequenceItemType(oContext, oArgument, oParameter[0]
-
-		);
-		if (oParameter[1] != '+' && oParameter[1] != '*')
-			aArguments[nIndex]	= oArgument.length ? oArgument[0] : null;
-	}
-};
-
-function fFunctionCall_assertSequenceItemType(oContext, oSequence, cItemType
-
-	) {
-	//
-	for (var nIndex = 0, nLength = oSequence.length, nNodeType, vItem; nIndex < nLength; nIndex++) {
-		vItem	= oSequence[nIndex];
-		// Node types
-		if (cItemType == cXTNode || cItemType.prototype instanceof cXTNode) {
-			// Check if is node
-			if (!oContext.DOMAdapter.isNode(vItem))
-				throw new cException("XPTY0004"
-
-				);
-
-			// Check node type
-			if (cItemType != cXTNode) {
-				nNodeType	= oContext.DOMAdapter.getProperty(vItem, "nodeType");
-				if ([null, cXTElement, cXTAttribute, cXTText, cXTText, null, null, cXTProcessingInstruction, cXTComment, cXTDocument, null, null, null][nNodeType] != cItemType)
-					throw new cException("XPTY0004"
-
-					);
-			}
-		}
-		else
-		// Atomic types
-		if (cItemType == cXSAnyAtomicType || cItemType.prototype instanceof cXSAnyAtomicType) {
-			// Atomize item
-			vItem	= fFunction_sequence_atomize([vItem], oContext)[0];
-			// Convert type if necessary
-			if (cItemType != cXSAnyAtomicType) {
-				// Cast item to expected type if it's type is xs:untypedAtomic
-				if (vItem instanceof cXSUntypedAtomic)
-					vItem	= cItemType.cast(vItem);
-				// Cast item to xs:string if it's type is xs:anyURI
-				else
-				if (cItemType == cXSString/* || cItemType.prototype instanceof cXSString*/) {
-					if (vItem instanceof cXSAnyURI)
-						vItem	= cXSString.cast(vItem);
-				}
-				else
-				if (cItemType == cXSDouble/* || cItemType.prototype instanceof cXSDouble*/) {
-					if (fXSAnyAtomicType_isNumeric(vItem))
-						vItem	= cItemType.cast(vItem);
-				}
-			}
-			// Check type
-			if (!(vItem instanceof cItemType))
-				throw new cException("XPTY0004"
-
-				);
-			// Write value back to sequence
-			oSequence[nIndex]	= vItem;
-		}
-	}
-};
-
-function fFunctionCall_assertSequenceCardinality(oContext, oSequence, sCardinality
-
-	) {
-	var nLength	= oSequence.length;
-	// Check cardinality
-	if (sCardinality == '?') {	// =0 or 1
-		if (nLength > 1)
-			throw new cException("XPTY0004"
-
-			);
-	}
-	else
-	if (sCardinality == '+') {	// =1+
-		if (nLength < 1)
-			throw new cException("XPTY0004"
-
-			);
-	}
-	else
-	if (sCardinality != '*') {	// =1 ('*' =0+)
-		if (nLength != 1)
-			throw new cException("XPTY0004"
-
-			);
-	}
-};
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cIntersectExceptExpr(oExpr) {
-	this.left	= oExpr;
-	this.items	= [];
-};
-
-cIntersectExceptExpr.prototype.left		= null;
-cIntersectExceptExpr.prototype.items	= null;
-
-// Static members
-function fIntersectExceptExpr_parse (oLexer, oStaticContext) {
-	var oExpr,
-		sOperator;
-	if (oLexer.eof() ||!(oExpr = fInstanceofExpr_parse(oLexer, oStaticContext)))
-		return;
-	if (!((sOperator = oLexer.peek()) == "intersect" || sOperator == "except"))
-		return oExpr;
-
-	// IntersectExcept expression
-	var oIntersectExceptExpr	= new cIntersectExceptExpr(oExpr);
-	while ((sOperator = oLexer.peek()) == "intersect" || sOperator == "except") {
-		oLexer.next();
-		if (oLexer.eof() ||!(oExpr = fInstanceofExpr_parse(oLexer, oStaticContext)))
-			throw new cException("XPST0003"
-
-			);
-		oIntersectExceptExpr.items.push([sOperator, oExpr]);
-	}
-	return oIntersectExceptExpr;
-};
-
-// Public members
-cIntersectExceptExpr.prototype.evaluate	= function (oContext) {
-	var oSequence	= this.left.evaluate(oContext);
-	for (var nIndex = 0, nLength = this.items.length, oItem; nIndex < nLength; nIndex++)
-		oSequence	= hStaticContext_operators[(oItem = this.items[nIndex])[0]].call(oContext, oSequence, oItem[1].evaluate(oContext));
-	return oSequence;
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cRangeExpr(oLeft, oRight) {
-	this.left	= oLeft;
-	this.right	= oRight;
-};
-
-cRangeExpr.prototype.left	= null;
-cRangeExpr.prototype.right	= null;
-
-// Static members
-function fRangeExpr_parse (oLexer, oStaticContext) {
-	var oExpr,
-		oRight;
-	if (oLexer.eof() ||!(oExpr = fAdditiveExpr_parse(oLexer, oStaticContext)))
-		return;
-	if (oLexer.peek() != "to")
-		return oExpr;
-
-	// Range expression
-	oLexer.next();
-	if (oLexer.eof() ||!(oRight = fAdditiveExpr_parse(oLexer, oStaticContext)))
-		throw new cException("XPST0003"
-
-		);
-	return new cRangeExpr(oExpr, oRight);
-};
-
-// Public members
-cRangeExpr.prototype.evaluate	= function (oContext) {
-	//
-	var oLeft	= this.left.evaluate(oContext);
-	if (!oLeft.length)
-		return [];
-	//
-
-
-	fFunctionCall_assertSequenceCardinality(oContext, oLeft, '?'
-
-	);
-	fFunctionCall_assertSequenceItemType(oContext, oLeft, cXSInteger
-
-	);
-
-	var oRight	= this.right.evaluate(oContext);
-	if (!oRight.length)
-		return [];
-
-
-
-	fFunctionCall_assertSequenceCardinality(oContext, oRight, '?'
-
-	);
-	fFunctionCall_assertSequenceItemType(oContext, oRight, cXSInteger
-
-	);
-
-	return hStaticContext_operators["to"].call(oContext, oLeft[0], oRight[0]);
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cUnionExpr(oExpr) {
-	this.left	= oExpr;
-	this.items	= [];
-};
-
-cUnionExpr.prototype.left	= null;
-cUnionExpr.prototype.items	= null;
-
-// Static members
-function fUnionExpr_parse (oLexer, oStaticContext) {
-	var oExpr,
-		sOperator;
-	if (oLexer.eof() ||!(oExpr = fIntersectExceptExpr_parse(oLexer, oStaticContext)))
-		return;
-	if (!((sOperator = oLexer.peek()) == '|' || sOperator == "union"))
-		return oExpr;
-
-	// Union expression
-	var oUnionExpr	= new cUnionExpr(oExpr);
-	while ((sOperator = oLexer.peek()) == '|' || sOperator == "union") {
-		oLexer.next();
-		if (oLexer.eof() ||!(oExpr = fIntersectExceptExpr_parse(oLexer, oStaticContext)))
-			throw new cException("XPST0003"
-
-			);
-		oUnionExpr.items.push(oExpr);
-	}
-	return oUnionExpr;
-};
-
-// Public members
-cUnionExpr.prototype.evaluate	= function (oContext) {
-	var oSequence	= this.left.evaluate(oContext);
-	for (var nIndex = 0, nLength = this.items.length; nIndex < nLength; nIndex++)
-		oSequence	= hStaticContext_operators["union"].call(oContext, oSequence, this.items[nIndex].evaluate(oContext));
-	return oSequence;
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cInstanceofExpr(oExpr, oType) {
-	this.expression	= oExpr;
-	this.type		= oType;
-};
-
-cInstanceofExpr.prototype.expression	= null;
-cInstanceofExpr.prototype.type			= null;
-
-function fInstanceofExpr_parse (oLexer, oStaticContext) {
-	var oExpr,
-		oType;
-	if (oLexer.eof() ||!(oExpr = fTreatExpr_parse(oLexer, oStaticContext)))
-		return;
-
-	if (!(oLexer.peek() == "instance" && oLexer.peek(1) == "of"))
-		return oExpr;
-
-	oLexer.next(2);
-	if (oLexer.eof() ||!(oType = fSequenceType_parse(oLexer, oStaticContext)))
-		throw new cException("XPST0003"
-
-		);
-
-	return new cInstanceofExpr(oExpr, oType);
-};
-
-cInstanceofExpr.prototype.evaluate	= function(oContext) {
-	var oSequence1	= this.expression.evaluate(oContext),
-		oItemType	= this.type.itemType,
-		sOccurence	= this.type.occurence;
-	// Validate empty-sequence()
-	if (!oItemType)
-		return [new cXSBoolean(!oSequence1.length)];
-	// Validate cardinality
-	if (!oSequence1.length)
-		return [new cXSBoolean(sOccurence == '?' || sOccurence == '*')];
-	if (oSequence1.length != 1)
-		if (!(sOccurence == '+' || sOccurence == '*'))
-			return [new cXSBoolean(false)];
-
-	// Validate type
-	if (!oItemType.test)	// item()
-		return [new cXSBoolean(true)];
-
-	var bValue	= true;
-	for (var nIndex = 0, nLength = oSequence1.length; (nIndex < nLength) && bValue; nIndex++)
-		bValue	= oItemType.test.test(oSequence1[nIndex], oContext);
-	//
-	return [new cXSBoolean(bValue)];
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cTreatExpr(oExpr, oType) {
-	this.expression	= oExpr;
-	this.type		= oType;
-};
-
-cTreatExpr.prototype.expression	= null;
-cTreatExpr.prototype.type		= null;
-
-function fTreatExpr_parse (oLexer, oStaticContext) {
-	var oExpr,
-		oType;
-	if (oLexer.eof() ||!(oExpr = fCastableExpr_parse(oLexer, oStaticContext)))
-		return;
-
-	if (!(oLexer.peek() == "treat" && oLexer.peek(1) == "as"))
-		return oExpr;
-
-	oLexer.next(2);
-	if (oLexer.eof() ||!(oType = fSequenceType_parse(oLexer, oStaticContext)))
-		throw new cException("XPST0003"
-
-		);
-
-	return new cTreatExpr(oExpr, oType);
-};
-
-cTreatExpr.prototype.evaluate	= function(oContext) {
-	var oSequence1	= this.expression.evaluate(oContext),
-		oItemType	= this.type.itemType,
-		sOccurence	= this.type.occurence;
-	// Validate empty-sequence()
-	if (!oItemType) {
-		if (oSequence1.length)
-			throw new cException("XPDY0050"
-
-			);
-		return oSequence1;
-	}
-
-	// Validate cardinality
-	if (!(sOccurence == '?' || sOccurence == '*'))
-		if (!oSequence1.length)
-			throw new cException("XPDY0050"
-
-			);
-
-	if (!(sOccurence == '+' || sOccurence == '*'))
-		if (oSequence1.length != 1)
-			throw new cException("XPDY0050"
-
-			);
-
-	// Validate type
-	if (!oItemType.test)	// item()
-		return oSequence1;
-
-	for (var nIndex = 0, nLength = oSequence1.length; nIndex < nLength; nIndex++)
-		if (!oItemType.test.test(oSequence1[nIndex], oContext))
-			throw new cException("XPDY0050"
-
-			);
-
-	//
-	return oSequence1;
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cCastableExpr(oExpr, oType) {
-	this.expression	= oExpr;
-	this.type		= oType;
-};
-
-cCastableExpr.prototype.expression	= null;
-cCastableExpr.prototype.type		= null;
-
-function fCastableExpr_parse (oLexer, oStaticContext) {
-	var oExpr,
-		oType;
-	if (oLexer.eof() ||!(oExpr = fCastExpr_parse(oLexer, oStaticContext)))
-		return;
-
-	if (!(oLexer.peek() == "castable" && oLexer.peek(1) == "as"))
-		return oExpr;
-
-	oLexer.next(2);
-	if (oLexer.eof() ||!(oType = fSingleType_parse(oLexer, oStaticContext)))
-		throw new cException("XPST0003"
-
-		);
-
-	return new cCastableExpr(oExpr, oType);
-};
-
-cCastableExpr.prototype.evaluate	= function(oContext) {
-	var oSequence1	= this.expression.evaluate(oContext),
-		oItemType	= this.type.itemType,
-		sOccurence	= this.type.occurence;
-
-	if (oSequence1.length > 1)
-		return [new cXSBoolean(false)];
-	else
-	if (!oSequence1.length)
-		return [new cXSBoolean(sOccurence == '?')];
-
-	// Try casting
-	try {
-		oItemType.cast(fFunction_sequence_atomize(oSequence1, oContext)[0]);
-	}
-	catch (e) {
-		if (e.code == "XPST0051")
-			throw e;
-		if (e.code == "XPST0017")
-			throw new cException("XPST0080"
-
-			);
-		//
-		return [new cXSBoolean(false)];
-	}
-
-	return [new cXSBoolean(true)];
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cCastExpr(oExpr, oType) {
-	this.expression	= oExpr;
-	this.type		= oType;
-};
-
-cCastExpr.prototype.expression	= null;
-cCastExpr.prototype.type		= null;
-
-function fCastExpr_parse (oLexer, oStaticContext) {
-	var oExpr,
-		oType;
-	if (oLexer.eof() ||!(oExpr = fUnaryExpr_parse(oLexer, oStaticContext)))
-		return;
-
-	if (!(oLexer.peek() == "cast" && oLexer.peek(1) == "as"))
-		return oExpr;
-
-	oLexer.next(2);
-	if (oLexer.eof() ||!(oType = fSingleType_parse(oLexer, oStaticContext)))
-		throw new cException("XPST0003"
-
-		);
-
-	return new cCastExpr(oExpr, oType);
-};
-
-cCastExpr.prototype.evaluate	= function(oContext) {
-	var oSequence1	= this.expression.evaluate(oContext);
-	// Validate cardinality
-	fFunctionCall_assertSequenceCardinality(oContext, oSequence1, this.type.occurence
-
-	);
-	//
-	if (!oSequence1.length)
-		return [];
-	//
-	return [this.type.itemType.cast(fFunction_sequence_atomize(oSequence1, oContext)[0], oContext)];
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cAtomicType(sPrefix, sLocalName, sNameSpaceURI) {
-	this.prefix			= sPrefix;
-	this.localName		= sLocalName;
-	this.namespaceURI	= sNameSpaceURI;
-};
-
-cAtomicType.prototype.prefix		= null;
-cAtomicType.prototype.localName		= null;
-cAtomicType.prototype.namespaceURI	= null;
-
-function fAtomicType_parse (oLexer, oStaticContext) {
-	var aMatch	= oLexer.peek().match(rNameTest);
-	if (aMatch) {
-		if (aMatch[1] == '*' || aMatch[2] == '*')
-			throw new cException("XPST0003"
-
-			);
-		oLexer.next();
-		return new cAtomicType(aMatch[1] || null, aMatch[2], aMatch[1] ? oStaticContext.getURIForPrefix(aMatch[1]) : null);
-	}
-};
-
-cAtomicType.prototype.test	= function(vItem, oContext) {
-	// Test
-	var sUri	= (this.namespaceURI ? '{' + this.namespaceURI + '}' : '') + this.localName,
-		cType	= this.namespaceURI == sNS_XSD ? hStaticContext_dataTypes[this.localName] : oContext.staticContext.getDataType(sUri);
-	if (cType)
-		return vItem instanceof cType;
-	//
-	throw new cException("XPST0051"
-
-	);
-};
-
-cAtomicType.prototype.cast	= function(vItem, oContext) {
-	// Cast
-	var sUri	= (this.namespaceURI ? '{' + this.namespaceURI + '}' : '') + this.localName,
-		cType	= this.namespaceURI == sNS_XSD ? hStaticContext_dataTypes[this.localName] : oContext.staticContext.getDataType(sUri);
-	if (cType)
-		return cType.cast(vItem);
-	//
-	throw new cException("XPST0051"
-
-	);
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cItemType(oTest) {
-	this.test	= oTest;
-};
-
-cItemType.prototype.test	= null;
-
-function fItemType_parse (oLexer, oStaticContext) {
-	if (oLexer.eof())
-		return;
-
-	var oExpr;
-	if (oLexer.peek() == "item" && oLexer.peek(1) == '(') {
-		oLexer.next(2);
-		if (oLexer.peek() != ')')
-			throw new cException("XPST0003"
-
-			);
-		oLexer.next();
-		return new cItemType;
-	}
-	// Note! Following step should have been before previous as per spec
-	if (oExpr = fKindTest_parse(oLexer, oStaticContext))
-		return new cItemType(oExpr);
-	if (oExpr = fAtomicType_parse(oLexer, oStaticContext))
-		return new cItemType(oExpr);
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cSequenceType(oItemType, sOccurence) {
-	this.itemType	= oItemType	|| null;
-	this.occurence	= sOccurence|| null;
-};
-
-cSequenceType.prototype.itemType	= null;
-cSequenceType.prototype.occurence	= null;
-
-function fSequenceType_parse (oLexer, oStaticContext) {
-	if (oLexer.eof())
-		return;
-
-	if (oLexer.peek() == "empty-sequence" && oLexer.peek(1) == '(') {
-		oLexer.next(2);
-		if (oLexer.peek() != ')')
-			throw new cException("XPST0003"
-
-			);
-		oLexer.next();
-		return new cSequenceType;	// empty sequence
-	}
-
-	var oExpr,
-		sOccurence;
-	if (!oLexer.eof() && (oExpr = fItemType_parse(oLexer, oStaticContext))) {
-		sOccurence	= oLexer.peek();
-		if (sOccurence == '?' || sOccurence == '*' || sOccurence == '+')
-			oLexer.next();
-		else
-			sOccurence	= null;
-
-		return new cSequenceType(oExpr, sOccurence);
-	}
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cSingleType(oItemType, sOccurence) {
-	this.itemType	= oItemType	|| null;
-	this.occurence	= sOccurence|| null;
-};
-
-cSingleType.prototype.itemType	= null;
-cSingleType.prototype.occurence	= null;
-
-function fSingleType_parse (oLexer, oStaticContext) {
-	var oExpr,
-		sOccurence;
-	if (!oLexer.eof() && (oExpr = fAtomicType_parse(oLexer, oStaticContext))) {
-		sOccurence	= oLexer.peek();
-		if (sOccurence == '?')
-			oLexer.next();
-		else
-			sOccurence	= null;
-
-		return new cSingleType(oExpr, sOccurence);
-	}
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSAnyType() {
-
-};
-
-cXSAnyType.prototype.builtInKind	= cXSConstants.ANYTYPE_DT;
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSAnySimpleType() {
-
-};
-
-cXSAnySimpleType.prototype	= new cXSAnyType;
-
-cXSAnySimpleType.prototype.builtInKind	= cXSConstants.ANYSIMPLETYPE_DT;
-cXSAnySimpleType.prototype.primitiveKind= null;
-
-cXSAnySimpleType.PRIMITIVE_ANYURI		= "anyURI";		//18;
-cXSAnySimpleType.PRIMITIVE_BASE64BINARY	= "base64Binary";	// 17;
-cXSAnySimpleType.PRIMITIVE_BOOLEAN		= "boolean";	// 3;
-cXSAnySimpleType.PRIMITIVE_DATE			= "date";		// 10;
-cXSAnySimpleType.PRIMITIVE_DATETIME		= "dateTime";	// 8;
-cXSAnySimpleType.PRIMITIVE_DECIMAL		= "decimal";	// 4;
-cXSAnySimpleType.PRIMITIVE_DOUBLE		= "double";		// 6;
-cXSAnySimpleType.PRIMITIVE_DURATION		= "duration";	// 7;
-cXSAnySimpleType.PRIMITIVE_FLOAT		= "float";		// 5;
-cXSAnySimpleType.PRIMITIVE_GDAY			= "gDay";		// 14;
-cXSAnySimpleType.PRIMITIVE_GMONTH		= "gMonth";		// 15;
-cXSAnySimpleType.PRIMITIVE_GMONTHDAY	= "gMonthDay";	// 13;
-cXSAnySimpleType.PRIMITIVE_GYEAR		= "gYear";		// 12;
-cXSAnySimpleType.PRIMITIVE_GYEARMONTH	= "gYearMonth";	// 11;
-cXSAnySimpleType.PRIMITIVE_HEXBINARY	= "hexBinary";	// 16;
-cXSAnySimpleType.PRIMITIVE_NOTATION		= "NOTATION";	// 20;
-cXSAnySimpleType.PRIMITIVE_QNAME		= "QName";		// 19;
-cXSAnySimpleType.PRIMITIVE_STRING		= "string";		// 2;
-cXSAnySimpleType.PRIMITIVE_TIME			= "time";		// 9;
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSAnyAtomicType() {
-
-};
-
-cXSAnyAtomicType.prototype	= new cXSAnySimpleType;
-cXSAnyAtomicType.prototype.builtInKind	= cXSConstants.ANYATOMICTYPE_DT;
-
-cXSAnyAtomicType.cast	= function(vValue) {
-	throw new cException("XPST0017"
-
-	);	//  {http://www.w3.org/2001/XMLSchema}anyAtomicType
-};
-
-function fXSAnyAtomicType_isNumeric(vItem) {
-	return vItem instanceof cXSFloat || vItem instanceof cXSDouble || vItem instanceof cXSDecimal;
-};
-
-//
-fStaticContext_defineSystemDataType("anyAtomicType",	cXSAnyAtomicType);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSAnyURI(sScheme, sAuthority, sPath, sQuery, sFragment) {
-	this.scheme		= sScheme;
-	this.authority	= sAuthority;
-	this.path		= sPath;
-	this.query		= sQuery;
-	this.fragment	= sFragment;
-};
-
-cXSAnyURI.prototype	= new cXSAnyAtomicType;
-cXSAnyURI.prototype.builtInKind		= cXSConstants.ANYURI_DT;
-cXSAnyURI.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_ANYURI;
-
-cXSAnyURI.prototype.scheme		= null;
-cXSAnyURI.prototype.authority	= null;
-cXSAnyURI.prototype.path		= null;
-cXSAnyURI.prototype.query		= null;
-cXSAnyURI.prototype.fragment	= null;
-
-cXSAnyURI.prototype.toString	= function() {
-	return (this.scheme ? this.scheme + ':' : '')
-			+ (this.authority ? '/' + '/' + this.authority : '')
-			+ (this.path ? this.path : '')
-			+ (this.query ? '?' + this.query : '')
-			+ (this.fragment ? '#' + this.fragment : '');
-};
-
-var rXSAnyURI	= /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;	// http://tools.ietf.org/html/rfc3986
-cXSAnyURI.cast	= function(vValue) {
-	if (vValue instanceof cXSAnyURI)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch;
-		if (aMatch = fString_trim(vValue).match(rXSAnyURI))
-			return new cXSAnyURI(aMatch[2], aMatch[4], aMatch[5], aMatch[7], aMatch[9]);
-		throw new cException("FORG0001");
-	}
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-fStaticContext_defineSystemDataType("anyURI",	cXSAnyURI);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSBase64Binary(sValue) {
-	this.value	= sValue;
-};
-
-cXSBase64Binary.prototype	= new cXSAnyAtomicType;
-cXSBase64Binary.prototype.builtInKind	= cXSConstants.BASE64BINARY_DT;
-cXSBase64Binary.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_BASE64BINARY;
-
-cXSBase64Binary.prototype.value	= null;
-
-cXSBase64Binary.prototype.valueOf	= function() {
-	return this.value;
-};
-
-cXSBase64Binary.prototype.toString	= function() {
-	return this.value;
-};
-
-var rXSBase64Binary		= /^((([A-Za-z0-9+\/]\s*){4})*(([A-Za-z0-9+\/]\s*){3}[A-Za-z0-9+\/]|([A-Za-z0-9+\/]\s*){2}[AEIMQUYcgkosw048]\s*=|[A-Za-z0-9+\/]\s*[AQgw]\s*=\s*=))?$/;
-cXSBase64Binary.cast	= function(vValue) {
-	if (vValue instanceof cXSBase64Binary)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSBase64Binary);
-		if (aMatch)
-			return new cXSBase64Binary(aMatch[0]);
-		throw new cException("FORG0001");
-	}
-	if (vValue instanceof cXSHexBinary) {
-		var aMatch	= vValue.valueOf().match(/.{2}/g),
-			aValue	= [];
-		for (var nIndex = 0, nLength = aMatch.length; nIndex < nLength; nIndex++)
-			aValue.push(cString.fromCharCode(fWindow_parseInt(aMatch[nIndex], 16)));
-		return new cXSBase64Binary(fWindow_btoa(aValue.join('')));
-	}
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-fStaticContext_defineSystemDataType("base64Binary",	cXSBase64Binary);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSBoolean(bValue) {
-	this.value	= bValue;
-};
-
-cXSBoolean.prototype	= new cXSAnyAtomicType;
-cXSBoolean.prototype.builtInKind	= cXSConstants.BOOLEAN_DT;
-cXSBoolean.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_BOOLEAN;
-
-cXSBoolean.prototype.value	= null;
-
-cXSBoolean.prototype.valueOf	= function() {
-	return this.value;
-};
-
-cXSBoolean.prototype.toString	= function() {
-	return cString(this.value);
-};
-
-var rXSBoolean	= /^(0|1|true|false)$/;
-cXSBoolean.cast	= function(vValue) {
-	if (vValue instanceof cXSBoolean)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch;
-		if (aMatch = fString_trim(vValue).match(rXSBoolean))
-			return new cXSBoolean(aMatch[1] == '1' || aMatch[1] == "true");
-		throw new cException("FORG0001");
-	}
-	if (fXSAnyAtomicType_isNumeric(vValue))
-		return new cXSBoolean(vValue != 0);
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-fStaticContext_defineSystemDataType("boolean",	cXSBoolean);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSDate(nYear, nMonth, nDay, nTimezone, bNegative) {
-	this.year		= nYear;
-	this.month		= nMonth;
-	this.day		= nDay;
-	this.timezone	= nTimezone;
-	this.negative	= bNegative;
-};
-
-cXSDate.prototype	= new cXSAnyAtomicType;
-cXSDate.prototype.builtInKind	= cXSConstants.DATE_DT;
-cXSDate.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_DATE;
-
-cXSDate.prototype.year		= null;
-cXSDate.prototype.month		= null;
-cXSDate.prototype.day		= null;
-cXSDate.prototype.timezone	= null;
-cXSDate.prototype.negative	= null;
-
-cXSDate.prototype.toString	= function() {
-	return fXSDateTime_getDateComponent(this)
-			+ fXSDateTime_getTZComponent(this);
-};
-
-var rXSDate		= /^(-?)([1-9]\d\d\d+|0\d\d\d)-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])(Z|([+\-])(0\d|1[0-4]):([0-5]\d))?$/;
-cXSDate.cast	= function(vValue) {
-	if (vValue instanceof cXSDate)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSDate);
-		if (aMatch) {
-			var nYear	= +aMatch[2],
-				nMonth	= +aMatch[3],
-				nDay	= +aMatch[4];
-			if (nDay - 1 < fXSDate_getDaysForYearMonth(nYear, nMonth))
-				return new cXSDate( nYear,
-									nMonth,
-									nDay,
-									aMatch[5] ? aMatch[5] == 'Z' ? 0 : (aMatch[6] == '-' ? -1 : 1) * (aMatch[7] * 60 + aMatch[8] * 1) : null,
-									aMatch[1] == '-'
-				);
-			//
-			throw new cException("FORG0001"
-
-			);
-		}
-		throw new cException("FORG0001");
-	}
-	if (vValue instanceof cXSDateTime)
-		return new cXSDate(vValue.year, vValue.month, vValue.day, vValue.timezone, vValue.negative);
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-// Utilities
-var aXSDate_days	= [31,28,31,30,31,30,31,31,30,31,30,31];
-function fXSDate_getDaysForYearMonth(nYear, nMonth) {
-	return nMonth == 2 && (nYear % 400 == 0 || nYear % 100 != 0 && nYear % 4 == 0) ? 29 : aXSDate_days[nMonth - 1];
-};
-
-function fXSDate_normalize(oValue, bDay) {
-	// Adjust day for month/year
-	if (!bDay) {
-		var nDay	= fXSDate_getDaysForYearMonth(oValue.year, oValue.month);
-		if (oValue.day > nDay) {
-			while (oValue.day > nDay) {
-				oValue.month	+= 1;
-				if (oValue.month > 12) {
-					oValue.year		+= 1;
-					if (oValue.year == 0)
-						oValue.year	= 1;
-					oValue.month	= 1;
-				}
-				oValue.day	-= nDay;
-				nDay = fXSDate_getDaysForYearMonth(oValue.year, oValue.month);
-			}
-		}
-		else
-		if (oValue.day < 1) {
-			while (oValue.day < 1) {
-				oValue.month	-= 1;
-				if (oValue.month < 1) {
-					oValue.year		-= 1;
-					if (oValue.year == 0)
-						oValue.year	=-1;
-					oValue.month	= 12;
-				}
-				nDay = fXSDate_getDaysForYearMonth(oValue.year, oValue.month);
-				oValue.day	+= nDay;
-			}
-		}
-	}
-//?	else
-	// Adjust month
-	if (oValue.month > 12) {
-		oValue.year		+= ~~(oValue.month / 12);
-		if (oValue.year == 0)
-			oValue.year	= 1;
-		oValue.month	= oValue.month % 12;
-	}
-	else
-	if (oValue.month < 1) {
-		oValue.year		+= ~~(oValue.month / 12) - 1;
-		if (oValue.year == 0)
-			oValue.year	=-1;
-		oValue.month	= oValue.month % 12 + 12;
-	}
-
-	return oValue;
-};
-
-//
-fStaticContext_defineSystemDataType("date",	cXSDate);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSDateTime(nYear, nMonth, nDay, nHours, nMinutes, nSeconds, nTimezone, bNegative) {
-	this.year	= nYear;
-	this.month	= nMonth;
-	this.day	= nDay;
-	this.hours	= nHours;
-	this.minutes	= nMinutes;
-	this.seconds	= nSeconds;
-	this.timezone	= nTimezone;
-	this.negative	= bNegative;
-};
-
-cXSDateTime.prototype	= new cXSAnyAtomicType;
-cXSDateTime.prototype.builtInKind	= cXSConstants.DATETIME_DT;
-cXSDateTime.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_DATETIME;
-
-cXSDateTime.prototype.year		= null;
-cXSDateTime.prototype.month		= null;
-cXSDateTime.prototype.day		= null;
-cXSDateTime.prototype.hours		= null;
-cXSDateTime.prototype.minutes	= null;
-cXSDateTime.prototype.seconds	= null;
-cXSDateTime.prototype.timezone	= null;
-cXSDateTime.prototype.negative	= null;
-
-cXSDateTime.prototype.toString	= function() {
-	return fXSDateTime_getDateComponent(this)
-			+ 'T'
-			+ fXSDateTime_getTimeComponent(this)
-			+ fXSDateTime_getTZComponent(this);
-};
-
-var rXSDateTime		= /^(-?)([1-9]\d\d\d+|0\d\d\d)-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])T(([01]\d|2[0-3]):([0-5]\d):([0-5]\d)(?:\.(\d+))?|(24:00:00)(?:\.(0+))?)(Z|([+\-])(0\d|1[0-4]):([0-5]\d))?$/;
-cXSDateTime.cast	= function(vValue) {
-	if (vValue instanceof cXSDateTime)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSDateTime);
-		if (aMatch) {
-			var nYear	= +aMatch[2],
-				nMonth	= +aMatch[3],
-				nDay	= +aMatch[4],
-				bValue	= !!aMatch[10];
-			if (nDay - 1 < fXSDate_getDaysForYearMonth(nYear, nMonth))
-				return fXSDateTime_normalize(new cXSDateTime( nYear,
-										nMonth,
-										nDay,
-										bValue ? 24 : +aMatch[6],
-										bValue ? 0 : +aMatch[7],
-										cNumber((bValue ? 0 : aMatch[8]) + '.' + (bValue ? 0 : aMatch[9] || 0)),
-										aMatch[12] ? aMatch[12] == 'Z' ? 0 : (aMatch[13] == '-' ? -1 : 1) * (aMatch[14] * 60 + aMatch[15] * 1) : null,
-										aMatch[1] == '-'
-				));
-			//
-			throw new cException("FORG0001"
-
-			);
-		}
-		throw new cException("FORG0001");
-	}
-	if (vValue instanceof cXSDate)
-		return new cXSDateTime(vValue.year, vValue.month, vValue.day, 0, 0, 0, vValue.timezone, vValue.negative);
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-// Utilities
-function fXSDateTime_pad(vValue, nLength) {
-	var sValue	= cString(vValue);
-	if (arguments.length < 2)
-		nLength	= 2;
-	return (sValue.length < nLength + 1 ? new cArray(nLength + 1 - sValue.length).join('0') : '') + sValue;
-};
-
-function fXSDateTime_getTZComponent(oDateTime) {
-	var nTimezone	= oDateTime.timezone;
-	return nTimezone == null
-			? ''
-			: nTimezone
-				? (nTimezone > 0 ? '+' : '-')
-					+ fXSDateTime_pad(cMath.abs(~~(nTimezone / 60)))
-					+ ':'
-					+ fXSDateTime_pad(cMath.abs(nTimezone % 60))
-				: 'Z';
-};
-
-function fXSDateTime_getDateComponent(oDateTime) {
-	return (oDateTime.negative ? '-' : '')
-			+ fXSDateTime_pad(oDateTime.year, 4)
-			+ '-' + fXSDateTime_pad(oDateTime.month)
-			+ '-' + fXSDateTime_pad(oDateTime.day);
-};
-
-function fXSDateTime_getTimeComponent(oDateTime) {
-	var aValue	= cString(oDateTime.seconds).split('.');
-	return fXSDateTime_pad(oDateTime.hours)
-			+ ':' + fXSDateTime_pad(oDateTime.minutes)
-			+ ':' + fXSDateTime_pad(aValue[0])
-			+ (aValue.length > 1 ? '.' + aValue[1] : '');
-};
-
-function fXSDateTime_normalize(oValue) {
-	return fXSDate_normalize(fXSTime_normalize(oValue));
-};
-
-//
-fStaticContext_defineSystemDataType("dateTime",	cXSDateTime);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSDecimal(nValue) {
-	this.value	= nValue;
-};
-
-cXSDecimal.prototype	= new cXSAnyAtomicType;
-cXSDecimal.prototype.builtInKind	= cXSConstants.DECIMAL_DT;
-cXSDecimal.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_DECIMAL;
-
-cXSDecimal.prototype.value	= null;
-
-cXSDecimal.prototype.valueOf	= function() {
-	return this.value;
-};
-
-cXSDecimal.prototype.toString	= function() {
-	return cString(this.value);
-};
-
-var rXSDecimal	= /^[+\-]?((\d+(\.\d*)?)|(\.\d+))$/;
-cXSDecimal.cast	= function(vValue) {
-	if (vValue instanceof cXSDecimal)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSDecimal);
-		if (aMatch)
-			return new cXSDecimal(+vValue);
-		throw new cException("FORG0001");
-	}
-	if (vValue instanceof cXSBoolean)
-		return new cXSDecimal(vValue * 1);
-	if (fXSAnyAtomicType_isNumeric(vValue)) {
-		if (!fIsNaN(vValue) && fIsFinite(vValue))
-			return new cXSDecimal(+vValue);
-		throw new cException("FOCA0002"
-
-		);
-	}
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-fStaticContext_defineSystemDataType("decimal",	cXSDecimal);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSDouble(nValue) {
-	this.value	= nValue;
-};
-
-cXSDouble.prototype	= new cXSAnyAtomicType;
-cXSDouble.prototype.builtInKind		= cXSConstants.DOUBLE_DT;
-cXSDouble.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_DOUBLE;
-
-cXSDouble.prototype.value	= null;
-
-cXSDouble.prototype.valueOf	= function() {
-	return this.value;
-};
-
-cXSDouble.prototype.toString	= function() {
-	return cString(this.value);
-};
-
-var rXSDouble	= /^([+\-]?((\d+(\.\d*)?)|(\.\d+))([eE][+\-]?\d+)?|(-?INF)|NaN)$/;
-cXSDouble.cast	= function(vValue) {
-	if (vValue instanceof cXSDouble)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSDouble);
-		if (aMatch)
-			return new cXSDouble(aMatch[7] ? +aMatch[7].replace("INF", "Infinity") : +vValue);
-		throw new cException("FORG0001");
-	}
-	if (vValue instanceof cXSBoolean)
-		return new cXSDouble(vValue * 1);
-	if (fXSAnyAtomicType_isNumeric(vValue))
-		return new cXSDouble(vValue.value);
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-fStaticContext_defineSystemDataType("double",	cXSDouble);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSDuration(nYear, nMonth, nDay, nHours, nMinutes, nSeconds, bNegative) {
-	this.year	= nYear;
-	this.month	= nMonth;
-	this.day	= nDay;
-	this.hours	= nHours;
-	this.minutes	= nMinutes;
-	this.seconds	= nSeconds;
-	this.negative	= bNegative;
-};
-
-cXSDuration.prototype	= new cXSAnyAtomicType;
-cXSDuration.prototype.builtInKind	= cXSConstants.DURATION_DT;
-cXSDuration.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_DURATION;
-
-cXSDuration.prototype.year		= null;
-cXSDuration.prototype.month		= null;
-cXSDuration.prototype.day		= null;
-cXSDuration.prototype.hours		= null;
-cXSDuration.prototype.minutes	= null;
-cXSDuration.prototype.seconds	= null;
-cXSDuration.prototype.negative	= null;
-
-cXSDuration.prototype.toString	= function() {
-	return (this.negative ? '-' : '') + 'P'
-			+ ((fXSDuration_getYearMonthComponent(this) + fXSDuration_getDayTimeComponent(this)) || 'T0S');
-};
-
-var rXSDuration		= /^(-)?P(?:([0-9]+)Y)?(?:([0-9]+)M)?(?:([0-9]+)D)?(?:T(?:([0-9]+)H)?(?:([0-9]+)M)?(?:((?:(?:[0-9]+(?:.[0-9]*)?)|(?:.[0-9]+)))S)?)?$/;
-cXSDuration.cast	= function(vValue) {
-	if (vValue instanceof cXSDuration)
-		return vValue;
-	if (vValue instanceof cXSYearMonthDuration)
-		return new cXSDuration(vValue.year, vValue.month, 0, 0, 0, 0, vValue.negative);
-	if (vValue instanceof cXSDayTimeDuration)
-		return new cXSDuration(0, 0, vValue.day, vValue.hours, vValue.minutes, vValue.seconds, vValue.negative);
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSDuration);
-		if (aMatch)
-			return fXSDuration_normalize(new cXSDuration(+aMatch[2] || 0, +aMatch[3] || 0, +aMatch[4] || 0, +aMatch[5] || 0, +aMatch[6] || 0, +aMatch[7] || 0, aMatch[1] == '-'));
-		throw new cException("FORG0001");
-	}
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-// Utilities
-function fXSDuration_getYearMonthComponent(oDuration) {
-	return (oDuration.year ? oDuration.year + 'Y' : '')
-			+ (oDuration.month ? oDuration.month + 'M' : '');
-};
-
-function fXSDuration_getDayTimeComponent(oDuration) {
-	return (oDuration.day ? oDuration.day + 'D' : '')
-			+ (oDuration.hours || oDuration.minutes || oDuration.seconds
-				? 'T'
-					+ (oDuration.hours ? oDuration.hours + 'H' : '')
-					+ (oDuration.minutes ? oDuration.minutes + 'M' : '')
-					+ (oDuration.seconds ? oDuration.seconds + 'S' : '')
-				: '');
-};
-
-function fXSDuration_normalize(oDuration) {
-	return fXSYearMonthDuration_normalize(fXSDayTimeDuration_normalize(oDuration));
-};
-
-//
-fStaticContext_defineSystemDataType("duration",	cXSDuration);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSFloat(nValue) {
-	this.value	= nValue;
-};
-
-cXSFloat.prototype	= new cXSAnyAtomicType;
-cXSFloat.prototype.builtInKind		= cXSConstants.FLOAT_DT;
-cXSFloat.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_FLOAT;
-
-cXSFloat.prototype.value	= null;
-
-cXSFloat.prototype.valueOf	= function() {
-	return this.value;
-};
-
-cXSFloat.prototype.toString	= function() {
-	return cString(this.value);
-};
-
-var rXSFloat	= /^([+\-]?((\d+(\.\d*)?)|(\.\d+))([eE][+\-]?\d+)?|(-?INF)|NaN)$/;
-cXSFloat.cast	= function(vValue) {
-	if (vValue instanceof cXSFloat)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSFloat);
-		if (aMatch)
-			return new cXSFloat(aMatch[7] ? +aMatch[7].replace("INF", "Infinity") : +vValue);
-		throw new cException("FORG0001");
-	}
-	if (vValue instanceof cXSBoolean)
-		return new cXSFloat(vValue * 1);
-	if (fXSAnyAtomicType_isNumeric(vValue))
-		return new cXSFloat(vValue.value);
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-fStaticContext_defineSystemDataType("float",	cXSFloat);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSGDay(nDay, nTimezone) {
-	this.day		= nDay;
-	this.timezone	= nTimezone;
-};
-
-cXSGDay.prototype	= new cXSAnyAtomicType;
-cXSGDay.prototype.builtInKind	= cXSConstants.GDAY_DT;
-cXSGDay.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_GDAY;
-
-cXSGDay.prototype.day		= null;
-cXSGDay.prototype.timezone	= null;
-
-cXSGDay.prototype.toString	= function() {
-	return '-'
-			+ '-'
-			+ '-' + fXSDateTime_pad(this.day)
-			+ fXSDateTime_getTZComponent(this);
-};
-
-var rXSGDay		= /^---(0[1-9]|[12]\d|3[01])(Z|([+\-])(0\d|1[0-4]):([0-5]\d))?$/;
-cXSGDay.cast	= function(vValue) {
-	if (vValue instanceof cXSGDay)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSGDay);
-		if (aMatch) {
-			var nDay	= +aMatch[1];
-			return new cXSGDay(	nDay,
-								aMatch[2] ? aMatch[2] == 'Z' ? 0 : (aMatch[3] == '-' ? -1 : 1) * (aMatch[4] * 60 + aMatch[5] * 1) : null
-			);
-		}
-		throw new cException("FORG0001");
-	}
-	if (vValue instanceof cXSDate || vValue instanceof cXSDateTime)
-		return new cXSGDay(vValue.day, vValue.timezone);
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-fStaticContext_defineSystemDataType("gDay",	cXSGDay);
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSGMonth(nMonth, nTimezone) {
-	this.month		= nMonth;
-	this.timezone	= nTimezone;
-};
-
-cXSGMonth.prototype	= new cXSAnyAtomicType;
-cXSGMonth.prototype.builtInKind		= cXSConstants.GMONTH_DT;
-cXSGMonth.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_GMONTH;
-
-cXSGMonth.prototype.month		= null;
-cXSGMonth.prototype.timezone	= null;
-
-cXSGMonth.prototype.toString	= function() {
-	return '-'
-			+ '-' + fXSDateTime_pad(this.month)
-			+ fXSDateTime_getTZComponent(this);
-};
-
-var rXSGMonth	= /^--(0[1-9]|1[0-2])(Z|([+\-])(0\d|1[0-4]):([0-5]\d))?$/;
-cXSGMonth.cast	= function(vValue) {
-	if (vValue instanceof cXSGMonth)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSGMonth);
-		if (aMatch) {
-			var nMonth	= +aMatch[1];
-			return new cXSGMonth(	nMonth,
-									aMatch[2] ? aMatch[2] == 'Z' ? 0 : (aMatch[3] == '-' ? -1 : 1) * (aMatch[4] * 60 + aMatch[5] * 1) : null
-			);
-		}
-		throw new cException("FORG0001");
-	}
-	if (vValue instanceof cXSDate || vValue instanceof cXSDateTime)
-		return new cXSGMonth(vValue.month, vValue.timezone);
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-fStaticContext_defineSystemDataType("gMonth",	cXSGMonth);
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSGMonthDay(nMonth, nDay, nTimezone) {
-	this.month		= nMonth;
-	this.day		= nDay;
-	this.timezone	= nTimezone;
-};
-
-cXSGMonthDay.prototype	= new cXSAnyAtomicType;
-cXSGMonthDay.prototype.builtInKind		= cXSConstants.GMONTHDAY_DT;
-cXSGMonthDay.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_GMONTHDAY;
-
-cXSGMonthDay.prototype.month	= null;
-cXSGMonthDay.prototype.day		= null;
-cXSGMonthDay.prototype.timezone	= null;
-
-cXSGMonthDay.prototype.toString	= function() {
-	return '-'
-			+ '-' + fXSDateTime_pad(this.month)
-			+ '-' + fXSDateTime_pad(this.day)
-			+ fXSDateTime_getTZComponent(this);
-};
-
-var rXSGMonthDay	= /^--(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])(Z|([+\-])(0\d|1[0-4]):([0-5]\d))?$/;
-cXSGMonthDay.cast	= function(vValue) {
-	if (vValue instanceof cXSGMonthDay)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSGMonthDay);
-		if (aMatch) {
-			var nMonth	= +aMatch[1],
-				nDay	= +aMatch[2];
-			if (nDay - 1 < fXSDate_getDaysForYearMonth(1976, nMonth))
-				return new cXSGMonthDay(	nMonth,
-											nDay,
-											aMatch[3] ? aMatch[3] == 'Z' ? 0 : (aMatch[4] == '-' ? -1 : 1) * (aMatch[5] * 60 + aMatch[6] * 1) : null
-				);
-			//
-			throw new cException("FORG0001"
-
-			);
-		}
-		throw new cException("FORG0001");
-	}
-	if (vValue instanceof cXSDate || vValue instanceof cXSDateTime)
-		return new cXSGMonthDay(vValue.month, vValue.day, vValue.timezone);
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-fStaticContext_defineSystemDataType("gMonthDay",	cXSGMonthDay);
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSGYear(nYear, nTimezone) {
-	this.year	= nYear;
-	this.timezone	= nTimezone;
-};
-
-cXSGYear.prototype	= new cXSAnyAtomicType;
-cXSGYear.prototype.builtInKind		= cXSConstants.GYEAR_DT;
-cXSGYear.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_GYEAR;
-
-cXSGYear.prototype.year		= null;
-cXSGYear.prototype.timezone	= null;
-
-cXSGYear.prototype.toString	= function() {
-	return fXSDateTime_pad(this.year)
-			+ fXSDateTime_getTZComponent(this);
-};
-
-var rXSGYear		= /^-?([1-9]\d\d\d+|0\d\d\d)(Z|([+\-])(0\d|1[0-4]):([0-5]\d))?$/;
-cXSGYear.cast	= function(vValue) {
-	if (vValue instanceof cXSGYear)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSGYear);
-		if (aMatch) {
-			var nYear	= +aMatch[1];
-			return new cXSGYear(	nYear,
-									aMatch[2] ? aMatch[2] == 'Z' ? 0 : (aMatch[3] == '-' ? -1 : 1) * (aMatch[4] * 60 + aMatch[5] * 1) : null
-			);
-		}
-		throw new cException("FORG0001");
-	}
-	if (vValue instanceof cXSDate || vValue instanceof cXSDateTime)
-		return new cXSGYear(vValue.year, vValue.timezone);
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-fStaticContext_defineSystemDataType("gYear",	cXSGYear);
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSGYearMonth(nYear, nMonth, nTimezone) {
-	this.year		= nYear;
-	this.month		= nMonth;
-	this.timezone	= nTimezone;
-};
-
-cXSGYearMonth.prototype	= new cXSAnyAtomicType;
-cXSGYearMonth.prototype.builtInKind		= cXSConstants.GYEARMONTH_DT;
-cXSGYearMonth.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_GYEARMONTH;
-
-cXSGYearMonth.prototype.year	= null;
-cXSGYearMonth.prototype.month	= null;
-cXSGYearMonth.prototype.timezone= null;
-
-cXSGYearMonth.prototype.toString	= function() {
-	return fXSDateTime_pad(this.year)
-			+ '-' + fXSDateTime_pad(this.month)
-			+ fXSDateTime_getTZComponent(this);
-};
-
-var rXSGYearMonth	= /^-?([1-9]\d\d\d+|0\d\d\d)-(0[1-9]|1[0-2])(Z|([+\-])(0\d|1[0-4]):([0-5]\d))?$/;
-cXSGYearMonth.cast	= function(vValue) {
-	if (vValue instanceof cXSGYearMonth)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSGYearMonth);
-		if (aMatch) {
-			var nYear	= +aMatch[1],
-				nMonth	= +aMatch[2];
-			return new cXSGYearMonth(	nYear,
-										nMonth,
-										aMatch[3] ? aMatch[3] == 'Z' ? 0 : (aMatch[4] == '-' ? -1 : 1) * (aMatch[5] * 60 + aMatch[6] * 1) : null
-			);
-		}
-		throw new cException("FORG0001");
-	}
-	if (vValue instanceof cXSDate || vValue instanceof cXSDateTime)
-		return new cXSGYearMonth(vValue.year, vValue.month, vValue.timezone);
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-fStaticContext_defineSystemDataType("gYearMonth",	cXSGYearMonth);
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSHexBinary(sValue) {
-	this.value	= sValue;
-};
-
-cXSHexBinary.prototype	= new cXSAnyAtomicType;
-cXSHexBinary.prototype.builtInKind		= cXSConstants.HEXBINARY_DT;
-cXSHexBinary.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_HEXBINARY;
-
-cXSHexBinary.prototype.value	= null;
-
-cXSHexBinary.prototype.valueOf	= function() {
-	return this.value;
-};
-
-cXSHexBinary.prototype.toString	= function() {
-	return this.value;
-};
-
-var rXSHexBinary	= /^([0-9a-fA-F]{2})*$/;
-cXSHexBinary.cast	= function(vValue) {
-	if (vValue instanceof cXSHexBinary)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSHexBinary);
-		if (aMatch)
-			return new cXSHexBinary(aMatch[0].toUpperCase());
-		throw new cException("FORG0001");
-	}
-	if (vValue instanceof cXSBase64Binary) {
-		var sValue	= fWindow_atob(vValue.valueOf()),
-			aValue	= [];
-		for (var nIndex = 0, nLength = sValue.length, sLetter; nIndex < nLength; nIndex++) {
-			sLetter = sValue.charCodeAt(nIndex).toString(16);
-			aValue.push(new cArray(3 - sLetter.length).join('0') + sLetter);
-		}
-		return new cXSHexBinary(aValue.join(''));
-	}
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-fStaticContext_defineSystemDataType("hexBinary",	cXSHexBinary);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSNOTATION() {
-
-};
-
-cXSNOTATION.prototype	= new cXSAnyAtomicType;
-cXSNOTATION.prototype.builtInKind	= cXSConstants.NOTATION_DT;
-cXSNOTATION.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_NOTATION;
-
-cXSNOTATION.cast	= function(vValue) {
-	throw new cException("XPST0017"
-
-	);	//  {http://www.w3.org/2001/XMLSchema}NOTATION
-};
-
-//
-fStaticContext_defineSystemDataType("NOTATION",	cXSNOTATION);
-
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSQName(sPrefix, sLocalName, sNameSpaceURI) {
-	this.prefix	= sPrefix;
-	this.localName	= sLocalName;
-	this.namespaceURI	= sNameSpaceURI;
-};
-
-cXSQName.prototype	= new cXSAnyAtomicType;
-cXSQName.prototype.builtInKind		= cXSConstants.QNAME_DT;
-cXSQName.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_QNAME;
-
-cXSQName.prototype.prefix	= null;
-cXSQName.prototype.localName	= null;
-cXSQName.prototype.namespaceURI	= null;
-
-cXSQName.prototype.toString	= function() {
-	return (this.prefix ? this.prefix + ':' : '') + this.localName;
-};
-
-var rXSQName	= /^(?:(?![0-9-])(\w[\w.-]*)\:)?(?![0-9-])(\w[\w.-]*)$/;
-cXSQName.cast	= function(vValue) {
-	if (vValue instanceof cXSQName)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSQName);
-		if (aMatch)
-			return new cXSQName(aMatch[1] || null, aMatch[2], null);
-		throw new cException("FORG0001");
-	}
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-fStaticContext_defineSystemDataType("QName",	cXSQName);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSString(sValue) {
-	this.value	= sValue;
-};
-
-cXSString.prototype	= new cXSAnyAtomicType;
-
-cXSString.prototype.value	= null;
-cXSString.prototype.builtInKind		= cXSConstants.STRING_DT;
-cXSString.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_STRING;
-
-cXSString.prototype.valueOf		= function() {
-	return this.value;
-};
-
-cXSString.prototype.toString	= function() {
-	return this.value;
-};
-
-cXSString.cast	= function(vValue) {
-	return new cXSString(cString(vValue));
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-fStaticContext_defineSystemDataType("string",	cXSString);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSTime(nHours, nMinutes, nSeconds, nTimezone) {
-	this.hours	= nHours;
-	this.minutes	= nMinutes;
-	this.seconds	= nSeconds;
-	this.timezone	= nTimezone;
-};
-
-cXSTime.prototype	= new cXSAnyAtomicType;
-cXSTime.prototype.builtInKind	= cXSConstants.TIME_DT;
-cXSTime.prototype.primitiveKind	= cXSAnySimpleType.PRIMITIVE_TIME;
-
-cXSTime.prototype.hours		= null;
-cXSTime.prototype.minutes	= null;
-cXSTime.prototype.seconds	= null;
-cXSTime.prototype.timezone		= null;
-
-cXSTime.prototype.toString	= function() {
-	return fXSDateTime_getTimeComponent(this)
-			+ fXSDateTime_getTZComponent(this);
-};
-
-var rXSTime		= /^(([01]\d|2[0-3]):([0-5]\d):([0-5]\d)(?:\.(\d+))?|(24:00:00)(?:\.(0+))?)(Z|([+\-])(0\d|1[0-4]):([0-5]\d))?$/;
-cXSTime.cast	= function(vValue) {
-	if (vValue instanceof cXSTime)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSTime);
-		if (aMatch) {
-			var bValue	= !!aMatch[6];
-			return new cXSTime(bValue ? 0 : +aMatch[2],
-								bValue ? 0 : +aMatch[3],
-								cNumber((bValue ? 0 : aMatch[4]) + '.' + (bValue ? 0 : aMatch[5] || 0)),
-								aMatch[8] ? aMatch[8] == 'Z' ? 0 : (aMatch[9] == '-' ? -1 : 1) * (aMatch[10] * 60 + aMatch[11] * 1) : null
-			);
-		}
-		throw new cException("FORG0001");
-	}
-	if (vValue instanceof cXSDateTime)
-		return new cXSTime(vValue.hours, vValue.minutes, vValue.seconds, vValue.timezone);
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-function fXSTime_normalize(oValue) {
-	//
-	if (oValue.seconds >= 60 || oValue.seconds < 0) {
-		oValue.minutes	+= ~~(oValue.seconds / 60) - (oValue.seconds < 0 && oValue.seconds % 60 ? 1 : 0);
-		oValue.seconds	= oValue.seconds % 60 + (oValue.seconds < 0 && oValue.seconds % 60 ? 60 : 0);
-	}
-	//
-	if (oValue.minutes >= 60 || oValue.minutes < 0) {
-		oValue.hours	+= ~~(oValue.minutes / 60) - (oValue.minutes < 0 && oValue.minutes % 60 ? 1 : 0);
-		oValue.minutes	= oValue.minutes % 60 + (oValue.minutes < 0 && oValue.minutes % 60 ? 60 : 0);
-	}
-	//
-	if (oValue.hours >= 24 || oValue.hours < 0) {
-		if (oValue instanceof cXSDateTime)
-			oValue.day		+= ~~(oValue.hours / 24) - (oValue.hours < 0 && oValue.hours % 24 ? 1 : 0);
-		oValue.hours	= oValue.hours % 24 + (oValue.hours < 0 && oValue.hours % 24 ? 24 : 0);
-	}
-	//
-	return oValue;
-};
-
-//
-fStaticContext_defineSystemDataType("time",	cXSTime);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSUntypedAtomic(sValue) {
-	this.value	= sValue;
-};
-
-cXSUntypedAtomic.prototype	= new cXSAnyAtomicType;
-cXSUntypedAtomic.prototype.builtInKind	= cXSConstants.XT_UNTYPEDATOMIC_DT;
-
-cXSUntypedAtomic.prototype.toString	= function() {
-	return cString(this.value);
-};
-
-cXSUntypedAtomic.cast	= function(vValue) {
-	if (vValue instanceof cXSUntypedAtomic)
-		return vValue;
-
-	return new cXSUntypedAtomic(cString(vValue));
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-fStaticContext_defineSystemDataType("untypedAtomic",	cXSUntypedAtomic);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSYearMonthDuration(nYear, nMonth, bNegative) {
-	cXSDuration.call(this, nYear, nMonth, 0, 0, 0, 0, bNegative);
-};
-
-cXSYearMonthDuration.prototype	= new cXSDuration;
-cXSYearMonthDuration.prototype.builtInKind	= cXSConstants.XT_YEARMONTHDURATION_DT;
-
-cXSYearMonthDuration.prototype.toString	= function() {
-	return (this.negative ? '-' : '') + 'P'
-			+ (fXSDuration_getYearMonthComponent(this) || '0M');
-};
-
-var rXSYearMonthDuration	= /^(-)?P(?:([0-9]+)Y)?(?:([0-9]+)M)?$/;
-cXSYearMonthDuration.cast	= function(vValue) {
-	if (vValue instanceof cXSYearMonthDuration)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSYearMonthDuration);
-		if (aMatch)
-			return fXSYearMonthDuration_normalize(new cXSYearMonthDuration(+aMatch[2] || 0, +aMatch[3] || 0, aMatch[1] == '-'));
-		throw new cException("FORG0001");
-	}
-	if (vValue instanceof cXSDayTimeDuration)
-		return new cXSYearMonthDuration(0, 0);
-	if (vValue instanceof cXSDuration)
-		return new cXSYearMonthDuration(vValue.year, vValue.month, vValue.negative);
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-function fXSYearMonthDuration_normalize(oDuration) {
-	if (oDuration.month >= 12) {
-		oDuration.year	+= ~~(oDuration.month / 12);
-		oDuration.month	%= 12;
-	}
-	return oDuration;
-};
-
-//
-fStaticContext_defineSystemDataType("yearMonthDuration",	cXSYearMonthDuration);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSDayTimeDuration(nDay, nHours, nMinutes, nSeconds, bNegative) {
-	cXSDuration.call(this, 0, 0, nDay, nHours, nMinutes, nSeconds, bNegative);
-};
-
-cXSDayTimeDuration.prototype	= new cXSDuration;
-cXSDayTimeDuration.prototype.builtInKind	= cXSConstants.DAYTIMEDURATION_DT;
-
-cXSDayTimeDuration.prototype.toString	= function() {
-	return (this.negative ? '-' : '') + 'P'
-			+ (fXSDuration_getDayTimeComponent(this) || 'T0S');
-};
-
-var rXSDayTimeDuration	= /^(-)?P(?:([0-9]+)D)?(?:T(?:([0-9]+)H)?(?:([0-9]+)M)?(?:((?:(?:[0-9]+(?:.[0-9]*)?)|(?:.[0-9]+)))S)?)?$/;
-cXSDayTimeDuration.cast	= function(vValue) {
-	if (vValue instanceof cXSDayTimeDuration)
-		return vValue;
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSDayTimeDuration);
-		if (aMatch)
-			return fXSDayTimeDuration_normalize(new cXSDayTimeDuration(+aMatch[2] || 0, +aMatch[3] || 0, +aMatch[4] || 0, +aMatch[5] || 0, aMatch[1] == '-'));
-		throw new cException("FORG0001");
-	}
-	if (vValue instanceof cXSYearMonthDuration)
-		return new cXSDayTimeDuration(0, 0, 0, 0);
-	if (vValue instanceof cXSDuration)
-		return new cXSDayTimeDuration(vValue.day, vValue.hours, vValue.minutes, vValue.seconds, vValue.negative);
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-// Utilities
-function fXSDayTimeDuration_normalize(oDuration) {
-	if (oDuration.seconds >= 60) {
-		oDuration.minutes	+= ~~(oDuration.seconds / 60);
-		oDuration.seconds	%= 60;
-	}
-	if (oDuration.minutes >= 60) {
-		oDuration.hours		+= ~~(oDuration.minutes / 60);
-		oDuration.minutes	%= 60;
-	}
-	if (oDuration.hours >= 24) {
-		oDuration.day		+= ~~(oDuration.hours / 24);
-		oDuration.hours		%= 24;
-	}
-	return oDuration;
-};
-
-//
-fStaticContext_defineSystemDataType("dayTimeDuration",	cXSDayTimeDuration);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSInteger(nValue) {
-	this.value	= nValue;
-};
-
-cXSInteger.prototype	= new cXSDecimal;
-cXSInteger.prototype.builtInKind	= cXSConstants.INTEGER_DT;
-
-var rXSInteger	= /^[-+]?[0-9]+$/;
-cXSInteger.cast	= function(vValue) {
-	if (vValue instanceof cXSInteger)
-		return new cXSInteger(vValue.value);
-	if (vValue instanceof cXSString || vValue instanceof cXSUntypedAtomic) {
-		var aMatch	= fString_trim(vValue).match(rXSInteger);
-		if (aMatch)
-			return new cXSInteger(+vValue);
-		throw new cException("FORG0001");
-	}
-	if (vValue instanceof cXSBoolean)
-		return new cXSInteger(vValue * 1);
-	if (fXSAnyAtomicType_isNumeric(vValue)) {
-		if (!fIsNaN(vValue) && fIsFinite(vValue))
-			return new cXSInteger(+vValue);
-		throw new cException("FOCA0002"
-
-		);
-	}
-	//
-	throw new cException("XPTY0004"
-
-	);
-};
-
-//
-fStaticContext_defineSystemDataType("integer",	cXSInteger);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSNonPositiveInteger(nValue) {
-	this.value	= nValue;
-};
-
-cXSNonPositiveInteger.prototype	= new cXSInteger;
-cXSNonPositiveInteger.prototype.builtInKind	= cXSConstants.NONPOSITIVEINTEGER_DT;
-
-cXSNonPositiveInteger.cast	= function(vValue) {
-	var oValue;
-	try {
-		oValue	= cXSInteger.cast(vValue);
-	}
-	catch (oError) {
-		throw oError;
-	}
-	// facet validation
-	if (oValue.value <= 0)
-		return new cXSNonPositiveInteger(oValue.value);
-	//
-	throw new cException("FORG0001");
-};
-
-//
-fStaticContext_defineSystemDataType("nonPositiveInteger",	cXSNonPositiveInteger);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSNegativeInteger(nValue) {
-	this.value	= nValue;
-};
-
-cXSNegativeInteger.prototype	= new cXSNonPositiveInteger;
-cXSNegativeInteger.prototype.builtInKind	= cXSConstants.NEGATIVEINTEGER_DT;
-
-cXSNegativeInteger.cast	= function(vValue) {
-	var oValue;
-	try {
-		oValue	= cXSInteger.cast(vValue);
-	}
-	catch (oError) {
-		throw oError;
-	}
-	// facet validation
-	if (oValue.value <= -1)
-		return new cXSNegativeInteger(oValue.value);
-	//
-	throw new cException("FORG0001");
-};
-
-//
-fStaticContext_defineSystemDataType("negativeInteger",	cXSNegativeInteger);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSLong(nValue) {
-	this.value	= nValue;
-};
-
-cXSLong.prototype	= new cXSInteger;
-cXSLong.prototype.builtInKind	= cXSConstants.LONG_DT;
-
-cXSLong.cast	= function(vValue) {
-	var oValue;
-	try {
-		oValue	= cXSInteger.cast(vValue);
-	}
-	catch (oError) {
-		throw oError;
-	}
-	// facet validation
-	if (oValue.value <= 9223372036854775807 && oValue.value >= -9223372036854775808)
-		return new cXSLong(oValue.value);
-	//
-	throw new cException("FORG0001");
-};
-
-//
-fStaticContext_defineSystemDataType("long",	cXSLong);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSInt(nValue) {
-	this.value	= nValue;
-};
-
-cXSInt.prototype	= new cXSLong;
-cXSInt.prototype.builtInKind	= cXSConstants.INT_DT;
-
-cXSInt.cast	= function(vValue) {
-	var oValue;
-	try {
-		oValue	= cXSInteger.cast(vValue);
-	}
-	catch (oError) {
-		throw oError;
-	}
-	// facet validation
-	if (oValue.value <= 2147483647 && oValue.value >= -2147483648)
-		return new cXSInt(oValue.value);
-	//
-	throw new cException("FORG0001");
-};
-
-//
-fStaticContext_defineSystemDataType("int",	cXSInt);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSShort(nValue) {
-	this.value	= nValue;
-};
-
-cXSShort.prototype	= new cXSInt;
-cXSShort.prototype.builtInKind	= cXSConstants.SHORT_DT;
-
-cXSShort.cast	= function(vValue) {
-	var oValue;
-	try {
-		oValue	= cXSInteger.cast(vValue);
-	}
-	catch (oError) {
-		throw oError;
-	}
-	// facet validation
-	if (oValue.value <= 32767 && oValue.value >= -32768)
-		return new cXSShort(oValue.value);
-	//
-	throw new cException("FORG0001");
-};
-
-//
-fStaticContext_defineSystemDataType("short",	cXSShort);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSByte(nValue) {
-	this.value	= nValue;
-};
-
-cXSByte.prototype	= new cXSShort;
-cXSByte.prototype.builtInKind	= cXSConstants.BYTE_DT;
-
-cXSByte.cast	= function(vValue) {
-	var oValue;
-	try {
-		oValue	= cXSInteger.cast(vValue);
-	}
-	catch (oError) {
-		throw oError;
-	}
-	// facet validation
-	if (oValue.value <= 127 && oValue.value >= -128)
-		return new cXSByte(oValue.value);
-	//
-	throw new cException("FORG0001");
-};
-
-//
-fStaticContext_defineSystemDataType("byte",	cXSByte);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSNonNegativeInteger(nValue) {
-	this.value	= nValue;
-};
-
-cXSNonNegativeInteger.prototype	= new cXSInteger;
-cXSNonNegativeInteger.prototype.builtInKind	= cXSConstants.NONNEGATIVEINTEGER_DT;
-
-cXSNonNegativeInteger.cast	= function(vValue) {
-	var oValue;
-	try {
-		oValue	= cXSInteger.cast(vValue);
-	}
-	catch (oError) {
-		throw oError;
-	}
-	// facet validation
-	if (oValue.value >= 0)
-		return new cXSNonNegativeInteger(oValue.value);
-	//
-	throw new cException("FORG0001");
-};
-
-//
-fStaticContext_defineSystemDataType("nonNegativeInteger",	cXSNonNegativeInteger);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSPositiveInteger(nValue) {
-	this.value	= nValue;
-};
-
-cXSPositiveInteger.prototype	= new cXSNonNegativeInteger;
-cXSPositiveInteger.prototype.builtInKind	= cXSConstants.POSITIVEINTEGER_DT;
-
-cXSPositiveInteger.cast	= function(vValue) {
-	var oValue;
-	try {
-		oValue	= cXSInteger.cast(vValue);
-	}
-	catch (oError) {
-		throw oError;
-	}
-	// facet validation
-	if (oValue.value >= 1)
-		return new cXSPositiveInteger(oValue.value);
-	//
-	throw new cException("FORG0001");
-};
-
-//
-fStaticContext_defineSystemDataType("positiveInteger",	cXSPositiveInteger);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSUnsignedLong(nValue) {
-	this.value	= nValue;
-};
-
-cXSUnsignedLong.prototype	= new cXSNonNegativeInteger;
-cXSUnsignedLong.prototype.builtInKind	= cXSConstants.UNSIGNEDLONG_DT;
-
-cXSUnsignedLong.cast	= function(vValue) {
-	var oValue;
-	try {
-		oValue	= cXSInteger.cast(vValue);
-	}
-	catch (oError) {
-		throw oError;
-	}
-	// facet validation
-	if (oValue.value >= 1 && oValue.value <= 18446744073709551615)
-		return new cXSUnsignedLong(oValue.value);
-	//
-	throw new cException("FORG0001");
-};
-
-//
-fStaticContext_defineSystemDataType("unsignedLong",	cXSUnsignedLong);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSUnsignedInt(nValue) {
-	this.value	= nValue;
-};
-
-cXSUnsignedInt.prototype	= new cXSNonNegativeInteger;
-cXSUnsignedInt.prototype.builtInKind	= cXSConstants.UNSIGNEDINT_DT;
-
-cXSUnsignedInt.cast	= function(vValue) {
-	var oValue;
-	try {
-		oValue	= cXSInteger.cast(vValue);
-	}
-	catch (oError) {
-		throw oError;
-	}
-	// facet validation
-	if (oValue.value >= 1 && oValue.value <= 4294967295)
-		return new cXSUnsignedInt(oValue.value);
-	//
-	throw new cException("FORG0001");
-};
-
-//
-fStaticContext_defineSystemDataType("unsignedInt",	cXSUnsignedInt);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSUnsignedShort(nValue) {
-	this.value	= nValue;
-};
-
-cXSUnsignedShort.prototype	= new cXSUnsignedInt;
-cXSUnsignedShort.prototype.builtInKind	= cXSConstants.UNSIGNEDSHORT_DT;
-
-cXSUnsignedShort.cast	= function(vValue) {
-	var oValue;
-	try {
-		oValue	= cXSInteger.cast(vValue);
-	}
-	catch (oError) {
-		throw oError;
-	}
-	// facet validation
-	if (oValue.value >= 1 && oValue.value <= 65535)
-		return new cXSUnsignedShort(oValue.value);
-	//
-	throw new cException("FORG0001");
-};
-
-//
-fStaticContext_defineSystemDataType("unsignedShort",	cXSUnsignedShort);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSUnsignedByte(nValue) {
-	this.value	= nValue;
-};
-
-cXSUnsignedByte.prototype	= new cXSUnsignedShort;
-cXSUnsignedByte.prototype.builtInKind	= cXSConstants.UNSIGNEDBYTE_DT;
-
-cXSUnsignedByte.cast	= function(vValue) {
-	var oValue;
-	try {
-		oValue	= cXSInteger.cast(vValue);
-	}
-	catch (oError) {
-		throw oError;
-	}
-	// facet validation
-	if (oValue.value >= 1 && oValue.value <= 255)
-		return new cXSUnsignedByte(oValue.value);
-	//
-	throw new cException("FORG0001");
-};
-
-//
-fStaticContext_defineSystemDataType("unsignedByte",	cXSUnsignedByte);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSNormalizedString(sValue) {
-	this.value	= sValue;
-};
-
-cXSNormalizedString.prototype	= new cXSString;
-cXSNormalizedString.prototype.builtInKind	= cXSConstants.NORMALIZEDSTRING_DT;
-
-cXSNormalizedString.cast	= function(vValue) {
-	return new cXSNormalizedString(cString(vValue));
-};
-
-//
-fStaticContext_defineSystemDataType("normalizedString",	cXSNormalizedString);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSToken(sValue) {
-	this.value	= sValue;
-};
-
-cXSToken.prototype	= new cXSNormalizedString;
-cXSToken.prototype.builtInKind	= cXSConstants.TOKEN_DT;
-
-cXSToken.cast	= function(vValue) {
-	return new cXSToken(cString(vValue));
-};
-
-//
-fStaticContext_defineSystemDataType("token",	cXSToken);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSName(sValue) {
-	this.value	= sValue;
-};
-
-cXSName.prototype	= new cXSToken;
-cXSName.prototype.builtInKind	= cXSConstants.NAME_DT;
-
-cXSName.cast	= function(vValue) {
-	return new cXSName(cString(vValue));
-};
-
-//
-fStaticContext_defineSystemDataType("Name",	cXSName);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSNCName(sValue) {
-	this.value	= sValue;
-};
-
-cXSNCName.prototype	= new cXSName;
-cXSNCName.prototype.builtInKind	= cXSConstants.NCNAME_DT;
-
-cXSNCName.cast	= function(vValue) {
-	return new cXSNCName(cString(vValue));
-};
-
-//
-fStaticContext_defineSystemDataType("NCName",	cXSNCName);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSENTITY(sValue) {
-	this.value	= sValue;
-};
-
-cXSENTITY.prototype	= new cXSNCName;
-cXSENTITY.prototype.builtInKind	= cXSConstants.ENTITY_DT;
-
-cXSENTITY.cast	= function(vValue) {
-	return new cXSENTITY(cString(vValue));
-};
-
-//
-fStaticContext_defineSystemDataType("ENTITY",	cXSENTITY);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSID(sValue) {
-	this.value	= sValue;
-};
-
-cXSID.prototype	= new cXSNCName;
-cXSID.prototype.builtInKind	= cXSConstants.ID_DT;
-
-cXSID.cast	= function(vValue) {
-	return new cXSID(cString(vValue));
-};
-
-//
-fStaticContext_defineSystemDataType("ID",	cXSID);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSIDREF(sValue) {
-	this.value	= sValue;
-};
-
-cXSIDREF.prototype	= new cXSNCName;
-cXSIDREF.prototype.builtInKind	= cXSConstants.IDREF_DT;
-
-cXSIDREF.cast	= function(vValue) {
-	return new cXSIDREF(cString(vValue));
-};
-
-//
-fStaticContext_defineSystemDataType("IDREF",	cXSIDREF);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSLanguage(sValue) {
-	this.value	= sValue;
-};
-
-cXSLanguage.prototype	= new cXSToken;
-cXSLanguage.prototype.builtInKind	= cXSConstants.LANGUAGE_DT;
-
-cXSLanguage.cast	= function(vValue) {
-	return new cXSLanguage(cString(vValue));
-};
-
-//
-fStaticContext_defineSystemDataType("language",	cXSLanguage);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXSNMTOKEN(sValue) {
-	this.value	= sValue;
-};
-
-cXSNMTOKEN.prototype	= new cXSToken;
-cXSNMTOKEN.prototype.builtInKind	= cXSConstants.NMTOKEN_DT;
-
-cXSNMTOKEN.cast	= function(vValue) {
-	return new cXSNMTOKEN(cString(vValue));
-};
-
-//
-fStaticContext_defineSystemDataType("NMTOKEN",	cXSNMTOKEN);
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXTItem() {
-
-};
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXTNode() {
-
-};
-
-cXTNode.prototype	= new cXTItem;
-
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXTAttribute() {
-
-};
-
-cXTAttribute.prototype	= new cXTNode;
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXTComment() {
-
-};
-
-cXTComment.prototype	= new cXTNode;
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXTDocument() {
-
-};
-
-cXTDocument.prototype	= new cXTNode;
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXTElement() {
-
-};
-
-cXTElement.prototype	= new cXTNode;
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXTProcessingInstruction() {
-
-};
-
-cXTProcessingInstruction.prototype	= new cXTNode;
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-function cXTText() {
-
-};
-
-cXTText.prototype	= new cXTNode;
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	12.1 Comparisons of base64Binary and hexBinary Values
-		op:hexBinary-equal
-		op:base64Binary-equal
-*/
-hStaticContext_operators["hexBinary-equal"]	= function(oLeft, oRight) {
-	return new cXSBoolean(oLeft.valueOf() == oRight.valueOf());
-};
-
-hStaticContext_operators["base64Binary-equal"]	= function(oLeft, oRight) {
-	return new cXSBoolean(oLeft.valueOf() == oRight.valueOf());
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	9.2 Operators on Boolean Values
-		op:boolean-equal
-		op:boolean-less-than
-		op:boolean-greater-than
-*/
-
-// 9.2 Operators on Boolean Values
-// op:boolean-equal($value1 as xs:boolean, $value2 as xs:boolean) as xs:boolean
-hStaticContext_operators["boolean-equal"]	= function(oLeft, oRight) {
-	return new cXSBoolean(oLeft.valueOf() == oRight.valueOf());
-};
-
-// op:boolean-less-than($arg1 as xs:boolean, $arg2 as xs:boolean) as xs:boolean
-hStaticContext_operators["boolean-less-than"]	= function(oLeft, oRight) {
-	return new cXSBoolean(oLeft.valueOf() < oRight.valueOf());
-};
-
-// op:boolean-greater-than($arg1 as xs:boolean, $arg2 as xs:boolean) as xs:boolean
-hStaticContext_operators["boolean-greater-than"]	= function(oLeft, oRight) {
-	return new cXSBoolean(oLeft.valueOf() > oRight.valueOf());
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	10.4 Comparison Operators on Duration, Date and Time Values
-		op:yearMonthDuration-less-than
-		op:yearMonthDuration-greater-than
-		op:dayTimeDuration-less-than
-		op:dayTimeDuration-greater-than
-		op:duration-equal
-		op:dateTime-equal
-		op:dateTime-less-than
-		op:dateTime-greater-than
-		op:date-equal
-		op:date-less-than
-		op:date-greater-than
-		op:time-equal
-		op:time-less-than
-		op:time-greater-than
-		op:gYearMonth-equal
-		op:gYear-equal
-		op:gMonthDay-equal
-		op:gMonth-equal
-		op:gDay-equal
-
-	10.6 Arithmetic Operators on Durations
-		op:add-yearMonthDurations
-		op:subtract-yearMonthDurations
-		op:multiply-yearMonthDuration
-		op:divide-yearMonthDuration
-		op:divide-yearMonthDuration-by-yearMonthDuration
-		op:add-dayTimeDurations
-		op:subtract-dayTimeDurations
-		op:multiply-dayTimeDuration
-		op:divide-dayTimeDuration
-		op:divide-dayTimeDuration-by-dayTimeDuration
-
-
-	10.8 Arithmetic Operators on Durations, Dates and Times
-		op:subtract-dateTimes
-		op:subtract-dates
-		op:subtract-times
-		op:add-yearMonthDuration-to-dateTime
-		op:add-dayTimeDuration-to-dateTime
-		op:subtract-yearMonthDuration-from-dateTime
-		op:subtract-dayTimeDuration-from-dateTime
-		op:add-yearMonthDuration-to-date
-		op:add-dayTimeDuration-to-date
-		op:subtract-yearMonthDuration-from-date
-		op:subtract-dayTimeDuration-from-date
-		op:add-dayTimeDuration-to-time
-		op:subtract-dayTimeDuration-from-time
-
-*/
-
-// 10.4 Comparison Operators on Duration, Date and Time Values
-// op:yearMonthDuration-less-than($arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration) as xs:boolean
-hStaticContext_operators["yearMonthDuration-less-than"]	= function(oLeft, oRight) {
-	return new cXSBoolean(fOperator_yearMonthDuration_toMonths(oLeft) < fOperator_yearMonthDuration_toMonths(oRight));
-};
-
-// op:yearMonthDuration-greater-than($arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration) as xs:boolean
-hStaticContext_operators["yearMonthDuration-greater-than"]	= function(oLeft, oRight) {
-	return new cXSBoolean(fOperator_yearMonthDuration_toMonths(oLeft) > fOperator_yearMonthDuration_toMonths(oRight));
-};
-
-// op:dayTimeDuration-less-than($arg1 as dayTimeDuration, $arg2 as dayTimeDuration) as xs:boolean
-hStaticContext_operators["dayTimeDuration-less-than"]	= function(oLeft, oRight) {
-	return new cXSBoolean(fOperator_dayTimeDuration_toSeconds(oLeft) < fOperator_dayTimeDuration_toSeconds(oRight));
-};
-
-// op:dayTimeDuration-greater-than($arg1 as dayTimeDuration, $arg2 as dayTimeDuration) as xs:boolean
-hStaticContext_operators["dayTimeDuration-greater-than"]	= function(oLeft, oRight) {
-	return new cXSBoolean(fOperator_dayTimeDuration_toSeconds(oLeft) > fOperator_dayTimeDuration_toSeconds(oRight));
-};
-
-// op:duration-equal($arg1 as xs:duration, $arg2 as xs:duration) as xs:boolean
-hStaticContext_operators["duration-equal"]	= function(oLeft, oRight) {
-	return new cXSBoolean(oLeft.negative == oRight.negative
-			&& fOperator_yearMonthDuration_toMonths(oLeft) == fOperator_yearMonthDuration_toMonths(oRight)
-			&& fOperator_dayTimeDuration_toSeconds(oLeft) == fOperator_dayTimeDuration_toSeconds(oRight));
-};
-
-// op:dateTime-equal($arg1 as xs:dateTime, $arg2 as xs:dateTime) as xs:boolean
-hStaticContext_operators["dateTime-equal"]	= function(oLeft, oRight) {
-	return fOperator_compareDateTimes(oLeft, oRight, 'eq');
-};
-
-// op:dateTime-less-than($arg1 as xs:dateTime, $arg2 as xs:dateTime) as xs:boolean
-hStaticContext_operators["dateTime-less-than"]	= function(oLeft, oRight) {
-	return fOperator_compareDateTimes(oLeft, oRight, 'lt');
-};
-
-//op:dateTime-greater-than($arg1 as xs:dateTime, $arg2 as xs:dateTime) as xs:boolean
-hStaticContext_operators["dateTime-greater-than"]	= function(oLeft, oRight) {
-	return fOperator_compareDateTimes(oLeft, oRight, 'gt');
-};
-
-// op:date-equal($arg1 as xs:date, $arg2 as xs:date) as xs:boolean
-hStaticContext_operators["date-equal"]	= function(oLeft, oRight) {
-	return fOperator_compareDates(oLeft, oRight, 'eq');
-};
-
-// op:date-less-than($arg1 as xs:date, $arg2 as xs:date) as xs:boolean
-hStaticContext_operators["date-less-than"]	= function(oLeft, oRight) {
-	return fOperator_compareDates(oLeft, oRight, 'lt');
-};
-
-// op:date-greater-than($arg1 as xs:date, $arg2 as xs:date) as xs:boolean
-hStaticContext_operators["date-greater-than"]	= function(oLeft, oRight) {
-	return fOperator_compareDates(oLeft, oRight, 'gt');
-};
-
-// op:time-equal($arg1 as xs:time, $arg2 as xs:time) as xs:boolean
-hStaticContext_operators["time-equal"]	= function(oLeft, oRight) {
-	return fOperator_compareTimes(oLeft, oRight, 'eq');
-};
-
-// op:time-less-than($arg1 as xs:time, $arg2 as xs:time) as xs:boolean
-hStaticContext_operators["time-less-than"]	= function(oLeft, oRight) {
-	return fOperator_compareTimes(oLeft, oRight, 'lt');
-};
-
-// op:time-greater-than($arg1 as xs:time, $arg2 as xs:time) as xs:boolean
-hStaticContext_operators["time-greater-than"]	= function(oLeft, oRight) {
-	return fOperator_compareTimes(oLeft, oRight, 'gt');
-};
-
-// op:gYearMonth-equal($arg1 as xs:gYearMonth, $arg2 as xs:gYearMonth) as xs:boolean
-hStaticContext_operators["gYearMonth-equal"]	= function(oLeft, oRight) {
-	return fOperator_compareDateTimes(
-			new cXSDateTime(oLeft.year, oLeft.month, fXSDate_getDaysForYearMonth(oLeft.year, oLeft.month), 0, 0, 0, oLeft.timezone == null ? this.timezone : oLeft.timezone),
-			new cXSDateTime(oRight.year, oRight.month, fXSDate_getDaysForYearMonth(oRight.year, oRight.month), 0, 0, 0, oRight.timezone == null ? this.timezone : oRight.timezone),
-			'eq'
-	);
-};
-
-// op:gYear-equal($arg1 as xs:gYear, $arg2 as xs:gYear) as xs:boolean
-hStaticContext_operators["gYear-equal"]	= function(oLeft, oRight) {
-	return fOperator_compareDateTimes(
-			new cXSDateTime(oLeft.year, 1, 1, 0, 0, 0, oLeft.timezone == null ? this.timezone : oLeft.timezone),
-			new cXSDateTime(oRight.year, 1, 1, 0, 0, 0, oRight.timezone == null ? this.timezone : oRight.timezone),
-			'eq'
-	);
-};
-
-// op:gMonthDay-equal($arg1 as xs:gMonthDay, $arg2 as xs:gMonthDay) as xs:boolean
-hStaticContext_operators["gMonthDay-equal"]	= function(oLeft, oRight) {
-	return fOperator_compareDateTimes(
-			new cXSDateTime(1972, oLeft.month, oLeft.day, 0, 0, 0, oLeft.timezone == null ? this.timezone : oLeft.timezone),
-			new cXSDateTime(1972, oRight.month, oRight.day, 0, 0, 0, oRight.timezone == null ? this.timezone : oRight.timezone),
-			'eq'
-	);
-};
-
-// op:gMonth-equal($arg1 as xs:gMonth, $arg2 as xs:gMonth) as xs:boolean
-hStaticContext_operators["gMonth-equal"]	= function(oLeft, oRight) {
-	return fOperator_compareDateTimes(
-			new cXSDateTime(1972, oLeft.month, fXSDate_getDaysForYearMonth(1972, oRight.month), 0, 0, 0, oLeft.timezone == null ? this.timezone : oLeft.timezone),
-			new cXSDateTime(1972, oRight.month, fXSDate_getDaysForYearMonth(1972, oRight.month), 0, 0, 0, oRight.timezone == null ? this.timezone : oRight.timezone),
-			'eq'
-	);
-};
-
-// op:gDay-equal($arg1 as xs:gDay, $arg2 as xs:gDay) as xs:boolean
-hStaticContext_operators["gDay-equal"]	= function(oLeft, oRight) {
-	return fOperator_compareDateTimes(
-			new cXSDateTime(1972, 12, oLeft.day, 0, 0, 0, oLeft.timezone == null ? this.timezone : oLeft.timezone),
-			new cXSDateTime(1972, 12, oRight.day, 0, 0, 0, oRight.timezone == null ? this.timezone : oRight.timezone),
-			'eq'
-	);
-};
-
-// 10.6 Arithmetic Operators on Durations
-// op:add-yearMonthDurations($arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration) as xs:yearMonthDuration
-hStaticContext_operators["add-yearMonthDurations"]	= function(oLeft, oRight) {
-	return fOperator_yearMonthDuration_fromMonths(fOperator_yearMonthDuration_toMonths(oLeft) + fOperator_yearMonthDuration_toMonths(oRight));
-};
-
-// op:subtract-yearMonthDurations($arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration) as xs:yearMonthDuration
-hStaticContext_operators["subtract-yearMonthDurations"]	= function(oLeft, oRight) {
-	return fOperator_yearMonthDuration_fromMonths(fOperator_yearMonthDuration_toMonths(oLeft) - fOperator_yearMonthDuration_toMonths(oRight));
-};
-
-// op:multiply-yearMonthDuration($arg1 as xs:yearMonthDuration, $arg2 as xs:double) as xs:yearMonthDuration
-hStaticContext_operators["multiply-yearMonthDuration"]	= function(oLeft, oRight) {
-	return fOperator_yearMonthDuration_fromMonths(fOperator_yearMonthDuration_toMonths(oLeft) * oRight);
-};
-
-// op:divide-yearMonthDuration($arg1 as xs:yearMonthDuration, $arg2 as xs:double) as xs:yearMonthDuration
-hStaticContext_operators["divide-yearMonthDuration"]	= function(oLeft, oRight) {
-	return fOperator_yearMonthDuration_fromMonths(fOperator_yearMonthDuration_toMonths(oLeft) / oRight);
-};
-
-// op:divide-yearMonthDuration-by-yearMonthDuration($arg1 as xs:yearMonthDuration, $arg2 as xs:yearMonthDuration) as xs:decimal
-hStaticContext_operators["divide-yearMonthDuration-by-yearMonthDuration"]	= function(oLeft, oRight) {
-	return new cXSDecimal(fOperator_yearMonthDuration_toMonths(oLeft) / fOperator_yearMonthDuration_toMonths(oRight));
-};
-
-// op:add-dayTimeDurations($arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration) as xs:dayTimeDuration
-hStaticContext_operators["add-dayTimeDurations"]	= function(oLeft, oRight) {
-	return fOperator_dayTimeDuration_fromSeconds(fOperator_dayTimeDuration_toSeconds(oLeft) + fOperator_dayTimeDuration_toSeconds(oRight));
-};
-
-// op:subtract-dayTimeDurations($arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration) as xs:dayTimeDuration
-hStaticContext_operators["subtract-dayTimeDurations"]	= function(oLeft, oRight) {
-	return fOperator_dayTimeDuration_fromSeconds(fOperator_dayTimeDuration_toSeconds(oLeft) - fOperator_dayTimeDuration_toSeconds(oRight));
-};
-
-// op:multiply-dayTimeDurations($arg1 as xs:dayTimeDuration, $arg2 as xs:double) as xs:dayTimeDuration
-hStaticContext_operators["multiply-dayTimeDuration"]	= function(oLeft, oRight) {
-	return fOperator_dayTimeDuration_fromSeconds(fOperator_dayTimeDuration_toSeconds(oLeft) * oRight);
-};
-
-// op:divide-dayTimeDurations($arg1 as xs:dayTimeDuration, $arg2 as xs:double) as xs:dayTimeDuration
-hStaticContext_operators["divide-dayTimeDuration"]	= function(oLeft, oRight) {
-	return fOperator_dayTimeDuration_fromSeconds(fOperator_dayTimeDuration_toSeconds(oLeft) / oRight);
-};
-
-// op:divide-dayTimeDuration-by-dayTimeDuration($arg1 as xs:dayTimeDuration, $arg2 as xs:dayTimeDuration) as xs:decimal
-hStaticContext_operators["divide-dayTimeDuration-by-dayTimeDuration"]	= function(oLeft, oRight) {
-	return new cXSDecimal(fOperator_dayTimeDuration_toSeconds(oLeft) / fOperator_dayTimeDuration_toSeconds(oRight));
-};
-
-// 10.8 Arithmetic Operators on Durations, Dates and Times
-// op:subtract-dateTimes($arg1 as xs:dateTime, $arg2 as xs:dateTime) as xs:dayTimeDuration
-hStaticContext_operators["subtract-dateTimes"]	= function(oLeft, oRight) {
-	return fOperator_dayTimeDuration_fromSeconds(fOperator_dateTime_toSeconds(oLeft) - fOperator_dateTime_toSeconds(oRight));
-};
-
-// op:subtract-dates($arg1 as xs:date, $arg2 as xs:date) as xs:dayTimeDuration
-hStaticContext_operators["subtract-dates"]	= function(oLeft, oRight) {
-	return fOperator_dayTimeDuration_fromSeconds(fOperator_dateTime_toSeconds(oLeft) - fOperator_dateTime_toSeconds(oRight));
-};
-
-// op:subtract-times($arg1 as xs:time, $arg2 as xs:time) as xs:dayTimeDuration
-hStaticContext_operators["subtract-times"]	= function(oLeft, oRight) {
-	return fOperator_dayTimeDuration_fromSeconds(fOperator_time_toSeconds(oLeft) - fOperator_time_toSeconds(oRight));
-};
-
-// op:add-yearMonthDuration-to-dateTime($arg1 as xs:dateTime, $arg2 as xs:yearMonthDuration) as xs:dateTime
-hStaticContext_operators["add-yearMonthDuration-to-dateTime"]	= function(oLeft, oRight) {
-	return fOperator_addYearMonthDuration2DateTime(oLeft, oRight, '+');
-};
-
-// op:add-dayTimeDuration-to-dateTime($arg1 as xs:dateTime, $arg2 as xs:dayTimeDuration) as xs:dateTime
-hStaticContext_operators["add-dayTimeDuration-to-dateTime"]	= function(oLeft, oRight) {
-	return fOperator_addDayTimeDuration2DateTime(oLeft, oRight, '+');
-};
-
-// op:subtract-yearMonthDuration-from-dateTime($arg1 as xs:dateTime, $arg2 as xs:yearMonthDuration) as xs:dateTime
-hStaticContext_operators["subtract-yearMonthDuration-from-dateTime"]	= function(oLeft, oRight) {
-	return fOperator_addYearMonthDuration2DateTime(oLeft, oRight, '-');
-};
-
-// op:subtract-dayTimeDuration-from-dateTime($arg1 as xs:dateTime, $arg2 as xs:dayTimeDuration) as xs:dateTime
-hStaticContext_operators["subtract-dayTimeDuration-from-dateTime"]	= function(oLeft, oRight) {
-	return fOperator_addDayTimeDuration2DateTime(oLeft, oRight, '-');
-};
-
-// op:add-yearMonthDuration-to-date($arg1 as xs:date, $arg2 as xs:yearMonthDuration) as xs:date
-hStaticContext_operators["add-yearMonthDuration-to-date"]	= function(oLeft, oRight) {
-	return fOperator_addYearMonthDuration2DateTime(oLeft, oRight, '+');
-};
-
-// op:add-dayTimeDuration-to-date($arg1 as xs:date, $arg2 as xs:dayTimeDuration) as xs:date
-hStaticContext_operators["add-dayTimeDuration-to-date"]	= function(oLeft, oRight) {
-	return fOperator_addDayTimeDuration2DateTime(oLeft, oRight, '+');
-};
-
-// op:subtract-yearMonthDuration-from-date($arg1 as xs:date, $arg2  as xs:yearMonthDuration) as xs:date
-hStaticContext_operators["subtract-yearMonthDuration-from-date"]	= function(oLeft, oRight) {
-	return fOperator_addYearMonthDuration2DateTime(oLeft, oRight, '-');
-};
-
-// op:subtract-dayTimeDuration-from-date($arg1 as xs:date, $arg2  as xs:dayTimeDuration) as xs:date
-hStaticContext_operators["subtract-dayTimeDuration-from-date"]	= function(oLeft, oRight) {
-	return fOperator_addDayTimeDuration2DateTime(oLeft, oRight, '-');
-};
-
-// op:add-dayTimeDuration-to-time($arg1 as xs:time, $arg2  as xs:dayTimeDuration) as xs:time
-hStaticContext_operators["add-dayTimeDuration-to-time"]	= function(oLeft, oRight) {
-	var oValue	= new cXSTime(oLeft.hours, oLeft.minutes, oLeft.seconds, oLeft.timezone);
-	oValue.hours	+= oRight.hours;
-	oValue.minutes	+= oRight.minutes;
-	oValue.seconds	+= oRight.seconds;
-	//
-	return fXSTime_normalize(oValue);
-};
-
-// op:subtract-dayTimeDuration-from-time($arg1 as xs:time, $arg2  as xs:dayTimeDuration) as xs:time
-hStaticContext_operators["subtract-dayTimeDuration-from-time"]	= function(oLeft, oRight) {
-	var oValue	= new cXSTime(oLeft.hours, oLeft.minutes, oLeft.seconds, oLeft.timezone);
-	oValue.hours	-= oRight.hours;
-	oValue.minutes	-= oRight.minutes;
-	oValue.seconds	-= oRight.seconds;
-	//
-	return fXSTime_normalize(oValue);
-};
-
-function fOperator_compareTimes(oLeft, oRight, sComparator) {
-	var nLeft	= fOperator_time_toSeconds(oLeft),
-		nRight	= fOperator_time_toSeconds(oRight);
-	return new cXSBoolean(sComparator == 'lt' ? nLeft < nRight : sComparator == 'gt' ? nLeft > nRight : nLeft == nRight);
-};
-
-function fOperator_compareDates(oLeft, oRight, sComparator) {
-	return fOperator_compareDateTimes(cXSDateTime.cast(oLeft), cXSDateTime.cast(oRight), sComparator);
-};
-
-function fOperator_compareDateTimes(oLeft, oRight, sComparator) {
-	// Adjust object time zone to Z and compare as strings
-	var oTimezone	= new cXSDayTimeDuration(0, 0, 0, 0),
-		sLeft	= fFunction_dateTime_adjustTimezone(oLeft, oTimezone).toString(),
-		sRight	= fFunction_dateTime_adjustTimezone(oRight, oTimezone).toString();
-	return new cXSBoolean(sComparator == 'lt' ? sLeft < sRight : sComparator == 'gt' ? sLeft > sRight : sLeft == sRight);
-};
-
-function fOperator_addYearMonthDuration2DateTime(oLeft, oRight, sOperator) {
-	var oValue;
-	if (oLeft instanceof cXSDate)
-		oValue	= new cXSDate(oLeft.year, oLeft.month, oLeft.day, oLeft.timezone, oLeft.negative);
-	else
-	if (oLeft instanceof cXSDateTime)
-		oValue	= new cXSDateTime(oLeft.year, oLeft.month, oLeft.day, oLeft.hours, oLeft.minutes, oLeft.seconds, oLeft.timezone, oLeft.negative);
-	//
-	oValue.year		= oValue.year + oRight.year * (sOperator == '-' ?-1 : 1);
-	oValue.month	= oValue.month + oRight.month * (sOperator == '-' ?-1 : 1);
-	//
-	fXSDate_normalize(oValue, true);
-	// Correct day if out of month range
-	var nDay	= fXSDate_getDaysForYearMonth(oValue.year, oValue.month);
-	if (oValue.day > nDay)
-		oValue.day	= nDay;
-	//
-	return oValue;
-};
-
-function fOperator_addDayTimeDuration2DateTime(oLeft, oRight, sOperator) {
-	var oValue;
-	if (oLeft instanceof cXSDate) {
-		var nValue	= (oRight.hours * 60 + oRight.minutes) * 60 + oRight.seconds;
-		oValue	= new cXSDate(oLeft.year, oLeft.month, oLeft.day, oLeft.timezone, oLeft.negative);
-		oValue.day	= oValue.day + oRight.day * (sOperator == '-' ?-1 : 1) - 1 * (nValue && sOperator == '-');
-		//
-		fXSDate_normalize(oValue);
-	}
-	else
-	if (oLeft instanceof cXSDateTime) {
-		oValue	= new cXSDateTime(oLeft.year, oLeft.month, oLeft.day, oLeft.hours, oLeft.minutes, oLeft.seconds, oLeft.timezone, oLeft.negative);
-		oValue.seconds	= oValue.seconds + oRight.seconds * (sOperator == '-' ?-1 : 1);
-		oValue.minutes	= oValue.minutes + oRight.minutes * (sOperator == '-' ?-1 : 1);
-		oValue.hours	= oValue.hours + oRight.hours * (sOperator == '-' ?-1 : 1);
-		oValue.day		= oValue.day + oRight.day * (sOperator == '-' ?-1 : 1);
-		//
-		fXSDateTime_normalize(oValue);
-	}
-	return oValue;
-};
-
-// xs:dayTimeDuration to/from seconds
-function fOperator_dayTimeDuration_toSeconds(oDuration) {
-	return (((oDuration.day * 24 + oDuration.hours) * 60 + oDuration.minutes) * 60 + oDuration.seconds) * (oDuration.negative ? -1 : 1);
-};
-
-function fOperator_dayTimeDuration_fromSeconds(nValue) {
-	var bNegative	=(nValue = cMath.round(nValue)) < 0,
-		nDays	= ~~((nValue = cMath.abs(nValue)) / 86400),
-		nHours	= ~~((nValue -= nDays * 3600 * 24) / 3600),
-		nMinutes= ~~((nValue -= nHours * 3600) / 60),
-		nSeconds	= nValue -= nMinutes * 60;
-	return new cXSDayTimeDuration(nDays, nHours, nMinutes, nSeconds, bNegative);
-};
-
-// xs:yearMonthDuration to/from months
-function fOperator_yearMonthDuration_toMonths(oDuration) {
-	return (oDuration.year * 12 + oDuration.month) * (oDuration.negative ? -1 : 1);
-};
-
-function fOperator_yearMonthDuration_fromMonths(nValue) {
-	var nNegative	=(nValue = cMath.round(nValue)) < 0,
-		nYears	= ~~((nValue = cMath.abs(nValue)) / 12),
-		nMonths		= nValue -= nYears * 12;
-	return new cXSYearMonthDuration(nYears, nMonths, nNegative);
-};
-
-// xs:time to seconds
-function fOperator_time_toSeconds(oTime) {
-	return oTime.seconds + (oTime.minutes - (oTime.timezone != null ? oTime.timezone % 60 : 0) + (oTime.hours - (oTime.timezone != null ? ~~(oTime.timezone / 60) : 0)) * 60) * 60;
-};
-
-// This function unlike all other date-related functions rely on interpretor's dateTime handling
-function fOperator_dateTime_toSeconds(oValue) {
-	var oDate	= new cDate((oValue.negative ? -1 : 1) * oValue.year, oValue.month, oValue.day, 0, 0, 0, 0);
-	if (oValue instanceof cXSDateTime) {
-		oDate.setHours(oValue.hours);
-		oDate.setMinutes(oValue.minutes);
-		oDate.setSeconds(oValue.seconds);
-	}
-	if (oValue.timezone != null)
-		oDate.setMinutes(oDate.getMinutes() - oValue.timezone);
-	return oDate.getTime() / 1000;
-};
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	14 Functions and Operators on Nodes
-		op:is-same-node
-		op:node-before
-		op:node-after
-*/
-
-// 14 Operators on Nodes
-// op:is-same-node($parameter1 as node(), $parameter2 as node()) as xs:boolean
-hStaticContext_operators["is-same-node"]	= function(oLeft, oRight) {
-	return new cXSBoolean(this.DOMAdapter.isSameNode(oLeft, oRight));
-};
-
-// op:node-before($parameter1 as node(), $parameter2 as node()) as xs:boolean
-hStaticContext_operators["node-before"]	= function(oLeft, oRight) {
-	return new cXSBoolean(!!(this.DOMAdapter.compareDocumentPosition(oLeft, oRight) & 4));
-};
-
-// op:node-after($parameter1 as node(), $parameter2 as node()) as xs:boolean
-hStaticContext_operators["node-after"]	= function(oLeft, oRight) {
-	return new cXSBoolean(!!(this.DOMAdapter.compareDocumentPosition(oLeft, oRight) & 2));
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	13.1 Operators on NOTATION
-		op:NOTATION-equal
-*/
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	6.2 Operators on Numeric Values
-		op:numeric-add
-		op:numeric-subtract
-		op:numeric-multiply
-		op:numeric-divide
-		op:numeric-integer-divide
-		op:numeric-mod
-		op:numeric-unary-plus
-		op:numeric-unary-minus
-
-	6.3 Comparison Operators on Numeric Values
-		op:numeric-equal
-		op:numeric-less-than
-		op:numeric-greater-than
-*/
-
-// 6.2 Operators on Numeric Values
-function fFunctionCall_numeric_getPower(oLeft, oRight) {
-	if (fIsNaN(oLeft) || (cMath.abs(oLeft) == nInfinity) || fIsNaN(oRight) || (cMath.abs(oRight) == nInfinity))
-		return 0;
-	var aLeft	= cString(oLeft).match(rNumericLiteral),
-		aRight	= cString(oRight).match(rNumericLiteral),
-		nPower	= cMath.max(1, (aLeft[2] || aLeft[3] || '').length + (aLeft[5] || 0) * (aLeft[4] == '+' ?-1 : 1), (aRight[2] || aRight[3] || '').length + (aRight[5] || 0) * (aRight[4] == '+' ?-1 : 1));
-	return nPower + (nPower % 2 ? 0 : 1);
-};
-
-// op:numeric-add($arg1 as numeric, $arg2 as numeric) as numeric
-hStaticContext_operators["numeric-add"]		= function(oLeft, oRight) {
-	var nLeft	= oLeft.valueOf(),
-		nRight	= oRight.valueOf(),
-		nPower	= cMath.pow(10, fFunctionCall_numeric_getPower(nLeft, nRight));
-	return fOperator_numeric_getResultOfType(oLeft, oRight, ((nLeft * nPower) + (nRight * nPower))/nPower);
-};
-
-// op:numeric-subtract($arg1 as numeric, $arg2 as numeric) as numeric
-hStaticContext_operators["numeric-subtract"]	= function(oLeft, oRight) {
-	var nLeft	= oLeft.valueOf(),
-		nRight	= oRight.valueOf(),
-		nPower	= cMath.pow(10, fFunctionCall_numeric_getPower(nLeft, nRight));
-	return fOperator_numeric_getResultOfType(oLeft, oRight, ((nLeft * nPower) - (nRight * nPower))/nPower);
-};
-
-// op:numeric-multiply($arg1 as numeric, $arg2 as numeric) as numeric
-hStaticContext_operators["numeric-multiply"]	= function(oLeft, oRight) {
-	var nLeft	= oLeft.valueOf(),
-		nRight	= oRight.valueOf(),
-		nPower	= cMath.pow(10, fFunctionCall_numeric_getPower(nLeft, nRight));
-	return fOperator_numeric_getResultOfType(oLeft, oRight, ((nLeft * nPower) * (nRight * nPower))/(nPower * nPower));
-};
-
-// op:numeric-divide($arg1 as numeric, $arg2 as numeric) as numeric
-hStaticContext_operators["numeric-divide"]	= function(oLeft, oRight) {
-	var nLeft	= oLeft.valueOf(),
-		nRight	= oRight.valueOf(),
-		nPower	= cMath.pow(10, fFunctionCall_numeric_getPower(nLeft, nRight));
-	return fOperator_numeric_getResultOfType(oLeft, oRight, (oLeft * nPower) / (oRight * nPower));
-};
-
-// op:numeric-integer-divide($arg1 as numeric, $arg2 as numeric) as xs:integer
-hStaticContext_operators["numeric-integer-divide"]	= function(oLeft, oRight) {
-	var oValue = oLeft / oRight;
-	return new cXSInteger(cMath.floor(oValue) + (oValue < 0));
-};
-
-// op:numeric-mod($arg1 as numeric, $arg2 as numeric) as numeric
-hStaticContext_operators["numeric-mod"]	= function(oLeft, oRight) {
-	var nLeft	= oLeft.valueOf(),
-		nRight	= oRight.valueOf(),
-		nPower	= cMath.pow(10, fFunctionCall_numeric_getPower(nLeft, nRight));
-	return fOperator_numeric_getResultOfType(oLeft, oRight, ((nLeft * nPower) % (nRight * nPower)) / nPower);
-};
-
-// op:numeric-unary-plus($arg as numeric) as numeric
-hStaticContext_operators["numeric-unary-plus"]	= function(oRight) {
-	return oRight;
-};
-
-// op:numeric-unary-minus($arg as numeric) as numeric
-hStaticContext_operators["numeric-unary-minus"]	= function(oRight) {
-	oRight.value	*=-1;
-	return oRight;
-};
-
-
-// 6.3 Comparison Operators on Numeric Values
-// op:numeric-equal($arg1 as numeric, $arg2 as numeric) as xs:boolean
-hStaticContext_operators["numeric-equal"]	= function(oLeft, oRight) {
-	return new cXSBoolean(oLeft.valueOf() == oRight.valueOf());
-};
-
-// op:numeric-less-than($arg1 as numeric, $arg2 as numeric) as xs:boolean
-hStaticContext_operators["numeric-less-than"]	= function(oLeft, oRight) {
-	return new cXSBoolean(oLeft.valueOf() < oRight.valueOf());
-};
-
-// op:numeric-greater-than($arg1 as numeric, $arg2 as numeric) as xs:boolean
-hStaticContext_operators["numeric-greater-than"]	= function(oLeft, oRight) {
-	return new cXSBoolean(oLeft.valueOf() > oRight.valueOf());
-};
-
-function fOperator_numeric_getResultOfType(oLeft, oRight, nResult) {
-	return new (oLeft instanceof cXSInteger && oRight instanceof cXSInteger && nResult == cMath.round(nResult) ? cXSInteger : cXSDecimal)(nResult);
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	11.2 Functions and Operators Related to QNames
-		op:QName-equal
-
-*/
-
-// 11.2 Operators Related to QNames
-// op:QName-equal($arg1 as xs:QName, $arg2 as xs:QName) as xs:boolean
-hStaticContext_operators["QName-equal"]	= function(oLeft, oRight) {
-	return new cXSBoolean(oLeft.localName == oRight.localName && oLeft.namespaceURI == oRight.namespaceURI);
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	15.1 General Functions and Operators on Sequences
-		op:concatenate
-
-	15.3 Equals, Union, Intersection and Except
-		op:union
-		op:intersect
-		op:except
-
-	15.5 Functions and Operators that Generate Sequences
-		op:to
-
-*/
-
-// 15.1 General Functions and Operators on Sequences
-// op:concatenate($seq1 as item()*, $seq2 as item()*) as item()*
-hStaticContext_operators["concatenate"]	= function(oSequence1, oSequence2) {
-	return oSequence1.concat(oSequence2);
-};
-
-// 15.3 Equals, Union, Intersection and Except
-// op:union($parameter1 as node()*, $parameter2 as node()*) as node()*
-hStaticContext_operators["union"]	= function(oSequence1, oSequence2) {
-	var oSequence	= [];
-	// Process first collection
-	for (var nIndex = 0, nLength = oSequence1.length, oItem; nIndex < nLength; nIndex++) {
-		if (!this.DOMAdapter.isNode(oItem = oSequence1[nIndex]))
-			throw new cException("XPTY0004"
-
-			);	// Required item type of second operand of 'intersect' is node(); supplied value has item type xs:integer
-		//
-		if (fArray_indexOf(oSequence, oItem) ==-1)
-			oSequence.push(oItem);
-	}
-	// Process second collection
-	for (var nIndex = 0, nLength = oSequence2.length, oItem; nIndex < nLength; nIndex++) {
-		if (!this.DOMAdapter.isNode(oItem = oSequence2[nIndex]))
-			throw new cException("XPTY0004"
-
-			);	// Required item type of second operand of 'intersect' is node(); supplied value has item type xs:integer
-		//
-		if (fArray_indexOf(oSequence, oItem) ==-1)
-			oSequence.push(oItem);
-	}
-	return fFunction_sequence_order(oSequence, this);
-};
-
-// op:intersect($parameter1 as node()*, $parameter2 as node()*) as node()*
-hStaticContext_operators["intersect"]	= function(oSequence1, oSequence2) {
-	var oSequence	= [];
-	for (var nIndex = 0, nLength = oSequence1.length, oItem, bFound; nIndex < nLength; nIndex++) {
-		if (!this.DOMAdapter.isNode(oItem = oSequence1[nIndex]))
-			throw new cException("XPTY0004"
-
-			);	// Required item type of second operand of 'intersect' is node(); supplied value has item type xs:integer
-		//
-		bFound	= false;
-		for (var nRightIndex = 0, nRightLength = oSequence2.length;(nRightIndex < nRightLength) && !bFound; nRightIndex++) {
-			if (!this.DOMAdapter.isNode(oSequence2[nRightIndex]))
-				throw new cException("XPTY0004"
-
-				);
-			bFound = this.DOMAdapter.isSameNode(oSequence2[nRightIndex], oItem);
-		}
-		//
-		if (bFound && fArray_indexOf(oSequence, oItem) ==-1)
-			oSequence.push(oItem);
-	}
-	return fFunction_sequence_order(oSequence, this);
-};
-
-// op:except($parameter1 as node()*, $parameter2 as node()*) as node()*
-hStaticContext_operators["except"]	= function(oSequence1, oSequence2) {
-	var oSequence	= [];
-	for (var nIndex = 0, nLength = oSequence1.length, oItem, bFound; nIndex < nLength; nIndex++) {
-		if (!this.DOMAdapter.isNode(oItem = oSequence1[nIndex]))
-			throw new cException("XPTY0004"
-
-			);	// Required item type of second operand of 'intersect' is node(); supplied value has item type xs:integer
-		//
-		bFound	= false;
-		for (var nRightIndex = 0, nRightLength = oSequence2.length;(nRightIndex < nRightLength) && !bFound; nRightIndex++) {
-			if (!this.DOMAdapter.isNode(oSequence2[nRightIndex]))
-				throw new cException("XPTY0004"
-
-				);
-			bFound = this.DOMAdapter.isSameNode(oSequence2[nRightIndex], oItem);
-		}
-		//
-		if (!bFound && fArray_indexOf(oSequence, oItem) ==-1)
-			oSequence.push(oItem);
-	}
-	return fFunction_sequence_order(oSequence, this);
-};
-
-// 15.5 Functions and Operators that Generate Sequences
-// op:to($firstval as xs:integer, $lastval as xs:integer) as xs:integer*
-hStaticContext_operators["to"]	= function(oLeft, oRight) {
-	var oSequence	= [];
-	for (var nIndex = oLeft.valueOf(), nLength = oRight.valueOf(); nIndex <= nLength; nIndex++)
-		oSequence.push(new cXSInteger(nIndex));
-	//
-	return oSequence;
-};
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	2 Accessors
-		node-name
-		nilled
-		string
-		data
-		base-uri
-		document-uri
-
-*/
-
-// fn:node-name($arg as node()?) as xs:QName?
-fStaticContext_defineSystemFunction("node-name",		[[cXTNode, '?']],	function(oNode) {
-	if (oNode != null) {
-		var fGetProperty	= this.DOMAdapter.getProperty;
-		switch (fGetProperty(oNode, "nodeType")) {
-			case 1:		// ELEMENT_NAME
-			case 2:		// ATTRIBUTE_NODE
-				return new cXSQName(fGetProperty(oNode, "prefix"), fGetProperty(oNode, "localName"), fGetProperty(oNode, "namespaceURI"));
-			case 5:		// ENTITY_REFERENCE_NODE
-				throw "Not implemented";
-			case 6:		// ENTITY_NODE
-				throw "Not implemented";
-			case 7:		// PROCESSING_INSTRUCTION_NODE
-				return new cXSQName(null, fGetProperty(oNode, "target"), null);
-			case 10:	// DOCUMENT_TYPE_NODE
-				return new cXSQName(null, fGetProperty(oNode, "name"), null);
-		}
-	}
-	//
-	return null;
-});
-
-// fn:nilled($arg as node()?) as xs:boolean?
-fStaticContext_defineSystemFunction("nilled",	[[cXTNode, '?']],	function(oNode) {
-	if (oNode != null) {
-		if (this.DOMAdapter.getProperty(oNode, "nodeType") == 1)
-			return new cXSBoolean(false);	// TODO: Determine if node is nilled
-	}
-	//
-	return null;
-});
-
-// fn:string() as xs:string
-// fn:string($arg as item()?) as xs:string
-fStaticContext_defineSystemFunction("string",	[[cXTItem, '?', true]],	function(/*[*/oItem/*]*/) {
-	if (!arguments.length) {
-		if (!this.item)
-			throw new cException("XPDY0002");
-		oItem	= this.item;
-	}
-	return oItem == null ? new cXSString('') : cXSString.cast(fFunction_sequence_atomize([oItem], this)[0]);
-});
-
-// fn:data($arg as item()*) as xs:anyAtomicType*
-fStaticContext_defineSystemFunction("data",	[[cXTItem, '*']],		function(oSequence1) {
-	return fFunction_sequence_atomize(oSequence1, this);
-});
-
-// fn:base-uri() as xs:anyURI?
-// fn:base-uri($arg as node()?) as xs:anyURI?
-fStaticContext_defineSystemFunction("base-uri",	[[cXTNode, '?', true]],	function(oNode) {
-	if (!arguments.length) {
-		if (!this.DOMAdapter.isNode(this.item))
-			throw new cException("XPTY0004"
-
-			);
-		oNode	= this.item;
-	}
-	//
-	return cXSAnyURI.cast(new cXSString(this.DOMAdapter.getProperty(oNode, "baseURI") || ''));
-});
-
-// fn:document-uri($arg as node()?) as xs:anyURI?
-fStaticContext_defineSystemFunction("document-uri",	[[cXTNode, '?']],	function(oNode) {
-	if (oNode != null) {
-		var fGetProperty	= this.DOMAdapter.getProperty;
-		if (fGetProperty(oNode, "nodeType") == 9)
-			return cXSAnyURI.cast(new cXSString(fGetProperty(oNode, "documentURI") || ''));
-	}
-	//
-	return null;
-});
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	8 Functions on anyURI
-		resolve-uri
-*/
-
-// fn:resolve-uri($relative as xs:string?) as xs:anyURI?
-// fn:resolve-uri($relative as xs:string?, $base as xs:string) as xs:anyURI?
-fStaticContext_defineSystemFunction("resolve-uri",	[[cXSString, '?'], [cXSString, '', true]],	function(sUri, sBaseUri) {
-	if (arguments.length < 2) {
-		if (!this.DOMAdapter.isNode(this.item))
-			throw new cException("XPTY0004"
-
-			);
-		sBaseUri	= new cXSString(this.DOMAdapter.getProperty(this.item, "baseURI") || '');
-	}
-
-	if (sUri == null)
-		return null;
-
-	//
-	if (sUri.valueOf() == '' || sUri.valueOf().charAt(0) == '#')
-		return cXSAnyURI.cast(sBaseUri);
-
-	var oUri	= cXSAnyURI.cast(sUri);
-	if (oUri.scheme)
-		return oUri;
-
-	var oBaseUri	= cXSAnyURI.cast(sBaseUri);
-	oUri.scheme	= oBaseUri.scheme;
-
-	if (!oUri.authority) {
-		// authority
-		oUri.authority	= oBaseUri.authority;
-
-		// path
-		if (oUri.path.charAt(0) != '/') {
-			var aUriSegments		= oUri.path.split('/'),
-				aBaseUriSegments	= oBaseUri.path.split('/');
-			aBaseUriSegments.pop();
-
-			var nBaseUriStart	= aBaseUriSegments[0] == '' ? 1 : 0;
-			for (var nIndex = 0, nLength = aUriSegments.length; nIndex < nLength; nIndex++) {
-				if (aUriSegments[nIndex] == '..') {
-					if (aBaseUriSegments.length > nBaseUriStart)
-						aBaseUriSegments.pop();
-					else {
-						aBaseUriSegments.push(aUriSegments[nIndex]);
-						nBaseUriStart++;
-					}
-				}
-				else
-				if (aUriSegments[nIndex] != '.')
-					aBaseUriSegments.push(aUriSegments[nIndex]);
-			}
-			if (aUriSegments[--nIndex] == '..' || aUriSegments[nIndex] == '.')
-				aBaseUriSegments.push('');
-			//
-			oUri.path	= aBaseUriSegments.join('/');
-		}
-	}
-
-	return oUri;
-});
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	9.1 Additional Boolean Constructor Functions
-		true
-		false
-
-	9.3 Functions on Boolean Values
-		not
-*/
-
-// 9.1 Additional Boolean Constructor Functions
-// fn:true() as xs:boolean
-fStaticContext_defineSystemFunction("true",	[],	function() {
-	return new cXSBoolean(true);
-});
-
-// fn:false() as xs:boolean
-fStaticContext_defineSystemFunction("false",	[],	function() {
-	return new cXSBoolean(false);
-});
-
-// 9.3 Functions on Boolean Values
-// fn:not($arg as item()*) as xs:boolean
-fStaticContext_defineSystemFunction("not",	[[cXTItem, '*']],	function(oSequence1) {
-	return new cXSBoolean(!fFunction_sequence_toEBV(oSequence1, this));
-});
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	16 Context Functions
-		position
-		last
-		current-dateTime
-		current-date
-		current-time
-		implicit-timezone
-		default-collation
-		static-base-uri
-
-*/
-// fn:position() as xs:integer
-fStaticContext_defineSystemFunction("position",	[],	function() {
-	return new cXSInteger(this.position);
-});
-
-// fn:last() as xs:integer
-fStaticContext_defineSystemFunction("last",	[],	function() {
-	return new cXSInteger(this.size);
-});
-
-// fn:current-dateTime() as xs:dateTime (2004-05-12T18:17:15.125Z)
-fStaticContext_defineSystemFunction("current-dateTime",	[],	 function() {
-	return this.dateTime;
-});
-
-// fn:current-date() as xs:date (2004-05-12+01:00)
-fStaticContext_defineSystemFunction("current-date",	[],	function() {
-	return cXSDate.cast(this.dateTime);
-});
-
-// fn:current-time() as xs:time (23:17:00.000-05:00)
-fStaticContext_defineSystemFunction("current-time",	[],	function() {
-	return cXSTime.cast(this.dateTime);
-});
-
-// fn:implicit-timezone() as xs:dayTimeDuration
-fStaticContext_defineSystemFunction("implicit-timezone",	[],	function() {
-	return this.timezone;
-});
-
-// fn:default-collation() as xs:string
-fStaticContext_defineSystemFunction("default-collation",	[],	 function() {
-	return new cXSString(this.staticContext.defaultCollationName);
-});
-
-// fn:static-base-uri() as xs:anyURI?
-fStaticContext_defineSystemFunction("static-base-uri",	[],	function() {
-	return cXSAnyURI.cast(new cXSString(this.staticContext.baseURI || ''));
-});
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	10.5 Component Extraction Functions on Durations, Dates and Times
-		years-from-duration
-		months-from-duration
-		days-from-duration
-		hours-from-duration
-		minutes-from-duration
-		seconds-from-duration
-		year-from-dateTime
-		month-from-dateTime
-		day-from-dateTime
-		hours-from-dateTime
-		minutes-from-dateTime
-		seconds-from-dateTime
-		timezone-from-dateTime
-		year-from-date
-		month-from-date
-		day-from-date
-		timezone-from-date
-		hours-from-time
-		minutes-from-time
-		seconds-from-time
-		timezone-from-time
-
-	10.7 Timezone Adjustment Functions on Dates and Time Values
-		adjust-dateTime-to-timezone
-		adjust-date-to-timezone
-		adjust-time-to-timezone
-*/
-
-// 10.5 Component Extraction Functions on Durations, Dates and Times
-// functions on duration
-// fn:years-from-duration($arg as xs:duration?) as xs:integer?
-fStaticContext_defineSystemFunction("years-from-duration",	[[cXSDuration, '?']],	function(oDuration) {
-	return fFunction_duration_getComponent(oDuration, "year");
-});
-
-// fn:months-from-duration($arg as xs:duration?) as xs:integer?
-fStaticContext_defineSystemFunction("months-from-duration",	[[cXSDuration, '?']],	function(oDuration) {
-	return fFunction_duration_getComponent(oDuration, "month");
-});
-
-// fn:days-from-duration($arg as xs:duration?) as xs:integer?
-fStaticContext_defineSystemFunction("days-from-duration",	[[cXSDuration, '?']],	function(oDuration) {
-	return fFunction_duration_getComponent(oDuration, "day");
-});
-
-// fn:hours-from-duration($arg as xs:duration?) as xs:integer?
-fStaticContext_defineSystemFunction("hours-from-duration",	[[cXSDuration, '?']],	function(oDuration) {
-	return fFunction_duration_getComponent(oDuration, "hours");
-});
-
-// fn:minutes-from-duration($arg as xs:duration?) as xs:integer?
-fStaticContext_defineSystemFunction("minutes-from-duration",	[[cXSDuration, '?']],	function(oDuration) {
-	return fFunction_duration_getComponent(oDuration, "minutes");
-});
-
-// fn:seconds-from-duration($arg as xs:duration?) as xs:decimal?
-fStaticContext_defineSystemFunction("seconds-from-duration",	[[cXSDuration, '?']],	function(oDuration) {
-	return fFunction_duration_getComponent(oDuration, "seconds");
-});
-
-// functions on dateTime
-// fn:year-from-dateTime($arg as xs:dateTime?) as xs:integer?
-fStaticContext_defineSystemFunction("year-from-dateTime",		[[cXSDateTime, '?']],	function(oDateTime) {
-	return fFunction_dateTime_getComponent(oDateTime,	"year");
-});
-
-// fn:month-from-dateTime($arg as xs:dateTime?) as xs:integer?
-fStaticContext_defineSystemFunction("month-from-dateTime",		[[cXSDateTime, '?']],	function(oDateTime) {
-	return fFunction_dateTime_getComponent(oDateTime, "month");
-});
-
-// fn:day-from-dateTime($arg as xs:dateTime?) as xs:integer?
-fStaticContext_defineSystemFunction("day-from-dateTime",			[[cXSDateTime, '?']],	function(oDateTime) {
-	return fFunction_dateTime_getComponent(oDateTime, "day");
-});
-
-// fn:hours-from-dateTime($arg as xs:dateTime?) as xs:integer?
-fStaticContext_defineSystemFunction("hours-from-dateTime",		[[cXSDateTime, '?']],	function(oDateTime) {
-	return fFunction_dateTime_getComponent(oDateTime, "hours");
-});
-
-// fn:minutes-from-dateTime($arg as xs:dateTime?) as xs:integer?
-fStaticContext_defineSystemFunction("minutes-from-dateTime",		[[cXSDateTime, '?']],	function(oDateTime) {
-	return fFunction_dateTime_getComponent(oDateTime, "minutes");
-});
-
-// fn:seconds-from-dateTime($arg as xs:dateTime?) as xs:decimal?
-fStaticContext_defineSystemFunction("seconds-from-dateTime",		[[cXSDateTime, '?']],	function(oDateTime) {
-	return fFunction_dateTime_getComponent(oDateTime, "seconds");
-});
-
-// fn:timezone-from-dateTime($arg as xs:dateTime?) as xs:dayTimeDuration?
-fStaticContext_defineSystemFunction("timezone-from-dateTime",	[[cXSDateTime, '?']],	function(oDateTime) {
-	return fFunction_dateTime_getComponent(oDateTime, "timezone");
-});
-
-// functions on date
-// fn:year-from-date($arg as xs:date?) as xs:integer?
-fStaticContext_defineSystemFunction("year-from-date",	[[cXSDate, '?']],	function(oDate) {
-	return fFunction_dateTime_getComponent(oDate, "year");
-});
-
-// fn:month-from-date($arg as xs:date?) as xs:integer?
-fStaticContext_defineSystemFunction("month-from-date",	[[cXSDate, '?']],	function(oDate) {
-	return fFunction_dateTime_getComponent(oDate, "month");
-});
-
-// fn:day-from-date($arg as xs:date?) as xs:integer?
-fStaticContext_defineSystemFunction("day-from-date",		[[cXSDate, '?']],	function(oDate) {
-	return fFunction_dateTime_getComponent(oDate, "day");
-});
-
-// fn:timezone-from-date($arg as xs:date?) as xs:dayTimeDuration?
-fStaticContext_defineSystemFunction("timezone-from-date",	[[cXSDate, '?']],	function(oDate) {
-	return fFunction_dateTime_getComponent(oDate, "timezone");
-});
-
-// functions on time
-// fn:hours-from-time($arg as xs:time?) as xs:integer?
-fStaticContext_defineSystemFunction("hours-from-time",		[[cXSTime, '?']],	function(oTime) {
-	return fFunction_dateTime_getComponent(oTime, "hours");
-});
-
-// fn:minutes-from-time($arg as xs:time?) as xs:integer?
-fStaticContext_defineSystemFunction("minutes-from-time",		[[cXSTime, '?']],	function(oTime) {
-	return fFunction_dateTime_getComponent(oTime, "minutes");
-});
-
-// fn:seconds-from-time($arg as xs:time?) as xs:decimal?
-fStaticContext_defineSystemFunction("seconds-from-time",		[[cXSTime, '?']],	function(oTime) {
-	return fFunction_dateTime_getComponent(oTime, "seconds");
-});
-
-// fn:timezone-from-time($arg as xs:time?) as xs:dayTimeDuration?
-fStaticContext_defineSystemFunction("timezone-from-time",	[[cXSTime, '?']],	function(oTime) {
-	return fFunction_dateTime_getComponent(oTime, "timezone");
-});
-
-
-// 10.7 Timezone Adjustment Functions on Dates and Time Values
-// fn:adjust-dateTime-to-timezone($arg as xs:dateTime?) as xs:dateTime?
-// fn:adjust-dateTime-to-timezone($arg as xs:dateTime?, $timezone as xs:dayTimeDuration?) as xs:dateTime?
-fStaticContext_defineSystemFunction("adjust-dateTime-to-timezone",	[[cXSDateTime, '?'], [cXSDayTimeDuration, '?', true]],	function(oDateTime, oDayTimeDuration) {
-	return fFunction_dateTime_adjustTimezone(oDateTime, arguments.length > 1 && oDayTimeDuration != null ? arguments.length > 1 ? oDayTimeDuration : this.timezone : null);
-});
-
-// fn:adjust-date-to-timezone($arg as xs:date?) as xs:date?
-// fn:adjust-date-to-timezone($arg as xs:date?, $timezone as xs:dayTimeDuration?) as xs:date?
-fStaticContext_defineSystemFunction("adjust-date-to-timezone",		[[cXSDate, '?'], [cXSDayTimeDuration, '?', true]],	function(oDate, oDayTimeDuration) {
-	return fFunction_dateTime_adjustTimezone(oDate, arguments.length > 1 && oDayTimeDuration != null ? arguments.length > 1 ? oDayTimeDuration : this.timezone : null);
-});
-
-// fn:adjust-time-to-timezone($arg as xs:time?) as xs:time?
-// fn:adjust-time-to-timezone($arg as xs:time?, $timezone as xs:dayTimeDuration?) as xs:time?
-fStaticContext_defineSystemFunction("adjust-time-to-timezone",		[[cXSTime, '?'], [cXSDayTimeDuration, '?', true]],	function(oTime, oDayTimeDuration) {
-	return fFunction_dateTime_adjustTimezone(oTime, arguments.length > 1 && oDayTimeDuration != null ? arguments.length > 1 ? oDayTimeDuration : this.timezone : null);
-});
-
-//
-function fFunction_duration_getComponent(oDuration, sName) {
-	if (oDuration == null)
-		return null;
-
-	var nValue	= oDuration[sName] * (oDuration.negative ?-1 : 1);
-	return sName == "seconds" ? new cXSDecimal(nValue) : new cXSInteger(nValue);
-};
-
-//
-function fFunction_dateTime_getComponent(oDateTime, sName) {
-	if (oDateTime == null)
-		return null;
-
-	if (sName == "timezone") {
-		var nTimezone	= oDateTime.timezone;
-		if (nTimezone == null)
-			return null;
-		return new cXSDayTimeDuration(0, cMath.abs(~~(nTimezone / 60)), cMath.abs(nTimezone % 60), 0, nTimezone < 0);
-	}
-	else {
-		var nValue	= oDateTime[sName];
-		if (!(oDateTime instanceof cXSDate)) {
-			if (sName == "hours")
-				if (nValue == 24)
-					nValue	= 0;
-		}
-		if (!(oDateTime instanceof cXSTime))
-			nValue	*= oDateTime.negative ?-1 : 1;
-		return sName == "seconds" ? new cXSDecimal(nValue) : new cXSInteger(nValue);
-	}
-};
-
-//
-function fFunction_dateTime_adjustTimezone(oDateTime, oTimezone) {
-	if (oDateTime == null)
-		return null;
-
-	// Create a copy
-	var oValue;
-	if (oDateTime instanceof cXSDate)
-		oValue	= new cXSDate(oDateTime.year, oDateTime.month, oDateTime.day, oDateTime.timezone, oDateTime.negative);
-	else
-	if (oDateTime instanceof cXSTime)
-		oValue	= new cXSTime(oDateTime.hours, oDateTime.minutes, oDateTime.seconds, oDateTime.timezone, oDateTime.negative);
-	else
-		oValue	= new cXSDateTime(oDateTime.year, oDateTime.month, oDateTime.day, oDateTime.hours, oDateTime.minutes, oDateTime.seconds, oDateTime.timezone, oDateTime.negative);
-
-	//
-	if (oTimezone == null)
-		oValue.timezone	= null;
-	else {
-		var nTimezone	= fOperator_dayTimeDuration_toSeconds(oTimezone) / 60;
-		if (oDateTime.timezone != null) {
-			var nDiff	= nTimezone - oDateTime.timezone;
-			if (oDateTime instanceof cXSDate) {
-				if (nDiff < 0)
-					oValue.day--;
-			}
-			else {
-				oValue.minutes	+= nDiff % 60;
-				oValue.hours	+= ~~(nDiff / 60);
-			}
-			//
-			fXSDateTime_normalize(oValue);
-		}
-		oValue.timezone	= nTimezone;
-	}
-	return oValue;
-};
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	14 Functions and Operators on Nodes
-		name
-		local-name
-		namespace-uri
-		number
-		lang
-		root
-
-*/
-
-// 14 Functions on Nodes
-// fn:name() as xs:string
-// fn:name($arg as node()?) as xs:string
-fStaticContext_defineSystemFunction("name",	[[cXTNode, '?', true]],	function(oNode) {
-	if (!arguments.length) {
-		if (!this.DOMAdapter.isNode(this.item))
-			throw new cException("XPTY0004"
-
-			);
-		oNode	= this.item;
-	}
-	else
-	if (oNode == null)
-		return new cXSString('');
-	//
-	var vValue	= hStaticContext_functions["node-name"].call(this, oNode);
-	return new cXSString(vValue == null ? '' : vValue.toString());
-});
-
-// fn:local-name() as xs:string
-// fn:local-name($arg as node()?) as xs:string
-fStaticContext_defineSystemFunction("local-name",	[[cXTNode, '?', true]],	function(oNode) {
-	if (!arguments.length) {
-		if (!this.DOMAdapter.isNode(this.item))
-			throw new cException("XPTY0004"
-
-			);
-		oNode	= this.item;
-	}
-	else
-	if (oNode == null)
-		return new cXSString('');
-	//
-	return new cXSString(this.DOMAdapter.getProperty(oNode, "localName") || '');
-});
-
-// fn:namespace-uri() as xs:anyURI
-// fn:namespace-uri($arg as node()?) as xs:anyURI
-fStaticContext_defineSystemFunction("namespace-uri",	[[cXTNode, '?', true]],	function(oNode) {
-	if (!arguments.length) {
-		if (!this.DOMAdapter.isNode(this.item))
-			throw new cException("XPTY0004"
-
-			);
-		oNode	= this.item;
-	}
-	else
-	if (oNode == null)
-		return cXSAnyURI.cast(new cXSString(''));
-	//
-	return cXSAnyURI.cast(new cXSString(this.DOMAdapter.getProperty(oNode, "namespaceURI") || ''));
-});
-
-// fn:number() as xs:double
-// fn:number($arg as xs:anyAtomicType?) as xs:double
-fStaticContext_defineSystemFunction("number",	[[cXSAnyAtomicType, '?', true]],	function(/*[*/oItem/*]*/) {
-	if (!arguments.length) {
-		if (!this.item)
-			throw new cException("XPDY0002");
-		oItem	= fFunction_sequence_atomize([this.item], this)[0];
-	}
-
-	// If input item cannot be cast to xs:decimal, a NaN should be returned
-	var vValue	= new cXSDouble(nNaN);
-	if (oItem != null) {
-		try {
-			vValue	= cXSDouble.cast(oItem);
-		}
-		catch (e) {
-
-		}
-	}
-	return vValue;
-});
-
-// fn:lang($testlang as xs:string?) as xs:boolean
-// fn:lang($testlang as xs:string?, $node as node()) as xs:boolean
-fStaticContext_defineSystemFunction("lang",	[[cXSString, '?'], [cXTNode, '', true]],	function(sLang, oNode) {
-	if (arguments.length < 2) {
-		if (!this.DOMAdapter.isNode(this.item))
-			throw new cException("XPTY0004"
-
-			);
-		oNode	= this.item;
-	}
-
-	var fGetProperty	= this.DOMAdapter.getProperty;
-	if (fGetProperty(oNode, "nodeType") == 2)
-		oNode	= fGetProperty(oNode, "ownerElement");
-
-	// walk up the tree looking for xml:lang attribute
-	for (var aAttributes; oNode; oNode = fGetProperty(oNode, "parentNode"))
-		if (aAttributes = fGetProperty(oNode, "attributes"))
-			for (var nIndex = 0, nLength = aAttributes.length; nIndex < nLength; nIndex++)
-				if (fGetProperty(aAttributes[nIndex], "nodeName") == "xml:lang")
-					return new cXSBoolean(fGetProperty(aAttributes[nIndex], "value").replace(/-.+/, '').toLowerCase() == sLang.valueOf().replace(/-.+/, '').toLowerCase());
-	//
-	return new cXSBoolean(false);
-});
-
-// fn:root() as node()
-// fn:root($arg as node()?) as node()?
-fStaticContext_defineSystemFunction("root",	[[cXTNode, '?', true]],	function(oNode) {
-	if (!arguments.length) {
-		if (!this.DOMAdapter.isNode(this.item))
-			throw new cException("XPTY0004"
-
-			);
-		oNode	= this.item;
-	}
-	else
-	if (oNode == null)
-		return null;
-
-	var fGetProperty	= this.DOMAdapter.getProperty;
-
-	// If context node is Attribute
-	if (fGetProperty(oNode, "nodeType") == 2)
-		oNode	= fGetProperty(oNode, "ownerElement");
-
-	for (var oParent = oNode; oParent; oParent = fGetProperty(oNode, "parentNode"))
-		oNode	= oParent;
-
-	return oNode;
-});
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	6.4 Functions on Numeric Values
-		abs
-		ceiling
-		floor
-		round
-		round-half-to-even
-*/
-
-// 6.4 Functions on Numeric Values
-// fn:abs($arg as numeric?) as numeric?
-fStaticContext_defineSystemFunction("abs",		[[cXSDouble, '?']],	function(oValue) {
-	return new cXSDecimal(cMath.abs(oValue));
-});
-
-// fn:ceiling($arg as numeric?) as numeric?
-fStaticContext_defineSystemFunction("ceiling",	[[cXSDouble, '?']],	function(oValue) {
-	return new cXSDecimal(cMath.ceil(oValue));
-});
-
-// fn:floor($arg as numeric?) as numeric?
-fStaticContext_defineSystemFunction("floor",		[[cXSDouble, '?']],	function(oValue) {
-	return new cXSDecimal(cMath.floor(oValue));
-});
-
-// fn:round($arg as numeric?) as numeric?
-fStaticContext_defineSystemFunction("round",		[[cXSDouble, '?']],	function(oValue) {
-	return new cXSDecimal(cMath.round(oValue));
-});
-
-// fn:round-half-to-even($arg as numeric?) as numeric?
-// fn:round-half-to-even($arg as numeric?, $precision as xs:integer) as numeric?
-fStaticContext_defineSystemFunction("round-half-to-even",	[[cXSDouble, '?'], [cXSInteger, '', true]],	function(oValue, oPrecision) {
-	var nPrecision	= arguments.length > 1 ? oPrecision.valueOf() : 0;
-
-	//
-	if (nPrecision < 0) {
-		var oPower	= new cXSInteger(cMath.pow(10,-nPrecision)),
-			nRounded= cMath.round(hStaticContext_operators["numeric-divide"].call(this, oValue, oPower)),
-			oRounded= new cXSInteger(nRounded);
-			nDecimal= cMath.abs(hStaticContext_operators["numeric-subtract"].call(this, oRounded, hStaticContext_operators["numeric-divide"].call(this, oValue, oPower)));
-		return hStaticContext_operators["numeric-multiply"].call(this, hStaticContext_operators["numeric-add"].call(this, oRounded, new cXSDecimal(nDecimal == 0.5 && nRounded % 2 ?-1 : 0)), oPower);
-	}
-	else {
-		var oPower	= new cXSInteger(cMath.pow(10, nPrecision)),
-			nRounded= cMath.round(hStaticContext_operators["numeric-multiply"].call(this, oValue, oPower)),
-			oRounded= new cXSInteger(nRounded);
-			nDecimal= cMath.abs(hStaticContext_operators["numeric-subtract"].call(this, oRounded, hStaticContext_operators["numeric-multiply"].call(this, oValue, oPower)));
-		return hStaticContext_operators["numeric-divide"].call(this, hStaticContext_operators["numeric-add"].call(this, oRounded, new cXSDecimal(nDecimal == 0.5 && nRounded % 2 ?-1 : 0)), oPower);
-	}
-});
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	11.1 Additional Constructor Functions for QNames
-		resolve-QName
-		QName
-
-	11.2 Functions and Operators Related to QNames
-		prefix-from-QName
-		local-name-from-QName
-		namespace-uri-from-QName
-		namespace-uri-for-prefix
-		in-scope-prefixes
-
-*/
-
-// 11.1 Additional Constructor Functions for QNames
-// fn:resolve-QName($qname as xs:string?, $element as element()) as xs:QName?
-fStaticContext_defineSystemFunction("resolve-QName",	[[cXSString, '?'], [cXTElement]],	function(oQName, oElement) {
-	if (oQName == null)
-		return null;
-
-	var sQName	= oQName.valueOf(),
-		aMatch	= sQName.match(rXSQName);
-	if (!aMatch)
-		throw new cException("FOCA0002"
-
-		);
-
-	var sPrefix	= aMatch[1] || null,
-		sLocalName	= aMatch[2],
-		sNameSpaceURI = this.DOMAdapter.lookupNamespaceURI(oElement, sPrefix);
-	//
-	if (sPrefix != null &&!sNameSpaceURI)
-		throw new cException("FONS0004"
-
-		);
-
-	return new cXSQName(sPrefix, sLocalName, sNameSpaceURI || null);
-});
-
-// fn:QName($paramURI as xs:string?, $paramQName as xs:string) as xs:QName
-fStaticContext_defineSystemFunction("QName",		[[cXSString, '?'], [cXSString]],	function(oUri, oQName) {
-	var sQName	= oQName.valueOf(),
-		aMatch	= sQName.match(rXSQName);
-
-	if (!aMatch)
-		throw new cException("FOCA0002"
-
-		);
-
-	return new cXSQName(aMatch[1] || null, aMatch[2] || null, oUri == null ? '' : oUri.valueOf());
-});
-
-// 11.2 Functions Related to QNames
-// fn:prefix-from-QName($arg as xs:QName?) as xs:NCName?
-fStaticContext_defineSystemFunction("prefix-from-QName",			[[cXSQName, '?']],	function(oQName) {
-	if (oQName != null) {
-		if (oQName.prefix)
-			return new cXSNCName(oQName.prefix);
-	}
-	//
-	return null;
-});
-
-// fn:local-name-from-QName($arg as xs:QName?) as xs:NCName?
-fStaticContext_defineSystemFunction("local-name-from-QName",		[[cXSQName, '?']],	function(oQName) {
-	if (oQName == null)
-		return null;
-
-	return new cXSNCName(oQName.localName);
-});
-
-// fn:namespace-uri-from-QName($arg as xs:QName?) as xs:anyURI?
-fStaticContext_defineSystemFunction("namespace-uri-from-QName",	[[cXSQName, '?']],	function(oQName) {
-	if (oQName == null)
-		return null;
-
-	return cXSAnyURI.cast(new cXSString(oQName.namespaceURI || ''));
-});
-
-// fn:namespace-uri-for-prefix($prefix as xs:string?, $element as element()) as xs:anyURI?
-fStaticContext_defineSystemFunction("namespace-uri-for-prefix",	[[cXSString, '?'], [cXTElement]],	function(oPrefix, oElement) {
-	var sPrefix	= oPrefix == null ? '' : oPrefix.valueOf(),
-		sNameSpaceURI	= this.DOMAdapter.lookupNamespaceURI(oElement, sPrefix || null);
-
-	return sNameSpaceURI == null ? null : cXSAnyURI.cast(new cXSString(sNameSpaceURI));
-});
-
-// fn:in-scope-prefixes($element as element()) as xs:string*
-fStaticContext_defineSystemFunction("in-scope-prefixes",	[[cXTElement]],	function(oElement) {
-	throw "Function '" + "in-scope-prefixes" + "' not implemented";
-});
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	15.1 General Functions and Operators on Sequences
-		boolean
-		index-of
-		empty
-		exists
-		distinct-values
-		insert-before
-		remove
-		reverse
-		subsequence
-		unordered
-
-	15.2 Functions That Test the Cardinality of Sequences
-		zero-or-one
-		one-or-more
-		exactly-one
-
-	15.3 Equals, Union, Intersection and Except
-		deep-equal
-
-	15.4 Aggregate Functions
-		count
-		avg
-		max
-		min
-		sum
-
-	15.5 Functions and Operators that Generate Sequences
-		id
-		idref
-		doc
-		doc-available
-		collection
-		element-with-id
-
-*/
-
-// 15.1 General Functions and Operators on Sequences
-// fn:boolean($arg as item()*) as xs:boolean
-fStaticContext_defineSystemFunction("boolean",	[[cXTItem, '*']],	function(oSequence1) {
-	return new cXSBoolean(fFunction_sequence_toEBV(oSequence1, this));
-});
-
-// fn:index-of($seqParam as xs:anyAtomicType*, $srchParam as xs:anyAtomicType) as xs:integer*
-// fn:index-of($seqParam as xs:anyAtomicType*, $srchParam as xs:anyAtomicType, $collation as xs:string) as xs:integer*
-fStaticContext_defineSystemFunction("index-of",	[[cXSAnyAtomicType, '*'], [cXSAnyAtomicType], [cXSString, '', true]],	function(oSequence1, oSearch, oCollation) {
-	if (!oSequence1.length || oSearch == null)
-		return [];
-
-	// TODO: Implement collation
-
-	var vLeft	= oSearch;
-	// Cast to XSString if Untyped
-	if (vLeft instanceof cXSUntypedAtomic)
-		vLeft	= cXSString.cast(vLeft);
-
-	var oSequence	= [];
-	for (var nIndex = 0, nLength = oSequence1.length, vRight; nIndex < nLength; nIndex++) {
-		vRight	= oSequence1[nIndex];
-		// Cast to XSString if Untyped
-		if (vRight instanceof cXSUntypedAtomic)
-			vRight	= cXSString.cast(vRight);
-		//
-		if (vRight.valueOf() === vLeft.valueOf())
-			oSequence.push(new cXSInteger(nIndex + 1));
-	}
-
-	return oSequence;
-});
-
-// fn:empty($arg as item()*) as xs:boolean
-fStaticContext_defineSystemFunction("empty",	[[cXTItem, '*']],	function(oSequence1) {
-	return new cXSBoolean(!oSequence1.length);
-});
-
-// fn:exists($arg as item()*) as xs:boolean
-fStaticContext_defineSystemFunction("exists",	[[cXTItem, '*']],	function(oSequence1) {
-	return new cXSBoolean(!!oSequence1.length);
-});
-
-// fn:distinct-values($arg as xs:anyAtomicType*) as xs:anyAtomicType*
-// fn:distinct-values($arg as xs:anyAtomicType*, $collation as xs:string) as xs:anyAtomicType*
-fStaticContext_defineSystemFunction("distinct-values",	[[cXSAnyAtomicType, '*'], [cXSString, '', true]],	function(oSequence1, oCollation) {
-	if (arguments.length > 1)
-		throw "Collation parameter in function '" + "distinct-values" + "' is not implemented";
-
-	if (!oSequence1.length)
-		return null;
-
-	var oSequence	= [];
-	for (var nIndex = 0, nLength = oSequence1.length, vLeft; nIndex < nLength; nIndex++) {
-		vLeft	= oSequence1[nIndex];
-		// Cast to XSString if Untyped
-		if (vLeft instanceof cXSUntypedAtomic)
-			vLeft	= cXSString.cast(vLeft);
-		for (var nRightIndex = 0, nRightLength = oSequence.length, vRight, bFound = false; (nRightIndex < nRightLength) &&!bFound; nRightIndex++) {
-			vRight	= oSequence[nRightIndex];
-			// Cast to XSString if Untyped
-			if (vRight instanceof cXSUntypedAtomic)
-				vRight	= cXSString.cast(vRight);
-			//
-			if (vRight.valueOf() === vLeft.valueOf())
-				bFound	= true;
-		}
-		if (!bFound)
-			oSequence.push(oSequence1[nIndex]);
-	}
-
-	return oSequence;
-});
-
-// fn:insert-before($target as item()*, $position as xs:integer, $inserts as item()*) as item()*
-fStaticContext_defineSystemFunction("insert-before",	[[cXTItem, '*'], [cXSInteger], [cXTItem, '*']],	function(oSequence1, oPosition, oSequence3) {
-	if (!oSequence1.length)
-		return oSequence3;
-	if (!oSequence3.length)
-		return oSequence1;
-
-	var nLength 	= oSequence1.length,
-		nPosition	= oPosition.valueOf();
-	if (nPosition < 1)
-		nPosition	= 1;
-	else
-	if (nPosition > nLength)
-		nPosition	= nLength + 1;
-
-	var oSequence	=  [];
-	for (var nIndex = 0; nIndex < nLength; nIndex++) {
-		if (nPosition == nIndex + 1)
-			oSequence	= oSequence.concat(oSequence3);
-		oSequence.push(oSequence1[nIndex]);
-	}
-	if (nPosition == nIndex + 1)
-		oSequence	= oSequence.concat(oSequence3);
-
-	return oSequence;
-});
-
-// fn:remove($target as item()*, $position as xs:integer) as item()*
-fStaticContext_defineSystemFunction("remove",	[[cXTItem, '*'], [cXSInteger]],	function(oSequence1, oPosition) {
-	if (!oSequence1.length)
-		return [];
-
-	var nLength 	= oSequence1.length,
-		nPosition	= oPosition.valueOf();
-
-	if (nPosition < 1 || nPosition > nLength)
-		return oSequence1;
-
-	var oSequence	=  [];
-	for (var nIndex = 0; nIndex < nLength; nIndex++)
-		if (nPosition != nIndex + 1)
-			oSequence.push(oSequence1[nIndex]);
-
-	return oSequence;
-});
-
-// fn:reverse($arg as item()*) as item()*
-fStaticContext_defineSystemFunction("reverse",	[[cXTItem, '*']],	function(oSequence1) {
-	oSequence1.reverse();
-
-	return oSequence1;
-});
-
-// fn:subsequence($sourceSeq as item()*, $startingLoc as xs:double) as item()*
-// fn:subsequence($sourceSeq as item()*, $startingLoc as xs:double, $length as xs:double) as item()*
-fStaticContext_defineSystemFunction("subsequence",	[[cXTItem, '*'], [cXSDouble, ''], [cXSDouble, '', true]],	function(oSequence1, oStart, oLength) {
-	var nPosition	= cMath.round(oStart),
-		nLength		= arguments.length > 2 ? cMath.round(oLength) : oSequence1.length - nPosition + 1;
-
-	// TODO: Handle out-of-range position and length values
-	return oSequence1.slice(nPosition - 1, nPosition - 1 + nLength);
-});
-
-// fn:unordered($sourceSeq as item()*) as item()*
-fStaticContext_defineSystemFunction("unordered",	[[cXTItem, '*']],	function(oSequence1) {
-	return oSequence1;
-});
-
-
-// 15.2 Functions That Test the Cardinality of Sequences
-// fn:zero-or-one($arg as item()*) as item()?
-fStaticContext_defineSystemFunction("zero-or-one",	[[cXTItem, '*']],	function(oSequence1) {
-	if (oSequence1.length > 1)
-		throw new cException("FORG0003");
-
-	return oSequence1;
-});
-
-// fn:one-or-more($arg as item()*) as item()+
-fStaticContext_defineSystemFunction("one-or-more",	[[cXTItem, '*']],	function(oSequence1) {
-	if (!oSequence1.length)
-		throw new cException("FORG0004");
-
-	return oSequence1;
-});
-
-// fn:exactly-one($arg as item()*) as item()
-fStaticContext_defineSystemFunction("exactly-one",	[[cXTItem, '*']],	function(oSequence1) {
-	if (oSequence1.length != 1)
-		throw new cException("FORG0005");
-
-	return oSequence1;
-});
-
-
-// 15.3 Equals, Union, Intersection and Except
-// fn:deep-equal($parameter1 as item()*, $parameter2 as item()*) as xs:boolean
-// fn:deep-equal($parameter1 as item()*, $parameter2 as item()*, $collation as string) as xs:boolean
-fStaticContext_defineSystemFunction("deep-equal",	[[cXTItem, '*'], [cXTItem, '*'], [cXSString, '', true]],	function(oSequence1, oSequence2, oCollation) {
-	throw "Function '" + "deep-equal" + "' not implemented";
-});
-
-
-// 15.4 Aggregate Functions
-// fn:count($arg as item()*) as xs:integer
-fStaticContext_defineSystemFunction("count",	[[cXTItem, '*']],	function(oSequence1) {
-	return new cXSInteger(oSequence1.length);
-});
-
-// fn:avg($arg as xs:anyAtomicType*) as xs:anyAtomicType?
-fStaticContext_defineSystemFunction("avg",	[[cXSAnyAtomicType, '*']],	function(oSequence1) {
-	if (!oSequence1.length)
-		return null;
-
-	//
-	try {
-		var vValue	= oSequence1[0];
-		if (vValue instanceof cXSUntypedAtomic)
-			vValue	= cXSDouble.cast(vValue);
-		for (var nIndex = 1, nLength = oSequence1.length, vRight; nIndex < nLength; nIndex++) {
-			vRight	= oSequence1[nIndex];
-			if (vRight instanceof cXSUntypedAtomic)
-				vRight	= cXSDouble.cast(vRight);
-			vValue	= hAdditiveExpr_operators['+'](vValue, vRight, this);
-		}
-		return hMultiplicativeExpr_operators['div'](vValue, new cXSInteger(nLength), this);
-	}
-	catch (e) {
-		// XPTY0004: Arithmetic operator is not defined for provided arguments
-		throw e.code != "XPTY0004" ? e : new cException("FORG0006"
-
-		);
-	}
-});
-
-// fn:max($arg as xs:anyAtomicType*) as xs:anyAtomicType?
-// fn:max($arg as xs:anyAtomicType*, $collation as string) as xs:anyAtomicType?
-fStaticContext_defineSystemFunction("max",	[[cXSAnyAtomicType, '*'], [cXSString, '', true]],	function(oSequence1, oCollation) {
-	if (!oSequence1.length)
-		return null;
-
-	// TODO: Implement collation
-
-	//
-	try {
-		var vValue	= oSequence1[0];
-		if (vValue instanceof cXSUntypedAtomic)
-			vValue	= cXSDouble.cast(vValue);
-		for (var nIndex = 1, nLength = oSequence1.length, vRight; nIndex < nLength; nIndex++) {
-			vRight	= oSequence1[nIndex];
-			if (vRight instanceof cXSUntypedAtomic)
-				vRight	= cXSDouble.cast(vRight);
-			if (hComparisonExpr_ValueComp_operators['ge'](vRight, vValue, this).valueOf())
-				vValue	= vRight;
-		}
-		return vValue;
-	}
-	catch (e) {
-		// XPTY0004: Cannot compare {type1} with {type2}
-		throw e.code != "XPTY0004" ? e : new cException("FORG0006"
-
-		);
-	}
-});
-
-// fn:min($arg as xs:anyAtomicType*) as xs:anyAtomicType?
-// fn:min($arg as xs:anyAtomicType*, $collation as string) as xs:anyAtomicType?
-fStaticContext_defineSystemFunction("min",	[[cXSAnyAtomicType, '*'], [cXSString, '', true]],	function(oSequence1, oCollation) {
-	if (!oSequence1.length)
-		return null;
-
-	// TODO: Implement collation
-
-	//
-	try {
-		var vValue	= oSequence1[0];
-		if (vValue instanceof cXSUntypedAtomic)
-			vValue	= cXSDouble.cast(vValue);
-		for (var nIndex = 1, nLength = oSequence1.length, vRight; nIndex < nLength; nIndex++) {
-			vRight	= oSequence1[nIndex];
-			if (vRight instanceof cXSUntypedAtomic)
-				vRight	= cXSDouble.cast(vRight);
-			if (hComparisonExpr_ValueComp_operators['le'](vRight, vValue, this).valueOf())
-				vValue	= vRight;
-			}
-		return vValue;
-	}
-	catch (e) {
-		// Cannot compare {type1} with {type2}
-		throw e.code != "XPTY0004" ? e : new cException("FORG0006"
-
-		);
-	}
-});
-
-// fn:sum($arg as xs:anyAtomicType*) as xs:anyAtomicType
-// fn:sum($arg as xs:anyAtomicType*, $zero as xs:anyAtomicType?) as xs:anyAtomicType?
-fStaticContext_defineSystemFunction("sum",	[[cXSAnyAtomicType, '*'], [cXSAnyAtomicType, '?', true]],	function(oSequence1, oZero) {
-	if (!oSequence1.length) {
-		if (arguments.length > 1)
-			return oZero;
-		else
-			return new cXSDouble(0);
-
-		return null;
-	}
-
-	// TODO: Implement collation
-
-	//
-	try {
-		var vValue	= oSequence1[0];
-		if (vValue instanceof cXSUntypedAtomic)
-			vValue	= cXSDouble.cast(vValue);
-		for (var nIndex = 1, nLength = oSequence1.length, vRight; nIndex < nLength; nIndex++) {
-			vRight	= oSequence1[nIndex];
-			if (vRight instanceof cXSUntypedAtomic)
-				vRight	= cXSDouble.cast(vRight);
-			vValue	= hAdditiveExpr_operators['+'](vValue, vRight, this);
-		}
-		return vValue;
-	}
-	catch (e) {
-		// XPTY0004: Arithmetic operator is not defined for provided arguments
-		throw e.code != "XPTY0004" ? e : new cException("FORG0006"
-
-		);
-	}
-});
-
-
-// 15.5 Functions and Operators that Generate Sequences
-// fn:id($arg as xs:string*) as element()*
-// fn:id($arg as xs:string*, $node as node()) as element()*
-fStaticContext_defineSystemFunction("id",	[[cXSString, '*'], [cXTNode, '', true]],	function(oSequence1, oNode) {
-	if (arguments.length < 2) {
-		if (!this.DOMAdapter.isNode(this.item))
-			throw new cException("XPTY0004"
-
-			);
-		oNode	= this.item;
-	}
-
-	// Get root node and check if it is Document
-	var oDocument	= hStaticContext_functions["root"].call(this, oNode);
-	if (this.DOMAdapter.getProperty(oDocument, "nodeType") != 9)
-		throw new cException("FODC0001");
-
-	// Search for elements
-	var oSequence	= [];
-	for (var nIndex = 0; nIndex < oSequence1.length; nIndex++)
-		for (var nRightIndex = 0, aValue = fString_trim(oSequence1[nIndex]).split(/\s+/), nRightLength = aValue.length; nRightIndex < nRightLength; nRightIndex++)
-			if ((oNode = this.DOMAdapter.getElementById(oDocument, aValue[nRightIndex])) && fArray_indexOf(oSequence, oNode) ==-1)
-				oSequence.push(oNode);
-	//
-	return fFunction_sequence_order(oSequence, this);
-});
-
-// fn:idref($arg as xs:string*) as node()*
-// fn:idref($arg as xs:string*, $node as node()) as node()*
-fStaticContext_defineSystemFunction("idref",	[[cXSString, '*'], [cXTNode, '', true]],	function(oSequence1, oNode) {
-	throw "Function '" + "idref" + "' not implemented";
-});
-
-// fn:doc($uri as xs:string?) as document-node()?
-fStaticContext_defineSystemFunction("doc",			[[cXSString, '?', true]],	function(oUri) {
-	throw "Function '" + "doc" + "' not implemented";
-});
-
-// fn:doc-available($uri as xs:string?) as xs:boolean
-fStaticContext_defineSystemFunction("doc-available",	[[cXSString, '?', true]],	function(oUri) {
-	throw "Function '" + "doc-available" + "' not implemented";
-});
-
-// fn:collection() as node()*
-// fn:collection($arg as xs:string?) as node()*
-fStaticContext_defineSystemFunction("collection",	[[cXSString, '?', true]],	function(oUri) {
-	throw "Function '" + "collection" + "' not implemented";
-});
-
-// fn:element-with-id($arg as xs:string*) as element()*
-// fn:element-with-id($arg as xs:string*, $node as node()) as element()*
-fStaticContext_defineSystemFunction("element-with-id",	[[cXSString, '*'], [cXTNode, '', true]],	function(oSequence1, oNode) {
-	throw "Function '" + "element-with-id" + "' not implemented";
-});
-
-// EBV calculation
-function fFunction_sequence_toEBV(oSequence1, oContext) {
-	if (!oSequence1.length)
-		return false;
-
-	var oItem	= oSequence1[0];
-	if (oContext.DOMAdapter.isNode(oItem))
-		return true;
-
-	if (oSequence1.length == 1) {
-		if (oItem instanceof cXSBoolean)
-			return oItem.value.valueOf();
-		if (oItem instanceof cXSString)
-			return !!oItem.valueOf().length;
-		if (fXSAnyAtomicType_isNumeric(oItem))
-			return !(fIsNaN(oItem.valueOf()) || oItem.valueOf() == 0);
-
-		throw new cException("FORG0006"
-
-		);
-	}
-
-	throw new cException("FORG0006"
-
-	);
-};
-
-function fFunction_sequence_atomize(oSequence1, oContext) {
-	var oSequence	= [];
-	for (var nIndex = 0, nLength = oSequence1.length, oItem, vItem; nIndex < nLength; nIndex++) {
-		oItem	= oSequence1[nIndex];
-		vItem	= null;
-		// Untyped
-		if (oItem == null)
-			vItem	= null;
-		// Node type
-		else
-		if (oContext.DOMAdapter.isNode(oItem)) {
-			var fGetProperty	= oContext.DOMAdapter.getProperty;
-			switch (fGetProperty(oItem, "nodeType")) {
-				case 1:	// ELEMENT_NODE
-					vItem	= new cXSUntypedAtomic(fGetProperty(oItem, "textContent"));
-					break;
-				case 2:	// ATTRIBUTE_NODE
-					vItem	= new cXSUntypedAtomic(fGetProperty(oItem, "value"));
-					break;
-				case 3:	// TEXT_NODE
-				case 4:	// CDATA_SECTION_NODE
-				case 8:	// COMMENT_NODE
-					vItem	= new cXSUntypedAtomic(fGetProperty(oItem, "data"));
-					break;
-				case 7:	// PROCESSING_INSTRUCTION_NODE
-					vItem	= new cXSUntypedAtomic(fGetProperty(oItem, "data"));
-					break;
-				case 9:	// DOCUMENT_NODE
-					var oNode	= fGetProperty(oItem, "documentElement");
-					vItem	= new cXSUntypedAtomic(oNode ? fGetProperty(oNode, "textContent") : '');
-					break;
-			}
-		}
-		// Base types
-		else
-		if (oItem instanceof cXSAnyAtomicType)
-			vItem	= oItem;
-
-		//
-		if (vItem != null)
-			oSequence.push(vItem);
-	}
-
-	return oSequence;
-};
-
-// Orders items in sequence in document order
-function fFunction_sequence_order(oSequence1, oContext) {
-	return oSequence1.sort(function(oNode, oNode2) {
-		var nPosition	= oContext.DOMAdapter.compareDocumentPosition(oNode, oNode2);
-		return nPosition & 2 ? 1 : nPosition & 4 ?-1 : 0;
-	});
-};
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	7.2 Functions to Assemble and Disassemble Strings
-		codepoints-to-string
-		string-to-codepoints
-
-	7.3 Equality and Comparison of Strings
-		compare
-		codepoint-equal
-
-	7.4 Functions on String Values
-		concat
-		string-join
-		substring
-		string-length
-		normalize-space
-		normalize-unicode
-		upper-case
-		lower-case
-		translate
-		encode-for-uri
-		iri-to-uri
-		escape-html-uri
-
-	7.5 Functions Based on Substring Matching
-		contains
-		starts-with
-		ends-with
-		substring-before
-		substring-after
-
-	7.6 String Functions that Use Pattern Matching
-		matches
-		replace
-		tokenize
-*/
-
-// 7.2 Functions to Assemble and Disassemble Strings
-// fn:codepoints-to-string($arg as xs:integer*) as xs:string
-fStaticContext_defineSystemFunction("codepoints-to-string",	[[cXSInteger, '*']],	function(oSequence1) {
-	var aValue	= [];
-	for (var nIndex = 0, nLength = oSequence1.length; nIndex < nLength; nIndex++)
-		aValue.push(cString.fromCharCode(oSequence1[nIndex]));
-
-	return new cXSString(aValue.join(''));
-});
-
-// fn:string-to-codepoints($arg as xs:string?) as xs:integer*
-fStaticContext_defineSystemFunction("string-to-codepoints",	[[cXSString, '?']],	function(oValue) {
-	if (oValue == null)
-		return null;
-
-	var sValue	= oValue.valueOf();
-	if (sValue == '')
-		return [];
-
-	var oSequence	= [];
-	for (var nIndex = 0, nLength = sValue.length; nIndex < nLength; nIndex++)
-		oSequence.push(new cXSInteger(sValue.charCodeAt(nIndex)));
-
-	return oSequence;
-});
-
-// 7.3 Equality and Comparison of Strings
-// fn:compare($comparand1 as xs:string?, $comparand2 as xs:string?) as xs:integer?
-// fn:compare($comparand1 as xs:string?, $comparand2 as xs:string?, $collation as xs:string) as xs:integer?
-fStaticContext_defineSystemFunction("compare",	[[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]],	function(oValue1, oValue2, oCollation) {
-	if (oValue1 == null || oValue2 == null)
-		return null;
-
-	var sCollation	= this.staticContext.defaultCollationName,
-		vCollation;
-	if (arguments.length > 2)
-		sCollation	= oCollation.valueOf();
-
-	vCollation	= sCollation == sNS_XPF + "/collation/codepoint" ? oCodepointStringCollator : this.staticContext.getCollation(sCollation);
-	if (!vCollation)
-		throw new cException("FOCH0002"
-
-		);
-
-	return new cXSInteger(vCollation.compare(oValue1.valueOf(), oValue2.valueOf()));
-});
-
-// fn:codepoint-equal($comparand1 as xs:string?, $comparand2  as xs:string?) as xs:boolean?
-fStaticContext_defineSystemFunction("codepoint-equal",	[[cXSString, '?'], [cXSString, '?']],	function(oValue1, oValue2) {
-	if (oValue1 == null || oValue2 == null)
-		return null;
-
-	// TODO: Check if JS uses 'Unicode code point collation' here
-
-	return new cXSBoolean(oValue1.valueOf() == oValue2.valueOf());
-});
-
-
-// 7.4 Functions on String Values
-// fn:concat($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?, ...) as xs:string
-fStaticContext_defineSystemFunction("concat",	null,	function() {
-	// check arguments length
-	if (arguments.length < 2)
-		throw new cException("XPST0017"
-
-		);
-
-	var aValue	= [];
-	for (var nIndex = 0, nLength = arguments.length, oSequence; nIndex < nLength; nIndex++) {
-		oSequence	= arguments[nIndex];
-		// Assert cardinality
-		fFunctionCall_assertSequenceCardinality(this, oSequence, '?'
-
-		);
-		//
-		if (oSequence.length)
-			aValue[aValue.length]	= cXSString.cast(fFunction_sequence_atomize(oSequence, this)[0]).valueOf();
-	}
-
-	return new cXSString(aValue.join(''));
-});
-
-// fn:string-join($arg1 as xs:string*, $arg2 as xs:string) as xs:string
-fStaticContext_defineSystemFunction("string-join",	[[cXSString, '*'], [cXSString]],	function(oSequence1, oValue) {
-	return new cXSString(oSequence1.join(oValue));
-});
-
-// fn:substring($sourceString as xs:string?, $startingLoc as xs:double) as xs:string
-// fn:substring($sourceString as xs:string?, $startingLoc as xs:double, $length as xs:double) as xs:string
-fStaticContext_defineSystemFunction("substring",	[[cXSString, '?'], [cXSDouble], [cXSDouble, '', true]],	function(oValue, oStart, oLength) {
-	var sValue	= oValue == null ? '' : oValue.valueOf(),
-		nStart	= cMath.round(oStart) - 1,
-		nEnd	= arguments.length > 2 ? nStart + cMath.round(oLength) : sValue.length;
-
-	// TODO: start can be negative
-	return new cXSString(nEnd > nStart ? sValue.substring(nStart, nEnd) : '');
-});
-
-// fn:string-length() as xs:integer
-// fn:string-length($arg as xs:string?) as xs:integer
-fStaticContext_defineSystemFunction("string-length",	[[cXSString, '?', true]],	function(oValue) {
-	if (!arguments.length) {
-		if (!this.item)
-			throw new cException("XPDY0002");
-		oValue	= cXSString.cast(fFunction_sequence_atomize([this.item], this)[0]);
-	}
-	return new cXSInteger(oValue == null ? 0 : oValue.valueOf().length);
-});
-
-// fn:normalize-space() as xs:string
-// fn:normalize-space($arg as xs:string?) as xs:string
-fStaticContext_defineSystemFunction("normalize-space",	[[cXSString, '?', true]],	function(oValue) {
-	if (!arguments.length) {
-		if (!this.item)
-			throw new cException("XPDY0002");
-		oValue	= cXSString.cast(fFunction_sequence_atomize([this.item], this)[0]);
-	}
-	return new cXSString(oValue == null ? '' : fString_trim(oValue).replace(/\s\s+/g, ' '));
-});
-
-// fn:normalize-unicode($arg as xs:string?) as xs:string
-// fn:normalize-unicode($arg as xs:string?, $normalizationForm as xs:string) as xs:string
-fStaticContext_defineSystemFunction("normalize-unicode",	[[cXSString, '?'], [cXSString, '', true]],	function(oValue, oNormalization) {
-	throw "Function '" + "normalize-unicode" + "' not implemented";
-});
-
-// fn:upper-case($arg as xs:string?) as xs:string
-fStaticContext_defineSystemFunction("upper-case",	[[cXSString, '?']],	function(oValue) {
-	return new cXSString(oValue == null ? '' : oValue.valueOf().toUpperCase());
-});
-
-// fn:lower-case($arg as xs:string?) as xs:string
-fStaticContext_defineSystemFunction("lower-case",	[[cXSString, '?']],	function(oValue) {
-	return new cXSString(oValue == null ? '' : oValue.valueOf().toLowerCase());
-});
-
-// fn:translate($arg as xs:string?, $mapString as xs:string, $transString as xs:string) as xs:string
-fStaticContext_defineSystemFunction("translate",	[[cXSString, '?'], [cXSString], [cXSString]],	function(oValue, oMap, oTranslate) {
-	if (oValue == null)
-		return new cXSString('');
-
-	var aValue	= oValue.valueOf().split(''),
-		aMap	= oMap.valueOf().split(''),
-		aTranslate	= oTranslate.valueOf().split(''),
-		nTranslateLength	= aTranslate.length,
-		aReturn	= [];
-	for (var nIndex = 0, nLength = aValue.length, nPosition; nIndex < nLength; nIndex++)
-		if ((nPosition = aMap.indexOf(aValue[nIndex])) ==-1)
-			aReturn[aReturn.length]	= aValue[nIndex];
-		else
-		if (nPosition < nTranslateLength)
-			aReturn[aReturn.length]	= aTranslate[nPosition];
-
-	return new cXSString(aReturn.join(''));
-});
-
-// fn:encode-for-uri($uri-part as xs:string?) as xs:string
-fStaticContext_defineSystemFunction("encode-for-uri",	[[cXSString, '?']],	function(oValue) {
-	return new cXSString(oValue == null ? '' : window.encodeURIComponent(oValue));
-});
-
-// fn:iri-to-uri($iri as xs:string?) as xs:string
-fStaticContext_defineSystemFunction("iri-to-uri",		[[cXSString, '?']],	function(oValue) {
-	return new cXSString(oValue == null ? '' : window.encodeURI(window.decodeURI(oValue)));
-});
-
-// fn:escape-html-uri($uri as xs:string?) as xs:string
-fStaticContext_defineSystemFunction("escape-html-uri",	[[cXSString, '?']],	function(oValue) {
-	if (oValue == null || oValue.valueOf() == '')
-		return new cXSString('');
-	// Encode
-	var aValue	= oValue.valueOf().split('');
-	for (var nIndex = 0, nLength = aValue.length, nCode; nIndex < nLength; nIndex++)
-		if ((nCode = aValue[nIndex].charCodeAt(0)) < 32 || nCode > 126)
-			aValue[nIndex]	= window.encodeURIComponent(aValue[nIndex]);
-	return new cXSString(aValue.join(''));
-});
-
-
-// 7.5 Functions Based on Substring Matching
-// fn:contains($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean
-// fn:contains($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean
-fStaticContext_defineSystemFunction("contains",	[[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]],	function(oValue, oSearch, oCollation) {
-	if (arguments.length > 2)
-		throw "Collation parameter in function '" + "contains" + "' is not implemented";
-	return new cXSBoolean((oValue == null ? '' : oValue.valueOf()).indexOf(oSearch == null ? '' : oSearch.valueOf()) >= 0);
-});
-
-// fn:starts-with($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean
-// fn:starts-with($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean
-fStaticContext_defineSystemFunction("starts-with",	[[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]],	function(oValue, oSearch, oCollation) {
-	if (arguments.length > 2)
-		throw "Collation parameter in function '" + "starts-with" + "' is not implemented";
-	return new cXSBoolean((oValue == null ? '' : oValue.valueOf()).indexOf(oSearch == null ? '' : oSearch.valueOf()) == 0);
-});
-
-// fn:ends-with($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean
-// fn:ends-with($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean
-fStaticContext_defineSystemFunction("ends-with",	[[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]],	function(oValue, oSearch, oCollation) {
-	if (arguments.length > 2)
-		throw "Collation parameter in function '" + "ends-with" + "' is not implemented";
-	var sValue	= oValue == null ? '' : oValue.valueOf(),
-		sSearch	= oSearch == null ? '' : oSearch.valueOf();
-
-	return new cXSBoolean(sValue.indexOf(sSearch) == sValue.length - sSearch.length);
-});
-
-// fn:substring-before($arg1 as xs:string?, $arg2 as xs:string?) as xs:string
-// fn:substring-before($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:string
-fStaticContext_defineSystemFunction("substring-before",	[[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]],	function(oValue, oSearch, oCollation) {
-	if (arguments.length > 2)
-		throw "Collation parameter in function '" + "substring-before" + "' is not implemented";
-
-	var sValue	= oValue == null ? '' : oValue.valueOf(),
-		sSearch	= oSearch == null ? '' : oSearch.valueOf(),
-		nPosition;
-
-	return new cXSString((nPosition = sValue.indexOf(sSearch)) >= 0 ? sValue.substring(0, nPosition) : '');
-});
-
-// fn:substring-after($arg1 as xs:string?, $arg2 as xs:string?) as xs:string
-// fn:substring-after($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:string
-fStaticContext_defineSystemFunction("substring-after",	[[cXSString, '?'], [cXSString, '?'], [cXSString, '', true]],	function(oValue, oSearch, oCollation) {
-	if (arguments.length > 2)
-		throw "Collation parameter in function '" + "substring-after" + "' is not implemented";
-
-	var sValue	= oValue == null ? '' : oValue.valueOf(),
-		sSearch	= oSearch == null ? '' : oSearch.valueOf(),
-		nPosition;
-
-	return new cXSString((nPosition = sValue.indexOf(sSearch)) >= 0 ? sValue.substring(nPosition + sSearch.length) : '');
-});
-
-
-// 7.6 String Functions that Use Pattern Matching
-function fFunction_string_createRegExp(sValue, sFlags) {
-	var d1	= '\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF',
-		d2	= '\u0370-\u037D\u037F-\u1FFF\u200C-\u200D',
-		d3	= '\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD',
-		c	= 'A-Z_a-z\\-.0-9\u00B7' + d1 + '\u0300-\u036F' + d2 + '\u203F-\u2040' + d3,
-		i	= 'A-Z_a-z' + d1 + d2 + d3;
-
-	sValue	= sValue
-				.replace(/\[\\i-\[:\]\]/g, '[' + i + ']')
-				.replace(/\[\\c-\[:\]\]/g, '[' + c + ']')
-				.replace(/\\i/g, '[:' + i + ']')
-				.replace(/\\I/g, '[^:' + i + ']')
-				.replace(/\\c/g, '[:' + c + ']')
-				.replace(/\\C/g, '[^:' + c + ']');
-
-	// Check if all flags are legal
-	if (sFlags && !sFlags.match(/^[smix]+$/))
-		throw new cException("FORX0001");	// Invalid character '{%0}' in regular expression flags
-
-	var bFlagS	= sFlags.indexOf('s') >= 0,
-		bFlagX	= sFlags.indexOf('x') >= 0;
-	if (bFlagS || bFlagX) {
-		// Strip 's' and 'x' from flags
-		sFlags	= sFlags.replace(/[sx]/g, '');
-		var aValue	= [],
-			rValue	= /\s/;
-		for (var nIndex = 0, nLength = sValue.length, bValue = false, sCharCurr, sCharPrev = ''; nIndex < nLength; nIndex++) {
-			sCharCurr	= sValue.charAt(nIndex);
-			if (sCharPrev != '\\') {
-				if (sCharCurr == '[')
-					bValue	= true;
-				else
-				if (sCharCurr == ']')
-					bValue	= false;
-			}
-			// Replace '\s' for flag 'x' if not in []
-			if (bValue || !(bFlagX && rValue.test(sCharCurr))) {
-				// Replace '.' for flag 's' if not in []
-				if (!bValue && (bFlagS && sCharCurr == '.' && sCharPrev != '\\'))
-					aValue[aValue.length]	= '(?:.|\\s)';
-				else
-					aValue[aValue.length]	= sCharCurr;
-			}
-			sCharPrev	= sCharCurr;
-		}
-		sValue	= aValue.join('');
-	}
-
-	return new cRegExp(sValue, sFlags + 'g');
-};
-
-// fn:matches($input as xs:string?, $pattern as xs:string) as xs:boolean
-// fn:matches($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:boolean
-fStaticContext_defineSystemFunction("matches",	[[cXSString, '?'], [cXSString], [cXSString, '', true]],	function(oValue, oPattern, oFlags) {
-	var sValue	= oValue == null ? '' : oValue.valueOf(),
-		rRegExp	= fFunction_string_createRegExp(oPattern.valueOf(), arguments.length > 2 ? oFlags.valueOf() : '');
-
-	return new cXSBoolean(rRegExp.test(sValue));
-});
-
-// fn:replace($input as xs:string?, $pattern as xs:string, $replacement as xs:string) as xs:string
-// fn:replace($input as xs:string?, $pattern as xs:string, $replacement as xs:string, $flags as xs:string) as xs:string
-fStaticContext_defineSystemFunction("replace",	[[cXSString, '?'], [cXSString],  [cXSString], [cXSString, '', true]],	function(oValue, oPattern, oReplacement, oFlags) {
-	var sValue	= oValue == null ? '' : oValue.valueOf(),
-		rRegExp	= fFunction_string_createRegExp(oPattern.valueOf(), arguments.length > 3 ? oFlags.valueOf() : '');
-
-	return new cXSBoolean(sValue.replace(rRegExp, oReplacement.valueOf()));
-});
-
-// fn:tokenize($input as xs:string?, $pattern as xs:string) as xs:string*
-// fn:tokenize($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:string*
-fStaticContext_defineSystemFunction("tokenize",	[[cXSString, '?'], [cXSString], [cXSString, '', true]],	function(oValue, oPattern, oFlags) {
-	var sValue	= oValue == null ? '' : oValue.valueOf(),
-		rRegExp	= fFunction_string_createRegExp(oPattern.valueOf(), arguments.length > 2 ? oFlags.valueOf() : '');
-
-	var oSequence	= [];
-	for (var nIndex = 0, aValue = sValue.split(rRegExp), nLength = aValue.length; nIndex < nLength; nIndex++)
-		oSequence.push(new cXSString(aValue[nIndex]));
-
-	return oSequence;
-});
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-/*
-	4 The Trace Function
-		trace
-*/
-
-// fn:trace($value as item()*, $label as xs:string) as item()*
-fStaticContext_defineSystemFunction("trace",		[[cXTItem, '*'], [cXSString]],	function(oSequence1, oLabel) {
-	var oConsole	= window.console;
-	if (oConsole && oConsole.log)
-		oConsole.log(oLabel.valueOf(), oSequence1);
-	return oSequence1;
-});
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-var oCodepointStringCollator	= new cStringCollator;
-
-oCodepointStringCollator.equals	= function(sValue1, sValue2) {
-	return sValue1 == sValue2;
-};
-
-oCodepointStringCollator.compare	= function(sValue1, sValue2) {
-	return sValue1 == sValue2 ? 0 : sValue1 > sValue2 ? 1 :-1;
-};
-function cLXDOMAdapter() {
-
-};
-
-cLXDOMAdapter.prototype	= new cDOMAdapter;
-
-var oLXDOMAdapter_staticContext	= new cStaticContext;
-
-cLXDOMAdapter.prototype.getProperty	= function(oNode, sName) {
-		if (sName in oNode)
-		return oNode[sName];
-
-		if (sName == "baseURI") {
-		var sBaseURI	= '',
-			fResolveUri	= oLXDOMAdapter_staticContext.getFunction('{' + "http://www.w3.org/2005/xpath-functions" + '}' + "resolve-uri"),
-			cXSString	= oLXDOMAdapter_staticContext.getDataType('{' + "http://www.w3.org/2001/XMLSchema" + '}' + "string");
-
-		for (var oParent = oNode, sUri; oParent; oParent = oParent.parentNode)
-			if (oParent.nodeType == 1  && (sUri = oParent.getAttribute("xml:base")))
-				sBaseURI	= fResolveUri(new cXSString(sUri), new cXSString(sBaseURI)).toString();
-				return sBaseURI;
-	}
-	else
-	if (sName == "textContent") {
-		var aText = [];
-		(function(oNode) {
-			for (var nIndex = 0, oChild; oChild = oNode.childNodes[nIndex]; nIndex++)
-				if (oChild.nodeType == 3  || oChild.nodeType == 4 )
-					aText.push(oChild.data);
-				else
-				if (oChild.nodeType == 1  && oChild.firstChild)
-					arguments.callee(oChild);
-		})(oNode);
-		return aText.join('');
-	}
-};
-
-cLXDOMAdapter.prototype.compareDocumentPosition	= function(oNode, oChild) {
-		if ("compareDocumentPosition" in oNode)
-		return oNode.compareDocumentPosition(oChild);
-
-		if (oChild == oNode)
-		return 0;
-
-		var oAttr1	= null,
-		oAttr2	= null,
-		aAttributes,
-		oAttr, oElement, nIndex, nLength;
-	if (oNode.nodeType == 2 ) {
-		oAttr1	= oNode;
-		oNode	= this.getProperty(oAttr1, "ownerElement");
-	}
-	if (oChild.nodeType == 2 ) {
-		oAttr2	= oChild;
-		oChild	= this.getProperty(oAttr2, "ownerElement");
-	}
-
-		if (oAttr1 && oAttr2 && oNode && oNode == oChild) {
-		for (nIndex = 0, aAttributes = this.getProperty(oNode, "attributes"), nLength = aAttributes.length; nIndex < nLength; nIndex++) {
-			oAttr	= aAttributes[nIndex];
-			if (oAttr == oAttr1)
-				return 32  | 4 ;
-			if (oAttr == oAttr2)
-				return 32  | 2 ;
-		}
-	}
-
-		var aChain1	= [], nLength1, oNode1,
-		aChain2	= [], nLength2, oNode2;
-		if (oAttr1)
-		aChain1.push(oAttr1);
-	for (oElement = oNode; oElement; oElement = oElement.parentNode)
-		aChain1.push(oElement);
-	if (oAttr2)
-		aChain2.push(oAttr2);
-	for (oElement = oChild; oElement; oElement = oElement.parentNode)
-		aChain2.push(oElement);
-		if (((oNode.ownerDocument || oNode) != (oChild.ownerDocument || oChild)) || (aChain1[aChain1.length - 1] != aChain2[aChain2.length - 1]))
-		return 32  | 1 ;
-		for (nIndex = cMath.min(nLength1 = aChain1.length, nLength2 = aChain2.length); nIndex; --nIndex)
-		if ((oNode1 = aChain1[--nLength1]) != (oNode2 = aChain2[--nLength2])) {
-						if (oNode1.nodeType == 2 )
-				return 4 ;
-			if (oNode2.nodeType == 2 )
-				return 2 ;
-						if (!oNode2.nextSibling)
-				return 4 ;
-			if (!oNode1.nextSibling)
-				return 2 ;
-			for (oElement = oNode2.previousSibling; oElement; oElement = oElement.previousSibling)
-				if (oElement == oNode1)
-					return 4 ;
-			return 2 ;
-		}
-		return nLength1 < nLength2 ? 4  | 16  : 2  | 8 ;
-};
-
-cLXDOMAdapter.prototype.lookupNamespaceURI	= function(oNode, sPrefix) {
-		if ("lookupNamespaceURI" in oNode)
-		return oNode.lookupNamespaceURI(sPrefix);
-
-		for (; oNode && oNode.nodeType != 9  ; oNode = oNode.parentNode)
-		if (sPrefix == this.getProperty(oChild, "prefix"))
-			return this.getProperty(oNode, "namespaceURI");
-		else
-		if (oNode.nodeType == 1)				for (var oAttributes = this.getProperty(oNode, "attributes"), nIndex = 0, nLength = oAttributes.length, sName = "xmlns" + ':' + sPrefix; nIndex < nLength; nIndex++)
-				if (this.getProperty(oAttributes[nIndex], "nodeName") == sName)
-					return this.getProperty(oAttributes[nIndex], "value");
-	return null;
-};
-
-cLXDOMAdapter.prototype.getElementsByTagNameNS	= function(oNode, sNameSpaceURI, sLocalName) {
-		if ("getElementsByTagNameNS" in oNode)
-		return oNode.getElementsByTagNameNS(sNameSpaceURI, sLocalName);
-
-		var aElements	= [],
-		bNameSpaceURI	= '*' == sNameSpaceURI,
-		bLocalName		= '*' == sLocalName;
-	(function(oNode) {
-		for (var nIndex = 0, oChild; oChild = oNode.childNodes[nIndex]; nIndex++)
-			if (oChild.nodeType == 1) {					if ((bLocalName || sLocalName == this.getProperty(oChild, "localName")) && (bNameSpaceURI || sNameSpaceURI == this.getProperty(oChild, "namespaceURI")))
-					aElements[aElements.length]	= oChild;
-				if (oChild.firstChild)
-					arguments.callee(oChild);
-			}
-	})(oNode);
-	return aElements;
-};
-
-var oMSHTMLDOMAdapter	= new cLXDOMAdapter;
-
-oMSHTMLDOMAdapter.getProperty	= function(oNode, sName) {
-	if (sName == "localName") {
-		if (oNode.nodeType == 1)
-			return oNode.nodeName.toLowerCase();
-	}
-	if (sName == "prefix")
-		return null;
-	if (sName == "namespaceURI")
-		return oNode.nodeType == 1 ? "http://www.w3.org/1999/xhtml" : null;
-	if (sName == "textContent")
-		return oNode.innerText;
-	if (sName == "attributes" && oNode.nodeType == 1) {
-		var aAttributes	= [];
-		for (var nIndex = 0, oAttributes = oNode.attributes, nLength = oAttributes.length, oNode2, oAttribute; nIndex < nLength; nIndex++) {
-			oNode2	= oAttributes[nIndex];
-			if (oNode2.specified) {
-				oAttribute	= new cAttr;
-				oAttribute.ownerElement	= oNode;
-				oAttribute.ownerDocument= oNode.ownerDocument;
-				oAttribute.specified	= true;
-				oAttribute.value		=
-				oAttribute.nodeValue	= oNode2.nodeValue;
-				oAttribute.name			=
-				oAttribute.nodeName		=
-								oAttribute.localName	= oNode2.nodeName.toLowerCase();
-								aAttributes[aAttributes.length]	= oAttribute;
-			}
-		}
-		return aAttributes;
-	}
-		return cLXDOMAdapter.prototype.getProperty.call(this, oNode, sName);
-};
-
-
-var oMSXMLDOMAdapter	= new cLXDOMAdapter;
-
-oMSXMLDOMAdapter.getProperty	= function(oNode, sName) {
-	if (sName == "localName") {
-		if (oNode.nodeType == 7)
-			return null;
-		if (oNode.nodeType == 1)
-			return oNode.baseName;
-	}
-	if (sName == "prefix" || sName == "namespaceURI")
-		return oNode[sName] || null;
-	if (sName == "textContent")
-		return oNode.text;
-	if (sName == "attributes" && oNode.nodeType == 1) {
-		var aAttributes	= [];
-		for (var nIndex = 0, oAttributes = oNode.attributes, nLength = oAttributes.length, oNode2, oAttribute; nIndex < nLength; nIndex++) {
-			oNode2	= oAttributes[nIndex];
-			if (oNode2.specified) {
-				oAttribute	= new cAttr;
-				oAttribute.nodeType		= 2;
-				oAttribute.ownerElement	= oNode;
-				oAttribute.ownerDocument= oNode.ownerDocument;
-				oAttribute.specified	= true;
-				oAttribute.value		=
-				oAttribute.nodeValue	= oNode2.nodeValue;
-				oAttribute.name			=
-				oAttribute.nodeName		= oNode2.nodeName;
-								oAttribute.localName	= oNode2.baseName;
-				oAttribute.prefix		= oNode2.prefix || null;
-				oAttribute.namespaceURI	= oNode2.namespaceURI || null;
-								aAttributes[aAttributes.length]	= oAttribute;
-			}
-		}
-		return aAttributes;
-	}
-		return cLXDOMAdapter.prototype.getProperty.call(this, oNode, sName);
-};
-
-oMSXMLDOMAdapter.getElementById	= function(oDocument, sId) {
-	return oDocument.nodeFromID(sId);
-};
-
-function cEvaluator() {
-
-};
-
-cEvaluator.prototype.defaultOL2DOMAdapter		= new cLXDOMAdapter;
-cEvaluator.prototype.defaultOL2HTMLDOMAdapter	= new cLXDOMAdapter;
-
-cEvaluator.prototype.defaultHTMLStaticContext	= new cStaticContext;
-cEvaluator.prototype.defaultHTMLStaticContext.baseURI	= window.document.location.href;
-cEvaluator.prototype.defaultHTMLStaticContext.defaultFunctionNamespace	= "http://www.w3.org/2005/xpath-functions";
-cEvaluator.prototype.defaultHTMLStaticContext.defaultElementNamespace	= "http://www.w3.org/1999/xhtml";
-
-cEvaluator.prototype.defaultXMLStaticContext	= new cStaticContext;
-cEvaluator.prototype.defaultXMLStaticContext.defaultFunctionNamespace	= "http://www.w3.org/2005/xpath-functions";
-
-cEvaluator.prototype.bOldMS		= !!window.document.namespaces && !window.document.createElementNS;
-cEvaluator.prototype.bOldW3		= !cEvaluator.prototype.bOldMS && window.document.documentElement.namespaceURI != "http://www.w3.org/1999/xhtml";
-
-cEvaluator.prototype.defaultDOMAdapter		= new cDOMAdapter;
-
-cEvaluator.prototype.compile	= function(sExpression, oStaticContext) {
-    return new cExpression(sExpression, oStaticContext);
-};
-
-cEvaluator.prototype.evaluate	= function(oQuery, sExpression, fNSResolver) {
-	if (! (oQuery instanceof window.jQuery))
-        oQuery = new window.jQuery(oQuery)
-
-    if (typeof sExpression == "undefined" || sExpression === null)
-        sExpression	= '';
-
-    var oNode	= oQuery[0];
-    if (typeof oNode == "undefined")
-        oNode	= null;
-
-    var oStaticContext	= oNode && (oNode.nodeType == 9 ? oNode : oNode.ownerDocument).createElement("div").tagName == "DIV" ? this.defaultHTMLStaticContext : this.defaultXMLStaticContext;
-
-    oStaticContext.namespaceResolver	= fNSResolver;
-
-    var oExpression	= new cExpression(cString(sExpression), oStaticContext);
-
-    oStaticContext.namespaceResolver	= null;
-
-    var aSequence,
-        oSequence	= new window.jQuery,
-        oAdapter	= this.defaultOL2DOMAdapter;
-
-    if (this.bOldMS)
-        oAdapter	= oStaticContext == this.defaultHTMLStaticContext ? oMSHTMLDOMAdapter : oMSXMLDOMAdapter;
-    else
-    if (this.bOldW3 && oStaticContext == this.defaultHTMLStaticContext)
-        oAdapter	= this.defaultOL2HTMLDOMAdapter;
-
-    aSequence	= oExpression.evaluate(new cDynamicContext(oStaticContext, oNode, null, oAdapter));
-    for (var nIndex = 0, nLength = aSequence.length, oItem; nIndex < nLength; nIndex++)
-        oSequence.push(oAdapter.isNode(oItem = aSequence[nIndex]) ? oItem : cStaticContext.xs2js(oItem));
-
-    return oSequence;
-};
-
-/*
- * XPath.js - Pure JavaScript implementation of XPath 2.0 parser and evaluator
- *
- * Copyright (c) 2012 Sergey Ilinsky
- * Dual licensed under the MIT and GPL licenses.
- *
- *
- */
-
-var oXPathEvaluator	= new cEvaluator,
-    oXPathClasses	= oXPathEvaluator.classes = {};
-
-//
-oXPathClasses.Exception		= cException;
-oXPathClasses.Expression	= cExpression;
-oXPathClasses.DOMAdapter	= cDOMAdapter;
-oXPathClasses.StaticContext	= cStaticContext;
-oXPathClasses.DynamicContext= cDynamicContext;
-oXPathClasses.StringCollator= cStringCollator;
-
-// Publish object
-window.xpath	= oXPathEvaluator;
-
-})()

+ 0 - 1231
src/js/lib/yahoo.js

@@ -1,1231 +0,0 @@
-/** @license
-========================================================================
-  Copyright (c) 2011, Yahoo! Inc. All rights reserved.
-  Code licensed under the BSD License:
-  http://developer.yahoo.com/yui/license.html
-  version: 2.9.0
-*/
-/**
- * The YAHOO object is the single global object used by YUI Library.  It
- * contains utility function for setting up namespaces, inheritance, and
- * logging.  YAHOO.util, YAHOO.widget, and YAHOO.example are namespaces
- * created automatically for and used by the library.
- * @module yahoo
- * @title  YAHOO Global
- */
-
-/**
- * YAHOO_config is not included as part of the library.  Instead it is an
- * object that can be defined by the implementer immediately before
- * including the YUI library.  The properties included in this object
- * will be used to configure global properties needed as soon as the
- * library begins to load.
- * @class YAHOO_config
- * @static
- */
-
-/**
- * A reference to a function that will be executed every time a YAHOO module
- * is loaded.  As parameter, this function will receive the version
- * information for the module. See <a href="YAHOO.env.html#getVersion">
- * YAHOO.env.getVersion</a> for the description of the version data structure.
- * @property listener
- * @type Function
- * @static
- * @default undefined
- */
-
-/**
- * Set to true if the library will be dynamically loaded after window.onload.
- * Defaults to false
- * @property injecting
- * @type boolean
- * @static
- * @default undefined
- */
-
-/**
- * Instructs the yuiloader component to dynamically load yui components and
- * their dependencies.  See the yuiloader documentation for more information
- * about dynamic loading
- * @property load
- * @static
- * @default undefined
- * @see yuiloader
- */
-
-/**
- * Forces the use of the supplied locale where applicable in the library
- * @property locale
- * @type string
- * @static
- * @default undefined
- */
-
-var typeof_yahoo = typeof YAHOO;
-if (typeof_yahoo == "undefined" || !YAHOO) {
-    /**
-     * The YAHOO global namespace object.  If YAHOO is already defined, the
-     * existing YAHOO object will not be overwritten so that defined
-     * namespaces are preserved.
-     * @class YAHOO
-     * @static
-     */
-    var YAHOO = {};
-}
-
-/**
- * Returns the namespace specified and creates it if it doesn't exist
- * <pre>
- * YAHOO.namespace("property.package");
- * YAHOO.namespace("YAHOO.property.package");
- * </pre>
- * Either of the above would create YAHOO.property, then
- * YAHOO.property.package
- *
- * Be careful when naming packages. Reserved words may work in some browsers
- * and not others. For instance, the following will fail in Safari:
- * <pre>
- * YAHOO.namespace("really.long.nested.namespace");
- * </pre>
- * This fails because "long" is a future reserved word in ECMAScript
- *
- * For implementation code that uses YUI, do not create your components
- * in the namespaces defined by YUI (
- * <code>YAHOO.util</code>,
- * <code>YAHOO.widget</code>,
- * <code>YAHOO.lang</code>,
- * <code>YAHOO.tool</code>,
- * <code>YAHOO.example</code>,
- * <code>YAHOO.env</code>) -- create your own namespace (e.g., 'companyname').
- *
- * @method namespace
- * @static
- * @param  {String*} arguments 1-n namespaces to create
- * @return {Object}  A reference to the last namespace object created
- */
-YAHOO.namespace = function() {
-    var a=arguments, o=null, i, j, d;
-    for (i=0; i<a.length; i=i+1) {
-        d=(""+a[i]).split(".");
-        o=YAHOO;
-
-        // YAHOO is implied, so it is ignored if it is included
-        for (j=(d[0] == "YAHOO") ? 1 : 0; j<d.length; j=j+1) {
-            o[d[j]]=o[d[j]] || {};
-            o=o[d[j]];
-        }
-    }
-
-    return o;
-};
-
-/**
- * Uses YAHOO.widget.Logger to output a log message, if the widget is
- * available.
- * Note: LogReader adds the message, category, and source to the DOM as HTML.
- *
- * @method log
- * @static
- * @param  {HTML}  msg  The message to log.
- * @param  {HTML}  cat  The log category for the message.  Default
- *                        categories are "info", "warn", "error", time".
- *                        Custom categories can be used as well. (opt)
- * @param  {HTML}  src  The source of the the message (opt)
- * @return {Boolean}      True if the log operation was successful.
- */
-YAHOO.log = function(msg, cat, src) {
-    var l=YAHOO.widget.Logger;
-    if(l && l.log) {
-        return l.log(msg, cat, src);
-    } else {
-        return false;
-    }
-};
-
-/**
- * Registers a module with the YAHOO object
- * @method register
- * @static
- * @param {String}   name    the name of the module (event, slider, etc)
- * @param {Function} mainClass a reference to class in the module.  This
- *                             class will be tagged with the version info
- *                             so that it will be possible to identify the
- *                             version that is in use when multiple versions
- *                             have loaded
- * @param {Object}   data      metadata object for the module.  Currently it
- *                             is expected to contain a "version" property
- *                             and a "build" property at minimum.
- */
-YAHOO.register = function(name, mainClass, data) {
-    var mods = YAHOO.env.modules, m, v, b, ls, i;
-
-    if (!mods[name]) {
-        mods[name] = {
-            versions:[],
-            builds:[]
-        };
-    }
-
-    m  = mods[name];
-    v  = data.version;
-    b  = data.build;
-    ls = YAHOO.env.listeners;
-
-    m.name = name;
-    m.version = v;
-    m.build = b;
-    m.versions.push(v);
-    m.builds.push(b);
-    m.mainClass = mainClass;
-
-    // fire the module load listeners
-    for (i=0;i<ls.length;i=i+1) {
-        ls[i](m);
-    }
-    // label the main class
-    if (mainClass) {
-        mainClass.VERSION = v;
-        mainClass.BUILD = b;
-    } else {
-        YAHOO.log("mainClass is undefined for module " + name, "warn");
-    }
-};
-
-/**
- * YAHOO.env is used to keep track of what is known about the YUI library and
- * the browsing environment
- * @class YAHOO.env
- * @static
- */
-YAHOO.env = YAHOO.env || {
-
-    /**
-     * Keeps the version info for all YUI modules that have reported themselves
-     * @property modules
-     * @type Object[]
-     */
-    modules: [],
-
-    /**
-     * List of functions that should be executed every time a YUI module
-     * reports itself.
-     * @property listeners
-     * @type Function[]
-     */
-    listeners: []
-};
-
-/**
- * Returns the version data for the specified module:
- *      <dl>
- *      <dt>name:</dt>      <dd>The name of the module</dd>
- *      <dt>version:</dt>   <dd>The version in use</dd>
- *      <dt>build:</dt>     <dd>The build number in use</dd>
- *      <dt>versions:</dt>  <dd>All versions that were registered</dd>
- *      <dt>builds:</dt>    <dd>All builds that were registered.</dd>
- *      <dt>mainClass:</dt> <dd>An object that was was stamped with the
- *                 current version and build. If
- *                 mainClass.VERSION != version or mainClass.BUILD != build,
- *                 multiple versions of pieces of the library have been
- *                 loaded, potentially causing issues.</dd>
- *       </dl>
- *
- * @method getVersion
- * @static
- * @param {String}  name the name of the module (event, slider, etc)
- * @return {Object} The version info
- */
-YAHOO.env.getVersion = function(name) {
-    return YAHOO.env.modules[name] || null;
-};
-
-/**
- * Do not fork for a browser if it can be avoided.  Use feature detection when
- * you can.  Use the user agent as a last resort.  YAHOO.env.ua stores a version
- * number for the browser engine, 0 otherwise.  This value may or may not map
- * to the version number of the browser using the engine.  The value is
- * presented as a float so that it can easily be used for boolean evaluation
- * as well as for looking for a particular range of versions.  Because of this,
- * some of the granularity of the version info may be lost (e.g., Gecko 1.8.0.9
- * reports 1.8).
- * @class YAHOO.env.ua
- * @static
- */
-
-/**
- * parses a user agent string (or looks for one in navigator to parse if
- * not supplied).
- * @method parseUA
- * @since 2.9.0
- * @static
- */
-YAHOO.env.parseUA = function(agent) {
-
-        var numberify = function(s) {
-            var c = 0;
-            return parseFloat(s.replace(/\./g, function() {
-                return (c++ == 1) ? '' : '.';
-            }));
-        },
-
-        nav = navigator,
-
-        o = {
-
-        /**
-         * Internet Explorer version number or 0.  Example: 6
-         * @property ie
-         * @type float
-         * @static
-         */
-        ie: 0,
-
-        /**
-         * Opera version number or 0.  Example: 9.2
-         * @property opera
-         * @type float
-         * @static
-         */
-        opera: 0,
-
-        /**
-         * Gecko engine revision number.  Will evaluate to 1 if Gecko
-         * is detected but the revision could not be found. Other browsers
-         * will be 0.  Example: 1.8
-         * <pre>
-         * Firefox 1.0.0.4: 1.7.8   <-- Reports 1.7
-         * Firefox 1.5.0.9: 1.8.0.9 <-- 1.8
-         * Firefox 2.0.0.3: 1.8.1.3 <-- 1.81
-         * Firefox 3.0   <-- 1.9
-         * Firefox 3.5   <-- 1.91
-         * </pre>
-         * @property gecko
-         * @type float
-         * @static
-         */
-        gecko: 0,
-
-        /**
-         * AppleWebKit version.  KHTML browsers that are not WebKit browsers
-         * will evaluate to 1, other browsers 0.  Example: 418.9
-         * <pre>
-         * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the
-         *                                   latest available for Mac OSX 10.3.
-         * Safari 2.0.2:         416     <-- hasOwnProperty introduced
-         * Safari 2.0.4:         418     <-- preventDefault fixed
-         * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
-         *                                   different versions of webkit
-         * Safari 2.0.4 (419.3): 419     <-- Tiger installations that have been
-         *                                   updated, but not updated
-         *                                   to the latest patch.
-         * Webkit 212 nightly:   522+    <-- Safari 3.0 precursor (with native
-         * SVG and many major issues fixed).
-         * Safari 3.0.4 (523.12) 523.12  <-- First Tiger release - automatic
-         * update from 2.x via the 10.4.11 OS patch.
-         * Webkit nightly 1/2008:525+    <-- Supports DOMContentLoaded event.
-         *                                   yahoo.com user agent hack removed.
-         * </pre>
-         * http://en.wikipedia.org/wiki/Safari_version_history
-         * @property webkit
-         * @type float
-         * @static
-         */
-        webkit: 0,
-
-        /**
-         * Chrome will be detected as webkit, but this property will also
-         * be populated with the Chrome version number
-         * @property chrome
-         * @type float
-         * @static
-         */
-        chrome: 0,
-
-        /**
-         * The mobile property will be set to a string containing any relevant
-         * user agent information when a modern mobile browser is detected.
-         * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series
-         * devices with the WebKit-based browser, and Opera Mini.
-         * @property mobile
-         * @type string
-         * @static
-         */
-        mobile: null,
-
-        /**
-         * Adobe AIR version number or 0.  Only populated if webkit is detected.
-         * Example: 1.0
-         * @property air
-         * @type float
-         */
-        air: 0,
-        /**
-         * Detects Apple iPad's OS version
-         * @property ipad
-         * @type float
-         * @static
-         */
-        ipad: 0,
-        /**
-         * Detects Apple iPhone's OS version
-         * @property iphone
-         * @type float
-         * @static
-         */
-        iphone: 0,
-        /**
-         * Detects Apples iPod's OS version
-         * @property ipod
-         * @type float
-         * @static
-         */
-        ipod: 0,
-        /**
-         * General truthy check for iPad, iPhone or iPod
-         * @property ios
-         * @type float
-         * @static
-         */
-        ios: null,
-        /**
-         * Detects Googles Android OS version
-         * @property android
-         * @type float
-         * @static
-         */
-        android: 0,
-        /**
-         * Detects Palms WebOS version
-         * @property webos
-         * @type float
-         * @static
-         */
-        webos: 0,
-
-        /**
-         * Google Caja version number or 0.
-         * @property caja
-         * @type float
-         */
-        caja: nav && nav.cajaVersion,
-
-        /**
-         * Set to true if the page appears to be in SSL
-         * @property secure
-         * @type boolean
-         * @static
-         */
-        secure: false,
-
-        /**
-         * The operating system.  Currently only detecting windows or macintosh
-         * @property os
-         * @type string
-         * @static
-         */
-        os: null
-
-    },
-
-    ua = agent || (navigator && navigator.userAgent),
-
-    loc = window && window.location,
-
-    href = loc && loc.href,
-
-    m;
-
-    o.secure = href && (href.toLowerCase().indexOf("https") === 0);
-
-    if (ua) {
-
-        if ((/windows|win32/i).test(ua)) {
-            o.os = 'windows';
-        } else if ((/macintosh/i).test(ua)) {
-            o.os = 'macintosh';
-        } else if ((/rhino/i).test(ua)) {
-            o.os = 'rhino';
-        }
-
-        // Modern KHTML browsers should qualify as Safari X-Grade
-        if ((/KHTML/).test(ua)) {
-            o.webkit = 1;
-        }
-        // Modern WebKit browsers are at least X-Grade
-        m = ua.match(/AppleWebKit\/([^\s]*)/);
-        if (m && m[1]) {
-            o.webkit = numberify(m[1]);
-
-            // Mobile browser check
-            if (/ Mobile\//.test(ua)) {
-                o.mobile = 'Apple'; // iPhone or iPod Touch
-
-                m = ua.match(/OS ([^\s]*)/);
-                if (m && m[1]) {
-                    m = numberify(m[1].replace('_', '.'));
-                }
-                o.ios = m;
-                o.ipad = o.ipod = o.iphone = 0;
-
-                m = ua.match(/iPad|iPod|iPhone/);
-                if (m && m[0]) {
-                    o[m[0].toLowerCase()] = o.ios;
-                }
-            } else {
-                m = ua.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/);
-                if (m) {
-                    // Nokia N-series, Android, webOS, ex: NokiaN95
-                    o.mobile = m[0];
-                }
-                if (/webOS/.test(ua)) {
-                    o.mobile = 'WebOS';
-                    m = ua.match(/webOS\/([^\s]*);/);
-                    if (m && m[1]) {
-                        o.webos = numberify(m[1]);
-                    }
-                }
-                if (/ Android/.test(ua)) {
-                    o.mobile = 'Android';
-                    m = ua.match(/Android ([^\s]*);/);
-                    if (m && m[1]) {
-                        o.android = numberify(m[1]);
-                    }
-
-                }
-            }
-
-            m = ua.match(/Chrome\/([^\s]*)/);
-            if (m && m[1]) {
-                o.chrome = numberify(m[1]); // Chrome
-            } else {
-                m = ua.match(/AdobeAIR\/([^\s]*)/);
-                if (m) {
-                    o.air = m[0]; // Adobe AIR 1.0 or better
-                }
-            }
-        }
-
-        if (!o.webkit) { // not webkit
-// @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
-            m = ua.match(/Opera[\s\/]([^\s]*)/);
-            if (m && m[1]) {
-                o.opera = numberify(m[1]);
-                m = ua.match(/Version\/([^\s]*)/);
-                if (m && m[1]) {
-                    o.opera = numberify(m[1]); // opera 10+
-                }
-                m = ua.match(/Opera Mini[^;]*/);
-                if (m) {
-                    o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
-                }
-            } else { // not opera or webkit
-                m = ua.match(/MSIE\s([^;]*)/);
-                if (m && m[1]) {
-                    o.ie = numberify(m[1]);
-                } else { // not opera, webkit, or ie
-                    m = ua.match(/Gecko\/([^\s]*)/);
-                    if (m) {
-                        o.gecko = 1; // Gecko detected, look for revision
-                        m = ua.match(/rv:([^\s\)]*)/);
-                        if (m && m[1]) {
-                            o.gecko = numberify(m[1]);
-                        }
-                    }
-                }
-            }
-        }
-    }
-
-    return o;
-};
-
-YAHOO.env.ua = YAHOO.env.parseUA();
-
-/**
- * Initializes the global by creating the default namespaces and applying
- * any new configuration information that is detected.  This is the setup
- * for env.
- * @method init
- * @static
- * @private
- */
-(function() {
-    YAHOO.namespace("util", "widget", "example");
-    /*global YAHOO_config*/
-    if ("undefined" !== typeof YAHOO_config) {
-        var l=YAHOO_config.listener, ls=YAHOO.env.listeners,unique=true, i;
-        if (l) {
-            // if YAHOO is loaded multiple times we need to check to see if
-            // this is a new config object.  If it is, add the new component
-            // load listener to the stack
-            for (i=0; i<ls.length; i++) {
-                if (ls[i] == l) {
-                    unique = false;
-                    break;
-                }
-            }
-
-            if (unique) {
-                ls.push(l);
-            }
-        }
-    }
-})();
-/**
- * Provides the language utilites and extensions used by the library
- * @class YAHOO.lang
- */
-YAHOO.lang = YAHOO.lang || {};
-
-(function() {
-
-
-var L = YAHOO.lang,
-
-    OP = Object.prototype,
-    ARRAY_TOSTRING = '[object Array]',
-    FUNCTION_TOSTRING = '[object Function]',
-    OBJECT_TOSTRING = '[object Object]',
-    NOTHING = [],
-
-    HTML_CHARS = {
-        '&': '&amp;',
-        '<': '&lt;',
-        '>': '&gt;',
-        '"': '&quot;',
-        "'": '&#x27;',
-        '/': '&#x2F;',
-        '`': '&#x60;'
-    },
-
-    // ADD = ["toString", "valueOf", "hasOwnProperty"],
-    ADD = ["toString", "valueOf"],
-
-    OB = {
-
-    /**
-     * Determines wheather or not the provided object is an array.
-     * @method isArray
-     * @param {any} o The object being testing
-     * @return {boolean} the result
-     */
-    isArray: function(o) {
-        return OP.toString.apply(o) === ARRAY_TOSTRING;
-    },
-
-    /**
-     * Determines whether or not the provided object is a boolean
-     * @method isBoolean
-     * @param {any} o The object being testing
-     * @return {boolean} the result
-     */
-    isBoolean: function(o) {
-        return typeof o === 'boolean';
-    },
-
-    /**
-     * Determines whether or not the provided object is a function.
-     * Note: Internet Explorer thinks certain functions are objects:
-     *
-     * var obj = document.createElement("object");
-     * YAHOO.lang.isFunction(obj.getAttribute) // reports false in IE
-     *
-     * var input = document.createElement("input"); // append to body
-     * YAHOO.lang.isFunction(input.focus) // reports false in IE
-     *
-     * You will have to implement additional tests if these functions
-     * matter to you.
-     *
-     * @method isFunction
-     * @param {any} o The object being testing
-     * @return {boolean} the result
-     */
-    isFunction: function(o) {
-        return (typeof o === 'function') || OP.toString.apply(o) === FUNCTION_TOSTRING;
-    },
-
-    /**
-     * Determines whether or not the provided object is null
-     * @method isNull
-     * @param {any} o The object being testing
-     * @return {boolean} the result
-     */
-    isNull: function(o) {
-        return o === null;
-    },
-
-    /**
-     * Determines whether or not the provided object is a legal number
-     * @method isNumber
-     * @param {any} o The object being testing
-     * @return {boolean} the result
-     */
-    isNumber: function(o) {
-        return typeof o === 'number' && isFinite(o);
-    },
-
-    /**
-     * Determines whether or not the provided object is of type object
-     * or function
-     * @method isObject
-     * @param {any} o The object being testing
-     * @return {boolean} the result
-     */
-    isObject: function(o) {
-return (o && (typeof o === 'object' || L.isFunction(o))) || false;
-    },
-
-    /**
-     * Determines whether or not the provided object is a string
-     * @method isString
-     * @param {any} o The object being testing
-     * @return {boolean} the result
-     */
-    isString: function(o) {
-        return typeof o === 'string';
-    },
-
-    /**
-     * Determines whether or not the provided object is undefined
-     * @method isUndefined
-     * @param {any} o The object being testing
-     * @return {boolean} the result
-     */
-    isUndefined: function(o) {
-        return typeof o === 'undefined';
-    },
-
-
-    /**
-     * IE will not enumerate native functions in a derived object even if the
-     * function was overridden.  This is a workaround for specific functions
-     * we care about on the Object prototype.
-     * @property _IEEnumFix
-     * @param {Function} r  the object to receive the augmentation
-     * @param {Function} s  the object that supplies the properties to augment
-     * @static
-     * @private
-     */
-    _IEEnumFix: (YAHOO.env.ua.ie) ? function(r, s) {
-            var i, fname, f;
-            for (i=0;i<ADD.length;i=i+1) {
-
-                fname = ADD[i];
-                f = s[fname];
-
-                if (L.isFunction(f) && f!=OP[fname]) {
-                    r[fname]=f;
-                }
-            }
-    } : function(){},
-
-    /**
-     * <p>
-     * Returns a copy of the specified string with special HTML characters
-     * escaped. The following characters will be converted to their
-     * corresponding character entities:
-     * <code>&amp; &lt; &gt; &quot; &#x27; &#x2F; &#x60;</code>
-     * </p>
-     *
-     * <p>
-     * This implementation is based on the
-     * <a href="http://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet">OWASP
-     * HTML escaping recommendations</a>. In addition to the characters
-     * in the OWASP recommendation, we also escape the <code>&#x60;</code>
-     * character, since IE interprets it as an attribute delimiter when used in
-     * innerHTML.
-     * </p>
-     *
-     * @method escapeHTML
-     * @param {String} html String to escape.
-     * @return {String} Escaped string.
-     * @static
-     * @since 2.9.0
-     */
-    escapeHTML: function (html) {
-        return html.replace(/[&<>"'\/`]/g, function (match) {
-            return HTML_CHARS[match];
-        });
-    },
-
-    /**
-     * Utility to set up the prototype, constructor and superclass properties to
-     * support an inheritance strategy that can chain constructors and methods.
-     * Static members will not be inherited.
-     *
-     * @method extend
-     * @static
-     * @param {Function} subc   the object to modify
-     * @param {Function} superc the object to inherit
-     * @param {Object} overrides  additional properties/methods to add to the
-     *                              subclass prototype.  These will override the
-     *                              matching items obtained from the superclass
-     *                              if present.
-     */
-    extend: function(subc, superc, overrides) {
-        if (!superc||!subc) {
-            throw new Error("extend failed, please check that " +
-                            "all dependencies are included.");
-        }
-        var F = function() {}, i;
-        F.prototype=superc.prototype;
-        subc.prototype=new F();
-        subc.prototype.constructor=subc;
-        subc.superclass=superc.prototype;
-        if (superc.prototype.constructor == OP.constructor) {
-            superc.prototype.constructor=superc;
-        }
-
-        if (overrides) {
-            for (i in overrides) {
-                if (L.hasOwnProperty(overrides, i)) {
-                    subc.prototype[i]=overrides[i];
-                }
-            }
-
-            L._IEEnumFix(subc.prototype, overrides);
-        }
-    },
-
-    /**
-     * Applies all properties in the supplier to the receiver if the
-     * receiver does not have these properties yet.  Optionally, one or
-     * more methods/properties can be specified (as additional
-     * parameters).  This option will overwrite the property if receiver
-     * has it already.  If true is passed as the third parameter, all
-     * properties will be applied and _will_ overwrite properties in
-     * the receiver.
-     *
-     * @method augmentObject
-     * @static
-     * @since 2.3.0
-     * @param {Function} r  the object to receive the augmentation
-     * @param {Function} s  the object that supplies the properties to augment
-     * @param {String*|boolean}  arguments zero or more properties methods
-     *        to augment the receiver with.  If none specified, everything
-     *        in the supplier will be used unless it would
-     *        overwrite an existing property in the receiver. If true
-     *        is specified as the third parameter, all properties will
-     *        be applied and will overwrite an existing property in
-     *        the receiver
-     */
-    augmentObject: function(r, s) {
-        if (!s||!r) {
-            throw new Error("Absorb failed, verify dependencies.");
-        }
-        var a=arguments, i, p, overrideList=a[2];
-        if (overrideList && overrideList!==true) { // only absorb the specified properties
-            for (i=2; i<a.length; i=i+1) {
-                r[a[i]] = s[a[i]];
-            }
-        } else { // take everything, overwriting only if the third parameter is true
-            for (p in s) {
-                if (overrideList || !(p in r)) {
-                    r[p] = s[p];
-                }
-            }
-
-            L._IEEnumFix(r, s);
-        }
-
-        return r;
-    },
-
-    /**
-     * Same as YAHOO.lang.augmentObject, except it only applies prototype properties
-     * @see YAHOO.lang.augmentObject
-     * @method augmentProto
-     * @static
-     * @param {Function} r  the object to receive the augmentation
-     * @param {Function} s  the object that supplies the properties to augment
-     * @param {String*|boolean}  arguments zero or more properties methods
-     *        to augment the receiver with.  If none specified, everything
-     *        in the supplier will be used unless it would overwrite an existing
-     *        property in the receiver.  if true is specified as the third
-     *        parameter, all properties will be applied and will overwrite an
-     *        existing property in the receiver
-     */
-    augmentProto: function(r, s) {
-        if (!s||!r) {
-            throw new Error("Augment failed, verify dependencies.");
-        }
-        //var a=[].concat(arguments);
-        var a=[r.prototype,s.prototype], i;
-        for (i=2;i<arguments.length;i=i+1) {
-            a.push(arguments[i]);
-        }
-        L.augmentObject.apply(this, a);
-
-        return r;
-    },
-
-
-    /**
-     * Returns a simple string representation of the object or array.
-     * Other types of objects will be returned unprocessed.  Arrays
-     * are expected to be indexed.  Use object notation for
-     * associative arrays.
-     * @method dump
-     * @since 2.3.0
-     * @param o {Object} The object to dump
-     * @param d {int} How deep to recurse child objects, default 3
-     * @return {String} the dump result
-     */
-    dump: function(o, d) {
-        var i,len,s=[],OBJ="{...}",FUN="f(){...}",
-            COMMA=', ', ARROW=' => ';
-
-        // Cast non-objects to string
-        // Skip dates because the std toString is what we want
-        // Skip HTMLElement-like objects because trying to dump
-        // an element will cause an unhandled exception in FF 2.x
-        if (!L.isObject(o)) {
-            return o + "";
-        } else if (o instanceof Date || ("nodeType" in o && "tagName" in o)) {
-            return o;
-        } else if  (L.isFunction(o)) {
-            return FUN;
-        }
-
-        // dig into child objects the depth specifed. Default 3
-        d = (L.isNumber(d)) ? d : 3;
-
-        // arrays [1, 2, 3]
-        if (L.isArray(o)) {
-            s.push("[");
-            for (i=0,len=o.length;i<len;i=i+1) {
-                if (L.isObject(o[i])) {
-                    s.push((d > 0) ? L.dump(o[i], d-1) : OBJ);
-                } else {
-                    s.push(o[i]);
-                }
-                s.push(COMMA);
-            }
-            if (s.length > 1) {
-                s.pop();
-            }
-            s.push("]");
-        // objects {k1 => v1, k2 => v2}
-        } else {
-            s.push("{");
-            for (i in o) {
-                if (L.hasOwnProperty(o, i)) {
-                    s.push(i + ARROW);
-                    if (L.isObject(o[i])) {
-                        s.push((d > 0) ? L.dump(o[i], d-1) : OBJ);
-                    } else {
-                        s.push(o[i]);
-                    }
-                    s.push(COMMA);
-                }
-            }
-            if (s.length > 1) {
-                s.pop();
-            }
-            s.push("}");
-        }
-
-        return s.join("");
-    },
-
-    /**
-     * Does variable substitution on a string. It scans through the string
-     * looking for expressions enclosed in { } braces. If an expression
-     * is found, it is used a key on the object.  If there is a space in
-     * the key, the first word is used for the key and the rest is provided
-     * to an optional function to be used to programatically determine the
-     * value (the extra information might be used for this decision). If
-     * the value for the key in the object, or what is returned from the
-     * function has a string value, number value, or object value, it is
-     * substituted for the bracket expression and it repeats.  If this
-     * value is an object, it uses the Object's toString() if this has
-     * been overridden, otherwise it does a shallow dump of the key/value
-     * pairs.
-     *
-     * By specifying the recurse option, the string is rescanned after
-     * every replacement, allowing for nested template substitutions.
-     * The side effect of this option is that curly braces in the
-     * replacement content must be encoded.
-     *
-     * @method substitute
-     * @since 2.3.0
-     * @param s {String} The string that will be modified.
-     * @param o {Object} An object containing the replacement values
-     * @param f {Function} An optional function that can be used to
-     *                     process each match.  It receives the key,
-     *                     value, and any extra metadata included with
-     *                     the key inside of the braces.
-     * @param recurse {boolean} default true - if not false, the replaced
-     * string will be rescanned so that nested substitutions are possible.
-     * @return {String} the substituted string
-     */
-    substitute: function (s, o, f, recurse) {
-        var i, j, k, key, v, meta, saved=[], token, lidx=s.length,
-            DUMP='dump', SPACE=' ', LBRACE='{', RBRACE='}',
-            dump, objstr;
-
-        for (;;) {
-            i = s.lastIndexOf(LBRACE, lidx);
-            if (i < 0) {
-                break;
-            }
-            j = s.indexOf(RBRACE, i);
-            if (i + 1 > j) {
-                break;
-            }
-
-            //Extract key and meta info
-            token = s.substring(i + 1, j);
-            key = token;
-            meta = null;
-            k = key.indexOf(SPACE);
-            if (k > -1) {
-                meta = key.substring(k + 1);
-                key = key.substring(0, k);
-            }
-
-            // lookup the value
-            v = o[key];
-
-            // if a substitution function was provided, execute it
-            if (f) {
-                v = f(key, v, meta);
-            }
-
-            if (L.isObject(v)) {
-                if (L.isArray(v)) {
-                    v = L.dump(v, parseInt(meta, 10));
-                } else {
-                    meta = meta || "";
-
-                    // look for the keyword 'dump', if found force obj dump
-                    dump = meta.indexOf(DUMP);
-                    if (dump > -1) {
-                        meta = meta.substring(4);
-                    }
-
-                    objstr = v.toString();
-
-                    // use the toString if it is not the Object toString
-                    // and the 'dump' meta info was not found
-                    if (objstr === OBJECT_TOSTRING || dump > -1) {
-                        v = L.dump(v, parseInt(meta, 10));
-                    } else {
-                        v = objstr;
-                    }
-                }
-            } else if (!L.isString(v) && !L.isNumber(v)) {
-                // This {block} has no replace string. Save it for later.
-                v = "~-" + saved.length + "-~";
-                saved[saved.length] = token;
-
-                // break;
-            }
-
-            s = s.substring(0, i) + v + s.substring(j + 1);
-
-            if (recurse === false) {
-                lidx = i-1;
-            }
-
-        }
-
-        // restore saved {block}s
-        for (i=saved.length-1; i>=0; i=i-1) {
-            s = s.replace(new RegExp("~-" + i + "-~"), "{"  + saved[i] + "}", "g");
-        }
-
-        return s;
-    },
-
-
-    /**
-     * Returns a string without any leading or trailing whitespace.  If
-     * the input is not a string, the input will be returned untouched.
-     * @method trim
-     * @since 2.3.0
-     * @param s {string} the string to trim
-     * @return {string} the trimmed string
-     */
-    trim: function(s){
-        try {
-            return s.replace(/^\s+|\s+$/g, "");
-        } catch(e) {
-            return s;
-        }
-    },
-
-    /**
-     * Returns a new object containing all of the properties of
-     * all the supplied objects.  The properties from later objects
-     * will overwrite those in earlier objects.
-     * @method merge
-     * @since 2.3.0
-     * @param arguments {Object*} the objects to merge
-     * @return the new merged object
-     */
-    merge: function() {
-        var o={}, a=arguments, l=a.length, i;
-        for (i=0; i<l; i=i+1) {
-            L.augmentObject(o, a[i], true);
-        }
-        return o;
-    },
-
-    /**
-     * Executes the supplied function in the context of the supplied
-     * object 'when' milliseconds later.  Executes the function a
-     * single time unless periodic is set to true.
-     * @method later
-     * @since 2.4.0
-     * @param when {int} the number of milliseconds to wait until the fn
-     * is executed
-     * @param o the context object
-     * @param fn {Function|String} the function to execute or the name of
-     * the method in the 'o' object to execute
-     * @param data [Array] data that is provided to the function.  This accepts
-     * either a single item or an array.  If an array is provided, the
-     * function is executed with one parameter for each array item.  If
-     * you need to pass a single array parameter, it needs to be wrapped in
-     * an array [myarray]
-     * @param periodic {boolean} if true, executes continuously at supplied
-     * interval until canceled
-     * @return a timer object. Call the cancel() method on this object to
-     * stop the timer.
-     */
-    later: function(when, o, fn, data, periodic) {
-        when = when || 0;
-        o = o || {};
-        var m=fn, d=data, f, r;
-
-        if (L.isString(fn)) {
-            m = o[fn];
-        }
-
-        if (!m) {
-            throw new TypeError("method undefined");
-        }
-
-        if (!L.isUndefined(data) && !L.isArray(d)) {
-            d = [data];
-        }
-
-        f = function() {
-            m.apply(o, d || NOTHING);
-        };
-
-        r = (periodic) ? setInterval(f, when) : setTimeout(f, when);
-
-        return {
-            interval: periodic,
-            cancel: function() {
-                if (this.interval) {
-                    clearInterval(r);
-                } else {
-                    clearTimeout(r);
-                }
-            }
-        };
-    },
-
-    /**
-     * A convenience method for detecting a legitimate non-null value.
-     * Returns false for null/undefined/NaN, true for other values,
-     * including 0/false/''
-     * @method isValue
-     * @since 2.3.0
-     * @param o {any} the item to test
-     * @return {boolean} true if it is not null/undefined/NaN || false
-     */
-    isValue: function(o) {
-        // return (o || o === false || o === 0 || o === ''); // Infinity fails
-return (L.isObject(o) || L.isString(o) || L.isNumber(o) || L.isBoolean(o));
-    }
-
-};
-
-/**
- * Determines whether or not the property was added
- * to the object instance.  Returns false if the property is not present
- * in the object, or was inherited from the prototype.
- * This abstraction is provided to enable hasOwnProperty for Safari 1.3.x.
- * There is a discrepancy between YAHOO.lang.hasOwnProperty and
- * Object.prototype.hasOwnProperty when the property is a primitive added to
- * both the instance AND prototype with the same value:
- * <pre>
- * var A = function() {};
- * A.prototype.foo = 'foo';
- * var a = new A();
- * a.foo = 'foo';
- * alert(a.hasOwnProperty('foo')); // true
- * alert(YAHOO.lang.hasOwnProperty(a, 'foo')); // false when using fallback
- * </pre>
- * @method hasOwnProperty
- * @param {any} o The object being testing
- * @param prop {string} the name of the property to test
- * @return {boolean} the result
- */
-L.hasOwnProperty = (OP.hasOwnProperty) ?
-    function(o, prop) {
-        return o && o.hasOwnProperty && o.hasOwnProperty(prop);
-    } : function(o, prop) {
-        return !L.isUndefined(o[prop]) &&
-                o.constructor.prototype[prop] !== o[prop];
-    };
-
-// new lang wins
-OB.augmentObject(L, OB, true);
-
-/**
- * An alias for <a href="YAHOO.lang.html">YAHOO.lang</a>
- * @class YAHOO.util.Lang
- */
-YAHOO.util.Lang = L;
-
-/**
- * Same as YAHOO.lang.augmentObject, except it only applies prototype
- * properties.  This is an alias for augmentProto.
- * @see YAHOO.lang.augmentObject
- * @method augment
- * @static
- * @param {Function} r  the object to receive the augmentation
- * @param {Function} s  the object that supplies the properties to augment
- * @param {String*|boolean}  arguments zero or more properties methods to
- *        augment the receiver with.  If none specified, everything
- *        in the supplier will be used unless it would
- *        overwrite an existing property in the receiver.  if true
- *        is specified as the third parameter, all properties will
- *        be applied and will overwrite an existing property in
- *        the receiver
- */
-L.augment = L.augmentProto;
-
-/**
- * An alias for <a href="YAHOO.lang.html#augment">YAHOO.lang.augment</a>
- * @for YAHOO
- * @method augment
- * @static
- * @param {Function} r  the object to receive the augmentation
- * @param {Function} s  the object that supplies the properties to augment
- * @param {String*}  arguments zero or more properties methods to
- *        augment the receiver with.  If none specified, everything
- *        in the supplier will be used unless it would
- *        overwrite an existing property in the receiver
- */
-YAHOO.augment = L.augmentProto;
-
-/**
- * An alias for <a href="YAHOO.lang.html#extend">YAHOO.lang.extend</a>
- * @method extend
- * @static
- * @param {Function} subc   the object to modify
- * @param {Function} superc the object to inherit
- * @param {Object} overrides  additional properties/methods to add to the
- *        subclass prototype.  These will override the
- *        matching items obtained from the superclass if present.
- */
-YAHOO.extend = L.extend;
-
-})();
-YAHOO.register("yahoo", YAHOO, {version: "2.9.0", build: "2800"});

+ 3 - 3
src/js/operations/ByteRepr.js

@@ -89,11 +89,11 @@ var ByteRepr = module.exports = {
                 else if (ordinal < 4294967296) padding = 8;
                 else padding = 2;
 
-                if (padding > 2) app.options.attemptHighlight = false;
+                if (padding > 2 && app) app.options.attemptHighlight = false;
 
                 output += Utils.hex(ordinal, padding) + delim;
             } else {
-                app.options.attemptHighlight = false;
+                if (app) app.options.attemptHighlight = false;
                 output += ordinal.toString(base) + delim;
             }
         }
@@ -119,7 +119,7 @@ var ByteRepr = module.exports = {
             throw "Error: Base argument must be between 2 and 36";
         }
 
-        if (base !== 16) {
+        if (base !== 16 && app) {
             app.options.attemptHighlight = false;
         }
 

+ 11 - 21
src/js/operations/Code.js

@@ -1,7 +1,8 @@
-/* globals xpath */
 var Utils = require("../core/Utils.js"),
-    VKbeautify = require("vkbeautify");
-    //Prettify = require("google-code-prettify");
+    VKbeautify = require("vkbeautify"),
+    dom = require("xmldom").DOMParser,
+    xpath = require("xpath"),
+    prettyPrintOne = require("exports-loader?prettyPrintOne!google-code-prettify/bin/prettify.min.js");
 
 
 /**
@@ -36,7 +37,7 @@ var Code = module.exports = {
     runSyntaxHighlight: function(input, args) {
         var language = args[0],
             lineNums = args[1];
-        return "<code class='prettyprint'>" + Prettify.prettyPrintOne(Utils.escapeHtml(input), language, lineNums) + "</code>";
+        return "<code class='prettyprint'>" + prettyPrintOne(Utils.escapeHtml(input), language, lineNums) + "</code>";
     },
 
 
@@ -336,36 +337,25 @@ var Code = module.exports = {
         var query = args[0],
             delimiter = args[1];
 
-        var xml;
+        var doc;
         try {
-            xml = $.parseXML(input);
+            doc = new dom().parseFromString(input);
         } catch (err) {
             return "Invalid input XML.";
         }
 
-        var result;
+        var nodes;
         try {
-            result = xpath.evaluate(xml, query);
+            nodes = xpath.select(query, doc);
         } catch (err) {
             return "Invalid XPath. Details:\n" + err.message;
         }
 
-        var serializer = new XMLSerializer();
         var nodeToString = function(node) {
-            switch (node.nodeType) {
-                case Node.ELEMENT_NODE: return serializer.serializeToString(node);
-                case Node.ATTRIBUTE_NODE: return node.value;
-                case Node.COMMENT_NODE: return node.data;
-                case Node.DOCUMENT_NODE: return serializer.serializeToString(node);
-                default: throw new Error("Unknown Node Type: " + node.nodeType);
-            }
+            return node.toString();
         };
 
-        return Object.keys(result).map(function(key) {
-            return result[key];
-        }).slice(0, -1) // all values except last (length)
-        .map(nodeToString)
-        .join(delimiter);
+        return nodes.map(nodeToString).join(delimiter);
     },
 
 

+ 1 - 1
src/js/operations/Compress.js

@@ -3,7 +3,7 @@ var rawdeflate = require("zlibjs/bin/rawdeflate.min"),
     zlibAndGzip = require("zlibjs/bin/zlib_and_gzip.min"),
     zip = require("zlibjs/bin/zip.min"),
     unzip = require("zlibjs/bin/unzip.min"),
-    bzip2 = require("../lib/bzip2.js");
+    bzip2 = require("exports-loader?bzip2!../lib/bzip2.js");
 
 var Zlib = {
     RawDeflate: rawdeflate.Zlib.RawDeflate,

+ 0 - 3
src/js/operations/DateTime.js

@@ -1,6 +1,3 @@
-var moment = require("moment-timezone");
-
-
 /**
  * Date and time operations.
  *

+ 1 - 1
src/js/operations/HTTP.js

@@ -1,4 +1,4 @@
-var UAParser = require("../lib/uas_parser.js");
+var UAParser = require("exports-loader?UAS_parser!../lib/uas_parser.js");
 
 
 /**

+ 1 - 1
src/js/operations/Hexdump.js

@@ -92,7 +92,7 @@ var Hexdump = module.exports = {
         var w = (width - 13) / 4;
         // w should be the specified width of the hexdump and therefore a round number
         if (Math.floor(w) !== w || input.indexOf("\r") !== -1 || output.indexOf(13) !== -1) {
-            app.options.attemptHighlight = false;
+            if (app) app.options.attemptHighlight = false;
         }
         return output;
     },

+ 9 - 4
src/js/views/html/ControlsWaiter.js

@@ -1,4 +1,5 @@
-/* globals moment */
+var Utils = require("../../core/Utils.js");
+
 
 /**
  * Waiter to handle events related to the CyberChef controls (i.e. Bake, Step, Save, Load etc.)
@@ -11,7 +12,7 @@
  * @param {HTMLApp} app - The main view object for CyberChef.
  * @param {Manager} manager - The CyberChef event manager.
  */
-var ControlsWaiter = function(app, manager) {
+var ControlsWaiter = module.exports = function(app, manager) {
     this.app = app;
     this.manager = manager;
 };
@@ -78,7 +79,9 @@ ControlsWaiter.prototype.setAutoBake = function(value) {
  */
 ControlsWaiter.prototype.bakeClick = function() {
     this.app.bake();
-    $("#output-text").selectRange(0);
+    var outputText = document.getElementById("output-text");
+    outputText.focus();
+    outputText.setSelectionRange(0, 0);
 };
 
 
@@ -87,7 +90,9 @@ ControlsWaiter.prototype.bakeClick = function() {
  */
 ControlsWaiter.prototype.stepClick = function() {
     this.app.bake(true);
-    $("#output-text").selectRange(0);
+    var outputText = document.getElementById("output-text");
+    outputText.focus();
+    outputText.setSelectionRange(0, 0);
 };
 
 

+ 8 - 2
src/js/views/html/HTMLApp.js

@@ -1,4 +1,10 @@
-/* globals Split */
+var Utils = require("../../core/Utils.js"),
+    Chef = require("../../core/Chef.js"),
+    Manager = require("./Manager.js"),
+    HTMLCategory = require("./HTMLCategory.js"),
+    HTMLOperation = require("./HTMLOperation.js"),
+    Split = require("split.js");
+
 
 /**
  * HTML view for CyberChef responsible for building the web page and dealing with all user
@@ -14,7 +20,7 @@
  * @param {String[]} defaultFavourites - A list of default favourite operations.
  * @param {Object} options - Default setting for app options.
  */
-var HTMLApp = function(categories, operations, defaultFavourites, defaultOptions) {
+var HTMLApp = module.exports = function(categories, operations, defaultFavourites, defaultOptions) {
     this.categories  = categories;
     this.operations  = operations;
     this.dfavourites = defaultFavourites;

+ 1 - 1
src/js/views/html/HTMLCategory.js

@@ -9,7 +9,7 @@
  * @param {string} name - The name of the category.
  * @param {boolean} selected - Whether this category is pre-selected or not.
  */
-var HTMLCategory = function(name, selected) {
+var HTMLCategory = module.exports = function(name, selected) {
     this.name = name;
     this.selected = selected;
     this.opList = [];

+ 1 - 1
src/js/views/html/HTMLIngredient.js

@@ -10,7 +10,7 @@
  * @param {HTMLApp} app - The main view object for CyberChef.
  * @param {Manager} manager - The CyberChef event manager.
  */
-var HTMLIngredient = function(config, app, manager) {
+var HTMLIngredient = module.exports = function(config, app, manager) {
     this.app = app;
     this.manager = manager;
 

+ 4 - 1
src/js/views/html/HTMLOperation.js

@@ -1,3 +1,6 @@
+var HTMLIngredient = require("./HTMLIngredient.js");
+
+
 /**
  * Object to handle the creation of operations.
  *
@@ -11,7 +14,7 @@
  * @param {HTMLApp} app - The main view object for CyberChef.
  * @param {Manager} manager - The CyberChef event manager.
  */
-var HTMLOperation = function(name, config, app, manager) {
+var HTMLOperation = module.exports = function(name, config, app, manager) {
     this.app         = app;
     this.manager     = manager;
 

+ 4 - 1
src/js/views/html/HighlighterWaiter.js

@@ -1,3 +1,6 @@
+var Utils = require("../../core/Utils.js");
+
+
 /**
  * Waiter to handle events related to highlighting in CyberChef.
  *
@@ -8,7 +11,7 @@
  * @constructor
  * @param {HTMLApp} app - The main view object for CyberChef.
  */
-var HighlighterWaiter = function(app) {
+var HighlighterWaiter = module.exports = function(app) {
     this.app = app;
 
     this.mouseButtonDown = false;

+ 4 - 1
src/js/views/html/InputWaiter.js

@@ -1,3 +1,6 @@
+var Utils = require("../../core/Utils.js");
+
+
 /**
  * Waiter to handle events related to the input.
  *
@@ -9,7 +12,7 @@
  * @param {HTMLApp} app - The main view object for CyberChef.
  * @param {Manager} manager - The CyberChef event manager.
  */
-var InputWaiter = function(app, manager) {
+var InputWaiter = module.exports = function(app, manager) {
     this.app = app;
     this.manager = manager;
 

+ 12 - 1
src/js/views/html/Manager.js

@@ -1,3 +1,14 @@
+var WindowWaiter      = require("./WindowWaiter.js"),
+    ControlsWaiter    = require("./ControlsWaiter.js"),
+    RecipeWaiter      = require("./RecipeWaiter.js"),
+    OperationsWaiter  = require("./OperationsWaiter.js"),
+    InputWaiter       = require("./InputWaiter.js"),
+    OutputWaiter      = require("./OutputWaiter.js"),
+    OptionsWaiter     = require("./OptionsWaiter.js"),
+    HighlighterWaiter = require("./HighlighterWaiter.js"),
+    SeasonalWaiter    = require("./SeasonalWaiter.js");
+
+
 /**
  * This object controls the Waiters responsible for handling events from all areas of the app.
  *
@@ -8,7 +19,7 @@
  * @constructor
  * @param {HTMLApp} app - The main view object for CyberChef.
  */
-var Manager = function(app) {
+var Manager = module.exports = function(app) {
     this.app = app;
 
     // Define custom events

+ 4 - 2
src/js/views/html/OperationsWaiter.js

@@ -1,4 +1,6 @@
-/* globals Sortable */
+var HTMLOperation = require("./HTMLOperation.js"),
+    Sortable = require("sortablejs");
+
 
 /**
  * Waiter to handle events related to the operations.
@@ -11,7 +13,7 @@
  * @param {HTMLApp} app - The main view object for CyberChef.
  * @param {Manager} manager - The CyberChef event manager.
  */
-var OperationsWaiter = function(app, manager) {
+var OperationsWaiter = module.exports = function(app, manager) {
     this.app = app;
     this.manager = manager;
 

+ 1 - 1
src/js/views/html/OptionsWaiter.js

@@ -8,7 +8,7 @@
  * @constructor
  * @param {HTMLApp} app - The main view object for CyberChef.
  */
-var OptionsWaiter = function(app) {
+var OptionsWaiter = module.exports = function(app) {
     this.app = app;
 };
 

+ 4 - 1
src/js/views/html/OutputWaiter.js

@@ -1,3 +1,6 @@
+var Utils = require("../../core/Utils.js");
+
+
 /**
  * Waiter to handle events related to the output.
  *
@@ -9,7 +12,7 @@
  * @param {HTMLApp} app - The main view object for CyberChef.
  * @param {Manager} manager - The CyberChef event manager.
  */
-var OutputWaiter = function(app, manager) {
+var OutputWaiter = module.exports = function(app, manager) {
     this.app = app;
     this.manager = manager;
 };

+ 6 - 3
src/js/views/html/RecipeWaiter.js

@@ -1,4 +1,6 @@
-/* globals Sortable */
+var HTMLOperation = require("./HTMLOperation.js"),
+    Sortable = require("sortablejs");
+
 
 /**
  * Waiter to handle events related to the recipe.
@@ -11,7 +13,7 @@
  * @param {HTMLApp} app - The main view object for CyberChef.
  * @param {Manager} manager - The CyberChef event manager.
  */
-var RecipeWaiter = function(app, manager) {
+var RecipeWaiter = module.exports = function(app, manager) {
     this.app = app;
     this.manager = manager;
     this.removeIntent = false;
@@ -31,7 +33,8 @@ RecipeWaiter.prototype.initialiseOperationDragNDrop = function() {
         sort: true,
         animation: 0,
         delay: 0,
-        filter: ".arg-input,.arg", // Relies on commenting out a line in Sortable.js which calls evt.preventDefault()
+        filter: ".arg-input,.arg",
+        preventOnFilter: false,
         setData: function(dataTransfer, dragEl) {
             dataTransfer.setData("Text", dragEl.querySelector(".arg-title").textContent);
         },

+ 1 - 1
src/js/views/html/SeasonalWaiter.js

@@ -9,7 +9,7 @@
  * @param {HTMLApp} app - The main view object for CyberChef.
  * @param {Manager} manager - The CyberChef event manager.
  */
-var SeasonalWaiter = function(app, manager) {
+var SeasonalWaiter = module.exports = function(app, manager) {
     this.app = app;
     this.manager = manager;
 };

+ 1 - 1
src/js/views/html/WindowWaiter.js

@@ -8,7 +8,7 @@
  * @constructor
  * @param {HTMLApp} app - The main view object for CyberChef.
  */
-var WindowWaiter = function(app) {
+var WindowWaiter = module.exports = function(app) {
     this.app = app;
 };
 

+ 9 - 2
src/js/views/html/main.js

@@ -1,11 +1,18 @@
-/* globals moment */
-
 /**
  * @author n1474335 [n1474335@gmail.com]
  * @copyright Crown Copyright 2016
  * @license Apache-2.0
  */
 
+require("bootstrap");
+require("bootstrap-colorpicker");
+require("bootstrap-switch");
+var CanvasComponents = require("../../lib/canvascomponents.js");
+
+var HTMLApp = require("./HTMLApp.js"),
+    Categories = require("../../config/Categories.js"),
+    OperationConfig = require("../../config/OperationConfig.js");
+
 /**
  * Main function used to build the CyberChef web app.
  */

+ 9 - 22
src/js/views/node/index.js

@@ -1,31 +1,18 @@
-var Chef = require("../../core/Chef.js");
-
-
 /**
+ * Node view for CyberChef.
+ *
  * @author n1474335 [n1474335@gmail.com]
  * @copyright Crown Copyright 2017
  * @license Apache-2.0
  */
 
-var chef = new Chef();
+var Chef = require("../../core/Chef.js");
 
-console.log(chef.bake("test", [{"op":"To Hex", "args":["Space"]}], {}, 0, false));
+module.exports = {
 
-console.log(chef.bake("425a6839314159265359b218ed630000031380400104002a438c00200021a9ea601a10003202185d5ed68ca6442f1e177245385090b218ed63",
-    [
-        {
-            "op" : "From Hex",
-            "args" : ["Space"]
-        },
-        {
-            "op" : "Bzip2 Decompress",
-            "args" : []
-        }
-    ],
-    {}, 0, false
-));
+    bake: function(input, recipeConfig) {
+        this.chef = new Chef();
+        return this.chef.bake(input, recipeConfig, {}, 0, false);
+    }
 
-console.log(chef.bake("192.168.0.0/30",
-    [{"op":"Parse IP range", "args":[true, true, false]}],
-    {}, 0, false
-));
+};

+ 0 - 24
test/NodeRunner.js

@@ -1,24 +0,0 @@
-/* eslint-env node */
-
-/**
- * NodeRunner.js
- *
- * The purpose of this file is to execute via PhantomJS the file
- * PhantomRunner.js, because PhantomJS is managed by node.
- *
- * @author tlwr [toby@toby.codes]
- * @copyright Crown Copyright 2017
- * @license Apache-2.0
- */
-
-var path = require("path"),
-    phantomjs = require("phantomjs-prebuilt"),
-    phantomEntryPoint = path.join(__dirname, "PhantomRunner.js"),
-    program = phantomjs.exec(phantomEntryPoint);
-
-program.stdout.pipe(process.stdout);
-program.stderr.pipe(process.stderr);
-
-program.on("exit", function(status) {
-    process.exit(status);
-});

+ 0 - 99
test/PhantomRunner.js

@@ -1,99 +0,0 @@
-/* eslint-env node */
-/* globals phantom */
-
-/**
- * PhantomRunner.js
- *
- * This file navigates to build/test/index.html and logs the test results.
- *
- * @author tlwr [toby@toby.codes]
- * @copyright Crown Copyright 2017
- * @license Apache-2.0
- */
-
-var page = require("webpage").create(),
-    allTestsPassing = true,
-    testStatusCounts = {
-        total: 0,
-    };
-
-
-/**
- * Helper function to convert a status to an icon.
- *
- * @param {string} status
- * @returns {string}
- */
-function statusToIcon(status) {
-    var icons = {
-        erroring: "🔥",
-        failing: "❌",
-        passing: "✔️️",
-    };
-    return icons[status] || "?";
-}
-
-
-/**
- * Callback function to handle test results.
- */
-page.onCallback = function(messageType) {
-    if (messageType === "testResult") {
-        var testResult = arguments[1];
-
-        allTestsPassing = allTestsPassing && testResult.status === "passing";
-        var newCount = (testStatusCounts[testResult.status] || 0) + 1;
-        testStatusCounts[testResult.status] = newCount;
-        testStatusCounts.total += 1;
-
-        console.log([
-            statusToIcon(testResult.status),
-            testResult.test.name
-        ].join(" "));
-
-        if (testResult.output) {
-            console.log(
-                testResult.output
-                    .trim()
-                    .replace(/^/, "\t")
-                    .replace(/\n/g, "\n\t")
-            );
-        }
-    } else if (messageType === "exit") {
-
-        console.log("\n");
-
-        for (var testStatus in testStatusCounts) {
-            var count = testStatusCounts[testStatus];
-            if (count > 0) {
-                console.log(testStatus.toUpperCase(), count);
-            }
-        }
-
-        if (!allTestsPassing) {
-            console.log("\nNot all tests are passing");
-        }
-
-        phantom.exit(allTestsPassing ? 0 : 1);
-    }
-};
-
-
-/**
- * Open the test webpage in PhantomJS.
- */
-page.open("build/test/index.html", function(status) {
-    if (status !== "success") {
-        console.log("STATUS: ", status);
-        phantom.exit(1);
-    }
-});
-
-
-/**
- * Fail if the process takes longer than 10 seconds.
- */
-setTimeout(function() {
-    console.log("Tests took longer than 10 seconds to run, returning.");
-    phantom.exit(1);
-}, 10 * 1000);

+ 3 - 1
test/TestRegister.js

@@ -8,6 +8,7 @@
  * @copyright Crown Copyright 2017
  * @license Apache-2.0
  */
+var Chef = require("../src/js/core/Chef.js");
 
 (function() {
     /**
@@ -85,5 +86,6 @@
 
 
     // Singleton TestRegister, keeping things simple and obvious.
-    window.TestRegister = new TestRegister();
+    global.TestRegister = global.TestRegister || new TestRegister();
+    module.exports = global.TestRegister;
 })();

+ 78 - 24
test/TestRunner.js

@@ -1,38 +1,92 @@
 /**
  * TestRunner.js
  *
- * This is for actually running the tests in the test register.
+ * For running the tests in the test register.
  *
  * @author tlwr [toby@toby.codes]
+ * @author n1474335 [n1474335@gmail.com]
  * @copyright Crown Copyright 2017
  * @license Apache-2.0
  */
+var TestRegister = require("./TestRegister.js"),
+    allTestsPassing = true,
+    testStatusCounts = {
+        total: 0,
+    };
 
-document.addEventListener("DOMContentLoaded", function() {
-    TestRegister.runTests()
+/**
+ * Requires and returns all modules that match.
+ *
+ * @param {Object} requireContext
+ * @returns {Object[]}
+ */
+function requireAll(requireContext) {
+    return requireContext.keys().map(requireContext);
+}
+
+// Import all tests
+requireAll(require.context("./tests", true, /.+\.js$/));
+
+
+/**
+ * Helper function to convert a status to an icon.
+ *
+ * @param {string} status
+ * @returns {string}
+ */
+function statusToIcon(status) {
+    var icons = {
+        erroring: "🔥",
+        failing: "❌",
+        passing: "✔️️",
+    };
+    return icons[status] || "?";
+}
+
+
+/**
+ * Displays a given test result in the console.
+ *
+ * @param {Object} testResult
+ */
+function handleTestResult(testResult) {
+    allTestsPassing = allTestsPassing && testResult.status === "passing";
+    var newCount = (testStatusCounts[testResult.status] || 0) + 1;
+    testStatusCounts[testResult.status] = newCount;
+    testStatusCounts.total += 1;
+
+    console.log([
+        statusToIcon(testResult.status),
+        testResult.test.name
+    ].join(" "));
+
+    if (testResult.output) {
+        console.log(
+            testResult.output
+                .trim()
+                .replace(/^/, "\t")
+                .replace(/\n/g, "\n\t")
+        );
+    }
+}
+
+
+TestRegister.runTests()
     .then(function(results) {
-        results.forEach(function(testResult) {
-
-            if (typeof window.callPhantom === "function") {
-                // If we're running this in PhantomJS
-                window.callPhantom(
-                    "testResult",
-                    testResult
-                );
-            } else {
-                // If we're just viewing this in a normal browser
-                var output = [
-                    "----------",
-                    testResult.test.name,
-                    testResult.status,
-                    testResult.output,
-                ].join("<br>");
-                document.querySelector("main").innerHTML += output;
+        results.forEach(handleTestResult);
+
+        console.log("\n");
+
+        for (var testStatus in testStatusCounts) {
+            var count = testStatusCounts[testStatus];
+            if (count > 0) {
+                console.log(testStatus.toUpperCase(), count);
             }
-        });
+        }
 
-        if (typeof window.callPhantom === "function") {
-            window.callPhantom("exit");
+        if (!allTestsPassing) {
+            console.log("\nNot all tests are passing");
         }
+
+        process.exit(allTestsPassing ? 0 : 1);
     });
-});

+ 0 - 33
test/test.html

@@ -1,33 +0,0 @@
-<!--
-    CyberChef test suite
-    
-    @author tlwr [toby@toby.codes]
-
-    @copyright Crown Copyright 2017
-    @license Apache-2.0
-    
-      Copyright 2017 Crown Copyright
-    
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-    
-        http://www.apache.org/licenses/LICENSE-2.0
-    
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-<!DOCTYPE html>
-<html>
-    <head>
-        <meta charset="UTF-8">
-        <title>CyberChef test suite</title>
-    </head>
-    <body>
-        <main style="white-space: pre"></main>
-        <script type="application/javascript" src="tests.js"></script>
-    </body>
-</html>

+ 2 - 0
test/tests/operations/Base58.js

@@ -6,6 +6,8 @@
  * @copyright Crown Copyright 2017
  * @license Apache-2.0
  */
+var TestRegister = require("../../TestRegister.js");
+
 TestRegister.addTests([
     {
         name: "To Base58 (Bitcoin): nothing",

+ 2 - 0
test/tests/operations/Compress.js

@@ -5,6 +5,8 @@
  * @copyright Crown Copyright 2017
  * @license Apache-2.0
  */
+var TestRegister = require("../../TestRegister.js");
+
 TestRegister.addTests([
     {
         name: "Bzip2 decompress",

+ 2 - 0
test/tests/operations/FlowControl.js

@@ -6,6 +6,8 @@
  * @copyright Crown Copyright 2017
  * @license Apache-2.0
  */
+var TestRegister = require("../../TestRegister.js");
+
 TestRegister.addTests([
     {
         name: "Fork: nothing",

+ 2 - 0
test/tests/operations/MorseCode.js

@@ -6,6 +6,8 @@
  * @copyright Crown Copyright 2017
  * @license Apache-2.0
  */
+var TestRegister = require("../../TestRegister.js");
+
 TestRegister.addTests([
     {
         name: "To Morse Code: 'SOS'",

+ 2 - 0
test/tests/operations/StrUtils.js

@@ -5,6 +5,8 @@
  * @copyright Crown Copyright 2017
  * @license Apache-2.0
  */
+var TestRegister = require("../../TestRegister.js");
+
 TestRegister.addTests([
     {
         name: "Regex, non-HTML op",

+ 0 - 11
webpack.config.js

@@ -1,11 +0,0 @@
-/* eslint-env node */
-
-var path = require("path");
-
-module.exports = {
-    entry: "./src/js/views/html/index.js",
-    output: {
-        filename: "bundle.js",
-        path: path.resolve(__dirname, "build/dev")
-    }
-};