diff --git a/README b/README
index 108c1eb..9dadc81 100644
--- a/README
+++ b/README
@@ -1,12 +1,189 @@
What is it?
===========
-include.js is javascript library, intended to simplify development of ajax and offline web applications.
+include.js is javascript library, intended to simplify development of ajax and offline web applications. It makes MVC-pattern trivial, and provides widely wanted browser-side 'include' directive. It's using approach which is different from common MVC frameworks, and its approach is a lot easier to understand and use. It relies on dynamically loadable modules, and HTML templates is the first-class module type.
-It provides comprehensive asynchronous modules API working in web browser, supporting JavaScript *and* first-class client-side HTML template modules.
+Yes, you can include plain JS files, JS modules without garbaging global namespace, HTML templates, HAML templates (not tested), and (soon) CSS files.
-It's compact and extensible. Developers can add they own custom module content types using clean and simple plug-ins API.
+And - it can include any custom content you want if you write corresponding plug-in. HTML Templates support is written as plugin, so you already have an example. And, yes - plugins can call each other, so it's _really_ easy to write support for your own templating engine, which you wanted but afraid to implement. Just compile your language to ASP Core Templates style (which is easy to do with .replace), and that's it.
-include.js relies on excellent require.js library as the backend. It means, that it's backward compatible with CommonJS and require.js modules.
+include.js relies on excellent require.js library as the backend.
+
+Features didgest
+================
+1. Complete backward compatibility with CommonJS Asynchronous modules, packages, and require.js modules. Since it's based on require.js.
+2. New module API, which is far easier to understand and use than original require.js one. Module definitions looks like module definitions, and include looks like traditional include.
+3. Plug-in API for custom modules with content of any type.
+4. Plug-ins included:
+- HTML Templates, supporting ASP and mustache style tags, and JS embedding.
+- HAML Templates. I'm using github implementation, and it have not been tested yet. But - it was straightforward to add.
+- TODO: CSS files. I can add templating capabilities to CSS content too, if you request.
+- TODO: Inline CSS in HTML Temapltes.
+5. Straightforward MVC pattern impementation, allowing to decompose your AJAX application into hierarchy of HTML+JS(+CSS) components. In case you're looking for the way to do MVC - this is an easies way ever.
+6. jQuery support. You can think of include.js as an easy way to define more advanced widgets:
+
+$.include({
+ html: "my_template.html" // include template from file...
+})
+.define( function( _ ){ // define module...
+ _.exports = function widget( $this, a_data, a_events ){ // exporting function...
+ _.html.renderTo( $this, a_data ); // which expands template inside of $this.
+
+ $this.find( "#ok").click( a_events.on_click ); // throw event up to the caller...
+ $this.find( "#refresh").click( function(){
+ widget( $this, a_data, a_events ); // ...and update ourself. Yep, in that easy way.
+ });
+ }
+});
+
+It's said, that Dojo Toolikit have better instruments for writing large AJAX applications, than jQuery. What I could say, as an author of large-scale inhouse jQuery ajax application? That used to be true, until the moment of include.js release.
+
+
+Comparison with require.js API
+==============================
+require.js:
+define( function(){
+ ...
+ return what_to_export; // looks pretty. However:
+ // - there are the mess of 'returns' in JS code - which one is export?
+ // - it's always placed at the end of file.
+});
+
+include.js:
+$.define( function( _ ){
+ ...
+ _.exports = what_to_export; // you can place it at the beginning, closer to the module interface.
+ // or - you can search for it. Or - you can still use require.js style.
+});
+
+require.js:
+ require( [ 'mod/one', 'mod/two', 'mod/three' ],
+ function( first, second, third ){ // try to make a change in this dependency list without mistake.
+ ...
+ return what_we_have_defined;
+ });
+
+include.js:
+ $.include({
+ first : 'mod/one',
+ second : 'mod/two',
+ third : 'mod/three'
+ })
+ .define( function( _ ){
+ // you can refer to dependencies as _.first, _.second, _.third
+ _.exports = what_we_have_defined;
+ });
+
+require.js:
+ require(["a.js", "b.js", "some/module"], function() { // Loading mix of plain .js files and 'modules'.
+ //interesting detail - what will happen with our module arguments? Have an idea?
+ });
+
+include.js:
+ $.include(
+ "a.js",
+ "b.js",
+ {
+ module : "some/module"
+ }
+ ).define( function( _ ){
+ // In this case it's clear, isn't it?
+ });
+
+require.js: // load three modules in order...
+ require(["order!one.js", "order!two.js", "order!three.js"], function () {
+ //This callback is called after the three scripts finish loading.
+ });
+
+include.js:
+ $.include(
+ [ "one.js", "two.js", "three.js" ], // feel the difference?
+ {
+ module : "some/module" // and you still can do this.
+ }
+ ).define( function( _ ){
+ //...
+ });
+
+Yep, require.js is really the great library. Unfortunately, I can't use their API. Fingers refusing to type, man. :)
+
+MVC, and using include.js with jQuery.
+======================================
+Suppose you're developing single-page ajax application. In this case, you have problem with growing mess in your single HTML page. I will show how to make it really simple with include.js, demonstrating implementation of MVC pattern.
+
+Don't panic - MVC is performed _really_ simple in our case. Because, an only thing which is _really_ needed to perform MVC - is modules, and HTML template modules in particular. We have them, and this is enough.
+
+1. Model - is you data. Model can be trivialy decomposed to modules, as shown above.
+
+2. View - is the _file_ with HTML template. This file can be _included_ as regular module, under 'html' name. On inclusion, it will be compiled to JS function. Function take context, and expands the template returning HTML. It looks like this.
+
+$.include({
+ html: "template.html"
+ model : "model"
+})
+.define( function( _ ){
+...
+ var plain_html = _.html( _.model.query_data() );
+...
+});
+
+Yes, you can include multiple tempates at once. You need to specify an object with name-path pairs instead of string in 'html' property. And - then access them as _.html.yourFile. See an example for detailed templates explanation.
+
+3. Controller. This is the module, including Model, View, attaching event handling, and performing DOM manipulation in order to insert template instance to HTML document. It looks like this:
+
+$.include({
+ html: "template.html"
+ model : "model"
+})
+.define( function( _ ){
+ _.exports = function( $this, a_data, a_events ){
+ function update(){
+ // taking context out of model...
+ var context = _.model.query_data( a_data );
+ _.model.on_update( update ); // subscribe for model updates...
+
+ // render template, inserting instance to $this jQuery object.
+ _.html.renderTo( $this, context ); // yes, we support jQuery!
+
+ // attach event handlers
+ $this.find( '#ok' ).click( a_events.on_ok ); // ok - pass to the caller.
+ $this.find( '#refresh ).click( update ); // We know how to process this event. We update ourself.
+ }
+
+ update();
+
+ return {
+ force_update : update; // return control interface to caller. Rarely needed, but important.
+ };
+ }
+});
+
+So, how you design your application? Answer is simple. You decompose it to the hierarchy of controllers. Controllers include views, as HTML templates, and other controllers. Controller function in all cases do the dame things:
+1) Prepare context talking to the model.
+2) Render view.
+3) Attach events to its templates instance.
+4) Render included controllers
+5) Return control object, if necessary.
+
+Ok, _what_ is controller? It's plain function of the following kind:
+function( root_DOM_node, data_or_parameters, callbacks ) -> control_object | undefined.
+
+root_DOM_node: this is jQuery object, controller-view should be placed inside. It's responsibility of controller to perform all DOM manipulations required until the return;
+
+data_or_parameters: if controller takes any data or parameters, it will be the second argument. Controller knows, how to process them;
+
+callbacks: set of callbacks for event processing. Controller can pass some events up to the controllers tree.
+
+control_object: in case some external control for controller instance is needed, this is the way how you achieve it.
+
+That's it. And if you don't think that this is an easiest way to do MVC ever, please, write me a letter. I'm really curious what can be easier.
+
+How can I try it?
+=================
+First - see an example. This example show you complete explanation of core templates language, if you execute it. Just put the files in include.js directory under your web root, and open 'core templates.html'.
+
+In order to evaluate it in your jquery project you need to include 'include-bootstrap' instead of your jquery.min.js, and read an exampe in order to understand, how to start the library.
+
+Don't panic, and say 'bye' to complicated frameworks. It's is not this case. The code is really short, friendly, and easy to read.
Why?
====
@@ -22,33 +199,4 @@ There are dozens of JS templating libraries, but they are unaware of modules, te
Frameworks like Dojo solve these problem, but they have quite tough learning curve.
-I believe that there are no real reasons for things to be so complicated. That's why I have created this library.
-
-Please, show me the code!
-=========================
-
-$.include(
- 'plain.script.js', // load plain .js script.
- 'jquery.widget.definition.js', // load plain .js script in parallel with previous one.
- [ 'one.js', 'tho.js', 'three.js' ], // load these three .js scripts in listed order.
- {// this is module context & dependency declaration.
- some_module : 'logic/module', // JS module. Just like this one.
- some_other_module : 'logic/other',
- html : 'template.html' // HTML template will be loaded & compiled to the JS function.
- }
-).define( function( _ ){ // this function will be called with context, filled with actual values
- _.export = function( a_events ){
- var x = _.some_module( _.some_other_module );
- var $this = $( _.html( x ) );
- $this.find( 'button.ok' ).click( a_events.on_ok );
- return $this;
- }
-});
-
-Does it actually work?
-======================
-Yes and no. Yes, the previous version of library perfectly works in complex application.
-
-But here is the development snapshot if new, completely rewritten version. It's highly unstable. So, if you like an idea, you're welcome to experiment with it, report bugs, suggest improvements, and write plug-ins.
-
-I need one week or so in order to make it reliable.
\ No newline at end of file
+I believe that there are no real reasons for things to be so complicated. That's why I have created this library.
\ No newline at end of file
diff --git a/core templates.html b/core templates.html
new file mode 100644
index 0000000..897f5d8
--- /dev/null
+++ b/core templates.html
@@ -0,0 +1,32 @@
+
+
+
+
-Hello World!
-
\ No newline at end of file
+This is the template.
+
+
The basics
+
Include.js Core Templates plugin support simple yet comprehensive template language, based on JavaScript inlining. You can use two templating tag styles - "mustache" and "ASP-style".
+
+Here's a list of Core Templates tags:
+{{ this.core_tags( $1, tags ) }}
+Yep, that's it. By the way, the table above is generated with these tags, and is the test. Please, take a look inside html/main.html
+
+You include template with name 'html', and it gets automatically compiled to JS function. You can call this function in your code with context object, and it will evaluate template with its embeeded JS in the given context, and return text. That's simple. Like this:
+
+
+var html = _.html( { a: 5, b: "dsdsd" } );
+
+
+Or, if you're using jQuery, you can do this:
+
+
+
+And template will be rendered to #holder tag, erasing all previously existing inner HTML. And that's it.
+
+Oh, year, there are third tag, which represent the most interesting feature of Core Templates. Sections.
+
+
Sections
+Section - it's just the named subtemplate declaration you can put in you document, and use it from main section, or JS module. Or from the other section. Sections allow you to split large HTML document to the number of reusable parts. How it looks like? Well, have you opened this template (html/main.html)? :) It's good example.
+
+Defining section is easy.
+{{ this.core_tags( $1, sections ) }}
+
+Sections are translated to template functions in _.html namespace. For example, table with tags above can be accessible as _.html.core_tags from .js file, or - as this.core_tags from inside of this template.
+
+When you want to directly inline section in the template, you need to pass parameters to this function call. First parameter is context, and it can be referred as $1. In addition, you can pass secons $2 and third $3 parameters.
+
+Sections are extremily useful feature. Some use cases:
+
+
Fight the complexity of deep HTML trees. In case if HTML tree becomes hard to understand, you can take parts out of it and move them to the sections.
+
Similar patterns in the document. Move them to the sections, and you will remove the pain.
+{- for( var i in $2 ){-}
+ <% var tag = $2[ i ]; %>
+
+
{{ tag.desc }}
+
<%= tag.mustache %>
+
{{ $2[ i ].asp }}
+
+{-}-}
+
+
+{-- why_such_templates --}
+
Now let me explain, why templates looks like they looks:
+
+
I believe that there's no real reason to introduce templating DSLs, while we have JS already.
+
+
JS have necessary control structures.
+
JS is more powerful, than any of templating DSLs. With emedded JS capabilities you're sure, that you can do _everything_ you need.
+
Templates with embedded JS can be easily compiled to JS, and they are FAST
+
And there's one important thing - you already know and unrestand JS, and there's nothing to learn.
+
+
+
+
You might have different point of view - and that's fine. I suspected that, and specially designed the system in the way, allowing you to easily extend templating system. I mean, it's _really_ easy.
+
+
All 'smart' content modules are handled through plug-ins
+
Core Templates itself is the plugin.
+
Plugins can call each other
+
You can translate your favorite template syntax to Core Templates one, and pass the result to 'html' plugin, to do the rest of magic.
+
???
+
PROFIT! Actually, this is the major reason for Core Templates to be minimalistic. It's degined to be the basis for more complicated templating DSLs.
+
+
+
+
Why I's using so strange JS-inline tags in 'mustache' case? It's so complicated to count JS backets when inserting if-s and for-s...
+
+
Because I hate counting brackets. You don't need to do it with mustache style.
+
The right way - to count {{ block }} and {{end}} patterns. Its so easy, that when you get used to it, you will not need DSLs, cause embedded JS will looks just fine.
+
+
+
+
diff --git a/include-bootstrap.js b/include-bootstrap.js
new file mode 100644
index 0000000..9dda3e2
--- /dev/null
+++ b/include-bootstrap.js
@@ -0,0 +1,462 @@
+/*
+ IncludeJS Copyright 2010, Vlad Balin aka "Gaperton".
+ Dual licensed under the MIT or GPL Version 2 licenses.
+
+ RequireJS Copyright (c) 2010, The Dojo Foundation All Rights Reserved.
+ Available via the MIT or new BSD license.
+ see: http://github.com/jrburke/requirejs for details
+ RequireJS i18n Copyright (c) 2010, The Dojo Foundation All Rights Reserved.
+ Available via the MIT or new BSD license.
+ see: http://github.com/jrburke/requirejs for details
+ RequireJS text Copyright (c) 2010, The Dojo Foundation All Rights Reserved.
+ Available via the MIT or new BSD license.
+ see: http://github.com/jrburke/requirejs for details
+ RequireJS jsonp Copyright (c) 2010, The Dojo Foundation All Rights Reserved.
+ Available via the MIT or new BSD license.
+ see: http://github.com/jrburke/requirejs for details
+ RequireJS order Copyright (c) 2010, The Dojo Foundation All Rights Reserved.
+ Available via the MIT or new BSD license.
+ see: http://github.com/jrburke/requirejs for details
+
+ jQuery JavaScript Library v1.4.3
+ http://jquery.com/
+
+ Copyright 2010, John Resig
+ Dual licensed under the MIT or GPL Version 2 licenses.
+ http://jquery.org/license
+
+ Includes Sizzle.js
+ http://sizzlejs.com/
+ Copyright 2010, The Dojo Foundation
+ Released under the MIT, BSD, and GPL Licenses.
+
+ Date: Thu Oct 14 23:10:06 2010 -0400
+*/
+var require,define;
+(function(){function R(j){return Ba.call(j)==="[object Function]"}function C(j,l,s){var q=y.plugins.defined[j];if(q)q[s.name].apply(null,s.args);else{q=y.plugins.waiting[j]||(y.plugins.waiting[j]=[]);q.push(s);z(["require/"+j],l.contextName)}}function da(j,l){Ca.apply(z,j);l.loaded[j[0]]=true}function H(j,l,s){var q,v,D;for(q=0;D=l[q];q++){D=typeof D==="string"?{name:D}:D;v=D.location;if(s&&(!v||v.indexOf("/")!==0&&v.indexOf(":")===-1))D.location=s+"/"+(D.location||D.name);D.location=D.location||
+D.name;D.lib=D.lib||"lib";D.main=D.main||"main";j[D.name]=D}}function x(j){var l=true,s=j.config.priorityWait,q,v;if(s){for(v=0;q=s[v];v++)if(!j.loaded[q]){l=false;break}l&&delete j.config.priorityWait}return l}function E(j){var l,s=y.paused;if(j.scriptCount<=0){for(j.scriptCount=0;wa.length;){l=wa.shift();l[0]===null?z.onError(new Error("Mismatched anonymous require.def modules")):da(l,j)}if(!(j.config.priorityWait&&!x(j))){if(s.length)for(j=0;l=s[j];j++)z.checkDeps.apply(z,l);z.checkLoaded(y.ctxName)}}}
+function P(j,l){var s=y.plugins.callbacks[j]=[];y.plugins[j]=function(){for(var q=0,v;v=s[q];q++)if(v.apply(null,arguments)===true&&l)return true;return false}}function J(j,l){if(!j.jQuery)if((l=l||(typeof jQuery!=="undefined"?jQuery:null))&&"readyWait"in l){j.jQuery=l;if(!j.defined.jquery&&!j.jQueryDef)j.defined.jquery=l;if(j.scriptCount){l.readyWait+=1;j.jQueryIncremented=true}}}function O(j){return function(l){j.exports=l}}function Z(j,l,s){return function(){var q=[].concat(Da.call(arguments,0));
+q.push(l,s);return(j?require[j]:require).apply(null,q)}}function $(j,l){var s=j.contextName,q=Z(null,s,l);z.mixin(q,{modify:Z("modify",s,l),def:Z("def",s,l),get:Z("get",s,l),nameToUrl:Z("nameToUrl",s,l),ready:z.ready,context:j,config:j.config,isBrowser:y.isBrowser});return q}var W={},y,X,Y=[],ta,la,B,c,Ea,ua={},Fa,Ga=/^(complete|loaded)$/,Ma=/(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,Na=/require\(["']([\w-_\.\/]+)["']\)/g,Ca,pa=!!(typeof window!=="undefined"&&navigator&&document),Ka=!pa&&typeof importScripts!==
+"undefined",Ba=Object.prototype.toString,xa=Array.prototype,Da=xa.slice,Ha,z,ya,wa=[],Ia=false,za;if(typeof require!=="undefined")if(R(require))return;else ua=require;z=require=function(j,l,s,q,v){var D;if(typeof j==="string"&&!R(l))return require.get(j,l,s,q);if(!require.isArray(j)){D=j;if(require.isArray(l)){j=l;l=s;s=q;q=v}else j=[]}Ca(null,j,l,D,s,q);(j=y.contexts[s||D&&D.context||y.ctxName])&&j.scriptCount===0&&E(j)};z.onError=function(j){throw j;};define=z.def=function(j,l,s,q){var v,D,I=za;
+if(typeof j!=="string"){q=s;s=l;l=j;j=null}if(!z.isArray(l)){q=s;s=l;l=[]}if(!j&&!l.length&&z.isFunction(s)){s.toString().replace(Ma,"").replace(Na,function(L,aa){l.push(aa)});l=["require","exports","module"].concat(l)}if(!j&&Ia){v=document.getElementsByTagName("script");for(j=v.length-1;j>-1&&(D=v[j]);j--)if(D.readyState==="interactive"){I=D;break}I||z.onError(new Error("ERROR: No matching script interactive for "+s));j=I.getAttribute("data-requiremodule")}if(typeof j==="string")y.contexts[y.ctxName].jQueryDef=
+j==="jquery";wa.push([j,l,s,null,q])};Ca=function(j,l,s,q,v,D){var I,L,aa,ba,V;v=v?v:q&&q.context?q.context:y.ctxName;I=y.contexts[v];if(j){L=j.indexOf("!");if(L!==-1){aa=j.substring(0,L);j=j.substring(L+1,j.length)}else aa=I.defPlugin[j];L=I.waiting[j];if(I&&(I.defined[j]||L&&L!==xa[j]))return}if(v!==y.ctxName){L=y.contexts[y.ctxName]&&y.contexts[y.ctxName].loaded;ba=true;if(L)for(V in L)if(!(V in W))if(!L[V]){ba=false;break}if(ba)y.ctxName=v}if(!I){I={contextName:v,config:{waitSeconds:7,baseUrl:y.baseUrl||
+"./",paths:{},packages:{}},waiting:[],specified:{require:true,exports:true,module:true},loaded:{},scriptCount:0,urlFetched:{},defPlugin:{},defined:{},modifiers:{}};y.plugins.newContext&&y.plugins.newContext(I);I=y.contexts[v]=I}if(q){if(q.baseUrl)if(q.baseUrl.charAt(q.baseUrl.length-1)!=="/")q.baseUrl+="/";ba=I.config.paths;L=I.config.packages;z.mixin(I.config,q,true);if(q.paths){for(V in q.paths)V in W||(ba[V]=q.paths[V]);I.config.paths=ba}if((ba=q.packagePaths)||q.packages){if(ba)for(V in ba)V in
+W||H(L,ba[V],V);q.packages&&H(L,q.packages);I.config.packages=L}if(q.priority){z(q.priority);I.config.priorityWait=q.priority}if(q.deps||q.callback)z(q.deps||[],q.callback);q.ready&&z.ready(q.ready);if(!l)return}if(l){V=l;l=[];for(q=0;q0;L--){I=q.slice(0,L).join("/");if(v[I]){q.splice(0,L,v[I]);break}else if(I=D[I]){v=
+I.location+"/"+I.lib;if(j===I.name)v+="/"+I.main;q.splice(0,L,v);break}}j=q.join("/")+(l||".js");j=(j.charAt(0)==="/"||j.match(/^\w+:/)?"":s.baseUrl)+j}return s.urlArgs?j+((j.indexOf("?")===-1?"?":"&")+s.urlArgs):j};z.checkLoaded=function(j){var l=y.contexts[j||y.ctxName],s=l.config.waitSeconds*1E3,q=s&&l.startTime+s<(new Date).getTime(),v,D=l.defined,I=l.modifiers,L="",aa=false,ba=false,V,ja=y.plugins.isWaiting,qa=y.plugins.orderDeps;if(!l.isCheckLoaded){if(l.config.priorityWait)if(x(l))E(l);else return;
+l.isCheckLoaded=true;s=l.waiting;v=l.loaded;for(V in v)if(!(V in W)){aa=true;if(!v[V])if(q)L+=V+" ";else{ba=true;break}}if(!aa&&!s.length&&(!ja||!ja(l)))l.isCheckLoaded=false;else{if(q&&L){v=new Error("require.js load timeout for modules: "+L);v.requireType="timeout";v.requireModules=L;z.onError(v)}if(ba){l.isCheckLoaded=false;if(pa||Ka)setTimeout(function(){z.checkLoaded(j)},50)}else{l.waiting=[];l.loaded={};qa&&qa(l);for(V in I)V in W||D[V]&&z.execModifiers(V,{},s,l);for(v=0;D=s[v];v++)z.exec(D,
+{},s,l);l.isCheckLoaded=false;if(l.waiting.length||ja&&ja(l))z.checkLoaded(j);else if(Y.length){v=l.loaded;l=true;for(V in v)if(!(V in W))if(!v[V]){l=false;break}if(l){y.ctxName=Y[0][1];V=Y;Y=[];for(v=0;l=V[v];v++)z.load.apply(z,l)}}else{y.ctxName="_";y.isDone=true;z.callReady&&z.callReady()}}}}};z.exec=function(j,l,s,q){if(j){var v=j.name,D=j.callback;D=j.deps;var I,L,aa=q.defined,ba,V=[],ja,qa=false;if(v){if(l[v]||v in aa)return aa[v];l[v]=true}if(D)for(I=0;L=D[I];I++){L=L.name;if(L==="require")L=
+$(q,v);else if(L==="exports"){L=aa[v]={};qa=true}else if(L==="module"){ja=L={id:v,uri:v?z.nameToUrl(v,null,q.contextName):undefined};ja.setExports=O(ja)}else L=L in aa?aa[L]:l[L]?undefined:z.exec(s[s[L]],l,s,q);V.push(L)}if((D=j.callback)&&z.isFunction(D)){ba=z.execCb(v,D,V);if(v)if(qa&&ba===undefined&&(!ja||!("exports"in ja)))ba=aa[v];else if(ja&&"exports"in ja)ba=aa[v]=ja.exports;else{v in aa&&!qa&&z.onError(new Error(v+" has already been defined"));aa[v]=ba}}z.execModifiers(v,l,s,q);return ba}};
+z.execCb=function(j,l,s){return l.apply(null,s)};z.execModifiers=function(j,l,s,q){var v=q.modifiers,D=v[j],I,L;if(D){for(L=0;L-1&&(la=ta[X]);X--){if(!y.head)y.head=la.parentNode;if(!ua.deps)if(c=la.getAttribute("data-main"))ua.deps=[c];if((c=la.src)&&!y.baseUrl)if(Ea=c.match(B)){y.baseUrl=c.substring(0,Ea.index);break}}}z.pageLoaded=function(){if(!y.isPageLoaded){y.isPageLoaded=
+true;Ha&&clearInterval(Ha);if(Fa)document.readyState="complete";z.callReady()}};z.callReady=function(){var j=y.readyCalls,l,s,q;if(y.isPageLoaded&&y.isDone){if(j.length){y.readyCalls=[];for(l=0;s=j[l];l++)s()}j=y.contexts;for(q in j)if(!(q in W)){l=j[q];if(l.jQueryIncremented){l.jQuery.readyWait-=1;l.jQueryIncremented=false}}}};z.ready=function(j){y.isPageLoaded&&y.isDone?j():y.readyCalls.push(j);return z};if(pa){if(document.addEventListener){document.addEventListener("DOMContentLoaded",z.pageLoaded,
+false);window.addEventListener("load",z.pageLoaded,false);if(!document.readyState){Fa=true;document.readyState="loading"}}else if(window.attachEvent){window.attachEvent("onload",z.pageLoaded);if(self===self.top)Ha=setInterval(function(){try{if(document.body){document.documentElement.doScroll("left");z.pageLoaded()}}catch(j){}},30)}document.readyState==="complete"&&z.pageLoaded()}z(ua);typeof setTimeout!=="undefined"&&setTimeout(function(){var j=y.contexts[ua.context||"_"];J(j);E(j)},0)})();
+(function(){function R(x,E){E=E.nlsWaiting;return E[x]||(E[x]=E[E.push({_name:x})-1])}function C(x,E,P,J){var O,Z,$,W,y,X,Y="root";Z=P.split("-");$=[];W=R(x,J);for(O=Z.length;O>-1;O--){y=O?Z.slice(0,O).join("-"):"root";if(X=E[y]){if(P===J.config.locale&&!W._match)W._match=y;if(Y==="root")Y=y;W[y]=y;if(X===true){X=x.split("/");X.splice(-1,0,y);X=X.join("/");if(!J.specified[X]&&!(X in J.loaded)&&!J.defined[X]){J.defPlugin[X]="i18n";$.push(X)}}}}if(Y!==P)if(J.defined[Y])J.defined[P]=J.defined[Y];else W[P]=
+Y;$.length&&require($,J.contextName)}var da=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/,H={};require.plugin({prefix:"i18n",require:function(x,E,P,J){var O,Z=J.defined[x];O=da.exec(x);if(O[5]){x=O[1]+O[5];E=R(x,J);E[O[4]]=O[4];E=J.nls[x];if(!E){J.defPlugin[x]="i18n";require([x],J.contextName);E=J.nls[x]={}}E[O[4]]=P}else{if(E=J.nls[x])require.mixin(E,Z);else E=J.nls[x]=Z;J.nlsRootLoaded[x]=true;if(O=J.nlsToLoad[x]){delete J.nlsToLoad[x];for(P=0;P0;P--){la=$.slice(0,P).join("-");la!=="root"&&
+Z[la]&&require.mixin(y,Z[la])}Z.root&&require.mixin(y,Z.root);x.defined[X+"/"+Y+"/"+W]=y}x.defined[J]=x.defined[X+"/"+ta+"/"+W];if(c)for(Y in c)Y in H||(x.defined[X+"/"+Y+"/"+W]=x.defined[X+"/"+c[Y]+"/"+W])}}})})();
+(function(){var R=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],C=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,da=/]*>\s*([\s\S]+)\s*<\/body>/im;if(!require.textStrip)require.textStrip=function(H){if(H){H=H.replace(C,"");var x=H.match(da);if(x)H=x[1]}else H="";return H};if(!require.getXhr)require.getXhr=function(){var H,x,E;if(typeof XMLHttpRequest!=="undefined")return new XMLHttpRequest;else for(x=0;x<3;x++){E=R[x];try{H=new ActiveXObject(E)}catch(P){}if(H){R=
+[E];break}}if(!H)throw new Error("require.getXhr(): XMLHttpRequest not available");return H};if(!require.fetchText)require.fetchText=function(H,x){var E=require.getXhr();E.open("GET",H,true);E.onreadystatechange=function(){E.readyState===4&&x(E.responseText)};E.send(null)};require.plugin({prefix:"text",require:function(){},newContext:function(H){require.mixin(H,{text:{},textWaiting:[]})},load:function(H,x){var E=false,P=null,J,O=H.indexOf("."),Z=H.substring(0,O),$=H.substring(O+1,H.length),W=require.s.contexts[x],
+y=W.textWaiting;O=$.indexOf("!");if(O!==-1){E=$.substring(O+1,$.length);$=$.substring(0,O);O=E.indexOf("!");if(O!==-1&&E.substring(0,O)==="strip"){P=E.substring(O+1,E.length);E="strip"}else if(E!=="strip"){P=E;E=null}}J=Z+"!"+$;O=E?J+"!"+E:J;if(P!==null&&!W.text[J])W.defined[H]=W.text[J]=P;else if(!W.text[J]&&!W.textWaiting[J]&&!W.textWaiting[O]){y[O]||(y[O]=y[y.push({name:H,key:J,fullKey:O,strip:!!E})-1]);x=require.nameToUrl(Z,"."+$,x);W.loaded[H]=false;require.fetchText(x,function(X){W.text[J]=
+X;W.loaded[H]=true})}},checkDeps:function(){},isWaiting:function(H){return!!H.textWaiting.length},orderDeps:function(H){var x,E,P,J=H.textWaiting;H.textWaiting=[];for(x=0;E=J[x];x++){P=H.text[E.key];H.defined[E.name]=E.strip?require.textStrip(P):P}}})})();
+(function(){var R=0;require._jsonp={};require.plugin({prefix:"jsonp",require:function(){},newContext:function(C){require.mixin(C,{jsonpWaiting:[]})},load:function(C,da){var H=C.indexOf("?"),x=C.substring(0,H);H=C.substring(H+1,C.length);var E=require.s.contexts[da],P={name:C},J="f"+R++,O=require.s.head,Z=O.ownerDocument.createElement("script");require._jsonp[J]=function($){P.value=$;E.loaded[C]=true;setTimeout(function(){O.removeChild(Z);delete require._jsonp[J]},15)};E.jsonpWaiting.push(P);x=require.nameToUrl(x,
+"?",da);x+=(x.indexOf("?")===-1?"?":"")+H.replace("?","require._jsonp."+J);E.loaded[C]=false;Z.type="text/javascript";Z.charset="utf-8";Z.src=x;Z.async=true;O.appendChild(Z)},checkDeps:function(){},isWaiting:function(C){return!!C.jsonpWaiting.length},orderDeps:function(C){var da,H,x=C.jsonpWaiting;C.jsonpWaiting=[];for(da=0;H=x[da];da++)C.defined[H.name]=H.value}})})();
+(function(){function R(H){var x=H.currentTarget||H.srcElement,E,P,J,O;if(H.type==="load"||da.test(x.readyState)){P=x.getAttribute("data-requirecontext");E=x.getAttribute("data-requiremodule");H=require.s.contexts[P];J=H.orderWaiting;O=H.orderCached;O[E]=true;for(E=0;O[J[E]];E++);E>0&&require(J.splice(0,E),P);if(!J.length)H.orderCached={};setTimeout(function(){x.parentNode.removeChild(x)},15)}}var C=window.opera&&Object.prototype.toString.call(window.opera)==="[object Opera]"||"MozAppearance"in document.documentElement.style,
+da=/^(complete|loaded)$/;require.plugin({prefix:"order",require:function(){},newContext:function(H){require.mixin(H,{orderWaiting:[],orderCached:{}})},load:function(H,x){var E=require.s.contexts[x],P=require.nameToUrl(H,null,x);require.s.skipAsync[P]=true;if(C)require([H],x);else{E.orderWaiting.push(H);E.loaded[H]=false;require.attach(P,x,H,R,"script/cache")}},checkDeps:function(){},isWaiting:function(H){return!!H.orderWaiting.length},orderDeps:function(){}})})();
+(function(R,C){function da(){return false}function H(){return true}function x(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function E(a){var b,d,e=[],g=[],h,m,n,p,A,F,Q,S;m=c.data(this,this.nodeType?"events":"__events__");if(typeof m==="function")m=m.events;if(!(a.liveFired===this||!m||!m.live||a.button&&a.type==="click")){if(a.namespace)S=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var ea=m.live.slice(0);for(p=0;pd)break;a.currentTarget=g.elem;a.data=g.handleObj.data;
+a.handleObj=g.handleObj;S=g.handleObj.origHandler.apply(g.elem,arguments);if(S===false||a.isPropagationStopped()){d=g.level;if(S===false)b=false}}return b}}function P(a,b){return(a&&a!=="*"?a+".":"")+b.replace(Ha,"`").replace(z,"&")}function J(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function O(a,b,d){if(c.isFunction(b))return c.grep(a,function(g,h){return!!b.call(g,h,g)===d});else if(b.nodeType)return c.grep(a,function(g){return g===b===d});else if(typeof b==="string"){var e=c.grep(a,
+function(g){return g.nodeType===1});if(aa.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(g){return c.inArray(g,b)>=0===d})}function Z(a){return c.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function $(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),g=c.data(this,e);if(e=e&&e.events){delete g.handle;g.events={};for(var h in e)for(var m in e[h])c.event.add(this,
+h,e[h][m],e[h][m].data)}}})}function W(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function y(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?$a:ab,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function X(a,
+b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(g,h){d||bb.test(a)?e(a,h):X(a+"["+(typeof h==="object"||c.isArray(h)?g:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(g,h){X(a+"["+g+"]",h,d,e)});else e(a,b)}function Y(a,b){var d={};c.each(Ra.concat.apply([],Ra.slice(0,b)),function(){d[this]=a});return d}function ta(a){if(!Oa[a]){var b=c("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";Oa[a]=d}return Oa[a]}
+function la(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var B=R.document,c=function(){function a(){if(!b.isReady){try{B.documentElement.doScroll("left")}catch(k){setTimeout(a,1);return}b.ready()}}var b=function(k,u){return new b.fn.init(k,u)},d=R.jQuery,e=R.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,m=/\S/,n=/^\s+/,p=/\s+$/,A=/\W/,F=/\d/,Q=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,S=/^[\],:{}\s]*$/,ea=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,K=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
+ca=/(?:^|:|,)(?:\s*\[)+/g,ma=/(webkit)[ \/]([\w.]+)/,f=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,o=/(mozilla)(?:.*? rv:([\w.]+))?/,r=navigator.userAgent,t=false,w=[],G,M=Object.prototype.toString,T=Object.prototype.hasOwnProperty,ra=Array.prototype.push,na=Array.prototype.slice,va=String.prototype.trim,sa=Array.prototype.indexOf,ka={};b.fn=b.prototype={init:function(k,u){var N,U;if(!k)return this;if(k.nodeType){this.context=this[0]=k;this.length=1;return this}if(k==="body"&&!u&&B.body){this.context=
+B;this[0]=B.body;this.selector="body";this.length=1;return this}if(typeof k==="string")if((N=h.exec(k))&&(N[1]||!u))if(N[1]){U=u?u.ownerDocument||u:B;if(k=Q.exec(k))if(b.isPlainObject(u)){k=[B.createElement(k[1])];b.fn.attr.call(k,u,true)}else k=[U.createElement(k[1])];else{k=b.buildFragment([N[1]],[U]);k=(k.cacheable?k.fragment.cloneNode(true):k.fragment).childNodes}return b.merge(this,k)}else{if((u=B.getElementById(N[2]))&&u.parentNode){if(u.id!==N[2])return g.find(k);this.length=1;this[0]=u}this.context=
+B;this.selector=k;return this}else if(!u&&!A.test(k)){this.selector=k;this.context=B;k=B.getElementsByTagName(k);return b.merge(this,k)}else return!u||u.jquery?(u||g).find(k):b(u).find(k);else if(b.isFunction(k))return g.ready(k);if(k.selector!==C){this.selector=k.selector;this.context=k.context}return b.makeArray(k,this)},selector:"",jquery:"1.4.3",length:0,size:function(){return this.length},toArray:function(){return na.call(this,0)},get:function(k){return k==null?this.toArray():k<0?this.slice(k)[0]:
+this[k]},pushStack:function(k,u,N){var U=b();b.isArray(k)?ra.apply(U,k):b.merge(U,k);U.prevObject=this;U.context=this.context;if(u==="find")U.selector=this.selector+(this.selector?" ":"")+N;else if(u)U.selector=this.selector+"."+u+"("+N+")";return U},each:function(k,u){return b.each(this,k,u)},ready:function(k){b.bindReady();if(b.isReady)k.call(B,b);else w&&w.push(k);return this},eq:function(k){return k===-1?this.slice(k):this.slice(k,+k+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},
+slice:function(){return this.pushStack(na.apply(this,arguments),"slice",na.call(arguments).join(","))},map:function(k){return this.pushStack(b.map(this,function(u,N){return k.call(u,N,u)}))},end:function(){return this.prevObject||b(null)},push:ra,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var k=arguments[0]||{},u=1,N=arguments.length,U=false,fa,ga,ia,ha,Pa;if(typeof k==="boolean"){U=k;k=arguments[1]||{};u=2}if(typeof k!=="object"&&!b.isFunction(k))k={};
+if(N===u){k=this;--u}for(;u0)){if(w){for(var u=0;k=w[u++];)k.call(B,b);w=null}b.fn.triggerHandler&&b(B).triggerHandler("ready")}}},bindReady:function(){if(!t){t=true;if(B.readyState==="complete")return setTimeout(b.ready,1);if(B.addEventListener){B.addEventListener("DOMContentLoaded",G,false);R.addEventListener("load",b.ready,false)}else if(B.attachEvent){B.attachEvent("onreadystatechange",G);R.attachEvent("onload",b.ready);var k=false;try{k=R.frameElement==null}catch(u){}B.documentElement.doScroll&&
+k&&a()}}},isFunction:function(k){return b.type(k)==="function"},isArray:Array.isArray||function(k){return b.type(k)==="array"},isWindow:function(k){return k&&typeof k==="object"&&"setInterval"in k},isNaN:function(k){return k==null||!F.test(k)||isNaN(k)},type:function(k){return k==null?String(k):ka[M.call(k)]||"object"},isPlainObject:function(k){if(!k||b.type(k)!=="object"||k.nodeType||b.isWindow(k))return false;if(k.constructor&&!T.call(k,"constructor")&&!T.call(k.constructor.prototype,"isPrototypeOf"))return false;
+var u;for(u in k);return u===C||T.call(k,u)},isEmptyObject:function(k){for(var u in k)return false;return true},error:function(k){throw k;},parseJSON:function(k){if(typeof k!=="string"||!k)return null;k=b.trim(k);if(S.test(k.replace(ea,"@").replace(K,"]").replace(ca,"")))return R.JSON&&R.JSON.parse?R.JSON.parse(k):(new Function("return "+k))();else b.error("Invalid JSON: "+k)},noop:function(){},globalEval:function(k){if(k&&m.test(k)){var u=B.getElementsByTagName("head")[0]||B.documentElement,N=B.createElement("script");
+N.type="text/javascript";if(b.support.scriptEval)N.appendChild(B.createTextNode(k));else N.text=k;u.insertBefore(N,u.firstChild);u.removeChild(N)}},nodeName:function(k,u){return k.nodeName&&k.nodeName.toUpperCase()===u.toUpperCase()},each:function(k,u,N){var U,fa=0,ga=k.length,ia=ga===C||b.isFunction(k);if(N)if(ia)for(U in k){if(u.apply(k[U],N)===false)break}else for(;fa