diff --git a/README.md b/README.md
index 52560fd3..00dc3d9f 100755
--- a/README.md
+++ b/README.md
@@ -17,3 +17,10 @@ Designed for standalone use or as a library to integrate into your own app.
Open demo/index.html in your favourite browser.
+## Minifying dependencies
+
+ npm install -g uglify
+ cd vendor
+ cat *.js | uglifyjs -o ../src/deps-min.js
+
+note: make sure underscore.js goes in at the top of the file as a few deps currently depend on it
diff --git a/demo/index.html b/demo/index.html
index b25163ac..b348579b 100755
--- a/demo/index.html
+++ b/demo/index.html
@@ -1,25 +1,21 @@
-
-
+
+
+
+
+
Loading...
-
-
-
-
-
Loading...
-
+
+
+
+
+
+ before
+
+
+ after
+
+
+ {{#rows}}
+
+
+ {{before}}
+
+
+ {{after}}
+
+
+ {{/rows}}
+
+
+
+
diff --git a/demo/js/app.js b/demo/js/app.js
index 30a42f30..d1732f23 100755
--- a/demo/js/app.js
+++ b/demo/js/app.js
@@ -1,271 +1,229 @@
-var app = {
- baseURL: util.getBaseURL(document.location.pathname),
- container: 'main_content',
- emitter: util.registerEmitter()
-};
-
-app.handler = function(route) {
- if (route.params && route.params.route) {
- var path = route.params.route;
- app.routes[path](route.params.id);
- } else {
- app.routes['home']();
- }
-};
-
-app.routes = {
- home: function() {
- // HACK: this should be in the html file (and really we need a much simpler example and keep this as recline-full example)
- var demoData = {
- headers: ['x', 'y', 'z']
- , rows: [
- {x: 1, y: 2, z: 3}
- , {x: 2, y: 4, z: 6}
- , {x: 3, y: 6, z: 9}
- , {x: 4, y: 8, z: 12}
- , {x: 5, y: 10, z: 15}
- , {x: 6, y: 12, z: 18}
- ]
- };
- var dataset = new RECLINE.Model.Dataset({
- title: 'My Demo Dataset'
- },
- demoData);
- recline.bootstrap(dataset);
- }
-}
-
-app.after = {
- tableContainer: function() {
- recline.activateControls();
- },
- dataTable: function() {
- $('.column-header-menu').click(function(e) {
- app.currentColumn = $(e.target).siblings().text();
- util.position('menu', e);
- util.render('columnActions', 'menu');
- });
-
- $('.row-header-menu').click(function(e) {
- app.currentRow = $(e.target).parents('tr:first').attr('data-id');
- util.position('menu', e);
- util.render('rowActions', 'menu');
- });
-
- $('.data-table-cell-edit').click(function(e) {
- var editing = $('.data-table-cell-editor-editor');
- if (editing.length > 0) {
- editing.parents('.data-table-cell-value').html(editing.text()).siblings('.data-table-cell-edit').removeClass("hidden");
- }
- $(e.target).addClass("hidden");
- var cell = $(e.target).siblings('.data-table-cell-value');
- cell.data("previousContents", cell.text());
- util.render('cellEditor', cell, {value: cell.text()});
- })
- },
- columnActions: function() { recline.handleMenuClick() },
- rowActions: function() { recline.handleMenuClick() },
- cellEditor: function() {
- $('.data-table-cell-editor .okButton').click(function(e) {
- var cell = $(e.target);
- var rowId = cell.parents('tr').attr('data-id');
- var header = cell.parents('td').attr('data-header');
- var doc = _.find(app.cache, function(cacheDoc) {
- return cacheDoc._id === rowId;
- });
- doc[header] = cell.parents('.data-table-cell-editor').find('.data-table-cell-editor-editor').val();
- util.notify("Updating row...", {persist: true, loader: true});
- costco.updateDoc(doc).then(function(response) {
- util.notify("Row updated successfully");
- recline.initializeTable();
- })
- })
- $('.data-table-cell-editor .cancelButton').click(function(e) {
- var cell = $(e.target).parents('.data-table-cell-value');
- cell.html(cell.data('previousContents')).siblings('.data-table-cell-edit').removeClass("hidden");
- })
- },
- actions: function() {
- $('.button').click(function(e) {
- var action = $(e.target).attr('data-action');
- util.position('menu', e, {left: -60, top: 5});
- util.render(action + 'Actions', 'menu');
- recline.handleMenuClick();
- });
- },
- controls: function() {
- $('#logged-in-status').click(function(e) {
- if ($(e.target).text() === "Sign in") {
- recline.showDialog("signIn");
- } else if ($(e.target).text() === "Sign out") {
- util.notify("Signing you out...", {persist: true, loader: true});
- couch.logout().then(function(response) {
- util.notify("Signed out");
- util.render('controls', 'project-controls', {text: "Sign in"});
- })
- }
- });
- },
- signIn: function() {
-
- $('.dialog-content #username-input').focus();
-
- $('.dialog-content').find('#sign-in-form').submit(function(e) {
- $('.dialog-content .okButton').click();
- return false;
- })
-
- $('.dialog-content .okButton').click(function(e) {
- util.hide('dialog');
- util.notify("Signing you in...", {persist: true, loader: true});
- var form = $(e.target).parents('.dialog-content').find('#sign-in-form');
- var credentials = {
- username: form.find('#username-input').val(),
- password: form.find('#password-input').val()
- }
- couch.login(credentials).then(function(response) {
- util.notify("Signed in");
- util.render('controls', 'project-controls', {text: "Sign out"});
- }, function(error) {
- if (error.statusText === "error") util.notify(JSON.parse(error.responseText).reason);
- })
- })
-
- },
- bulkEdit: function() {
- $('.dialog-content .okButton').click(function(e) {
- var funcText = $('.expression-preview-code').val();
- var editFunc = costco.evalFunction(funcText);
- ;
- if (editFunc.errorMessage) {
- util.notify("Error with function! " + editFunc.errorMessage);
- return;
- }
- util.hide('dialog');
- costco.updateDocs(editFunc);
- })
-
- var editor = $('.expression-preview-code');
- editor.val("function(doc) {\n doc['"+ app.currentColumn+"'] = doc['"+ app.currentColumn+"'];\n return doc;\n}");
- editor.focus().get(0).setSelectionRange(18, 18);
- editor.keydown(function(e) {
- // if you don't setTimeout it won't grab the latest character if you call e.target.value
- window.setTimeout( function() {
- var errors = $('.expression-preview-parsing-status');
- var editFunc = costco.evalFunction(e.target.value);
- if (!editFunc.errorMessage) {
- errors.text('No syntax error.');
- costco.previewTransform(app.cache, editFunc, app.currentColumn);
- } else {
- errors.text(editFunc.errorMessage);
- }
- }, 1, true);
- });
- editor.keydown();
- },
- transform: function() {
- $('.dialog-content .okButton').click(function(e) {
- util.notify("Not implemented yet, sorry! :D");
- util.hide('dialog');
- })
-
- var editor = $('.expression-preview-code');
- editor.val("function(val) {\n if(_.isString(val)) this.update(\"pizza\")\n}");
- editor.focus().get(0).setSelectionRange(62,62);
- editor.keydown(function(e) {
- // if you don't setTimeout it won't grab the latest character if you call e.target.value
- window.setTimeout( function() {
- var errors = $('.expression-preview-parsing-status');
- var editFunc = costco.evalFunction(e.target.value);
- if (!editFunc.errorMessage) {
- errors.text('No syntax error.');
- var traverseFunc = function(doc) {
- util.traverse(doc).forEach(editFunc);
- return doc;
- }
- costco.previewTransform(app.cache, traverseFunc);
- } else {
- errors.text(editFunc.errorMessage);
- }
- }, 1, true);
- });
- editor.keydown();
- },
- urlImport: function() {
- $('.dialog-content .okButton').click(function(e) {
- app.apiURL = $('#url-input').val().trim();
- util.notify("Fetching data...", {persist: true, loader: true});
- $.getJSON(app.apiURL + "?callback=?").then(
- function(docs) {
- app.apiDocs = docs;
- util.notify("Data fetched successfully!");
- recline.showDialog('jsonTree');
- },
- function (err) {
- util.hide('dialog');
- util.notify("Data fetch error: " + err.responseText);
- }
- );
- })
- },
- uploadImport: function() {
- $('.dialog-content .okButton').click(function(e) {
- util.hide('dialog');
- util.notify("Saving documents...", {persist: true, loader: true});
- costco.uploadCSV();
- })
- },
- jsonTree: function() {
- util.renderTree(app.apiDocs);
- $('.dialog-content .okButton').click(function(e) {
- util.hide('dialog');
- util.notify("Saving documents...", {persist: true, loader: true});
- costco.uploadDocs(util.lookupPath(util.selectedTreePath())).then(function(msg) {
- util.notify("Docs saved successfully!");
- recline.initializeTable(app.offset);
- });
- })
- },
- pasteImport: function() {
- $('.dialog-content .okButton').click(function(e) {
- util.notify("Uploading documents...", {persist: true, loader: true});
- try {
- var docs = JSON.parse($('.data-table-cell-copypaste-editor').val());
- } catch(e) {
- util.notify("JSON parse error: " + e);
- }
- if (docs) {
- if(_.isArray(docs)) {
- costco.uploadDocs(docs).then(
- function(docs) {
- util.notify("Data uploaded successfully!");
- recline.initializeTable(app.offset);
- util.hide('dialog');
- },
- function (err) {
- util.hide('dialog');
- }
- );
- } else {
- util.notify("Error: JSON must be an array of objects");
- }
- }
- })
- }
-}
-
-app.sammy = $.sammy(function () {
- this.get('', app.handler);
- this.get("#/", app.handler);
- this.get("#:route", app.handler);
- this.get("#:route/:id", app.handler);
-});
-
$(function() {
- app.emitter.on('error', function(error) {
- util.notify("Server error: " + error);
- })
-
- util.traverse = require('traverse');
- app.sammy.run();
+ window.app = new recline.DataTable({url: "awesome.com/webstore.json"});
})
+
+// app.after = {
+// tableContainer: function() {
+// recline.activateControls();
+// },
+// dataTable: function() {
+// $('.column-header-menu').click(function(e) {
+// app.currentColumn = $(e.target).siblings().text();
+// util.position('menu', e);
+// util.render('columnActions', 'menu');
+// });
+//
+// $('.row-header-menu').click(function(e) {
+// app.currentRow = $(e.target).parents('tr:first').attr('data-id');
+// util.position('menu', e);
+// util.render('rowActions', 'menu');
+// });
+//
+// $('.data-table-cell-edit').click(function(e) {
+// var editing = $('.data-table-cell-editor-editor');
+// if (editing.length > 0) {
+// editing.parents('.data-table-cell-value').html(editing.text()).siblings('.data-table-cell-edit').removeClass("hidden");
+// }
+// $(e.target).addClass("hidden");
+// var cell = $(e.target).siblings('.data-table-cell-value');
+// cell.data("previousContents", cell.text());
+// util.render('cellEditor', cell, {value: cell.text()});
+// })
+// },
+// columnActions: function() { recline.handleMenuClick() },
+// rowActions: function() { recline.handleMenuClick() },
+// cellEditor: function() {
+// $('.data-table-cell-editor .okButton').click(function(e) {
+// var cell = $(e.target);
+// var rowId = cell.parents('tr').attr('data-id');
+// var header = cell.parents('td').attr('data-header');
+// var doc = _.find(app.cache, function(cacheDoc) {
+// return cacheDoc._id === rowId;
+// });
+// doc[header] = cell.parents('.data-table-cell-editor').find('.data-table-cell-editor-editor').val();
+// util.notify("Updating row...", {persist: true, loader: true});
+// costco.updateDoc(doc).then(function(response) {
+// util.notify("Row updated successfully");
+// recline.initializeTable();
+// })
+// })
+// $('.data-table-cell-editor .cancelButton').click(function(e) {
+// var cell = $(e.target).parents('.data-table-cell-value');
+// cell.html(cell.data('previousContents')).siblings('.data-table-cell-edit').removeClass("hidden");
+// })
+// },
+// actions: function() {
+// $('.button').click(function(e) {
+// var action = $(e.target).attr('data-action');
+// util.position('menu', e, {left: -60, top: 5});
+// util.render(action + 'Actions', 'menu');
+// recline.handleMenuClick();
+// });
+// },
+// controls: function() {
+// $('#logged-in-status').click(function(e) {
+// if ($(e.target).text() === "Sign in") {
+// recline.showDialog("signIn");
+// } else if ($(e.target).text() === "Sign out") {
+// util.notify("Signing you out...", {persist: true, loader: true});
+// couch.logout().then(function(response) {
+// util.notify("Signed out");
+// util.render('controls', 'project-controls', {text: "Sign in"});
+// })
+// }
+// });
+// },
+// signIn: function() {
+//
+// $('.dialog-content #username-input').focus();
+//
+// $('.dialog-content').find('#sign-in-form').submit(function(e) {
+// $('.dialog-content .okButton').click();
+// return false;
+// })
+//
+// $('.dialog-content .okButton').click(function(e) {
+// util.hide('dialog');
+// util.notify("Signing you in...", {persist: true, loader: true});
+// var form = $(e.target).parents('.dialog-content').find('#sign-in-form');
+// var credentials = {
+// username: form.find('#username-input').val(),
+// password: form.find('#password-input').val()
+// }
+// couch.login(credentials).then(function(response) {
+// util.notify("Signed in");
+// util.render('controls', 'project-controls', {text: "Sign out"});
+// }, function(error) {
+// if (error.statusText === "error") util.notify(JSON.parse(error.responseText).reason);
+// })
+// })
+//
+// },
+// bulkEdit: function() {
+// $('.dialog-content .okButton').click(function(e) {
+// var funcText = $('.expression-preview-code').val();
+// var editFunc = costco.evalFunction(funcText);
+// ;
+// if (editFunc.errorMessage) {
+// util.notify("Error with function! " + editFunc.errorMessage);
+// return;
+// }
+// util.hide('dialog');
+// costco.updateDocs(editFunc);
+// })
+//
+// var editor = $('.expression-preview-code');
+// editor.val("function(doc) {\n doc['"+ app.currentColumn+"'] = doc['"+ app.currentColumn+"'];\n return doc;\n}");
+// editor.focus().get(0).setSelectionRange(18, 18);
+// editor.keydown(function(e) {
+// // if you don't setTimeout it won't grab the latest character if you call e.target.value
+// window.setTimeout( function() {
+// var errors = $('.expression-preview-parsing-status');
+// var editFunc = costco.evalFunction(e.target.value);
+// if (!editFunc.errorMessage) {
+// errors.text('No syntax error.');
+// costco.previewTransform(app.cache, editFunc, app.currentColumn);
+// } else {
+// errors.text(editFunc.errorMessage);
+// }
+// }, 1, true);
+// });
+// editor.keydown();
+// },
+// transform: function() {
+// $('.dialog-content .okButton').click(function(e) {
+// util.notify("Not implemented yet, sorry! :D");
+// util.hide('dialog');
+// })
+//
+// var editor = $('.expression-preview-code');
+// editor.val("function(val) {\n if(_.isString(val)) this.update(\"pizza\")\n}");
+// editor.focus().get(0).setSelectionRange(62,62);
+// editor.keydown(function(e) {
+// // if you don't setTimeout it won't grab the latest character if you call e.target.value
+// window.setTimeout( function() {
+// var errors = $('.expression-preview-parsing-status');
+// var editFunc = costco.evalFunction(e.target.value);
+// if (!editFunc.errorMessage) {
+// errors.text('No syntax error.');
+// var traverseFunc = function(doc) {
+// util.traverse(doc).forEach(editFunc);
+// return doc;
+// }
+// costco.previewTransform(app.cache, traverseFunc);
+// } else {
+// errors.text(editFunc.errorMessage);
+// }
+// }, 1, true);
+// });
+// editor.keydown();
+// },
+// urlImport: function() {
+// $('.dialog-content .okButton').click(function(e) {
+// app.apiURL = $('#url-input').val().trim();
+// util.notify("Fetching data...", {persist: true, loader: true});
+// $.getJSON(app.apiURL + "?callback=?").then(
+// function(docs) {
+// app.apiDocs = docs;
+// util.notify("Data fetched successfully!");
+// recline.showDialog('jsonTree');
+// },
+// function (err) {
+// util.hide('dialog');
+// util.notify("Data fetch error: " + err.responseText);
+// }
+// );
+// })
+// },
+// uploadImport: function() {
+// $('.dialog-content .okButton').click(function(e) {
+// util.hide('dialog');
+// util.notify("Saving documents...", {persist: true, loader: true});
+// costco.uploadCSV();
+// })
+// },
+// jsonTree: function() {
+// util.renderTree(app.apiDocs);
+// $('.dialog-content .okButton').click(function(e) {
+// util.hide('dialog');
+// util.notify("Saving documents...", {persist: true, loader: true});
+// costco.uploadDocs(util.lookupPath(util.selectedTreePath())).then(function(msg) {
+// util.notify("Docs saved successfully!");
+// recline.initializeTable(app.offset);
+// });
+// })
+// },
+// pasteImport: function() {
+// $('.dialog-content .okButton').click(function(e) {
+// util.notify("Uploading documents...", {persist: true, loader: true});
+// try {
+// var docs = JSON.parse($('.data-table-cell-copypaste-editor').val());
+// } catch(e) {
+// util.notify("JSON parse error: " + e);
+// }
+// if (docs) {
+// if(_.isArray(docs)) {
+// costco.uploadDocs(docs).then(
+// function(docs) {
+// util.notify("Data uploaded successfully!");
+// recline.initializeTable(app.offset);
+// util.hide('dialog');
+// },
+// function (err) {
+// util.hide('dialog');
+// }
+// );
+// } else {
+// util.notify("Error: JSON must be an array of objects");
+// }
+// }
+// })
+// }
+// }
+//
+// app.sammy = $.sammy(function () {
+// this.get('', app.handler);
+// this.get("#/", app.handler);
+// this.get("#:route", app.handler);
+// this.get("#:route/:id", app.handler);
+// });
diff --git a/src/backbone-webstore.js b/src/backbone-webstore.js
new file mode 100644
index 00000000..14d02ae3
--- /dev/null
+++ b/src/backbone-webstore.js
@@ -0,0 +1,48 @@
+// replaces `Backbone.sync` with a OKFN webstore based tabular data source
+
+var WebStore = function(url) {
+ this.url = url;
+ this.headers = [];
+ this.totalRows = 0;
+ this.getTabularData = function() {
+ var dfd = $.Deferred();
+ var tabularData = {
+ headers: ['x', 'y', 'z']
+ , rows: [
+ {x: 1, y: 2, z: 3}
+ , {x: 2, y: 4, z: 6}
+ , {x: 3, y: 6, z: 9}
+ , {x: 4, y: 8, z: 12}
+ , {x: 5, y: 10, z: 15}
+ , {x: 6, y: 12, z: 18}
+ ]
+ , getLength: function() { return this.rows.length; }
+ , getRows: function(numRows, start) {
+ if (start === undefined) {
+ start = 0;
+ }
+ var dfd = $.Deferred();
+ var results = this.rows.slice(start, start + numRows);
+ dfd.resolve(results);
+ return dfd.promise();
+ }
+ }
+ dfd.resolve(tabularData);
+ return dfd.promise();
+ }
+};
+
+
+// Override `Backbone.sync` to delegate to the model or collection's
+// webStore property, which should be an instance of `WebStore`.
+Backbone.sync = function(method, model, options) {
+ var resp;
+ var store = model.webStore || model.collection.webStore;
+
+ if (method === "read") {
+ store.getTabularData().then(function(tabularData) {
+ tabularData.getRows(10).then(options.success, options.error)
+ })
+ }
+
+};
\ No newline at end of file
diff --git a/src/deps-min.js b/src/deps-min.js
index 61283b14..4d9e0aed 100644
--- a/src/deps-min.js
+++ b/src/deps-min.js
@@ -12,8 +12,3318 @@
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Thu May 12 15:04:36 2011 -0400
- */(function(a,b){function F(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(N,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:J.isNaN(d)?M.test(d)?J.parseJSON(d):d:parseFloat(d)}catch(f){}J.data(a,c,d)}else d=b}return d}function E(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function D(a,c,d){var e=c+"defer",f=c+"queue",g=c+"mark",h=J.data(a,e,b,!0);h&&(d==="queue"||!J.data(a,f,b,!0))&&(d==="mark"||!J.data(a,g,b,!0))&&setTimeout(function(){!J.data(a,f,b,!0)&&!J.data(a,g,b,!0)&&(J.removeData(a,e,!0),h.resolve())},0)}function C(){return!1}function B(){return!0}function A(a,c,d){var e=J.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,J.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function z(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o=[],p=[],q=J._data(this,"events");if(!(a.liveFired===this||!q||!q.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(m=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var r=q.live.slice(0);for(h=0;h
c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,n=e.handleObj.origHandler.apply(e.elem,arguments);if(n===!1||a.isPropagationStopped()){c=e.level,n===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(_,"`").replace(ba,"&")}function x(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function w(a,b,c){b=b||0;if(J.isFunction(b))return J.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return J.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=J.grep(a,function(a){return a.nodeType===1});if(bm.test(b))return J.filter(b,d,!c);b=J.filter(b,d)}return J.grep(a,function(a,d){return J.inArray(a,b)>=0===c})}function v(a,b){return J.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function u(a,b){if(b.nodeType===1&&!!J.hasData(a)){var c=J.expando,d=J.data(a),e=J.data(b,d);if(d=d[c]){var f=d.events;e=e[c]=J.extend({},d);if(f){delete e.handle,e.events={};for(var g in f)for(var h=0,i=f[g].length;h").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c===""){cp||(cp=G.createElement("iframe"),cp.frameBorder=cp.width=cp.height=0),G.body.appendChild(cp);if(!cq||!cp.createElement)cq=(cp.contentWindow||cp.contentDocument).document,cq.write("");b=cq.createElement(a),cq.body.appendChild(b),c=J.css(b,"display"),G.body.removeChild(cp)}co[a]=c}return co[a]}function c(a){return J.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}var G=a.document,H=a.navigator,I=a.location,J=function(){function c(){if(!d.isReady){try{G.documentElement.doScroll("left")}catch(a){setTimeout(c,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=H.userAgent,w,x,y,z=Object.prototype.toString,A=Object.prototype.hasOwnProperty,B=Array.prototype.push,C=Array.prototype.slice,D=String.prototype.trim,E=Array.prototype.indexOf,F={};d.fn=d.prototype={constructor:d,init:function(a,c,e){var f,g,i,j;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!c&&G.body){this.context=G,this[0]=G.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?f=h.exec(a):f=[null,a,null];if(f&&(f[1]||!c)){if(f[1]){c=c instanceof d?c[0]:c,j=c?c.ownerDocument||c:G,i=m.exec(a),i?d.isPlainObject(c)?(a=[G.createElement(i[1])],d.fn.attr.call(a,c,!0)):a=[j.createElement(i[1])]:(i=d.buildFragment([f[1]],[j]),a=(i.cacheable?d.clone(i.fragment):i.fragment).childNodes);return d.merge(this,a)}g=G.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return e.find(a);this.length=1,this[0]=g}this.context=G,this.selector=a;return this}return!c||c.jquery?(c||e).find(a):this.constructor(c).find(a)}if(d.isFunction(a))return e.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.6.1",length:0,size:function(){return this.length},toArray:function(){return C.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?B.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),x.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(C.apply(this,arguments),"slice",C.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:B,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;x.resolveWith(G,[d]),d.fn.trigger&&d(G).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=d._Deferred();if(G.readyState==="complete")return setTimeout(d.ready,1);if(G.addEventListener)G.addEventListener("DOMContentLoaded",y,!1),a.addEventListener("load",d.ready,!1);else if(G.attachEvent){G.attachEvent("onreadystatechange",y),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}G.documentElement.doScroll&&b&&c()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):F[z.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!A.call(a,"constructor")&&!A.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||A.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=d.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&i.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||d.isArray(a));if(k)for(;i1?L.call(arguments,0):b,--f||g.resolveWith(g,L.call(c,0))}}var c=arguments,d=0,e=c.length,f=e,g=e<=1&&a&&J.isFunction(a.promise)?a:J.Deferred();if(e>1){for(;da ",c=a.getElementsByTagName("*"),d=a.getElementsByTagName("a")[0];if(!c||!c.length||!d)return{};e=G.createElement("select"),f=e.appendChild(G.createElement("option")),g=a.getElementsByTagName("input")[0],i={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.55$/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:g.value==="on",optSelected:f.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},g.checked=!0,i.noCloneChecked=g.cloneNode(!0).checked,e.disabled=!0,i.optDisabled=!f.disabled;try{delete a.test}catch(r){i.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function s(){i.noCloneEvent=!1,a.detachEvent("onclick",s)}),a.cloneNode(!0).fireEvent("onclick")),g=G.createElement("input"),g.value="t",g.setAttribute("type","radio"),i.radioValue=g.value==="t",g.setAttribute("checked","checked"),a.appendChild(g),j=G.createDocumentFragment(),j.appendChild(a.firstChild),i.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",k=G.createElement("body"),l={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(p in l)k.style[p]=l[p];k.appendChild(a),b.insertBefore(k,b.firstChild),i.appendChecked=g.checked,i.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,i.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
",i.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="",m=a.getElementsByTagName("td"),q=m[0].offsetHeight===0,m[0].style.display="",m[1].style.display="none",i.reliableHiddenOffsets=q&&m[0].offsetHeight===0,a.innerHTML="",G.defaultView&&G.defaultView.getComputedStyle&&(h=G.createElement("div"),h.style.width="0",h.style.marginRight="0",a.appendChild(h),i.reliableMarginRight=(parseInt((G.defaultView.getComputedStyle(h,null)||{marginRight:0}).marginRight,10)||0)===0),k.innerHTML="",b.removeChild(k);if(a.attachEvent)for(p in{submit:1,change:1,focusin:1})o="on"+p,q=o in a,q||(a.setAttribute(o,"return;"),q=typeof a[o]=="function"),i[p+"Bubbles"]=q;return i}(),J.boxModel=J.support.boxModel;var M=/^(?:\{.*\}|\[.*\])$/,N=/([a-z])([A-Z])/g;J.extend({cache:{},uuid:0,expando:"jQuery"+(J.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?J.cache[a[J.expando]]:a[J.expando];return!!a&&!E(a)},data:function(a,c,d,e){if(!!J.acceptData(a)){var f=J.expando,g=typeof c=="string",h,i=a.nodeType,j=i?J.cache:a,k=i?a[J.expando]:a[J.expando]&&J.expando;if((!k||e&&k&&!j[k][f])&&g&&d===b)return;k||(i?a[J.expando]=k=++J.uuid:k=J.expando),j[k]||(j[k]={},i||(j[k].toJSON=J.noop));if(typeof c=="object"||typeof c=="function")e?j[k][f]=J.extend(j[k][f],c):j[k]=J.extend(j[k],c);h=j[k],e&&(h[f]||(h[f]={}),h=h[f]),d!==b&&(h[J.camelCase(c)]=d);return c==="events"&&!h[c]?h[f]&&h[f].events:g?h[J.camelCase(c)]:h}},removeData:function(b,c,d){if(!!J.acceptData(b)){var e=J.expando,f=b.nodeType,g=f?J.cache:b,h=f?b[J.expando]:J.expando;if(!g[h])return;if(c){var i=d?g[h][e]:g[h];if(i){delete i[c];if(!E(i))return}}if(d){delete g[h][e];if(!E(g[h]))return}var j=g[h][e];J.support.deleteExpando||g!=a?delete g[h]:g[h]=null,j?(g[h]={},f||(g[h].toJSON=J.noop),g[h][e]=j):f&&(J.support.deleteExpando?delete b[J.expando]:b.removeAttribute?b.removeAttribute(J.expando):b[J.expando]=null)}},_data:function(a,b,c){return J.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=J.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),J.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=J.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,f;for(var g=0,h=e.length;g-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=J.valHooks[e.nodeName.toLowerCase()]||J.valHooks[e.type];return c&&"get"in c&&(d=c.get(e,"value"))!==b?d:(e.value||"").replace(Q,"")}return b}var f=J.isFunction(a);return this.each(function(d){var e=J(this),g;if(this.nodeType===1){f?g=a.call(this,d,e.val()):g=a,g==null?g="":typeof g=="number"?g+="":J.isArray(g)&&(g=J.map(g,function(a){return a==null?"":a+""})),c=J.valHooks[this.nodeName.toLowerCase()]||J.valHooks[this.type];if(!c||!("set"in c)||c.set(this,g,"value")===b)this.value=g}})}}),J.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,f=a.type==="select-one";if(c<0)return null;for(var g=f?c:0,h=f?c+1:e.length;g=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var f=a.nodeType;if(!a||f===3||f===8||f===2)return b;if(e&&c in J.attrFn)return J(a)[c](d);if("getAttribute"in a){var g,h,i=f!==1||!J.isXMLDoc(a);c=i&&J.attrFix[c]||c,h=J.attrHooks[c],h||(!U.test(c)||typeof d!="boolean"&&d!==b&&d.toLowerCase()!==c.toLowerCase()?W&&(J.nodeName(a,"form")||V.test(c))&&(h=W):h=X);if(d!==b){if(d===null){J.removeAttr(a,c);return b}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i)return h.get(a,c);g=a.getAttribute(c);return g===null?b:g}return J.prop(a,c,d)},removeAttr:function(a,b){var c;a.nodeType===1&&(b=J.attrFix[b]||b,J.support.getSetAttribute?a.removeAttribute(b):(J.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),U.test(b)&&(c=J.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(R.test(a.nodeName)&&a.parentNode)J.error("type property can't be changed");else if(!J.support.radioValue&&b==="radio"&&J.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):S.test(a.nodeName)||T.test(a.nodeName)&&a.href?0:b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var f,g,h=e!==1||!J.isXMLDoc(a);c=h&&J.propFix[c]||c,g=J.propHooks[c];return d!==b?g&&"set"in g&&(f=g.set(a,d,c))!==b?f:a[c]=d:g&&"get"in g&&(f=g.get(a,c))!==b?f:a[c]},propHooks:{}}),X={get:function(a,c){return a[J.propFix[c]||c]?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?J.removeAttr(a,c):(d=J.propFix[c]||c,d in a&&(a[d]=b),a.setAttribute(c,c.toLowerCase()));return c}},J.attrHooks.value={get:function(a,b){return W&&J.nodeName(a,"button")?W.get(a,b):a.value},set:function(a,b,c){if(W&&J.nodeName(a,"button"))return W.set(a,b,c);a.value=b}},J.support.getSetAttribute||(J.attrFix=J.propFix,W=J.attrHooks.name=J.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},J.each(["width","height"],function(a,b){J.attrHooks[b]=J.extend(J.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),J.support.hrefNormalized||J.each(["href","src","width","height"],function(a,c){J.attrHooks[c]=J.extend(J.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),J.support.style||(J.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),J.support.optSelected||(J.propHooks.selected=J.extend(J.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),J.support.checkOn||J.each(["radio","checkbox"],function(){J.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),J.each(["radio","checkbox"],function(){J.valHooks[this]=J.extend(J.valHooks[this],{set:function(a,b){if(J.isArray(b))return a.checked=J.inArray(J(a).val(),b)>=0}})});var Y=Object.prototype.hasOwnProperty,Z=/\.(.*)$/,$=/^(?:textarea|input|select)$/i,_=/\./g,ba=/ /g,bb=/[^\w\s.|`]/g,bc=function(a){return a.replace(bb,"\\$&")};J.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=C;else if(!d)return;var f,g;d.handler&&(f=d,d=f.handler),d.guid||(d.guid=J.guid++);var h=J._data(a);if(!h)return;var i=h.events,j=h.handle;i||(h.events=i={}),j||(h.handle=j=function(a){return typeof J!="undefined"&&(!a||J.event.triggered!==a.type)?J.event.handle.apply(j.elem,arguments):b}),j.elem=a,c=c.split(" ");var k,l=0,m;while(k=c[l++]){g=f?J.extend({},f):{handler:d,data:e},k.indexOf(".")>-1?(m=k.split("."),k=m.shift(),g.namespace=m.slice(0).sort().join(".")):(m=[],g.namespace=""),g.type=k,g.guid||(g.guid=d.guid);var n=i[k],o=J.event.special[k]||{};if(!n){n=i[k]=[];if(!o.setup||o.setup.call(a,e,m,j)===!1)a.addEventListener?a.addEventListener(k,j,!1):a.attachEvent&&a.attachEvent("on"+k,j)}o.add&&(o.add.call(a,g),g.handler.guid||(g.handler.guid=d.guid)),n.push(g),J.event.global[k]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=C);var f,g,h,i,j=0,k,l,m,n,o,p,q,r=J.hasData(a)&&J._data(a),s=r&&r.events;if(!r||!s)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(g in s)J.event.remove(a,g+c);return}c=c.split(" ");while(g=c[j++]){q=g,p=null,k=g.indexOf(".")<0,l=[],k||(l=g.split("."),g=l.shift(),m=new RegExp("(^|\\.)"+J.map(l.slice(0).sort(),bc).join("\\.(?:.*\\.)?")+"(\\.|$)")),o=s[g];if(!o)continue;if(!d){for(i=0;i=0&&(g=g.slice(0,-1),i=!0),g.indexOf(".")>=0&&(h=g.split("."),g=h.shift(),h.sort());if(!!e&&!J.event.customEvent[g]||!!J.event.global[g]){c=typeof c=="object"?c[J.expando]?c:new J.Event(g,c):new J.Event(g),c.type=g,c.exclusive=i,c.namespace=h.join("."),c.namespace_re=new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.)?")+"(\\.|$)");if(f||!e)c.preventDefault(),c.stopPropagation();if(!e){J.each(J.cache,function(){var a=J.expando,b=this[a];b&&b.events&&b.events[g]&&J.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d?J.makeArray
-(d):[],d.unshift(c);var j=e,k=g.indexOf(":")<0?"on"+g:"";do{var l=J._data(j,"handle");c.currentTarget=j,l&&l.apply(j,d),k&&J.acceptData(j)&&j[k]&&j[k].apply(j,d)===!1&&(c.result=!1,c.preventDefault()),j=j.parentNode||j.ownerDocument||j===c.target.ownerDocument&&a}while(j&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var m,n=J.event.special[g]||{};if((!n._default||n._default.call(e.ownerDocument,c)===!1)&&(g!=="click"||!J.nodeName(e,"a"))&&J.acceptData(e)){try{k&&e[g]&&(m=e[k],m&&(e[k]=null),J.event.triggered=g,e[g]())}catch(o){}m&&(e[k]=m),J.event.triggered=b}}return c.result}},handle:function(c){c=J.event.fix(c||a.event);var d=((J._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,f=Array.prototype.slice.call(arguments,0);f[0]=c,c.currentTarget=this;for(var g=0,h=d.length;g-1?J.map(a.options,function(a){return a.selected}).join("-"):"":J.nodeName(a,"select")&&(c=a.selectedIndex);return c},bh=function(a){var c=a.target,d,e;if(!!$.test(c.nodeName)&&!c.readOnly){d=J._data(c,"_change_data"),e=bg(c),(a.type!=="focusout"||c.type!=="radio")&&J._data(c,"_change_data",e);if(d===b||e===d)return;if(d!=null||e)a.type="change",a.liveFired=b,J.event.trigger(a,arguments[1],c)}};J.event.special.change={filters:{focusout:bh,beforedeactivate:bh,click:function(a){var b=a.target,c=J.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||J.nodeName(b,"select"))&&bh.call(this,a)},keydown:function(a){var b=a.target,c=J.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!J.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&bh.call(this,a)},beforeactivate:function(a){var b=a.target;J._data(b,"_change_data",bg(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in bf)J.event.add(this,c+".specialChange",bf[c]);return $.test(this.nodeName)},teardown:function(a){J.event.remove(this,".specialChange");return $.test(this.nodeName)}},bf=J.event.special.change.filters,bf.focus=bf.beforeactivate}J.support.focusinBubbles||J.each({focus:"focusin",blur:"focusout"},function(a,b){function c(a){var c=J.event.fix(a);c.type=b,c.originalEvent={},J.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;J.event.special[b]={setup:function(){d++===0&&G.addEventListener(a,c,!0)},teardown:function(){--d===0&&G.removeEventListener(a,c,!0)}}}),J.each(["bind","one"],function(a,c){J.fn[c]=function(a,d,e){var f;if(typeof a=="object"){for(var g in a)this[c](g,d,a[g],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(f=function(a){J(this).unbind(a,f);return e.apply(this,arguments)},f.guid=e.guid||J.guid++):f=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var h=0,i=this.length;h0?this.bind(b,a,c):this.trigger(b)},J.attrFn&&(J.attrFn[b]=!0)}),function(){function c(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(a,b,c,e){c=c||[],b=b||G;var g=b;if(b.nodeType!==1&&b.nodeType!==9)return[];if(!a||typeof a!="string")return c;var h,i,j,n,o,q,r,s,u=!0,v=k.isXML(b),w=[],x=a;do{d.exec(""),h=d.exec(x);if(h){x=h[3],w.push(h[1]);if(h[2]){n=h[3];break}}}while(h);if(w.length>1&&m.exec(a))if(w.length===2&&l.relative[w[0]])i=t(w[0]+w[1],b);else{i=l.relative[w[0]]?[b]:k(w.shift(),b);while(w.length)a=w.shift(),l.relative[a]&&(a+=w.shift()),i=t(a,i)}else{!e&&w.length>1&&b.nodeType===9&&!v&&l.match.ID.test(w[0])&&!l.match.ID.test(w[w.length-1])&&(o=k.find(w.shift(),b,v),b=o.expr?k.filter(o.expr,o.set)[0]:o.set[0]);if(b){o=e?{expr:w.pop(),set:p(e)}:k.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&b.parentNode?b.parentNode:b,v),i=o.expr?k.filter(o.expr,o.set):o.set,w.length>0?j=p(i):u=!1;while(w.length)q=w.pop(),r=q,l.relative[q]?r=w.pop():q="",r==null&&(r=b),l.relative[q](j,r,v)}else j=w=[]}j||(j=i),j||k.error(q||a);if(f.call(j)==="[object Array]")if(!u)c.push.apply(c,j);else if(b&&b.nodeType===1)for(s=0;j[s]!=null;s++)j[s]&&(j[s]===!0||j[s].nodeType===1&&k.contains(b,j[s]))&&c.push(i[s]);else for(s=0;j[s]!=null;s++)j[s]&&j[s].nodeType===1&&c.push(i[s]);else p(j,c);n&&(k(n,g,c,e),k.uniqueSort(c));return c};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(a,b,c,e,f){if(a[1]==="not")if((d.exec(a[3])||"").length>1||/^\w/.test(a[3]))a[3]=k(a[3],null,null,b);else{var g=k.filter(a[3],b,c,!0^f);c||e.push.apply(e,g);return!1}else if(l.match.POS.test(a[0])||l.match.CHILD.test(a[0]))return!0;return a},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(G.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c ",d.insertBefore(a,d.firstChild),G.getElementById(c)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),d.removeChild(a),d=a=null}(),function(){var a=G.createElement("div");a.appendChild(G.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML=" ",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),G.querySelectorAll&&function(){var a=k,b=G.createElement("div"),c="__sizzle__";b.innerHTML="
";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,d,e,f){d=d||G;if(!f&&!k.isXML(d)){var g=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(g&&(d.nodeType===1||d.nodeType===9)){if(g[1])return p(d.getElementsByTagName(b),e);if(g[2]&&l.find.CLASS&&d.getElementsByClassName)return p(d.getElementsByClassName(g[2]),e)}if(d.nodeType===9){if(b==="body"&&d.body)return p([d.body],e);if(g&&g[3]){var h=d.getElementById(g[3]);if(!h||!h.parentNode)return p([],e);if(h.id===g[3])return p([h],e)}try{return p(d.querySelectorAll(b),e)}catch(i){}}else if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){var j=d,m=d.getAttribute("id"),n=m||c,o=d.parentNode,q=/^\s*[+~]/.test(b);m?n=n.replace(/'/g,"\\$&"):d.setAttribute("id",n),q&&o&&(d=d.parentNode);try{if(!q||o)return p(d.querySelectorAll("[id='"+n+"'] "+b),e)}catch(r){}finally{m||j.removeAttribute("id")}}}return a(b,d,e,f)};for(var d in a)k[d]=a[d];b=null}}(),function(){var a=G.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var c=!b.call(G.createElement("div"),"div"),d=!1;try{b.call(G.documentElement,"[test!='']:sizzle")}catch(e){d=!0}k.matchesSelector=function(a,e){e=e.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(d||!l.match.PSEUDO.test(e)&&!/!=/.test(e)){var f=b.call(a,e);if(f||!c||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(e,null,null,[a]).length>0}}}(),function(){var a=G.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),G.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:G.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var t=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(g=f;g0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,f=this[0];if(J.isArray(a)){var g,h,i={},j=1;if(f&&a.length){for(d=0,e=a.length;d-1:J(f).is(g))&&c.push({selector:h,elem:f,level:j});f=f.parentNode,j++}}return c}var k=bo.test(a)||typeof a!="string"?J(a,b||this.context):0;for(d=0,e=this.length;d-1:J.find.matchesSelector(f,a)){c.push(f);break}f=f.parentNode;if(!f||!f.ownerDocument||f===b||f.nodeType===11)break}}c=c.length>1?J.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){return!a||typeof a=="string"?J.inArray(this[0],a?J(a):this.parent().children()):J.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?J(a,b):J.makeArray(a&&a.nodeType?[a]:a),d=J.merge(this.get(),c);return this.pushStack(x(c[0])||x(d[0])?d:J.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),J.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return J.dir(a,"parentNode")},parentsUntil:function(a,b,c){return J.dir(a,"parentNode",c)},next:function(a){return J.nth(a,2,"nextSibling")},prev:function(a){return J.nth(a,2,"previousSibling")},nextAll:function(a){return J.dir(a,"nextSibling")},prevAll:function(a){return J.dir(a,"previousSibling")},nextUntil:function(a,b,c){return J.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return J.dir(a,"previousSibling",c)},siblings:function(a){return J.sibling(a.parentNode.firstChild,a)},children:function(a){return J.sibling(a.firstChild)},contents:function(a){return J.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:J.makeArray(a.childNodes)}},function(a,b){J.fn[a]=function(c,d){var e=J.map(this,b,c),f=bn.call(arguments);bj.test(a)||(d=c),d&&typeof d=="string"&&(e=J.filter(d,e)),e=this.length>1&&!bp[a]?J.unique(e):e,(this.length>1||bl.test(d))&&bk.test(a)&&(e=e.reverse());return this.pushStack(e,a,f.join(","))}}),J.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?J.find.matchesSelector(b[0],a)?[b[0]]:[]:J.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!J(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bq=/ jQuery\d+="(?:\d+|null)"/g,br=/^\s+/,bs=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,bt=/<([\w:]+)/,bu=/",""],legend:[1,""," "],thead:[1,""],tr:[2,""],td:[3,""],col:[2,""],area:[1,""," "],_default:[0,"",""]};bA.optgroup=bA.option,bA.tbody=bA.tfoot=bA.colgroup=bA.caption=bA.thead,bA.th=bA.td,J.support.htmlSerialize||(bA._default=[1,"div","
"]),J.fn.extend({text:function(a){return J.isFunction(a)?this.each(function(b){var c=J(this);c.text(a.call(this,b,c.text()))}):typeof a!="object"&&a!==b?this.empty().append((this[0]&&this[0].ownerDocument||G).createTextNode(a)):J.text(this)},wrapAll:function(a){if(J.isFunction(a))return this.each(function(b){J(this).wrapAll(a.call(this,b))});if(this[0]){var b=J(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return J.isFunction(a)?this.each(function(b){J(this).wrapInner(a.call(this,b))}):this.each(function(){var b=J(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){J(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){J.nodeName(this,"body")||J(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=J(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,J(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||J.filter(a,[d]).length)!b&&d.nodeType===1&&(J.cleanData(d.getElementsByTagName("*")),J.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&J.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return J.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(bq,""):null;if(typeof a=="string"&&!bw.test(a)&&(J.support.leadingWhitespace||!br.test(a))&&!bA[(bt.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(bs,"<$1>$2>");try{for(var c=0,d=this.length;c1&&k0?this.clone(!0):this).get();J(e[g])[b](i),d=d.concat(i)}return this.pushStack(d,a,e.selector)}}),J.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,f,g;if((!J.support.noCloneEvent||!J.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!J.isXMLDoc(a)){t(a,d),e=s(a),f=s(d);for(g=0;e[g];++g)t(e[g],f[g])}if(b){u(a,d);if(c){e=s(a),f=s(d);for(g=0;e[g];++g)u(e[g],f[g])}}return d},clean:function(a,b,c,d){var e;b=b||G,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||G);var f=[],g;for(var h=0,i;(i=a[h])!=null;h++){typeof i=="number"&&(i+="");if(!
-i)continue;if(typeof i=="string")if(!bv.test(i))i=b.createTextNode(i);else{i=i.replace(bs,"<$1>$2>");var j=(bt.exec(i)||["",""])[1].toLowerCase(),k=bA[j]||bA._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!J.support.tbody){var n=bu.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]===""&&!n?m.childNodes:[];for(g=o.length-1;g>=0;--g)J.nodeName(o[g],"tbody")&&!o[g].childNodes.length&&o[g].parentNode.removeChild(o[g])}!J.support.leadingWhitespace&&br.test(i)&&m.insertBefore(b.createTextNode(br.exec(i)[0]),m.firstChild),i=m.childNodes}var p;if(!J.support.appendChecked)if(i[0]&&typeof (p=i.length)=="number")for(g=0;g=0)return b+"px"}}}),J.support.opacity||(J.cssHooks.opacity={get:function(a,b){return bC.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=J.isNaN(b)?"":"alpha(opacity="+b*100+")",f=d&&d.filter||c.filter||"";c.filter=bB.test(f)?f.replace(bB,e):f+" "+e}}),J(function(){J.support.reliableMarginRight||(J.cssHooks.marginRight={get:function(a,b){var c;J.swap(a,{display:"inline-block"},function(){b?c=bM(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),G.defaultView&&G.defaultView.getComputedStyle&&(bN=function(a,c){var d,e,f;c=c.replace(bE,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(f=e.getComputedStyle(a,null))d=f.getPropertyValue(c),d===""&&!J.contains(a.ownerDocument.documentElement,a)&&(d=J.style(a,c));return d}),G.documentElement.currentStyle&&(bO=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bF.test(d)&&bG.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bM=bN||bO,J.expr&&J.expr.filters&&(J.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!J.support.reliableHiddenOffsets&&(a.style.display||J.css(a,"display"))==="none"},J.expr.filters.visible=function(a){return!J.expr.filters.hidden(a)});var bQ=/%20/g,bR=/\[\]$/,bS=/\r?\n/g,bT=/#.*$/,bU=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bV=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bW=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bX=/^(?:GET|HEAD)$/,bY=/^\/\//,bZ=/\?/,b$=/
-
diff --git a/vendor/jquery-1.6.1.min.js b/vendor/_jquery-1.6.1.min.js
similarity index 100%
rename from vendor/jquery-1.6.1.min.js
rename to vendor/_jquery-1.6.1.min.js
diff --git a/vendor/underscore.js b/vendor/_underscore-1.1.6.js
similarity index 100%
rename from vendor/underscore.js
rename to vendor/_underscore-1.1.6.js
diff --git a/vendor/backbone/0.5.1/backbone.js b/vendor/backbone-0.5.1.js
similarity index 100%
rename from vendor/backbone/0.5.1/backbone.js
rename to vendor/backbone-0.5.1.js