[
  {
    "path": "README.md",
    "content": "#JavaScript Patterns\n\n<img src=\"http://shichuan.github.io/javascript-patterns/img/js-patterns.png\" alt=\"JS Patterns\" title=\"JS Patterns\" />\n<br />\nProject page at: <a href=\"http://shichuan.github.io/javascript-patterns\" target=\"_blank\">http://shichuan.github.io/javascript-patterns</a>\n\n"
  },
  {
    "path": "cn/index.html",
    "content": "﻿<!doctype html>\r\n<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->\r\n<!--[if lt IE 7]> <html class=\"no-js lt-ie9 lt-ie8 lt-ie7\" lang=\"en\"> <![endif]-->\r\n<!--[if IE 7]>    <html class=\"no-js lt-ie9 lt-ie8\" lang=\"en\"> <![endif]-->\r\n<!--[if IE 8]>    <html class=\"no-js lt-ie9\" lang=\"en\"> <![endif]-->\r\n<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->\r\n<!--[if gt IE 8]><!--> <html class=\"no-js\" lang=\"en\"> <!--<![endif]-->\r\n<head>\r\n  <meta charset=\"utf-8\">\r\n\r\n  <!-- Use the .htaccess and remove these lines to avoid edge case issues.\r\n       More info: h5bp.com/b/378 -->\r\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\r\n\r\n  <title>JavaScript的模式和反模式集合</title>\r\n  <meta name=\"description\" content=\"\">\r\n  <meta name=\"author\" content=\"\">\r\n\r\n  <!-- Mobile viewport optimized: h5bp.com/viewport -->\r\n  <meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\r\n\r\n  <!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->\r\n  <link href='http://fonts.googleapis.com/css?family=Tinos:400,700,400italic' rel='stylesheet' type='text/css'>\r\n  <link rel=\"stylesheet\" href=\"../css/style.css\">\r\n  \r\n  <!-- More ideas for your <head> here: h5bp.com/d/head-Tips -->\r\n\r\n  <!-- All JavaScript at the bottom, except this Modernizr build incl. Respond.js\r\n       Respond is a polyfill for min/max-width media queries. Modernizr enables HTML5 elements & feature detects; \r\n       for optimal performance, create your own custom Modernizr build: www.modernizr.com/download/ -->\r\n  <script src=\"../js/libs/modernizr-2.0.6.min.js\"></script>\r\n</head>\r\n\r\n<body>\r\n  <a class=\"fork\" href=\"https://github.com/shichuan/javascript-patterns\">\r\n    <img src=\"http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png\" alt=\"Fork me on GitHub\">\r\n   </a>\r\n  <header>\r\n    <div class=\"clearfix\">\r\n      <h1>JavaScript的模式集合</h1>\r\n      <div id=\"btns\">\r\n      <span  class='st_sina_hcount' displayText='Sina'></span><span  class='st_baidu_hcount' displayText='Baidu'></span><span  class='st_twitter_hcount' displayText='Tweet'></span><span  class='st_facebook_hcount' displayText='Facebook'></span><span  class='st_fblike_hcount' ></span><span  class='st_plusone_hcount' ></span>\r\n      </div>\r\n    </div>\r\n    <img src=\"../img/js-patterns-cn.png\" alt=\"JS Patterns\" title=\"JS Patterns\" />\r\n  </header>\r\n  <div role=\"main\">\r\n    <section id=\"intro\">\r\n      <p>A JavaScript pattern and antipattern code collection that covers function patterns, jQuery patterns, design patterns, general patterns, literals and constructor patterns, object creation patterns (<em>upcoming</em>), code reuse patterns (<em>upcoming</em>), DOM and browser patterns (<em>upcoming</em>).</p>\r\n      <p>Weekly roundups (pattern updates) will be regularly <a href=\"http://twitter.com/shichuan\">tweeted</a>.</p>\r\n    </section>\r\n    <section>\r\n      <h2>Function Patterns</h2>\r\n      <h3>API Patterns</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/callback.html\" target=\"_blank\">Callback patterns</a> - when you pass function A to function B as a parameter, function A is a callback function</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/configuration-objects.html\" target=\"_blank\">Configuration objects </a>- keep control of function arguments and makes it easily configurable</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/returning-functions.html\" target=\"_blank\">Returning functions </a>- one function returns another function or create another function on-demand</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/currying.html\" target=\"_blank\">Currying</a> - used to create new functions dynamically by partially applying a set of arguments</li>\r\n      </ul>\r\n      \r\n      <h3>Initialization patterns</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/immediate-functions.html\" target=\"_blank\">Immediate functions</a> - syntax that enables function execution as soon as it is defined</li> \r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/immediate-object-initialization.html\" target=\"_blank\">Immediate object initialization</a> - this pattern is mainly suitable for one-off tasks</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/init-time-branching.html\" target=\"_blank\">Init-time branching</a> - branch code once during initlization initialization</li>\r\n      </ul>\r\n      \r\n      <h3>Performance patterns</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/memoization.html\">Memoization</a> - use function properties to avoid repeated computation</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/self-defining-functions.html\">Self-defining functions</a> - self-overwrite with new bodies to do less work from the second invocation and after</li>\r\n      </ul>\r\n    </section>\r\n    \r\n    <section>\r\n      <h2>jQuery Patterns</h2>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/requery.html\" target=\"_blank\">requery</a> - avoid requery by using jQuery chaining</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/append.html\" target=\"_blank\">append</a> - use string concatenate and set innerHTML</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/data.html\" target=\"_blank\">data</a> - pattern and antipattern of using data</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/context-and-find.html\" target=\"_blank\">context and find</a> - use find over context</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/detach.html\" target=\"_blank\">detach</a> - take element off the DOM while manipulating them</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/event-delegation.html\" target=\"_blank\">event delegation</a> - event delegation pattern and antipattern</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/cache-selector.html\" target=\"_blank\">selector cache</a> - using selector cache to avoid requery</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/window-scroll-event.html\" target=\"_blank\">window scroll event</a> -  avoid attaching handlers to the window scroll event</li>\r\n      </ul>\r\n      <h3>Selector</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/left-and-right.html\" target=\"_blank\">Left and Right</a> - specific on the right, light on the left</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/decending-from-id.html\" target=\"_blank\">Decending from id</a> - be more specific</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/universal-selector.html\" target=\"_blank\">Universal Selector</a> - use of universal selector</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/specific-when-needed.html\" target=\"_blank\">Be Specific when Needed</a> - be specific only when needed</li>\r\n      </ul>\r\n    </section>\r\n    \r\n    <section>\r\n      <h2>Literals and Constructors Patterns</h2>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/literals-and-constructors/object-literal.html\" target=\"_blank\">Object literal</a> - use the simpler and reliable object literal instead of new Object();</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/literals-and-constructors/enforcing-new.html\" target=\"_blank\">Enforcing new</a> - when you forget `new`, `this` inside the constructor will point to the global object</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/literals-and-constructors/array-literal.html\" target=\"_blank\">Array literal</a> - use array literal notation to avoid potential errors when creating dynamic arrays at runtime</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/literals-and-constructors/json.html\" target=\"_blank\">Working with JSON</a> - use library from JSON.org, YUI, jQuery instead of eval for parsing</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/literals-and-constructors/primitive-wrappers.html\" target=\"_blank\">Primitive wrappers</a> - try to use the primitive without wrapper</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/literals-and-constructors/regular-expression-literal.html\" target=\"_blank\">Regular expression literal</a> - try to use the shorter literal notation</li>\r\n      </ul>\r\n    </section>\r\n    \r\n    <section>\r\n      <h2>Design Patterns</h2>\r\n      <h3>Creational</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/builder.html\" target=\"_blank\">Builder</a> - constructs complex objects by separating construction and representation</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/factory.html\" target=\"_blank\">Factory method</a> - creates objects without specifying the exact class to create</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/singleton.html\" target=\"_blank\">Singleton</a> - restricts object creation for a class to only one instance</li>\r\n      </ul>\r\n      <h3>Structural</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/decorator.html\" target=\"_blank\">Decorator</a> - dynamically adds/overrides behaviour in an existing method of an object</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/facade.html\" target=\"_blank\">Facade</a> - provides a simplified interface to a large body of code</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/proxy.html\" target=\"_blank\">Proxy</a> - provides a placeholder for another object to control access, reduce cost, and reduce complexity</li>\r\n      </ul>\r\n      <h3>Behavioral</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/chain-of-responsibility.html\" target=\"_blank\">Chain of responsibility</a> - delegates commands to a chain of processing objects</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/command.html\" target=\"_blank\">Command</a> - creates objects which encapsulate actions and parameters</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/iterator.html\" target=\"_blank\">Iterator</a> - implements a specialized language</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/mediator.html\" target=\"_blank\">Mediator</a> - allows loose coupling between classes by being the only class that has detailed knowledge of their methods</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/observer.html\" target=\"_blank\">Observer</a> - is a publish/subscribe pattern which allows a number of observer objects to see an event</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/strategy.html\" target=\"_blank\">Strategy</a> - allows one of a family of algorithms to be selected on-the-fly at runtime</li>\r\n      </ul>\r\n    </section>\r\n    \r\n    <section>\r\n      <h2>General Patterns</h2>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/minimizing-globals.html\" target=\"_blank\">Minimizing Globals</a> - create and access a global variable in a browser environment</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/globals.html\" target=\"_blank\">The Problem with Globals</a> - various problems with globals</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/access-to-global-object.html\" target=\"_blank\">Access to the Global Object</a> - access the global object without hard-coding the identifier window</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/single-var-pattern.html\" target=\"_blank\">Single var Pattern</a> - use one var statement and declare multiple variables</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/hoisting.html\" target=\"_blank\">Hoisting</a> - var statements anywhere in a function act as if the variables were declared at the top of the function</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/for-loops.html\" target=\"_blank\">for loops</a> - optimized for loops</li> \r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/for-in-loops.html\" target=\"_blank\">for-in loops</a> - optimized for-in loops</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/built-in-prototypes.html\" target=\"_blank\">(Not) Augmenting Built-in Prototypes</a> - only augment built-in prototypes when certain conditions are met</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/switch-pattern.html\" target=\"_blank\">switch Pattern</a> - improve the readability and robustness of your switch statements</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/avoiding-implied-typecasting.html\" target=\"_blank\">Implied Typecasting</a> - avoid implied typecasting</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/avoiding-eval.html\" target=\"_blank\">Avoiding eval()</a> - avoid using eval()</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/parseint.html\" target=\"_blank\">Number Conversions with parseInt()</a> - use the second radix parameter</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/conditionals.html\" target=\"_blank\">Conditionals</a> - pattern and antipattern of using if else</li>\r\n      </ul>\r\n    </section>\r\n    \r\n    <section>\r\n      <h2><em>References</em></h2>\r\n      <ol>    \r\n        <li>\r\n        The Essentials of Writing High Quality JavaScript<br />\r\n        <a href=\"http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/\" target=\"_blank\">http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/</a>\r\n        </li>\r\n        <li>\r\n        JSPatterns<br />\r\n        <a href=\"http://www.jspatterns.com/\" target=\"_blank\">http://www.jspatterns.com/</a>\r\n        </li>\r\n        <li>\r\n        jQuery Anti-Patterns for Performance & Compression<br />\r\n        <a href=\"http://paulirish.com/2009/perf/\" target=\"_blank\">http://paulirish.com/2009/perf/</a>\r\n        </li>\r\n        <li>\r\n        How DRY Affects JavaScript Performance<br />\r\n        <a href=\"http://velocityconf.com/velocityeu/public/schedule/detail/21634\" target=\"_blank\">http://velocityconf.com/velocityeu/public/schedule/detail/21634</a>\r\n        </li>\r\n        <li>\r\n        Object Oriented JavaScript<br />\r\n        <a href=\"http://www.packtpub.com/object-oriented-javascript/book\" target=\"_blank\">http://www.packtpub.com/object-oriented-javascript/book</a>\r\n        </li>\r\n        <li>\r\n        JavaScript Patterns<br />\r\n        <a href=\"http://shop.oreilly.com/product/9780596806767.do\" target=\"_blank\">http://shop.oreilly.com/product/9780596806767.do</a>\r\n        </li>\r\n        <li>\r\n        JavaScript: The Good Parts<br />\r\n        <a href=\"http://shop.oreilly.com/product/9780596517748.do\" target=\"_blank\">http://shop.oreilly.com/product/9780596517748.do</a>\r\n        </li>\r\n        <li>\r\n        Pro JavaScript Design Patterns<br />\r\n        <a href=\"http://jsdesignpatterns.com/\" target=\"_blank\">http://jsdesignpatterns.com/</a>\r\n        </li>\r\n        <li>\r\n        Essential JavaScript Design Patterns For Beginners, Volume 1.<br />\r\n        <a href=\"http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/\" target=\"_blank\">http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/</a>\r\n        </li>\r\n        <li>\r\n        Eloquent JavaScript<br />\r\n        <a href=\"http://eloquentjavascript.net/\" target=\"_blank\">http://eloquentjavascript.net/</a>\r\n        </li>\r\n      </ol>\r\n    </section>\r\n  </div>\r\n  <footer>\r\n    by <a href=\"http://twitter.com/#!/shichuan\">@shichuan</a>\r\n  </footer>\r\n\r\n\r\n  <!-- JavaScript at the bottom for fast page loading -->\r\n\r\n  <!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->\r\n  <script src=\"//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js\"></script>\r\n  <script>window.jQuery || document.write('<script src=\"../js/libs/jquery-1.6.4.min.js\"><\\/script>')</script>\r\n\r\n\r\n  <!-- scripts concatenated and minified via build script -->\r\n  <script type=\"text/javascript\">var switchTo5x=true;</script><script type=\"text/javascript\" src=\"http://w.sharethis.com/button/buttons.js\"></script><script type=\"text/javascript\">stLight.options({publisher:'44fc3536-fd12-4c07-970d-6654da9a2d6c'});</script>\r\n  <!-- end scripts -->\r\n\r\n\r\n  <!-- Asynchronous Google Analytics snippet. Change UA-XXXXX-X to be your site's ID.\r\n       mathiasbynens.be/notes/async-analytics-snippet -->\r\n  <script>\r\n    var _gaq=[['_setAccount','UA-2773745-18'],['_trackPageview'],['_trackPageLoadTime']];\r\n    (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];\r\n    g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';\r\n    s.parentNode.insertBefore(g,s)}(document,'script'));\r\n  </script>\r\n\r\n  <!-- Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6.\r\n       chromium.org/developers/how-tos/chrome-frame-getting-started -->\r\n  <!--[if lt IE 7 ]>\r\n    <script defer src=\"//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js\"></script>\r\n    <script defer>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>\r\n  <![endif]-->\r\n\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "code-reuse-patterns/borrowing-methods.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Borrowing Methods\n\t\t\t Description: reuse one or two methods of an existing object without forming a parent-child relationship with that object\n\t\t\t */\n\n\t\t\tfunction f() {\n\t\t\t\tvar args = [].slice.call(arguments, 1, 3);\n\t\t\t\treturn args;\n\t\t\t}\n\n\t\t\tvar one = {\n\t\t\t\tname:'object',\n\t\t\t\tsay:function (greet) {\n\t\t\t\t\treturn greet + ', ' + this.name;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// test\n\t\t\tconsole.log(one.say('hi')); // \"hi, object\"\n\n\t\t\tvar two = {\n\t\t\t\tname:'another object'\n\t\t\t};\n\t\t\t\n\t\t\t// apply two to original object one.\n\t\t\tconsole.log(one.say.apply(two, ['hello'])); // \"hello, another object\"\n\n\t\t\t// assigning to a variable\n\t\t\t// `this` will point to the global object\n\t\t\tvar say = one.say;\n\t\t\tconsole.log(say('hoho')); // \"hoho, undefined\"\n\n\t\t\t// passing as a callback\n\t\t\tvar yetanother = {\n\t\t\t\tname:'Yet another object',\n\t\t\t\tmethod:function (callback) {\n\t\t\t\t\treturn callback('Hola');\n\t\t\t\t}\n\t\t\t};\n\t\t\tconsole.log(yetanother.method(one.say)); // \"Hola, undefined\"\n\n\t\t\tfunction bind(o, m) {\n\t\t\t\treturn function () {\n\t\t\t\t\treturn m.apply(o, [].slice.call(arguments));\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tvar twosay = bind(two, one.say);\n\t\t\tconsole.log(twosay('yo')); // \"yo, another object\"\n\n\n\t\t\t// ECMAScript 5 adds a method bind() to Function.prototype, making it just as easy to use as apply() and call().\n\n\t\t\tif (typeof Function.prototype.bind === 'undefined') {\n\t\t\t\tFunction.prototype.bind = function (thisArg) {\n\t\t\t\t\tvar fn = this,\n\t\t\t\t\t\t\tslice = Array.prototype.slice,\n\t\t\t\t\t\t\targs = slice.call(arguments, 1);\n\t\t\t\t\treturn function () {\n\t\t\t\t\t\treturn fn.apply(thisArg, args.concat(slice.call(arguments)));\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tvar twosay2 = one.say.bind(two);\n\t\t\tconsole.log(twosay2('Bonjour')); // \"Bonjour, another object\"\n\n\t\t\tvar twosay3 = one.say.bind(two, 'Enchanté');\n\t\t\tconsole.log(twosay3()); // \"Enchanté, another object\"\n\n\n\t\t\t// reference\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "code-reuse-patterns/cp1-default.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Classical Pattern #1 - The Default Pattern (a pattern that should be generally avoided)\n\t\t\t Description: create an object using the Parent() constructor and assign this object to the Child()'s prototype\n\t\t\t */\n\n\t\t\tfunction inherit(C, P) {\n\t\t\t\tC.prototype = new P();\n\t\t\t}\n\n\t\t\t// the parent constructor\n\t\t\tfunction Parent(name) {\n\t\t\t\tthis.name = name || 'Adam';\n\t\t\t}\n\t\t\t// adding functionality to the prototype\n\t\t\tParent.prototype.say = function () {\n\t\t\t\treturn this.name;\n\t\t\t};\n\t\t\t// empty child constructor\n\t\t\tfunction Child(name) {\n\t\t\t}\n\n\t\t\t// inheritance magic happens here\n\t\t\tinherit(Child, Parent);\n\n\t\t\tvar kid = new Child();\n\t\t\tconsole.log(kid.say()); // \"Adam\"\n\n\t\t\t// Drawback 1: own properties added to `this` is inherited\n\t\t\tvar kiddo = new Child();\n\t\t\tkiddo.name = \"Patrick\";\n\t\t\tconsole.log(kiddo.say()); // \"Patrick\"\n\n\n\t\t\t// Drawback 2: it doesn't enable you to pass parameters to the child constructor\n\t\t\tvar s = new Child('Seth');\n\t\t\tconsole.log(s.say()); // \"Adam\"\n\n\n\t\t\t// reference\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "code-reuse-patterns/cp2-rent-a-constructor.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Classical Pattern #2 - Rent a Constructor (a pattern that should be generally avoided)\n\t\t\t Description: it borrows the parent constructor, passing the child object to be bound to this and also forwarding any arguments\n\t\t\t */\n\n\t\t\t// the parent constructor\n\t\t\tfunction Parent(name) {\n\t\t\t\tthis.name = name || 'Adam';\n\t\t\t}\n\n\t\t\t// adding functionality to the prototype\n\t\t\tParent.prototype.say = function () {\n\t\t\t\treturn this.name;\n\t\t\t};\n\n\t\t\t// child constructor\n\t\t\tfunction Child(name) {\n\t\t\t\tParent.apply(this, arguments);\n\t\t\t}\n\n\t\t\tvar kid = new Child(\"Patrick\");\n\t\t\tconsole.log(kid.name); // \"Patrick\"\n\n\t\t\t// Drawback 1: nothing from the prototype gets inherited\n\t\t\tconsole.log(typeof kid.say); // \"undefined\"\n\n\t\t\t// Multiple Inheritance by Borrowing Constructors\n\t\t\tfunction Cat() {\n\t\t\t\tthis.legs = 4;\n\t\t\t\tthis.say = function () {\n\t\t\t\t\treturn \"meaowww\";\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfunction Bird() {\n\t\t\t\tthis.wings = 2;\n\t\t\t\tthis.fly = true;\n\t\t\t}\n\n\t\t\tfunction CatWings() {\n\t\t\t\tCat.apply(this);\n\t\t\t\tBird.apply(this);\n\t\t\t}\n\n\t\t\tvar jane = new CatWings();\n\t\t\tconsole.dir(jane);\n\n\n\t\t\t// reference\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "code-reuse-patterns/cp3-rent-and-set-prototype.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Classical Pattern #3 - Rent and Set Prototype (a pattern that should be generally avoided)\n\t\t\t Description: first borrow the constructor and then also set the child's prototype to point to a new instance of the constructor\n\t\t\t */\n\n\t\t\t// the parent constructor\n\t\t\tfunction Parent(name) {\n\t\t\t\tthis.name = name || 'Adam';\n\t\t\t}\n\n\t\t\t// adding functionality to the prototype\n\t\t\tParent.prototype.say = function () {\n\t\t\t\treturn this.name;\n\t\t\t};\n\n\t\t\t// child constructor\n\t\t\tfunction Child(name) {\n\t\t\t\tParent.apply(this, arguments);\n\t\t\t}\n\n\t\t\tChild.prototype = new Parent();\n\n\t\t\tvar kid = new Child(\"Patrick\");\n\t\t\tconsole.log(kid.name); // \"Patrick\"\n\t\t\tconsole.log(typeof kid.say); // function\n\t\t\tconsole.log(kid.say()); // Patrick\n\t\t\tconsole.dir(kid);\n\t\t\tdelete kid.name;\n\t\t\tconsole.log(kid.say()); // \"Adam\"\n\n\t\t\t// Drawback - the parent constructor is called twice, so it could be inefficient\n\n\n\t\t\t// reference\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "code-reuse-patterns/cp4-share-the-prototype.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Classical Pattern #3 - Share the Prototype (a pattern that should be generally avoided)\n\t\t\t Description: first borrow the constructor and then also set the child's prototype to point to a new instance of the constructor\n\t\t\t */\n\n\t\t\tfunction inherit(C, P) {\n\t\t\t\tC.prototype = P.prototype;\n\t\t\t}\n\n\t\t\t// the parent constructor\n\t\t\tfunction Parent(name) {\n\t\t\t\tthis.name = name || 'Adam';\n\t\t\t}\n\n\t\t\t// adding functionality to the prototype\n\t\t\tParent.prototype.say = function () {\n\t\t\t\treturn this.name;\n\t\t\t};\n\n\t\t\t// child constructor\n\t\t\tfunction Child(name) {\n\t\t\t}\n\n\t\t\tinherit(Child, Parent);\n\n\t\t\tvar kid = new Child('Patrick');\n\t\t\tconsole.log(kid.name); // undefined\n\t\t\tconsole.log(typeof kid.say); // function\n\t\t\tkid.name = 'Patrick';\n\t\t\tconsole.log(kid.say()); // Patrick\n\t\t\tconsole.dir(kid);\n\n\n\t\t\t// reference\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "code-reuse-patterns/cp5-a-temporary-constructor.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Classical Pattern #5 - A Temporary Constructor (a pattern that should be generally avoided)\n\t\t\t Description: first borrow the constructor and then also set the child's prototype to point to a new instance of the constructor\n\t\t\t */\n\n\t\t\t/* Basic */\n\t\t\t/*function inherit(C, P) {\n\t\t\t var F = function () {};\n\t\t\t F.prototype = P.prototype;\n\t\t\t C.prototype = new F();\n\t\t\t }*/\n\n\t\t\t/* Storing the Superclass */\n\t\t\t/*function inherit(C, P) {\n\t\t\t var F = function () {};\n\t\t\t F.prototype = P.prototype;\n\t\t\t C.prototype = new F();\n\t\t\t C.uber = P.prototype;\n\t\t\t }*/\n\n\t\t\t/* Resetting the Constructor Pointer */\n\t\t\t/*function inherit(C, P) {\n\t\t\t var F = function () {};\n\t\t\t F.prototype = P.prototype;\n\t\t\t C.prototype = new F();\n\t\t\t C.uber = P.prototype;\n\t\t\t C.prototype.constructor = C;\n\t\t\t }*/\n\n\t\t\t/* in closure */\n\t\t\tvar inherit = (function () {\n\t\t\t\tvar F = function () {\n\t\t\t\t};\n\t\t\t\treturn function (C, P) {\n\t\t\t\t\tF.prototype = P.prototype;\n\t\t\t\t\tC.prototype = new F();\n\t\t\t\t\tC.uber = P.prototype;\n\t\t\t\t\tC.prototype.constructor = C;\n\t\t\t\t}\n\t\t\t}());\n\n\t\t\tfunction Parent(name) {\n\t\t\t\tthis.name = name || 'Adam';\n\t\t\t}\n\n\t\t\t// adding functionality to the prototype\n\t\t\tParent.prototype.say = function () {\n\t\t\t\treturn this.name;\n\t\t\t};\n\n\t\t\t// child constructor\n\t\t\tfunction Child(name) {\n\t\t\t}\n\n\t\t\tinherit(Child, Parent);\n\n\t\t\tvar kid = new Child();\n\t\t\tconsole.log(kid.name); // undefined\n\t\t\tconsole.log(typeof kid.say); // function\n\t\t\tkid.name = 'Patrick';\n\t\t\tconsole.log(kid.say()); // Patrick\n\t\t\tconsole.log(kid.constructor.name); // Child\n\t\t\tconsole.log(kid.constructor === Parent); // false\n\n\n\t\t\t// reference\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "code-reuse-patterns/inheritance-by-copying-properties.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Inheritance by Copying Properties\n\t\t\t Description: an object gets functionality from another object, simply by copying it\n\t\t\t */\n\n\t\t\t/* shallow copy */\n\t\t\tfunction extend(parent, child) {\n\t\t\t\tvar i;\n\t\t\t\tchild = child || {};\n\t\t\t\tfor (i in parent) {\n\t\t\t\t\tif (parent.hasOwnProperty(i)) {\n\t\t\t\t\t\tchild[i] = parent[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn child;\n\t\t\t}\n\n\t\t\tvar dad = {name:\"Adam\"};\n\t\t\tvar kid = extend(dad);\n\t\t\tconsole.log(kid.name); // \"Adam\"\n\n\t\t\tvar dad = {\n\t\t\t\tcounts:[1, 2, 3],\n\t\t\t\treads:{paper:true}\n\t\t\t};\n\t\t\tvar kid = extend(dad);\n\t\t\tkid.counts.push(4);\n\t\t\tconsole.log(dad.counts.toString()); // \"1,2,3,4\"\n\t\t\tconsole.log(dad.reads === kid.reads); // true\n\n\n\t\t\t/* deep copy */\n\t\t\tfunction extendDeep(parent, child) {\n\t\t\t\tvar i,\n\t\t\t\t\t\ttoStr = Object.prototype.toString,\n\t\t\t\t\t\tastr = \"[object Array]\";\n\n\t\t\t\tchild = child || {};\n\n\t\t\t\tfor (i in parent) {\n\t\t\t\t\tif (parent.hasOwnProperty(i)) {\n\t\t\t\t\t\tif (typeof parent[i] === 'object') {\n\t\t\t\t\t\t\tchild[i] = (toStr.call(parent[i]) === astr) ? [] : {};\n\t\t\t\t\t\t\textendDeep(parent[i], child[i]);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchild[i] = parent[i];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn child;\n\t\t\t}\n\n\t\t\tvar dad = {\n\t\t\t\tcounts:[1, 2, 3],\n\t\t\t\treads:{paper:true}\n\t\t\t};\n\t\t\tvar kid = extendDeep(dad);\n\n\t\t\tkid.counts.push(4);\n\t\t\tconsole.log(kid.counts.toString()); // \"1,2,3,4\"\n\t\t\tconsole.log(dad.counts.toString()); // \"1,2,3\"\n\n\t\t\tconsole.log(dad.reads === kid.reads); // false\n\t\t\tkid.reads.paper = false;\n\n\n\t\t\t// reference\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "code-reuse-patterns/klass.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Klass (a pattern that should be generally avoided)\n\t\t\t Description: generally a pattern that should be avoided unless one is more comfortable with class than prototype\n\t\t\t */\n\n\t\t\t// Drawback: it brings the whole confusing notion of classes, which don’t technically exist in the language\n\n\t\t\t// Benefit: you can tweak the syntax and the conventions to resemble another of your favorite languages\n\n\t\t\tvar klass = function (Parent, props) {\n\n\t\t\t\tvar Child, F, i;\n\n\t\t\t\t// 1.\n\t\t\t\t// new constructor\n\t\t\t\tChild = function () {\n\t\t\t\t\tif (Child.uber && Child.uber.hasOwnProperty(\"__construct\")) {\n\t\t\t\t\t\tChild.uber.__construct.apply(this, arguments);\n\t\t\t\t\t}\n\t\t\t\t\tif (Child.prototype.hasOwnProperty(\"__construct\")) {\n\t\t\t\t\t\tChild.prototype.__construct.apply(this, arguments);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\t// 2.\n\t\t\t\t// inherit\n\t\t\t\tParent = Parent || Object;\n\t\t\t\tF = function () {\n\t\t\t\t};\n\t\t\t\tF.prototype = Parent.prototype;\n\t\t\t\tChild.prototype = new F();\n\t\t\t\tChild.uber = Parent.prototype;\n\t\t\t\tChild.prototype.constructor = Child;\n\n\t\t\t\t// 3.\n\t\t\t\t// add implementation methods\n\t\t\t\tfor (i in props) {\n\t\t\t\t\tif (props.hasOwnProperty(i)) {\n\t\t\t\t\t\tChild.prototype[i] = props[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// return the \"class\"\n\t\t\t\treturn Child;\n\t\t\t};\n\n\t\t\tvar Man = klass(null, {\n\t\t\t\t__construct:function (what) {\n\t\t\t\t\tconsole.log(\"Man's constructor\");\n\t\t\t\t\tthis.name = what;\n\t\t\t\t},\n\t\t\t\tgetName:function () {\n\t\t\t\t\treturn this.name;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tvar first = new Man('Adam'); // logs \"Man's constructor\"\n\t\t\tfirst.getName(); // \"Adam\"\n\n\t\t\tvar SuperMan = klass(Man, {\n\t\t\t\t__construct:function (what) {\n\t\t\t\t\tconsole.log(\"SuperMan's constructor\");\n\t\t\t\t},\n\t\t\t\tgetName:function () {\n\t\t\t\t\tvar name = SuperMan.uber.getName.call(this);\n\t\t\t\t\treturn \"I am \" + name;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tvar clark = new SuperMan('Clark Kent');\n\t\t\tclark.getName(); // \"I am Clark Kent\"\n\n\t\t\tconsole.log(clark instanceof Man); // true\n\t\t\tconsole.log(clark instanceof SuperMan); // true\n\n\t\t\t/* Title: Classical Pattern #5 - A Temporary Constructor (a pattern that should be generally avoided)\n\t\t\t Description: first borrow the constructor and then also set the child's prototype to point to a new instance of the constructor\n\t\t\t */\n\n\t\t\t/* Basic */\n\t\t\t/*function inherit(C, P) {\n\t\t\t var F = function () {};\n\t\t\t F.prototype = P.prototype;\n\t\t\t C.prototype = new F();\n\t\t\t }*/\n\n\t\t\t/* Storing the Superclass */\n\t\t\t/*function inherit(C, P) {\n\t\t\t var F = function () {};\n\t\t\t F.prototype = P.prototype;\n\t\t\t C.prototype = new F();\n\t\t\t C.uber = P.prototype;\n\t\t\t }*/\n\n\t\t\t/* Resetting the Constructor Pointer */\n\t\t\t/*function inherit(C, P) {\n\t\t\t var F = function () {};\n\t\t\t F.prototype = P.prototype;\n\t\t\t C.prototype = new F();\n\t\t\t C.uber = P.prototype;\n\t\t\t C.prototype.constructor = C;\n\t\t\t }*/\n\n\t\t\t/* in closure */\n\t\t\tvar inherit = (function () {\n\t\t\t\tvar F = function () {\n\t\t\t\t};\n\t\t\t\treturn function (C, P) {\n\t\t\t\t\tF.prototype = P.prototype;\n\t\t\t\t\tC.prototype = new F();\n\t\t\t\t\tC.uber = P.prototype;\n\t\t\t\t\tC.prototype.constructor = C;\n\t\t\t\t}\n\t\t\t}());\n\n\t\t\tfunction Parent(name) {\n\t\t\t\tthis.name = name || 'Adam';\n\t\t\t}\n\n\t\t\t// adding functionality to the prototype\n\t\t\tParent.prototype.say = function () {\n\t\t\t\treturn this.name;\n\t\t\t};\n\n\t\t\t// child constructor\n\t\t\tfunction Child(name) {\n\t\t\t}\n\n\t\t\tinherit(Child, Parent);\n\n\t\t\tvar kid = new Child();\n\t\t\tconsole.log(kid.name); // undefined\n\t\t\tconsole.log(typeof kid.say); // function\n\t\t\tkid.name = 'Patrick';\n\t\t\tconsole.log(kid.say()); // Patrick\n\t\t\tconsole.log(kid.constructor.name); // Child\n\t\t\tconsole.log(kid.constructor === Parent); // false\n\n\n\t\t\t// reference\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "code-reuse-patterns/mix-ins.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Mix-ins\n\t\t\t Description: copy from any number of objects and mix them all into a new object\n\t\t\t */\n\n\t\t\tfunction mix() {\n\t\t\t\tvar arg, prop, child = {};\n\t\t\t\tfor (arg = 0; arg < arguments.length; arg += 1) {\n\t\t\t\t\tfor (prop in arguments[arg]) {\n\t\t\t\t\t\tif (arguments[arg].hasOwnProperty(prop)) {\n\t\t\t\t\t\t\tchild[prop] = arguments[arg][prop];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn child;\n\t\t\t}\n\n\t\t\tvar cake = mix(\n\t\t\t\t\t{eggs:2, large:true},\n\t\t\t\t\t{butter:1, salted:true},\n\t\t\t\t\t{flour:'3 cups'},\n\t\t\t\t\t{sugar:'sure!'}\n\t\t\t);\n\n\t\t\tconsole.dir(cake);\n\n\n\t\t\t// reference\n\t\t\t// http://addyosmani.com/resources/essentialjsdesignpatterns/book/#mixinpatternjavascript\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "code-reuse-patterns/prototypal-inheritance.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Prototypal Inheritance\n\t\t\t Description: objects inherit from other objects\n\t\t\t */\n\n\t\t\tfunction object(o) {\n\t\t\t\tfunction F() {\n\t\t\t\t}\n\n\t\t\t\tF.prototype = o;\n\t\t\t\treturn new F();\n\t\t\t}\n\n\t\t\t// object to inherit from\n\t\t\tvar parent = {\n\t\t\t\tname:\"Papa\"\n\t\t\t};\n\n\t\t\t// the new object\n\t\t\tvar child = object(parent);\n\n\t\t\t// testing\n\t\t\tconsole.log(child.name); // \"Papa\"\n\n\n\t\t\t// parent constructor\n\t\t\tfunction Person() {\n\t\t\t\t// an \"own\" property\n\t\t\t\tthis.name = \"Adam\";\n\t\t\t}\n\t\t\t// a property added to the prototype\n\t\t\tPerson.prototype.getName = function () {\n\t\t\t\treturn this.name;\n\t\t\t};\n\n\t\t\t// create a new person\n\t\t\tvar papa = new Person();\n\n\t\t\t// inherit\n\t\t\tvar kid = object(papa);\n\n\t\t\t// test that both the own property\n\t\t\t// and the prototype property were inherited\n\t\t\tconsole.log(kid.getName()); // \"Adam\"\n\n\t\t\t// parent constructor\n\t\t\tfunction Person() {\n\t\t\t\t// an \"own\" property\n\t\t\t\tthis.name = \"Adam\";\n\t\t\t}\n\n\t\t\t// a property added to the prototype\n\t\t\tPerson.prototype.getName = function () {\n\t\t\t\treturn this.name;\n\t\t\t};\n\n\t\t\t// inherit\n\t\t\tvar kid = object(Person.prototype);\n\t\t\tconsole.log(typeof kid.getName); // \"function\", because it was in the prototype\n\t\t\tconsole.log(typeof kid.name); // \"undefined\", because only the prototype was inherited\n\n\t\t\t/* Addition to ECMAScript 5 */\n\t\t\tvar child = Object.create(parent);\n\n\t\t\tvar child = Object.create(parent, {\n\t\t\t\tage:{ value:2 } // ECMA5 descriptor\n\t\t\t});\n\t\t\tconsole.log(child.hasOwnProperty(\"age\")); // true\n\n\n\t\t\t// reference\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "css/style.css",
    "content": "/*\r\n * HTML5 ✰ Boilerplate\r\n *\r\n * What follows is the result of much research on cross-browser styling.\r\n * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,\r\n * Kroc Camen, and the H5BP dev community and team.\r\n *\r\n * Detailed information about this CSS: h5bp.com/css\r\n *\r\n * ==|== normalize ==========================================================\r\n */\r\n\r\n\r\n/* =============================================================================\r\n   HTML5 display definitions\r\n   ========================================================================== */\r\n\r\narticle, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; }\r\naudio, canvas, video { display: inline-block; *display: inline; *zoom: 1; }\r\naudio:not([controls]) { display: none; }\r\n[hidden] { display: none; }\r\n\r\n\r\n/* =============================================================================\r\n   Base\r\n   ========================================================================== */\r\n\r\n/*\r\n * 1. Correct text resizing oddly in IE6/7 when body font-size is set using em units\r\n * 2. Force vertical scrollbar in non-IE\r\n * 3. Prevent iOS text size adjust on device orientation change, without disabling user zoom: h5bp.com/g\r\n */\r\n\r\nhtml { font-size: 100%; overflow-y: scroll; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }\r\n\r\nbody { margin: 0; font-size: 1em; line-height: 1.4; }\r\n\r\nbody, button, input, select, textarea { font-family: sans-serif; color: #222; }\r\n\r\n/*\r\n * Remove text-shadow in selection highlight: h5bp.com/i\r\n * These selection declarations have to be separate\r\n * Also: hot pink! (or customize the background color to match your design)\r\n */\r\n\r\n::-moz-selection { background: #fe57a1; color: #fff; text-shadow: none; }\r\n::selection { background: #fe57a1; color: #fff; text-shadow: none; }\r\n\r\n\r\n/* =============================================================================\r\n   Links\r\n   ========================================================================== */\r\n\r\na { color: #06e; }\r\na:visited { color: #06e; }\r\na:hover { color: #06e; }\r\na:focus { outline: thin dotted; }\r\n\r\n/* Improve readability when focused and hovered in all browsers: h5bp.com/h */\r\na:hover, a:active { outline: 0; }\r\n\r\n\r\n/* =============================================================================\r\n   Typography\r\n   ========================================================================== */\r\n\r\nabbr[title] { border-bottom: 1px dotted; }\r\n\r\nb, strong { font-weight: bold; }\r\n\r\nblockquote { margin: 1em 40px; }\r\n\r\ndfn { font-style: italic; }\r\n\r\nhr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; }\r\n\r\nins { background: #ff9; color: #000; text-decoration: none; }\r\n\r\nmark { background: #ff0; color: #000; font-style: italic; font-weight: bold; }\r\n\r\n/* Redeclare monospace font family: h5bp.com/j */\r\npre, code, kbd, samp { font-family: monospace, serif; _font-family: 'courier new', monospace; font-size: 1em; }\r\n\r\n/* Improve readability of pre-formatted text in all browsers */\r\npre { white-space: pre; white-space: pre-wrap; word-wrap: break-word; }\r\n\r\nq { quotes: none; }\r\nq:before, q:after { content: \"\"; content: none; }\r\n\r\nsmall { font-size: 85%; }\r\n\r\n/* Position subscript and superscript content without affecting line-height: h5bp.com/k */\r\nsub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; }\r\nsup { top: -0.5em; }\r\nsub { bottom: -0.25em; }\r\n\r\n\r\n/* =============================================================================\r\n   Lists\r\n   ========================================================================== */\r\n\r\nul, ol { margin: 1em 0; padding: 0 0 0 40px; }\r\ndd { margin: 0 0 0 40px; }\r\nnav ul, nav ol { list-style: none; list-style-image: none; margin: 0; padding: 0; }\r\n\r\n\r\n/* =============================================================================\r\n   Embedded content\r\n   ========================================================================== */\r\n\r\n/*\r\n * 1. Improve image quality when scaled in IE7: h5bp.com/d\r\n * 2. Remove the gap between images and borders on image containers: h5bp.com/e\r\n */\r\n\r\nimg { border: 0; -ms-interpolation-mode: bicubic; vertical-align: middle; }\r\n\r\n/*\r\n * Correct overflow not hidden in IE9\r\n */\r\n\r\nsvg:not(:root) { overflow: hidden; }\r\n\r\n\r\n/* =============================================================================\r\n   Figures\r\n   ========================================================================== */\r\n\r\nfigure { margin: 0; }\r\n\r\n\r\n/* =============================================================================\r\n   Forms\r\n   ========================================================================== */\r\n\r\nform { margin: 0; }\r\nfieldset { border: 0; margin: 0; padding: 0; }\r\n\r\n/* Indicate that 'label' will shift focus to the associated form element */\r\nlabel { cursor: pointer; }\r\n\r\n/*\r\n * 1. Correct color not inheriting in IE6/7/8/9\r\n * 2. Correct alignment displayed oddly in IE6/7\r\n */\r\n\r\nlegend { border: 0; *margin-left: -7px; padding: 0; }\r\n\r\n/*\r\n * 1. Correct font-size not inheriting in all browsers\r\n * 2. Remove margins in FF3/4 S5 Chrome\r\n * 3. Define consistent vertical alignment display in all browsers\r\n */\r\n\r\nbutton, input, select, textarea { font-size: 100%; margin: 0; vertical-align: baseline; *vertical-align: middle; }\r\n\r\n/*\r\n * 1. Define line-height as normal to match FF3/4 (set using !important in the UA stylesheet)\r\n */\r\n\r\nbutton, input { line-height: normal; }\r\n\r\n/*\r\n * 1. Display hand cursor for clickable form elements\r\n * 2. Allow styling of clickable form elements in iOS\r\n * 3. Correct inner spacing displayed oddly in IE7 (doesn't effect IE6)\r\n */\r\n\r\nbutton, input[type=\"button\"], input[type=\"reset\"], input[type=\"submit\"] { cursor: pointer; -webkit-appearance: button; *overflow: visible; }\r\n\r\n/*\r\n * Consistent box sizing and appearance\r\n */\r\n\r\ninput[type=\"checkbox\"], input[type=\"radio\"] { box-sizing: border-box; padding: 0; }\r\ninput[type=\"search\"] { -webkit-appearance: textfield; -moz-box-sizing: content-box; -webkit-box-sizing: content-box; box-sizing: content-box; }\r\ninput[type=\"search\"]::-webkit-search-decoration { -webkit-appearance: none; }\r\n\r\n/*\r\n * Remove inner padding and border in FF3/4: h5bp.com/l\r\n */\r\n\r\nbutton::-moz-focus-inner, input::-moz-focus-inner { border: 0; padding: 0; }\r\n\r\n/*\r\n * 1. Remove default vertical scrollbar in IE6/7/8/9\r\n * 2. Allow only vertical resizing\r\n */\r\n\r\ntextarea { overflow: auto; vertical-align: top; resize: vertical; }\r\n\r\n/* Colors for form validity */\r\ninput:valid, textarea:valid {  }\r\ninput:invalid, textarea:invalid { background-color: #f0dddd; }\r\n\r\n\r\n/* =============================================================================\r\n   Tables\r\n   ========================================================================== */\r\n\r\ntable { border-collapse: collapse; border-spacing: 0; }\r\ntd { vertical-align: top; }\r\n\r\n\r\n/* ==|== primary styles =====================================================\r\n   Author: Shi Chuan\r\n   ========================================================================== */\r\n\r\n.fork img {\r\n    position: absolute;\r\n    top: 0;\r\n    right: 0;\r\n}\r\n\r\nhtml {\r\n  background:#F8FAF0;\r\n  -webkit-box-sizing: border-box;\r\n  -moz-box-sizing: border-box;\r\n  -ms-box-sizing: border-box;\r\n  box-sizing: border-box;\r\n  font-size: 100%;\r\n}\r\n\r\nbody {\r\n  margin:0 auto;\r\n  padding: 1em;\r\n  word-wrap: break-word;\r\n  word-break: break-word;\r\n}\r\n\r\nheader {\r\n  position: relative;\r\n  margin-top: 2em;\r\n  margin-bottom: 1em;\r\n}\r\n\r\nheader img {padding-top:5px; border-top:1px solid #ccc; display:block;}\r\n\r\nh1, h2, h3 {font-family: 'Tinos', serif; padding:0; margin:0;}\r\n\r\nh1 {\r\n  font-size: 1.6em;\r\n  float:left; \r\n  margin-top:7px;\r\n}\r\n#btns {float:right; margin-bottom:10px;}\r\n\r\n#btns span {display:block; float:left;}\r\n.st_sharethis {margin-top:2px;}\r\nh2 {\r\n  font-size: 1.4em;\r\n  display:block;\r\n  padding-bottom:0.5em;\r\n  border-bottom:1px solid #ccc;\r\n  margin-bottom:1em;\r\n  margin-top:1.5em;\r\n}\r\nh3 {\r\n  font-size: 1.2em;\r\n  color:#555;\r\n}\r\na {\r\n  text-decoration:none;\r\n  \r\n}\r\n\r\nul, ul li {\r\n  list-style:none; margin-left:0; padding-left:10px; color:#444;\r\n}\r\n\r\nul { \r\n  margin-bottom:1em;\r\n}\r\n\r\nli {\r\n  margin-bottom:0.5em;\r\n}\r\n\r\niframe,\r\nobject,\r\nembed,\r\nimg {\r\n  max-width: 100%;\r\n}\r\n\r\nnav {\r\n  text-align: left;\r\n  background: #324A69;\r\n  background: -o-linear-gradient(rgba(50, 74, 105, 0.8), rgba(50, 74, 105, 1));\r\n  background: -webkit-linear-gradient(rgba(50, 74, 105, 0.8), rgba(50, 74, 105, 1));\r\n  background: -moz-linear-gradient(rgba(50, 74, 105, 0.8), rgba(50, 74, 105, 1));\r\n  background: -ms-linear-gradient(rgba(50, 74, 105, 0.8), rgba(50, 74, 105, 1));\r\n  margin: 1em 0;\r\n}\r\n\r\nnav li {\r\n  color: #fff;\r\n  list-style-position: inside;\r\n  list-style-type: disc;\r\n  border-bottom: solid 1px rgba(255, 255, 255, 0.2);\r\n  margin: 0;\r\n}\r\n\r\nnav li a:visited,\r\nnav li a {\r\n  color: #fff;\r\n}\r\nnav li a {\r\n  font-size: 0.9em;\r\n  display: block;\r\n  padding: 0.5em 0.3em;\r\n}\r\n\r\nnav li a:hover {\r\n  color: #ccc;\r\n}\r\n\r\nnav #toggle-nav {\r\n  background: none;\r\n  background: #546377;\r\n  /*background: -o-linear-gradient(rgba(50, 74, 105, 0.8), rgba(50, 74, 105, 1));\r\n  background: -webkit-linear-gradient(rgba(50, 74, 105, 0.8), rgba(50, 74, 105, 1));\r\n  background: -moz-linear-gradient(rgba(50, 74, 105, 0.8), rgba(50, 74, 105, 1));\r\n  background: -ms-linear-gradient(rgba(50, 74, 105, 0.8), rgba(50, 74, 105, 1));*/\r\n  border: none;\r\n  color: #fff;\r\n  left: 0;\r\n  height: 40px;\r\n  position: absolute;\r\n  bottom: 100%;\r\n  width: 70px;\r\n}\r\n\r\nnav #toggle-nav:hover {\r\n  background: #2A3B50;\r\n  /*background: -webkit-linear-gradient(rgba(69, 105, 151, 0.8), rgba(50, 74, 105, 1));\r\n  background: -moz-linear-gradient(rgba(69, 105, 151, 0.8), rgba(50, 74, 105, 1));\r\n  background: -ms-linear-gradient(rgba(69, 105, 151, 0.8), rgba(50, 74, 105, 1));*/\r\n}\r\n\r\nnav #toggle-nav:active {\r\n  background: #2A3B50;\r\n}\r\n\r\nfooter {\r\n  text-align:center;\r\n  margin-top:2em;\r\n  margin-bottom:1em;\r\n}\r\n\r\n\r\n\r\n/* ==|== media queries ======================================================\r\n   PLACEHOLDER Media Queries for Responsive Design.\r\n   These override the primary ('mobile first') styles\r\n   Modify as content requires.\r\n   ========================================================================== */\r\n@media only screen and (min-width: 48em) {\r\n  body {\r\n    max-width: 66%;\r\n  }\r\n\r\n  .sticky {\r\n    position: fixed;\r\n    margin: 0;\r\n    left: 0;\r\n    top: 3em;\r\n    width: 16%;\r\n    z-index: 2;\r\n  }\r\n\r\n  nav.sty {\r\n    width: 16%;\r\n  }\r\n}\r\n\r\n\r\n/* ==|== non-semantic helper classes ========================================\r\n   Please define your styles before this section.\r\n   ========================================================================== */\r\n\r\n/* For image replacement */\r\n.ir { display: block; border: 0; text-indent: -999em; overflow: hidden; background-color: transparent; background-repeat: no-repeat; text-align: left; direction: ltr; *line-height: 0; }\r\n.ir br { display: none; }\r\n\r\n/* Hide from both screenreaders and browsers: h5bp.com/u */\r\n.hidden { display: none !important; visibility: hidden; }\r\n\r\n/* Hide only visually, but have it available for screenreaders: h5bp.com/v */\r\n.visuallyhidden { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }\r\n\r\n/* Extends the .visuallyhidden class to allow the element to be focusable when navigated to via the keyboard: h5bp.com/p */\r\n.visuallyhidden.focusable:active, .visuallyhidden.focusable:focus { clip: auto; height: auto; margin: 0; overflow: visible; position: static; width: auto; }\r\n\r\n/* Hide visually and from screenreaders, but maintain layout */\r\n.invisible { visibility: hidden; }\r\n\r\n/* Contain floats: h5bp.com/q */\r\n.clearfix:before, .clearfix:after { content: \"\"; display: table; }\r\n.clearfix:after { clear: both; }\r\n.clearfix { *zoom: 1; }\r\n\r\n/*@media screen and (min-width: 20em){\r\n  body {}\r\n}*/\r\n\r\n/* ==|== print styles =======================================================\r\n   Print styles.\r\n   Inlined to avoid required HTTP connection: h5bp.com/r\r\n   ========================================================================== */\r\n\r\n@media print {\r\n  * { background: transparent !important; color: black !important; box-shadow:none !important; text-shadow: none !important; filter:none !important; -ms-filter: none !important; } /* Black prints faster: h5bp.com/s */\r\n  a, a:visited { text-decoration: underline; }\r\n  a[href]:after { content: \" (\" attr(href) \")\"; }\r\n  abbr[title]:after { content: \" (\" attr(title) \")\"; }\r\n  .ir a:after, a[href^=\"javascript:\"]:after, a[href^=\"#\"]:after { content: \"\"; }  /* Don't show links for images, or javascript/internal links */\r\n  pre, blockquote { border: 1px solid #999; page-break-inside: avoid; }\r\n  thead { display: table-header-group; } /* h5bp.com/t */\r\n  tr, img { page-break-inside: avoid; }\r\n  img { max-width: 100% !important; }\r\n  @page { margin: 0.5cm; }\r\n  p, h2, h3 { orphans: 3; widows: 3; }\r\n  h2, h3 { page-break-after: avoid; }\r\n}"
  },
  {
    "path": "design-patterns/builder.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>JavaScript Patterns</title>\n    <meta charset=\"utf-8\">\n  </head>\n  <body>\n    <button id=\"test\">Test</button>\n    <script>\n      /* Title: Builder\n       Description: constructs complex objects by separating construction and representation\n       */\n      function getBeerById(id, callback) {\n        // Make request for beer by ID, then return the beer data.\n        asyncRequest('GET', 'beer.uri?id=' + id, function (resp) {\n          // callback response\n          callback(resp.responseText);\n        });\n      }\n      var el = document.querySelector('#test');\n      el.addEventListener('click', getBeerByIdBridge, false);\n      function getBeerByIdBridge(e) {\n        getBeerById(this.id, function (beer) {\n          console.log('Requested Beer: ' + beer);\n        });\n      }\n      // reference\n      // http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/#builderpatternjquery\n    </script>\n  </body>\n</html>\n"
  },
  {
    "path": "design-patterns/chain-of-responsibility.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Chain of responsibility\n\t\t\t Description: delegates commands to a chain of processing objects\n\t\t\t */\n\n\t\t\tvar NO_TOPIC = -1;\n\t\t\tvar Topic;\n\n\t\t\tfunction Handler(s, t) {\n\t\t\t\tthis.successor = s || null;\n\t\t\t\tthis.topic = t || 0;\n\t\t\t}\n\n\t\t\tHandler.prototype = {\n\t\t\t\thandle:function () {\n\t\t\t\t\tconsole.log(this.has());\n\t\t\t\t\tif (this.successor) {\n\t\t\t\t\t\tthis.successor.handle();\n\t\t\t\t\t}\n\t\t\t\t\tconsole.log(this.topic);\n\t\t\t\t},\n\t\t\t\thas:function () {\n\t\t\t\t\treturn this.topic != NO_TOPIC;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tvar _handle = Handler.prototype.handle;\n\n\t\t\tvar app = new Handler({\n\t\t\t\thandle:function () {\n\t\t\t\t\tconsole.log('app handle');\n\t\t\t\t}\n\t\t\t}, 3);\n\n\t\t\tvar dialog = new Handler(app, 1);\n\t\t\t//dialog.handle = function () {\n\t\t\t//if (this.has()) {\n\t\t\t//} else {\n\t\t\t//console.log('dialog handle');\n\t\t\t//_handle.call(this);\n\t\t\t//}\n\t\t\t//}\n\n\t\t\tvar button = new Handler(dialog, 2);\n\t\t\t//button.handle = function () {\n\t\t\t//if (this.has()) {\n\t\t\t//} else {\n\t\t\t//console.log('dialog handle');\n\t\t\t//_handle.call(this);\n\t\t\t//}\n\t\t\t//}\n\n\t\t\tbutton.handle();\n\n\t\t\t// reference\n\t\t\t// https://gist.github.com/1174982\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "design-patterns/command.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Command\n\t\t\t Description: creates objects which encapsulate actions and parameters\n\t\t\t */\n\n\t\t\t(function () {\n\n\t\t\t\tvar CarManager = {\n\n\t\t\t\t\t/* request information */\n\t\t\t\t\trequestInfo:function (model, id) {\n\t\t\t\t\t\treturn 'The purchase info for ' + model + ' with ID ' + id + ' is being processed...';\n\t\t\t\t\t},\n\n\t\t\t\t\t/* purchase the car */\n\t\t\t\t\tbuyVehicle:function (model, id) {\n\t\t\t\t\t\treturn 'You have successfully purchased Item ' + id + ', a ' + model + '.';\n\t\t\t\t\t}\n\n\t\t\t\t};\n\n\t\t\t\tCarManager.execute = function (commad) {\n\t\t\t\t\treturn CarManager[commad.request](commad.model, commad.carID);\n\t\t\t\t};\n\n\t\t\t\tvar actionA = CarManager.execute({request:'requestInfo', model:'Ford Mondeo', carID:'543434'});\n\t\t\t\tconsole.log(actionA);\n\t\t\t\tvar actionB = CarManager.execute({request:'buyVehicle', model:'Ford Mondeo', carID:'543434'});\n\t\t\t\tconsole.log(actionB);\n\n\t\t\t})();\n\n\t\t\t// reference\n\t\t\t// http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/#commandpatternjavascript\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "design-patterns/decorator.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Decorator\n\t\t\t Description: dynamically adds/overrides behaviour in an existing method of an object\n\t\t\t */\n\n\t\t\tvar tree = {};\n\t\t\ttree.decorate = function () {\n\t\t\t\tconsole.log('Make sure the tree won\\'t fall');\n\t\t\t};\n\n\t\t\ttree.getDecorator = function (deco) {\n\t\t\t\ttree[deco].prototype = this;\n\t\t\t\treturn new tree[deco];\n\t\t\t};\n\n\t\t\ttree.RedBalls = function () {\n\t\t\t\tthis.decorate = function () {\n\t\t\t\t\tthis.RedBalls.prototype.decorate();\n\t\t\t\t\tconsole.log('Put on some red balls');\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttree.BlueBalls = function () {\n\t\t\t\tthis.decorate = function () {\n\t\t\t\t\tthis.BlueBalls.prototype.decorate();\n\t\t\t\t\tconsole.log('Add blue balls');\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttree.Angel = function () {\n\t\t\t\tthis.decorate = function () {\n\t\t\t\t\tthis.Angel.prototype.decorate();\n\t\t\t\t\tconsole.log('An angel on the top');\n\t\t\t\t}\n\t\t\t};\n\n\t\t\ttree = tree.getDecorator('BlueBalls');\n\t\t\ttree = tree.getDecorator('Angel');\n\t\t\ttree = tree.getDecorator('RedBalls');\n\n\t\t\ttree.decorate();\n\n\t\t\t// reference\n\t\t\t// http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/#decoratorpatternjavascript\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "design-patterns/facade.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Facade\n\t\t\t Description: provides a simplified interface to a large body of code\n\t\t\t */\n\n\t\t\tvar mobileEvent = {\n\t\t\t\t// ...\n\t\t\t\tstop:function (e) {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t\t// ...\n\t\t\t};\n\n\t\t\t// reference\n\t\t\t// http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/#facadepatternjavascript\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "design-patterns/factory.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Factory method\n\t\t\t Description: creates objects without specifying the exact class to create\n\t\t\t */\n\n\t\t\tvar jsp = {};\n\t\t\tjsp.dom = {};\n\t\t\tjsp.dom.Text = function () {\n\t\t\t\tthis.insert = function (where) {\n\t\t\t\t\tvar txt = document.createTextNode(this.url);\n\t\t\t\t\twhere.appendChild(txt);\n\t\t\t\t};\n\t\t\t};\n\t\t\tjsp.dom.Link = function () {\n\t\t\t\tthis.insert = function (where) {\n\t\t\t\t\tvar link = document.createElement('a');\n\t\t\t\t\tlink.href = this.url;\n\t\t\t\t\tlink.appendChild(document.createTextNode(this.url));\n\t\t\t\t\twhere.appendChild(link);\n\t\t\t\t};\n\t\t\t};\n\t\t\tjsp.dom.Image = function () {\n\t\t\t\tthis.insert = function (where) {\n\t\t\t\t\tvar im = document.createElement('img');\n\t\t\t\t\tim.src = this.url;\n\t\t\t\t\twhere.appendChild(im);\n\t\t\t\t};\n\t\t\t};\n\t\t\tjsp.dom.factory = function (type) {\n\t\t\t\treturn new jsp.dom[type];\n\t\t\t}\n\n\t\t\tvar o = jsp.dom.factory('Link');\n\t\t\to.url = 'http://google.com';\n\t\t\to.insert(document.body);\n\n\t\t\tvar taskManager = {};\n\n\t\t\ttaskManager.update = function () {\n\t\t\t\tconsole.log('update');\n\t\t\t}\n\n\t\t\ttaskManager.read = function () {\n\t\t\t\tconsole.log('read');\n\t\t\t}\n\n\t\t\tvar type = 'update';\n\t\t\tvar task;\n\n\t\t\tif (type === 'update') {\n\t\t\t\ttask = new taskManager.update();\n\t\t\t}\n\n\t\t\tif (type === 'read') {\n\t\t\t\ttask = new taskManager.read();\n\t\t\t}\n\n\t\t\ttaskManager.factory = function (typeType) {\n\t\t\t\treturn new taskManager[typeType];\n\t\t\t}\n\n\t\t\ttask = new taskManager[type];\n\n\t\t\t/*** Built-in Object Factory ***/\n\t\t\tvar o = new Object(),\n\t\t\t\t\tn = new Object(1),\n\t\t\t\t\ts = Object('1'),\n\t\t\t\t\tb = Object(true);\n\n\t\t\t// test\n\t\t\to.constructor === Object;  // true\n\t\t\tn.constructor === Number;  // true\n\t\t\ts.constructor === String;  // true\n\t\t\tb.constructor === Boolean; // true\n\n\t\t\t// reference\n\t\t\t// http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/#factorypatternjavascript\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "design-patterns/iterator.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>JavaScript Patterns</title>\n    <meta charset=\"utf-8\">\n  </head>\n  <body>\n    <script>\n      /* Title: Iterator\n       Description: implements a specialized language\n       */\n      var element;\n      while (element - agg.next()) {\n        // do something with the element\n        console.log(element);\n      }\n      while (agg.hasNext()) {\n        // do something with the next element...\n        console.log(agg.next());\n      }\n      var agg = (function () {\n        var index = 0,\n            data = [1, 2, 3, 4, 5],\n            length = data.length;\n        return {\n          next:function () {\n            var element;\n            if (!this.hasNext()) {\n              return null;\n            }\n            element = data[index];\n            index = index + 2;\n            return element;\n          },\n          hasNext:function () {\n            return index < length;\n          },\n          rewind:function () {\n            index = 0;\n          },\n          current:function () {\n            return data[index];\n          }\n        };\n      }());\n      // this loop logs 1, then 3, then 5\n      while (agg.hasNext()) {\n        console.log(agg.next());\n      }\n      // go back\n      agg.rewind();\n      console.log(agg.current()); // 1\n      // reference\n      // http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/#iteratorpatternjquery\n      // http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate\n    </script>\n  </body>\n</html>"
  },
  {
    "path": "design-patterns/mediator.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Mediator\n\t\t\t Description: allows loose coupling between classes by being the only class that has detailed knowledge of their methods\n\t\t\t */\n\n\t\t\tfunction Player(name) {\n\t\t\t\tthis.points = 0;\n\t\t\t\tthis.name = name;\n\t\t\t}\n\t\t\tPlayer.prototype.play = function () {\n\t\t\t\tthis.points += 1;\n\t\t\t\tmediator.played();\n\t\t\t};\n\t\t\tvar scoreboard = {\n\n\t\t\t\t// HTML element to be updated\n\t\t\t\telement:document.getElementById('results'),\n\n\t\t\t\t// update the score display\n\t\t\t\tupdate:function (score) {\n\t\t\t\t\tvar i, msg = '';\n\t\t\t\t\tfor (i in score) {\n\t\t\t\t\t\tif (score.hasOwnProperty(i)) {\n\t\t\t\t\t\t\tmsg += '<p><strong>' + i + '<\\/strong>: ';\n\t\t\t\t\t\t\tmsg += score[i];\n\t\t\t\t\t\t\tmsg += '<\\/p>';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.element.innerHTML = msg;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tvar mediator = {\n\n\t\t\t\t// all the player\n\t\t\t\tplayers:{},\n\n\t\t\t\t// initialization\n\t\t\t\tsetup:function () {\n\t\t\t\t\tvar players = this.players;\n\t\t\t\t\tplayers.home = new Player('Home');\n\t\t\t\t\tplayers.guest = new Player('Guest');\n\t\t\t\t},\n\n\t\t\t\t// someone plays, update the score\n\t\t\t\tplayed:function () {\n\t\t\t\t\tvar players = this.players,\n\t\t\t\t\t\t\tscore = {\n\t\t\t\t\t\t\t\tHome:players.home.points,\n\t\t\t\t\t\t\t\tGuest:players.guest.points\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\tscoreboard.update(score);\n\t\t\t\t},\n\n\t\t\t\t// handle user interactions\n\t\t\t\tkeypress:function (e) {\n\t\t\t\t\te = e || window.event; // IE\n\t\t\t\t\tif (e.which === 49) { // key \"1\"\n\t\t\t\t\t\tmediator.players.home.play();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (e.which === 48) { // key \"0\"\n\t\t\t\t\t\tmediator.players.guest.play();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// go!\n\t\t\tmediator.setup();\n\t\t\twindow.onkeypress = mediator.keypress;\n\n\t\t\t// game over in 30 seconds\n\t\t\tsetTimeout(function () {\n\t\t\t\twindow.onkeypress = null;\n\t\t\t\tconsole.log('Game over!');\n\t\t\t}, 30000);\n\n\t\t\t// reference\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "design-patterns/multiton.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n<head>\n<title>JavaScript Patterns</title>\n<meta charset=\"utf-8\">\n</head>\n<body>\n<script>\n/* Title: Multiton / Object Pool\n Description: stores references to each object created for a class\n*/\n\n\n//example class\nfunction Widget() {\n  // cache\n  Widget.instances = Widget.instances || [];\n \n  // provide metadata\n  this.id = Widget.length;\n  \n  // store reference\n  Widget.instances.push(this);\n  // implicit return:\n  // return this;\n}\n\n//getInstance method\nWidget.getInstance = function (index) {\n    return Widget.instances[index];\n};\n\n\nnew Widget();\nnew Widget();\nWidget.instances.length === 2; //true\nWidget.instances[0].id === 1; //true\nWidget.instances[1] === Widget.getInstance(1); //true\n\n//Another example class uses the id to ensure prior\n//instances with the same id are removed from the object pool\n(function (global) {\n    var index = -1;\n    \n    function Widget(id) {\n        // provide metadata\n        //accept the id parameter to allow overwriting\n        this.id = id || (index += 1);\n      \n        // store reference\n        Widget.instances[this.id] = this;\n        // implicit return:\n        // return this;\n    }\n    \n    //cache\n    Widget.instances = {};\n    \n    //getInstance method\n    Widget.getInstance = function (index) {\n        return Widget.instances[index];\n    };\n    \n    return global.Widget = Widget;\n}(this));\n\nnew Widget();\nWidget.getInstance(0).id = 0; //true\n\nvar orig = new Widget();\nvar compare = new Widget(1);\ncompare.id === 1; //true\ncompare === orig; //false\n\nnew Widget(\"test\");\nWidget.instances.test === Widget.getInstance(\"test\"); //true\n\n//passing the id as a parameter does not increment the index\nnew Widget().id === 2; //true\n\n\n//general reference about the multiton pattern: http://en.wikipedia.org/wiki/Multiton_pattern\n</script>\n</body>\n</html>"
  },
  {
    "path": "design-patterns/observer.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Observer\n\t\t\t Description: is a publish/subscribe pattern which allows a number of observer objects to see an event\n\t\t\t */\n\n\t\t\tvar observer = {\n\t\t\t\taddSubscriber:function (callback) {\n\t\t\t\t\tthis.subscribers[this.subscribers.length] = callback;\n\t\t\t\t},\n\t\t\t\tremoveSubscriber:function (callback) {\n\t\t\t\t\tfor (var i = 0; i < this.subscribers.length; i++) {\n\t\t\t\t\t\tif (this.subscribers[i] === callback) {\n\t\t\t\t\t\t\tdelete(this.subscribers[i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tpublish:function (what) {\n\t\t\t\t\tfor (var i = 0; i < this.subscribers.length; i++) {\n\t\t\t\t\t\tif (typeof this.subscribers[i] === 'function') {\n\t\t\t\t\t\t\tthis.subscribers[i](what);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tmake:function (o) { // turns an object into a publisher\n\t\t\t\t\tfor (var i in this) {\n\t\t\t\t\t\to[i] = this[i];\n\t\t\t\t\t\to.subscribers = [];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tvar blogger = {\n\t\t\t\twriteBlogPost:function () {\n\t\t\t\t\tvar content = 'Today is ' + new Date();\n\t\t\t\t\tthis.publish(content);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tvar la_times = {\n\t\t\t\tnewIssue:function () {\n\t\t\t\t\tvar paper = 'Martians have landed on Earth!';\n\t\t\t\t\tthis.publish(paper);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tobserver.make(blogger);\n\t\t\tobserver.make(la_times);\n\n\t\t\tvar jack = {\n\t\t\t\tread:function (what) {\n\t\t\t\t\tconsole.log('I just read that ' + what)\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tvar jill = {\n\t\t\t\tgossip:function (what) {\n\t\t\t\t\tconsole.log('You didn\\'t hear it from me, but ' + what)\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tblogger.addSubscriber(jack.read);\n\t\t\tblogger.addSubscriber(jill.gossip);\n\t\t\tblogger.writeBlogPost();\n\n\t\t\tblogger.removeSubscriber(jill.gossip);\n\t\t\tblogger.writeBlogPost();\n\n\t\t\tla_times.addSubscriber(jill.gossip);\n\t\t\tla_times.newIssue();\n\n\t\t\t// reference\n\t\t\t// http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/#observerpatternjavascript\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "design-patterns/proxy.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n<head>\n\t<title>JavaScript Patterns</title>\n\t<meta charset=\"utf-8\">\n\t<style>\n\t\timg {\n\t\t\tfloat: left;\n\t\t\tpadding-right: 7px;\n\t\t}\n\n\t\tdiv {\n\t\t\tpadding: 7px;\n\t\t\tborder: 1px solid #ccc;\n\t\t\tbackground: #eee;\n\t\t\twidth: 400px;\n\t\t}\n\n\t\th2 {\n\t\t\tmargin: 0;\n\t\t}\n\n\t\tspan {\n\t\t\ttext-decoration: underline;\n\t\t\tcursor: pointer;\n\t\t}\n\n\t\tbody {\n\t\t\tpadding: 21px;\n\t\t\tfont-size: 105%;\n\t\t\tfont-family: Helvetica;\n\t\t}\n\n\t\tinput {\n\t\t\tmargin-right: 7px;\n\t\t}\n\n\t\ta {\n\t\t\tcolor: blue;\n\t\t}\n\t</style>\n</head>\n<body>\n\t<h1>Dave Matthews vids</h1>\n\t<p><span id=\"toggle-all\">Toggle Checked</span></p>\n\t<ol id=\"vids\">\n\t\t<li><input type=\"checkbox\" checked><a href=\"http://new.music.yahoo.com/videos/--2158073\">Gravedigger</a></li>\n\t\t<li><input type=\"checkbox\" checked><a href=\"http://new.music.yahoo.com/videos/--4472739\">Save Me</a></li>\n\t\t<li><input type=\"checkbox\" checked><a href=\"http://new.music.yahoo.com/videos/--45286339\">Crush</a></li>\n\t\t<li><input type=\"checkbox\" checked><a href=\"http://new.music.yahoo.com/videos/--2144530\">Don't Drink The\n\t\t\tWater</a></li>\n\t\t<li><input type=\"checkbox\" checked><a href=\"http://new.music.yahoo.com/videos/--217241800\">Funny the Way It\n\t\t\tIs</a></li>\n\t\t<li><input type=\"checkbox\" checked><a href=\"http://new.music.yahoo.com/videos/--2144532\">What Would You Say</a>\n\t\t</li>\n\t</ol>\n\n\t<script>\n\t\t/* Title: Proxy\n\t\t Description: provides a placeholder for another object to control access, reduce cost, and reduce complexity\n\t\t */\n\n\t\tvar $ = function (id) {\n\t\t\treturn document.getElementById(id);\n\t\t};\n\n\t\tvar http = {\n\t\t\tmakeRequest:function (ids, callback) {\n\t\t\t\tvar url = 'http://query.yahooapis.com/v1/public/yql?q=',\n\t\t\t\t\t\tsql = 'select * from music.video.id where ids IN (\"%ID%\")',\n\t\t\t\t\t\tformat = \"format=json\",\n\t\t\t\t\t\thandler = \"callback=\" + callback,\n\t\t\t\t\t\tscript = document.createElement('script');\n\n\t\t\t\tsql = sql.replace('%ID%', ids.join('\",\"'));\n\t\t\t\tsql = encodeURIComponent(sql);\n\n\t\t\t\turl += sql + '&' + format + '&' + handler;\n\t\t\t\tscript.src = url;\n\n\t\t\t\tdocument.body.appendChild(script);\n\t\t\t}\n\t\t};\n\n\t\tvar proxy = {\n\t\t\tids:[],\n\t\t\tdelay:50,\n\t\t\ttimeout:null,\n\t\t\tcallback:null,\n\t\t\tcontext:null,\n\t\t\tmakeRequest:function (id, callback, context) {\n\n\t\t\t\t// add to the queue\n\t\t\t\tthis.ids.push(id);\n\n\t\t\t\tthis.callback = callback;\n\t\t\t\tthis.context = context;\n\n\t\t\t\t// set up timeout\n\t\t\t\tif (!this.timeout) {\n\t\t\t\t\tthis.timeout = setTimeout(function () {\n\t\t\t\t\t\tproxy.flush();\n\t\t\t\t\t}, this.delay);\n\t\t\t\t}\n\t\t\t},\n\t\t\tflush:function () {\n\t\t\t\thttp.makeRequest(this.ids, 'proxy.handler');\n\t\t\t\t// clear timeout and queue\n\t\t\t\tthis.timeout = null;\n\t\t\t\tthis.ids = [];\n\n\t\t\t},\n\t\t\thandler:function (data) {\n\t\t\t\tvar i, max;\n\n\t\t\t\t// single video\n\t\t\t\tif (parseInt(data.query.count, 10) === 1) {\n\t\t\t\t\tproxy.callback.call(proxy.context, data.query.results.Video);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// multiple videos\n\t\t\t\tfor (i = 0, max = data.query.results.Video.length; i < max; i += 1) {\n\t\t\t\t\tproxy.callback.call(proxy.context, data.query.results.Video[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\n\t\tvar videos = {\n\t\t\tgetPlayer:function (id) {\n\t\t\t\treturn '' +\n\t\t\t\t\t\t'<object width=\"400\" height=\"255\" id=\"uvp_fop\" allowFullScreen=\"true\">' +\n\t\t\t\t\t\t'<param name=\"movie\" value=\"http://d.yimg.com/m/up/fop/embedflv/swf/fop.swf\"\\/>' +\n\t\t\t\t\t\t'<param name=\"flashVars\" value=\"id=v' + id + '&amp;eID=1301797&amp;lang=us&amp;enableFullScreen=0&amp;shareEnable=1\"\\/>' +\n\t\t\t\t\t\t'<param name=\"wmode\" value=\"transparent\"\\/>' +\n\t\t\t\t\t\t'<embed ' +\n\t\t\t\t\t\t'height=\"255\" ' +\n\t\t\t\t\t\t'width=\"400\" ' +\n\t\t\t\t\t\t'id=\"uvp_fop\" ' +\n\t\t\t\t\t\t'allowFullScreen=\"true\" ' +\n\t\t\t\t\t\t'src=\"http://d.yimg.com/m/up/fop/embedflv/swf/fop.swf\" ' +\n\t\t\t\t\t\t'type=\"application/x-shockwave-flash\" ' +\n\t\t\t\t\t\t'flashvars=\"id=v' + id + '&amp;eID=1301797&amp;lang=us&amp;ympsc=4195329&amp;enableFullScreen=1&amp;shareEnable=1\"' +\n\t\t\t\t\t\t'\\/>' +\n\t\t\t\t\t\t'<\\/object>';\n\t\t\t},\n\n\t\t\tupdateList:function (data) {\n\t\t\t\tvar id,\n\t\t\t\t\t\thtml = '',\n\t\t\t\t\t\tinfo;\n\n\t\t\t\tif (data.query) {\n\t\t\t\t\tdata = data.query.results.Video;\n\t\t\t\t}\n\t\t\t\tid = data.id;\n\t\t\t\thtml += '<img src=\"' + data.Image[0].url + '\" width=\"50\" \\/>';\n\t\t\t\thtml += '<h2>' + data.title + '<\\/h2>';\n\t\t\t\thtml += '<p>' + data.copyrightYear + ', ' + data.label + '<\\/p>';\n\t\t\t\tif (data.Album) {\n\t\t\t\t\thtml += '<p>Album: ' + data.Album.Release.title + ', ' + data.Album.Release.releaseYear + '<br \\/>';\n\t\t\t\t}\n\t\t\t\thtml += '<p><a class=\"play\" href=\"http://new.music.yahoo.com/videos/--' + id + '\">&raquo; play<\\/a><\\/p>';\n\t\t\t\tinfo = document.createElement('div');\n\t\t\t\tinfo.id = \"info\" + id;\n\t\t\t\tinfo.innerHTML = html;\n\t\t\t\t$('v' + id).appendChild(info);\n\t\t\t},\n\n\t\t\tgetInfo:function (id) {\n\t\t\t\tvar info = $('info' + id);\n\n\t\t\t\tif (!info) {\n\t\t\t\t\tproxy.makeRequest(id, videos.updateList, videos);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (info.style.display === \"none\") {\n\t\t\t\t\tinfo.style.display = '';\n\t\t\t\t} else {\n\t\t\t\t\tinfo.style.display = 'none';\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\n\t\t$('vids').onclick = function (e) {\n\t\t\tvar src, id;\n\n\t\t\te = e || window.event;\n\t\t\tsrc = e.target || e.srcElement;\n\n\t\t\tif (src.nodeName.toUpperCase() !== \"A\") {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (typeof e.preventDefault === \"function\") {\n\t\t\t\te.preventDefault();\n\t\t\t}\n\t\t\te.returnValue = false;\n\n\t\t\tid = src.href.split('--')[1];\n\n\t\t\tif (src.className === \"play\") {\n\t\t\t\tsrc.parentNode.innerHTML = videos.getPlayer(id);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsrc.parentNode.id = \"v\" + id;\n\t\t\tvideos.getInfo(id);\n\t\t};\n\n\t\t$('toggle-all').onclick = function (e) {\n\n\t\t\tvar hrefs,\n\t\t\t\t\ti,\n\t\t\t\t\tmax,\n\t\t\t\t\tid;\n\n\t\t\threfs = $('vids').getElementsByTagName('a');\n\t\t\tfor (i = 0, max = hrefs.length; i < max; i += 1) {\n\t\t\t\t// skip play links\n\t\t\t\tif (hrefs[i].className === \"play\") {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t// skip unchecked\n\t\t\t\tif (!hrefs[i].parentNode.firstChild.checked) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tid = hrefs[i].href.split('--')[1];\n\t\t\t\threfs[i].parentNode.id = \"v\" + id;\n\t\t\t\tvideos.getInfo(id);\n\t\t\t}\n\t\t};\n\n\t\t// reference\n\t\t// http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/#proxypatternjquery\n\t\t// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate\n\t</script>\n</body>\n</html>"
  },
  {
    "path": "design-patterns/singleton.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Singleton\n\t\t\t Description: restricts object creation for a class to only one instance\n\t\t\t */\n\n\t\t\tvar obj = {\n\t\t\t\tmyprop:'my value'\n\t\t\t};\n\n\t\t\tvar obj2 = {\n\t\t\t\tmyprop:'my value'\n\t\t\t};\n\t\t\tobj === obj2; // false\n\t\t\tobj == obj2;  // false\n\n\t\t\tvar uni = new Universe();\n\t\t\tvar uni2 = new Universe();\n\t\t\tuni === uni2; // true\n\n\t\t\tfunction Universe() {\n\n\t\t\t\t// do we have an existing instance?\n\t\t\t\tif (typeof Universe.instance === 'object') {\n\t\t\t\t\treturn Universe.instance;\n\t\t\t\t}\n\n\t\t\t\t// proceed as normal\n\t\t\t\tthis.start_time = 0;\n\t\t\t\tthis.bang = \"Big\";\n\n\t\t\t\t// cache\n\t\t\t\tUniverse.instance = this;\n\n\t\t\t\t// implicit return:\n\t\t\t\t// return this;\n\t\t\t}\n\n\t\t\t// testing\n\t\t\tvar uni = new Universe();\n\t\t\tvar uni2 = new Universe();\n\t\t\tuni === uni2; // true\n\n\t\t\t/*** Instance in a Closure ***/\n\n\t\t\tfunction Universe() {\n\n\t\t\t\t// the cached instance\n\t\t\t\tvar instance = this;\n\n\t\t\t\t// proceed as normal\n\t\t\t\tthis.start_time = 0;\n\t\t\t\tthis.bang = \"Big\";\n\n\t\t\t\t// rewrite the contructor\n\t\t\t\tUniverse = function () {\n\t\t\t\t\treturn instance;\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tfunction Universe() {\n\n\t\t\t\t// the cached instance\n\t\t\t\tvar instance;\n\n\t\t\t\t// rewrite the constructor\n\t\t\t\tUniverse = function Universe() {\n\t\t\t\t\treturn instance;\n\t\t\t\t};\n\n\t\t\t\t// carry over the prototype properties\n\t\t\t\tUniverse.prototype = this;\n\n\t\t\t\t// the instance\n\t\t\t\tinstance = new Universe();\n\n\t\t\t\t// reset the constructor pointer\n\t\t\t\tinstance.constructor = Universe;\n\n\t\t\t\t// all the functionality\n\t\t\t\tinstance.start_time = 0;\n\t\t\t\tinstance.bang = \"Big\";\n\n\t\t\t\treturn instance;\n\t\t\t}\n\n\n\t\t\t// testing\n\t\t\tvar uni = new Universe();\n\t\t\tvar uni2 = new Universe();\n\t\t\tuni === uni2; // true\n\n\t\t\t// adding to the prototype\n\t\t\tUniverse.prototype.nothing = true;\n\n\t\t\tvar uni = new Universe();\n\n\t\t\t// again adding to the prototype\n\t\t\t// after the initial object is created\n\t\t\tUniverse.prototype.everything = true;\n\n\t\t\tvar uni2 = new Universe();\n\n\t\t\t// only the original prototype was\n\t\t\t// linked to the objects\n\t\t\tuni.nothing; // true\n\t\t\tuni2.nothing; // true\n\t\t\tuni.everything; // true\n\t\t\tuni2.everything; // true\n\n\t\t\t// that sounds right:\n\t\t\tuni.constructor.name; // \"Universe\"\n\t\t\tuni.constructor === Universe; // true\n\n\t\t\tvar Universe;\n\n\t\t\t(function () {\n\n\t\t\t\tvar instance;\n\n\t\t\t\tUniverse = function Universe() {\n\n\t\t\t\t\tif (instance) {\n\t\t\t\t\t\treturn instance;\n\t\t\t\t\t}\n\n\t\t\t\t\tinstance = this;\n\n\t\t\t\t\t// all the functionality\n\t\t\t\t\tthis.start_time = 0;\n\t\t\t\t\tthis.bang = \"Big\";\n\t\t\t\t};\n\t\t\t}());\n\n\t\t\t// reference\n\t\t\t// http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/#singletonpatternjavascript\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "design-patterns/strategy.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Strategy\n\t\t\t Description: allows one of a family of algorithms to be selected on-the-fly at runtime\n\t\t\t */\n\n\t\t\tvar validator = {\n\n\t\t\t\t// all available checks\n\t\t\t\ttypes:{},\n\n\t\t\t\t// error messages in the current\n\t\t\t\t// validation session\n\t\t\t\tmessages:[],\n\n\t\t\t\t// current validation config\n\t\t\t\t// name: validation type\n\t\t\t\tconfig:{},\n\n\t\t\t\t// the interface method\n\t\t\t\t// 'data' is key => value pairs\n\t\t\t\tvalidate:function (data) {\n\n\t\t\t\t\tvar i, msg, type, checker, result_ok;\n\n\t\t\t\t\t// reset all messages\n\t\t\t\t\tthis.messages = [];\n\n\t\t\t\t\tfor (i in data) {\n\n\t\t\t\t\t\tif (data.hasOwnProperty(i)) {\n\n\t\t\t\t\t\t\ttype = this.config[i];\n\t\t\t\t\t\t\tchecker = this.types[type];\n\n\t\t\t\t\t\t\tif (!type) {\n\t\t\t\t\t\t\t\tcontinue; // no need to validate\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!checker) { // uh-oh\n\t\t\t\t\t\t\t\tthrow {\n\t\t\t\t\t\t\t\t\tname:\"ValidationError\",\n\t\t\t\t\t\t\t\t\tmessage:\"No handler to validate type \" + type\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tresult_ok = checker.validate(data[i]);\n\t\t\t\t\t\t\tif (!result_ok) {\n\t\t\t\t\t\t\t\tmsg = \"Invalid value for *\" + i + \"*, \" + checker.instructions;\n\t\t\t\t\t\t\t\tthis.messages.push(msg);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn this.hasErrors();\n\t\t\t\t},\n\n\t\t\t\t// helper\n\t\t\t\thasErrors:function () {\n\t\t\t\t\treturn this.messages.length !== 0;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// checks for non-empty values\n\t\t\tvalidator.types.isNonEmpty = {\n\t\t\t\tvalidate:function (value) {\n\t\t\t\t\treturn value !== \"\";\n\t\t\t\t},\n\t\t\t\tinstructions:\"the value cannot be empty\"\n\t\t\t};\n\n\t\t\t// checks if a value is a number\n\t\t\tvalidator.types.isNumber = {\n\t\t\t\tvalidate:function (value) {\n\t\t\t\t\treturn !isNaN(value) && value/Infinity === 0;\n\t\t\t\t},\n\t\t\t\tinstructions:\"the value can only be a valid number, e.g. 1, 3.14 or 2010\"\n\t\t\t};\n\n\t\t\t// checks if the value contains only letters and numbers\n\t\t\tvalidator.types.isAlphaNum = {\n\t\t\t\tvalidate:function (value) {\n\t\t\t\t\treturn !/[^a-z0-9]/i.test(value);\n\t\t\t\t},\n\t\t\t\tinstructions:\"the value can only contain characters and numbers, no special symbols\"\n\t\t\t};\n\n\t\t\tvar data = {\n\t\t\t\tfirst_name:\"Super\",\n\t\t\t\tlast_name:\"Man\",\n\t\t\t\tage:\"unknown\",\n\t\t\t\tusername:\"o_O\"\n\t\t\t};\n\n\t\t\tvalidator.config = {\n\t\t\t\tfirst_name:'isNonEmpty',\n\t\t\t\tage:'isNumber',\n\t\t\t\tusername:'isAlphaNum'\n\t\t\t};\n\n\t\t\tvalidator.validate(data);\n\n\t\t\tif (validator.hasErrors()) {\n\t\t\t\tconsole.log(validator.messages.join(\"\\n\"));\n\t\t\t}\n\n\t\t\t// reference\n\t\t\t// http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/#strategypatternjquery\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "design-patterns/visitor.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Visitor\n\t\t\t Description: Represent an operation to be performed on the elements of an object structure.\n\t\t\t Visitor lets you define a new operation without changing the classes of the elements on which it operates.\n\t\t\t */\n\n\t\t\tvar Employee = function (name, salary, vacation) {\n\t\t\t\tvar self = this;\n\n\t\t\t\tthis.accept = function (visitor) {\n\t\t\t\t\tvisitor.visit(self);\n\t\t\t\t};\n\n\t\t\t\tthis.getName = function () {\n\t\t\t\t\treturn name;\n\t\t\t\t};\n\n\t\t\t\tthis.getSalary = function () {\n\t\t\t\t\treturn salary;\n\t\t\t\t};\n\n\t\t\t\tthis.setSalary = function (sal) {\n\t\t\t\t\tsalary = sal;\n\t\t\t\t};\n\n\t\t\t\tthis.getVacation = function () {\n\t\t\t\t\treturn vacation;\n\t\t\t\t};\n\n\t\t\t\tthis.setVacation = function (vac) {\n\t\t\t\t\tvacation = vac;\n\t\t\t\t};\n\t\t\t};\n\n\t\t\tvar ExtraSalary = function () {\n\t\t\t\tthis.visit = function (emp) {\n\t\t\t\t\temp.setSalary(emp.getSalary() * 1.1);\n\t\t\t\t};\n\t\t\t};\n\n\t\t\tvar ExtraVacation = function () {\n\t\t\t\tthis.visit = function (emp) {\n\t\t\t\t\temp.setVacation(emp.getVacation() + 2);\n\t\t\t\t};\n\t\t\t};\n\n\t\t\t// log helper\n\t\t\tvar log = (function() {\n\t\t\t\tvar log = \"\";\n\n\t\t\t\treturn {\n\t\t\t\t\tadd: function(msg) { log += msg + \"\\n\"; },\n\t\t\t\t\tshow: function() { alert(log); log = \"\"; }\n\t\t\t\t}\n\t\t\t})();\n\n\t\t\t//example\n\t\t\tfunction run() {\n\n\t\t\t\tvar employees = [\n\t\t\t\t\tnew Employee(\"John\", 10000, 10),\n\t\t\t\t\tnew Employee(\"Mary\", 20000, 21),\n\t\t\t\t\tnew Employee(\"Boss\", 250000, 51)\n\t\t\t\t];\n\n\t\t\t\tvar visitorSalary = new ExtraSalary();\n\t\t\t\tvar visitorVacation = new ExtraVacation();\n\n\t\t\t\tfor (var i = 0, len = employees.length; i < len; i++) {\n\t\t\t\t\tvar emp = employees[i];\n\n\t\t\t\t\temp.accept(visitorSalary);\n\t\t\t\t\temp.accept(visitorVacation);\n\t\t\t\t\tlog.add(emp.getName() + \": $\" + emp.getSalary() +\n\t\t\t\t\t\t\t\" and \" + emp.getVacation() + \" vacation days\");\n\t\t\t\t}\n\n\t\t\t\tlog.show();\n\t\t\t}\n\n\t\t\t// reference\n\t\t\t// http://www.dofactory.com/javascript/visitor-design-pattern\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "dom-and-browser/event-handling.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<button id=\"clickme\">Click me: 0</button>\n\t\t<script>\n\t\t\t/* Title: Event Handling\n\t\t\t Description: when you pass function A to function B as a parameter, function A is a callback function\n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\t/*var b = document.getElementById('clickme'),\n\t\t\t count = 0;\n\t\t\t b.onclick = function () {\n\t\t\t count += 1;\n\t\t\t b.innerHTML = \"Click me: \" + count;\n\t\t\t };*/\n\n\t\t\t// preferred\n\t\t\tvar b = document.getElementById('clickme');\n\t\t\tif (document.addEventListener) { // W3C\n\t\t\t\tb.addEventListener('click', myHandler, false);\n\t\t\t} else if (document.attachEvent) { // IE\n\t\t\t\tb.attachEvent('onclick', myHandler);\n\t\t\t} else { // last resort\n\t\t\t\tb.onclick = myHandler;\n\t\t\t}\n\n\t\t\tfunction myHandler(e) {\n\t\t\t\tvar src, parts;\n\t\t\t\t// get event and source element\n\t\t\t\te = e || window.event;\n\t\t\t\tsrc = e.target || e.srcElement;\n\t\t\t\t// actual work: update label\n\t\t\t\tparts = src.innerHTML.split(\": \");\n\t\t\t\tparts[1] = parseInt(parts[1], 10) + 1;\n\t\t\t\tsrc.innerHTML = parts[0] + \": \" + parts[1];\n\t\t\t\t// no bubble\n\t\t\t\tif (typeof e.stopPropagation === \"function\") {\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t}\n\t\t\t\tif (typeof e.cancelBubble !== \"undefined\") {\n\t\t\t\t\te.cancelBubble = true;\n\t\t\t\t}\n\t\t\t\t// prevent default action\n\t\t\t\tif (typeof e.preventDefault === \"function\") {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t}\n\t\t\t\tif (typeof e.returnValue !== \"undefined\") {\n\t\t\t\t\te.returnValue = false;\n\t\t\t\t}\n\t\t\t}\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "function-patterns/callback.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Callback patterns\n\t\t\t Description: when you pass function A to function B as a parameter, function A is a callback function\n\t\t\t */\n\n\t\t\tvar complexComputation = function () { /* do some complex stuff and return a node */\n\t\t\t};\n\n\t\t\tvar findNodes = function (callback) {\n\t\t\t\tvar nodes = [];\n\n\t\t\t\tvar node = complexComputation();\n\n\t\t\t\t// call if callback is callable\n\t\t\t\tif (typeof callback === \"function\") {\n\t\t\t\t\tcallback(node);\n\t\t\t\t}\n\n\t\t\t\tnodes.push(node);\n\t\t\t\treturn nodes;\n\t\t\t};\n\n\t\t\t// a callback function\n\t\t\tvar hide = function (node) {\n\t\t\t\tnode.style.display = \"none\";\n\t\t\t};\n\n\t\t\t// find the nodes and hide them as you go\n\t\t\tvar hiddenNodes = findNodes(hide);\n\n\t\t\t// you can also use an anonymous function, like this:\n\t\t\tvar blockNodes = findNodes(function (node) {\n\t\t\t\tnode.style.display = 'block';\n\t\t\t});\n\n\t\t\t// reference\n\t\t\t// http://www.jspatterns.com/\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "function-patterns/callbacks-and-scope.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\tvar myapp = {};\n\t\t\tmyapp.color = \"green\";\n\t\t\tmyapp.paint = function (node) {\n\t\t\t\tnode.style.color = this.color;\n\t\t\t};\n\n\t\t\tvar findNodes = function (callback) {\n\t\t\t\t// ...\n\t\t\t\tif (typeof callback === \"function\") {\n\t\t\t\t\tcallback(found);\n\t\t\t\t}\n\t\t\t\t// ...\n\t\t\t};\n\n\t\t\tvar findNodes = function (callback, callback_obj) {\n\t\t\t\t// ...\n\t\t\t\tif (typeof callback === \"function\") {\n\t\t\t\t\tcallback.call(callback_obj, found);\n\t\t\t\t}\n\t\t\t\t// ...\n\t\t\t};\n\n\t\t\tvar findNodes = function (callback, callback_obj) {\n\t\t\t\tif (typeof callback === \"string\") {\n\t\t\t\t\tcallback = callback_obj[callback];\n\t\t\t\t}\n\n\t\t\t\t// ...\n\t\t\t\tif (typeof callback === \"function\") {\n\t\t\t\t\tcallback.call(callback_obj, found);\n\t\t\t\t}\n\t\t\t\t// ...\n\t\t\t};\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "function-patterns/configuration-objects.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Configuration objects\n\t\t\t Description: keep control of function arguments and makes it easily configurable\n\t\t\t */\n\n\t\t\tvar conf = {\n\t\t\t\tusername:\"shichuan\",\n\t\t\t\tfirst:\"Chuan\",\n\t\t\t\tlast:\"Shi\"\n\t\t\t};\n\t\t\taddPerson(conf);\n\n\t\t\t// reference\n\t\t\t// http://www.jspatterns.com/\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "function-patterns/currying.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Currying\n\t\t\t Description: used to create new functions dynamically by partially applying a set of arguments\n\t\t\t in ECMAScript 5, you can use bind to implement curring.\n\t\t\t */\n\n\t\t\t/***\n\t\t\t function application\n\t\t\t ***/\n\t\t\t// define a function\n\t\t\tvar sayHi = function (who) {\n\t\t\t\treturn \"Hello\" + (who ? \", \" + who : \"\") + \"!\";\n\t\t\t};\n\n\t\t\t// invoke a function\n\t\t\tsayHi(); // \"Hello!\"\n\t\t\tsayHi('world'); // \"Hello, world!\"\n\n\t\t\t// apply a function\n\t\t\tsayHi.apply(null, [\"hello\"]); // \"Hello, hello!\"\n\n\t\t\tvar alien = {\n\t\t\t\tsayHi:function (who) {\n\t\t\t\t\treturn \"Hello\" + (who ? \", \" + who : \"\") + \"!\";\n\t\t\t\t}\n\t\t\t};\n\n\t\t\talien.sayHi('world'); // \"Hello, world!\"\n\t\t\tsayHi.apply(alien, [\"humans\"]); // \"Hello, humans!\"\n\n\t\t\t// the second is more efficient, saves an array\n\t\t\tsayHi.apply(alien, [\"humans\"]); // \"Hello, humans!\"\n\t\t\tsayHi.call(alien, \"humans\"); // \"Hello, humans!\"\n\n\t\t\t/***\n\t\t\t partial application\n\t\t\t ***/\n\n\t\t\t// for illustration purposes\n\t\t\t// not valid JavaScript\n\n\t\t\t// we have this function\n\t\t\tfunction add(x, y) {\n\t\t\t\treturn x + y;\n\t\t\t}\n\n\t\t\t// and we know the arguments\n\t\t\tadd(5, 4);\n\n\t\t\t// step 1 -- substitute one argument\n\t\t\tfunction add(5, y) {\n\t\t\t\treturn 5 + y;\n\t\t\t}\n\n\t\t\t// step 2 -- substitute the other argument\n\t\t\tfunction add(5, 4) {\n\t\t\t\treturn 5 + 4;\n\t\t\t}\n\n\t\t\t/***\n\t\t\t currying\n\t\t\t ***/\n\n\t\t\t// a curried add()\n\t\t\t// accepts partial list of arguments\n\t\t\tfunction add(x, y) {\n\t\t\t\tvar oldx = x, oldy = y;\n\t\t\t\tif (typeof oldy === \"undefined\") { // partial\n\t\t\t\t\treturn function (newy) {\n\t\t\t\t\t\treturn oldx + newy;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// full application\n\t\t\t\treturn x + y;\n\t\t\t}\n\n\t\t\t// test\n\t\t\ttypeof add(5); // \"function\"\n\t\t\tadd(3)(4); // 7\n\n\t\t\t// create and store a new function\n\t\t\tvar add2000 = add(2000);\n\t\t\tadd2000(10); // 2010\n\n\t\t\tfunction schonfinkelize(fn) {\n\t\t\t\tvar slice = Array.prototype.slice,\n\t\t\t\t\t\tstored_args = slice.call(arguments, 1);\n\t\t\t\treturn function () {\n\t\t\t\t\tvar new_args = slice.call(arguments),\n\t\t\t\t\t\t\targs = stored_args.concat(new_args);\n\t\t\t\t\treturn fn.apply(null, args);\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// reference\n\t\t\t// http://www.jspatterns.com/\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate\n\n\t\t\t// Here's a generic curry function (from kybernetikos):\n\t\t\t// It's slightly more complex than the common examples of currying (e.g. the one above), but that's because\n\t\t\t//    the function can afterwards be called either in the normal way, or in the curried way.\n\t\t\t//    If you call a 3 argument curried function with it, the returned function *is also curried*.\n\t\t\t//    e.g. you can write func(arg1)(arg2)(arg3) or func(arg1, arg2, arg3) or func(arg1)(arg2, arg3) etc...\n\n\t\t\t/* the curry procedure needs to know how many arguments are required before it should calculate the result */\n\t\t\tfunction curry(func, minArgs) {\n\t\t\t\tif (minArgs == undefined) {\n\t\t\t\t\tminArgs = 1;\n\t\t\t\t}\n\n\t\t\t\tfunction funcWithArgsFrozen(frozenargs) {\n\t\t\t\t\treturn function () {\n\t\t\t\t\t\t// could do an optimisation here - if called with no arguments\n\t\t\t\t\t\t// return exactly this function.\n\t\t\t\t\t\tvar args = Array.prototype.slice.call(arguments);\n\t\t\t\t\t\tvar newArgs = frozenargs.concat(args);\n\t\t\t\t\t\tif (newArgs.length >= minArgs) {\n\t\t\t\t\t\t\treturn func.apply(this, newArgs);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn funcWithArgsFrozen(newArgs);\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn funcWithArgsFrozen([]);\n\t\t\t}\n\n\t\t\t/* Here are some example uses - I use these with a functional immutable list structure implemented in js\n\t\t\t but they also work ok for normal higher order functions over arrays.\n\t\t\t */\n\n\t\t\tvar plus = curry(function () {\n\t\t\t\tvar result = 0;\n\t\t\t\tfor (var i = 0; i < arguments.length; ++i) {\n\t\t\t\t\tresult += arguments[i];\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}, 2);\n\n\t\t\t/* Now you can call\n\t\t\t plus(3,2)         // normal call\n\t\t\t plus(3)           // partial application (returns a function that adds 3 to its argument)\n\t\t\t plus(3)(2)        // complete application (returns 5)\n\t\t\t plus()(3)()()(2)  // returns 5\n\t\t\t plus(3, 2, 4, 5)  // the normal call can optionally take more than the minimum number of arguments\n\t\t\t plus(3)(2, 3, 5)  // the last application can too.\n\t\t\t */\n\n\t\t\tvar minus = curry(function (x) {\n\t\t\t\tvar result = x;\n\t\t\t\tfor (var i = 1; i < arguments.length; ++i) {\n\t\t\t\t\tresult -= arguments[i];\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}, 2);\n\n\t\t\t/* flip switches the order of the first two arguments on a function.  It is curried itself and\n\t\t\t the function it returns is curried too.  Particularly useful if you want a function that subtracts a number */\n\n\t\t\tvar flip = curry(function (func) {\n\t\t\t\treturn curry(function (a, b) {\n\t\t\t\t\treturn func(b, a);\n\t\t\t\t}, 2);\n\t\t\t});\n\n\t\t\t/* for example\n\t\t\t minus(5)             // returns a function that takes its argument away from 5\n\t\t\t flip(minus)(5)       // returns a function that takes 5 away from its argument\n\t\t\t */\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "function-patterns/enforcing-new-in-constructors.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\tfunction Person() {\n\t\t\t\tvar that = (this === window) ? {} : this;\n\t\t\t\tthat.name = name;\n\t\t\t\tthat.say = function () {\n\t\t\t\t\treturn \"I am \" + that.name;\n\t\t\t\t};\n\t\t\t\treturn that;\n\t\t\t}\n\n\t\t\t// reference\n\t\t\t// http://www.jspatterns.com/\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "function-patterns/function-call.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>JavaScript Patterns</title>\n    <meta charset=\"utf-8\">\n  </head>\n  <body>\n    <script>\n      // Title: 4 different ways to call function\n      \n      var foo, bar, baz, myapp;\n\n\n      function foo(a, b) {\n        return [this, a, b];\n      };\n      // using () operator\n      // if the function is called without an explicit owner object\n      // `this` keyword will refers to global\n      // \n      // bar = [window, 1, 2]\n      bar = foo(1, 2);\n      console.log(bar);\n\n\n      myapp = {\n        baz: foo,\n        onemore: function() {\n          function insideTheClosure() {\n            return this;\n          }\n          return [this, insideTheClosure()]\n        }\n      };\n\n      // still using () operator\n      // but now baz function belongs to myapp object\n      //\n      // bar = [myapp, 1, 2]\n      bar = myapp.baz(1, 2);\n      console.log(bar);\n\n      // like in the first example we need to call function\n      // within myapp like myapp.baz()\n      // not just inside the object`s function\n      // \n      // bar = [myapp, window]\n      bar = myapp.onemore();\n      console.log(bar);\n\n\n      // using apply and call methods of the Function itself\n      // there are almost the same\n      // but apply could be useful in case we don't know arguments beforehand\n      // \n      // bar = [myapp, 1, 2]\n      bar = foo.call(myapp, 1, 2);\n      console.log(bar);\n      bar = foo.apply(myapp, [1, 2]);\n      console.log(bar);\n\n\n      /* Reference:\n       * http://devlicio.us/blogs/sergio_pereira/archive/2009/02/09/JavaScript-5-ways-to-call-a-function.aspx\n       */\n    </script>\n  </body>\n</html>\n"
  },
  {
    "path": "function-patterns/immediate-functions.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Immediate functions\n\t\t\t Description: syntax that enables function execution as soon as it is defined\n\t\t\t */\n\n\t\t\t(function () {\n\t\t\t\tconsole.log('watch out!');\n\t\t\t}());\n\n\t\t\t//alternative with less parentheses\n\t\t\t!function () {\n\t\t\t\tconsole.log('watch out!');\n\t\t\t}();\n\t\t\t\n\t\t\t//another alternative with less parentheses\n\t\t\t+function () {\n\t\t\t\tconsole.log('watch out!');\n\t\t\t}();\n\t\t\t\n\t\t\t//crockfords the good part book way of doing this\n\t\t\t(function () {\n\t\t\t\tconsole.log('watch out!');\n\t\t\t}());\n\n\n\t\t\t// reference\n\t\t\t// http://www.jspatterns.com/\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "function-patterns/immediate-object-initialization.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Immediate object initialization\n\t\t\t Description: this pattern is mainly suitable for one-off tasks\n\t\t\t */\n\n\t\t\t({\n\t\t\t\t// here you can define setting values\n\t\t\t\t// a.k.a. configuration constants\n\t\t\t\tmaxwidth:600,\n\t\t\t\tmaxheight:400,\n\n\t\t\t\t// you can also define utility methods\n\t\t\t\tgimmeMax:function () {\n\t\t\t\t\treturn this.maxwidth + \"x\" + this.maxheight;\n\t\t\t\t},\n\n\t\t\t\t// initialize\n\t\t\t\tinit:function () {\n\t\t\t\t\tconsole.log(this.gimmeMax());\n\t\t\t\t\t// more init tasks...\n\t\t\t\t}\n\t\t\t}).init();\n\n\t\t\t// reference\n\t\t\t// http://www.jspatterns.com/\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "function-patterns/init-time-branching.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Init-time branching\n\t\t\t Description: branch code once during initialization\n\t\t\t */\n\n\t\t\t// BEFORE\n\t\t\t/* var utils = {\n\t\t\t addListener: function (el, type, fn) {\n\t\t\t if (typeof window.addEventListener === 'function') {\n\t\t\t el.addEventListener(type, fn, false);\n\t\t\t } else if (typeof document.attachEvent !== 'undefined') {\n\t\t\t el.attachEvent('on' + type, fn);\n\t\t\t } else {\n\t\t\t el['on' + type] = fn;\n\t\t\t }\n\t\t\t },\n\t\t\t removeListener: function (el, type, fn) {\n\t\t\t }\n\t\t\t }; */\n\n\t\t\t// the interface\n\t\t\tvar utils = {\n\t\t\t\taddListener:null,\n\t\t\t\tremoveListener:null\n\t\t\t};\n\n\t\t\t// the implementation\n\t\t\tif (typeof window.addEventListener === 'function') {\n\t\t\t\tutils.addListener = function (el, type, fn) {\n\t\t\t\t\tel.addEventListener(type, fn, false);\n\t\t\t\t};\n\t\t\t\tutils.removeListener = function(el, type, fn) { \n\t\t\t\t\tel.removeEventListener(type, fn, false); \n\t\t\t\t};\n\t\t\t} else if (typeof document.attachEvent !== 'undefined') { // IE\n\t\t\t\tutils.addListener = function (el, type, fn) {\n\t\t\t\t\tel.attachEvent('on' + type, fn);\n\t\t\t\t};\n\t\t\t\tutils.removeListener = function (el, type, fn) {\n\t\t\t\t\tel.detachEvent('on' + type, fn);\n\t\t\t\t};\n\t\t\t} else { // older browsers\n\t\t\t\tutils.addListener = function (el, type, fn) {\n\t\t\t\t\tel['on' + type] = fn;\n\t\t\t\t};\n\t\t\t\tutils.removeListener = function (el, type, fn) {\n\t\t\t\t\tel['on' + type] = null;\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// reference\n\t\t\t// http://www.jspatterns.com/\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "function-patterns/memoization.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Memoization\n\t\t\t Description: use function properties to avoid repeated computation\n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\t// reason see: https://github.com/shichuan/javascript-patterns/issues/6\n\t\t\tvar myFunc = function (param) {\n\t\t\t\tif (!myFunc.cache[param]) {\n\t\t\t\t\tvar result = {};\n\t\t\t\t\t// ... expensive operation ...\n\t\t\t\t\tmyFunc.cache[param] = result;\n\t\t\t\t}\n\t\t\t\treturn myFunc.cache[param];\n\t\t\t};\n\n\t\t\t// cache storage\n\t\t\tmyFunc.cache = {};\n\n\n\t\t\t// preferred method 1\n\t\t\t// only one argument using param\n\n\t\t\tvar myFunc = function (param) {\n\t\t\t\tif (!myFunc.cache.hasOwnProperty(param)) {\n\t\t\t\t\tvar result = {};\n\t\t\t\t\t// ... expensive operation ...\n\t\t\t\t\tmyFunc.cache[param] = result;\n\t\t\t\t}\n\t\t\t\treturn myFunc.cache[param];\n\t\t\t};\n\n\t\t\t// cache storage\n\t\t\tmyFunc.cache = {};\n\n\n\t\t\t// preferred method 2\n\t\t\t// multiple arguments using JSON stringify\n\t\t\t\n\t\t\t// this will only work correctly for primitive (and Array) arguments, \n\t\t\t// since the order in which properties of Objects are enumerated is undetermined \n\t\t\t// and can even change between enumerations. \n\t\t\t// (a JSON encoder that sorts the keys won't have this issue).\n\n\t\t\tvar myFunc = function () {\n\t\t\t\tvar cachekey = JSON.stringify(Array.prototype.slice.call(arguments)),\n\t\t\t\t\t\tresult;\n\t\t\t\tif (!myFunc.cache[cachekey]) {\n\t\t\t\t\tresult = {};\n\t\t\t\t\t// ... expensive operation ...\n\t\t\t\t\tmyFunc.cache[cachekey] = result;\n\t\t\t\t}\n\t\t\t\treturn myFunc.cache[cachekey];\n\t\t\t};\n\n\t\t\t// cache storage\n\t\t\tmyFunc.cache = {};\n\n\n\t\t\t// preferred method 3\n\t\t\t// multiple arguments using arguments.callee\n\n\t\t\tvar myFunc = function (param) {\n\t\t\t\tvar f = arguments.callee,\n\t\t\t\t\t\tresult;\n\t\t\t\tif (!f.cache[param]) {\n\t\t\t\t\tresult = {};\n\t\t\t\t\t// ... expensive operation ...\n\t\t\t\t\tf.cache[param] = result;\n\t\t\t\t}\n\t\t\t\treturn f.cache[param];\n\t\t\t};\n\n\t\t\t// cache storage\n\t\t\tmyFunc.cache = {};\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "function-patterns/partial-application.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Partial application\n\t\t\t Description: the process of fixing a number of arguments to a function, producing another function of smaller arity\n\t\t\t */\n\n\t\t\tvar partialAny = (function(aps){\n\n\t\t\t\t// This function will be returned as a result of the immediately \n\t\t\t\t// invoked function expression and assigned to the `partialAny` var.\n\t\t\t\tfunction func(fn){\n\t\t\t\t\tvar argsOrig = aps.call(arguments, 1);\n\t\t\t\t\treturn function() {\n\t\t\t\t\t\tvar args = [],\n\t\t\t\t\t\t\targsPartial = aps.call(arguments),\n\t\t\t\t\t\t\ti = 0;\n\t\t\t\t\t\t// Iterate over all the originally-spedicified arguments. If that\n\t\t\t\t\t\t// argument was the `partialAny._` placeholder, use the next just\n\t\t\t\t\t\t// passed-in argument, otherwise use the originally-specified \n\t\t\t\t\t\t// argument.\n\t\t\t\t\t\tfor ( ; i < argsOrig.length; i++ ) {\n\t\t\t\t\t\t\targs[i] = argsOrig[i] === func._\n\t\t\t\t\t\t\t? argsPartial.shift()\n\t\t\t\t\t\t\t: argsOrig[i];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If any just-passed-in arguments remain, add them to the end.\n\t\t\t\t\t\treturn fn.apply( this, args.concat( argsPartial ));\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\t// This is used as the placeholder argument.\n\t\t\t\tfunc._ = {};\n\n\t\t\t\treturn func;\n\t\t\t})(Array.prototype.slice);\n\n\t\t\t// Slightly more legitimate example\n\n\t\t\tfunction hex( r, g, b ) {\n\t\t\t\treturn '#' + r + g + b;\n\t\t\t}\n\n\t\t\tvar redMax = partialAny( hex, 'ff', partialAny._, partialAny._);\n\t\t\tconsole.log(redMax('11','22')); // \"#ff1122\"\n\n\t\t\t// Because `_` is easier on the eyes than `partialAny._`, let's use\n\t\t\t// that instead. This is, of course, entirely optional, and the name\n\t\t\t// could just as well be `foo` or `PLACEHOLDER` instead of `_`.\n\n\t\t\tvar __ = partialAny._;\n\n\t\t\tvar greenMax = partialAny( hex, __, 'ff' );\n\t\t\tconsole.log(greenMax( '33', '44' )); \n\n\t\t\tvar blueMax = partialAny( hex, __, __, 'ff' );\n\t\t\tconsole.log(blueMax( '55', '66' ));\n\n\t\t\tvar magentaMax = partialAny( hex, 'ff', __, 'ff' );\n\t\t\tconsole.log(magentaMax( '77' )); \n\n\t\t\t// reference\n\t\t\t// http://msdn.microsoft.com/en-us/magazine/gg575560.aspx\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "function-patterns/returning-functions.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Returning functions\n\t\t\t Description: one function returns another function or create another function on-demand\n\t\t\t */\n\n\t\t\tvar setup = function () {\n\t\t\t\tconsole.log(1);\n\t\t\t\treturn function () {\n\t\t\t\t\tconsole.log(2);\n\t\t\t\t};\n\t\t\t};\n\t\t\t// using the setup function\n\t\t\tvar my = setup(); // alerts 1\n\t\t\tmy(); // alerts 2\n\n\n\t\t\t \n\t\t\t// Your setup function can store some private data in a closure and use that data somehow.\n\t\t\t// Here setup() creates a counter function, which gives a next ID for example. But the count variable is not exposed.\n\t\t\t\n\t\t\tvar setup = function () {\n\t\t\t\tvar count = 0;\n\t\t\t\treturn function () {\n\t\t\t\t\treturn ++count;\n\t\t\t\t};\n\t\t\t};\n\t\t\t// usage\n\t\t\tvar next = setup();\n\t\t\t//next(); // returns 1\n\t\t\t//next(); // returns 2\n\t\t\t//next(); // returns 3\n\t\t\t\n\t\t\tvar newCodes = function(){  \n\t\t\t    var dCodes = 'one'; \n\t\t\t    var dCodes2 = 'two';     \n\t\t\t    return [dCodes, dCodes2];  \n\t\t\t};\n\t\t\t\n\t\t\tvar codes = newCodes();\n\t\t\tvar dCodes = codes[0]; //access the first\n\t\t\tvar dCodes2 = codes[1]; //access the second\n\t\t\t\n\t\t\tvar newCodes = function(){  \n\t\t\t    var dCodes = 'one'; // Linked ICDs  \n\t\t\t    var dCodes2 = 'two'; //Linked CPTs       \n\t\t\t    return {\n\t\t\t        dCodes: dCodes,\n\t\t\t        dCodes2: dCodes2\n\t\t\t    };  \n\t\t\t};\n\t\t\t\n\t\t\tvar codes = newCodes();\n\t\t\tvar dCodes = codes.dCodes; //access the one called dcodes\n\t\t\tvar dCodes2 = codes.dCodes2; //access the one called dcodes2\n\t\t\t\n\t\t\t// reference\n\t\t\t// http://www.jspatterns.com/returning-functions/\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "function-patterns/self-defining-functions.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Self-defining functions\n\t\t\t Description: self-overwrite with new bodies to do less work from the second invocation and after\n\t\t\t */\n\n\t\t\tvar scareMe = function () {\n\t\t\t\talert(\"Boo!\");\n\t\t\t\tscareMe = function () {\n\t\t\t\t\talert(\"Double boo!\");\n\t\t\t\t};\n\t\t\t};\n\n\t\t\t// 1. adding a new property\n\t\t\tscareMe.property = \"properly\";\n\t\t\t// 2. assigning to a different name\n\t\t\tvar prank = scareMe;\n\t\t\t// 3. using as a method\n\t\t\tvar spooky = {\n\t\t\t\tboo:scareMe\n\t\t\t};\n\t\t\t// calling with a new name\n\t\t\tprank(); // \"Boo!\"\n\t\t\tprank(); // \"Boo!\"\n\t\t\tconsole.log(prank.property); // \"properly\"\n\t\t\t// calling as a method\n\t\t\tspooky.boo(); // \"Boo!\"\n\t\t\tspooky.boo(); // \"Boo!\"\n\t\t\tconsole.log(spooky.boo.property); // \"properly\"\n\t\t\t// using the self-defined function\n\t\t\tscareMe(); // Double boo!\n\t\t\tscareMe(); // Double boo!\n\t\t\tconsole.log(scareMe.property); // undefined\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "function-patterns/self-overwrite.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\n\t\t\tfunction next() {\n\t\t\t\tvar count = 1;\n\t\t\t\tnext = function () {\n\t\t\t\t\treturn ++count;\n\t\t\t\t};\n\t\t\t\treturn count;\n\t\t\t}\n\t\t\tconsole.log(next()); // 1\n\t\t\tconsole.log(next()); // 2\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "general-patterns/access-to-global-object.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Access to the Global Object\n\t\t\t * Description: access the global object without hard-coding the identifier window\n\t\t\t */\n\n\t\t\t// access to the Global Object\n\t\t\t// this should work in ES3, ES5 and ES5-strict.\n\t\t\tvar global = (function (g) {\n\t\t\t\treturn g;\n\t\t\t})(this);\n\n\t\t\t// Test Cases\n\t\t\t// http://jsperf.com/globalx/7\n\n\t\t\t// References\n\t\t\t// http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "general-patterns/avoiding-eval.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Avoiding eval()\n\t\t\t * Description: avoid using eval()\n\t\t\t */\n\n\t\t\t// antipattern 1\n\t\t\tvar property = \"name\",\n\t\t\t    obj = { name: \"John\" };\n\n\t\t\talert(eval(\"obj.\" + property));\n\n\n\t\t\t// preferred 1\n\t\t\talert(obj[property]);\n\n\n\t\t\t/* antipattern 2\n\t\t\t * It's also important to remember that passing strings to setInterval(), setTimeout(),\n\t\t\t * and the Function() constructor is, for the most part, similar to using eval() and therefore should be avoided.\n\t\t\t */\n\t\t\tsetTimeout(\"myFunc()\", 1000);\n\t\t\tsetTimeout(\"myFunc(1, 2, 3)\", 1000);\n\n\n\t\t\t// preferred 2\n\t\t\tsetTimeout(myFunc, 1000);\n\t\t\tsetTimeout(function () {\n\t\t\t\tmyFunc(1, 2, 3);\n\t\t\t}, 1000);\n\t\t\t// in supported browsers (i.e. not IE)\n\t\t\tsetTimeout(myFunc, 1000, 1, 2, 3);\n\n\t\t\t// References\n\t\t\t// http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "general-patterns/avoiding-implied-typecasting.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Implied Typecasting\n\t\t\t * Description: avoid implied typecasting\n\t\t\t */\n\n\t\t\tvar zero = 0;\n\n\t\t\t/* antipattern\n\t\t\t * JavaScript implicitly typecasts variables when you compare them.\n\t\t\t * That's why comparisons such as false == 0 or \"\" == 0 return true.\n\t\t\t */\n\t\t\tif (zero == false) {\n\t\t\t\t// this block is executed...\n\t\t\t}\n\n\n\t\t\t// preferred\n\t\t\t/* To avoid confusion caused by the implied typecasting,\n\t\t\t * always use the === and !== operators that check both the values and the type of the expressions you compare\n\t\t\t */\n\t\t\tif (zero === false) {\n\t\t\t\t// not executing because zero is 0, not false\n\t\t\t}\n\n\n\t\t\t/* NOTE: There's another school of thought that subscribes to the opinion that it's redundant to use === when == is\n\t\t\t * sufficient. For example, when you use typeof you know it returns a string, so there's no reason to use strict\n\t\t\t * equality. However, JSLint requires strict equality; it does make the code look consistent and reduces the mental\n\t\t\t * effort when reading code. (\"Is this == intentional or an omission?\")\n\t\t\t */\n\n\n\t\t\t// References\n\t\t\t// http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "general-patterns/built-in-prototypes.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: (Not) Augmenting Built-in Prototypes\n\t\t\t * Description: it can seriously hurt maintainability, because it will make your code less predictable\n\t\t\t */\n\n\t\t\t/* NOTE: You can make an exception of the rule only when all these conditions are met:\n\n\t\t\t * 1. It's expected that future ECMAScript versions or JavaScript implementations will implement this functionality\n\t\t\t *    as a built-in method consistently. For example, you can add methods described in ECMAScript 5 while waiting for\n\t\t\t *    the browsers to catch up. In this case you’re just defining the useful methods ahead of time.\n\t\t\t * 2. You check if your custom property or method doesn't exist already—maybe already implemented somewhere else in\n\t\t\t *    the code or already part of the JavaScript engine of one of the browsers you support.\n\t\t\t * 3. You clearly document and communicate the change with the team.\n\t\t\t */\n\t\t\tif (typeof Object.prototype.myMethod !== \"function\") {\n\t\t\t\tObject.prototype.myMethod = function () {\n\t\t\t\t\t// implementation...\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// References\n\t\t\t// http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "general-patterns/conditionals.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Conditionals\n\t\t\t * Description: pattern and antipattern of using if else\n\t\t\t */\n\n\t\t\t/* NOTE: Paul Irish states that the first statement (normal pattern) is only an antipattern when optimizing for\n\t\t\t * low-bandwidth source (such as for a bookmarklet).\n\t\t\t * Using the normal pattern will generally outperform the regex (alternative method 1) in a loop,\n\t\t\t * and is faster than the object literal (alternative method 2) for lower numbers of conditions,\n\t\t\t * they generally even out around 10 conditions.\n\t\t\t * See http://jsperf.com/if-this-or-that\n\t\t\t */\n\n\t\t\t// normal pattern\n\t\t\tif (type === 'foo' || type === 'bar') {\n\t\t\t}\n\n\n\t\t\t// alternative method 1 - regex test\n\t\t\tif (/^(foo|bar)$/.test(type)) {\n\t\t\t}\n\n\n\t\t\t// alternative method 2 - object literal lookup (smaller if < 5 items)\n\t\t\tif (({foo:1, bar:1})[type]) {\n\t\t\t}\n\n\n\t\t\t/* alternative method 3 - binary-search-like approach\n\t\t\t * This approach is best when there are ranges of values for which to test\n\t\t\t */\n\t\t\tif (value < 6) {\n\t\t\t\tif (value < 3) {\n\t\t\t\t\tif (value == 0) {\n\t\t\t\t\t\treturn result0;\n\t\t\t\t\t} else if (value == 1) {\n\t\t\t\t\t\treturn result1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn result2;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (value == 3) {\n\t\t\t\t\t\treturn result3;\n\t\t\t\t\t} else if (value == 4) {\n\t\t\t\t\t\treturn result4;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn result5;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (value < 8) {\n\t\t\t\t\tif (value == 6) {\n\t\t\t\t\t\treturn result6;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn result7;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (value == 8) {\n\t\t\t\t\t\treturn result8;\n\t\t\t\t\t} else if (value == 9) {\n\t\t\t\t\t\treturn result9;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn result10;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t/* alternative method 4 - object/array lookup tables\n\t\t\t * Most useful when there is logical mapping between a single key and a single value\n\t\t\t */\n\t\t\tif (value == 0) {\n\t\t\t\treturn result0;\n\t\t\t} else if (value == 1) {\n\t\t\t\treturn result1;\n\t\t\t} else if (value == 2) {\n\t\t\t\treturn result2;\n\t\t\t}\n\t\t\t\n\t\t\t// define the array of results\n\t\t\tvar results = [result0, result1, result2];\n\t\t\t// return the correct result\n\t\t\treturn results[value];\n\t\t\t\n\t\t\t\n\t\t\t/* alternative method 5 - only using logical operators\n\t\t\t * Shorter way to use simple statements\n\t\t\t */\n\t\t\tvar \n\t\t\t\ttype = 'foo',\n\t\t\t\ttype2 = 'bar',\n\t\t\t\tresult = 0;\n\t\t\t\t\n\t\t\ttype == 'foo' && result++;\n\t\t\tconsole.log(result); // 1\n\t\t\t!type == 'foo' || result++;\n\t\t\tconsole.log(result); // 2\n\t\t\ttype == 'foo' && type2 == 'bar' && result++;\n\t\t\tconsole.log(result); //3\n\t\t\ttype == 'foo' && type2 == 'bar' && result == 3 && (result=0); //parentheses avoid \"invalid assignment left-hand side\" error\n\t\t\tconsole.log(result); //0\n\t\t\ttype == 'OOF' || result++; //equivalent: type != 'OOF' && result++;\n\t\t\tconsole.log(result); //1\t\t\t\n\n\n\t\t\t// References\n\t\t\t// http://paulirish.com/2009/perf/\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "general-patterns/for-in-loops.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: for-in loops\n\t\t\t * Description: optimized for-in loops\n\t\t\t */\n\t\t\t// the object\n\t\t\tvar man = {\n\t\t\t\thands:2,\n\t\t\t\tlegs:2,\n\t\t\t\theads:1\n\t\t\t};\n\t\t\t// somewhere else in the code\n\t\t\t// a method was added to all objects\n\t\t\tif (typeof Object.prototype.clone === 'undefined') {\n\t\t\t\tObject.prototype.clone = function () {\n\t\t\t\t};\n\t\t\t}\n\t\t\t\n\t\t\t// antipattern\n\t\t\t// for-in loop without checking hasOwnProperty()\n\t\t\tfor (var i in man) {\n\t\t\t\tconsole.log(i, \":\", man[i]);\n\t\t\t}\n\t\t\t/*\n\t\t\t * result in the console\n\t\t\t * hands : 2\n\t\t\t * legs : 2\n\t\t\t * heads : 1\n\t\t\t * clone: function()\n\t\t\t */\n\t\t\t// preferred 1\n\t\t\tfor (var i in man) {\n\t\t\t\tif (man.hasOwnProperty(i)) { // filter\n\t\t\t\t\tconsole.log(i, \":\", man[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t/*\n\t\t\t * result in the console\n\t\t\t * hands : 2\n\t\t\t * legs : 2\n\t\t\t * heads : 1\n\t\t\t */\n\t\t\t// preferred 2\n\t\t\t// benefit is you can avoid naming collisions in case the `man` object has redefined `hasOwnProperty`\n\t\t\tfor (var i in man) {\n\t\t\t\tif (Object.prototype.hasOwnProperty.call(man, i)) { // filter\n\t\t\t\t\tconsole.log(i, \":\", man[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// preferred 3\n\t\t\t// use a local variable to \"cache\" `Object.prototype.hasOwnProperty`\n\t\t\tvar i,\n\t\t\t\t\thasOwn = Object.prototype.hasOwnProperty;\n\t\t\tfor (i in man) {\n\t\t\t\tif (hasOwn.call(man, i)) { // filter\n\t\t\t\t\tconsole.log(i, \":\", man[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t//Preferred 4 \n\t\t\t/* Check if object has properties before print output\n\t\t\t *  using Object.keys(obj) and length built ins. A good method for \n\t\t\t *  not wasting resources and avoiding errors with larger objects\n\t\t\t */  \n\t\t\tif (Object.keys(man).length > 0){\n\t\t\t     for (var item in man)\n\t\t\t\t console.log(item,':',man[item]);\n\t\t\t} else { \n\t\t\t    console.log('Empty Object');}\n\t\t\t\n\t\t\t/*\t\n\t\t\t * hands : 2\n\t\t\t * legs : 2\n\t\t\t * heads : 1\n\t\t\t * clone : function() {\n\t\t\t *\t\t    }\n\t\t\t */\n\t\t\t\n\t\t\t\n\t\t\t// References\n\t\t\t// http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "general-patterns/for-loops.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: for loops\n\t\t\t * Description: optimized for loops\n\t\t\t */\n\n\t\t\t// sub-optimal loop\n\t\t\tfor (var i = 0; i < myarray.length; i++) {\n\t\t\t\t// do something with myarray[i]\n\t\t\t}\n\n\t\t\t// optimization 1 - cache the length of the array with the use of `max`\n\t\t\tfor (var i = 0, max = myarray.length; i < max; i++) {\n\t\t\t\t// do something with myarray[i]\n\t\t\t}\n\n\n\t\t\t// optimization 2 - use single var pattern for consistency\n\t\t\t// NOTE: A drawback is that it makes it a little harder to copy and paste whole loops while refactoring code.\n\t\t\tvar i = 0,\n\t\t\t\t\tmax,\n\t\t\t\t\tmyarray = [];\n\n\t\t\tfor (i = 0, max = myarray.length; i < max; i++) {\n\t\t\t\t// do something with myarray[i]\n\t\t\t}\n\n\n\t\t\t// optimization 3 - substitute `i++` with `i = i + 1`  or `i += 1` to avoid excessive trickiness\n\t\t\tvar i = 0,\n\t\t\t\t\tmax,\n\t\t\t\t\tmyarray = [];\n\n\t\t\tfor (i = 0, max = myarray.length; i < max; i += 1) {\n\t\t\t\t// do something with myarray[i]\n\t\t\t}\n\n\n\t\t\t// preferred 1\n\t\t\tvar i, myarray = [];\n\t\t\tfor (i = myarray.length; i--;) {\n\t\t\t\t// do something with myarray[i]\n\t\t\t}\n\n\n\t\t\t// preferred 2\n\t\t\tvar myarray = [],\n\t\t\t\t\ti = myarray.length;\n\t\t\twhile (i--) {\n\t\t\t\t// do something with myarray[i]\n\t\t\t}\n\n\n\t\t\t// References\n\t\t\t// http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "general-patterns/function-declarations.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Function Declarations\n\t\t\t * Description: creating anonymous functions and assigning them to a variable\n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\t// there is one benefit for this type of function decalaration:\n\t\t\t// you can call getData () before the declaration. \n\t\t\tfunction getData() {\n\t\t\t}\n\n\n\t\t\t// preferred\n\t\t\t/* Benefits:\n\t\t\t * 1. Makes it easier to understand \"functions as an object\".\n\t\t\t * 2. It enforces good semicolon habits.\n\t\t\t * 3. Doesn't have much of the baggage traditionally associated with functions and scope.\n\t\t\t */\n\t\t\tvar getData = function () {\n\t\t\t};\n\n\n\t\t\t// named function expression\n\t\t\t/* Benefits:\n\t\t\t * 1. Provides the debugger with an explicit function name: helps stack inspection.\n\t\t\t * Issues:\n\t\t\t * 3. Can break IE, coffeescript doesn't do function names:\n\t\t\t *    https://github.com/jashkenas/coffee-script/issues/366\n\t\t\t */\n\t\t\tvar getData = function getData () {\n\t\t\t};\n\n                        // named function expression + 'F'\n\t\t\t/* Benefits:\n\t\t\t * 1. Gets rid of (anonymous function) in stack traces\n\t\t\t * 2. Doesn't break an IE (well, unless there's a function name collision of the sort described here: https://github.com/jashkenas/coffee-script/issues/366#issuecomment-242134)\n\t\t\t */\n\t\t\tvar getData = function getDataF () {\n\t\t\t};\n\n\n\t\t\t// References\n\t\t\t// http://ejohn.org/blog/javascript-as-a-first-language/\n\t\t\t// http://kangax.github.com/nfe/\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "general-patterns/global-import.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: The Problem with Globals\n\t\t\t * Description: You can pass some global objects inside a function.\n\t\t\t */\n\n\t\t\t(function ($, YAHOO) {\n\t\t\t\t// now have access to globals jQuery (as $) and YAHOO in this code\n\t\t\t}(jQuery, YAHOO));\n\n\t\t\t// References\n\t\t\t// http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "general-patterns/globals.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: The Problem with Globals\n\t\t\t * Description: The problem is that they are shared among all the code in your JavaScript application or web page\n\t\t\t */\n\n\t\t\t// antipattern 1\n\t\t\tfunction sum(x, y) {\n\t\t\t\t// implied global\n\t\t\t\tresult = x + y;\n\t\t\t\treturn result;\n\t\t\t}\n\n\n\t\t\t// preferred 1\n\t\t\tfunction sum(x, y) {\n\t\t\t\t// a variable declared inside of a function is local to that function and not available outside the function\n\t\t\t\tvar result = x + y;\n\t\t\t\treturn result;\n\t\t\t}\n\n\n\t\t\t// antipattern 2\n\t\t\tfunction foo() {\n\t\t\t\tvar a = b = 0;\n\t\t\t\t// ...\n\t\t\t}\n\n\t\t\t// the preceding code snippet will behave as if you've typed the following\n\t\t\tvar a = (b = 0);\n\n\n\t\t\t// preferred 2\n\t\t\tfunction foo() {\n\t\t\t\tvar a, b;\n\t\t\t\t// ...\n\t\t\t\ta = b = 0; // both local\n\t\t\t}\n\n\t\t\t// References\n\t\t\t// http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "general-patterns/hoisting.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Hoisting\n\t\t\t * Description: var statements anywhere in a function act as if the variables were declared at the top of the function\n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\twontchange = \"global\"; // global variable\n\t\t\twillchange = \"global\"; // global variable\n\t\t\tfunction func_bad() {\n\t\t\t\talert(wontchange); // \"global\"\n\t\t\t\talert(willchange); // \"undefined\" due to the var below\n\t\t\t\tvar willchange = \"local\"; // This rescopes willchange inside this function\n\t\t\t\talert(willchange); // \"local\"\n\t\t\t}\n\t\t\tfunc_bad();\n\n\t\t\t// the preceding code snippet will behave as if it were implemented like so:\n\t\t\twontchange = \"global\"; // global variable\n\t\t\twillchange = \"global\"; // global variable\n\t\t\tfunction func() {\n\t\t\t\t// This still rescopes, but it is a lot more explicit\n\t\t\t\tvar willchange; // same as -> var willchange = undefined;\n\t\t\t\talert(wontchange); // \"global\"\n\t\t\t\talert(willchange); // \"undefined\"\n\t\t\t\twillchange = \"local\";\n\t\t\t\talert(willchange); // \"local\"\n\t\t\t}\n\t\t\tfunc();\n\n\n\t\t\t// References\n\t\t\t// http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "general-patterns/iife-for-loop.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n    <head>\n        <title>JavaScript Patterns</title>\n        <meta charset=\"utf-8\">\n    </head>\n    <body>\n        <script>\n            /* Title: iife for loops\n             * Description: loops that make use of counters as expected\n             */\n\n            // this will log 'regular loop 5'\n            for (var i = 0; i < 5; i++) {\n              setTimeout(function() {\n                console.log('regular loop', i);\n              }, 3000);\n            }\n\n            // this will log 'iife loop 1', 'iife loop 2', 'iife loop 3', 'iife loop 4'\n            for (var i = 0; i < 5; i++) {\n              (function(n) {\n                setTimeout(function() {\n                  console.log('iife loop', n);\n                }, 3000);\n              })(i);\n            }\n\n            // same results as the iife loop. Let isn't supported by all javascript versions\n            for (let i = 0; i < 5; i++) {\n              setTimeout(function() {\n                console.log('let loop', i);\n              }, 3000);\n            }\n\n            // References\n            // http://benalman.com/news/2010/11/immediately-invoked-function-expression/\n        </script>\n    </body>\n</html>"
  },
  {
    "path": "general-patterns/map-and-filter-by-reduce.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n<head>\n    <title>JavaScript Patterns</title>\n    <meta charset=\"utf-8\">\n</head>\n<body>\n<script>\n  /* Title: Map and Filter By Reduce\n   * Description: Combine map and filter with reduce\n   */\n\n  // Basic example\n  const euro = [29.76, 41.85, 46.5];\n  const above30 = euro.reduce((total, amount) => {\n    if (amount > 30) {\n      total.push(amount);\n    }\n    return total;\n  }, []);\n  console.log('above30', above30);\n\n  // Using async/await\n  async function foo() {\n    try {\n      var values = await getValues();\n\n      return await values.reduce(async function(values, value) {\n        values = await values;\n        value = await asyncOperation(value);\n        console.log(value);\n        values.push(value);\n        return values;\n      }, []);\n    } catch (err) {\n      console.log('We had an ', err);\n    }\n  }\n\n  // References\n  // https://medium.freecodecamp.org/reduce-f47a7da511a9\n  // https://code.tutsplus.com/tutorials/a-primer-on-es7-async-functions--cms-22367\n</script>\n</body>\n</html>"
  },
  {
    "path": "general-patterns/minimizing-globals.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Minimizing Globals\n\t\t\t Description: they are declared outside of any function or simply used without being declared\n\t\t\t */\n\n\t\t\tmyglobal = \"hello\"; // antipattern\n\t\t\tconsole.log(myglobal); // \"hello\"\n\t\t\tconsole.log(window.myglobal); // \"hello\"\n\t\t\tconsole.log(window[\"myglobal\"]); // \"hello\"\n\t\t\tconsole.log(this.myglobal); // \"hello\"\n\n\t\t\t// If you have to (gun to your head) use globals like jQuery does think of using a prefix and holding all your information in an object\n\t\t\tprefix_myglobal = {\n\t\t\t    method: function () {},\n\t\t\t    property: \"hello\"\n\t\t\t};\n\n\t\t\t// References\n\t\t\t// http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "general-patterns/parseint.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Number Conversions with parseInt()\n\t\t\t Description: use the second radix parameter\n\t\t\t */\n\n\t\t\t// pattern 1\n\t\t\t/* NOTE: in this example, if you omit the radix parameter like parseInt(year), the returned value will be 0,\n\t\t\t * because \"09\" assumes octal number (as if you did parseInt( year, 8 )) and 09 is not a valid digit in base 8.\n\t\t\t */\n\t\t\t //if we omit the radix parameter then the returned value is not zero, it takes base 10 in chrome console.please check\n\n\t\t\tvar month = \"06\",\n\t\t\tyear = \"09\";\n\t\t\tmonth = parseInt(month, 10);\n\t\t\tyear = parseInt(year, 10);\n\n\n\t\t\t// pattern 2\n\t\t\t/* NOTE: if you're expecting input such as “08 hello”, parseInt() will return a number, whereas the others will fail\n\t\t\t * with NaN.\n\t\t\t If the input string begins with \"0\", radix is eight (octal) or 10 (decimal).  \n\t\t\t Exactly which radix is chosen is *implementation-dependent*.  \n\t\t\t ECMAScript 5 specifies that 10 (decimal) is used, but not all browsers support this yet.  For this reason always specify a radix when using parseInt.\n\t\t\t */\n\t\t\t+\"08\" // result is 8\n\t\t\tNumber(\"08\") // 8\n\t\t\t\n\t\t\t//pattern 3\n\t\t\t/* NOTE: Bit operator parsing to int and chunk float vars, if a string has characters it return zero (0)\n\t\t\t *\n\t\t\t */\n\t\t\t(\"789\"|0) // => 789\n\t\t\t(\"sds\"|0) // => 0\n\t\t\t(8.45|0) // => 8\n\t\t\t(\"8.55\"|0) // => 8\n\n\t\t\t// References\n\t\t\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt\n\t\t\t// http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "general-patterns/shim-sniffing.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Shim Sniffing\n\t\t\t * Description: \n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\tArray.prototype.map = function() {\n\t\t\t\t// stuff\n\t\t\t};\n\n\t\t\t// better \n\t\t\tif (!Array.prototype.map) {\n\t\t\t\tArray.prototype.map = function() {\n\t\t\t\t\t// stuff\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// even better\n\t\t\tif (typeof Array.prototype.map !== \"function\") {\n\t\t\t\tArray.prototype.map = function() {\n\t\t\t\t\t// stuff\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t// If use either native or your own implementation, but not others:\n\t\t\t// When you call toString() of a native function it should return a string with a function that has a body of [native code] \n\n\t\t\t// by default there is white spaces and new lines issue\n\t\t\tconsole.log(Array.prototype.map.toString().replace(/\\s/g, '*'));\n\t\t\t// \"*function*map()*{*****[native*code]*}*\"  // IE\n\t\t\t// \"function*map()*{*****[native*code]*}\" // FF\n\t\t\t// \"function*map()*{*[native*code]*}\" // Chrome\n\n\t\t\t// a proper check can fix the problem\n\t\t\tconsole.log(Array.prototype.map.toString().replace(/\\s/g, ''));\n\t\t\t// \"functionmap(){[nativecode]}\"\n\n\t\t\t// a reusable shim() function\n\t\t\tfunction shim(o, prop, fn) {\n\t\t\t\tvar nbody = \"function\" + prop + \"(){[nativecode]}\";\n\t\t\t\tif (o.hasOwnProperty(prop) &&\n\t\t\t\t\to[prop].toString().replace(/\\s/g, '') === nbody) {\n\t\t\t\t\t// native!\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t// shim\n\t\t\t\to[prop] = fn;\n\t\t\t}\n\n\t\t\t// this is native, cool\n\t\t\tshim(\n\t\t\t\tArray.prototype, 'map',\n\t\t\t\tfunction(){/*...*/}\n\t\t\t); // true\n\n\t\t\t// this is new\n\t\t\tshim(\n\t\t\t\tArray.prototype, 'mapzer',\n\t\t\t\tfunction(){console.log(this)}\n\t\t\t);\n\n\t\t\t[1,2,3].mapzer(); // alerts 1,2,3\n\n\t\t\t// References\n\t\t\t// http://www.jspatterns.com/shim-sniffing/\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "general-patterns/single-var-pattern.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n  <head>\n    <title>JavaScript Patterns</title>\n    <meta charset=\"utf-8\">\n  </head>\n  <body>\n    <script>\n      /* Title: Single var Pattern\n       Description: use one var statement and declare multiple variables\n       */\n\n      /* Benefits:\n       * 1. Provides a single place to look for all the local variables needed by the function\n       * 2. Prevents logical errors when a variable is used before it's defined\n       * 3. Helps you remember to declare variables and therefore minimize globals\n       * 4. Is less code (to type and to transfer over the wire)\n       */\n\n      function func() {\n        var a = 1\n          , b = 2\n          , sum = a + b\n          , myobject = {}\n          , i\n          , j;\n\n        // function body...\n      }\n\n      function updateElement() {\n        var el = document.getElementById(\"result\")\n          , style = el.style;\n        // do something with el and style...\n      }\n      \n      // Preferred way \n      // Move commas BEFORE vars\n      // You'll not forget to add one when adding variable to the end of list\n      function func() {\n        var a = 1\n            , b = 2\n            , sum = a + b\n            , myobject = {}\n            , i\n            , j;\n\n        // function body...\n      }\n\n      // References\n      // http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/\n    </script>\n  </body>\n</html>"
  },
  {
    "path": "general-patterns/switch-pattern.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: switch Pattern\n\t\t\t Description: improve the readability and robustness of your switch statements\n\t\t\t */\n\n\t\t\t/* Style conventions:\n\t\t\t * 1. Aligning each `case` with `switch` (an exception to the curly braces indentation rule).\n\t\t\t * 2. Indenting the code within each case.\n\t\t\t * 3. Ending each `case` with a clear `break`;.\n\t\t\t * 4. Avoiding fall-throughs (when you omit the break intentionally). If you're absolutely convinced\n\t\t\t *    that a fall-through is the best approach, make sure you document such cases, because they might\n\t\t\t *    look like errors to the readers of your code.\n\t\t\t * 5. Ending the `switch` with a `default`: to make sure there's always a sane result even if none of \n\t\t\t *    the cases matched.\n\t\t\t */\n\n\t\t\t//antipattern\n\t\t\tvar inspect_me = 0,\n\t\t\t\t\tresult = '';\n\t\t\tswitch (inspect_me) {\n\t\t\tcase 0:\n\t\t\t\tresult = \"zero\";\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\tresult = \"one\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tresult = \"unknown\";\n\t\t\t}\n\n\t\t\t//preferred 1,\n\t\t\t//'cause it is much faster and easy to reuse and read\n\t\t\t//avoid to use switch\n\t\t\tvar results = {\n\t\t\t\t0: \"zero\",\n\t\t\t\t1: \"one\"\n\t\t\t};\n\n\t\t\tresult = results[inspect_me] || \"unknown\";\n\n\t\t\t//preferred 2\n\t\t\tvar resultFuncs = {\n\t\t\t\t0: function () {\n\t\t\t\t\t//some code for \"zero\" case\n\t\t\t\t\treturn \"zero\";\n\t\t\t\t},\n\t\t\t\t1: function () {\n\t\t\t\t\t//some code for one case\n\t\t\t\t\treturn \"one\";\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tresult = (resultFuncs[inspect_me] || function () {\n\t\t\t\t//some code for default case\n\t\t\t\treturn \"unknown\";\n\t\t\t})();\n\n\t\t\t// References\n\t\t\t// http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "img/.gitignore",
    "content": "!.gitignore\n\n"
  },
  {
    "path": "index.html",
    "content": "﻿<!doctype html>\r\n<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->\r\n<!--[if lt IE 7]> <html class=\"no-js lt-ie9 lt-ie8 lt-ie7\" lang=\"en\"> <![endif]-->\r\n<!--[if IE 7]>    <html class=\"no-js lt-ie9 lt-ie8\" lang=\"en\"> <![endif]-->\r\n<!--[if IE 8]>    <html class=\"no-js lt-ie9\" lang=\"en\"> <![endif]-->\r\n<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->\r\n<!--[if gt IE 8]><!--> <html class=\"no-js\" lang=\"en\"> <!--<![endif]-->\r\n<head>\r\n  <meta charset=\"utf-8\">\r\n\r\n  <!-- Use the .htaccess and remove these lines to avoid edge case issues.\r\n       More info: h5bp.com/b/378 -->\r\n  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\r\n\r\n  <title>JavaScript Patterns</title>\r\n  <meta name=\"description\" content=\"JavaScript patterns and antipatterns collection\">\r\n  <meta name=\"author\" content=\"Shi Chuan\">\r\n\r\n  <!-- Mobile viewport optimized: h5bp.com/viewport -->\r\n  <meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\r\n\r\n  <!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->\r\n  <link href='http://fonts.googleapis.com/css?family=Tinos:400,700,400italic' rel='stylesheet' type='text/css'>\r\n  <link rel=\"stylesheet\" href=\"css/style.css\">\r\n  \r\n  <!-- More ideas for your <head> here: h5bp.com/d/head-Tips -->\r\n\r\n  <!-- All JavaScript at the bottom, except this Modernizr build incl. Respond.js\r\n       Respond is a polyfill for min/max-width media queries. Modernizr enables HTML5 elements & feature detects; \r\n       for optimal performance, create your own custom Modernizr build: www.modernizr.com/download/ -->\r\n  <script src=\"js/libs/modernizr-2.0.6.min.js\"></script>\r\n</head>\r\n\r\n<body>\r\n  <a class=\"fork\" href=\"https://github.com/shichuan/javascript-patterns\">\r\n    <img src=\"http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png\" alt=\"Fork me on GitHub\">\r\n  </a>\r\n  <header>\r\n    <div class=\"clearfix\">\r\n      <h1>JavaScript Patterns Collection</h1> \r\n      <div id=\"btns\">\r\n      <span  class='st_sharethis_hcount' displayText='ShareThis'></span><span  class='st_twitter_hcount' displayText='Tweet'></span><span  class='st_facebook_hcount' displayText='Facebook'></span><span  class='st_plusone_hcount' ></span>\r\n      </div>\r\n    </div>\r\n    <img src=\"img/js-patterns.png\" alt=\"JS Patterns\" title=\"JS Patterns\" />\r\n    <nav id=\"toc\" class=\"sticky\">\r\n      <ul>\r\n        <li><a href=\"#general-patterns\">General Patterns</a></li>\r\n        <li><a href=\"#jquery-patterns\">jQuery Patterns</a></li>\r\n        <li><a href=\"#jquery-plugin-patterns\">jQuery Plugin Patterns</a></li>\r\n        <li><a href=\"#literals-and-constructor\">Literals and Constructor Patterns</a></li>\r\n        <li><a href=\"#function-patterns\">Function Patterns</a></li>\r\n        <li><a href=\"#object-creation-patterns\">Object Creation Patterns</a></li>\r\n        <li><a href=\"#code-reuse-patterns\">Code Reuse Patterns</a></li> \r\n        <li><a href=\"#design-patterns\">Design Patterns</a></li>  \r\n      </ul>\r\n    </nav>\r\n  </header>\r\n  <div role=\"main\">\r\n    <section id=\"intro\">\r\n      <p>A JavaScript pattern and antipattern collection that covers function patterns, jQuery patterns, jQuery plugin patterns, design patterns, general patterns, literals and constructor patterns, object creation patterns, code reuse patterns, DOM and browser patterns (<em>upcoming</em>).</p>\r\n      Patterns collected while developing <a href=\"http://www.xigan.com\">喜感网</a>.</p>\r\n    </section>\r\n    <section id=\"general-patterns\">\r\n      <h2>General Patterns</h2>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/function-declarations.html\" target=\"_blank\">Function Declarations</a> - creating anonymous functions and assigning them to a variable</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/conditionals.html\" target=\"_blank\">Conditionals</a> - pattern and antipattern of using if else</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/access-to-global-object.html\" target=\"_blank\">Access to the Global Object</a> - access the global object without hard-coding the identifier window</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/single-var-pattern.html\" target=\"_blank\">Single var Pattern</a> - use one var statement and declare multiple variables</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/hoisting.html\" target=\"_blank\">Hoisting</a> - var statements anywhere in a function act as if the variables were declared at the top of the function</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/for-loops.html\" target=\"_blank\">for loops</a> - optimized for loops</li> \r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/for-in-loops.html\" target=\"_blank\">for-in loops</a> - optimized for-in loops</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/built-in-prototypes.html\" target=\"_blank\">(Not) Augmenting Built-in Prototypes</a> - only augment built-in prototypes when certain conditions are met</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/switch-pattern.html\" target=\"_blank\">switch Pattern</a> - improve the readability and robustness of your switch statements</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/avoiding-implied-typecasting.html\" target=\"_blank\">Implied Typecasting</a> - avoid implied typecasting</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/avoiding-eval.html\" target=\"_blank\">Avoiding eval()</a> - avoid using eval()</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/parseint.html\" target=\"_blank\">Number Conversions with parseInt()</a> - use the second radix parameter</li>     \r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/minimizing-globals.html\" target=\"_blank\">Minimizing Globals</a> - create and access a global variable in a browser environment</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/general-patterns/globals.html\" target=\"_blank\">The Problem with Globals</a> - various problems with globals</li>\r\n      </ul>\r\n    </section>\r\n    \r\n    <section id=\"jquery-patterns\">\r\n      <h2>jQuery Patterns</h2>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/requery.html\" target=\"_blank\">requery</a> - avoid requery by using jQuery chaining</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/append.html\" target=\"_blank\">append</a> - use string concatenate and set innerHTML</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/data.html\" target=\"_blank\">data</a> - pattern and antipattern of using data</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/context-and-find.html\" target=\"_blank\">context and find</a> - use find over context</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/detach.html\" target=\"_blank\">detach</a> - take element off the DOM while manipulating them</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/event-delegation.html\" target=\"_blank\">event delegation</a> - event delegation pattern and antipattern</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/cache-selector.html\" target=\"_blank\">selector cache</a> - using selector cache to avoid requery</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/window-scroll-event.html\" target=\"_blank\">window scroll event</a> -  avoid attaching handlers to the window scroll event</li>\r\n      </ul>\r\n      <h3>Selector</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/left-and-right.html\" target=\"_blank\">Left and Right</a> - specific on the right, light on the left</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/decending-from-id.html\" target=\"_blank\">Decending from id</a> - be more specific</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/universal-selector.html\" target=\"_blank\">Universal Selector</a> - use of universal selector</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/specific-when-needed.html\" target=\"_blank\">Be Specific when Needed</a> - be specific only when needed</li>\r\n      </ul>\r\n      <h3 id=\"jquery-pubsub\">Publish–subscribe</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/pubsub-custom-events.html\" target=\"_blank\">Method 1</a> - custom events using .on() and .off()</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/pubsub-callback.html\" target=\"_blank\">Method 2</a> - using jQuery 1.7's $.Callbacks() feature</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/pubsub-observable.html\" target=\"_blank\">Method 3</a> - using jQuery UI $.Observable</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-patterns/pubsub-plugin.html\" target=\"_blank\">Method 4</a> - third-party plugins</li>\r\n      </ul>\r\n    </section>\r\n\r\n    <section id=\"jquery-plugin-patterns\">\r\n      <h2>jQuery Plugin Patterns</h2>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-plugin-patterns/basic.html\" target=\"_blank\">Basic</a> - the most basic pattern</li>\r\n\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-plugin-patterns/extend.html\" target=\"_blank\">Extend</a> - enables you to define multiple functions at once and which sometimes make more sense semantically</li>\r\n\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-plugin-patterns/lightweight.html\" target=\"_blank\">Lightweight</a> - perfect as a generic template for beginners and above</li>\r\n\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-plugin-patterns/namespaced-starter.html\" target=\"_blank\">Namespaced pattern</a> - to avoid collisions and improve code organization when working with components under another namespace</li>\r\n\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-plugin-patterns/prototypal-inheritance.html\" target=\"_blank\">Prototypal inheritance</a> - prototypal inheritance with the DOM-to-Object bridge pattern</li>\r\n\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-plugin-patterns/best-options.html\" target=\"_blank\">Best options</a> - globally/Per-call overridable options for greater option customization</li>\r\n\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-plugin-patterns/custom-events.html\" target=\"_blank\">Custom events (Pseudo Pub/Sub)</a> - for better application decoupling</li>\r\n\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-plugin-patterns/highly-configurable-mutable.html\" target=\"_blank\">'Highly configurable' mutable</a> - define plugin’s logic using a constructor and an object literal defined on its prototype</li>\r\n        \r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-plugin-patterns/ui-widget-factory.html\" target=\"_blank\">UI Widget factory</a> - for building complex, stateful plugins based on object-oriented principles</li>\r\n\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-plugin-patterns/ui-widget-factory-bridge.html\" target=\"_blank\">UI Widget factory \"bridge\"</a> - the bridge serves as a middle layer between a JavaScript object that is created using $.widget and jQuery’s API</li>\r\n\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-plugin-patterns/ui-widget-factory-mobile.html\" target=\"_blank\">UI Widget factory for jQuery mobile</a> - demonstrating best practices for building mobile widgets</li>\r\n\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/jquery-plugin-patterns/ui-widget-requirejs-module.html\" target=\"_blank\">UI Widget + RequireJS module</a> - for wrapping jQueryUI widgets inside RequireJS compatible modules</li>\r\n        \r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/tree/master/jquery-plugin-patterns/amd-commonjs\" target=\"_blank\">Universal Module Definition pattern</a> - create AMD and CommonJS compatible plugin modules which are compatible with a number of different script loaders</li>\r\n      </ul>    \r\n    </section>\r\n    \r\n    <section id=\"literals-and-constructor\">\r\n      <h2>Literals and Constructors Patterns</h2>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/literals-and-constructors/object-literal.html\" target=\"_blank\">Object literal</a> - use the simpler and reliable object literal instead of new Object();</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/literals-and-constructors/enforcing-new.html\" target=\"_blank\">Enforcing new</a> - when you forget `new`, `this` inside the constructor will point to the global object</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/literals-and-constructors/array-literal.html\" target=\"_blank\">Array literal</a> - use array literal notation to avoid potential errors when creating dynamic arrays at runtime</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/literals-and-constructors/json.html\" target=\"_blank\">Working with JSON</a> - use library from JSON.org, YUI, jQuery instead of eval for parsing</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/literals-and-constructors/primitive-wrappers.html\" target=\"_blank\">Primitive wrappers</a> - try to use the primitive without wrapper</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/literals-and-constructors/regular-expression-literal.html\" target=\"_blank\">Regular expression literal</a> - try to use the shorter literal notation</li>\r\n      </ul>\r\n    </section>\r\n\r\n    <section id=\"function-patterns\">\r\n      <h2>Function Patterns</h2>\r\n      <h3>API Patterns</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/callback.html\" target=\"_blank\">Callback patterns</a> - when you pass function A to function B as a parameter, function A is a callback function</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/configuration-objects.html\" target=\"_blank\">Configuration objects </a>- keep control of function arguments and makes it easily configurable</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/returning-functions.html\" target=\"_blank\">Returning functions </a>- one function returns another function or create another function on-demand</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/currying.html\" target=\"_blank\">Currying</a> - used to create new functions dynamically by partially applying a set of arguments</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/partial-application.html\" target=\"_blank\">Partial application</a> - the process of fixing a number of arguments to a function, producing another function of smaller arity</li>\r\n        \r\n      </ul>\r\n      \r\n      <h3>Initialization patterns</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/immediate-functions.html\" target=\"_blank\">Immediate functions</a> - syntax that enables function execution as soon as it is defined</li> \r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/immediate-object-initialization.html\" target=\"_blank\">Immediate object initialization</a> - this pattern is mainly suitable for one-off tasks</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/init-time-branching.html\" target=\"_blank\">Init-time branching</a> - branch code once during initlization initialization</li>\r\n      </ul>\r\n      \r\n      <h3>Performance patterns</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/memoization.html\" target=\"_blank\">Memoization</a> - use function properties to avoid repeated computation</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/function-patterns/self-defining-functions.html\" target=\"_blank\">Self-defining functions</a> - self-overwrite with new bodies to do less work from the second invocation and after</li>\r\n      </ul>\r\n    </section>\r\n\r\n    <section id=\"object-creation-patterns\">\r\n      <h2>Object Creation Patterns</h2>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/namespace.html\" target=\"_blank\">Namespace</a> - namespaces help reduce the number of globals required and avoid naming collisions or excessive name prefixing</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/declaring-dependencies.html\" target=\"_blank\">Declaring Dependencies</a> - it's good to declare the modules your code relies on at the top</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/private-properties-and-methods.html\" target=\"_blank\">Private Properties and Methods</a> - JavaScript doesn't have special syntax for private members, you can implement them using a closure</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/revelation.html\" target=\"_blank\">Revelation Pattern</a> - it is about having private methods, which you also expose as public methods</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/module.html \" target=\"_blank\">Module Pattern</a> - all the methods are kept private and you only expose those that you decide at the end</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/sandbox.html\" target=\"_blank\">Sandbox</a> - it provides an environment for the modules to work without affecting other modules and their personal sandboxes</li>        \r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/static-members.html\" target=\"_blank\">Static Members</a> - public and private static members</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/object-constants.html\" target=\"_blank\">Object Constants</a> - an implementation of a contant object provides set, inDefined and get methods</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/chaining.html\" target=\"_blank\">Chaining Pattern</a> - it enables you to call methods on an object one after the other</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/object-creation-patterns/sugar-method.html\" target=\"_blank\">method() Method</a> - adding convenient funcationality to a language</li>\r\n      </ul>\r\n    </section>\r\n\r\n    <section id=\"code-reuse-patterns\">\r\n      <h2>Code Reuse Patterns</h2>\r\n      <h3>Classical Patterns (patterns that should generally be avoided)</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/code-reuse-patterns/cp1-default.html\" target=\"_blank\">The default pattern</a> - create an object using the Parent() constructor and assign this object to the Child()'s prototype</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/code-reuse-patterns/cp2-rent-a-constructor.html\" target=\"_blank\">Rent a constructor</a> - it borrows the parent constructor, passing the child object to be bound to this and also forwarding any arguments</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/code-reuse-patterns/cp3-rent-and-set-prototype.html\" target=\"_blank\">Rent and Set Prototype</a> - restricts object creation for a class to only one instance</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/code-reuse-patterns/cp4-share-the-prototype.html\" target=\"_blank\">Share the Prototype</a> - restricts object creation for a class to only one instance</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/code-reuse-patterns/cp5-a-temporary-constructor.html\" target=\"_blank\">A Temporary Constructor</a> - first borrow the constructor and then also set the child's prototype to point to a new instance of the constructor</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/code-reuse-patterns/klass.html\" target=\"_blank\">Klass</a> - generally a pattern that should be avoided unless one is more comfortable with class than prototype</li>\r\n      </ul>\r\n      <h3>Preferred Patterns</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/code-reuse-patterns/prototypal-inheritance.html\" target=\"_blank\">Prototypal Inheritance</a> - objects inherit from other objects</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/code-reuse-patterns/inheritance-by-copying-properties.html\" target=\"_blank\">Inheritance by Copying Properties</a> - an object gets functionality from another object, simply by copying it</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/code-reuse-patterns/mix-ins.html\" target=\"_blank\">Mix-ins</a> - copy from any number of objects and mix them all into a new object</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/code-reuse-patterns/borrowing-methods.html\" target=\"_blank\">Borrowing Methods</a> - reuse one or two methods of an existing object without forming a parent-child relationship with that object</li>\r\n      </ul>\r\n    </section>\r\n    \r\n    <section id=\"design-patterns\">\r\n      <h2>Design Patterns</h2>\r\n      <h3>Creational</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/builder.html\" target=\"_blank\">Builder</a> - constructs complex objects by separating construction and representation</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/factory.html\" target=\"_blank\">Factory method</a> - creates objects without specifying the exact class to create</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/singleton.html\" target=\"_blank\">Singleton</a> - restricts object creation for a class to only one instance</li>\r\n      </ul>\r\n      <h3>Structural</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/decorator.html\" target=\"_blank\">Decorator</a> - dynamically adds/overrides behaviour in an existing method of an object</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/facade.html\" target=\"_blank\">Facade</a> - provides a simplified interface to a large body of code</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/proxy.html\" target=\"_blank\">Proxy</a> - provides a placeholder for another object to control access, reduce cost, and reduce complexity</li>\r\n      </ul>\r\n      <h3>Behavioral</h3>\r\n      <ul>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/chain-of-responsibility.html\" target=\"_blank\">Chain of responsibility</a> - delegates commands to a chain of processing objects</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/command.html\" target=\"_blank\">Command</a> - creates objects which encapsulate actions and parameters</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/iterator.html\" target=\"_blank\">Iterator</a> - implements a specialized language</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/mediator.html\" target=\"_blank\">Mediator</a> - allows loose coupling between classes by being the only class that has detailed knowledge of their methods</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/observer.html\" target=\"_blank\">Observer</a> - is a publish/subscribe pattern which allows a number of observer objects to see an event</li>\r\n        <li><a href=\"https://github.com/shichuan/javascript-patterns/blob/master/design-patterns/strategy.html\" target=\"_blank\">Strategy</a> - allows one of a family of algorithms to be selected on-the-fly at runtime</li>\r\n      </ul>\r\n    </section>\r\n    \r\n    <section>\r\n      <h2><em>References</em></h2>\r\n      <ol>    \r\n        <li>\r\n        The Essentials of Writing High Quality JavaScript<br />\r\n        <a href=\"http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/\" target=\"_blank\">http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/</a>\r\n        </li>\r\n        <li>\r\n        JSPatterns<br />\r\n        <a href=\"http://www.jspatterns.com/\" target=\"_blank\">http://www.jspatterns.com/</a>\r\n        </li>\r\n        <li>\r\n        jQuery Anti-Patterns for Performance & Compression<br />\r\n        <a href=\"http://paulirish.com/2009/perf/\" target=\"_blank\">http://paulirish.com/2009/perf/</a>\r\n        </li>\r\n        <li>\r\n        How DRY Affects JavaScript Performance<br />\r\n        <a href=\"http://velocityconf.com/velocityeu/public/schedule/detail/21634\" target=\"_blank\">http://velocityconf.com/velocityeu/public/schedule/detail/21634</a>\r\n        </li>\r\n        <li>\r\n        Object Oriented JavaScript<br />\r\n        <a href=\"http://www.packtpub.com/object-oriented-javascript/book\" target=\"_blank\">http://www.packtpub.com/object-oriented-javascript/book</a>\r\n        </li>\r\n        <li>\r\n        JavaScript Patterns<br />\r\n        <a href=\"http://shop.oreilly.com/product/9780596806767.do\" target=\"_blank\">http://shop.oreilly.com/product/9780596806767.do</a>\r\n        </li>\r\n        <li>\r\n        JavaScript: The Good Parts<br />\r\n        <a href=\"http://shop.oreilly.com/product/9780596517748.do\" target=\"_blank\">http://shop.oreilly.com/product/9780596517748.do</a>\r\n        </li>\r\n        <li>\r\n        Pro JavaScript Design Patterns<br />\r\n        <a href=\"http://jsdesignpatterns.com/\" target=\"_blank\">http://jsdesignpatterns.com/</a>\r\n        </li>\r\n        <li>\r\n        Essential JavaScript Design Patterns For Beginners, Volume 1.<br />\r\n        <a href=\"http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/\" target=\"_blank\">http://www.addyosmani.com/resources/essentialjsdesignpatterns/book/</a>\r\n        </li>\r\n        <li>\r\n        Eloquent JavaScript<br />\r\n        <a href=\"http://eloquentjavascript.net/\" target=\"_blank\">http://eloquentjavascript.net/</a>\r\n        </li>\r\n      </ol>\r\n    </section>\r\n  </div>\r\n  <footer>\r\n    by <a href=\"http://twitter.com/#!/shichuan\">@shichuan</a> from <a href=\"http://www.xigan.com\">喜感网</a>\r\n  </footer>\r\n\r\n\r\n  <!-- JavaScript at the bottom for fast page loading -->\r\n  <script type=\"text/javascript\">var switchTo5x=false;</script><script type=\"text/javascript\" src=\"http://w.sharethis.com/button/buttons.js\"></script>\r\n  <script type=\"text/javascript\">\r\n    stLight.options({\r\n      publisher:'44fc3536-fd12-4c07-970d-6654da9a2d6c',\r\n      st_url:'http://shichuan.github.com/javascript-patterns/'\r\n    });\r\n  </script>\r\n  \r\n  <!-- Asynchronous Google Analytics snippet. Change UA-XXXXX-X to be your site's ID.\r\n       mathiasbynens.be/notes/async-analytics-snippet -->\r\n  <script>\r\n    var _gaq=[['_setAccount','UA-2773745-18'],['_trackPageview'],['_trackPageLoadTime']];\r\n    (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];\r\n    g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';\r\n    s.parentNode.insertBefore(g,s)}(document,'script'));\r\n  </script>\r\n\r\n  <!-- Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6.\r\n       chromium.org/developers/how-tos/chrome-frame-getting-started -->\r\n  <!--[if lt IE 7 ]>\r\n    <script defer src=\"//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js\"></script>\r\n    <script defer>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>\r\n  <![endif]-->\r\n\r\n</body>\r\n</html>\r\n"
  },
  {
    "path": "jquery-patterns/append.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: append\n\t\t\t * Description: use string concatenate and set innerHTML. Note that it is recommended to use the \n\t\t\t * array.join technique to concatenate long strings.\n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\t// appending inside\n\t\t\t$.each(reallyLongArray, function (count, item) {\n\t\t\t\tvar newLI = '<li>' + item + '</li>';\n\t\t\t\t$('#ballers').append(newLI);\n\t\t\t});\n\n\n\t\t\t// documentFragment off-DOM\n\t\t\tvar frag = document.createDocumentFragment();\n\t\t\t$.each(reallyLongArray, function (count, item) {\n\t\t\t\tvar newLI = $('<li>' + item + '</li>');\n\t\t\t\tfrag.appendChild(newLI[0]);\n\t\t\t});\n\t\t\t$('#ballers')[0].appendChild(frag);\n\n\n\t\t\t// string concatenate and set innerHTML\n\t\t\tvar myhtml = '';\n\t\t\t$.each(reallyLongArray, function (count, item) {\n\t\t\t\tmyhtml += '<li>' + item + '</li>';\n\t\t\t});\n\t\t\t$('#ballers').html(myhtml);\n\n\t\t\t// concatenate very long strings\n\t\t\tvar myHtmlBuffer = [];\n\t\t\t$.each(reallyLongArray, function(count, item) {\n\t\t\t\tmyHtmlBuffer.push('<li>' + item + '</li>');\n\t\t\t});\n\t\t\t$('#ballers').html(myHtmlBuffer.join(''));\n\n\t\t\t// References\n\t\t\t// http://paulirish.com/2009/perf/\n\t\t\t// http://www.sitepen.com/blog/2008/05/09/string-performance-an-analysis/\n\t\t\t// http://stackoverflow.com/questions/112158/javascript-string-concatenation\n\t\t\t// http://stackoverflow.com/questions/153381/javascript-string-concatenation-faster-than-this-example\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "jquery-patterns/cache-selector.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: selector cache\n\t\t\t Description: using selector cache to avoid requery\n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\t$('.list-item').click(function () {\n\t\t\t\t$('.photo').hide();\n\t\t\t});\n\n\n\t\t\t// preferred\n\t\t\tvar $photo;\n\t\t\t// prefix the cache with $ to help identify it as a selector cache later\n\t\t\t$('.list-item').click(function () {\n\t\t\t\t$photo = $photo || $('.photo');\n\t\t\t\t$photo.hide();\n\t\t\t});\n\n\n\t\t\t// References\n\t\t\t// http://ejohn.org/blog/learning-from-twitter/\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "jquery-patterns/context-and-find.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: context and find\n\t\t\t * Description: better to choose `find` over `context` \n\t\t\t */\n\n\t\t\t\n\t\t\tvar arms = $('div.robotarm', '#container');\n\t\t\t$('.reply_form', $(this).closest('.comment')).hide();\n\n\t\t\t// no performance gain over doing this, but a preferred pattern for readability reason\n\t\t\tvar arms = $('#container').find('div.robotarm');\n\t\t\t$(this).closest('.comment').find('.reply_form').hide();\n\t\t\t\n\n\t\t\t// References\n\t\t\t// http://paulirish.com/2009/perf/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-patterns/data.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: data\n\t\t\t * Description: pattern and antipattern of using data\n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\t$(elem).data(key, value);\n\n\n\t\t\t// preferred\n\t\t\t$.data(elem, key, value);\n\n\n\t\t\t// References\n\t\t\t// http://paulirish.com/2009/perf/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-patterns/decending-from-id.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Decending from id\n\t\t\t * Description: be more specific, better to descend from an id\n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\tvar arms = $('.container div.robotarm');\n\n\n\t\t\t// better\n\t\t\tvar arms = $('#container div.robotarm');\n\n\n\t\t\t// preferred\n\t\t\tvar arms = $('#container').find('div.robotarm');\n\n\n\t\t\t// References\n\t\t\t// http://paulirish.com/2009/perf/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-patterns/detach.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: detach\n\t\t\t * Description: take element off the DOM while manipulating them\n\t\t\t */\n\n\t\t\tvar table = $('#some-table');\n\t\t\tvar parent = table.parent();\n\n\t\t\ttable.detach();\n\t\t\ttable.addLotsAndLotsOfRows();\n\t\t\tparent.append(table);\n\n\n\t\t\t// References\n\t\t\t// http://paulirish.com/2009/perf/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-patterns/event-delegation.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: event delegation\n\t\t\t Description: event delegation pattern and antipattern\n\t\t\t */\n\n\t\t\t// antipattern \n\t\t\t// As of jQuery 1.7, the .live() method is deprecated\n\t\t\t// $('a.trigger', $('#container')[0]).live('click', handlerFn);\n\n\n\t\t\t// preferred\n\t\t\t$('#container').on('click', 'a.trigger', handlerFn);\n\n\t\t\t// .bind()\n\t\t\t// .live() - best used for simple scenario, it functions the best with a supply selector only, it's not chainable\n\t\t\t// .delegate() - it gives you a more focused way, it can better filter the elements, for example, table row\n\n\n\t\t\t// References\n\t\t\t// http://paulirish.com/2009/perf/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-patterns/left-and-right.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Left and Right\n\t\t\t * Description: specific on the right, light on the left\n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\t$('div.data .brad')\n\n\n\t\t\t// preferred\n\t\t\t$('.data td.brad')\n\n\n\t\t\t// References\n\t\t\t// http://paulirish.com/2009/perf/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-patterns/pubsub-callback.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js\"></script>\n\t\t<script>\n\t\t\t/* Title: Using jQuery 1.7's $.Callbacks() feature\n\t\t\t * Description: $.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, more information on it (including lots of examples) here: http://addyosmani.com/blog/jquery-1-7s-callbacks-feature-demystified/.\n\t\t\t */\n\n\t\t\tvar topics = {};\n\n\t\t\tjQuery.Topic = function( id ) {\n\t\t\t    var callbacks,\n\t\t\t        topic = id && topics[ id ];\n\t\t\t    if ( !topic ) {\n\t\t\t        callbacks = jQuery.Callbacks();\n\t\t\t        topic = {\n\t\t\t            publish: callbacks.fire,\n\t\t\t            subscribe: callbacks.add,\n\t\t\t            unsubscribe: callbacks.remove\n\t\t\t        };\n\t\t\t        if ( id ) {\n\t\t\t            topics[ id ] = topic;\n\t\t\t        }\n\t\t\t    }\n\t\t\t    return topic;\n\t\t\t};\n\n\t\t\tfunction fn1( value ){\n\t\t\t\tconsole.log( value );\n\t\t\t}\n\n\t\t\tfunction fn2( value ){\n\t\t\t\tfn1(\"fn2 says:\" + value);\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Usage:\n\t\t\t// Subscribers\n\t\t\t$.Topic( 'mailArrived' ).subscribe( fn1 );\n\t\t\t$.Topic( 'mailArrived' ).subscribe( fn2 );\n\t\t\t$.Topic( 'mailSent' ).subscribe( fn1 );\n\n\t\t\t// Publisher\n\t\t\t$.Topic( 'mailArrived' ).publish( 'hello world!' );\n\t\t\t$.Topic( 'mailSent' ).publish( 'woo! mail!' );\n\n\t\t\t//  Here, 'hello world!' gets pushed to fn1 and fn2\n\t\t\t//  when the 'mailArrived' notification is published\n\t\t\t//  with 'woo! mail!' also being pushed to fn1 when\n\t\t\t//  the 'mailSent' notification is published.\n\t\t\t/*\n\t\t\toutput:\n\t\t\thello world!\n\t\t\tfn2 says: hello world!\n\t\t\twoo! mail!\n\t\t\t*/\n\n\t\t\t// References\n\t\t\t// https://gist.github.com/1321768\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "jquery-patterns/pubsub-custom-events.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js\"></script>\n\t\t<script>\n\t\t\t/* Title: Custom events using .on() and .off()\n\t\t\t * Description: A really tiny pub/sub implementation for jQuery 1.7 using the two new methods(since jQuery 1.7): .on() and .off().\n\t\t\t */\n\n\t\t\t/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011\n\t\t\t * http://benalman.com/\n\t\t\t * Copyright (c) 2011 \"Cowboy\" Ben Alman; Licensed MIT, GPL */\n\n\t\t\t(function($) {\n\n\t\t\t  var o = $({});\n\n\t\t\t  $.subscribe = function() {\n\t\t\t    o.on.apply(o, arguments);\n\t\t\t  };\n\n\t\t\t  $.unsubscribe = function() {\n\t\t\t    o.off.apply(o, arguments);\n\t\t\t  };\n\n\t\t\t  $.publish = function() {\n\t\t\t    o.trigger.apply(o, arguments);\n\t\t\t  };\n\n\t\t\t}(jQuery));\n\n\n\t\t\t// Usage:\n\t\t\t// Super-basic example:\n\n\t\t\tfunction handle(e, a, b, c) {\n\t\t\t  // `e` is the event object, you probably don't care about it.\n\t\t\t  console.log(a + b + c);\n\t\t\t};\n\n\t\t\t$.subscribe(\"/some/topic\", handle);\n\n\t\t\t$.publish(\"/some/topic\", [ \"a\", \"b\", \"c\" ]);\n\t\t\t// logs: abc\n\n\t\t\t$.unsubscribe(\"/some/topic\", handle); // Unsubscribe just this handler\n\n\t\t\t// Or:\n\n\t\t\t$.subscribe(\"/some/topic\", function(e, a, b, c) {\n\t\t\t  console.log(a + b + c);\n\t\t\t});\n\n\t\t\t$.publish(\"/some/topic\", [ \"a\", \"b\", \"c\" ]);\n\t\t\t// logs: abc\n\t\t\t// Unsubscribe all handlers for this topic\n\t\t\t$.unsubscribe(\"/some/topic\"); \n\n\t\t\t// References\n\t\t\t// https://gist.github.com/1321768\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-patterns/pubsub-observable.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script src=\"http://brado23.github.com/jquery-ui/jquery-1.6.2.js\"></script>\n    <script src=\"http://brado23.github.com/jquery-ui/ui/jquery.ui.core.js\"></script>\n    <script src=\"http://brado23.github.com/jquery-ui/ui/jquery.ui.widget.js\"></script>\n    <script src=\"http://brado23.github.com/jquery-ui/ui/jquery.ui.button.js\"></script>\n    <script src=\"http://brado23.github.com/jquery-ui/ui/jquery.ui.observable.js\"></script>\n    <script src=\"http://brado23.github.com/jquery-ui/grid-editing/localstore.js\"></script>\n\t\t<script src=\"http://brado23.github.com/jquery-ui/grid-editing/observer.js\"></script>​\n\t\t<script>\n\t\t\t/* Title: Using jQuery UI $.Observable\n\t\t\t * Description: Using jQuery UI $.Observable (which is currently still under development), when objects/collections of data are changed or updated, events are triggered to inform any observers of the change\n\t\t\t */\n\n\t\t\t/*$.observers example by @addyosmani*/\n\n\t\t\tvar myData = [], \n\t\t\t    observer = $.observer(myData);\n\n\t\t\tfunction dataChange( data ){\n\t\t\t   console.log('New data arrived with ID ' + data[0].id + ' and value ' + data[0].title);   \n\t\t\t}\n\n\t\t\t$(observer).bind(\"change\", function ( e ) { \n\t\t\t    dataChange( e.target.data );\n\t\t\t});\n\n\t\t\t$.observable( myData ).insert({\n\t\t\t                id: myData.length + 1,\n\t\t\t                title: 'test'\n\t\t\t            });\n\t\t\t\n\t\t\t// References\n\t\t\t// https://gist.github.com/1321768\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-patterns/pubsub-plugin.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js\"></script>\n\t\t<script>\n\t\t\t/* Title: One of the many third-party plugins\n\t\t\t * Description: Peter Higgin's jQuery plugin, available here: https://github.com/phiggins42/bloody-jquery-plugins/blob/master/pubsub.js\n\t\t\t */\n\n\n\t\t\t;(function(d){\n\t\t\t    // the topic/subscription hash\n\t\t\t    var cache = {};\n\n\t\t\t    // Publish some data on a named topic.\n\t\t\t    d.publish = function(/* String */topic, /* Array? */args){\n\t\t\t        // topic: String - The channel to publish on\n\t\t\t        // args: Array - The data to publish. Each array item is converted into an ordered\n\t\t\t        // arguments on the subscribed functions. \n\t\t\t        cache[topic] && d.each(cache[topic], function(){\n\t\t\t            this.apply(d, args || []);\n\t\t\t        });\n\t\t\t    };\n\n\t\t\t    // Register a callback on a named topic.\n\t\t\t    d.subscribe = function(/* String */topic, /* Function */callback){    \n\t\t\t        // @topic: String - The channel to subscribe to\n\t\t\t        // @callback: Function - The handler event. Anytime something is $.publish'ed on a \n\t\t\t        // subscribed channel, the callback will be called with the published array as \n\t\t\t        // ordered arguments.\n\t\t\t        //\n\t\t\t        // returns: Array - A handle which can be used to unsubscribe this \n\t\t\t        // particular subscription.\n\n\t\t\t        if(!cache[topic]){\n\t\t\t            cache[topic] = [];\n\t\t\t        }\n\t\t\t        cache[topic].push(callback);\n\t\t\t        return [topic, callback]; // Array\n\t\t\t    };\n\n\t\t\t    // Disconnect a subscribed function for a topic.\n\t\t\t    d.unsubscribe = function(/* Array */handle){    \n\t\t\t        // handle: Array - The return value from a $.subscribe call.\n\t\t\t        var t = handle[0];\n\t\t\t        cache[t] && d.each(cache[t], function(idx){\n\t\t\t            if(this == handle[1]){\n\t\t\t                cache[t].splice(idx, 1);\n\t\t\t            }\n\t\t\t        });\n\t\t\t    };\n\n\t\t\t})(jQuery);\n\n\n\t\t\t// Usage:\n\t\t\t// Publish stuff on '/some/topic'. Anything subscribed will be called\n\t\t\t// with a function signature like: function(a,b,c){ ... }\n\n\n\t\t\t$.subscribe(\"/some/topic\", function(a, b, c){ \n\t\t\t    console.log(a,b,c);\n\t\t\t});\n\n\n\t\t\t$.publish(\"/some/topic\", [\"a\",\"b\",\"c\"]);\n\n\t\t\t// References\n\t\t\t// https://gist.github.com/1321768\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-patterns/requery.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: requery\n\t\t\t * Description: avoid requery by using jQuery chaining\n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\t// create and append your element\n\t\t\t$(document.body).append(\"<div class='baaron' />\");\n\t\t\t\t// requery to bind stuff\n\t\t\t\t$(\"div.baaron\").click(function () {\n\t\t\t});\n\n\n\t\t\t// preferred 1\n\t\t\t// swap to appendTo to hold your element\n\t\t\t$(\"<div class='baaron' />\")\n\t\t\t\t.appendTo(document.body)\n\t\t\t\t.click(function () {\n\t\t\t\t\t// do stuff\n\t\t\t\t});\n\t\t\t\t\t\n\t\t\t// preferred 2\n\t\t\t// cache the selector\n\t\t\tvar $baaron = $(\"<div class='baaron' />\").appendTo(document.body);\n\t\t\t\n\t\t\t$baaron.click(function () {\n\t\t\t\t// do stuff\n\t\t\t});\n\n\n\t\t\t// References\n\t\t\t// http://paulirish.com/2009/perf/\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "jquery-patterns/specific-when-needed.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Be Specific when Needed\n\t\t\t * Description: no need to be over-specific\n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\tvar arms = $('.data table.attendees td.brad');\n\n\n\t\t\t// preferred\n\t\t\tvar arms = $('.data td.brad');\n\n\n\t\t\t// References\n\t\t\t// http://paulirish.com/2009/perf/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-patterns/universal-selector.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Universal Selector\n\t\t\t * Description: better use of universal selector\n\t\t\t */\n\n\t\t\t// antipattern 1\n\t\t\t$('.buttons > *')\n\n\n\t\t\t// preferred 1\n\t\t\t$('.buttons').children()\n\n\n\t\t\t// antipattern 2\n\t\t\t$('.gender :radio')\n\t\t\t$('.gender *:radio')\n\n\n\t\t\t// preferred 2\n\t\t\t$('.gender input:radio')\n\n\n\t\t\t// References\n\t\t\t// http://paulirish.com/2009/perf/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-patterns/window-scroll-event.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: window scroll event\n\t\t\t * Description: avoid attaching handlers to the window scroll event\n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\t$(window).scroll(function () {\n\t\t\t\t$('.foo').something();\n\t\t\t});\n\n\n\t\t\t// preferred\n\t\t\tvar outerPane = $details.find(\".details-pane-outer\"),\n\t\t\t\t\tdidScroll = false;\n\t\t\t$(window).scroll(function () {\n\t\t\t\tdidScroll = true;\n\t\t\t});\n\n\t\t\tsetInterval(function () {\n\t\t\t\tif (didScroll) {\n\t\t\t\t\tdidScroll = false;\n\t\t\t\t\t// Check your page position and then\n\t\t\t\t\t// Load in more results\n\t\t\t\t\t// outerPane.html();\n\t\t\t\t}\n\t\t\t}, 250);\n\n\n\t\t\t// preferred v2, timeout instead of interval - no unnecessary ticks\n\t\t\tvar scrollTimeout;  // global for any pending scrollTimeout\n\t\t\tvar outerPane = $details.find(\".details-pane-outer\");\n\n\t\t\t$(window).scroll(function () {\n\t\t\t\tif (scrollTimeout) {\n\t\t\t\t\t// clear the timeout, if one is pending\n\t\t\t\t\tclearTimeout(scrollTimeout);\n\t\t\t\t\tscrollTimeout = null;\n\t\t\t\t}\n\t\t\t\tscrollTimeout = setTimeout(scrollHandler, 250);\n\t\t\t});\n\n\t\t\tscrollHandler = function () {\n\t\t\t\t// Check your page position and then\n\t\t\t\t// Load in more results\n\t\t\t\t// outerPane.html();\n\t\t\t};\n\n\n\t\t\t// References\n\t\t\t// http://ejohn.org/blog/learning-from-twitter/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-plugin-patterns/amd-commonjs/pluginCore.js",
    "content": "﻿// Module/Plugin core\n// Note: the wrapper code you see around the module is what enables\n// us to support multiple module formats and specifications by\n// mapping the arguments defined to what a specific format expects\n// to be present. Our actual module functionality is defined lower\n// down, where a named module and exports are demonstrated.\n//\n// Note that dependencies can just as easily be declared if required\n// and should work as demonstrated earlier with the AMD module examples.\n\n(function ( name, definition ){\n  var theModule = definition(),\n      // this is considered \"safe\":\n      hasDefine = typeof define === 'function' && define.amd,\n      // hasDefine = typeof define === 'function',\n      hasExports = typeof module !== 'undefined' && module.exports;\n\n  if ( hasDefine ){ // AMD Module\n    define(theModule);\n  } else if ( hasExports ) { // Node.js Module\n    module.exports = theModule;\n  } else { // Assign to common namespaces or simply the global object (window)\n    (this.jQuery || this.ender || this.$ || this)[name] = theModule;\n  }\n})( 'core', function () {\n    var module = this;\n    module.plugins = [];\n    module.highlightColor = \"yellow\";\n    module.errorColor = \"red\";\n\n  // define the core module here and return the public API\n\n  // This is the highlight method used by the core highlightAll()\n  // method and all of the plugins highlighting elements different\n  // colors\n  module.highlight = function(el,strColor){\n    if(this.jQuery){\n      jQuery(el).css('background', strColor);\n    }\n  }\n  return {\n      highlightAll:function(){\n        module.highlight('div', module.highlightColor);\n      }\n  };\n\n});"
  },
  {
    "path": "jquery-plugin-patterns/amd-commonjs/pluginExtension.js",
    "content": "﻿// Extension to module core\n\n(function ( name, definition ) {\n    var theModule = definition(),\n        hasDefine = typeof define === 'function',\n        hasExports = typeof module !== 'undefined' && module.exports;\n\n    if ( hasDefine ) { // AMD Module\n        define(theModule);\n    } else if ( hasExports ) { // Node.js Module\n        module.exports = theModule;\n    } else { // Assign to common namespaces or simply the global object (window)\n\n        // account for for flat-file/global module extensions\n        var obj = null;\n        var namespaces = name.split(\".\");\n        var scope = (this.jQuery || this.ender || this.$ || this);\n        for (var i = 0; i < namespaces.length; i++) {\n            var packageName = namespaces[i];\n            if (obj && i == namespaces.length - 1) {\n                obj[packageName] = theModule;\n            } else if (typeof scope[packageName] === \"undefined\") {\n                scope[packageName] = {};\n            }\n            obj = scope[packageName];\n        }\n\n    }\n})('core.plugin', function () {\n\n    // Define your module here and return the public API.\n    // This code could be easily adapted with the core to\n    // allow for methods that overwrite and extend core functionality\n    // in order to expand the highlight method to do more if you wish.\n    return {\n        setGreen: function ( el ) {\n            highlight(el, 'green');\n        },\n        setRed: function ( el ) {\n            highlight(el, errorColor);\n        }\n    };\n\n});"
  },
  {
    "path": "jquery-plugin-patterns/amd-commonjs/usage.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\"></script>\n\t\t<script src=\"pluginCore.js\"></script>\n\t\t<script src=\"pluginExtension.js\"></script>\n\n\t\t<script type=\"text/javascript\">\n\n\t\t$(function(){\n\n\t\t    // Our plugin 'core' is exposed under a core namespace in\n\t\t    // this example, which we first cache\n\t\t    var core = $.core;\n\n\t\t    // Then use use some of the built-in core functionality to\n\t\t    // highlight all divs in the page yellow\n\t\t    core.highlightAll();\n\n\t\t    // Access the plugins (extensions) loaded into the 'plugin'\n\t\t    // namespace of our core module:\n\n\t\t    // Set the first div in the page to have a green background.\n\t\t    core.plugin.setGreen(\"div:first\");\n\t\t    // Here we're making use of the core's 'highlight' method\n\t\t    // under the hood from a plugin loaded in after it\n\n\t\t    // Set the last div to the 'errorColor' property defined in\n\t\t    // our core module/plugin. If you review the code further down,\n\t\t    // you'll see how easy it is to consume properties and methods\n\t\t    // between the core and other plugins\n\t\t    core.plugin.setRed('div:last');\n\t\t});\n\n\t\t</script>\n\t\t\n\t\t<script>\n\t\t// References\n\t\t// http://coding.smashingmagazine.com/2011/10/11/essential-jquery-plugin-patterns/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-plugin-patterns/basic.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\"></script>\n\t\t<script>\n\t\t/*!\n\t\t * jQuery basic plugin boilerplate\n\t\t */\n\n\t\t/*\n\t\tThe most basic form of jQuery plugin\n\t\tThis is great for compactness\n\t\t*/\n\n\t\t$.fn.myPluginName = function() {\n\t\t    // your plugin logic\n\t\t};\n\n\n\t\t/*\n\t\tA better foundation to build on\n\t\tHere, we’ve wrapped our plugin logic in an anonymous function. To ensure that our use of the $ sign as a shorthand creates no conflicts between jQuery and other JavaScript libraries, we simply pass it to this closure, which maps it to the dollar sign, thus ensuring that it can’t be affected by anything outside of its scope of execution.\n\t\t*/\n\n\t\t(function( $ ){\n\t\t  \t$.fn.myPluginName = function() {\n\t\t    \t// your plugin logic\n\t\t  \t};\n\t\t})( jQuery );\n\n\n\t\t// References\n\t\t// Essential jQuery Plugin Patterns (by Addy Osmani) - http://goo.gl/oE0ge\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-plugin-patterns/best-options.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t/*!\n\t\t * jQuery 'best options' plugin boilerplate\n\t\t * Author: @cowboy\n\t\t * Further changes: @addyosmani\n\t\t * Licensed under the MIT license\n\t\t */\n\n\t\t;(function ( $, window, document, undefined ) {\n\n\t\t    $.fn.pluginName = function ( options ) {\n\n\t\t        // Here's a best practice for overriding 'defaults'\n\t\t        // with specified options. Note how, rather than a\n\t\t        // regular defaults object being passed as the second\n\t\t        // parameter, we instead refer to $.fn.pluginName.options\n\t\t        // explicitly, merging it with the options passed directly\n\t\t        // to the plugin. This allows us to override options both\n\t\t        // globally and on a per-call level. \n\n\t\t        options = $.extend( {}, $.fn.pluginName.options, options );\n\n\t\t        return this.each(function () {\n\n\t\t            var elem = $(this);\n\n\t\t        });\n\t\t    };\n\n\t\t    // Globally overriding options\n\t\t    // Here are our publicly accessible default plugin options\n\t\t    // that are available in case the user doesn't pass in all\n\t\t    // of the values expected. The user is given a default\n\t\t    // experience but can also override the values as necessary.\n\t\t    // eg. $fn.pluginName.key ='otherval';\n\n\t\t    $.fn.pluginName.options = {\n\n\t\t        key: \"value\",\n\t\t        myMethod: function ( elem, param ) {\n\n\t\t        }\n\t\t    };\n\n\t\t})( jQuery, window, document );\n\n\n\t\t// References\n\t\t/*\n\t\tjQuery Pluginization and the accompanying gist (by Ben Alman) - http://goo.gl/1VwfP http://goo.gl/bg63\n\t\tEssential jQuery Plugin Patterns (by Addy Osmani) - http://goo.gl/oE0ge\n\t\t*/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-plugin-patterns/custom-events.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t/*!\n\t\t * jQuery custom-events plugin boilerplate\n\t\t * Author: DevPatch\n\t\t * Further changes: @addyosmani\n\t\t * Licensed under the MIT license\n\t\t */\n\n\t\t// In this pattern, we use jQuery's custom events to add\n\t\t// pub/sub (publish/subscribe) capabilities to widgets.\n\t\t// Each widget would publish certain events and subscribe\n\t\t// to others. This approach effectively helps to decouple\n\t\t// the widgets and enables them to function independently.\n\n\t\t;(function ( $, window, document, undefined ) {\n\t\t    $.widget(\"ao.eventStatus\", {\n\t\t        options: {\n\n\t\t        },\n\n\t\t        _create : function() {\n\t\t            var self = this;\n\n\t\t            //self.element.addClass( \"my-widget\" );\n\n\t\t            //subscribe to 'myEventStart'\n\t\t            self.element.bind( \"myEventStart\", function( e ) {\n\t\t                console.log(\"event start\");\n\t\t            });\n\n\t\t            //subscribe to 'myEventEnd'\n\t\t            self.element.bind( \"myEventEnd\", function( e ) {\n\t\t                console.log(\"event end\");\n\t\t            });\n\n\t\t            //unsubscribe to 'myEventStart'\n\t\t            //self.element.unbind( \"myEventStart\", function(e){\n\t\t                ///console.log(\"unsubscribed to this event\");\n\t\t            //});\n\t\t        },\n\n\t\t        destroy: function(){\n\t\t            $.Widget.prototype.destroy.apply( this, arguments );\n\t\t        },\n\t\t    });\n\t\t})( jQuery, window , document );\n\n\t\t//Publishing event notifications\n\t\t//usage:\n\t\t// $(\".my-widget\").trigger(\"myEventStart\");\n\t\t// $(\".my-widget\").trigger(\"myEventEnd\");\n\n\n\t\t// References\n\t\t/*\n\t\tCommunication Between jQuery UI Widgets (by Benjamin Sternthal) - http://goo.gl/oE0ge\n\t\tUnderstanding the Publish/Subscribe Pattern for Greater JavaScript Scalability (by Addy Osmani) - http://goo.gl/CU5fC\n\t\tEssential jQuery Plugin Patterns (by Addy Osmani) - http://goo.gl/oE0ge\n\t\t*/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-plugin-patterns/extend.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t/*!\n\t\t * jQuery extend-based plugin boilerplate\n\t\t * Author: @oscargodson\n\t\t * Further changes: @timmywil\n\t\t * Licensed under the MIT license\n\t\t */\n\n\t\t/*\n\t\tAs you'll notice below, we're making use of $.fn.extend to create our plugin rather\n\t\tthan opting for $.fn.pluginname. This type of structure may be useful if you need\n\t\tto add a relatively large number of methods to your plugin. There are however alternatives\n\t\tto this that may be better suited, including Alex Sexton's prototypal inheritence pattern\n\t\twhich is also included in this repo.\n\t\t*/\n\n\n\t\t// the semi colon before function invocation is a safety net against concatenated\n\t\t// scripts and/or other plugins which may not be closed properly.\n\t\t;( function( $ ){\n\t\t\t$.fn.extend( {\n\t\t\t\tpluginname: function( options ) {\n\n\t\t\t\t\tthis.defaults = {};\n\n\t\t\t\t\tvar settings = $.extend( {}, this.defaults, options );\n\n\t\t\t\t\treturn this.each( function() {\n\n\t\t\t\t\t\tvar $this = $( this );\n\n\t\t\t\t\t});\n\n\t\t\t\t}\n\n\t\t\t});\n\n\t\t})( jQuery );\n\n\n\t\t// References\n\t\t// Essential jQuery Plugin Patterns (by Addy Osmani) - http://goo.gl/oE0ge\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-plugin-patterns/highly-configurable-mutable.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t/*\n\t\t * 'Highly configurable' mutable plugin boilerplate\n\t\t * Author: @markdalgleish\n\t\t * Further changes, comments: @addyosmani\n\t\t * Licensed under the MIT license\n\t\t */\n\n\t\t// Note that with this pattern, as per Alex Sexton's, the plugin logic\n\t\t// hasn't been nested in a jQuery plugin. Instead, we just use\n\t\t// jQuery for its instantiation.\n\n\t\t;(function( $, window, document, undefined ){\n\n\t\t  // our plugin constructor\n\t\t  var Plugin = function( elem, options ){\n\t\t      this.elem = elem;\n\t\t      this.$elem = $(elem);\n\t\t      this.options = options;\n\n\t\t      // This next line takes advantage of HTML5 data attributes\n\t\t      // to support customization of the plugin on a per-element\n\t\t      // basis. For example,\n\t\t      // <div class=item' data-plugin-options='{\"message\":\"Goodbye World!\"}'></div>\n\t\t      this.metadata = this.$elem.data( 'plugin-options' );\n\t\t    };\n\n\t\t  // the plugin prototype\n\t\t  Plugin.prototype = {\n\t\t    defaults: {\n\t\t      message: 'Hello world!'\n\t\t    },\n\n\t\t    init: function() {\n\t\t      // Introduce defaults that can be extended either\n\t\t      // globally or using an object literal.\n\t\t      this.config = $.extend({}, this.defaults, this.options,\n\t\t      this.metadata);\n\n\t\t      // Sample usage:\n\t\t      // Set the message per instance:\n\t\t      // $('#elem').plugin({ message: 'Goodbye World!'});\n\t\t      // or\n\t\t      // var p = new Plugin(document.getElementById('elem'),\n\t\t      // { message: 'Goodbye World!'}).init()\n\t\t      // or, set the global default message:\n\t\t      // Plugin.defaults.message = 'Goodbye World!'\n\n\t\t      this.sampleMethod();\n\t\t      return this;\n\t\t    },\n\n\t\t    sampleMethod: function() {\n\t\t      // eg. show the currently configured message\n\t\t      // console.log(this.config.message);\n\t\t    }\n\t\t  }\n\n\t\t  Plugin.defaults = Plugin.prototype.defaults;\n\n\t\t  $.fn.plugin = function(options) {\n\t\t    return this.each(function() {\n\t\t      new Plugin(this, options).init();\n\t\t    });\n\t\t  };\n\n\t\t  //optional: window.Plugin = Plugin;\n\n\t\t})( jQuery, window , document );\n\n\n\t\t// References\n\t\t/*\n\t\tCreating Highly Configurable jQuery Plugins (by Mark Dalgleish) - http://goo.gl/1VwfP http://goo.gl/bg63\n\t\tEssential jQuery Plugin Patterns (by Addy Osmani) - http://goo.gl/oE0ge\n\t\t*/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-plugin-patterns/jquery-mobile-ui-widget-factory.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t/*!\n\t\t * (jQuery mobile) jQuery UI Widget-factory plugin boilerplate (for 1.8/9+)\n\t\t * Author: @scottjehl\n\t\t * Further changes: @addyosmani\n\t\t * Licensed under the MIT license\n\t\t */\n\n\t\t;(function ( $, window, document, undefined ) {\n\n\t\t    //define a widget under a namespace of your choice\n\t\t    //here 'mobile' has been used in the first parameter\n\t\t    $.widget( \"mobile.widgetName\", $.mobile.widget, {\n\n\t\t        //Options to be used as defaults\n\t\t        options: {\n\t\t            foo: true,\n\t\t            bar: false\n\t\t        },\n\n\t\t        _create: function() {\n\t\t            // _create will automatically run the first time this\n\t\t            // widget is called. Put the initial widget set-up code\n\t\t            // here, then you can access the element on which\n\t\t            // the widget was called via this.element\n\t\t            // The options defined above can be accessed via\n\t\t            // this.options\n\n\t\t            //var m = this.element,\n\t\t            //p = m.parents(\":jqmData(role='page')\"),\n\t\t            //c = p.find(\":jqmData(role='content')\")\n\t\t        },\n\n\t\t        // Private methods/props start with underscores\n\t\t        _dosomething: function(){ ... },\n\n\t\t        // Public methods like these below can can be called\n\t\t                // externally:\n\t\t        // $(\"#myelem\").foo( \"enable\", arguments );\n\n\t\t        enable: function() { ... },\n\n\t\t        // Destroy an instantiated plugin and clean up modifications\n\t\t        // the widget has made to the DOM\n\t\t        destroy: function () {\n\t\t            //this.element.removeStuff();\n\t\t            // For UI 1.8, destroy must be invoked from the\n\t\t            // base widget\n\t\t            $.Widget.prototype.destroy.call(this);\n\t\t            // For UI 1.9, define _destroy instead and don't\n\t\t            // worry about calling the base widget\n\t\t        },\n\n\t\t        methodB: function ( event ) {\n\t\t            //_trigger dispatches callbacks the plugin user can\n\t\t            // subscribe to\n\t\t            //signature: _trigger( \"callbackName\" , [eventObject],\n\t\t            //  [uiObject] )\n\t\t            // eg. this._trigger( \"hover\", e /*where e.type ==\n\t\t            // \"mouseenter\"*/, { hovered: $(e.target)});\n\t\t            this._trigger('methodA', event, {\n\t\t                key: value\n\t\t            });\n\t\t        },\n\n\t\t        methodA: function ( event ) {\n\t\t            this._trigger('dataChanged', event, {\n\t\t                key: value\n\t\t            });\n\t\t        },\n\n\t\t        //Respond to any changes the user makes to the option method\n\t\t        _setOption: function ( key, value ) {\n\t\t            switch (key) {\n\t\t            case \"someValue\":\n\t\t                //this.options.someValue = doSomethingWith( value );\n\t\t                break;\n\t\t            default:\n\t\t                //this.options[ key ] = value;\n\t\t                break;\n\t\t            }\n\n\t\t            // For UI 1.8, _setOption must be manually invoked from\n\t\t            // the base widget\n\t\t            $.Widget.prototype._setOption.apply(this, arguments);\n\t\t            // For UI 1.9 the _super method can be used instead\n\t\t            // this._super( \"_setOption\", key, value );\n\t\t        }\n\t\t    });\n\n\t\t})( jQuery, window, document );\n\n\t\t//usage: $(\"#myelem\").foo( options );\n\n\t\t/* Some additional notes - delete this section before using the boilerplate.\n\n\t\t We can also self-init this widget whenever a new page in jQuery Mobile is created. jQuery Mobile's \"page\" plugin dispatches a \"create\" event when a jQuery Mobile page (found via data-role=page attr) is first initialized.\n\n\t\tWe can listen for that event (called \"pagecreate\" ) and run our plugin automatically whenever a new page is created.\n\n\t\t$(document).bind(\"pagecreate\", function (e) {\n\t\t    // In here, e.target refers to the page that was created\n\t\t    // (it's the target of the pagecreate event)\n\t\t    // So, we can simply find elements on this page that match a\n\t\t    // selector of our choosing, and call our plugin on them.\n\t\t    // Here's how we'd call our \"foo\" plugin on any element with a\n\t\t    // data-role attribute of \"foo\":\n\t\t    $(e.target).find(\"[data-role='foo']\").foo(options);\n\n\t\t    // Or, better yet, let's write the selector accounting for the configurable\n\t\t    // data-attribute namespace\n\t\t    $(e.target).find(\":jqmData(role='foo')\").foo(options);\n\t\t});\n\n\t\tThat's it. Now you can simply reference the script containing your widget and pagecreate binding in a page running jQuery Mobile site, and it will automatically run like any other jQM plugin.\n\t\t*/\n\n\n\t\t// References\n\t\t// http://coding.smashingmagazine.com/2011/10/11/essential-jquery-plugin-patterns/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-plugin-patterns/lightweight.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\"></script>\n\t\t<script>\n\t\t/*!\n\t\t * jQuery lightweight plugin boilerplate\n\t\t * Original author: @ajpiano\n\t\t * Further changes, comments: @addyosmani\n\t\t * Licensed under the MIT license\n\t\t */\n\n\t\t// the semi-colon before the function invocation is a safety\n\t\t// net against concatenated scripts and/or other plugins\n\t\t// that are not closed properly.\n\t\t;(function ( $, window, document, undefined ) {\n\n\t\t    // undefined is used here as the undefined global\n\t\t    // variable in ECMAScript 3 and is mutable (i.e. it can\n\t\t    // be changed by someone else). undefined isn't really\n\t\t    // being passed in so we can ensure that its value is\n\t\t    // truly undefined. In ES5, undefined can no longer be\n\t\t    // modified.\n\n\t\t    // window and document are passed through as local\n\t\t    // variables rather than as globals, because this (slightly)\n\t\t    // quickens the resolution process and can be more\n\t\t    // efficiently minified (especially when both are\n\t\t    // regularly referenced in your plugin).\n\n\t\t    // Create the defaults once\n\t\t    var pluginName = 'defaultPluginName',\n\t\t        defaults = {\n\t\t            propertyName: \"value\"\n\t\t        };\n\n\t\t    // The actual plugin constructor\n\t\t    function Plugin( element, options ) {\n\t\t        this.element = element;\n\n\t\t        // jQuery has an extend method that merges the\n\t\t        // contents of two or more objects, storing the\n\t\t        // result in the first object. The first object\n\t\t        // is generally empty because we don't want to alter\n\t\t        // the default options for future instances of the plugin\n\t\t        this.options = $.extend( {}, defaults, options) ;\n\n\t\t        this._defaults = defaults;\n\t\t        this._name = pluginName;\n\n\t\t        this.init();\n\t\t    }\n\n\t\t    Plugin.prototype.init = function () {\n\t\t        // Place initialization logic here\n\t\t        // You already have access to the DOM element and\n\t\t        // the options via the instance, e.g. this.element\n\t\t        // and this.options\n\t\t    };\n\n\t\t    // A really lightweight plugin wrapper around the constructor,\n\t\t    // preventing against multiple instantiations\n\t\t    $.fn[pluginName] = function ( options ) {\n\t\t        return this.each(function () {\n\t\t            if (!$.data(this, 'plugin_' + pluginName)) {\n\t\t                $.data(this, 'plugin_' + pluginName,\n\t\t                new Plugin( this, options ));\n\t\t            }\n\t\t        });\n\t\t    }\n\n\t\t})( jQuery, window, document );\n\n\n\t\t// References\n\t\t/* \n\t\tPlugins/Authoring (by jQuery) - http://goo.gl/98R9\n\t\tSigns of a poorly written jQuery plugin (by Remy Sharp) - http://goo.gl/5RNI\n\t\tHow to Create Your Own jQuery Plugin (by Elijah Manor) - http://goo.gl/EoSFq\n\t\tStyle in jQuery Plugins and Why it Matters (by \"Cowboy\" Ben Alman) - http://goo.gl/E7pd0\n\t\tCreate Your First jQuery Plugin Part 2 (by Andrew Wirick) - http://goo.gl/IhCYO\n\t\tEssential jQuery Plugin Patterns (by Addy Osmani) - http://goo.gl/oE0ge\n\t\t*/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-plugin-patterns/namespaced-starter.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t/*!\n\t\t * jQuery namespaced 'Starter' plugin boilerplate\n\t\t * Author: @dougneiner\n\t\t * Further changes: @addyosmani\n\t\t * Licensed under the MIT license\n\t\t */\n\n\t\t;(function ( $ ) {\n\t\t\tif ( ! $.myNamespace ) {\n\t\t\t\t$.myNamespace = {};\n\t\t\t}\n\n\t\t\t$.myNamespace.myPluginName = function ( el, myFunctionParam, options ) {\n\n\t\t\t\t// To avoid scope issues, use 'base' instead of 'this'\n\t\t\t\t// to reference this class from internal events and functions.\n\t\t\t\tvar base = this;\n\n\t\t\t\t// Access to jQuery and DOM versions of element\n\t\t\t\tbase.$el = $( el );\n\t\t\t\tbase.el = el;\n\n\t\t\t\t// Add a reverse reference to the DOM object\n\t\t\t\tbase.$el.data( \"myNamespace.myPluginName\" , base );\n\n\t\t\t\tbase.init = function () {\n\t\t\t\t\tbase.myFunctionParam = myFunctionParam;\n\n\t\t\t\t\tbase.settings = $.extend( {}, $.myNamespace.myPluginName.defaults, options );\n\n\t\t\t\t\t// Put your initialization code here\n\n\t\t\t\t};\n\n\t\t\t\t// Sample Function, Uncomment to use\n\t\t\t\t// base.functionName = function( paramaters ){\n\t\t\t\t//\n\t\t\t\t// };\n\n\t\t\t\t// Run initializer\n\t\t\t\tbase.init();\n\t\t\t};\n\n\t\t\t$.myNamespace.myPluginName.defaults = {\n\t\t\t\tmyDefaultValue: \"\"\n\t\t\t};\n\n\t\t\t$.fn.mynamespace_myPluginName = function( myFunctionParam, options ) {\n\t\t\t\treturn this.each( function () {\n\t\t\t\t\t( new $.myNamespace.myPluginName( this, myFunctionParam, options ) );\n\t\t\t\t});\n\t\t\t};\n\n\t\t} )( jQuery );\n\n\n\t\t// References\n\t\t/*\n\t\tNamespacing in JavaScript (by Angus Croll) - http://goo.gl/eul12\n\t\tUse Your $.fn jQuery Namespace (by Ryan Florence) - http://goo.gl/QQIC6\n\t\tJavaScript Namespacing (by Peter Michaux) - http://goo.gl/24t8N\n\t\tModules and namespaces in JavaScript (by Axel Rauschmayer) - http://goo.gl/6XuqO\n\t\tEssential jQuery Plugin Patterns (by Addy Osmani) - http://goo.gl/oE0ge\n\t\t*/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-plugin-patterns/prototypal-inheritance.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\"></script>\n\t\t<script>\n\t\t/*!\n\t\t * jQuery prototypal inheritance plugin boilerplate\n\t\t * Author: Alex Sexton, Scott Gonzalez\n\t\t * Further changes: @addyosmani\n\t\t * Licensed under the MIT license\n\t\t */\n\n\t\t// myObject - an object representing a concept that you want\n\t\t// to model (e.g. a car)\n\t\tvar myObject = {\n\t\t  init: function( options, elem ) {\n\t\t    // Mix in the passed-in options with the default options\n\t\t    this.options = $.extend( {}, this.options, options );\n\n\t\t    // Save the element reference, both as a jQuery\n\t\t    // reference and a normal reference\n\t\t    this.elem  = elem;\n\t\t    this.$elem = $(elem);\n\n\t\t    // Build the DOM's initial structure\n\t\t    this._build();\n\n\t\t    // return this so that we can chain and use the bridge with less code.\n\t\t    return this;\n\t\t  },\n\t\t  options: {\n\t\t    name: \"No name\"\n\t\t  },\n\t\t  _build: function(){\n\t\t    //this.$elem.html('<h1>'+this.options.name+'</h1>');\n\t\t  },\n\t\t  myMethod: function( msg ){\n\t\t    // You have direct access to the associated and cached\n\t\t    // jQuery element\n\t\t    // this.$elem.append('<p>'+msg+'</p>');\n\t\t  }\n\t\t};\n\n\t\t// Object.create support test, and fallback for browsers without it\n\t\tif ( typeof Object.create !== 'function' ) {\n\t\t    Object.create = function (o) {\n\t\t        function F() {}\n\t\t        F.prototype = o;\n\t\t        return new F();\n\t\t    };\n\t\t}\n\n\t\t// Create a plugin based on a defined object\n\t\t$.plugin = function( name, object ) {\n\t\t  $.fn[name] = function( options ) {\n\t\t    return this.each(function() {\n\t\t      if ( ! $.data( this, name ) ) {\n\t\t        $.data( this, name, Object.create(object).init(\n\t\t        options, this ) );\n\t\t      }\n\t\t    });\n\t\t  };\n\t\t};\n\n\t\t// Usage:\n\t\t// With myObject, we could now essentially do this:\n\t\t// $.plugin('myobj', myObject);\n\n\t\t// and at this point we could do the following\n\t\t// $('#elem').myobj({name: \"John\"});\n\t\t// var inst = $('#elem').data('myobj');\n\t\t// inst.myMethod('I am a method');\n\n\n\t\t// References\n\t\t/*\n\t\tUsing Inheritance Patterns To Organize Large jQuery Applications (by Alex Sexton) - http://goo.gl/Z4lYz\n\t\tHow to Manage Large Applications With jQuery or Whatever (by Alex Sexton) - http://goo.gl/kKWhj\n\t\tPractical Example of the Need for Prototypal Inheritance (by Neeraj Singh) - http://goo.gl/jrzb6\n\t\tPrototypal Inheritance in JavaScript (by Douglas Crockford) - http://goo.gl/TPXqV\n\t\tEssential jQuery Plugin Patterns (by Addy Osmani) - http://goo.gl/oE0ge\n\t\t*/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-plugin-patterns/ui-widget-factory-bridge.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\"></script>\n\t\t<script>\n\t\t/*!\n\t\t * jQuery UI Widget factory \"bridge\" plugin boilerplate\n\t\t * Author: @erichynds\n\t\t * Further changes, additional comments: @addyosmani\n\t\t * Licensed under the MIT license\n\t\t */\n\n\t\t// a \"widgetName\" object constructor\n\t\t// required: this must accept two arguments,\n\t\t// options: an object of configuration options\n\t\t// element: the DOM element the instance was created on\n\t\tvar widgetName = function( options, element ){\n\t\t  this.name = \"myWidgetName\";\n\t\t  this.options = options;\n\t\t  this.element = element;\n\t\t  this._init();\n\t\t}\n\n\t\t// the \"widgetName\" prototype\n\t\twidgetName.prototype = {\n\n\t\t    // _create will automatically run the first time this\n\t\t    // widget is called\n\t\t    _create: function(){\n\t\t        // creation code\n\t\t    },\n\n\t\t    // required: initialization logic for the plugin goes into _init\n\t\t    // This fires when your instance is first created and when\n\t\t    // attempting to initialize the widget again (by the bridge)\n\t\t    // after it has already been initialized.\n\t\t    _init: function(){\n\t\t        // init code\n\t\t    },\n\n\t\t    // required: objects to be used with the bridge must contain an\n\t\t    // 'option'. Post-initialization, the logic for changing options\n\t\t    // goes here.\n\t\t    option: function( key, value ){\n\n\t\t        // optional: get/change options post initialization\n\t\t        // ignore if you don't require them.\n\n\t\t        // signature: $('#foo').bar({ cool:false });\n\t\t        if( $.isPlainObject( key ) ){\n\t\t            this.options = $.extend( true, this.options, key );\n\n\t\t        // signature: $('#foo').option('cool'); - getter\n\t\t        } else if ( key && typeof value === \"undefined\" ){\n\t\t            return this.options[ key ];\n\n\t\t        // signature: $('#foo').bar('option', 'baz', false);\n\t\t        } else {\n\t\t            this.options[ key ] = value;\n\t\t        }\n\n\t\t        // required: option must return the current instance.\n\t\t        // When re-initializing an instance on elements, option\n\t\t        // is called first and is then chained to the _init method.\n\t\t        return this;\n\t\t    },\n\n\t\t    // notice no underscore is used for public methods\n\t\t    publicFunction: function(){\n\t\t        console.log('public function');\n\t\t    },\n\n\t\t    // underscores are used for private methods\n\t\t    _privateFunction: function(){\n\t\t        console.log('private function');\n\t\t    }\n\t\t};\n\n\t\t// usage:\n\n\t\t// connect the widget obj to jQuery's API under the \"foo\" namespace\n\t\t// $.widget.bridge(\"foo\", widgetName);\n\n\t\t// create an instance of the widget for use\n\t\t// var instance = $(\"#elem\").foo({\n\t\t//     baz: true\n\t\t// });\n\n\t\t// your widget instance exists in the elem's data\n\t\t// instance.data(\"foo\").element; // => #elem element\n\n\t\t// bridge allows you to call public methods...\n\t\t// instance.foo(\"publicFunction\"); // => \"public method\"\n\n\t\t// bridge prevents calls to internal methods\n\t\t// instance.foo(\"_privateFunction\"); // => #elem element\n\n\n\t\t// References\n\t\t/*\n\t\tUsing $.widget.bridge Outside of the Widget Factory (by Eric Hynds) - http://goo.gl/UfPKn\n\t\tEssential jQuery Plugin Patterns (by Addy Osmani) - http://goo.gl/oE0ge\n\t\t*/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-plugin-patterns/ui-widget-factory-mobile.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t/*!\n\t\t * jQuery UI Widget + RequireJS module boilerplate (for 1.8/9+)\n\t\t * Authors: @jrburke, @addyosmani\n\t\t * Licensed under the MIT license\n\t\t */\n\n\t\t// Note from James:\n\t\t//\n\t\t// This assumes you are using the RequireJS+jQuery file, and\n\t\t// that the following files are all in the same directory:\n\t\t//\n\t\t// - require-jquery.js\n\t\t// - jquery-ui.custom.min.js (custom jQuery UI build with widget factory)\n\t\t// - templates/\n\t\t//    - asset.html\n\t\t// - ao.myWidget.js \n\n\t\t// Then you can construct the widget like so: \n\n\t\t//ao.myWidget.js file:\n\t\tdefine(\"ao.myWidget\", [\"jquery\", \"text!templates/asset.html\", \"jquery-ui.custom.min\",\"jquery.tmpl\"], function ($, assetHtml) {\n\n\t\t    // define your widget under a namespace of your choice\n\t\t    // 'ao' is used here as a demonstration\n\t\t    $.widget( \"ao.myWidget\", { \n\n\t\t        // Options to be used as defaults\n\t\t        options: {}, \n\n\t\t        // Set up widget (e.g. create element, apply theming,\n\t\t        // bind events, etc.)\n\t\t        _create: function () {\n\n\t\t            // _create will automatically run the first time\n\t\t            // this widget is called. Put the initial widget\n\t\t            // set-up code here, then you can access the element\n\t\t            // on which the widget was called via this.element.\n\t\t            // The options defined above can be accessed via\n\t\t            // this.options\n\n\t\t            //this.element.addStuff();\n\t\t            //this.element.addStuff();\n\t\t            //this.element.tmpl(assetHtml).appendTo(this.content);\n\t\t        },\n\n\t\t        // Destroy an instantiated plugin and clean up modifications\n\t\t        // that the widget has made to the DOM\n\t\t        destroy: function () {\n\t\t            //t his.element.removeStuff();\n\t\t            // For UI 1.8, destroy must be invoked from the base\n\t\t            // widget\n\t\t            $.Widget.prototype.destroy.call( this );\n\t\t            // For UI 1.9, define _destroy instead and don't worry\n\t\t            // about calling the base widget\n\t\t        },\n\n\t\t        methodB: function ( event ) {\n\t\t            // _trigger dispatches callbacks the plugin user can\n\t\t            // subscribe to\n\t\t            //signature: _trigger( \"callbackName\" , [eventObject],\n\t\t            // [uiObject] )\n\t\t            this._trigger('methodA', event, {\n\t\t                key: value\n\t\t            });\n\t\t        },\n\n\t\t        methodA: function ( event ) {\n\t\t            this._trigger('dataChanged', event, {\n\t\t                key: value\n\t\t            });\n\t\t        },\n\n\t\t        //Respond to any changes the user makes to the option method\n\t\t        _setOption: function ( key, value ) {\n\t\t            switch (key) {\n\t\t            case \"someValue\":\n\t\t                //this.options.someValue = doSomethingWith( value );\n\t\t                break;\n\t\t            default:\n\t\t                //this.options[ key ] = value;\n\t\t                break;\n\t\t            }\n\n\t\t            // For UI 1.8, _setOption must be manually invoked from\n\t\t            // the base widget\n\t\t            $.Widget.prototype._setOption.apply( this, arguments );\n\t\t            // For UI 1.9 the _super method can be used instead\n\t\t            //this._super( \"_setOption\", key, value );\n\t\t        }\n\n\t\t        //somewhere assetHtml would be used for templating, depending\n\t\t        // on your choice.\n\t\t    });\n\t\t}); \n\n\t\t// If you are going to use the RequireJS optimizer to combine files\n\t\t// together, you can leave off the \"ao.myWidget\" argument to define:\n\t\t// define([\"jquery\", \"text!templates/asset.html\", \"jquery-ui.custom.min\"], …\n\n\n\t\t// References\n\t\t// http://coding.smashingmagazine.com/2011/10/11/essential-jquery-plugin-patterns/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-plugin-patterns/ui-widget-factory.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js\"></script>\n\t\t<script>\n\t\t/*!\n\t\t * jQuery UI Widget-factory plugin boilerplate (for 1.8/9+)\n\t\t * Author: @addyosmani\n\t\t * Further changes: @peolanha\n\t\t * Licensed under the MIT license\n\t\t */\n\n\t\t;(function ( $, window, document, undefined ) {\n\n\t\t    // define your widget under a namespace of your choice\n\t\t    //  with additional parameters e.g.\n\t\t    // $.widget( \"namespace.widgetname\", (optional) - an\n\t\t    // existing widget prototype to inherit from, an object\n\t\t    // literal to become the widget's prototype ); \n\n\t\t    $.widget( \"namespace.widgetname\" , {\n\n\t\t        //Options to be used as defaults\n\t\t        options: {\n\t\t            someValue: null\n\t\t        },\n\n\t\t        //Setup widget (eg. element creation, apply theming\n\t\t        // , bind events etc.)\n\t\t        _create: function () {\n\n\t\t            // _create will automatically run the first time\n\t\t            // this widget is called. Put the initial widget\n\t\t            // setup code here, then you can access the element\n\t\t            // on which the widget was called via this.element.\n\t\t            // The options defined above can be accessed\n\t\t            // via this.options this.element.addStuff();\n\t\t        },\n\n\t\t        // Destroy an instantiated plugin and clean up\n\t\t        // modifications the widget has made to the DOM\n\t\t        destroy: function () {\n\n\t\t            // this.element.removeStuff();\n\t\t            // For UI 1.8, destroy must be invoked from the\n\t\t            // base widget\n\t\t            $.Widget.prototype.destroy.call(this);\n\t\t            // For UI 1.9, define _destroy instead and don't\n\t\t            // worry about\n\t\t            // calling the base widget\n\t\t        },\n\n\t\t        methodB: function ( event ) {\n\t\t            //_trigger dispatches callbacks the plugin user\n\t\t            // can subscribe to\n\t\t            // signature: _trigger( \"callbackName\" , [eventObject],\n\t\t            // [uiObject] )\n\t\t            // eg. this._trigger( \"hover\", e /*where e.type ==\n\t\t            // \"mouseenter\"*/, { hovered: $(e.target)});\n\t\t            this._trigger('methodA', event, {\n\t\t                key: value\n\t\t            });\n\t\t        },\n\n\t\t        methodA: function ( event ) {\n\t\t            this._trigger('dataChanged', event, {\n\t\t                key: value\n\t\t            });\n\t\t        },\n\n\t\t        // Respond to any changes the user makes to the\n\t\t        // option method\n\t\t        _setOption: function ( key, value ) {\n\t\t            switch (key) {\n\t\t            case \"someValue\":\n\t\t                //this.options.someValue = doSomethingWith( value );\n\t\t                break;\n\t\t            default:\n\t\t                //this.options[ key ] = value;\n\t\t                break;\n\t\t            }\n\n\t\t            // For UI 1.8, _setOption must be manually invoked\n\t\t            // from the base widget\n\t\t            $.Widget.prototype._setOption.apply( this, arguments );\n\t\t            // For UI 1.9 the _super method can be used instead\n\t\t            // this._super( \"_setOption\", key, value );\n\t\t        }\n\t\t    });\n\n\t\t})( jQuery, window, document );\n\n\n\t\t// References\n\t\t/*\n\t\tThe jQuery UI Widget Factory (by Adam J. Sontag) - http://goo.gl/DLKEt\n\t\tIntroduction to Stateful Plugins and the Widget Factory (by Doug Neiner) - http://goo.gl/eTGhP\n\t\tWidget Factory (by Scott González) - http://goo.gl/5qFQG\n\t\tUnderstanding jQuery UI widgets: A tutorial (by Hacking at 0300) - http://goo.gl/rBhaF\n\t\tEssential jQuery Plugin Patterns (by Addy Osmani) - http://goo.gl/oE0ge\n\t\t*/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "jquery-plugin-patterns/ui-widget-requirejs-module.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t/*!\n\t\t * jQuery UI Widget + RequireJS module boilerplate (for 1.8/9+)\n\t\t * Authors: @jrburke, @addyosmani\n\t\t * Licensed under the MIT license\n\t\t */\n\n\t\t// Note from James:\n\t\t//\n\t\t// This assumes you are using the RequireJS+jQuery file, and\n\t\t// that the following files are all in the same directory:\n\t\t//\n\t\t// - require-jquery.js\n\t\t// - jquery-ui.custom.min.js (custom jQuery UI build with widget factory)\n\t\t// - templates/\n\t\t//    - asset.html\n\t\t// - ao.myWidget.js \n\n\t\t// Then you can construct the widget like so: \n\n\t\t//ao.myWidget.js file:\n\t\tdefine(\"ao.myWidget\", [\"jquery\", \"text!templates/asset.html\", \"jquery-ui.custom.min\",\"jquery.tmpl\"], function ($, assetHtml) {\n\n\t\t    // define your widget under a namespace of your choice\n\t\t    // 'ao' is used here as a demonstration\n\t\t    $.widget( \"ao.myWidget\", { \n\n\t\t        // Options to be used as defaults\n\t\t        options: {}, \n\n\t\t        // Set up widget (e.g. create element, apply theming,\n\t\t        // bind events, etc.)\n\t\t        _create: function () {\n\n\t\t            // _create will automatically run the first time\n\t\t            // this widget is called. Put the initial widget\n\t\t            // set-up code here, then you can access the element\n\t\t            // on which the widget was called via this.element.\n\t\t            // The options defined above can be accessed via\n\t\t            // this.options\n\n\t\t            //this.element.addStuff();\n\t\t            //this.element.addStuff();\n\t\t            //this.element.tmpl(assetHtml).appendTo(this.content);\n\t\t        },\n\n\t\t        // Destroy an instantiated plugin and clean up modifications\n\t\t        // that the widget has made to the DOM\n\t\t        destroy: function () {\n\t\t            //t his.element.removeStuff();\n\t\t            // For UI 1.8, destroy must be invoked from the base\n\t\t            // widget\n\t\t            $.Widget.prototype.destroy.call( this );\n\t\t            // For UI 1.9, define _destroy instead and don't worry\n\t\t            // about calling the base widget\n\t\t        },\n\n\t\t        methodB: function ( event ) {\n\t\t            // _trigger dispatches callbacks the plugin user can\n\t\t            // subscribe to\n\t\t            //signature: _trigger( \"callbackName\" , [eventObject],\n\t\t            // [uiObject] )\n\t\t            this._trigger('methodA', event, {\n\t\t                key: value\n\t\t            });\n\t\t        },\n\n\t\t        methodA: function ( event ) {\n\t\t            this._trigger('dataChanged', event, {\n\t\t                key: value\n\t\t            });\n\t\t        },\n\n\t\t        //Respond to any changes the user makes to the option method\n\t\t        _setOption: function ( key, value ) {\n\t\t            switch (key) {\n\t\t            case \"someValue\":\n\t\t                //this.options.someValue = doSomethingWith( value );\n\t\t                break;\n\t\t            default:\n\t\t                //this.options[ key ] = value;\n\t\t                break;\n\t\t            }\n\n\t\t            // For UI 1.8, _setOption must be manually invoked from\n\t\t            // the base widget\n\t\t            $.Widget.prototype._setOption.apply( this, arguments );\n\t\t            // For UI 1.9 the _super method can be used instead\n\t\t            //this._super( \"_setOption\", key, value );\n\t\t        }\n\n\t\t        //somewhere assetHtml would be used for templating, depending\n\t\t        // on your choice.\n\t\t    });\n\t\t}); \n\n\t\t// If you are going to use the RequireJS optimizer to combine files\n\t\t// together, you can leave off the \"ao.myWidget\" argument to define:\n\t\t// define([\"jquery\", \"text!templates/asset.html\", \"jquery-ui.custom.min\"], …\n\n\n\t\t// References\n\t\t/*\n\t\tUsing RequireJS with jQuery (by Rebecca Murphey) - http://goo.gl/jpX31\n\t\tFast Modular Code With jQuery and RequireJS (by James Burke) - http://goo.gl/BMEYQ\n\t\tjQuery’s Best Friends (by Alex Sexton) - http://jquerysbestfriends.com/\n\t\tManaging Dependencies With RequireJS (by Ruslan Matveev) - http://goo.gl/zRRT9\n\t\tEssential jQuery Plugin Patterns (by Addy Osmani) - http://goo.gl/oE0ge\n\t\t*/\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "js/libs/jquery-1.6.4.js",
    "content": "/*!\n * jQuery JavaScript Library v1.6.4\n * http://jquery.com/\n *\n * Copyright 2011, John Resig\n * Dual licensed under the MIT or GPL Version 2 licenses.\n * http://jquery.org/license\n *\n * Includes Sizzle.js\n * http://sizzlejs.com/\n * Copyright 2011, The Dojo Foundation\n * Released under the MIT, BSD, and GPL Licenses.\n *\n * Date: Mon Sep 12 18:54:48 2011 -0400\n */\n(function( window, undefined ) {\n\n// Use the correct document accordingly with window argument (sandbox)\nvar document = window.document,\n\tnavigator = window.navigator,\n\tlocation = window.location;\nvar jQuery = (function() {\n\n// Define a local copy of jQuery\nvar jQuery = function( selector, context ) {\n\t\t// The jQuery object is actually just the init constructor 'enhanced'\n\t\treturn new jQuery.fn.init( selector, context, rootjQuery );\n\t},\n\n\t// Map over jQuery in case of overwrite\n\t_jQuery = window.jQuery,\n\n\t// Map over the $ in case of overwrite\n\t_$ = window.$,\n\n\t// A central reference to the root jQuery(document)\n\trootjQuery,\n\n\t// A simple way to check for HTML strings or ID strings\n\t// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)\n\tquickExpr = /^(?:[^#<]*(<[\\w\\W]+>)[^>]*$|#([\\w\\-]*)$)/,\n\n\t// Check if a string has a non-whitespace character in it\n\trnotwhite = /\\S/,\n\n\t// Used for trimming whitespace\n\ttrimLeft = /^\\s+/,\n\ttrimRight = /\\s+$/,\n\n\t// Check for digits\n\trdigit = /\\d/,\n\n\t// Match a standalone tag\n\trsingleTag = /^<(\\w+)\\s*\\/?>(?:<\\/\\1>)?$/,\n\n\t// JSON RegExp\n\trvalidchars = /^[\\],:{}\\s]*$/,\n\trvalidescape = /\\\\(?:[\"\\\\\\/bfnrt]|u[0-9a-fA-F]{4})/g,\n\trvalidtokens = /\"[^\"\\\\\\n\\r]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g,\n\trvalidbraces = /(?:^|:|,)(?:\\s*\\[)+/g,\n\n\t// Useragent RegExp\n\trwebkit = /(webkit)[ \\/]([\\w.]+)/,\n\tropera = /(opera)(?:.*version)?[ \\/]([\\w.]+)/,\n\trmsie = /(msie) ([\\w.]+)/,\n\trmozilla = /(mozilla)(?:.*? rv:([\\w.]+))?/,\n\n\t// Matches dashed string for camelizing\n\trdashAlpha = /-([a-z]|[0-9])/ig,\n\trmsPrefix = /^-ms-/,\n\n\t// Used by jQuery.camelCase as callback to replace()\n\tfcamelCase = function( all, letter ) {\n\t\treturn ( letter + \"\" ).toUpperCase();\n\t},\n\n\t// Keep a UserAgent string for use with jQuery.browser\n\tuserAgent = navigator.userAgent,\n\n\t// For matching the engine and version of the browser\n\tbrowserMatch,\n\n\t// The deferred used on DOM ready\n\treadyList,\n\n\t// The ready event handler\n\tDOMContentLoaded,\n\n\t// Save a reference to some core methods\n\ttoString = Object.prototype.toString,\n\thasOwn = Object.prototype.hasOwnProperty,\n\tpush = Array.prototype.push,\n\tslice = Array.prototype.slice,\n\ttrim = String.prototype.trim,\n\tindexOf = Array.prototype.indexOf,\n\n\t// [[Class]] -> type pairs\n\tclass2type = {};\n\njQuery.fn = jQuery.prototype = {\n\tconstructor: jQuery,\n\tinit: function( selector, context, rootjQuery ) {\n\t\tvar match, elem, ret, doc;\n\n\t\t// Handle $(\"\"), $(null), or $(undefined)\n\t\tif ( !selector ) {\n\t\t\treturn this;\n\t\t}\n\n\t\t// Handle $(DOMElement)\n\t\tif ( selector.nodeType ) {\n\t\t\tthis.context = this[0] = selector;\n\t\t\tthis.length = 1;\n\t\t\treturn this;\n\t\t}\n\n\t\t// The body element only exists once, optimize finding it\n\t\tif ( selector === \"body\" && !context && document.body ) {\n\t\t\tthis.context = document;\n\t\t\tthis[0] = document.body;\n\t\t\tthis.selector = selector;\n\t\t\tthis.length = 1;\n\t\t\treturn this;\n\t\t}\n\n\t\t// Handle HTML strings\n\t\tif ( typeof selector === \"string\" ) {\n\t\t\t// Are we dealing with HTML string or an ID?\n\t\t\tif ( selector.charAt(0) === \"<\" && selector.charAt( selector.length - 1 ) === \">\" && selector.length >= 3 ) {\n\t\t\t\t// Assume that strings that start and end with <> are HTML and skip the regex check\n\t\t\t\tmatch = [ null, selector, null ];\n\n\t\t\t} else {\n\t\t\t\tmatch = quickExpr.exec( selector );\n\t\t\t}\n\n\t\t\t// Verify a match, and that no context was specified for #id\n\t\t\tif ( match && (match[1] || !context) ) {\n\n\t\t\t\t// HANDLE: $(html) -> $(array)\n\t\t\t\tif ( match[1] ) {\n\t\t\t\t\tcontext = context instanceof jQuery ? context[0] : context;\n\t\t\t\t\tdoc = (context ? context.ownerDocument || context : document);\n\n\t\t\t\t\t// If a single string is passed in and it's a single tag\n\t\t\t\t\t// just do a createElement and skip the rest\n\t\t\t\t\tret = rsingleTag.exec( selector );\n\n\t\t\t\t\tif ( ret ) {\n\t\t\t\t\t\tif ( jQuery.isPlainObject( context ) ) {\n\t\t\t\t\t\t\tselector = [ document.createElement( ret[1] ) ];\n\t\t\t\t\t\t\tjQuery.fn.attr.call( selector, context, true );\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tselector = [ doc.createElement( ret[1] ) ];\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tret = jQuery.buildFragment( [ match[1] ], [ doc ] );\n\t\t\t\t\t\tselector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn jQuery.merge( this, selector );\n\n\t\t\t\t// HANDLE: $(\"#id\")\n\t\t\t\t} else {\n\t\t\t\t\telem = document.getElementById( match[2] );\n\n\t\t\t\t\t// Check parentNode to catch when Blackberry 4.6 returns\n\t\t\t\t\t// nodes that are no longer in the document #6963\n\t\t\t\t\tif ( elem && elem.parentNode ) {\n\t\t\t\t\t\t// Handle the case where IE and Opera return items\n\t\t\t\t\t\t// by name instead of ID\n\t\t\t\t\t\tif ( elem.id !== match[2] ) {\n\t\t\t\t\t\t\treturn rootjQuery.find( selector );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Otherwise, we inject the element directly into the jQuery object\n\t\t\t\t\t\tthis.length = 1;\n\t\t\t\t\t\tthis[0] = elem;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.context = document;\n\t\t\t\t\tthis.selector = selector;\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\n\t\t\t// HANDLE: $(expr, $(...))\n\t\t\t} else if ( !context || context.jquery ) {\n\t\t\t\treturn (context || rootjQuery).find( selector );\n\n\t\t\t// HANDLE: $(expr, context)\n\t\t\t// (which is just equivalent to: $(context).find(expr)\n\t\t\t} else {\n\t\t\t\treturn this.constructor( context ).find( selector );\n\t\t\t}\n\n\t\t// HANDLE: $(function)\n\t\t// Shortcut for document ready\n\t\t} else if ( jQuery.isFunction( selector ) ) {\n\t\t\treturn rootjQuery.ready( selector );\n\t\t}\n\n\t\tif (selector.selector !== undefined) {\n\t\t\tthis.selector = selector.selector;\n\t\t\tthis.context = selector.context;\n\t\t}\n\n\t\treturn jQuery.makeArray( selector, this );\n\t},\n\n\t// Start with an empty selector\n\tselector: \"\",\n\n\t// The current version of jQuery being used\n\tjquery: \"1.6.4\",\n\n\t// The default length of a jQuery object is 0\n\tlength: 0,\n\n\t// The number of elements contained in the matched element set\n\tsize: function() {\n\t\treturn this.length;\n\t},\n\n\ttoArray: function() {\n\t\treturn slice.call( this, 0 );\n\t},\n\n\t// Get the Nth element in the matched element set OR\n\t// Get the whole matched element set as a clean array\n\tget: function( num ) {\n\t\treturn num == null ?\n\n\t\t\t// Return a 'clean' array\n\t\t\tthis.toArray() :\n\n\t\t\t// Return just the object\n\t\t\t( num < 0 ? this[ this.length + num ] : this[ num ] );\n\t},\n\n\t// Take an array of elements and push it onto the stack\n\t// (returning the new matched element set)\n\tpushStack: function( elems, name, selector ) {\n\t\t// Build a new jQuery matched element set\n\t\tvar ret = this.constructor();\n\n\t\tif ( jQuery.isArray( elems ) ) {\n\t\t\tpush.apply( ret, elems );\n\n\t\t} else {\n\t\t\tjQuery.merge( ret, elems );\n\t\t}\n\n\t\t// Add the old object onto the stack (as a reference)\n\t\tret.prevObject = this;\n\n\t\tret.context = this.context;\n\n\t\tif ( name === \"find\" ) {\n\t\t\tret.selector = this.selector + (this.selector ? \" \" : \"\") + selector;\n\t\t} else if ( name ) {\n\t\t\tret.selector = this.selector + \".\" + name + \"(\" + selector + \")\";\n\t\t}\n\n\t\t// Return the newly-formed element set\n\t\treturn ret;\n\t},\n\n\t// Execute a callback for every element in the matched set.\n\t// (You can seed the arguments with an array of args, but this is\n\t// only used internally.)\n\teach: function( callback, args ) {\n\t\treturn jQuery.each( this, callback, args );\n\t},\n\n\tready: function( fn ) {\n\t\t// Attach the listeners\n\t\tjQuery.bindReady();\n\n\t\t// Add the callback\n\t\treadyList.done( fn );\n\n\t\treturn this;\n\t},\n\n\teq: function( i ) {\n\t\treturn i === -1 ?\n\t\t\tthis.slice( i ) :\n\t\t\tthis.slice( i, +i + 1 );\n\t},\n\n\tfirst: function() {\n\t\treturn this.eq( 0 );\n\t},\n\n\tlast: function() {\n\t\treturn this.eq( -1 );\n\t},\n\n\tslice: function() {\n\t\treturn this.pushStack( slice.apply( this, arguments ),\n\t\t\t\"slice\", slice.call(arguments).join(\",\") );\n\t},\n\n\tmap: function( callback ) {\n\t\treturn this.pushStack( jQuery.map(this, function( elem, i ) {\n\t\t\treturn callback.call( elem, i, elem );\n\t\t}));\n\t},\n\n\tend: function() {\n\t\treturn this.prevObject || this.constructor(null);\n\t},\n\n\t// For internal use only.\n\t// Behaves like an Array's method, not like a jQuery method.\n\tpush: push,\n\tsort: [].sort,\n\tsplice: [].splice\n};\n\n// Give the init function the jQuery prototype for later instantiation\njQuery.fn.init.prototype = jQuery.fn;\n\njQuery.extend = jQuery.fn.extend = function() {\n\tvar options, name, src, copy, copyIsArray, clone,\n\t\ttarget = arguments[0] || {},\n\t\ti = 1,\n\t\tlength = arguments.length,\n\t\tdeep = false;\n\n\t// Handle a deep copy situation\n\tif ( typeof target === \"boolean\" ) {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\n\t// Handle case when target is a string or something (possible in deep copy)\n\tif ( typeof target !== \"object\" && !jQuery.isFunction(target) ) {\n\t\ttarget = {};\n\t}\n\n\t// extend jQuery itself if only one argument is passed\n\tif ( length === i ) {\n\t\ttarget = this;\n\t\t--i;\n\t}\n\n\tfor ( ; i < length; i++ ) {\n\t\t// Only deal with non-null/undefined values\n\t\tif ( (options = arguments[ i ]) != null ) {\n\t\t\t// Extend the base object\n\t\t\tfor ( name in options ) {\n\t\t\t\tsrc = target[ name ];\n\t\t\t\tcopy = options[ name ];\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif ( target === copy ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\tif ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {\n\t\t\t\t\tif ( copyIsArray ) {\n\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\tclone = src && jQuery.isArray(src) ? src : [];\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclone = src && jQuery.isPlainObject(src) ? src : {};\n\t\t\t\t\t}\n\n\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\ttarget[ name ] = jQuery.extend( deep, clone, copy );\n\n\t\t\t\t// Don't bring in undefined values\n\t\t\t\t} else if ( copy !== undefined ) {\n\t\t\t\t\ttarget[ name ] = copy;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n\njQuery.extend({\n\tnoConflict: function( deep ) {\n\t\tif ( window.$ === jQuery ) {\n\t\t\twindow.$ = _$;\n\t\t}\n\n\t\tif ( deep && window.jQuery === jQuery ) {\n\t\t\twindow.jQuery = _jQuery;\n\t\t}\n\n\t\treturn jQuery;\n\t},\n\n\t// Is the DOM ready to be used? Set to true once it occurs.\n\tisReady: false,\n\n\t// A counter to track how many items to wait for before\n\t// the ready event fires. See #6781\n\treadyWait: 1,\n\n\t// Hold (or release) the ready event\n\tholdReady: function( hold ) {\n\t\tif ( hold ) {\n\t\t\tjQuery.readyWait++;\n\t\t} else {\n\t\t\tjQuery.ready( true );\n\t\t}\n\t},\n\n\t// Handle when the DOM is ready\n\tready: function( wait ) {\n\t\t// Either a released hold or an DOMready/load event and not yet ready\n\t\tif ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {\n\t\t\t// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).\n\t\t\tif ( !document.body ) {\n\t\t\t\treturn setTimeout( jQuery.ready, 1 );\n\t\t\t}\n\n\t\t\t// Remember that the DOM is ready\n\t\t\tjQuery.isReady = true;\n\n\t\t\t// If a normal DOM Ready event fired, decrement, and wait if need be\n\t\t\tif ( wait !== true && --jQuery.readyWait > 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If there are functions bound, to execute\n\t\t\treadyList.resolveWith( document, [ jQuery ] );\n\n\t\t\t// Trigger any bound ready events\n\t\t\tif ( jQuery.fn.trigger ) {\n\t\t\t\tjQuery( document ).trigger( \"ready\" ).unbind( \"ready\" );\n\t\t\t}\n\t\t}\n\t},\n\n\tbindReady: function() {\n\t\tif ( readyList ) {\n\t\t\treturn;\n\t\t}\n\n\t\treadyList = jQuery._Deferred();\n\n\t\t// Catch cases where $(document).ready() is called after the\n\t\t// browser event has already occurred.\n\t\tif ( document.readyState === \"complete\" ) {\n\t\t\t// Handle it asynchronously to allow scripts the opportunity to delay ready\n\t\t\treturn setTimeout( jQuery.ready, 1 );\n\t\t}\n\n\t\t// Mozilla, Opera and webkit nightlies currently support this event\n\t\tif ( document.addEventListener ) {\n\t\t\t// Use the handy event callback\n\t\t\tdocument.addEventListener( \"DOMContentLoaded\", DOMContentLoaded, false );\n\n\t\t\t// A fallback to window.onload, that will always work\n\t\t\twindow.addEventListener( \"load\", jQuery.ready, false );\n\n\t\t// If IE event model is used\n\t\t} else if ( document.attachEvent ) {\n\t\t\t// ensure firing before onload,\n\t\t\t// maybe late but safe also for iframes\n\t\t\tdocument.attachEvent( \"onreadystatechange\", DOMContentLoaded );\n\n\t\t\t// A fallback to window.onload, that will always work\n\t\t\twindow.attachEvent( \"onload\", jQuery.ready );\n\n\t\t\t// If IE and not a frame\n\t\t\t// continually check to see if the document is ready\n\t\t\tvar toplevel = false;\n\n\t\t\ttry {\n\t\t\t\ttoplevel = window.frameElement == null;\n\t\t\t} catch(e) {}\n\n\t\t\tif ( document.documentElement.doScroll && toplevel ) {\n\t\t\t\tdoScrollCheck();\n\t\t\t}\n\t\t}\n\t},\n\n\t// See test/unit/core.js for details concerning isFunction.\n\t// Since version 1.3, DOM methods and functions like alert\n\t// aren't supported. They return false on IE (#2968).\n\tisFunction: function( obj ) {\n\t\treturn jQuery.type(obj) === \"function\";\n\t},\n\n\tisArray: Array.isArray || function( obj ) {\n\t\treturn jQuery.type(obj) === \"array\";\n\t},\n\n\t// A crude way of determining if an object is a window\n\tisWindow: function( obj ) {\n\t\treturn obj && typeof obj === \"object\" && \"setInterval\" in obj;\n\t},\n\n\tisNaN: function( obj ) {\n\t\treturn obj == null || !rdigit.test( obj ) || isNaN( obj );\n\t},\n\n\ttype: function( obj ) {\n\t\treturn obj == null ?\n\t\t\tString( obj ) :\n\t\t\tclass2type[ toString.call(obj) ] || \"object\";\n\t},\n\n\tisPlainObject: function( obj ) {\n\t\t// Must be an Object.\n\t\t// Because of IE, we also have to check the presence of the constructor property.\n\t\t// Make sure that DOM nodes and window objects don't pass through, as well\n\t\tif ( !obj || jQuery.type(obj) !== \"object\" || obj.nodeType || jQuery.isWindow( obj ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\ttry {\n\t\t\t// Not own constructor property must be Object\n\t\t\tif ( obj.constructor &&\n\t\t\t\t!hasOwn.call(obj, \"constructor\") &&\n\t\t\t\t!hasOwn.call(obj.constructor.prototype, \"isPrototypeOf\") ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} catch ( e ) {\n\t\t\t// IE8,9 Will throw exceptions on certain host objects #9897\n\t\t\treturn false;\n\t\t}\n\n\t\t// Own properties are enumerated firstly, so to speed up,\n\t\t// if last one is own, then all properties are own.\n\n\t\tvar key;\n\t\tfor ( key in obj ) {}\n\n\t\treturn key === undefined || hasOwn.call( obj, key );\n\t},\n\n\tisEmptyObject: function( obj ) {\n\t\tfor ( var name in obj ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t},\n\n\terror: function( msg ) {\n\t\tthrow msg;\n\t},\n\n\tparseJSON: function( data ) {\n\t\tif ( typeof data !== \"string\" || !data ) {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Make sure leading/trailing whitespace is removed (IE can't handle it)\n\t\tdata = jQuery.trim( data );\n\n\t\t// Attempt to parse using the native JSON parser first\n\t\tif ( window.JSON && window.JSON.parse ) {\n\t\t\treturn window.JSON.parse( data );\n\t\t}\n\n\t\t// Make sure the incoming data is actual JSON\n\t\t// Logic borrowed from http://json.org/json2.js\n\t\tif ( rvalidchars.test( data.replace( rvalidescape, \"@\" )\n\t\t\t.replace( rvalidtokens, \"]\" )\n\t\t\t.replace( rvalidbraces, \"\")) ) {\n\n\t\t\treturn (new Function( \"return \" + data ))();\n\n\t\t}\n\t\tjQuery.error( \"Invalid JSON: \" + data );\n\t},\n\n\t// Cross-browser xml parsing\n\tparseXML: function( data ) {\n\t\tvar xml, tmp;\n\t\ttry {\n\t\t\tif ( window.DOMParser ) { // Standard\n\t\t\t\ttmp = new DOMParser();\n\t\t\t\txml = tmp.parseFromString( data , \"text/xml\" );\n\t\t\t} else { // IE\n\t\t\t\txml = new ActiveXObject( \"Microsoft.XMLDOM\" );\n\t\t\t\txml.async = \"false\";\n\t\t\t\txml.loadXML( data );\n\t\t\t}\n\t\t} catch( e ) {\n\t\t\txml = undefined;\n\t\t}\n\t\tif ( !xml || !xml.documentElement || xml.getElementsByTagName( \"parsererror\" ).length ) {\n\t\t\tjQuery.error( \"Invalid XML: \" + data );\n\t\t}\n\t\treturn xml;\n\t},\n\n\tnoop: function() {},\n\n\t// Evaluates a script in a global context\n\t// Workarounds based on findings by Jim Driscoll\n\t// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context\n\tglobalEval: function( data ) {\n\t\tif ( data && rnotwhite.test( data ) ) {\n\t\t\t// We use execScript on Internet Explorer\n\t\t\t// We use an anonymous function so that context is window\n\t\t\t// rather than jQuery in Firefox\n\t\t\t( window.execScript || function( data ) {\n\t\t\t\twindow[ \"eval\" ].call( window, data );\n\t\t\t} )( data );\n\t\t}\n\t},\n\n\t// Convert dashed to camelCase; used by the css and data modules\n\t// Microsoft forgot to hump their vendor prefix (#9572)\n\tcamelCase: function( string ) {\n\t\treturn string.replace( rmsPrefix, \"ms-\" ).replace( rdashAlpha, fcamelCase );\n\t},\n\n\tnodeName: function( elem, name ) {\n\t\treturn elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();\n\t},\n\n\t// args is for internal usage only\n\teach: function( object, callback, args ) {\n\t\tvar name, i = 0,\n\t\t\tlength = object.length,\n\t\t\tisObj = length === undefined || jQuery.isFunction( object );\n\n\t\tif ( args ) {\n\t\t\tif ( isObj ) {\n\t\t\t\tfor ( name in object ) {\n\t\t\t\t\tif ( callback.apply( object[ name ], args ) === false ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor ( ; i < length; ) {\n\t\t\t\t\tif ( callback.apply( object[ i++ ], args ) === false ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t// A special, fast, case for the most common use of each\n\t\t} else {\n\t\t\tif ( isObj ) {\n\t\t\t\tfor ( name in object ) {\n\t\t\t\t\tif ( callback.call( object[ name ], name, object[ name ] ) === false ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor ( ; i < length; ) {\n\t\t\t\t\tif ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn object;\n\t},\n\n\t// Use native String.trim function wherever possible\n\ttrim: trim ?\n\t\tfunction( text ) {\n\t\t\treturn text == null ?\n\t\t\t\t\"\" :\n\t\t\t\ttrim.call( text );\n\t\t} :\n\n\t\t// Otherwise use our own trimming functionality\n\t\tfunction( text ) {\n\t\t\treturn text == null ?\n\t\t\t\t\"\" :\n\t\t\t\ttext.toString().replace( trimLeft, \"\" ).replace( trimRight, \"\" );\n\t\t},\n\n\t// results is for internal usage only\n\tmakeArray: function( array, results ) {\n\t\tvar ret = results || [];\n\n\t\tif ( array != null ) {\n\t\t\t// The window, strings (and functions) also have 'length'\n\t\t\t// The extra typeof function check is to prevent crashes\n\t\t\t// in Safari 2 (See: #3039)\n\t\t\t// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930\n\t\t\tvar type = jQuery.type( array );\n\n\t\t\tif ( array.length == null || type === \"string\" || type === \"function\" || type === \"regexp\" || jQuery.isWindow( array ) ) {\n\t\t\t\tpush.call( ret, array );\n\t\t\t} else {\n\t\t\t\tjQuery.merge( ret, array );\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\tinArray: function( elem, array ) {\n\t\tif ( !array ) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tif ( indexOf ) {\n\t\t\treturn indexOf.call( array, elem );\n\t\t}\n\n\t\tfor ( var i = 0, length = array.length; i < length; i++ ) {\n\t\t\tif ( array[ i ] === elem ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t},\n\n\tmerge: function( first, second ) {\n\t\tvar i = first.length,\n\t\t\tj = 0;\n\n\t\tif ( typeof second.length === \"number\" ) {\n\t\t\tfor ( var l = second.length; j < l; j++ ) {\n\t\t\t\tfirst[ i++ ] = second[ j ];\n\t\t\t}\n\n\t\t} else {\n\t\t\twhile ( second[j] !== undefined ) {\n\t\t\t\tfirst[ i++ ] = second[ j++ ];\n\t\t\t}\n\t\t}\n\n\t\tfirst.length = i;\n\n\t\treturn first;\n\t},\n\n\tgrep: function( elems, callback, inv ) {\n\t\tvar ret = [], retVal;\n\t\tinv = !!inv;\n\n\t\t// Go through the array, only saving the items\n\t\t// that pass the validator function\n\t\tfor ( var i = 0, length = elems.length; i < length; i++ ) {\n\t\t\tretVal = !!callback( elems[ i ], i );\n\t\t\tif ( inv !== retVal ) {\n\t\t\t\tret.push( elems[ i ] );\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\t// arg is for internal usage only\n\tmap: function( elems, callback, arg ) {\n\t\tvar value, key, ret = [],\n\t\t\ti = 0,\n\t\t\tlength = elems.length,\n\t\t\t// jquery objects are treated as arrays\n\t\t\tisArray = elems instanceof jQuery || length !== undefined && typeof length === \"number\" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;\n\n\t\t// Go through the array, translating each of the items to their\n\t\tif ( isArray ) {\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tvalue = callback( elems[ i ], i, arg );\n\n\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret[ ret.length ] = value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t// Go through every key on the object,\n\t\t} else {\n\t\t\tfor ( key in elems ) {\n\t\t\t\tvalue = callback( elems[ key ], key, arg );\n\n\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret[ ret.length ] = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Flatten any nested arrays\n\t\treturn ret.concat.apply( [], ret );\n\t},\n\n\t// A global GUID counter for objects\n\tguid: 1,\n\n\t// Bind a function to a context, optionally partially applying any\n\t// arguments.\n\tproxy: function( fn, context ) {\n\t\tif ( typeof context === \"string\" ) {\n\t\t\tvar tmp = fn[ context ];\n\t\t\tcontext = fn;\n\t\t\tfn = tmp;\n\t\t}\n\n\t\t// Quick check to determine if target is callable, in the spec\n\t\t// this throws a TypeError, but we will just return undefined.\n\t\tif ( !jQuery.isFunction( fn ) ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Simulated bind\n\t\tvar args = slice.call( arguments, 2 ),\n\t\t\tproxy = function() {\n\t\t\t\treturn fn.apply( context, args.concat( slice.call( arguments ) ) );\n\t\t\t};\n\n\t\t// Set the guid of unique handler to the same of original handler, so it can be removed\n\t\tproxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;\n\n\t\treturn proxy;\n\t},\n\n\t// Mutifunctional method to get and set values to a collection\n\t// The value/s can optionally be executed if it's a function\n\taccess: function( elems, key, value, exec, fn, pass ) {\n\t\tvar length = elems.length;\n\n\t\t// Setting many attributes\n\t\tif ( typeof key === \"object\" ) {\n\t\t\tfor ( var k in key ) {\n\t\t\t\tjQuery.access( elems, k, key[k], exec, fn, value );\n\t\t\t}\n\t\t\treturn elems;\n\t\t}\n\n\t\t// Setting one attribute\n\t\tif ( value !== undefined ) {\n\t\t\t// Optionally, function values get executed if exec is true\n\t\t\texec = !pass && exec && jQuery.isFunction(value);\n\n\t\t\tfor ( var i = 0; i < length; i++ ) {\n\t\t\t\tfn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );\n\t\t\t}\n\n\t\t\treturn elems;\n\t\t}\n\n\t\t// Getting an attribute\n\t\treturn length ? fn( elems[0], key ) : undefined;\n\t},\n\n\tnow: function() {\n\t\treturn (new Date()).getTime();\n\t},\n\n\t// Use of jQuery.browser is frowned upon.\n\t// More details: http://docs.jquery.com/Utilities/jQuery.browser\n\tuaMatch: function( ua ) {\n\t\tua = ua.toLowerCase();\n\n\t\tvar match = rwebkit.exec( ua ) ||\n\t\t\tropera.exec( ua ) ||\n\t\t\trmsie.exec( ua ) ||\n\t\t\tua.indexOf(\"compatible\") < 0 && rmozilla.exec( ua ) ||\n\t\t\t[];\n\n\t\treturn { browser: match[1] || \"\", version: match[2] || \"0\" };\n\t},\n\n\tsub: function() {\n\t\tfunction jQuerySub( selector, context ) {\n\t\t\treturn new jQuerySub.fn.init( selector, context );\n\t\t}\n\t\tjQuery.extend( true, jQuerySub, this );\n\t\tjQuerySub.superclass = this;\n\t\tjQuerySub.fn = jQuerySub.prototype = this();\n\t\tjQuerySub.fn.constructor = jQuerySub;\n\t\tjQuerySub.sub = this.sub;\n\t\tjQuerySub.fn.init = function init( selector, context ) {\n\t\t\tif ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {\n\t\t\t\tcontext = jQuerySub( context );\n\t\t\t}\n\n\t\t\treturn jQuery.fn.init.call( this, selector, context, rootjQuerySub );\n\t\t};\n\t\tjQuerySub.fn.init.prototype = jQuerySub.fn;\n\t\tvar rootjQuerySub = jQuerySub(document);\n\t\treturn jQuerySub;\n\t},\n\n\tbrowser: {}\n});\n\n// Populate the class2type map\njQuery.each(\"Boolean Number String Function Array Date RegExp Object\".split(\" \"), function(i, name) {\n\tclass2type[ \"[object \" + name + \"]\" ] = name.toLowerCase();\n});\n\nbrowserMatch = jQuery.uaMatch( userAgent );\nif ( browserMatch.browser ) {\n\tjQuery.browser[ browserMatch.browser ] = true;\n\tjQuery.browser.version = browserMatch.version;\n}\n\n// Deprecated, use jQuery.browser.webkit instead\nif ( jQuery.browser.webkit ) {\n\tjQuery.browser.safari = true;\n}\n\n// IE doesn't match non-breaking spaces with \\s\nif ( rnotwhite.test( \"\\xA0\" ) ) {\n\ttrimLeft = /^[\\s\\xA0]+/;\n\ttrimRight = /[\\s\\xA0]+$/;\n}\n\n// All jQuery objects should point back to these\nrootjQuery = jQuery(document);\n\n// Cleanup functions for the document ready method\nif ( document.addEventListener ) {\n\tDOMContentLoaded = function() {\n\t\tdocument.removeEventListener( \"DOMContentLoaded\", DOMContentLoaded, false );\n\t\tjQuery.ready();\n\t};\n\n} else if ( document.attachEvent ) {\n\tDOMContentLoaded = function() {\n\t\t// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).\n\t\tif ( document.readyState === \"complete\" ) {\n\t\t\tdocument.detachEvent( \"onreadystatechange\", DOMContentLoaded );\n\t\t\tjQuery.ready();\n\t\t}\n\t};\n}\n\n// The DOM ready check for Internet Explorer\nfunction doScrollCheck() {\n\tif ( jQuery.isReady ) {\n\t\treturn;\n\t}\n\n\ttry {\n\t\t// If IE is used, use the trick by Diego Perini\n\t\t// http://javascript.nwbox.com/IEContentLoaded/\n\t\tdocument.documentElement.doScroll(\"left\");\n\t} catch(e) {\n\t\tsetTimeout( doScrollCheck, 1 );\n\t\treturn;\n\t}\n\n\t// and execute any waiting functions\n\tjQuery.ready();\n}\n\nreturn jQuery;\n\n})();\n\n\nvar // Promise methods\n\tpromiseMethods = \"done fail isResolved isRejected promise then always pipe\".split( \" \" ),\n\t// Static reference to slice\n\tsliceDeferred = [].slice;\n\njQuery.extend({\n\t// Create a simple deferred (one callbacks list)\n\t_Deferred: function() {\n\t\tvar // callbacks list\n\t\t\tcallbacks = [],\n\t\t\t// stored [ context , args ]\n\t\t\tfired,\n\t\t\t// to avoid firing when already doing so\n\t\t\tfiring,\n\t\t\t// flag to know if the deferred has been cancelled\n\t\t\tcancelled,\n\t\t\t// the deferred itself\n\t\t\tdeferred  = {\n\n\t\t\t\t// done( f1, f2, ...)\n\t\t\t\tdone: function() {\n\t\t\t\t\tif ( !cancelled ) {\n\t\t\t\t\t\tvar args = arguments,\n\t\t\t\t\t\t\ti,\n\t\t\t\t\t\t\tlength,\n\t\t\t\t\t\t\telem,\n\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\t_fired;\n\t\t\t\t\t\tif ( fired ) {\n\t\t\t\t\t\t\t_fired = fired;\n\t\t\t\t\t\t\tfired = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor ( i = 0, length = args.length; i < length; i++ ) {\n\t\t\t\t\t\t\telem = args[ i ];\n\t\t\t\t\t\t\ttype = jQuery.type( elem );\n\t\t\t\t\t\t\tif ( type === \"array\" ) {\n\t\t\t\t\t\t\t\tdeferred.done.apply( deferred, elem );\n\t\t\t\t\t\t\t} else if ( type === \"function\" ) {\n\t\t\t\t\t\t\t\tcallbacks.push( elem );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( _fired ) {\n\t\t\t\t\t\t\tdeferred.resolveWith( _fired[ 0 ], _fired[ 1 ] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// resolve with given context and args\n\t\t\t\tresolveWith: function( context, args ) {\n\t\t\t\t\tif ( !cancelled && !fired && !firing ) {\n\t\t\t\t\t\t// make sure args are available (#8421)\n\t\t\t\t\t\targs = args || [];\n\t\t\t\t\t\tfiring = 1;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\twhile( callbacks[ 0 ] ) {\n\t\t\t\t\t\t\t\tcallbacks.shift().apply( context, args );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfinally {\n\t\t\t\t\t\t\tfired = [ context, args ];\n\t\t\t\t\t\t\tfiring = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// resolve with this as context and given arguments\n\t\t\t\tresolve: function() {\n\t\t\t\t\tdeferred.resolveWith( this, arguments );\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Has this deferred been resolved?\n\t\t\t\tisResolved: function() {\n\t\t\t\t\treturn !!( firing || fired );\n\t\t\t\t},\n\n\t\t\t\t// Cancel\n\t\t\t\tcancel: function() {\n\t\t\t\t\tcancelled = 1;\n\t\t\t\t\tcallbacks = [];\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\t\t\t};\n\n\t\treturn deferred;\n\t},\n\n\t// Full fledged deferred (two callbacks list)\n\tDeferred: function( func ) {\n\t\tvar deferred = jQuery._Deferred(),\n\t\t\tfailDeferred = jQuery._Deferred(),\n\t\t\tpromise;\n\t\t// Add errorDeferred methods, then and promise\n\t\tjQuery.extend( deferred, {\n\t\t\tthen: function( doneCallbacks, failCallbacks ) {\n\t\t\t\tdeferred.done( doneCallbacks ).fail( failCallbacks );\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\talways: function() {\n\t\t\t\treturn deferred.done.apply( deferred, arguments ).fail.apply( this, arguments );\n\t\t\t},\n\t\t\tfail: failDeferred.done,\n\t\t\trejectWith: failDeferred.resolveWith,\n\t\t\treject: failDeferred.resolve,\n\t\t\tisRejected: failDeferred.isResolved,\n\t\t\tpipe: function( fnDone, fnFail ) {\n\t\t\t\treturn jQuery.Deferred(function( newDefer ) {\n\t\t\t\t\tjQuery.each( {\n\t\t\t\t\t\tdone: [ fnDone, \"resolve\" ],\n\t\t\t\t\t\tfail: [ fnFail, \"reject\" ]\n\t\t\t\t\t}, function( handler, data ) {\n\t\t\t\t\t\tvar fn = data[ 0 ],\n\t\t\t\t\t\t\taction = data[ 1 ],\n\t\t\t\t\t\t\treturned;\n\t\t\t\t\t\tif ( jQuery.isFunction( fn ) ) {\n\t\t\t\t\t\t\tdeferred[ handler ](function() {\n\t\t\t\t\t\t\t\treturned = fn.apply( this, arguments );\n\t\t\t\t\t\t\t\tif ( returned && jQuery.isFunction( returned.promise ) ) {\n\t\t\t\t\t\t\t\t\treturned.promise().then( newDefer.resolve, newDefer.reject );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tnewDefer[ action + \"With\" ]( this === deferred ? newDefer : this, [ returned ] );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdeferred[ handler ]( newDefer[ action ] );\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}).promise();\n\t\t\t},\n\t\t\t// Get a promise for this deferred\n\t\t\t// If obj is provided, the promise aspect is added to the object\n\t\t\tpromise: function( obj ) {\n\t\t\t\tif ( obj == null ) {\n\t\t\t\t\tif ( promise ) {\n\t\t\t\t\t\treturn promise;\n\t\t\t\t\t}\n\t\t\t\t\tpromise = obj = {};\n\t\t\t\t}\n\t\t\t\tvar i = promiseMethods.length;\n\t\t\t\twhile( i-- ) {\n\t\t\t\t\tobj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ];\n\t\t\t\t}\n\t\t\t\treturn obj;\n\t\t\t}\n\t\t});\n\t\t// Make sure only one callback list will be used\n\t\tdeferred.done( failDeferred.cancel ).fail( deferred.cancel );\n\t\t// Unexpose cancel\n\t\tdelete deferred.cancel;\n\t\t// Call given func if any\n\t\tif ( func ) {\n\t\t\tfunc.call( deferred, deferred );\n\t\t}\n\t\treturn deferred;\n\t},\n\n\t// Deferred helper\n\twhen: function( firstParam ) {\n\t\tvar args = arguments,\n\t\t\ti = 0,\n\t\t\tlength = args.length,\n\t\t\tcount = length,\n\t\t\tdeferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?\n\t\t\t\tfirstParam :\n\t\t\t\tjQuery.Deferred();\n\t\tfunction resolveFunc( i ) {\n\t\t\treturn function( value ) {\n\t\t\t\targs[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;\n\t\t\t\tif ( !( --count ) ) {\n\t\t\t\t\t// Strange bug in FF4:\n\t\t\t\t\t// Values changed onto the arguments object sometimes end up as undefined values\n\t\t\t\t\t// outside the $.when method. Cloning the object into a fresh array solves the issue\n\t\t\t\t\tdeferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) );\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\tif ( length > 1 ) {\n\t\t\tfor( ; i < length; i++ ) {\n\t\t\t\tif ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) {\n\t\t\t\t\targs[ i ].promise().then( resolveFunc(i), deferred.reject );\n\t\t\t\t} else {\n\t\t\t\t\t--count;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( !count ) {\n\t\t\t\tdeferred.resolveWith( deferred, args );\n\t\t\t}\n\t\t} else if ( deferred !== firstParam ) {\n\t\t\tdeferred.resolveWith( deferred, length ? [ firstParam ] : [] );\n\t\t}\n\t\treturn deferred.promise();\n\t}\n});\n\n\n\njQuery.support = (function() {\n\n\tvar div = document.createElement( \"div\" ),\n\t\tdocumentElement = document.documentElement,\n\t\tall,\n\t\ta,\n\t\tselect,\n\t\topt,\n\t\tinput,\n\t\tmarginDiv,\n\t\tsupport,\n\t\tfragment,\n\t\tbody,\n\t\ttestElementParent,\n\t\ttestElement,\n\t\ttestElementStyle,\n\t\ttds,\n\t\tevents,\n\t\teventName,\n\t\ti,\n\t\tisSupported;\n\n\t// Preliminary tests\n\tdiv.setAttribute(\"className\", \"t\");\n\tdiv.innerHTML = \"   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>\";\n\n\n\tall = div.getElementsByTagName( \"*\" );\n\ta = div.getElementsByTagName( \"a\" )[ 0 ];\n\n\t// Can't get basic test support\n\tif ( !all || !all.length || !a ) {\n\t\treturn {};\n\t}\n\n\t// First batch of supports tests\n\tselect = document.createElement( \"select\" );\n\topt = select.appendChild( document.createElement(\"option\") );\n\tinput = div.getElementsByTagName( \"input\" )[ 0 ];\n\n\tsupport = {\n\t\t// IE strips leading whitespace when .innerHTML is used\n\t\tleadingWhitespace: ( div.firstChild.nodeType === 3 ),\n\n\t\t// Make sure that tbody elements aren't automatically inserted\n\t\t// IE will insert them into empty tables\n\t\ttbody: !div.getElementsByTagName( \"tbody\" ).length,\n\n\t\t// Make sure that link elements get serialized correctly by innerHTML\n\t\t// This requires a wrapper element in IE\n\t\thtmlSerialize: !!div.getElementsByTagName( \"link\" ).length,\n\n\t\t// Get the style information from getAttribute\n\t\t// (IE uses .cssText instead)\n\t\tstyle: /top/.test( a.getAttribute(\"style\") ),\n\n\t\t// Make sure that URLs aren't manipulated\n\t\t// (IE normalizes it by default)\n\t\threfNormalized: ( a.getAttribute( \"href\" ) === \"/a\" ),\n\n\t\t// Make sure that element opacity exists\n\t\t// (IE uses filter instead)\n\t\t// Use a regex to work around a WebKit issue. See #5145\n\t\topacity: /^0.55$/.test( a.style.opacity ),\n\n\t\t// Verify style float existence\n\t\t// (IE uses styleFloat instead of cssFloat)\n\t\tcssFloat: !!a.style.cssFloat,\n\n\t\t// Make sure that if no value is specified for a checkbox\n\t\t// that it defaults to \"on\".\n\t\t// (WebKit defaults to \"\" instead)\n\t\tcheckOn: ( input.value === \"on\" ),\n\n\t\t// Make sure that a selected-by-default option has a working selected property.\n\t\t// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)\n\t\toptSelected: opt.selected,\n\n\t\t// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)\n\t\tgetSetAttribute: div.className !== \"t\",\n\n\t\t// Will be defined later\n\t\tsubmitBubbles: true,\n\t\tchangeBubbles: true,\n\t\tfocusinBubbles: false,\n\t\tdeleteExpando: true,\n\t\tnoCloneEvent: true,\n\t\tinlineBlockNeedsLayout: false,\n\t\tshrinkWrapBlocks: false,\n\t\treliableMarginRight: true\n\t};\n\n\t// Make sure checked status is properly cloned\n\tinput.checked = true;\n\tsupport.noCloneChecked = input.cloneNode( true ).checked;\n\n\t// Make sure that the options inside disabled selects aren't marked as disabled\n\t// (WebKit marks them as disabled)\n\tselect.disabled = true;\n\tsupport.optDisabled = !opt.disabled;\n\n\t// Test to see if it's possible to delete an expando from an element\n\t// Fails in Internet Explorer\n\ttry {\n\t\tdelete div.test;\n\t} catch( e ) {\n\t\tsupport.deleteExpando = false;\n\t}\n\n\tif ( !div.addEventListener && div.attachEvent && div.fireEvent ) {\n\t\tdiv.attachEvent( \"onclick\", function() {\n\t\t\t// Cloning a node shouldn't copy over any\n\t\t\t// bound event handlers (IE does this)\n\t\t\tsupport.noCloneEvent = false;\n\t\t});\n\t\tdiv.cloneNode( true ).fireEvent( \"onclick\" );\n\t}\n\n\t// Check if a radio maintains it's value\n\t// after being appended to the DOM\n\tinput = document.createElement(\"input\");\n\tinput.value = \"t\";\n\tinput.setAttribute(\"type\", \"radio\");\n\tsupport.radioValue = input.value === \"t\";\n\n\tinput.setAttribute(\"checked\", \"checked\");\n\tdiv.appendChild( input );\n\tfragment = document.createDocumentFragment();\n\tfragment.appendChild( div.firstChild );\n\n\t// WebKit doesn't clone checked state correctly in fragments\n\tsupport.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;\n\n\tdiv.innerHTML = \"\";\n\n\t// Figure out if the W3C box model works as expected\n\tdiv.style.width = div.style.paddingLeft = \"1px\";\n\n\tbody = document.getElementsByTagName( \"body\" )[ 0 ];\n\t// We use our own, invisible, body unless the body is already present\n\t// in which case we use a div (#9239)\n\ttestElement = document.createElement( body ? \"div\" : \"body\" );\n\ttestElementStyle = {\n\t\tvisibility: \"hidden\",\n\t\twidth: 0,\n\t\theight: 0,\n\t\tborder: 0,\n\t\tmargin: 0,\n\t\tbackground: \"none\"\n\t};\n\tif ( body ) {\n\t\tjQuery.extend( testElementStyle, {\n\t\t\tposition: \"absolute\",\n\t\t\tleft: \"-1000px\",\n\t\t\ttop: \"-1000px\"\n\t\t});\n\t}\n\tfor ( i in testElementStyle ) {\n\t\ttestElement.style[ i ] = testElementStyle[ i ];\n\t}\n\ttestElement.appendChild( div );\n\ttestElementParent = body || documentElement;\n\ttestElementParent.insertBefore( testElement, testElementParent.firstChild );\n\n\t// Check if a disconnected checkbox will retain its checked\n\t// value of true after appended to the DOM (IE6/7)\n\tsupport.appendChecked = input.checked;\n\n\tsupport.boxModel = div.offsetWidth === 2;\n\n\tif ( \"zoom\" in div.style ) {\n\t\t// Check if natively block-level elements act like inline-block\n\t\t// elements when setting their display to 'inline' and giving\n\t\t// them layout\n\t\t// (IE < 8 does this)\n\t\tdiv.style.display = \"inline\";\n\t\tdiv.style.zoom = 1;\n\t\tsupport.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );\n\n\t\t// Check if elements with layout shrink-wrap their children\n\t\t// (IE 6 does this)\n\t\tdiv.style.display = \"\";\n\t\tdiv.innerHTML = \"<div style='width:4px;'></div>\";\n\t\tsupport.shrinkWrapBlocks = ( div.offsetWidth !== 2 );\n\t}\n\n\tdiv.innerHTML = \"<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>\";\n\ttds = div.getElementsByTagName( \"td\" );\n\n\t// Check if table cells still have offsetWidth/Height when they are set\n\t// to display:none and there are still other visible table cells in a\n\t// table row; if so, offsetWidth/Height are not reliable for use when\n\t// determining if an element has been hidden directly using\n\t// display:none (it is still safe to use offsets if a parent element is\n\t// hidden; don safety goggles and see bug #4512 for more information).\n\t// (only IE 8 fails this test)\n\tisSupported = ( tds[ 0 ].offsetHeight === 0 );\n\n\ttds[ 0 ].style.display = \"\";\n\ttds[ 1 ].style.display = \"none\";\n\n\t// Check if empty table cells still have offsetWidth/Height\n\t// (IE < 8 fail this test)\n\tsupport.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );\n\tdiv.innerHTML = \"\";\n\n\t// Check if div with explicit width and no margin-right incorrectly\n\t// gets computed margin-right based on width of container. For more\n\t// info see bug #3333\n\t// Fails in WebKit before Feb 2011 nightlies\n\t// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right\n\tif ( document.defaultView && document.defaultView.getComputedStyle ) {\n\t\tmarginDiv = document.createElement( \"div\" );\n\t\tmarginDiv.style.width = \"0\";\n\t\tmarginDiv.style.marginRight = \"0\";\n\t\tdiv.appendChild( marginDiv );\n\t\tsupport.reliableMarginRight =\n\t\t\t( parseInt( ( document.defaultView.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;\n\t}\n\n\t// Remove the body element we added\n\ttestElement.innerHTML = \"\";\n\ttestElementParent.removeChild( testElement );\n\n\t// Technique from Juriy Zaytsev\n\t// http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/\n\t// We only care about the case where non-standard event systems\n\t// are used, namely in IE. Short-circuiting here helps us to\n\t// avoid an eval call (in setAttribute) which can cause CSP\n\t// to go haywire. See: https://developer.mozilla.org/en/Security/CSP\n\tif ( div.attachEvent ) {\n\t\tfor( i in {\n\t\t\tsubmit: 1,\n\t\t\tchange: 1,\n\t\t\tfocusin: 1\n\t\t} ) {\n\t\t\teventName = \"on\" + i;\n\t\t\tisSupported = ( eventName in div );\n\t\t\tif ( !isSupported ) {\n\t\t\t\tdiv.setAttribute( eventName, \"return;\" );\n\t\t\t\tisSupported = ( typeof div[ eventName ] === \"function\" );\n\t\t\t}\n\t\t\tsupport[ i + \"Bubbles\" ] = isSupported;\n\t\t}\n\t}\n\n\t// Null connected elements to avoid leaks in IE\n\ttestElement = fragment = select = opt = body = marginDiv = div = input = null;\n\n\treturn support;\n})();\n\n// Keep track of boxModel\njQuery.boxModel = jQuery.support.boxModel;\n\n\n\n\nvar rbrace = /^(?:\\{.*\\}|\\[.*\\])$/,\n\trmultiDash = /([A-Z])/g;\n\njQuery.extend({\n\tcache: {},\n\n\t// Please use with caution\n\tuuid: 0,\n\n\t// Unique for each copy of jQuery on the page\n\t// Non-digits removed to match rinlinejQuery\n\texpando: \"jQuery\" + ( jQuery.fn.jquery + Math.random() ).replace( /\\D/g, \"\" ),\n\n\t// The following elements throw uncatchable exceptions if you\n\t// attempt to add expando properties to them.\n\tnoData: {\n\t\t\"embed\": true,\n\t\t// Ban all objects except for Flash (which handle expandos)\n\t\t\"object\": \"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\",\n\t\t\"applet\": true\n\t},\n\n\thasData: function( elem ) {\n\t\telem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];\n\n\t\treturn !!elem && !isEmptyDataObject( elem );\n\t},\n\n\tdata: function( elem, name, data, pvt /* Internal Use Only */ ) {\n\t\tif ( !jQuery.acceptData( elem ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar thisCache, ret,\n\t\t\tinternalKey = jQuery.expando,\n\t\t\tgetByName = typeof name === \"string\",\n\n\t\t\t// We have to handle DOM nodes and JS objects differently because IE6-7\n\t\t\t// can't GC object references properly across the DOM-JS boundary\n\t\t\tisNode = elem.nodeType,\n\n\t\t\t// Only DOM nodes need the global jQuery cache; JS object data is\n\t\t\t// attached directly to the object so GC can occur automatically\n\t\t\tcache = isNode ? jQuery.cache : elem,\n\n\t\t\t// Only defining an ID for JS objects if its cache already exists allows\n\t\t\t// the code to shortcut on the same path as a DOM node with no cache\n\t\t\tid = isNode ? elem[ jQuery.expando ] : elem[ jQuery.expando ] && jQuery.expando;\n\n\t\t// Avoid doing any more work than we need to when trying to get data on an\n\t\t// object that has no data at all\n\t\tif ( (!id || (pvt && id && (cache[ id ] && !cache[ id ][ internalKey ]))) && getByName && data === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( !id ) {\n\t\t\t// Only DOM nodes need a new unique ID for each element since their data\n\t\t\t// ends up in the global cache\n\t\t\tif ( isNode ) {\n\t\t\t\telem[ jQuery.expando ] = id = ++jQuery.uuid;\n\t\t\t} else {\n\t\t\t\tid = jQuery.expando;\n\t\t\t}\n\t\t}\n\n\t\tif ( !cache[ id ] ) {\n\t\t\tcache[ id ] = {};\n\n\t\t\t// TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery\n\t\t\t// metadata on plain JS objects when the object is serialized using\n\t\t\t// JSON.stringify\n\t\t\tif ( !isNode ) {\n\t\t\t\tcache[ id ].toJSON = jQuery.noop;\n\t\t\t}\n\t\t}\n\n\t\t// An object can be passed to jQuery.data instead of a key/value pair; this gets\n\t\t// shallow copied over onto the existing cache\n\t\tif ( typeof name === \"object\" || typeof name === \"function\" ) {\n\t\t\tif ( pvt ) {\n\t\t\t\tcache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name);\n\t\t\t} else {\n\t\t\t\tcache[ id ] = jQuery.extend(cache[ id ], name);\n\t\t\t}\n\t\t}\n\n\t\tthisCache = cache[ id ];\n\n\t\t// Internal jQuery data is stored in a separate object inside the object's data\n\t\t// cache in order to avoid key collisions between internal data and user-defined\n\t\t// data\n\t\tif ( pvt ) {\n\t\t\tif ( !thisCache[ internalKey ] ) {\n\t\t\t\tthisCache[ internalKey ] = {};\n\t\t\t}\n\n\t\t\tthisCache = thisCache[ internalKey ];\n\t\t}\n\n\t\tif ( data !== undefined ) {\n\t\t\tthisCache[ jQuery.camelCase( name ) ] = data;\n\t\t}\n\n\t\t// TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should\n\t\t// not attempt to inspect the internal events object using jQuery.data, as this\n\t\t// internal data object is undocumented and subject to change.\n\t\tif ( name === \"events\" && !thisCache[name] ) {\n\t\t\treturn thisCache[ internalKey ] && thisCache[ internalKey ].events;\n\t\t}\n\n\t\t// Check for both converted-to-camel and non-converted data property names\n\t\t// If a data property was specified\n\t\tif ( getByName ) {\n\n\t\t\t// First Try to find as-is property data\n\t\t\tret = thisCache[ name ];\n\n\t\t\t// Test for null|undefined property data\n\t\t\tif ( ret == null ) {\n\n\t\t\t\t// Try to find the camelCased property\n\t\t\t\tret = thisCache[ jQuery.camelCase( name ) ];\n\t\t\t}\n\t\t} else {\n\t\t\tret = thisCache;\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\tremoveData: function( elem, name, pvt /* Internal Use Only */ ) {\n\t\tif ( !jQuery.acceptData( elem ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar thisCache,\n\n\t\t\t// Reference to internal data cache key\n\t\t\tinternalKey = jQuery.expando,\n\n\t\t\tisNode = elem.nodeType,\n\n\t\t\t// See jQuery.data for more information\n\t\t\tcache = isNode ? jQuery.cache : elem,\n\n\t\t\t// See jQuery.data for more information\n\t\t\tid = isNode ? elem[ jQuery.expando ] : jQuery.expando;\n\n\t\t// If there is already no cache entry for this object, there is no\n\t\t// purpose in continuing\n\t\tif ( !cache[ id ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( name ) {\n\n\t\t\tthisCache = pvt ? cache[ id ][ internalKey ] : cache[ id ];\n\n\t\t\tif ( thisCache ) {\n\n\t\t\t\t// Support interoperable removal of hyphenated or camelcased keys\n\t\t\t\tif ( !thisCache[ name ] ) {\n\t\t\t\t\tname = jQuery.camelCase( name );\n\t\t\t\t}\n\n\t\t\t\tdelete thisCache[ name ];\n\n\t\t\t\t// If there is no data left in the cache, we want to continue\n\t\t\t\t// and let the cache object itself get destroyed\n\t\t\t\tif ( !isEmptyDataObject(thisCache) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// See jQuery.data for more information\n\t\tif ( pvt ) {\n\t\t\tdelete cache[ id ][ internalKey ];\n\n\t\t\t// Don't destroy the parent cache unless the internal data object\n\t\t\t// had been the only thing left in it\n\t\t\tif ( !isEmptyDataObject(cache[ id ]) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tvar internalCache = cache[ id ][ internalKey ];\n\n\t\t// Browsers that fail expando deletion also refuse to delete expandos on\n\t\t// the window, but it will allow it on all other JS objects; other browsers\n\t\t// don't care\n\t\t// Ensure that `cache` is not a window object #10080\n\t\tif ( jQuery.support.deleteExpando || !cache.setInterval ) {\n\t\t\tdelete cache[ id ];\n\t\t} else {\n\t\t\tcache[ id ] = null;\n\t\t}\n\n\t\t// We destroyed the entire user cache at once because it's faster than\n\t\t// iterating through each key, but we need to continue to persist internal\n\t\t// data if it existed\n\t\tif ( internalCache ) {\n\t\t\tcache[ id ] = {};\n\t\t\t// TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery\n\t\t\t// metadata on plain JS objects when the object is serialized using\n\t\t\t// JSON.stringify\n\t\t\tif ( !isNode ) {\n\t\t\t\tcache[ id ].toJSON = jQuery.noop;\n\t\t\t}\n\n\t\t\tcache[ id ][ internalKey ] = internalCache;\n\n\t\t// Otherwise, we need to eliminate the expando on the node to avoid\n\t\t// false lookups in the cache for entries that no longer exist\n\t\t} else if ( isNode ) {\n\t\t\t// IE does not allow us to delete expando properties from nodes,\n\t\t\t// nor does it have a removeAttribute function on Document nodes;\n\t\t\t// we must handle all of these cases\n\t\t\tif ( jQuery.support.deleteExpando ) {\n\t\t\t\tdelete elem[ jQuery.expando ];\n\t\t\t} else if ( elem.removeAttribute ) {\n\t\t\t\telem.removeAttribute( jQuery.expando );\n\t\t\t} else {\n\t\t\t\telem[ jQuery.expando ] = null;\n\t\t\t}\n\t\t}\n\t},\n\n\t// For internal use only.\n\t_data: function( elem, name, data ) {\n\t\treturn jQuery.data( elem, name, data, true );\n\t},\n\n\t// A method for determining if a DOM node can handle the data expando\n\tacceptData: function( elem ) {\n\t\tif ( elem.nodeName ) {\n\t\t\tvar match = jQuery.noData[ elem.nodeName.toLowerCase() ];\n\n\t\t\tif ( match ) {\n\t\t\t\treturn !(match === true || elem.getAttribute(\"classid\") !== match);\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n});\n\njQuery.fn.extend({\n\tdata: function( key, value ) {\n\t\tvar data = null;\n\n\t\tif ( typeof key === \"undefined\" ) {\n\t\t\tif ( this.length ) {\n\t\t\t\tdata = jQuery.data( this[0] );\n\n\t\t\t\tif ( this[0].nodeType === 1 ) {\n\t\t\t    var attr = this[0].attributes, name;\n\t\t\t\t\tfor ( var i = 0, l = attr.length; i < l; i++ ) {\n\t\t\t\t\t\tname = attr[i].name;\n\n\t\t\t\t\t\tif ( name.indexOf( \"data-\" ) === 0 ) {\n\t\t\t\t\t\t\tname = jQuery.camelCase( name.substring(5) );\n\n\t\t\t\t\t\t\tdataAttr( this[0], name, data[ name ] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn data;\n\n\t\t} else if ( typeof key === \"object\" ) {\n\t\t\treturn this.each(function() {\n\t\t\t\tjQuery.data( this, key );\n\t\t\t});\n\t\t}\n\n\t\tvar parts = key.split(\".\");\n\t\tparts[1] = parts[1] ? \".\" + parts[1] : \"\";\n\n\t\tif ( value === undefined ) {\n\t\t\tdata = this.triggerHandler(\"getData\" + parts[1] + \"!\", [parts[0]]);\n\n\t\t\t// Try to fetch any internally stored data first\n\t\t\tif ( data === undefined && this.length ) {\n\t\t\t\tdata = jQuery.data( this[0], key );\n\t\t\t\tdata = dataAttr( this[0], key, data );\n\t\t\t}\n\n\t\t\treturn data === undefined && parts[1] ?\n\t\t\t\tthis.data( parts[0] ) :\n\t\t\t\tdata;\n\n\t\t} else {\n\t\t\treturn this.each(function() {\n\t\t\t\tvar $this = jQuery( this ),\n\t\t\t\t\targs = [ parts[0], value ];\n\n\t\t\t\t$this.triggerHandler( \"setData\" + parts[1] + \"!\", args );\n\t\t\t\tjQuery.data( this, key, value );\n\t\t\t\t$this.triggerHandler( \"changeData\" + parts[1] + \"!\", args );\n\t\t\t});\n\t\t}\n\t},\n\n\tremoveData: function( key ) {\n\t\treturn this.each(function() {\n\t\t\tjQuery.removeData( this, key );\n\t\t});\n\t}\n});\n\nfunction dataAttr( elem, key, data ) {\n\t// If nothing was found internally, try to fetch any\n\t// data from the HTML5 data-* attribute\n\tif ( data === undefined && elem.nodeType === 1 ) {\n\n\t\tvar name = \"data-\" + key.replace( rmultiDash, \"-$1\" ).toLowerCase();\n\n\t\tdata = elem.getAttribute( name );\n\n\t\tif ( typeof data === \"string\" ) {\n\t\t\ttry {\n\t\t\t\tdata = data === \"true\" ? true :\n\t\t\t\tdata === \"false\" ? false :\n\t\t\t\tdata === \"null\" ? null :\n\t\t\t\t!jQuery.isNaN( data ) ? parseFloat( data ) :\n\t\t\t\t\trbrace.test( data ) ? jQuery.parseJSON( data ) :\n\t\t\t\t\tdata;\n\t\t\t} catch( e ) {}\n\n\t\t\t// Make sure we set the data so it isn't changed later\n\t\t\tjQuery.data( elem, key, data );\n\n\t\t} else {\n\t\t\tdata = undefined;\n\t\t}\n\t}\n\n\treturn data;\n}\n\n// TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON\n// property to be considered empty objects; this property always exists in\n// order to make sure JSON.stringify does not expose internal metadata\nfunction isEmptyDataObject( obj ) {\n\tfor ( var name in obj ) {\n\t\tif ( name !== \"toJSON\" ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n\n\n\nfunction handleQueueMarkDefer( elem, type, src ) {\n\tvar deferDataKey = type + \"defer\",\n\t\tqueueDataKey = type + \"queue\",\n\t\tmarkDataKey = type + \"mark\",\n\t\tdefer = jQuery.data( elem, deferDataKey, undefined, true );\n\tif ( defer &&\n\t\t( src === \"queue\" || !jQuery.data( elem, queueDataKey, undefined, true ) ) &&\n\t\t( src === \"mark\" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) {\n\t\t// Give room for hard-coded callbacks to fire first\n\t\t// and eventually mark/queue something else on the element\n\t\tsetTimeout( function() {\n\t\t\tif ( !jQuery.data( elem, queueDataKey, undefined, true ) &&\n\t\t\t\t!jQuery.data( elem, markDataKey, undefined, true ) ) {\n\t\t\t\tjQuery.removeData( elem, deferDataKey, true );\n\t\t\t\tdefer.resolve();\n\t\t\t}\n\t\t}, 0 );\n\t}\n}\n\njQuery.extend({\n\n\t_mark: function( elem, type ) {\n\t\tif ( elem ) {\n\t\t\ttype = (type || \"fx\") + \"mark\";\n\t\t\tjQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );\n\t\t}\n\t},\n\n\t_unmark: function( force, elem, type ) {\n\t\tif ( force !== true ) {\n\t\t\ttype = elem;\n\t\t\telem = force;\n\t\t\tforce = false;\n\t\t}\n\t\tif ( elem ) {\n\t\t\ttype = type || \"fx\";\n\t\t\tvar key = type + \"mark\",\n\t\t\t\tcount = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );\n\t\t\tif ( count ) {\n\t\t\t\tjQuery.data( elem, key, count, true );\n\t\t\t} else {\n\t\t\t\tjQuery.removeData( elem, key, true );\n\t\t\t\thandleQueueMarkDefer( elem, type, \"mark\" );\n\t\t\t}\n\t\t}\n\t},\n\n\tqueue: function( elem, type, data ) {\n\t\tif ( elem ) {\n\t\t\ttype = (type || \"fx\") + \"queue\";\n\t\t\tvar q = jQuery.data( elem, type, undefined, true );\n\t\t\t// Speed up dequeue by getting out quickly if this is just a lookup\n\t\t\tif ( data ) {\n\t\t\t\tif ( !q || jQuery.isArray(data) ) {\n\t\t\t\t\tq = jQuery.data( elem, type, jQuery.makeArray(data), true );\n\t\t\t\t} else {\n\t\t\t\t\tq.push( data );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn q || [];\n\t\t}\n\t},\n\n\tdequeue: function( elem, type ) {\n\t\ttype = type || \"fx\";\n\n\t\tvar queue = jQuery.queue( elem, type ),\n\t\t\tfn = queue.shift(),\n\t\t\tdefer;\n\n\t\t// If the fx queue is dequeued, always remove the progress sentinel\n\t\tif ( fn === \"inprogress\" ) {\n\t\t\tfn = queue.shift();\n\t\t}\n\n\t\tif ( fn ) {\n\t\t\t// Add a progress sentinel to prevent the fx queue from being\n\t\t\t// automatically dequeued\n\t\t\tif ( type === \"fx\" ) {\n\t\t\t\tqueue.unshift(\"inprogress\");\n\t\t\t}\n\n\t\t\tfn.call(elem, function() {\n\t\t\t\tjQuery.dequeue(elem, type);\n\t\t\t});\n\t\t}\n\n\t\tif ( !queue.length ) {\n\t\t\tjQuery.removeData( elem, type + \"queue\", true );\n\t\t\thandleQueueMarkDefer( elem, type, \"queue\" );\n\t\t}\n\t}\n});\n\njQuery.fn.extend({\n\tqueue: function( type, data ) {\n\t\tif ( typeof type !== \"string\" ) {\n\t\t\tdata = type;\n\t\t\ttype = \"fx\";\n\t\t}\n\n\t\tif ( data === undefined ) {\n\t\t\treturn jQuery.queue( this[0], type );\n\t\t}\n\t\treturn this.each(function() {\n\t\t\tvar queue = jQuery.queue( this, type, data );\n\n\t\t\tif ( type === \"fx\" && queue[0] !== \"inprogress\" ) {\n\t\t\t\tjQuery.dequeue( this, type );\n\t\t\t}\n\t\t});\n\t},\n\tdequeue: function( type ) {\n\t\treturn this.each(function() {\n\t\t\tjQuery.dequeue( this, type );\n\t\t});\n\t},\n\t// Based off of the plugin by Clint Helfers, with permission.\n\t// http://blindsignals.com/index.php/2009/07/jquery-delay/\n\tdelay: function( time, type ) {\n\t\ttime = jQuery.fx ? jQuery.fx.speeds[time] || time : time;\n\t\ttype = type || \"fx\";\n\n\t\treturn this.queue( type, function() {\n\t\t\tvar elem = this;\n\t\t\tsetTimeout(function() {\n\t\t\t\tjQuery.dequeue( elem, type );\n\t\t\t}, time );\n\t\t});\n\t},\n\tclearQueue: function( type ) {\n\t\treturn this.queue( type || \"fx\", [] );\n\t},\n\t// Get a promise resolved when queues of a certain type\n\t// are emptied (fx is the type by default)\n\tpromise: function( type, object ) {\n\t\tif ( typeof type !== \"string\" ) {\n\t\t\tobject = type;\n\t\t\ttype = undefined;\n\t\t}\n\t\ttype = type || \"fx\";\n\t\tvar defer = jQuery.Deferred(),\n\t\t\telements = this,\n\t\t\ti = elements.length,\n\t\t\tcount = 1,\n\t\t\tdeferDataKey = type + \"defer\",\n\t\t\tqueueDataKey = type + \"queue\",\n\t\t\tmarkDataKey = type + \"mark\",\n\t\t\ttmp;\n\t\tfunction resolve() {\n\t\t\tif ( !( --count ) ) {\n\t\t\t\tdefer.resolveWith( elements, [ elements ] );\n\t\t\t}\n\t\t}\n\t\twhile( i-- ) {\n\t\t\tif (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||\n\t\t\t\t\t( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||\n\t\t\t\t\t\tjQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&\n\t\t\t\t\tjQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) {\n\t\t\t\tcount++;\n\t\t\t\ttmp.done( resolve );\n\t\t\t}\n\t\t}\n\t\tresolve();\n\t\treturn defer.promise();\n\t}\n});\n\n\n\n\nvar rclass = /[\\n\\t\\r]/g,\n\trspace = /\\s+/,\n\trreturn = /\\r/g,\n\trtype = /^(?:button|input)$/i,\n\trfocusable = /^(?:button|input|object|select|textarea)$/i,\n\trclickable = /^a(?:rea)?$/i,\n\trboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,\n\tnodeHook, boolHook;\n\njQuery.fn.extend({\n\tattr: function( name, value ) {\n\t\treturn jQuery.access( this, name, value, true, jQuery.attr );\n\t},\n\n\tremoveAttr: function( name ) {\n\t\treturn this.each(function() {\n\t\t\tjQuery.removeAttr( this, name );\n\t\t});\n\t},\n\t\n\tprop: function( name, value ) {\n\t\treturn jQuery.access( this, name, value, true, jQuery.prop );\n\t},\n\t\n\tremoveProp: function( name ) {\n\t\tname = jQuery.propFix[ name ] || name;\n\t\treturn this.each(function() {\n\t\t\t// try/catch handles cases where IE balks (such as removing a property on window)\n\t\t\ttry {\n\t\t\t\tthis[ name ] = undefined;\n\t\t\t\tdelete this[ name ];\n\t\t\t} catch( e ) {}\n\t\t});\n\t},\n\n\taddClass: function( value ) {\n\t\tvar classNames, i, l, elem,\n\t\t\tsetClass, c, cl;\n\n\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\treturn this.each(function( j ) {\n\t\t\t\tjQuery( this ).addClass( value.call(this, j, this.className) );\n\t\t\t});\n\t\t}\n\n\t\tif ( value && typeof value === \"string\" ) {\n\t\t\tclassNames = value.split( rspace );\n\n\t\t\tfor ( i = 0, l = this.length; i < l; i++ ) {\n\t\t\t\telem = this[ i ];\n\n\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\tif ( !elem.className && classNames.length === 1 ) {\n\t\t\t\t\t\telem.className = value;\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetClass = \" \" + elem.className + \" \";\n\n\t\t\t\t\t\tfor ( c = 0, cl = classNames.length; c < cl; c++ ) {\n\t\t\t\t\t\t\tif ( !~setClass.indexOf( \" \" + classNames[ c ] + \" \" ) ) {\n\t\t\t\t\t\t\t\tsetClass += classNames[ c ] + \" \";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telem.className = jQuery.trim( setClass );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tremoveClass: function( value ) {\n\t\tvar classNames, i, l, elem, className, c, cl;\n\n\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\treturn this.each(function( j ) {\n\t\t\t\tjQuery( this ).removeClass( value.call(this, j, this.className) );\n\t\t\t});\n\t\t}\n\n\t\tif ( (value && typeof value === \"string\") || value === undefined ) {\n\t\t\tclassNames = (value || \"\").split( rspace );\n\n\t\t\tfor ( i = 0, l = this.length; i < l; i++ ) {\n\t\t\t\telem = this[ i ];\n\n\t\t\t\tif ( elem.nodeType === 1 && elem.className ) {\n\t\t\t\t\tif ( value ) {\n\t\t\t\t\t\tclassName = (\" \" + elem.className + \" \").replace( rclass, \" \" );\n\t\t\t\t\t\tfor ( c = 0, cl = classNames.length; c < cl; c++ ) {\n\t\t\t\t\t\t\tclassName = className.replace(\" \" + classNames[ c ] + \" \", \" \");\n\t\t\t\t\t\t}\n\t\t\t\t\t\telem.className = jQuery.trim( className );\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\telem.className = \"\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\ttoggleClass: function( value, stateVal ) {\n\t\tvar type = typeof value,\n\t\t\tisBool = typeof stateVal === \"boolean\";\n\n\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\treturn this.each(function( i ) {\n\t\t\t\tjQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );\n\t\t\t});\n\t\t}\n\n\t\treturn this.each(function() {\n\t\t\tif ( type === \"string\" ) {\n\t\t\t\t// toggle individual class names\n\t\t\t\tvar className,\n\t\t\t\t\ti = 0,\n\t\t\t\t\tself = jQuery( this ),\n\t\t\t\t\tstate = stateVal,\n\t\t\t\t\tclassNames = value.split( rspace );\n\n\t\t\t\twhile ( (className = classNames[ i++ ]) ) {\n\t\t\t\t\t// check each className given, space seperated list\n\t\t\t\t\tstate = isBool ? state : !self.hasClass( className );\n\t\t\t\t\tself[ state ? \"addClass\" : \"removeClass\" ]( className );\n\t\t\t\t}\n\n\t\t\t} else if ( type === \"undefined\" || type === \"boolean\" ) {\n\t\t\t\tif ( this.className ) {\n\t\t\t\t\t// store className if set\n\t\t\t\t\tjQuery._data( this, \"__className__\", this.className );\n\t\t\t\t}\n\n\t\t\t\t// toggle whole className\n\t\t\t\tthis.className = this.className || value === false ? \"\" : jQuery._data( this, \"__className__\" ) || \"\";\n\t\t\t}\n\t\t});\n\t},\n\n\thasClass: function( selector ) {\n\t\tvar className = \" \" + selector + \" \";\n\t\tfor ( var i = 0, l = this.length; i < l; i++ ) {\n\t\t\tif ( this[i].nodeType === 1 && (\" \" + this[i].className + \" \").replace(rclass, \" \").indexOf( className ) > -1 ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t},\n\n\tval: function( value ) {\n\t\tvar hooks, ret,\n\t\t\telem = this[0];\n\t\t\n\t\tif ( !arguments.length ) {\n\t\t\tif ( elem ) {\n\t\t\t\thooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];\n\n\t\t\t\tif ( hooks && \"get\" in hooks && (ret = hooks.get( elem, \"value\" )) !== undefined ) {\n\t\t\t\t\treturn ret;\n\t\t\t\t}\n\n\t\t\t\tret = elem.value;\n\n\t\t\t\treturn typeof ret === \"string\" ? \n\t\t\t\t\t// handle most common string cases\n\t\t\t\t\tret.replace(rreturn, \"\") : \n\t\t\t\t\t// handle cases where value is null/undef or number\n\t\t\t\t\tret == null ? \"\" : ret;\n\t\t\t}\n\n\t\t\treturn undefined;\n\t\t}\n\n\t\tvar isFunction = jQuery.isFunction( value );\n\n\t\treturn this.each(function( i ) {\n\t\t\tvar self = jQuery(this), val;\n\n\t\t\tif ( this.nodeType !== 1 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( isFunction ) {\n\t\t\t\tval = value.call( this, i, self.val() );\n\t\t\t} else {\n\t\t\t\tval = value;\n\t\t\t}\n\n\t\t\t// Treat null/undefined as \"\"; convert numbers to string\n\t\t\tif ( val == null ) {\n\t\t\t\tval = \"\";\n\t\t\t} else if ( typeof val === \"number\" ) {\n\t\t\t\tval += \"\";\n\t\t\t} else if ( jQuery.isArray( val ) ) {\n\t\t\t\tval = jQuery.map(val, function ( value ) {\n\t\t\t\t\treturn value == null ? \"\" : value + \"\";\n\t\t\t\t});\n\t\t\t}\n\n\t\t\thooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];\n\n\t\t\t// If set returns undefined, fall back to normal setting\n\t\t\tif ( !hooks || !(\"set\" in hooks) || hooks.set( this, val, \"value\" ) === undefined ) {\n\t\t\t\tthis.value = val;\n\t\t\t}\n\t\t});\n\t}\n});\n\njQuery.extend({\n\tvalHooks: {\n\t\toption: {\n\t\t\tget: function( elem ) {\n\t\t\t\t// attributes.value is undefined in Blackberry 4.7 but\n\t\t\t\t// uses .value. See #6932\n\t\t\t\tvar val = elem.attributes.value;\n\t\t\t\treturn !val || val.specified ? elem.value : elem.text;\n\t\t\t}\n\t\t},\n\t\tselect: {\n\t\t\tget: function( elem ) {\n\t\t\t\tvar value,\n\t\t\t\t\tindex = elem.selectedIndex,\n\t\t\t\t\tvalues = [],\n\t\t\t\t\toptions = elem.options,\n\t\t\t\t\tone = elem.type === \"select-one\";\n\n\t\t\t\t// Nothing was selected\n\t\t\t\tif ( index < 0 ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\t// Loop through all the selected options\n\t\t\t\tfor ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {\n\t\t\t\t\tvar option = options[ i ];\n\n\t\t\t\t\t// Don't return options that are disabled or in a disabled optgroup\n\t\t\t\t\tif ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute(\"disabled\") === null) &&\n\t\t\t\t\t\t\t(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, \"optgroup\" )) ) {\n\n\t\t\t\t\t\t// Get the specific value for the option\n\t\t\t\t\t\tvalue = jQuery( option ).val();\n\n\t\t\t\t\t\t// We don't need an array for one selects\n\t\t\t\t\t\tif ( one ) {\n\t\t\t\t\t\t\treturn value;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Multi-Selects return an array\n\t\t\t\t\t\tvalues.push( value );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Fixes Bug #2551 -- select.val() broken in IE after form.reset()\n\t\t\t\tif ( one && !values.length && options.length ) {\n\t\t\t\t\treturn jQuery( options[ index ] ).val();\n\t\t\t\t}\n\n\t\t\t\treturn values;\n\t\t\t},\n\n\t\t\tset: function( elem, value ) {\n\t\t\t\tvar values = jQuery.makeArray( value );\n\n\t\t\t\tjQuery(elem).find(\"option\").each(function() {\n\t\t\t\t\tthis.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;\n\t\t\t\t});\n\n\t\t\t\tif ( !values.length ) {\n\t\t\t\t\telem.selectedIndex = -1;\n\t\t\t\t}\n\t\t\t\treturn values;\n\t\t\t}\n\t\t}\n\t},\n\n\tattrFn: {\n\t\tval: true,\n\t\tcss: true,\n\t\thtml: true,\n\t\ttext: true,\n\t\tdata: true,\n\t\twidth: true,\n\t\theight: true,\n\t\toffset: true\n\t},\n\t\n\tattrFix: {\n\t\t// Always normalize to ensure hook usage\n\t\ttabindex: \"tabIndex\"\n\t},\n\t\n\tattr: function( elem, name, value, pass ) {\n\t\tvar nType = elem.nodeType;\n\t\t\n\t\t// don't get/set attributes on text, comment and attribute nodes\n\t\tif ( !elem || nType === 3 || nType === 8 || nType === 2 ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif ( pass && name in jQuery.attrFn ) {\n\t\t\treturn jQuery( elem )[ name ]( value );\n\t\t}\n\n\t\t// Fallback to prop when attributes are not supported\n\t\tif ( !(\"getAttribute\" in elem) ) {\n\t\t\treturn jQuery.prop( elem, name, value );\n\t\t}\n\n\t\tvar ret, hooks,\n\t\t\tnotxml = nType !== 1 || !jQuery.isXMLDoc( elem );\n\n\t\t// Normalize the name if needed\n\t\tif ( notxml ) {\n\t\t\tname = jQuery.attrFix[ name ] || name;\n\n\t\t\thooks = jQuery.attrHooks[ name ];\n\n\t\t\tif ( !hooks ) {\n\t\t\t\t// Use boolHook for boolean attributes\n\t\t\t\tif ( rboolean.test( name ) ) {\n\t\t\t\t\thooks = boolHook;\n\n\t\t\t\t// Use nodeHook if available( IE6/7 )\n\t\t\t\t} else if ( nodeHook ) {\n\t\t\t\t\thooks = nodeHook;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( value !== undefined ) {\n\n\t\t\tif ( value === null ) {\n\t\t\t\tjQuery.removeAttr( elem, name );\n\t\t\t\treturn undefined;\n\n\t\t\t} else if ( hooks && \"set\" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {\n\t\t\t\treturn ret;\n\n\t\t\t} else {\n\t\t\t\telem.setAttribute( name, \"\" + value );\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t} else if ( hooks && \"get\" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {\n\t\t\treturn ret;\n\n\t\t} else {\n\n\t\t\tret = elem.getAttribute( name );\n\n\t\t\t// Non-existent attributes return null, we normalize to undefined\n\t\t\treturn ret === null ?\n\t\t\t\tundefined :\n\t\t\t\tret;\n\t\t}\n\t},\n\n\tremoveAttr: function( elem, name ) {\n\t\tvar propName;\n\t\tif ( elem.nodeType === 1 ) {\n\t\t\tname = jQuery.attrFix[ name ] || name;\n\n\t\t\tjQuery.attr( elem, name, \"\" );\n\t\t\telem.removeAttribute( name );\n\n\t\t\t// Set corresponding property to false for boolean attributes\n\t\t\tif ( rboolean.test( name ) && (propName = jQuery.propFix[ name ] || name) in elem ) {\n\t\t\t\telem[ propName ] = false;\n\t\t\t}\n\t\t}\n\t},\n\n\tattrHooks: {\n\t\ttype: {\n\t\t\tset: function( elem, value ) {\n\t\t\t\t// We can't allow the type property to be changed (since it causes problems in IE)\n\t\t\t\tif ( rtype.test( elem.nodeName ) && elem.parentNode ) {\n\t\t\t\t\tjQuery.error( \"type property can't be changed\" );\n\t\t\t\t} else if ( !jQuery.support.radioValue && value === \"radio\" && jQuery.nodeName(elem, \"input\") ) {\n\t\t\t\t\t// Setting the type on a radio button after the value resets the value in IE6-9\n\t\t\t\t\t// Reset value to it's default in case type is set after value\n\t\t\t\t\t// This is for element creation\n\t\t\t\t\tvar val = elem.value;\n\t\t\t\t\telem.setAttribute( \"type\", value );\n\t\t\t\t\tif ( val ) {\n\t\t\t\t\t\telem.value = val;\n\t\t\t\t\t}\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t// Use the value property for back compat\n\t\t// Use the nodeHook for button elements in IE6/7 (#1954)\n\t\tvalue: {\n\t\t\tget: function( elem, name ) {\n\t\t\t\tif ( nodeHook && jQuery.nodeName( elem, \"button\" ) ) {\n\t\t\t\t\treturn nodeHook.get( elem, name );\n\t\t\t\t}\n\t\t\t\treturn name in elem ?\n\t\t\t\t\telem.value :\n\t\t\t\t\tnull;\n\t\t\t},\n\t\t\tset: function( elem, value, name ) {\n\t\t\t\tif ( nodeHook && jQuery.nodeName( elem, \"button\" ) ) {\n\t\t\t\t\treturn nodeHook.set( elem, value, name );\n\t\t\t\t}\n\t\t\t\t// Does not return so that setAttribute is also used\n\t\t\t\telem.value = value;\n\t\t\t}\n\t\t}\n\t},\n\n\tpropFix: {\n\t\ttabindex: \"tabIndex\",\n\t\treadonly: \"readOnly\",\n\t\t\"for\": \"htmlFor\",\n\t\t\"class\": \"className\",\n\t\tmaxlength: \"maxLength\",\n\t\tcellspacing: \"cellSpacing\",\n\t\tcellpadding: \"cellPadding\",\n\t\trowspan: \"rowSpan\",\n\t\tcolspan: \"colSpan\",\n\t\tusemap: \"useMap\",\n\t\tframeborder: \"frameBorder\",\n\t\tcontenteditable: \"contentEditable\"\n\t},\n\t\n\tprop: function( elem, name, value ) {\n\t\tvar nType = elem.nodeType;\n\n\t\t// don't get/set properties on text, comment and attribute nodes\n\t\tif ( !elem || nType === 3 || nType === 8 || nType === 2 ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tvar ret, hooks,\n\t\t\tnotxml = nType !== 1 || !jQuery.isXMLDoc( elem );\n\n\t\tif ( notxml ) {\n\t\t\t// Fix name and attach hooks\n\t\t\tname = jQuery.propFix[ name ] || name;\n\t\t\thooks = jQuery.propHooks[ name ];\n\t\t}\n\n\t\tif ( value !== undefined ) {\n\t\t\tif ( hooks && \"set\" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {\n\t\t\t\treturn ret;\n\n\t\t\t} else {\n\t\t\t\treturn (elem[ name ] = value);\n\t\t\t}\n\n\t\t} else {\n\t\t\tif ( hooks && \"get\" in hooks && (ret = hooks.get( elem, name )) !== null ) {\n\t\t\t\treturn ret;\n\n\t\t\t} else {\n\t\t\t\treturn elem[ name ];\n\t\t\t}\n\t\t}\n\t},\n\t\n\tpropHooks: {\n\t\ttabIndex: {\n\t\t\tget: function( elem ) {\n\t\t\t\t// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set\n\t\t\t\t// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/\n\t\t\t\tvar attributeNode = elem.getAttributeNode(\"tabindex\");\n\n\t\t\t\treturn attributeNode && attributeNode.specified ?\n\t\t\t\t\tparseInt( attributeNode.value, 10 ) :\n\t\t\t\t\trfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?\n\t\t\t\t\t\t0 :\n\t\t\t\t\t\tundefined;\n\t\t\t}\n\t\t}\n\t}\n});\n\n// Add the tabindex propHook to attrHooks for back-compat\njQuery.attrHooks.tabIndex = jQuery.propHooks.tabIndex;\n\n// Hook for boolean attributes\nboolHook = {\n\tget: function( elem, name ) {\n\t\t// Align boolean attributes with corresponding properties\n\t\t// Fall back to attribute presence where some booleans are not supported\n\t\tvar attrNode;\n\t\treturn jQuery.prop( elem, name ) === true || ( attrNode = elem.getAttributeNode( name ) ) && attrNode.nodeValue !== false ?\n\t\t\tname.toLowerCase() :\n\t\t\tundefined;\n\t},\n\tset: function( elem, value, name ) {\n\t\tvar propName;\n\t\tif ( value === false ) {\n\t\t\t// Remove boolean attributes when set to false\n\t\t\tjQuery.removeAttr( elem, name );\n\t\t} else {\n\t\t\t// value is true since we know at this point it's type boolean and not false\n\t\t\t// Set boolean attributes to the same name and set the DOM property\n\t\t\tpropName = jQuery.propFix[ name ] || name;\n\t\t\tif ( propName in elem ) {\n\t\t\t\t// Only set the IDL specifically if it already exists on the element\n\t\t\t\telem[ propName ] = true;\n\t\t\t}\n\n\t\t\telem.setAttribute( name, name.toLowerCase() );\n\t\t}\n\t\treturn name;\n\t}\n};\n\n// IE6/7 do not support getting/setting some attributes with get/setAttribute\nif ( !jQuery.support.getSetAttribute ) {\n\t\n\t// Use this for any attribute in IE6/7\n\t// This fixes almost every IE6/7 issue\n\tnodeHook = jQuery.valHooks.button = {\n\t\tget: function( elem, name ) {\n\t\t\tvar ret;\n\t\t\tret = elem.getAttributeNode( name );\n\t\t\t// Return undefined if nodeValue is empty string\n\t\t\treturn ret && ret.nodeValue !== \"\" ?\n\t\t\t\tret.nodeValue :\n\t\t\t\tundefined;\n\t\t},\n\t\tset: function( elem, value, name ) {\n\t\t\t// Set the existing or create a new attribute node\n\t\t\tvar ret = elem.getAttributeNode( name );\n\t\t\tif ( !ret ) {\n\t\t\t\tret = document.createAttribute( name );\n\t\t\t\telem.setAttributeNode( ret );\n\t\t\t}\n\t\t\treturn (ret.nodeValue = value + \"\");\n\t\t}\n\t};\n\n\t// Set width and height to auto instead of 0 on empty string( Bug #8150 )\n\t// This is for removals\n\tjQuery.each([ \"width\", \"height\" ], function( i, name ) {\n\t\tjQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {\n\t\t\tset: function( elem, value ) {\n\t\t\t\tif ( value === \"\" ) {\n\t\t\t\t\telem.setAttribute( name, \"auto\" );\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n}\n\n\n// Some attributes require a special call on IE\nif ( !jQuery.support.hrefNormalized ) {\n\tjQuery.each([ \"href\", \"src\", \"width\", \"height\" ], function( i, name ) {\n\t\tjQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {\n\t\t\tget: function( elem ) {\n\t\t\t\tvar ret = elem.getAttribute( name, 2 );\n\t\t\t\treturn ret === null ? undefined : ret;\n\t\t\t}\n\t\t});\n\t});\n}\n\nif ( !jQuery.support.style ) {\n\tjQuery.attrHooks.style = {\n\t\tget: function( elem ) {\n\t\t\t// Return undefined in the case of empty string\n\t\t\t// Normalize to lowercase since IE uppercases css property names\n\t\t\treturn elem.style.cssText.toLowerCase() || undefined;\n\t\t},\n\t\tset: function( elem, value ) {\n\t\t\treturn (elem.style.cssText = \"\" + value);\n\t\t}\n\t};\n}\n\n// Safari mis-reports the default selected property of an option\n// Accessing the parent's selectedIndex property fixes it\nif ( !jQuery.support.optSelected ) {\n\tjQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {\n\t\tget: function( elem ) {\n\t\t\tvar parent = elem.parentNode;\n\n\t\t\tif ( parent ) {\n\t\t\t\tparent.selectedIndex;\n\n\t\t\t\t// Make sure that it also works with optgroups, see #5701\n\t\t\t\tif ( parent.parentNode ) {\n\t\t\t\t\tparent.parentNode.selectedIndex;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t});\n}\n\n// Radios and checkboxes getter/setter\nif ( !jQuery.support.checkOn ) {\n\tjQuery.each([ \"radio\", \"checkbox\" ], function() {\n\t\tjQuery.valHooks[ this ] = {\n\t\t\tget: function( elem ) {\n\t\t\t\t// Handle the case where in Webkit \"\" is returned instead of \"on\" if a value isn't specified\n\t\t\t\treturn elem.getAttribute(\"value\") === null ? \"on\" : elem.value;\n\t\t\t}\n\t\t};\n\t});\n}\njQuery.each([ \"radio\", \"checkbox\" ], function() {\n\tjQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {\n\t\tset: function( elem, value ) {\n\t\t\tif ( jQuery.isArray( value ) ) {\n\t\t\t\treturn (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0);\n\t\t\t}\n\t\t}\n\t});\n});\n\n\n\n\nvar rnamespaces = /\\.(.*)$/,\n\trformElems = /^(?:textarea|input|select)$/i,\n\trperiod = /\\./g,\n\trspaces = / /g,\n\trescape = /[^\\w\\s.|`]/g,\n\tfcleanup = function( nm ) {\n\t\treturn nm.replace(rescape, \"\\\\$&\");\n\t};\n\n/*\n * A number of helper functions used for managing events.\n * Many of the ideas behind this code originated from\n * Dean Edwards' addEvent library.\n */\njQuery.event = {\n\n\t// Bind an event to an element\n\t// Original by Dean Edwards\n\tadd: function( elem, types, handler, data ) {\n\t\tif ( elem.nodeType === 3 || elem.nodeType === 8 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( handler === false ) {\n\t\t\thandler = returnFalse;\n\t\t} else if ( !handler ) {\n\t\t\t// Fixes bug #7229. Fix recommended by jdalton\n\t\t\treturn;\n\t\t}\n\n\t\tvar handleObjIn, handleObj;\n\n\t\tif ( handler.handler ) {\n\t\t\thandleObjIn = handler;\n\t\t\thandler = handleObjIn.handler;\n\t\t}\n\n\t\t// Make sure that the function being executed has a unique ID\n\t\tif ( !handler.guid ) {\n\t\t\thandler.guid = jQuery.guid++;\n\t\t}\n\n\t\t// Init the element's event structure\n\t\tvar elemData = jQuery._data( elem );\n\n\t\t// If no elemData is found then we must be trying to bind to one of the\n\t\t// banned noData elements\n\t\tif ( !elemData ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar events = elemData.events,\n\t\t\teventHandle = elemData.handle;\n\n\t\tif ( !events ) {\n\t\t\telemData.events = events = {};\n\t\t}\n\n\t\tif ( !eventHandle ) {\n\t\t\telemData.handle = eventHandle = function( e ) {\n\t\t\t\t// Discard the second event of a jQuery.event.trigger() and\n\t\t\t\t// when an event is called after a page has unloaded\n\t\t\t\treturn typeof jQuery !== \"undefined\" && (!e || jQuery.event.triggered !== e.type) ?\n\t\t\t\t\tjQuery.event.handle.apply( eventHandle.elem, arguments ) :\n\t\t\t\t\tundefined;\n\t\t\t};\n\t\t}\n\n\t\t// Add elem as a property of the handle function\n\t\t// This is to prevent a memory leak with non-native events in IE.\n\t\teventHandle.elem = elem;\n\n\t\t// Handle multiple events separated by a space\n\t\t// jQuery(...).bind(\"mouseover mouseout\", fn);\n\t\ttypes = types.split(\" \");\n\n\t\tvar type, i = 0, namespaces;\n\n\t\twhile ( (type = types[ i++ ]) ) {\n\t\t\thandleObj = handleObjIn ?\n\t\t\t\tjQuery.extend({}, handleObjIn) :\n\t\t\t\t{ handler: handler, data: data };\n\n\t\t\t// Namespaced event handlers\n\t\t\tif ( type.indexOf(\".\") > -1 ) {\n\t\t\t\tnamespaces = type.split(\".\");\n\t\t\t\ttype = namespaces.shift();\n\t\t\t\thandleObj.namespace = namespaces.slice(0).sort().join(\".\");\n\n\t\t\t} else {\n\t\t\t\tnamespaces = [];\n\t\t\t\thandleObj.namespace = \"\";\n\t\t\t}\n\n\t\t\thandleObj.type = type;\n\t\t\tif ( !handleObj.guid ) {\n\t\t\t\thandleObj.guid = handler.guid;\n\t\t\t}\n\n\t\t\t// Get the current list of functions bound to this event\n\t\t\tvar handlers = events[ type ],\n\t\t\t\tspecial = jQuery.event.special[ type ] || {};\n\n\t\t\t// Init the event handler queue\n\t\t\tif ( !handlers ) {\n\t\t\t\thandlers = events[ type ] = [];\n\n\t\t\t\t// Check for a special event handler\n\t\t\t\t// Only use addEventListener/attachEvent if the special\n\t\t\t\t// events handler returns false\n\t\t\t\tif ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {\n\t\t\t\t\t// Bind the global event handler to the element\n\t\t\t\t\tif ( elem.addEventListener ) {\n\t\t\t\t\t\telem.addEventListener( type, eventHandle, false );\n\n\t\t\t\t\t} else if ( elem.attachEvent ) {\n\t\t\t\t\t\telem.attachEvent( \"on\" + type, eventHandle );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( special.add ) {\n\t\t\t\tspecial.add.call( elem, handleObj );\n\n\t\t\t\tif ( !handleObj.handler.guid ) {\n\t\t\t\t\thandleObj.handler.guid = handler.guid;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add the function to the element's handler list\n\t\t\thandlers.push( handleObj );\n\n\t\t\t// Keep track of which events have been used, for event optimization\n\t\t\tjQuery.event.global[ type ] = true;\n\t\t}\n\n\t\t// Nullify elem to prevent memory leaks in IE\n\t\telem = null;\n\t},\n\n\tglobal: {},\n\n\t// Detach an event or set of events from an element\n\tremove: function( elem, types, handler, pos ) {\n\t\t// don't do events on text and comment nodes\n\t\tif ( elem.nodeType === 3 || elem.nodeType === 8 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( handler === false ) {\n\t\t\thandler = returnFalse;\n\t\t}\n\n\t\tvar ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType,\n\t\t\telemData = jQuery.hasData( elem ) && jQuery._data( elem ),\n\t\t\tevents = elemData && elemData.events;\n\n\t\tif ( !elemData || !events ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// types is actually an event object here\n\t\tif ( types && types.type ) {\n\t\t\thandler = types.handler;\n\t\t\ttypes = types.type;\n\t\t}\n\n\t\t// Unbind all events for the element\n\t\tif ( !types || typeof types === \"string\" && types.charAt(0) === \".\" ) {\n\t\t\ttypes = types || \"\";\n\n\t\t\tfor ( type in events ) {\n\t\t\t\tjQuery.event.remove( elem, type + types );\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\t// Handle multiple events separated by a space\n\t\t// jQuery(...).unbind(\"mouseover mouseout\", fn);\n\t\ttypes = types.split(\" \");\n\n\t\twhile ( (type = types[ i++ ]) ) {\n\t\t\torigType = type;\n\t\t\thandleObj = null;\n\t\t\tall = type.indexOf(\".\") < 0;\n\t\t\tnamespaces = [];\n\n\t\t\tif ( !all ) {\n\t\t\t\t// Namespaced event handlers\n\t\t\t\tnamespaces = type.split(\".\");\n\t\t\t\ttype = namespaces.shift();\n\n\t\t\t\tnamespace = new RegExp(\"(^|\\\\.)\" +\n\t\t\t\t\tjQuery.map( namespaces.slice(0).sort(), fcleanup ).join(\"\\\\.(?:.*\\\\.)?\") + \"(\\\\.|$)\");\n\t\t\t}\n\n\t\t\teventType = events[ type ];\n\n\t\t\tif ( !eventType ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif ( !handler ) {\n\t\t\t\tfor ( j = 0; j < eventType.length; j++ ) {\n\t\t\t\t\thandleObj = eventType[ j ];\n\n\t\t\t\t\tif ( all || namespace.test( handleObj.namespace ) ) {\n\t\t\t\t\t\tjQuery.event.remove( elem, origType, handleObj.handler, j );\n\t\t\t\t\t\teventType.splice( j--, 1 );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\n\t\t\tfor ( j = pos || 0; j < eventType.length; j++ ) {\n\t\t\t\thandleObj = eventType[ j ];\n\n\t\t\t\tif ( handler.guid === handleObj.guid ) {\n\t\t\t\t\t// remove the given handler for the given type\n\t\t\t\t\tif ( all || namespace.test( handleObj.namespace ) ) {\n\t\t\t\t\t\tif ( pos == null ) {\n\t\t\t\t\t\t\teventType.splice( j--, 1 );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( special.remove ) {\n\t\t\t\t\t\t\tspecial.remove.call( elem, handleObj );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( pos != null ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// remove generic event handler if no more handlers exist\n\t\t\tif ( eventType.length === 0 || pos != null && eventType.length === 1 ) {\n\t\t\t\tif ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {\n\t\t\t\t\tjQuery.removeEvent( elem, type, elemData.handle );\n\t\t\t\t}\n\n\t\t\t\tret = null;\n\t\t\t\tdelete events[ type ];\n\t\t\t}\n\t\t}\n\n\t\t// Remove the expando if it's no longer used\n\t\tif ( jQuery.isEmptyObject( events ) ) {\n\t\t\tvar handle = elemData.handle;\n\t\t\tif ( handle ) {\n\t\t\t\thandle.elem = null;\n\t\t\t}\n\n\t\t\tdelete elemData.events;\n\t\t\tdelete elemData.handle;\n\n\t\t\tif ( jQuery.isEmptyObject( elemData ) ) {\n\t\t\t\tjQuery.removeData( elem, undefined, true );\n\t\t\t}\n\t\t}\n\t},\n\t\n\t// Events that are safe to short-circuit if no handlers are attached.\n\t// Native DOM events should not be added, they may have inline handlers.\n\tcustomEvent: {\n\t\t\"getData\": true,\n\t\t\"setData\": true,\n\t\t\"changeData\": true\n\t},\n\n\ttrigger: function( event, data, elem, onlyHandlers ) {\n\t\t// Event object or event type\n\t\tvar type = event.type || event,\n\t\t\tnamespaces = [],\n\t\t\texclusive;\n\n\t\tif ( type.indexOf(\"!\") >= 0 ) {\n\t\t\t// Exclusive events trigger only for the exact event (no namespaces)\n\t\t\ttype = type.slice(0, -1);\n\t\t\texclusive = true;\n\t\t}\n\n\t\tif ( type.indexOf(\".\") >= 0 ) {\n\t\t\t// Namespaced trigger; create a regexp to match event type in handle()\n\t\t\tnamespaces = type.split(\".\");\n\t\t\ttype = namespaces.shift();\n\t\t\tnamespaces.sort();\n\t\t}\n\n\t\tif ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {\n\t\t\t// No jQuery handlers for this event type, and it can't have inline handlers\n\t\t\treturn;\n\t\t}\n\n\t\t// Caller can pass in an Event, Object, or just an event type string\n\t\tevent = typeof event === \"object\" ?\n\t\t\t// jQuery.Event object\n\t\t\tevent[ jQuery.expando ] ? event :\n\t\t\t// Object literal\n\t\t\tnew jQuery.Event( type, event ) :\n\t\t\t// Just the event type (string)\n\t\t\tnew jQuery.Event( type );\n\n\t\tevent.type = type;\n\t\tevent.exclusive = exclusive;\n\t\tevent.namespace = namespaces.join(\".\");\n\t\tevent.namespace_re = new RegExp(\"(^|\\\\.)\" + namespaces.join(\"\\\\.(?:.*\\\\.)?\") + \"(\\\\.|$)\");\n\t\t\n\t\t// triggerHandler() and global events don't bubble or run the default action\n\t\tif ( onlyHandlers || !elem ) {\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t}\n\n\t\t// Handle a global trigger\n\t\tif ( !elem ) {\n\t\t\t// TODO: Stop taunting the data cache; remove global events and always attach to document\n\t\t\tjQuery.each( jQuery.cache, function() {\n\t\t\t\t// internalKey variable is just used to make it easier to find\n\t\t\t\t// and potentially change this stuff later; currently it just\n\t\t\t\t// points to jQuery.expando\n\t\t\t\tvar internalKey = jQuery.expando,\n\t\t\t\t\tinternalCache = this[ internalKey ];\n\t\t\t\tif ( internalCache && internalCache.events && internalCache.events[ type ] ) {\n\t\t\t\t\tjQuery.event.trigger( event, data, internalCache.handle.elem );\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\t// Don't do events on text and comment nodes\n\t\tif ( elem.nodeType === 3 || elem.nodeType === 8 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Clean up the event in case it is being reused\n\t\tevent.result = undefined;\n\t\tevent.target = elem;\n\n\t\t// Clone any incoming data and prepend the event, creating the handler arg list\n\t\tdata = data != null ? jQuery.makeArray( data ) : [];\n\t\tdata.unshift( event );\n\n\t\tvar cur = elem,\n\t\t\t// IE doesn't like method names with a colon (#3533, #8272)\n\t\t\tontype = type.indexOf(\":\") < 0 ? \"on\" + type : \"\";\n\n\t\t// Fire event on the current element, then bubble up the DOM tree\n\t\tdo {\n\t\t\tvar handle = jQuery._data( cur, \"handle\" );\n\n\t\t\tevent.currentTarget = cur;\n\t\t\tif ( handle ) {\n\t\t\t\thandle.apply( cur, data );\n\t\t\t}\n\n\t\t\t// Trigger an inline bound script\n\t\t\tif ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) {\n\t\t\t\tevent.result = false;\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\n\t\t\t// Bubble up to document, then to window\n\t\t\tcur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window;\n\t\t} while ( cur && !event.isPropagationStopped() );\n\n\t\t// If nobody prevented the default action, do it now\n\t\tif ( !event.isDefaultPrevented() ) {\n\t\t\tvar old,\n\t\t\t\tspecial = jQuery.event.special[ type ] || {};\n\n\t\t\tif ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) &&\n\t\t\t\t!(type === \"click\" && jQuery.nodeName( elem, \"a\" )) && jQuery.acceptData( elem ) ) {\n\n\t\t\t\t// Call a native DOM method on the target with the same name name as the event.\n\t\t\t\t// Can't use an .isFunction)() check here because IE6/7 fails that test.\n\t\t\t\t// IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch.\n\t\t\t\ttry {\n\t\t\t\t\tif ( ontype && elem[ type ] ) {\n\t\t\t\t\t\t// Don't re-trigger an onFOO event when we call its FOO() method\n\t\t\t\t\t\told = elem[ ontype ];\n\n\t\t\t\t\t\tif ( old ) {\n\t\t\t\t\t\t\telem[ ontype ] = null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tjQuery.event.triggered = type;\n\t\t\t\t\t\telem[ type ]();\n\t\t\t\t\t}\n\t\t\t\t} catch ( ieError ) {}\n\n\t\t\t\tif ( old ) {\n\t\t\t\t\telem[ ontype ] = old;\n\t\t\t\t}\n\n\t\t\t\tjQuery.event.triggered = undefined;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn event.result;\n\t},\n\n\thandle: function( event ) {\n\t\tevent = jQuery.event.fix( event || window.event );\n\t\t// Snapshot the handlers list since a called handler may add/remove events.\n\t\tvar handlers = ((jQuery._data( this, \"events\" ) || {})[ event.type ] || []).slice(0),\n\t\t\trun_all = !event.exclusive && !event.namespace,\n\t\t\targs = Array.prototype.slice.call( arguments, 0 );\n\n\t\t// Use the fix-ed Event rather than the (read-only) native event\n\t\targs[0] = event;\n\t\tevent.currentTarget = this;\n\n\t\tfor ( var j = 0, l = handlers.length; j < l; j++ ) {\n\t\t\tvar handleObj = handlers[ j ];\n\n\t\t\t// Triggered event must 1) be non-exclusive and have no namespace, or\n\t\t\t// 2) have namespace(s) a subset or equal to those in the bound event.\n\t\t\tif ( run_all || event.namespace_re.test( handleObj.namespace ) ) {\n\t\t\t\t// Pass in a reference to the handler function itself\n\t\t\t\t// So that we can later remove it\n\t\t\t\tevent.handler = handleObj.handler;\n\t\t\t\tevent.data = handleObj.data;\n\t\t\t\tevent.handleObj = handleObj;\n\n\t\t\t\tvar ret = handleObj.handler.apply( this, args );\n\n\t\t\t\tif ( ret !== undefined ) {\n\t\t\t\t\tevent.result = ret;\n\t\t\t\t\tif ( ret === false ) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( event.isImmediatePropagationStopped() ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn event.result;\n\t},\n\n\tprops: \"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which\".split(\" \"),\n\n\tfix: function( event ) {\n\t\tif ( event[ jQuery.expando ] ) {\n\t\t\treturn event;\n\t\t}\n\n\t\t// store a copy of the original event object\n\t\t// and \"clone\" to set read-only properties\n\t\tvar originalEvent = event;\n\t\tevent = jQuery.Event( originalEvent );\n\n\t\tfor ( var i = this.props.length, prop; i; ) {\n\t\t\tprop = this.props[ --i ];\n\t\t\tevent[ prop ] = originalEvent[ prop ];\n\t\t}\n\n\t\t// Fix target property, if necessary\n\t\tif ( !event.target ) {\n\t\t\t// Fixes #1925 where srcElement might not be defined either\n\t\t\tevent.target = event.srcElement || document;\n\t\t}\n\n\t\t// check if target is a textnode (safari)\n\t\tif ( event.target.nodeType === 3 ) {\n\t\t\tevent.target = event.target.parentNode;\n\t\t}\n\n\t\t// Add relatedTarget, if necessary\n\t\tif ( !event.relatedTarget && event.fromElement ) {\n\t\t\tevent.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement;\n\t\t}\n\n\t\t// Calculate pageX/Y if missing and clientX/Y available\n\t\tif ( event.pageX == null && event.clientX != null ) {\n\t\t\tvar eventDocument = event.target.ownerDocument || document,\n\t\t\t\tdoc = eventDocument.documentElement,\n\t\t\t\tbody = eventDocument.body;\n\n\t\t\tevent.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);\n\t\t\tevent.pageY = event.clientY + (doc && doc.scrollTop  || body && body.scrollTop  || 0) - (doc && doc.clientTop  || body && body.clientTop  || 0);\n\t\t}\n\n\t\t// Add which for key events\n\t\tif ( event.which == null && (event.charCode != null || event.keyCode != null) ) {\n\t\t\tevent.which = event.charCode != null ? event.charCode : event.keyCode;\n\t\t}\n\n\t\t// Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs)\n\t\tif ( !event.metaKey && event.ctrlKey ) {\n\t\t\tevent.metaKey = event.ctrlKey;\n\t\t}\n\n\t\t// Add which for click: 1 === left; 2 === middle; 3 === right\n\t\t// Note: button is not normalized, so don't use it\n\t\tif ( !event.which && event.button !== undefined ) {\n\t\t\tevent.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));\n\t\t}\n\n\t\treturn event;\n\t},\n\n\t// Deprecated, use jQuery.guid instead\n\tguid: 1E8,\n\n\t// Deprecated, use jQuery.proxy instead\n\tproxy: jQuery.proxy,\n\n\tspecial: {\n\t\tready: {\n\t\t\t// Make sure the ready event is setup\n\t\t\tsetup: jQuery.bindReady,\n\t\t\tteardown: jQuery.noop\n\t\t},\n\n\t\tlive: {\n\t\t\tadd: function( handleObj ) {\n\t\t\t\tjQuery.event.add( this,\n\t\t\t\t\tliveConvert( handleObj.origType, handleObj.selector ),\n\t\t\t\t\tjQuery.extend({}, handleObj, {handler: liveHandler, guid: handleObj.handler.guid}) );\n\t\t\t},\n\n\t\t\tremove: function( handleObj ) {\n\t\t\t\tjQuery.event.remove( this, liveConvert( handleObj.origType, handleObj.selector ), handleObj );\n\t\t\t}\n\t\t},\n\n\t\tbeforeunload: {\n\t\t\tsetup: function( data, namespaces, eventHandle ) {\n\t\t\t\t// We only want to do this special case on windows\n\t\t\t\tif ( jQuery.isWindow( this ) ) {\n\t\t\t\t\tthis.onbeforeunload = eventHandle;\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tteardown: function( namespaces, eventHandle ) {\n\t\t\t\tif ( this.onbeforeunload === eventHandle ) {\n\t\t\t\t\tthis.onbeforeunload = null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\njQuery.removeEvent = document.removeEventListener ?\n\tfunction( elem, type, handle ) {\n\t\tif ( elem.removeEventListener ) {\n\t\t\telem.removeEventListener( type, handle, false );\n\t\t}\n\t} :\n\tfunction( elem, type, handle ) {\n\t\tif ( elem.detachEvent ) {\n\t\t\telem.detachEvent( \"on\" + type, handle );\n\t\t}\n\t};\n\njQuery.Event = function( src, props ) {\n\t// Allow instantiation without the 'new' keyword\n\tif ( !this.preventDefault ) {\n\t\treturn new jQuery.Event( src, props );\n\t}\n\n\t// Event object\n\tif ( src && src.type ) {\n\t\tthis.originalEvent = src;\n\t\tthis.type = src.type;\n\n\t\t// Events bubbling up the document may have been marked as prevented\n\t\t// by a handler lower down the tree; reflect the correct value.\n\t\tthis.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||\n\t\t\tsrc.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;\n\n\t// Event type\n\t} else {\n\t\tthis.type = src;\n\t}\n\n\t// Put explicitly provided properties onto the event object\n\tif ( props ) {\n\t\tjQuery.extend( this, props );\n\t}\n\n\t// timeStamp is buggy for some events on Firefox(#3843)\n\t// So we won't rely on the native value\n\tthis.timeStamp = jQuery.now();\n\n\t// Mark it as fixed\n\tthis[ jQuery.expando ] = true;\n};\n\nfunction returnFalse() {\n\treturn false;\n}\nfunction returnTrue() {\n\treturn true;\n}\n\n// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding\n// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html\njQuery.Event.prototype = {\n\tpreventDefault: function() {\n\t\tthis.isDefaultPrevented = returnTrue;\n\n\t\tvar e = this.originalEvent;\n\t\tif ( !e ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// if preventDefault exists run it on the original event\n\t\tif ( e.preventDefault ) {\n\t\t\te.preventDefault();\n\n\t\t// otherwise set the returnValue property of the original event to false (IE)\n\t\t} else {\n\t\t\te.returnValue = false;\n\t\t}\n\t},\n\tstopPropagation: function() {\n\t\tthis.isPropagationStopped = returnTrue;\n\n\t\tvar e = this.originalEvent;\n\t\tif ( !e ) {\n\t\t\treturn;\n\t\t}\n\t\t// if stopPropagation exists run it on the original event\n\t\tif ( e.stopPropagation ) {\n\t\t\te.stopPropagation();\n\t\t}\n\t\t// otherwise set the cancelBubble property of the original event to true (IE)\n\t\te.cancelBubble = true;\n\t},\n\tstopImmediatePropagation: function() {\n\t\tthis.isImmediatePropagationStopped = returnTrue;\n\t\tthis.stopPropagation();\n\t},\n\tisDefaultPrevented: returnFalse,\n\tisPropagationStopped: returnFalse,\n\tisImmediatePropagationStopped: returnFalse\n};\n\n// Checks if an event happened on an element within another element\n// Used in jQuery.event.special.mouseenter and mouseleave handlers\nvar withinElement = function( event ) {\n\n\t// Check if mouse(over|out) are still within the same parent element\n\tvar related = event.relatedTarget,\n\t\tinside = false,\n\t\teventType = event.type;\n\n\tevent.type = event.data;\n\n\tif ( related !== this ) {\n\n\t\tif ( related ) {\n\t\t\tinside = jQuery.contains( this, related );\n\t\t}\n\n\t\tif ( !inside ) {\n\n\t\t\tjQuery.event.handle.apply( this, arguments );\n\n\t\t\tevent.type = eventType;\n\t\t}\n\t}\n},\n\n// In case of event delegation, we only need to rename the event.type,\n// liveHandler will take care of the rest.\ndelegate = function( event ) {\n\tevent.type = event.data;\n\tjQuery.event.handle.apply( this, arguments );\n};\n\n// Create mouseenter and mouseleave events\njQuery.each({\n\tmouseenter: \"mouseover\",\n\tmouseleave: \"mouseout\"\n}, function( orig, fix ) {\n\tjQuery.event.special[ orig ] = {\n\t\tsetup: function( data ) {\n\t\t\tjQuery.event.add( this, fix, data && data.selector ? delegate : withinElement, orig );\n\t\t},\n\t\tteardown: function( data ) {\n\t\t\tjQuery.event.remove( this, fix, data && data.selector ? delegate : withinElement );\n\t\t}\n\t};\n});\n\n// submit delegation\nif ( !jQuery.support.submitBubbles ) {\n\n\tjQuery.event.special.submit = {\n\t\tsetup: function( data, namespaces ) {\n\t\t\tif ( !jQuery.nodeName( this, \"form\" ) ) {\n\t\t\t\tjQuery.event.add(this, \"click.specialSubmit\", function( e ) {\n\t\t\t\t\t// Avoid triggering error on non-existent type attribute in IE VML (#7071)\n\t\t\t\t\tvar elem = e.target,\n\t\t\t\t\t\ttype = jQuery.nodeName( elem, \"input\" ) || jQuery.nodeName( elem, \"button\" ) ? elem.type : \"\";\n\n\t\t\t\t\tif ( (type === \"submit\" || type === \"image\") && jQuery( elem ).closest(\"form\").length ) {\n\t\t\t\t\t\ttrigger( \"submit\", this, arguments );\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tjQuery.event.add(this, \"keypress.specialSubmit\", function( e ) {\n\t\t\t\t\tvar elem = e.target,\n\t\t\t\t\t\ttype = jQuery.nodeName( elem, \"input\" ) || jQuery.nodeName( elem, \"button\" ) ? elem.type : \"\";\n\n\t\t\t\t\tif ( (type === \"text\" || type === \"password\") && jQuery( elem ).closest(\"form\").length && e.keyCode === 13 ) {\n\t\t\t\t\t\ttrigger( \"submit\", this, arguments );\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\n\t\tteardown: function( namespaces ) {\n\t\t\tjQuery.event.remove( this, \".specialSubmit\" );\n\t\t}\n\t};\n\n}\n\n// change delegation, happens here so we have bind.\nif ( !jQuery.support.changeBubbles ) {\n\n\tvar changeFilters,\n\n\tgetVal = function( elem ) {\n\t\tvar type = jQuery.nodeName( elem, \"input\" ) ? elem.type : \"\",\n\t\t\tval = elem.value;\n\n\t\tif ( type === \"radio\" || type === \"checkbox\" ) {\n\t\t\tval = elem.checked;\n\n\t\t} else if ( type === \"select-multiple\" ) {\n\t\t\tval = elem.selectedIndex > -1 ?\n\t\t\t\tjQuery.map( elem.options, function( elem ) {\n\t\t\t\t\treturn elem.selected;\n\t\t\t\t}).join(\"-\") :\n\t\t\t\t\"\";\n\n\t\t} else if ( jQuery.nodeName( elem, \"select\" ) ) {\n\t\t\tval = elem.selectedIndex;\n\t\t}\n\n\t\treturn val;\n\t},\n\n\ttestChange = function testChange( e ) {\n\t\tvar elem = e.target, data, val;\n\n\t\tif ( !rformElems.test( elem.nodeName ) || elem.readOnly ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdata = jQuery._data( elem, \"_change_data\" );\n\t\tval = getVal(elem);\n\n\t\t// the current data will be also retrieved by beforeactivate\n\t\tif ( e.type !== \"focusout\" || elem.type !== \"radio\" ) {\n\t\t\tjQuery._data( elem, \"_change_data\", val );\n\t\t}\n\n\t\tif ( data === undefined || val === data ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( data != null || val ) {\n\t\t\te.type = \"change\";\n\t\t\te.liveFired = undefined;\n\t\t\tjQuery.event.trigger( e, arguments[1], elem );\n\t\t}\n\t};\n\n\tjQuery.event.special.change = {\n\t\tfilters: {\n\t\t\tfocusout: testChange,\n\n\t\t\tbeforedeactivate: testChange,\n\n\t\t\tclick: function( e ) {\n\t\t\t\tvar elem = e.target, type = jQuery.nodeName( elem, \"input\" ) ? elem.type : \"\";\n\n\t\t\t\tif ( type === \"radio\" || type === \"checkbox\" || jQuery.nodeName( elem, \"select\" ) ) {\n\t\t\t\t\ttestChange.call( this, e );\n\t\t\t\t}\n\t\t\t},\n\n\t\t\t// Change has to be called before submit\n\t\t\t// Keydown will be called before keypress, which is used in submit-event delegation\n\t\t\tkeydown: function( e ) {\n\t\t\t\tvar elem = e.target, type = jQuery.nodeName( elem, \"input\" ) ? elem.type : \"\";\n\n\t\t\t\tif ( (e.keyCode === 13 && !jQuery.nodeName( elem, \"textarea\" ) ) ||\n\t\t\t\t\t(e.keyCode === 32 && (type === \"checkbox\" || type === \"radio\")) ||\n\t\t\t\t\ttype === \"select-multiple\" ) {\n\t\t\t\t\ttestChange.call( this, e );\n\t\t\t\t}\n\t\t\t},\n\n\t\t\t// Beforeactivate happens also before the previous element is blurred\n\t\t\t// with this event you can't trigger a change event, but you can store\n\t\t\t// information\n\t\t\tbeforeactivate: function( e ) {\n\t\t\t\tvar elem = e.target;\n\t\t\t\tjQuery._data( elem, \"_change_data\", getVal(elem) );\n\t\t\t}\n\t\t},\n\n\t\tsetup: function( data, namespaces ) {\n\t\t\tif ( this.type === \"file\" ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tfor ( var type in changeFilters ) {\n\t\t\t\tjQuery.event.add( this, type + \".specialChange\", changeFilters[type] );\n\t\t\t}\n\n\t\t\treturn rformElems.test( this.nodeName );\n\t\t},\n\n\t\tteardown: function( namespaces ) {\n\t\t\tjQuery.event.remove( this, \".specialChange\" );\n\n\t\t\treturn rformElems.test( this.nodeName );\n\t\t}\n\t};\n\n\tchangeFilters = jQuery.event.special.change.filters;\n\n\t// Handle when the input is .focus()'d\n\tchangeFilters.focus = changeFilters.beforeactivate;\n}\n\nfunction trigger( type, elem, args ) {\n\t// Piggyback on a donor event to simulate a different one.\n\t// Fake originalEvent to avoid donor's stopPropagation, but if the\n\t// simulated event prevents default then we do the same on the donor.\n\t// Don't pass args or remember liveFired; they apply to the donor event.\n\tvar event = jQuery.extend( {}, args[ 0 ] );\n\tevent.type = type;\n\tevent.originalEvent = {};\n\tevent.liveFired = undefined;\n\tjQuery.event.handle.call( elem, event );\n\tif ( event.isDefaultPrevented() ) {\n\t\targs[ 0 ].preventDefault();\n\t}\n}\n\n// Create \"bubbling\" focus and blur events\nif ( !jQuery.support.focusinBubbles ) {\n\tjQuery.each({ focus: \"focusin\", blur: \"focusout\" }, function( orig, fix ) {\n\n\t\t// Attach a single capturing handler while someone wants focusin/focusout\n\t\tvar attaches = 0;\n\n\t\tjQuery.event.special[ fix ] = {\n\t\t\tsetup: function() {\n\t\t\t\tif ( attaches++ === 0 ) {\n\t\t\t\t\tdocument.addEventListener( orig, handler, true );\n\t\t\t\t}\n\t\t\t},\n\t\t\tteardown: function() {\n\t\t\t\tif ( --attaches === 0 ) {\n\t\t\t\t\tdocument.removeEventListener( orig, handler, true );\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tfunction handler( donor ) {\n\t\t\t// Donor event is always a native one; fix it and switch its type.\n\t\t\t// Let focusin/out handler cancel the donor focus/blur event.\n\t\t\tvar e = jQuery.event.fix( donor );\n\t\t\te.type = fix;\n\t\t\te.originalEvent = {};\n\t\t\tjQuery.event.trigger( e, null, e.target );\n\t\t\tif ( e.isDefaultPrevented() ) {\n\t\t\t\tdonor.preventDefault();\n\t\t\t}\n\t\t}\n\t});\n}\n\njQuery.each([\"bind\", \"one\"], function( i, name ) {\n\tjQuery.fn[ name ] = function( type, data, fn ) {\n\t\tvar handler;\n\n\t\t// Handle object literals\n\t\tif ( typeof type === \"object\" ) {\n\t\t\tfor ( var key in type ) {\n\t\t\t\tthis[ name ](key, data, type[key], fn);\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\n\t\tif ( arguments.length === 2 || data === false ) {\n\t\t\tfn = data;\n\t\t\tdata = undefined;\n\t\t}\n\n\t\tif ( name === \"one\" ) {\n\t\t\thandler = function( event ) {\n\t\t\t\tjQuery( this ).unbind( event, handler );\n\t\t\t\treturn fn.apply( this, arguments );\n\t\t\t};\n\t\t\thandler.guid = fn.guid || jQuery.guid++;\n\t\t} else {\n\t\t\thandler = fn;\n\t\t}\n\n\t\tif ( type === \"unload\" && name !== \"one\" ) {\n\t\t\tthis.one( type, data, fn );\n\n\t\t} else {\n\t\t\tfor ( var i = 0, l = this.length; i < l; i++ ) {\n\t\t\t\tjQuery.event.add( this[i], type, handler, data );\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t};\n});\n\njQuery.fn.extend({\n\tunbind: function( type, fn ) {\n\t\t// Handle object literals\n\t\tif ( typeof type === \"object\" && !type.preventDefault ) {\n\t\t\tfor ( var key in type ) {\n\t\t\t\tthis.unbind(key, type[key]);\n\t\t\t}\n\n\t\t} else {\n\t\t\tfor ( var i = 0, l = this.length; i < l; i++ ) {\n\t\t\t\tjQuery.event.remove( this[i], type, fn );\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tdelegate: function( selector, types, data, fn ) {\n\t\treturn this.live( types, data, fn, selector );\n\t},\n\n\tundelegate: function( selector, types, fn ) {\n\t\tif ( arguments.length === 0 ) {\n\t\t\treturn this.unbind( \"live\" );\n\n\t\t} else {\n\t\t\treturn this.die( types, null, fn, selector );\n\t\t}\n\t},\n\n\ttrigger: function( type, data ) {\n\t\treturn this.each(function() {\n\t\t\tjQuery.event.trigger( type, data, this );\n\t\t});\n\t},\n\n\ttriggerHandler: function( type, data ) {\n\t\tif ( this[0] ) {\n\t\t\treturn jQuery.event.trigger( type, data, this[0], true );\n\t\t}\n\t},\n\n\ttoggle: function( fn ) {\n\t\t// Save reference to arguments for access in closure\n\t\tvar args = arguments,\n\t\t\tguid = fn.guid || jQuery.guid++,\n\t\t\ti = 0,\n\t\t\ttoggler = function( event ) {\n\t\t\t\t// Figure out which function to execute\n\t\t\t\tvar lastToggle = ( jQuery.data( this, \"lastToggle\" + fn.guid ) || 0 ) % i;\n\t\t\t\tjQuery.data( this, \"lastToggle\" + fn.guid, lastToggle + 1 );\n\n\t\t\t\t// Make sure that clicks stop\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\t// and execute the function\n\t\t\t\treturn args[ lastToggle ].apply( this, arguments ) || false;\n\t\t\t};\n\n\t\t// link all the functions, so any of them can unbind this click handler\n\t\ttoggler.guid = guid;\n\t\twhile ( i < args.length ) {\n\t\t\targs[ i++ ].guid = guid;\n\t\t}\n\n\t\treturn this.click( toggler );\n\t},\n\n\thover: function( fnOver, fnOut ) {\n\t\treturn this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );\n\t}\n});\n\nvar liveMap = {\n\tfocus: \"focusin\",\n\tblur: \"focusout\",\n\tmouseenter: \"mouseover\",\n\tmouseleave: \"mouseout\"\n};\n\njQuery.each([\"live\", \"die\"], function( i, name ) {\n\tjQuery.fn[ name ] = function( types, data, fn, origSelector /* Internal Use Only */ ) {\n\t\tvar type, i = 0, match, namespaces, preType,\n\t\t\tselector = origSelector || this.selector,\n\t\t\tcontext = origSelector ? this : jQuery( this.context );\n\n\t\tif ( typeof types === \"object\" && !types.preventDefault ) {\n\t\t\tfor ( var key in types ) {\n\t\t\t\tcontext[ name ]( key, data, types[key], selector );\n\t\t\t}\n\n\t\t\treturn this;\n\t\t}\n\n\t\tif ( name === \"die\" && !types &&\n\t\t\t\t\torigSelector && origSelector.charAt(0) === \".\" ) {\n\n\t\t\tcontext.unbind( origSelector );\n\n\t\t\treturn this;\n\t\t}\n\n\t\tif ( data === false || jQuery.isFunction( data ) ) {\n\t\t\tfn = data || returnFalse;\n\t\t\tdata = undefined;\n\t\t}\n\n\t\ttypes = (types || \"\").split(\" \");\n\n\t\twhile ( (type = types[ i++ ]) != null ) {\n\t\t\tmatch = rnamespaces.exec( type );\n\t\t\tnamespaces = \"\";\n\n\t\t\tif ( match )  {\n\t\t\t\tnamespaces = match[0];\n\t\t\t\ttype = type.replace( rnamespaces, \"\" );\n\t\t\t}\n\n\t\t\tif ( type === \"hover\" ) {\n\t\t\t\ttypes.push( \"mouseenter\" + namespaces, \"mouseleave\" + namespaces );\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tpreType = type;\n\n\t\t\tif ( liveMap[ type ] ) {\n\t\t\t\ttypes.push( liveMap[ type ] + namespaces );\n\t\t\t\ttype = type + namespaces;\n\n\t\t\t} else {\n\t\t\t\ttype = (liveMap[ type ] || type) + namespaces;\n\t\t\t}\n\n\t\t\tif ( name === \"live\" ) {\n\t\t\t\t// bind live handler\n\t\t\t\tfor ( var j = 0, l = context.length; j < l; j++ ) {\n\t\t\t\t\tjQuery.event.add( context[j], \"live.\" + liveConvert( type, selector ),\n\t\t\t\t\t\t{ data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType } );\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\t// unbind live handler\n\t\t\t\tcontext.unbind( \"live.\" + liveConvert( type, selector ), fn );\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t};\n});\n\nfunction liveHandler( event ) {\n\tvar stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,\n\t\telems = [],\n\t\tselectors = [],\n\t\tevents = jQuery._data( this, \"events\" );\n\n\t// Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911)\n\tif ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === \"click\" ) {\n\t\treturn;\n\t}\n\n\tif ( event.namespace ) {\n\t\tnamespace = new RegExp(\"(^|\\\\.)\" + event.namespace.split(\".\").join(\"\\\\.(?:.*\\\\.)?\") + \"(\\\\.|$)\");\n\t}\n\n\tevent.liveFired = this;\n\n\tvar live = events.live.slice(0);\n\n\tfor ( j = 0; j < live.length; j++ ) {\n\t\thandleObj = live[j];\n\n\t\tif ( handleObj.origType.replace( rnamespaces, \"\" ) === event.type ) {\n\t\t\tselectors.push( handleObj.selector );\n\n\t\t} else {\n\t\t\tlive.splice( j--, 1 );\n\t\t}\n\t}\n\n\tmatch = jQuery( event.target ).closest( selectors, event.currentTarget );\n\n\tfor ( i = 0, l = match.length; i < l; i++ ) {\n\t\tclose = match[i];\n\n\t\tfor ( j = 0; j < live.length; j++ ) {\n\t\t\thandleObj = live[j];\n\n\t\t\tif ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) {\n\t\t\t\telem = close.elem;\n\t\t\t\trelated = null;\n\n\t\t\t\t// Those two events require additional checking\n\t\t\t\tif ( handleObj.preType === \"mouseenter\" || handleObj.preType === \"mouseleave\" ) {\n\t\t\t\t\tevent.type = handleObj.preType;\n\t\t\t\t\trelated = jQuery( event.relatedTarget ).closest( handleObj.selector )[0];\n\n\t\t\t\t\t// Make sure not to accidentally match a child element with the same selector\n\t\t\t\t\tif ( related && jQuery.contains( elem, related ) ) {\n\t\t\t\t\t\trelated = elem;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( !related || related !== elem ) {\n\t\t\t\t\telems.push({ elem: elem, handleObj: handleObj, level: close.level });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor ( i = 0, l = elems.length; i < l; i++ ) {\n\t\tmatch = elems[i];\n\n\t\tif ( maxLevel && match.level > maxLevel ) {\n\t\t\tbreak;\n\t\t}\n\n\t\tevent.currentTarget = match.elem;\n\t\tevent.data = match.handleObj.data;\n\t\tevent.handleObj = match.handleObj;\n\n\t\tret = match.handleObj.origHandler.apply( match.elem, arguments );\n\n\t\tif ( ret === false || event.isPropagationStopped() ) {\n\t\t\tmaxLevel = match.level;\n\n\t\t\tif ( ret === false ) {\n\t\t\t\tstop = false;\n\t\t\t}\n\t\t\tif ( event.isImmediatePropagationStopped() ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn stop;\n}\n\nfunction liveConvert( type, selector ) {\n\treturn (type && type !== \"*\" ? type + \".\" : \"\") + selector.replace(rperiod, \"`\").replace(rspaces, \"&\");\n}\n\njQuery.each( (\"blur focus focusin focusout load resize scroll unload click dblclick \" +\n\t\"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave \" +\n\t\"change select submit keydown keypress keyup error\").split(\" \"), function( i, name ) {\n\n\t// Handle event binding\n\tjQuery.fn[ name ] = function( data, fn ) {\n\t\tif ( fn == null ) {\n\t\t\tfn = data;\n\t\t\tdata = null;\n\t\t}\n\n\t\treturn arguments.length > 0 ?\n\t\t\tthis.bind( name, data, fn ) :\n\t\t\tthis.trigger( name );\n\t};\n\n\tif ( jQuery.attrFn ) {\n\t\tjQuery.attrFn[ name ] = true;\n\t}\n});\n\n\n\n/*!\n * Sizzle CSS Selector Engine\n *  Copyright 2011, The Dojo Foundation\n *  Released under the MIT, BSD, and GPL Licenses.\n *  More information: http://sizzlejs.com/\n */\n(function(){\n\nvar chunker = /((?:\\((?:\\([^()]+\\)|[^()]+)+\\)|\\[(?:\\[[^\\[\\]]*\\]|['\"][^'\"]*['\"]|[^\\[\\]'\"]+)+\\]|\\\\.|[^ >+~,(\\[\\\\]+)+|[>+~])(\\s*,\\s*)?((?:.|\\r|\\n)*)/g,\n\tdone = 0,\n\ttoString = Object.prototype.toString,\n\thasDuplicate = false,\n\tbaseHasDuplicate = true,\n\trBackslash = /\\\\/g,\n\trNonWord = /\\W/;\n\n// Here we check if the JavaScript engine is using some sort of\n// optimization where it does not always call our comparision\n// function. If that is the case, discard the hasDuplicate value.\n//   Thus far that includes Google Chrome.\n[0, 0].sort(function() {\n\tbaseHasDuplicate = false;\n\treturn 0;\n});\n\nvar Sizzle = function( selector, context, results, seed ) {\n\tresults = results || [];\n\tcontext = context || document;\n\n\tvar origContext = context;\n\n\tif ( context.nodeType !== 1 && context.nodeType !== 9 ) {\n\t\treturn [];\n\t}\n\t\n\tif ( !selector || typeof selector !== \"string\" ) {\n\t\treturn results;\n\t}\n\n\tvar m, set, checkSet, extra, ret, cur, pop, i,\n\t\tprune = true,\n\t\tcontextXML = Sizzle.isXML( context ),\n\t\tparts = [],\n\t\tsoFar = selector;\n\t\n\t// Reset the position of the chunker regexp (start from head)\n\tdo {\n\t\tchunker.exec( \"\" );\n\t\tm = chunker.exec( soFar );\n\n\t\tif ( m ) {\n\t\t\tsoFar = m[3];\n\t\t\n\t\t\tparts.push( m[1] );\n\t\t\n\t\t\tif ( m[2] ) {\n\t\t\t\textra = m[3];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t} while ( m );\n\n\tif ( parts.length > 1 && origPOS.exec( selector ) ) {\n\n\t\tif ( parts.length === 2 && Expr.relative[ parts[0] ] ) {\n\t\t\tset = posProcess( parts[0] + parts[1], context );\n\n\t\t} else {\n\t\t\tset = Expr.relative[ parts[0] ] ?\n\t\t\t\t[ context ] :\n\t\t\t\tSizzle( parts.shift(), context );\n\n\t\t\twhile ( parts.length ) {\n\t\t\t\tselector = parts.shift();\n\n\t\t\t\tif ( Expr.relative[ selector ] ) {\n\t\t\t\t\tselector += parts.shift();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tset = posProcess( selector, set );\n\t\t\t}\n\t\t}\n\n\t} else {\n\t\t// Take a shortcut and set the context if the root selector is an ID\n\t\t// (but not if it'll be faster if the inner selector is an ID)\n\t\tif ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&\n\t\t\t\tExpr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {\n\n\t\t\tret = Sizzle.find( parts.shift(), context, contextXML );\n\t\t\tcontext = ret.expr ?\n\t\t\t\tSizzle.filter( ret.expr, ret.set )[0] :\n\t\t\t\tret.set[0];\n\t\t}\n\n\t\tif ( context ) {\n\t\t\tret = seed ?\n\t\t\t\t{ expr: parts.pop(), set: makeArray(seed) } :\n\t\t\t\tSizzle.find( parts.pop(), parts.length === 1 && (parts[0] === \"~\" || parts[0] === \"+\") && context.parentNode ? context.parentNode : context, contextXML );\n\n\t\t\tset = ret.expr ?\n\t\t\t\tSizzle.filter( ret.expr, ret.set ) :\n\t\t\t\tret.set;\n\n\t\t\tif ( parts.length > 0 ) {\n\t\t\t\tcheckSet = makeArray( set );\n\n\t\t\t} else {\n\t\t\t\tprune = false;\n\t\t\t}\n\n\t\t\twhile ( parts.length ) {\n\t\t\t\tcur = parts.pop();\n\t\t\t\tpop = cur;\n\n\t\t\t\tif ( !Expr.relative[ cur ] ) {\n\t\t\t\t\tcur = \"\";\n\t\t\t\t} else {\n\t\t\t\t\tpop = parts.pop();\n\t\t\t\t}\n\n\t\t\t\tif ( pop == null ) {\n\t\t\t\t\tpop = context;\n\t\t\t\t}\n\n\t\t\t\tExpr.relative[ cur ]( checkSet, pop, contextXML );\n\t\t\t}\n\n\t\t} else {\n\t\t\tcheckSet = parts = [];\n\t\t}\n\t}\n\n\tif ( !checkSet ) {\n\t\tcheckSet = set;\n\t}\n\n\tif ( !checkSet ) {\n\t\tSizzle.error( cur || selector );\n\t}\n\n\tif ( toString.call(checkSet) === \"[object Array]\" ) {\n\t\tif ( !prune ) {\n\t\t\tresults.push.apply( results, checkSet );\n\n\t\t} else if ( context && context.nodeType === 1 ) {\n\t\t\tfor ( i = 0; checkSet[i] != null; i++ ) {\n\t\t\t\tif ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {\n\t\t\t\t\tresults.push( set[i] );\n\t\t\t\t}\n\t\t\t}\n\n\t\t} else {\n\t\t\tfor ( i = 0; checkSet[i] != null; i++ ) {\n\t\t\t\tif ( checkSet[i] && checkSet[i].nodeType === 1 ) {\n\t\t\t\t\tresults.push( set[i] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t} else {\n\t\tmakeArray( checkSet, results );\n\t}\n\n\tif ( extra ) {\n\t\tSizzle( extra, origContext, results, seed );\n\t\tSizzle.uniqueSort( results );\n\t}\n\n\treturn results;\n};\n\nSizzle.uniqueSort = function( results ) {\n\tif ( sortOrder ) {\n\t\thasDuplicate = baseHasDuplicate;\n\t\tresults.sort( sortOrder );\n\n\t\tif ( hasDuplicate ) {\n\t\t\tfor ( var i = 1; i < results.length; i++ ) {\n\t\t\t\tif ( results[i] === results[ i - 1 ] ) {\n\t\t\t\t\tresults.splice( i--, 1 );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn results;\n};\n\nSizzle.matches = function( expr, set ) {\n\treturn Sizzle( expr, null, null, set );\n};\n\nSizzle.matchesSelector = function( node, expr ) {\n\treturn Sizzle( expr, null, null, [node] ).length > 0;\n};\n\nSizzle.find = function( expr, context, isXML ) {\n\tvar set;\n\n\tif ( !expr ) {\n\t\treturn [];\n\t}\n\n\tfor ( var i = 0, l = Expr.order.length; i < l; i++ ) {\n\t\tvar match,\n\t\t\ttype = Expr.order[i];\n\t\t\n\t\tif ( (match = Expr.leftMatch[ type ].exec( expr )) ) {\n\t\t\tvar left = match[1];\n\t\t\tmatch.splice( 1, 1 );\n\n\t\t\tif ( left.substr( left.length - 1 ) !== \"\\\\\" ) {\n\t\t\t\tmatch[1] = (match[1] || \"\").replace( rBackslash, \"\" );\n\t\t\t\tset = Expr.find[ type ]( match, context, isXML );\n\n\t\t\t\tif ( set != null ) {\n\t\t\t\t\texpr = expr.replace( Expr.match[ type ], \"\" );\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( !set ) {\n\t\tset = typeof context.getElementsByTagName !== \"undefined\" ?\n\t\t\tcontext.getElementsByTagName( \"*\" ) :\n\t\t\t[];\n\t}\n\n\treturn { set: set, expr: expr };\n};\n\nSizzle.filter = function( expr, set, inplace, not ) {\n\tvar match, anyFound,\n\t\told = expr,\n\t\tresult = [],\n\t\tcurLoop = set,\n\t\tisXMLFilter = set && set[0] && Sizzle.isXML( set[0] );\n\n\twhile ( expr && set.length ) {\n\t\tfor ( var type in Expr.filter ) {\n\t\t\tif ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {\n\t\t\t\tvar found, item,\n\t\t\t\t\tfilter = Expr.filter[ type ],\n\t\t\t\t\tleft = match[1];\n\n\t\t\t\tanyFound = false;\n\n\t\t\t\tmatch.splice(1,1);\n\n\t\t\t\tif ( left.substr( left.length - 1 ) === \"\\\\\" ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif ( curLoop === result ) {\n\t\t\t\t\tresult = [];\n\t\t\t\t}\n\n\t\t\t\tif ( Expr.preFilter[ type ] ) {\n\t\t\t\t\tmatch = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );\n\n\t\t\t\t\tif ( !match ) {\n\t\t\t\t\t\tanyFound = found = true;\n\n\t\t\t\t\t} else if ( match === true ) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( match ) {\n\t\t\t\t\tfor ( var i = 0; (item = curLoop[i]) != null; i++ ) {\n\t\t\t\t\t\tif ( item ) {\n\t\t\t\t\t\t\tfound = filter( item, match, i, curLoop );\n\t\t\t\t\t\t\tvar pass = not ^ !!found;\n\n\t\t\t\t\t\t\tif ( inplace && found != null ) {\n\t\t\t\t\t\t\t\tif ( pass ) {\n\t\t\t\t\t\t\t\t\tanyFound = true;\n\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tcurLoop[i] = false;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t} else if ( pass ) {\n\t\t\t\t\t\t\t\tresult.push( item );\n\t\t\t\t\t\t\t\tanyFound = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( found !== undefined ) {\n\t\t\t\t\tif ( !inplace ) {\n\t\t\t\t\t\tcurLoop = result;\n\t\t\t\t\t}\n\n\t\t\t\t\texpr = expr.replace( Expr.match[ type ], \"\" );\n\n\t\t\t\t\tif ( !anyFound ) {\n\t\t\t\t\t\treturn [];\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Improper expression\n\t\tif ( expr === old ) {\n\t\t\tif ( anyFound == null ) {\n\t\t\t\tSizzle.error( expr );\n\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\told = expr;\n\t}\n\n\treturn curLoop;\n};\n\nSizzle.error = function( msg ) {\n\tthrow \"Syntax error, unrecognized expression: \" + msg;\n};\n\nvar Expr = Sizzle.selectors = {\n\torder: [ \"ID\", \"NAME\", \"TAG\" ],\n\n\tmatch: {\n\t\tID: /#((?:[\\w\\u00c0-\\uFFFF\\-]|\\\\.)+)/,\n\t\tCLASS: /\\.((?:[\\w\\u00c0-\\uFFFF\\-]|\\\\.)+)/,\n\t\tNAME: /\\[name=['\"]*((?:[\\w\\u00c0-\\uFFFF\\-]|\\\\.)+)['\"]*\\]/,\n\t\tATTR: /\\[\\s*((?:[\\w\\u00c0-\\uFFFF\\-]|\\\\.)+)\\s*(?:(\\S?=)\\s*(?:(['\"])(.*?)\\3|(#?(?:[\\w\\u00c0-\\uFFFF\\-]|\\\\.)*)|)|)\\s*\\]/,\n\t\tTAG: /^((?:[\\w\\u00c0-\\uFFFF\\*\\-]|\\\\.)+)/,\n\t\tCHILD: /:(only|nth|last|first)-child(?:\\(\\s*(even|odd|(?:[+\\-]?\\d+|(?:[+\\-]?\\d*)?n\\s*(?:[+\\-]\\s*\\d+)?))\\s*\\))?/,\n\t\tPOS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\\((\\d*)\\))?(?=[^\\-]|$)/,\n\t\tPSEUDO: /:((?:[\\w\\u00c0-\\uFFFF\\-]|\\\\.)+)(?:\\((['\"]?)((?:\\([^\\)]+\\)|[^\\(\\)]*)+)\\2\\))?/\n\t},\n\n\tleftMatch: {},\n\n\tattrMap: {\n\t\t\"class\": \"className\",\n\t\t\"for\": \"htmlFor\"\n\t},\n\n\tattrHandle: {\n\t\thref: function( elem ) {\n\t\t\treturn elem.getAttribute( \"href\" );\n\t\t},\n\t\ttype: function( elem ) {\n\t\t\treturn elem.getAttribute( \"type\" );\n\t\t}\n\t},\n\n\trelative: {\n\t\t\"+\": function(checkSet, part){\n\t\t\tvar isPartStr = typeof part === \"string\",\n\t\t\t\tisTag = isPartStr && !rNonWord.test( part ),\n\t\t\t\tisPartStrNotTag = isPartStr && !isTag;\n\n\t\t\tif ( isTag ) {\n\t\t\t\tpart = part.toLowerCase();\n\t\t\t}\n\n\t\t\tfor ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {\n\t\t\t\tif ( (elem = checkSet[i]) ) {\n\t\t\t\t\twhile ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}\n\n\t\t\t\t\tcheckSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?\n\t\t\t\t\t\telem || false :\n\t\t\t\t\t\telem === part;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( isPartStrNotTag ) {\n\t\t\t\tSizzle.filter( part, checkSet, true );\n\t\t\t}\n\t\t},\n\n\t\t\">\": function( checkSet, part ) {\n\t\t\tvar elem,\n\t\t\t\tisPartStr = typeof part === \"string\",\n\t\t\t\ti = 0,\n\t\t\t\tl = checkSet.length;\n\n\t\t\tif ( isPartStr && !rNonWord.test( part ) ) {\n\t\t\t\tpart = part.toLowerCase();\n\n\t\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\t\telem = checkSet[i];\n\n\t\t\t\t\tif ( elem ) {\n\t\t\t\t\t\tvar parent = elem.parentNode;\n\t\t\t\t\t\tcheckSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\t\telem = checkSet[i];\n\n\t\t\t\t\tif ( elem ) {\n\t\t\t\t\t\tcheckSet[i] = isPartStr ?\n\t\t\t\t\t\t\telem.parentNode :\n\t\t\t\t\t\t\telem.parentNode === part;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( isPartStr ) {\n\t\t\t\t\tSizzle.filter( part, checkSet, true );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t\"\": function(checkSet, part, isXML){\n\t\t\tvar nodeCheck,\n\t\t\t\tdoneName = done++,\n\t\t\t\tcheckFn = dirCheck;\n\n\t\t\tif ( typeof part === \"string\" && !rNonWord.test( part ) ) {\n\t\t\t\tpart = part.toLowerCase();\n\t\t\t\tnodeCheck = part;\n\t\t\t\tcheckFn = dirNodeCheck;\n\t\t\t}\n\n\t\t\tcheckFn( \"parentNode\", part, doneName, checkSet, nodeCheck, isXML );\n\t\t},\n\n\t\t\"~\": function( checkSet, part, isXML ) {\n\t\t\tvar nodeCheck,\n\t\t\t\tdoneName = done++,\n\t\t\t\tcheckFn = dirCheck;\n\n\t\t\tif ( typeof part === \"string\" && !rNonWord.test( part ) ) {\n\t\t\t\tpart = part.toLowerCase();\n\t\t\t\tnodeCheck = part;\n\t\t\t\tcheckFn = dirNodeCheck;\n\t\t\t}\n\n\t\t\tcheckFn( \"previousSibling\", part, doneName, checkSet, nodeCheck, isXML );\n\t\t}\n\t},\n\n\tfind: {\n\t\tID: function( match, context, isXML ) {\n\t\t\tif ( typeof context.getElementById !== \"undefined\" && !isXML ) {\n\t\t\t\tvar m = context.getElementById(match[1]);\n\t\t\t\t// Check parentNode to catch when Blackberry 4.6 returns\n\t\t\t\t// nodes that are no longer in the document #6963\n\t\t\t\treturn m && m.parentNode ? [m] : [];\n\t\t\t}\n\t\t},\n\n\t\tNAME: function( match, context ) {\n\t\t\tif ( typeof context.getElementsByName !== \"undefined\" ) {\n\t\t\t\tvar ret = [],\n\t\t\t\t\tresults = context.getElementsByName( match[1] );\n\n\t\t\t\tfor ( var i = 0, l = results.length; i < l; i++ ) {\n\t\t\t\t\tif ( results[i].getAttribute(\"name\") === match[1] ) {\n\t\t\t\t\t\tret.push( results[i] );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn ret.length === 0 ? null : ret;\n\t\t\t}\n\t\t},\n\n\t\tTAG: function( match, context ) {\n\t\t\tif ( typeof context.getElementsByTagName !== \"undefined\" ) {\n\t\t\t\treturn context.getElementsByTagName( match[1] );\n\t\t\t}\n\t\t}\n\t},\n\tpreFilter: {\n\t\tCLASS: function( match, curLoop, inplace, result, not, isXML ) {\n\t\t\tmatch = \" \" + match[1].replace( rBackslash, \"\" ) + \" \";\n\n\t\t\tif ( isXML ) {\n\t\t\t\treturn match;\n\t\t\t}\n\n\t\t\tfor ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {\n\t\t\t\tif ( elem ) {\n\t\t\t\t\tif ( not ^ (elem.className && (\" \" + elem.className + \" \").replace(/[\\t\\n\\r]/g, \" \").indexOf(match) >= 0) ) {\n\t\t\t\t\t\tif ( !inplace ) {\n\t\t\t\t\t\t\tresult.push( elem );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else if ( inplace ) {\n\t\t\t\t\t\tcurLoop[i] = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false;\n\t\t},\n\n\t\tID: function( match ) {\n\t\t\treturn match[1].replace( rBackslash, \"\" );\n\t\t},\n\n\t\tTAG: function( match, curLoop ) {\n\t\t\treturn match[1].replace( rBackslash, \"\" ).toLowerCase();\n\t\t},\n\n\t\tCHILD: function( match ) {\n\t\t\tif ( match[1] === \"nth\" ) {\n\t\t\t\tif ( !match[2] ) {\n\t\t\t\t\tSizzle.error( match[0] );\n\t\t\t\t}\n\n\t\t\t\tmatch[2] = match[2].replace(/^\\+|\\s*/g, '');\n\n\t\t\t\t// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'\n\t\t\t\tvar test = /(-?)(\\d*)(?:n([+\\-]?\\d*))?/.exec(\n\t\t\t\t\tmatch[2] === \"even\" && \"2n\" || match[2] === \"odd\" && \"2n+1\" ||\n\t\t\t\t\t!/\\D/.test( match[2] ) && \"0n+\" + match[2] || match[2]);\n\n\t\t\t\t// calculate the numbers (first)n+(last) including if they are negative\n\t\t\t\tmatch[2] = (test[1] + (test[2] || 1)) - 0;\n\t\t\t\tmatch[3] = test[3] - 0;\n\t\t\t}\n\t\t\telse if ( match[2] ) {\n\t\t\t\tSizzle.error( match[0] );\n\t\t\t}\n\n\t\t\t// TODO: Move to normal caching system\n\t\t\tmatch[0] = done++;\n\n\t\t\treturn match;\n\t\t},\n\n\t\tATTR: function( match, curLoop, inplace, result, not, isXML ) {\n\t\t\tvar name = match[1] = match[1].replace( rBackslash, \"\" );\n\t\t\t\n\t\t\tif ( !isXML && Expr.attrMap[name] ) {\n\t\t\t\tmatch[1] = Expr.attrMap[name];\n\t\t\t}\n\n\t\t\t// Handle if an un-quoted value was used\n\t\t\tmatch[4] = ( match[4] || match[5] || \"\" ).replace( rBackslash, \"\" );\n\n\t\t\tif ( match[2] === \"~=\" ) {\n\t\t\t\tmatch[4] = \" \" + match[4] + \" \";\n\t\t\t}\n\n\t\t\treturn match;\n\t\t},\n\n\t\tPSEUDO: function( match, curLoop, inplace, result, not ) {\n\t\t\tif ( match[1] === \"not\" ) {\n\t\t\t\t// If we're dealing with a complex expression, or a simple one\n\t\t\t\tif ( ( chunker.exec(match[3]) || \"\" ).length > 1 || /^\\w/.test(match[3]) ) {\n\t\t\t\t\tmatch[3] = Sizzle(match[3], null, null, curLoop);\n\n\t\t\t\t} else {\n\t\t\t\t\tvar ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);\n\n\t\t\t\t\tif ( !inplace ) {\n\t\t\t\t\t\tresult.push.apply( result, ret );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t\n\t\t\treturn match;\n\t\t},\n\n\t\tPOS: function( match ) {\n\t\t\tmatch.unshift( true );\n\n\t\t\treturn match;\n\t\t}\n\t},\n\t\n\tfilters: {\n\t\tenabled: function( elem ) {\n\t\t\treturn elem.disabled === false && elem.type !== \"hidden\";\n\t\t},\n\n\t\tdisabled: function( elem ) {\n\t\t\treturn elem.disabled === true;\n\t\t},\n\n\t\tchecked: function( elem ) {\n\t\t\treturn elem.checked === true;\n\t\t},\n\t\t\n\t\tselected: function( elem ) {\n\t\t\t// Accessing this property makes selected-by-default\n\t\t\t// options in Safari work properly\n\t\t\tif ( elem.parentNode ) {\n\t\t\t\telem.parentNode.selectedIndex;\n\t\t\t}\n\t\t\t\n\t\t\treturn elem.selected === true;\n\t\t},\n\n\t\tparent: function( elem ) {\n\t\t\treturn !!elem.firstChild;\n\t\t},\n\n\t\tempty: function( elem ) {\n\t\t\treturn !elem.firstChild;\n\t\t},\n\n\t\thas: function( elem, i, match ) {\n\t\t\treturn !!Sizzle( match[3], elem ).length;\n\t\t},\n\n\t\theader: function( elem ) {\n\t\t\treturn (/h\\d/i).test( elem.nodeName );\n\t\t},\n\n\t\ttext: function( elem ) {\n\t\t\tvar attr = elem.getAttribute( \"type\" ), type = elem.type;\n\t\t\t// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) \n\t\t\t// use getAttribute instead to test this case\n\t\t\treturn elem.nodeName.toLowerCase() === \"input\" && \"text\" === type && ( attr === type || attr === null );\n\t\t},\n\n\t\tradio: function( elem ) {\n\t\t\treturn elem.nodeName.toLowerCase() === \"input\" && \"radio\" === elem.type;\n\t\t},\n\n\t\tcheckbox: function( elem ) {\n\t\t\treturn elem.nodeName.toLowerCase() === \"input\" && \"checkbox\" === elem.type;\n\t\t},\n\n\t\tfile: function( elem ) {\n\t\t\treturn elem.nodeName.toLowerCase() === \"input\" && \"file\" === elem.type;\n\t\t},\n\n\t\tpassword: function( elem ) {\n\t\t\treturn elem.nodeName.toLowerCase() === \"input\" && \"password\" === elem.type;\n\t\t},\n\n\t\tsubmit: function( elem ) {\n\t\t\tvar name = elem.nodeName.toLowerCase();\n\t\t\treturn (name === \"input\" || name === \"button\") && \"submit\" === elem.type;\n\t\t},\n\n\t\timage: function( elem ) {\n\t\t\treturn elem.nodeName.toLowerCase() === \"input\" && \"image\" === elem.type;\n\t\t},\n\n\t\treset: function( elem ) {\n\t\t\tvar name = elem.nodeName.toLowerCase();\n\t\t\treturn (name === \"input\" || name === \"button\") && \"reset\" === elem.type;\n\t\t},\n\n\t\tbutton: function( elem ) {\n\t\t\tvar name = elem.nodeName.toLowerCase();\n\t\t\treturn name === \"input\" && \"button\" === elem.type || name === \"button\";\n\t\t},\n\n\t\tinput: function( elem ) {\n\t\t\treturn (/input|select|textarea|button/i).test( elem.nodeName );\n\t\t},\n\n\t\tfocus: function( elem ) {\n\t\t\treturn elem === elem.ownerDocument.activeElement;\n\t\t}\n\t},\n\tsetFilters: {\n\t\tfirst: function( elem, i ) {\n\t\t\treturn i === 0;\n\t\t},\n\n\t\tlast: function( elem, i, match, array ) {\n\t\t\treturn i === array.length - 1;\n\t\t},\n\n\t\teven: function( elem, i ) {\n\t\t\treturn i % 2 === 0;\n\t\t},\n\n\t\todd: function( elem, i ) {\n\t\t\treturn i % 2 === 1;\n\t\t},\n\n\t\tlt: function( elem, i, match ) {\n\t\t\treturn i < match[3] - 0;\n\t\t},\n\n\t\tgt: function( elem, i, match ) {\n\t\t\treturn i > match[3] - 0;\n\t\t},\n\n\t\tnth: function( elem, i, match ) {\n\t\t\treturn match[3] - 0 === i;\n\t\t},\n\n\t\teq: function( elem, i, match ) {\n\t\t\treturn match[3] - 0 === i;\n\t\t}\n\t},\n\tfilter: {\n\t\tPSEUDO: function( elem, match, i, array ) {\n\t\t\tvar name = match[1],\n\t\t\t\tfilter = Expr.filters[ name ];\n\n\t\t\tif ( filter ) {\n\t\t\t\treturn filter( elem, i, match, array );\n\n\t\t\t} else if ( name === \"contains\" ) {\n\t\t\t\treturn (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || \"\").indexOf(match[3]) >= 0;\n\n\t\t\t} else if ( name === \"not\" ) {\n\t\t\t\tvar not = match[3];\n\n\t\t\t\tfor ( var j = 0, l = not.length; j < l; j++ ) {\n\t\t\t\t\tif ( not[j] === elem ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\n\t\t\t} else {\n\t\t\t\tSizzle.error( name );\n\t\t\t}\n\t\t},\n\n\t\tCHILD: function( elem, match ) {\n\t\t\tvar type = match[1],\n\t\t\t\tnode = elem;\n\n\t\t\tswitch ( type ) {\n\t\t\t\tcase \"only\":\n\t\t\t\tcase \"first\":\n\t\t\t\t\twhile ( (node = node.previousSibling) )\t {\n\t\t\t\t\t\tif ( node.nodeType === 1 ) { \n\t\t\t\t\t\t\treturn false; \n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( type === \"first\" ) { \n\t\t\t\t\t\treturn true; \n\t\t\t\t\t}\n\n\t\t\t\t\tnode = elem;\n\n\t\t\t\tcase \"last\":\n\t\t\t\t\twhile ( (node = node.nextSibling) )\t {\n\t\t\t\t\t\tif ( node.nodeType === 1 ) { \n\t\t\t\t\t\t\treturn false; \n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn true;\n\n\t\t\t\tcase \"nth\":\n\t\t\t\t\tvar first = match[2],\n\t\t\t\t\t\tlast = match[3];\n\n\t\t\t\t\tif ( first === 1 && last === 0 ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tvar doneName = match[0],\n\t\t\t\t\t\tparent = elem.parentNode;\n\t\n\t\t\t\t\tif ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {\n\t\t\t\t\t\tvar count = 0;\n\t\t\t\t\t\t\n\t\t\t\t\t\tfor ( node = parent.firstChild; node; node = node.nextSibling ) {\n\t\t\t\t\t\t\tif ( node.nodeType === 1 ) {\n\t\t\t\t\t\t\t\tnode.nodeIndex = ++count;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} \n\n\t\t\t\t\t\tparent.sizcache = doneName;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tvar diff = elem.nodeIndex - last;\n\n\t\t\t\t\tif ( first === 0 ) {\n\t\t\t\t\t\treturn diff === 0;\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn ( diff % first === 0 && diff / first >= 0 );\n\t\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\tID: function( elem, match ) {\n\t\t\treturn elem.nodeType === 1 && elem.getAttribute(\"id\") === match;\n\t\t},\n\n\t\tTAG: function( elem, match ) {\n\t\t\treturn (match === \"*\" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;\n\t\t},\n\t\t\n\t\tCLASS: function( elem, match ) {\n\t\t\treturn (\" \" + (elem.className || elem.getAttribute(\"class\")) + \" \")\n\t\t\t\t.indexOf( match ) > -1;\n\t\t},\n\n\t\tATTR: function( elem, match ) {\n\t\t\tvar name = match[1],\n\t\t\t\tresult = Expr.attrHandle[ name ] ?\n\t\t\t\t\tExpr.attrHandle[ name ]( elem ) :\n\t\t\t\t\telem[ name ] != null ?\n\t\t\t\t\t\telem[ name ] :\n\t\t\t\t\t\telem.getAttribute( name ),\n\t\t\t\tvalue = result + \"\",\n\t\t\t\ttype = match[2],\n\t\t\t\tcheck = match[4];\n\n\t\t\treturn result == null ?\n\t\t\t\ttype === \"!=\" :\n\t\t\t\ttype === \"=\" ?\n\t\t\t\tvalue === check :\n\t\t\t\ttype === \"*=\" ?\n\t\t\t\tvalue.indexOf(check) >= 0 :\n\t\t\t\ttype === \"~=\" ?\n\t\t\t\t(\" \" + value + \" \").indexOf(check) >= 0 :\n\t\t\t\t!check ?\n\t\t\t\tvalue && result !== false :\n\t\t\t\ttype === \"!=\" ?\n\t\t\t\tvalue !== check :\n\t\t\t\ttype === \"^=\" ?\n\t\t\t\tvalue.indexOf(check) === 0 :\n\t\t\t\ttype === \"$=\" ?\n\t\t\t\tvalue.substr(value.length - check.length) === check :\n\t\t\t\ttype === \"|=\" ?\n\t\t\t\tvalue === check || value.substr(0, check.length + 1) === check + \"-\" :\n\t\t\t\tfalse;\n\t\t},\n\n\t\tPOS: function( elem, match, i, array ) {\n\t\t\tvar name = match[2],\n\t\t\t\tfilter = Expr.setFilters[ name ];\n\n\t\t\tif ( filter ) {\n\t\t\t\treturn filter( elem, i, match, array );\n\t\t\t}\n\t\t}\n\t}\n};\n\nvar origPOS = Expr.match.POS,\n\tfescape = function(all, num){\n\t\treturn \"\\\\\" + (num - 0 + 1);\n\t};\n\nfor ( var type in Expr.match ) {\n\tExpr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\\[]*\\])(?![^\\(]*\\))/.source) );\n\tExpr.leftMatch[ type ] = new RegExp( /(^(?:.|\\r|\\n)*?)/.source + Expr.match[ type ].source.replace(/\\\\(\\d+)/g, fescape) );\n}\n\nvar makeArray = function( array, results ) {\n\tarray = Array.prototype.slice.call( array, 0 );\n\n\tif ( results ) {\n\t\tresults.push.apply( results, array );\n\t\treturn results;\n\t}\n\t\n\treturn array;\n};\n\n// Perform a simple check to determine if the browser is capable of\n// converting a NodeList to an array using builtin methods.\n// Also verifies that the returned array holds DOM nodes\n// (which is not the case in the Blackberry browser)\ntry {\n\tArray.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;\n\n// Provide a fallback method if it does not work\n} catch( e ) {\n\tmakeArray = function( array, results ) {\n\t\tvar i = 0,\n\t\t\tret = results || [];\n\n\t\tif ( toString.call(array) === \"[object Array]\" ) {\n\t\t\tArray.prototype.push.apply( ret, array );\n\n\t\t} else {\n\t\t\tif ( typeof array.length === \"number\" ) {\n\t\t\t\tfor ( var l = array.length; i < l; i++ ) {\n\t\t\t\t\tret.push( array[i] );\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\tfor ( ; array[i]; i++ ) {\n\t\t\t\t\tret.push( array[i] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t};\n}\n\nvar sortOrder, siblingCheck;\n\nif ( document.documentElement.compareDocumentPosition ) {\n\tsortOrder = function( a, b ) {\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t\treturn 0;\n\t\t}\n\n\t\tif ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {\n\t\t\treturn a.compareDocumentPosition ? -1 : 1;\n\t\t}\n\n\t\treturn a.compareDocumentPosition(b) & 4 ? -1 : 1;\n\t};\n\n} else {\n\tsortOrder = function( a, b ) {\n\t\t// The nodes are identical, we can exit early\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t\treturn 0;\n\n\t\t// Fallback to using sourceIndex (in IE) if it's available on both nodes\n\t\t} else if ( a.sourceIndex && b.sourceIndex ) {\n\t\t\treturn a.sourceIndex - b.sourceIndex;\n\t\t}\n\n\t\tvar al, bl,\n\t\t\tap = [],\n\t\t\tbp = [],\n\t\t\taup = a.parentNode,\n\t\t\tbup = b.parentNode,\n\t\t\tcur = aup;\n\n\t\t// If the nodes are siblings (or identical) we can do a quick check\n\t\tif ( aup === bup ) {\n\t\t\treturn siblingCheck( a, b );\n\n\t\t// If no parents were found then the nodes are disconnected\n\t\t} else if ( !aup ) {\n\t\t\treturn -1;\n\n\t\t} else if ( !bup ) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t// Otherwise they're somewhere else in the tree so we need\n\t\t// to build up a full list of the parentNodes for comparison\n\t\twhile ( cur ) {\n\t\t\tap.unshift( cur );\n\t\t\tcur = cur.parentNode;\n\t\t}\n\n\t\tcur = bup;\n\n\t\twhile ( cur ) {\n\t\t\tbp.unshift( cur );\n\t\t\tcur = cur.parentNode;\n\t\t}\n\n\t\tal = ap.length;\n\t\tbl = bp.length;\n\n\t\t// Start walking down the tree looking for a discrepancy\n\t\tfor ( var i = 0; i < al && i < bl; i++ ) {\n\t\t\tif ( ap[i] !== bp[i] ) {\n\t\t\t\treturn siblingCheck( ap[i], bp[i] );\n\t\t\t}\n\t\t}\n\n\t\t// We ended someplace up the tree so do a sibling check\n\t\treturn i === al ?\n\t\t\tsiblingCheck( a, bp[i], -1 ) :\n\t\t\tsiblingCheck( ap[i], b, 1 );\n\t};\n\n\tsiblingCheck = function( a, b, ret ) {\n\t\tif ( a === b ) {\n\t\t\treturn ret;\n\t\t}\n\n\t\tvar cur = a.nextSibling;\n\n\t\twhile ( cur ) {\n\t\t\tif ( cur === b ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\tcur = cur.nextSibling;\n\t\t}\n\n\t\treturn 1;\n\t};\n}\n\n// Utility function for retreiving the text value of an array of DOM nodes\nSizzle.getText = function( elems ) {\n\tvar ret = \"\", elem;\n\n\tfor ( var i = 0; elems[i]; i++ ) {\n\t\telem = elems[i];\n\n\t\t// Get the text from text nodes and CDATA nodes\n\t\tif ( elem.nodeType === 3 || elem.nodeType === 4 ) {\n\t\t\tret += elem.nodeValue;\n\n\t\t// Traverse everything else, except comment nodes\n\t\t} else if ( elem.nodeType !== 8 ) {\n\t\t\tret += Sizzle.getText( elem.childNodes );\n\t\t}\n\t}\n\n\treturn ret;\n};\n\n// Check to see if the browser returns elements by name when\n// querying by getElementById (and provide a workaround)\n(function(){\n\t// We're going to inject a fake input element with a specified name\n\tvar form = document.createElement(\"div\"),\n\t\tid = \"script\" + (new Date()).getTime(),\n\t\troot = document.documentElement;\n\n\tform.innerHTML = \"<a name='\" + id + \"'/>\";\n\n\t// Inject it into the root element, check its status, and remove it quickly\n\troot.insertBefore( form, root.firstChild );\n\n\t// The workaround has to do additional checks after a getElementById\n\t// Which slows things down for other browsers (hence the branching)\n\tif ( document.getElementById( id ) ) {\n\t\tExpr.find.ID = function( match, context, isXML ) {\n\t\t\tif ( typeof context.getElementById !== \"undefined\" && !isXML ) {\n\t\t\t\tvar m = context.getElementById(match[1]);\n\n\t\t\t\treturn m ?\n\t\t\t\t\tm.id === match[1] || typeof m.getAttributeNode !== \"undefined\" && m.getAttributeNode(\"id\").nodeValue === match[1] ?\n\t\t\t\t\t\t[m] :\n\t\t\t\t\t\tundefined :\n\t\t\t\t\t[];\n\t\t\t}\n\t\t};\n\n\t\tExpr.filter.ID = function( elem, match ) {\n\t\t\tvar node = typeof elem.getAttributeNode !== \"undefined\" && elem.getAttributeNode(\"id\");\n\n\t\t\treturn elem.nodeType === 1 && node && node.nodeValue === match;\n\t\t};\n\t}\n\n\troot.removeChild( form );\n\n\t// release memory in IE\n\troot = form = null;\n})();\n\n(function(){\n\t// Check to see if the browser returns only elements\n\t// when doing getElementsByTagName(\"*\")\n\n\t// Create a fake element\n\tvar div = document.createElement(\"div\");\n\tdiv.appendChild( document.createComment(\"\") );\n\n\t// Make sure no comments are found\n\tif ( div.getElementsByTagName(\"*\").length > 0 ) {\n\t\tExpr.find.TAG = function( match, context ) {\n\t\t\tvar results = context.getElementsByTagName( match[1] );\n\n\t\t\t// Filter out possible comments\n\t\t\tif ( match[1] === \"*\" ) {\n\t\t\t\tvar tmp = [];\n\n\t\t\t\tfor ( var i = 0; results[i]; i++ ) {\n\t\t\t\t\tif ( results[i].nodeType === 1 ) {\n\t\t\t\t\t\ttmp.push( results[i] );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tresults = tmp;\n\t\t\t}\n\n\t\t\treturn results;\n\t\t};\n\t}\n\n\t// Check to see if an attribute returns normalized href attributes\n\tdiv.innerHTML = \"<a href='#'></a>\";\n\n\tif ( div.firstChild && typeof div.firstChild.getAttribute !== \"undefined\" &&\n\t\t\tdiv.firstChild.getAttribute(\"href\") !== \"#\" ) {\n\n\t\tExpr.attrHandle.href = function( elem ) {\n\t\t\treturn elem.getAttribute( \"href\", 2 );\n\t\t};\n\t}\n\n\t// release memory in IE\n\tdiv = null;\n})();\n\nif ( document.querySelectorAll ) {\n\t(function(){\n\t\tvar oldSizzle = Sizzle,\n\t\t\tdiv = document.createElement(\"div\"),\n\t\t\tid = \"__sizzle__\";\n\n\t\tdiv.innerHTML = \"<p class='TEST'></p>\";\n\n\t\t// Safari can't handle uppercase or unicode characters when\n\t\t// in quirks mode.\n\t\tif ( div.querySelectorAll && div.querySelectorAll(\".TEST\").length === 0 ) {\n\t\t\treturn;\n\t\t}\n\t\n\t\tSizzle = function( query, context, extra, seed ) {\n\t\t\tcontext = context || document;\n\n\t\t\t// Only use querySelectorAll on non-XML documents\n\t\t\t// (ID selectors don't work in non-HTML documents)\n\t\t\tif ( !seed && !Sizzle.isXML(context) ) {\n\t\t\t\t// See if we find a selector to speed up\n\t\t\t\tvar match = /^(\\w+$)|^\\.([\\w\\-]+$)|^#([\\w\\-]+$)/.exec( query );\n\t\t\t\t\n\t\t\t\tif ( match && (context.nodeType === 1 || context.nodeType === 9) ) {\n\t\t\t\t\t// Speed-up: Sizzle(\"TAG\")\n\t\t\t\t\tif ( match[1] ) {\n\t\t\t\t\t\treturn makeArray( context.getElementsByTagName( query ), extra );\n\t\t\t\t\t\n\t\t\t\t\t// Speed-up: Sizzle(\".CLASS\")\n\t\t\t\t\t} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {\n\t\t\t\t\t\treturn makeArray( context.getElementsByClassName( match[2] ), extra );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ( context.nodeType === 9 ) {\n\t\t\t\t\t// Speed-up: Sizzle(\"body\")\n\t\t\t\t\t// The body element only exists once, optimize finding it\n\t\t\t\t\tif ( query === \"body\" && context.body ) {\n\t\t\t\t\t\treturn makeArray( [ context.body ], extra );\n\t\t\t\t\t\t\n\t\t\t\t\t// Speed-up: Sizzle(\"#ID\")\n\t\t\t\t\t} else if ( match && match[3] ) {\n\t\t\t\t\t\tvar elem = context.getElementById( match[3] );\n\n\t\t\t\t\t\t// Check parentNode to catch when Blackberry 4.6 returns\n\t\t\t\t\t\t// nodes that are no longer in the document #6963\n\t\t\t\t\t\tif ( elem && elem.parentNode ) {\n\t\t\t\t\t\t\t// Handle the case where IE and Opera return items\n\t\t\t\t\t\t\t// by name instead of ID\n\t\t\t\t\t\t\tif ( elem.id === match[3] ) {\n\t\t\t\t\t\t\t\treturn makeArray( [ elem ], extra );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn makeArray( [], extra );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn makeArray( context.querySelectorAll(query), extra );\n\t\t\t\t\t} catch(qsaError) {}\n\n\t\t\t\t// qSA works strangely on Element-rooted queries\n\t\t\t\t// We can work around this by specifying an extra ID on the root\n\t\t\t\t// and working up from there (Thanks to Andrew Dupont for the technique)\n\t\t\t\t// IE 8 doesn't work on object elements\n\t\t\t\t} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== \"object\" ) {\n\t\t\t\t\tvar oldContext = context,\n\t\t\t\t\t\told = context.getAttribute( \"id\" ),\n\t\t\t\t\t\tnid = old || id,\n\t\t\t\t\t\thasParent = context.parentNode,\n\t\t\t\t\t\trelativeHierarchySelector = /^\\s*[+~]/.test( query );\n\n\t\t\t\t\tif ( !old ) {\n\t\t\t\t\t\tcontext.setAttribute( \"id\", nid );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnid = nid.replace( /'/g, \"\\\\$&\" );\n\t\t\t\t\t}\n\t\t\t\t\tif ( relativeHierarchySelector && hasParent ) {\n\t\t\t\t\t\tcontext = context.parentNode;\n\t\t\t\t\t}\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif ( !relativeHierarchySelector || hasParent ) {\n\t\t\t\t\t\t\treturn makeArray( context.querySelectorAll( \"[id='\" + nid + \"'] \" + query ), extra );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} catch(pseudoError) {\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tif ( !old ) {\n\t\t\t\t\t\t\toldContext.removeAttribute( \"id\" );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\t\treturn oldSizzle(query, context, extra, seed);\n\t\t};\n\n\t\tfor ( var prop in oldSizzle ) {\n\t\t\tSizzle[ prop ] = oldSizzle[ prop ];\n\t\t}\n\n\t\t// release memory in IE\n\t\tdiv = null;\n\t})();\n}\n\n(function(){\n\tvar html = document.documentElement,\n\t\tmatches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;\n\n\tif ( matches ) {\n\t\t// Check to see if it's possible to do matchesSelector\n\t\t// on a disconnected node (IE 9 fails this)\n\t\tvar disconnectedMatch = !matches.call( document.createElement( \"div\" ), \"div\" ),\n\t\t\tpseudoWorks = false;\n\n\t\ttry {\n\t\t\t// This should fail with an exception\n\t\t\t// Gecko does not error, returns false instead\n\t\t\tmatches.call( document.documentElement, \"[test!='']:sizzle\" );\n\t\n\t\t} catch( pseudoError ) {\n\t\t\tpseudoWorks = true;\n\t\t}\n\n\t\tSizzle.matchesSelector = function( node, expr ) {\n\t\t\t// Make sure that attribute selectors are quoted\n\t\t\texpr = expr.replace(/\\=\\s*([^'\"\\]]*)\\s*\\]/g, \"='$1']\");\n\n\t\t\tif ( !Sizzle.isXML( node ) ) {\n\t\t\t\ttry { \n\t\t\t\t\tif ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {\n\t\t\t\t\t\tvar ret = matches.call( node, expr );\n\n\t\t\t\t\t\t// IE 9's matchesSelector returns false on disconnected nodes\n\t\t\t\t\t\tif ( ret || !disconnectedMatch ||\n\t\t\t\t\t\t\t\t// As well, disconnected nodes are said to be in a document\n\t\t\t\t\t\t\t\t// fragment in IE 9, so check for that\n\t\t\t\t\t\t\t\tnode.document && node.document.nodeType !== 11 ) {\n\t\t\t\t\t\t\treturn ret;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} catch(e) {}\n\t\t\t}\n\n\t\t\treturn Sizzle(expr, null, null, [node]).length > 0;\n\t\t};\n\t}\n})();\n\n(function(){\n\tvar div = document.createElement(\"div\");\n\n\tdiv.innerHTML = \"<div class='test e'></div><div class='test'></div>\";\n\n\t// Opera can't find a second classname (in 9.6)\n\t// Also, make sure that getElementsByClassName actually exists\n\tif ( !div.getElementsByClassName || div.getElementsByClassName(\"e\").length === 0 ) {\n\t\treturn;\n\t}\n\n\t// Safari caches class attributes, doesn't catch changes (in 3.2)\n\tdiv.lastChild.className = \"e\";\n\n\tif ( div.getElementsByClassName(\"e\").length === 1 ) {\n\t\treturn;\n\t}\n\t\n\tExpr.order.splice(1, 0, \"CLASS\");\n\tExpr.find.CLASS = function( match, context, isXML ) {\n\t\tif ( typeof context.getElementsByClassName !== \"undefined\" && !isXML ) {\n\t\t\treturn context.getElementsByClassName(match[1]);\n\t\t}\n\t};\n\n\t// release memory in IE\n\tdiv = null;\n})();\n\nfunction dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {\n\tfor ( var i = 0, l = checkSet.length; i < l; i++ ) {\n\t\tvar elem = checkSet[i];\n\n\t\tif ( elem ) {\n\t\t\tvar match = false;\n\n\t\t\telem = elem[dir];\n\n\t\t\twhile ( elem ) {\n\t\t\t\tif ( elem.sizcache === doneName ) {\n\t\t\t\t\tmatch = checkSet[elem.sizset];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif ( elem.nodeType === 1 && !isXML ){\n\t\t\t\t\telem.sizcache = doneName;\n\t\t\t\t\telem.sizset = i;\n\t\t\t\t}\n\n\t\t\t\tif ( elem.nodeName.toLowerCase() === cur ) {\n\t\t\t\t\tmatch = elem;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\telem = elem[dir];\n\t\t\t}\n\n\t\t\tcheckSet[i] = match;\n\t\t}\n\t}\n}\n\nfunction dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {\n\tfor ( var i = 0, l = checkSet.length; i < l; i++ ) {\n\t\tvar elem = checkSet[i];\n\n\t\tif ( elem ) {\n\t\t\tvar match = false;\n\t\t\t\n\t\t\telem = elem[dir];\n\n\t\t\twhile ( elem ) {\n\t\t\t\tif ( elem.sizcache === doneName ) {\n\t\t\t\t\tmatch = checkSet[elem.sizset];\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\tif ( !isXML ) {\n\t\t\t\t\t\telem.sizcache = doneName;\n\t\t\t\t\t\telem.sizset = i;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( typeof cur !== \"string\" ) {\n\t\t\t\t\t\tif ( elem === cur ) {\n\t\t\t\t\t\t\tmatch = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {\n\t\t\t\t\t\tmatch = elem;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\telem = elem[dir];\n\t\t\t}\n\n\t\t\tcheckSet[i] = match;\n\t\t}\n\t}\n}\n\nif ( document.documentElement.contains ) {\n\tSizzle.contains = function( a, b ) {\n\t\treturn a !== b && (a.contains ? a.contains(b) : true);\n\t};\n\n} else if ( document.documentElement.compareDocumentPosition ) {\n\tSizzle.contains = function( a, b ) {\n\t\treturn !!(a.compareDocumentPosition(b) & 16);\n\t};\n\n} else {\n\tSizzle.contains = function() {\n\t\treturn false;\n\t};\n}\n\nSizzle.isXML = function( elem ) {\n\t// documentElement is verified for cases where it doesn't yet exist\n\t// (such as loading iframes in IE - #4833) \n\tvar documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;\n\n\treturn documentElement ? documentElement.nodeName !== \"HTML\" : false;\n};\n\nvar posProcess = function( selector, context ) {\n\tvar match,\n\t\ttmpSet = [],\n\t\tlater = \"\",\n\t\troot = context.nodeType ? [context] : context;\n\n\t// Position selectors must be done after the filter\n\t// And so must :not(positional) so we move all PSEUDOs to the end\n\twhile ( (match = Expr.match.PSEUDO.exec( selector )) ) {\n\t\tlater += match[0];\n\t\tselector = selector.replace( Expr.match.PSEUDO, \"\" );\n\t}\n\n\tselector = Expr.relative[selector] ? selector + \"*\" : selector;\n\n\tfor ( var i = 0, l = root.length; i < l; i++ ) {\n\t\tSizzle( selector, root[i], tmpSet );\n\t}\n\n\treturn Sizzle.filter( later, tmpSet );\n};\n\n// EXPOSE\njQuery.find = Sizzle;\njQuery.expr = Sizzle.selectors;\njQuery.expr[\":\"] = jQuery.expr.filters;\njQuery.unique = Sizzle.uniqueSort;\njQuery.text = Sizzle.getText;\njQuery.isXMLDoc = Sizzle.isXML;\njQuery.contains = Sizzle.contains;\n\n\n})();\n\n\nvar runtil = /Until$/,\n\trparentsprev = /^(?:parents|prevUntil|prevAll)/,\n\t// Note: This RegExp should be improved, or likely pulled from Sizzle\n\trmultiselector = /,/,\n\tisSimple = /^.[^:#\\[\\.,]*$/,\n\tslice = Array.prototype.slice,\n\tPOS = jQuery.expr.match.POS,\n\t// methods guaranteed to produce a unique set when starting from a unique set\n\tguaranteedUnique = {\n\t\tchildren: true,\n\t\tcontents: true,\n\t\tnext: true,\n\t\tprev: true\n\t};\n\njQuery.fn.extend({\n\tfind: function( selector ) {\n\t\tvar self = this,\n\t\t\ti, l;\n\n\t\tif ( typeof selector !== \"string\" ) {\n\t\t\treturn jQuery( selector ).filter(function() {\n\t\t\t\tfor ( i = 0, l = self.length; i < l; i++ ) {\n\t\t\t\t\tif ( jQuery.contains( self[ i ], this ) ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tvar ret = this.pushStack( \"\", \"find\", selector ),\n\t\t\tlength, n, r;\n\n\t\tfor ( i = 0, l = this.length; i < l; i++ ) {\n\t\t\tlength = ret.length;\n\t\t\tjQuery.find( selector, this[i], ret );\n\n\t\t\tif ( i > 0 ) {\n\t\t\t\t// Make sure that the results are unique\n\t\t\t\tfor ( n = length; n < ret.length; n++ ) {\n\t\t\t\t\tfor ( r = 0; r < length; r++ ) {\n\t\t\t\t\t\tif ( ret[r] === ret[n] ) {\n\t\t\t\t\t\t\tret.splice(n--, 1);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\thas: function( target ) {\n\t\tvar targets = jQuery( target );\n\t\treturn this.filter(function() {\n\t\t\tfor ( var i = 0, l = targets.length; i < l; i++ ) {\n\t\t\t\tif ( jQuery.contains( this, targets[i] ) ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t},\n\n\tnot: function( selector ) {\n\t\treturn this.pushStack( winnow(this, selector, false), \"not\", selector);\n\t},\n\n\tfilter: function( selector ) {\n\t\treturn this.pushStack( winnow(this, selector, true), \"filter\", selector );\n\t},\n\n\tis: function( selector ) {\n\t\treturn !!selector && ( typeof selector === \"string\" ?\n\t\t\tjQuery.filter( selector, this ).length > 0 :\n\t\t\tthis.filter( selector ).length > 0 );\n\t},\n\n\tclosest: function( selectors, context ) {\n\t\tvar ret = [], i, l, cur = this[0];\n\t\t\n\t\t// Array\n\t\tif ( jQuery.isArray( selectors ) ) {\n\t\t\tvar match, selector,\n\t\t\t\tmatches = {},\n\t\t\t\tlevel = 1;\n\n\t\t\tif ( cur && selectors.length ) {\n\t\t\t\tfor ( i = 0, l = selectors.length; i < l; i++ ) {\n\t\t\t\t\tselector = selectors[i];\n\n\t\t\t\t\tif ( !matches[ selector ] ) {\n\t\t\t\t\t\tmatches[ selector ] = POS.test( selector ) ?\n\t\t\t\t\t\t\tjQuery( selector, context || this.context ) :\n\t\t\t\t\t\t\tselector;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\twhile ( cur && cur.ownerDocument && cur !== context ) {\n\t\t\t\t\tfor ( selector in matches ) {\n\t\t\t\t\t\tmatch = matches[ selector ];\n\n\t\t\t\t\t\tif ( match.jquery ? match.index( cur ) > -1 : jQuery( cur ).is( match ) ) {\n\t\t\t\t\t\t\tret.push({ selector: selector, elem: cur, level: level });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcur = cur.parentNode;\n\t\t\t\t\tlevel++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn ret;\n\t\t}\n\n\t\t// String\n\t\tvar pos = POS.test( selectors ) || typeof selectors !== \"string\" ?\n\t\t\t\tjQuery( selectors, context || this.context ) :\n\t\t\t\t0;\n\n\t\tfor ( i = 0, l = this.length; i < l; i++ ) {\n\t\t\tcur = this[i];\n\n\t\t\twhile ( cur ) {\n\t\t\t\tif ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {\n\t\t\t\t\tret.push( cur );\n\t\t\t\t\tbreak;\n\n\t\t\t\t} else {\n\t\t\t\t\tcur = cur.parentNode;\n\t\t\t\t\tif ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tret = ret.length > 1 ? jQuery.unique( ret ) : ret;\n\n\t\treturn this.pushStack( ret, \"closest\", selectors );\n\t},\n\n\t// Determine the position of an element within\n\t// the matched set of elements\n\tindex: function( elem ) {\n\n\t\t// No argument, return index in parent\n\t\tif ( !elem ) {\n\t\t\treturn ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;\n\t\t}\n\n\t\t// index in selector\n\t\tif ( typeof elem === \"string\" ) {\n\t\t\treturn jQuery.inArray( this[0], jQuery( elem ) );\n\t\t}\n\n\t\t// Locate the position of the desired element\n\t\treturn jQuery.inArray(\n\t\t\t// If it receives a jQuery object, the first element is used\n\t\t\telem.jquery ? elem[0] : elem, this );\n\t},\n\n\tadd: function( selector, context ) {\n\t\tvar set = typeof selector === \"string\" ?\n\t\t\t\tjQuery( selector, context ) :\n\t\t\t\tjQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),\n\t\t\tall = jQuery.merge( this.get(), set );\n\n\t\treturn this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?\n\t\t\tall :\n\t\t\tjQuery.unique( all ) );\n\t},\n\n\tandSelf: function() {\n\t\treturn this.add( this.prevObject );\n\t}\n});\n\n// A painfully simple check to see if an element is disconnected\n// from a document (should be improved, where feasible).\nfunction isDisconnected( node ) {\n\treturn !node || !node.parentNode || node.parentNode.nodeType === 11;\n}\n\njQuery.each({\n\tparent: function( elem ) {\n\t\tvar parent = elem.parentNode;\n\t\treturn parent && parent.nodeType !== 11 ? parent : null;\n\t},\n\tparents: function( elem ) {\n\t\treturn jQuery.dir( elem, \"parentNode\" );\n\t},\n\tparentsUntil: function( elem, i, until ) {\n\t\treturn jQuery.dir( elem, \"parentNode\", until );\n\t},\n\tnext: function( elem ) {\n\t\treturn jQuery.nth( elem, 2, \"nextSibling\" );\n\t},\n\tprev: function( elem ) {\n\t\treturn jQuery.nth( elem, 2, \"previousSibling\" );\n\t},\n\tnextAll: function( elem ) {\n\t\treturn jQuery.dir( elem, \"nextSibling\" );\n\t},\n\tprevAll: function( elem ) {\n\t\treturn jQuery.dir( elem, \"previousSibling\" );\n\t},\n\tnextUntil: function( elem, i, until ) {\n\t\treturn jQuery.dir( elem, \"nextSibling\", until );\n\t},\n\tprevUntil: function( elem, i, until ) {\n\t\treturn jQuery.dir( elem, \"previousSibling\", until );\n\t},\n\tsiblings: function( elem ) {\n\t\treturn jQuery.sibling( elem.parentNode.firstChild, elem );\n\t},\n\tchildren: function( elem ) {\n\t\treturn jQuery.sibling( elem.firstChild );\n\t},\n\tcontents: function( elem ) {\n\t\treturn jQuery.nodeName( elem, \"iframe\" ) ?\n\t\t\telem.contentDocument || elem.contentWindow.document :\n\t\t\tjQuery.makeArray( elem.childNodes );\n\t}\n}, function( name, fn ) {\n\tjQuery.fn[ name ] = function( until, selector ) {\n\t\tvar ret = jQuery.map( this, fn, until ),\n\t\t\t// The variable 'args' was introduced in\n\t\t\t// https://github.com/jquery/jquery/commit/52a0238\n\t\t\t// to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.\n\t\t\t// http://code.google.com/p/v8/issues/detail?id=1050\n\t\t\targs = slice.call(arguments);\n\n\t\tif ( !runtil.test( name ) ) {\n\t\t\tselector = until;\n\t\t}\n\n\t\tif ( selector && typeof selector === \"string\" ) {\n\t\t\tret = jQuery.filter( selector, ret );\n\t\t}\n\n\t\tret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;\n\n\t\tif ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {\n\t\t\tret = ret.reverse();\n\t\t}\n\n\t\treturn this.pushStack( ret, name, args.join(\",\") );\n\t};\n});\n\njQuery.extend({\n\tfilter: function( expr, elems, not ) {\n\t\tif ( not ) {\n\t\t\texpr = \":not(\" + expr + \")\";\n\t\t}\n\n\t\treturn elems.length === 1 ?\n\t\t\tjQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :\n\t\t\tjQuery.find.matches(expr, elems);\n\t},\n\n\tdir: function( elem, dir, until ) {\n\t\tvar matched = [],\n\t\t\tcur = elem[ dir ];\n\n\t\twhile ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {\n\t\t\tif ( cur.nodeType === 1 ) {\n\t\t\t\tmatched.push( cur );\n\t\t\t}\n\t\t\tcur = cur[dir];\n\t\t}\n\t\treturn matched;\n\t},\n\n\tnth: function( cur, result, dir, elem ) {\n\t\tresult = result || 1;\n\t\tvar num = 0;\n\n\t\tfor ( ; cur; cur = cur[dir] ) {\n\t\t\tif ( cur.nodeType === 1 && ++num === result ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn cur;\n\t},\n\n\tsibling: function( n, elem ) {\n\t\tvar r = [];\n\n\t\tfor ( ; n; n = n.nextSibling ) {\n\t\t\tif ( n.nodeType === 1 && n !== elem ) {\n\t\t\t\tr.push( n );\n\t\t\t}\n\t\t}\n\n\t\treturn r;\n\t}\n});\n\n// Implement the identical functionality for filter and not\nfunction winnow( elements, qualifier, keep ) {\n\n\t// Can't pass null or undefined to indexOf in Firefox 4\n\t// Set to 0 to skip string check\n\tqualifier = qualifier || 0;\n\n\tif ( jQuery.isFunction( qualifier ) ) {\n\t\treturn jQuery.grep(elements, function( elem, i ) {\n\t\t\tvar retVal = !!qualifier.call( elem, i, elem );\n\t\t\treturn retVal === keep;\n\t\t});\n\n\t} else if ( qualifier.nodeType ) {\n\t\treturn jQuery.grep(elements, function( elem, i ) {\n\t\t\treturn (elem === qualifier) === keep;\n\t\t});\n\n\t} else if ( typeof qualifier === \"string\" ) {\n\t\tvar filtered = jQuery.grep(elements, function( elem ) {\n\t\t\treturn elem.nodeType === 1;\n\t\t});\n\n\t\tif ( isSimple.test( qualifier ) ) {\n\t\t\treturn jQuery.filter(qualifier, filtered, !keep);\n\t\t} else {\n\t\t\tqualifier = jQuery.filter( qualifier, filtered );\n\t\t}\n\t}\n\n\treturn jQuery.grep(elements, function( elem, i ) {\n\t\treturn (jQuery.inArray( elem, qualifier ) >= 0) === keep;\n\t});\n}\n\n\n\n\nvar rinlinejQuery = / jQuery\\d+=\"(?:\\d+|null)\"/g,\n\trleadingWhitespace = /^\\s+/,\n\trxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:]+)[^>]*)\\/>/ig,\n\trtagName = /<([\\w:]+)/,\n\trtbody = /<tbody/i,\n\trhtml = /<|&#?\\w+;/,\n\trnocache = /<(?:script|object|embed|option|style)/i,\n\t// checked=\"checked\" or checked\n\trchecked = /checked\\s*(?:[^=]|=\\s*.checked.)/i,\n\trscriptType = /\\/(java|ecma)script/i,\n\trcleanScript = /^\\s*<!(?:\\[CDATA\\[|\\-\\-)/,\n\twrapMap = {\n\t\toption: [ 1, \"<select multiple='multiple'>\", \"</select>\" ],\n\t\tlegend: [ 1, \"<fieldset>\", \"</fieldset>\" ],\n\t\tthead: [ 1, \"<table>\", \"</table>\" ],\n\t\ttr: [ 2, \"<table><tbody>\", \"</tbody></table>\" ],\n\t\ttd: [ 3, \"<table><tbody><tr>\", \"</tr></tbody></table>\" ],\n\t\tcol: [ 2, \"<table><tbody></tbody><colgroup>\", \"</colgroup></table>\" ],\n\t\tarea: [ 1, \"<map>\", \"</map>\" ],\n\t\t_default: [ 0, \"\", \"\" ]\n\t};\n\nwrapMap.optgroup = wrapMap.option;\nwrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\nwrapMap.th = wrapMap.td;\n\n// IE can't serialize <link> and <script> tags normally\nif ( !jQuery.support.htmlSerialize ) {\n\twrapMap._default = [ 1, \"div<div>\", \"</div>\" ];\n}\n\njQuery.fn.extend({\n\ttext: function( text ) {\n\t\tif ( jQuery.isFunction(text) ) {\n\t\t\treturn this.each(function(i) {\n\t\t\t\tvar self = jQuery( this );\n\n\t\t\t\tself.text( text.call(this, i, self.text()) );\n\t\t\t});\n\t\t}\n\n\t\tif ( typeof text !== \"object\" && text !== undefined ) {\n\t\t\treturn this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );\n\t\t}\n\n\t\treturn jQuery.text( this );\n\t},\n\n\twrapAll: function( html ) {\n\t\tif ( jQuery.isFunction( html ) ) {\n\t\t\treturn this.each(function(i) {\n\t\t\t\tjQuery(this).wrapAll( html.call(this, i) );\n\t\t\t});\n\t\t}\n\n\t\tif ( this[0] ) {\n\t\t\t// The elements to wrap the target around\n\t\t\tvar wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);\n\n\t\t\tif ( this[0].parentNode ) {\n\t\t\t\twrap.insertBefore( this[0] );\n\t\t\t}\n\n\t\t\twrap.map(function() {\n\t\t\t\tvar elem = this;\n\n\t\t\t\twhile ( elem.firstChild && elem.firstChild.nodeType === 1 ) {\n\t\t\t\t\telem = elem.firstChild;\n\t\t\t\t}\n\n\t\t\t\treturn elem;\n\t\t\t}).append( this );\n\t\t}\n\n\t\treturn this;\n\t},\n\n\twrapInner: function( html ) {\n\t\tif ( jQuery.isFunction( html ) ) {\n\t\t\treturn this.each(function(i) {\n\t\t\t\tjQuery(this).wrapInner( html.call(this, i) );\n\t\t\t});\n\t\t}\n\n\t\treturn this.each(function() {\n\t\t\tvar self = jQuery( this ),\n\t\t\t\tcontents = self.contents();\n\n\t\t\tif ( contents.length ) {\n\t\t\t\tcontents.wrapAll( html );\n\n\t\t\t} else {\n\t\t\t\tself.append( html );\n\t\t\t}\n\t\t});\n\t},\n\n\twrap: function( html ) {\n\t\treturn this.each(function() {\n\t\t\tjQuery( this ).wrapAll( html );\n\t\t});\n\t},\n\n\tunwrap: function() {\n\t\treturn this.parent().each(function() {\n\t\t\tif ( !jQuery.nodeName( this, \"body\" ) ) {\n\t\t\t\tjQuery( this ).replaceWith( this.childNodes );\n\t\t\t}\n\t\t}).end();\n\t},\n\n\tappend: function() {\n\t\treturn this.domManip(arguments, true, function( elem ) {\n\t\t\tif ( this.nodeType === 1 ) {\n\t\t\t\tthis.appendChild( elem );\n\t\t\t}\n\t\t});\n\t},\n\n\tprepend: function() {\n\t\treturn this.domManip(arguments, true, function( elem ) {\n\t\t\tif ( this.nodeType === 1 ) {\n\t\t\t\tthis.insertBefore( elem, this.firstChild );\n\t\t\t}\n\t\t});\n\t},\n\n\tbefore: function() {\n\t\tif ( this[0] && this[0].parentNode ) {\n\t\t\treturn this.domManip(arguments, false, function( elem ) {\n\t\t\t\tthis.parentNode.insertBefore( elem, this );\n\t\t\t});\n\t\t} else if ( arguments.length ) {\n\t\t\tvar set = jQuery(arguments[0]);\n\t\t\tset.push.apply( set, this.toArray() );\n\t\t\treturn this.pushStack( set, \"before\", arguments );\n\t\t}\n\t},\n\n\tafter: function() {\n\t\tif ( this[0] && this[0].parentNode ) {\n\t\t\treturn this.domManip(arguments, false, function( elem ) {\n\t\t\t\tthis.parentNode.insertBefore( elem, this.nextSibling );\n\t\t\t});\n\t\t} else if ( arguments.length ) {\n\t\t\tvar set = this.pushStack( this, \"after\", arguments );\n\t\t\tset.push.apply( set, jQuery(arguments[0]).toArray() );\n\t\t\treturn set;\n\t\t}\n\t},\n\n\t// keepData is for internal use only--do not document\n\tremove: function( selector, keepData ) {\n\t\tfor ( var i = 0, elem; (elem = this[i]) != null; i++ ) {\n\t\t\tif ( !selector || jQuery.filter( selector, [ elem ] ).length ) {\n\t\t\t\tif ( !keepData && elem.nodeType === 1 ) {\n\t\t\t\t\tjQuery.cleanData( elem.getElementsByTagName(\"*\") );\n\t\t\t\t\tjQuery.cleanData( [ elem ] );\n\t\t\t\t}\n\n\t\t\t\tif ( elem.parentNode ) {\n\t\t\t\t\telem.parentNode.removeChild( elem );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tempty: function() {\n\t\tfor ( var i = 0, elem; (elem = this[i]) != null; i++ ) {\n\t\t\t// Remove element nodes and prevent memory leaks\n\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\tjQuery.cleanData( elem.getElementsByTagName(\"*\") );\n\t\t\t}\n\n\t\t\t// Remove any remaining nodes\n\t\t\twhile ( elem.firstChild ) {\n\t\t\t\telem.removeChild( elem.firstChild );\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tclone: function( dataAndEvents, deepDataAndEvents ) {\n\t\tdataAndEvents = dataAndEvents == null ? false : dataAndEvents;\n\t\tdeepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;\n\n\t\treturn this.map( function () {\n\t\t\treturn jQuery.clone( this, dataAndEvents, deepDataAndEvents );\n\t\t});\n\t},\n\n\thtml: function( value ) {\n\t\tif ( value === undefined ) {\n\t\t\treturn this[0] && this[0].nodeType === 1 ?\n\t\t\t\tthis[0].innerHTML.replace(rinlinejQuery, \"\") :\n\t\t\t\tnull;\n\n\t\t// See if we can take a shortcut and just use innerHTML\n\t\t} else if ( typeof value === \"string\" && !rnocache.test( value ) &&\n\t\t\t(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&\n\t\t\t!wrapMap[ (rtagName.exec( value ) || [\"\", \"\"])[1].toLowerCase() ] ) {\n\n\t\t\tvalue = value.replace(rxhtmlTag, \"<$1></$2>\");\n\n\t\t\ttry {\n\t\t\t\tfor ( var i = 0, l = this.length; i < l; i++ ) {\n\t\t\t\t\t// Remove element nodes and prevent memory leaks\n\t\t\t\t\tif ( this[i].nodeType === 1 ) {\n\t\t\t\t\t\tjQuery.cleanData( this[i].getElementsByTagName(\"*\") );\n\t\t\t\t\t\tthis[i].innerHTML = value;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t// If using innerHTML throws an exception, use the fallback method\n\t\t\t} catch(e) {\n\t\t\t\tthis.empty().append( value );\n\t\t\t}\n\n\t\t} else if ( jQuery.isFunction( value ) ) {\n\t\t\tthis.each(function(i){\n\t\t\t\tvar self = jQuery( this );\n\n\t\t\t\tself.html( value.call(this, i, self.html()) );\n\t\t\t});\n\n\t\t} else {\n\t\t\tthis.empty().append( value );\n\t\t}\n\n\t\treturn this;\n\t},\n\n\treplaceWith: function( value ) {\n\t\tif ( this[0] && this[0].parentNode ) {\n\t\t\t// Make sure that the elements are removed from the DOM before they are inserted\n\t\t\t// this can help fix replacing a parent with child elements\n\t\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\t\treturn this.each(function(i) {\n\t\t\t\t\tvar self = jQuery(this), old = self.html();\n\t\t\t\t\tself.replaceWith( value.call( this, i, old ) );\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif ( typeof value !== \"string\" ) {\n\t\t\t\tvalue = jQuery( value ).detach();\n\t\t\t}\n\n\t\t\treturn this.each(function() {\n\t\t\t\tvar next = this.nextSibling,\n\t\t\t\t\tparent = this.parentNode;\n\n\t\t\t\tjQuery( this ).remove();\n\n\t\t\t\tif ( next ) {\n\t\t\t\t\tjQuery(next).before( value );\n\t\t\t\t} else {\n\t\t\t\t\tjQuery(parent).append( value );\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\treturn this.length ?\n\t\t\t\tthis.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), \"replaceWith\", value ) :\n\t\t\t\tthis;\n\t\t}\n\t},\n\n\tdetach: function( selector ) {\n\t\treturn this.remove( selector, true );\n\t},\n\n\tdomManip: function( args, table, callback ) {\n\t\tvar results, first, fragment, parent,\n\t\t\tvalue = args[0],\n\t\t\tscripts = [];\n\n\t\t// We can't cloneNode fragments that contain checked, in WebKit\n\t\tif ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === \"string\" && rchecked.test( value ) ) {\n\t\t\treturn this.each(function() {\n\t\t\t\tjQuery(this).domManip( args, table, callback, true );\n\t\t\t});\n\t\t}\n\n\t\tif ( jQuery.isFunction(value) ) {\n\t\t\treturn this.each(function(i) {\n\t\t\t\tvar self = jQuery(this);\n\t\t\t\targs[0] = value.call(this, i, table ? self.html() : undefined);\n\t\t\t\tself.domManip( args, table, callback );\n\t\t\t});\n\t\t}\n\n\t\tif ( this[0] ) {\n\t\t\tparent = value && value.parentNode;\n\n\t\t\t// If we're in a fragment, just use that instead of building a new one\n\t\t\tif ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {\n\t\t\t\tresults = { fragment: parent };\n\n\t\t\t} else {\n\t\t\t\tresults = jQuery.buildFragment( args, this, scripts );\n\t\t\t}\n\n\t\t\tfragment = results.fragment;\n\n\t\t\tif ( fragment.childNodes.length === 1 ) {\n\t\t\t\tfirst = fragment = fragment.firstChild;\n\t\t\t} else {\n\t\t\t\tfirst = fragment.firstChild;\n\t\t\t}\n\n\t\t\tif ( first ) {\n\t\t\t\ttable = table && jQuery.nodeName( first, \"tr\" );\n\n\t\t\t\tfor ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {\n\t\t\t\t\tcallback.call(\n\t\t\t\t\t\ttable ?\n\t\t\t\t\t\t\troot(this[i], first) :\n\t\t\t\t\t\t\tthis[i],\n\t\t\t\t\t\t// Make sure that we do not leak memory by inadvertently discarding\n\t\t\t\t\t\t// the original fragment (which might have attached data) instead of\n\t\t\t\t\t\t// using it; in addition, use the original fragment object for the last\n\t\t\t\t\t\t// item instead of first because it can end up being emptied incorrectly\n\t\t\t\t\t\t// in certain situations (Bug #8070).\n\t\t\t\t\t\t// Fragments from the fragment cache must always be cloned and never used\n\t\t\t\t\t\t// in place.\n\t\t\t\t\t\tresults.cacheable || (l > 1 && i < lastIndex) ?\n\t\t\t\t\t\t\tjQuery.clone( fragment, true, true ) :\n\t\t\t\t\t\t\tfragment\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( scripts.length ) {\n\t\t\t\tjQuery.each( scripts, evalScript );\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n});\n\nfunction root( elem, cur ) {\n\treturn jQuery.nodeName(elem, \"table\") ?\n\t\t(elem.getElementsByTagName(\"tbody\")[0] ||\n\t\telem.appendChild(elem.ownerDocument.createElement(\"tbody\"))) :\n\t\telem;\n}\n\nfunction cloneCopyEvent( src, dest ) {\n\n\tif ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {\n\t\treturn;\n\t}\n\n\tvar internalKey = jQuery.expando,\n\t\toldData = jQuery.data( src ),\n\t\tcurData = jQuery.data( dest, oldData );\n\n\t// Switch to use the internal data object, if it exists, for the next\n\t// stage of data copying\n\tif ( (oldData = oldData[ internalKey ]) ) {\n\t\tvar events = oldData.events;\n\t\t\t\tcurData = curData[ internalKey ] = jQuery.extend({}, oldData);\n\n\t\tif ( events ) {\n\t\t\tdelete curData.handle;\n\t\t\tcurData.events = {};\n\n\t\t\tfor ( var type in events ) {\n\t\t\t\tfor ( var i = 0, l = events[ type ].length; i < l; i++ ) {\n\t\t\t\t\tjQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? \".\" : \"\" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction cloneFixAttributes( src, dest ) {\n\tvar nodeName;\n\n\t// We do not need to do anything for non-Elements\n\tif ( dest.nodeType !== 1 ) {\n\t\treturn;\n\t}\n\n\t// clearAttributes removes the attributes, which we don't want,\n\t// but also removes the attachEvent events, which we *do* want\n\tif ( dest.clearAttributes ) {\n\t\tdest.clearAttributes();\n\t}\n\n\t// mergeAttributes, in contrast, only merges back on the\n\t// original attributes, not the events\n\tif ( dest.mergeAttributes ) {\n\t\tdest.mergeAttributes( src );\n\t}\n\n\tnodeName = dest.nodeName.toLowerCase();\n\n\t// IE6-8 fail to clone children inside object elements that use\n\t// the proprietary classid attribute value (rather than the type\n\t// attribute) to identify the type of content to display\n\tif ( nodeName === \"object\" ) {\n\t\tdest.outerHTML = src.outerHTML;\n\n\t} else if ( nodeName === \"input\" && (src.type === \"checkbox\" || src.type === \"radio\") ) {\n\t\t// IE6-8 fails to persist the checked state of a cloned checkbox\n\t\t// or radio button. Worse, IE6-7 fail to give the cloned element\n\t\t// a checked appearance if the defaultChecked value isn't also set\n\t\tif ( src.checked ) {\n\t\t\tdest.defaultChecked = dest.checked = src.checked;\n\t\t}\n\n\t\t// IE6-7 get confused and end up setting the value of a cloned\n\t\t// checkbox/radio button to an empty string instead of \"on\"\n\t\tif ( dest.value !== src.value ) {\n\t\t\tdest.value = src.value;\n\t\t}\n\n\t// IE6-8 fails to return the selected option to the default selected\n\t// state when cloning options\n\t} else if ( nodeName === \"option\" ) {\n\t\tdest.selected = src.defaultSelected;\n\n\t// IE6-8 fails to set the defaultValue to the correct value when\n\t// cloning other types of input fields\n\t} else if ( nodeName === \"input\" || nodeName === \"textarea\" ) {\n\t\tdest.defaultValue = src.defaultValue;\n\t}\n\n\t// Event data gets referenced instead of copied if the expando\n\t// gets copied too\n\tdest.removeAttribute( jQuery.expando );\n}\n\njQuery.buildFragment = function( args, nodes, scripts ) {\n\tvar fragment, cacheable, cacheresults, doc;\n\n  // nodes may contain either an explicit document object,\n  // a jQuery collection or context object.\n  // If nodes[0] contains a valid object to assign to doc\n  if ( nodes && nodes[0] ) {\n    doc = nodes[0].ownerDocument || nodes[0];\n  }\n\n  // Ensure that an attr object doesn't incorrectly stand in as a document object\n\t// Chrome and Firefox seem to allow this to occur and will throw exception\n\t// Fixes #8950\n\tif ( !doc.createDocumentFragment ) {\n\t\tdoc = document;\n\t}\n\n\t// Only cache \"small\" (1/2 KB) HTML strings that are associated with the main document\n\t// Cloning options loses the selected state, so don't cache them\n\t// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment\n\t// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache\n\tif ( args.length === 1 && typeof args[0] === \"string\" && args[0].length < 512 && doc === document &&\n\t\targs[0].charAt(0) === \"<\" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) {\n\n\t\tcacheable = true;\n\n\t\tcacheresults = jQuery.fragments[ args[0] ];\n\t\tif ( cacheresults && cacheresults !== 1 ) {\n\t\t\tfragment = cacheresults;\n\t\t}\n\t}\n\n\tif ( !fragment ) {\n\t\tfragment = doc.createDocumentFragment();\n\t\tjQuery.clean( args, doc, fragment, scripts );\n\t}\n\n\tif ( cacheable ) {\n\t\tjQuery.fragments[ args[0] ] = cacheresults ? fragment : 1;\n\t}\n\n\treturn { fragment: fragment, cacheable: cacheable };\n};\n\njQuery.fragments = {};\n\njQuery.each({\n\tappendTo: \"append\",\n\tprependTo: \"prepend\",\n\tinsertBefore: \"before\",\n\tinsertAfter: \"after\",\n\treplaceAll: \"replaceWith\"\n}, function( name, original ) {\n\tjQuery.fn[ name ] = function( selector ) {\n\t\tvar ret = [],\n\t\t\tinsert = jQuery( selector ),\n\t\t\tparent = this.length === 1 && this[0].parentNode;\n\n\t\tif ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {\n\t\t\tinsert[ original ]( this[0] );\n\t\t\treturn this;\n\n\t\t} else {\n\t\t\tfor ( var i = 0, l = insert.length; i < l; i++ ) {\n\t\t\t\tvar elems = (i > 0 ? this.clone(true) : this).get();\n\t\t\t\tjQuery( insert[i] )[ original ]( elems );\n\t\t\t\tret = ret.concat( elems );\n\t\t\t}\n\n\t\t\treturn this.pushStack( ret, name, insert.selector );\n\t\t}\n\t};\n});\n\nfunction getAll( elem ) {\n\tif ( \"getElementsByTagName\" in elem ) {\n\t\treturn elem.getElementsByTagName( \"*\" );\n\n\t} else if ( \"querySelectorAll\" in elem ) {\n\t\treturn elem.querySelectorAll( \"*\" );\n\n\t} else {\n\t\treturn [];\n\t}\n}\n\n// Used in clean, fixes the defaultChecked property\nfunction fixDefaultChecked( elem ) {\n\tif ( elem.type === \"checkbox\" || elem.type === \"radio\" ) {\n\t\telem.defaultChecked = elem.checked;\n\t}\n}\n// Finds all inputs and passes them to fixDefaultChecked\nfunction findInputs( elem ) {\n\tif ( jQuery.nodeName( elem, \"input\" ) ) {\n\t\tfixDefaultChecked( elem );\n\t} else if ( \"getElementsByTagName\" in elem ) {\n\t\tjQuery.grep( elem.getElementsByTagName(\"input\"), fixDefaultChecked );\n\t}\n}\n\njQuery.extend({\n\tclone: function( elem, dataAndEvents, deepDataAndEvents ) {\n\t\tvar clone = elem.cloneNode(true),\n\t\t\t\tsrcElements,\n\t\t\t\tdestElements,\n\t\t\t\ti;\n\n\t\tif ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&\n\t\t\t\t(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {\n\t\t\t// IE copies events bound via attachEvent when using cloneNode.\n\t\t\t// Calling detachEvent on the clone will also remove the events\n\t\t\t// from the original. In order to get around this, we use some\n\t\t\t// proprietary methods to clear the events. Thanks to MooTools\n\t\t\t// guys for this hotness.\n\n\t\t\tcloneFixAttributes( elem, clone );\n\n\t\t\t// Using Sizzle here is crazy slow, so we use getElementsByTagName\n\t\t\t// instead\n\t\t\tsrcElements = getAll( elem );\n\t\t\tdestElements = getAll( clone );\n\n\t\t\t// Weird iteration because IE will replace the length property\n\t\t\t// with an element if you are cloning the body and one of the\n\t\t\t// elements on the page has a name or id of \"length\"\n\t\t\tfor ( i = 0; srcElements[i]; ++i ) {\n\t\t\t\t// Ensure that the destination node is not null; Fixes #9587\n\t\t\t\tif ( destElements[i] ) {\n\t\t\t\t\tcloneFixAttributes( srcElements[i], destElements[i] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Copy the events from the original to the clone\n\t\tif ( dataAndEvents ) {\n\t\t\tcloneCopyEvent( elem, clone );\n\n\t\t\tif ( deepDataAndEvents ) {\n\t\t\t\tsrcElements = getAll( elem );\n\t\t\t\tdestElements = getAll( clone );\n\n\t\t\t\tfor ( i = 0; srcElements[i]; ++i ) {\n\t\t\t\t\tcloneCopyEvent( srcElements[i], destElements[i] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsrcElements = destElements = null;\n\n\t\t// Return the cloned set\n\t\treturn clone;\n\t},\n\n\tclean: function( elems, context, fragment, scripts ) {\n\t\tvar checkScriptType;\n\n\t\tcontext = context || document;\n\n\t\t// !context.createElement fails in IE with an error but returns typeof 'object'\n\t\tif ( typeof context.createElement === \"undefined\" ) {\n\t\t\tcontext = context.ownerDocument || context[0] && context[0].ownerDocument || document;\n\t\t}\n\n\t\tvar ret = [], j;\n\n\t\tfor ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {\n\t\t\tif ( typeof elem === \"number\" ) {\n\t\t\t\telem += \"\";\n\t\t\t}\n\n\t\t\tif ( !elem ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Convert html string into DOM nodes\n\t\t\tif ( typeof elem === \"string\" ) {\n\t\t\t\tif ( !rhtml.test( elem ) ) {\n\t\t\t\t\telem = context.createTextNode( elem );\n\t\t\t\t} else {\n\t\t\t\t\t// Fix \"XHTML\"-style tags in all browsers\n\t\t\t\t\telem = elem.replace(rxhtmlTag, \"<$1></$2>\");\n\n\t\t\t\t\t// Trim whitespace, otherwise indexOf won't work as expected\n\t\t\t\t\tvar tag = (rtagName.exec( elem ) || [\"\", \"\"])[1].toLowerCase(),\n\t\t\t\t\t\twrap = wrapMap[ tag ] || wrapMap._default,\n\t\t\t\t\t\tdepth = wrap[0],\n\t\t\t\t\t\tdiv = context.createElement(\"div\");\n\n\t\t\t\t\t// Go to html and back, then peel off extra wrappers\n\t\t\t\t\tdiv.innerHTML = wrap[1] + elem + wrap[2];\n\n\t\t\t\t\t// Move to the right depth\n\t\t\t\t\twhile ( depth-- ) {\n\t\t\t\t\t\tdiv = div.lastChild;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Remove IE's autoinserted <tbody> from table fragments\n\t\t\t\t\tif ( !jQuery.support.tbody ) {\n\n\t\t\t\t\t\t// String was a <table>, *may* have spurious <tbody>\n\t\t\t\t\t\tvar hasBody = rtbody.test(elem),\n\t\t\t\t\t\t\ttbody = tag === \"table\" && !hasBody ?\n\t\t\t\t\t\t\t\tdiv.firstChild && div.firstChild.childNodes :\n\n\t\t\t\t\t\t\t\t// String was a bare <thead> or <tfoot>\n\t\t\t\t\t\t\t\twrap[1] === \"<table>\" && !hasBody ?\n\t\t\t\t\t\t\t\t\tdiv.childNodes :\n\t\t\t\t\t\t\t\t\t[];\n\n\t\t\t\t\t\tfor ( j = tbody.length - 1; j >= 0 ; --j ) {\n\t\t\t\t\t\t\tif ( jQuery.nodeName( tbody[ j ], \"tbody\" ) && !tbody[ j ].childNodes.length ) {\n\t\t\t\t\t\t\t\ttbody[ j ].parentNode.removeChild( tbody[ j ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// IE completely kills leading whitespace when innerHTML is used\n\t\t\t\t\tif ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {\n\t\t\t\t\t\tdiv.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );\n\t\t\t\t\t}\n\n\t\t\t\t\telem = div.childNodes;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Resets defaultChecked for any radios and checkboxes\n\t\t\t// about to be appended to the DOM in IE 6/7 (#8060)\n\t\t\tvar len;\n\t\t\tif ( !jQuery.support.appendChecked ) {\n\t\t\t\tif ( elem[0] && typeof (len = elem.length) === \"number\" ) {\n\t\t\t\t\tfor ( j = 0; j < len; j++ ) {\n\t\t\t\t\t\tfindInputs( elem[j] );\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfindInputs( elem );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( elem.nodeType ) {\n\t\t\t\tret.push( elem );\n\t\t\t} else {\n\t\t\t\tret = jQuery.merge( ret, elem );\n\t\t\t}\n\t\t}\n\n\t\tif ( fragment ) {\n\t\t\tcheckScriptType = function( elem ) {\n\t\t\t\treturn !elem.type || rscriptType.test( elem.type );\n\t\t\t};\n\t\t\tfor ( i = 0; ret[i]; i++ ) {\n\t\t\t\tif ( scripts && jQuery.nodeName( ret[i], \"script\" ) && (!ret[i].type || ret[i].type.toLowerCase() === \"text/javascript\") ) {\n\t\t\t\t\tscripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );\n\n\t\t\t\t} else {\n\t\t\t\t\tif ( ret[i].nodeType === 1 ) {\n\t\t\t\t\t\tvar jsTags = jQuery.grep( ret[i].getElementsByTagName( \"script\" ), checkScriptType );\n\n\t\t\t\t\t\tret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );\n\t\t\t\t\t}\n\t\t\t\t\tfragment.appendChild( ret[i] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\tcleanData: function( elems ) {\n\t\tvar data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,\n\t\t\tdeleteExpando = jQuery.support.deleteExpando;\n\n\t\tfor ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {\n\t\t\tif ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tid = elem[ jQuery.expando ];\n\n\t\t\tif ( id ) {\n\t\t\t\tdata = cache[ id ] && cache[ id ][ internalKey ];\n\n\t\t\t\tif ( data && data.events ) {\n\t\t\t\t\tfor ( var type in data.events ) {\n\t\t\t\t\t\tif ( special[ type ] ) {\n\t\t\t\t\t\t\tjQuery.event.remove( elem, type );\n\n\t\t\t\t\t\t// This is a shortcut to avoid jQuery.event.remove's overhead\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tjQuery.removeEvent( elem, type, data.handle );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Null the DOM reference to avoid IE6/7/8 leak (#7054)\n\t\t\t\t\tif ( data.handle ) {\n\t\t\t\t\t\tdata.handle.elem = null;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( deleteExpando ) {\n\t\t\t\t\tdelete elem[ jQuery.expando ];\n\n\t\t\t\t} else if ( elem.removeAttribute ) {\n\t\t\t\t\telem.removeAttribute( jQuery.expando );\n\t\t\t\t}\n\n\t\t\t\tdelete cache[ id ];\n\t\t\t}\n\t\t}\n\t}\n});\n\nfunction evalScript( i, elem ) {\n\tif ( elem.src ) {\n\t\tjQuery.ajax({\n\t\t\turl: elem.src,\n\t\t\tasync: false,\n\t\t\tdataType: \"script\"\n\t\t});\n\t} else {\n\t\tjQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || \"\" ).replace( rcleanScript, \"/*$0*/\" ) );\n\t}\n\n\tif ( elem.parentNode ) {\n\t\telem.parentNode.removeChild( elem );\n\t}\n}\n\n\n\n\nvar ralpha = /alpha\\([^)]*\\)/i,\n\tropacity = /opacity=([^)]*)/,\n\t// fixed for IE9, see #8346\n\trupper = /([A-Z]|^ms)/g,\n\trnumpx = /^-?\\d+(?:px)?$/i,\n\trnum = /^-?\\d/,\n\trrelNum = /^([\\-+])=([\\-+.\\de]+)/,\n\n\tcssShow = { position: \"absolute\", visibility: \"hidden\", display: \"block\" },\n\tcssWidth = [ \"Left\", \"Right\" ],\n\tcssHeight = [ \"Top\", \"Bottom\" ],\n\tcurCSS,\n\n\tgetComputedStyle,\n\tcurrentStyle;\n\njQuery.fn.css = function( name, value ) {\n\t// Setting 'undefined' is a no-op\n\tif ( arguments.length === 2 && value === undefined ) {\n\t\treturn this;\n\t}\n\n\treturn jQuery.access( this, name, value, true, function( elem, name, value ) {\n\t\treturn value !== undefined ?\n\t\t\tjQuery.style( elem, name, value ) :\n\t\t\tjQuery.css( elem, name );\n\t});\n};\n\njQuery.extend({\n\t// Add in style property hooks for overriding the default\n\t// behavior of getting and setting a style property\n\tcssHooks: {\n\t\topacity: {\n\t\t\tget: function( elem, computed ) {\n\t\t\t\tif ( computed ) {\n\t\t\t\t\t// We should always get a number back from opacity\n\t\t\t\t\tvar ret = curCSS( elem, \"opacity\", \"opacity\" );\n\t\t\t\t\treturn ret === \"\" ? \"1\" : ret;\n\n\t\t\t\t} else {\n\t\t\t\t\treturn elem.style.opacity;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\t// Exclude the following css properties to add px\n\tcssNumber: {\n\t\t\"fillOpacity\": true,\n\t\t\"fontWeight\": true,\n\t\t\"lineHeight\": true,\n\t\t\"opacity\": true,\n\t\t\"orphans\": true,\n\t\t\"widows\": true,\n\t\t\"zIndex\": true,\n\t\t\"zoom\": true\n\t},\n\n\t// Add in properties whose names you wish to fix before\n\t// setting or getting the value\n\tcssProps: {\n\t\t// normalize float css property\n\t\t\"float\": jQuery.support.cssFloat ? \"cssFloat\" : \"styleFloat\"\n\t},\n\n\t// Get and set the style property on a DOM Node\n\tstyle: function( elem, name, value, extra ) {\n\t\t// Don't set styles on text and comment nodes\n\t\tif ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Make sure that we're working with the right name\n\t\tvar ret, type, origName = jQuery.camelCase( name ),\n\t\t\tstyle = elem.style, hooks = jQuery.cssHooks[ origName ];\n\n\t\tname = jQuery.cssProps[ origName ] || origName;\n\n\t\t// Check if we're setting a value\n\t\tif ( value !== undefined ) {\n\t\t\ttype = typeof value;\n\n\t\t\t// convert relative number strings (+= or -=) to relative numbers. #7345\n\t\t\tif ( type === \"string\" && (ret = rrelNum.exec( value )) ) {\n\t\t\t\tvalue = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );\n\t\t\t\t// Fixes bug #9237\n\t\t\t\ttype = \"number\";\n\t\t\t}\n\n\t\t\t// Make sure that NaN and null values aren't set. See: #7116\n\t\t\tif ( value == null || type === \"number\" && isNaN( value ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If a number was passed in, add 'px' to the (except for certain CSS properties)\n\t\t\tif ( type === \"number\" && !jQuery.cssNumber[ origName ] ) {\n\t\t\t\tvalue += \"px\";\n\t\t\t}\n\n\t\t\t// If a hook was provided, use that value, otherwise just set the specified value\n\t\t\tif ( !hooks || !(\"set\" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {\n\t\t\t\t// Wrapped to prevent IE from throwing errors when 'invalid' values are provided\n\t\t\t\t// Fixes bug #5509\n\t\t\t\ttry {\n\t\t\t\t\tstyle[ name ] = value;\n\t\t\t\t} catch(e) {}\n\t\t\t}\n\n\t\t} else {\n\t\t\t// If a hook was provided get the non-computed value from there\n\t\t\tif ( hooks && \"get\" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\n\t\t\t// Otherwise just get the value from the style object\n\t\t\treturn style[ name ];\n\t\t}\n\t},\n\n\tcss: function( elem, name, extra ) {\n\t\tvar ret, hooks;\n\n\t\t// Make sure that we're working with the right name\n\t\tname = jQuery.camelCase( name );\n\t\thooks = jQuery.cssHooks[ name ];\n\t\tname = jQuery.cssProps[ name ] || name;\n\n\t\t// cssFloat needs a special treatment\n\t\tif ( name === \"cssFloat\" ) {\n\t\t\tname = \"float\";\n\t\t}\n\n\t\t// If a hook was provided get the computed value from there\n\t\tif ( hooks && \"get\" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {\n\t\t\treturn ret;\n\n\t\t// Otherwise, if a way to get the computed value exists, use that\n\t\t} else if ( curCSS ) {\n\t\t\treturn curCSS( elem, name );\n\t\t}\n\t},\n\n\t// A method for quickly swapping in/out CSS properties to get correct calculations\n\tswap: function( elem, options, callback ) {\n\t\tvar old = {};\n\n\t\t// Remember the old values, and insert the new ones\n\t\tfor ( var name in options ) {\n\t\t\told[ name ] = elem.style[ name ];\n\t\t\telem.style[ name ] = options[ name ];\n\t\t}\n\n\t\tcallback.call( elem );\n\n\t\t// Revert the old values\n\t\tfor ( name in options ) {\n\t\t\telem.style[ name ] = old[ name ];\n\t\t}\n\t}\n});\n\n// DEPRECATED, Use jQuery.css() instead\njQuery.curCSS = jQuery.css;\n\njQuery.each([\"height\", \"width\"], function( i, name ) {\n\tjQuery.cssHooks[ name ] = {\n\t\tget: function( elem, computed, extra ) {\n\t\t\tvar val;\n\n\t\t\tif ( computed ) {\n\t\t\t\tif ( elem.offsetWidth !== 0 ) {\n\t\t\t\t\treturn getWH( elem, name, extra );\n\t\t\t\t} else {\n\t\t\t\t\tjQuery.swap( elem, cssShow, function() {\n\t\t\t\t\t\tval = getWH( elem, name, extra );\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\treturn val;\n\t\t\t}\n\t\t},\n\n\t\tset: function( elem, value ) {\n\t\t\tif ( rnumpx.test( value ) ) {\n\t\t\t\t// ignore negative width and height values #1599\n\t\t\t\tvalue = parseFloat( value );\n\n\t\t\t\tif ( value >= 0 ) {\n\t\t\t\t\treturn value + \"px\";\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\treturn value;\n\t\t\t}\n\t\t}\n\t};\n});\n\nif ( !jQuery.support.opacity ) {\n\tjQuery.cssHooks.opacity = {\n\t\tget: function( elem, computed ) {\n\t\t\t// IE uses filters for opacity\n\t\t\treturn ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || \"\" ) ?\n\t\t\t\t( parseFloat( RegExp.$1 ) / 100 ) + \"\" :\n\t\t\t\tcomputed ? \"1\" : \"\";\n\t\t},\n\n\t\tset: function( elem, value ) {\n\t\t\tvar style = elem.style,\n\t\t\t\tcurrentStyle = elem.currentStyle,\n\t\t\t\topacity = jQuery.isNaN( value ) ? \"\" : \"alpha(opacity=\" + value * 100 + \")\",\n\t\t\t\tfilter = currentStyle && currentStyle.filter || style.filter || \"\";\n\n\t\t\t// IE has trouble with opacity if it does not have layout\n\t\t\t// Force it by setting the zoom level\n\t\t\tstyle.zoom = 1;\n\n\t\t\t// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652\n\t\t\tif ( value >= 1 && jQuery.trim( filter.replace( ralpha, \"\" ) ) === \"\" ) {\n\n\t\t\t\t// Setting style.filter to null, \"\" & \" \" still leave \"filter:\" in the cssText\n\t\t\t\t// if \"filter:\" is present at all, clearType is disabled, we want to avoid this\n\t\t\t\t// style.removeAttribute is IE Only, but so apparently is this code path...\n\t\t\t\tstyle.removeAttribute( \"filter\" );\n\n\t\t\t\t// if there there is no filter style applied in a css rule, we are done\n\t\t\t\tif ( currentStyle && !currentStyle.filter ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// otherwise, set new filter values\n\t\t\tstyle.filter = ralpha.test( filter ) ?\n\t\t\t\tfilter.replace( ralpha, opacity ) :\n\t\t\t\tfilter + \" \" + opacity;\n\t\t}\n\t};\n}\n\njQuery(function() {\n\t// This hook cannot be added until DOM ready because the support test\n\t// for it is not run until after DOM ready\n\tif ( !jQuery.support.reliableMarginRight ) {\n\t\tjQuery.cssHooks.marginRight = {\n\t\t\tget: function( elem, computed ) {\n\t\t\t\t// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right\n\t\t\t\t// Work around by temporarily setting element display to inline-block\n\t\t\t\tvar ret;\n\t\t\t\tjQuery.swap( elem, { \"display\": \"inline-block\" }, function() {\n\t\t\t\t\tif ( computed ) {\n\t\t\t\t\t\tret = curCSS( elem, \"margin-right\", \"marginRight\" );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tret = elem.style.marginRight;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t};\n\t}\n});\n\nif ( document.defaultView && document.defaultView.getComputedStyle ) {\n\tgetComputedStyle = function( elem, name ) {\n\t\tvar ret, defaultView, computedStyle;\n\n\t\tname = name.replace( rupper, \"-$1\" ).toLowerCase();\n\n\t\tif ( !(defaultView = elem.ownerDocument.defaultView) ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif ( (computedStyle = defaultView.getComputedStyle( elem, null )) ) {\n\t\t\tret = computedStyle.getPropertyValue( name );\n\t\t\tif ( ret === \"\" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {\n\t\t\t\tret = jQuery.style( elem, name );\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t};\n}\n\nif ( document.documentElement.currentStyle ) {\n\tcurrentStyle = function( elem, name ) {\n\t\tvar left,\n\t\t\tret = elem.currentStyle && elem.currentStyle[ name ],\n\t\t\trsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ],\n\t\t\tstyle = elem.style;\n\n\t\t// From the awesome hack by Dean Edwards\n\t\t// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\n\n\t\t// If we're not dealing with a regular pixel number\n\t\t// but a number that has a weird ending, we need to convert it to pixels\n\t\tif ( !rnumpx.test( ret ) && rnum.test( ret ) ) {\n\t\t\t// Remember the original values\n\t\t\tleft = style.left;\n\n\t\t\t// Put in the new values to get a computed value out\n\t\t\tif ( rsLeft ) {\n\t\t\t\telem.runtimeStyle.left = elem.currentStyle.left;\n\t\t\t}\n\t\t\tstyle.left = name === \"fontSize\" ? \"1em\" : (ret || 0);\n\t\t\tret = style.pixelLeft + \"px\";\n\n\t\t\t// Revert the changed values\n\t\t\tstyle.left = left;\n\t\t\tif ( rsLeft ) {\n\t\t\t\telem.runtimeStyle.left = rsLeft;\n\t\t\t}\n\t\t}\n\n\t\treturn ret === \"\" ? \"auto\" : ret;\n\t};\n}\n\ncurCSS = getComputedStyle || currentStyle;\n\nfunction getWH( elem, name, extra ) {\n\n\t// Start with offset property\n\tvar val = name === \"width\" ? elem.offsetWidth : elem.offsetHeight,\n\t\twhich = name === \"width\" ? cssWidth : cssHeight;\n\n\tif ( val > 0 ) {\n\t\tif ( extra !== \"border\" ) {\n\t\t\tjQuery.each( which, function() {\n\t\t\t\tif ( !extra ) {\n\t\t\t\t\tval -= parseFloat( jQuery.css( elem, \"padding\" + this ) ) || 0;\n\t\t\t\t}\n\t\t\t\tif ( extra === \"margin\" ) {\n\t\t\t\t\tval += parseFloat( jQuery.css( elem, extra + this ) ) || 0;\n\t\t\t\t} else {\n\t\t\t\t\tval -= parseFloat( jQuery.css( elem, \"border\" + this + \"Width\" ) ) || 0;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn val + \"px\";\n\t}\n\n\t// Fall back to computed then uncomputed css if necessary\n\tval = curCSS( elem, name, name );\n\tif ( val < 0 || val == null ) {\n\t\tval = elem.style[ name ] || 0;\n\t}\n\t// Normalize \"\", auto, and prepare for extra\n\tval = parseFloat( val ) || 0;\n\n\t// Add padding, border, margin\n\tif ( extra ) {\n\t\tjQuery.each( which, function() {\n\t\t\tval += parseFloat( jQuery.css( elem, \"padding\" + this ) ) || 0;\n\t\t\tif ( extra !== \"padding\" ) {\n\t\t\t\tval += parseFloat( jQuery.css( elem, \"border\" + this + \"Width\" ) ) || 0;\n\t\t\t}\n\t\t\tif ( extra === \"margin\" ) {\n\t\t\t\tval += parseFloat( jQuery.css( elem, extra + this ) ) || 0;\n\t\t\t}\n\t\t});\n\t}\n\n\treturn val + \"px\";\n}\n\nif ( jQuery.expr && jQuery.expr.filters ) {\n\tjQuery.expr.filters.hidden = function( elem ) {\n\t\tvar width = elem.offsetWidth,\n\t\t\theight = elem.offsetHeight;\n\n\t\treturn (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, \"display\" )) === \"none\");\n\t};\n\n\tjQuery.expr.filters.visible = function( elem ) {\n\t\treturn !jQuery.expr.filters.hidden( elem );\n\t};\n}\n\n\n\n\nvar r20 = /%20/g,\n\trbracket = /\\[\\]$/,\n\trCRLF = /\\r?\\n/g,\n\trhash = /#.*$/,\n\trheaders = /^(.*?):[ \\t]*([^\\r\\n]*)\\r?$/mg, // IE leaves an \\r character at EOL\n\trinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,\n\t// #7653, #8125, #8152: local protocol detection\n\trlocalProtocol = /^(?:about|app|app\\-storage|.+\\-extension|file|res|widget):$/,\n\trnoContent = /^(?:GET|HEAD)$/,\n\trprotocol = /^\\/\\//,\n\trquery = /\\?/,\n\trscript = /<script\\b[^<]*(?:(?!<\\/script>)<[^<]*)*<\\/script>/gi,\n\trselectTextarea = /^(?:select|textarea)/i,\n\trspacesAjax = /\\s+/,\n\trts = /([?&])_=[^&]*/,\n\trurl = /^([\\w\\+\\.\\-]+:)(?:\\/\\/([^\\/?#:]*)(?::(\\d+))?)?/,\n\n\t// Keep a copy of the old load method\n\t_load = jQuery.fn.load,\n\n\t/* Prefilters\n\t * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)\n\t * 2) These are called:\n\t *    - BEFORE asking for a transport\n\t *    - AFTER param serialization (s.data is a string if s.processData is true)\n\t * 3) key is the dataType\n\t * 4) the catchall symbol \"*\" can be used\n\t * 5) execution will start with transport dataType and THEN continue down to \"*\" if needed\n\t */\n\tprefilters = {},\n\n\t/* Transports bindings\n\t * 1) key is the dataType\n\t * 2) the catchall symbol \"*\" can be used\n\t * 3) selection will start with transport dataType and THEN go to \"*\" if needed\n\t */\n\ttransports = {},\n\n\t// Document location\n\tajaxLocation,\n\n\t// Document location segments\n\tajaxLocParts,\n\t\n\t// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression\n\tallTypes = [\"*/\"] + [\"*\"];\n\n// #8138, IE may throw an exception when accessing\n// a field from window.location if document.domain has been set\ntry {\n\tajaxLocation = location.href;\n} catch( e ) {\n\t// Use the href attribute of an A element\n\t// since IE will modify it given document.location\n\tajaxLocation = document.createElement( \"a\" );\n\tajaxLocation.href = \"\";\n\tajaxLocation = ajaxLocation.href;\n}\n\n// Segment location into parts\najaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];\n\n// Base \"constructor\" for jQuery.ajaxPrefilter and jQuery.ajaxTransport\nfunction addToPrefiltersOrTransports( structure ) {\n\n\t// dataTypeExpression is optional and defaults to \"*\"\n\treturn function( dataTypeExpression, func ) {\n\n\t\tif ( typeof dataTypeExpression !== \"string\" ) {\n\t\t\tfunc = dataTypeExpression;\n\t\t\tdataTypeExpression = \"*\";\n\t\t}\n\n\t\tif ( jQuery.isFunction( func ) ) {\n\t\t\tvar dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),\n\t\t\t\ti = 0,\n\t\t\t\tlength = dataTypes.length,\n\t\t\t\tdataType,\n\t\t\t\tlist,\n\t\t\t\tplaceBefore;\n\n\t\t\t// For each dataType in the dataTypeExpression\n\t\t\tfor(; i < length; i++ ) {\n\t\t\t\tdataType = dataTypes[ i ];\n\t\t\t\t// We control if we're asked to add before\n\t\t\t\t// any existing element\n\t\t\t\tplaceBefore = /^\\+/.test( dataType );\n\t\t\t\tif ( placeBefore ) {\n\t\t\t\t\tdataType = dataType.substr( 1 ) || \"*\";\n\t\t\t\t}\n\t\t\t\tlist = structure[ dataType ] = structure[ dataType ] || [];\n\t\t\t\t// then we add to the structure accordingly\n\t\t\t\tlist[ placeBefore ? \"unshift\" : \"push\" ]( func );\n\t\t\t}\n\t\t}\n\t};\n}\n\n// Base inspection function for prefilters and transports\nfunction inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,\n\t\tdataType /* internal */, inspected /* internal */ ) {\n\n\tdataType = dataType || options.dataTypes[ 0 ];\n\tinspected = inspected || {};\n\n\tinspected[ dataType ] = true;\n\n\tvar list = structure[ dataType ],\n\t\ti = 0,\n\t\tlength = list ? list.length : 0,\n\t\texecuteOnly = ( structure === prefilters ),\n\t\tselection;\n\n\tfor(; i < length && ( executeOnly || !selection ); i++ ) {\n\t\tselection = list[ i ]( options, originalOptions, jqXHR );\n\t\t// If we got redirected to another dataType\n\t\t// we try there if executing only and not done already\n\t\tif ( typeof selection === \"string\" ) {\n\t\t\tif ( !executeOnly || inspected[ selection ] ) {\n\t\t\t\tselection = undefined;\n\t\t\t} else {\n\t\t\t\toptions.dataTypes.unshift( selection );\n\t\t\t\tselection = inspectPrefiltersOrTransports(\n\t\t\t\t\t\tstructure, options, originalOptions, jqXHR, selection, inspected );\n\t\t\t}\n\t\t}\n\t}\n\t// If we're only executing or nothing was selected\n\t// we try the catchall dataType if not done already\n\tif ( ( executeOnly || !selection ) && !inspected[ \"*\" ] ) {\n\t\tselection = inspectPrefiltersOrTransports(\n\t\t\t\tstructure, options, originalOptions, jqXHR, \"*\", inspected );\n\t}\n\t// unnecessary when only executing (prefilters)\n\t// but it'll be ignored by the caller in that case\n\treturn selection;\n}\n\n// A special extend for ajax options\n// that takes \"flat\" options (not to be deep extended)\n// Fixes #9887\nfunction ajaxExtend( target, src ) {\n\tvar key, deep,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\tfor( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n}\n\njQuery.fn.extend({\n\tload: function( url, params, callback ) {\n\t\tif ( typeof url !== \"string\" && _load ) {\n\t\t\treturn _load.apply( this, arguments );\n\n\t\t// Don't do a request if no elements are being requested\n\t\t} else if ( !this.length ) {\n\t\t\treturn this;\n\t\t}\n\n\t\tvar off = url.indexOf( \" \" );\n\t\tif ( off >= 0 ) {\n\t\t\tvar selector = url.slice( off, url.length );\n\t\t\turl = url.slice( 0, off );\n\t\t}\n\n\t\t// Default to a GET request\n\t\tvar type = \"GET\";\n\n\t\t// If the second parameter was provided\n\t\tif ( params ) {\n\t\t\t// If it's a function\n\t\t\tif ( jQuery.isFunction( params ) ) {\n\t\t\t\t// We assume that it's the callback\n\t\t\t\tcallback = params;\n\t\t\t\tparams = undefined;\n\n\t\t\t// Otherwise, build a param string\n\t\t\t} else if ( typeof params === \"object\" ) {\n\t\t\t\tparams = jQuery.param( params, jQuery.ajaxSettings.traditional );\n\t\t\t\ttype = \"POST\";\n\t\t\t}\n\t\t}\n\n\t\tvar self = this;\n\n\t\t// Request the remote document\n\t\tjQuery.ajax({\n\t\t\turl: url,\n\t\t\ttype: type,\n\t\t\tdataType: \"html\",\n\t\t\tdata: params,\n\t\t\t// Complete callback (responseText is used internally)\n\t\t\tcomplete: function( jqXHR, status, responseText ) {\n\t\t\t\t// Store the response as specified by the jqXHR object\n\t\t\t\tresponseText = jqXHR.responseText;\n\t\t\t\t// If successful, inject the HTML into all the matched elements\n\t\t\t\tif ( jqXHR.isResolved() ) {\n\t\t\t\t\t// #4825: Get the actual response in case\n\t\t\t\t\t// a dataFilter is present in ajaxSettings\n\t\t\t\t\tjqXHR.done(function( r ) {\n\t\t\t\t\t\tresponseText = r;\n\t\t\t\t\t});\n\t\t\t\t\t// See if a selector was specified\n\t\t\t\t\tself.html( selector ?\n\t\t\t\t\t\t// Create a dummy div to hold the results\n\t\t\t\t\t\tjQuery(\"<div>\")\n\t\t\t\t\t\t\t// inject the contents of the document in, removing the scripts\n\t\t\t\t\t\t\t// to avoid any 'Permission Denied' errors in IE\n\t\t\t\t\t\t\t.append(responseText.replace(rscript, \"\"))\n\n\t\t\t\t\t\t\t// Locate the specified elements\n\t\t\t\t\t\t\t.find(selector) :\n\n\t\t\t\t\t\t// If not, just inject the full result\n\t\t\t\t\t\tresponseText );\n\t\t\t\t}\n\n\t\t\t\tif ( callback ) {\n\t\t\t\t\tself.each( callback, [ responseText, status, jqXHR ] );\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treturn this;\n\t},\n\n\tserialize: function() {\n\t\treturn jQuery.param( this.serializeArray() );\n\t},\n\n\tserializeArray: function() {\n\t\treturn this.map(function(){\n\t\t\treturn this.elements ? jQuery.makeArray( this.elements ) : this;\n\t\t})\n\t\t.filter(function(){\n\t\t\treturn this.name && !this.disabled &&\n\t\t\t\t( this.checked || rselectTextarea.test( this.nodeName ) ||\n\t\t\t\t\trinput.test( this.type ) );\n\t\t})\n\t\t.map(function( i, elem ){\n\t\t\tvar val = jQuery( this ).val();\n\n\t\t\treturn val == null ?\n\t\t\t\tnull :\n\t\t\t\tjQuery.isArray( val ) ?\n\t\t\t\t\tjQuery.map( val, function( val, i ){\n\t\t\t\t\t\treturn { name: elem.name, value: val.replace( rCRLF, \"\\r\\n\" ) };\n\t\t\t\t\t}) :\n\t\t\t\t\t{ name: elem.name, value: val.replace( rCRLF, \"\\r\\n\" ) };\n\t\t}).get();\n\t}\n});\n\n// Attach a bunch of functions for handling common AJAX events\njQuery.each( \"ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend\".split( \" \" ), function( i, o ){\n\tjQuery.fn[ o ] = function( f ){\n\t\treturn this.bind( o, f );\n\t};\n});\n\njQuery.each( [ \"get\", \"post\" ], function( i, method ) {\n\tjQuery[ method ] = function( url, data, callback, type ) {\n\t\t// shift arguments if data argument was omitted\n\t\tif ( jQuery.isFunction( data ) ) {\n\t\t\ttype = type || callback;\n\t\t\tcallback = data;\n\t\t\tdata = undefined;\n\t\t}\n\n\t\treturn jQuery.ajax({\n\t\t\ttype: method,\n\t\t\turl: url,\n\t\t\tdata: data,\n\t\t\tsuccess: callback,\n\t\t\tdataType: type\n\t\t});\n\t};\n});\n\njQuery.extend({\n\n\tgetScript: function( url, callback ) {\n\t\treturn jQuery.get( url, undefined, callback, \"script\" );\n\t},\n\n\tgetJSON: function( url, data, callback ) {\n\t\treturn jQuery.get( url, data, callback, \"json\" );\n\t},\n\n\t// Creates a full fledged settings object into target\n\t// with both ajaxSettings and settings fields.\n\t// If target is omitted, writes into ajaxSettings.\n\tajaxSetup: function( target, settings ) {\n\t\tif ( settings ) {\n\t\t\t// Building a settings object\n\t\t\tajaxExtend( target, jQuery.ajaxSettings );\n\t\t} else {\n\t\t\t// Extending ajaxSettings\n\t\t\tsettings = target;\n\t\t\ttarget = jQuery.ajaxSettings;\n\t\t}\n\t\tajaxExtend( target, settings );\n\t\treturn target;\n\t},\n\n\tajaxSettings: {\n\t\turl: ajaxLocation,\n\t\tisLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),\n\t\tglobal: true,\n\t\ttype: \"GET\",\n\t\tcontentType: \"application/x-www-form-urlencoded\",\n\t\tprocessData: true,\n\t\tasync: true,\n\t\t/*\n\t\ttimeout: 0,\n\t\tdata: null,\n\t\tdataType: null,\n\t\tusername: null,\n\t\tpassword: null,\n\t\tcache: null,\n\t\ttraditional: false,\n\t\theaders: {},\n\t\t*/\n\n\t\taccepts: {\n\t\t\txml: \"application/xml, text/xml\",\n\t\t\thtml: \"text/html\",\n\t\t\ttext: \"text/plain\",\n\t\t\tjson: \"application/json, text/javascript\",\n\t\t\t\"*\": allTypes\n\t\t},\n\n\t\tcontents: {\n\t\t\txml: /xml/,\n\t\t\thtml: /html/,\n\t\t\tjson: /json/\n\t\t},\n\n\t\tresponseFields: {\n\t\t\txml: \"responseXML\",\n\t\t\ttext: \"responseText\"\n\t\t},\n\n\t\t// List of data converters\n\t\t// 1) key format is \"source_type destination_type\" (a single space in-between)\n\t\t// 2) the catchall symbol \"*\" can be used for source_type\n\t\tconverters: {\n\n\t\t\t// Convert anything to text\n\t\t\t\"* text\": window.String,\n\n\t\t\t// Text to html (true = no transformation)\n\t\t\t\"text html\": true,\n\n\t\t\t// Evaluate text as a json expression\n\t\t\t\"text json\": jQuery.parseJSON,\n\n\t\t\t// Parse text as xml\n\t\t\t\"text xml\": jQuery.parseXML\n\t\t},\n\n\t\t// For options that shouldn't be deep extended:\n\t\t// you can add your own custom options here if\n\t\t// and when you create one that shouldn't be\n\t\t// deep extended (see ajaxExtend)\n\t\tflatOptions: {\n\t\t\tcontext: true,\n\t\t\turl: true\n\t\t}\n\t},\n\n\tajaxPrefilter: addToPrefiltersOrTransports( prefilters ),\n\tajaxTransport: addToPrefiltersOrTransports( transports ),\n\n\t// Main method\n\tajax: function( url, options ) {\n\n\t\t// If url is an object, simulate pre-1.5 signature\n\t\tif ( typeof url === \"object\" ) {\n\t\t\toptions = url;\n\t\t\turl = undefined;\n\t\t}\n\n\t\t// Force options to be an object\n\t\toptions = options || {};\n\n\t\tvar // Create the final options object\n\t\t\ts = jQuery.ajaxSetup( {}, options ),\n\t\t\t// Callbacks context\n\t\t\tcallbackContext = s.context || s,\n\t\t\t// Context for global events\n\t\t\t// It's the callbackContext if one was provided in the options\n\t\t\t// and if it's a DOM node or a jQuery collection\n\t\t\tglobalEventContext = callbackContext !== s &&\n\t\t\t\t( callbackContext.nodeType || callbackContext instanceof jQuery ) ?\n\t\t\t\t\t\tjQuery( callbackContext ) : jQuery.event,\n\t\t\t// Deferreds\n\t\t\tdeferred = jQuery.Deferred(),\n\t\t\tcompleteDeferred = jQuery._Deferred(),\n\t\t\t// Status-dependent callbacks\n\t\t\tstatusCode = s.statusCode || {},\n\t\t\t// ifModified key\n\t\t\tifModifiedKey,\n\t\t\t// Headers (they are sent all at once)\n\t\t\trequestHeaders = {},\n\t\t\trequestHeadersNames = {},\n\t\t\t// Response headers\n\t\t\tresponseHeadersString,\n\t\t\tresponseHeaders,\n\t\t\t// transport\n\t\t\ttransport,\n\t\t\t// timeout handle\n\t\t\ttimeoutTimer,\n\t\t\t// Cross-domain detection vars\n\t\t\tparts,\n\t\t\t// The jqXHR state\n\t\t\tstate = 0,\n\t\t\t// To know if global events are to be dispatched\n\t\t\tfireGlobals,\n\t\t\t// Loop variable\n\t\t\ti,\n\t\t\t// Fake xhr\n\t\t\tjqXHR = {\n\n\t\t\t\treadyState: 0,\n\n\t\t\t\t// Caches the header\n\t\t\t\tsetRequestHeader: function( name, value ) {\n\t\t\t\t\tif ( !state ) {\n\t\t\t\t\t\tvar lname = name.toLowerCase();\n\t\t\t\t\t\tname = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;\n\t\t\t\t\t\trequestHeaders[ name ] = value;\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Raw string\n\t\t\t\tgetAllResponseHeaders: function() {\n\t\t\t\t\treturn state === 2 ? responseHeadersString : null;\n\t\t\t\t},\n\n\t\t\t\t// Builds headers hashtable if needed\n\t\t\t\tgetResponseHeader: function( key ) {\n\t\t\t\t\tvar match;\n\t\t\t\t\tif ( state === 2 ) {\n\t\t\t\t\t\tif ( !responseHeaders ) {\n\t\t\t\t\t\t\tresponseHeaders = {};\n\t\t\t\t\t\t\twhile( ( match = rheaders.exec( responseHeadersString ) ) ) {\n\t\t\t\t\t\t\t\tresponseHeaders[ match[1].toLowerCase() ] = match[ 2 ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmatch = responseHeaders[ key.toLowerCase() ];\n\t\t\t\t\t}\n\t\t\t\t\treturn match === undefined ? null : match;\n\t\t\t\t},\n\n\t\t\t\t// Overrides response content-type header\n\t\t\t\toverrideMimeType: function( type ) {\n\t\t\t\t\tif ( !state ) {\n\t\t\t\t\t\ts.mimeType = type;\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Cancel the request\n\t\t\t\tabort: function( statusText ) {\n\t\t\t\t\tstatusText = statusText || \"abort\";\n\t\t\t\t\tif ( transport ) {\n\t\t\t\t\t\ttransport.abort( statusText );\n\t\t\t\t\t}\n\t\t\t\t\tdone( 0, statusText );\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\t\t\t};\n\n\t\t// Callback for when everything is done\n\t\t// It is defined here because jslint complains if it is declared\n\t\t// at the end of the function (which would be more logical and readable)\n\t\tfunction done( status, nativeStatusText, responses, headers ) {\n\n\t\t\t// Called once\n\t\t\tif ( state === 2 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// State is \"done\" now\n\t\t\tstate = 2;\n\n\t\t\t// Clear timeout if it exists\n\t\t\tif ( timeoutTimer ) {\n\t\t\t\tclearTimeout( timeoutTimer );\n\t\t\t}\n\n\t\t\t// Dereference transport for early garbage collection\n\t\t\t// (no matter how long the jqXHR object will be used)\n\t\t\ttransport = undefined;\n\n\t\t\t// Cache response headers\n\t\t\tresponseHeadersString = headers || \"\";\n\n\t\t\t// Set readyState\n\t\t\tjqXHR.readyState = status > 0 ? 4 : 0;\n\n\t\t\tvar isSuccess,\n\t\t\t\tsuccess,\n\t\t\t\terror,\n\t\t\t\tstatusText = nativeStatusText,\n\t\t\t\tresponse = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,\n\t\t\t\tlastModified,\n\t\t\t\tetag;\n\n\t\t\t// If successful, handle type chaining\n\t\t\tif ( status >= 200 && status < 300 || status === 304 ) {\n\n\t\t\t\t// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n\t\t\t\tif ( s.ifModified ) {\n\n\t\t\t\t\tif ( ( lastModified = jqXHR.getResponseHeader( \"Last-Modified\" ) ) ) {\n\t\t\t\t\t\tjQuery.lastModified[ ifModifiedKey ] = lastModified;\n\t\t\t\t\t}\n\t\t\t\t\tif ( ( etag = jqXHR.getResponseHeader( \"Etag\" ) ) ) {\n\t\t\t\t\t\tjQuery.etag[ ifModifiedKey ] = etag;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If not modified\n\t\t\t\tif ( status === 304 ) {\n\n\t\t\t\t\tstatusText = \"notmodified\";\n\t\t\t\t\tisSuccess = true;\n\n\t\t\t\t// If we have data\n\t\t\t\t} else {\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tsuccess = ajaxConvert( s, response );\n\t\t\t\t\t\tstatusText = \"success\";\n\t\t\t\t\t\tisSuccess = true;\n\t\t\t\t\t} catch(e) {\n\t\t\t\t\t\t// We have a parsererror\n\t\t\t\t\t\tstatusText = \"parsererror\";\n\t\t\t\t\t\terror = e;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// We extract error from statusText\n\t\t\t\t// then normalize statusText and status for non-aborts\n\t\t\t\terror = statusText;\n\t\t\t\tif( !statusText || status ) {\n\t\t\t\t\tstatusText = \"error\";\n\t\t\t\t\tif ( status < 0 ) {\n\t\t\t\t\t\tstatus = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Set data for the fake xhr object\n\t\t\tjqXHR.status = status;\n\t\t\tjqXHR.statusText = \"\" + ( nativeStatusText || statusText );\n\n\t\t\t// Success/Error\n\t\t\tif ( isSuccess ) {\n\t\t\t\tdeferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );\n\t\t\t} else {\n\t\t\t\tdeferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );\n\t\t\t}\n\n\t\t\t// Status-dependent callbacks\n\t\t\tjqXHR.statusCode( statusCode );\n\t\t\tstatusCode = undefined;\n\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( \"ajax\" + ( isSuccess ? \"Success\" : \"Error\" ),\n\t\t\t\t\t\t[ jqXHR, s, isSuccess ? success : error ] );\n\t\t\t}\n\n\t\t\t// Complete\n\t\t\tcompleteDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] );\n\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( \"ajaxComplete\", [ jqXHR, s ] );\n\t\t\t\t// Handle the global AJAX counter\n\t\t\t\tif ( !( --jQuery.active ) ) {\n\t\t\t\t\tjQuery.event.trigger( \"ajaxStop\" );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Attach deferreds\n\t\tdeferred.promise( jqXHR );\n\t\tjqXHR.success = jqXHR.done;\n\t\tjqXHR.error = jqXHR.fail;\n\t\tjqXHR.complete = completeDeferred.done;\n\n\t\t// Status-dependent callbacks\n\t\tjqXHR.statusCode = function( map ) {\n\t\t\tif ( map ) {\n\t\t\t\tvar tmp;\n\t\t\t\tif ( state < 2 ) {\n\t\t\t\t\tfor( tmp in map ) {\n\t\t\t\t\t\tstatusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttmp = map[ jqXHR.status ];\n\t\t\t\t\tjqXHR.then( tmp, tmp );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this;\n\t\t};\n\n\t\t// Remove hash character (#7531: and string promotion)\n\t\t// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)\n\t\t// We also use the url parameter if available\n\t\ts.url = ( ( url || s.url ) + \"\" ).replace( rhash, \"\" ).replace( rprotocol, ajaxLocParts[ 1 ] + \"//\" );\n\n\t\t// Extract dataTypes list\n\t\ts.dataTypes = jQuery.trim( s.dataType || \"*\" ).toLowerCase().split( rspacesAjax );\n\n\t\t// Determine if a cross-domain request is in order\n\t\tif ( s.crossDomain == null ) {\n\t\t\tparts = rurl.exec( s.url.toLowerCase() );\n\t\t\ts.crossDomain = !!( parts &&\n\t\t\t\t( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||\n\t\t\t\t\t( parts[ 3 ] || ( parts[ 1 ] === \"http:\" ? 80 : 443 ) ) !=\n\t\t\t\t\t\t( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === \"http:\" ? 80 : 443 ) ) )\n\t\t\t);\n\t\t}\n\n\t\t// Convert data if not already a string\n\t\tif ( s.data && s.processData && typeof s.data !== \"string\" ) {\n\t\t\ts.data = jQuery.param( s.data, s.traditional );\n\t\t}\n\n\t\t// Apply prefilters\n\t\tinspectPrefiltersOrTransports( prefilters, s, options, jqXHR );\n\n\t\t// If request was aborted inside a prefiler, stop there\n\t\tif ( state === 2 ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// We can fire global events as of now if asked to\n\t\tfireGlobals = s.global;\n\n\t\t// Uppercase the type\n\t\ts.type = s.type.toUpperCase();\n\n\t\t// Determine if request has content\n\t\ts.hasContent = !rnoContent.test( s.type );\n\n\t\t// Watch for a new set of requests\n\t\tif ( fireGlobals && jQuery.active++ === 0 ) {\n\t\t\tjQuery.event.trigger( \"ajaxStart\" );\n\t\t}\n\n\t\t// More options handling for requests with no content\n\t\tif ( !s.hasContent ) {\n\n\t\t\t// If data is available, append data to url\n\t\t\tif ( s.data ) {\n\t\t\t\ts.url += ( rquery.test( s.url ) ? \"&\" : \"?\" ) + s.data;\n\t\t\t\t// #9682: remove data so that it's not used in an eventual retry\n\t\t\t\tdelete s.data;\n\t\t\t}\n\n\t\t\t// Get ifModifiedKey before adding the anti-cache parameter\n\t\t\tifModifiedKey = s.url;\n\n\t\t\t// Add anti-cache in url if needed\n\t\t\tif ( s.cache === false ) {\n\n\t\t\t\tvar ts = jQuery.now(),\n\t\t\t\t\t// try replacing _= if it is there\n\t\t\t\t\tret = s.url.replace( rts, \"$1_=\" + ts );\n\n\t\t\t\t// if nothing was replaced, add timestamp to the end\n\t\t\t\ts.url = ret + ( (ret === s.url ) ? ( rquery.test( s.url ) ? \"&\" : \"?\" ) + \"_=\" + ts : \"\" );\n\t\t\t}\n\t\t}\n\n\t\t// Set the correct header, if data is being sent\n\t\tif ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {\n\t\t\tjqXHR.setRequestHeader( \"Content-Type\", s.contentType );\n\t\t}\n\n\t\t// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n\t\tif ( s.ifModified ) {\n\t\t\tifModifiedKey = ifModifiedKey || s.url;\n\t\t\tif ( jQuery.lastModified[ ifModifiedKey ] ) {\n\t\t\t\tjqXHR.setRequestHeader( \"If-Modified-Since\", jQuery.lastModified[ ifModifiedKey ] );\n\t\t\t}\n\t\t\tif ( jQuery.etag[ ifModifiedKey ] ) {\n\t\t\t\tjqXHR.setRequestHeader( \"If-None-Match\", jQuery.etag[ ifModifiedKey ] );\n\t\t\t}\n\t\t}\n\n\t\t// Set the Accepts header for the server, depending on the dataType\n\t\tjqXHR.setRequestHeader(\n\t\t\t\"Accept\",\n\t\t\ts.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?\n\t\t\t\ts.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== \"*\" ? \", \" + allTypes + \"; q=0.01\" : \"\" ) :\n\t\t\t\ts.accepts[ \"*\" ]\n\t\t);\n\n\t\t// Check for headers option\n\t\tfor ( i in s.headers ) {\n\t\t\tjqXHR.setRequestHeader( i, s.headers[ i ] );\n\t\t}\n\n\t\t// Allow custom headers/mimetypes and early abort\n\t\tif ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {\n\t\t\t\t// Abort if not done already\n\t\t\t\tjqXHR.abort();\n\t\t\t\treturn false;\n\n\t\t}\n\n\t\t// Install callbacks on deferreds\n\t\tfor ( i in { success: 1, error: 1, complete: 1 } ) {\n\t\t\tjqXHR[ i ]( s[ i ] );\n\t\t}\n\n\t\t// Get transport\n\t\ttransport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );\n\n\t\t// If no transport, we auto-abort\n\t\tif ( !transport ) {\n\t\t\tdone( -1, \"No Transport\" );\n\t\t} else {\n\t\t\tjqXHR.readyState = 1;\n\t\t\t// Send global event\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( \"ajaxSend\", [ jqXHR, s ] );\n\t\t\t}\n\t\t\t// Timeout\n\t\t\tif ( s.async && s.timeout > 0 ) {\n\t\t\t\ttimeoutTimer = setTimeout( function(){\n\t\t\t\t\tjqXHR.abort( \"timeout\" );\n\t\t\t\t}, s.timeout );\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tstate = 1;\n\t\t\t\ttransport.send( requestHeaders, done );\n\t\t\t} catch (e) {\n\t\t\t\t// Propagate exception as error if not done\n\t\t\t\tif ( state < 2 ) {\n\t\t\t\t\tdone( -1, e );\n\t\t\t\t// Simply rethrow otherwise\n\t\t\t\t} else {\n\t\t\t\t\tjQuery.error( e );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn jqXHR;\n\t},\n\n\t// Serialize an array of form elements or a set of\n\t// key/values into a query string\n\tparam: function( a, traditional ) {\n\t\tvar s = [],\n\t\t\tadd = function( key, value ) {\n\t\t\t\t// If value is a function, invoke it and return its value\n\t\t\t\tvalue = jQuery.isFunction( value ) ? value() : value;\n\t\t\t\ts[ s.length ] = encodeURIComponent( key ) + \"=\" + encodeURIComponent( value );\n\t\t\t};\n\n\t\t// Set traditional to true for jQuery <= 1.3.2 behavior.\n\t\tif ( traditional === undefined ) {\n\t\t\ttraditional = jQuery.ajaxSettings.traditional;\n\t\t}\n\n\t\t// If an array was passed in, assume that it is an array of form elements.\n\t\tif ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {\n\t\t\t// Serialize the form elements\n\t\t\tjQuery.each( a, function() {\n\t\t\t\tadd( this.name, this.value );\n\t\t\t});\n\n\t\t} else {\n\t\t\t// If traditional, encode the \"old\" way (the way 1.3.2 or older\n\t\t\t// did it), otherwise encode params recursively.\n\t\t\tfor ( var prefix in a ) {\n\t\t\t\tbuildParams( prefix, a[ prefix ], traditional, add );\n\t\t\t}\n\t\t}\n\n\t\t// Return the resulting serialization\n\t\treturn s.join( \"&\" ).replace( r20, \"+\" );\n\t}\n});\n\nfunction buildParams( prefix, obj, traditional, add ) {\n\tif ( jQuery.isArray( obj ) ) {\n\t\t// Serialize array item.\n\t\tjQuery.each( obj, function( i, v ) {\n\t\t\tif ( traditional || rbracket.test( prefix ) ) {\n\t\t\t\t// Treat each array item as a scalar.\n\t\t\t\tadd( prefix, v );\n\n\t\t\t} else {\n\t\t\t\t// If array item is non-scalar (array or object), encode its\n\t\t\t\t// numeric index to resolve deserialization ambiguity issues.\n\t\t\t\t// Note that rack (as of 1.0.0) can't currently deserialize\n\t\t\t\t// nested arrays properly, and attempting to do so may cause\n\t\t\t\t// a server error. Possible fixes are to modify rack's\n\t\t\t\t// deserialization algorithm or to provide an option or flag\n\t\t\t\t// to force array serialization to be shallow.\n\t\t\t\tbuildParams( prefix + \"[\" + ( typeof v === \"object\" || jQuery.isArray(v) ? i : \"\" ) + \"]\", v, traditional, add );\n\t\t\t}\n\t\t});\n\n\t} else if ( !traditional && obj != null && typeof obj === \"object\" ) {\n\t\t// Serialize object item.\n\t\tfor ( var name in obj ) {\n\t\t\tbuildParams( prefix + \"[\" + name + \"]\", obj[ name ], traditional, add );\n\t\t}\n\n\t} else {\n\t\t// Serialize scalar item.\n\t\tadd( prefix, obj );\n\t}\n}\n\n// This is still on the jQuery object... for now\n// Want to move this to jQuery.ajax some day\njQuery.extend({\n\n\t// Counter for holding the number of active queries\n\tactive: 0,\n\n\t// Last-Modified header cache for next request\n\tlastModified: {},\n\tetag: {}\n\n});\n\n/* Handles responses to an ajax request:\n * - sets all responseXXX fields accordingly\n * - finds the right dataType (mediates between content-type and expected dataType)\n * - returns the corresponding response\n */\nfunction ajaxHandleResponses( s, jqXHR, responses ) {\n\n\tvar contents = s.contents,\n\t\tdataTypes = s.dataTypes,\n\t\tresponseFields = s.responseFields,\n\t\tct,\n\t\ttype,\n\t\tfinalDataType,\n\t\tfirstDataType;\n\n\t// Fill responseXXX fields\n\tfor( type in responseFields ) {\n\t\tif ( type in responses ) {\n\t\t\tjqXHR[ responseFields[type] ] = responses[ type ];\n\t\t}\n\t}\n\n\t// Remove auto dataType and get content-type in the process\n\twhile( dataTypes[ 0 ] === \"*\" ) {\n\t\tdataTypes.shift();\n\t\tif ( ct === undefined ) {\n\t\t\tct = s.mimeType || jqXHR.getResponseHeader( \"content-type\" );\n\t\t}\n\t}\n\n\t// Check if we're dealing with a known content-type\n\tif ( ct ) {\n\t\tfor ( type in contents ) {\n\t\t\tif ( contents[ type ] && contents[ type ].test( ct ) ) {\n\t\t\t\tdataTypes.unshift( type );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check to see if we have a response for the expected dataType\n\tif ( dataTypes[ 0 ] in responses ) {\n\t\tfinalDataType = dataTypes[ 0 ];\n\t} else {\n\t\t// Try convertible dataTypes\n\t\tfor ( type in responses ) {\n\t\t\tif ( !dataTypes[ 0 ] || s.converters[ type + \" \" + dataTypes[0] ] ) {\n\t\t\t\tfinalDataType = type;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( !firstDataType ) {\n\t\t\t\tfirstDataType = type;\n\t\t\t}\n\t\t}\n\t\t// Or just use first one\n\t\tfinalDataType = finalDataType || firstDataType;\n\t}\n\n\t// If we found a dataType\n\t// We add the dataType to the list if needed\n\t// and return the corresponding response\n\tif ( finalDataType ) {\n\t\tif ( finalDataType !== dataTypes[ 0 ] ) {\n\t\t\tdataTypes.unshift( finalDataType );\n\t\t}\n\t\treturn responses[ finalDataType ];\n\t}\n}\n\n// Chain conversions given the request and the original response\nfunction ajaxConvert( s, response ) {\n\n\t// Apply the dataFilter if provided\n\tif ( s.dataFilter ) {\n\t\tresponse = s.dataFilter( response, s.dataType );\n\t}\n\n\tvar dataTypes = s.dataTypes,\n\t\tconverters = {},\n\t\ti,\n\t\tkey,\n\t\tlength = dataTypes.length,\n\t\ttmp,\n\t\t// Current and previous dataTypes\n\t\tcurrent = dataTypes[ 0 ],\n\t\tprev,\n\t\t// Conversion expression\n\t\tconversion,\n\t\t// Conversion function\n\t\tconv,\n\t\t// Conversion functions (transitive conversion)\n\t\tconv1,\n\t\tconv2;\n\n\t// For each dataType in the chain\n\tfor( i = 1; i < length; i++ ) {\n\n\t\t// Create converters map\n\t\t// with lowercased keys\n\t\tif ( i === 1 ) {\n\t\t\tfor( key in s.converters ) {\n\t\t\t\tif( typeof key === \"string\" ) {\n\t\t\t\t\tconverters[ key.toLowerCase() ] = s.converters[ key ];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Get the dataTypes\n\t\tprev = current;\n\t\tcurrent = dataTypes[ i ];\n\n\t\t// If current is auto dataType, update it to prev\n\t\tif( current === \"*\" ) {\n\t\t\tcurrent = prev;\n\t\t// If no auto and dataTypes are actually different\n\t\t} else if ( prev !== \"*\" && prev !== current ) {\n\n\t\t\t// Get the converter\n\t\t\tconversion = prev + \" \" + current;\n\t\t\tconv = converters[ conversion ] || converters[ \"* \" + current ];\n\n\t\t\t// If there is no direct converter, search transitively\n\t\t\tif ( !conv ) {\n\t\t\t\tconv2 = undefined;\n\t\t\t\tfor( conv1 in converters ) {\n\t\t\t\t\ttmp = conv1.split( \" \" );\n\t\t\t\t\tif ( tmp[ 0 ] === prev || tmp[ 0 ] === \"*\" ) {\n\t\t\t\t\t\tconv2 = converters[ tmp[1] + \" \" + current ];\n\t\t\t\t\t\tif ( conv2 ) {\n\t\t\t\t\t\t\tconv1 = converters[ conv1 ];\n\t\t\t\t\t\t\tif ( conv1 === true ) {\n\t\t\t\t\t\t\t\tconv = conv2;\n\t\t\t\t\t\t\t} else if ( conv2 === true ) {\n\t\t\t\t\t\t\t\tconv = conv1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If we found no converter, dispatch an error\n\t\t\tif ( !( conv || conv2 ) ) {\n\t\t\t\tjQuery.error( \"No conversion from \" + conversion.replace(\" \",\" to \") );\n\t\t\t}\n\t\t\t// If found converter is not an equivalence\n\t\t\tif ( conv !== true ) {\n\t\t\t\t// Convert with 1 or 2 converters accordingly\n\t\t\t\tresponse = conv ? conv( response ) : conv2( conv1(response) );\n\t\t\t}\n\t\t}\n\t}\n\treturn response;\n}\n\n\n\n\nvar jsc = jQuery.now(),\n\tjsre = /(\\=)\\?(&|$)|\\?\\?/i;\n\n// Default jsonp settings\njQuery.ajaxSetup({\n\tjsonp: \"callback\",\n\tjsonpCallback: function() {\n\t\treturn jQuery.expando + \"_\" + ( jsc++ );\n\t}\n});\n\n// Detect, normalize options and install callbacks for jsonp requests\njQuery.ajaxPrefilter( \"json jsonp\", function( s, originalSettings, jqXHR ) {\n\n\tvar inspectData = s.contentType === \"application/x-www-form-urlencoded\" &&\n\t\t( typeof s.data === \"string\" );\n\n\tif ( s.dataTypes[ 0 ] === \"jsonp\" ||\n\t\ts.jsonp !== false && ( jsre.test( s.url ) ||\n\t\t\t\tinspectData && jsre.test( s.data ) ) ) {\n\n\t\tvar responseContainer,\n\t\t\tjsonpCallback = s.jsonpCallback =\n\t\t\t\tjQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,\n\t\t\tprevious = window[ jsonpCallback ],\n\t\t\turl = s.url,\n\t\t\tdata = s.data,\n\t\t\treplace = \"$1\" + jsonpCallback + \"$2\";\n\n\t\tif ( s.jsonp !== false ) {\n\t\t\turl = url.replace( jsre, replace );\n\t\t\tif ( s.url === url ) {\n\t\t\t\tif ( inspectData ) {\n\t\t\t\t\tdata = data.replace( jsre, replace );\n\t\t\t\t}\n\t\t\t\tif ( s.data === data ) {\n\t\t\t\t\t// Add callback manually\n\t\t\t\t\turl += (/\\?/.test( url ) ? \"&\" : \"?\") + s.jsonp + \"=\" + jsonpCallback;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\ts.url = url;\n\t\ts.data = data;\n\n\t\t// Install callback\n\t\twindow[ jsonpCallback ] = function( response ) {\n\t\t\tresponseContainer = [ response ];\n\t\t};\n\n\t\t// Clean-up function\n\t\tjqXHR.always(function() {\n\t\t\t// Set callback back to previous value\n\t\t\twindow[ jsonpCallback ] = previous;\n\t\t\t// Call if it was a function and we have a response\n\t\t\tif ( responseContainer && jQuery.isFunction( previous ) ) {\n\t\t\t\twindow[ jsonpCallback ]( responseContainer[ 0 ] );\n\t\t\t}\n\t\t});\n\n\t\t// Use data converter to retrieve json after script execution\n\t\ts.converters[\"script json\"] = function() {\n\t\t\tif ( !responseContainer ) {\n\t\t\t\tjQuery.error( jsonpCallback + \" was not called\" );\n\t\t\t}\n\t\t\treturn responseContainer[ 0 ];\n\t\t};\n\n\t\t// force json dataType\n\t\ts.dataTypes[ 0 ] = \"json\";\n\n\t\t// Delegate to script\n\t\treturn \"script\";\n\t}\n});\n\n\n\n\n// Install script dataType\njQuery.ajaxSetup({\n\taccepts: {\n\t\tscript: \"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript\"\n\t},\n\tcontents: {\n\t\tscript: /javascript|ecmascript/\n\t},\n\tconverters: {\n\t\t\"text script\": function( text ) {\n\t\t\tjQuery.globalEval( text );\n\t\t\treturn text;\n\t\t}\n\t}\n});\n\n// Handle cache's special case and global\njQuery.ajaxPrefilter( \"script\", function( s ) {\n\tif ( s.cache === undefined ) {\n\t\ts.cache = false;\n\t}\n\tif ( s.crossDomain ) {\n\t\ts.type = \"GET\";\n\t\ts.global = false;\n\t}\n});\n\n// Bind script tag hack transport\njQuery.ajaxTransport( \"script\", function(s) {\n\n\t// This transport only deals with cross domain requests\n\tif ( s.crossDomain ) {\n\n\t\tvar script,\n\t\t\thead = document.head || document.getElementsByTagName( \"head\" )[0] || document.documentElement;\n\n\t\treturn {\n\n\t\t\tsend: function( _, callback ) {\n\n\t\t\t\tscript = document.createElement( \"script\" );\n\n\t\t\t\tscript.async = \"async\";\n\n\t\t\t\tif ( s.scriptCharset ) {\n\t\t\t\t\tscript.charset = s.scriptCharset;\n\t\t\t\t}\n\n\t\t\t\tscript.src = s.url;\n\n\t\t\t\t// Attach handlers for all browsers\n\t\t\t\tscript.onload = script.onreadystatechange = function( _, isAbort ) {\n\n\t\t\t\t\tif ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {\n\n\t\t\t\t\t\t// Handle memory leak in IE\n\t\t\t\t\t\tscript.onload = script.onreadystatechange = null;\n\n\t\t\t\t\t\t// Remove the script\n\t\t\t\t\t\tif ( head && script.parentNode ) {\n\t\t\t\t\t\t\thead.removeChild( script );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Dereference the script\n\t\t\t\t\t\tscript = undefined;\n\n\t\t\t\t\t\t// Callback if not abort\n\t\t\t\t\t\tif ( !isAbort ) {\n\t\t\t\t\t\t\tcallback( 200, \"success\" );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\t// Use insertBefore instead of appendChild  to circumvent an IE6 bug.\n\t\t\t\t// This arises when a base node is used (#2709 and #4378).\n\t\t\t\thead.insertBefore( script, head.firstChild );\n\t\t\t},\n\n\t\t\tabort: function() {\n\t\t\t\tif ( script ) {\n\t\t\t\t\tscript.onload( 0, 1 );\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n});\n\n\n\n\nvar // #5280: Internet Explorer will keep connections alive if we don't abort on unload\n\txhrOnUnloadAbort = window.ActiveXObject ? function() {\n\t\t// Abort all pending requests\n\t\tfor ( var key in xhrCallbacks ) {\n\t\t\txhrCallbacks[ key ]( 0, 1 );\n\t\t}\n\t} : false,\n\txhrId = 0,\n\txhrCallbacks;\n\n// Functions to create xhrs\nfunction createStandardXHR() {\n\ttry {\n\t\treturn new window.XMLHttpRequest();\n\t} catch( e ) {}\n}\n\nfunction createActiveXHR() {\n\ttry {\n\t\treturn new window.ActiveXObject( \"Microsoft.XMLHTTP\" );\n\t} catch( e ) {}\n}\n\n// Create the request object\n// (This is still attached to ajaxSettings for backward compatibility)\njQuery.ajaxSettings.xhr = window.ActiveXObject ?\n\t/* Microsoft failed to properly\n\t * implement the XMLHttpRequest in IE7 (can't request local files),\n\t * so we use the ActiveXObject when it is available\n\t * Additionally XMLHttpRequest can be disabled in IE7/IE8 so\n\t * we need a fallback.\n\t */\n\tfunction() {\n\t\treturn !this.isLocal && createStandardXHR() || createActiveXHR();\n\t} :\n\t// For all other browsers, use the standard XMLHttpRequest object\n\tcreateStandardXHR;\n\n// Determine support properties\n(function( xhr ) {\n\tjQuery.extend( jQuery.support, {\n\t\tajax: !!xhr,\n\t\tcors: !!xhr && ( \"withCredentials\" in xhr )\n\t});\n})( jQuery.ajaxSettings.xhr() );\n\n// Create transport if the browser can provide an xhr\nif ( jQuery.support.ajax ) {\n\n\tjQuery.ajaxTransport(function( s ) {\n\t\t// Cross domain only allowed if supported through XMLHttpRequest\n\t\tif ( !s.crossDomain || jQuery.support.cors ) {\n\n\t\t\tvar callback;\n\n\t\t\treturn {\n\t\t\t\tsend: function( headers, complete ) {\n\n\t\t\t\t\t// Get a new xhr\n\t\t\t\t\tvar xhr = s.xhr(),\n\t\t\t\t\t\thandle,\n\t\t\t\t\t\ti;\n\n\t\t\t\t\t// Open the socket\n\t\t\t\t\t// Passing null username, generates a login popup on Opera (#2865)\n\t\t\t\t\tif ( s.username ) {\n\t\t\t\t\t\txhr.open( s.type, s.url, s.async, s.username, s.password );\n\t\t\t\t\t} else {\n\t\t\t\t\t\txhr.open( s.type, s.url, s.async );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Apply custom fields if provided\n\t\t\t\t\tif ( s.xhrFields ) {\n\t\t\t\t\t\tfor ( i in s.xhrFields ) {\n\t\t\t\t\t\t\txhr[ i ] = s.xhrFields[ i ];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Override mime type if needed\n\t\t\t\t\tif ( s.mimeType && xhr.overrideMimeType ) {\n\t\t\t\t\t\txhr.overrideMimeType( s.mimeType );\n\t\t\t\t\t}\n\n\t\t\t\t\t// X-Requested-With header\n\t\t\t\t\t// For cross-domain requests, seeing as conditions for a preflight are\n\t\t\t\t\t// akin to a jigsaw puzzle, we simply never set it to be sure.\n\t\t\t\t\t// (it can always be set on a per-request basis or even using ajaxSetup)\n\t\t\t\t\t// For same-domain requests, won't change header if already provided.\n\t\t\t\t\tif ( !s.crossDomain && !headers[\"X-Requested-With\"] ) {\n\t\t\t\t\t\theaders[ \"X-Requested-With\" ] = \"XMLHttpRequest\";\n\t\t\t\t\t}\n\n\t\t\t\t\t// Need an extra try/catch for cross domain requests in Firefox 3\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfor ( i in headers ) {\n\t\t\t\t\t\t\txhr.setRequestHeader( i, headers[ i ] );\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch( _ ) {}\n\n\t\t\t\t\t// Do send the request\n\t\t\t\t\t// This may raise an exception which is actually\n\t\t\t\t\t// handled in jQuery.ajax (so no try/catch here)\n\t\t\t\t\txhr.send( ( s.hasContent && s.data ) || null );\n\n\t\t\t\t\t// Listener\n\t\t\t\t\tcallback = function( _, isAbort ) {\n\n\t\t\t\t\t\tvar status,\n\t\t\t\t\t\t\tstatusText,\n\t\t\t\t\t\t\tresponseHeaders,\n\t\t\t\t\t\t\tresponses,\n\t\t\t\t\t\t\txml;\n\n\t\t\t\t\t\t// Firefox throws exceptions when accessing properties\n\t\t\t\t\t\t// of an xhr when a network error occured\n\t\t\t\t\t\t// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)\n\t\t\t\t\t\ttry {\n\n\t\t\t\t\t\t\t// Was never called and is aborted or complete\n\t\t\t\t\t\t\tif ( callback && ( isAbort || xhr.readyState === 4 ) ) {\n\n\t\t\t\t\t\t\t\t// Only called once\n\t\t\t\t\t\t\t\tcallback = undefined;\n\n\t\t\t\t\t\t\t\t// Do not keep as active anymore\n\t\t\t\t\t\t\t\tif ( handle ) {\n\t\t\t\t\t\t\t\t\txhr.onreadystatechange = jQuery.noop;\n\t\t\t\t\t\t\t\t\tif ( xhrOnUnloadAbort ) {\n\t\t\t\t\t\t\t\t\t\tdelete xhrCallbacks[ handle ];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// If it's an abort\n\t\t\t\t\t\t\t\tif ( isAbort ) {\n\t\t\t\t\t\t\t\t\t// Abort it manually if needed\n\t\t\t\t\t\t\t\t\tif ( xhr.readyState !== 4 ) {\n\t\t\t\t\t\t\t\t\t\txhr.abort();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tstatus = xhr.status;\n\t\t\t\t\t\t\t\t\tresponseHeaders = xhr.getAllResponseHeaders();\n\t\t\t\t\t\t\t\t\tresponses = {};\n\t\t\t\t\t\t\t\t\txml = xhr.responseXML;\n\n\t\t\t\t\t\t\t\t\t// Construct response list\n\t\t\t\t\t\t\t\t\tif ( xml && xml.documentElement /* #4958 */ ) {\n\t\t\t\t\t\t\t\t\t\tresponses.xml = xml;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tresponses.text = xhr.responseText;\n\n\t\t\t\t\t\t\t\t\t// Firefox throws an exception when accessing\n\t\t\t\t\t\t\t\t\t// statusText for faulty cross-domain requests\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tstatusText = xhr.statusText;\n\t\t\t\t\t\t\t\t\t} catch( e ) {\n\t\t\t\t\t\t\t\t\t\t// We normalize with Webkit giving an empty statusText\n\t\t\t\t\t\t\t\t\t\tstatusText = \"\";\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// Filter status for non standard behaviors\n\n\t\t\t\t\t\t\t\t\t// If the request is local and we have data: assume a success\n\t\t\t\t\t\t\t\t\t// (success with no data won't get notified, that's the best we\n\t\t\t\t\t\t\t\t\t// can do given current implementations)\n\t\t\t\t\t\t\t\t\tif ( !status && s.isLocal && !s.crossDomain ) {\n\t\t\t\t\t\t\t\t\t\tstatus = responses.text ? 200 : 404;\n\t\t\t\t\t\t\t\t\t// IE - #1450: sometimes returns 1223 when it should be 204\n\t\t\t\t\t\t\t\t\t} else if ( status === 1223 ) {\n\t\t\t\t\t\t\t\t\t\tstatus = 204;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch( firefoxAccessException ) {\n\t\t\t\t\t\t\tif ( !isAbort ) {\n\t\t\t\t\t\t\t\tcomplete( -1, firefoxAccessException );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Call complete if needed\n\t\t\t\t\t\tif ( responses ) {\n\t\t\t\t\t\t\tcomplete( status, statusText, responses, responseHeaders );\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\t// if we're in sync mode or it's in cache\n\t\t\t\t\t// and has been retrieved directly (IE6 & IE7)\n\t\t\t\t\t// we need to manually fire the callback\n\t\t\t\t\tif ( !s.async || xhr.readyState === 4 ) {\n\t\t\t\t\t\tcallback();\n\t\t\t\t\t} else {\n\t\t\t\t\t\thandle = ++xhrId;\n\t\t\t\t\t\tif ( xhrOnUnloadAbort ) {\n\t\t\t\t\t\t\t// Create the active xhrs callbacks list if needed\n\t\t\t\t\t\t\t// and attach the unload handler\n\t\t\t\t\t\t\tif ( !xhrCallbacks ) {\n\t\t\t\t\t\t\t\txhrCallbacks = {};\n\t\t\t\t\t\t\t\tjQuery( window ).unload( xhrOnUnloadAbort );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Add to list of active xhrs callbacks\n\t\t\t\t\t\t\txhrCallbacks[ handle ] = callback;\n\t\t\t\t\t\t}\n\t\t\t\t\t\txhr.onreadystatechange = callback;\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\t\tabort: function() {\n\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\tcallback(0,1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t});\n}\n\n\n\n\nvar elemdisplay = {},\n\tiframe, iframeDoc,\n\trfxtypes = /^(?:toggle|show|hide)$/,\n\trfxnum = /^([+\\-]=)?([\\d+.\\-]+)([a-z%]*)$/i,\n\ttimerId,\n\tfxAttrs = [\n\t\t// height animations\n\t\t[ \"height\", \"marginTop\", \"marginBottom\", \"paddingTop\", \"paddingBottom\" ],\n\t\t// width animations\n\t\t[ \"width\", \"marginLeft\", \"marginRight\", \"paddingLeft\", \"paddingRight\" ],\n\t\t// opacity animations\n\t\t[ \"opacity\" ]\n\t],\n\tfxNow;\n\njQuery.fn.extend({\n\tshow: function( speed, easing, callback ) {\n\t\tvar elem, display;\n\n\t\tif ( speed || speed === 0 ) {\n\t\t\treturn this.animate( genFx(\"show\", 3), speed, easing, callback);\n\n\t\t} else {\n\t\t\tfor ( var i = 0, j = this.length; i < j; i++ ) {\n\t\t\t\telem = this[i];\n\n\t\t\t\tif ( elem.style ) {\n\t\t\t\t\tdisplay = elem.style.display;\n\n\t\t\t\t\t// Reset the inline display of this element to learn if it is\n\t\t\t\t\t// being hidden by cascaded rules or not\n\t\t\t\t\tif ( !jQuery._data(elem, \"olddisplay\") && display === \"none\" ) {\n\t\t\t\t\t\tdisplay = elem.style.display = \"\";\n\t\t\t\t\t}\n\n\t\t\t\t\t// Set elements which have been overridden with display: none\n\t\t\t\t\t// in a stylesheet to whatever the default browser style is\n\t\t\t\t\t// for such an element\n\t\t\t\t\tif ( display === \"\" && jQuery.css( elem, \"display\" ) === \"none\" ) {\n\t\t\t\t\t\tjQuery._data(elem, \"olddisplay\", defaultDisplay(elem.nodeName));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Set the display of most of the elements in a second loop\n\t\t\t// to avoid the constant reflow\n\t\t\tfor ( i = 0; i < j; i++ ) {\n\t\t\t\telem = this[i];\n\n\t\t\t\tif ( elem.style ) {\n\t\t\t\t\tdisplay = elem.style.display;\n\n\t\t\t\t\tif ( display === \"\" || display === \"none\" ) {\n\t\t\t\t\t\telem.style.display = jQuery._data(elem, \"olddisplay\") || \"\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this;\n\t\t}\n\t},\n\n\thide: function( speed, easing, callback ) {\n\t\tif ( speed || speed === 0 ) {\n\t\t\treturn this.animate( genFx(\"hide\", 3), speed, easing, callback);\n\n\t\t} else {\n\t\t\tfor ( var i = 0, j = this.length; i < j; i++ ) {\n\t\t\t\tif ( this[i].style ) {\n\t\t\t\t\tvar display = jQuery.css( this[i], \"display\" );\n\n\t\t\t\t\tif ( display !== \"none\" && !jQuery._data( this[i], \"olddisplay\" ) ) {\n\t\t\t\t\t\tjQuery._data( this[i], \"olddisplay\", display );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Set the display of the elements in a second loop\n\t\t\t// to avoid the constant reflow\n\t\t\tfor ( i = 0; i < j; i++ ) {\n\t\t\t\tif ( this[i].style ) {\n\t\t\t\t\tthis[i].style.display = \"none\";\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn this;\n\t\t}\n\t},\n\n\t// Save the old toggle function\n\t_toggle: jQuery.fn.toggle,\n\n\ttoggle: function( fn, fn2, callback ) {\n\t\tvar bool = typeof fn === \"boolean\";\n\n\t\tif ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {\n\t\t\tthis._toggle.apply( this, arguments );\n\n\t\t} else if ( fn == null || bool ) {\n\t\t\tthis.each(function() {\n\t\t\t\tvar state = bool ? fn : jQuery(this).is(\":hidden\");\n\t\t\t\tjQuery(this)[ state ? \"show\" : \"hide\" ]();\n\t\t\t});\n\n\t\t} else {\n\t\t\tthis.animate(genFx(\"toggle\", 3), fn, fn2, callback);\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tfadeTo: function( speed, to, easing, callback ) {\n\t\treturn this.filter(\":hidden\").css(\"opacity\", 0).show().end()\n\t\t\t\t\t.animate({opacity: to}, speed, easing, callback);\n\t},\n\n\tanimate: function( prop, speed, easing, callback ) {\n\t\tvar optall = jQuery.speed(speed, easing, callback);\n\n\t\tif ( jQuery.isEmptyObject( prop ) ) {\n\t\t\treturn this.each( optall.complete, [ false ] );\n\t\t}\n\n\t\t// Do not change referenced properties as per-property easing will be lost\n\t\tprop = jQuery.extend( {}, prop );\n\n\t\treturn this[ optall.queue === false ? \"each\" : \"queue\" ](function() {\n\t\t\t// XXX 'this' does not always have a nodeName when running the\n\t\t\t// test suite\n\n\t\t\tif ( optall.queue === false ) {\n\t\t\t\tjQuery._mark( this );\n\t\t\t}\n\n\t\t\tvar opt = jQuery.extend( {}, optall ),\n\t\t\t\tisElement = this.nodeType === 1,\n\t\t\t\thidden = isElement && jQuery(this).is(\":hidden\"),\n\t\t\t\tname, val, p,\n\t\t\t\tdisplay, e,\n\t\t\t\tparts, start, end, unit;\n\n\t\t\t// will store per property easing and be used to determine when an animation is complete\n\t\t\topt.animatedProperties = {};\n\n\t\t\tfor ( p in prop ) {\n\n\t\t\t\t// property name normalization\n\t\t\t\tname = jQuery.camelCase( p );\n\t\t\t\tif ( p !== name ) {\n\t\t\t\t\tprop[ name ] = prop[ p ];\n\t\t\t\t\tdelete prop[ p ];\n\t\t\t\t}\n\n\t\t\t\tval = prop[ name ];\n\n\t\t\t\t// easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)\n\t\t\t\tif ( jQuery.isArray( val ) ) {\n\t\t\t\t\topt.animatedProperties[ name ] = val[ 1 ];\n\t\t\t\t\tval = prop[ name ] = val[ 0 ];\n\t\t\t\t} else {\n\t\t\t\t\topt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';\n\t\t\t\t}\n\n\t\t\t\tif ( val === \"hide\" && hidden || val === \"show\" && !hidden ) {\n\t\t\t\t\treturn opt.complete.call( this );\n\t\t\t\t}\n\n\t\t\t\tif ( isElement && ( name === \"height\" || name === \"width\" ) ) {\n\t\t\t\t\t// Make sure that nothing sneaks out\n\t\t\t\t\t// Record all 3 overflow attributes because IE does not\n\t\t\t\t\t// change the overflow attribute when overflowX and\n\t\t\t\t\t// overflowY are set to the same value\n\t\t\t\t\topt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];\n\n\t\t\t\t\t// Set display property to inline-block for height/width\n\t\t\t\t\t// animations on inline elements that are having width/height\n\t\t\t\t\t// animated\n\t\t\t\t\tif ( jQuery.css( this, \"display\" ) === \"inline\" &&\n\t\t\t\t\t\t\tjQuery.css( this, \"float\" ) === \"none\" ) {\n\t\t\t\t\t\tif ( !jQuery.support.inlineBlockNeedsLayout ) {\n\t\t\t\t\t\t\tthis.style.display = \"inline-block\";\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdisplay = defaultDisplay( this.nodeName );\n\n\t\t\t\t\t\t\t// inline-level elements accept inline-block;\n\t\t\t\t\t\t\t// block-level elements need to be inline with layout\n\t\t\t\t\t\t\tif ( display === \"inline\" ) {\n\t\t\t\t\t\t\t\tthis.style.display = \"inline-block\";\n\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.style.display = \"inline\";\n\t\t\t\t\t\t\t\tthis.style.zoom = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( opt.overflow != null ) {\n\t\t\t\tthis.style.overflow = \"hidden\";\n\t\t\t}\n\n\t\t\tfor ( p in prop ) {\n\t\t\t\te = new jQuery.fx( this, opt, p );\n\t\t\t\tval = prop[ p ];\n\n\t\t\t\tif ( rfxtypes.test(val) ) {\n\t\t\t\t\te[ val === \"toggle\" ? hidden ? \"show\" : \"hide\" : val ]();\n\n\t\t\t\t} else {\n\t\t\t\t\tparts = rfxnum.exec( val );\n\t\t\t\t\tstart = e.cur();\n\n\t\t\t\t\tif ( parts ) {\n\t\t\t\t\t\tend = parseFloat( parts[2] );\n\t\t\t\t\t\tunit = parts[3] || ( jQuery.cssNumber[ p ] ? \"\" : \"px\" );\n\n\t\t\t\t\t\t// We need to compute starting value\n\t\t\t\t\t\tif ( unit !== \"px\" ) {\n\t\t\t\t\t\t\tjQuery.style( this, p, (end || 1) + unit);\n\t\t\t\t\t\t\tstart = ((end || 1) / e.cur()) * start;\n\t\t\t\t\t\t\tjQuery.style( this, p, start + unit);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If a +=/-= token was provided, we're doing a relative animation\n\t\t\t\t\t\tif ( parts[1] ) {\n\t\t\t\t\t\t\tend = ( (parts[ 1 ] === \"-=\" ? -1 : 1) * end ) + start;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\te.custom( start, end, unit );\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\te.custom( start, val, \"\" );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// For JS strict compliance\n\t\t\treturn true;\n\t\t});\n\t},\n\n\tstop: function( clearQueue, gotoEnd ) {\n\t\tif ( clearQueue ) {\n\t\t\tthis.queue([]);\n\t\t}\n\n\t\tthis.each(function() {\n\t\t\tvar timers = jQuery.timers,\n\t\t\t\ti = timers.length;\n\t\t\t// clear marker counters if we know they won't be\n\t\t\tif ( !gotoEnd ) {\n\t\t\t\tjQuery._unmark( true, this );\n\t\t\t}\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( timers[i].elem === this ) {\n\t\t\t\t\tif (gotoEnd) {\n\t\t\t\t\t\t// force the next step to be the last\n\t\t\t\t\t\ttimers[i](true);\n\t\t\t\t\t}\n\n\t\t\t\t\ttimers.splice(i, 1);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// start the next in the queue if the last step wasn't forced\n\t\tif ( !gotoEnd ) {\n\t\t\tthis.dequeue();\n\t\t}\n\n\t\treturn this;\n\t}\n\n});\n\n// Animations created synchronously will run synchronously\nfunction createFxNow() {\n\tsetTimeout( clearFxNow, 0 );\n\treturn ( fxNow = jQuery.now() );\n}\n\nfunction clearFxNow() {\n\tfxNow = undefined;\n}\n\n// Generate parameters to create a standard animation\nfunction genFx( type, num ) {\n\tvar obj = {};\n\n\tjQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() {\n\t\tobj[ this ] = type;\n\t});\n\n\treturn obj;\n}\n\n// Generate shortcuts for custom animations\njQuery.each({\n\tslideDown: genFx(\"show\", 1),\n\tslideUp: genFx(\"hide\", 1),\n\tslideToggle: genFx(\"toggle\", 1),\n\tfadeIn: { opacity: \"show\" },\n\tfadeOut: { opacity: \"hide\" },\n\tfadeToggle: { opacity: \"toggle\" }\n}, function( name, props ) {\n\tjQuery.fn[ name ] = function( speed, easing, callback ) {\n\t\treturn this.animate( props, speed, easing, callback );\n\t};\n});\n\njQuery.extend({\n\tspeed: function( speed, easing, fn ) {\n\t\tvar opt = speed && typeof speed === \"object\" ? jQuery.extend({}, speed) : {\n\t\t\tcomplete: fn || !fn && easing ||\n\t\t\t\tjQuery.isFunction( speed ) && speed,\n\t\t\tduration: speed,\n\t\t\teasing: fn && easing || easing && !jQuery.isFunction(easing) && easing\n\t\t};\n\n\t\topt.duration = jQuery.fx.off ? 0 : typeof opt.duration === \"number\" ? opt.duration :\n\t\t\topt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;\n\n\t\t// Queueing\n\t\topt.old = opt.complete;\n\t\topt.complete = function( noUnmark ) {\n\t\t\tif ( jQuery.isFunction( opt.old ) ) {\n\t\t\t\topt.old.call( this );\n\t\t\t}\n\n\t\t\tif ( opt.queue !== false ) {\n\t\t\t\tjQuery.dequeue( this );\n\t\t\t} else if ( noUnmark !== false ) {\n\t\t\t\tjQuery._unmark( this );\n\t\t\t}\n\t\t};\n\n\t\treturn opt;\n\t},\n\n\teasing: {\n\t\tlinear: function( p, n, firstNum, diff ) {\n\t\t\treturn firstNum + diff * p;\n\t\t},\n\t\tswing: function( p, n, firstNum, diff ) {\n\t\t\treturn ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;\n\t\t}\n\t},\n\n\ttimers: [],\n\n\tfx: function( elem, options, prop ) {\n\t\tthis.options = options;\n\t\tthis.elem = elem;\n\t\tthis.prop = prop;\n\n\t\toptions.orig = options.orig || {};\n\t}\n\n});\n\njQuery.fx.prototype = {\n\t// Simple function for setting a style value\n\tupdate: function() {\n\t\tif ( this.options.step ) {\n\t\t\tthis.options.step.call( this.elem, this.now, this );\n\t\t}\n\n\t\t(jQuery.fx.step[this.prop] || jQuery.fx.step._default)( this );\n\t},\n\n\t// Get the current size\n\tcur: function() {\n\t\tif ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {\n\t\t\treturn this.elem[ this.prop ];\n\t\t}\n\n\t\tvar parsed,\n\t\t\tr = jQuery.css( this.elem, this.prop );\n\t\t// Empty strings, null, undefined and \"auto\" are converted to 0,\n\t\t// complex values such as \"rotate(1rad)\" are returned as is,\n\t\t// simple values such as \"10px\" are parsed to Float.\n\t\treturn isNaN( parsed = parseFloat( r ) ) ? !r || r === \"auto\" ? 0 : r : parsed;\n\t},\n\n\t// Start an animation from one number to another\n\tcustom: function( from, to, unit ) {\n\t\tvar self = this,\n\t\t\tfx = jQuery.fx;\n\n\t\tthis.startTime = fxNow || createFxNow();\n\t\tthis.start = from;\n\t\tthis.end = to;\n\t\tthis.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? \"\" : \"px\" );\n\t\tthis.now = this.start;\n\t\tthis.pos = this.state = 0;\n\n\t\tfunction t( gotoEnd ) {\n\t\t\treturn self.step(gotoEnd);\n\t\t}\n\n\t\tt.elem = this.elem;\n\n\t\tif ( t() && jQuery.timers.push(t) && !timerId ) {\n\t\t\ttimerId = setInterval( fx.tick, fx.interval );\n\t\t}\n\t},\n\n\t// Simple 'show' function\n\tshow: function() {\n\t\t// Remember where we started, so that we can go back to it later\n\t\tthis.options.orig[this.prop] = jQuery.style( this.elem, this.prop );\n\t\tthis.options.show = true;\n\n\t\t// Begin the animation\n\t\t// Make sure that we start at a small width/height to avoid any\n\t\t// flash of content\n\t\tthis.custom(this.prop === \"width\" || this.prop === \"height\" ? 1 : 0, this.cur());\n\n\t\t// Start by showing the element\n\t\tjQuery( this.elem ).show();\n\t},\n\n\t// Simple 'hide' function\n\thide: function() {\n\t\t// Remember where we started, so that we can go back to it later\n\t\tthis.options.orig[this.prop] = jQuery.style( this.elem, this.prop );\n\t\tthis.options.hide = true;\n\n\t\t// Begin the animation\n\t\tthis.custom(this.cur(), 0);\n\t},\n\n\t// Each step of an animation\n\tstep: function( gotoEnd ) {\n\t\tvar t = fxNow || createFxNow(),\n\t\t\tdone = true,\n\t\t\telem = this.elem,\n\t\t\toptions = this.options,\n\t\t\ti, n;\n\n\t\tif ( gotoEnd || t >= options.duration + this.startTime ) {\n\t\t\tthis.now = this.end;\n\t\t\tthis.pos = this.state = 1;\n\t\t\tthis.update();\n\n\t\t\toptions.animatedProperties[ this.prop ] = true;\n\n\t\t\tfor ( i in options.animatedProperties ) {\n\t\t\t\tif ( options.animatedProperties[i] !== true ) {\n\t\t\t\t\tdone = false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( done ) {\n\t\t\t\t// Reset the overflow\n\t\t\t\tif ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {\n\n\t\t\t\t\tjQuery.each( [ \"\", \"X\", \"Y\" ], function (index, value) {\n\t\t\t\t\t\telem.style[ \"overflow\" + value ] = options.overflow[index];\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\t// Hide the element if the \"hide\" operation was done\n\t\t\t\tif ( options.hide ) {\n\t\t\t\t\tjQuery(elem).hide();\n\t\t\t\t}\n\n\t\t\t\t// Reset the properties, if the item has been hidden or shown\n\t\t\t\tif ( options.hide || options.show ) {\n\t\t\t\t\tfor ( var p in options.animatedProperties ) {\n\t\t\t\t\t\tjQuery.style( elem, p, options.orig[p] );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Execute the complete function\n\t\t\t\toptions.complete.call( elem );\n\t\t\t}\n\n\t\t\treturn false;\n\n\t\t} else {\n\t\t\t// classical easing cannot be used with an Infinity duration\n\t\t\tif ( options.duration == Infinity ) {\n\t\t\t\tthis.now = t;\n\t\t\t} else {\n\t\t\t\tn = t - this.startTime;\n\t\t\t\tthis.state = n / options.duration;\n\n\t\t\t\t// Perform the easing function, defaults to swing\n\t\t\t\tthis.pos = jQuery.easing[ options.animatedProperties[ this.prop ] ]( this.state, n, 0, 1, options.duration );\n\t\t\t\tthis.now = this.start + ((this.end - this.start) * this.pos);\n\t\t\t}\n\t\t\t// Perform the next step of the animation\n\t\t\tthis.update();\n\t\t}\n\n\t\treturn true;\n\t}\n};\n\njQuery.extend( jQuery.fx, {\n\ttick: function() {\n\t\tfor ( var timers = jQuery.timers, i = 0 ; i < timers.length ; ++i ) {\n\t\t\tif ( !timers[i]() ) {\n\t\t\t\ttimers.splice(i--, 1);\n\t\t\t}\n\t\t}\n\n\t\tif ( !timers.length ) {\n\t\t\tjQuery.fx.stop();\n\t\t}\n\t},\n\n\tinterval: 13,\n\n\tstop: function() {\n\t\tclearInterval( timerId );\n\t\ttimerId = null;\n\t},\n\n\tspeeds: {\n\t\tslow: 600,\n\t\tfast: 200,\n\t\t// Default speed\n\t\t_default: 400\n\t},\n\n\tstep: {\n\t\topacity: function( fx ) {\n\t\t\tjQuery.style( fx.elem, \"opacity\", fx.now );\n\t\t},\n\n\t\t_default: function( fx ) {\n\t\t\tif ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {\n\t\t\t\tfx.elem.style[ fx.prop ] = (fx.prop === \"width\" || fx.prop === \"height\" ? Math.max(0, fx.now) : fx.now) + fx.unit;\n\t\t\t} else {\n\t\t\t\tfx.elem[ fx.prop ] = fx.now;\n\t\t\t}\n\t\t}\n\t}\n});\n\nif ( jQuery.expr && jQuery.expr.filters ) {\n\tjQuery.expr.filters.animated = function( elem ) {\n\t\treturn jQuery.grep(jQuery.timers, function( fn ) {\n\t\t\treturn elem === fn.elem;\n\t\t}).length;\n\t};\n}\n\n// Try to restore the default display value of an element\nfunction defaultDisplay( nodeName ) {\n\n\tif ( !elemdisplay[ nodeName ] ) {\n\n\t\tvar body = document.body,\n\t\t\telem = jQuery( \"<\" + nodeName + \">\" ).appendTo( body ),\n\t\t\tdisplay = elem.css( \"display\" );\n\n\t\telem.remove();\n\n\t\t// If the simple way fails,\n\t\t// get element's real default display by attaching it to a temp iframe\n\t\tif ( display === \"none\" || display === \"\" ) {\n\t\t\t// No iframe to use yet, so create it\n\t\t\tif ( !iframe ) {\n\t\t\t\tiframe = document.createElement( \"iframe\" );\n\t\t\t\tiframe.frameBorder = iframe.width = iframe.height = 0;\n\t\t\t}\n\n\t\t\tbody.appendChild( iframe );\n\n\t\t\t// Create a cacheable copy of the iframe document on first call.\n\t\t\t// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML\n\t\t\t// document to it; WebKit & Firefox won't allow reusing the iframe document.\n\t\t\tif ( !iframeDoc || !iframe.createElement ) {\n\t\t\t\tiframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;\n\t\t\t\tiframeDoc.write( ( document.compatMode === \"CSS1Compat\" ? \"<!doctype html>\" : \"\" ) + \"<html><body>\" );\n\t\t\t\tiframeDoc.close();\n\t\t\t}\n\n\t\t\telem = iframeDoc.createElement( nodeName );\n\n\t\t\tiframeDoc.body.appendChild( elem );\n\n\t\t\tdisplay = jQuery.css( elem, \"display\" );\n\n\t\t\tbody.removeChild( iframe );\n\t\t}\n\n\t\t// Store the correct default display\n\t\telemdisplay[ nodeName ] = display;\n\t}\n\n\treturn elemdisplay[ nodeName ];\n}\n\n\n\n\nvar rtable = /^t(?:able|d|h)$/i,\n\trroot = /^(?:body|html)$/i;\n\nif ( \"getBoundingClientRect\" in document.documentElement ) {\n\tjQuery.fn.offset = function( options ) {\n\t\tvar elem = this[0], box;\n\n\t\tif ( options ) {\n\t\t\treturn this.each(function( i ) {\n\t\t\t\tjQuery.offset.setOffset( this, options, i );\n\t\t\t});\n\t\t}\n\n\t\tif ( !elem || !elem.ownerDocument ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif ( elem === elem.ownerDocument.body ) {\n\t\t\treturn jQuery.offset.bodyOffset( elem );\n\t\t}\n\n\t\ttry {\n\t\t\tbox = elem.getBoundingClientRect();\n\t\t} catch(e) {}\n\n\t\tvar doc = elem.ownerDocument,\n\t\t\tdocElem = doc.documentElement;\n\n\t\t// Make sure we're not dealing with a disconnected DOM node\n\t\tif ( !box || !jQuery.contains( docElem, elem ) ) {\n\t\t\treturn box ? { top: box.top, left: box.left } : { top: 0, left: 0 };\n\t\t}\n\n\t\tvar body = doc.body,\n\t\t\twin = getWindow(doc),\n\t\t\tclientTop  = docElem.clientTop  || body.clientTop  || 0,\n\t\t\tclientLeft = docElem.clientLeft || body.clientLeft || 0,\n\t\t\tscrollTop  = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop  || body.scrollTop,\n\t\t\tscrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,\n\t\t\ttop  = box.top  + scrollTop  - clientTop,\n\t\t\tleft = box.left + scrollLeft - clientLeft;\n\n\t\treturn { top: top, left: left };\n\t};\n\n} else {\n\tjQuery.fn.offset = function( options ) {\n\t\tvar elem = this[0];\n\n\t\tif ( options ) {\n\t\t\treturn this.each(function( i ) {\n\t\t\t\tjQuery.offset.setOffset( this, options, i );\n\t\t\t});\n\t\t}\n\n\t\tif ( !elem || !elem.ownerDocument ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tif ( elem === elem.ownerDocument.body ) {\n\t\t\treturn jQuery.offset.bodyOffset( elem );\n\t\t}\n\n\t\tjQuery.offset.initialize();\n\n\t\tvar computedStyle,\n\t\t\toffsetParent = elem.offsetParent,\n\t\t\tprevOffsetParent = elem,\n\t\t\tdoc = elem.ownerDocument,\n\t\t\tdocElem = doc.documentElement,\n\t\t\tbody = doc.body,\n\t\t\tdefaultView = doc.defaultView,\n\t\t\tprevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,\n\t\t\ttop = elem.offsetTop,\n\t\t\tleft = elem.offsetLeft;\n\n\t\twhile ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {\n\t\t\tif ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === \"fixed\" ) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcomputedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;\n\t\t\ttop  -= elem.scrollTop;\n\t\t\tleft -= elem.scrollLeft;\n\n\t\t\tif ( elem === offsetParent ) {\n\t\t\t\ttop  += elem.offsetTop;\n\t\t\t\tleft += elem.offsetLeft;\n\n\t\t\t\tif ( jQuery.offset.doesNotAddBorder && !(jQuery.offset.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {\n\t\t\t\t\ttop  += parseFloat( computedStyle.borderTopWidth  ) || 0;\n\t\t\t\t\tleft += parseFloat( computedStyle.borderLeftWidth ) || 0;\n\t\t\t\t}\n\n\t\t\t\tprevOffsetParent = offsetParent;\n\t\t\t\toffsetParent = elem.offsetParent;\n\t\t\t}\n\n\t\t\tif ( jQuery.offset.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== \"visible\" ) {\n\t\t\t\ttop  += parseFloat( computedStyle.borderTopWidth  ) || 0;\n\t\t\t\tleft += parseFloat( computedStyle.borderLeftWidth ) || 0;\n\t\t\t}\n\n\t\t\tprevComputedStyle = computedStyle;\n\t\t}\n\n\t\tif ( prevComputedStyle.position === \"relative\" || prevComputedStyle.position === \"static\" ) {\n\t\t\ttop  += body.offsetTop;\n\t\t\tleft += body.offsetLeft;\n\t\t}\n\n\t\tif ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === \"fixed\" ) {\n\t\t\ttop  += Math.max( docElem.scrollTop, body.scrollTop );\n\t\t\tleft += Math.max( docElem.scrollLeft, body.scrollLeft );\n\t\t}\n\n\t\treturn { top: top, left: left };\n\t};\n}\n\njQuery.offset = {\n\tinitialize: function() {\n\t\tvar body = document.body, container = document.createElement(\"div\"), innerDiv, checkDiv, table, td, bodyMarginTop = parseFloat( jQuery.css(body, \"marginTop\") ) || 0,\n\t\t\thtml = \"<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>\";\n\n\t\tjQuery.extend( container.style, { position: \"absolute\", top: 0, left: 0, margin: 0, border: 0, width: \"1px\", height: \"1px\", visibility: \"hidden\" } );\n\n\t\tcontainer.innerHTML = html;\n\t\tbody.insertBefore( container, body.firstChild );\n\t\tinnerDiv = container.firstChild;\n\t\tcheckDiv = innerDiv.firstChild;\n\t\ttd = innerDiv.nextSibling.firstChild.firstChild;\n\n\t\tthis.doesNotAddBorder = (checkDiv.offsetTop !== 5);\n\t\tthis.doesAddBorderForTableAndCells = (td.offsetTop === 5);\n\n\t\tcheckDiv.style.position = \"fixed\";\n\t\tcheckDiv.style.top = \"20px\";\n\n\t\t// safari subtracts parent border width here which is 5px\n\t\tthis.supportsFixedPosition = (checkDiv.offsetTop === 20 || checkDiv.offsetTop === 15);\n\t\tcheckDiv.style.position = checkDiv.style.top = \"\";\n\n\t\tinnerDiv.style.overflow = \"hidden\";\n\t\tinnerDiv.style.position = \"relative\";\n\n\t\tthis.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5);\n\n\t\tthis.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop);\n\n\t\tbody.removeChild( container );\n\t\tjQuery.offset.initialize = jQuery.noop;\n\t},\n\n\tbodyOffset: function( body ) {\n\t\tvar top = body.offsetTop,\n\t\t\tleft = body.offsetLeft;\n\n\t\tjQuery.offset.initialize();\n\n\t\tif ( jQuery.offset.doesNotIncludeMarginInBodyOffset ) {\n\t\t\ttop  += parseFloat( jQuery.css(body, \"marginTop\") ) || 0;\n\t\t\tleft += parseFloat( jQuery.css(body, \"marginLeft\") ) || 0;\n\t\t}\n\n\t\treturn { top: top, left: left };\n\t},\n\n\tsetOffset: function( elem, options, i ) {\n\t\tvar position = jQuery.css( elem, \"position\" );\n\n\t\t// set position first, in-case top/left are set even on static elem\n\t\tif ( position === \"static\" ) {\n\t\t\telem.style.position = \"relative\";\n\t\t}\n\n\t\tvar curElem = jQuery( elem ),\n\t\t\tcurOffset = curElem.offset(),\n\t\t\tcurCSSTop = jQuery.css( elem, \"top\" ),\n\t\t\tcurCSSLeft = jQuery.css( elem, \"left\" ),\n\t\t\tcalculatePosition = (position === \"absolute\" || position === \"fixed\") && jQuery.inArray(\"auto\", [curCSSTop, curCSSLeft]) > -1,\n\t\t\tprops = {}, curPosition = {}, curTop, curLeft;\n\n\t\t// need to be able to calculate position if either top or left is auto and position is either absolute or fixed\n\t\tif ( calculatePosition ) {\n\t\t\tcurPosition = curElem.position();\n\t\t\tcurTop = curPosition.top;\n\t\t\tcurLeft = curPosition.left;\n\t\t} else {\n\t\t\tcurTop = parseFloat( curCSSTop ) || 0;\n\t\t\tcurLeft = parseFloat( curCSSLeft ) || 0;\n\t\t}\n\n\t\tif ( jQuery.isFunction( options ) ) {\n\t\t\toptions = options.call( elem, i, curOffset );\n\t\t}\n\n\t\tif (options.top != null) {\n\t\t\tprops.top = (options.top - curOffset.top) + curTop;\n\t\t}\n\t\tif (options.left != null) {\n\t\t\tprops.left = (options.left - curOffset.left) + curLeft;\n\t\t}\n\n\t\tif ( \"using\" in options ) {\n\t\t\toptions.using.call( elem, props );\n\t\t} else {\n\t\t\tcurElem.css( props );\n\t\t}\n\t}\n};\n\n\njQuery.fn.extend({\n\tposition: function() {\n\t\tif ( !this[0] ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tvar elem = this[0],\n\n\t\t// Get *real* offsetParent\n\t\toffsetParent = this.offsetParent(),\n\n\t\t// Get correct offsets\n\t\toffset       = this.offset(),\n\t\tparentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();\n\n\t\t// Subtract element margins\n\t\t// note: when an element has margin: auto the offsetLeft and marginLeft\n\t\t// are the same in Safari causing offset.left to incorrectly be 0\n\t\toffset.top  -= parseFloat( jQuery.css(elem, \"marginTop\") ) || 0;\n\t\toffset.left -= parseFloat( jQuery.css(elem, \"marginLeft\") ) || 0;\n\n\t\t// Add offsetParent borders\n\t\tparentOffset.top  += parseFloat( jQuery.css(offsetParent[0], \"borderTopWidth\") ) || 0;\n\t\tparentOffset.left += parseFloat( jQuery.css(offsetParent[0], \"borderLeftWidth\") ) || 0;\n\n\t\t// Subtract the two offsets\n\t\treturn {\n\t\t\ttop:  offset.top  - parentOffset.top,\n\t\t\tleft: offset.left - parentOffset.left\n\t\t};\n\t},\n\n\toffsetParent: function() {\n\t\treturn this.map(function() {\n\t\t\tvar offsetParent = this.offsetParent || document.body;\n\t\t\twhile ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, \"position\") === \"static\") ) {\n\t\t\t\toffsetParent = offsetParent.offsetParent;\n\t\t\t}\n\t\t\treturn offsetParent;\n\t\t});\n\t}\n});\n\n\n// Create scrollLeft and scrollTop methods\njQuery.each( [\"Left\", \"Top\"], function( i, name ) {\n\tvar method = \"scroll\" + name;\n\n\tjQuery.fn[ method ] = function( val ) {\n\t\tvar elem, win;\n\n\t\tif ( val === undefined ) {\n\t\t\telem = this[ 0 ];\n\n\t\t\tif ( !elem ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\twin = getWindow( elem );\n\n\t\t\t// Return the scroll offset\n\t\t\treturn win ? (\"pageXOffset\" in win) ? win[ i ? \"pageYOffset\" : \"pageXOffset\" ] :\n\t\t\t\tjQuery.support.boxModel && win.document.documentElement[ method ] ||\n\t\t\t\t\twin.document.body[ method ] :\n\t\t\t\telem[ method ];\n\t\t}\n\n\t\t// Set the scroll offset\n\t\treturn this.each(function() {\n\t\t\twin = getWindow( this );\n\n\t\t\tif ( win ) {\n\t\t\t\twin.scrollTo(\n\t\t\t\t\t!i ? val : jQuery( win ).scrollLeft(),\n\t\t\t\t\t i ? val : jQuery( win ).scrollTop()\n\t\t\t\t);\n\n\t\t\t} else {\n\t\t\t\tthis[ method ] = val;\n\t\t\t}\n\t\t});\n\t};\n});\n\nfunction getWindow( elem ) {\n\treturn jQuery.isWindow( elem ) ?\n\t\telem :\n\t\telem.nodeType === 9 ?\n\t\t\telem.defaultView || elem.parentWindow :\n\t\t\tfalse;\n}\n\n\n\n\n// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods\njQuery.each([ \"Height\", \"Width\" ], function( i, name ) {\n\n\tvar type = name.toLowerCase();\n\n\t// innerHeight and innerWidth\n\tjQuery.fn[ \"inner\" + name ] = function() {\n\t\tvar elem = this[0];\n\t\treturn elem && elem.style ?\n\t\t\tparseFloat( jQuery.css( elem, type, \"padding\" ) ) :\n\t\t\tnull;\n\t};\n\n\t// outerHeight and outerWidth\n\tjQuery.fn[ \"outer\" + name ] = function( margin ) {\n\t\tvar elem = this[0];\n\t\treturn elem && elem.style ?\n\t\t\tparseFloat( jQuery.css( elem, type, margin ? \"margin\" : \"border\" ) ) :\n\t\t\tnull;\n\t};\n\n\tjQuery.fn[ type ] = function( size ) {\n\t\t// Get window width or height\n\t\tvar elem = this[0];\n\t\tif ( !elem ) {\n\t\t\treturn size == null ? null : this;\n\t\t}\n\n\t\tif ( jQuery.isFunction( size ) ) {\n\t\t\treturn this.each(function( i ) {\n\t\t\t\tvar self = jQuery( this );\n\t\t\t\tself[ type ]( size.call( this, i, self[ type ]() ) );\n\t\t\t});\n\t\t}\n\n\t\tif ( jQuery.isWindow( elem ) ) {\n\t\t\t// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode\n\t\t\t// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat\n\t\t\tvar docElemProp = elem.document.documentElement[ \"client\" + name ],\n\t\t\t\tbody = elem.document.body;\n\t\t\treturn elem.document.compatMode === \"CSS1Compat\" && docElemProp ||\n\t\t\t\tbody && body[ \"client\" + name ] || docElemProp;\n\n\t\t// Get document width or height\n\t\t} else if ( elem.nodeType === 9 ) {\n\t\t\t// Either scroll[Width/Height] or offset[Width/Height], whichever is greater\n\t\t\treturn Math.max(\n\t\t\t\telem.documentElement[\"client\" + name],\n\t\t\t\telem.body[\"scroll\" + name], elem.documentElement[\"scroll\" + name],\n\t\t\t\telem.body[\"offset\" + name], elem.documentElement[\"offset\" + name]\n\t\t\t);\n\n\t\t// Get or set width or height on the element\n\t\t} else if ( size === undefined ) {\n\t\t\tvar orig = jQuery.css( elem, type ),\n\t\t\t\tret = parseFloat( orig );\n\n\t\t\treturn jQuery.isNaN( ret ) ? orig : ret;\n\n\t\t// Set the width or height on the element (default to pixels if value is unitless)\n\t\t} else {\n\t\t\treturn this.css( type, typeof size === \"string\" ? size : size + \"px\" );\n\t\t}\n\t};\n\n});\n\n\n// Expose jQuery to the global object\nwindow.jQuery = window.$ = jQuery;\n})(window);"
  },
  {
    "path": "js/plugins.js",
    "content": "\n// usage: log('inside coolFunc', this, arguments);\n// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/\nwindow.log = function(){\n  log.history = log.history || [];   // store logs to an array for reference\n  log.history.push(arguments);\n  if(this.console) {\n    arguments.callee = arguments.callee.caller;\n    var newarr = [].slice.call(arguments);\n    (typeof console.log === 'object' ? log.apply.call(console.log, console, newarr) : console.log.apply(console, newarr));\n  }\n};\n\n// make it safe to use console.log always\n(function(b){function c(){}for(var d=\"assert,clear,count,debug,dir,dirxml,error,exception,firebug,group,groupCollapsed,groupEnd,info,log,memoryProfile,memoryProfileEnd,profile,profileEnd,table,time,timeEnd,timeStamp,trace,warn\".split(\",\"),a;a=d.pop();){b[a]=b[a]||c}})((function(){try\n{console.log();return window.console;}catch(err){return window.console={};}})());\n\n\n// place any jQuery/helper plugins in here, instead of separate, slower script files.\n\n"
  },
  {
    "path": "js/script.js",
    "content": "/* Author:\n  Shi Chuan\n*/\n\n\n\n\n\n"
  },
  {
    "path": "literals-and-constructors/array-literal.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Array literal\n\t\t\t * Description: use array literal notation to avoid potential errors when creating dynamic arrays at runtime\n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\tvar a = new Array();\n\n\n\t\t\t// preferred\n\t\t\tvar a = [];\n\n\n\t\t\t// References\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "literals-and-constructors/enforcing-new.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Enforcing new\n\t\t\t * Description: when you forget `new`, `this` inside the constructor will point to the global object\n\t\t\t */\n\n\t\t\t// constructor\n\t\t\tfunction Waffle() {\n\t\t\t\tthis.tastes = \"yummy\";\n\t\t\t}\n\n\t\t\t// antipattern\n\t\t\t// forgotten `new`\n\t\t\tvar good_morning = Waffle();\n\t\t\tconsole.log(typeof good_morning); // \"undefined\"\n\t\t\tconsole.log(window.tastes); // \"yummy\"\n\n\n\t\t\t// preferred\n\t\t\tvar good_morning = new Waffle();\n\t\t\tconsole.log(typeof good_morning); // \"object\"\n\t\t\tconsole.log(good_morning.tastes); // \"yummy\"\n\n\n\t\t\t// preferred\n\t\t\t// You can also guarantee that this situation never occurs by guaranteeing new instances;\n\t\t\t// Similar to how you can call $() and $.Deferred() in the same way as new $() and new $.Deferred():\n\t\t\tfunction Waffle() {\n\t\t\t\tif (!(this instanceof Waffle)) {\n\t\t\t\t\treturn new Waffle();\n\t\t\t\t}\n\n\t\t\t\tthis.tastes = \"yummy\";\n\t\t\t}\n\n\t\t\tvar good_morning = new Waffle();\n\t\t\tvar good_evening = Waffle();\n\n\t\t\tconsole.log(typeof good_morning); // \"object\"\n\t\t\tconsole.log(good_morning.tastes); // \"yummy\"\n\t\t\tconsole.log(typeof good_evening); // \"object\"\n\t\t\tconsole.log(good_evening.tastes); // \"yummy\"\n\n\n\t\t\t// References\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "literals-and-constructors/json.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Working with JSON\n\t\t\t * Description: use library from JSON.org or YUI, jQuery library\n\t\t\t */\n\n\t\t\t// an input JSON string\n\t\t\tvar jstr = '{\"mykey\": \"my value\"}';\n\n\t\t\t// antipattern\n\t\t\tvar data = eval('(' + jstr + ')');\n\n\n\t\t\t// preferred\n\t\t\t// JSON.org library\n\t\t\tvar data = JSON.parse(jstr);\n\t\t\tconsole.log(data.mykey); // \"my value\"\n\n\n\t\t\t// References\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "literals-and-constructors/object-literal.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Object literal\n\t\t\t * Description: use the simpler and reliable object literal instead of new Object();\n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\tvar car = new Object();\n\t\t\tcar.goes = \"far\";\n\n\n\t\t\t// preferred\n\t\t\tvar car = {goes:\"far\"};\n\n\n\t\t\t// References\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "literals-and-constructors/primitive-wrappers.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Primitive Wrappers\n\t\t\t * Description: JavaScript has 3 primitive wrapper objects: number, string, boolean\n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\t// with wrappers\n\t\t\tvar s = new String(\"my string\");\n\t\t\tvar n = new Number(101);\n\t\t\tvar b = new Boolean(true);\n\n\n\t\t\t// preferred\n\t\t\t// without wrappers\n\t\t\tvar s = \"my string\";\n\t\t\tvar n = 101;\n\t\t\tvar b = true;\n\n\t\t\t/*\n\t\t\t only use primitive wrappers when you want to augment the value and persist state\n\t\t\t */\n\n\t\t\t// primitive string\n\t\t\tvar greet = \"Hello there\";\n\t\t\t// primitive is converted to an object\n\t\t\t// in order to use the split() method\n\t\t\tgreet.split(' ')[0]; // \"Hello\"\n\t\t\t// attemting to augment a primitive is not an error\n\t\t\tgreet.smile = true;\n\t\t\t// but it doesn't actually work\n\t\t\tconsole.log(typeof greet.smile); // \"undefined\"\n\n\t\t\t// primitive wrapper\n\t\t\tvar greet = new String(\"Hello there\");\n\t\t\t// split() method is called directly on the object\n\t\t\tgreet.split(' ')[0]; // \"Hello\"\n\t\t\t// augment the object\n\t\t\tgreet.smile = true;\n\t\t\tconsole.log(typeof greet.smile); // \"boolean\"\n\n\n\t\t\t// References\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "literals-and-constructors/regular-expression-literal.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Regular Expression Literal\n\t\t\t * Description: the regular expression literal notation is shorter\n\t\t\t */\n\n\t\t\t// antipattern\n\t\t\tvar re = new RegExp(\"\\\\\\\\\", \"gm\");\n\n\n\t\t\t// preferred\n\t\t\tvar re = /\\\\/gm;\n\n\n\t\t\t// References\n\t\t\t// http://shop.oreilly.com/product/9780596806767.do\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "object-creation-patterns/chaining.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Chaining Pattern\n\t\t\t Description: it enables you to call methods on an object one after the other\n\t\t\t */\n\n\t\t\tvar obj = {\n\t\t\t\tvalue:1,\n\t\t\t\tincrement:function () {\n\t\t\t\t\tthis.value += 1;\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\t\t\tadd:function (v) {\n\t\t\t\t\tthis.value += v;\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\t\t\tshout:function () {\n\t\t\t\t\tconsole.log(this.value);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\t// chain method calls\n\t\t\tobj.increment().add(3).shout(); // 5\n\n\t\t\t// as opposed to calling them one by one\n\t\t\t// obj.increment();\n\t\t\t// obj.add(3);\n\t\t\t// obj.shout();\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "object-creation-patterns/declaring-dependencies.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Declaring Dependencies\n\t\t\t Description: it's good to declare the modules your code relies on at the top\n\t\t\t */\n\n\t\t\tvar myFunction = function () {\n\t\t\t\t// dependencies\n\t\t\t\tvar event = YAHOO.util.Event,\n\t\t\t\t\t\tdom = YAHOO.util.dom;\n\n\t\t\t\t// use event and dom variables\n\t\t\t\t// for the rest of the function...\n\t\t\t};\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "object-creation-patterns/inheritence.html",
    "content": "<!--\n* One base class is created.\n* Another child class created extending the base class to demonstrate the inheritance.\n* One subclass created extending the second class to demonstrate the multilevel inheritance.\n* All the classes are having static, non-static, private and public members.\n* In the test client we are demonstrating some of these features.\n* To test the other features, additional caller codes has to be added.\n-->\n<!doctype html>\n<html lang=\"en\">\n<head>\n<title>JavaScript Patterns - Inheritance</title>\n<meta charset=\"utf-8\">\n</head>\n\n<script>\n\t//Defination of top superclass\n\tfunction topSuperClass() {\n\n\t}\n\t//static members\n\ttopSuperClass.staticProperty = function() {\n\t\t//static private members\n\t\tvar TSCstaticPrivateVariable = \"I am static private variable of top super class\";\n\t\tvar TSCstaticPrivateMethod = function() {\n\t\t\treturn \"I am a static private method of top super class\";\n\t\t};\n\t\treturn {\n\t\t\t//static public members\n\t\t\tTSCstaticPublicVariable : \"I am static public variable of top super class\",\n\t\t\tTSCstaticPublicMethod : function() {\n\t\t\t\treturn \"I am a static public method of top super class\";\n\t\t\t}\n\t\t};\n\t}();\n\n\t//non static members\n\ttopSuperClass.prototype.TSCnonStaticProperty = function() {\n\t\t//non static private members\n\t\tvar TSCnonStaticPrivateVariable = \"I am non static private variable of top super class\";\n\t\tvar TSCnonStaticPrivateMethod = function() {\n\t\t\treturn \"I am a non static private method of top super class\";\n\t\t};\n\t\treturn {\n\t\t\t//non static public members\n\t\t\tTSCnonStaticPublicVariable : \"I am non static public variable of top super class\",\n\t\t\tTSCnonStaticPublicMethod : function() {\n\t\t\t\talert(TSCnonStaticPrivateMethod());// accessing the private member inside class\n\t\t\t\treturn \"I am a non static public method of top super class\";\n\t\t\t}\n\t\t};\n\t}();\n\n\t//Defination of superclass\n\tfunction superClass() {\n\t}\n\t//inheritance declaration\n\tsuperClass.prototype = new topSuperClass();\n\n\t//static members\n\tsuperClass.staticProperty = function() {\n\t\t//static private members\n\t\tvar SCstaticPrivateVariable = \"I am static private variable of super class\";\n\t\tvar SCstaticPrivateMethod = function() {\n\t\t\treturn \"I am a static private method of super class\";\n\t\t};\n\t\treturn {\n\t\t\t//static public members\n\t\t\tSCstaticPublicVariable : \"I am static public variable of super class\",\n\t\t\tSCstaticPublicMethod : function() {\n\t\t\t\treturn \"I am a static public method of super class\";\n\t\t\t}\n\t\t};\n\t}();\n\n\t//non static members\n\tsuperClass.prototype.SCnonStaticProperty = function() {\n\t\t//non static private members\n\t\tvar SCnonStaticPrivateVariable = \"I am non static private variable of super class\";\n\t\tvar SCnonStaticPrivateMethod = function() {\n\t\t\treturn \"I am a non static private method of super class\";\n\t\t};\n\t\treturn {\n\t\t\t//non static public members\n\t\t\tSCnonStaticPublicVariable : \"I am non static public variable of super class\",\n\t\t\tSCnonStaticPublicMethod : function() {\n\t\t\t\treturn \"I am a non static public method of super class\";\n\t\t\t}\n\t\t};\n\t}();\n\n\t//Defination of subclass\n\tfunction subClass() {\n\t}\n\t//inheritance Declaration\n\t//subClass.prototype = new topSuperClass();\n\tsubClass.prototype = new superClass();\n\n\t//static members\n\tsubClass.staticProperty = function() {\n\t\t//static private members\n\t\tvar SBCstaticPrivateVariable = \"I am static private variable of sub class\";\n\t\tvar SBCstaticPrivateMethod = function() {\n\t\t\treturn \"I am a static private method of sub class\";\n\t\t};\n\t\treturn {\n\t\t\t//static public members\n\t\t\tSBCstaticPublicVariable : \"I am static public variable of sub class\",\n\t\t\tSBCstaticPublicMethod : function() {\n\t\t\t\treturn \"I am a static public method of sub class\";\n\t\t\t}\n\t\t};\n\t}();\n\n\t//non static members\n\tsubClass.prototype.SBCnonStaticProperty = function() {\n\t\t//non static private members\n\t\tvar SBCnonStaticPrivateVariable = \"I am non static private variable of sub class\";\n\t\tvar SBCnonStaticprivateMethod = function() {\n\t\t\treturn \"I am a non static private method of sub class\";\n\t\t};\n\t\treturn {\n\t\t\t//non static public members\n\t\t\tSBCnonStaticPublicVariable : \"I am non static public variable of sub class\",\n\t\t\tSBCnonStaticPublicMethod : function() {\n\t\t\t\treturn \"I am a non static public method of sub class\";\n\t\t\t}\n\t\t};\n\t}();\n\n\t//Inheritence Defination\n\t//superClass.prototype = new topSuperClass();\n\t//subClass.prototype = new superClass();\n\n\tvar test = function() {\n\n\t\t//Demonstration of base class member access\n\t\tvar topSuperClassObj = new topSuperClass();// Creation of object of the base class\n\n\t\t//Calling the private static members with class refferene\n\t\t//alert(topSuperClass.staticProperty.TSCstaticPrivateVariable);//Not visible outside class\n\t\t//alert(topSuperClass.staticProperty.TSCstaticPrivateMethod());//Not visible outside class\n\n\t\t//Accessing the public static members\n\t\t//alert(topSuperClass.staticProperty.TSCstaticPublicVariable);//Visible as public member variable \n\t\t//alert(topSuperClass.staticProperty.TSCstaticPublicMethod());//Visible as public method\n\n\t\t//Calling the private non static mebbers with object refferene\n\t\t//alert(topSuperClassObj.TSCnonStaticProperty.TSCnonStaticPrivateVariable);//Not visible outside class\n\t\t//alert(topSuperClassObj.TSCnonStaticProperty.TSCnonStaticPrivateMethod());//Not visible outside class\n\n\t\t//Calling the public non static mebbers with object refferene\n\t\t//alert(topSuperClassObj.TSCnonStaticProperty.TSCnonStaticPublicVariable);//visible outside class\n\t\talert(topSuperClassObj.TSCnonStaticProperty.TSCnonStaticPublicMethod());//visible outside class\n\n\t\t//How to access super class methods using subclass reference\n\t\t//var subClassObj = new subClass();\n\t\t//alert(subClassObj.SBCnonStaticProperty.SBCnonStaticPublicMethod());\n\t\t//alert(subClass.staticProperty.SBCstaticPublicMethod());\n\n\t\t//alert(subClassObj.SCnonStaticProperty.SCnonStaticPublicMethod());\n\t\t//alert(superClass.staticProperty.SCstaticPublicMethod());\n\n\t\t//alert(subClassObj.TSCnonStaticProperty.TSCnonStaticPublicMethod());\n\t\t//alert(topSuperClass.staticProperty.TSCstaticPublicMethod());\n\n\t}\n</script>\n\n<body>\n\t<h1 align=\"center\">JAVASCRIP INHERITANCE</h1>\n\t<p align=\"center\">\n\t\t<input type=\"button\" value=\"Test\" onclick=\"test()\">\n\t</p>\n\n</body>\n</html>"
  },
  {
    "path": "object-creation-patterns/module.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Module Pattern\n\t\t\t Description: all the methods are kept private and you only expose those that you decide at the end\n\t\t\t */\n\n\t\t\tvar MYAPP = MYAPP || {};\n\n\t\t\tMYAPP.namespace = function (ns_string) {\n\t\t\t\tvar parts = ns_string.split('.'),\n\t\t\t\t\t\tparent = MYAPP,\n\t\t\t\t\t\ti;\n\n\t\t\t\t// strip redundant leading global\n\t\t\t\tif (parts[0] === \"MYAPP\") {\n\t\t\t\t\tparts = parts.slice(1);\n\t\t\t\t}\n\n\t\t\t\tfor (i = 0; i < parts.length; i += 1) {\n\t\t\t\t\t// create a property if it doesn't exist\n\t\t\t\t\tif (typeof parent[parts[i]] === \"undefined\") {\n\t\t\t\t\t\tparent[parts[i]] = {};\n\t\t\t\t\t}\n\t\t\t\t\tparent = parent[parts[i]];\n\t\t\t\t}\n\t\t\t\treturn parent;\n\t\t\t};\n\n\t\t\tMYAPP.namespace('MYAPP.utilities.Array');\n\n\t\t\tMYAPP.utilities.array = (function () {\n\t\t\t\t// private properties\n\t\t\t\tvar array_string = \"[object Array]\",\n\t\t\t\t\t\tops = Object.prototype.toString,\n\n\t\t\t\t\t// private methods\n\t\t\t\t\t\tinArray = function (haystack, needle) {\n\t\t\t\t\t\t\tfor (var i = 0, max = haystack.length; i < max; i += 1) {\n\t\t\t\t\t\t\t\tif (haystack[i] === needle) {\n\t\t\t\t\t\t\t\t\treturn i;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn -1;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tisArray = function (a) {\n\t\t\t\t\t\t\treturn ops.call(a) === array_string;\n\t\t\t\t\t\t};\n\t\t\t\t// end var\n\n\t\t\t\t// revealing public API\n\t\t\t\treturn {\n\t\t\t\t\tisArray:isArray,\n\t\t\t\t\tindexOf:inArray\n\t\t\t\t};\n\t\t\t}());\n\n\n\t\t\t// Modules That Create Constructors\n\n\t\t\tvar MYAPP = MYAPP || {};\n\n\t\t\tMYAPP.namespace = function (ns_string) {\n\t\t\t\tvar parts = ns_string.split('.'),\n\t\t\t\t\t\tparent = MYAPP,\n\t\t\t\t\t\ti;\n\n\t\t\t\t// strip redundant leading global\n\t\t\t\tif (parts[0] === \"MYAPP\") {\n\t\t\t\t\tparts = parts.slice(1);\n\t\t\t\t}\n\n\t\t\t\tfor (i = 0; i < parts.length; i += 1) {\n\t\t\t\t\t// create a property if it doesn't exist\n\t\t\t\t\tif (typeof parent[parts[i]] === \"undefined\") {\n\t\t\t\t\t\tparent[parts[i]] = {};\n\t\t\t\t\t}\n\t\t\t\t\tparent = parent[parts[i]];\n\t\t\t\t}\n\t\t\t\treturn parent;\n\t\t\t};\n\n\t\t\tMYAPP.namespace('MYAPP.utilities.Array');\n\n\t\t\tMYAPP.utilities.Array = (function () {\n\t\t\t\t// dependencies\n\t\t\t\tvar uobj = MYAPP.utilities.object,\n\t\t\t\t\t\tulang = MYAPP.utilities.lang,\n\n\t\t\t\t\t// private properties and methods...\n\t\t\t\t\t\tConstr;\n\n\t\t\t\t// end var\n\t\t\t\t// optionally one-time init procedures\n\t\t\t\t// ...\n\n\t\t\t\t// public API -- constructor\n\t\t\t\tConstr = function (o) {\n\t\t\t\t\tthis.elements = this.toArray(o);\n\t\t\t\t};\n\t\t\t\t// public API -- prototype\n\t\t\t\tConstr.prototype = {\n\t\t\t\t\tconstructor:MYAPP.utilities.Array,\n\t\t\t\t\tversion:\"2.0\",\n\t\t\t\t\ttoArray:function (obj) {\n\t\t\t\t\t\tfor (var i = 0, a = [], len = obj.length; i < len; i += 1) {\n\t\t\t\t\t\t\ta[i] = obj[i];\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn a;\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\t// return the constructor\n\t\t\t\t// to be assigned to the new namespace\n\t\t\t\treturn Constr;\n\t\t\t}());\n\n\t\t\tvar arr = new MYAPP.utilities.Array(obj);\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "object-creation-patterns/module2.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Module Pattern\n\t\t\t Description: all the methods are kept private and you only expose those that you decide at the end\n\t\t\t */\n\t\t\t\n\t\t\t// create a namespace\n\t\t\tYAHOO.namespace(\"myProject\");\n\n\n\n\t\t\tYAHOO.myProject.myModule = function () {\n\n\t\t\t\t//\"private\" variables:\n\t\t\t\tvar myPrivateVar = \"I can be accessed only from within YAHOO.myProject.myModule.\";\n\t\t\t\t\n\t\t\t\t//\"private\" method:\n\t\t\t\tvar myPrivateMethod = function () {\n\t\t\t\t\tYAHOO.log(\"I can be accessed only from within YAHOO.myProject.myModule\");\n\t\t\t\t}\n\n\t\t\t\t//return public methods\n\t\t\t\treturn  {\n\t\t\t\t\tmyPublicProperty: \"I'm accessible as YAHOO.myProject.myModule.myPublicProperty.\",\n\t\t\t\t\tmyPublicMethod: function () {\n\t\t\t\t\t\tYAHOO.log(\"I'm accessible as YAHOO.myProject.myModule.myPublicMethod.\");\n\n\t\t\t\t\t\t//Within myProject, I can access \"private\" vars and methods:\n\t\t\t\t\t\tYAHOO.log(myPrivateVar);\n\t\t\t\t\t\tYAHOO.log(myPrivateMethod());\n\n\t\t\t\t\t\t//The native scope of myPublicMethod is myProject; we can\n\t\t\t\t\t\t//access public members using \"this\":\n\t\t\t\t\t\tYAHOO.log(this.myPublicProperty);\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t}(); // the parens here cause the anonymous function to execute and return\n\n\t\t\t\n\t\t\t// Reference\n\t\t\t// http://yuiblog.com/blog/2007/06/12/module-pattern/\n\t\t\t\n\t\t</script>\n</html>"
  },
  {
    "path": "object-creation-patterns/module3-augmentation.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Module Pattern - Augmentation\n\t\t\t Description: This pattern import modules, and add properties, then export it.  It has adventage for developing large applications.\n\t\t\t */\n\t\t\t\n\t\t\tvar MODULE = (function (my) {\n\t\t\t\tmy.anotherMethod = function () {\n\t\t\t\t\t// added method...\n\t\t\t\t};\n\n\t\t\t\treturn my;\n\t\t\t}(MODULE));\n\n\t\t\t\n\t\t\t// Reference\n\t\t\t// http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html\n\t\t\t\n\t\t</script>\n</html>"
  },
  {
    "path": "object-creation-patterns/module4-loose-augmentation.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Module Pattern - loose Augmentation\n\t\t\t Description: This pattern import modules, and add properties, then export it.  It has adventage for developing large applications.\n\t\t\t */\n\t\t\t\n\t\t\tvar MODULE = (function (my) {\n\t\t\t\tmy.anotherMethod = function () {\n\t\t\t\t\t// added method...\n\t\t\t\t};\n\n\t\t\t\treturn my;\n\t\t\t}(MODULE || {})); // adding a default object\n\n\t\t\t\n\t\t\t// Reference\n\t\t\t// http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html\n\t\t\t\n\t\t</script>\n</html>"
  },
  {
    "path": "object-creation-patterns/module5-tight-augmentation.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Module Pattern - Tight Augmentation\n\t\t\t Description: This pattern import modules, and add properties, then export it.  It has adventage for developing large applications.  And also have the authorities to old module method, and override a new one.\n\t\t\t */\n\t\t\t\n\t\t\tvar MODULE = (function (my) {\n\t\t\t\tvar old_moduleMethod = my.moduleMethod;\n\n\t\t\t\tmy.moduleMethod = function () {\n\t\t\t\t\t// method override, has access to old through old_moduleMethod...\n\t\t\t\t};\n\n\t\t\t\treturn my;\n\t\t\t}(MODULE));\n\n\t\t\t\n\t\t\t// Reference\n\t\t\t// http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html\n\t\t\t\n\t\t</script>\n</html>"
  },
  {
    "path": "object-creation-patterns/module6-clone-inheritance.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Module Pattern - clone and inheritance Augmentation\n\t\t\t Description: This pattern import modules, and add properties, then export it.  It has adventage for developing large applications.  And the new module object will inheritance the old one.\n\t\t\t */\n\t\t\tvar MODULE_TWO = (function (old) {\n\t\t\t\tvar my = {},\n\t\t\t\t\tkey;\n\n\t\t\t\t// let my object inherience property\n\t\t\t\tfor (key in old) {\n\t\t\t\t\tif (old.hasOwnProperty(key)) {\n\t\t\t\t\t\tmy[key] = old[key];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tvar super_moduleMethod = old.moduleMethod;\n\t\t\t\tmy.moduleMethod = function () {\n\t\t\t\t\t// override method on the clone, access to super through super_moduleMethod\n\t\t\t\t};\n\n\t\t\t\treturn my;\n\t\t\t}(MODULE));\n\n\t\t\t\n\t\t\t// Reference\n\t\t\t// http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html\n\t\t\t\n\t\t</script>\n</html>"
  },
  {
    "path": "object-creation-patterns/module7-cross-file.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Module Pattern - cross-file private Augmentation\n\t\t\t */\n\t\t\t\n\t\t\tvar MODULE = (function (my) {\n\t\t\t\tvar _private = my._private = my._private || {},\n\t\t\t\t\t_seal = my._seal = my._seal || function () {\n\t\t\t\t\t\tdelete my._private;\n\t\t\t\t\t\tdelete my._seal;\n\t\t\t\t\t\tdelete my._unseal;\n\t\t\t\t\t},\n\t\t\t\t\t_unseal = my._unseal = my._unseal || function () {\n\t\t\t\t\t\tmy._private = _private;\n\t\t\t\t\t\tmy._seal = _seal;\n\t\t\t\t\t\tmy._unseal = _unseal;\n\t\t\t\t\t};\n\n\t\t\t\t// permanent access to _private, _seal, and _unseal\n\n\t\t\t\treturn my;\n\t\t\t}(MODULE || {}));\n\n\t\t\t\n\t\t\t// Reference\n\t\t\t// http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html\n\t\t\t\n\t\t</script>\n</html>"
  },
  {
    "path": "object-creation-patterns/namespace.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Namespace Pattern\n\t\t\t Description: namespaces help reduce the number of globals required and avoid naming collisions or excessive name prefixing\n\t\t\t */\n\n\t\t\t// unsafe\n\t\t\tvar MYAPP = {};\n\t\t\t// better\n\t\t\tif (typeof MYAPP === \"undefined\") {\n\t\t\t\tvar MYAPP = {};\n\t\t\t}\n\t\t\t// or shorter\n\t\t\tvar MYAPP = MYAPP || {};\n\n\t\t\tMYAPP.namespace = function (ns_string) {\n\t\t\t\tvar parts = ns_string.split('.'),\n\t\t\t\t\t\tparent = MYAPP,\n\t\t\t\t\t\ti;\n\n\t\t\t\t// strip redundant leading global\n\t\t\t\tif (parts[0] === \"MYAPP\") {\n\t\t\t\t\tparts = parts.slice(1);\n\t\t\t\t}\n\n\t\t\t\tfor (i = 0; i < parts.length; i += 1) {\n\t\t\t\t\t// create a property if it doesn't exist\n\t\t\t\t\tif (typeof parent[parts[i]] === \"undefined\") {\n\t\t\t\t\t\tparent[parts[i]] = {};\n\t\t\t\t\t}\n\t\t\t\t\tparent = parent[parts[i]];\n\t\t\t\t}\n\t\t\t\treturn parent;\n\t\t\t};\n\n\t\t\t// assign returned value to a local var\n\t\t\tvar module2 = MYAPP.namespace('MYAPP.modules.module2');\n\t\t\tconsole.log(module2 === MYAPP.modules.module2); // true\n\n\t\t\t// skip initial `MYAPP`\n\t\t\tMYAPP.namespace('modules.module51');\n\n\t\t\t// long namespace\n\t\t\tMYAPP.namespace('once.upon.a.time.there.was.this.long.nested.property');\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "object-creation-patterns/object-constants.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Object Constants\n\t\t\t Description: an implementation of a constant object provides set, isDefined and get methods\n\t\t\t */\n\n\t\t\tvar constant = (function () {\n\t\t\t\tvar constants = {},\n\t\t\t\t\t\townProp = Object.prototype.hasOwnProperty,\n\t\t\t\t\t\tallowed = {\n\t\t\t\t\t\t\tstring:1,\n\t\t\t\t\t\t\tnumber:1,\n\t\t\t\t\t\t\tboolean:1\n\t\t\t\t\t\t},\n\t\t\t\t\t\tprefix = (Math.random() + \"_\").slice(2);\n\t\t\t\treturn {\n\t\t\t\t\tset:function (name, value) {\n\t\t\t\t\t\tif (this.isDefined(name)) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!ownProp.call(allowed, typeof value)) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconstants[prefix + name] = value;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t},\n\t\t\t\t\tisDefined:function (name) {\n\t\t\t\t\t\treturn ownProp.call(constants, prefix + name);\n\t\t\t\t\t},\n\t\t\t\t\tget:function (name) {\n\t\t\t\t\t\tif (this.isDefined(name)) {\n\t\t\t\t\t\t\treturn constants[prefix + name];\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t}());\n\n\t\t\t// check if defined\n\t\t\tconsole.log(constant.isDefined(\"maxwidth\")); // false\n\n\t\t\t// define\n\t\t\tconsole.log(constant.set(\"maxwidth\", 480)); // true\n\n\t\t\t// check again\n\t\t\tconsole.log(constant.isDefined(\"maxwidth\")); // true\n\n\t\t\t// attempt to redefine\n\t\t\tconsole.log(constant.set(\"maxwidth\", 320)); // false\n\n\t\t\t// is the value still intact?\n\t\t\tconsole.log(constant.get(\"maxwidth\")); // 480\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "object-creation-patterns/private-properties-and-methods.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Private Properties and Methods\n\t\t\t Description: JavaScript doesn't have special syntax for private members, you can implement them using a closure\n\t\t\t */\n\n\t\t\tfunction Gadget() {\n\t\t\t\t// private member\n\t\t\t\tvar name = 'iPod';\n\t\t\t\t// privileged function\n\t\t\t\tthis.getName = function () {\n\t\t\t\t\treturn name;\n\t\t\t\t};\n\t\t\t}\n\t\t\tvar toy = new Gadget();\n\n\t\t\t// `name` is undefined, it's private\n\t\t\tconsole.log(toy.name); // undefined\n\n\t\t\t// public method has access to `name`\n\t\t\tconsole.log(toy.getName()); // \"iPod\"\n\n\t\t\t// this will be the object\n\t\t\tvar bob = (function () {\n\t\t\t\t// private members\n\t\t\t\tvar name = \"Bob\";\n\n\t\t\t\t// implement the public interface\n\t\t\t\tvar person = {\n\t\t\t\t\t// public method\n\t\t\t\t\tgetName:function () {\n\t\t\t\t\t\treturn name;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\t\n\t\t\t\treturn person;\n\t\t\t})();\n\t\t\t\n\t\t\tconsole.log(bob.getName()); // \"Bob\"\n\t\t</script>\n\t</body>\n</html>\n"
  },
  {
    "path": "object-creation-patterns/revelation.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Revelation Pattern\n\t\t\t Description: it is about having private methods, which you also expose as public methods\n\t\t\t */\n\n\t\t\tvar myarray;\n\n\t\t\t(function () {\n\n\t\t\t\tvar astr = \"[object Array]\",\n\t\t\t\t\t\ttoString = Object.prototype.toString;\n\n\t\t\t\tfunction isArray(a) {\n\t\t\t\t\treturn toString.call(a) === astr;\n\t\t\t\t}\n\n\t\t\t\tfunction indexOf(haystack, needle) {\n\t\t\t\t\tvar i = 0,\n\t\t\t\t\t\t\tmax = haystack.length;\n\t\t\t\t\tfor (; i < max; i += 1) {\n\t\t\t\t\t\tif (haystack[i] === needle) {\n\t\t\t\t\t\t\treturn i;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n\t\t\t\tmyarray = {\n\t\t\t\t\tisArray:isArray,\n\t\t\t\t\tindexOf:indexOf,\n\t\t\t\t\tinArray:indexOf\n\t\t\t\t};\n\t\t\t}());\n\n\t\t\tconsole.log(myarray.isArray([1, 2])); // true\n\t\t\tconsole.log(myarray.isArray({0:1})); // false\n\t\t\tconsole.log(myarray.indexOf([\"a\", \"b\", \"z\"], \"z\")); // 2\n\t\t\tconsole.log(myarray.inArray([\"a\", \"b\", \"z\"], \"z\")); // 2\n\n\t\t\tmyarray.indexOf = null;\n\t\t\tconsole.log(myarray.inArray([\"a\", \"b\", \"z\"], \"z\")); // 2\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "object-creation-patterns/sandbox.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Sandbox Pattern\n\t\t\t Description: it provides an environment for the modules to work without affecting other modules and their personal sandboxes\n\t\t\t */\n\n\t\t\tfunction Sandbox() {\n\t\t\t\t// turning arguments into an array\n\t\t\t\tvar args = Array.prototype.slice.call(arguments),\n\t\t\t\t\t// the last argument is the callback\n\t\t\t\t\t\tcallback = args.pop(),\n\t\t\t\t\t// modules can be passed as an array or as individual parameters\n\t\t\t\t\t\tmodules = (args[0] && typeof args[0] === \"string\") ? args : args[0],\n\t\t\t\t\t\ti;\n\n\t\t\t\t// make sure the function is called\n\t\t\t\t// as a constructor\n\t\t\t\tif (!(this instanceof Sandbox)) {\n\t\t\t\t\treturn new Sandbox(modules, callback);\n\t\t\t\t}\n\n\t\t\t\t// add properties to `this` as needed:\n\t\t\t\tthis.a = 1;\n\t\t\t\tthis.b = 2;\n\n\t\t\t\t// now add modules to the core `this` object\n\t\t\t\t// no modules or \"*\" both mean \"use all modules\"\n\t\t\t\tif (!modules || modules == '*') {\n\t\t\t\t\tmodules = [];\n\t\t\t\t\tfor (i in Sandbox.modules) {\n\t\t\t\t\t\tif (Sandbox.modules.hasOwnProperty(i)) {\n\t\t\t\t\t\t\tmodules.push(i);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// initialize the required modules\n\t\t\t\tfor (i = 0; i < modules.length; i += 1) {\n\t\t\t\t\tSandbox.modules[modules[i]](this);\n\t\t\t\t}\n\n\t\t\t\t// call the callback\n\t\t\t\tcallback(this);\n\t\t\t}\n\n\t\t\t// any prototype properties as needed\n\t\t\tSandbox.prototype = {\n\t\t\t\tname:\"My Application\",\n\t\t\t\tversion:\"1.0\",\n\t\t\t\tgetName:function () {\n\t\t\t\t\treturn this.name;\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tSandbox.modules = {};\n\n\t\t\tSandbox.modules.dom = function (box) {\n\t\t\t\tbox.getElement = function () {\n\t\t\t\t};\n\t\t\t\tbox.getStyle = function () {\n\t\t\t\t};\n\t\t\t\tbox.foo = \"bar\";\n\t\t\t};\n\n\t\t\tSandbox.modules.event = function (box) {\n\t\t\t\t// access to the Sandbox prototype if needed:\n\t\t\t\t// box.constructor.prototype.m = \"mmm\";\n\t\t\t\tbox.attachEvent = function () {\n\t\t\t\t};\n\t\t\t\tbox.detachEvent = function () {\n\t\t\t\t};\n\t\t\t};\n\n\t\t\tSandbox.modules.ajax = function (box) {\n\t\t\t\tbox.makeRequest = function () {\n\t\t\t\t};\n\t\t\t\tbox.getResponse = function () {\n\t\t\t\t};\n\t\t\t};\n\n\n\t\t\t// how to use\n\t\t\tSandbox(['ajax', 'event'], function (box) {\n\t\t\t\t// console.log(box);\n\t\t\t});\n\n\t\t\tSandbox('ajax', 'dom', function (box) {\n\t\t\t\t// console.log(box);\n\t\t\t});\n\n\t\t\tSandbox('*', function (box) {\n\t\t\t\t// console.log(box);\n\t\t\t});\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "object-creation-patterns/static-members.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Public and Private Static Members\n\t\t\t Description:\n\t\t\t Public Static Members - accessible outside the constructor\n\t\t\t Private Static Members - shared by all the objects with the same constructor function and not accessible outside the constructor\n\t\t\t */\n\n\t\t\t// Public Static Members\n\n\t\t\t// constructor\n\t\t\tvar Gadget = function () {\n\t\t\t};\n\n\t\t\t// a static method\n\t\t\tGadget.isShiny = function () {\n\t\t\t\treturn \"you bet\";\n\t\t\t};\n\n\t\t\t// a normal method added to the prototype\n\t\t\tGadget.prototype.setPrice = function (price) {\n\t\t\t\tthis.price = price;\n\t\t\t};\n\n\t\t\t// calling a static method\n\t\t\tconsole.log(Gadget.isShiny()); // \"you bet\"\n\n\t\t\t// creating an instance and calling a method\n\t\t\tvar iphone = new Gadget();\n\t\t\tiphone.setPrice(500);\n\n\t\t\tconsole.log(typeof Gadget.setPrice); // \"undefined\"\n\t\t\tconsole.log(typeof iphone.isShiny); // \"undefined\"\n\n\t\t\tGadget.prototype.isShiny = Gadget.isShiny;\n\t\t\tconsole.log(iphone.isShiny()); // \"you bet\"\n\n\n\t\t\t// constructor\n\t\t\tvar Gadget = function (price) {\n\t\t\t\tthis.price = price;\n\t\t\t};\n\n\t\t\t// a static method\n\t\t\tGadget.isShiny = function () {\n\n\t\t\t\t// this always works\n\t\t\t\tvar msg = \"you bet\";\n\n\t\t\t\tif (this instanceof Gadget) {\n\t\t\t\t\t// this only works if called non-statically\n\t\t\t\t\tmsg += \", it costs $\" + this.price + '!';\n\t\t\t\t}\n\n\t\t\t\treturn msg;\n\t\t\t};\n\n\t\t\t// a normal method added to the prototype\n\t\t\tGadget.prototype.isShiny = function () {\n\t\t\t\treturn Gadget.isShiny.call(this);\n\t\t\t};\n\n\t\t\tconsole.log(Gadget.isShiny()); // \"you bet\"\n\n\t\t\tvar a = new Gadget('499.99');\n\t\t\tconsole.log(a.isShiny()); // \"you bet, it costs $499.99!\"\n\n\n\t\t\t// Private Static Members\n\n\t\t\t// method 1\n\t\t\tvar Gadget = (function () {\n\n\t\t\t\t// static variable/property\n\t\t\t\tvar counter = 0;\n\n\t\t\t\t// returning the new implementation\n\t\t\t\t// of the constructor\n\t\t\t\treturn function () {\n\t\t\t\t\tconsole.log(counter += 1);\n\t\t\t\t};\n\t\t\t}()); // execute immediately\n\n\t\t\tvar g1 = new Gadget(); // logs 1\n\t\t\tvar g2 = new Gadget(); // logs 2\n\t\t\tvar g3 = new Gadget(); // logs 3\n\n\n\t\t\t// method 2\n\t\t\tvar Gadget = (function () {\n\n\t\t\t\t// static variable/property\n\t\t\t\tvar counter = 0,\n\t\t\t\t\t\tNewGadget;\n\n\t\t\t\t// this will become the\n\t\t\t\t// new constructor implementation\n\t\t\t\tNewGadget = function () {\n\t\t\t\t\tcounter += 1;\n\t\t\t\t};\n\n\t\t\t\t// a priviledged method\n\t\t\t\tNewGadget.prototype.getLastId = function () {\n\t\t\t\t\treturn counter;\n\t\t\t\t};\n\n\t\t\t\t// overwrite the constructor\n\t\t\t\treturn NewGadget;\n\n\t\t\t}()); // execute immediately\n\n\t\t\tvar iphone = new Gadget();\n\t\t\tiphone.getLastId(); // 1\n\t\t\tvar ipod = new Gadget();\n\t\t\tipod.getLastId(); // 2\n\t\t\tvar ipad = new Gadget();\n\t\t\tipad.getLastId(); // 3\n\t\t</script>\n\t</body>\n</html>"
  },
  {
    "path": "object-creation-patterns/sub-module.html",
    "content": "<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: Sub Module Pattern \n\t\t\t Description: create a sub module.\n\t\t\t */\n\t\t\t\n\t\t\tMODULE.sub = (function () {\n\t\t\t\tvar my = {};\n\t\t\t\t// ...\n\n\t\t\t\treturn my;\n\t\t\t}());\n\n\t\t\t\n\t\t\t// Reference\n\t\t\t// http://www.adequatelygood.com/JavaScript-Module-Pattern-In-Depth.html\n\t\t\t\n\t\t</script>\n</html>"
  },
  {
    "path": "object-creation-patterns/sugar-method.html",
    "content": "﻿<!doctype html>\n<html lang=\"en\">\n\t<head>\n\t\t<title>JavaScript Patterns</title>\n\t\t<meta charset=\"utf-8\">\n\t</head>\n\t<body>\n\t\t<script>\n\t\t\t/* Title: method() Method\n\t\t\t Description: adding convenient functionality to a language\n\t\t\t */\n\n\t\t\tif (typeof Function.prototype.method !== \"function\") {\n\t\t\t\tFunction.prototype.method = function (name, implementation) {\n\t\t\t\t\tthis.prototype[name] = implementation;\n\t\t\t\t\treturn this;\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tvar Person = function (name) {\n\t\t\t\tthis.name = name;\n\t\t\t}.\n\t\t\t\t\tmethod('getName',\n\t\t\t\t\tfunction () {\n\t\t\t\t\t\treturn this.name;\n\t\t\t\t\t}).\n\t\t\t\t\tmethod('setName', function (name) {\n\t\t\t\t\t\tthis.name = name;\n\t\t\t\t\t\treturn this;\n\t\t\t\t\t});\n\n\t\t\tvar a = new Person('Adam');\n\t\t\tconsole.log(a.getName()); // 'Adam'\n\t\t\tconsole.log(a.setName('Eve').getName()); // 'Eve'\n\t\t</script>\n\t</body>\n</html>"
  }
]