OSDN Git Service

first commit
author音浴博物館 <onyoku@enoch.(none)>
Mon, 14 Jan 2013 00:19:05 +0000 (09:19 +0900)
committer音浴博物館 <onyoku@enoch.(none)>
Mon, 14 Jan 2013 00:19:05 +0000 (09:19 +0900)
144 files changed:
app/.htaccess [new file with mode: 0644]
app/Config/Schema/db_acl.php [new file with mode: 0644]
app/Config/Schema/db_acl.sql [new file with mode: 0644]
app/Config/Schema/i18n.php [new file with mode: 0644]
app/Config/Schema/i18n.sql [new file with mode: 0644]
app/Config/Schema/sessions.php [new file with mode: 0644]
app/Config/Schema/sessions.sql [new file with mode: 0644]
app/Config/acl.ini.php [new file with mode: 0644]
app/Config/acl.php [new file with mode: 0644]
app/Config/bootstrap.php [new file with mode: 0644]
app/Config/const.php [new file with mode: 0644]
app/Config/core.php [new file with mode: 0644]
app/Config/database.php [new file with mode: 0644]
app/Config/email.php.default [new file with mode: 0644]
app/Config/m_const.php [new file with mode: 0644]
app/Config/routes.php [new file with mode: 0644]
app/Console/Command/AppShell.php [new file with mode: 0644]
app/Console/Command/Task/empty [new file with mode: 0644]
app/Console/Templates/empty [new file with mode: 0644]
app/Console/cake [new file with mode: 0755]
app/Console/cake.bat [new file with mode: 0644]
app/Console/cake.php [new file with mode: 0644]
app/Controller/.DbsController.php.swp [new file with mode: 0644]
app/Controller/AppController.php [new file with mode: 0644]
app/Controller/Component/.eXmasCakeComponent.php.swp [new file with mode: 0644]
app/Controller/Component/eXmasCakeComponent.php [new file with mode: 0644]
app/Controller/Component/empty [new file with mode: 0644]
app/Controller/DbTablesController.php [new file with mode: 0644]
app/Controller/DbsController.php [new file with mode: 0644]
app/Controller/PagesController.php [new file with mode: 0644]
app/Controller/ProjectsController.php [new file with mode: 0644]
app/Controller/SiteController.php [new file with mode: 0644]
app/Controller/TableFieldsController.php [new file with mode: 0644]
app/Lib/empty [new file with mode: 0644]
app/Locale/eng/LC_MESSAGES/empty [new file with mode: 0644]
app/Model/.TableField.php.swp [new file with mode: 0644]
app/Model/AppModel.php [new file with mode: 0644]
app/Model/Behavior/empty [new file with mode: 0644]
app/Model/Datasource/empty [new file with mode: 0644]
app/Model/Db.php [new file with mode: 0644]
app/Model/DbTable.php [new file with mode: 0644]
app/Model/Project.php [new file with mode: 0644]
app/Model/TableField.php [new file with mode: 0644]
app/Plugin/empty [new file with mode: 0644]
app/Test/Case/Controller/Component/empty [new file with mode: 0644]
app/Test/Case/Model/Behavior/empty [new file with mode: 0644]
app/Test/Case/View/Helper/empty [new file with mode: 0644]
app/Test/Fixture/empty [new file with mode: 0644]
app/Vendor/empty [new file with mode: 0644]
app/Vendor/xtcpdf.php [new file with mode: 0644]
app/View/DbTables/add.ctp [new file with mode: 0644]
app/View/DbTables/add_view.ctp [new file with mode: 0644]
app/View/DbTables/create_controller.ctp [new file with mode: 0644]
app/View/DbTables/edit.ctp [new file with mode: 0644]
app/View/DbTables/edit_view.ctp [new file with mode: 0644]
app/View/DbTables/index.ctp [new file with mode: 0644]
app/View/DbTables/index_view.ctp [new file with mode: 0644]
app/View/DbTables/model.ctp [new file with mode: 0644]
app/View/DbTables/related_add.ctp [new file with mode: 0644]
app/View/DbTables/related_edit.ctp [new file with mode: 0644]
app/View/DbTables/related_view.ctp [new file with mode: 0644]
app/View/DbTables/script.ctp [new file with mode: 0644]
app/View/DbTables/view.ctp [new file with mode: 0644]
app/View/DbTables/view_view.ctp [new file with mode: 0644]
app/View/Dbs/add.ctp [new file with mode: 0644]
app/View/Dbs/constant.ctp [new file with mode: 0644]
app/View/Dbs/edit.ctp [new file with mode: 0644]
app/View/Dbs/index.ctp [new file with mode: 0644]
app/View/Dbs/output.ctp [new file with mode: 0644]
app/View/Dbs/script.ctp [new file with mode: 0644]
app/View/Dbs/sql.ctp [new file with mode: 0644]
app/View/Dbs/test.ctp [new file with mode: 0644]
app/View/Dbs/view.ctp [new file with mode: 0644]
app/View/Elements/empty [new file with mode: 0644]
app/View/Emails/html/default.ctp [new file with mode: 0644]
app/View/Emails/text/default.ctp [new file with mode: 0644]
app/View/Errors/error400.ctp [new file with mode: 0644]
app/View/Errors/error500.ctp [new file with mode: 0644]
app/View/Helper/AppHelper.php [new file with mode: 0644]
app/View/Layouts/Emails/html/default.ctp [new file with mode: 0644]
app/View/Layouts/Emails/text/default.ctp [new file with mode: 0644]
app/View/Layouts/ajax.ctp [new file with mode: 0644]
app/View/Layouts/default.ctp [new file with mode: 0644]
app/View/Layouts/error.ctp [new file with mode: 0644]
app/View/Layouts/flash.ctp [new file with mode: 0644]
app/View/Layouts/js/default.ctp [new file with mode: 0644]
app/View/Layouts/pdf.ctp [new file with mode: 0644]
app/View/Layouts/rss/default.ctp [new file with mode: 0644]
app/View/Layouts/xml/default.ctp [new file with mode: 0644]
app/View/Pages/home.ctp [new file with mode: 0644]
app/View/Projects/add.ctp [new file with mode: 0644]
app/View/Projects/backup/index.ctp [new file with mode: 0644]
app/View/Projects/backup/view.ctp [new file with mode: 0644]
app/View/Projects/edit.ctp [new file with mode: 0644]
app/View/Projects/index.ctp [new file with mode: 0644]
app/View/Projects/view.ctp [new file with mode: 0644]
app/View/Scaffolds/empty [new file with mode: 0644]
app/View/Site/index.ctp [new file with mode: 0644]
app/View/TableFields/add.ctp [new file with mode: 0644]
app/View/TableFields/edit.ctp [new file with mode: 0644]
app/View/TableFields/index.ctp [new file with mode: 0644]
app/View/TableFields/related_add.ctp [new file with mode: 0644]
app/View/TableFields/related_edit.ctp [new file with mode: 0644]
app/View/TableFields/related_view.ctp [new file with mode: 0644]
app/View/TableFields/view.ctp [new file with mode: 0644]
app/index.php [new file with mode: 0644]
app/tmp/cache/models/empty [new file with mode: 0755]
app/tmp/cache/persistent/empty [new file with mode: 0755]
app/tmp/cache/views/empty [new file with mode: 0755]
app/tmp/logs/empty [new file with mode: 0755]
app/tmp/sessions/empty [new file with mode: 0755]
app/tmp/tests/empty [new file with mode: 0755]
app/webroot/.htaccess [new file with mode: 0644]
app/webroot/css/exmascake.css [new file with mode: 0644]
app/webroot/css/images/ui-bg_flat_0_aaaaaa_40x100.png [new file with mode: 0644]
app/webroot/css/images/ui-bg_flat_75_ffffff_40x100.png [new file with mode: 0644]
app/webroot/css/images/ui-bg_glass_55_fbf9ee_1x400.png [new file with mode: 0644]
app/webroot/css/images/ui-bg_glass_65_ffffff_1x400.png [new file with mode: 0644]
app/webroot/css/images/ui-bg_glass_75_dadada_1x400.png [new file with mode: 0644]
app/webroot/css/images/ui-bg_glass_75_e6e6e6_1x400.png [new file with mode: 0644]
app/webroot/css/images/ui-bg_glass_95_fef1ec_1x400.png [new file with mode: 0644]
app/webroot/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png [new file with mode: 0644]
app/webroot/css/images/ui-icons_222222_256x240.png [new file with mode: 0644]
app/webroot/css/images/ui-icons_2e83ff_256x240.png [new file with mode: 0644]
app/webroot/css/images/ui-icons_454545_256x240.png [new file with mode: 0644]
app/webroot/css/images/ui-icons_888888_256x240.png [new file with mode: 0644]
app/webroot/css/images/ui-icons_cd0a0a_256x240.png [new file with mode: 0644]
app/webroot/css/jquery-ui-1.9.2.custom.css [new file with mode: 0644]
app/webroot/css/jquery-ui-1.9.2.custom.min.css [new file with mode: 0644]
app/webroot/favicon.ico [new file with mode: 0644]
app/webroot/files/empty [new file with mode: 0644]
app/webroot/img/cake.icon.png [new file with mode: 0644]
app/webroot/img/cake.power.gif [new file with mode: 0644]
app/webroot/img/exmascake_logo.png [new file with mode: 0644]
app/webroot/img/test-error-icon.png [new file with mode: 0644]
app/webroot/img/test-fail-icon.png [new file with mode: 0644]
app/webroot/img/test-pass-icon.png [new file with mode: 0644]
app/webroot/img/test-skip-icon.png [new file with mode: 0644]
app/webroot/index.php [new file with mode: 0644]
app/webroot/js/empty [new file with mode: 0644]
app/webroot/js/jquery-1.8.3.js [new file with mode: 0644]
app/webroot/js/jquery-ui-1.9.2.custom.js [new file with mode: 0644]
app/webroot/js/jquery-ui-1.9.2.custom.min.js [new file with mode: 0644]
app/webroot/test.php [new file with mode: 0644]

diff --git a/app/.htaccess b/app/.htaccess
new file mode 100644 (file)
index 0000000..fc3aac4
--- /dev/null
@@ -0,0 +1,5 @@
+<IfModule mod_rewrite.c>
+    RewriteEngine on
+    RewriteRule    ^$    webroot/    [L]
+    RewriteRule    (.*) webroot/$1    [L]
+</IfModule>
\ No newline at end of file
diff --git a/app/Config/Schema/db_acl.php b/app/Config/Schema/db_acl.php
new file mode 100644 (file)
index 0000000..149ded0
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+/**
+ * This is Acl Schema file
+ *
+ * Use it to configure database for ACL
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       app.Config.Schema
+ * @since         CakePHP(tm) v 0.2.9
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+/*
+ *
+ * Using the Schema command line utility
+ * cake schema run create DbAcl
+ *
+ */
+class DbAclSchema extends CakeSchema {
+
+       public $name = 'DbAcl';
+
+       public function before($event = array()) {
+               return true;
+       }
+
+       public function after($event = array()) {
+       }
+
+       public $acos = array(
+               'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
+               'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+               'model' => array('type' => 'string', 'null' => true),
+               'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+               'alias' => array('type' => 'string', 'null' => true),
+               'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+               'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+               'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
+       );
+
+       public $aros = array(
+               'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
+               'parent_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+               'model' => array('type' => 'string', 'null' => true),
+               'foreign_key' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+               'alias' => array('type' => 'string', 'null' => true),
+               'lft' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+               'rght' => array('type' => 'integer', 'null' => true, 'default' => null, 'length' => 10),
+               'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
+       );
+
+       public $aros_acos = array(
+               'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
+               'aro_id' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
+               'aco_id' => array('type' => 'integer', 'null' => false, 'length' => 10),
+               '_create' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
+               '_read' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
+               '_update' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
+               '_delete' => array('type' => 'string', 'null' => false, 'default' => '0', 'length' => 2),
+               'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'ARO_ACO_KEY' => array('column' => array('aro_id', 'aco_id'), 'unique' => 1))
+       );
+
+}
diff --git a/app/Config/Schema/db_acl.sql b/app/Config/Schema/db_acl.sql
new file mode 100644 (file)
index 0000000..f50f392
--- /dev/null
@@ -0,0 +1,40 @@
+# $Id$
+#
+# Copyright 2005-2012, Cake Software Foundation, Inc.
+#
+# Licensed under The MIT License
+# Redistributions of files must retain the above copyright notice.
+# MIT License (http://www.opensource.org/licenses/mit-license.php)
+
+CREATE TABLE acos (
+  id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+  parent_id INTEGER(10) DEFAULT NULL,
+  model VARCHAR(255) DEFAULT '',
+  foreign_key INTEGER(10) UNSIGNED DEFAULT NULL,
+  alias VARCHAR(255) DEFAULT '',
+  lft INTEGER(10) DEFAULT NULL,
+  rght INTEGER(10) DEFAULT NULL,
+  PRIMARY KEY  (id)
+);
+
+CREATE TABLE aros_acos (
+  id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+  aro_id INTEGER(10) UNSIGNED NOT NULL,
+  aco_id INTEGER(10) UNSIGNED NOT NULL,
+  _create CHAR(2) NOT NULL DEFAULT 0,
+  _read CHAR(2) NOT NULL DEFAULT 0,
+  _update CHAR(2) NOT NULL DEFAULT 0,
+  _delete CHAR(2) NOT NULL DEFAULT 0,
+  PRIMARY KEY(id)
+);
+
+CREATE TABLE aros (
+  id INTEGER(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+  parent_id INTEGER(10) DEFAULT NULL,
+  model VARCHAR(255) DEFAULT '',
+  foreign_key INTEGER(10) UNSIGNED DEFAULT NULL,
+  alias VARCHAR(255) DEFAULT '',
+  lft INTEGER(10) DEFAULT NULL,
+  rght INTEGER(10) DEFAULT NULL,
+  PRIMARY KEY  (id)
+);
\ No newline at end of file
diff --git a/app/Config/Schema/i18n.php b/app/Config/Schema/i18n.php
new file mode 100644 (file)
index 0000000..8de0052
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+/**
+ * This is i18n Schema file
+ *
+ * Use it to configure database for i18n
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       app.Config.Schema
+ * @since         CakePHP(tm) v 0.2.9
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+/*
+ *
+ * Using the Schema command line utility
+ * cake schema run create i18n
+ *
+ */
+class i18nSchema extends CakeSchema {
+
+       public $name = 'i18n';
+
+       public function before($event = array()) {
+               return true;
+       }
+
+       public function after($event = array()) {
+       }
+
+       public $i18n = array(
+               'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'length' => 10, 'key' => 'primary'),
+               'locale' => array('type' => 'string', 'null' => false, 'length' => 6, 'key' => 'index'),
+               'model' => array('type' => 'string', 'null' => false, 'key' => 'index'),
+               'foreign_key' => array('type' => 'integer', 'null' => false, 'length' => 10, 'key' => 'index'),
+               'field' => array('type' => 'string', 'null' => false, 'key' => 'index'),
+               'content' => array('type' => 'text', 'null' => true, 'default' => null),
+               'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1), 'locale' => array('column' => 'locale', 'unique' => 0), 'model' => array('column' => 'model', 'unique' => 0), 'row_id' => array('column' => 'foreign_key', 'unique' => 0), 'field' => array('column' => 'field', 'unique' => 0))
+       );
+
+}
diff --git a/app/Config/Schema/i18n.sql b/app/Config/Schema/i18n.sql
new file mode 100644 (file)
index 0000000..239e146
--- /dev/null
@@ -0,0 +1,26 @@
+# $Id$
+#
+# Copyright 2005-2012, Cake Software Foundation, Inc.
+#
+# Licensed under The MIT License
+# Redistributions of files must retain the above copyright notice.
+# MIT License (http://www.opensource.org/licenses/mit-license.php)
+
+CREATE TABLE i18n (
+       id int(10) NOT NULL auto_increment,
+       locale varchar(6) NOT NULL,
+       model varchar(255) NOT NULL,
+       foreign_key int(10) NOT NULL,
+       field varchar(255) NOT NULL,
+       content mediumtext,
+       PRIMARY KEY     (id),
+#      UNIQUE INDEX I18N_LOCALE_FIELD(locale, model, foreign_key, field),
+#      INDEX I18N_LOCALE_ROW(locale, model, foreign_key),
+#      INDEX I18N_LOCALE_MODEL(locale, model),
+#      INDEX I18N_FIELD(model, foreign_key, field),
+#      INDEX I18N_ROW(model, foreign_key),
+       INDEX locale (locale),
+       INDEX model (model),
+       INDEX row_id (foreign_key),
+       INDEX field (field)
+);
\ No newline at end of file
diff --git a/app/Config/Schema/sessions.php b/app/Config/Schema/sessions.php
new file mode 100644 (file)
index 0000000..e98ca06
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+/**
+ * This is Sessions Schema file
+ *
+ * Use it to configure database for Sessions
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       app.Config.Schema
+ * @since         CakePHP(tm) v 0.2.9
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+/*
+ *
+ * Using the Schema command line utility
+ * cake schema run create Sessions
+ *
+ */
+class SessionsSchema extends CakeSchema {
+
+       public $name = 'Sessions';
+
+       public function before($event = array()) {
+               return true;
+       }
+
+       public function after($event = array()) {
+       }
+
+       public $cake_sessions = array(
+               'id' => array('type' => 'string', 'null' => false, 'key' => 'primary'),
+               'data' => array('type' => 'text', 'null' => true, 'default' => null),
+               'expires' => array('type' => 'integer', 'null' => true, 'default' => null),
+               'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1))
+       );
+
+}
diff --git a/app/Config/Schema/sessions.sql b/app/Config/Schema/sessions.sql
new file mode 100644 (file)
index 0000000..b8951b6
--- /dev/null
@@ -0,0 +1,16 @@
+# $Id$
+#
+# Copyright 2005-2012, Cake Software Foundation, Inc.
+#                                                              1785 E. Sahara Avenue, Suite 490-204
+#                                                              Las Vegas, Nevada 89104
+#
+# Licensed under The MIT License
+# Redistributions of files must retain the above copyright notice.
+# MIT License (http://www.opensource.org/licenses/mit-license.php)
+
+CREATE TABLE cake_sessions (
+  id varchar(255) NOT NULL default '',
+  data text,
+  expires int(11) default NULL,
+  PRIMARY KEY  (id)
+);
\ No newline at end of file
diff --git a/app/Config/acl.ini.php b/app/Config/acl.ini.php
new file mode 100644 (file)
index 0000000..11ce65b
--- /dev/null
@@ -0,0 +1,68 @@
+;<?php exit() ?>
+;/**
+; * ACL Configuration
+; *
+; *
+; * PHP 5
+; *
+; * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+; * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+; *
+; *  Licensed under The MIT License
+; *  Redistributions of files must retain the above copyright notice.
+; *
+; * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+; * @link          http://cakephp.org CakePHP(tm) Project
+; * @package       app.Config
+; * @since         CakePHP(tm) v 0.10.0.1076
+; * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+; */
+
+; acl.ini.php - Cake ACL Configuration
+; ---------------------------------------------------------------------
+; Use this file to specify user permissions.
+; aco = access control object (something in your application)
+; aro = access request object (something requesting access)
+;
+; User records are added as follows:
+;
+; [uid]
+; groups = group1, group2, group3
+; allow = aco1, aco2, aco3
+; deny = aco4, aco5, aco6
+;
+; Group records are added in a similar manner:
+;
+; [gid]
+; allow = aco1, aco2, aco3
+; deny = aco4, aco5, aco6
+;
+; The allow, deny, and groups sections are all optional.
+; NOTE: groups names *cannot* ever be the same as usernames!
+;
+; ACL permissions are checked in the following order:
+; 1. Check for user denies (and DENY if specified)
+; 2. Check for user allows (and ALLOW if specified)
+; 3. Gather user's groups
+; 4. Check group denies (and DENY if specified)
+; 5. Check group allows (and ALLOW if specified)
+; 6. If no aro, aco, or group information is found, DENY
+;
+; ---------------------------------------------------------------------
+
+;-------------------------------------
+;Users
+;-------------------------------------
+
+[username-goes-here]
+groups = group1, group2
+deny = aco1, aco2
+allow = aco3, aco4
+
+;-------------------------------------
+;Groups
+;-------------------------------------
+
+[groupname-goes-here]
+deny = aco5, aco6
+allow = aco7, aco8
diff --git a/app/Config/acl.php b/app/Config/acl.php
new file mode 100644 (file)
index 0000000..21f8dda
--- /dev/null
@@ -0,0 +1,134 @@
+<?php
+/**
+ * This is the PHP base ACL configuration file.
+ *
+ * Use it to configure access control of your Cake application.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       app.Config
+ * @since         CakePHP(tm) v 2.1
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+/**
+ * Example
+ * -------
+ * 
+ * Assumptions:
+ *
+ * 1. In your application you created a User model with the following properties: 
+ *    username, group_id, password, email, firstname, lastname and so on.
+ * 2. You configured AuthComponent to authorize actions via 
+ *    $this->Auth->authorize = array('Actions' => array('actionPath' => 'controllers/'),...) 
+ * 
+ * Now, when a user (i.e. jeff) authenticates successfully and requests a controller action (i.e. /invoices/delete)
+ * that is not allowed by default (e.g. via $this->Auth->allow('edit') in the Invoices controller) then AuthComponent 
+ * will ask the configured ACL interface if access is granted. Under the assumptions 1. and 2. this will be 
+ * done via a call to Acl->check() with 
+ *
+ *    array('User' => array('username' => 'jeff', 'group_id' => 4, ...))
+ *
+ * as ARO and
+ *
+ *    '/controllers/invoices/delete'
+ *
+ * as ACO.
+ * 
+ * If the configured map looks like
+ *
+ *    $config['map'] = array(
+ *       'User' => 'User/username',
+ *       'Role' => 'User/group_id',
+ *    );
+ *
+ * then PhpAcl will lookup if we defined a role like User/jeff. If that role is not found, PhpAcl will try to 
+ * find a definition for Role/4. If the definition isn't found then a default role (Role/default) will be used to 
+ * check rules for the given ACO. The search can be expanded by defining aliases in the alias configuration.
+ * E.g. if you want to use a more readable name than Role/4 in your definitions you can define an alias like
+ *
+ *    $config['alias'] = array(
+ *       'Role/4' => 'Role/editor',
+ *    );
+ * 
+ * In the roles configuration you can define roles on the lhs and inherited roles on the rhs:
+ * 
+ *    $config['roles'] = array(
+ *       'Role/admin' => null,
+ *       'Role/accountant' => null,
+ *       'Role/editor' => null,
+ *       'Role/manager' => 'Role/editor, Role/accountant',
+ *       'User/jeff' => 'Role/manager',
+ *    );
+ * 
+ * In this example manager inherits all rules from editor and accountant. Role/admin doesn't inherit from any role.
+ * Lets define some rules:
+ *
+ *    $config['rules'] = array(
+ *       'allow' => array(
+ *             '*' => 'Role/admin',
+ *             'controllers/users/(dashboard|profile)' => 'Role/default',
+ *             'controllers/invoices/*' => 'Role/accountant',
+ *             'controllers/articles/*' => 'Role/editor',
+ *             'controllers/users/*'  => 'Role/manager',
+ *             'controllers/invoices/delete'  => 'Role/manager',
+ *       ),
+ *       'deny' => array(
+ *             'controllers/invoices/delete' => 'Role/accountant, User/jeff',
+ *             'controllers/articles/(delete|publish)' => 'Role/editor',
+ *       ),
+ *    );
+ *
+ * Ok, so as jeff inherits from Role/manager he's matched every rule that references User/jeff, Role/manager, 
+ * Role/editor, Role/accountant and Role/default. However, for jeff, rules for User/jeff are more specific than 
+ * rules for Role/manager, rules for Role/manager are more specific than rules for Role/editor and so on.
+ * This is important when allow and deny rules match for a role. E.g. Role/accountant is allowed 
+ * controllers/invoices/* but at the same time controllers/invoices/delete is denied. But there is a more
+ * specific rule defined for Role/manager which is allowed controllers/invoices/delete. However, the most specific
+ * rule denies access to the delete action explicitly for User/jeff, so he'll be denied access to the resource.
+ *
+ * If we would remove the role definition for User/jeff, then jeff would be granted access as he would be resolved
+ * to Role/manager and Role/manager has an allow rule.
+ */
+
+/**
+ * The role map defines how to resolve the user record from your application
+ * to the roles you defined in the roles configuration. 
+ */
+$config['map'] = array(
+       'User' => 'User/username',
+       'Role' => 'User/group_id',
+);
+
+/**
+ * define aliases to map your model information to
+ * the roles defined in your role configuration.
+ */
+$config['alias'] = array(
+       'Role/4' => 'Role/editor',
+);
+
+/**
+ * role configuration
+ */
+$config['roles'] = array(
+       'Role/admin' => null,
+);
+
+/**
+ * rule configuration
+ */
+$config['rules'] = array(
+       'allow' => array(
+               '*' => 'Role/admin',
+       ),
+       'deny' => array(),
+);
diff --git a/app/Config/bootstrap.php b/app/Config/bootstrap.php
new file mode 100644 (file)
index 0000000..aebf445
--- /dev/null
@@ -0,0 +1,184 @@
+<?php
+/**
+ * This file is loaded automatically by the app/webroot/index.php file after core.php
+ *
+ * This file should load/create any application wide configuration settings, such as 
+ * Caching, Logging, loading additional configuration files.
+ *
+ * You should also use this file to include any files that provide global functions/constants
+ * that your application uses.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       app.Config
+ * @since         CakePHP(tm) v 0.10.8.2117
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+/**
+ * Cache Engine Configuration
+ * Default settings provided below
+ *
+ * File storage engine.
+ *
+ *      Cache::config('default', array(
+ *             'engine' => 'File', //[required]
+ *             'duration'=> 3600, //[optional]
+ *             'probability'=> 100, //[optional]
+ *             'path' => CACHE, //[optional] use system tmp directory - remember to use absolute path
+ *             'prefix' => 'cake_', //[optional]  prefix every cache file with this string
+ *             'lock' => false, //[optional]  use file locking
+ *             'serialize' => true, // [optional]
+ *             'mask' => 0666, // [optional] permission mask to use when creating cache files
+ *     ));
+ *
+ * APC (http://pecl.php.net/package/APC)
+ *
+ *      Cache::config('default', array(
+ *             'engine' => 'Apc', //[required]
+ *             'duration'=> 3600, //[optional]
+ *             'probability'=> 100, //[optional]
+ *             'prefix' => Inflector::slug(APP_DIR) . '_', //[optional]  prefix every cache file with this string
+ *     ));
+ *
+ * Xcache (http://xcache.lighttpd.net/)
+ *
+ *      Cache::config('default', array(
+ *             'engine' => 'Xcache', //[required]
+ *             'duration'=> 3600, //[optional]
+ *             'probability'=> 100, //[optional]
+ *             'prefix' => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string
+ *             'user' => 'user', //user from xcache.admin.user settings
+ *             'password' => 'password', //plaintext password (xcache.admin.pass)
+ *     ));
+ *
+ * Memcache (http://memcached.org/)
+ *
+ *      Cache::config('default', array(
+ *             'engine' => 'Memcache', //[required]
+ *             'duration'=> 3600, //[optional]
+ *             'probability'=> 100, //[optional]
+ *             'prefix' => Inflector::slug(APP_DIR) . '_', //[optional]  prefix every cache file with this string
+ *             'servers' => array(
+ *                     '127.0.0.1:11211' // localhost, default port 11211
+ *             ), //[optional]
+ *             'persistent' => true, // [optional] set this to false for non-persistent connections
+ *             'compress' => false, // [optional] compress data in Memcache (slower, but uses less memory)
+ *     ));
+ *
+ *  Wincache (http://php.net/wincache)
+ *
+ *      Cache::config('default', array(
+ *             'engine' => 'Wincache', //[required]
+ *             'duration'=> 3600, //[optional]
+ *             'probability'=> 100, //[optional]
+ *             'prefix' => Inflector::slug(APP_DIR) . '_', //[optional]  prefix every cache file with this string
+ *     ));
+ *
+ * Redis (http://http://redis.io/)
+ *
+ *      Cache::config('default', array(
+ *             'engine' => 'Redis', //[required]
+ *             'duration'=> 3600, //[optional]
+ *             'probability'=> 100, //[optional]
+ *             'prefix' => Inflector::slug(APP_DIR) . '_', //[optional]  prefix every cache file with this string
+ *             'server' => '127.0.0.1' // localhost
+ *             'port' => 6379 // default port 6379
+ *             'timeout' => 0 // timeout in seconds, 0 = unlimited
+ *             'persistent' => true, // [optional] set this to false for non-persistent connections
+ *     ));
+ */
+Cache::config('default', array('engine' => 'File'));
+
+/**
+ * The settings below can be used to set additional paths to models, views and controllers.
+ *
+ * App::build(array(
+ *     'Model'                     => array('/path/to/models', '/next/path/to/models'),
+ *     'Model/Behavior'            => array('/path/to/behaviors', '/next/path/to/behaviors'),
+ *     'Model/Datasource'          => array('/path/to/datasources', '/next/path/to/datasources'),
+ *     'Model/Datasource/Database' => array('/path/to/databases', '/next/path/to/database'),
+ *     'Model/Datasource/Session'  => array('/path/to/sessions', '/next/path/to/sessions'),
+ *     'Controller'                => array('/path/to/controllers', '/next/path/to/controllers'),
+ *     'Controller/Component'      => array('/path/to/components', '/next/path/to/components'),
+ *     'Controller/Component/Auth' => array('/path/to/auths', '/next/path/to/auths'),
+ *     'Controller/Component/Acl'  => array('/path/to/acls', '/next/path/to/acls'),
+ *     'View'                      => array('/path/to/views', '/next/path/to/views'),
+ *     'View/Helper'               => array('/path/to/helpers', '/next/path/to/helpers'),
+ *     'Console'                   => array('/path/to/consoles', '/next/path/to/consoles'),
+ *     'Console/Command'           => array('/path/to/commands', '/next/path/to/commands'),
+ *     'Console/Command/Task'      => array('/path/to/tasks', '/next/path/to/tasks'),
+ *     'Lib'                       => array('/path/to/libs', '/next/path/to/libs'),
+ *     'Locale'                    => array('/path/to/locales', '/next/path/to/locales'),
+ *     'Vendor'                    => array('/path/to/vendors', '/next/path/to/vendors'),
+ *     'Plugin'                    => array('/path/to/plugins', '/next/path/to/plugins'),
+ * ));
+ *
+ */
+
+/**
+ * Custom Inflector rules, can be set to correctly pluralize or singularize table, model, controller names or whatever other
+ * string is passed to the inflection functions
+ *
+ * Inflector::rules('singular', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
+ * Inflector::rules('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array()));
+ *
+ */
+
+/**
+ * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
+ * Uncomment one of the lines below, as you need. make sure you read the documentation on CakePlugin to use more
+ * advanced ways of loading plugins
+ *
+ * CakePlugin::loadAll(); // Loads all plugins at once
+ * CakePlugin::load('DebugKit'); //Loads a single plugin named DebugKit
+ *
+ */
+
+
+/**
+ * You can attach event listeners to the request lifecyle as Dispatcher Filter . By Default CakePHP bundles two filters:
+ *
+ * - AssetDispatcher filter will serve your asset files (css, images, js, etc) from your themes and plugins
+ * - CacheDispatcher filter will read the Cache.check configure variable and try to serve cached content generated from controllers
+ *
+ * Feel free to remove or add filters as you see fit for your application. A few examples:
+ *
+ * Configure::write('Dispatcher.filters', array(
+ *             'MyCacheFilter', //  will use MyCacheFilter class from the Routing/Filter package in your app.
+ *             'MyPlugin.MyFilter', // will use MyFilter class from the Routing/Filter package in MyPlugin plugin.
+ *             array('callable' => $aFunction, 'on' => 'before', 'priority' => 9), // A valid PHP callback type to be called on beforeDispatch
+ *             array('callable' => $anotherMethod, 'on' => 'after'), // A valid PHP callback type to be called on afterDispatch
+ *
+ * ));
+ */
+Configure::write('Dispatcher.filters', array(
+       'AssetDispatcher',
+       'CacheDispatcher'
+));
+
+/**
+ * Configures default file logging options
+ */
+App::uses('CakeLog', 'Log');
+CakeLog::config('debug', array(
+       'engine' => 'FileLog',
+       'types' => array('notice', 'info', 'debug'),
+       'file' => 'debug',
+));
+CakeLog::config('error', array(
+       'engine' => 'FileLog',
+       'types' => array('warning', 'error', 'critical', 'alert', 'emergency'),
+       'file' => 'error',
+));
+
+config('const');
+
diff --git a/app/Config/const.php b/app/Config/const.php
new file mode 100644 (file)
index 0000000..e49ee9b
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+
+const APP_TITLE = "プロジェクト管理";
+
+const PROJECT = "プロジェクト";
+
+const DB = "データベース";
+const DB_NAME = 'データベース名';
+const DB_HOST = 'ホスト名';
+const DB_PORT = 'ポート番号';
+const DB_USER = 'ユーザ名';
+const DB_PASSWORD = 'パスワード';
+const DB_TABLE = "テーブル";
+const SYMBOL = '記号';
+
+const TABLE_FIELD = "フィールド";
+const FIELD_TYPE = 'フィールド型';
+const FIELD_OPTION = 'オプション';
+const DEFAULT_VALUE = 'デフォルト値';
+const LINE_NO = '項目番号';
+const FOREIGN_TABLE = '参照先テーブル';
+const FOREIGN_FIELD = '参照フィールド';
+
+const TOP = 'トップページ';
+const SCRIPT = 'スクリプト';
+const CONSTANT = '定数';
+const OUTPUT = '出力';
+const SQL = 'SQL';
+const MODEL = 'モデル';
+const CONTROLLER = 'コントローラー';
+const VIEW_INDEX = 'index表示';
+const VIEW_ADD = 'add表示';
+const VIEW_EDIT = 'edit表示';
+const VIEW_VIEW = 'view表示';
+
+const ADD = '登録';
+const EDIT = '編集';
+const DEL = '削除';
+const VIEW = '詳細';
+const LOOKUP = '一覧';
+const MENU = 'メニュー';
+const ACTION = '操作';
+
+const SUBMIT = '登録';
+const PREV = '前へ';
+const NEXT = '次へ';
+const PAGE_NAVI = 'ページ {:page}/{:pages}  (全 {:count} 件)';
+
+const CONFIRM = '%sを%sしますか';
+const SAVE_OK = '保存しました';
+const SAVE_NG = '保存できませんでした';
+const DEL_OK = '削除しました';
+const DEL_NG = '削除できませんでした';
+const INVALID_ID = 'データに誤りがあります';
+const NOTEXISTS = 'データが見つかりませんでした';
+const UNIQUE_NG = '同一名称のデータは登録できません';
+
+const COPIPE_MESSAGE = '上記をそのままコピーして%sに貼り付けてください';
+
+
+// 汎用
+const ID = '登録番号';
+const NAME = '名称';
+const ACTIVE = '有効';
+const INACTIVE = '無効';
+const CREATED = '作成日';
+const MODIFIED = '更新日';
+const DESCRIPTION = 'メモ';
+const LOGIN = 'ログイン';
+const LOGOUT = 'ログアウト';
+const STATUS = '状態';
+const GO_BACK = '戻る';
+const RELATED_DATA = '連携データ';
+const SP1 = '    ';
+const SP2 = '        ';
+const SP3 = '            ';
+const SP4 = '                ';
+
diff --git a/app/Config/core.php b/app/Config/core.php
new file mode 100644 (file)
index 0000000..bd5688f
--- /dev/null
@@ -0,0 +1,278 @@
+<?php
+/**
+ * This is core configuration file.
+ *
+ * Use it to configure core behavior of Cake.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       app.Config
+ * @since         CakePHP(tm) v 0.2.9
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+/**
+ * CakePHP Debug Level:
+ *
+ * Production Mode:
+ *     0: No error messages, errors, or warnings shown. Flash messages redirect.
+ *
+ * Development Mode:
+ *     1: Errors and warnings shown, model caches refreshed, flash messages halted.
+ *     2: As in 1, but also with full debug messages and SQL output.
+ *
+ * In production mode, flash messages redirect after a time interval.
+ * In development mode, you need to click the flash message to continue.
+ */
+       Configure::write('debug', 2);
+
+/**
+ * Configure the Error handler used to handle errors for your application.  By default
+ * ErrorHandler::handleError() is used.  It will display errors using Debugger, when debug > 0
+ * and log errors with CakeLog when debug = 0.
+ *
+ * Options:
+ *
+ * - `handler` - callback - The callback to handle errors. You can set this to any callable type,
+ *    including anonymous functions.
+ * - `level` - int - The level of errors you are interested in capturing.
+ * - `trace` - boolean - Include stack traces for errors in log files.
+ *
+ * @see ErrorHandler for more information on error handling and configuration.
+ */
+       Configure::write('Error', array(
+               'handler' => 'ErrorHandler::handleError',
+               'level' => E_ALL & ~E_DEPRECATED,
+               'trace' => true
+       ));
+
+/**
+ * Configure the Exception handler used for uncaught exceptions.  By default,
+ * ErrorHandler::handleException() is used. It will display a HTML page for the exception, and
+ * while debug > 0, framework errors like Missing Controller will be displayed.  When debug = 0,
+ * framework errors will be coerced into generic HTTP errors.
+ *
+ * Options:
+ *
+ * - `handler` - callback - The callback to handle exceptions. You can set this to any callback type,
+ *   including anonymous functions.
+ * - `renderer` - string - The class responsible for rendering uncaught exceptions.  If you choose a custom class you
+ *   should place the file for that class in app/Lib/Error. This class needs to implement a render method.
+ * - `log` - boolean - Should Exceptions be logged?
+ *
+ * @see ErrorHandler for more information on exception handling and configuration.
+ */
+       Configure::write('Exception', array(
+               'handler' => 'ErrorHandler::handleException',
+               'renderer' => 'ExceptionRenderer',
+               'log' => true
+       ));
+
+/**
+ * Application wide charset encoding
+ */
+       Configure::write('App.encoding', 'UTF-8');
+
+/**
+ * To configure CakePHP *not* to use mod_rewrite and to
+ * use CakePHP pretty URLs, remove these .htaccess
+ * files:
+ *
+ * /.htaccess
+ * /app/.htaccess
+ * /app/webroot/.htaccess
+ *
+ * And uncomment the App.baseUrl below:
+ */
+       //Configure::write('App.baseUrl', env('SCRIPT_NAME'));
+
+/**
+ * Uncomment the define below to use CakePHP prefix routes.
+ *
+ * The value of the define determines the names of the routes
+ * and their associated controller actions:
+ *
+ * Set to an array of prefixes you want to use in your application. Use for
+ * admin or other prefixed routes.
+ *
+ *     Routing.prefixes = array('admin', 'manager');
+ *
+ * Enables:
+ *     `admin_index()` and `/admin/controller/index`
+ *     `manager_index()` and `/manager/controller/index`
+ *
+ */
+       //Configure::write('Routing.prefixes', array('admin'));
+
+/**
+ * Turn off all caching application-wide.
+ *
+ */
+       //Configure::write('Cache.disable', true);
+
+/**
+ * Enable cache checking.
+ *
+ * If set to true, for view caching you must still use the controller
+ * public $cacheAction inside your controllers to define caching settings.
+ * You can either set it controller-wide by setting public $cacheAction = true,
+ * or in each action using $this->cacheAction = true.
+ *
+ */
+       //Configure::write('Cache.check', true);
+
+/**
+ * Defines the default error type when using the log() function. Used for
+ * differentiating error logging and debugging. Currently PHP supports LOG_DEBUG.
+ */
+       define('LOG_ERROR', LOG_ERR);
+
+/**
+ * Session configuration.
+ *
+ * Contains an array of settings to use for session configuration. The defaults key is
+ * used to define a default preset to use for sessions, any settings declared here will override
+ * the settings of the default config.
+ *
+ * ## Options
+ *
+ * - `Session.cookie` - The name of the cookie to use. Defaults to 'CAKEPHP'
+ * - `Session.timeout` - The number of minutes you want sessions to live for. This timeout is handled by CakePHP
+ * - `Session.cookieTimeout` - The number of minutes you want session cookies to live for.
+ * - `Session.checkAgent` - Do you want the user agent to be checked when starting sessions? You might want to set the
+ *    value to false, when dealing with older versions of IE, Chrome Frame or certain web-browsing devices and AJAX
+ * - `Session.defaults` - The default configuration set to use as a basis for your session.
+ *    There are four builtins: php, cake, cache, database.
+ * - `Session.handler` - Can be used to enable a custom session handler.  Expects an array of of callables,
+ *    that can be used with `session_save_handler`.  Using this option will automatically add `session.save_handler`
+ *    to the ini array.
+ * - `Session.autoRegenerate` - Enabling this setting, turns on automatic renewal of sessions, and
+ *    sessionids that change frequently. See CakeSession::$requestCountdown.
+ * - `Session.ini` - An associative array of additional ini values to set.
+ *
+ * The built in defaults are:
+ *
+ * - 'php' - Uses settings defined in your php.ini.
+ * - 'cake' - Saves session files in CakePHP's /tmp directory.
+ * - 'database' - Uses CakePHP's database sessions.
+ * - 'cache' - Use the Cache class to save sessions.
+ *
+ * To define a custom session handler, save it at /app/Model/Datasource/Session/<name>.php.
+ * Make sure the class implements `CakeSessionHandlerInterface` and set Session.handler to <name>
+ *
+ * To use database sessions, run the app/Config/Schema/sessions.php schema using
+ * the cake shell command: cake schema create Sessions
+ *
+ */
+       Configure::write('Session', array(
+               'defaults' => 'php'
+       ));
+
+/**
+ * The level of CakePHP security.
+ */
+       Configure::write('Security.level', 'medium');
+
+/**
+ * A random string used in security hashing methods.
+ */
+       Configure::write('Security.salt', 'DYhG93b0qyJfIxfsvniR2G0FgaC9mi');
+
+/**
+ * A random numeric string (digits only) used to encrypt/decrypt strings.
+ */
+       Configure::write('Security.cipherSeed', '7685930965749683645');
+
+/**
+ * Apply timestamps with the last modified time to static assets (js, css, images).
+ * Will append a querystring parameter containing the time the file was modified. This is
+ * useful for invalidating browser caches.
+ *
+ * Set to `true` to apply timestamps when debug > 0. Set to 'force' to always enable
+ * timestamping regardless of debug value.
+ */
+       //Configure::write('Asset.timestamp', true);
+
+/**
+ * Compress CSS output by removing comments, whitespace, repeating tags, etc.
+ * This requires a/var/cache directory to be writable by the web server for caching.
+ * and /vendors/csspp/csspp.php
+ *
+ * To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use HtmlHelper::css().
+ */
+       //Configure::write('Asset.filter.css', 'css.php');
+
+/**
+ * Plug in your own custom JavaScript compressor by dropping a script in your webroot to handle the
+ * output, and setting the config below to the name of the script.
+ *
+ * To use, prefix your JavaScript link URLs with '/cjs/' instead of '/js/' or use JavaScriptHelper::link().
+ */
+       //Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php');
+
+/**
+ * The classname and database used in CakePHP's
+ * access control lists.
+ */
+       Configure::write('Acl.classname', 'DbAcl');
+       Configure::write('Acl.database', 'default');
+
+/**
+ * Uncomment this line and correct your server timezone to fix 
+ * any date & time related errors.
+ */
+       date_default_timezone_set('Asia/Tokyo');
+
+/**
+ * Pick the caching engine to use.  If APC is enabled use it.
+ * If running via cli - apc is disabled by default. ensure it's available and enabled in this case
+ *
+ * Note: 'default' and other application caches should be configured in app/Config/bootstrap.php.
+ *       Please check the comments in boostrap.php for more info on the cache engines available 
+ *       and their setttings.
+ */
+$engine = 'File';
+if (extension_loaded('apc') && function_exists('apc_dec') && (php_sapi_name() !== 'cli' || ini_get('apc.enable_cli'))) {
+       $engine = 'Apc';
+}
+
+// In development mode, caches should expire quickly.
+$duration = '+999 days';
+if (Configure::read('debug') >= 1) {
+       $duration = '+10 seconds';
+}
+
+// Prefix each application on the same server with a different string, to avoid Memcache and APC conflicts.
+$prefix = 'myapp_';
+
+/**
+ * Configure the cache used for general framework caching.  Path information,
+ * object listings, and translation cache files are stored with this configuration.
+ */
+Cache::config('_cake_core_', array(
+       'engine' => $engine,
+       'prefix' => $prefix . 'cake_core_',
+       'path' => CACHE . 'persistent' . DS,
+       'serialize' => ($engine === 'File'),
+       'duration' => $duration
+));
+
+/**
+ * Configure the cache for model and datasource caches.  This cache configuration
+ * is used to store schema descriptions, and table listings in connections.
+ */
+Cache::config('_cake_model_', array(
+       'engine' => $engine,
+       'prefix' => $prefix . 'cake_model_',
+       'path' => CACHE . 'models' . DS,
+       'serialize' => ($engine === 'File'),
+       'duration' => $duration
+));
diff --git a/app/Config/database.php b/app/Config/database.php
new file mode 100644 (file)
index 0000000..90dfe7c
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+class DATABASE_CONFIG {
+
+       public $default = array(
+               'datasource' => 'Database/Postgres',
+               'persistent' => false,
+               'host' => 'localhost',
+               'login' => 'exmascake',
+               'password' => 'exmascake',
+               'database' => 'exmascake',
+               'encoding' => 'utf8',
+       );
+}
diff --git a/app/Config/email.php.default b/app/Config/email.php.default
new file mode 100644 (file)
index 0000000..fa252e8
--- /dev/null
@@ -0,0 +1,97 @@
+<?php
+/**
+ * This is email configuration file.
+ *
+ * Use it to configure email transports of Cake.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       app.Config
+ * @since         CakePHP(tm) v 2.0.0
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+/**
+ * In this file you set up your send email details.
+ *
+ * @package       cake.config
+ */
+/**
+ * Email configuration class.
+ * You can specify multiple configurations for production, development and testing.
+ *
+ * transport => The name of a supported transport; valid options are as follows:
+ *             Mail            - Send using PHP mail function
+ *             Smtp            - Send using SMTP
+ *             Debug           - Do not send the email, just return the result
+ *
+ * You can add custom transports (or override existing transports) by adding the
+ * appropriate file to app/Network/Email.  Transports should be named 'YourTransport.php',
+ * where 'Your' is the name of the transport.
+ *
+ * from =>
+ * The origin email. See CakeEmail::from() about the valid values
+ *
+ */
+class EmailConfig {
+
+       public $default = array(
+               'transport' => 'Mail',
+               'from' => 'you@localhost',
+               //'charset' => 'utf-8',
+               //'headerCharset' => 'utf-8',
+       );
+
+       public $smtp = array(
+               'transport' => 'Smtp',
+               'from' => array('site@localhost' => 'My Site'),
+               'host' => 'localhost',
+               'port' => 25,
+               'timeout' => 30,
+               'username' => 'user',
+               'password' => 'secret',
+               'client' => null,
+               'log' => false,
+               //'charset' => 'utf-8',
+               //'headerCharset' => 'utf-8',
+       );
+
+       public $fast = array(
+               'from' => 'you@localhost',
+               'sender' => null,
+               'to' => null,
+               'cc' => null,
+               'bcc' => null,
+               'replyTo' => null,
+               'readReceipt' => null,
+               'returnPath' => null,
+               'messageId' => true,
+               'subject' => null,
+               'message' => null,
+               'headers' => null,
+               'viewRender' => null,
+               'template' => false,
+               'layout' => false,
+               'viewVars' => null,
+               'attachments' => null,
+               'emailFormat' => null,
+               'transport' => 'Smtp',
+               'host' => 'localhost',
+               'port' => 25,
+               'timeout' => 30,
+               'username' => 'user',
+               'password' => 'secret',
+               'client' => null,
+               'log' => true,
+               //'charset' => 'utf-8',
+               //'headerCharset' => 'utf-8',
+       );
+
+}
diff --git a/app/Config/m_const.php b/app/Config/m_const.php
new file mode 100644 (file)
index 0000000..a4b4958
--- /dev/null
@@ -0,0 +1,6 @@
+<?php
+
+const NOTEMPTY = '何か値が必要です';
+const NUMERIC = '数値で入力してください';
+const DATE_TYPE = '日付形式で入力してください';
+
diff --git a/app/Config/routes.php b/app/Config/routes.php
new file mode 100644 (file)
index 0000000..51127de
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+/**
+ * Routes configuration
+ *
+ * In this file, you set up routes to your controllers and their actions.
+ * Routes are very important mechanism that allows you to freely connect
+ * different urls to chosen controllers and their actions (functions).
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       app.Config
+ * @since         CakePHP(tm) v 0.2.9
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+/**
+ * Here, we are connecting '/' (base path) to controller called 'Pages',
+ * its action called 'display', and we pass a param to select the view file
+ * to use (in this case, /app/View/Pages/home.ctp)...
+ */
+       Router::connect('/', array('controller' => 'site', 'action' => 'index'));
+/**
+ * ...and connect the rest of 'Pages' controller's urls.
+ */
+       Router::connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
+
+/**
+ * Load all plugin routes.  See the CakePlugin documentation on 
+ * how to customize the loading of plugin routes.
+ */
+       CakePlugin::routes();
+
+/**
+ * Load the CakePHP default routes. Remove this if you do not want to use
+ * the built-in default routes.
+ */
+       require CAKE . 'Config' . DS . 'routes.php';
diff --git a/app/Console/Command/AppShell.php b/app/Console/Command/AppShell.php
new file mode 100644 (file)
index 0000000..5cc915f
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/**
+ * AppShell file
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @since         CakePHP(tm) v 2.0
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+App::uses('Shell', 'Console');
+
+/**
+ * Application Shell
+ *
+ * Add your application-wide methods in the class below, your shells
+ * will inherit them.
+ *
+ * @package       app.Console.Command
+ */
+class AppShell extends Shell {
+
+}
diff --git a/app/Console/Command/Task/empty b/app/Console/Command/Task/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/Console/Templates/empty b/app/Console/Templates/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/Console/cake b/app/Console/cake
new file mode 100755 (executable)
index 0000000..b7e3825
--- /dev/null
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+################################################################################
+#
+# Bake is a shell script for running CakePHP bake script
+# PHP 5
+#
+# CakePHP(tm) :  Rapid Development Framework (http://cakephp.org)
+# Copyright 2005-2012, Cake Software Foundation, Inc.
+#
+# Licensed under The MIT License
+# Redistributions of files must retain the above copyright notice.
+#
+# @copyright    Copyright 2005-2012, Cake Software Foundation, Inc.
+# @link         http://cakephp.org CakePHP(tm) Project
+# @package      app.Console
+# @since        CakePHP(tm) v 2.0
+# @license      MIT License (http://www.opensource.org/licenses/mit-license.php)
+#
+################################################################################
+LIB=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && LIB=$LIB/$(basename -- "$0")
+
+while [ -h "$LIB" ]; do
+       DIR=$(dirname -- "$LIB")
+       SYM=$(readlink "$LIB")
+       LIB=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
+done
+
+LIB=$(dirname -- "$LIB")/
+APP=$(dirname $(cd $(dirname $0) && pwd))
+
+exec php -q "$LIB"cake.php -working "$APP" "$@"
+
+exit;
diff --git a/app/Console/cake.bat b/app/Console/cake.bat
new file mode 100644 (file)
index 0000000..b28ec8d
--- /dev/null
@@ -0,0 +1,32 @@
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\r
+::\r
+:: Bake is a shell script for running CakePHP bake script\r
+:: PHP 5\r
+::\r
+:: CakePHP(tm) : Rapid Development Framework (http://cakephp.org)\r
+:: Copyright 2005-2012, Cake Software Foundation, Inc.\r
+::\r
+:: Licensed under The MIT License\r
+:: Redistributions of files must retain the above copyright notice.\r
+::\r
+:: @copyright          Copyright 2005-2012, Cake Software Foundation, Inc.\r
+:: @link               http://cakephp.org CakePHP(tm) Project\r
+:: @package            app.Console\r
+:: @since              CakePHP(tm) v 2.0\r
+:: @license            MIT License (http://www.opensource.org/licenses/mit-license.php)\r
+::\r
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::\r
+\r
+:: In order for this script to work as intended, the cake\console\ folder must be in your PATH\r
+\r
+@echo.\r
+@echo off\r
+\r
+SET app=%0\r
+SET lib=%~dp0\r
+\r
+php -q "%lib%cake.php" -working "%CD% " %*\r
+\r
+echo.\r
+\r
+exit /B %ERRORLEVEL%\r
diff --git a/app/Console/cake.php b/app/Console/cake.php
new file mode 100644 (file)
index 0000000..edef894
--- /dev/null
@@ -0,0 +1,33 @@
+#!/usr/bin/php -q
+<?php
+/**
+ * Command-line code generation utility to automate programmer chores.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc.
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       app.Console
+ * @since         CakePHP(tm) v 2.0
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+$ds = DIRECTORY_SEPARATOR;
+$dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php';
+
+if (function_exists('ini_set')) {
+       $root = dirname(dirname(dirname(__FILE__)));
+       ini_set('include_path', $root . $ds . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
+}
+
+if (!include ($dispatcher)) {
+       trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
+}
+unset($paths, $path, $dispatcher, $root, $ds);
+
+return ShellDispatcher::run($argv);
diff --git a/app/Controller/.DbsController.php.swp b/app/Controller/.DbsController.php.swp
new file mode 100644 (file)
index 0000000..1caaf18
Binary files /dev/null and b/app/Controller/.DbsController.php.swp differ
diff --git a/app/Controller/AppController.php b/app/Controller/AppController.php
new file mode 100644 (file)
index 0000000..7aab7e9
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Application level Controller
+ *
+ * This file is application-wide controller file. You can put all
+ * application-wide controller-related methods here.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       app.Controller
+ * @since         CakePHP(tm) v 0.2.9
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+App::uses('Controller', 'Controller');
+
+/**
+ * Application Controller
+ *
+ * Add your application-wide methods in the class below, your controllers
+ * will inherit them.
+ *
+ * @package       app.Controller
+ * @link http://book.cakephp.org/2.0/en/controllers.html#the-app-controller
+ */
+class AppController extends Controller {
+}
diff --git a/app/Controller/Component/.eXmasCakeComponent.php.swp b/app/Controller/Component/.eXmasCakeComponent.php.swp
new file mode 100644 (file)
index 0000000..510f866
Binary files /dev/null and b/app/Controller/Component/.eXmasCakeComponent.php.swp differ
diff --git a/app/Controller/Component/eXmasCakeComponent.php b/app/Controller/Component/eXmasCakeComponent.php
new file mode 100644 (file)
index 0000000..981c934
--- /dev/null
@@ -0,0 +1,554 @@
+<?php
+class eXmasCakeComponent extends Object{
+
+       var $GeneralConst = array(
+               'TOP' => 'トップページ',
+        'ADD' => '登録',
+        'EDIT' => '編集',
+        'DEL' => '削除',
+        'VIEW' => '詳細',
+        'LOOKUP' => '一覧',
+        'MENU' => 'メニュー',
+        'ACTION' => '操作',
+        'SUBMIT' => '登録',
+        'PREV' => '前へ',
+        'NEXT' => '次へ',
+        'PAGE_NAVI' => 'ページ {:page}/{:pages}  (全 {:count} 件)',
+        'CONFIRM' => '%sを%sしますか',
+        'SAVE_OK' => '保存しました',
+        'SAVE_NG' => '保存できませんでした',
+        'DEL_OK' => '削除しました',
+        'DEL_NG' => '削除できませんでした',
+        'INVALID_ID' => 'データに誤りがあります',
+        'NOTEXISTS' => 'データが見つかりませんでした',
+        'UNIQUE_NG' => '同一名称のデータは登録できません',
+        'ID' => '登録番号',
+        'NAME' => '名称',
+        'ACTIVE' => '有効',
+        'INACTIVE' => '無効',
+        'CREATED' => '作成日',
+        'MODIFIED' => '更新日',
+        'DESCRIPTION' => 'メモ',
+        'LOGIN' => 'ログイン',
+        'LOGOUT' => 'ログアウト',
+        'STATUS' => '状態',
+        'GO_BACK' => '戻る',
+        'RELATED_DATA' => '連携データ'
+       );
+
+    var $numeric = array(
+            'int',
+            'smallint',
+            'integer',
+            'bigint',
+            'decimal',
+            'numeric',
+            'real',
+            'double precision',
+            'serial',
+            'bigserial'
+        );
+
+       function initialize() { }
+       function startup() { }
+       function beforeRender() { }
+       function shutdown() { }
+    function beforeRedirect() { }
+
+       public function rmrf($dir) {
+               foreach (glob($dir) as $file) {
+                       if (is_dir($file)) {
+                               $this->rmrf("$file/*");
+                               rmdir($file);
+                       } else {
+                               unlink($file);
+                       }
+               }
+       }       
+
+       public function createFolder($path) {
+               $this->rmrf($path);
+               mkdir($path);
+               mkdir($path.DS.'Config');
+               mkdir($path.DS.'Controller');
+               mkdir($path.DS.'Model');
+               mkdir($path.DS.'View');
+       }
+
+       public function getDbScript($db) {
+               $spt = '<?php'.PHP_EOL;
+        $spt .= 'class DATABASE_CONFIG {'.PHP_EOL;
+        $spt .= SP1.'public $default = array('.PHP_EOL;
+        $spt .= SP2."'datasource' => 'Database/Postgres',".PHP_EOL;
+        $spt .= SP2."'persistent' => false,".PHP_EOL;
+        $spt .= SP2."'host' => '".$db['db_host']."',".PHP_EOL;
+        $spt .= SP2."'login' => '".$db['db_user']."',".PHP_EOL;
+        $spt .= SP2."'password' => '".$db['db_password']."',".PHP_EOL;
+        $spt .= SP2."'database' => '".$db['db_name']."',".PHP_EOL;
+        $spt .= SP2."'encoding' => 'utf8',".PHP_EOL;
+        $spt .= SP1.");".PHP_EOL;
+        $spt .= "}".PHP_EOL;
+        return $spt;
+       }
+
+       public function getTableSql($dbTable) {
+               $names = $this->getNames($dbTable['DbTable']);
+
+               $spt = '-- drop table '.$names['TableName'].';'.PHP_EOL;
+               $spt .= '-- '.$names['TableName'].' テーブル'.PHP_EOL;
+               if (!empty($dbTable['TableField'])) {
+               $spt .= 'create table '.$names['TableName'].' ('.PHP_EOL;
+                       $fields = $dbTable['TableField'];
+                       foreach ($fields as $tableField) {
+                               $spt .=SP1.$tableField['symbol'].' '.$tableField['field_type'].' '.$tableField['field_option'];
+                               if ($tableField['default_value'] != null) {
+                                       $spt .= ' default '.$tableField['default_value'];
+                               }
+                               $spt .= ', -- '.$tableField['name'].PHP_EOL;
+                       }
+                       $spt .= 'primary key (id)'.PHP_EOL;
+                       $spt .= ');';
+               }
+               return $spt;
+       }
+
+       public function getNames($dbTable) {
+               $names = array();
+               $names['TableName'] = $dbTable['symbol'];
+               $names['ClassName'] = Inflector::classify($dbTable['symbol']);
+               $names['Property'] = Inflector::camelize($dbTable['symbol']);
+//             $names['DisplayField'] = $this->getDisplayField($dbTable);              
+               $names['Controller'] = $names['Property']."ontroller";
+               $names['Model'] = $names['ClassName']; 
+               $names['property'] = strtolower($names['Property']);
+               $names['PROPERTY'] = strtoupper($names['Property']);
+               $names['classname'] = strtolower($names['ClassName']);
+               $names['CLASSNAME'] = strtoupper($names['ClassName']);
+               $names['symbol'] = Inflector::underscore($dbTable['symbol']);
+
+               return $names;
+       }
+
+       public function getDisplayField($tableFields) {
+               if (!empty($tableFields)) {
+                       foreach ($tableFields as $tableField) {
+                               if (preg_match("/name/", $tableField['symbol'])) {
+                                       return $tableField['symbol'];
+                               }
+                       }
+               }
+               return 'id';
+       }
+
+       public function getStem($data){
+               $data = strtolower($data);
+               $pos = strpos($data,'(');
+               if ($pos>0) {
+                       return   substr(0,$pos);
+               } else {
+                       return $data;
+               }
+       }
+
+       public function generateBelongsTo($tableField) {
+               $belongsto = $this->getBelongsTo($tableField);
+               $belong = "";
+               if (!empty($belongsto)) {
+                       $belong = SP1."public $"."belongsTo = array(".PHP_EOL;
+
+                       foreach($belongsto as $data) {
+                               foreach ($data as $key=>$value) {
+                                       $table = $value[0];
+                                       $field = $value[1];
+                                       $belong .= SP2."'$table' => array(".PHP_EOL;
+                                       $belong .= SP3."'className' => '$table',".PHP_EOL;
+                                       $belong .= SP3."'foreignKey' => '$key',".PHP_EOL;
+                                       $belong .= SP3."'conditions' => '',".PHP_EOL;
+                                       $belong .= SP3."'fields' => '',".PHP_EOL;
+                                       $belong .= SP3."'order' => ''".PHP_EOL;
+                                       $belong .= SP2."),".PHP_EOL;
+                               }
+                       }
+                       $belong .= SP1.");".PHP_EOL;
+               }
+               return $belong;
+       }
+
+       public function getBelongsTo($tableFields) {
+               $belongs = array();
+               foreach ($tableFields as $tableField) {
+                       $symbol =  $tableField['symbol'];
+                       $foreigntable = $tableField['foreign_table'];
+                       $foreignkey = $tableField['foreign_field'];
+                       if ($foreigntable != '') {
+                               $classify = Inflector::classify($foreigntable);
+                               $belongs[] = array($symbol=>array($classify,$foreignkey));
+                       }
+               }
+               return $belongs;
+       }
+
+       public function generateRules($tableFields) {
+               $rules = SP1."public $"."validate = array(".PHP_EOL;
+               foreach ($tableFields as $tableField) {
+                       $symbol =  $tableField['symbol'];
+                       $check = $this->getRule($tableField);
+                       if (count($check)) {
+                               $rules .= SP2."'$symbol' => array(".PHP_EOL;
+                               foreach($check as $value) {
+                                       list($rule,$message) = $value;
+                                       $rules .= SP3."'$rule' => array(".PHP_EOL;
+                                       $rules .= SP4."'rule' => array('$rule'),".PHP_EOL;
+                                       $rules .= SP4."'message' => $message,".PHP_EOL;
+                                       $rules .= SP3."),".PHP_EOL;
+                               }
+                               $rules .= SP2."),".PHP_EOL;
+                       }
+               }
+               $rules .= SP1.");".PHP_EOL;
+               return $rules;
+       }
+
+       public function getRule($tableField) {
+               $type = $tableField['field_type'];
+               $option = $tableField['field_option'];
+               $check = array();
+               $stem = $this->getStem($type);
+               if (in_array($stem,$this->numeric)) {
+                       $check[] = array('numeric','NUMERIC');
+               }
+               if ($stem == 'date') {
+                       $check[] = array('date','DATE_TYPE');
+               }
+               if ($option == 'not null') {
+                       $check[] = array('notempty','NOTEMPTY');
+               }
+               return $check;
+       }
+
+       public function getHasmanies($hasmanies) {
+               $hasmany = "";
+               if (!empty($hasmanies)) {
+                       $hasmany = SP1.'public $hasMany = array('.PHP_EOL;
+                       foreach ($hasmanies as $row) {
+                               $table = Inflector::classify($row['table_name']);
+                               $field = $row['field_name'];
+                               $hasmany .= SP2."'$table' => array(".PHP_EOL;
+                               $hasmany .= SP3."'className' => '$table',".PHP_EOL;
+                               $hasmany .= SP3."'foreignKey' => '$field',".PHP_EOL;
+                               $hasmany .= SP3."'dependent' => false,".PHP_EOL;
+                               $hasmany .= SP3."'conditions' => '',".PHP_EOL;
+                               $hasmany .= SP3."'fields' => '',".PHP_EOL;
+                               $hasmany .= SP3."'order' => '',".PHP_EOL;
+                               $hasmany .= SP3."'limit' => '',".PHP_EOL;
+                               $hasmany .= SP3."'offset' => '',".PHP_EOL;
+                               $hasmany .= SP3."'exclusive' => '',".PHP_EOL;
+                               $hasmany .= SP3."'finderQuery' => '',".PHP_EOL;
+                               $hasmany .= SP3."'counterQuery' => ''".PHP_EOL;
+                               $hasmany .= SP2."),".PHP_EOL;
+                       }
+                       $hasmany .= SP1.");".PHP_EOL;
+               }
+               return $hasmany;
+       }
+
+       public function getModel($names,$rules,$belongs,$hasmany) {
+               $str = "<?php".PHP_EOL;
+               $str .= "App::uses('AppModel', 'Model');".PHP_EOL;
+               $str .= "/**".PHP_EOL;
+               $str .= " * ".$names['ClassName']." Model".PHP_EOL;
+               $str .= " *".PHP_EOL;
+               $str .= " * @property  ".$names['Property']." $".$names['Property'].PHP_EOL;
+               $str .= " */".PHP_EOL;
+               $str .= "class ".$names['ClassName']." extends AppModel {".PHP_EOL;
+               if (isset($names['DisplayField'])) {
+                       $str .= SP1."/**".PHP_EOL;
+                       $str .= SP1." * Display field".PHP_EOL;
+                       $str .= SP1." *".PHP_EOL;
+                       $str .= SP1." * @var string".PHP_EOL;
+                       $str .= SP1." */".PHP_EOL;
+                       $str .= SP1."public $"."displyField = '".$names['DisplayField']."';".PHP_EOL;
+               }
+               if (!empty($rules)) {
+                       $str .= SP1."/**".PHP_EOL;
+                       $str .= SP1." * Validation rules".PHP_EOL;
+                       $str .= SP1." *".PHP_EOL;
+                       $str .= SP1." * @var array".PHP_EOL;
+                       $str .= SP1." */".PHP_EOL;
+                       $str .= $rules.PHP_EOL;
+               }
+               if (!empty($belongs)) {
+                       $str .= SP1."/**".PHP_EOL;
+                       $str .= SP1." * belongsTo associations".PHP_EOL;
+                       $str .= SP1." *".PHP_EOL;
+                       $str .= SP1." * @var array".PHP_EOL;
+                       $str .= SP1." */".PHP_EOL;
+                       $str .= $belongs.PHP_EOL;
+               }
+               if (!empty($hasmany)) {
+                       $str .= SP1."/**".PHP_EOL;
+                       $str .= SP1." * hasMany associations".PHP_EOL;
+                       $str .= SP1." *".PHP_EOL;
+                       $str .= SP1." * @var array".PHP_EOL;
+                       $str .= SP1." */".PHP_EOL;
+                       $str .= $hasmany.PHP_EOL;
+               }
+               $str .= '}';
+               return $str;
+       }
+
+       public function getClassDiv($name,$action) {
+               if ($action == 'add' || $action == 'edit') {
+                       return "<div class='$name form'>";
+               } else {
+                       return "<div class='$name $action'>";
+               }
+       }
+       public function getTitle($name,$action) {
+               return "<h2><?php echo $name.$action; ?></h2>";
+       }
+       public function getTable($names,$dbTable) {
+               
+               $str = "<table cellpadding=\"0\" cellspacing=\"0\">".PHP_EOL;
+               if(!empty($dbTable)) {
+                       $displayName = 'id';
+                       $str .= SP1."<tr>".PHP_EOL;
+                       foreach ($dbTable['TableField'] as $tableField) {
+                               $str .= SP2.'<th><?php echo $this->Paginator->sort(\''.$tableField['symbol'].'\','.strtoupper($tableField['symbol']).'); ?></th>'.PHP_EOL;
+                               if ($displayName == 'id') {
+                                       if (preg_match("/name/",$tableField['symbol'])) {
+                                               $displayName = $tableField['symbol'];
+                                       }
+                               }
+                       }
+                       $str .= SP2."<th class=\"actions\"><?php echo ACTION; ?></th>".PHP_EOL;
+                       $str .= SP1."</tr>".PHP_EOL;
+                       $str .= "<?php foreach ($".$names['property']." as $".$names['classname']."): ?>".PHP_EOL;
+                       $str .= SP1."<tr>".PHP_EOL;
+                       foreach ($dbTable['TableField'] as $tableField) {
+                               $str .= SP2."<td><?php echo h($".$names['classname']."['".$names['ClassName']."']['".$tableField['symbol']."']); ?>&nbsp;</td>".PHP_EOL;
+                       }       
+                       $str .= SP2.'<td class="actions">'.PHP_EOL;
+                       $str .= '<?php echo $this->Html->link(VIEW, array(\'action\' => \'view\',$'.$names['classname']."['".$names['ClassName']."']['id'])); ?>".PHP_EOL;
+                       $str .= '<?php echo $this->Html->link(EDIT, array(\'action\' => \'edit\', $'.$names['classname']."['".$names['ClassName']."']['id'])); ?>".PHP_EOL;
+                       $str .= '<?php echo $this->Form->postLink(DEL,array(\'action\' => \'delete\','.PHP_EOL;
+                       $str .= SP3.' $'.$names['classname']."['".$names['ClassName']."']['id']), null, __(CONFIRM,$".$names['classname']. "['" .$names['ClassName']."']['".$displayName."'],DEL)); ?>".PHP_EOL;
+                       $str .= SP2.'</td>'.PHP_EOL;
+                       $str .= SP1.'</tr>'.PHP_EOL;
+                       $str .= '<?php endforeach; ?>'.PHP_EOL;
+                       $str .= '</table>'.PHP_EOL;
+               }
+               return $str;
+       }
+
+       public function getPaginator() {
+               $str = '<p>'.PHP_EOL;
+               $str .= '<?php'.PHP_EOL;
+               $str .= SP1.'$this->Paginator->counter(array(\'format\' => PAGE_NAVI));'.PHP_EOL;
+               $str .= '?>  </p>'.PHP_EOL;
+               $str .= '<div class="paging">'.PHP_EOL;
+               $str .= '<?php'.PHP_EOL;
+               $str .= SP1.'echo $this->Paginator->prev(\'< \' . PREV, array(), null, array(\'class\' => \'prev disabled\'));'.PHP_EOL;
+               $str .= SP1.'echo $this->Paginator->numbers(array(\'separator\' => \'\'));'.PHP_EOL;
+               $str .= SP1.'echo $this->Paginator->next(NEXT . \' >\', array(), null, array(\'class\' => \'next disabled\'));'.PHP_EOL;
+               $str .= '?>'.PHP_EOL; 
+               $str .= '</div>'.PHP_EOL;
+               return $str;
+       }
+
+       public function getDl($names,$dbTable) {
+               $str = '<dl>'.PHP_EOL;
+               if(!empty($dbTable['TableField'])) {
+                       foreach ($dbTable['TableField'] as $tableField) {
+                               $str .= SP1.'<dt><?php echo '.strtoupper($tableField['symbol']).'; ?></dt>'.PHP_EOL;
+                               $str .= SP1.'<dd>'.PHP_EOL;
+                               if ($tableField['field_type'] == 'text') {
+                                       $str .= SP2.'<?php echo nl2br(h($'.$names['classname'].'[\''.$names['ClassName'].'\'][\''.$tableField['symbol'].'\'])); ?>'.PHP_EOL;
+                               } else {
+                                       $str .= SP2.'<?php echo h($'.$names['classname'].'[\''.$names['ClassName'].'\'][\''.$tableField['symbol'].'\']); ?>'.PHP_EOL;
+                               }
+                               $str .= SP2.'&nbsp;'.PHP_EOL;
+                               $str .= SP1.'</dd>'.PHP_EOL;
+                       }
+               }
+               $str .= '<dl>'.PHP_EOL;
+               return $str;
+       }
+       public function getInput($names,$dbTable,$mode) {
+               $str = '<?php echo $this->Form->create(\''.$names['Model'].'\'); ?>'.PHP_EOL;
+               $str .= SP1.'<fieldset>'.PHP_EOL;
+               $str .= SP2.'<legend><?php echo '.$names['PROPERTY'].'.ADD; ?></legend>'.PHP_EOL;
+               $str .= SP1.'<?php'.PHP_EOL;
+
+               if(!empty($dbTable['TableField'])) {
+                       foreach ($dbTable['TableField'] as $tableField) {
+                               if (strtolower($tableField['symbol']) != 'id' || $mode == 'edit') {
+                                       if (strtolower($tableField['field_type'] != 'timestamp')) {
+                                               $str .=SP1.'echo $this->Form->input(\''.$tableField['symbol']."',array('label'=>".strtoupper($tableField['symbol']);
+                                               if (strtolower($tableField['field_type']) == 'date') {
+                                                       $str .= ",'type'=>'date','dateFormat' => 'YMD','monthNames'=>false";
+                                               }
+                                               $str .= "));".PHP_EOL;
+                                       }
+                               }
+                       }
+               }
+               $str .= SP1.'?>'.PHP_EOL;
+               $str .= SP1.'</fieldset>'.PHP_EOL;
+               $str .= '<?php echo $this->Form->end(SUBMIT); ?>'.PHP_EOL;
+
+               return $str;
+       }
+
+       public function getMenu($names,$menus) {
+               $str = '<div class="actions">'.PHP_EOL;
+               $str .= '<h3><?php echo MENU; ?></h3>'.PHP_EOL;
+               $str .= SP1.'<ul>'.PHP_EOL;
+               if (in_array('add',$menus)) {
+                       $str .= SP2.'<li><?php echo $this->Html->link('.$names['PROPERTY'].'.ADD, array(\'action\' => \'add\')); ?></li>'.PHP_EOL;
+               }
+               if (in_array('edit',$menus)) {
+                       $str .= '<li><?php echo $this->Html->link('.$names['PROPERTY'].".EDIT, array('action' => 'edit',$". $names['classname']."['".$names['ClassName']."']['id'])); ?></li>".PHP_EOL;
+               }
+               if (in_array('delete',$menus)) {
+$str .= '<li><?php echo $this->Form->postLink('.$names['PROPERTY'].'.DEL,array(\'action\' => \'delete\','.PHP_EOL;
+            $str .= SP3.' $'.$names['classname']."['".$names['ClassName']."']['id']), null, __(CONFIRM,$".$names['classname']. "['" .$names['ClassName']."']['".$names['DisplayField']."'],DEL)); ?></li>".PHP_EOL;
+               }
+               if (in_array('lookup',$menus)) {
+                       $str .= '<li><?php echo $this->Html->link('.$names['PROPERTY'].'.LOOKUP, array(\'action\' => \'index\')); ?></li>'.PHP_EOL;
+
+               }
+               $str .= SP1.'</ul>'.PHP_EOL;
+               $str .= '</div>'.PHP_EOL;
+               return $str;
+       }
+
+       public function index_view($table) {
+               $names = $this->getNames($table['DbTable']);
+               $names['DisplayField'] = $this->getDisplayField($table['TableField']);
+               $str = $this->getClassDiv($names['property'],'index').PHP_EOL;
+               $str .= $this->getTitle($names['PROPERTY'],'LOOKUP').PHP_EOL;   
+        $str .= $this->getTable($names,$table).PHP_EOL;
+               $str .= $this->getPaginator().PHP_EOL;
+               $str .= '</div>'.PHP_EOL;
+
+               $str .= $this->getMenu($names,array('add'));
+               return $str; 
+       }
+
+       public function view_view($table) {
+               $names = $this->getNames($table['DbTable']);
+        $names['DisplayField'] = $this->getDisplayField($table['TableField']);
+               $str = $this->getClassDiv($names['property'],'view').PHP_EOL;
+               $str .= $this->getTitle($names['PROPERTY'],'VIEW').PHP_EOL;
+               $str .= $this->getDl($names,$table).PHP_EOL;
+        $str .= '</div>'.PHP_EOL;
+
+               $str .= $this->getMenu($names,array('edit','delete','lookup')).PHP_EOL;
+               return $str;
+       }
+       public function add_view($table) {
+        $names = $this->getNames($table['DbTable']);
+        $names['DisplayField'] = $this->getDisplayField($table['TableField']);
+               $str = $this->getClassDiv($names['property'],'add').PHP_EOL;
+               $str .= $this->getInput($names,$table,'add').PHP_EOL;
+        $str .= '</div>'.PHP_EOL;
+               $str .= $this->getMenu($names,array('lookup')).PHP_EOL;
+               return $str;
+       }
+       public function edit_view($table) {
+        $names = $this->getNames($table['DbTable']);
+        $names['DisplayField'] = $this->getDisplayField($table['TableField']);
+               $str = $this->getClassDiv($names['property'],'edit').PHP_EOL;
+               $str .= $this->getInput($names,$table,'edit');
+        $str .= '</div>'.PHP_EOL;
+               $str .= $this->getMenu($names,array('lookup')).PHP_EOL;
+               return $str;
+       }
+       public function getIndexMethod($names) {
+               $index = SP1.'public function index() {'.PHP_EOL;
+               $index .= SP2.'$this->'.$names['ClassName'].'->recursive = 0;'.PHP_EOL;
+               $index .= SP2.'$this->set(\''.$names['property'].'\', $this->paginate());'.PHP_EOL;
+               $index .= SP1.'}'.PHP_EOL;
+               return $index;
+       }
+       public function getViewMethod($names) {
+               $view = SP1.'public function view($id = null) {'.PHP_EOL;
+               $view .= SP2.'$this->'.$names['ClassName'].'->id = $id;'.PHP_EOL;
+               $view .= SP2.'if (!$this->'.$names['ClassName'].'->exists()) {'.PHP_EOL;
+               $view .= SP3.'throw new NotFoundException(INVALID_ID);'.PHP_EOL;
+               $view .= SP2.'}'.PHP_EOL;
+               $view .= SP2.'$this->set(\''.$names['classname'].'\', $this->'.$names['ClassName'].'->read(null, $id));'.PHP_EOL;
+               $view .= SP1.'}';
+               return $view;
+       }
+       public function getAddMethod($names,$belongs) {
+               $add = SP1.'public function add() {'.PHP_EOL;
+               $add .= SP2.'if ($this->request->is(\'post\')) {'.PHP_EOL;
+               $add .= SP3.'$this->'.$names['Model'].'->create();'.PHP_EOL;
+               $add .= SP3.'if ($this->'.$names['Model'].'->save($this->request->data)) {'.PHP_EOL;
+               $add .= SP4.'$this->Session->setFlash(SAVE_OK);'.PHP_EOL;
+               $add .= SP4.'$this->redirect(array(\'action\' => \'index\'));'.PHP_EOL;
+               $add .= SP3.'} else {'.PHP_EOL;
+               $add .= SP4.'$this->Session->setFlash(SAVE_NG);'.PHP_EOL;
+               $add .= SP3.'}'.PHP_EOL;
+               $add .= SP2.'}'.PHP_EOL;
+               if (!empty($belongs)) {
+                       foreach($belongs as $data) {
+                               foreach ($data as $key=>$value) {
+                                       $val = strtolower(Inflector::pluralize($value[0]));
+                                       $add .= SP2.'$'.$val.' = $this->'.$names['Model'].'->'.Inflector::classify($value['0']).'->find(\'list\');'.PHP_EOL;
+                                       $add .= SP2.'$this->set(compact(\''.$val.'\'));'.PHP_EOL;
+                               }
+                       }
+               }
+               $add .= SP1.'}'.PHP_EOL;
+               return $add;
+       }
+       public function getEditMethod($names,$belongs) {
+               $edit = SP1.'public function edit($id = null) {'.PHP_EOL;
+               $edit .= SP2.'$this->'.$names['Model'].'->id = $id;'.PHP_EOL;
+               $edit .= SP2.'if (!$this->'.$names['Model'].'->exists()) {'.PHP_EOL;
+               $edit .= SP3.'throw new NotFoundException(INVALID_ID);'.PHP_EOL;
+               $edit .= SP2.'}'.PHP_EOL;
+               $edit .= SP2.'if ($this->request->is(\'post\') || $this->request->is(\'put\')) {'.PHP_EOL;
+               $edit .= SP3.'if ($this->'.$names['Model'].'->save($this->request->data)) {'.PHP_EOL;
+               $edit .= SP4.'$this->Session->setFlash(SAVE_OK);'.PHP_EOL;
+               $edit .= SP4.'$this->redirect(array(\'action\' => \'index\'));'.PHP_EOL;
+               $edit .= SP3.'} else {'.PHP_EOL;
+               $edit .= SP4.'$this->Session->setFlash(SAVE_NG);'.PHP_EOL;
+               $edit .= SP3.'}'.PHP_EOL;
+               $edit .= SP2.'} else {'.PHP_EOL;
+               $edit .= SP3.'$this->request->data = $this->'.$names['Model'].'->read(null, $id);'.PHP_EOL;
+               $edit .= SP2.'}'.PHP_EOL;
+               if (!empty($belongs)) {
+                       foreach($belongs as $data) {
+                               foreach ($data as $key=>$value) {
+                                       $val = strtolower(Inflector::pluralize($value[0]));
+                                       $edit .= SP2.'$'.$val.' = $this->'.$names['Model'].'->'.Inflector::classify($value['0']).'->find(\'list\');'.PHP_EOL;
+                                       $edit .= SP2.'$this->set(compact(\''.$val.'\'));'.PHP_EOL;
+                               }
+                       }
+               }
+               $edit .= SP1.'}'.PHP_EOL;
+               return $edit;
+       }
+       public function getDeleteMethod($names) {
+               $delete = SP1.'public function delete($id = null) {'.PHP_EOL;
+               $delete .= SP2.'if (!$this->request->is(\'post\')) {'.PHP_EOL;
+               $delete .= SP3.'throw new MethodNotAllowedException();'.PHP_EOL;
+               $delete .= SP2.'}'.PHP_EOL;
+               $delete .= SP2.'$this->'.$names['Model'].'->id = $id;'.PHP_EOL;
+               $delete .= SP2.'if (!$this->'.$names['Model'].'->exists()) {'.PHP_EOL;
+               $delete .= SP3.'throw new NotFoundException(INVALID_ID);'.PHP_EOL;
+               $delete .= SP2.'}'.PHP_EOL;
+               $delete .= SP2.'if ($this->'.$names['Model'].'->delete()) {'.PHP_EOL;
+               $delete .= SP3.'$this->Session->setFlash(DEL_OK);'.PHP_EOL;
+               $delete .= SP3.'$this->redirect(array(\'action\' => \'index\'));'.PHP_EOL;
+               $delete .= SP2.'}'.PHP_EOL;
+               $delete .= SP2.'$this->Session->setFlash(DEL_NG);'.PHP_EOL;
+               $delete .= SP1.'}'.PHP_EOL;
+               return $delete;
+       }
+
+}
diff --git a/app/Controller/Component/empty b/app/Controller/Component/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/Controller/DbTablesController.php b/app/Controller/DbTablesController.php
new file mode 100644 (file)
index 0000000..2064c52
--- /dev/null
@@ -0,0 +1,509 @@
+<?php
+App::uses('AppController', 'Controller');
+/**
+ * DbTables Controller
+ *
+ * @property DbTable $DbTable
+ */
+class DbTablesController extends AppController {
+
+    public $components = array('eXmasCake');
+
+/**
+ * script method
+ *
+ * @throws NotFoundException
+ * @param string $id
+ * @return void
+ */
+    public function script($id = null) {
+        $this->DbTable->id = $id;
+        if (!$this->DbTable->exists()) {
+            throw new NotFoundException(INVALID_ID);
+        }
+               $dbTable = $this->DbTable->read(null, $id);
+               $this->set('script',$this->eXmasCake->getTableSql($dbTable));
+               $this->set('dbTable', $dbTable);
+    }
+/**
+ * model method
+ *
+ * @throws NotFoundException
+ * @param string $id
+ * @return void
+ */
+    public function model($id = null) {
+        $this->DbTable->id = $id;
+        if (!$this->DbTable->exists()) {
+            throw new NotFoundException(INVALID_ID);
+        }
+        $dbTable = $this->DbTable->read(null, $id);
+
+               $names = $this->eXmasCake->getNames($dbTable['DbTable']);
+
+
+        $this->set('dbTable', $dbTable);
+
+               $displayField = '';
+               $rules = '';
+
+               $hasmany = array();
+        $belongsto = '';
+
+
+        if (!empty($dbTable['TableField'])) {
+                       $displayField = $this->eXmasCake->getDisplayField($dbTable['TableField']);
+                       $rules = $this->getRules($dbTable['TableField']);
+                       $belongs = $this->eXmasCake->getBelongsTo($dbTable['TableField']);
+                       $hasmanies = $this->DbTable->getHasmany($dbTable['DbTable']['symbol']);
+
+                       $hasmany = $this->eXmasCake->getHasmanies($hasmanies);
+                       
+                       if (!empty($belongs)) {
+                               $belongsto = SP1.'public $belongsTo = array('.PHP_EOL;
+                               foreach($belongs as $data) {
+                                       foreach ($data as $key=>$value) {
+                                       $table = $value[0];
+                                       $field = $value[1];
+                                               $belongsto .= SP2."'$table' => array(".PHP_EOL;
+                                       $belongsto .= SP3."'className' => '$table',".PHP_EOL;
+                                       $belongsto .= SP3."'foreignKey' => '$key',".PHP_EOL;
+                                               $belongsto .= SP3."'conditions' => '',".PHP_EOL;
+                                               $belongsto .= SP3."'fields' => '',".PHP_EOL;
+                                               $belongsto .= SP3."'order' => ''".PHP_EOL;
+                                               $belongsto .= SP2."),".PHP_EOL;
+                                       }
+                               }
+                               $belongsto .= SP1.");".PHP_EOL;
+                       }
+               }       
+               if ($rules != '') {
+                       $rules = SP1.'public $validate = array('.PHP_EOL.$rules.SP1.');'.PHP_EOL;
+               }
+               $this->set('names',$names);
+           $this->set('rules',$rules);
+        $this->set('displayField',$displayField);
+               $this->set('belongs',$belongsto);
+               $this->set('hasmany',$hasmany);
+       }
+/**
+ * getRules method
+ *
+ * @return $rules
+ */
+       public function getRules($tableFields) {
+               $rules = '';
+        foreach ($tableFields as $tableField) {
+            $symbol =  $tableField['symbol'];
+                       $check = $this->eXmasCake->getRule($tableField);
+                       if (count($check)) {
+                               $rules .= SP2."'$symbol' => array(".PHP_EOL;
+                               foreach($check as $value) {
+                                       list($rule,$message) = $value;
+                                       $rules .= SP3."'$rule' => array(".PHP_EOL;
+                                       $rules .= SP4."'rule' => array('$rule'),".PHP_EOL;
+                                       $rules .= SP4."'message' => $message,".PHP_EOL;
+                                       $rules .= SP3."),".PHP_EOL;
+                               }
+            }
+               }
+               return $rules;
+       }
+/**
+ * create_controller method
+ *
+ * @return void
+ */
+    public function create_controller($id = null) {
+        $this->DbTable->id = $id;
+        if (!$this->DbTable->exists()) {
+            throw new NotFoundException(INVALID_ID);
+        }
+        $dbTable = $this->DbTable->read(null, $id);
+               $belongs = $this->eXmasCake->getBelongsTo($dbTable['TableField']);
+               $this->set('dbTable', $dbTable);
+               $index = $this->getIndexMethod($dbTable['DbTable']['symbol']);
+               $view = $this->getViewMethod($dbTable['DbTable']['symbol']);
+               $add = $this->getAddMethod($dbTable,$belongs);
+               $edit = $this->getEditMethod($dbTable,$belongs);
+               $delete = $this->getDeleteMethod($dbTable['DbTable']['symbol']);
+        $className = Inflector::camelize($dbTable['DbTable']['symbol']);
+        $property =  Inflector::classify($dbTable['DbTable']['symbol']);
+        $this->set('className',$className);
+        $this->set('property',$property);
+               $this->set('index',$index);
+               $this->set('view',$view);
+               $this->set('add',$add);
+               $this->set('edit',$edit);
+               $this->set('delete',$delete);
+       }
+/**
+ * getIndexMethod method
+ *
+ * @return $index
+ */
+       public function getIndexMethod($symbol) {
+               $index = SP1.'public function index() {'.PHP_EOL;
+               $index .= SP2.'$this->'.Inflector::classify($symbol).'->recursive = 0;'.PHP_EOL;
+               $index .= SP2.'$this->set(\''.$symbol.'\', $this->paginate());'.PHP_EOL;
+               $index .= SP1.'}'.PHP_EOL;
+               return $index;
+       }
+/**
+ * getViewMethod method
+ *
+ * @return $view
+ */
+       public function getViewMethod($symbol) {
+               $property = Inflector::classify($symbol);
+       $view = SP1.'public function view($id = null) {'.PHP_EOL;
+        $view .= SP2.'$this->'.$property.'->id = $id;'.PHP_EOL;
+        $view .= SP2.'if (!$this->'.$property.'->exists()) {'.PHP_EOL;
+           $view .= SP3.'throw new NotFoundException(INVALID_ID);'.PHP_EOL;
+               $view .= SP2.'}'.PHP_EOL;
+               $view .= SP2.'$this->set(\''.strtolower($property).'\', $this->'.$property.'->read(null, $id));'.PHP_EOL;
+               $view .= SP1.'}';
+               return $view;
+       }
+
+/**
+ * getAddMethod
+ *
+ * @return $add
+ */
+       public function getAddMethod($dbTable,$belongs) {
+               $symbol = $dbTable['DbTable']['symbol'];
+
+               $property = Inflector::classify($symbol);
+
+               $add = SP1.'public function add() {'.PHP_EOL;
+               $add .= SP2.'if ($this->request->is(\'post\')) {'.PHP_EOL;
+               $add .= SP3.'$this->'.$property.'->create();'.PHP_EOL;
+               $add .= SP3.'if ($this->'.$property.'->save($this->request->data)) {'.PHP_EOL;
+               $add .= SP4.'$this->Session->setFlash(SAVE_OK);'.PHP_EOL;
+               $add .= SP4.'$this->redirect(array(\'action\' => \'index\'));'.PHP_EOL;
+               $add .= SP3.'} else {'.PHP_EOL;
+               $add .= SP4.'$this->Session->setFlash(SAVE_NG);'.PHP_EOL;
+               $add .= SP3.'}'.PHP_EOL;
+               $add .= SP2.'}'.PHP_EOL;
+               if (!empty($belongs)) {
+            foreach($belongs as $data) {
+                               foreach ($data as $key=>$value) {
+                                       $val = strtolower(Inflector::pluralize($value[0]));
+                                       $add .= SP2.'$'.$val.' = $this->'.$property.'->'.Inflector::classify($value['0']).'->find(\'list\');'.PHP_EOL;
+                                       $add .= SP2.'$this->set(compact(\''.$val.'\'));'.PHP_EOL;
+                               }
+                       }
+               }
+               $add .= SP1.'}'.PHP_EOL;
+               return $add;
+       }
+/**
+ * 
+ */
+       public function getEditMethod($dbTable,$belongs) {
+               $property = Inflector::classify($dbTable['DbTable']['symbol']);
+               $edit = SP1.'public function edit($id = null) {'.PHP_EOL;
+               $edit .= SP2.'$this->'.$property.'->id = $id;'.PHP_EOL;
+               $edit .= SP2.'if (!$this->'.$property.'->exists()) {'.PHP_EOL;
+               $edit .= SP3.'throw new NotFoundException(INVALID_ID);'.PHP_EOL;
+               $edit .= SP2.'}'.PHP_EOL;
+               $edit .= SP2.'if ($this->request->is(\'post\') || $this->request->is(\'put\')) {'.PHP_EOL;
+               $edit .= SP3.'if ($this->'.$property.'->save($this->request->data)) {'.PHP_EOL;
+               $edit .= SP4.'$this->Session->setFlash(SAVE_OK);'.PHP_EOL;
+               $edit .= SP4.'$this->redirect(array(\'action\' => \'index\'));'.PHP_EOL;
+               $edit .= SP3.'} else {'.PHP_EOL;
+               $edit .= SP4.'$this->Session->setFlash(SAVE_NG);'.PHP_EOL;
+               $edit .= SP3.'}'.PHP_EOL;
+               $edit .= SP2.'} else {'.PHP_EOL;
+               $edit .= SP3.'$this->request->data = $this->'.$property.'->read(null, $id);'.PHP_EOL;
+               $edit .= SP2.'}'.PHP_EOL;
+        if (!empty($belongs)) {
+            foreach($belongs as $data) {
+                foreach ($data as $key=>$value) {
+                    $val = strtolower(Inflector::pluralize($value[0]));
+                    $edit .= SP2.'$'.$val.' = $this->'.$property.'->'.Inflector::classify($value['0']).'->find(\'list\');'.PHP_EOL;
+                    $edit .= SP2.'$this->set(compact(\''.$val.'\'));'.PHP_EOL;
+                }
+            }
+        }
+               $edit .= SP1.'}'.PHP_EOL;
+               return $edit;
+       }       
+/**
+ * getDeleteMethod method
+ *
+ * return $delete
+ */
+       public function getDeleteMethod($symbol) {
+               $property = Inflector::classify($symbol);
+               $delete = SP1.'public function delete($id = null) {'.PHP_EOL;
+               $delete .= SP2.'if (!$this->request->is(\'post\')) {'.PHP_EOL;
+               $delete .= SP3.'throw new MethodNotAllowedException();'.PHP_EOL;
+               $delete .= SP2.'}'.PHP_EOL;
+               $delete .= SP2.'$this->'.$property.'->id = $id;'.PHP_EOL;
+               $delete .= SP2.'if (!$this->'.$property.'->exists()) {'.PHP_EOL;
+               $delete .= SP3.'throw new NotFoundException(INVALID_ID);'.PHP_EOL;
+               $delete .= SP2.'}'.PHP_EOL;   
+               $delete .= SP2.'if ($this->'.$property.'->delete()) {'.PHP_EOL;
+               $delete .= SP3.'$this->Session->setFlash(DEL_OK);'.PHP_EOL;
+               $delete .= SP3.'$this->redirect(array(\'action\' => \'index\'));'.PHP_EOL;
+               $delete .= SP2.'}'.PHP_EOL;   
+               $delete .= SP2.'$this->Session->setFlash(DEL_NG);'.PHP_EOL;
+               $delete .= SP2.'$this->redirect(array(\'action\' => \'index\'));'.PHP_EOL;
+               $delete .= SP1.'}'.PHP_EOL;                     
+               return $delete;
+       }
+
+/**
+ * index_view method
+ *
+ * @return void
+ */
+       public function index_view($id = null) {
+               $this->DbTable->id = $id;
+               if (!$this->DbTable->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               $this->data_set($id);
+       }
+/**
+ * add_view method
+ *
+ * @return void
+ */
+    public function add_view($id = null) {
+        $this->DbTable->id = $id;
+        if (!$this->DbTable->exists()) {
+            throw new NotFoundException(INVALID_ID);
+        }
+               $this->data_set($id);
+    }
+
+/**
+ * edit_view method
+ *
+ * @return void
+ */
+    public function edit_view($id = null) {
+        $this->DbTable->id = $id;
+        if (!$this->DbTable->exists()) {
+            throw new NotFoundException(INVALID_ID);
+               }   
+               $this->data_set($id);
+    }   
+/** 
+ * view_view method
+ *      
+ * @return void
+ */     
+    public function view_view($id = null) {
+        $this->DbTable->id = $id;
+        if (!$this->DbTable->exists()) {
+            throw new NotFoundException(INVALID_ID);
+        }   
+        $this->data_set($id);
+    }   
+
+/*
+ * data_set method
+ *
+ * @return void
+ */
+       public function data_set($id) {
+        $dbTable = $this->DbTable->read(null, $id);
+        $this->set('dbTable', $dbTable);
+        $className = Inflector::camelize($dbTable['DbTable']['symbol']);
+        $property =  Inflector::classify($dbTable['DbTable']['symbol']);
+        $this->set('className',$className);
+        $this->set('property',$property);
+       }
+/**
+ * index method
+ *
+ * @return void
+ */
+       public function index() {
+               $this->DbTable->recursive = 0;
+               $this->paginate=array(
+               'limit' => 10, 
+               'sort' => 'id',
+                );     
+               $this->set('dbTables', $this->paginate());
+       }
+
+/**
+ * view method
+ *
+ * @throws NotFoundException
+ * @param string $id
+ * @return void
+ */
+       public function view($id = null) {
+               $this->DbTable->id = $id;
+               if (!$this->DbTable->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               $this->set('dbTable', $this->DbTable->read(null, $id));
+       }
+/**
+       * related_view method
+       *
+       * @throws NotFoundException
+       * @param string $id
+       * @return void
+ */
+       public function related_view($id = null) {
+               $this->DbTable->id = $id;
+               if (!$this->DbTable->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               $this->set('dbTable', $this->DbTable->read(null, $id));
+       }
+
+/**
+ * add method
+ *
+ * @return void
+ */
+       public function add() {
+               if ($this->request->is('post')) {
+                       $this->DbTable->create();
+                       if ($this->DbTable->save($this->request->data)) {
+                               $this->Session->setFlash(SAVE_OK);
+                               $this->redirect(array('action' => 'index'));
+                       } else {
+                               $this->Session->setFlash(SAVE_NG);
+                       }
+               }
+               $dbs = $this->DbTable->Db->find('list');
+               $this->set(compact('dbs'));
+       }
+/**
+       * related_add method
+       *
+       * @return void
+ */
+       public function related_add($id=null) {
+               if ($this->request->is('post')) {
+                       if ($this->DbTable->existsName($id,$this->request->data['DbTable']['name'],$this->request->data['DbTable']['symbol'])) {
+                               $this->Session->setFlash(UNIQUE_NG);
+                               $this->redirect(array('controller'=>'dbs','action' => 'view'.DS.$id));
+                       } else {
+                               $this->DbTable->create();
+                               if ($this->DbTable->save($this->request->data)) {
+                                       $this->Session->setFlash(SAVE_OK);
+                                       $this->redirect(array('controller'=>'dbs','action' => 'view'.DS.$id));
+                               } else {
+                                       $this->Session->setFlash(SAVE_NG);
+                               }
+                       }
+               }
+               $dbs = $this->DbTable->Db->read(null,$id);
+               $this->set('dbs',$dbs);
+       }
+
+/**
+ * edit method
+ *
+ * @throws NotFoundException
+ * @param string $id
+ * @return void
+ */
+       public function edit($id = null) {
+               $this->DbTable->id = $id;
+               if (!$this->DbTable->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               if ($this->request->is('post') || $this->request->is('put')) {
+                       if ($this->DbTable->save($this->request->data)) {
+                               $this->Session->setFlash(SAVE_OK);
+                               $this->redirect(array('action' => 'index'));
+                       } else {
+                               $this->Session->setFlash(SAVE_NG);
+                       }
+               } else {
+                       $this->request->data = $this->DbTable->read(null, $id);
+               }
+               $dbs = $this->DbTable->Db->find('list');
+               $this->set(compact('dbs'));
+       }
+
+/** reted_edit method
+       *
+       * @throws NotFoundException
+       * @param string $id
+       * @return void
+*/
+public function related_edit($id = null) {
+       $this->DbTable->id = $id;
+       if (!$this->DbTable->exists()) {
+               throw new NotFoundException(INVALID_ID);
+       }
+       if ($this->request->is('post') || $this->request->is('put')) {
+               if ($this->DbTable->save($this->request->data)) {
+                       $this->Session->setFlash(SAVE_OK);
+                       $this->redirect(array('action' => 'related_view'.DS.$id));
+               } else {
+                       $this->Session->setFlash(SAVE_NG);
+               }
+
+       } else {
+               $this->request->data = $this->DbTable->read(null, $id);
+       }
+       $dbs = $this->DbTable->Db->find('list');
+       $this->set(compact('dbs'));
+}
+/*
+ * delete method
+ *
+ * @throws MethodNotAllowedException
+ * @throws NotFoundException
+ * @param string $id
+ * @return void
+ */
+       public function delete($id = null) {
+               if (!$this->request->is('post')) {
+                       throw new MethodNotAllowedException();
+               }
+               $this->DbTable->id = $id;
+               if (!$this->DbTable->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               if ($this->DbTable->delete()) {
+                       $this->Session->setFlash(DEL_OK);
+                       $this->redirect(array('action' => 'index'));
+               }
+               $this->Session->setFlash(DEL_NG);
+               $this->redirect(array('action' => 'index'));
+       }
+/*
+       * related_delete method
+       *
+       * @throws MethodNotAllowedException
+       * @throws NotFoundException
+       * @param string $id
+       * @return void
+ */
+       public function related_delete($id = null,$db_id) {
+               if (!$this->request->is('post')) {
+                       throw new MethodNotAllowedException();
+               }
+               $this->DbTable->id = $id;
+               if (!$this->DbTable->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+
+               $options = array();
+               $options['TableField.db_table_id'] = $id; 
+               $this->DbTable->TableField->deleteAll($options);
+
+               if ($this->DbTable->delete()) {
+                       $this->Session->setFlash(DEL_OK);
+                       $this->redirect(array('controller'=>'dbs','action' => 'view'.DS.$db_id));
+               }
+               $this->Session->setFlash(DEL_NG.$this->DbTable);
+               $this->redirect(array('controller'=>'dbs','action' => 'view'.DS.$db_id));
+    }  
+
+}
diff --git a/app/Controller/DbsController.php b/app/Controller/DbsController.php
new file mode 100644 (file)
index 0000000..2ad4312
--- /dev/null
@@ -0,0 +1,385 @@
+<?php
+App::uses('AppController', 'Controller');
+/**
+ * Dbs Controller
+ *
+ * @property Db $Db
+ */
+class DbsController extends AppController {
+
+       public $components = array('eXmasCake');
+
+/**
+ * script method
+ *
+ * @return void
+ */
+       public function script($id = null) {
+               $this->Db->id = $id;
+               if (!$this->Db->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               $db = $this->Db->read(null, $id);
+               $script = $this->eXmasCake->getDbScript($db['Db']);
+               $this->set('script', $script);
+               $this->set('id',$id);
+       }
+
+/**
+ * constant method
+ *
+ * @return void
+ */
+       public function constant($id = null) {
+               $this->Db->id = $id;
+               if (!$this->Db->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               $db = $this->Db->read(null, $id);
+               $const = $this->getConstant($db['DbTable']);
+               $this->set('const',$const);
+               $this->set('id',$id);
+       }
+/**
+ * output method
+ * 
+ * @return void
+ */
+       public function output($id = null) {
+               $this->Db->id = $id;
+               if (!$this->Db->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               $db = $this->Db->read(null, $id);
+               $path = dirname(dirname(__FILE__)).DS.'tmp'.DS.'output'.DS.'app';
+               $this->eXmasCake->createFolder($path);
+
+               if (!$this->createDbScript($path,$db)) {
+            $this->Session->setFlash(SAVE_NG);
+               }
+               
+               $this->createConst($path,$db);
+               $this->createSqls($path,$db);
+               $this->createModels($path,$db);
+               $this->createControllers($path,$db);
+               $this->createViews($path,$db);
+               $this->createZip($path);
+               // download
+               header('Content-Type: application/zip');
+               header('Content-Disposition: attachment; filename=app.zip');
+               header('Content-Length: ' . filesize(dirname($path).DS.'app.zip'));
+               echo file_get_contents(dirname($path).DS.'app.zip');
+       }
+/**
+ * createDbScript method
+ *
+ * @return boolean
+ */
+       public function createDbScript($path,$db) {
+               $script = $this->eXmasCake->getDbScript($db['Db']);
+               file_put_contents($path.DS.'Config'.DS.'database.php',$script);
+       }
+/**
+ * createDbScript method
+ *
+ * @return boolean
+ */
+       public function createConst($path,$db) {
+               $const = $this->getConstant($db['DbTable']);
+               $script = '<?php'.PHP_EOL;
+               foreach ($const as $key=>$value) {
+               $script .= "const $key = '$value';".PHP_EOL;
+               }
+               file_put_contents($path.DS.'Config'.DS.'const.php',$script);
+       }
+/** 
+ * createSqls method
+ *
+ * @return boolean
+ */
+       public function createSqls($path,$db) {
+               $script = '';
+               foreach ($db['DbTable'] as $DbTable) {
+                       $table = $this->Db->DbTable->read(null,$DbTable['id']);
+                       $script .= $this->eXmasCake->getTableSql($table);
+                       $script .= PHP_EOL;
+               }
+               file_put_contents($path.DS.'tables.sql',$script);       
+       }
+
+/** 
+ * createModels method
+ *
+ * @return boolean
+ */
+       public function createModels($path,$db) {
+               foreach ($db['DbTable'] as $DbTable) {
+                       $table = $this->Db->DbTable->read(null,$DbTable['id']);
+                       $names = $this->eXmasCake->getNames($table['DbTable']);
+                       $rules = '';
+                       $hasmany = '';
+                       $belongsto = '';
+
+                       if (!empty($table['TableField'])) {
+                               $names['DisplayField'] = $this->eXmasCake->getDisplayField($table['TableField']);
+                               $rules = $this->eXmasCake->generateRules($table['TableField']);
+                               $hasmanies = $this->Db->DbTable->getHasmany($table['DbTable']['symbol']);
+                               $hasmany = $this->eXmasCake->getHasmanies($hasmanies);
+                               $belongs = $this->eXmasCake->generateBelongsTo($table['TableField']);
+                       }
+                       $script = $this->eXmasCake->getModel($names,$rules,$belongs,$hasmany);
+                       file_put_contents($path.DS.'Model'.DS.$names['Model'].'.php',$script);
+               }
+       }
+/**                     
+ * createControllers method
+ *
+ * @return boolean
+ */
+       public function createControllers($path,$db) {
+        foreach ($db['DbTable'] as $DbTable) {
+                       $table = $this->Db->DbTable->read(null,$DbTable['id']);
+                       $names = $this->eXmasCake->getNames($table['DbTable']);
+                       $belongs = '';
+                       if (!empty($table['TableField'])) {
+                               $belongs = $this->eXmasCake->getBelongsTo($table['TableField']);
+                       }
+                       $script = "<?php".PHP_EOL;
+                       $script .= "App::uses('AppController', 'Controller');".PHP_EOL;
+                       $script .= "/**".PHP_EOL;
+                       $script .= " * ".$names['ClassName']." Controller".PHP_EOL;
+                       $script .= " *".PHP_EOL;
+                       $script .= " * @property ".$names['Model']." $".$names['Model'].PHP_EOL;
+                       $script .= " */".PHP_EOL;
+                       $script .= "class ".$names['Property']."Controller extends AppController {".PHP_EOL;
+                       $script .= "/**".PHP_EOL;
+                       $script .= " * index method".PHP_EOL;
+                       $script .= " *".PHP_EOL;
+                       $script .= " * @return void".PHP_EOL;
+                       $script .= " */".PHP_EOL;
+                       $script .= $this->eXmasCake->getIndexMethod($names);
+                       $script .= "/**".PHP_EOL;
+                       $script .= " * view method".PHP_EOL;
+                       $script .= " *".PHP_EOL;
+                       $script .= " * @param string $"."id".PHP_EOL;
+                       $script .= " * @return void".PHP_EOL;
+                       $script .= " */".PHP_EOL;
+                       $script .= $this->eXmasCake->getViewMethod($names);
+                       $script .= "/**".PHP_EOL;
+                       $script .= " * add method".PHP_EOL;
+                       $script .= " *".PHP_EOL;
+                       $script .= " * @return void".PHP_EOL;
+                       $script .= " */".PHP_EOL;
+                       $script .= $this->eXmasCake->getAddMethod($names,$belongs);
+                       $script .= "/**".PHP_EOL;
+                       $script .= " * edit method".PHP_EOL;
+                       $script .= " *".PHP_EOL;
+                       $script .= " * @throws NotFoundException".PHP_EOL;
+                       $script .= " * @param string $"."id".PHP_EOL;
+                       $script .= " * @return void".PHP_EOL;
+                       $script .= " */".PHP_EOL;
+                       $script .= $this->eXmasCake->getEditMethod($names,$belongs);
+                       $script .= "/**".PHP_EOL;
+                       $script .= " * delete method".PHP_EOL;
+                       $script .= " *".PHP_EOL;
+                       $script .= " * @throws MethodNotAllowedException".PHP_EOL;
+                       $script .= " * @throws NotFoundException".PHP_EOL;
+                       $script .= " * @param string $"."id".PHP_EOL;
+                       $script .= " * @return void".PHP_EOL;
+                       $script .= " */".PHP_EOL;
+                       $script .= $this->eXmasCake->getDeleteMethod($names);
+                       $script .= "}".PHP_EOL;
+
+            file_put_contents($path.DS.'Controller'.DS.$names['Property'].'Controller.php',$script);
+               }
+       }
+/**                             
+ * createControllers method
+ *
+ * @return boolean
+ */
+       public function createViews($path,$db) {
+               foreach ($db['DbTable'] as $DbTable) {
+                       $table = $this->Db->DbTable->read(null,$DbTable['id']);
+
+                       $names = $this->eXmasCake->getNames($table['DbTable']);
+                       $dir = $path.DS."View".DS.$names['Property'];
+                       mkdir($dir);
+                       $this->index_view($dir,$table);
+            $this->view_view($dir,$table);       
+            $this->add_view($dir,$table);       
+            $this->edit_view($dir,$table);
+               }
+       }
+       function index_view($path,$table) {
+               $script = $this->eXmasCake->index_view($table);
+               if ($script) {
+                       file_put_contents($path.DS."index.ctp",$script);
+               }
+       }
+    function view_view($path,$table) {
+        $script = $this->eXmasCake->view_view($table);
+        if ($script) {
+               file_put_contents($path.DS."view.ctp",$script);
+               }                                                                                               
+       }
+    function add_view($path,$table) {
+        $script = $this->eXmasCake->add_view($table);
+        if ($script) {
+            file_put_contents($path.DS."add.ctp",$script);
+        }                                               
+       }
+    function edit_view($path,$table) {
+        $script = $this->eXmasCake->edit_view($table);
+        if ($script) {
+            file_put_contents($path.DS."edit.ctp",$script);
+        }
+       }
+
+/**
+ * createControllers method
+ *
+ * @return boolean
+ */
+       public function createZip($path) {
+               $command = 'cd ' . dirname($path).'; zip -r app.zip ./app';
+               exec($command);
+       }
+
+/**
+ * sql method
+ * 
+ * @return void
+ */
+       public function sql($id = null) {
+        $this->Db->id = $id;
+               if (!$this->Db->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               $db = $this->Db->read(null, $id);
+
+               $sql = "";
+               foreach ($db['DbTable'] as $dbTable) {
+                       $tbls = $this->Db->DbTable->read(null, $dbTable['id']);
+                       $sql .= $this->eXmasCake->getTableSql($tbls);
+                       $sql .= PHP_EOL;
+               }
+               $sql .= PHP_EOL;
+               $this->set('script',$sql);
+               $this->set('id',$id);
+       }
+
+
+/**
+ * getConstant method
+ *
+ * @return $const
+ */
+       public function getConstant($DbTables) {
+               $const = $this->eXmasCake->GeneralConst;
+               foreach ($DbTables as $DbTable) {
+                       $key = strtoupper(Inflector::camelize($DbTable['symbol']));
+                       $value = $DbTable['name'];
+                       $const += array($key=>$value);
+                       $tbls = $this->Db->DbTable->read(null, $DbTable['id']);
+                       $Fields = $tbls['TableField'];
+                       foreach ($Fields as $Field) {
+                               $key = strtoupper($Field['symbol']);
+                               $value = $Field['name'];
+                               $const += array($key=>$value);
+                       }
+               }
+               return $const;
+       }
+
+/**
+ * index method
+ *
+ * @return void
+ */
+       public function index() {
+               $this->Db->recursive = 0;
+               $this->set('dbs', $this->paginate());
+       }
+
+/**
+ * view method
+ *
+ * @throws NotFoundException
+ * @param string $id
+ * @return void
+ */
+       public function view($id = null) {
+               $this->Db->id = $id;
+               if (!$this->Db->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               $this->set('db', $this->Db->read(null, $id));
+       }
+
+/**
+ * add method
+ *
+ * @return void
+ */
+       public function add() {
+               if ($this->request->is('post')) {
+                       $this->Db->create();
+                       if ($this->Db->save($this->request->data)) {
+                               $this->Session->setFlash(SAVE_OK);
+                               $this->redirect(array('action' => 'index'));
+                       } else {
+                               $this->Session->setFlash(SAVE_NG);
+                       }
+               }
+       }
+
+/**
+ * edit method
+ *
+ * @throws NotFoundException
+ * @param string $id
+ * @return void
+ */
+       public function edit($id = null) {
+               $this->Db->id = $id;
+               if (!$this->Db->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               if ($this->request->is('post') || $this->request->is('put')) {
+                       if ($this->Db->save($this->request->data)) {
+                               $this->Session->setFlash(SAVE_OK);
+                               $this->redirect(array('action' => 'index'));
+                       } else {
+                               $this->Session->setFlash(SAVE_NG);
+                       }
+               } else {
+                       $this->request->data = $this->Db->read(null, $id);
+               }
+       }
+
+/**
+ * delete method
+ *
+ * @throws MethodNotAllowedException
+ * @throws NotFoundException
+ * @param string $id
+ * @return void
+ */
+       public function delete($id = null) {
+               if (!$this->request->is('post')) {
+                       throw new MethodNotAllowedException();
+               }
+               $this->Db->id = $id;
+               if (!$this->Db->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               if ($this->Db->delete()) {
+                       $this->Session->setFlash(DEL_OK);
+                       $this->redirect(array('action' => 'index'));
+               }
+               $this->Session->setFlash(DEL_NG);
+               $this->redirect(array('action' => 'index'));
+       }
+
+}
diff --git a/app/Controller/PagesController.php b/app/Controller/PagesController.php
new file mode 100644 (file)
index 0000000..5a2e57d
--- /dev/null
@@ -0,0 +1,75 @@
+<?php
+/**
+ * Static content controller.
+ *
+ * This file will render views from views/pages/
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       app.Controller
+ * @since         CakePHP(tm) v 0.2.9
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+App::uses('AppController', 'Controller');
+
+/**
+ * Static content controller
+ *
+ * Override this controller by placing a copy in controllers directory of an application
+ *
+ * @package       app.Controller
+ * @link http://book.cakephp.org/2.0/en/controllers/pages-controller.html
+ */
+class PagesController extends AppController {
+
+/**
+ * Controller name
+ *
+ * @var string
+ */
+       public $name = 'Pages';
+
+/**
+ * This controller does not use a model
+ *
+ * @var array
+ */
+       public $uses = array();
+
+/**
+ * Displays a view
+ *
+ * @param mixed What page to display
+ * @return void
+ */
+       public function display() {
+               $path = func_get_args();
+
+               $count = count($path);
+               if (!$count) {
+                       $this->redirect('/');
+               }
+               $page = $subpage = $title_for_layout = null;
+
+               if (!empty($path[0])) {
+                       $page = $path[0];
+               }
+               if (!empty($path[1])) {
+                       $subpage = $path[1];
+               }
+               if (!empty($path[$count - 1])) {
+                       $title_for_layout = Inflector::humanize($path[$count - 1]);
+               }
+               $this->set(compact('page', 'subpage', 'title_for_layout'));
+               $this->render(implode('/', $path));
+       }
+}
diff --git a/app/Controller/ProjectsController.php b/app/Controller/ProjectsController.php
new file mode 100644 (file)
index 0000000..95a636c
--- /dev/null
@@ -0,0 +1,105 @@
+<?php
+App::uses('AppController', 'Controller');
+/**
+ * Projects Controller
+ *
+ * @property Project $Project
+ */
+class ProjectsController extends AppController {
+
+    var $status = array('0'=>'開始前','1'=>'実施中','9'=>'完了');
+
+/**
+ * index method
+ *
+ * @return void
+ */
+       public function index() {
+               $this->Project->recursive = 0;
+               $this->set('projects', $this->paginate());
+        $this->set('status',$this->status);
+       }
+
+/**
+ * view method
+ *
+ * @throws NotFoundException
+ * @param string $id
+ * @return void
+ */
+       public function view($id = null) {
+               $this->Project->id = $id;
+               if (!$this->Project->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               $this->set('project', $this->Project->read(null, $id));
+        $this->set('status',$this->status);
+       }
+
+/**
+ * add method
+ *
+ * @return void
+ */
+       public function add() {
+               if ($this->request->is('post')) {
+                       $this->Project->create();
+                       if ($this->Project->save($this->request->data)) {
+                               $this->Session->setFlash(SAVE_OK);
+                               $this->redirect(array('action' => 'index'));
+                       } else {
+                               $this->Session->setFlash(SAVE_NG);
+                       }
+               }
+        $this->set('status',$this->status);
+       }
+
+/**
+ * edit method
+ *
+ * @throws NotFoundException
+ * @param string $id
+ * @return void
+ */
+       public function edit($id = null) {
+               $this->Project->id = $id;
+               if (!$this->Project->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               if ($this->request->is('post') || $this->request->is('put')) {
+                       if ($this->Project->save($this->request->data)) {
+                               $this->Session->setFlash(SAVE_OK);
+                               $this->redirect(array('action' => 'index'));
+                       } else {
+                               $this->Session->setFlash(SAVE_NG);
+                       }
+               } else {
+                       $this->request->data = $this->Project->read(null, $id);
+               $this->set('status',$this->status);
+               }
+       }
+
+/**
+ * delete method
+ *
+ * @throws MethodNotAllowedException
+ * @throws NotFoundException
+ * @param string $id
+ * @return void
+ */
+       public function delete($id = null) {
+               if (!$this->request->is('post')) {
+                       throw new MethodNotAllowedException();
+               }
+               $this->Project->id = $id;
+               if (!$this->Project->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               if ($this->Project->delete()) {
+                       $this->Session->setFlash(DEL_OK);
+                       $this->redirect(array('action' => 'index'));
+               }
+               $this->Session->setFlash(DEL_NG);
+               $this->redirect(array('action' => 'index'));
+       }
+}
diff --git a/app/Controller/SiteController.php b/app/Controller/SiteController.php
new file mode 100644 (file)
index 0000000..44830c2
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+App::uses('AppController', 'Controller');
+/**
+ *  * Site Controller
+ *  *
+ *  */
+class SiteController extends AppController {
+    var $use = array();
+
+    public function index() {
+
+    }
+}
+?>
+
diff --git a/app/Controller/TableFieldsController.php b/app/Controller/TableFieldsController.php
new file mode 100644 (file)
index 0000000..c3c1060
--- /dev/null
@@ -0,0 +1,175 @@
+<?php
+App::uses('AppController', 'Controller');
+/**
+ * TableFields Controller
+ *
+ * @property TableField $TableField
+ */
+class TableFieldsController extends AppController {
+
+/**
+ * index method
+ *
+ * @return void
+ */
+       public function index() {
+               $this->TableField->recursive = 0;
+        $this->paginate=array(
+               //  'conditions' => array(検索条件),
+               //  'fields' => array(取得するカラム),
+               //  'page' => int(数値,最初に表示するページ。デフォルトは1,'last'(小文字)も可*1),
+              'limit' => 10, // int(数値:showでも可。デフォルトは20),
+                  'sort' => 'db_table_id',
+                  'order' => array('db_table_id','line_no'),
+                  'direction' => 'asc',
+                  //  'recursive' => findAllに与える。
+               );
+
+               $this->set('tableFields', $this->paginate());
+       }
+
+/**
+ * view method
+ *
+ * @throws NotFoundException
+ * @param string $id
+ * @return void
+ */
+       public function view($id = null) {
+               $this->TableField->id = $id;
+               if (!$this->TableField->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               $this->set('tableField', $this->TableField->read(null, $id));
+       }
+    public function related_view($id = null) {
+        $this->TableField->id = $id;
+        if (!$this->TableField->exists()) {
+            throw new NotFoundException(INVALID_ID);
+        }
+        $this->set('tableField', $this->TableField->read(null, $id));
+    }
+
+/**
+ * add method
+ *
+ * @return void
+ */
+       public function add() {
+       if ($this->request->is('post')) {
+            $db_table_id = $this->request->data['TableField']['db_table_id'];                    
+            $this->request->data['TableField']['line_no'] = $this->TableField->newLine($db_table_id);    
+                       $this->TableField->create();
+                       if ($this->TableField->save($this->request->data)) {
+                               $this->Session->setFlash(SAVE_OK);
+                               $this->redirect(array('action' => 'index'));
+                       } else {
+                               $this->Session->setFlash(SAVE_NG);
+                       }
+               }
+               $dbTables = $this->TableField->DbTable->find('list');
+               $this->set(compact('dbTables'));
+       }
+/**
+       * related_add method
+       *
+       * @return void
+ */
+       public function related_add($id) {
+               if ($this->request->is('post')) {
+                       $db_table_id = $this->request->data['TableField']['db_table_id'];
+                       $this->request->data['TableField']['line_no'] = $this->TableField->newLine($db_table_id);
+                       $this->TableField->create();
+                       if ($this->TableField->save($this->request->data)) {
+                               $this->Session->setFlash(SAVE_OK);
+                               $this->redirect(array('controller'=>'db_tables','action' => 'related_view'.DS.$id));
+                       } else {
+                               $this->Session->setFlash(SAVE_NG);
+                       }
+               }
+               $dbTables = $this->TableField->DbTable->read(null,$id);
+               $this->set('dbTables',$dbTables);
+       }
+
+/**
+ * delete method
+ *
+ * @throws MethodNotAllowedException
+ * @throws NotFoundException
+ * @param string $id
+ * @return void
+ */
+       public function delete($id = null) {
+               if (!$this->request->is('post')) {
+                       throw new MethodNotAllowedException();
+               }
+               $this->TableField->id = $id;
+               if (!$this->TableField->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               if ($this->TableField->delete()) {
+                       $this->Session->setFlash(DEL_OK);
+                       $this->redirect(array('action' => 'index'));
+               }
+               $this->Session->setFlash(DEL_NG);
+               $this->redirect(array('action' => 'index'));
+       }
+/**
+ * realed_edit method
+ *
+ * @throws NotFoundException
+ * @param string $id
+ * @return void
+ */
+       public function related_edit($id = null) {
+               $this->TableField->id = $id;
+               if (!$this->TableField->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               if ($this->request->is('post') || $this->request->is('put')) {
+                       $tf = $this->request->data['TableField'];
+                       if ($tf['current_line_no'] != $tf['line_no']) {
+                               $this->TableField->resetLineNo($tf['db_table_id'],$tf['current_line_no'] ,$tf['line_no']);
+                       }
+               
+                       if ($this->TableField->save($this->request->data)) {
+                               $this->Session->setFlash(SAVE_OK);
+                               $this->redirect(array('action' => 'related_view'.DS.$id));
+                       } else {
+                               $this->Session->setFlash(SAVE_NG);
+                       }
+               } else {
+                       $this->request->data = $this->TableField->read(null, $id);
+               }
+               $dbTables = $this->TableField->DbTable->find('list');
+               $this->set(compact('dbTables'));
+       }
+/**
+ * related_delete method
+ *
+ * @throws MethodNotAllowedException
+ * @throws NotFoundException
+ * @param string $id
+ * @return void
+ */
+       public function related_delete($id = null,$line_no,$table_id) {
+               if (!$this->request->is('post')) {
+                       throw new MethodNotAllowedException();
+               }
+
+               $max = $this->TableField->maxLine($table_id);
+               $this->TableField->resetLineNo($table_id,$line_no,$max);
+               
+               $this->TableField->id = $id;
+               if (!$this->TableField->exists()) {
+                       throw new NotFoundException(INVALID_ID);
+               }
+               if ($this->TableField->delete()) {
+                       $this->Session->setFlash(DEL_OK);
+                       $this->redirect(array('controller'=>'db_tables','action' => 'related_view',$table_id));
+               }
+                
+               $this->Session->setFlash(DEL_NG);
+               $this->redirect(array('action' => 'related_view',$id));
+       }
+}
diff --git a/app/Lib/empty b/app/Lib/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/Locale/eng/LC_MESSAGES/empty b/app/Locale/eng/LC_MESSAGES/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/Model/.TableField.php.swp b/app/Model/.TableField.php.swp
new file mode 100644 (file)
index 0000000..1befc55
Binary files /dev/null and b/app/Model/.TableField.php.swp differ
diff --git a/app/Model/AppModel.php b/app/Model/AppModel.php
new file mode 100644 (file)
index 0000000..f9cd7a8
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+/**
+ * Application model for Cake.
+ *
+ * This file is application-wide model file. You can put all
+ * application-wide model-related methods here.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       app.Model
+ * @since         CakePHP(tm) v 0.2.9
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+App::uses('Model', 'Model');
+
+config('m_const');
+
+
+/**
+ * Application model for Cake.
+ *
+ * Add your application-wide methods in the class below, your models
+ * will inherit them.
+ *
+ * @package       app.Model
+ */
+class AppModel extends Model {
+}
diff --git a/app/Model/Behavior/empty b/app/Model/Behavior/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/Model/Datasource/empty b/app/Model/Datasource/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/Model/Db.php b/app/Model/Db.php
new file mode 100644 (file)
index 0000000..147e0f4
--- /dev/null
@@ -0,0 +1,78 @@
+<?php
+App::uses('AppModel', 'Model');
+/**
+ * Db Model
+ *
+ * @property DbTable $DbTable
+ */
+class Db extends AppModel {
+
+/**
+ * Display field
+ *
+ * @var string
+ */
+       public $displayField = 'db_name';
+
+/**
+ * Validation rules
+ *
+ * @var array
+ */
+       public $validate = array(
+               'db_name' => array(
+                       'notempty' => array(
+                               'rule' => array('notempty'),
+                               'message' => NOTEMPTY,
+                               //'allowEmpty' => false,
+                               //'required' => false,
+                               //'last' => false, // Stop validation after this rule
+                               //'on' => 'create', // Limit validation to 'create' or 'update' operations
+                       ),
+               ),
+               'db_host' => array(
+                       'notempty' => array(
+                               'rule' => array('notempty'),
+                               'message' => NOTEMPTY,
+                               //'allowEmpty' => false,
+                               //'required' => false,
+                               //'last' => false, // Stop validation after this rule
+                               //'on' => 'create', // Limit validation to 'create' or 'update' operations
+                       ),
+               ),
+               'db_user' => array(
+                       'notempty' => array(
+                               'rule' => array('notempty'),
+                               'message' => NOTEMPTY,
+                               //'allowEmpty' => false,
+                               //'required' => false,
+                               //'last' => false, // Stop validation after this rule
+                               //'on' => 'create', // Limit validation to 'create' or 'update' operations
+                       ),
+               ),
+       );
+
+       //The Associations below have been created with all possible keys, those that are not needed can be removed
+
+/**
+ * hasMany associations
+ *
+ * @var array
+ */
+       public $hasMany = array(
+               'DbTable' => array(
+                       'className' => 'DbTable',
+                       'foreignKey' => 'db_id',
+                       'dependent' => false,
+                       'conditions' => '',
+                       'fields' => '',
+                       'order' => '',
+                       'limit' => '',
+                       'offset' => '',
+                       'exclusive' => '',
+                       'finderQuery' => '',
+                       'counterQuery' => ''
+               )
+       );
+
+}
diff --git a/app/Model/DbTable.php b/app/Model/DbTable.php
new file mode 100644 (file)
index 0000000..e73b51f
--- /dev/null
@@ -0,0 +1,118 @@
+<?php
+App::uses('AppModel', 'Model');
+/**
+ * DbTable Model
+ *
+ * @property Db $Db
+ * @property TableField $TableField
+ */
+class DbTable extends AppModel {
+
+/**
+ * Display field
+ *
+ * @var string
+ */
+       public $displayField = 'name';
+
+/**
+ * Validation rules
+ *
+ * @var array
+ */
+       public $validate = array(
+               'name' => array(
+                       'notempty' => array(
+                               'rule' => array('notempty'),
+                               'message' => NOTEMPTY,
+                               //'allowEmpty' => false,
+                               //'required' => false,
+                               //'last' => false, // Stop validation after this rule
+                               //'on' => 'create', // Limit validation to 'create' or 'update' operations
+                       ),
+               ),
+               'symbol' => array(
+                       'notempty' => array(
+                               'rule' => array('notempty'),
+                               'message' => NOTEMPTY,
+                               //'allowEmpty' => false,
+                               //'required' => false,
+                               //'last' => false, // Stop validation after this rule
+                               //'on' => 'create', // Limit validation to 'create' or 'update' operations
+                       ),
+               ),
+               'db_id' => array(
+                       'numeric' => array(
+                               'rule' => array('numeric'),
+                               'message' => NUMERIC,
+                               //'allowEmpty' => false,
+                               //'required' => false,
+                               //'last' => false, // Stop validation after this rule
+                               //'on' => 'create', // Limit validation to 'create' or 'update' operations
+                       ),
+                       'notempty' => array(
+                               'rule' => array('notempty'),
+                               'message' => NOTEMPTY,
+                               //'allowEmpty' => false,
+                               //'required' => false,
+                               //'last' => false, // Stop validation after this rule
+                               //'on' => 'create', // Limit validation to 'create' or 'update' operations
+                       ),
+               ),
+       );
+
+       //The Associations below have been created with all possible keys, those that are not needed can be removed
+
+/**
+ * belongsTo associations
+ *
+ * @var array
+ */
+       public $belongsTo = array(
+               'Db' => array(
+                       'className' => 'Db',
+                       'foreignKey' => 'db_id',
+                       'conditions' => '',
+                       'fields' => '',
+                       'order' => ''
+               )
+       );
+
+/**
+ * hasMany associations
+ *
+ * @var array
+ */
+       public $hasMany = array(
+               'TableField' => array(
+                       'className' => 'TableField',
+                       'foreignKey' => 'db_table_id',
+                       'dependent' => false,
+                       'conditions' => '',
+                       'fields' => '',
+                       'order' => 'line_no',
+                       'limit' => '',
+                       'offset' => '',
+                       'exclusive' => '',
+                       'finderQuery' => '',
+                       'counterQuery' => ''
+               )
+       );
+
+       public function existsName($db_id,$name,$symbol) {
+               $que = "select count(*) as num from db_tables where (symbol = '$symbol' or name = '$name') and db_id = $db_id ";
+               $res = $this->Query($que);
+               return ($res[0][0]['num'] > 0) ? true:false;
+       }
+
+       public function getHasmany($symbol) {
+               $que = "select a.symbol as table_name,b.symbol as field_name from db_tables as a, table_fields as b where b.foreign_table ilike '$symbol' and a.id = b.db_table_id";
+               $res = $this->Query($que);
+               if (count($res)) {
+                       return $res[0];
+               } else {
+                       return null;
+               }
+       }
+
+}
diff --git a/app/Model/Project.php b/app/Model/Project.php
new file mode 100644 (file)
index 0000000..9b607df
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+App::uses('AppModel', 'Model');
+/**
+ * Project Model
+ *
+ */
+class Project extends AppModel {
+
+/**
+ * Display field
+ *
+ * @var string
+ */
+       public $displayField = 'name';
+
+/**
+ * Validation rules
+ *
+ * @var array
+ */
+       public $validate = array(
+               'name' => array(
+                       'notempty' => array(
+                               'rule' => array('notempty'),
+                               'message' => NOTEMPTY,
+                               //'allowEmpty' => false,
+                               //'required' => false,
+                               //'last' => false, // Stop validation after this rule
+                               //'on' => 'create', // Limit validation to 'create' or 'update' operations
+                       ),
+               ),
+       );
+}
diff --git a/app/Model/TableField.php b/app/Model/TableField.php
new file mode 100644 (file)
index 0000000..6f12623
--- /dev/null
@@ -0,0 +1,106 @@
+<?php
+App::uses('AppModel', 'Model');
+/**
+ * TableField Model
+ *
+ * @property DbTable $DbTable
+ */
+class TableField extends AppModel {
+
+/**
+ * Display field
+ *
+ * @var string
+ */
+       public $displayField = 'name';
+
+/**
+ * Validation rules
+ *
+ * @var array
+ */
+       public $validate = array(
+               'line_no' => array(
+                       'numeric' => array(
+                               'rule' => array('numeric'),
+                               'message' => NUMERIC,
+                               //'allowEmpty' => false,
+                               //'required' => false,
+                               //'last' => false, // Stop validation after this rule
+                               //'on' => 'create', // Limit validation to 'create' or 'update' operations
+                       ),
+               ),
+               'name' => array(
+                       'notempty' => array(
+                               'rule' => array('notempty'),
+                               'message' => NOTEMPTY,
+                               //'allowEmpty' => false,
+                               //'required' => false,
+                               //'last' => false, // Stop validation after this rule
+                               //'on' => 'create', // Limit validation to 'create' or 'update' operations
+                       ),
+               ),
+               'symbol' => array(
+                       'notempty' => array(
+                               'rule' => array('notempty'),
+                               'message' => NOTEMPTY,
+                               //'allowEmpty' => false,
+                               //'required' => false,
+                               //'last' => false, // Stop validation after this rule
+                               //'on' => 'create', // Limit validation to 'create' or 'update' operations
+                       ),
+               ),
+               'field_type' => array(
+                       'notempty' => array(
+                               'rule' => array('notempty'),
+                               'message' => NOTEMPTY,
+                               //'allowEmpty' => false,
+                               //'required' => false,
+                               //'last' => false, // Stop validation after this rule
+                               //'on' => 'create', // Limit validation to 'create' or 'update' operations
+                       ),
+               ),
+               'db_table_id' => array(
+                       'numeric' => array(
+                               'rule' => array('numeric'),
+                               'message' => NOTEMPTY,
+                               //'allowEmpty' => false,
+                               //'required' => false,
+                               //'last' => false, // Stop validation after this rule
+                               //'on' => 'create', // Limit validation to 'create' or 'update' operations
+                       ),
+               ),
+       );
+
+       //The Associations below have been created with all possible keys, those that are not needed can be removed
+
+/**
+ * belongsTo associations
+ *
+ * @var array
+ */
+       public $belongsTo = array(
+               'DbTable' => array(
+                       'className' => 'DbTable',
+                       'foreignKey' => 'db_table_id',
+                       'conditions' => '',
+                       'fields' => '',
+                       'order' => ''
+               )
+       );
+
+    public function newLine($db_table_id) {
+               $line = $this->maxLine($db_table_id);
+        return $line + 1;
+    } 
+    public function resetLineNo($table,$start,$end) {
+        $inc = ($start > $end) ? 1:-1;
+        $que = "update table_fields set line_no = line_no + ($inc) where line_no between symmetric $start and $end and db_table_id = $table";
+        $this->query($que);
+       }
+       public function maxLine($db_table_id) {
+               $que = "select max(line_no) as max_line from table_fields where db_table_id = $db_table_id";
+               $res = $this->query($que);
+               return $res[0][0]['max_line'];
+       }
+}
diff --git a/app/Plugin/empty b/app/Plugin/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/Test/Case/Controller/Component/empty b/app/Test/Case/Controller/Component/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/Test/Case/Model/Behavior/empty b/app/Test/Case/Model/Behavior/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/Test/Case/View/Helper/empty b/app/Test/Case/View/Helper/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/Test/Fixture/empty b/app/Test/Fixture/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/Vendor/empty b/app/Vendor/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/Vendor/xtcpdf.php b/app/Vendor/xtcpdf.php
new file mode 100644 (file)
index 0000000..50453ea
--- /dev/null
@@ -0,0 +1,49 @@
+<?php 
+App::import('Vendor','tcpdf/tcpdf'); 
+
+class XTCPDF  extends TCPDF 
+{ 
+
+       var $xheadertext  = 'PDF created using CakePHP and TCPDF'; 
+       var $xheadercolor = array(0,0,200); 
+       var $xfootertext  = 'Copyright Â© %d XXXXXXXXXXX. All rights reserved.'; 
+       var $xfooterfont  = PDF_FONT_NAME_MAIN ; 
+       var $xfooterfontsize = 8 ; 
+
+
+       /** 
+         * Overwrites the default header // デフォルトのheader()関数を上書き
+         * set the text in the view using // ビューの文字列は以下のようにして設定します。
+         *    $fpdf->xheadertext = 'YOUR ORGANIZATION'; 
+         * set the fill color in the view using // ビューの塗りつぶしの色は以下のようにして設定します。
+         *    $fpdf->xheadercolor = array(0,0,100); (r, g, b) 
+         * set the font in the view using // ビューのフォントは以下のようにして設定します。
+         *    $fpdf->setHeaderFont(array('YourFont','',fontsize)); 
+         */ 
+       function Header() 
+       { 
+
+               list($r, $b, $g) = $this->xheadercolor; 
+               $this->setY(10); // shouldn't be needed due to page margin, but helas, otherwise it's at the page top
+               $this->SetFillColor($r, $b, $g); 
+               $this->SetTextColor(0 , 0, 0); 
+               $this->Cell(0,20, '', 0,1,'C', 1); 
+               $this->Text(15,26,$this->xheadertext ); 
+       } 
+
+       /** 
+         * Overwrites the default footer // デフォルトのfooter()を上書き
+         * set the text in the view using // ビューの文字列は以下のようにして設定します。
+         * $fpdf->xfootertext = 'Copyright Â© %d YOUR ORGANIZATION. All rights reserved.'; 
+         */ 
+       function Footer() 
+       { 
+               $year = date('Y'); 
+               $footertext = sprintf($this->xfootertext, $year); 
+               $this->SetY(-20); 
+               $this->SetTextColor(0, 0, 0); 
+               $this->SetFont($this->xfooterfont,'',$this->xfooterfontsize); 
+               $this->Cell(0,8, $footertext,'T',1,'C'); 
+       } 
+} 
+?>
diff --git a/app/View/DbTables/add.ctp b/app/View/DbTables/add.ctp
new file mode 100644 (file)
index 0000000..db9deed
--- /dev/null
@@ -0,0 +1,19 @@
+<div class="dbTables form">
+<?php echo $this->Form->create('DbTable'); ?>
+       <fieldset>
+               <legend><?php echo DB_TABLE.ADD; ?></legend>
+       <?php
+        echo $this->Form->input('db_id',array('label'=>DB));
+               echo $this->Form->input('name',array('label'=>NAME));
+               echo $this->Form->input('symbol',array('label'=>SYMBOL));
+               echo $this->Form->input('description',array('label'=>DESCRIPTION));
+       ?>
+       </fieldset>
+<?php echo $this->Form->end(SUBMIT); ?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(DB_TABLE.LOOKUP, array('action' => 'index')); ?></li>
+       </ul>
+</div>
diff --git a/app/View/DbTables/add_view.ctp b/app/View/DbTables/add_view.ctp
new file mode 100644 (file)
index 0000000..01bea7e
--- /dev/null
@@ -0,0 +1,52 @@
+<div class="dbTables view">
+<h2><?php  echo h($dbTable['DbTable']['name']).DS.VIEW_ADD; ?></h2>
+<div>
+<pre>
+<?php
+       $displayName = 'id';
+       $lower_class = strtolower($className);
+       $upper_class = strtoupper($className);
+       $lower_property = strtolower($property);
+       $upper_property = strtoupper($property);
+       echo h("<div class=\"$lower_class form\">").PHP_EOL;
+    echo h("<h2><?php echo $upper_class.ADD; ?></h2>").PHP_EOL;
+       echo h('<?php echo $this->Form->create(\''.$property.'\'); ?>').PHP_EOL;
+       echo h(SP1.'<fieldset>').PHP_EOL;
+    echo h(SP2."<legend><?php echo $upper_class.ADD; ?></legend>").PHP_EOL;
+    echo h(SP1.'<?php').PHP_EOL;
+       
+       if(!empty($dbTable['TableField'])) {
+               foreach ($dbTable['TableField'] as $tableField) {               
+                       if (strtolower($tableField['symbol']) != 'id') {
+                               if (strtolower($tableField['field_type'] != 'timestamp')) {
+                                       echo h(SP1.'echo $this->Form->input(\''.$tableField['symbol']."',array('label'=>".strtoupper($tableField['symbol']));
+                                       if (strtolower($tableField['field_type']) == 'date') {
+                                               echo ",'type'=>'date','dateFormat' => 'YMD','monthNames'=>false";
+                                       } 
+                                       echo "));".PHP_EOL;
+                               }
+                       }
+               }
+       }
+       echo h(SP1.'?>').PHP_EOL;
+    echo h(SP1.'</fieldset>').PHP_EOL;
+       echo h('<?php echo $this->Form->end(SUBMIT); ?>').PHP_EOL;
+       echo h('</div>').PHP_EOL;
+       echo h('<div class="actions">').PHP_EOL;
+    echo h(SP1.'<h3><?php echo MENU; ?></h3>').PHP_EOL;
+    echo h(SP1.'<ul>').PHP_EOL;
+
+       echo h(SP2.'<li><?php echo $this->Html->link('.$upper_class.".LOOKUP, array('action' => 'index')); ?></li>").PHP_EOL;
+    echo h(SP1.'</ul>').PHP_EOL;
+       echo h('</div>').PHP_EOL;
+?>
+</pre>
+       </div>
+<?php echo __(COPIPE_MESSAGE,"View/$className/add.ctp");?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(GO_BACK, array('action' => 'related_view'.DS.$dbTable['DbTable']['id'])); ?> </li>
+       </ul>
+</div>
diff --git a/app/View/DbTables/create_controller.ctp b/app/View/DbTables/create_controller.ctp
new file mode 100644 (file)
index 0000000..c24e497
--- /dev/null
@@ -0,0 +1,65 @@
+<div class="dbTables view">
+<h2><?php  echo h($dbTable['DbTable']['name']).DS.CONTROLLER; ?></h2>
+<div>
+<pre>
+<?php echo h("<?php")."\n"; ?>
+App::uses('AppController', 'Controller');
+/**
+* <?php echo $className; ?> Controller
+ *
+ * @property <?php echo $property.' $'.$property."\n"; ?>
+ */
+class <?php echo $className; ?>Controller extends AppController {
+
+/**
+ * index method
+ *
+ * @return void
+ */
+<?php echo $index; ?>
+
+/**
+ * view method
+ *  
+ * @throws NotFoundException
+ * @param string $id
+ * @return void
+ */     
+<?php echo $view; ?>
+
+/**         
+ * add method
+ *      
+ * @return void
+ */
+<?php echo $add; ?>
+
+/**
+* edit method
+*
+* @throws NotFoundException
+* @param string $id
+* @return void
+*/
+<?php echo $edit; ?>
+
+/**     
+* delete method
+*      
+* @throws MethodNotAllowedException
+* @throws NotFoundException
+* @param string $id
+* @return void
+*/     
+<?php echo $delete; ?>
+}
+</pre>
+</div>
+<?php echo __(COPIPE_MESSAGE,"Controller/$className"."Controller.php");?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(GO_BACK, array('action' => 'related_view'.DS.$dbTable['DbTable']['id'])); ?> </li>
+       </ul>
+</div>
diff --git a/app/View/DbTables/edit.ctp b/app/View/DbTables/edit.ctp
new file mode 100644 (file)
index 0000000..1a1c81f
--- /dev/null
@@ -0,0 +1,22 @@
+<div class="dbTables form">
+<?php echo $this->Form->create('DbTable'); ?>
+       <fieldset>
+               <legend><?php echo DB_TABLE.EDIT; ?></legend>
+       <?php
+               echo $this->Form->input('id');
+               echo $this->Form->input('name',array('label'=>NAME));
+               echo $this->Form->input('symbol',array('label'=>SYMBOL));
+               echo $this->Form->input('db_id',array('label'=>DB));
+               echo $this->Form->input('description',array('label'=>DESCRIPTION));
+       ?>
+       </fieldset>
+<?php echo $this->Form->end(SUBMIT); ?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+
+               <li><?php echo $this->Form->postLink(DB_TABLE.DEL, array('action' => 'delete', $this->Form->value('DbTable.id')), null, __(CONFIRM,$this->Form->value('DbTable.name'),DEL)); ?></li>
+               <li><?php echo $this->Html->link(DB_TABLE.LOOKUP, array('action' => 'index')); ?></li>
+       </ul>
+</div>
diff --git a/app/View/DbTables/edit_view.ctp b/app/View/DbTables/edit_view.ctp
new file mode 100644 (file)
index 0000000..7272bb7
--- /dev/null
@@ -0,0 +1,45 @@
+<div class="dbTables view">
+<h2><?php  echo h($dbTable['DbTable']['name']).DS.VIEW_EDIT; ?></h2>
+<div>
+<pre>
+<?php
+       $displayName = 'id';
+       $lower_class = strtolower($className);
+       $upper_class = strtoupper($className);
+       $lower_property = strtolower($property);
+       $upper_property = strtoupper($property);
+       echo h("<div class=\"$lower_class form\">").PHP_EOL;
+       echo h('<?php echo $this->Form->create(\''.$property.'\'); ?>').PHP_EOL;
+       echo h(SP1.'<fieldset>').PHP_EOL;
+    echo h(SP2."<legend><?php echo $upper_class.EDIT; ?></legend>").PHP_EOL;
+    echo h(SP1.'<?php').PHP_EOL;
+       
+       if(!empty($dbTable['TableField'])) {
+               foreach ($dbTable['TableField'] as $tableField) {       
+                       if (strtolower($tableField['field_type']) != 'timestamp') {
+                       echo h(SP1.'echo $this->Form->input(\''.$tableField['symbol']."',array('label'=>".strtoupper($tableField['symbol'])."));").PHP_EOL;
+                       }
+               }
+       }
+       echo h(SP1.'?>').PHP_EOL;
+    echo h(SP1.'</fieldset>').PHP_EOL;
+       echo h('<?php echo $this->Form->end(SUBMIT); ?>').PHP_EOL;
+       echo h('</div>').PHP_EOL;
+       echo h('<div class="actions">').PHP_EOL;
+    echo h(SP1.'<h3><?php echo MENU; ?></h3>').PHP_EOL;
+    echo h(SP1.'<ul>').PHP_EOL;
+
+       echo h(SP2.'<li><?php echo $this->Html->link('.$upper_class.".LOOKUP, array('action' => 'index')); ?></li>").PHP_EOL;
+    echo h(SP1.'</ul>').PHP_EOL;
+       echo h('</div>').PHP_EOL;
+?>
+</pre>
+       </div>
+<?php echo __(COPIPE_MESSAGE,"View/$className/edit.ctp");?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(GO_BACK, array('action' => 'related_view'.DS.$dbTable['DbTable']['id'])); ?> </li>
+       </ul>
+</div>
diff --git a/app/View/DbTables/index.ctp b/app/View/DbTables/index.ctp
new file mode 100644 (file)
index 0000000..e58ed2a
--- /dev/null
@@ -0,0 +1,44 @@
+<div class="dbTables index">
+       <h2><?php echo DB_TABLE.LOOKUP; ?></h2>
+       <table cellpadding="0" cellspacing="0">
+       <tr>
+                       <th><?php echo $this->Paginator->sort('id',ID); ?></th>
+                       <th><?php echo $this->Paginator->sort('name',NAME); ?></th>
+                       <th><?php echo $this->Paginator->sort('symbol',SYMBOL); ?></th>
+                       <th class="actions"><?php echo ACTION; ?></th>
+       </tr>
+       <?php
+       foreach ($dbTables as $dbTable): ?>
+       <tr>
+               <td><?php echo h($dbTable['DbTable']['id']); ?>&nbsp;</td>
+               <td><?php echo h($dbTable['DbTable']['name']); ?>&nbsp;</td>
+               <td><?php echo h($dbTable['DbTable']['symbol']); ?>&nbsp;</td>
+               <td class="actions">
+                       <?php echo $this->Html->link(VIEW, array('action' => 'view', $dbTable['DbTable']['id'])); ?>
+                       <?php echo $this->Html->link(EDIT, array('action' => 'edit', $dbTable['DbTable']['id'])); ?>
+                       <?php echo $this->Form->postLink(DEL, array('action' => 'delete', $dbTable['DbTable']['id']), null, __(CONFIRM, $dbTable['DbTable']['name'],DEL)); ?>
+               </td>
+       </tr>
+<?php endforeach; ?>
+       </table>
+       <p>
+       <?php
+       echo $this->Paginator->counter(array(
+       'format' => PAGE_NAVI 
+       ));
+       ?>      </p>
+
+       <div class="paging">
+       <?php
+               echo $this->Paginator->prev('< ' . PREV, array(), null, array('class' => 'prev disabled'));
+               echo $this->Paginator->numbers(array('separator' => ''));
+               echo $this->Paginator->next(NEXT . ' >', array(), null, array('class' => 'next disabled'));
+       ?>
+       </div>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(DB_TABLE.ADD, array('action' => 'add')); ?></li>
+       </ul>
+</div>
diff --git a/app/View/DbTables/index_view.ctp b/app/View/DbTables/index_view.ctp
new file mode 100644 (file)
index 0000000..e4f70cb
--- /dev/null
@@ -0,0 +1,72 @@
+<div class="dbTables view">
+<h2><?php  echo h($dbTable['DbTable']['name']).DS.VIEW_INDEX; ?></h2>
+<div>
+<pre>
+<?php
+       $displayName = 'id';
+       $lower_class = strtolower($className);
+       $upper_class = strtoupper($className);
+       $lower_property = strtolower($property);
+       echo h("<div class=\"$lower_class index\">").PHP_EOL;
+    echo h("<h2><?php echo $upper_class.LOOKUP; ?></h2>").PHP_EOL;
+    echo h("<table cellpadding=\"0\" cellspacing=\"0\">").PHP_EOL;
+    if(!empty($dbTable['TableField'])) {
+               echo h(SP1."<tr>").PHP_EOL;
+               foreach ($dbTable['TableField'] as $tableField) {
+                       echo h(SP2.'<th><?php echo $this->Paginator->sort(\''.$tableField['symbol'].'\','.strtoupper($tableField['symbol']).'); ?></th>').PHP_EOL;
+                       if ($displayName == 'id') {
+                               if (preg_match("/name/",$tableField['symbol'])) {
+                                       $displayName = $tableField['symbol'];
+                               }
+                       }
+               }
+               echo h(SP2."<th class=\"actions\"><?php echo ACTION; ?></th>").PHP_EOL;
+               echo h(SP1."</tr>").PHP_EOL;
+
+               echo h("<?php foreach ($".$lower_class." as $".$lower_property."): ?>").PHP_EOL;
+               echo h(SP1."<tr>").PHP_EOL;
+               foreach ($dbTable['TableField'] as $tableField) {
+               echo h(SP2."<td><?php echo h($".$lower_property."['$property']['".$tableField['symbol']."']); ?>&nbsp;</td>").PHP_EOL;
+               }       
+               echo h(SP2.'<td class="actions">').PHP_EOL;
+               echo h('<?php echo $this->Html->link(VIEW, array(\'action\' => \'view\',$'.$lower_property."['".$property."']['id'])); ?>").PHP_EOL;
+               echo h('<?php echo $this->Html->link(EDIT, array(\'action\' => \'edit\', $'.$lower_property."['".$property."']['id'])); ?>").PHP_EOL;
+               echo h('<?php echo $this->Form->postLink(DEL,array(\'action\' => \'delete\',').PHP_EOL;
+               echo h(SP3.' $'.$lower_property."['".$property."']['id']), null, __(CONFIRM,$".$lower_property. "['" .$property ."']['".$displayName."'],DEL)); ?>").PHP_EOL;
+               echo h(SP2.'</td>').PHP_EOL;
+               echo h(SP1.'</tr>').PHP_EOL;
+               echo h('<?php endforeach; ?>').PHP_EOL;
+               echo h('</table>').PHP_EOL;
+       echo h('<p>').PHP_EOL;
+           echo h('<?php').PHP_EOL;
+           echo h(SP1.'$this->Paginator->counter(array(\'format\' => PAGE_NAVI));').PHP_EOL;
+           echo h('?>  </p>').PHP_EOL;
+           
+       echo h('<div class="paging">').PHP_EOL;
+       echo h('<?php').PHP_EOL;
+        echo h(SP1.'echo $this->Paginator->prev(\'< \' . PREV, array(), null, array(\'class\' => \'prev disabled\'));').PHP_EOL;
+        echo h(SP1.'echo $this->Paginator->numbers(array(\'separator\' => \'\'));').PHP_EOL;
+        echo h(SP1.'echo $this->Paginator->next(NEXT . \' >\', array(), null, array(\'class\' => \'next disabled\'));').PHP_EOL;
+       echo h('?>').PHP_EOL; 
+       echo h('</div>').PHP_EOL;
+               echo h('</div>').PHP_EOL;
+               echo h('<div class="actions">').PHP_EOL;
+       echo h('<h3><?php echo MENU; ?></h3>').PHP_EOL;
+       echo h(SP1.'<ul>').PHP_EOL;
+        echo h(SP2.'<li><?php echo $this->Html->link('.$upper_class.'.ADD, array(\'action\' => \'add\')); ?></li>').PHP_EOL;     
+       echo h(SP1.'</ul>').PHP_EOL;
+               echo h('</div>').PHP_EOL;
+}
+
+?>
+
+</pre>
+       </div>
+<?php echo __(COPIPE_MESSAGE,"View/$className/index.ctp");?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(GO_BACK, array('action' => 'related_view'.DS.$dbTable['DbTable']['id'])); ?> </li>
+       </ul>
+</div>
diff --git a/app/View/DbTables/model.ctp b/app/View/DbTables/model.ctp
new file mode 100644 (file)
index 0000000..ae051e1
--- /dev/null
@@ -0,0 +1,73 @@
+<div class="dbTables view">
+
+<h2><?php  echo $dbTable['DbTable']['name'].MODEL; ?></h2>
+<div id="dialog">
+<?php
+$className = $names['ClassName'];
+$property = $names['Property'];
+?>
+<pre>
+<?php echo h('<?php').PHP_EOL; ?>
+App::uses('AppModel', 'Model');
+/**
+ * <?php echo $className; ?> Model
+ *
+ * @property  <?php echo $property.' $'.$property.PHP_EOL; ?>
+ */
+class <?php echo $className; ?> extends AppModel {
+<?php if ($displayField): ?>
+    /**
+     * Display field
+     *
+     * @var string
+     */
+    public $displayField = '<?php echo $displayField; ?>'; 
+<?php endif; ?>
+
+<?php if (!empty($rules)): ?>
+    /**
+     * Validation rules
+     *
+     * @var array
+     */
+<?php echo $rules; ?>
+<?php endif; ?>
+
+<?php if (!empty($belongs)): ?>
+    /**
+     * belongsTo associations
+     *
+     * @var array
+     */
+<?php echo $belongs ?>
+<?php endif; ?>
+<?php if (!empty($hasmany)): ?>
+    /**
+     * hasMany associations
+     *
+     * @var array
+     */
+<?php echo $hasmany ?>
+<?php endif; ?>
+<br>
+}
+</pre>
+</div>
+<?php 
+echo __(COPIPE_MESSAGE,"Model/$className.php"); ?>
+<p>
+また、Model/AppModel.phpに次の行を追加してください。
+<pre>
+const NOTEMPTY = '何か値が必要です';
+const NUMERIC = '数値で入力してください';
+const DATE_TYPE = '日付形式で入力してください';
+</pre>
+</p>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(GO_BACK, array('action' => 'related_view'.DS.$dbTable['DbTable']['id'])); ?> </li>
+       </ul>
+</div>
+
diff --git a/app/View/DbTables/related_add.ctp b/app/View/DbTables/related_add.ctp
new file mode 100644 (file)
index 0000000..defbf8b
--- /dev/null
@@ -0,0 +1,19 @@
+<div class="dbTables form">
+<?php echo $this->Form->create('DbTable'); ?>
+       <fieldset>
+               <legend><?php echo $dbs['Db']['db_name'].DS.DB_TABLE.ADD; ?></legend>
+       <?php
+        echo $this->Form->hidden('db_id',array('value'=>$dbs['Db']['id']));
+               echo $this->Form->input('name',array('label'=>NAME));
+               echo $this->Form->input('symbol',array('label'=>SYMBOL));
+               echo $this->Form->input('description',array('label'=>DESCRIPTION));
+       ?>
+       </fieldset>
+<?php echo $this->Form->end(SUBMIT); ?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(GO_BACK, array('controller'=>'dbs','action' => 'view',$dbs['Db']['id'])); ?></li>
+       </ul>
+</div>
diff --git a/app/View/DbTables/related_edit.ctp b/app/View/DbTables/related_edit.ctp
new file mode 100644 (file)
index 0000000..596064f
--- /dev/null
@@ -0,0 +1,20 @@
+<div class="dbTables form">
+<?php echo $this->Form->create('DbTable'); ?>
+       <fieldset>
+               <legend><?php echo $this->data['Db']['db_name'].DS.DB_TABLE.EDIT; ?></legend>
+       <?php
+               echo $this->Form->hidden('db_id',array('value'=>$this->data['Db']['id']));
+               echo $this->Form->input('id');
+               echo $this->Form->input('name',array('label'=>NAME));
+               echo $this->Form->input('symbol',array('label'=>SYMBOL));
+               echo $this->Form->input('description',array('label'=>DESCRIPTION));
+       ?>
+       </fieldset>
+<?php echo $this->Form->end(SUBMIT); ?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(GO_BACK, array('action' => 'related_view',$this->data['DbTable']['id'],$this->data['Db']['id'])); ?></li>
+       </ul>
+</div>
diff --git a/app/View/DbTables/related_view.ctp b/app/View/DbTables/related_view.ctp
new file mode 100644 (file)
index 0000000..f9ccdf1
--- /dev/null
@@ -0,0 +1,84 @@
+<div class="dbTables view">
+
+<h2><?php  echo $dbTable['DbTable']['name'].DS.DB_TABLE.VIEW; ?></h2>
+       <dl>
+               <dt><?php echo ID; ?></dt>
+               <dd>
+                       <?php echo h($dbTable['DbTable']['id']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo NAME; ?></dt>
+               <dd>
+                       <?php echo h($dbTable['DbTable']['name']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo SYMBOL; ?></dt>
+               <dd>
+                       <?php echo h($dbTable['DbTable']['symbol']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo DESCRIPTION; ?></dt>
+               <dd>
+                       <?php echo nl2br(h(trim($dbTable['DbTable']['description']))); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo CREATED; ?></dt>
+               <dd>
+                       <?php echo h($dbTable['DbTable']['created']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo MODIFIED; ?></dt>
+               <dd>
+                       <?php echo h($dbTable['DbTable']['modified']); ?>
+                       &nbsp;
+               </dd>
+       </dl>
+<div>
+<div class="related">
+    <h3><?php echo TABLE_FIELD; ?></h3>
+       <table cellpadding = "0" cellspacing = "0">
+    <tr>
+        <th><?php echo LINE_NO; ?></th>
+        <th><?php echo NAME; ?></th>
+        <th><?php echo SYMBOL; ?></th>
+        <th><?php echo FIELD_TYPE; ?></th>
+    </tr>
+<?php if (!empty($dbTable['TableField'])): ?>
+    <?php
+        foreach ($dbTable['TableField'] as $tableField): ?>
+        <tr>
+            <td><?php echo $tableField['line_no']; ?></td>
+            <td><?php echo $this->Html->link($tableField['name'], array('controller' => 'table_fields', 'action' => 'related_view',$tableField['id'])); ?></td>
+            <td><?php echo $tableField['symbol']; ?></td>
+            <td><?php echo $tableField['field_type']; ?></td>
+        </tr>
+    <?php endforeach; ?>
+<?php endif; ?>
+       </table>
+       <div class="actions">
+               <ul>
+            <li><?php echo $this->Html->link(TABLE_FIELD.ADD, array('controller' => 'table_fields', 'action' => 'related_add',$dbTable['DbTable']['id'])); ?> </li>
+        </ul>
+       </div>
+</div>
+</div>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(DB_TABLE.EDIT, array('action' => 'related_edit', $dbTable['DbTable']['id'])); ?> </li>
+               <li><?php echo $this->Form->postLink(DB_TABLE.DEL, array('action' => 'related_delete', $dbTable['DbTable']['id'],$dbTable['Db']['id']), null, __(CONFIRM, $dbTable['DbTable']['name'],DEL)); ?> </li>
+               <li><?php echo $this->Html->link(GO_BACK, array('controller'=>'dbs','action' => 'view'.DS.$dbTable['Db']['id'])); ?> </li>
+       </ul>
+
+    <h3><?php echo ACTION; ?></h3>
+    <ul>
+         <li><?php echo $this->Html->link(SCRIPT, array('action' => 'script'.DS.$dbTable['DbTable']['id'])); ?> </li>
+         <li><?php echo $this->Html->link(MODEL, array('action' => 'model'.DS.$dbTable['DbTable']['id'])); ?> </li>
+         <li><?php echo $this->Html->link(CONTROLLER, array('action' => 'create_controller'.DS.$dbTable['DbTable']['id'])); ?> </li>
+         <li><?php echo $this->Html->link(VIEW_INDEX, array('action' => 'index_view'.DS.$dbTable['DbTable']['id'])); ?> </li>
+         <li><?php echo $this->Html->link(VIEW_ADD, array('action' => 'add_view'.DS.$dbTable['DbTable']['id'])); ?> </li>
+         <li><?php echo $this->Html->link(VIEW_EDIT, array('action' => 'edit_view'.DS.$dbTable['DbTable']['id'])); ?> </li>
+         <li><?php echo $this->Html->link(VIEW_VIEW, array('action' => 'view_view'.DS.$dbTable['DbTable']['id'])); ?> </li>
+       </ul>
+</div>
diff --git a/app/View/DbTables/script.ctp b/app/View/DbTables/script.ctp
new file mode 100644 (file)
index 0000000..1a42346
--- /dev/null
@@ -0,0 +1,25 @@
+<div class="dbTables view">
+<h2><?php  echo $dbTable['DbTable']['name'].DS.DB_TABLE.SCRIPT; ?></h2>
+<div id="dialog">
+<pre>
+<?php echo h($script); ?>
+</pre>
+</div>
+<?php 
+       $tbl = h($dbTable['DbTable']['symbol']);                
+       echo __(COPIPE_MESSAGE,"$tbl.sql").PHP_EOL;
+?>
+<p>
+また、保存ディレクトリの中に移動して、コマンドラインから次のように実行してください。
+<pre>
+psql <?php echo $dbTable['Db']['db_name'].' -U '.$dbTable['Db']['db_user']." < $tbl.sql"; ?> 
+</pre>
+</p>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(GO_BACK, array('action' => 'related_view'.DS.$dbTable['DbTable']['id'])); ?> </li>
+       </ul>
+</div>
+
diff --git a/app/View/DbTables/view.ctp b/app/View/DbTables/view.ctp
new file mode 100644 (file)
index 0000000..5750b5e
--- /dev/null
@@ -0,0 +1,81 @@
+<div class="dbTables view">
+<h2><?php  echo DB_TABLE.VIEW; ?></h2>
+       <dl>
+               <dt><?php echo ID; ?></dt>
+               <dd>
+                       <?php echo h($dbTable['DbTable']['id']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo NAME; ?></dt>
+               <dd>
+                       <?php echo h($dbTable['DbTable']['name']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo SYMBOL; ?></dt>
+               <dd>
+                       <?php echo h($dbTable['DbTable']['symbol']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo DB; ?></dt>
+               <dd>
+                       <?php echo $this->Html->link($dbTable['Db']['db_name'], array('controller' => 'dbs', 'action' => 'view', $dbTable['Db']['id'])); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo DESCRIPTION; ?></dt>
+               <dd>
+                       <?php echo nl2br(h(trim($dbTable['DbTable']['description']))); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo CREATED; ?></dt>
+               <dd>
+                       <?php echo h($dbTable['DbTable']['created']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo MODIFIED; ?></dt>
+               <dd>
+                       <?php echo h($dbTable['DbTable']['modified']); ?>
+                       &nbsp;
+               </dd>
+       </dl>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(DB_TABLE.EDIT, array('action' => 'edit', $dbTable['DbTable']['id'])); ?> </li>
+               <li><?php echo $this->Form->postLink(DB_TABLE.DEL, array('action' => 'delete', $dbTable['DbTable']['id']), null, __(CONFIRM, $dbTable['DbTable']['name'],DEL)); ?> </li>
+               <li><?php echo $this->Html->link(DB_TABLE.LOOKUP, array('action' => 'index')); ?> </li>
+       </ul>
+</div>
+<div class="related">
+       <h3><?php echo RELATED_DATA; ?></h3>
+       <?php if (!empty($dbTable['TableField'])): ?>
+       <table cellpadding = "0" cellspacing = "0">
+       <tr>
+               <th><?php echo LINE_NO; ?></th>
+               <th><?php echo NAME; ?></th>
+               <th><?php echo SYMBOL; ?></th>
+               <th class="actions"><?php echo ACTION; ?></th>
+       </tr>
+       <?php
+               $i = 0;
+               foreach ($dbTable['TableField'] as $tableField): ?>
+               <tr>
+                       <td><?php echo $tableField['line_no']; ?></td>
+                       <td><?php echo $tableField['name']; ?></td>
+                       <td><?php echo $tableField['symbol']; ?></td>
+                       <td class="actions">
+                               <?php echo $this->Html->link(VIEW, array('controller' => 'table_fields', 'action' => 'view', $tableField['id'])); ?>
+                               <?php echo $this->Html->link(EDIT, array('controller' => 'table_fields', 'action' => 'edit', $tableField['id'])); ?>
+                               <?php echo $this->Form->postLink(DEL, array('controller' => 'table_fields', 'action' => 'delete', $tableField['id']), null, __(CONFIRM, $tableField['name'],DEL)); ?>
+                       </td>
+               </tr>
+       <?php endforeach; ?>
+       </table>
+<?php endif; ?>
+
+       <div class="actions">
+               <ul>
+                       <li><?php echo $this->Html->link(TABLE_FIELD.ADD, array('controller' => 'table_fields', 'action' => 'add')); ?> </li>
+               </ul>
+       </div>
+</div>
diff --git a/app/View/DbTables/view_view.ctp b/app/View/DbTables/view_view.ctp
new file mode 100644 (file)
index 0000000..2fb1d41
--- /dev/null
@@ -0,0 +1,55 @@
+<div class="dbTables view">
+<h2><?php  echo h($dbTable['DbTable']['name']).DS.VIEW_VIEW; ?></h2>
+<div>
+<pre>
+<?php
+       $displayName = 'id';
+       $lower_class = strtolower($className);
+       $upper_class = strtoupper($className);
+       $lower_property = strtolower($property);
+       $upper_property = strtoupper($property);
+       echo h("<div class=\"$lower_class view\">").PHP_EOL;
+       echo h("<h2><?php echo $upper_class.EDIT; ?></h2>").PHP_EOL;
+       echo h('<dl>').PHP_EOL;
+       $displayField = 'id';   
+       if(!empty($dbTable['TableField'])) {
+               foreach ($dbTable['TableField'] as $tableField) {
+                       echo h(SP1.'<dt><?php echo '.strtoupper($tableField['symbol']).'; ?></dt>').PHP_EOL;
+                       echo h(SP1.'<dd>').PHP_EOL;
+                       echo h(SP2.'<?php echo h($'.$lower_property.'[\''.$property.'\'][\''.$tableField['symbol'].'\']); ?>').PHP_EOL;
+                       echo h(SP2.'&nbsp;').PHP_EOL;
+                       echo h('</dd>').PHP_EOL;
+                       if (strtolower($displayField) == 'id') {
+                               if (preg_match("/name/",$tableField['symbol'])) {
+                                       $displayField = $tableField['symbol'];
+                               }
+                       }
+               }
+       }
+       echo h('<dl>').PHP_EOL;
+       echo h('</div>').PHP_EOL;
+       echo h('<div class="actions">').PHP_EOL;
+    echo h(SP1.'<h3><?php echo MENU; ?></h3>').PHP_EOL;
+    echo h(SP1.'<ul>').PHP_EOL;
+       echo h(SP2.'<li><?php echo $this->Html->link('.$upper_class.".EDIT, array('action' => 'edit',$". $lower_property."['".$property."']['id'])); ?></li>").PHP_EOL;
+       echo h(SP2.'<li><?php echo $this->Form->postLink(');
+       echo h("$upper_class.DEL,");
+       echo h("array('action' => 'delete',").PHP_EOL; 
+       echo h(SP4."$".$lower_property."['".$property."']['id']");
+       echo h('),null, __(CONFIRM,');
+       echo h("$".$lower_property."['$property']");
+       echo h("['$displayField'],DEL));?> </li>").PHP_EOL;
+       echo h(SP2.'<li><?php echo $this->Html->link('.$upper_class.".LOOKUP, array('action' => 'index')); ?></li>").PHP_EOL;
+    echo h(SP1.'</ul>').PHP_EOL;
+       echo h('</div>').PHP_EOL;
+?>
+</pre>
+       </div>
+<?php echo __(COPIPE_MESSAGE,"View/$className/view.ctp");?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(GO_BACK, array('action' => 'related_view'.DS.$dbTable['DbTable']['id'])); ?> </li>
+       </ul>
+</div>
diff --git a/app/View/Dbs/add.ctp b/app/View/Dbs/add.ctp
new file mode 100644 (file)
index 0000000..506a7be
--- /dev/null
@@ -0,0 +1,21 @@
+<div class="dbs form">
+<?php echo $this->Form->create('Db'); ?>
+       <fieldset>
+               <legend><?php echo DB.ADD; ?></legend>
+       <?php
+               echo $this->Form->input('db_name',array('label'=>DB_NAME));
+               echo $this->Form->input('db_host',array('label'=>DB_HOST));
+               echo $this->Form->input('db_port',array('label'=>DB_PORT));
+               echo $this->Form->input('db_user',array('label'=>DB_USER));
+               echo $this->Form->input('db_password',array('label'=>DB_PASSWORD));
+       ?>
+       </fieldset>
+<?php echo $this->Form->end(SUBMIT); ?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+
+               <li><?php echo $this->Html->link(DB.LOOKUP, array('action' => 'index')); ?></li>
+       </ul>
+</div>
diff --git a/app/View/Dbs/constant.ctp b/app/View/Dbs/constant.ctp
new file mode 100644 (file)
index 0000000..6fe8705
--- /dev/null
@@ -0,0 +1,27 @@
+<div class="dbs view">
+<h2><?php  echo DB.CONSTANT; ?></h2>
+
+<div id="dialog">
+<pre>
+<?php 
+echo h("<?php\n");
+foreach ($const as $key=>$value) {
+       echo "const $key = '$value';\n";
+}
+?>
+</pre>
+</div>
+<?php echo __(COPIPE_MESSAGE,'Config/const.php'); ?>
+<br/>
+また、Config/bootstrap.phpに次の記述を末尾に追加してください。
+<pre>
+config('const');
+</pre>
+
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(GO_BACK, array('action' => 'view'.DS.$id)); ?> </li>
+       </ul>
+</div>
diff --git a/app/View/Dbs/edit.ctp b/app/View/Dbs/edit.ctp
new file mode 100644 (file)
index 0000000..7f6511d
--- /dev/null
@@ -0,0 +1,21 @@
+<div class="dbs form">
+<?php echo $this->Form->create('Db'); ?>
+       <fieldset>
+               <legend><?php echo DB.EDIT; ?></legend>
+       <?php
+               echo $this->Form->input('id');
+               echo $this->Form->input('db_name',array('label'=>DB_NAME));
+               echo $this->Form->input('db_host',array('label'=>DB_HOST));
+               echo $this->Form->input('db_port',array('label'=>DB_PORT));
+               echo $this->Form->input('db_user',array('label'=>DB_USER));
+               echo $this->Form->input('db_password',array('label'=>DB_PASSWORD));
+       ?>
+       </fieldset>
+<?php echo $this->Form->end(SUBMIT); ?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(DB.LOOKUP, array('action' => 'index')); ?></li>
+       </ul>
+</div>
diff --git a/app/View/Dbs/index.ctp b/app/View/Dbs/index.ctp
new file mode 100644 (file)
index 0000000..b853cfd
--- /dev/null
@@ -0,0 +1,45 @@
+<div class="dbs index">
+       <h2><?php echo DB.LOOKUP; ?></h2>
+       <table cellpadding="0" cellspacing="0">
+       <tr>
+                       <th><?php echo $this->Paginator->sort('id',ID); ?></th>
+                       <th><?php echo $this->Paginator->sort('db_name',NAME); ?></th>
+                       <th><?php echo $this->Paginator->sort('db_host',DB_HOST); ?></th>
+                       <th class="actions"><?php echo ACTION; ?></th>
+       </tr>
+       <?php
+       foreach ($dbs as $db): ?>
+       <tr>
+               <td><?php echo h($db['Db']['id']); ?>&nbsp;</td>
+               <td><?php echo h($db['Db']['db_name']); ?>&nbsp;</td>
+               <td><?php echo h($db['Db']['db_host']); ?>&nbsp;</td>
+               <td class="actions">
+                       <?php echo $this->Html->link(VIEW, array('action' => 'view', $db['Db']['id'])); ?>
+                       <?php echo $this->Html->link(EDIT, array('action' => 'edit', $db['Db']['id'])); ?>
+                       <?php echo $this->Form->postLink(DEL, array('action' => 'delete', $db['Db']['id']), null, __(CONFIRM, $db['Db']['db_name'],DEL)); ?>
+               </td>
+       </tr>
+<?php endforeach; ?>
+       </table>
+       <p>
+       <?php
+       echo $this->Paginator->counter(array(
+       'format' => PAGE_NAVI
+       ));
+       ?>      </p>
+
+       <div class="paging">
+       <?php
+               echo $this->Paginator->prev('< ' . PREV, array(), null, array('class' => 'prev disabled'));
+               echo $this->Paginator->numbers(array('separator' => ''));
+               echo $this->Paginator->next(NEXT . ' >', array(), null, array('class' => 'next disabled'));
+       ?>
+       </div>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(DB.ADD, array('action' => 'add')); ?></li>
+        <li><?php echo $this->Html->link(TOP, array('controller'=>'site','action' => 'index')); ?></li>
+    </ul>
+</div>
diff --git a/app/View/Dbs/output.ctp b/app/View/Dbs/output.ctp
new file mode 100644 (file)
index 0000000..95cc52e
--- /dev/null
@@ -0,0 +1,3 @@
+(ダミー)
+出力しました.
+
diff --git a/app/View/Dbs/script.ctp b/app/View/Dbs/script.ctp
new file mode 100644 (file)
index 0000000..641c5c3
--- /dev/null
@@ -0,0 +1,20 @@
+<div class="dbs view">
+<h2><?php  echo DB.SCRIPT; ?></h2>
+
+
+<div id="dialog">
+<pre>
+<?php 
+echo h($script); 
+?>
+</pre>
+</div>
+<?php echo __(COPIPE_MESSAGE,'Config/database.php'); ?>
+
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(GO_BACK, array('action' => 'view', $id)); ?> </li>
+       </ul>
+</div>
diff --git a/app/View/Dbs/sql.ctp b/app/View/Dbs/sql.ctp
new file mode 100644 (file)
index 0000000..2c6ec42
--- /dev/null
@@ -0,0 +1,20 @@
+<div class="dbs view">
+<h2><?php  echo SQL.SCRIPT; ?></h2>
+
+
+<div id="dialog">
+<pre>
+<?php 
+echo h($script); 
+?>
+</pre>
+</div>
+<?php echo __(COPIPE_MESSAGE,'create.sql'); ?>
+
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(GO_BACK, array('action' => 'view', $id)); ?> </li>
+       </ul>
+</div>
diff --git a/app/View/Dbs/test.ctp b/app/View/Dbs/test.ctp
new file mode 100644 (file)
index 0000000..b7ef71c
--- /dev/null
@@ -0,0 +1,31 @@
+<?php 
+//App::import('Vendor','xtcpdf');  
+//$tcpdf = new XTCPDF(); 
+
+echo "A";
+/*
+$textfont = 'freesans'; // 見た目もいいし、きれいで、「dejavusans」よりスリムです。 
+//日本語フォントの指定についてはこの記事の末尾を参照してください。
+$tcpdf->SetAuthor("KBS Homes & Properties at http://kbs-properties.com"); 
+$tcpdf->SetAutoPageBreak( false ); 
+$tcpdf->setHeaderFont(array($textfont,'',40)); 
+$tcpdf->xheadercolor = array(150,0,0); 
+$tcpdf->xheadertext = 'KBS Homes & Properties'; 
+$tcpdf->xfootertext = 'Copyright Â© %d KBS Homes & Properties. All rights reserved.'; 
+// ページを追加(最近のバージョンのtcpdfで必要になった)
+$tcpdf->AddPage(); 
+// ページの内容の位置を決めプリントする。
+// 例:
+$tcpdf->SetTextColor(0, 0, 0); 
+$tcpdf->SetFont($textfont,'B',20); 
+$tcpdf->Cell(0,14, "Hello World", 0,1,'L'); 
+// ... 
+// など。
+// TCPDF の例を参照。
+echo $tcpdf->Output('filename.pdf', 'D'); 
+ */
+?>
diff --git a/app/View/Dbs/view.ctp b/app/View/Dbs/view.ctp
new file mode 100644 (file)
index 0000000..86d5cb7
--- /dev/null
@@ -0,0 +1,91 @@
+<div class="dbs view">
+<h2><?php  echo DB; ?></h2>
+       <dl>
+               <dt><?php echo ID; ?></dt>
+               <dd>
+                       <?php echo h($db['Db']['id']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo DB_NAME; ?></dt>
+               <dd>
+                       <?php echo h($db['Db']['db_name']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo DB_HOST; ?></dt>
+               <dd>
+                       <?php echo h($db['Db']['db_host']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo DB_PORT; ?></dt>
+               <dd>
+                       <?php echo h($db['Db']['db_port']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo DB_USER; ?></dt>
+               <dd>
+                       <?php echo h($db['Db']['db_user']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo DB_PASSWORD; ?></dt>
+               <dd>
+                       <?php echo h($db['Db']['db_password']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo CREATED; ?></dt>
+               <dd>
+                       <?php echo h($db['Db']['created']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo MODIFIED; ?></dt>
+               <dd>
+                       <?php echo h($db['Db']['modified']); ?>
+                       &nbsp;
+               </dd>
+       </dl>
+<div class="related">
+       <h3><?php echo DB_TABLE; ?></h3>
+       <?php if (!empty($db['DbTable'])): ?>
+       <table cellpadding = "0" cellspacing = "0">
+       <tr>
+               <th><?php echo ID; ?></th>
+               <th><?php echo NAME; ?></th>
+               <th><?php echo SYMBOL; ?></th>
+       </tr>
+       <?php
+               $i = 0;
+               foreach ($db['DbTable'] as $dbTable): ?>
+               <tr>
+                       <td><?php echo $dbTable['id']; ?></td>
+                       <td><?php 
+                       echo $this->Html->link($dbTable['name'], array('controller' => 'db_tables', 'action' => 'related_view', $dbTable['id'],$db['Db']['id'])); 
+                       ?></td>
+                       <td><?php echo $dbTable['symbol']; ?></td>
+               </tr>
+       <?php endforeach; ?>
+       </table>
+<?php endif; ?>
+
+       <div class="actions">
+               <ul>
+                       <li><?php echo $this->Html->link(DB_TABLE.ADD, array('controller' => 'db_tables', 'action' => 'related_add',$db['Db']['id'])); ?> </li>
+               </ul>
+       </div>
+</div>
+</div>
+<div class="actions">
+    <h3><?php echo MENU; ?></h3>
+    <ul>
+        <li><?php echo $this->Html->link(DB.EDIT, array('action' => 'edit', $db['Db']['id'])); ?> </li>
+        <li><?php echo $this->Form->postLink(DB.DEL, array('action' => 'delete', $db['Db']['id']), null, __(CONFIRM, $db['Db']['db_name'],DEL)); ?> </li>
+        <li><?php echo $this->Html->link(DB.LOOKUP, array('action' => 'index')); ?> </li>
+    </ul>
+    <h3><?php echo ACTION; ?></h3>
+    <ul>
+         <li><?php echo $this->Html->link(SCRIPT, array('action' => 'script', $db['Db']['id'])); ?> </li>
+        <li><?php echo $this->Html->link(CONSTANT, array('action' => 'constant', $db['Db']['id'])); ?> </li>
+        <li><?php echo $this->Html->link(SQL, array('action' => 'sql', $db['Db']['id'])); ?> </li>
+
+        <li><?php echo $this->Html->link(OUTPUT, array('action' => 'output', $db['Db']['id'])); ?> </li>
+    </ul>
+</div>
+
diff --git a/app/View/Elements/empty b/app/View/Elements/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/View/Emails/html/default.ctp b/app/View/Emails/html/default.ctp
new file mode 100644 (file)
index 0000000..0eb7f57
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+/**
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       Cake.View.Emails.html
+ * @since         CakePHP(tm) v 0.10.0.1076
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<?php
+$content = explode("\n", $content);
+
+foreach ($content as $line):
+       echo '<p> ' . $line . "</p>\n";
+endforeach;
+?>
\ No newline at end of file
diff --git a/app/View/Emails/text/default.ctp b/app/View/Emails/text/default.ctp
new file mode 100644 (file)
index 0000000..56be8c1
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+/**
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       Cake.View.Emails.text
+ * @since         CakePHP(tm) v 0.10.0.1076
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<?php echo $content; ?>
\ No newline at end of file
diff --git a/app/View/Errors/error400.ctp b/app/View/Errors/error400.ctp
new file mode 100644 (file)
index 0000000..6d50860
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+/**
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       Cake.View.Errors
+ * @since         CakePHP(tm) v 0.10.0.1076
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<h2><?php echo $name; ?></h2>
+<p class="error">
+       <strong><?php echo __d('cake', 'Error'); ?>: </strong>
+       <?php printf(
+               __d('cake', 'The requested address %s was not found on this server.'),
+               "<strong>'{$url}'</strong>"
+       ); ?>
+</p>
+<?php
+if (Configure::read('debug') > 0 ):
+       echo $this->element('exception_stack_trace');
+endif;
+?>
diff --git a/app/View/Errors/error500.ctp b/app/View/Errors/error500.ctp
new file mode 100644 (file)
index 0000000..4e1f36e
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       Cake.View.Errors
+ * @since         CakePHP(tm) v 0.10.0.1076
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<h2><?php echo $name; ?></h2>
+<p class="error">
+       <strong><?php echo __d('cake', 'Error'); ?>: </strong>
+       <?php echo __d('cake', 'An Internal Error Has Occurred.'); ?>
+</p>
+<?php
+if (Configure::read('debug') > 0 ):
+       echo $this->element('exception_stack_trace');
+endif;
+?>
diff --git a/app/View/Helper/AppHelper.php b/app/View/Helper/AppHelper.php
new file mode 100644 (file)
index 0000000..0fddaea
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Application level View Helper
+ *
+ * This file is application-wide helper file. You can put all
+ * application-wide helper-related methods here.
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       app.View.Helper
+ * @since         CakePHP(tm) v 0.2.9
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+App::uses('Helper', 'View');
+
+/**
+ * Application helper
+ *
+ * Add your application-wide methods in the class below, your helpers
+ * will inherit them.
+ *
+ * @package       app.View.Helper
+ */
+class AppHelper extends Helper {
+}
diff --git a/app/View/Layouts/Emails/html/default.ctp b/app/View/Layouts/Emails/html/default.ctp
new file mode 100644 (file)
index 0000000..e574a9b
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+/**
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       Cake.View.Layouts.Emails.html
+ * @since         CakePHP(tm) v 0.10.0.1076
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<html>
+<head>
+       <title><?php echo $title_for_layout;?></title>
+</head>
+<body>
+       <?php echo $this->fetch('content');?>
+
+       <p>This email was sent using the <a href="http://cakephp.org">CakePHP Framework</a></p>
+</body>
+</html>
\ No newline at end of file
diff --git a/app/View/Layouts/Emails/text/default.ctp b/app/View/Layouts/Emails/text/default.ctp
new file mode 100644 (file)
index 0000000..c2a683a
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+/**
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       Cake.View.Layouts.Emails.text
+ * @since         CakePHP(tm) v 0.10.0.1076
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<?php echo $this->fetch('content');?>
+
+This email was sent using the CakePHP Framework, http://cakephp.org.
diff --git a/app/View/Layouts/ajax.ctp b/app/View/Layouts/ajax.ctp
new file mode 100644 (file)
index 0000000..c0da850
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+/**
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       Cake.View.Layouts
+ * @since         CakePHP(tm) v 0.10.0.1076
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<?php echo $this->fetch('content'); ?>
diff --git a/app/View/Layouts/default.ctp b/app/View/Layouts/default.ctp
new file mode 100644 (file)
index 0000000..25647dc
--- /dev/null
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html lang="ja">
+
+<head>
+<?php echo $this->Html->charset(); ?>
+<title>
+<?php echo APP_TITLE; ?>:
+</title>
+<?php
+echo $this->Html->meta('icon');
+
+echo $this->Html->css('exmascake');
+echo $this->Html->css('jquery-ui-1.9.2.custom');
+
+echo $this->fetch('meta');
+echo $this->fetch('css');
+echo $this->fetch('script');
+echo $this->Html->script('jquery-1.8.3');
+echo $this->Html->script('jquery-ui-1.9.2.custom');
+
+?>
+</head>
+<body>
+<div id="container">
+<div id="header">
+<center><?php echo $this->Html->image("exmascake_logo.png"); ?></center>
+<center><h3>(eXpress Method Appearance System for CakePHP)</h3></center>
+</div>
+<div id="content">
+<hr/>
+
+<?php echo $this->Session->flash(); ?>
+
+<?php echo $this->fetch('content'); ?>
+
+</div>
+<div id="footer">
+<hr />
+
+<?php 
+       echo 'Copyright 2012 NPUCC. All rights reserved.';
+?>
+</div>
+</div>
+<?php //echo $this->element('sql_dump'); ?>
+</body>
+</html>
+
diff --git a/app/View/Layouts/error.ctp b/app/View/Layouts/error.ctp
new file mode 100644 (file)
index 0000000..4947734
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+/**
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       Cake.View.Layouts
+ * @since         CakePHP(tm) v 0.10.0.1076
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+$cakeDescription = __d('cake_dev', 'CakePHP: the rapid development php framework');
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+       <?php echo $this->Html->charset(); ?>
+       <title>
+               <?php echo $cakeDescription ?>:
+               <?php echo $title_for_layout; ?>
+       </title>
+       <?php
+               echo $this->Html->meta('icon');
+
+               echo $this->Html->css('cake.generic');
+
+               echo $this->fetch('meta');
+               echo $this->fetch('css');
+               echo $this->fetch('script');
+       ?>
+</head>
+<body>
+       <div id="container">
+               <div id="header">
+                       <h1><?php echo $this->Html->link($cakeDescription, 'http://cakephp.org'); ?></h1>
+               </div>
+               <div id="content">
+
+                       <?php echo $this->Session->flash(); ?>
+
+                       <?php echo $this->fetch('content'); ?>
+               </div>
+               <div id="footer">
+                       <?php echo $this->Html->link(
+                                       $this->Html->image('cake.power.gif', array('alt' => $cakeDescription, 'border' => '0')),
+                                       'http://www.cakephp.org/',
+                                       array('target' => '_blank', 'escape' => false)
+                               );
+                       ?>
+               </div>
+       </div>
+       <?php echo $this->element('sql_dump'); ?>
+</body>
+</html>
diff --git a/app/View/Layouts/flash.ctp b/app/View/Layouts/flash.ctp
new file mode 100644 (file)
index 0000000..76fae34
--- /dev/null
@@ -0,0 +1,37 @@
+<?php
+/**
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       Cake.View.Layouts
+ * @since         CakePHP(tm) v 0.10.0.1076
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<?php echo $this->Html->charset(); ?>
+<title><?php echo $page_title; ?></title>
+
+<?php if (Configure::read('debug') == 0) { ?>
+<meta http-equiv="Refresh" content="<?php echo $pause; ?>;url=<?php echo $url; ?>"/>
+<?php } ?>
+<style><!--
+P { text-align:center; font:bold 1.1em sans-serif }
+A { color:#444; text-decoration:none }
+A:HOVER { text-decoration: underline; color:#44E }
+--></style>
+</head>
+<body>
+<p><a href="<?php echo $url; ?>"><?php echo $message; ?></a></p>
+</body>
+</html>
\ No newline at end of file
diff --git a/app/View/Layouts/js/default.ctp b/app/View/Layouts/js/default.ctp
new file mode 100644 (file)
index 0000000..7239b5d
--- /dev/null
@@ -0,0 +1,2 @@
+<?php echo $scripts_for_layout; ?>
+<script type="text/javascript"><?php echo $this->fetch('content'); ?></script>
diff --git a/app/View/Layouts/pdf.ctp b/app/View/Layouts/pdf.ctp
new file mode 100644 (file)
index 0000000..392a13c
--- /dev/null
@@ -0,0 +1,4 @@
+<?php 
+header("Content-type: application/pdf"); 
+echo $content_for_layout; 
+?>
diff --git a/app/View/Layouts/rss/default.ctp b/app/View/Layouts/rss/default.ctp
new file mode 100644 (file)
index 0000000..077de61
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+if (!isset($channel)) {
+       $channel = array();
+}
+if (!isset($channel['title'])) {
+       $channel['title'] = $title_for_layout;
+}
+
+echo $this->Rss->document(
+       $this->Rss->channel(
+               array(), $channel, $this->fetch('content')
+       )
+);
+?>
diff --git a/app/View/Layouts/xml/default.ctp b/app/View/Layouts/xml/default.ctp
new file mode 100644 (file)
index 0000000..fbd5ee0
--- /dev/null
@@ -0,0 +1 @@
+<?php echo $this->fetch('content'); ?>
diff --git a/app/View/Pages/home.ctp b/app/View/Pages/home.ctp
new file mode 100644 (file)
index 0000000..9a22923
--- /dev/null
@@ -0,0 +1,188 @@
+<?php
+/**
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       Cake.View.Pages
+ * @since         CakePHP(tm) v 0.10.0.1076
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+if (Configure::read('debug') == 0):
+       throw new NotFoundException();
+endif;
+App::uses('Debugger', 'Utility');
+?>
+<iframe src="http://cakephp.org/bake-banner" width="830" height="160" style="overflow:hidden; border:none;">
+       <p>For updates and important announcements, visit http://cakefest.org</p>
+</iframe>
+<h2><?php echo __d('cake_dev', 'Release Notes for CakePHP %s.', Configure::version()); ?></h2>
+<a href="http://cakephp.org/changelogs/<?php echo Configure::version(); ?>"><?php echo __d('cake_dev', 'Read the changelog'); ?> </a>
+<?php
+if (Configure::read('debug') > 0):
+       Debugger::checkSecurityKeys();
+endif;
+?>
+<p id="url-rewriting-warning" style="background-color:#e32; color:#fff;">
+       <?php echo __d('cake_dev', 'URL rewriting is not properly configured on your server.'); ?>
+       1) <a target="_blank" href="http://book.cakephp.org/2.0/en/installation/advanced-installation.html#apache-and-mod-rewrite-and-htaccess" style="color:#fff;">Help me configure it</a>
+       2) <a target="_blank" href="http://book.cakephp.org/2.0/en/development/configuration.html#cakephp-core-configuration" style="color:#fff;">I don't / can't use URL rewriting</a>
+</p>
+<p>
+<?php
+       if (version_compare(PHP_VERSION, '5.2.8', '>=')):
+               echo '<span class="notice success">';
+                       echo __d('cake_dev', 'Your version of PHP is 5.2.8 or higher.');
+               echo '</span>';
+       else:
+               echo '<span class="notice">';
+                       echo __d('cake_dev', 'Your version of PHP is too low. You need PHP 5.2.8 or higher to use CakePHP.');
+               echo '</span>';
+       endif;
+?>
+</p>
+<p>
+       <?php
+               if (is_writable(TMP)):
+                       echo '<span class="notice success">';
+                               echo __d('cake_dev', 'Your tmp directory is writable.');
+                       echo '</span>';
+               else:
+                       echo '<span class="notice">';
+                               echo __d('cake_dev', 'Your tmp directory is NOT writable.');
+                       echo '</span>';
+               endif;
+       ?>
+</p>
+<p>
+       <?php
+               $settings = Cache::settings();
+               if (!empty($settings)):
+                       echo '<span class="notice success">';
+                               echo __d('cake_dev', 'The %s is being used for core caching. To change the config edit APP/Config/core.php ', '<em>'. $settings['engine'] . 'Engine</em>');
+                       echo '</span>';
+               else:
+                       echo '<span class="notice">';
+                               echo __d('cake_dev', 'Your cache is NOT working. Please check the settings in APP/Config/core.php');
+                       echo '</span>';
+               endif;
+       ?>
+</p>
+<p>
+       <?php
+               $filePresent = null;
+               if (file_exists(APP . 'Config' . DS . 'database.php')):
+                       echo '<span class="notice success">';
+                               echo __d('cake_dev', 'Your database configuration file is present.');
+                               $filePresent = true;
+                       echo '</span>';
+               else:
+                       echo '<span class="notice">';
+                               echo __d('cake_dev', 'Your database configuration file is NOT present.');
+                               echo '<br/>';
+                               echo __d('cake_dev', 'Rename APP/Config/database.php.default to APP/Config/database.php');
+                       echo '</span>';
+               endif;
+       ?>
+</p>
+<?php
+if (isset($filePresent)):
+       App::uses('ConnectionManager', 'Model');
+       try {
+               $connected = ConnectionManager::getDataSource('default');
+       } catch (Exception $connectionError) {
+               $connected = false;
+       }
+?>
+<p>
+       <?php
+               if ($connected && $connected->isConnected()):
+                       echo '<span class="notice success">';
+                               echo __d('cake_dev', 'Cake is able to connect to the database.');
+                       echo '</span>';
+               else:
+                       echo '<span class="notice">';
+                               echo __d('cake_dev', 'Cake is NOT able to connect to the database.');
+                               echo '<br /><br />';
+                               echo $connectionError->getMessage();
+                       echo '</span>';
+               endif;
+       ?>
+</p>
+<?php endif;?>
+<?php
+       App::uses('Validation', 'Utility');
+       if (!Validation::alphaNumeric('cakephp')) {
+               echo '<p><span class="notice">';
+                       echo __d('cake_dev', 'PCRE has not been compiled with Unicode support.');
+                       echo '<br/>';
+                       echo __d('cake_dev', 'Recompile PCRE with Unicode support by adding <code>--enable-unicode-properties</code> when configuring');
+               echo '</span></p>';
+       }
+?>
+<h3><?php echo __d('cake_dev', 'Editing this Page'); ?></h3>
+<p>
+<?php
+echo __d('cake_dev', 'To change the content of this page, edit: APP/View/Pages/home.ctp.<br />
+To change its layout, edit: APP/View/Layouts/default.ctp.<br />
+You can also add some CSS styles for your pages at: APP/webroot/css.');
+?>
+</p>
+
+<h3><?php echo __d('cake_dev', 'Getting Started'); ?></h3>
+<p>
+       <?php
+               echo $this->Html->link(
+                       sprintf('<strong>%s</strong> %s', __d('cake_dev', 'New'), __d('cake_dev', 'CakePHP 2.0 Docs')),
+                       'http://book.cakephp.org/2.0/en/',
+                       array('target' => '_blank', 'escape' => false)
+               );
+       ?>
+</p>
+<p>
+       <?php
+               echo $this->Html->link(
+                       __d('cake_dev', 'The 15 min Blog Tutorial'),
+                       'http://book.cakephp.org/2.0/en/tutorials-and-examples/blog/blog.html',
+                       array('target' => '_blank', 'escape' => false)
+               );
+       ?>
+</p>
+
+<h3><?php echo __d('cake_dev', 'More about Cake'); ?></h3>
+<p>
+<?php echo __d('cake_dev', 'CakePHP is a rapid development framework for PHP which uses commonly known design patterns like Active Record, Association Data Mapping, Front Controller and MVC.'); ?>
+</p>
+<p>
+<?php echo __d('cake_dev', 'Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility.'); ?>
+</p>
+
+<ul>
+       <li><a href="http://cakefoundation.org/"><?php echo __d('cake_dev', 'Cake Software Foundation'); ?> </a>
+       <ul><li><?php echo __d('cake_dev', 'Promoting development related to CakePHP'); ?></li></ul></li>
+       <li><a href="http://www.cakephp.org"><?php echo __d('cake_dev', 'CakePHP'); ?> </a>
+       <ul><li><?php echo __d('cake_dev', 'The Rapid Development Framework'); ?></li></ul></li>
+       <li><a href="http://book.cakephp.org"><?php echo __d('cake_dev', 'CakePHP Documentation'); ?> </a>
+       <ul><li><?php echo __d('cake_dev', 'Your Rapid Development Cookbook'); ?></li></ul></li>
+       <li><a href="http://api20.cakephp.org"><?php echo __d('cake_dev', 'CakePHP API'); ?> </a>
+       <ul><li><?php echo __d('cake_dev', 'Quick Reference'); ?></li></ul></li>
+       <li><a href="http://bakery.cakephp.org"><?php echo __d('cake_dev', 'The Bakery'); ?> </a>
+       <ul><li><?php echo __d('cake_dev', 'Everything CakePHP'); ?></li></ul></li>
+       <li><a href="http://live.cakephp.org"><?php echo __d('cake_dev', 'The Show'); ?> </a>
+       <ul><li><?php echo __d('cake_dev', 'The Show is a live and archived internet radio broadcast CakePHP-related topics and answer questions live via IRC, Skype, and telephone.'); ?></li></ul></li>
+       <li><a href="http://groups.google.com/group/cake-php"><?php echo __d('cake_dev', 'CakePHP Google Group'); ?> </a>
+       <ul><li><?php echo __d('cake_dev', 'Community mailing list'); ?></li></ul></li>
+       <li><a href="irc://irc.freenode.net/cakephp">irc.freenode.net #cakephp</a>
+       <ul><li><?php echo __d('cake_dev', 'Live chat about CakePHP'); ?></li></ul></li>
+       <li><a href="http://github.com/cakephp/"><?php echo __d('cake_dev', 'CakePHP Code'); ?> </a>
+       <ul><li><?php echo __d('cake_dev', 'For the Development of CakePHP Git repository, Downloads'); ?></li></ul></li>
+       <li><a href="http://cakephp.lighthouseapp.com/"><?php echo __d('cake_dev', 'CakePHP Lighthouse'); ?> </a>
+       <ul><li><?php echo __d('cake_dev', 'CakePHP Tickets, Wiki pages, Roadmap'); ?></li></ul></li>
+</ul>
diff --git a/app/View/Projects/add.ctp b/app/View/Projects/add.ctp
new file mode 100644 (file)
index 0000000..bf2df5f
--- /dev/null
@@ -0,0 +1,19 @@
+<div class="projects form">
+<?php echo $this->Form->create('Project'); ?>
+       <fieldset>
+               <legend><?php echo PROJECT.ADD; ?></legend>
+       <?php
+               echo $this->Form->input('name',array('label'=>NAME));
+               echo $this->Form->input('status',array('label'=>STATUS,'type'=>'select','options'=>$status));
+               echo $this->Form->input('description',array('label'=>DESCRIPTION));
+       ?>
+       </fieldset>
+<?php echo $this->Form->end(SUBMIT); ?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+
+               <li><?php echo $this->Html->link(PROJECT.LOOKUP, array('action' => 'index')); ?></li>
+       </ul>
+</div>
diff --git a/app/View/Projects/backup/index.ctp b/app/View/Projects/backup/index.ctp
new file mode 100644 (file)
index 0000000..5736e5b
--- /dev/null
@@ -0,0 +1,45 @@
+<div class="projects index">
+       <h2><?php echo PROJECT.LOOKUP; ?></h2>
+       <table cellpadding="0" cellspacing="0">
+       <tr>
+                       <th><?php echo $this->Paginator->sort('id',ID); ?></th>
+                       <th><?php echo $this->Paginator->sort('name',NAME); ?></th>
+                       <th><?php echo $this->Paginator->sort('status',STATUS); ?></th>
+                       <th class="actions"><?php echo ACTION; ?></th>
+       </tr>
+       <?php
+       foreach ($projects as $project): ?>
+       <tr>
+               <td><?php echo h($project['Project']['id']); ?>&nbsp;</td>
+               <td><?php echo h($project['Project']['name']); ?>&nbsp;</td>
+               <td><?php echo h($status[$project['Project']['status']]); ?>&nbsp;</td>
+               <td class="actions">
+                       <?php echo $this->Html->link(VIEW, array('action' => 'view', $project['Project']['id'])); ?>
+                       <?php echo $this->Html->link(EDIT, array('action' => 'edit', $project['Project']['id'])); ?>
+                       <?php echo $this->Form->postLink(DEL, array('action' => 'delete', $project['Project']['id']), null, __(CONFIRM, $project['Project']['name'],DEL)); ?>
+               </td>
+       </tr>
+<?php endforeach; ?>
+       </table>
+       <p>
+       <?php
+       echo $this->Paginator->counter(array(
+       'format' => PAGE_NAVI 
+       ));
+       ?>      </p>
+
+       <div class="paging">
+       <?php
+               echo $this->Paginator->prev('< ' . PREV, array(), null, array('class' => 'prev disabled'));
+               echo $this->Paginator->numbers(array('separator' => ''));
+               echo $this->Paginator->next(NEXT . ' >', array(), null, array('class' => 'next disabled'));
+       ?>
+       </div>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(PROJECT.ADD, array('action' => 'add')); ?></li>
+        <li><?php echo $this->Html->link(TOP, array('controller'=>'site','action' => 'index')); ?></li>
+    </ul>
+</div>
diff --git a/app/View/Projects/backup/view.ctp b/app/View/Projects/backup/view.ctp
new file mode 100644 (file)
index 0000000..dec683c
--- /dev/null
@@ -0,0 +1,43 @@
+<div class="projects view">
+<h2><?php  echo PROJECT.VIEW; ?></h2>
+       <dl>
+               <dt><?php echo ID; ?></dt>
+               <dd>
+                       <?php echo h($project['Project']['id']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo NAME; ?></dt>
+               <dd>
+                       <?php echo h($project['Project']['name']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo STATUS; ?></dt>
+               <dd>
+                       <?php echo h($status[$project['Project']['status']]); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo DESCRIPTION; ?></dt>
+               <dd>
+                       <?php echo nl2br(h(trim($project['Project']['description']))); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo CREATED; ?></dt>
+               <dd>
+                       <?php echo h($project['Project']['created']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo MODIFIED; ?></dt>
+               <dd>
+                       <?php echo h($project['Project']['modified']); ?>
+                       &nbsp;
+               </dd>
+       </dl>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(PROJECT.EDIT, array('action' => 'edit', $project['Project']['id'])); ?> </li>
+               <li><?php echo $this->Form->postLink(PROJECT.DEL, array('action' => 'delete', $project['Project']['id']), null, __(CONFIRM, $project['Project']['name'],DEL)); ?> </li>
+               <li><?php echo $this->Html->link(PROJECT.LOOKUP, array('action' => 'index')); ?> </li>
+       </ul>
+</div>
diff --git a/app/View/Projects/edit.ctp b/app/View/Projects/edit.ctp
new file mode 100644 (file)
index 0000000..27e80bf
--- /dev/null
@@ -0,0 +1,19 @@
+<div class="projects form">
+<?php echo $this->Form->create('Project'); ?>
+       <fieldset>
+               <legend><?php echo PROJECT.EDIT; ?></legend>
+       <?php
+               echo $this->Form->input('id');
+               echo $this->Form->input('name',array('label'=>NAME));
+               echo $this->Form->input('status',array('label'=>STATUS,'type'=>'select','options'=>$status));
+               echo $this->Form->input('description',array('label'=>DESCRIPTION));
+       ?>
+       </fieldset>
+<?php echo $this->Form->end(SUBMIT); ?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(PROJECT.LOOKUP, array('action' => 'index')); ?></li>
+       </ul>
+</div>
diff --git a/app/View/Projects/index.ctp b/app/View/Projects/index.ctp
new file mode 100644 (file)
index 0000000..5736e5b
--- /dev/null
@@ -0,0 +1,45 @@
+<div class="projects index">
+       <h2><?php echo PROJECT.LOOKUP; ?></h2>
+       <table cellpadding="0" cellspacing="0">
+       <tr>
+                       <th><?php echo $this->Paginator->sort('id',ID); ?></th>
+                       <th><?php echo $this->Paginator->sort('name',NAME); ?></th>
+                       <th><?php echo $this->Paginator->sort('status',STATUS); ?></th>
+                       <th class="actions"><?php echo ACTION; ?></th>
+       </tr>
+       <?php
+       foreach ($projects as $project): ?>
+       <tr>
+               <td><?php echo h($project['Project']['id']); ?>&nbsp;</td>
+               <td><?php echo h($project['Project']['name']); ?>&nbsp;</td>
+               <td><?php echo h($status[$project['Project']['status']]); ?>&nbsp;</td>
+               <td class="actions">
+                       <?php echo $this->Html->link(VIEW, array('action' => 'view', $project['Project']['id'])); ?>
+                       <?php echo $this->Html->link(EDIT, array('action' => 'edit', $project['Project']['id'])); ?>
+                       <?php echo $this->Form->postLink(DEL, array('action' => 'delete', $project['Project']['id']), null, __(CONFIRM, $project['Project']['name'],DEL)); ?>
+               </td>
+       </tr>
+<?php endforeach; ?>
+       </table>
+       <p>
+       <?php
+       echo $this->Paginator->counter(array(
+       'format' => PAGE_NAVI 
+       ));
+       ?>      </p>
+
+       <div class="paging">
+       <?php
+               echo $this->Paginator->prev('< ' . PREV, array(), null, array('class' => 'prev disabled'));
+               echo $this->Paginator->numbers(array('separator' => ''));
+               echo $this->Paginator->next(NEXT . ' >', array(), null, array('class' => 'next disabled'));
+       ?>
+       </div>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(PROJECT.ADD, array('action' => 'add')); ?></li>
+        <li><?php echo $this->Html->link(TOP, array('controller'=>'site','action' => 'index')); ?></li>
+    </ul>
+</div>
diff --git a/app/View/Projects/view.ctp b/app/View/Projects/view.ctp
new file mode 100644 (file)
index 0000000..7ca1a33
--- /dev/null
@@ -0,0 +1,44 @@
+<div class="projects view">
+<h2><?php echo PROJECT.EDIT; ?></h2>
+<dl>
+    <dt><?php echo ID; ?></dt>
+    <dd>
+        <?php echo h($project['Project']['id']); ?>
+        &nbsp;
+</dd>
+           <dt><?php echo MODIFIED; ?></dt>
+                   <dd>
+                               <?php echo h($project['Project']['modified']); ?>
+        &nbsp;
+</dd>
+    <dt><?php echo NAME; ?></dt>
+    <dd>
+        <?php echo h($project['Project']['name']); ?>
+        &nbsp;
+</dd>
+           <dt><?php echo STATUS; ?></dt>
+                   <dd>
+                               <?php echo h($project['Project']['status']); ?>
+        &nbsp;
+</dd>
+    <dt><?php echo DESCRIPTION; ?></dt>
+    <dd>
+        <?php echo h($project['Project']['description']); ?>
+        &nbsp;
+</dd>
+           <dt><?php echo CREATED; ?></dt>
+                   <dd>
+                               <?php echo h($project['Project']['created']); ?>
+        &nbsp;
+</dd>
+<dl>
+</div>
+<div class="actions">
+    <h3><?php echo MENU; ?></h3>
+    <ul>
+        <li><?php echo $this->Html->link(PROJECT.EDIT, array('action' => 'edit',$project['Project']['id'])); ?></li>
+        <li><?php echo $this->Form->postLink(PROJECT.DEL,array('action' => 'delete',
+                $project['Project']['id'],null, __(CONFIRM,$project['Project']['name'],DEL)));?> </li>
+        <li><?php echo $this->Html->link(PROJECT.LOOKUP, array('action' => 'index')); ?></li>
+    </ul>
+</div>>
diff --git a/app/View/Scaffolds/empty b/app/View/Scaffolds/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/View/Site/index.ctp b/app/View/Site/index.ctp
new file mode 100644 (file)
index 0000000..963c3dd
--- /dev/null
@@ -0,0 +1,30 @@
+<div class="site index">
+<h2>ようこそ</h2>
+<div id="snaptarget" class="ui-widget-header">
+<p>eXmasCakeとは</p>
+</div>
+<div id="draggable" class="draggable ui-widget-content">
+eXmasCake(eXpress Method Appearance System for CakePHP)は、Webサイトを手早く構築するためのツールです。
+<p>
+eXmasCakeは、システムで利用するデータベースのレイアウトを管理するとともに、CRUD用プログラムを自動的に生成することができます。いわば、CakePHP初心者にとっては頼もしい先輩、ベテランにとっては律儀な新人を得た感覚で利用できることでしょう。
+</p>
+<p>
+焼きあがったCakeを素敵にデコレーションして、あなた自身のおいしいCakeを完成させてください。
+</p>
+</div>
+<div id="snaptarget" class="ui-widget-header">
+利用方法
+</div>
+<div id="draggable" class="draggable ui-widget-content">
+(これから書きます)
+
+</div>
+</div>
+<div class="actions">
+    <h3><?php echo MENU; ?></h3>
+    <ul>
+        <li><?php echo $this->Html->link(PROJECT.LOOKUP, array('controller'=>'projects','action' => 'index')); ?></li>
+        <li><?php echo $this->Html->link(DB.LOOKUP, array('controller'=>'dbs','action' => 'index')); ?></li>
+    </ul>
+</div>
+
diff --git a/app/View/TableFields/add.ctp b/app/View/TableFields/add.ctp
new file mode 100644 (file)
index 0000000..807749e
--- /dev/null
@@ -0,0 +1,25 @@
+<div class="tableFields form">
+<?php echo $this->Form->create('TableField'); ?>
+       <fieldset>
+               <legend><?php echo TABLE_FIELD.ADD; ?></legend>
+       <?php
+        echo $this->Form->input('db_table_id',array('label'=>DB_TABLE));
+               echo $this->Form->input('name',array('label'=>NAME));
+               echo $this->Form->input('symbol',array('label'=>SYMBOL));
+               echo $this->Form->input('field_type',array('label'=>FIELD_TYPE));
+               echo $this->Form->input('field_option',array('label'=>FIELD_OPTION));
+               echo $this->Form->input('default_value',array('label'=>DEFAULT_VALUE));
+               echo $this->Form->input('foreign_table',array('label'=>FOREIGN_TABLE));
+               echo $this->Form->input('foreign_field',array('label'=>FOREIGN_FIELD));
+               echo $this->Form->input('description',array('label'=>DESCRIPTION));
+       ?>
+       </fieldset>
+<?php echo $this->Form->end(SUBMIT); ?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+
+               <li><?php echo $this->Html->link(TABLE_FIELD.LOOKUP, array('action' => 'index')); ?></li>
+       </ul>
+</div>
diff --git a/app/View/TableFields/edit.ctp b/app/View/TableFields/edit.ctp
new file mode 100644 (file)
index 0000000..9af8f32
--- /dev/null
@@ -0,0 +1,27 @@
+<div class="tableFields form">
+<?php echo $this->Form->create('TableField'); ?>
+       <fieldset>
+               <legend><?php echo TABLE_FIELD.EDIT; ?></legend>
+<?php
+        echo $this->Form->hidden('current_line_no',array('value'=>$this->data['TableField']['line_no']));
+
+        echo $this->Form->input('db_table_id',array('label'=>DB_TABLE));
+               echo $this->Form->input('line_no',array('label'=>LINE_NO));
+               echo $this->Form->input('name',array('label'=>NAME));
+               echo $this->Form->input('symbol',array('label'=>SYMBOL));
+               echo $this->Form->input('field_type',array('label'=>FIELD_TYPE));
+               echo $this->Form->input('field_option',array('label'=>DESCRIPTION));
+               echo $this->Form->input('default_value',array('label'=>DEFAULT_VALUE));
+               echo $this->Form->input('foreign_table',array('label'=>FOREIGN_TABLE));
+               echo $this->Form->input('foreign_field',array('label'=>FOREIGN_FIELD));
+               echo $this->Form->input('description',array('label'=>DESCRIPTION));
+       ?>
+       </fieldset>
+<?php echo $this->Form->end(SUBMIT); ?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(TABLE_FIELD.LOOKUP, array('action' => 'index')); ?></li>
+       </ul>
+</div>
diff --git a/app/View/TableFields/index.ctp b/app/View/TableFields/index.ctp
new file mode 100644 (file)
index 0000000..cff50b0
--- /dev/null
@@ -0,0 +1,48 @@
+<div class="tableFields index">
+       <h2><?php echo TABLE_FIELD.LOOKUP; ?></h2>
+       <table cellpadding="0" cellspacing="0">
+       <tr>
+                       <th><?php echo $this->Paginator->sort('db_table_id',DB_TABLE); ?></th>
+                       <th><?php echo $this->Paginator->sort('line_no',LINE_NO); ?></th>
+                       <th><?php echo $this->Paginator->sort('name',NAME); ?></th>
+                       <th><?php echo $this->Paginator->sort('symbol',SYMBOL); ?></th>
+                       <th><?php echo $this->Paginator->sort('field_type',FIELD_TYPE); ?></th>
+                       <th class="actions"><?php echo ACTION; ?></th>
+       </tr>
+       <?php
+       foreach ($tableFields as $tableField): ?>
+       <tr>
+               <td><?php echo h($tableField['DbTable']['name']); ?>&nbsp;</td>
+               <td><?php echo h($tableField['TableField']['line_no']); ?>&nbsp;</td>
+               <td><?php echo h($tableField['TableField']['name']); ?>&nbsp;</td>
+               <td><?php echo h($tableField['TableField']['symbol']); ?>&nbsp;</td>
+               <td><?php echo h($tableField['TableField']['field_type']); ?>&nbsp;</td>
+               <td class="actions">
+                       <?php echo $this->Html->link(VIEW, array('action' => 'view', $tableField['TableField']['id'])); ?>
+                       <?php echo $this->Html->link(EDIT, array('action' => 'edit', $tableField['TableField']['id'])); ?>
+                       <?php echo $this->Form->postLink(DEL, array('action' => 'delete', $tableField['TableField']['id']), null, __(CONFIRM, $tableField['TableField']['name'],DEL)); ?>
+               </td>
+       </tr>
+<?php endforeach; ?>
+       </table>
+       <p>
+       <?php
+       echo $this->Paginator->counter(array(
+       'format' => PAGE_NAVI 
+       ));
+       ?>      </p>
+
+       <div class="paging">
+       <?php
+               echo $this->Paginator->prev('< ' . PREV, array(), null, array('class' => 'prev disabled'));
+               echo $this->Paginator->numbers(array('separator' => ''));
+               echo $this->Paginator->next(NEXT . ' >', array(), null, array('class' => 'next disabled'));
+       ?>
+       </div>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(TABLE_FIELD.ADD, array('action' => 'add')); ?></li>
+       </ul>
+</div>
diff --git a/app/View/TableFields/related_add.ctp b/app/View/TableFields/related_add.ctp
new file mode 100644 (file)
index 0000000..d4078df
--- /dev/null
@@ -0,0 +1,25 @@
+<div class="tableFields form">
+<?php echo $this->Form->create('TableField'); ?>
+       <fieldset>
+               <legend><?php echo $dbTables['DbTable']['name'].DS.TABLE_FIELD.ADD; ?></legend>
+       <?php
+        echo $this->Form->hidden('db_table_id',array('value'=>$dbTables['DbTable']['id']));
+               echo $this->Form->input('name',array('label'=>NAME));
+               echo $this->Form->input('symbol',array('label'=>SYMBOL));
+               echo $this->Form->input('field_type',array('label'=>FIELD_TYPE));
+               echo $this->Form->input('field_option',array('label'=>FIELD_OPTION));
+               echo $this->Form->input('default_value',array('label'=>DEFAULT_VALUE));
+               echo $this->Form->input('foreign_table',array('label'=>FOREIGN_TABLE));
+               echo $this->Form->input('foreign_field',array('label'=>FOREIGN_FIELD));
+               echo $this->Form->input('description',array('label'=>DESCRIPTION));
+       ?>
+       </fieldset>
+<?php echo $this->Form->end(SUBMIT); ?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+
+               <li><?php echo $this->Html->link(GO_BACK, array('controller'=>'db_tables','action' => 'related_view',$dbTables['DbTable']['id'])); ?></li>
+       </ul>
+</div>
diff --git a/app/View/TableFields/related_edit.ctp b/app/View/TableFields/related_edit.ctp
new file mode 100644 (file)
index 0000000..fe11bb2
--- /dev/null
@@ -0,0 +1,27 @@
+<div class="tableFields form">
+<?php echo $this->Form->create('TableField'); ?>
+       <fieldset>
+               <legend><?php echo $this->data["DbTable"]["name"].DS.TABLE_FIELD.EDIT; ?></legend>
+<?php
+        echo $this->Form->hidden('current_line_no',array('value'=>$this->data['TableField']['line_no']));
+
+        echo $this->Form->hidden('db_table_id',array('value'=>$this->data['DbTable']['id']));
+               echo $this->Form->input('line_no',array('label'=>LINE_NO));
+               echo $this->Form->input('name',array('label'=>NAME));
+               echo $this->Form->input('symbol',array('label'=>SYMBOL));
+               echo $this->Form->input('field_type',array('label'=>FIELD_TYPE));
+               echo $this->Form->input('field_option',array('label'=>DESCRIPTION));
+               echo $this->Form->input('default_value',array('label'=>DEFAULT_VALUE));
+               echo $this->Form->input('foreign_table',array('label'=>FOREIGN_TABLE));
+               echo $this->Form->input('foreign_field',array('label'=>FOREIGN_FIELD));
+               echo $this->Form->input('description',array('label'=>DESCRIPTION));
+       ?>
+       </fieldset>
+<?php echo $this->Form->end(SUBMIT); ?>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(TABLE_FIELD.LOOKUP, array('action' => 'index')); ?></li>
+       </ul>
+</div>
diff --git a/app/View/TableFields/related_view.ctp b/app/View/TableFields/related_view.ctp
new file mode 100644 (file)
index 0000000..3c32490
--- /dev/null
@@ -0,0 +1,78 @@
+<div class="tableFields view">
+<h2><?php  echo TABLE_FIELD.VIEW; ?></h2>
+       <dl>
+               <dt><?php echo ID; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['id']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo LINE_NO; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['line_no']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo NAME; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['name']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo SYMBOL; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['symbol']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo FIELD_TYPE; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['field_type']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo FIELD_OPTION; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['field_option']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo DEFAULT_VALUE; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['default_value']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo DB_TABLE; ?></dt>
+               <dd>
+                       <?php echo h($tableField['DbTable']['name']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo FOREIGN_TABLE; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['foreign_table']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo FOREIGN_FIELD; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['foreign_field']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo DESCRIPTION; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['description']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo CREATED; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['created']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo MODIFIED; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['modified']); ?>
+                       &nbsp;
+               </dd>
+       </dl>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(TABLE_FIELD.EDIT, array('action' => 'related_edit', $tableField['TableField']['id'])); ?> </li>
+               <li><?php echo $this->Form->postLink(TABLE_FIELD.DEL, array('action' => 'related_delete', $tableField['TableField']['id'],$tableField['TableField']['line_no'],$tableField['DbTable']['id']), null, __(CONFIRM, $tableField['TableField']['name'],DEL)); ?> </li>
+               <li><?php echo $this->Html->link(GO_BACK, array('controller'=>'db_tables','action' => 'related_view',$tableField['DbTable']['id'])); ?> </li>
+       </ul>
+</div>
diff --git a/app/View/TableFields/view.ctp b/app/View/TableFields/view.ctp
new file mode 100644 (file)
index 0000000..85909c1
--- /dev/null
@@ -0,0 +1,78 @@
+<div class="tableFields view">
+<h2><?php  echo TABLE_FIELD.VIEW; ?></h2>
+       <dl>
+               <dt><?php echo ID; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['id']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo LINE_NO; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['line_no']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo NAME; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['name']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo SYMBOL; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['symbol']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo FIELD_TYPE; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['field_type']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo FIELD_OPTION; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['field_option']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo DEFAULT_VALUE; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['default_value']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo DB_TABLE; ?></dt>
+               <dd>
+                       <?php echo h($tableField['DbTable']['name']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo FOREIGN_TABLE; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['foreign_table']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo FOREIGN_FIELD; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['foreign_field']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo DESCRIPTION; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['description']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo CREATED; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['created']); ?>
+                       &nbsp;
+               </dd>
+               <dt><?php echo MODIFIED; ?></dt>
+               <dd>
+                       <?php echo h($tableField['TableField']['modified']); ?>
+                       &nbsp;
+               </dd>
+       </dl>
+</div>
+<div class="actions">
+       <h3><?php echo MENU; ?></h3>
+       <ul>
+               <li><?php echo $this->Html->link(TABLE_FIELD.EDIT, array('action' => 'edit', $tableField['TableField']['id'])); ?> </li>
+               <li><?php echo $this->Form->postLink(TABLE_FIELD.DEL, array('action' => 'delete', $tableField['TableField']['id']), null, __(CONFIRM, $tableField['TableField']['name'],DEL)); ?> </li>
+               <li><?php echo $this->Html->link(TABLE_FIELD.LOOKUP, array('action' => 'index')); ?> </li>
+       </ul>
+</div>
diff --git a/app/index.php b/app/index.php
new file mode 100644 (file)
index 0000000..29f2c57
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+/**
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       app
+ * @since         CakePHP(tm) v 0.10.0.1076
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+require 'webroot' . DIRECTORY_SEPARATOR . 'index.php';
diff --git a/app/tmp/cache/models/empty b/app/tmp/cache/models/empty
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/app/tmp/cache/persistent/empty b/app/tmp/cache/persistent/empty
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/app/tmp/cache/views/empty b/app/tmp/cache/views/empty
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/app/tmp/logs/empty b/app/tmp/logs/empty
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/app/tmp/sessions/empty b/app/tmp/sessions/empty
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/app/tmp/tests/empty b/app/tmp/tests/empty
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/app/webroot/.htaccess b/app/webroot/.htaccess
new file mode 100644 (file)
index 0000000..48a63f0
--- /dev/null
@@ -0,0 +1,6 @@
+<IfModule mod_rewrite.c>
+    RewriteEngine On
+    RewriteCond %{REQUEST_FILENAME} !-d
+    RewriteCond %{REQUEST_FILENAME} !-f
+    RewriteRule ^(.*)$ index.php [QSA,L]
+</IfModule>
diff --git a/app/webroot/css/exmascake.css b/app/webroot/css/exmascake.css
new file mode 100644 (file)
index 0000000..0ccbdb7
--- /dev/null
@@ -0,0 +1,738 @@
+@charset "utf-8";
+/**
+ *
+ * Generic CSS for CakePHP
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       app.webroot.css
+ * @since         CakePHP(tm)
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+
+* {
+       margin:0;
+       padding:0;
+}
+
+/** General Style Info **/
+body {
+       background: #fff;
+       color: #333;
+       font-family:'lucida grande',verdana,helvetica,arial,sans-serif;
+       font-size:90%;
+       margin: 0;
+}
+a {
+       color: #003d4c;
+       text-decoration: underline;
+       font-weight: bold;
+}
+a:hover {
+       color: #367889;
+       text-decoration:none;
+}
+a img {
+       border:none;
+}
+h1, h2, h3, h4 {
+       font-weight: normal;
+       margin-bottom:0.5em;
+}
+h1 {
+       background:#fff;
+       color: #003d4c;
+       font-size: 100%;
+}
+h2 {
+       background:#fff;
+       color: #e32;
+       font-family:'Gill Sans','lucida grande', helvetica, arial, sans-serif;
+       font-size: 190%;
+}
+h3 {
+       color: #2c6877;
+       font-family:'Gill Sans','lucida grande', helvetica, arial, sans-serif;
+       font-size: 165%;
+}
+h4 {
+       color: #993;
+       font-weight: normal;
+}
+ul, li {
+       margin: 0 12px;
+}
+p {
+       margin: 0 0 1em 0;
+}
+
+/** Layout **/
+#container {
+       text-align: left;
+}
+
+#header{
+       padding: 10px 20px;
+}
+#header h1 {
+       line-height:20px;
+       color: #333;
+       padding: 0px 30px;
+}
+#header h1 a {
+       color: #333;
+       background: #fff;
+       font-weight: normal;
+       text-decoration: none;
+}
+#header h1 a:hover {
+       color: #333;
+       background: #fff;
+       text-decoration: underline;
+}
+#content{
+       background: #fff;
+       clear: both;
+       color: #333;
+       padding: 10px 20px 40px 20px;
+       overflow: auto;
+}
+#footer {
+       clear: both;
+       padding: 6px 10px;
+       text-align: center;
+}
+
+/** containers **/
+div.form,
+div.index,
+div.view {
+       float:right;
+       width:76%;
+       border-left:1px solid #666;
+       padding:10px 2%;
+}
+div.actions {
+       float:left;
+       width:16%;
+       padding:10px 1.5%;
+}
+div.actions h3 {
+       padding-top:0;
+       color:#777;
+}
+
+
+/** Tables **/
+table {
+       border-right:0;
+       clear: both;
+       color: #333;
+       margin-bottom: 10px;
+       width: 100%;
+}
+th {
+       border:0;
+       border-bottom:2px solid #555;
+       text-align: left;
+       padding:4px;
+}
+th a {
+       display: block;
+       padding: 2px 4px;
+       text-decoration: none;
+}
+th a.asc:after {
+       content: ' ⇣';
+}
+th a.desc:after {
+       content: ' ⇡';
+}
+table tr td {
+       padding: 6px;
+       text-align: left;
+       vertical-align: top;
+       border-bottom:1px solid #ddd;
+}
+table tr:nth-child(even) {
+       background: #f9f9f9;
+}
+td.actions {
+       text-align: center;
+       white-space: nowrap;
+}
+table td.actions a {
+       margin: 0px 6px;
+       padding:2px 5px;
+}
+
+/* SQL log */
+.cake-sql-log {
+       background: #fff;
+}
+.cake-sql-log td {
+       padding: 4px 8px;
+       text-align: left;
+       font-family: Monaco, Consolas, "Courier New", monospaced;
+}
+.cake-sql-log caption {
+       color:#fff;
+}
+
+/** Paging **/
+.paging {
+       background:#fff;
+       color: #ccc;
+       margin-top: 1em;
+       clear:both;
+}
+.paging .current,
+.paging .disabled,
+.paging a {
+       text-decoration: none;
+       padding: 5px 8px;
+       display: inline-block
+}
+.paging > span {
+       display: inline-block;
+       border: 1px solid #ccc;
+       border-left: 0;
+}
+.paging > span:hover {
+       background: #efefef;
+}
+.paging .prev {
+       border-left: 1px solid #ccc;
+       -moz-border-radius: 4px 0 0 4px;
+       -webkit-border-radius: 4px 0 0 4px;
+       border-radius: 4px 0 0 4px;
+}
+.paging .next {
+       -moz-border-radius: 0 4px 4px 0;
+       -webkit-border-radius: 0 4px 4px 0;
+       border-radius: 0 4px 4px 0;
+}
+.paging .disabled {
+       color: #ddd;
+}
+.paging .disabled:hover {
+       background: transparent;
+}
+.paging .current {
+       background: #efefef;
+       color: #c73e14;
+}
+
+/** Scaffold View **/
+dl {
+       line-height: 2em;
+       margin: 0em 0em;
+       width: 60%;
+}
+dl dd:nth-child(4n+2),
+dl dt:nth-child(4n+1) {
+       background: #f4f4f4;
+}
+
+dt {
+       font-weight: bold;
+       padding-left: 4px;
+       vertical-align: top;
+       width: 10em;
+}
+dd {
+       margin-left: 10em;
+       margin-top: -2em;
+       vertical-align: top;
+}
+
+/** Forms **/
+form {
+       clear: both;
+       margin-right: 20px;
+       padding: 0;
+       width: 95%;
+}
+fieldset {
+       border: none;
+       margin-bottom: 1em;
+       padding: 16px 10px;
+}
+fieldset legend {
+       color: #e32;
+       font-size: 160%;
+       font-weight: bold;
+}
+fieldset fieldset {
+       margin-top: 0;
+       padding: 10px 0 0;
+}
+fieldset fieldset legend {
+       font-size: 120%;
+       font-weight: normal;
+}
+fieldset fieldset div {
+       clear: left;
+       margin: 0 20px;
+}
+form div {
+       clear: both;
+       margin-bottom: 1em;
+       padding: .5em;
+       vertical-align: text-top;
+}
+form .input {
+       color: #444;
+}
+form .required {
+       font-weight: bold;
+}
+form .required label:after {
+       color: #e32;
+       content: '*';
+       display:inline;
+}
+form div.submit {
+       border: 0;
+       clear: both;
+       margin-top: 10px;
+}
+label {
+       display: block;
+       font-size: 110%;
+       margin-bottom:3px;
+}
+input, textarea {
+       clear: both;
+       font-size: 140%;
+       font-family: "frutiger linotype", "lucida grande", "verdana", sans-serif;
+       padding: 1%;
+       width:98%;
+}
+select {
+       clear: both;
+       font-size: 120%;
+       vertical-align: text-bottom;
+}
+select[multiple=multiple] {
+       width: 100%;
+}
+option {
+       font-size: 120%;
+       padding: 0 3px;
+}
+input[type=checkbox] {
+       clear: left;
+       float: left;
+       margin: 0px 6px 7px 2px;
+       width: auto;
+}
+div.checkbox label {
+       display: inline;
+}
+input[type=radio] {
+       float:left;
+       width:auto;
+       margin: 6px 0;
+       padding: 0;
+       line-height: 26px;
+}
+.radio label {
+       margin: 0 0 6px 20px;
+       line-height: 26px;
+}
+input[type=submit] {
+       display: inline;
+       font-size: 110%;
+       width: auto;
+}
+form .submit input[type=submit] {
+       background:#62af56;
+       background-image: -webkit-gradient(linear, left top, left bottom, from(#76BF6B), to(#3B8230));
+       background-image: -webkit-linear-gradient(top, #76BF6B, #3B8230);
+       background-image: -moz-linear-gradient(top, #76BF6B, #3B8230);
+       border-color: #2d6324;
+       color: #fff;
+       text-shadow: rgba(0, 0, 0, 0.5) 0px -1px 0px;
+       padding: 8px 10px;
+}
+form .submit input[type=submit]:hover {
+       background: #5BA150;
+}
+/* Form errors */
+form .error {
+       background: #FFDACC;
+       -moz-border-radius: 4px;
+       -webkit-border-radius: 4px;
+       border-radius: 4px;
+       font-weight: normal;
+}
+form .error-message {
+       -moz-border-radius: none;
+       -webkit-border-radius: none;
+       border-radius: none;
+       border: none;
+       background: none;
+       margin: 0;
+       padding-left: 4px;
+       padding-right: 0;
+}
+form .error,
+form .error-message {
+       color: #9E2424;
+       -webkit-box-shadow: none;
+       -moz-box-shadow: none;
+       -ms-box-shadow: none;
+       -o-box-shadow: none;
+       box-shadow: none;
+       text-shadow: none;
+}
+
+/** Notices and Errors **/
+.message {
+       clear: both;
+       color: #fff;
+       font-size: 140%;
+       font-weight: bold;
+       margin: 0 0 1em 0;
+       padding: 5px;
+}
+
+.success,
+.message,
+.cake-error,
+.cake-debug,
+.notice,
+p.error,
+.error-message {
+       background: #ffcc00;
+       background-repeat: repeat-x;
+       background-image: -moz-linear-gradient(top, #ffcc00, #E6B800);
+       background-image: -ms-linear-gradient(top, #ffcc00, #E6B800);
+       background-image: -webkit-gradient(linear, left top, left bottom, from(#ffcc00), to(#E6B800));
+       background-image: -webkit-linear-gradient(top, #ffcc00, #E6B800);
+       background-image: -o-linear-gradient(top, #ffcc00, #E6B800);
+       background-image: linear-gradient(top, #ffcc00, #E6B800);
+       text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
+       border: 1px solid rgba(0, 0, 0, 0.2);
+       margin-bottom: 18px;
+       padding: 7px 14px;
+       color: #404040;
+       text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
+       -webkit-border-radius: 4px;
+       -moz-border-radius: 4px;
+       border-radius: 4px;
+       -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
+       -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
+       box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
+}
+.success,
+.message,
+.cake-error,
+p.error,
+.error-message {
+       clear: both;
+       color: #fff;
+       background: #c43c35;
+       border: 1px solid rgba(0, 0, 0, 0.5);
+       background-repeat: repeat-x;
+       background-image: -moz-linear-gradient(top, #ee5f5b, #c43c35);
+       background-image: -ms-linear-gradient(top, #ee5f5b, #c43c35);
+       background-image: -webkit-gradient(linear, left top, left bottom, from(#ee5f5b), to(#c43c35));
+       background-image: -webkit-linear-gradient(top, #ee5f5b, #c43c35);
+       background-image: -o-linear-gradient(top, #ee5f5b, #c43c35);
+       background-image: linear-gradient(top, #ee5f5b, #c43c35);
+       text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
+}
+.success {
+       clear: both;
+       color: #fff;
+       border: 1px solid rgba(0, 0, 0, 0.5);
+       background: #3B8230;
+       background-repeat: repeat-x;
+       background-image: -webkit-gradient(linear, left top, left bottom, from(#76BF6B), to(#3B8230));
+       background-image: -webkit-linear-gradient(top, #76BF6B, #3B8230);
+       background-image: -moz-linear-gradient(top, #76BF6B, #3B8230);
+       background-image: -ms-linear-gradient(top, #76BF6B, #3B8230);
+       background-image: -o-linear-gradient(top, #76BF6B, #3B8230);
+       background-image: linear-gradient(top, #76BF6B, #3B8230);
+       text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
+}
+p.error {
+       font-family: Monaco, Consolas, Courier, monospace;
+       font-size: 120%;
+       padding: 0.8em;
+       margin: 1em 0;
+}
+p.error em {
+       font-weight: normal;
+       line-height: 140%;
+}
+.notice {
+       color: #000;
+       display: block;
+       font-size: 120%;
+       padding: 0.8em;
+       margin: 1em 0;
+}
+.success {
+       color: #fff;
+}
+
+/**  Actions  **/
+.actions ul {
+       margin: 0;
+       padding: 0;
+}
+.actions li {
+       margin:0 0 0.5em 0;
+       list-style-type: none;
+       white-space: nowrap;
+       padding: 0;
+}
+.actions ul li a {
+       font-weight: normal;
+       display: block;
+       clear: both;
+}
+
+/* Buttons and button links */
+input[type=submit],
+.actions ul li a,
+.actions a {
+       font-weight:normal;
+       padding: 4px 8px;
+       background: #dcdcdc;
+       background-image: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#dcdcdc));
+       background-image: -webkit-linear-gradient(top, #fefefe, #dcdcdc);
+       background-image: -moz-linear-gradient(top, #fefefe, #dcdcdc);
+       background-image: -ms-linear-gradient(top, #fefefe, #dcdcdc);
+       background-image: -o-linear-gradient(top, #fefefe, #dcdcdc);
+       background-image: linear-gradient(top, #fefefe, #dcdcdc);
+       color:#333;
+       border:1px solid #bbb;
+       -webkit-border-radius: 4px;
+       -moz-border-radius: 4px;
+       border-radius: 4px;
+       text-decoration: none;
+       text-shadow: #fff 0px 1px 0px;
+       min-width: 0;
+       -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0px 1px 1px rgba(0, 0, 0, 0.2);
+       -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0px 1px 1px rgba(0, 0, 0, 0.2);
+       box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0px 1px 1px rgba(0, 0, 0, 0.2);
+       -webkit-user-select: none;
+       user-select: none;
+}
+.actions ul li a:hover,
+.actions a:hover {
+       background: #ededed;
+       border-color: #acacac;
+       text-decoration: none;
+}
+input[type=submit]:active,
+.actions ul li a:active,
+.actions a:active {
+       background: #eee;
+       background-image: -webkit-gradient(linear, left top, left bottom, from(#dfdfdf), to(#eee));
+       background-image: -webkit-linear-gradient(top, #dfdfdf, #eee);
+       background-image: -moz-linear-gradient(top, #dfdfdf, #eee);
+       background-image: -ms-linear-gradient(top, #dfdfdf, #eee);
+       background-image: -o-linear-gradient(top, #dfdfdf, #eee);
+       background-image: linear-gradient(top, #dfdfdf, #eee);
+       text-shadow: #eee 0px 1px 0px;
+       -moz-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3);
+       -webkit-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3);
+       box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.3);
+       border-color: #aaa;
+       text-decoration: none;
+}
+
+/** Related **/
+.related {
+       clear: both;
+       display: block;
+}
+
+/** Debugging **/
+pre {
+       color: #000;
+       background: #f0f0f0;
+       padding: 15px;
+       -moz-box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
+       -webkit-box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
+       box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
+}
+.cake-debug-output {
+       padding: 0;
+       position: relative;
+}
+.cake-debug-output > span {
+       position: absolute;
+       top: 5px;
+       right: 5px;
+       background: rgba(255, 255, 255, 0.3);
+       -moz-border-radius: 4px;
+       -webkit-border-radius: 4px;
+       border-radius: 4px;
+       padding: 5px 6px;
+       color: #000;
+       display: block;
+       float: left;
+       -moz-box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.5);
+       -webkit-box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.5);
+       box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.5);
+       text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
+}
+.cake-debug,
+.cake-error {
+       font-size: 16px;
+       line-height: 20px;
+       clear: both;
+}
+.cake-error > a {
+       text-shadow: none;
+}
+.cake-error {
+       white-space: normal;
+}
+.cake-stack-trace {
+       background: rgba(255, 255, 255, 0.7);
+       color: #333;
+       margin: 10px 0 5px 0;
+       padding: 10px 10px 0 10px;
+       font-size: 120%;
+       line-height: 140%;
+       overflow: auto;
+       position: relative;
+       -moz-border-radius: 4px;
+       -webkit-border-radius: 4px;
+       border-radius: 4px;
+}
+.cake-stack-trace a {
+       text-shadow: none;
+       background: rgba(255, 255, 255, 0.7);
+       padding: 5px;
+       -moz-border-radius: 10px;
+       -webkit-border-radius: 10px;
+       border-radius: 10px;
+       margin: 0px 4px 10px 2px;
+       font-family: sans-serif;
+       font-size: 14px;
+       line-height: 14px;
+       display: inline-block;
+       text-decoration: none;
+       -moz-box-shadow: inset 0px 1px 0 rgba(0, 0, 0, 0.3);
+       -webkit-box-shadow: inset 0px 1px 0 rgba(0, 0, 0, 0.3);
+       box-shadow: inset 0px 1px 0 rgba(0, 0, 0, 0.3);
+}
+.cake-code-dump pre {
+       position: relative;
+       overflow: auto;
+}
+.cake-context {
+       margin-bottom: 10px;
+}
+.cake-stack-trace pre {
+       color: #000;
+       background-color: #F0F0F0;
+       margin: 0px 0 10px 0;
+       padding: 1em;
+       overflow: auto;
+       text-shadow: none;
+}
+.cake-stack-trace li {
+       padding: 10px 5px 0px;
+       margin: 0 0 4px 0;
+       font-family: monospace;
+       border: 1px solid #bbb;
+       -moz-border-radius: 4px;
+       -wekbkit-border-radius: 4px;
+       border-radius: 4px;
+       background: #dcdcdc;
+       background-image: -webkit-gradient(linear, left top, left bottom, from(#fefefe), to(#dcdcdc));
+       background-image: -webkit-linear-gradient(top, #fefefe, #dcdcdc);
+       background-image: -moz-linear-gradient(top, #fefefe, #dcdcdc);
+       background-image: -ms-linear-gradient(top, #fefefe, #dcdcdc);
+       background-image: -o-linear-gradient(top, #fefefe, #dcdcdc);
+       background-image: linear-gradient(top, #fefefe, #dcdcdc);
+}
+/* excerpt */
+.cake-code-dump pre,
+.cake-code-dump pre code {
+       clear: both;
+       font-size: 12px;
+       line-height: 15px;
+       margin: 4px 2px;
+       padding: 4px;
+       overflow: auto;
+}
+.cake-code-dump .code-highlight {
+       display: block;
+       background-color: rgba(255, 255, 0, 0.5);
+}
+.code-coverage-results div.code-line {
+       padding-left:5px;
+       display:block;
+       margin-left:10px;
+}
+.code-coverage-results div.uncovered span.content {
+       background:#ecc;
+}
+.code-coverage-results div.covered span.content {
+       background:#cec;
+}
+.code-coverage-results div.ignored span.content {
+       color:#aaa;
+}
+.code-coverage-results span.line-num {
+       color:#666;
+       display:block;
+       float:left;
+       width:20px;
+       text-align:right;
+       margin-right:5px;
+}
+.code-coverage-results span.line-num strong {
+       color:#666;
+}
+.code-coverage-results div.start {
+       border:1px solid #aaa;
+       border-width:1px 1px 0px 1px;
+       margin-top:30px;
+       padding-top:5px;
+}
+.code-coverage-results div.end {
+       border:1px solid #aaa;
+       border-width:0px 1px 1px 1px;
+       margin-bottom:30px;
+       padding-bottom:5px;
+}
+.code-coverage-results div.realstart {
+       margin-top:0px;
+}
+.code-coverage-results p.note {
+       color:#bbb;
+       padding:5px;
+       margin:5px 0 10px;
+       font-size:10px;
+}
+.code-coverage-results span.result-bad {
+       color: #a00;
+}
+.code-coverage-results span.result-ok {
+       color: #fa0;
+}
+.code-coverage-results span.result-good {
+       color: #0a0;
+}
+
+/** Elements **/
+#url-rewriting-warning {
+       display:none;
+}
diff --git a/app/webroot/css/images/ui-bg_flat_0_aaaaaa_40x100.png b/app/webroot/css/images/ui-bg_flat_0_aaaaaa_40x100.png
new file mode 100644 (file)
index 0000000..5b5dab2
Binary files /dev/null and b/app/webroot/css/images/ui-bg_flat_0_aaaaaa_40x100.png differ
diff --git a/app/webroot/css/images/ui-bg_flat_75_ffffff_40x100.png b/app/webroot/css/images/ui-bg_flat_75_ffffff_40x100.png
new file mode 100644 (file)
index 0000000..ac8b229
Binary files /dev/null and b/app/webroot/css/images/ui-bg_flat_75_ffffff_40x100.png differ
diff --git a/app/webroot/css/images/ui-bg_glass_55_fbf9ee_1x400.png b/app/webroot/css/images/ui-bg_glass_55_fbf9ee_1x400.png
new file mode 100644 (file)
index 0000000..ad3d634
Binary files /dev/null and b/app/webroot/css/images/ui-bg_glass_55_fbf9ee_1x400.png differ
diff --git a/app/webroot/css/images/ui-bg_glass_65_ffffff_1x400.png b/app/webroot/css/images/ui-bg_glass_65_ffffff_1x400.png
new file mode 100644 (file)
index 0000000..42ccba2
Binary files /dev/null and b/app/webroot/css/images/ui-bg_glass_65_ffffff_1x400.png differ
diff --git a/app/webroot/css/images/ui-bg_glass_75_dadada_1x400.png b/app/webroot/css/images/ui-bg_glass_75_dadada_1x400.png
new file mode 100644 (file)
index 0000000..5a46b47
Binary files /dev/null and b/app/webroot/css/images/ui-bg_glass_75_dadada_1x400.png differ
diff --git a/app/webroot/css/images/ui-bg_glass_75_e6e6e6_1x400.png b/app/webroot/css/images/ui-bg_glass_75_e6e6e6_1x400.png
new file mode 100644 (file)
index 0000000..86c2baa
Binary files /dev/null and b/app/webroot/css/images/ui-bg_glass_75_e6e6e6_1x400.png differ
diff --git a/app/webroot/css/images/ui-bg_glass_95_fef1ec_1x400.png b/app/webroot/css/images/ui-bg_glass_95_fef1ec_1x400.png
new file mode 100644 (file)
index 0000000..4443fdc
Binary files /dev/null and b/app/webroot/css/images/ui-bg_glass_95_fef1ec_1x400.png differ
diff --git a/app/webroot/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/app/webroot/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png
new file mode 100644 (file)
index 0000000..7c9fa6c
Binary files /dev/null and b/app/webroot/css/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ
diff --git a/app/webroot/css/images/ui-icons_222222_256x240.png b/app/webroot/css/images/ui-icons_222222_256x240.png
new file mode 100644 (file)
index 0000000..b273ff1
Binary files /dev/null and b/app/webroot/css/images/ui-icons_222222_256x240.png differ
diff --git a/app/webroot/css/images/ui-icons_2e83ff_256x240.png b/app/webroot/css/images/ui-icons_2e83ff_256x240.png
new file mode 100644 (file)
index 0000000..09d1cdc
Binary files /dev/null and b/app/webroot/css/images/ui-icons_2e83ff_256x240.png differ
diff --git a/app/webroot/css/images/ui-icons_454545_256x240.png b/app/webroot/css/images/ui-icons_454545_256x240.png
new file mode 100644 (file)
index 0000000..59bd45b
Binary files /dev/null and b/app/webroot/css/images/ui-icons_454545_256x240.png differ
diff --git a/app/webroot/css/images/ui-icons_888888_256x240.png b/app/webroot/css/images/ui-icons_888888_256x240.png
new file mode 100644 (file)
index 0000000..6d02426
Binary files /dev/null and b/app/webroot/css/images/ui-icons_888888_256x240.png differ
diff --git a/app/webroot/css/images/ui-icons_cd0a0a_256x240.png b/app/webroot/css/images/ui-icons_cd0a0a_256x240.png
new file mode 100644 (file)
index 0000000..2ab019b
Binary files /dev/null and b/app/webroot/css/images/ui-icons_cd0a0a_256x240.png differ
diff --git a/app/webroot/css/jquery-ui-1.9.2.custom.css b/app/webroot/css/jquery-ui-1.9.2.custom.css
new file mode 100644 (file)
index 0000000..9fa4a2d
--- /dev/null
@@ -0,0 +1,462 @@
+/*! jQuery UI - v1.9.2 - 2012-11-23
+* http://jqueryui.com
+* Includes: jquery.ui.core.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css
+* To view and modify this theme, visit http://jqueryui.com/themeroller/
+* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */
+
+/* Layout helpers
+----------------------------------*/
+.ui-helper-hidden { display: none; }
+.ui-helper-hidden-accessible { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
+.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
+.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
+.ui-helper-clearfix:after { clear: both; }
+.ui-helper-clearfix { zoom: 1; }
+.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
+
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-disabled { cursor: default !important; }
+
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Overlays */
+.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
+.ui-accordion .ui-accordion-header { display: block; cursor: pointer; position: relative; margin-top: 2px; padding: .5em .5em .5em .7em; zoom: 1; }
+.ui-accordion .ui-accordion-icons { padding-left: 2.2em; }
+.ui-accordion .ui-accordion-noicons { padding-left: .7em; }
+.ui-accordion .ui-accordion-icons .ui-accordion-icons { padding-left: 2.2em; }
+.ui-accordion .ui-accordion-header .ui-accordion-header-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
+.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; overflow: auto; zoom: 1; }
+.ui-autocomplete {
+       position: absolute;
+       top: 0;
+       left: 0;
+       cursor: default;
+}
+
+/* workarounds */
+* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
+.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
+.ui-button, .ui-button:link, .ui-button:visited, .ui-button:hover, .ui-button:active { text-decoration: none; }
+.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
+button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
+.ui-button-icons-only { width: 3.4em; } 
+button.ui-button-icons-only { width: 3.7em; } 
+
+/*button text element */
+.ui-button .ui-button-text { display: block; line-height: 1.4;  }
+.ui-button-text-only .ui-button-text { padding: .4em 1em; }
+.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
+.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
+.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
+.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
+/* no icon support for input elements, provide padding by default */
+input.ui-button { padding: .4em 1em; }
+
+/*button icon element(s) */
+.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
+.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
+.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
+.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
+
+/*button sets*/
+.ui-buttonset { margin-right: 7px; }
+.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
+
+/* workarounds */
+button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
+.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
+.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
+.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
+.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
+.ui-datepicker .ui-datepicker-prev { left:2px; }
+.ui-datepicker .ui-datepicker-next { right:2px; }
+.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
+.ui-datepicker .ui-datepicker-next-hover { right:1px; }
+.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px;  }
+.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
+.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
+.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
+.ui-datepicker select.ui-datepicker-month, 
+.ui-datepicker select.ui-datepicker-year { width: 49%;}
+.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
+.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0;  }
+.ui-datepicker td { border: 0; padding: 1px; }
+.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
+.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
+.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
+.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
+
+/* with multiple calendars */
+.ui-datepicker.ui-datepicker-multi { width:auto; }
+.ui-datepicker-multi .ui-datepicker-group { float:left; }
+.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
+.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
+.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
+.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
+.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
+.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
+.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
+
+/* RTL support */
+.ui-datepicker-rtl { direction: rtl; }
+.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
+.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
+.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group { float:right; }
+.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
+
+/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
+.ui-datepicker-cover {
+    position: absolute; /*must have*/
+    z-index: -1; /*must have*/
+    filter: mask(); /*must have*/
+    top: -4px; /*must have*/
+    left: -4px; /*must have*/
+    width: 200px; /*must have*/
+    height: 200px; /*must have*/
+}.ui-dialog { position: absolute; top: 0; left: 0; padding: .2em; width: 300px; overflow: hidden; }
+.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative;  }
+.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
+.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
+.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
+.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
+.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
+.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
+.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
+.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
+.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
+.ui-draggable .ui-dialog-titlebar { cursor: move; }
+.ui-menu { list-style:none; padding: 2px; margin: 0; display:block; outline: none; }
+.ui-menu .ui-menu { margin-top: -3px; position: absolute; }
+.ui-menu .ui-menu-item { margin: 0; padding: 0; zoom: 1; width: 100%; }
+.ui-menu .ui-menu-divider { margin: 5px -2px 5px -2px; height: 0; font-size: 0; line-height: 0; border-width: 1px 0 0 0; }
+.ui-menu .ui-menu-item a { text-decoration: none; display: block; padding: 2px .4em; line-height: 1.5; zoom: 1; font-weight: normal; }
+.ui-menu .ui-menu-item a.ui-state-focus,
+.ui-menu .ui-menu-item a.ui-state-active { font-weight: normal; margin: -1px; }
+
+.ui-menu .ui-state-disabled { font-weight: normal; margin: .4em 0 .2em; line-height: 1.5; }
+.ui-menu .ui-state-disabled a { cursor: default; }
+
+/* icon support */
+.ui-menu-icons { position: relative; }
+.ui-menu-icons .ui-menu-item a { position: relative; padding-left: 2em; }
+
+/* left-aligned */
+.ui-menu .ui-icon { position: absolute; top: .2em; left: .2em; }
+
+/* right-aligned */
+.ui-menu .ui-menu-icon { position: static; float: right; }
+.ui-progressbar { height:2em; text-align: left; overflow: hidden; }
+.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }.ui-resizable { position: relative;}
+.ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; }
+.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
+.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
+.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
+.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
+.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
+.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
+.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
+.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
+.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
+.ui-slider { position: relative; text-align: left; }
+.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
+.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
+
+.ui-slider-horizontal { height: .8em; }
+.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
+.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
+.ui-slider-horizontal .ui-slider-range-min { left: 0; }
+.ui-slider-horizontal .ui-slider-range-max { right: 0; }
+
+.ui-slider-vertical { width: .8em; height: 100px; }
+.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
+.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
+.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
+.ui-slider-vertical .ui-slider-range-max { top: 0; }.ui-spinner { position:relative; display: inline-block; overflow: hidden; padding: 0; vertical-align: middle; }
+.ui-spinner-input { border: none; background: none; padding: 0; margin: .2em 0; vertical-align: middle; margin-left: .4em; margin-right: 22px; }
+.ui-spinner-button { width: 16px; height: 50%; font-size: .5em; padding: 0; margin: 0; text-align: center; position: absolute; cursor: default; display: block; overflow: hidden; right: 0; }
+.ui-spinner a.ui-spinner-button { border-top: none; border-bottom: none; border-right: none; } /* more specificity required here to overide default borders */
+.ui-spinner .ui-icon { position: absolute; margin-top: -8px; top: 50%; left: 0; } /* vertical centre icon */
+.ui-spinner-up { top: 0; }
+.ui-spinner-down { bottom: 0; }
+
+/* TR overrides */
+.ui-spinner .ui-icon-triangle-1-s {
+       /* need to fix icons sprite */
+       background-position:-65px -16px;
+}
+.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
+.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
+.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 0; margin: 1px .2em 0 0; border-bottom: 0; padding: 0; white-space: nowrap; }
+.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-active { margin-bottom: -1px; padding-bottom: 1px; }
+.ui-tabs .ui-tabs-nav li.ui-tabs-active a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-tabs-loading a { cursor: text; }
+.ui-tabs .ui-tabs-nav li a, .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
+.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
+.ui-tooltip {
+       padding: 8px;
+       position: absolute;
+       z-index: 9999;
+       max-width: 300px;
+       -webkit-box-shadow: 0 0 5px #aaa;
+       box-shadow: 0 0 5px #aaa;
+}
+/* Fades and background-images don't work well together in IE6, drop the image */
+* html .ui-tooltip {
+       background-image: none;
+}
+body .ui-tooltip { border-width: 2px; }
+
+/* Component containers
+----------------------------------*/
+.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; }
+.ui-widget .ui-widget { font-size: 1em; }
+.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; }
+.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; }
+.ui-widget-content a { color: #222222; }
+.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
+.ui-widget-header a { color: #222222; }
+
+/* Interaction states
+----------------------------------*/
+.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
+.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
+.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
+.ui-state-hover a, .ui-state-hover a:hover, .ui-state-hover a:link, .ui-state-hover a:visited { color: #212121; text-decoration: none; }
+.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
+.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
+
+/* Interaction Cues
+----------------------------------*/
+.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight  {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
+.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
+.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
+.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
+.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
+.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
+.ui-priority-secondary, .ui-widget-content .ui-priority-secondary,  .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
+.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
+.ui-state-disabled .ui-icon { filter:Alpha(Opacity=35); } /* For IE8 - See #6059 */
+
+/* Icons
+----------------------------------*/
+
+/* states and images */
+.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
+.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); }
+.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
+.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); }
+.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
+.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
+
+/* positioning */
+.ui-icon-carat-1-n { background-position: 0 0; }
+.ui-icon-carat-1-ne { background-position: -16px 0; }
+.ui-icon-carat-1-e { background-position: -32px 0; }
+.ui-icon-carat-1-se { background-position: -48px 0; }
+.ui-icon-carat-1-s { background-position: -64px 0; }
+.ui-icon-carat-1-sw { background-position: -80px 0; }
+.ui-icon-carat-1-w { background-position: -96px 0; }
+.ui-icon-carat-1-nw { background-position: -112px 0; }
+.ui-icon-carat-2-n-s { background-position: -128px 0; }
+.ui-icon-carat-2-e-w { background-position: -144px 0; }
+.ui-icon-triangle-1-n { background-position: 0 -16px; }
+.ui-icon-triangle-1-ne { background-position: -16px -16px; }
+.ui-icon-triangle-1-e { background-position: -32px -16px; }
+.ui-icon-triangle-1-se { background-position: -48px -16px; }
+.ui-icon-triangle-1-s { background-position: -64px -16px; }
+.ui-icon-triangle-1-sw { background-position: -80px -16px; }
+.ui-icon-triangle-1-w { background-position: -96px -16px; }
+.ui-icon-triangle-1-nw { background-position: -112px -16px; }
+.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
+.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
+.ui-icon-arrow-1-n { background-position: 0 -32px; }
+.ui-icon-arrow-1-ne { background-position: -16px -32px; }
+.ui-icon-arrow-1-e { background-position: -32px -32px; }
+.ui-icon-arrow-1-se { background-position: -48px -32px; }
+.ui-icon-arrow-1-s { background-position: -64px -32px; }
+.ui-icon-arrow-1-sw { background-position: -80px -32px; }
+.ui-icon-arrow-1-w { background-position: -96px -32px; }
+.ui-icon-arrow-1-nw { background-position: -112px -32px; }
+.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
+.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
+.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
+.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
+.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
+.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
+.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
+.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
+.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
+.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
+.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
+.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
+.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
+.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
+.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
+.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
+.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
+.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
+.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
+.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
+.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
+.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
+.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
+.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
+.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
+.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
+.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
+.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
+.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
+.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
+.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
+.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
+.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
+.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
+.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
+.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
+.ui-icon-arrow-4 { background-position: 0 -80px; }
+.ui-icon-arrow-4-diag { background-position: -16px -80px; }
+.ui-icon-extlink { background-position: -32px -80px; }
+.ui-icon-newwin { background-position: -48px -80px; }
+.ui-icon-refresh { background-position: -64px -80px; }
+.ui-icon-shuffle { background-position: -80px -80px; }
+.ui-icon-transfer-e-w { background-position: -96px -80px; }
+.ui-icon-transferthick-e-w { background-position: -112px -80px; }
+.ui-icon-folder-collapsed { background-position: 0 -96px; }
+.ui-icon-folder-open { background-position: -16px -96px; }
+.ui-icon-document { background-position: -32px -96px; }
+.ui-icon-document-b { background-position: -48px -96px; }
+.ui-icon-note { background-position: -64px -96px; }
+.ui-icon-mail-closed { background-position: -80px -96px; }
+.ui-icon-mail-open { background-position: -96px -96px; }
+.ui-icon-suitcase { background-position: -112px -96px; }
+.ui-icon-comment { background-position: -128px -96px; }
+.ui-icon-person { background-position: -144px -96px; }
+.ui-icon-print { background-position: -160px -96px; }
+.ui-icon-trash { background-position: -176px -96px; }
+.ui-icon-locked { background-position: -192px -96px; }
+.ui-icon-unlocked { background-position: -208px -96px; }
+.ui-icon-bookmark { background-position: -224px -96px; }
+.ui-icon-tag { background-position: -240px -96px; }
+.ui-icon-home { background-position: 0 -112px; }
+.ui-icon-flag { background-position: -16px -112px; }
+.ui-icon-calendar { background-position: -32px -112px; }
+.ui-icon-cart { background-position: -48px -112px; }
+.ui-icon-pencil { background-position: -64px -112px; }
+.ui-icon-clock { background-position: -80px -112px; }
+.ui-icon-disk { background-position: -96px -112px; }
+.ui-icon-calculator { background-position: -112px -112px; }
+.ui-icon-zoomin { background-position: -128px -112px; }
+.ui-icon-zoomout { background-position: -144px -112px; }
+.ui-icon-search { background-position: -160px -112px; }
+.ui-icon-wrench { background-position: -176px -112px; }
+.ui-icon-gear { background-position: -192px -112px; }
+.ui-icon-heart { background-position: -208px -112px; }
+.ui-icon-star { background-position: -224px -112px; }
+.ui-icon-link { background-position: -240px -112px; }
+.ui-icon-cancel { background-position: 0 -128px; }
+.ui-icon-plus { background-position: -16px -128px; }
+.ui-icon-plusthick { background-position: -32px -128px; }
+.ui-icon-minus { background-position: -48px -128px; }
+.ui-icon-minusthick { background-position: -64px -128px; }
+.ui-icon-close { background-position: -80px -128px; }
+.ui-icon-closethick { background-position: -96px -128px; }
+.ui-icon-key { background-position: -112px -128px; }
+.ui-icon-lightbulb { background-position: -128px -128px; }
+.ui-icon-scissors { background-position: -144px -128px; }
+.ui-icon-clipboard { background-position: -160px -128px; }
+.ui-icon-copy { background-position: -176px -128px; }
+.ui-icon-contact { background-position: -192px -128px; }
+.ui-icon-image { background-position: -208px -128px; }
+.ui-icon-video { background-position: -224px -128px; }
+.ui-icon-script { background-position: -240px -128px; }
+.ui-icon-alert { background-position: 0 -144px; }
+.ui-icon-info { background-position: -16px -144px; }
+.ui-icon-notice { background-position: -32px -144px; }
+.ui-icon-help { background-position: -48px -144px; }
+.ui-icon-check { background-position: -64px -144px; }
+.ui-icon-bullet { background-position: -80px -144px; }
+.ui-icon-radio-on { background-position: -96px -144px; }
+.ui-icon-radio-off { background-position: -112px -144px; }
+.ui-icon-pin-w { background-position: -128px -144px; }
+.ui-icon-pin-s { background-position: -144px -144px; }
+.ui-icon-play { background-position: 0 -160px; }
+.ui-icon-pause { background-position: -16px -160px; }
+.ui-icon-seek-next { background-position: -32px -160px; }
+.ui-icon-seek-prev { background-position: -48px -160px; }
+.ui-icon-seek-end { background-position: -64px -160px; }
+.ui-icon-seek-start { background-position: -80px -160px; }
+/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
+.ui-icon-seek-first { background-position: -80px -160px; }
+.ui-icon-stop { background-position: -96px -160px; }
+.ui-icon-eject { background-position: -112px -160px; }
+.ui-icon-volume-off { background-position: -128px -160px; }
+.ui-icon-volume-on { background-position: -144px -160px; }
+.ui-icon-power { background-position: 0 -176px; }
+.ui-icon-signal-diag { background-position: -16px -176px; }
+.ui-icon-signal { background-position: -32px -176px; }
+.ui-icon-battery-0 { background-position: -48px -176px; }
+.ui-icon-battery-1 { background-position: -64px -176px; }
+.ui-icon-battery-2 { background-position: -80px -176px; }
+.ui-icon-battery-3 { background-position: -96px -176px; }
+.ui-icon-circle-plus { background-position: 0 -192px; }
+.ui-icon-circle-minus { background-position: -16px -192px; }
+.ui-icon-circle-close { background-position: -32px -192px; }
+.ui-icon-circle-triangle-e { background-position: -48px -192px; }
+.ui-icon-circle-triangle-s { background-position: -64px -192px; }
+.ui-icon-circle-triangle-w { background-position: -80px -192px; }
+.ui-icon-circle-triangle-n { background-position: -96px -192px; }
+.ui-icon-circle-arrow-e { background-position: -112px -192px; }
+.ui-icon-circle-arrow-s { background-position: -128px -192px; }
+.ui-icon-circle-arrow-w { background-position: -144px -192px; }
+.ui-icon-circle-arrow-n { background-position: -160px -192px; }
+.ui-icon-circle-zoomin { background-position: -176px -192px; }
+.ui-icon-circle-zoomout { background-position: -192px -192px; }
+.ui-icon-circle-check { background-position: -208px -192px; }
+.ui-icon-circlesmall-plus { background-position: 0 -208px; }
+.ui-icon-circlesmall-minus { background-position: -16px -208px; }
+.ui-icon-circlesmall-close { background-position: -32px -208px; }
+.ui-icon-squaresmall-plus { background-position: -48px -208px; }
+.ui-icon-squaresmall-minus { background-position: -64px -208px; }
+.ui-icon-squaresmall-close { background-position: -80px -208px; }
+.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
+.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
+.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
+.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
+.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
+.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
+
+
+/* Misc visuals
+----------------------------------*/
+
+/* Corner radius */
+.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
+.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
+.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
+.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
+
+/* Overlays */
+.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .3;filter:Alpha(Opacity=30); }
+.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .3;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }
\ No newline at end of file
diff --git a/app/webroot/css/jquery-ui-1.9.2.custom.min.css b/app/webroot/css/jquery-ui-1.9.2.custom.min.css
new file mode 100644 (file)
index 0000000..e964969
--- /dev/null
@@ -0,0 +1,5 @@
+/*! jQuery UI - v1.9.2 - 2012-11-23
+* http://jqueryui.com
+* Includes: jquery.ui.core.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css
+* To view and modify this theme, visit http://jqueryui.com/themeroller/
+* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{zoom:1}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin-top:2px;padding:.5em .5em .5em .7em;zoom:1}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-noicons{padding-left:.7em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto;zoom:1}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}* html .ui-autocomplete{width:1px}.ui-button{display:inline-block;position:relative;padding:0;margin-right:.1em;cursor:pointer;text-align:center;zoom:1;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:1.4}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-datepicker{width:17em;padding:.2em .2em 0;display:none}.ui-datepicker .ui-datepicker-header{position:relative;padding:.2em 0}.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{position:absolute;top:2px;width:1.8em;height:1.8em}.ui-datepicker .ui-datepicker-prev-hover,.ui-datepicker .ui-datepicker-next-hover{top:1px}.ui-datepicker .ui-datepicker-prev{left:2px}.ui-datepicker .ui-datepicker-next{right:2px}.ui-datepicker .ui-datepicker-prev-hover{left:1px}.ui-datepicker .ui-datepicker-next-hover{right:1px}.ui-datepicker .ui-datepicker-prev span,.ui-datepicker .ui-datepicker-next span{display:block;position:absolute;left:50%;margin-left:-8px;top:50%;margin-top:-8px}.ui-datepicker .ui-datepicker-title{margin:0 2.3em;line-height:1.8em;text-align:center}.ui-datepicker .ui-datepicker-title select{font-size:1em;margin:1px 0}.ui-datepicker select.ui-datepicker-month-year{width:100%}.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year{width:49%}.ui-datepicker table{width:100%;font-size:.9em;border-collapse:collapse;margin:0 0 .4em}.ui-datepicker th{padding:.7em .3em;text-align:center;font-weight:bold;border:0}.ui-datepicker td{border:0;padding:1px}.ui-datepicker td span,.ui-datepicker td a{display:block;padding:.2em;text-align:right;text-decoration:none}.ui-datepicker .ui-datepicker-buttonpane{background-image:none;margin:.7em 0 0 0;padding:0 .2em;border-left:0;border-right:0;border-bottom:0}.ui-datepicker .ui-datepicker-buttonpane button{float:right;margin:.5em .2em .4em;cursor:pointer;padding:.2em .6em .3em .6em;width:auto;overflow:visible}.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current{float:left}.ui-datepicker.ui-datepicker-multi{width:auto}.ui-datepicker-multi .ui-datepicker-group{float:left}.ui-datepicker-multi .ui-datepicker-group table{width:95%;margin:0 auto .4em}.ui-datepicker-multi-2 .ui-datepicker-group{width:50%}.ui-datepicker-multi-3 .ui-datepicker-group{width:33.3%}.ui-datepicker-multi-4 .ui-datepicker-group{width:25%}.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header{border-left-width:0}.ui-datepicker-multi .ui-datepicker-buttonpane{clear:left}.ui-datepicker-row-break{clear:both;width:100%;font-size:0em}.ui-datepicker-rtl{direction:rtl}.ui-datepicker-rtl .ui-datepicker-prev{right:2px;left:auto}.ui-datepicker-rtl .ui-datepicker-next{left:2px;right:auto}.ui-datepicker-rtl .ui-datepicker-prev:hover{right:1px;left:auto}.ui-datepicker-rtl .ui-datepicker-next:hover{left:1px;right:auto}.ui-datepicker-rtl .ui-datepicker-buttonpane{clear:right}.ui-datepicker-rtl .ui-datepicker-buttonpane button{float:left}.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current{float:right}.ui-datepicker-rtl .ui-datepicker-group{float:right}.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header{border-right-width:0;border-left-width:1px}.ui-datepicker-cover{position:absolute;z-index:-1;filter:mask();top:-4px;left:-4px;width:200px;height:200px}.ui-dialog{position:absolute;top:0;left:0;padding:.2em;width:300px;overflow:hidden}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 16px .1em 0}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:19px;margin:-10px 0 0 0;padding:1px;height:18px}.ui-dialog .ui-dialog-titlebar-close span{display:block;margin:1px}.ui-dialog .ui-dialog-titlebar-close:hover,.ui-dialog .ui-dialog-titlebar-close:focus{padding:0}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto;zoom:1}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin:.5em 0 0 0;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:14px;height:14px;right:3px;bottom:3px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-menu{list-style:none;padding:2px;margin:0;display:block;outline:none}.ui-menu .ui-menu{margin-top:-3px;position:absolute}.ui-menu .ui-menu-item{margin:0;padding:0;zoom:1;width:100%}.ui-menu .ui-menu-divider{margin:5px -2px 5px -2px;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-menu-item a{text-decoration:none;display:block;padding:2px .4em;line-height:1.5;zoom:1;font-weight:normal}.ui-menu .ui-menu-item a.ui-state-focus,.ui-menu .ui-menu-item a.ui-state-active{font-weight:normal;margin:-1px}.ui-menu .ui-state-disabled{font-weight:normal;margin:.4em 0 .2em;line-height:1.5}.ui-menu .ui-state-disabled a{cursor:default}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item a{position:relative;padding-left:2em}.ui-menu .ui-icon{position:absolute;top:.2em;left:.2em}.ui-menu .ui-menu-icon{position:static;float:right}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;padding:0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:22px}.ui-spinner-button{width:16px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:none;border-bottom:none;border-right:none}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-tabs{position:relative;padding:.2em;zoom:1}.ui-tabs .ui-tabs-nav{margin:0;padding:.2em .2em 0}.ui-tabs .ui-tabs-nav li{list-style:none;float:left;position:relative;top:0;margin:1px .2em 0 0;border-bottom:0;padding:0;white-space:nowrap}.ui-tabs .ui-tabs-nav li a{float:left;padding:.5em 1em;text-decoration:none}.ui-tabs .ui-tabs-nav li.ui-tabs-active{margin-bottom:-1px;padding-bottom:1px}.ui-tabs .ui-tabs-nav li.ui-tabs-active a,.ui-tabs .ui-tabs-nav li.ui-state-disabled a,.ui-tabs .ui-tabs-nav li.ui-tabs-loading a{cursor:text}.ui-tabs .ui-tabs-nav li a,.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a{cursor:pointer}.ui-tabs .ui-tabs-panel{display:block;border-width:0;padding:1em 1.4em;background:none}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px;-webkit-box-shadow:0 0 5px #aaa;box-shadow:0 0 5px #aaa}* html .ui-tooltip{background-image:none}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Verdana,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Verdana,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #aaa;background:#fff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x;color:#222}.ui-widget-content a{color:#222}.ui-widget-header{border:1px solid #aaa;background:#ccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x;color:#222;font-weight:bold}.ui-widget-header a{color:#222}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #d3d3d3;background:#e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#555}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#555;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #999;background:#dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited{color:#212121;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #aaa;background:#fff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#212121;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #fcefa1;background:#fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x;color:#363636}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x;color:#cd0a0a}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#cd0a0a}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#cd0a0a}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px;background-image:url(images/ui-icons_222222_256x240.png)}.ui-widget-content .ui-icon{background-image:url(images/ui-icons_222222_256x240.png)}.ui-widget-header .ui-icon{background-image:url(images/ui-icons_222222_256x240.png)}.ui-state-default .ui-icon{background-image:url(images/ui-icons_888888_256x240.png)}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url(images/ui-icons_454545_256x240.png)}.ui-state-active .ui-icon{background-image:url(images/ui-icons_454545_256x240.png)}.ui-state-highlight .ui-icon{background-image:url(images/ui-icons_2e83ff_256x240.png)}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url(images/ui-icons_cd0a0a_256x240.png)}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{-moz-border-radius-topleft:4px;-webkit-border-top-left-radius:4px;-khtml-border-top-left-radius:4px;border-top-left-radius:4px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{-moz-border-radius-topright:4px;-webkit-border-top-right-radius:4px;-khtml-border-top-right-radius:4px;border-top-right-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{-moz-border-radius-bottomleft:4px;-webkit-border-bottom-left-radius:4px;-khtml-border-bottom-left-radius:4px;border-bottom-left-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{-moz-border-radius-bottomright:4px;-webkit-border-bottom-right-radius:4px;-khtml-border-bottom-right-radius:4px;border-bottom-right-radius:4px}.ui-widget-overlay{background:#aaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30)}.ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30);-moz-border-radius:8px;-khtml-border-radius:8px;-webkit-border-radius:8px;border-radius:8px}
\ No newline at end of file
diff --git a/app/webroot/favicon.ico b/app/webroot/favicon.ico
new file mode 100644 (file)
index 0000000..b36e81f
Binary files /dev/null and b/app/webroot/favicon.ico differ
diff --git a/app/webroot/files/empty b/app/webroot/files/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/webroot/img/cake.icon.png b/app/webroot/img/cake.icon.png
new file mode 100644 (file)
index 0000000..394fa42
Binary files /dev/null and b/app/webroot/img/cake.icon.png differ
diff --git a/app/webroot/img/cake.power.gif b/app/webroot/img/cake.power.gif
new file mode 100644 (file)
index 0000000..8f8d570
Binary files /dev/null and b/app/webroot/img/cake.power.gif differ
diff --git a/app/webroot/img/exmascake_logo.png b/app/webroot/img/exmascake_logo.png
new file mode 100644 (file)
index 0000000..1ed2cbb
Binary files /dev/null and b/app/webroot/img/exmascake_logo.png differ
diff --git a/app/webroot/img/test-error-icon.png b/app/webroot/img/test-error-icon.png
new file mode 100644 (file)
index 0000000..07bb124
Binary files /dev/null and b/app/webroot/img/test-error-icon.png differ
diff --git a/app/webroot/img/test-fail-icon.png b/app/webroot/img/test-fail-icon.png
new file mode 100644 (file)
index 0000000..f9d2f14
Binary files /dev/null and b/app/webroot/img/test-fail-icon.png differ
diff --git a/app/webroot/img/test-pass-icon.png b/app/webroot/img/test-pass-icon.png
new file mode 100644 (file)
index 0000000..99c5eb0
Binary files /dev/null and b/app/webroot/img/test-pass-icon.png differ
diff --git a/app/webroot/img/test-skip-icon.png b/app/webroot/img/test-skip-icon.png
new file mode 100644 (file)
index 0000000..749771c
Binary files /dev/null and b/app/webroot/img/test-skip-icon.png differ
diff --git a/app/webroot/index.php b/app/webroot/index.php
new file mode 100644 (file)
index 0000000..e125e09
--- /dev/null
@@ -0,0 +1,92 @@
+<?php
+/**
+ * Index
+ *
+ * The Front Controller for handling every request
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice.
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://cakephp.org CakePHP(tm) Project
+ * @package       app.webroot
+ * @since         CakePHP(tm) v 0.2.9
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+/**
+ * Use the DS to separate the directories in other defines
+ */
+if (!defined('DS')) {
+       define('DS', DIRECTORY_SEPARATOR);
+}
+/**
+ * These defines should only be edited if you have cake installed in
+ * a directory layout other than the way it is distributed.
+ * When using custom settings be sure to use the DS and do not add a trailing DS.
+ */
+
+/**
+ * The full path to the directory which holds "app", WITHOUT a trailing DS.
+ *
+ */
+if (!defined('ROOT')) {
+       define('ROOT', dirname(dirname(dirname(__FILE__))));
+}
+/**
+ * The actual directory name for the "app".
+ *
+ */
+if (!defined('APP_DIR')) {
+       define('APP_DIR', basename(dirname(dirname(__FILE__))));
+}
+
+/**
+ * The absolute path to the "cake" directory, WITHOUT a trailing DS.
+ *
+ * Un-comment this line to specify a fixed path to CakePHP.
+ * This should point at the directory containing `Cake`.
+ *
+ * For ease of development CakePHP uses PHP's include_path.  If you
+ * cannot modify your include_path set this value.
+ *
+ * Leaving this constant undefined will result in it being defined in Cake/bootstrap.php
+ */
+       //define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
+
+/**
+ * Editing below this line should NOT be necessary.
+ * Change at your own risk.
+ *
+ */
+if (!defined('WEBROOT_DIR')) {
+       define('WEBROOT_DIR', basename(dirname(__FILE__)));
+}
+if (!defined('WWW_ROOT')) {
+       define('WWW_ROOT', dirname(__FILE__) . DS);
+}
+
+if (!defined('CAKE_CORE_INCLUDE_PATH')) {
+       if (function_exists('ini_set')) {
+               ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
+       }
+       if (!include ('Cake' . DS . 'bootstrap.php')) {
+               $failed = true;
+       }
+} else {
+       if (!include (CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) {
+               $failed = true;
+       }
+}
+if (!empty($failed)) {
+       trigger_error("CakePHP core could not be found.  Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php.  It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
+}
+
+App::uses('Dispatcher', 'Routing');
+
+$Dispatcher = new Dispatcher();
+$Dispatcher->dispatch(new CakeRequest(), new CakeResponse(array('charset' => Configure::read('App.encoding'))));
diff --git a/app/webroot/js/empty b/app/webroot/js/empty
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/webroot/js/jquery-1.8.3.js b/app/webroot/js/jquery-1.8.3.js
new file mode 100644 (file)
index 0000000..a86bf79
--- /dev/null
@@ -0,0 +1,9472 @@
+/*!
+ * jQuery JavaScript Library v1.8.3
+ * http://jquery.com/
+ *
+ * Includes Sizzle.js
+ * http://sizzlejs.com/
+ *
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Released under the MIT license
+ * http://jquery.org/license
+ *
+ * Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time)
+ */
+(function( window, undefined ) {
+var
+       // A central reference to the root jQuery(document)
+       rootjQuery,
+
+       // The deferred used on DOM ready
+       readyList,
+
+       // Use the correct document accordingly with window argument (sandbox)
+       document = window.document,
+       location = window.location,
+       navigator = window.navigator,
+
+       // Map over jQuery in case of overwrite
+       _jQuery = window.jQuery,
+
+       // Map over the $ in case of overwrite
+       _$ = window.$,
+
+       // Save a reference to some core methods
+       core_push = Array.prototype.push,
+       core_slice = Array.prototype.slice,
+       core_indexOf = Array.prototype.indexOf,
+       core_toString = Object.prototype.toString,
+       core_hasOwn = Object.prototype.hasOwnProperty,
+       core_trim = String.prototype.trim,
+
+       // Define a local copy of jQuery
+       jQuery = function( selector, context ) {
+               // The jQuery object is actually just the init constructor 'enhanced'
+               return new jQuery.fn.init( selector, context, rootjQuery );
+       },
+
+       // Used for matching numbers
+       core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,
+
+       // Used for detecting and trimming whitespace
+       core_rnotwhite = /\S/,
+       core_rspace = /\s+/,
+
+       // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
+       rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
+
+       // A simple way to check for HTML strings
+       // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
+       rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
+
+       // Match a standalone tag
+       rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
+
+       // JSON RegExp
+       rvalidchars = /^[\],:{}\s]*$/,
+       rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
+       rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
+       rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,
+
+       // Matches dashed string for camelizing
+       rmsPrefix = /^-ms-/,
+       rdashAlpha = /-([\da-z])/gi,
+
+       // Used by jQuery.camelCase as callback to replace()
+       fcamelCase = function( all, letter ) {
+               return ( letter + "" ).toUpperCase();
+       },
+
+       // The ready event handler and self cleanup method
+       DOMContentLoaded = function() {
+               if ( document.addEventListener ) {
+                       document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+                       jQuery.ready();
+               } else if ( document.readyState === "complete" ) {
+                       // we're here because readyState === "complete" in oldIE
+                       // which is good enough for us to call the dom ready!
+                       document.detachEvent( "onreadystatechange", DOMContentLoaded );
+                       jQuery.ready();
+               }
+       },
+
+       // [[Class]] -> type pairs
+       class2type = {};
+
+jQuery.fn = jQuery.prototype = {
+       constructor: jQuery,
+       init: function( selector, context, rootjQuery ) {
+               var match, elem, ret, doc;
+
+               // Handle $(""), $(null), $(undefined), $(false)
+               if ( !selector ) {
+                       return this;
+               }
+
+               // Handle $(DOMElement)
+               if ( selector.nodeType ) {
+                       this.context = this[0] = selector;
+                       this.length = 1;
+                       return this;
+               }
+
+               // Handle HTML strings
+               if ( typeof selector === "string" ) {
+                       if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
+                               // Assume that strings that start and end with <> are HTML and skip the regex check
+                               match = [ null, selector, null ];
+
+                       } else {
+                               match = rquickExpr.exec( selector );
+                       }
+
+                       // Match html or make sure no context is specified for #id
+                       if ( match && (match[1] || !context) ) {
+
+                               // HANDLE: $(html) -> $(array)
+                               if ( match[1] ) {
+                                       context = context instanceof jQuery ? context[0] : context;
+                                       doc = ( context && context.nodeType ? context.ownerDocument || context : document );
+
+                                       // scripts is true for back-compat
+                                       selector = jQuery.parseHTML( match[1], doc, true );
+                                       if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
+                                               this.attr.call( selector, context, true );
+                                       }
+
+                                       return jQuery.merge( this, selector );
+
+                               // HANDLE: $(#id)
+                               } else {
+                                       elem = document.getElementById( match[2] );
+
+                                       // Check parentNode to catch when Blackberry 4.6 returns
+                                       // nodes that are no longer in the document #6963
+                                       if ( elem && elem.parentNode ) {
+                                               // Handle the case where IE and Opera return items
+                                               // by name instead of ID
+                                               if ( elem.id !== match[2] ) {
+                                                       return rootjQuery.find( selector );
+                                               }
+
+                                               // Otherwise, we inject the element directly into the jQuery object
+                                               this.length = 1;
+                                               this[0] = elem;
+                                       }
+
+                                       this.context = document;
+                                       this.selector = selector;
+                                       return this;
+                               }
+
+                       // HANDLE: $(expr, $(...))
+                       } else if ( !context || context.jquery ) {
+                               return ( context || rootjQuery ).find( selector );
+
+                       // HANDLE: $(expr, context)
+                       // (which is just equivalent to: $(context).find(expr)
+                       } else {
+                               return this.constructor( context ).find( selector );
+                       }
+
+               // HANDLE: $(function)
+               // Shortcut for document ready
+               } else if ( jQuery.isFunction( selector ) ) {
+                       return rootjQuery.ready( selector );
+               }
+
+               if ( selector.selector !== undefined ) {
+                       this.selector = selector.selector;
+                       this.context = selector.context;
+               }
+
+               return jQuery.makeArray( selector, this );
+       },
+
+       // Start with an empty selector
+       selector: "",
+
+       // The current version of jQuery being used
+       jquery: "1.8.3",
+
+       // The default length of a jQuery object is 0
+       length: 0,
+
+       // The number of elements contained in the matched element set
+       size: function() {
+               return this.length;
+       },
+
+       toArray: function() {
+               return core_slice.call( this );
+       },
+
+       // Get the Nth element in the matched element set OR
+       // Get the whole matched element set as a clean array
+       get: function( num ) {
+               return num == null ?
+
+                       // Return a 'clean' array
+                       this.toArray() :
+
+                       // Return just the object
+                       ( num < 0 ? this[ this.length + num ] : this[ num ] );
+       },
+
+       // Take an array of elements and push it onto the stack
+       // (returning the new matched element set)
+       pushStack: function( elems, name, selector ) {
+
+               // Build a new jQuery matched element set
+               var ret = jQuery.merge( this.constructor(), elems );
+
+               // Add the old object onto the stack (as a reference)
+               ret.prevObject = this;
+
+               ret.context = this.context;
+
+               if ( name === "find" ) {
+                       ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
+               } else if ( name ) {
+                       ret.selector = this.selector + "." + name + "(" + selector + ")";
+               }
+
+               // Return the newly-formed element set
+               return ret;
+       },
+
+       // Execute a callback for every element in the matched set.
+       // (You can seed the arguments with an array of args, but this is
+       // only used internally.)
+       each: function( callback, args ) {
+               return jQuery.each( this, callback, args );
+       },
+
+       ready: function( fn ) {
+               // Add the callback
+               jQuery.ready.promise().done( fn );
+
+               return this;
+       },
+
+       eq: function( i ) {
+               i = +i;
+               return i === -1 ?
+                       this.slice( i ) :
+                       this.slice( i, i + 1 );
+       },
+
+       first: function() {
+               return this.eq( 0 );
+       },
+
+       last: function() {
+               return this.eq( -1 );
+       },
+
+       slice: function() {
+               return this.pushStack( core_slice.apply( this, arguments ),
+                       "slice", core_slice.call(arguments).join(",") );
+       },
+
+       map: function( callback ) {
+               return this.pushStack( jQuery.map(this, function( elem, i ) {
+                       return callback.call( elem, i, elem );
+               }));
+       },
+
+       end: function() {
+               return this.prevObject || this.constructor(null);
+       },
+
+       // For internal use only.
+       // Behaves like an Array's method, not like a jQuery method.
+       push: core_push,
+       sort: [].sort,
+       splice: [].splice
+};
+
+// Give the init function the jQuery prototype for later instantiation
+jQuery.fn.init.prototype = jQuery.fn;
+
+jQuery.extend = jQuery.fn.extend = function() {
+       var options, name, src, copy, copyIsArray, clone,
+               target = arguments[0] || {},
+               i = 1,
+               length = arguments.length,
+               deep = false;
+
+       // Handle a deep copy situation
+       if ( typeof target === "boolean" ) {
+               deep = target;
+               target = arguments[1] || {};
+               // skip the boolean and the target
+               i = 2;
+       }
+
+       // Handle case when target is a string or something (possible in deep copy)
+       if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
+               target = {};
+       }
+
+       // extend jQuery itself if only one argument is passed
+       if ( length === i ) {
+               target = this;
+               --i;
+       }
+
+       for ( ; i < length; i++ ) {
+               // Only deal with non-null/undefined values
+               if ( (options = arguments[ i ]) != null ) {
+                       // Extend the base object
+                       for ( name in options ) {
+                               src = target[ name ];
+                               copy = options[ name ];
+
+                               // Prevent never-ending loop
+                               if ( target === copy ) {
+                                       continue;
+                               }
+
+                               // Recurse if we're merging plain objects or arrays
+                               if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
+                                       if ( copyIsArray ) {
+                                               copyIsArray = false;
+                                               clone = src && jQuery.isArray(src) ? src : [];
+
+                                       } else {
+                                               clone = src && jQuery.isPlainObject(src) ? src : {};
+                                       }
+
+                                       // Never move original objects, clone them
+                                       target[ name ] = jQuery.extend( deep, clone, copy );
+
+                               // Don't bring in undefined values
+                               } else if ( copy !== undefined ) {
+                                       target[ name ] = copy;
+                               }
+                       }
+               }
+       }
+
+       // Return the modified object
+       return target;
+};
+
+jQuery.extend({
+       noConflict: function( deep ) {
+               if ( window.$ === jQuery ) {
+                       window.$ = _$;
+               }
+
+               if ( deep && window.jQuery === jQuery ) {
+                       window.jQuery = _jQuery;
+               }
+
+               return jQuery;
+       },
+
+       // Is the DOM ready to be used? Set to true once it occurs.
+       isReady: false,
+
+       // A counter to track how many items to wait for before
+       // the ready event fires. See #6781
+       readyWait: 1,
+
+       // Hold (or release) the ready event
+       holdReady: function( hold ) {
+               if ( hold ) {
+                       jQuery.readyWait++;
+               } else {
+                       jQuery.ready( true );
+               }
+       },
+
+       // Handle when the DOM is ready
+       ready: function( wait ) {
+
+               // Abort if there are pending holds or we're already ready
+               if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
+                       return;
+               }
+
+               // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
+               if ( !document.body ) {
+                       return setTimeout( jQuery.ready, 1 );
+               }
+
+               // Remember that the DOM is ready
+               jQuery.isReady = true;
+
+               // If a normal DOM Ready event fired, decrement, and wait if need be
+               if ( wait !== true && --jQuery.readyWait > 0 ) {
+                       return;
+               }
+
+               // If there are functions bound, to execute
+               readyList.resolveWith( document, [ jQuery ] );
+
+               // Trigger any bound ready events
+               if ( jQuery.fn.trigger ) {
+                       jQuery( document ).trigger("ready").off("ready");
+               }
+       },
+
+       // See test/unit/core.js for details concerning isFunction.
+       // Since version 1.3, DOM methods and functions like alert
+       // aren't supported. They return false on IE (#2968).
+       isFunction: function( obj ) {
+               return jQuery.type(obj) === "function";
+       },
+
+       isArray: Array.isArray || function( obj ) {
+               return jQuery.type(obj) === "array";
+       },
+
+       isWindow: function( obj ) {
+               return obj != null && obj == obj.window;
+       },
+
+       isNumeric: function( obj ) {
+               return !isNaN( parseFloat(obj) ) && isFinite( obj );
+       },
+
+       type: function( obj ) {
+               return obj == null ?
+                       String( obj ) :
+                       class2type[ core_toString.call(obj) ] || "object";
+       },
+
+       isPlainObject: function( obj ) {
+               // Must be an Object.
+               // Because of IE, we also have to check the presence of the constructor property.
+               // Make sure that DOM nodes and window objects don't pass through, as well
+               if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
+                       return false;
+               }
+
+               try {
+                       // Not own constructor property must be Object
+                       if ( obj.constructor &&
+                               !core_hasOwn.call(obj, "constructor") &&
+                               !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
+                               return false;
+                       }
+               } catch ( e ) {
+                       // IE8,9 Will throw exceptions on certain host objects #9897
+                       return false;
+               }
+
+               // Own properties are enumerated firstly, so to speed up,
+               // if last one is own, then all properties are own.
+
+               var key;
+               for ( key in obj ) {}
+
+               return key === undefined || core_hasOwn.call( obj, key );
+       },
+
+       isEmptyObject: function( obj ) {
+               var name;
+               for ( name in obj ) {
+                       return false;
+               }
+               return true;
+       },
+
+       error: function( msg ) {
+               throw new Error( msg );
+       },
+
+       // data: string of html
+       // context (optional): If specified, the fragment will be created in this context, defaults to document
+       // scripts (optional): If true, will include scripts passed in the html string
+       parseHTML: function( data, context, scripts ) {
+               var parsed;
+               if ( !data || typeof data !== "string" ) {
+                       return null;
+               }
+               if ( typeof context === "boolean" ) {
+                       scripts = context;
+                       context = 0;
+               }
+               context = context || document;
+
+               // Single tag
+               if ( (parsed = rsingleTag.exec( data )) ) {
+                       return [ context.createElement( parsed[1] ) ];
+               }
+
+               parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] );
+               return jQuery.merge( [],
+                       (parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes );
+       },
+
+       parseJSON: function( data ) {
+               if ( !data || typeof data !== "string") {
+                       return null;
+               }
+
+               // Make sure leading/trailing whitespace is removed (IE can't handle it)
+               data = jQuery.trim( data );
+
+               // Attempt to parse using the native JSON parser first
+               if ( window.JSON && window.JSON.parse ) {
+                       return window.JSON.parse( data );
+               }
+
+               // Make sure the incoming data is actual JSON
+               // Logic borrowed from http://json.org/json2.js
+               if ( rvalidchars.test( data.replace( rvalidescape, "@" )
+                       .replace( rvalidtokens, "]" )
+                       .replace( rvalidbraces, "")) ) {
+
+                       return ( new Function( "return " + data ) )();
+
+               }
+               jQuery.error( "Invalid JSON: " + data );
+       },
+
+       // Cross-browser xml parsing
+       parseXML: function( data ) {
+               var xml, tmp;
+               if ( !data || typeof data !== "string" ) {
+                       return null;
+               }
+               try {
+                       if ( window.DOMParser ) { // Standard
+                               tmp = new DOMParser();
+                               xml = tmp.parseFromString( data , "text/xml" );
+                       } else { // IE
+                               xml = new ActiveXObject( "Microsoft.XMLDOM" );
+                               xml.async = "false";
+                               xml.loadXML( data );
+                       }
+               } catch( e ) {
+                       xml = undefined;
+               }
+               if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
+                       jQuery.error( "Invalid XML: " + data );
+               }
+               return xml;
+       },
+
+       noop: function() {},
+
+       // Evaluates a script in a global context
+       // Workarounds based on findings by Jim Driscoll
+       // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
+       globalEval: function( data ) {
+               if ( data && core_rnotwhite.test( data ) ) {
+                       // We use execScript on Internet Explorer
+                       // We use an anonymous function so that context is window
+                       // rather than jQuery in Firefox
+                       ( window.execScript || function( data ) {
+                               window[ "eval" ].call( window, data );
+                       } )( data );
+               }
+       },
+
+       // Convert dashed to camelCase; used by the css and data modules
+       // Microsoft forgot to hump their vendor prefix (#9572)
+       camelCase: function( string ) {
+               return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
+       },
+
+       nodeName: function( elem, name ) {
+               return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
+       },
+
+       // args is for internal usage only
+       each: function( obj, callback, args ) {
+               var name,
+                       i = 0,
+                       length = obj.length,
+                       isObj = length === undefined || jQuery.isFunction( obj );
+
+               if ( args ) {
+                       if ( isObj ) {
+                               for ( name in obj ) {
+                                       if ( callback.apply( obj[ name ], args ) === false ) {
+                                               break;
+                                       }
+                               }
+                       } else {
+                               for ( ; i < length; ) {
+                                       if ( callback.apply( obj[ i++ ], args ) === false ) {
+                                               break;
+                                       }
+                               }
+                       }
+
+               // A special, fast, case for the most common use of each
+               } else {
+                       if ( isObj ) {
+                               for ( name in obj ) {
+                                       if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) {
+                                               break;
+                                       }
+                               }
+                       } else {
+                               for ( ; i < length; ) {
+                                       if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) {
+                                               break;
+                                       }
+                               }
+                       }
+               }
+
+               return obj;
+       },
+
+       // Use native String.trim function wherever possible
+       trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
+               function( text ) {
+                       return text == null ?
+                               "" :
+                               core_trim.call( text );
+               } :
+
+               // Otherwise use our own trimming functionality
+               function( text ) {
+                       return text == null ?
+                               "" :
+                               ( text + "" ).replace( rtrim, "" );
+               },
+
+       // results is for internal usage only
+       makeArray: function( arr, results ) {
+               var type,
+                       ret = results || [];
+
+               if ( arr != null ) {
+                       // The window, strings (and functions) also have 'length'
+                       // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
+                       type = jQuery.type( arr );
+
+                       if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) {
+                               core_push.call( ret, arr );
+                       } else {
+                               jQuery.merge( ret, arr );
+                       }
+               }
+
+               return ret;
+       },
+
+       inArray: function( elem, arr, i ) {
+               var len;
+
+               if ( arr ) {
+                       if ( core_indexOf ) {
+                               return core_indexOf.call( arr, elem, i );
+                       }
+
+                       len = arr.length;
+                       i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
+
+                       for ( ; i < len; i++ ) {
+                               // Skip accessing in sparse arrays
+                               if ( i in arr && arr[ i ] === elem ) {
+                                       return i;
+                               }
+                       }
+               }
+
+               return -1;
+       },
+
+       merge: function( first, second ) {
+               var l = second.length,
+                       i = first.length,
+                       j = 0;
+
+               if ( typeof l === "number" ) {
+                       for ( ; j < l; j++ ) {
+                               first[ i++ ] = second[ j ];
+                       }
+
+               } else {
+                       while ( second[j] !== undefined ) {
+                               first[ i++ ] = second[ j++ ];
+                       }
+               }
+
+               first.length = i;
+
+               return first;
+       },
+
+       grep: function( elems, callback, inv ) {
+               var retVal,
+                       ret = [],
+                       i = 0,
+                       length = elems.length;
+               inv = !!inv;
+
+               // Go through the array, only saving the items
+               // that pass the validator function
+               for ( ; i < length; i++ ) {
+                       retVal = !!callback( elems[ i ], i );
+                       if ( inv !== retVal ) {
+                               ret.push( elems[ i ] );
+                       }
+               }
+
+               return ret;
+       },
+
+       // arg is for internal usage only
+       map: function( elems, callback, arg ) {
+               var value, key,
+                       ret = [],
+                       i = 0,
+                       length = elems.length,
+                       // jquery objects are treated as arrays
+                       isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
+
+               // Go through the array, translating each of the items to their
+               if ( isArray ) {
+                       for ( ; i < length; i++ ) {
+                               value = callback( elems[ i ], i, arg );
+
+                               if ( value != null ) {
+                                       ret[ ret.length ] = value;
+                               }
+                       }
+
+               // Go through every key on the object,
+               } else {
+                       for ( key in elems ) {
+                               value = callback( elems[ key ], key, arg );
+
+                               if ( value != null ) {
+                                       ret[ ret.length ] = value;
+                               }
+                       }
+               }
+
+               // Flatten any nested arrays
+               return ret.concat.apply( [], ret );
+       },
+
+       // A global GUID counter for objects
+       guid: 1,
+
+       // Bind a function to a context, optionally partially applying any
+       // arguments.
+       proxy: function( fn, context ) {
+               var tmp, args, proxy;
+
+               if ( typeof context === "string" ) {
+                       tmp = fn[ context ];
+                       context = fn;
+                       fn = tmp;
+               }
+
+               // Quick check to determine if target is callable, in the spec
+               // this throws a TypeError, but we will just return undefined.
+               if ( !jQuery.isFunction( fn ) ) {
+                       return undefined;
+               }
+
+               // Simulated bind
+               args = core_slice.call( arguments, 2 );
+               proxy = function() {
+                       return fn.apply( context, args.concat( core_slice.call( arguments ) ) );
+               };
+
+               // Set the guid of unique handler to the same of original handler, so it can be removed
+               proxy.guid = fn.guid = fn.guid || jQuery.guid++;
+
+               return proxy;
+       },
+
+       // Multifunctional method to get and set values of a collection
+       // The value/s can optionally be executed if it's a function
+       access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
+               var exec,
+                       bulk = key == null,
+                       i = 0,
+                       length = elems.length;
+
+               // Sets many values
+               if ( key && typeof key === "object" ) {
+                       for ( i in key ) {
+                               jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
+                       }
+                       chainable = 1;
+
+               // Sets one value
+               } else if ( value !== undefined ) {
+                       // Optionally, function values get executed if exec is true
+                       exec = pass === undefined && jQuery.isFunction( value );
+
+                       if ( bulk ) {
+                               // Bulk operations only iterate when executing function values
+                               if ( exec ) {
+                                       exec = fn;
+                                       fn = function( elem, key, value ) {
+                                               return exec.call( jQuery( elem ), value );
+                                       };
+
+                               // Otherwise they run against the entire set
+                               } else {
+                                       fn.call( elems, value );
+                                       fn = null;
+                               }
+                       }
+
+                       if ( fn ) {
+                               for (; i < length; i++ ) {
+                                       fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
+                               }
+                       }
+
+                       chainable = 1;
+               }
+
+               return chainable ?
+                       elems :
+
+                       // Gets
+                       bulk ?
+                               fn.call( elems ) :
+                               length ? fn( elems[0], key ) : emptyGet;
+       },
+
+       now: function() {
+               return ( new Date() ).getTime();
+       }
+});
+
+jQuery.ready.promise = function( obj ) {
+       if ( !readyList ) {
+
+               readyList = jQuery.Deferred();
+
+               // Catch cases where $(document).ready() is called after the browser event has already occurred.
+               // we once tried to use readyState "interactive" here, but it caused issues like the one
+               // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
+               if ( document.readyState === "complete" ) {
+                       // Handle it asynchronously to allow scripts the opportunity to delay ready
+                       setTimeout( jQuery.ready, 1 );
+
+               // Standards-based browsers support DOMContentLoaded
+               } else if ( document.addEventListener ) {
+                       // Use the handy event callback
+                       document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
+
+                       // A fallback to window.onload, that will always work
+                       window.addEventListener( "load", jQuery.ready, false );
+
+               // If IE event model is used
+               } else {
+                       // Ensure firing before onload, maybe late but safe also for iframes
+                       document.attachEvent( "onreadystatechange", DOMContentLoaded );
+
+                       // A fallback to window.onload, that will always work
+                       window.attachEvent( "onload", jQuery.ready );
+
+                       // If IE and not a frame
+                       // continually check to see if the document is ready
+                       var top = false;
+
+                       try {
+                               top = window.frameElement == null && document.documentElement;
+                       } catch(e) {}
+
+                       if ( top && top.doScroll ) {
+                               (function doScrollCheck() {
+                                       if ( !jQuery.isReady ) {
+
+                                               try {
+                                                       // Use the trick by Diego Perini
+                                                       // http://javascript.nwbox.com/IEContentLoaded/
+                                                       top.doScroll("left");
+                                               } catch(e) {
+                                                       return setTimeout( doScrollCheck, 50 );
+                                               }
+
+                                               // and execute any waiting functions
+                                               jQuery.ready();
+                                       }
+                               })();
+                       }
+               }
+       }
+       return readyList.promise( obj );
+};
+
+// Populate the class2type map
+jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
+       class2type[ "[object " + name + "]" ] = name.toLowerCase();
+});
+
+// All jQuery objects should point back to these
+rootjQuery = jQuery(document);
+// String to Object options format cache
+var optionsCache = {};
+
+// Convert String-formatted options into Object-formatted ones and store in cache
+function createOptions( options ) {
+       var object = optionsCache[ options ] = {};
+       jQuery.each( options.split( core_rspace ), function( _, flag ) {
+               object[ flag ] = true;
+       });
+       return object;
+}
+
+/*
+ * Create a callback list using the following parameters:
+ *
+ *     options: an optional list of space-separated options that will change how
+ *                     the callback list behaves or a more traditional option object
+ *
+ * By default a callback list will act like an event callback list and can be
+ * "fired" multiple times.
+ *
+ * Possible options:
+ *
+ *     once:                   will ensure the callback list can only be fired once (like a Deferred)
+ *
+ *     memory:                 will keep track of previous values and will call any callback added
+ *                                     after the list has been fired right away with the latest "memorized"
+ *                                     values (like a Deferred)
+ *
+ *     unique:                 will ensure a callback can only be added once (no duplicate in the list)
+ *
+ *     stopOnFalse:    interrupt callings when a callback returns false
+ *
+ */
+jQuery.Callbacks = function( options ) {
+
+       // Convert options from String-formatted to Object-formatted if needed
+       // (we check in cache first)
+       options = typeof options === "string" ?
+               ( optionsCache[ options ] || createOptions( options ) ) :
+               jQuery.extend( {}, options );
+
+       var // Last fire value (for non-forgettable lists)
+               memory,
+               // Flag to know if list was already fired
+               fired,
+               // Flag to know if list is currently firing
+               firing,
+               // First callback to fire (used internally by add and fireWith)
+               firingStart,
+               // End of the loop when firing
+               firingLength,
+               // Index of currently firing callback (modified by remove if needed)
+               firingIndex,
+               // Actual callback list
+               list = [],
+               // Stack of fire calls for repeatable lists
+               stack = !options.once && [],
+               // Fire callbacks
+               fire = function( data ) {
+                       memory = options.memory && data;
+                       fired = true;
+                       firingIndex = firingStart || 0;
+                       firingStart = 0;
+                       firingLength = list.length;
+                       firing = true;
+                       for ( ; list && firingIndex < firingLength; firingIndex++ ) {
+                               if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
+                                       memory = false; // To prevent further calls using add
+                                       break;
+                               }
+                       }
+                       firing = false;
+                       if ( list ) {
+                               if ( stack ) {
+                                       if ( stack.length ) {
+                                               fire( stack.shift() );
+                                       }
+                               } else if ( memory ) {
+                                       list = [];
+                               } else {
+                                       self.disable();
+                               }
+                       }
+               },
+               // Actual Callbacks object
+               self = {
+                       // Add a callback or a collection of callbacks to the list
+                       add: function() {
+                               if ( list ) {
+                                       // First, we save the current length
+                                       var start = list.length;
+                                       (function add( args ) {
+                                               jQuery.each( args, function( _, arg ) {
+                                                       var type = jQuery.type( arg );
+                                                       if ( type === "function" ) {
+                                                               if ( !options.unique || !self.has( arg ) ) {
+                                                                       list.push( arg );
+                                                               }
+                                                       } else if ( arg && arg.length && type !== "string" ) {
+                                                               // Inspect recursively
+                                                               add( arg );
+                                                       }
+                                               });
+                                       })( arguments );
+                                       // Do we need to add the callbacks to the
+                                       // current firing batch?
+                                       if ( firing ) {
+                                               firingLength = list.length;
+                                       // With memory, if we're not firing then
+                                       // we should call right away
+                                       } else if ( memory ) {
+                                               firingStart = start;
+                                               fire( memory );
+                                       }
+                               }
+                               return this;
+                       },
+                       // Remove a callback from the list
+                       remove: function() {
+                               if ( list ) {
+                                       jQuery.each( arguments, function( _, arg ) {
+                                               var index;
+                                               while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
+                                                       list.splice( index, 1 );
+                                                       // Handle firing indexes
+                                                       if ( firing ) {
+                                                               if ( index <= firingLength ) {
+                                                                       firingLength--;
+                                                               }
+                                                               if ( index <= firingIndex ) {
+                                                                       firingIndex--;
+                                                               }
+                                                       }
+                                               }
+                                       });
+                               }
+                               return this;
+                       },
+                       // Control if a given callback is in the list
+                       has: function( fn ) {
+                               return jQuery.inArray( fn, list ) > -1;
+                       },
+                       // Remove all callbacks from the list
+                       empty: function() {
+                               list = [];
+                               return this;
+                       },
+                       // Have the list do nothing anymore
+                       disable: function() {
+                               list = stack = memory = undefined;
+                               return this;
+                       },
+                       // Is it disabled?
+                       disabled: function() {
+                               return !list;
+                       },
+                       // Lock the list in its current state
+                       lock: function() {
+                               stack = undefined;
+                               if ( !memory ) {
+                                       self.disable();
+                               }
+                               return this;
+                       },
+                       // Is it locked?
+                       locked: function() {
+                               return !stack;
+                       },
+                       // Call all callbacks with the given context and arguments
+                       fireWith: function( context, args ) {
+                               args = args || [];
+                               args = [ context, args.slice ? args.slice() : args ];
+                               if ( list && ( !fired || stack ) ) {
+                                       if ( firing ) {
+                                               stack.push( args );
+                                       } else {
+                                               fire( args );
+                                       }
+                               }
+                               return this;
+                       },
+                       // Call all the callbacks with the given arguments
+                       fire: function() {
+                               self.fireWith( this, arguments );
+                               return this;
+                       },
+                       // To know if the callbacks have already been called at least once
+                       fired: function() {
+                               return !!fired;
+                       }
+               };
+
+       return self;
+};
+jQuery.extend({
+
+       Deferred: function( func ) {
+               var tuples = [
+                               // action, add listener, listener list, final state
+                               [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
+                               [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
+                               [ "notify", "progress", jQuery.Callbacks("memory") ]
+                       ],
+                       state = "pending",
+                       promise = {
+                               state: function() {
+                                       return state;
+                               },
+                               always: function() {
+                                       deferred.done( arguments ).fail( arguments );
+                                       return this;
+                               },
+                               then: function( /* fnDone, fnFail, fnProgress */ ) {
+                                       var fns = arguments;
+                                       return jQuery.Deferred(function( newDefer ) {
+                                               jQuery.each( tuples, function( i, tuple ) {
+                                                       var action = tuple[ 0 ],
+                                                               fn = fns[ i ];
+                                                       // deferred[ done | fail | progress ] for forwarding actions to newDefer
+                                                       deferred[ tuple[1] ]( jQuery.isFunction( fn ) ?
+                                                               function() {
+                                                                       var returned = fn.apply( this, arguments );
+                                                                       if ( returned && jQuery.isFunction( returned.promise ) ) {
+                                                                               returned.promise()
+                                                                                       .done( newDefer.resolve )
+                                                                                       .fail( newDefer.reject )
+                                                                                       .progress( newDefer.notify );
+                                                                       } else {
+                                                                               newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
+                                                                       }
+                                                               } :
+                                                               newDefer[ action ]
+                                                       );
+                                               });
+                                               fns = null;
+                                       }).promise();
+                               },
+                               // Get a promise for this deferred
+                               // If obj is provided, the promise aspect is added to the object
+                               promise: function( obj ) {
+                                       return obj != null ? jQuery.extend( obj, promise ) : promise;
+                               }
+                       },
+                       deferred = {};
+
+               // Keep pipe for back-compat
+               promise.pipe = promise.then;
+
+               // Add list-specific methods
+               jQuery.each( tuples, function( i, tuple ) {
+                       var list = tuple[ 2 ],
+                               stateString = tuple[ 3 ];
+
+                       // promise[ done | fail | progress ] = list.add
+                       promise[ tuple[1] ] = list.add;
+
+                       // Handle state
+                       if ( stateString ) {
+                               list.add(function() {
+                                       // state = [ resolved | rejected ]
+                                       state = stateString;
+
+                               // [ reject_list | resolve_list ].disable; progress_list.lock
+                               }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
+                       }
+
+                       // deferred[ resolve | reject | notify ] = list.fire
+                       deferred[ tuple[0] ] = list.fire;
+                       deferred[ tuple[0] + "With" ] = list.fireWith;
+               });
+
+               // Make the deferred a promise
+               promise.promise( deferred );
+
+               // Call given func if any
+               if ( func ) {
+                       func.call( deferred, deferred );
+               }
+
+               // All done!
+               return deferred;
+       },
+
+       // Deferred helper
+       when: function( subordinate /* , ..., subordinateN */ ) {
+               var i = 0,
+                       resolveValues = core_slice.call( arguments ),
+                       length = resolveValues.length,
+
+                       // the count of uncompleted subordinates
+                       remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
+
+                       // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
+                       deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
+
+                       // Update function for both resolve and progress values
+                       updateFunc = function( i, contexts, values ) {
+                               return function( value ) {
+                                       contexts[ i ] = this;
+                                       values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
+                                       if( values === progressValues ) {
+                                               deferred.notifyWith( contexts, values );
+                                       } else if ( !( --remaining ) ) {
+                                               deferred.resolveWith( contexts, values );
+                                       }
+                               };
+                       },
+
+                       progressValues, progressContexts, resolveContexts;
+
+               // add listeners to Deferred subordinates; treat others as resolved
+               if ( length > 1 ) {
+                       progressValues = new Array( length );
+                       progressContexts = new Array( length );
+                       resolveContexts = new Array( length );
+                       for ( ; i < length; i++ ) {
+                               if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
+                                       resolveValues[ i ].promise()
+                                               .done( updateFunc( i, resolveContexts, resolveValues ) )
+                                               .fail( deferred.reject )
+                                               .progress( updateFunc( i, progressContexts, progressValues ) );
+                               } else {
+                                       --remaining;
+                               }
+                       }
+               }
+
+               // if we're not waiting on anything, resolve the master
+               if ( !remaining ) {
+                       deferred.resolveWith( resolveContexts, resolveValues );
+               }
+
+               return deferred.promise();
+       }
+});
+jQuery.support = (function() {
+
+       var support,
+               all,
+               a,
+               select,
+               opt,
+               input,
+               fragment,
+               eventName,
+               i,
+               isSupported,
+               clickFn,
+               div = document.createElement("div");
+
+       // Setup
+       div.setAttribute( "className", "t" );
+       div.innerHTML = "  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
+
+       // Support tests won't run in some limited or non-browser environments
+       all = div.getElementsByTagName("*");
+       a = div.getElementsByTagName("a")[ 0 ];
+       if ( !all || !a || !all.length ) {
+               return {};
+       }
+
+       // First batch of tests
+       select = document.createElement("select");
+       opt = select.appendChild( document.createElement("option") );
+       input = div.getElementsByTagName("input")[ 0 ];
+
+       a.style.cssText = "top:1px;float:left;opacity:.5";
+       support = {
+               // IE strips leading whitespace when .innerHTML is used
+               leadingWhitespace: ( div.firstChild.nodeType === 3 ),
+
+               // Make sure that tbody elements aren't automatically inserted
+               // IE will insert them into empty tables
+               tbody: !div.getElementsByTagName("tbody").length,
+
+               // Make sure that link elements get serialized correctly by innerHTML
+               // This requires a wrapper element in IE
+               htmlSerialize: !!div.getElementsByTagName("link").length,
+
+               // Get the style information from getAttribute
+               // (IE uses .cssText instead)
+               style: /top/.test( a.getAttribute("style") ),
+
+               // Make sure that URLs aren't manipulated
+               // (IE normalizes it by default)
+               hrefNormalized: ( a.getAttribute("href") === "/a" ),
+
+               // Make sure that element opacity exists
+               // (IE uses filter instead)
+               // Use a regex to work around a WebKit issue. See #5145
+               opacity: /^0.5/.test( a.style.opacity ),
+
+               // Verify style float existence
+               // (IE uses styleFloat instead of cssFloat)
+               cssFloat: !!a.style.cssFloat,
+
+               // Make sure that if no value is specified for a checkbox
+               // that it defaults to "on".
+               // (WebKit defaults to "" instead)
+               checkOn: ( input.value === "on" ),
+
+               // Make sure that a selected-by-default option has a working selected property.
+               // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
+               optSelected: opt.selected,
+
+               // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
+               getSetAttribute: div.className !== "t",
+
+               // Tests for enctype support on a form (#6743)
+               enctype: !!document.createElement("form").enctype,
+
+               // Makes sure cloning an html5 element does not cause problems
+               // Where outerHTML is undefined, this still works
+               html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
+
+               // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
+               boxModel: ( document.compatMode === "CSS1Compat" ),
+
+               // Will be defined later
+               submitBubbles: true,
+               changeBubbles: true,
+               focusinBubbles: false,
+               deleteExpando: true,
+               noCloneEvent: true,
+               inlineBlockNeedsLayout: false,
+               shrinkWrapBlocks: false,
+               reliableMarginRight: true,
+               boxSizingReliable: true,
+               pixelPosition: false
+       };
+
+       // Make sure checked status is properly cloned
+       input.checked = true;
+       support.noCloneChecked = input.cloneNode( true ).checked;
+
+       // Make sure that the options inside disabled selects aren't marked as disabled
+       // (WebKit marks them as disabled)
+       select.disabled = true;
+       support.optDisabled = !opt.disabled;
+
+       // Test to see if it's possible to delete an expando from an element
+       // Fails in Internet Explorer
+       try {
+               delete div.test;
+       } catch( e ) {
+               support.deleteExpando = false;
+       }
+
+       if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
+               div.attachEvent( "onclick", clickFn = function() {
+                       // Cloning a node shouldn't copy over any
+                       // bound event handlers (IE does this)
+                       support.noCloneEvent = false;
+               });
+               div.cloneNode( true ).fireEvent("onclick");
+               div.detachEvent( "onclick", clickFn );
+       }
+
+       // Check if a radio maintains its value
+       // after being appended to the DOM
+       input = document.createElement("input");
+       input.value = "t";
+       input.setAttribute( "type", "radio" );
+       support.radioValue = input.value === "t";
+
+       input.setAttribute( "checked", "checked" );
+
+       // #11217 - WebKit loses check when the name is after the checked attribute
+       input.setAttribute( "name", "t" );
+
+       div.appendChild( input );
+       fragment = document.createDocumentFragment();
+       fragment.appendChild( div.lastChild );
+
+       // WebKit doesn't clone checked state correctly in fragments
+       support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
+
+       // Check if a disconnected checkbox will retain its checked
+       // value of true after appended to the DOM (IE6/7)
+       support.appendChecked = input.checked;
+
+       fragment.removeChild( input );
+       fragment.appendChild( div );
+
+       // Technique from Juriy Zaytsev
+       // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
+       // We only care about the case where non-standard event systems
+       // are used, namely in IE. Short-circuiting here helps us to
+       // avoid an eval call (in setAttribute) which can cause CSP
+       // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
+       if ( div.attachEvent ) {
+               for ( i in {
+                       submit: true,
+                       change: true,
+                       focusin: true
+               }) {
+                       eventName = "on" + i;
+                       isSupported = ( eventName in div );
+                       if ( !isSupported ) {
+                               div.setAttribute( eventName, "return;" );
+                               isSupported = ( typeof div[ eventName ] === "function" );
+                       }
+                       support[ i + "Bubbles" ] = isSupported;
+               }
+       }
+
+       // Run tests that need a body at doc ready
+       jQuery(function() {
+               var container, div, tds, marginDiv,
+                       divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;",
+                       body = document.getElementsByTagName("body")[0];
+
+               if ( !body ) {
+                       // Return for frameset docs that don't have a body
+                       return;
+               }
+
+               container = document.createElement("div");
+               container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px";
+               body.insertBefore( container, body.firstChild );
+
+               // Construct the test element
+               div = document.createElement("div");
+               container.appendChild( div );
+
+               // Check if table cells still have offsetWidth/Height when they are set
+               // to display:none and there are still other visible table cells in a
+               // table row; if so, offsetWidth/Height are not reliable for use when
+               // determining if an element has been hidden directly using
+               // display:none (it is still safe to use offsets if a parent element is
+               // hidden; don safety goggles and see bug #4512 for more information).
+               // (only IE 8 fails this test)
+               div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
+               tds = div.getElementsByTagName("td");
+               tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
+               isSupported = ( tds[ 0 ].offsetHeight === 0 );
+
+               tds[ 0 ].style.display = "";
+               tds[ 1 ].style.display = "none";
+
+               // Check if empty table cells still have offsetWidth/Height
+               // (IE <= 8 fail this test)
+               support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
+
+               // Check box-sizing and margin behavior
+               div.innerHTML = "";
+               div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
+               support.boxSizing = ( div.offsetWidth === 4 );
+               support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
+
+               // NOTE: To any future maintainer, we've window.getComputedStyle
+               // because jsdom on node.js will break without it.
+               if ( window.getComputedStyle ) {
+                       support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
+                       support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
+
+                       // Check if div with explicit width and no margin-right incorrectly
+                       // gets computed margin-right based on width of container. For more
+                       // info see bug #3333
+                       // Fails in WebKit before Feb 2011 nightlies
+                       // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+                       marginDiv = document.createElement("div");
+                       marginDiv.style.cssText = div.style.cssText = divReset;
+                       marginDiv.style.marginRight = marginDiv.style.width = "0";
+                       div.style.width = "1px";
+                       div.appendChild( marginDiv );
+                       support.reliableMarginRight =
+                               !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
+               }
+
+               if ( typeof div.style.zoom !== "undefined" ) {
+                       // Check if natively block-level elements act like inline-block
+                       // elements when setting their display to 'inline' and giving
+                       // them layout
+                       // (IE < 8 does this)
+                       div.innerHTML = "";
+                       div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
+                       support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
+
+                       // Check if elements with layout shrink-wrap their children
+                       // (IE 6 does this)
+                       div.style.display = "block";
+                       div.style.overflow = "visible";
+                       div.innerHTML = "<div></div>";
+                       div.firstChild.style.width = "5px";
+                       support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
+
+                       container.style.zoom = 1;
+               }
+
+               // Null elements to avoid leaks in IE
+               body.removeChild( container );
+               container = div = tds = marginDiv = null;
+       });
+
+       // Null elements to avoid leaks in IE
+       fragment.removeChild( div );
+       all = a = select = opt = input = fragment = div = null;
+
+       return support;
+})();
+var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
+       rmultiDash = /([A-Z])/g;
+
+jQuery.extend({
+       cache: {},
+
+       deletedIds: [],
+
+       // Remove at next major release (1.9/2.0)
+       uuid: 0,
+
+       // Unique for each copy of jQuery on the page
+       // Non-digits removed to match rinlinejQuery
+       expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
+
+       // The following elements throw uncatchable exceptions if you
+       // attempt to add expando properties to them.
+       noData: {
+               "embed": true,
+               // Ban all objects except for Flash (which handle expandos)
+               "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
+               "applet": true
+       },
+
+       hasData: function( elem ) {
+               elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
+               return !!elem && !isEmptyDataObject( elem );
+       },
+
+       data: function( elem, name, data, pvt /* Internal Use Only */ ) {
+               if ( !jQuery.acceptData( elem ) ) {
+                       return;
+               }
+
+               var thisCache, ret,
+                       internalKey = jQuery.expando,
+                       getByName = typeof name === "string",
+
+                       // We have to handle DOM nodes and JS objects differently because IE6-7
+                       // can't GC object references properly across the DOM-JS boundary
+                       isNode = elem.nodeType,
+
+                       // Only DOM nodes need the global jQuery cache; JS object data is
+                       // attached directly to the object so GC can occur automatically
+                       cache = isNode ? jQuery.cache : elem,
+
+                       // Only defining an ID for JS objects if its cache already exists allows
+                       // the code to shortcut on the same path as a DOM node with no cache
+                       id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
+
+               // Avoid doing any more work than we need to when trying to get data on an
+               // object that has no data at all
+               if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
+                       return;
+               }
+
+               if ( !id ) {
+                       // Only DOM nodes need a new unique ID for each element since their data
+                       // ends up in the global cache
+                       if ( isNode ) {
+                               elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++;
+                       } else {
+                               id = internalKey;
+                       }
+               }
+
+               if ( !cache[ id ] ) {
+                       cache[ id ] = {};
+
+                       // Avoids exposing jQuery metadata on plain JS objects when the object
+                       // is serialized using JSON.stringify
+                       if ( !isNode ) {
+                               cache[ id ].toJSON = jQuery.noop;
+                       }
+               }
+
+               // An object can be passed to jQuery.data instead of a key/value pair; this gets
+               // shallow copied over onto the existing cache
+               if ( typeof name === "object" || typeof name === "function" ) {
+                       if ( pvt ) {
+                               cache[ id ] = jQuery.extend( cache[ id ], name );
+                       } else {
+                               cache[ id ].data = jQuery.extend( cache[ id ].data, name );
+                       }
+               }
+
+               thisCache = cache[ id ];
+
+               // jQuery data() is stored in a separate object inside the object's internal data
+               // cache in order to avoid key collisions between internal data and user-defined
+               // data.
+               if ( !pvt ) {
+                       if ( !thisCache.data ) {
+                               thisCache.data = {};
+                       }
+
+                       thisCache = thisCache.data;
+               }
+
+               if ( data !== undefined ) {
+                       thisCache[ jQuery.camelCase( name ) ] = data;
+               }
+
+               // Check for both converted-to-camel and non-converted data property names
+               // If a data property was specified
+               if ( getByName ) {
+
+                       // First Try to find as-is property data
+                       ret = thisCache[ name ];
+
+                       // Test for null|undefined property data
+                       if ( ret == null ) {
+
+                               // Try to find the camelCased property
+                               ret = thisCache[ jQuery.camelCase( name ) ];
+                       }
+               } else {
+                       ret = thisCache;
+               }
+
+               return ret;
+       },
+
+       removeData: function( elem, name, pvt /* Internal Use Only */ ) {
+               if ( !jQuery.acceptData( elem ) ) {
+                       return;
+               }
+
+               var thisCache, i, l,
+
+                       isNode = elem.nodeType,
+
+                       // See jQuery.data for more information
+                       cache = isNode ? jQuery.cache : elem,
+                       id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
+
+               // If there is already no cache entry for this object, there is no
+               // purpose in continuing
+               if ( !cache[ id ] ) {
+                       return;
+               }
+
+               if ( name ) {
+
+                       thisCache = pvt ? cache[ id ] : cache[ id ].data;
+
+                       if ( thisCache ) {
+
+                               // Support array or space separated string names for data keys
+                               if ( !jQuery.isArray( name ) ) {
+
+                                       // try the string as a key before any manipulation
+                                       if ( name in thisCache ) {
+                                               name = [ name ];
+                                       } else {
+
+                                               // split the camel cased version by spaces unless a key with the spaces exists
+                                               name = jQuery.camelCase( name );
+                                               if ( name in thisCache ) {
+                                                       name = [ name ];
+                                               } else {
+                                                       name = name.split(" ");
+                                               }
+                                       }
+                               }
+
+                               for ( i = 0, l = name.length; i < l; i++ ) {
+                                       delete thisCache[ name[i] ];
+                               }
+
+                               // If there is no data left in the cache, we want to continue
+                               // and let the cache object itself get destroyed
+                               if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
+                                       return;
+                               }
+                       }
+               }
+
+               // See jQuery.data for more information
+               if ( !pvt ) {
+                       delete cache[ id ].data;
+
+                       // Don't destroy the parent cache unless the internal data object
+                       // had been the only thing left in it
+                       if ( !isEmptyDataObject( cache[ id ] ) ) {
+                               return;
+                       }
+               }
+
+               // Destroy the cache
+               if ( isNode ) {
+                       jQuery.cleanData( [ elem ], true );
+
+               // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
+               } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
+                       delete cache[ id ];
+
+               // When all else fails, null
+               } else {
+                       cache[ id ] = null;
+               }
+       },
+
+       // For internal use only.
+       _data: function( elem, name, data ) {
+               return jQuery.data( elem, name, data, true );
+       },
+
+       // A method for determining if a DOM node can handle the data expando
+       acceptData: function( elem ) {
+               var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
+
+               // nodes accept data unless otherwise specified; rejection can be conditional
+               return !noData || noData !== true && elem.getAttribute("classid") === noData;
+       }
+});
+
+jQuery.fn.extend({
+       data: function( key, value ) {
+               var parts, part, attr, name, l,
+                       elem = this[0],
+                       i = 0,
+                       data = null;
+
+               // Gets all values
+               if ( key === undefined ) {
+                       if ( this.length ) {
+                               data = jQuery.data( elem );
+
+                               if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
+                                       attr = elem.attributes;
+                                       for ( l = attr.length; i < l; i++ ) {
+                                               name = attr[i].name;
+
+                                               if ( !name.indexOf( "data-" ) ) {
+                                                       name = jQuery.camelCase( name.substring(5) );
+
+                                                       dataAttr( elem, name, data[ name ] );
+                                               }
+                                       }
+                                       jQuery._data( elem, "parsedAttrs", true );
+                               }
+                       }
+
+                       return data;
+               }
+
+               // Sets multiple values
+               if ( typeof key === "object" ) {
+                       return this.each(function() {
+                               jQuery.data( this, key );
+                       });
+               }
+
+               parts = key.split( ".", 2 );
+               parts[1] = parts[1] ? "." + parts[1] : "";
+               part = parts[1] + "!";
+
+               return jQuery.access( this, function( value ) {
+
+                       if ( value === undefined ) {
+                               data = this.triggerHandler( "getData" + part, [ parts[0] ] );
+
+                               // Try to fetch any internally stored data first
+                               if ( data === undefined && elem ) {
+                                       data = jQuery.data( elem, key );
+                                       data = dataAttr( elem, key, data );
+                               }
+
+                               return data === undefined && parts[1] ?
+                                       this.data( parts[0] ) :
+                                       data;
+                       }
+
+                       parts[1] = value;
+                       this.each(function() {
+                               var self = jQuery( this );
+
+                               self.triggerHandler( "setData" + part, parts );
+                               jQuery.data( this, key, value );
+                               self.triggerHandler( "changeData" + part, parts );
+                       });
+               }, null, value, arguments.length > 1, null, false );
+       },
+
+       removeData: function( key ) {
+               return this.each(function() {
+                       jQuery.removeData( this, key );
+               });
+       }
+});
+
+function dataAttr( elem, key, data ) {
+       // If nothing was found internally, try to fetch any
+       // data from the HTML5 data-* attribute
+       if ( data === undefined && elem.nodeType === 1 ) {
+
+               var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
+
+               data = elem.getAttribute( name );
+
+               if ( typeof data === "string" ) {
+                       try {
+                               data = data === "true" ? true :
+                               data === "false" ? false :
+                               data === "null" ? null :
+                               // Only convert to a number if it doesn't change the string
+                               +data + "" === data ? +data :
+                               rbrace.test( data ) ? jQuery.parseJSON( data ) :
+                                       data;
+                       } catch( e ) {}
+
+                       // Make sure we set the data so it isn't changed later
+                       jQuery.data( elem, key, data );
+
+               } else {
+                       data = undefined;
+               }
+       }
+
+       return data;
+}
+
+// checks a cache object for emptiness
+function isEmptyDataObject( obj ) {
+       var name;
+       for ( name in obj ) {
+
+               // if the public data object is empty, the private is still empty
+               if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
+                       continue;
+               }
+               if ( name !== "toJSON" ) {
+                       return false;
+               }
+       }
+
+       return true;
+}
+jQuery.extend({
+       queue: function( elem, type, data ) {
+               var queue;
+
+               if ( elem ) {
+                       type = ( type || "fx" ) + "queue";
+                       queue = jQuery._data( elem, type );
+
+                       // Speed up dequeue by getting out quickly if this is just a lookup
+                       if ( data ) {
+                               if ( !queue || jQuery.isArray(data) ) {
+                                       queue = jQuery._data( elem, type, jQuery.makeArray(data) );
+                               } else {
+                                       queue.push( data );
+                               }
+                       }
+                       return queue || [];
+               }
+       },
+
+       dequeue: function( elem, type ) {
+               type = type || "fx";
+
+               var queue = jQuery.queue( elem, type ),
+                       startLength = queue.length,
+                       fn = queue.shift(),
+                       hooks = jQuery._queueHooks( elem, type ),
+                       next = function() {
+                               jQuery.dequeue( elem, type );
+                       };
+
+               // If the fx queue is dequeued, always remove the progress sentinel
+               if ( fn === "inprogress" ) {
+                       fn = queue.shift();
+                       startLength--;
+               }
+
+               if ( fn ) {
+
+                       // Add a progress sentinel to prevent the fx queue from being
+                       // automatically dequeued
+                       if ( type === "fx" ) {
+                               queue.unshift( "inprogress" );
+                       }
+
+                       // clear up the last queue stop function
+                       delete hooks.stop;
+                       fn.call( elem, next, hooks );
+               }
+
+               if ( !startLength && hooks ) {
+                       hooks.empty.fire();
+               }
+       },
+
+       // not intended for public consumption - generates a queueHooks object, or returns the current one
+       _queueHooks: function( elem, type ) {
+               var key = type + "queueHooks";
+               return jQuery._data( elem, key ) || jQuery._data( elem, key, {
+                       empty: jQuery.Callbacks("once memory").add(function() {
+                               jQuery.removeData( elem, type + "queue", true );
+                               jQuery.removeData( elem, key, true );
+                       })
+               });
+       }
+});
+
+jQuery.fn.extend({
+       queue: function( type, data ) {
+               var setter = 2;
+
+               if ( typeof type !== "string" ) {
+                       data = type;
+                       type = "fx";
+                       setter--;
+               }
+
+               if ( arguments.length < setter ) {
+                       return jQuery.queue( this[0], type );
+               }
+
+               return data === undefined ?
+                       this :
+                       this.each(function() {
+                               var queue = jQuery.queue( this, type, data );
+
+                               // ensure a hooks for this queue
+                               jQuery._queueHooks( this, type );
+
+                               if ( type === "fx" && queue[0] !== "inprogress" ) {
+                                       jQuery.dequeue( this, type );
+                               }
+                       });
+       },
+       dequeue: function( type ) {
+               return this.each(function() {
+                       jQuery.dequeue( this, type );
+               });
+       },
+       // Based off of the plugin by Clint Helfers, with permission.
+       // http://blindsignals.com/index.php/2009/07/jquery-delay/
+       delay: function( time, type ) {
+               time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
+               type = type || "fx";
+
+               return this.queue( type, function( next, hooks ) {
+                       var timeout = setTimeout( next, time );
+                       hooks.stop = function() {
+                               clearTimeout( timeout );
+                       };
+               });
+       },
+       clearQueue: function( type ) {
+               return this.queue( type || "fx", [] );
+       },
+       // Get a promise resolved when queues of a certain type
+       // are emptied (fx is the type by default)
+       promise: function( type, obj ) {
+               var tmp,
+                       count = 1,
+                       defer = jQuery.Deferred(),
+                       elements = this,
+                       i = this.length,
+                       resolve = function() {
+                               if ( !( --count ) ) {
+                                       defer.resolveWith( elements, [ elements ] );
+                               }
+                       };
+
+               if ( typeof type !== "string" ) {
+                       obj = type;
+                       type = undefined;
+               }
+               type = type || "fx";
+
+               while( i-- ) {
+                       tmp = jQuery._data( elements[ i ], type + "queueHooks" );
+                       if ( tmp && tmp.empty ) {
+                               count++;
+                               tmp.empty.add( resolve );
+                       }
+               }
+               resolve();
+               return defer.promise( obj );
+       }
+});
+var nodeHook, boolHook, fixSpecified,
+       rclass = /[\t\r\n]/g,
+       rreturn = /\r/g,
+       rtype = /^(?:button|input)$/i,
+       rfocusable = /^(?:button|input|object|select|textarea)$/i,
+       rclickable = /^a(?:rea|)$/i,
+       rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
+       getSetAttribute = jQuery.support.getSetAttribute;
+
+jQuery.fn.extend({
+       attr: function( name, value ) {
+               return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
+       },
+
+       removeAttr: function( name ) {
+               return this.each(function() {
+                       jQuery.removeAttr( this, name );
+               });
+       },
+
+       prop: function( name, value ) {
+               return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
+       },
+
+       removeProp: function( name ) {
+               name = jQuery.propFix[ name ] || name;
+               return this.each(function() {
+                       // try/catch handles cases where IE balks (such as removing a property on window)
+                       try {
+                               this[ name ] = undefined;
+                               delete this[ name ];
+                       } catch( e ) {}
+               });
+       },
+
+       addClass: function( value ) {
+               var classNames, i, l, elem,
+                       setClass, c, cl;
+
+               if ( jQuery.isFunction( value ) ) {
+                       return this.each(function( j ) {
+                               jQuery( this ).addClass( value.call(this, j, this.className) );
+                       });
+               }
+
+               if ( value && typeof value === "string" ) {
+                       classNames = value.split( core_rspace );
+
+                       for ( i = 0, l = this.length; i < l; i++ ) {
+                               elem = this[ i ];
+
+                               if ( elem.nodeType === 1 ) {
+                                       if ( !elem.className && classNames.length === 1 ) {
+                                               elem.className = value;
+
+                                       } else {
+                                               setClass = " " + elem.className + " ";
+
+                                               for ( c = 0, cl = classNames.length; c < cl; c++ ) {
+                                                       if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) {
+                                                               setClass += classNames[ c ] + " ";
+                                                       }
+                                               }
+                                               elem.className = jQuery.trim( setClass );
+                                       }
+                               }
+                       }
+               }
+
+               return this;
+       },
+
+       removeClass: function( value ) {
+               var removes, className, elem, c, cl, i, l;
+
+               if ( jQuery.isFunction( value ) ) {
+                       return this.each(function( j ) {
+                               jQuery( this ).removeClass( value.call(this, j, this.className) );
+                       });
+               }
+               if ( (value && typeof value === "string") || value === undefined ) {
+                       removes = ( value || "" ).split( core_rspace );
+
+                       for ( i = 0, l = this.length; i < l; i++ ) {
+                               elem = this[ i ];
+                               if ( elem.nodeType === 1 && elem.className ) {
+
+                                       className = (" " + elem.className + " ").replace( rclass, " " );
+
+                                       // loop over each item in the removal list
+                                       for ( c = 0, cl = removes.length; c < cl; c++ ) {
+                                               // Remove until there is nothing to remove,
+                                               while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) {
+                                                       className = className.replace( " " + removes[ c ] + " " , " " );
+                                               }
+                                       }
+                                       elem.className = value ? jQuery.trim( className ) : "";
+                               }
+                       }
+               }
+
+               return this;
+       },
+
+       toggleClass: function( value, stateVal ) {
+               var type = typeof value,
+                       isBool = typeof stateVal === "boolean";
+
+               if ( jQuery.isFunction( value ) ) {
+                       return this.each(function( i ) {
+                               jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
+                       });
+               }
+
+               return this.each(function() {
+                       if ( type === "string" ) {
+                               // toggle individual class names
+                               var className,
+                                       i = 0,
+                                       self = jQuery( this ),
+                                       state = stateVal,
+                                       classNames = value.split( core_rspace );
+
+                               while ( (className = classNames[ i++ ]) ) {
+                                       // check each className given, space separated list
+                                       state = isBool ? state : !self.hasClass( className );
+                                       self[ state ? "addClass" : "removeClass" ]( className );
+                               }
+
+                       } else if ( type === "undefined" || type === "boolean" ) {
+                               if ( this.className ) {
+                                       // store className if set
+                                       jQuery._data( this, "__className__", this.className );
+                               }
+
+                               // toggle whole className
+                               this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
+                       }
+               });
+       },
+
+       hasClass: function( selector ) {
+               var className = " " + selector + " ",
+                       i = 0,
+                       l = this.length;
+               for ( ; i < l; i++ ) {
+                       if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
+                               return true;
+                       }
+               }
+
+               return false;
+       },
+
+       val: function( value ) {
+               var hooks, ret, isFunction,
+                       elem = this[0];
+
+               if ( !arguments.length ) {
+                       if ( elem ) {
+                               hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
+
+                               if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
+                                       return ret;
+                               }
+
+                               ret = elem.value;
+
+                               return typeof ret === "string" ?
+                                       // handle most common string cases
+                                       ret.replace(rreturn, "") :
+                                       // handle cases where value is null/undef or number
+                                       ret == null ? "" : ret;
+                       }
+
+                       return;
+               }
+
+               isFunction = jQuery.isFunction( value );
+
+               return this.each(function( i ) {
+                       var val,
+                               self = jQuery(this);
+
+                       if ( this.nodeType !== 1 ) {
+                               return;
+                       }
+
+                       if ( isFunction ) {
+                               val = value.call( this, i, self.val() );
+                       } else {
+                               val = value;
+                       }
+
+                       // Treat null/undefined as ""; convert numbers to string
+                       if ( val == null ) {
+                               val = "";
+                       } else if ( typeof val === "number" ) {
+                               val += "";
+                       } else if ( jQuery.isArray( val ) ) {
+                               val = jQuery.map(val, function ( value ) {
+                                       return value == null ? "" : value + "";
+                               });
+                       }
+
+                       hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
+
+                       // If set returns undefined, fall back to normal setting
+                       if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
+                               this.value = val;
+                       }
+               });
+       }
+});
+
+jQuery.extend({
+       valHooks: {
+               option: {
+                       get: function( elem ) {
+                               // attributes.value is undefined in Blackberry 4.7 but
+                               // uses .value. See #6932
+                               var val = elem.attributes.value;
+                               return !val || val.specified ? elem.value : elem.text;
+                       }
+               },
+               select: {
+                       get: function( elem ) {
+                               var value, option,
+                                       options = elem.options,
+                                       index = elem.selectedIndex,
+                                       one = elem.type === "select-one" || index < 0,
+                                       values = one ? null : [],
+                                       max = one ? index + 1 : options.length,
+                                       i = index < 0 ?
+                                               max :
+                                               one ? index : 0;
+
+                               // Loop through all the selected options
+                               for ( ; i < max; i++ ) {
+                                       option = options[ i ];
+
+                                       // oldIE doesn't update selected after form reset (#2551)
+                                       if ( ( option.selected || i === index ) &&
+                                                       // Don't return options that are disabled or in a disabled optgroup
+                                                       ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
+                                                       ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
+
+                                               // Get the specific value for the option
+                                               value = jQuery( option ).val();
+
+                                               // We don't need an array for one selects
+                                               if ( one ) {
+                                                       return value;
+                                               }
+
+                                               // Multi-Selects return an array
+                                               values.push( value );
+                                       }
+                               }
+
+                               return values;
+                       },
+
+                       set: function( elem, value ) {
+                               var values = jQuery.makeArray( value );
+
+                               jQuery(elem).find("option").each(function() {
+                                       this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
+                               });
+
+                               if ( !values.length ) {
+                                       elem.selectedIndex = -1;
+                               }
+                               return values;
+                       }
+               }
+       },
+
+       // Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9
+       attrFn: {},
+
+       attr: function( elem, name, value, pass ) {
+               var ret, hooks, notxml,
+                       nType = elem.nodeType;
+
+               // don't get/set attributes on text, comment and attribute nodes
+               if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+                       return;
+               }
+
+               if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) {
+                       return jQuery( elem )[ name ]( value );
+               }
+
+               // Fallback to prop when attributes are not supported
+               if ( typeof elem.getAttribute === "undefined" ) {
+                       return jQuery.prop( elem, name, value );
+               }
+
+               notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+               // All attributes are lowercase
+               // Grab necessary hook if one is defined
+               if ( notxml ) {
+                       name = name.toLowerCase();
+                       hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
+               }
+
+               if ( value !== undefined ) {
+
+                       if ( value === null ) {
+                               jQuery.removeAttr( elem, name );
+                               return;
+
+                       } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
+                               return ret;
+
+                       } else {
+                               elem.setAttribute( name, value + "" );
+                               return value;
+                       }
+
+               } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
+                       return ret;
+
+               } else {
+
+                       ret = elem.getAttribute( name );
+
+                       // Non-existent attributes return null, we normalize to undefined
+                       return ret === null ?
+                               undefined :
+                               ret;
+               }
+       },
+
+       removeAttr: function( elem, value ) {
+               var propName, attrNames, name, isBool,
+                       i = 0;
+
+               if ( value && elem.nodeType === 1 ) {
+
+                       attrNames = value.split( core_rspace );
+
+                       for ( ; i < attrNames.length; i++ ) {
+                               name = attrNames[ i ];
+
+                               if ( name ) {
+                                       propName = jQuery.propFix[ name ] || name;
+                                       isBool = rboolean.test( name );
+
+                                       // See #9699 for explanation of this approach (setting first, then removal)
+                                       // Do not do this for boolean attributes (see #10870)
+                                       if ( !isBool ) {
+                                               jQuery.attr( elem, name, "" );
+                                       }
+                                       elem.removeAttribute( getSetAttribute ? name : propName );
+
+                                       // Set corresponding property to false for boolean attributes
+                                       if ( isBool && propName in elem ) {
+                                               elem[ propName ] = false;
+                                       }
+                               }
+                       }
+               }
+       },
+
+       attrHooks: {
+               type: {
+                       set: function( elem, value ) {
+                               // We can't allow the type property to be changed (since it causes problems in IE)
+                               if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
+                                       jQuery.error( "type property can't be changed" );
+                               } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
+                                       // Setting the type on a radio button after the value resets the value in IE6-9
+                                       // Reset value to it's default in case type is set after value
+                                       // This is for element creation
+                                       var val = elem.value;
+                                       elem.setAttribute( "type", value );
+                                       if ( val ) {
+                                               elem.value = val;
+                                       }
+                                       return value;
+                               }
+                       }
+               },
+               // Use the value property for back compat
+               // Use the nodeHook for button elements in IE6/7 (#1954)
+               value: {
+                       get: function( elem, name ) {
+                               if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
+                                       return nodeHook.get( elem, name );
+                               }
+                               return name in elem ?
+                                       elem.value :
+                                       null;
+                       },
+                       set: function( elem, value, name ) {
+                               if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
+                                       return nodeHook.set( elem, value, name );
+                               }
+                               // Does not return so that setAttribute is also used
+                               elem.value = value;
+                       }
+               }
+       },
+
+       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( elem, name, value ) {
+               var ret, hooks, notxml,
+                       nType = elem.nodeType;
+
+               // don't get/set properties on text, comment and attribute nodes
+               if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
+                       return;
+               }
+
+               notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
+
+               if ( notxml ) {
+                       // Fix name and attach hooks
+                       name = jQuery.propFix[ name ] || name;
+                       hooks = jQuery.propHooks[ name ];
+               }
+
+               if ( value !== undefined ) {
+                       if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
+                               return ret;
+
+                       } else {
+                               return ( elem[ name ] = value );
+                       }
+
+               } else {
+                       if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
+                               return ret;
+
+                       } else {
+                               return elem[ name ];
+                       }
+               }
+       },
+
+       propHooks: {
+               tabIndex: {
+                       get: function( elem ) {
+                               // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
+                               // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
+                               var attributeNode = elem.getAttributeNode("tabindex");
+
+                               return attributeNode && attributeNode.specified ?
+                                       parseInt( attributeNode.value, 10 ) :
+                                       rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
+                                               0 :
+                                               undefined;
+                       }
+               }
+       }
+});
+
+// Hook for boolean attributes
+boolHook = {
+       get: function( elem, name ) {
+               // Align boolean attributes with corresponding properties
+               // Fall back to attribute presence where some booleans are not supported
+               var attrNode,
+                       property = jQuery.prop( elem, name );
+               return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
+                       name.toLowerCase() :
+                       undefined;
+       },
+       set: function( elem, value, name ) {
+               var propName;
+               if ( value === false ) {
+                       // Remove boolean attributes when set to false
+                       jQuery.removeAttr( elem, name );
+               } else {
+                       // value is true since we know at this point it's type boolean and not false
+                       // Set boolean attributes to the same name and set the DOM property
+                       propName = jQuery.propFix[ name ] || name;
+                       if ( propName in elem ) {
+                               // Only set the IDL specifically if it already exists on the element
+                               elem[ propName ] = true;
+                       }
+
+                       elem.setAttribute( name, name.toLowerCase() );
+               }
+               return name;
+       }
+};
+
+// IE6/7 do not support getting/setting some attributes with get/setAttribute
+if ( !getSetAttribute ) {
+
+       fixSpecified = {
+               name: true,
+               id: true,
+               coords: true
+       };
+
+       // Use this for any attribute in IE6/7
+       // This fixes almost every IE6/7 issue
+       nodeHook = jQuery.valHooks.button = {
+               get: function( elem, name ) {
+                       var ret;
+                       ret = elem.getAttributeNode( name );
+                       return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ?
+                               ret.value :
+                               undefined;
+               },
+               set: function( elem, value, name ) {
+                       // Set the existing or create a new attribute node
+                       var ret = elem.getAttributeNode( name );
+                       if ( !ret ) {
+                               ret = document.createAttribute( name );
+                               elem.setAttributeNode( ret );
+                       }
+                       return ( ret.value = value + "" );
+               }
+       };
+
+       // Set width and height to auto instead of 0 on empty string( Bug #8150 )
+       // This is for removals
+       jQuery.each([ "width", "height" ], function( i, name ) {
+               jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+                       set: function( elem, value ) {
+                               if ( value === "" ) {
+                                       elem.setAttribute( name, "auto" );
+                                       return value;
+                               }
+                       }
+               });
+       });
+
+       // Set contenteditable to false on removals(#10429)
+       // Setting to empty string throws an error as an invalid value
+       jQuery.attrHooks.contenteditable = {
+               get: nodeHook.get,
+               set: function( elem, value, name ) {
+                       if ( value === "" ) {
+                               value = "false";
+                       }
+                       nodeHook.set( elem, value, name );
+               }
+       };
+}
+
+
+// Some attributes require a special call on IE
+if ( !jQuery.support.hrefNormalized ) {
+       jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
+               jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
+                       get: function( elem ) {
+                               var ret = elem.getAttribute( name, 2 );
+                               return ret === null ? undefined : ret;
+                       }
+               });
+       });
+}
+
+if ( !jQuery.support.style ) {
+       jQuery.attrHooks.style = {
+               get: function( elem ) {
+                       // Return undefined in the case of empty string
+                       // Normalize to lowercase since IE uppercases css property names
+                       return elem.style.cssText.toLowerCase() || undefined;
+               },
+               set: function( elem, value ) {
+                       return ( elem.style.cssText = value + "" );
+               }
+       };
+}
+
+// Safari mis-reports the default selected property of an option
+// Accessing the parent's selectedIndex property fixes it
+if ( !jQuery.support.optSelected ) {
+       jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
+               get: function( elem ) {
+                       var parent = elem.parentNode;
+
+                       if ( parent ) {
+                               parent.selectedIndex;
+
+                               // Make sure that it also works with optgroups, see #5701
+                               if ( parent.parentNode ) {
+                                       parent.parentNode.selectedIndex;
+                               }
+                       }
+                       return null;
+               }
+       });
+}
+
+// IE6/7 call enctype encoding
+if ( !jQuery.support.enctype ) {
+       jQuery.propFix.enctype = "encoding";
+}
+
+// Radios and checkboxes getter/setter
+if ( !jQuery.support.checkOn ) {
+       jQuery.each([ "radio", "checkbox" ], function() {
+               jQuery.valHooks[ this ] = {
+                       get: function( elem ) {
+                               // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
+                               return elem.getAttribute("value") === null ? "on" : elem.value;
+                       }
+               };
+       });
+}
+jQuery.each([ "radio", "checkbox" ], function() {
+       jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
+               set: function( elem, value ) {
+                       if ( jQuery.isArray( value ) ) {
+                               return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
+                       }
+               }
+       });
+});
+var rformElems = /^(?:textarea|input|select)$/i,
+       rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/,
+       rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
+       rkeyEvent = /^key/,
+       rmouseEvent = /^(?:mouse|contextmenu)|click/,
+       rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
+       hoverHack = function( events ) {
+               return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
+       };
+
+/*
+ * Helper functions for managing events -- not part of the public interface.
+ * Props to Dean Edwards' addEvent library for many of the ideas.
+ */
+jQuery.event = {
+
+       add: function( elem, types, handler, data, selector ) {
+
+               var elemData, eventHandle, events,
+                       t, tns, type, namespaces, handleObj,
+                       handleObjIn, handlers, special;
+
+               // Don't attach events to noData or text/comment nodes (allow plain objects tho)
+               if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
+                       return;
+               }
+
+               // Caller can pass in an object of custom data in lieu of the handler
+               if ( handler.handler ) {
+                       handleObjIn = handler;
+                       handler = handleObjIn.handler;
+                       selector = handleObjIn.selector;
+               }
+
+               // Make sure that the handler has a unique ID, used to find/remove it later
+               if ( !handler.guid ) {
+                       handler.guid = jQuery.guid++;
+               }
+
+               // Init the element's event structure and main handler, if this is the first
+               events = elemData.events;
+               if ( !events ) {
+                       elemData.events = events = {};
+               }
+               eventHandle = elemData.handle;
+               if ( !eventHandle ) {
+                       elemData.handle = eventHandle = function( e ) {
+                               // Discard the second event of a jQuery.event.trigger() and
+                               // when an event is called after a page has unloaded
+                               return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
+                                       jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
+                                       undefined;
+                       };
+                       // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
+                       eventHandle.elem = elem;
+               }
+
+               // Handle multiple events separated by a space
+               // jQuery(...).bind("mouseover mouseout", fn);
+               types = jQuery.trim( hoverHack(types) ).split( " " );
+               for ( t = 0; t < types.length; t++ ) {
+
+                       tns = rtypenamespace.exec( types[t] ) || [];
+                       type = tns[1];
+                       namespaces = ( tns[2] || "" ).split( "." ).sort();
+
+                       // If event changes its type, use the special event handlers for the changed type
+                       special = jQuery.event.special[ type ] || {};
+
+                       // If selector defined, determine special event api type, otherwise given type
+                       type = ( selector ? special.delegateType : special.bindType ) || type;
+
+                       // Update special based on newly reset type
+                       special = jQuery.event.special[ type ] || {};
+
+                       // handleObj is passed to all event handlers
+                       handleObj = jQuery.extend({
+                               type: type,
+                               origType: tns[1],
+                               data: data,
+                               handler: handler,
+                               guid: handler.guid,
+                               selector: selector,
+                               needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
+                               namespace: namespaces.join(".")
+                       }, handleObjIn );
+
+                       // Init the event handler queue if we're the first
+                       handlers = events[ type ];
+                       if ( !handlers ) {
+                               handlers = events[ type ] = [];
+                               handlers.delegateCount = 0;
+
+                               // Only use addEventListener/attachEvent if the special events handler returns false
+                               if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
+                                       // Bind the global event handler to the element
+                                       if ( elem.addEventListener ) {
+                                               elem.addEventListener( type, eventHandle, false );
+
+                                       } else if ( elem.attachEvent ) {
+                                               elem.attachEvent( "on" + type, eventHandle );
+                                       }
+                               }
+                       }
+
+                       if ( special.add ) {
+                               special.add.call( elem, handleObj );
+
+                               if ( !handleObj.handler.guid ) {
+                                       handleObj.handler.guid = handler.guid;
+                               }
+                       }
+
+                       // Add to the element's handler list, delegates in front
+                       if ( selector ) {
+                               handlers.splice( handlers.delegateCount++, 0, handleObj );
+                       } else {
+                               handlers.push( handleObj );
+                       }
+
+                       // Keep track of which events have ever been used, for event optimization
+                       jQuery.event.global[ type ] = true;
+               }
+
+               // Nullify elem to prevent memory leaks in IE
+               elem = null;
+       },
+
+       global: {},
+
+       // Detach an event or set of events from an element
+       remove: function( elem, types, handler, selector, mappedTypes ) {
+
+               var t, tns, type, origType, namespaces, origCount,
+                       j, events, special, eventType, handleObj,
+                       elemData = jQuery.hasData( elem ) && jQuery._data( elem );
+
+               if ( !elemData || !(events = elemData.events) ) {
+                       return;
+               }
+
+               // Once for each type.namespace in types; type may be omitted
+               types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
+               for ( t = 0; t < types.length; t++ ) {
+                       tns = rtypenamespace.exec( types[t] ) || [];
+                       type = origType = tns[1];
+                       namespaces = tns[2];
+
+                       // Unbind all events (on this namespace, if provided) for the element
+                       if ( !type ) {
+                               for ( type in events ) {
+                                       jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
+                               }
+                               continue;
+                       }
+
+                       special = jQuery.event.special[ type ] || {};
+                       type = ( selector? special.delegateType : special.bindType ) || type;
+                       eventType = events[ type ] || [];
+                       origCount = eventType.length;
+                       namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
+
+                       // Remove matching events
+                       for ( j = 0; j < eventType.length; j++ ) {
+                               handleObj = eventType[ j ];
+
+                               if ( ( mappedTypes || origType === handleObj.origType ) &&
+                                        ( !handler || handler.guid === handleObj.guid ) &&
+                                        ( !namespaces || namespaces.test( handleObj.namespace ) ) &&
+                                        ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
+                                       eventType.splice( j--, 1 );
+
+                                       if ( handleObj.selector ) {
+                                               eventType.delegateCount--;
+                                       }
+                                       if ( special.remove ) {
+                                               special.remove.call( elem, handleObj );
+                                       }
+                               }
+                       }
+
+                       // Remove generic event handler if we removed something and no more handlers exist
+                       // (avoids potential for endless recursion during removal of special event handlers)
+                       if ( eventType.length === 0 && origCount !== eventType.length ) {
+                               if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
+                                       jQuery.removeEvent( elem, type, elemData.handle );
+                               }
+
+                               delete events[ type ];
+                       }
+               }
+
+               // Remove the expando if it's no longer used
+               if ( jQuery.isEmptyObject( events ) ) {
+                       delete elemData.handle;
+
+                       // removeData also checks for emptiness and clears the expando if empty
+                       // so use it instead of delete
+                       jQuery.removeData( elem, "events", true );
+               }
+       },
+
+       // Events that are safe to short-circuit if no handlers are attached.
+       // Native DOM events should not be added, they may have inline handlers.
+       customEvent: {
+               "getData": true,
+               "setData": true,
+               "changeData": true
+       },
+
+       trigger: function( event, data, elem, onlyHandlers ) {
+               // Don't do events on text and comment nodes
+               if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
+                       return;
+               }
+
+               // Event object or event type
+               var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType,
+                       type = event.type || event,
+                       namespaces = [];
+
+               // focus/blur morphs to focusin/out; ensure we're not firing them right now
+               if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
+                       return;
+               }
+
+               if ( type.indexOf( "!" ) >= 0 ) {
+                       // Exclusive events trigger only for the exact event (no namespaces)
+                       type = type.slice(0, -1);
+                       exclusive = true;
+               }
+
+               if ( type.indexOf( "." ) >= 0 ) {
+                       // Namespaced trigger; create a regexp to match event type in handle()
+                       namespaces = type.split(".");
+                       type = namespaces.shift();
+                       namespaces.sort();
+               }
+
+               if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
+                       // No jQuery handlers for this event type, and it can't have inline handlers
+                       return;
+               }
+
+               // Caller can pass in an Event, Object, or just an event type string
+               event = typeof event === "object" ?
+                       // jQuery.Event object
+                       event[ jQuery.expando ] ? event :
+                       // Object literal
+                       new jQuery.Event( type, event ) :
+                       // Just the event type (string)
+                       new jQuery.Event( type );
+
+               event.type = type;
+               event.isTrigger = true;
+               event.exclusive = exclusive;
+               event.namespace = namespaces.join( "." );
+               event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
+               ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
+
+               // Handle a global trigger
+               if ( !elem ) {
+
+                       // TODO: Stop taunting the data cache; remove global events and always attach to document
+                       cache = jQuery.cache;
+                       for ( i in cache ) {
+                               if ( cache[ i ].events && cache[ i ].events[ type ] ) {
+                                       jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
+                               }
+                       }
+                       return;
+               }
+
+               // Clean up the event in case it is being reused
+               event.result = undefined;
+               if ( !event.target ) {
+                       event.target = elem;
+               }
+
+               // Clone any incoming data and prepend the event, creating the handler arg list
+               data = data != null ? jQuery.makeArray( data ) : [];
+               data.unshift( event );
+
+               // Allow special events to draw outside the lines
+               special = jQuery.event.special[ type ] || {};
+               if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
+                       return;
+               }
+
+               // Determine event propagation path in advance, per W3C events spec (#9951)
+               // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
+               eventPath = [[ elem, special.bindType || type ]];
+               if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
+
+                       bubbleType = special.delegateType || type;
+                       cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
+                       for ( old = elem; cur; cur = cur.parentNode ) {
+                               eventPath.push([ cur, bubbleType ]);
+                               old = cur;
+                       }
+
+                       // Only add window if we got to document (e.g., not plain obj or detached DOM)
+                       if ( old === (elem.ownerDocument || document) ) {
+                               eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
+                       }
+               }
+
+               // Fire handlers on the event path
+               for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
+
+                       cur = eventPath[i][0];
+                       event.type = eventPath[i][1];
+
+                       handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
+                       if ( handle ) {
+                               handle.apply( cur, data );
+                       }
+                       // Note that this is a bare JS function and not a jQuery handler
+                       handle = ontype && cur[ ontype ];
+                       if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
+                               event.preventDefault();
+                       }
+               }
+               event.type = type;
+
+               // If nobody prevented the default action, do it now
+               if ( !onlyHandlers && !event.isDefaultPrevented() ) {
+
+                       if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
+                               !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
+
+                               // Call a native DOM method on the target with the same name name as the event.
+                               // Can't use an .isFunction() check here because IE6/7 fails that test.
+                               // Don't do default actions on window, that's where global variables be (#6170)
+                               // IE<9 dies on focus/blur to hidden element (#1486)
+                               if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
+
+                                       // Don't re-trigger an onFOO event when we call its FOO() method
+                                       old = elem[ ontype ];
+
+                                       if ( old ) {
+                                               elem[ ontype ] = null;
+                                       }
+
+                                       // Prevent re-triggering of the same event, since we already bubbled it above
+                                       jQuery.event.triggered = type;
+                                       elem[ type ]();
+                                       jQuery.event.triggered = undefined;
+
+                                       if ( old ) {
+                                               elem[ ontype ] = old;
+                                       }
+                               }
+                       }
+               }
+
+               return event.result;
+       },
+
+       dispatch: function( event ) {
+
+               // Make a writable jQuery.Event from the native event object
+               event = jQuery.event.fix( event || window.event );
+
+               var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related,
+                       handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
+                       delegateCount = handlers.delegateCount,
+                       args = core_slice.call( arguments ),
+                       run_all = !event.exclusive && !event.namespace,
+                       special = jQuery.event.special[ event.type ] || {},
+                       handlerQueue = [];
+
+               // Use the fix-ed jQuery.Event rather than the (read-only) native event
+               args[0] = event;
+               event.delegateTarget = this;
+
+               // Call the preDispatch hook for the mapped type, and let it bail if desired
+               if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
+                       return;
+               }
+
+               // Determine handlers that should run if there are delegated events
+               // Avoid non-left-click bubbling in Firefox (#3861)
+               if ( delegateCount && !(event.button && event.type === "click") ) {
+
+                       for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
+
+                               // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764)
+                               if ( cur.disabled !== true || event.type !== "click" ) {
+                                       selMatch = {};
+                                       matches = [];
+                                       for ( i = 0; i < delegateCount; i++ ) {
+                                               handleObj = handlers[ i ];
+                                               sel = handleObj.selector;
+
+                                               if ( selMatch[ sel ] === undefined ) {
+                                                       selMatch[ sel ] = handleObj.needsContext ?
+                                                               jQuery( sel, this ).index( cur ) >= 0 :
+                                                               jQuery.find( sel, this, null, [ cur ] ).length;
+                                               }
+                                               if ( selMatch[ sel ] ) {
+                                                       matches.push( handleObj );
+                                               }
+                                       }
+                                       if ( matches.length ) {
+                                               handlerQueue.push({ elem: cur, matches: matches });
+                                       }
+                               }
+                       }
+               }
+
+               // Add the remaining (directly-bound) handlers
+               if ( handlers.length > delegateCount ) {
+                       handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
+               }
+
+               // Run delegates first; they may want to stop propagation beneath us
+               for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
+                       matched = handlerQueue[ i ];
+                       event.currentTarget = matched.elem;
+
+                       for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
+                               handleObj = matched.matches[ j ];
+
+                               // Triggered event must either 1) be non-exclusive and have no namespace, or
+                               // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
+                               if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
+
+                                       event.data = handleObj.data;
+                                       event.handleObj = handleObj;
+
+                                       ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
+                                                       .apply( matched.elem, args );
+
+                                       if ( ret !== undefined ) {
+                                               event.result = ret;
+                                               if ( ret === false ) {
+                                                       event.preventDefault();
+                                                       event.stopPropagation();
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               // Call the postDispatch hook for the mapped type
+               if ( special.postDispatch ) {
+                       special.postDispatch.call( this, event );
+               }
+
+               return event.result;
+       },
+
+       // Includes some event props shared by KeyEvent and MouseEvent
+       // *** attrChange attrName relatedNode srcElement  are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
+       props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
+
+       fixHooks: {},
+
+       keyHooks: {
+               props: "char charCode key keyCode".split(" "),
+               filter: function( event, original ) {
+
+                       // Add which for key events
+                       if ( event.which == null ) {
+                               event.which = original.charCode != null ? original.charCode : original.keyCode;
+                       }
+
+                       return event;
+               }
+       },
+
+       mouseHooks: {
+               props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
+               filter: function( event, original ) {
+                       var eventDoc, doc, body,
+                               button = original.button,
+                               fromElement = original.fromElement;
+
+                       // Calculate pageX/Y if missing and clientX/Y available
+                       if ( event.pageX == null && original.clientX != null ) {
+                               eventDoc = event.target.ownerDocument || document;
+                               doc = eventDoc.documentElement;
+                               body = eventDoc.body;
+
+                               event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
+                               event.pageY = original.clientY + ( doc && doc.scrollTop  || body && body.scrollTop  || 0 ) - ( doc && doc.clientTop  || body && body.clientTop  || 0 );
+                       }
+
+                       // Add relatedTarget, if necessary
+                       if ( !event.relatedTarget && fromElement ) {
+                               event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
+                       }
+
+                       // Add which for click: 1 === left; 2 === middle; 3 === right
+                       // Note: button is not normalized, so don't use it
+                       if ( !event.which && button !== undefined ) {
+                               event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
+                       }
+
+                       return event;
+               }
+       },
+
+       fix: function( event ) {
+               if ( event[ jQuery.expando ] ) {
+                       return event;
+               }
+
+               // Create a writable copy of the event object and normalize some properties
+               var i, prop,
+                       originalEvent = event,
+                       fixHook = jQuery.event.fixHooks[ event.type ] || {},
+                       copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
+
+               event = jQuery.Event( originalEvent );
+
+               for ( i = copy.length; i; ) {
+                       prop = copy[ --i ];
+                       event[ prop ] = originalEvent[ prop ];
+               }
+
+               // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
+               if ( !event.target ) {
+                       event.target = originalEvent.srcElement || document;
+               }
+
+               // Target should not be a text node (#504, Safari)
+               if ( event.target.nodeType === 3 ) {
+                       event.target = event.target.parentNode;
+               }
+
+               // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8)
+               event.metaKey = !!event.metaKey;
+
+               return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
+       },
+
+       special: {
+               load: {
+                       // Prevent triggered image.load events from bubbling to window.load
+                       noBubble: true
+               },
+
+               focus: {
+                       delegateType: "focusin"
+               },
+               blur: {
+                       delegateType: "focusout"
+               },
+
+               beforeunload: {
+                       setup: function( data, namespaces, eventHandle ) {
+                               // We only want to do this special case on windows
+                               if ( jQuery.isWindow( this ) ) {
+                                       this.onbeforeunload = eventHandle;
+                               }
+                       },
+
+                       teardown: function( namespaces, eventHandle ) {
+                               if ( this.onbeforeunload === eventHandle ) {
+                                       this.onbeforeunload = null;
+                               }
+                       }
+               }
+       },
+
+       simulate: function( type, elem, event, bubble ) {
+               // Piggyback on a donor event to simulate a different one.
+               // Fake originalEvent to avoid donor's stopPropagation, but if the
+               // simulated event prevents default then we do the same on the donor.
+               var e = jQuery.extend(
+                       new jQuery.Event(),
+                       event,
+                       { type: type,
+                               isSimulated: true,
+                               originalEvent: {}
+                       }
+               );
+               if ( bubble ) {
+                       jQuery.event.trigger( e, null, elem );
+               } else {
+                       jQuery.event.dispatch.call( elem, e );
+               }
+               if ( e.isDefaultPrevented() ) {
+                       event.preventDefault();
+               }
+       }
+};
+
+// Some plugins are using, but it's undocumented/deprecated and will be removed.
+// The 1.7 special event interface should provide all the hooks needed now.
+jQuery.event.handle = jQuery.event.dispatch;
+
+jQuery.removeEvent = document.removeEventListener ?
+       function( elem, type, handle ) {
+               if ( elem.removeEventListener ) {
+                       elem.removeEventListener( type, handle, false );
+               }
+       } :
+       function( elem, type, handle ) {
+               var name = "on" + type;
+
+               if ( elem.detachEvent ) {
+
+                       // #8545, #7054, preventing memory leaks for custom events in IE6-8
+                       // detachEvent needed property on element, by name of that event, to properly expose it to GC
+                       if ( typeof elem[ name ] === "undefined" ) {
+                               elem[ name ] = null;
+                       }
+
+                       elem.detachEvent( name, handle );
+               }
+       };
+
+jQuery.Event = function( src, props ) {
+       // Allow instantiation without the 'new' keyword
+       if ( !(this instanceof jQuery.Event) ) {
+               return new jQuery.Event( src, props );
+       }
+
+       // Event object
+       if ( src && src.type ) {
+               this.originalEvent = src;
+               this.type = src.type;
+
+               // Events bubbling up the document may have been marked as prevented
+               // by a handler lower down the tree; reflect the correct value.
+               this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
+                       src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
+
+       // Event type
+       } else {
+               this.type = src;
+       }
+
+       // Put explicitly provided properties onto the event object
+       if ( props ) {
+               jQuery.extend( this, props );
+       }
+
+       // Create a timestamp if incoming event doesn't have one
+       this.timeStamp = src && src.timeStamp || jQuery.now();
+
+       // Mark it as fixed
+       this[ jQuery.expando ] = true;
+};
+
+function returnFalse() {
+       return false;
+}
+function returnTrue() {
+       return true;
+}
+
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
+// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
+jQuery.Event.prototype = {
+       preventDefault: function() {
+               this.isDefaultPrevented = returnTrue;
+
+               var e = this.originalEvent;
+               if ( !e ) {
+                       return;
+               }
+
+               // if preventDefault exists run it on the original event
+               if ( e.preventDefault ) {
+                       e.preventDefault();
+
+               // otherwise set the returnValue property of the original event to false (IE)
+               } else {
+                       e.returnValue = false;
+               }
+       },
+       stopPropagation: function() {
+               this.isPropagationStopped = returnTrue;
+
+               var e = this.originalEvent;
+               if ( !e ) {
+                       return;
+               }
+               // if stopPropagation exists run it on the original event
+               if ( e.stopPropagation ) {
+                       e.stopPropagation();
+               }
+               // otherwise set the cancelBubble property of the original event to true (IE)
+               e.cancelBubble = true;
+       },
+       stopImmediatePropagation: function() {
+               this.isImmediatePropagationStopped = returnTrue;
+               this.stopPropagation();
+       },
+       isDefaultPrevented: returnFalse,
+       isPropagationStopped: returnFalse,
+       isImmediatePropagationStopped: returnFalse
+};
+
+// Create mouseenter/leave events using mouseover/out and event-time checks
+jQuery.each({
+       mouseenter: "mouseover",
+       mouseleave: "mouseout"
+}, function( orig, fix ) {
+       jQuery.event.special[ orig ] = {
+               delegateType: fix,
+               bindType: fix,
+
+               handle: function( event ) {
+                       var ret,
+                               target = this,
+                               related = event.relatedTarget,
+                               handleObj = event.handleObj,
+                               selector = handleObj.selector;
+
+                       // For mousenter/leave call the handler if related is outside the target.
+                       // NB: No relatedTarget if the mouse left/entered the browser window
+                       if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
+                               event.type = handleObj.origType;
+                               ret = handleObj.handler.apply( this, arguments );
+                               event.type = fix;
+                       }
+                       return ret;
+               }
+       };
+});
+
+// IE submit delegation
+if ( !jQuery.support.submitBubbles ) {
+
+       jQuery.event.special.submit = {
+               setup: function() {
+                       // Only need this for delegated form submit events
+                       if ( jQuery.nodeName( this, "form" ) ) {
+                               return false;
+                       }
+
+                       // Lazy-add a submit handler when a descendant form may potentially be submitted
+                       jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
+                               // Node name check avoids a VML-related crash in IE (#9807)
+                               var elem = e.target,
+                                       form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
+                               if ( form && !jQuery._data( form, "_submit_attached" ) ) {
+                                       jQuery.event.add( form, "submit._submit", function( event ) {
+                                               event._submit_bubble = true;
+                                       });
+                                       jQuery._data( form, "_submit_attached", true );
+                               }
+                       });
+                       // return undefined since we don't need an event listener
+               },
+
+               postDispatch: function( event ) {
+                       // If form was submitted by the user, bubble the event up the tree
+                       if ( event._submit_bubble ) {
+                               delete event._submit_bubble;
+                               if ( this.parentNode && !event.isTrigger ) {
+                                       jQuery.event.simulate( "submit", this.parentNode, event, true );
+                               }
+                       }
+               },
+
+               teardown: function() {
+                       // Only need this for delegated form submit events
+                       if ( jQuery.nodeName( this, "form" ) ) {
+                               return false;
+                       }
+
+                       // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
+                       jQuery.event.remove( this, "._submit" );
+               }
+       };
+}
+
+// IE change delegation and checkbox/radio fix
+if ( !jQuery.support.changeBubbles ) {
+
+       jQuery.event.special.change = {
+
+               setup: function() {
+
+                       if ( rformElems.test( this.nodeName ) ) {
+                               // IE doesn't fire change on a check/radio until blur; trigger it on click
+                               // after a propertychange. Eat the blur-change in special.change.handle.
+                               // This still fires onchange a second time for check/radio after blur.
+                               if ( this.type === "checkbox" || this.type === "radio" ) {
+                                       jQuery.event.add( this, "propertychange._change", function( event ) {
+                                               if ( event.originalEvent.propertyName === "checked" ) {
+                                                       this._just_changed = true;
+                                               }
+                                       });
+                                       jQuery.event.add( this, "click._change", function( event ) {
+                                               if ( this._just_changed && !event.isTrigger ) {
+                                                       this._just_changed = false;
+                                               }
+                                               // Allow triggered, simulated change events (#11500)
+                                               jQuery.event.simulate( "change", this, event, true );
+                                       });
+                               }
+                               return false;
+                       }
+                       // Delegated event; lazy-add a change handler on descendant inputs
+                       jQuery.event.add( this, "beforeactivate._change", function( e ) {
+                               var elem = e.target;
+
+                               if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) {
+                                       jQuery.event.add( elem, "change._change", function( event ) {
+                                               if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
+                                                       jQuery.event.simulate( "change", this.parentNode, event, true );
+                                               }
+                                       });
+                                       jQuery._data( elem, "_change_attached", true );
+                               }
+                       });
+               },
+
+               handle: function( event ) {
+                       var elem = event.target;
+
+                       // Swallow native change events from checkbox/radio, we already triggered them above
+                       if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
+                               return event.handleObj.handler.apply( this, arguments );
+                       }
+               },
+
+               teardown: function() {
+                       jQuery.event.remove( this, "._change" );
+
+                       return !rformElems.test( this.nodeName );
+               }
+       };
+}
+
+// Create "bubbling" focus and blur events
+if ( !jQuery.support.focusinBubbles ) {
+       jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
+
+               // Attach a single capturing handler while someone wants focusin/focusout
+               var attaches = 0,
+                       handler = function( event ) {
+                               jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
+                       };
+
+               jQuery.event.special[ fix ] = {
+                       setup: function() {
+                               if ( attaches++ === 0 ) {
+                                       document.addEventListener( orig, handler, true );
+                               }
+                       },
+                       teardown: function() {
+                               if ( --attaches === 0 ) {
+                                       document.removeEventListener( orig, handler, true );
+                               }
+                       }
+               };
+       });
+}
+
+jQuery.fn.extend({
+
+       on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
+               var origFn, type;
+
+               // Types can be a map of types/handlers
+               if ( typeof types === "object" ) {
+                       // ( types-Object, selector, data )
+                       if ( typeof selector !== "string" ) { // && selector != null
+                               // ( types-Object, data )
+                               data = data || selector;
+                               selector = undefined;
+                       }
+                       for ( type in types ) {
+                               this.on( type, selector, data, types[ type ], one );
+                       }
+                       return this;
+               }
+
+               if ( data == null && fn == null ) {
+                       // ( types, fn )
+                       fn = selector;
+                       data = selector = undefined;
+               } else if ( fn == null ) {
+                       if ( typeof selector === "string" ) {
+                               // ( types, selector, fn )
+                               fn = data;
+                               data = undefined;
+                       } else {
+                               // ( types, data, fn )
+                               fn = data;
+                               data = selector;
+                               selector = undefined;
+                       }
+               }
+               if ( fn === false ) {
+                       fn = returnFalse;
+               } else if ( !fn ) {
+                       return this;
+               }
+
+               if ( one === 1 ) {
+                       origFn = fn;
+                       fn = function( event ) {
+                               // Can use an empty set, since event contains the info
+                               jQuery().off( event );
+                               return origFn.apply( this, arguments );
+                       };
+                       // Use same guid so caller can remove using origFn
+                       fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
+               }
+               return this.each( function() {
+                       jQuery.event.add( this, types, fn, data, selector );
+               });
+       },
+       one: function( types, selector, data, fn ) {
+               return this.on( types, selector, data, fn, 1 );
+       },
+       off: function( types, selector, fn ) {
+               var handleObj, type;
+               if ( types && types.preventDefault && types.handleObj ) {
+                       // ( event )  dispatched jQuery.Event
+                       handleObj = types.handleObj;
+                       jQuery( types.delegateTarget ).off(
+                               handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
+                               handleObj.selector,
+                               handleObj.handler
+                       );
+                       return this;
+               }
+               if ( typeof types === "object" ) {
+                       // ( types-object [, selector] )
+                       for ( type in types ) {
+                               this.off( type, selector, types[ type ] );
+                       }
+                       return this;
+               }
+               if ( selector === false || typeof selector === "function" ) {
+                       // ( types [, fn] )
+                       fn = selector;
+                       selector = undefined;
+               }
+               if ( fn === false ) {
+                       fn = returnFalse;
+               }
+               return this.each(function() {
+                       jQuery.event.remove( this, types, fn, selector );
+               });
+       },
+
+       bind: function( types, data, fn ) {
+               return this.on( types, null, data, fn );
+       },
+       unbind: function( types, fn ) {
+               return this.off( types, null, fn );
+       },
+
+       live: function( types, data, fn ) {
+               jQuery( this.context ).on( types, this.selector, data, fn );
+               return this;
+       },
+       die: function( types, fn ) {
+               jQuery( this.context ).off( types, this.selector || "**", fn );
+               return this;
+       },
+
+       delegate: function( selector, types, data, fn ) {
+               return this.on( types, selector, data, fn );
+       },
+       undelegate: function( selector, types, fn ) {
+               // ( namespace ) or ( selector, types [, fn] )
+               return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
+       },
+
+       trigger: function( type, data ) {
+               return this.each(function() {
+                       jQuery.event.trigger( type, data, this );
+               });
+       },
+       triggerHandler: function( type, data ) {
+               if ( this[0] ) {
+                       return jQuery.event.trigger( type, data, this[0], true );
+               }
+       },
+
+       toggle: function( fn ) {
+               // Save reference to arguments for access in closure
+               var args = arguments,
+                       guid = fn.guid || jQuery.guid++,
+                       i = 0,
+                       toggler = function( event ) {
+                               // Figure out which function to execute
+                               var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
+                               jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
+
+                               // Make sure that clicks stop
+                               event.preventDefault();
+
+                               // and execute the function
+                               return args[ lastToggle ].apply( this, arguments ) || false;
+                       };
+
+               // link all the functions, so any of them can unbind this click handler
+               toggler.guid = guid;
+               while ( i < args.length ) {
+                       args[ i++ ].guid = guid;
+               }
+
+               return this.click( toggler );
+       },
+
+       hover: function( fnOver, fnOut ) {
+               return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
+       }
+});
+
+jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
+       "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
+       "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
+
+       // Handle event binding
+       jQuery.fn[ name ] = function( data, fn ) {
+               if ( fn == null ) {
+                       fn = data;
+                       data = null;
+               }
+
+               return arguments.length > 0 ?
+                       this.on( name, null, data, fn ) :
+                       this.trigger( name );
+       };
+
+       if ( rkeyEvent.test( name ) ) {
+               jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
+       }
+
+       if ( rmouseEvent.test( name ) ) {
+               jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
+       }
+});
+/*!\r
+ * Sizzle CSS Selector Engine\r
+ * Copyright 2012 jQuery Foundation and other contributors\r
+ * Released under the MIT license\r
+ * http://sizzlejs.com/\r
+ */\r
+(function( window, undefined ) {\r
+\r
+var cachedruns,\r
+       assertGetIdNotName,\r
+       Expr,\r
+       getText,\r
+       isXML,\r
+       contains,\r
+       compile,\r
+       sortOrder,\r
+       hasDuplicate,\r
+       outermostContext,\r
+\r
+       baseHasDuplicate = true,\r
+       strundefined = "undefined",\r
+\r
+       expando = ( "sizcache" + Math.random() ).replace( ".", "" ),\r
+\r
+       Token = String,\r
+       document = window.document,\r
+       docElem = document.documentElement,\r
+       dirruns = 0,\r
+       done = 0,\r
+       pop = [].pop,\r
+       push = [].push,\r
+       slice = [].slice,\r
+       // Use a stripped-down indexOf if a native one is unavailable\r
+       indexOf = [].indexOf || function( elem ) {\r
+               var i = 0,\r
+                       len = this.length;\r
+               for ( ; i < len; i++ ) {\r
+                       if ( this[i] === elem ) {\r
+                               return i;\r
+                       }\r
+               }\r
+               return -1;\r
+       },\r
+\r
+       // Augment a function for special use by Sizzle\r
+       markFunction = function( fn, value ) {\r
+               fn[ expando ] = value == null || value;\r
+               return fn;\r
+       },\r
+\r
+       createCache = function() {\r
+               var cache = {},\r
+                       keys = [];\r
+\r
+               return markFunction(function( key, value ) {\r
+                       // Only keep the most recent entries\r
+                       if ( keys.push( key ) > Expr.cacheLength ) {\r
+                               delete cache[ keys.shift() ];\r
+                       }\r
+\r
+                       // Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157)\r
+                       return (cache[ key + " " ] = value);\r
+               }, cache );\r
+       },\r
+\r
+       classCache = createCache(),\r
+       tokenCache = createCache(),\r
+       compilerCache = createCache(),\r
+\r
+       // Regex\r
+\r
+       // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace\r
+       whitespace = "[\\x20\\t\\r\\n\\f]",\r
+       // http://www.w3.org/TR/css3-syntax/#characters\r
+       characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",\r
+\r
+       // Loosely modeled on CSS identifier characters\r
+       // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors)\r
+       // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier\r
+       identifier = characterEncoding.replace( "w", "w#" ),\r
+\r
+       // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors\r
+       operators = "([*^$|!~]?=)",\r
+       attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +\r
+               "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",\r
+\r
+       // Prefer arguments not in parens/brackets,\r
+       //   then attribute selectors and non-pseudos (denoted by :),\r
+       //   then anything else\r
+       // These preferences are here to reduce the number of selectors\r
+       //   needing tokenize in the PSEUDO preFilter\r
+       pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)",\r
+\r
+       // For matchExpr.POS and matchExpr.needsContext\r
+       pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +\r
+               "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)",\r
+\r
+       // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter\r
+       rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),\r
+\r
+       rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),\r
+       rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),\r
+       rpseudo = new RegExp( pseudos ),\r
+\r
+       // Easily-parseable/retrievable ID or TAG or CLASS selectors\r
+       rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,\r
+\r
+       rnot = /^:not/,\r
+       rsibling = /[\x20\t\r\n\f]*[+~]/,\r
+       rendsWithNot = /:not\($/,\r
+\r
+       rheader = /h\d/i,\r
+       rinputs = /input|select|textarea|button/i,\r
+\r
+       rbackslash = /\\(?!\\)/g,\r
+\r
+       matchExpr = {\r
+               "ID": new RegExp( "^#(" + characterEncoding + ")" ),\r
+               "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),\r
+               "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),\r
+               "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),\r
+               "ATTR": new RegExp( "^" + attributes ),\r
+               "PSEUDO": new RegExp( "^" + pseudos ),\r
+               "POS": new RegExp( pos, "i" ),\r
+               "CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace +\r
+                       "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +\r
+                       "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),\r
+               // For use in libraries implementing .is()\r
+               "needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" )\r
+       },\r
+\r
+       // Support\r
+\r
+       // Used for testing something on an element\r
+       assert = function( fn ) {\r
+               var div = document.createElement("div");\r
+\r
+               try {\r
+                       return fn( div );\r
+               } catch (e) {\r
+                       return false;\r
+               } finally {\r
+                       // release memory in IE\r
+                       div = null;\r
+               }\r
+       },\r
+\r
+       // Check if getElementsByTagName("*") returns only elements\r
+       assertTagNameNoComments = assert(function( div ) {\r
+               div.appendChild( document.createComment("") );\r
+               return !div.getElementsByTagName("*").length;\r
+       }),\r
+\r
+       // Check if getAttribute returns normalized href attributes\r
+       assertHrefNotNormalized = assert(function( div ) {\r
+               div.innerHTML = "<a href='#'></a>";\r
+               return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&\r
+                       div.firstChild.getAttribute("href") === "#";\r
+       }),\r
+\r
+       // Check if attributes should be retrieved by attribute nodes\r
+       assertAttributes = assert(function( div ) {\r
+               div.innerHTML = "<select></select>";\r
+               var type = typeof div.lastChild.getAttribute("multiple");\r
+               // IE8 returns a string for some attributes even when not present\r
+               return type !== "boolean" && type !== "string";\r
+       }),\r
+\r
+       // Check if getElementsByClassName can be trusted\r
+       assertUsableClassName = assert(function( div ) {\r
+               // Opera can't find a second classname (in 9.6)\r
+               div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";\r
+               if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {\r
+                       return false;\r
+               }\r
+\r
+               // Safari 3.2 caches class attributes and doesn't catch changes\r
+               div.lastChild.className = "e";\r
+               return div.getElementsByClassName("e").length === 2;\r
+       }),\r
+\r
+       // Check if getElementById returns elements by name\r
+       // Check if getElementsByName privileges form controls or returns elements by ID\r
+       assertUsableName = assert(function( div ) {\r
+               // Inject content\r
+               div.id = expando + 0;\r
+               div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";\r
+               docElem.insertBefore( div, docElem.firstChild );\r
+\r
+               // Test\r
+               var pass = document.getElementsByName &&\r
+                       // buggy browsers will return fewer than the correct 2\r
+                       document.getElementsByName( expando ).length === 2 +\r
+                       // buggy browsers will return more than the correct 0\r
+                       document.getElementsByName( expando + 0 ).length;\r
+               assertGetIdNotName = !document.getElementById( expando );\r
+\r
+               // Cleanup\r
+               docElem.removeChild( div );\r
+\r
+               return pass;\r
+       });\r
+\r
+// If slice is not available, provide a backup\r
+try {\r
+       slice.call( docElem.childNodes, 0 )[0].nodeType;\r
+} catch ( e ) {\r
+       slice = function( i ) {\r
+               var elem,\r
+                       results = [];\r
+               for ( ; (elem = this[i]); i++ ) {\r
+                       results.push( elem );\r
+               }\r
+               return results;\r
+       };\r
+}\r
+\r
+function Sizzle( selector, context, results, seed ) {\r
+       results = results || [];\r
+       context = context || document;\r
+       var match, elem, xml, m,\r
+               nodeType = context.nodeType;\r
+\r
+       if ( !selector || typeof selector !== "string" ) {\r
+               return results;\r
+       }\r
+\r
+       if ( nodeType !== 1 && nodeType !== 9 ) {\r
+               return [];\r
+       }\r
+\r
+       xml = isXML( context );\r
+\r
+       if ( !xml && !seed ) {\r
+               if ( (match = rquickExpr.exec( selector )) ) {\r
+                       // Speed-up: Sizzle("#ID")\r
+                       if ( (m = match[1]) ) {\r
+                               if ( nodeType === 9 ) {\r
+                                       elem = context.getElementById( m );\r
+                                       // Check parentNode to catch when Blackberry 4.6 returns\r
+                                       // nodes that are no longer in the document #6963\r
+                                       if ( elem && elem.parentNode ) {\r
+                                               // Handle the case where IE, Opera, and Webkit return items\r
+                                               // by name instead of ID\r
+                                               if ( elem.id === m ) {\r
+                                                       results.push( elem );\r
+                                                       return results;\r
+                                               }\r
+                                       } else {\r
+                                               return results;\r
+                                       }\r
+                               } else {\r
+                                       // Context is not a document\r
+                                       if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&\r
+                                               contains( context, elem ) && elem.id === m ) {\r
+                                               results.push( elem );\r
+                                               return results;\r
+                                       }\r
+                               }\r
+\r
+                       // Speed-up: Sizzle("TAG")\r
+                       } else if ( match[2] ) {\r
+                               push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );\r
+                               return results;\r
+\r
+                       // Speed-up: Sizzle(".CLASS")\r
+                       } else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) {\r
+                               push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );\r
+                               return results;\r
+                       }\r
+               }\r
+       }\r
+\r
+       // All others\r
+       return select( selector.replace( rtrim, "$1" ), context, results, seed, xml );\r
+}\r
+\r
+Sizzle.matches = function( expr, elements ) {\r
+       return Sizzle( expr, null, null, elements );\r
+};\r
+\r
+Sizzle.matchesSelector = function( elem, expr ) {\r
+       return Sizzle( expr, null, null, [ elem ] ).length > 0;\r
+};\r
+\r
+// Returns a function to use in pseudos for input types\r
+function createInputPseudo( type ) {\r
+       return function( elem ) {\r
+               var name = elem.nodeName.toLowerCase();\r
+               return name === "input" && elem.type === type;\r
+       };\r
+}\r
+\r
+// Returns a function to use in pseudos for buttons\r
+function createButtonPseudo( type ) {\r
+       return function( elem ) {\r
+               var name = elem.nodeName.toLowerCase();\r
+               return (name === "input" || name === "button") && elem.type === type;\r
+       };\r
+}\r
+\r
+// Returns a function to use in pseudos for positionals\r
+function createPositionalPseudo( fn ) {\r
+       return markFunction(function( argument ) {\r
+               argument = +argument;\r
+               return markFunction(function( seed, matches ) {\r
+                       var j,\r
+                               matchIndexes = fn( [], seed.length, argument ),\r
+                               i = matchIndexes.length;\r
+\r
+                       // Match elements found at the specified indexes\r
+                       while ( i-- ) {\r
+                               if ( seed[ (j = matchIndexes[i]) ] ) {\r
+                                       seed[j] = !(matches[j] = seed[j]);\r
+                               }\r
+                       }\r
+               });\r
+       });\r
+}\r
+\r
+/**\r
+ * Utility function for retrieving the text value of an array of DOM nodes\r
+ * @param {Array|Element} elem\r
+ */\r
+getText = Sizzle.getText = function( elem ) {\r
+       var node,\r
+               ret = "",\r
+               i = 0,\r
+               nodeType = elem.nodeType;\r
+\r
+       if ( nodeType ) {\r
+               if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {\r
+                       // Use textContent for elements\r
+                       // innerText usage removed for consistency of new lines (see #11153)\r
+                       if ( typeof elem.textContent === "string" ) {\r
+                               return elem.textContent;\r
+                       } else {\r
+                               // Traverse its children\r
+                               for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {\r
+                                       ret += getText( elem );\r
+                               }\r
+                       }\r
+               } else if ( nodeType === 3 || nodeType === 4 ) {\r
+                       return elem.nodeValue;\r
+               }\r
+               // Do not include comment or processing instruction nodes\r
+       } else {\r
+\r
+               // If no nodeType, this is expected to be an array\r
+               for ( ; (node = elem[i]); i++ ) {\r
+                       // Do not traverse comment nodes\r
+                       ret += getText( node );\r
+               }\r
+       }\r
+       return ret;\r
+};\r
+\r
+isXML = Sizzle.isXML = function( elem ) {\r
+       // documentElement is verified for cases where it doesn't yet exist\r
+       // (such as loading iframes in IE - #4833)\r
+       var documentElement = elem && (elem.ownerDocument || elem).documentElement;\r
+       return documentElement ? documentElement.nodeName !== "HTML" : false;\r
+};\r
+\r
+// Element contains another\r
+contains = Sizzle.contains = docElem.contains ?\r
+       function( a, b ) {\r
+               var adown = a.nodeType === 9 ? a.documentElement : a,\r
+                       bup = b && b.parentNode;\r
+               return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) );\r
+       } :\r
+       docElem.compareDocumentPosition ?\r
+       function( a, b ) {\r
+               return b && !!( a.compareDocumentPosition( b ) & 16 );\r
+       } :\r
+       function( a, b ) {\r
+               while ( (b = b.parentNode) ) {\r
+                       if ( b === a ) {\r
+                               return true;\r
+                       }\r
+               }\r
+               return false;\r
+       };\r
+\r
+Sizzle.attr = function( elem, name ) {\r
+       var val,\r
+               xml = isXML( elem );\r
+\r
+       if ( !xml ) {\r
+               name = name.toLowerCase();\r
+       }\r
+       if ( (val = Expr.attrHandle[ name ]) ) {\r
+               return val( elem );\r
+       }\r
+       if ( xml || assertAttributes ) {\r
+               return elem.getAttribute( name );\r
+       }\r
+       val = elem.getAttributeNode( name );\r
+       return val ?\r
+               typeof elem[ name ] === "boolean" ?\r
+                       elem[ name ] ? name : null :\r
+                       val.specified ? val.value : null :\r
+               null;\r
+};\r
+\r
+Expr = Sizzle.selectors = {\r
+\r
+       // Can be adjusted by the user\r
+       cacheLength: 50,\r
+\r
+       createPseudo: markFunction,\r
+\r
+       match: matchExpr,\r
+\r
+       // IE6/7 return a modified href\r
+       attrHandle: assertHrefNotNormalized ?\r
+               {} :\r
+               {\r
+                       "href": function( elem ) {\r
+                               return elem.getAttribute( "href", 2 );\r
+                       },\r
+                       "type": function( elem ) {\r
+                               return elem.getAttribute("type");\r
+                       }\r
+               },\r
+\r
+       find: {\r
+               "ID": assertGetIdNotName ?\r
+                       function( id, context, xml ) {\r
+                               if ( typeof context.getElementById !== strundefined && !xml ) {\r
+                                       var m = context.getElementById( id );\r
+                                       // Check parentNode to catch when Blackberry 4.6 returns\r
+                                       // nodes that are no longer in the document #6963\r
+                                       return m && m.parentNode ? [m] : [];\r
+                               }\r
+                       } :\r
+                       function( id, context, xml ) {\r
+                               if ( typeof context.getElementById !== strundefined && !xml ) {\r
+                                       var m = context.getElementById( id );\r
+\r
+                                       return m ?\r
+                                               m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?\r
+                                                       [m] :\r
+                                                       undefined :\r
+                                               [];\r
+                               }\r
+                       },\r
+\r
+               "TAG": assertTagNameNoComments ?\r
+                       function( tag, context ) {\r
+                               if ( typeof context.getElementsByTagName !== strundefined ) {\r
+                                       return context.getElementsByTagName( tag );\r
+                               }\r
+                       } :\r
+                       function( tag, context ) {\r
+                               var results = context.getElementsByTagName( tag );\r
+\r
+                               // Filter out possible comments\r
+                               if ( tag === "*" ) {\r
+                                       var elem,\r
+                                               tmp = [],\r
+                                               i = 0;\r
+\r
+                                       for ( ; (elem = results[i]); i++ ) {\r
+                                               if ( elem.nodeType === 1 ) {\r
+                                                       tmp.push( elem );\r
+                                               }\r
+                                       }\r
+\r
+                                       return tmp;\r
+                               }\r
+                               return results;\r
+                       },\r
+\r
+               "NAME": assertUsableName && function( tag, context ) {\r
+                       if ( typeof context.getElementsByName !== strundefined ) {\r
+                               return context.getElementsByName( name );\r
+                       }\r
+               },\r
+\r
+               "CLASS": assertUsableClassName && function( className, context, xml ) {\r
+                       if ( typeof context.getElementsByClassName !== strundefined && !xml ) {\r
+                               return context.getElementsByClassName( className );\r
+                       }\r
+               }\r
+       },\r
+\r
+       relative: {\r
+               ">": { dir: "parentNode", first: true },\r
+               " ": { dir: "parentNode" },\r
+               "+": { dir: "previousSibling", first: true },\r
+               "~": { dir: "previousSibling" }\r
+       },\r
+\r
+       preFilter: {\r
+               "ATTR": function( match ) {\r
+                       match[1] = match[1].replace( rbackslash, "" );\r
+\r
+                       // Move the given value to match[3] whether quoted or unquoted\r
+                       match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" );\r
+\r
+                       if ( match[2] === "~=" ) {\r
+                               match[3] = " " + match[3] + " ";\r
+                       }\r
+\r
+                       return match.slice( 0, 4 );\r
+               },\r
+\r
+               "CHILD": function( match ) {\r
+                       /* matches from matchExpr["CHILD"]\r
+                               1 type (only|nth|...)\r
+                               2 argument (even|odd|\d*|\d*n([+-]\d+)?|...)\r
+                               3 xn-component of xn+y argument ([+-]?\d*n|)\r
+                               4 sign of xn-component\r
+                               5 x of xn-component\r
+                               6 sign of y-component\r
+                               7 y of y-component\r
+                       */\r
+                       match[1] = match[1].toLowerCase();\r
+\r
+                       if ( match[1] === "nth" ) {\r
+                               // nth-child requires argument\r
+                               if ( !match[2] ) {\r
+                                       Sizzle.error( match[0] );\r
+                               }\r
+\r
+                               // numeric x and y parameters for Expr.filter.CHILD\r
+                               // remember that false/true cast respectively to 0/1\r
+                               match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) );\r
+                               match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" );\r
+\r
+                       // other types prohibit arguments\r
+                       } else if ( match[2] ) {\r
+                               Sizzle.error( match[0] );\r
+                       }\r
+\r
+                       return match;\r
+               },\r
+\r
+               "PSEUDO": function( match ) {\r
+                       var unquoted, excess;\r
+                       if ( matchExpr["CHILD"].test( match[0] ) ) {\r
+                               return null;\r
+                       }\r
+\r
+                       if ( match[3] ) {\r
+                               match[2] = match[3];\r
+                       } else if ( (unquoted = match[4]) ) {\r
+                               // Only check arguments that contain a pseudo\r
+                               if ( rpseudo.test(unquoted) &&\r
+                                       // Get excess from tokenize (recursively)\r
+                                       (excess = tokenize( unquoted, true )) &&\r
+                                       // advance to the next closing parenthesis\r
+                                       (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {\r
+\r
+                                       // excess is a negative index\r
+                                       unquoted = unquoted.slice( 0, excess );\r
+                                       match[0] = match[0].slice( 0, excess );\r
+                               }\r
+                               match[2] = unquoted;\r
+                       }\r
+\r
+                       // Return only captures needed by the pseudo filter method (type and argument)\r
+                       return match.slice( 0, 3 );\r
+               }\r
+       },\r
+\r
+       filter: {\r
+               "ID": assertGetIdNotName ?\r
+                       function( id ) {\r
+                               id = id.replace( rbackslash, "" );\r
+                               return function( elem ) {\r
+                                       return elem.getAttribute("id") === id;\r
+                               };\r
+                       } :\r
+                       function( id ) {\r
+                               id = id.replace( rbackslash, "" );\r
+                               return function( elem ) {\r
+                                       var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");\r
+                                       return node && node.value === id;\r
+                               };\r
+                       },\r
+\r
+               "TAG": function( nodeName ) {\r
+                       if ( nodeName === "*" ) {\r
+                               return function() { return true; };\r
+                       }\r
+                       nodeName = nodeName.replace( rbackslash, "" ).toLowerCase();\r
+\r
+                       return function( elem ) {\r
+                               return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;\r
+                       };\r
+               },\r
+\r
+               "CLASS": function( className ) {\r
+                       var pattern = classCache[ expando ][ className + " " ];\r
+\r
+                       return pattern ||\r
+                               (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&\r
+                               classCache( className, function( elem ) {\r
+                                       return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );\r
+                               });\r
+               },\r
+\r
+               "ATTR": function( name, operator, check ) {\r
+                       return function( elem, context ) {\r
+                               var result = Sizzle.attr( elem, name );\r
+\r
+                               if ( result == null ) {\r
+                                       return operator === "!=";\r
+                               }\r
+                               if ( !operator ) {\r
+                                       return true;\r
+                               }\r
+\r
+                               result += "";\r
+\r
+                               return operator === "=" ? result === check :\r
+                                       operator === "!=" ? result !== check :\r
+                                       operator === "^=" ? check && result.indexOf( check ) === 0 :\r
+                                       operator === "*=" ? check && result.indexOf( check ) > -1 :\r
+                                       operator === "$=" ? check && result.substr( result.length - check.length ) === check :\r
+                                       operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :\r
+                                       operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" :\r
+                                       false;\r
+                       };\r
+               },\r
+\r
+               "CHILD": function( type, argument, first, last ) {\r
+\r
+                       if ( type === "nth" ) {\r
+                               return function( elem ) {\r
+                                       var node, diff,\r
+                                               parent = elem.parentNode;\r
+\r
+                                       if ( first === 1 && last === 0 ) {\r
+                                               return true;\r
+                                       }\r
+\r
+                                       if ( parent ) {\r
+                                               diff = 0;\r
+                                               for ( node = parent.firstChild; node; node = node.nextSibling ) {\r
+                                                       if ( node.nodeType === 1 ) {\r
+                                                               diff++;\r
+                                                               if ( elem === node ) {\r
+                                                                       break;\r
+                                                               }\r
+                                                       }\r
+                                               }\r
+                                       }\r
+\r
+                                       // Incorporate the offset (or cast to NaN), then check against cycle size\r
+                                       diff -= last;\r
+                                       return diff === first || ( diff % first === 0 && diff / first >= 0 );\r
+                               };\r
+                       }\r
+\r
+                       return function( elem ) {\r
+                               var node = elem;\r
+\r
+                               switch ( type ) {\r
+                                       case "only":\r
+                                       case "first":\r
+                                               while ( (node = node.previousSibling) ) {\r
+                                                       if ( node.nodeType === 1 ) {\r
+                                                               return false;\r
+                                                       }\r
+                                               }\r
+\r
+                                               if ( type === "first" ) {\r
+                                                       return true;\r
+                                               }\r
+\r
+                                               node = elem;\r
+\r
+                                               /* falls through */\r
+                                       case "last":\r
+                                               while ( (node = node.nextSibling) ) {\r
+                                                       if ( node.nodeType === 1 ) {\r
+                                                               return false;\r
+                                                       }\r
+                                               }\r
+\r
+                                               return true;\r
+                               }\r
+                       };\r
+               },\r
+\r
+               "PSEUDO": function( pseudo, argument ) {\r
+                       // pseudo-class names are case-insensitive\r
+                       // http://www.w3.org/TR/selectors/#pseudo-classes\r
+                       // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters\r
+                       // Remember that setFilters inherits from pseudos\r
+                       var args,\r
+                               fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||\r
+                                       Sizzle.error( "unsupported pseudo: " + pseudo );\r
+\r
+                       // The user may use createPseudo to indicate that\r
+                       // arguments are needed to create the filter function\r
+                       // just as Sizzle does\r
+                       if ( fn[ expando ] ) {\r
+                               return fn( argument );\r
+                       }\r
+\r
+                       // But maintain support for old signatures\r
+                       if ( fn.length > 1 ) {\r
+                               args = [ pseudo, pseudo, "", argument ];\r
+                               return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?\r
+                                       markFunction(function( seed, matches ) {\r
+                                               var idx,\r
+                                                       matched = fn( seed, argument ),\r
+                                                       i = matched.length;\r
+                                               while ( i-- ) {\r
+                                                       idx = indexOf.call( seed, matched[i] );\r
+                                                       seed[ idx ] = !( matches[ idx ] = matched[i] );\r
+                                               }\r
+                                       }) :\r
+                                       function( elem ) {\r
+                                               return fn( elem, 0, args );\r
+                                       };\r
+                       }\r
+\r
+                       return fn;\r
+               }\r
+       },\r
+\r
+       pseudos: {\r
+               "not": markFunction(function( selector ) {\r
+                       // Trim the selector passed to compile\r
+                       // to avoid treating leading and trailing\r
+                       // spaces as combinators\r
+                       var input = [],\r
+                               results = [],\r
+                               matcher = compile( selector.replace( rtrim, "$1" ) );\r
+\r
+                       return matcher[ expando ] ?\r
+                               markFunction(function( seed, matches, context, xml ) {\r
+                                       var elem,\r
+                                               unmatched = matcher( seed, null, xml, [] ),\r
+                                               i = seed.length;\r
+\r
+                                       // Match elements unmatched by `matcher`\r
+                                       while ( i-- ) {\r
+                                               if ( (elem = unmatched[i]) ) {\r
+                                                       seed[i] = !(matches[i] = elem);\r
+                                               }\r
+                                       }\r
+                               }) :\r
+                               function( elem, context, xml ) {\r
+                                       input[0] = elem;\r
+                                       matcher( input, null, xml, results );\r
+                                       return !results.pop();\r
+                               };\r
+               }),\r
+\r
+               "has": markFunction(function( selector ) {\r
+                       return function( elem ) {\r
+                               return Sizzle( selector, elem ).length > 0;\r
+                       };\r
+               }),\r
+\r
+               "contains": markFunction(function( text ) {\r
+                       return function( elem ) {\r
+                               return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;\r
+                       };\r
+               }),\r
+\r
+               "enabled": function( elem ) {\r
+                       return elem.disabled === false;\r
+               },\r
+\r
+               "disabled": function( elem ) {\r
+                       return elem.disabled === true;\r
+               },\r
+\r
+               "checked": function( elem ) {\r
+                       // In CSS3, :checked should return both checked and selected elements\r
+                       // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\r
+                       var nodeName = elem.nodeName.toLowerCase();\r
+                       return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);\r
+               },\r
+\r
+               "selected": function( elem ) {\r
+                       // Accessing this property makes selected-by-default\r
+                       // options in Safari work properly\r
+                       if ( elem.parentNode ) {\r
+                               elem.parentNode.selectedIndex;\r
+                       }\r
+\r
+                       return elem.selected === true;\r
+               },\r
+\r
+               "parent": function( elem ) {\r
+                       return !Expr.pseudos["empty"]( elem );\r
+               },\r
+\r
+               "empty": function( elem ) {\r
+                       // http://www.w3.org/TR/selectors/#empty-pseudo\r
+                       // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),\r
+                       //   not comment, processing instructions, or others\r
+                       // Thanks to Diego Perini for the nodeName shortcut\r
+                       //   Greater than "@" means alpha characters (specifically not starting with "#" or "?")\r
+                       var nodeType;\r
+                       elem = elem.firstChild;\r
+                       while ( elem ) {\r
+                               if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) {\r
+                                       return false;\r
+                               }\r
+                               elem = elem.nextSibling;\r
+                       }\r
+                       return true;\r
+               },\r
+\r
+               "header": function( elem ) {\r
+                       return rheader.test( elem.nodeName );\r
+               },\r
+\r
+               "text": function( elem ) {\r
+                       var type, attr;\r
+                       // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)\r
+                       // use getAttribute instead to test this case\r
+                       return elem.nodeName.toLowerCase() === "input" &&\r
+                               (type = elem.type) === "text" &&\r
+                               ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type );\r
+               },\r
+\r
+               // Input types\r
+               "radio": createInputPseudo("radio"),\r
+               "checkbox": createInputPseudo("checkbox"),\r
+               "file": createInputPseudo("file"),\r
+               "password": createInputPseudo("password"),\r
+               "image": createInputPseudo("image"),\r
+\r
+               "submit": createButtonPseudo("submit"),\r
+               "reset": createButtonPseudo("reset"),\r
+\r
+               "button": function( elem ) {\r
+                       var name = elem.nodeName.toLowerCase();\r
+                       return name === "input" && elem.type === "button" || name === "button";\r
+               },\r
+\r
+               "input": function( elem ) {\r
+                       return rinputs.test( elem.nodeName );\r
+               },\r
+\r
+               "focus": function( elem ) {\r
+                       var doc = elem.ownerDocument;\r
+                       return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);\r
+               },\r
+\r
+               "active": function( elem ) {\r
+                       return elem === elem.ownerDocument.activeElement;\r
+               },\r
+\r
+               // Positional types\r
+               "first": createPositionalPseudo(function() {\r
+                       return [ 0 ];\r
+               }),\r
+\r
+               "last": createPositionalPseudo(function( matchIndexes, length ) {\r
+                       return [ length - 1 ];\r
+               }),\r
+\r
+               "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {\r
+                       return [ argument < 0 ? argument + length : argument ];\r
+               }),\r
+\r
+               "even": createPositionalPseudo(function( matchIndexes, length ) {\r
+                       for ( var i = 0; i < length; i += 2 ) {\r
+                               matchIndexes.push( i );\r
+                       }\r
+                       return matchIndexes;\r
+               }),\r
+\r
+               "odd": createPositionalPseudo(function( matchIndexes, length ) {\r
+                       for ( var i = 1; i < length; i += 2 ) {\r
+                               matchIndexes.push( i );\r
+                       }\r
+                       return matchIndexes;\r
+               }),\r
+\r
+               "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {\r
+                       for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) {\r
+                               matchIndexes.push( i );\r
+                       }\r
+                       return matchIndexes;\r
+               }),\r
+\r
+               "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {\r
+                       for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) {\r
+                               matchIndexes.push( i );\r
+                       }\r
+                       return matchIndexes;\r
+               })\r
+       }\r
+};\r
+\r
+function siblingCheck( a, b, ret ) {\r
+       if ( a === b ) {\r
+               return ret;\r
+       }\r
+\r
+       var cur = a.nextSibling;\r
+\r
+       while ( cur ) {\r
+               if ( cur === b ) {\r
+                       return -1;\r
+               }\r
+\r
+               cur = cur.nextSibling;\r
+       }\r
+\r
+       return 1;\r
+}\r
+\r
+sortOrder = docElem.compareDocumentPosition ?\r
+       function( a, b ) {\r
+               if ( a === b ) {\r
+                       hasDuplicate = true;\r
+                       return 0;\r
+               }\r
+\r
+               return ( !a.compareDocumentPosition || !b.compareDocumentPosition ?\r
+                       a.compareDocumentPosition :\r
+                       a.compareDocumentPosition(b) & 4\r
+               ) ? -1 : 1;\r
+       } :\r
+       function( a, b ) {\r
+               // The nodes are identical, we can exit early\r
+               if ( a === b ) {\r
+                       hasDuplicate = true;\r
+                       return 0;\r
+\r
+               // Fallback to using sourceIndex (in IE) if it's available on both nodes\r
+               } else if ( a.sourceIndex && b.sourceIndex ) {\r
+                       return a.sourceIndex - b.sourceIndex;\r
+               }\r
+\r
+               var al, bl,\r
+                       ap = [],\r
+                       bp = [],\r
+                       aup = a.parentNode,\r
+                       bup = b.parentNode,\r
+                       cur = aup;\r
+\r
+               // If the nodes are siblings (or identical) we can do a quick check\r
+               if ( aup === bup ) {\r
+                       return siblingCheck( a, b );\r
+\r
+               // If no parents were found then the nodes are disconnected\r
+               } else if ( !aup ) {\r
+                       return -1;\r
+\r
+               } else if ( !bup ) {\r
+                       return 1;\r
+               }\r
+\r
+               // Otherwise they're somewhere else in the tree so we need\r
+               // to build up a full list of the parentNodes for comparison\r
+               while ( cur ) {\r
+                       ap.unshift( cur );\r
+                       cur = cur.parentNode;\r
+               }\r
+\r
+               cur = bup;\r
+\r
+               while ( cur ) {\r
+                       bp.unshift( cur );\r
+                       cur = cur.parentNode;\r
+               }\r
+\r
+               al = ap.length;\r
+               bl = bp.length;\r
+\r
+               // Start walking down the tree looking for a discrepancy\r
+               for ( var i = 0; i < al && i < bl; i++ ) {\r
+                       if ( ap[i] !== bp[i] ) {\r
+                               return siblingCheck( ap[i], bp[i] );\r
+                       }\r
+               }\r
+\r
+               // We ended someplace up the tree so do a sibling check\r
+               return i === al ?\r
+                       siblingCheck( a, bp[i], -1 ) :\r
+                       siblingCheck( ap[i], b, 1 );\r
+       };\r
+\r
+// Always assume the presence of duplicates if sort doesn't\r
+// pass them to our comparison function (as in Google Chrome).\r
+[0, 0].sort( sortOrder );\r
+baseHasDuplicate = !hasDuplicate;\r
+\r
+// Document sorting and removing duplicates\r
+Sizzle.uniqueSort = function( results ) {\r
+       var elem,\r
+               duplicates = [],\r
+               i = 1,\r
+               j = 0;\r
+\r
+       hasDuplicate = baseHasDuplicate;\r
+       results.sort( sortOrder );\r
+\r
+       if ( hasDuplicate ) {\r
+               for ( ; (elem = results[i]); i++ ) {\r
+                       if ( elem === results[ i - 1 ] ) {\r
+                               j = duplicates.push( i );\r
+                       }\r
+               }\r
+               while ( j-- ) {\r
+                       results.splice( duplicates[ j ], 1 );\r
+               }\r
+       }\r
+\r
+       return results;\r
+};\r
+\r
+Sizzle.error = function( msg ) {\r
+       throw new Error( "Syntax error, unrecognized expression: " + msg );\r
+};\r
+\r
+function tokenize( selector, parseOnly ) {\r
+       var matched, match, tokens, type,\r
+               soFar, groups, preFilters,\r
+               cached = tokenCache[ expando ][ selector + " " ];\r
+\r
+       if ( cached ) {\r
+               return parseOnly ? 0 : cached.slice( 0 );\r
+       }\r
+\r
+       soFar = selector;\r
+       groups = [];\r
+       preFilters = Expr.preFilter;\r
+\r
+       while ( soFar ) {\r
+\r
+               // Comma and first run\r
+               if ( !matched || (match = rcomma.exec( soFar )) ) {\r
+                       if ( match ) {\r
+                               // Don't consume trailing commas as valid\r
+                               soFar = soFar.slice( match[0].length ) || soFar;\r
+                       }\r
+                       groups.push( tokens = [] );\r
+               }\r
+\r
+               matched = false;\r
+\r
+               // Combinators\r
+               if ( (match = rcombinators.exec( soFar )) ) {\r
+                       tokens.push( matched = new Token( match.shift() ) );\r
+                       soFar = soFar.slice( matched.length );\r
+\r
+                       // Cast descendant combinators to space\r
+                       matched.type = match[0].replace( rtrim, " " );\r
+               }\r
+\r
+               // Filters\r
+               for ( type in Expr.filter ) {\r
+                       if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||\r
+                               (match = preFilters[ type ]( match ))) ) {\r
+\r
+                               tokens.push( matched = new Token( match.shift() ) );\r
+                               soFar = soFar.slice( matched.length );\r
+                               matched.type = type;\r
+                               matched.matches = match;\r
+                       }\r
+               }\r
+\r
+               if ( !matched ) {\r
+                       break;\r
+               }\r
+       }\r
+\r
+       // Return the length of the invalid excess\r
+       // if we're just parsing\r
+       // Otherwise, throw an error or return tokens\r
+       return parseOnly ?\r
+               soFar.length :\r
+               soFar ?\r
+                       Sizzle.error( selector ) :\r
+                       // Cache the tokens\r
+                       tokenCache( selector, groups ).slice( 0 );\r
+}\r
+\r
+function addCombinator( matcher, combinator, base ) {\r
+       var dir = combinator.dir,\r
+               checkNonElements = base && combinator.dir === "parentNode",\r
+               doneName = done++;\r
+\r
+       return combinator.first ?\r
+               // Check against closest ancestor/preceding element\r
+               function( elem, context, xml ) {\r
+                       while ( (elem = elem[ dir ]) ) {\r
+                               if ( checkNonElements || elem.nodeType === 1  ) {\r
+                                       return matcher( elem, context, xml );\r
+                               }\r
+                       }\r
+               } :\r
+\r
+               // Check against all ancestor/preceding elements\r
+               function( elem, context, xml ) {\r
+                       // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching\r
+                       if ( !xml ) {\r
+                               var cache,\r
+                                       dirkey = dirruns + " " + doneName + " ",\r
+                                       cachedkey = dirkey + cachedruns;\r
+                               while ( (elem = elem[ dir ]) ) {\r
+                                       if ( checkNonElements || elem.nodeType === 1 ) {\r
+                                               if ( (cache = elem[ expando ]) === cachedkey ) {\r
+                                                       return elem.sizset;\r
+                                               } else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) {\r
+                                                       if ( elem.sizset ) {\r
+                                                               return elem;\r
+                                                       }\r
+                                               } else {\r
+                                                       elem[ expando ] = cachedkey;\r
+                                                       if ( matcher( elem, context, xml ) ) {\r
+                                                               elem.sizset = true;\r
+                                                               return elem;\r
+                                                       }\r
+                                                       elem.sizset = false;\r
+                                               }\r
+                                       }\r
+                               }\r
+                       } else {\r
+                               while ( (elem = elem[ dir ]) ) {\r
+                                       if ( checkNonElements || elem.nodeType === 1 ) {\r
+                                               if ( matcher( elem, context, xml ) ) {\r
+                                                       return elem;\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+               };\r
+}\r
+\r
+function elementMatcher( matchers ) {\r
+       return matchers.length > 1 ?\r
+               function( elem, context, xml ) {\r
+                       var i = matchers.length;\r
+                       while ( i-- ) {\r
+                               if ( !matchers[i]( elem, context, xml ) ) {\r
+                                       return false;\r
+                               }\r
+                       }\r
+                       return true;\r
+               } :\r
+               matchers[0];\r
+}\r
+\r
+function condense( unmatched, map, filter, context, xml ) {\r
+       var elem,\r
+               newUnmatched = [],\r
+               i = 0,\r
+               len = unmatched.length,\r
+               mapped = map != null;\r
+\r
+       for ( ; i < len; i++ ) {\r
+               if ( (elem = unmatched[i]) ) {\r
+                       if ( !filter || filter( elem, context, xml ) ) {\r
+                               newUnmatched.push( elem );\r
+                               if ( mapped ) {\r
+                                       map.push( i );\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       return newUnmatched;\r
+}\r
+\r
+function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {\r
+       if ( postFilter && !postFilter[ expando ] ) {\r
+               postFilter = setMatcher( postFilter );\r
+       }\r
+       if ( postFinder && !postFinder[ expando ] ) {\r
+               postFinder = setMatcher( postFinder, postSelector );\r
+       }\r
+       return markFunction(function( seed, results, context, xml ) {\r
+               var temp, i, elem,\r
+                       preMap = [],\r
+                       postMap = [],\r
+                       preexisting = results.length,\r
+\r
+                       // Get initial elements from seed or context\r
+                       elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),\r
+\r
+                       // Prefilter to get matcher input, preserving a map for seed-results synchronization\r
+                       matcherIn = preFilter && ( seed || !selector ) ?\r
+                               condense( elems, preMap, preFilter, context, xml ) :\r
+                               elems,\r
+\r
+                       matcherOut = matcher ?\r
+                               // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,\r
+                               postFinder || ( seed ? preFilter : preexisting || postFilter ) ?\r
+\r
+                                       // ...intermediate processing is necessary\r
+                                       [] :\r
+\r
+                                       // ...otherwise use results directly\r
+                                       results :\r
+                               matcherIn;\r
+\r
+               // Find primary matches\r
+               if ( matcher ) {\r
+                       matcher( matcherIn, matcherOut, context, xml );\r
+               }\r
+\r
+               // Apply postFilter\r
+               if ( postFilter ) {\r
+                       temp = condense( matcherOut, postMap );\r
+                       postFilter( temp, [], context, xml );\r
+\r
+                       // Un-match failing elements by moving them back to matcherIn\r
+                       i = temp.length;\r
+                       while ( i-- ) {\r
+                               if ( (elem = temp[i]) ) {\r
+                                       matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);\r
+                               }\r
+                       }\r
+               }\r
+\r
+               if ( seed ) {\r
+                       if ( postFinder || preFilter ) {\r
+                               if ( postFinder ) {\r
+                                       // Get the final matcherOut by condensing this intermediate into postFinder contexts\r
+                                       temp = [];\r
+                                       i = matcherOut.length;\r
+                                       while ( i-- ) {\r
+                                               if ( (elem = matcherOut[i]) ) {\r
+                                                       // Restore matcherIn since elem is not yet a final match\r
+                                                       temp.push( (matcherIn[i] = elem) );\r
+                                               }\r
+                                       }\r
+                                       postFinder( null, (matcherOut = []), temp, xml );\r
+                               }\r
+\r
+                               // Move matched elements from seed to results to keep them synchronized\r
+                               i = matcherOut.length;\r
+                               while ( i-- ) {\r
+                                       if ( (elem = matcherOut[i]) &&\r
+                                               (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {\r
+\r
+                                               seed[temp] = !(results[temp] = elem);\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+               // Add elements to results, through postFinder if defined\r
+               } else {\r
+                       matcherOut = condense(\r
+                               matcherOut === results ?\r
+                                       matcherOut.splice( preexisting, matcherOut.length ) :\r
+                                       matcherOut\r
+                       );\r
+                       if ( postFinder ) {\r
+                               postFinder( null, results, matcherOut, xml );\r
+                       } else {\r
+                               push.apply( results, matcherOut );\r
+                       }\r
+               }\r
+       });\r
+}\r
+\r
+function matcherFromTokens( tokens ) {\r
+       var checkContext, matcher, j,\r
+               len = tokens.length,\r
+               leadingRelative = Expr.relative[ tokens[0].type ],\r
+               implicitRelative = leadingRelative || Expr.relative[" "],\r
+               i = leadingRelative ? 1 : 0,\r
+\r
+               // The foundational matcher ensures that elements are reachable from top-level context(s)\r
+               matchContext = addCombinator( function( elem ) {\r
+                       return elem === checkContext;\r
+               }, implicitRelative, true ),\r
+               matchAnyContext = addCombinator( function( elem ) {\r
+                       return indexOf.call( checkContext, elem ) > -1;\r
+               }, implicitRelative, true ),\r
+               matchers = [ function( elem, context, xml ) {\r
+                       return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (\r
+                               (checkContext = context).nodeType ?\r
+                                       matchContext( elem, context, xml ) :\r
+                                       matchAnyContext( elem, context, xml ) );\r
+               } ];\r
+\r
+       for ( ; i < len; i++ ) {\r
+               if ( (matcher = Expr.relative[ tokens[i].type ]) ) {\r
+                       matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];\r
+               } else {\r
+                       matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );\r
+\r
+                       // Return special upon seeing a positional matcher\r
+                       if ( matcher[ expando ] ) {\r
+                               // Find the next relative operator (if any) for proper handling\r
+                               j = ++i;\r
+                               for ( ; j < len; j++ ) {\r
+                                       if ( Expr.relative[ tokens[j].type ] ) {\r
+                                               break;\r
+                                       }\r
+                               }\r
+                               return setMatcher(\r
+                                       i > 1 && elementMatcher( matchers ),\r
+                                       i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ),\r
+                                       matcher,\r
+                                       i < j && matcherFromTokens( tokens.slice( i, j ) ),\r
+                                       j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),\r
+                                       j < len && tokens.join("")\r
+                               );\r
+                       }\r
+                       matchers.push( matcher );\r
+               }\r
+       }\r
+\r
+       return elementMatcher( matchers );\r
+}\r
+\r
+function matcherFromGroupMatchers( elementMatchers, setMatchers ) {\r
+       var bySet = setMatchers.length > 0,\r
+               byElement = elementMatchers.length > 0,\r
+               superMatcher = function( seed, context, xml, results, expandContext ) {\r
+                       var elem, j, matcher,\r
+                               setMatched = [],\r
+                               matchedCount = 0,\r
+                               i = "0",\r
+                               unmatched = seed && [],\r
+                               outermost = expandContext != null,\r
+                               contextBackup = outermostContext,\r
+                               // We must always have either seed elements or context\r
+                               elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),\r
+                               // Nested matchers should use non-integer dirruns\r
+                               dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E);\r
+\r
+                       if ( outermost ) {\r
+                               outermostContext = context !== document && context;\r
+                               cachedruns = superMatcher.el;\r
+                       }\r
+\r
+                       // Add elements passing elementMatchers directly to results\r
+                       for ( ; (elem = elems[i]) != null; i++ ) {\r
+                               if ( byElement && elem ) {\r
+                                       for ( j = 0; (matcher = elementMatchers[j]); j++ ) {\r
+                                               if ( matcher( elem, context, xml ) ) {\r
+                                                       results.push( elem );\r
+                                                       break;\r
+                                               }\r
+                                       }\r
+                                       if ( outermost ) {\r
+                                               dirruns = dirrunsUnique;\r
+                                               cachedruns = ++superMatcher.el;\r
+                                       }\r
+                               }\r
+\r
+                               // Track unmatched elements for set filters\r
+                               if ( bySet ) {\r
+                                       // They will have gone through all possible matchers\r
+                                       if ( (elem = !matcher && elem) ) {\r
+                                               matchedCount--;\r
+                                       }\r
+\r
+                                       // Lengthen the array for every element, matched or not\r
+                                       if ( seed ) {\r
+                                               unmatched.push( elem );\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       // Apply set filters to unmatched elements\r
+                       matchedCount += i;\r
+                       if ( bySet && i !== matchedCount ) {\r
+                               for ( j = 0; (matcher = setMatchers[j]); j++ ) {\r
+                                       matcher( unmatched, setMatched, context, xml );\r
+                               }\r
+\r
+                               if ( seed ) {\r
+                                       // Reintegrate element matches to eliminate the need for sorting\r
+                                       if ( matchedCount > 0 ) {\r
+                                               while ( i-- ) {\r
+                                                       if ( !(unmatched[i] || setMatched[i]) ) {\r
+                                                               setMatched[i] = pop.call( results );\r
+                                                       }\r
+                                               }\r
+                                       }\r
+\r
+                                       // Discard index placeholder values to get only actual matches\r
+                                       setMatched = condense( setMatched );\r
+                               }\r
+\r
+                               // Add matches to results\r
+                               push.apply( results, setMatched );\r
+\r
+                               // Seedless set matches succeeding multiple successful matchers stipulate sorting\r
+                               if ( outermost && !seed && setMatched.length > 0 &&\r
+                                       ( matchedCount + setMatchers.length ) > 1 ) {\r
+\r
+                                       Sizzle.uniqueSort( results );\r
+                               }\r
+                       }\r
+\r
+                       // Override manipulation of globals by nested matchers\r
+                       if ( outermost ) {\r
+                               dirruns = dirrunsUnique;\r
+                               outermostContext = contextBackup;\r
+                       }\r
+\r
+                       return unmatched;\r
+               };\r
+\r
+       superMatcher.el = 0;\r
+       return bySet ?\r
+               markFunction( superMatcher ) :\r
+               superMatcher;\r
+}\r
+\r
+compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {\r
+       var i,\r
+               setMatchers = [],\r
+               elementMatchers = [],\r
+               cached = compilerCache[ expando ][ selector + " " ];\r
+\r
+       if ( !cached ) {\r
+               // Generate a function of recursive functions that can be used to check each element\r
+               if ( !group ) {\r
+                       group = tokenize( selector );\r
+               }\r
+               i = group.length;\r
+               while ( i-- ) {\r
+                       cached = matcherFromTokens( group[i] );\r
+                       if ( cached[ expando ] ) {\r
+                               setMatchers.push( cached );\r
+                       } else {\r
+                               elementMatchers.push( cached );\r
+                       }\r
+               }\r
+\r
+               // Cache the compiled function\r
+               cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );\r
+       }\r
+       return cached;\r
+};\r
+\r
+function multipleContexts( selector, contexts, results ) {\r
+       var i = 0,\r
+               len = contexts.length;\r
+       for ( ; i < len; i++ ) {\r
+               Sizzle( selector, contexts[i], results );\r
+       }\r
+       return results;\r
+}\r
+\r
+function select( selector, context, results, seed, xml ) {\r
+       var i, tokens, token, type, find,\r
+               match = tokenize( selector ),\r
+               j = match.length;\r
+\r
+       if ( !seed ) {\r
+               // Try to minimize operations if there is only one group\r
+               if ( match.length === 1 ) {\r
+\r
+                       // Take a shortcut and set the context if the root selector is an ID\r
+                       tokens = match[0] = match[0].slice( 0 );\r
+                       if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&\r
+                                       context.nodeType === 9 && !xml &&\r
+                                       Expr.relative[ tokens[1].type ] ) {\r
+\r
+                               context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0];\r
+                               if ( !context ) {\r
+                                       return results;\r
+                               }\r
+\r
+                               selector = selector.slice( tokens.shift().length );\r
+                       }\r
+\r
+                       // Fetch a seed set for right-to-left matching\r
+                       for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) {\r
+                               token = tokens[i];\r
+\r
+                               // Abort if we hit a combinator\r
+                               if ( Expr.relative[ (type = token.type) ] ) {\r
+                                       break;\r
+                               }\r
+                               if ( (find = Expr.find[ type ]) ) {\r
+                                       // Search, expanding context for leading sibling combinators\r
+                                       if ( (seed = find(\r
+                                               token.matches[0].replace( rbackslash, "" ),\r
+                                               rsibling.test( tokens[0].type ) && context.parentNode || context,\r
+                                               xml\r
+                                       )) ) {\r
+\r
+                                               // If seed is empty or no tokens remain, we can return early\r
+                                               tokens.splice( i, 1 );\r
+                                               selector = seed.length && tokens.join("");\r
+                                               if ( !selector ) {\r
+                                                       push.apply( results, slice.call( seed, 0 ) );\r
+                                                       return results;\r
+                                               }\r
+\r
+                                               break;\r
+                                       }\r
+                               }\r
+                       }\r
+               }\r
+       }\r
+\r
+       // Compile and execute a filtering function\r
+       // Provide `match` to avoid retokenization if we modified the selector above\r
+       compile( selector, match )(\r
+               seed,\r
+               context,\r
+               xml,\r
+               results,\r
+               rsibling.test( selector )\r
+       );\r
+       return results;\r
+}\r
+\r
+if ( document.querySelectorAll ) {\r
+       (function() {\r
+               var disconnectedMatch,\r
+                       oldSelect = select,\r
+                       rescape = /'|\\/g,\r
+                       rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,\r
+\r
+                       // qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA\r
+                       // A support test would require too much code (would include document ready)\r
+                       rbuggyQSA = [ ":focus" ],\r
+\r
+                       // matchesSelector(:active) reports false when true (IE9/Opera 11.5)\r
+                       // A support test would require too much code (would include document ready)\r
+                       // just skip matchesSelector for :active\r
+                       rbuggyMatches = [ ":active" ],\r
+                       matches = docElem.matchesSelector ||\r
+                               docElem.mozMatchesSelector ||\r
+                               docElem.webkitMatchesSelector ||\r
+                               docElem.oMatchesSelector ||\r
+                               docElem.msMatchesSelector;\r
+\r
+               // Build QSA regex\r
+               // Regex strategy adopted from Diego Perini\r
+               assert(function( div ) {\r
+                       // Select is set to empty string on purpose\r
+                       // This is to test IE's treatment of not explictly\r
+                       // setting a boolean content attribute,\r
+                       // since its presence should be enough\r
+                       // http://bugs.jquery.com/ticket/12359\r
+                       div.innerHTML = "<select><option selected=''></option></select>";\r
+\r
+                       // IE8 - Some boolean attributes are not treated correctly\r
+                       if ( !div.querySelectorAll("[selected]").length ) {\r
+                               rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );\r
+                       }\r
+\r
+                       // Webkit/Opera - :checked should return selected option elements\r
+                       // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\r
+                       // IE8 throws error here (do not put tests after this one)\r
+                       if ( !div.querySelectorAll(":checked").length ) {\r
+                               rbuggyQSA.push(":checked");\r
+                       }\r
+               });\r
+\r
+               assert(function( div ) {\r
+\r
+                       // Opera 10-12/IE9 - ^= $= *= and empty values\r
+                       // Should not select anything\r
+                       div.innerHTML = "<p test=''></p>";\r
+                       if ( div.querySelectorAll("[test^='']").length ) {\r
+                               rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );\r
+                       }\r
+\r
+                       // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)\r
+                       // IE8 throws error here (do not put tests after this one)\r
+                       div.innerHTML = "<input type='hidden'/>";\r
+                       if ( !div.querySelectorAll(":enabled").length ) {\r
+                               rbuggyQSA.push(":enabled", ":disabled");\r
+                       }\r
+               });\r
+\r
+               // rbuggyQSA always contains :focus, so no need for a length check\r
+               rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") );\r
+\r
+               select = function( selector, context, results, seed, xml ) {\r
+                       // Only use querySelectorAll when not filtering,\r
+                       // when this is not xml,\r
+                       // and when no QSA bugs apply\r
+                       if ( !seed && !xml && !rbuggyQSA.test( selector ) ) {\r
+                               var groups, i,\r
+                                       old = true,\r
+                                       nid = expando,\r
+                                       newContext = context,\r
+                                       newSelector = context.nodeType === 9 && selector;\r
+\r
+                               // qSA works strangely on Element-rooted queries\r
+                               // We can work around this by specifying an extra ID on the root\r
+                               // and working up from there (Thanks to Andrew Dupont for the technique)\r
+                               // IE 8 doesn't work on object elements\r
+                               if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {\r
+                                       groups = tokenize( selector );\r
+\r
+                                       if ( (old = context.getAttribute("id")) ) {\r
+                                               nid = old.replace( rescape, "\\$&" );\r
+                                       } else {\r
+                                               context.setAttribute( "id", nid );\r
+                                       }\r
+                                       nid = "[id='" + nid + "'] ";\r
+\r
+                                       i = groups.length;\r
+                                       while ( i-- ) {\r
+                                               groups[i] = nid + groups[i].join("");\r
+                                       }\r
+                                       newContext = rsibling.test( selector ) && context.parentNode || context;\r
+                                       newSelector = groups.join(",");\r
+                               }\r
+\r
+                               if ( newSelector ) {\r
+                                       try {\r
+                                               push.apply( results, slice.call( newContext.querySelectorAll(\r
+                                                       newSelector\r
+                                               ), 0 ) );\r
+                                               return results;\r
+                                       } catch(qsaError) {\r
+                                       } finally {\r
+                                               if ( !old ) {\r
+                                                       context.removeAttribute("id");\r
+                                               }\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       return oldSelect( selector, context, results, seed, xml );\r
+               };\r
+\r
+               if ( matches ) {\r
+                       assert(function( div ) {\r
+                               // Check to see if it's possible to do matchesSelector\r
+                               // on a disconnected node (IE 9)\r
+                               disconnectedMatch = matches.call( div, "div" );\r
+\r
+                               // This should fail with an exception\r
+                               // Gecko does not error, returns false instead\r
+                               try {\r
+                                       matches.call( div, "[test!='']:sizzle" );\r
+                                       rbuggyMatches.push( "!=", pseudos );\r
+                               } catch ( e ) {}\r
+                       });\r
+\r
+                       // rbuggyMatches always contains :active and :focus, so no need for a length check\r
+                       rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") );\r
+\r
+                       Sizzle.matchesSelector = function( elem, expr ) {\r
+                               // Make sure that attribute selectors are quoted\r
+                               expr = expr.replace( rattributeQuotes, "='$1']" );\r
+\r
+                               // rbuggyMatches always contains :active, so no need for an existence check\r
+                               if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) {\r
+                                       try {\r
+                                               var ret = matches.call( elem, expr );\r
+\r
+                                               // IE 9's matchesSelector returns false on disconnected nodes\r
+                                               if ( ret || disconnectedMatch ||\r
+                                                               // As well, disconnected nodes are said to be in a document\r
+                                                               // fragment in IE 9\r
+                                                               elem.document && elem.document.nodeType !== 11 ) {\r
+                                                       return ret;\r
+                                               }\r
+                                       } catch(e) {}\r
+                               }\r
+\r
+                               return Sizzle( expr, null, null, [ elem ] ).length > 0;\r
+                       };\r
+               }\r
+       })();\r
+}\r
+\r
+// Deprecated\r
+Expr.pseudos["nth"] = Expr.pseudos["eq"];\r
+\r
+// Back-compat\r
+function setFilters() {}\r
+Expr.filters = setFilters.prototype = Expr.pseudos;\r
+Expr.setFilters = new setFilters();\r
+\r
+// Override sizzle attribute retrieval
+Sizzle.attr = jQuery.attr;
+jQuery.find = Sizzle;
+jQuery.expr = Sizzle.selectors;
+jQuery.expr[":"] = jQuery.expr.pseudos;
+jQuery.unique = Sizzle.uniqueSort;
+jQuery.text = Sizzle.getText;
+jQuery.isXMLDoc = Sizzle.isXML;
+jQuery.contains = Sizzle.contains;
+\r
+\r
+})( window );\r
+var runtil = /Until$/,
+       rparentsprev = /^(?:parents|prev(?:Until|All))/,
+       isSimple = /^.[^:#\[\.,]*$/,
+       rneedsContext = jQuery.expr.match.needsContext,
+       // methods guaranteed to produce a unique set when starting from a unique set
+       guaranteedUnique = {
+               children: true,
+               contents: true,
+               next: true,
+               prev: true
+       };
+
+jQuery.fn.extend({
+       find: function( selector ) {
+               var i, l, length, n, r, ret,
+                       self = this;
+
+               if ( typeof selector !== "string" ) {
+                       return jQuery( selector ).filter(function() {
+                               for ( i = 0, l = self.length; i < l; i++ ) {
+                                       if ( jQuery.contains( self[ i ], this ) ) {
+                                               return true;
+                                       }
+                               }
+                       });
+               }
+
+               ret = this.pushStack( "", "find", selector );
+
+               for ( i = 0, l = this.length; i < l; i++ ) {
+                       length = ret.length;
+                       jQuery.find( selector, this[i], ret );
+
+                       if ( i > 0 ) {
+                               // Make sure that the results are unique
+                               for ( n = length; n < ret.length; n++ ) {
+                                       for ( r = 0; r < length; r++ ) {
+                                               if ( ret[r] === ret[n] ) {
+                                                       ret.splice(n--, 1);
+                                                       break;
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               return ret;
+       },
+
+       has: function( target ) {
+               var i,
+                       targets = jQuery( target, this ),
+                       len = targets.length;
+
+               return this.filter(function() {
+                       for ( i = 0; i < len; i++ ) {
+                               if ( jQuery.contains( this, targets[i] ) ) {
+                                       return true;
+                               }
+                       }
+               });
+       },
+
+       not: function( selector ) {
+               return this.pushStack( winnow(this, selector, false), "not", selector);
+       },
+
+       filter: function( selector ) {
+               return this.pushStack( winnow(this, selector, true), "filter", selector );
+       },
+
+       is: function( selector ) {
+               return !!selector && (
+                       typeof selector === "string" ?
+                               // If this is a positional/relative selector, check membership in the returned set
+                               // so $("p:first").is("p:last") won't return true for a doc with two "p".
+                               rneedsContext.test( selector ) ?
+                                       jQuery( selector, this.context ).index( this[0] ) >= 0 :
+                                       jQuery.filter( selector, this ).length > 0 :
+                               this.filter( selector ).length > 0 );
+       },
+
+       closest: function( selectors, context ) {
+               var cur,
+                       i = 0,
+                       l = this.length,
+                       ret = [],
+                       pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
+                               jQuery( selectors, context || this.context ) :
+                               0;
+
+               for ( ; i < l; i++ ) {
+                       cur = this[i];
+
+                       while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
+                               if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
+                                       ret.push( cur );
+                                       break;
+                               }
+                               cur = cur.parentNode;
+                       }
+               }
+
+               ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
+
+               return this.pushStack( ret, "closest", selectors );
+       },
+
+       // Determine the position of an element within
+       // the matched set of elements
+       index: function( elem ) {
+
+               // No argument, return index in parent
+               if ( !elem ) {
+                       return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
+               }
+
+               // index in selector
+               if ( typeof elem === "string" ) {
+                       return jQuery.inArray( this[0], jQuery( elem ) );
+               }
+
+               // Locate the position of the desired element
+               return jQuery.inArray(
+                       // If it receives a jQuery object, the first element is used
+                       elem.jquery ? elem[0] : elem, this );
+       },
+
+       add: function( selector, context ) {
+               var set = typeof selector === "string" ?
+                               jQuery( selector, context ) :
+                               jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
+                       all = jQuery.merge( this.get(), set );
+
+               return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
+                       all :
+                       jQuery.unique( all ) );
+       },
+
+       addBack: function( selector ) {
+               return this.add( selector == null ?
+                       this.prevObject : this.prevObject.filter(selector)
+               );
+       }
+});
+
+jQuery.fn.andSelf = jQuery.fn.addBack;
+
+// A painfully simple check to see if an element is disconnected
+// from a document (should be improved, where feasible).
+function isDisconnected( node ) {
+       return !node || !node.parentNode || node.parentNode.nodeType === 11;
+}
+
+function sibling( cur, dir ) {
+       do {
+               cur = cur[ dir ];
+       } while ( cur && cur.nodeType !== 1 );
+
+       return cur;
+}
+
+jQuery.each({
+       parent: function( elem ) {
+               var parent = elem.parentNode;
+               return parent && parent.nodeType !== 11 ? parent : null;
+       },
+       parents: function( elem ) {
+               return jQuery.dir( elem, "parentNode" );
+       },
+       parentsUntil: function( elem, i, until ) {
+               return jQuery.dir( elem, "parentNode", until );
+       },
+       next: function( elem ) {
+               return sibling( elem, "nextSibling" );
+       },
+       prev: function( elem ) {
+               return sibling( elem, "previousSibling" );
+       },
+       nextAll: function( elem ) {
+               return jQuery.dir( elem, "nextSibling" );
+       },
+       prevAll: function( elem ) {
+               return jQuery.dir( elem, "previousSibling" );
+       },
+       nextUntil: function( elem, i, until ) {
+               return jQuery.dir( elem, "nextSibling", until );
+       },
+       prevUntil: function( elem, i, until ) {
+               return jQuery.dir( elem, "previousSibling", until );
+       },
+       siblings: function( elem ) {
+               return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
+       },
+       children: function( elem ) {
+               return jQuery.sibling( elem.firstChild );
+       },
+       contents: function( elem ) {
+               return jQuery.nodeName( elem, "iframe" ) ?
+                       elem.contentDocument || elem.contentWindow.document :
+                       jQuery.merge( [], elem.childNodes );
+       }
+}, function( name, fn ) {
+       jQuery.fn[ name ] = function( until, selector ) {
+               var ret = jQuery.map( this, fn, until );
+
+               if ( !runtil.test( name ) ) {
+                       selector = until;
+               }
+
+               if ( selector && typeof selector === "string" ) {
+                       ret = jQuery.filter( selector, ret );
+               }
+
+               ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
+
+               if ( this.length > 1 && rparentsprev.test( name ) ) {
+                       ret = ret.reverse();
+               }
+
+               return this.pushStack( ret, name, core_slice.call( arguments ).join(",") );
+       };
+});
+
+jQuery.extend({
+       filter: function( expr, elems, not ) {
+               if ( not ) {
+                       expr = ":not(" + expr + ")";
+               }
+
+               return elems.length === 1 ?
+                       jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
+                       jQuery.find.matches(expr, elems);
+       },
+
+       dir: function( elem, dir, until ) {
+               var matched = [],
+                       cur = elem[ dir ];
+
+               while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
+                       if ( cur.nodeType === 1 ) {
+                               matched.push( cur );
+                       }
+                       cur = cur[dir];
+               }
+               return matched;
+       },
+
+       sibling: function( n, elem ) {
+               var r = [];
+
+               for ( ; n; n = n.nextSibling ) {
+                       if ( n.nodeType === 1 && n !== elem ) {
+                               r.push( n );
+                       }
+               }
+
+               return r;
+       }
+});
+
+// Implement the identical functionality for filter and not
+function winnow( elements, qualifier, keep ) {
+
+       // Can't pass null or undefined to indexOf in Firefox 4
+       // Set to 0 to skip string check
+       qualifier = qualifier || 0;
+
+       if ( jQuery.isFunction( qualifier ) ) {
+               return jQuery.grep(elements, function( elem, i ) {
+                       var retVal = !!qualifier.call( elem, i, elem );
+                       return retVal === keep;
+               });
+
+       } else if ( qualifier.nodeType ) {
+               return jQuery.grep(elements, function( elem, i ) {
+                       return ( elem === qualifier ) === keep;
+               });
+
+       } else if ( typeof qualifier === "string" ) {
+               var filtered = jQuery.grep(elements, function( elem ) {
+                       return elem.nodeType === 1;
+               });
+
+               if ( isSimple.test( qualifier ) ) {
+                       return jQuery.filter(qualifier, filtered, !keep);
+               } else {
+                       qualifier = jQuery.filter( qualifier, filtered );
+               }
+       }
+
+       return jQuery.grep(elements, function( elem, i ) {
+               return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
+       });
+}
+function createSafeFragment( document ) {
+       var list = nodeNames.split( "|" ),
+       safeFrag = document.createDocumentFragment();
+
+       if ( safeFrag.createElement ) {
+               while ( list.length ) {
+                       safeFrag.createElement(
+                               list.pop()
+                       );
+               }
+       }
+       return safeFrag;
+}
+
+var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
+               "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
+       rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
+       rleadingWhitespace = /^\s+/,
+       rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
+       rtagName = /<([\w:]+)/,
+       rtbody = /<tbody/i,
+       rhtml = /<|&#?\w+;/,
+       rnoInnerhtml = /<(?:script|style|link)/i,
+       rnocache = /<(?:script|object|embed|option|style)/i,
+       rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
+       rcheckableType = /^(?:checkbox|radio)$/,
+       // checked="checked" or checked
+       rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
+       rscriptType = /\/(java|ecma)script/i,
+       rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,
+       wrapMap = {
+               option: [ 1, "<select multiple='multiple'>", "</select>" ],
+               legend: [ 1, "<fieldset>", "</fieldset>" ],
+               thead: [ 1, "<table>", "</table>" ],
+               tr: [ 2, "<table><tbody>", "</tbody></table>" ],
+               td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
+               col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
+               area: [ 1, "<map>", "</map>" ],
+               _default: [ 0, "", "" ]
+       },
+       safeFragment = createSafeFragment( document ),
+       fragmentDiv = safeFragment.appendChild( document.createElement("div") );
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
+// unless wrapped in a div with non-breaking characters in front of it.
+if ( !jQuery.support.htmlSerialize ) {
+       wrapMap._default = [ 1, "X<div>", "</div>" ];
+}
+
+jQuery.fn.extend({
+       text: function( value ) {
+               return jQuery.access( this, function( value ) {
+                       return value === undefined ?
+                               jQuery.text( this ) :
+                               this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
+               }, null, value, arguments.length );
+       },
+
+       wrapAll: function( html ) {
+               if ( jQuery.isFunction( html ) ) {
+                       return this.each(function(i) {
+                               jQuery(this).wrapAll( html.call(this, i) );
+                       });
+               }
+
+               if ( this[0] ) {
+                       // The elements to wrap the target around
+                       var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
+
+                       if ( this[0].parentNode ) {
+                               wrap.insertBefore( this[0] );
+                       }
+
+                       wrap.map(function() {
+                               var elem = this;
+
+                               while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
+                                       elem = elem.firstChild;
+                               }
+
+                               return elem;
+                       }).append( this );
+               }
+
+               return this;
+       },
+
+       wrapInner: function( html ) {
+               if ( jQuery.isFunction( html ) ) {
+                       return this.each(function(i) {
+                               jQuery(this).wrapInner( html.call(this, i) );
+                       });
+               }
+
+               return this.each(function() {
+                       var self = jQuery( this ),
+                               contents = self.contents();
+
+                       if ( contents.length ) {
+                               contents.wrapAll( html );
+
+                       } else {
+                               self.append( html );
+                       }
+               });
+       },
+
+       wrap: function( html ) {
+               var isFunction = jQuery.isFunction( html );
+
+               return this.each(function(i) {
+                       jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
+               });
+       },
+
+       unwrap: function() {
+               return this.parent().each(function() {
+                       if ( !jQuery.nodeName( this, "body" ) ) {
+                               jQuery( this ).replaceWith( this.childNodes );
+                       }
+               }).end();
+       },
+
+       append: function() {
+               return this.domManip(arguments, true, function( elem ) {
+                       if ( this.nodeType === 1 || this.nodeType === 11 ) {
+                               this.appendChild( elem );
+                       }
+               });
+       },
+
+       prepend: function() {
+               return this.domManip(arguments, true, function( elem ) {
+                       if ( this.nodeType === 1 || this.nodeType === 11 ) {
+                               this.insertBefore( elem, this.firstChild );
+                       }
+               });
+       },
+
+       before: function() {
+               if ( !isDisconnected( this[0] ) ) {
+                       return this.domManip(arguments, false, function( elem ) {
+                               this.parentNode.insertBefore( elem, this );
+                       });
+               }
+
+               if ( arguments.length ) {
+                       var set = jQuery.clean( arguments );
+                       return this.pushStack( jQuery.merge( set, this ), "before", this.selector );
+               }
+       },
+
+       after: function() {
+               if ( !isDisconnected( this[0] ) ) {
+                       return this.domManip(arguments, false, function( elem ) {
+                               this.parentNode.insertBefore( elem, this.nextSibling );
+                       });
+               }
+
+               if ( arguments.length ) {
+                       var set = jQuery.clean( arguments );
+                       return this.pushStack( jQuery.merge( this, set ), "after", this.selector );
+               }
+       },
+
+       // keepData is for internal use only--do not document
+       remove: function( selector, keepData ) {
+               var elem,
+                       i = 0;
+
+               for ( ; (elem = this[i]) != null; i++ ) {
+                       if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
+                               if ( !keepData && elem.nodeType === 1 ) {
+                                       jQuery.cleanData( elem.getElementsByTagName("*") );
+                                       jQuery.cleanData( [ elem ] );
+                               }
+
+                               if ( elem.parentNode ) {
+                                       elem.parentNode.removeChild( elem );
+                               }
+                       }
+               }
+
+               return this;
+       },
+
+       empty: function() {
+               var elem,
+                       i = 0;
+
+               for ( ; (elem = this[i]) != null; i++ ) {
+                       // Remove element nodes and prevent memory leaks
+                       if ( elem.nodeType === 1 ) {
+                               jQuery.cleanData( elem.getElementsByTagName("*") );
+                       }
+
+                       // Remove any remaining nodes
+                       while ( elem.firstChild ) {
+                               elem.removeChild( elem.firstChild );
+                       }
+               }
+
+               return this;
+       },
+
+       clone: function( dataAndEvents, deepDataAndEvents ) {
+               dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
+               deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
+
+               return this.map( function () {
+                       return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
+               });
+       },
+
+       html: function( value ) {
+               return jQuery.access( this, function( value ) {
+                       var elem = this[0] || {},
+                               i = 0,
+                               l = this.length;
+
+                       if ( value === undefined ) {
+                               return elem.nodeType === 1 ?
+                                       elem.innerHTML.replace( rinlinejQuery, "" ) :
+                                       undefined;
+                       }
+
+                       // See if we can take a shortcut and just use innerHTML
+                       if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
+                               ( jQuery.support.htmlSerialize || !rnoshimcache.test( value )  ) &&
+                               ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
+                               !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
+
+                               value = value.replace( rxhtmlTag, "<$1></$2>" );
+
+                               try {
+                                       for (; i < l; i++ ) {
+                                               // Remove element nodes and prevent memory leaks
+                                               elem = this[i] || {};
+                                               if ( elem.nodeType === 1 ) {
+                                                       jQuery.cleanData( elem.getElementsByTagName( "*" ) );
+                                                       elem.innerHTML = value;
+                                               }
+                                       }
+
+                                       elem = 0;
+
+                               // If using innerHTML throws an exception, use the fallback method
+                               } catch(e) {}
+                       }
+
+                       if ( elem ) {
+                               this.empty().append( value );
+                       }
+               }, null, value, arguments.length );
+       },
+
+       replaceWith: function( value ) {
+               if ( !isDisconnected( this[0] ) ) {
+                       // Make sure that the elements are removed from the DOM before they are inserted
+                       // this can help fix replacing a parent with child elements
+                       if ( jQuery.isFunction( value ) ) {
+                               return this.each(function(i) {
+                                       var self = jQuery(this), old = self.html();
+                                       self.replaceWith( value.call( this, i, old ) );
+                               });
+                       }
+
+                       if ( typeof value !== "string" ) {
+                               value = jQuery( value ).detach();
+                       }
+
+                       return this.each(function() {
+                               var next = this.nextSibling,
+                                       parent = this.parentNode;
+
+                               jQuery( this ).remove();
+
+                               if ( next ) {
+                                       jQuery(next).before( value );
+                               } else {
+                                       jQuery(parent).append( value );
+                               }
+                       });
+               }
+
+               return this.length ?
+                       this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
+                       this;
+       },
+
+       detach: function( selector ) {
+               return this.remove( selector, true );
+       },
+
+       domManip: function( args, table, callback ) {
+
+               // Flatten any nested arrays
+               args = [].concat.apply( [], args );
+
+               var results, first, fragment, iNoClone,
+                       i = 0,
+                       value = args[0],
+                       scripts = [],
+                       l = this.length;
+
+               // We can't cloneNode fragments that contain checked, in WebKit
+               if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) {
+                       return this.each(function() {
+                               jQuery(this).domManip( args, table, callback );
+                       });
+               }
+
+               if ( jQuery.isFunction(value) ) {
+                       return this.each(function(i) {
+                               var self = jQuery(this);
+                               args[0] = value.call( this, i, table ? self.html() : undefined );
+                               self.domManip( args, table, callback );
+                       });
+               }
+
+               if ( this[0] ) {
+                       results = jQuery.buildFragment( args, this, scripts );
+                       fragment = results.fragment;
+                       first = fragment.firstChild;
+
+                       if ( fragment.childNodes.length === 1 ) {
+                               fragment = first;
+                       }
+
+                       if ( first ) {
+                               table = table && jQuery.nodeName( first, "tr" );
+
+                               // Use the original fragment for the last item instead of the first because it can end up
+                               // being emptied incorrectly in certain situations (#8070).
+                               // Fragments from the fragment cache must always be cloned and never used in place.
+                               for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) {
+                                       callback.call(
+                                               table && jQuery.nodeName( this[i], "table" ) ?
+                                                       findOrAppend( this[i], "tbody" ) :
+                                                       this[i],
+                                               i === iNoClone ?
+                                                       fragment :
+                                                       jQuery.clone( fragment, true, true )
+                                       );
+                               }
+                       }
+
+                       // Fix #11809: Avoid leaking memory
+                       fragment = first = null;
+
+                       if ( scripts.length ) {
+                               jQuery.each( scripts, function( i, elem ) {
+                                       if ( elem.src ) {
+                                               if ( jQuery.ajax ) {
+                                                       jQuery.ajax({
+                                                               url: elem.src,
+                                                               type: "GET",
+                                                               dataType: "script",
+                                                               async: false,
+                                                               global: false,
+                                                               "throws": true
+                                                       });
+                                               } else {
+                                                       jQuery.error("no ajax");
+                                               }
+                                       } else {
+                                               jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) );
+                                       }
+
+                                       if ( elem.parentNode ) {
+                                               elem.parentNode.removeChild( elem );
+                                       }
+                               });
+                       }
+               }
+
+               return this;
+       }
+});
+
+function findOrAppend( elem, tag ) {
+       return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
+}
+
+function cloneCopyEvent( src, dest ) {
+
+       if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
+               return;
+       }
+
+       var type, i, l,
+               oldData = jQuery._data( src ),
+               curData = jQuery._data( dest, oldData ),
+               events = oldData.events;
+
+       if ( events ) {
+               delete curData.handle;
+               curData.events = {};
+
+               for ( type in events ) {
+                       for ( i = 0, l = events[ type ].length; i < l; i++ ) {
+                               jQuery.event.add( dest, type, events[ type ][ i ] );
+                       }
+               }
+       }
+
+       // make the cloned public data object a copy from the original
+       if ( curData.data ) {
+               curData.data = jQuery.extend( {}, curData.data );
+       }
+}
+
+function cloneFixAttributes( src, dest ) {
+       var nodeName;
+
+       // We do not need to do anything for non-Elements
+       if ( dest.nodeType !== 1 ) {
+               return;
+       }
+
+       // clearAttributes removes the attributes, which we don't want,
+       // but also removes the attachEvent events, which we *do* want
+       if ( dest.clearAttributes ) {
+               dest.clearAttributes();
+       }
+
+       // mergeAttributes, in contrast, only merges back on the
+       // original attributes, not the events
+       if ( dest.mergeAttributes ) {
+               dest.mergeAttributes( src );
+       }
+
+       nodeName = dest.nodeName.toLowerCase();
+
+       if ( nodeName === "object" ) {
+               // IE6-10 improperly clones children of object elements using classid.
+               // IE10 throws NoModificationAllowedError if parent is null, #12132.
+               if ( dest.parentNode ) {
+                       dest.outerHTML = src.outerHTML;
+               }
+
+               // This path appears unavoidable for IE9. When cloning an object
+               // element in IE9, the outerHTML strategy above is not sufficient.
+               // If the src has innerHTML and the destination does not,
+               // copy the src.innerHTML into the dest.innerHTML. #10324
+               if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) {
+                       dest.innerHTML = src.innerHTML;
+               }
+
+       } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
+               // IE6-8 fails to persist the checked state of a cloned checkbox
+               // or radio button. Worse, IE6-7 fail to give the cloned element
+               // a checked appearance if the defaultChecked value isn't also set
+
+               dest.defaultChecked = dest.checked = src.checked;
+
+               // IE6-7 get confused and end up setting the value of a cloned
+               // checkbox/radio button to an empty string instead of "on"
+               if ( dest.value !== src.value ) {
+                       dest.value = src.value;
+               }
+
+       // IE6-8 fails to return the selected option to the default selected
+       // state when cloning options
+       } else if ( nodeName === "option" ) {
+               dest.selected = src.defaultSelected;
+
+       // IE6-8 fails to set the defaultValue to the correct value when
+       // cloning other types of input fields
+       } else if ( nodeName === "input" || nodeName === "textarea" ) {
+               dest.defaultValue = src.defaultValue;
+
+       // IE blanks contents when cloning scripts
+       } else if ( nodeName === "script" && dest.text !== src.text ) {
+               dest.text = src.text;
+       }
+
+       // Event data gets referenced instead of copied if the expando
+       // gets copied too
+       dest.removeAttribute( jQuery.expando );
+}
+
+jQuery.buildFragment = function( args, context, scripts ) {
+       var fragment, cacheable, cachehit,
+               first = args[ 0 ];
+
+       // Set context from what may come in as undefined or a jQuery collection or a node
+       // Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 &
+       // also doubles as fix for #8950 where plain objects caused createDocumentFragment exception
+       context = context || document;
+       context = !context.nodeType && context[0] || context;
+       context = context.ownerDocument || context;
+
+       // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
+       // Cloning options loses the selected state, so don't cache them
+       // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
+       // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
+       // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
+       if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document &&
+               first.charAt(0) === "<" && !rnocache.test( first ) &&
+               (jQuery.support.checkClone || !rchecked.test( first )) &&
+               (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
+
+               // Mark cacheable and look for a hit
+               cacheable = true;
+               fragment = jQuery.fragments[ first ];
+               cachehit = fragment !== undefined;
+       }
+
+       if ( !fragment ) {
+               fragment = context.createDocumentFragment();
+               jQuery.clean( args, context, fragment, scripts );
+
+               // Update the cache, but only store false
+               // unless this is a second parsing of the same content
+               if ( cacheable ) {
+                       jQuery.fragments[ first ] = cachehit && fragment;
+               }
+       }
+
+       return { fragment: fragment, cacheable: cacheable };
+};
+
+jQuery.fragments = {};
+
+jQuery.each({
+       appendTo: "append",
+       prependTo: "prepend",
+       insertBefore: "before",
+       insertAfter: "after",
+       replaceAll: "replaceWith"
+}, function( name, original ) {
+       jQuery.fn[ name ] = function( selector ) {
+               var elems,
+                       i = 0,
+                       ret = [],
+                       insert = jQuery( selector ),
+                       l = insert.length,
+                       parent = this.length === 1 && this[0].parentNode;
+
+               if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) {
+                       insert[ original ]( this[0] );
+                       return this;
+               } else {
+                       for ( ; i < l; i++ ) {
+                               elems = ( i > 0 ? this.clone(true) : this ).get();
+                               jQuery( insert[i] )[ original ]( elems );
+                               ret = ret.concat( elems );
+                       }
+
+                       return this.pushStack( ret, name, insert.selector );
+               }
+       };
+});
+
+function getAll( elem ) {
+       if ( typeof elem.getElementsByTagName !== "undefined" ) {
+               return elem.getElementsByTagName( "*" );
+
+       } else if ( typeof elem.querySelectorAll !== "undefined" ) {
+               return elem.querySelectorAll( "*" );
+
+       } else {
+               return [];
+       }
+}
+
+// Used in clean, fixes the defaultChecked property
+function fixDefaultChecked( elem ) {
+       if ( rcheckableType.test( elem.type ) ) {
+               elem.defaultChecked = elem.checked;
+       }
+}
+
+jQuery.extend({
+       clone: function( elem, dataAndEvents, deepDataAndEvents ) {
+               var srcElements,
+                       destElements,
+                       i,
+                       clone;
+
+               if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
+                       clone = elem.cloneNode( true );
+
+               // IE<=8 does not properly clone detached, unknown element nodes
+               } else {
+                       fragmentDiv.innerHTML = elem.outerHTML;
+                       fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
+               }
+
+               if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
+                               (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
+                       // IE copies events bound via attachEvent when using cloneNode.
+                       // Calling detachEvent on the clone will also remove the events
+                       // from the original. In order to get around this, we use some
+                       // proprietary methods to clear the events. Thanks to MooTools
+                       // guys for this hotness.
+
+                       cloneFixAttributes( elem, clone );
+
+                       // Using Sizzle here is crazy slow, so we use getElementsByTagName instead
+                       srcElements = getAll( elem );
+                       destElements = getAll( clone );
+
+                       // Weird iteration because IE will replace the length property
+                       // with an element if you are cloning the body and one of the
+                       // elements on the page has a name or id of "length"
+                       for ( i = 0; srcElements[i]; ++i ) {
+                               // Ensure that the destination node is not null; Fixes #9587
+                               if ( destElements[i] ) {
+                                       cloneFixAttributes( srcElements[i], destElements[i] );
+                               }
+                       }
+               }
+
+               // Copy the events from the original to the clone
+               if ( dataAndEvents ) {
+                       cloneCopyEvent( elem, clone );
+
+                       if ( deepDataAndEvents ) {
+                               srcElements = getAll( elem );
+                               destElements = getAll( clone );
+
+                               for ( i = 0; srcElements[i]; ++i ) {
+                                       cloneCopyEvent( srcElements[i], destElements[i] );
+                               }
+                       }
+               }
+
+               srcElements = destElements = null;
+
+               // Return the cloned set
+               return clone;
+       },
+
+       clean: function( elems, context, fragment, scripts ) {
+               var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags,
+                       safe = context === document && safeFragment,
+                       ret = [];
+
+               // Ensure that context is a document
+               if ( !context || typeof context.createDocumentFragment === "undefined" ) {
+                       context = document;
+               }
+
+               // Use the already-created safe fragment if context permits
+               for ( i = 0; (elem = elems[i]) != null; i++ ) {
+                       if ( typeof elem === "number" ) {
+                               elem += "";
+                       }
+
+                       if ( !elem ) {
+                               continue;
+                       }
+
+                       // Convert html string into DOM nodes
+                       if ( typeof elem === "string" ) {
+                               if ( !rhtml.test( elem ) ) {
+                                       elem = context.createTextNode( elem );
+                               } else {
+                                       // Ensure a safe container in which to render the html
+                                       safe = safe || createSafeFragment( context );
+                                       div = context.createElement("div");
+                                       safe.appendChild( div );
+
+                                       // Fix "XHTML"-style tags in all browsers
+                                       elem = elem.replace(rxhtmlTag, "<$1></$2>");
+
+                                       // Go to html and back, then peel off extra wrappers
+                                       tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
+                                       wrap = wrapMap[ tag ] || wrapMap._default;
+                                       depth = wrap[0];
+                                       div.innerHTML = wrap[1] + elem + wrap[2];
+
+                                       // Move to the right depth
+                                       while ( depth-- ) {
+                                               div = div.lastChild;
+                                       }
+
+                                       // Remove IE's autoinserted <tbody> from table fragments
+                                       if ( !jQuery.support.tbody ) {
+
+                                               // String was a <table>, *may* have spurious <tbody>
+                                               hasBody = rtbody.test(elem);
+                                                       tbody = tag === "table" && !hasBody ?
+                                                               div.firstChild && div.firstChild.childNodes :
+
+                                                               // String was a bare <thead> or <tfoot>
+                                                               wrap[1] === "<table>" && !hasBody ?
+                                                                       div.childNodes :
+                                                                       [];
+
+                                               for ( j = tbody.length - 1; j >= 0 ; --j ) {
+                                                       if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
+                                                               tbody[ j ].parentNode.removeChild( tbody[ j ] );
+                                                       }
+                                               }
+                                       }
+
+                                       // IE completely kills leading whitespace when innerHTML is used
+                                       if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
+                                               div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
+                                       }
+
+                                       elem = div.childNodes;
+
+                                       // Take out of fragment container (we need a fresh div each time)
+                                       div.parentNode.removeChild( div );
+                               }
+                       }
+
+                       if ( elem.nodeType ) {
+                               ret.push( elem );
+                       } else {
+                               jQuery.merge( ret, elem );
+                       }
+               }
+
+               // Fix #11356: Clear elements from safeFragment
+               if ( div ) {
+                       elem = div = safe = null;
+               }
+
+               // Reset defaultChecked for any radios and checkboxes
+               // about to be appended to the DOM in IE 6/7 (#8060)
+               if ( !jQuery.support.appendChecked ) {
+                       for ( i = 0; (elem = ret[i]) != null; i++ ) {
+                               if ( jQuery.nodeName( elem, "input" ) ) {
+                                       fixDefaultChecked( elem );
+                               } else if ( typeof elem.getElementsByTagName !== "undefined" ) {
+                                       jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
+                               }
+                       }
+               }
+
+               // Append elements to a provided document fragment
+               if ( fragment ) {
+                       // Special handling of each script element
+                       handleScript = function( elem ) {
+                               // Check if we consider it executable
+                               if ( !elem.type || rscriptType.test( elem.type ) ) {
+                                       // Detach the script and store it in the scripts array (if provided) or the fragment
+                                       // Return truthy to indicate that it has been handled
+                                       return scripts ?
+                                               scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
+                                               fragment.appendChild( elem );
+                               }
+                       };
+
+                       for ( i = 0; (elem = ret[i]) != null; i++ ) {
+                               // Check if we're done after handling an executable script
+                               if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
+                                       // Append to fragment and handle embedded scripts
+                                       fragment.appendChild( elem );
+                                       if ( typeof elem.getElementsByTagName !== "undefined" ) {
+                                               // handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
+                                               jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
+
+                                               // Splice the scripts into ret after their former ancestor and advance our index beyond them
+                                               ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
+                                               i += jsTags.length;
+                                       }
+                               }
+                       }
+               }
+
+               return ret;
+       },
+
+       cleanData: function( elems, /* internal */ acceptData ) {
+               var data, id, elem, type,
+                       i = 0,
+                       internalKey = jQuery.expando,
+                       cache = jQuery.cache,
+                       deleteExpando = jQuery.support.deleteExpando,
+                       special = jQuery.event.special;
+
+               for ( ; (elem = elems[i]) != null; i++ ) {
+
+                       if ( acceptData || jQuery.acceptData( elem ) ) {
+
+                               id = elem[ internalKey ];
+                               data = id && cache[ id ];
+
+                               if ( data ) {
+                                       if ( data.events ) {
+                                               for ( type in data.events ) {
+                                                       if ( special[ type ] ) {
+                                                               jQuery.event.remove( elem, type );
+
+                                                       // This is a shortcut to avoid jQuery.event.remove's overhead
+                                                       } else {
+                                                               jQuery.removeEvent( elem, type, data.handle );
+                                                       }
+                                               }
+                                       }
+
+                                       // Remove cache only if it was not already removed by jQuery.event.remove
+                                       if ( cache[ id ] ) {
+
+                                               delete cache[ id ];
+
+                                               // IE does not allow us to delete expando properties from nodes,
+                                               // nor does it have a removeAttribute function on Document nodes;
+                                               // we must handle all of these cases
+                                               if ( deleteExpando ) {
+                                                       delete elem[ internalKey ];
+
+                                               } else if ( elem.removeAttribute ) {
+                                                       elem.removeAttribute( internalKey );
+
+                                               } else {
+                                                       elem[ internalKey ] = null;
+                                               }
+
+                                               jQuery.deletedIds.push( id );
+                                       }
+                               }
+                       }
+               }
+       }
+});
+// Limit scope pollution from any deprecated API
+(function() {
+
+var matched, browser;
+
+// Use of jQuery.browser is frowned upon.
+// More details: http://api.jquery.com/jQuery.browser
+// jQuery.uaMatch maintained for back-compat
+jQuery.uaMatch = function( ua ) {
+       ua = ua.toLowerCase();
+
+       var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
+               /(webkit)[ \/]([\w.]+)/.exec( ua ) ||
+               /(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
+               /(msie) ([\w.]+)/.exec( ua ) ||
+               ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
+               [];
+
+       return {
+               browser: match[ 1 ] || "",
+               version: match[ 2 ] || "0"
+       };
+};
+
+matched = jQuery.uaMatch( navigator.userAgent );
+browser = {};
+
+if ( matched.browser ) {
+       browser[ matched.browser ] = true;
+       browser.version = matched.version;
+}
+
+// Chrome is Webkit, but Webkit is also Safari.
+if ( browser.chrome ) {
+       browser.webkit = true;
+} else if ( browser.webkit ) {
+       browser.safari = true;
+}
+
+jQuery.browser = browser;
+
+jQuery.sub = function() {
+       function jQuerySub( selector, context ) {
+               return new jQuerySub.fn.init( selector, context );
+       }
+       jQuery.extend( true, jQuerySub, this );
+       jQuerySub.superclass = this;
+       jQuerySub.fn = jQuerySub.prototype = this();
+       jQuerySub.fn.constructor = jQuerySub;
+       jQuerySub.sub = this.sub;
+       jQuerySub.fn.init = function init( selector, context ) {
+               if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
+                       context = jQuerySub( context );
+               }
+
+               return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
+       };
+       jQuerySub.fn.init.prototype = jQuerySub.fn;
+       var rootjQuerySub = jQuerySub(document);
+       return jQuerySub;
+};
+
+})();
+var curCSS, iframe, iframeDoc,
+       ralpha = /alpha\([^)]*\)/i,
+       ropacity = /opacity=([^)]*)/,
+       rposition = /^(top|right|bottom|left)$/,
+       // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
+       // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
+       rdisplayswap = /^(none|table(?!-c[ea]).+)/,
+       rmargin = /^margin/,
+       rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
+       rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
+       rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ),
+       elemdisplay = { BODY: "block" },
+
+       cssShow = { position: "absolute", visibility: "hidden", display: "block" },
+       cssNormalTransform = {
+               letterSpacing: 0,
+               fontWeight: 400
+       },
+
+       cssExpand = [ "Top", "Right", "Bottom", "Left" ],
+       cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
+
+       eventsToggle = jQuery.fn.toggle;
+
+// return a css property mapped to a potentially vendor prefixed property
+function vendorPropName( style, name ) {
+
+       // shortcut for names that are not vendor prefixed
+       if ( name in style ) {
+               return name;
+       }
+
+       // check for vendor prefixed names
+       var capName = name.charAt(0).toUpperCase() + name.slice(1),
+               origName = name,
+               i = cssPrefixes.length;
+
+       while ( i-- ) {
+               name = cssPrefixes[ i ] + capName;
+               if ( name in style ) {
+                       return name;
+               }
+       }
+
+       return origName;
+}
+
+function isHidden( elem, el ) {
+       elem = el || elem;
+       return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
+}
+
+function showHide( elements, show ) {
+       var elem, display,
+               values = [],
+               index = 0,
+               length = elements.length;
+
+       for ( ; index < length; index++ ) {
+               elem = elements[ index ];
+               if ( !elem.style ) {
+                       continue;
+               }
+               values[ index ] = jQuery._data( elem, "olddisplay" );
+               if ( show ) {
+                       // Reset the inline display of this element to learn if it is
+                       // being hidden by cascaded rules or not
+                       if ( !values[ index ] && elem.style.display === "none" ) {
+                               elem.style.display = "";
+                       }
+
+                       // Set elements which have been overridden with display: none
+                       // in a stylesheet to whatever the default browser style is
+                       // for such an element
+                       if ( elem.style.display === "" && isHidden( elem ) ) {
+                               values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
+                       }
+               } else {
+                       display = curCSS( elem, "display" );
+
+                       if ( !values[ index ] && display !== "none" ) {
+                               jQuery._data( elem, "olddisplay", display );
+                       }
+               }
+       }
+
+       // Set the display of most of the elements in a second loop
+       // to avoid the constant reflow
+       for ( index = 0; index < length; index++ ) {
+               elem = elements[ index ];
+               if ( !elem.style ) {
+                       continue;
+               }
+               if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
+                       elem.style.display = show ? values[ index ] || "" : "none";
+               }
+       }
+
+       return elements;
+}
+
+jQuery.fn.extend({
+       css: function( name, value ) {
+               return jQuery.access( this, function( elem, name, value ) {
+                       return value !== undefined ?
+                               jQuery.style( elem, name, value ) :
+                               jQuery.css( elem, name );
+               }, name, value, arguments.length > 1 );
+       },
+       show: function() {
+               return showHide( this, true );
+       },
+       hide: function() {
+               return showHide( this );
+       },
+       toggle: function( state, fn2 ) {
+               var bool = typeof state === "boolean";
+
+               if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) {
+                       return eventsToggle.apply( this, arguments );
+               }
+
+               return this.each(function() {
+                       if ( bool ? state : isHidden( this ) ) {
+                               jQuery( this ).show();
+                       } else {
+                               jQuery( this ).hide();
+                       }
+               });
+       }
+});
+
+jQuery.extend({
+       // Add in style property hooks for overriding the default
+       // behavior of getting and setting a style property
+       cssHooks: {
+               opacity: {
+                       get: function( elem, computed ) {
+                               if ( computed ) {
+                                       // We should always get a number back from opacity
+                                       var ret = curCSS( elem, "opacity" );
+                                       return ret === "" ? "1" : ret;
+
+                               }
+                       }
+               }
+       },
+
+       // Exclude the following css properties to add px
+       cssNumber: {
+               "fillOpacity": true,
+               "fontWeight": true,
+               "lineHeight": true,
+               "opacity": true,
+               "orphans": true,
+               "widows": true,
+               "zIndex": true,
+               "zoom": true
+       },
+
+       // Add in properties whose names you wish to fix before
+       // setting or getting the value
+       cssProps: {
+               // normalize float css property
+               "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
+       },
+
+       // Get and set the style property on a DOM Node
+       style: function( elem, name, value, extra ) {
+               // Don't set styles on text and comment nodes
+               if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
+                       return;
+               }
+
+               // Make sure that we're working with the right name
+               var ret, type, hooks,
+                       origName = jQuery.camelCase( name ),
+                       style = elem.style;
+
+               name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
+
+               // gets hook for the prefixed version
+               // followed by the unprefixed version
+               hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+               // Check if we're setting a value
+               if ( value !== undefined ) {
+                       type = typeof value;
+
+                       // convert relative number strings (+= or -=) to relative numbers. #7345
+                       if ( type === "string" && (ret = rrelNum.exec( value )) ) {
+                               value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
+                               // Fixes bug #9237
+                               type = "number";
+                       }
+
+                       // Make sure that NaN and null values aren't set. See: #7116
+                       if ( value == null || type === "number" && isNaN( value ) ) {
+                               return;
+                       }
+
+                       // If a number was passed in, add 'px' to the (except for certain CSS properties)
+                       if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
+                               value += "px";
+                       }
+
+                       // If a hook was provided, use that value, otherwise just set the specified value
+                       if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
+                               // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
+                               // Fixes bug #5509
+                               try {
+                                       style[ name ] = value;
+                               } catch(e) {}
+                       }
+
+               } else {
+                       // If a hook was provided get the non-computed value from there
+                       if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
+                               return ret;
+                       }
+
+                       // Otherwise just get the value from the style object
+                       return style[ name ];
+               }
+       },
+
+       css: function( elem, name, numeric, extra ) {
+               var val, num, hooks,
+                       origName = jQuery.camelCase( name );
+
+               // Make sure that we're working with the right name
+               name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
+
+               // gets hook for the prefixed version
+               // followed by the unprefixed version
+               hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
+
+               // If a hook was provided get the computed value from there
+               if ( hooks && "get" in hooks ) {
+                       val = hooks.get( elem, true, extra );
+               }
+
+               // Otherwise, if a way to get the computed value exists, use that
+               if ( val === undefined ) {
+                       val = curCSS( elem, name );
+               }
+
+               //convert "normal" to computed value
+               if ( val === "normal" && name in cssNormalTransform ) {
+                       val = cssNormalTransform[ name ];
+               }
+
+               // Return, converting to number if forced or a qualifier was provided and val looks numeric
+               if ( numeric || extra !== undefined ) {
+                       num = parseFloat( val );
+                       return numeric || jQuery.isNumeric( num ) ? num || 0 : val;
+               }
+               return val;
+       },
+
+       // A method for quickly swapping in/out CSS properties to get correct calculations
+       swap: function( elem, options, callback ) {
+               var ret, name,
+                       old = {};
+
+               // Remember the old values, and insert the new ones
+               for ( name in options ) {
+                       old[ name ] = elem.style[ name ];
+                       elem.style[ name ] = options[ name ];
+               }
+
+               ret = callback.call( elem );
+
+               // Revert the old values
+               for ( name in options ) {
+                       elem.style[ name ] = old[ name ];
+               }
+
+               return ret;
+       }
+});
+
+// NOTE: To any future maintainer, we've window.getComputedStyle
+// because jsdom on node.js will break without it.
+if ( window.getComputedStyle ) {
+       curCSS = function( elem, name ) {
+               var ret, width, minWidth, maxWidth,
+                       computed = window.getComputedStyle( elem, null ),
+                       style = elem.style;
+
+               if ( computed ) {
+
+                       // getPropertyValue is only needed for .css('filter') in IE9, see #12537
+                       ret = computed.getPropertyValue( name ) || computed[ name ];
+
+                       if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
+                               ret = jQuery.style( elem, name );
+                       }
+
+                       // A tribute to the "awesome hack by Dean Edwards"
+                       // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
+                       // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
+                       // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
+                       if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
+                               width = style.width;
+                               minWidth = style.minWidth;
+                               maxWidth = style.maxWidth;
+
+                               style.minWidth = style.maxWidth = style.width = ret;
+                               ret = computed.width;
+
+                               style.width = width;
+                               style.minWidth = minWidth;
+                               style.maxWidth = maxWidth;
+                       }
+               }
+
+               return ret;
+       };
+} else if ( document.documentElement.currentStyle ) {
+       curCSS = function( elem, name ) {
+               var left, rsLeft,
+                       ret = elem.currentStyle && elem.currentStyle[ name ],
+                       style = elem.style;
+
+               // Avoid setting ret to empty string here
+               // so we don't default to auto
+               if ( ret == null && style && style[ name ] ) {
+                       ret = style[ name ];
+               }
+
+               // From the awesome hack by Dean Edwards
+               // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
+
+               // If we're not dealing with a regular pixel number
+               // but a number that has a weird ending, we need to convert it to pixels
+               // but not position css attributes, as those are proportional to the parent element instead
+               // and we can't measure the parent instead because it might trigger a "stacking dolls" problem
+               if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
+
+                       // Remember the original values
+                       left = style.left;
+                       rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
+
+                       // Put in the new values to get a computed value out
+                       if ( rsLeft ) {
+                               elem.runtimeStyle.left = elem.currentStyle.left;
+                       }
+                       style.left = name === "fontSize" ? "1em" : ret;
+                       ret = style.pixelLeft + "px";
+
+                       // Revert the changed values
+                       style.left = left;
+                       if ( rsLeft ) {
+                               elem.runtimeStyle.left = rsLeft;
+                       }
+               }
+
+               return ret === "" ? "auto" : ret;
+       };
+}
+
+function setPositiveNumber( elem, value, subtract ) {
+       var matches = rnumsplit.exec( value );
+       return matches ?
+                       Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
+                       value;
+}
+
+function augmentWidthOrHeight( elem, name, extra, isBorderBox ) {
+       var i = extra === ( isBorderBox ? "border" : "content" ) ?
+               // If we already have the right measurement, avoid augmentation
+               4 :
+               // Otherwise initialize for horizontal or vertical properties
+               name === "width" ? 1 : 0,
+
+               val = 0;
+
+       for ( ; i < 4; i += 2 ) {
+               // both box models exclude margin, so add it if we want it
+               if ( extra === "margin" ) {
+                       // we use jQuery.css instead of curCSS here
+                       // because of the reliableMarginRight CSS hook!
+                       val += jQuery.css( elem, extra + cssExpand[ i ], true );
+               }
+
+               // From this point on we use curCSS for maximum performance (relevant in animations)
+               if ( isBorderBox ) {
+                       // border-box includes padding, so remove it if we want content
+                       if ( extra === "content" ) {
+                               val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
+                       }
+
+                       // at this point, extra isn't border nor margin, so remove border
+                       if ( extra !== "margin" ) {
+                               val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
+                       }
+               } else {
+                       // at this point, extra isn't content, so add padding
+                       val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
+
+                       // at this point, extra isn't content nor padding, so add border
+                       if ( extra !== "padding" ) {
+                               val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
+                       }
+               }
+       }
+
+       return val;
+}
+
+function getWidthOrHeight( elem, name, extra ) {
+
+       // Start with offset property, which is equivalent to the border-box value
+       var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
+               valueIsBorderBox = true,
+               isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box";
+
+       // some non-html elements return undefined for offsetWidth, so check for null/undefined
+       // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
+       // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
+       if ( val <= 0 || val == null ) {
+               // Fall back to computed then uncomputed css if necessary
+               val = curCSS( elem, name );
+               if ( val < 0 || val == null ) {
+                       val = elem.style[ name ];
+               }
+
+               // Computed unit is not pixels. Stop here and return.
+               if ( rnumnonpx.test(val) ) {
+                       return val;
+               }
+
+               // we need the check for style in case a browser which returns unreliable values
+               // for getComputedStyle silently falls back to the reliable elem.style
+               valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
+
+               // Normalize "", auto, and prepare for extra
+               val = parseFloat( val ) || 0;
+       }
+
+       // use the active box-sizing model to add/subtract irrelevant styles
+       return ( val +
+               augmentWidthOrHeight(
+                       elem,
+                       name,
+                       extra || ( isBorderBox ? "border" : "content" ),
+                       valueIsBorderBox
+               )
+       ) + "px";
+}
+
+
+// Try to determine the default display value of an element
+function css_defaultDisplay( nodeName ) {
+       if ( elemdisplay[ nodeName ] ) {
+               return elemdisplay[ nodeName ];
+       }
+
+       var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ),
+               display = elem.css("display");
+       elem.remove();
+
+       // If the simple way fails,
+       // get element's real default display by attaching it to a temp iframe
+       if ( display === "none" || display === "" ) {
+               // Use the already-created iframe if possible
+               iframe = document.body.appendChild(
+                       iframe || jQuery.extend( document.createElement("iframe"), {
+                               frameBorder: 0,
+                               width: 0,
+                               height: 0
+                       })
+               );
+
+               // Create a cacheable copy of the iframe document on first call.
+               // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
+               // document to it; WebKit & Firefox won't allow reusing the iframe document.
+               if ( !iframeDoc || !iframe.createElement ) {
+                       iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
+                       iframeDoc.write("<!doctype html><html><body>");
+                       iframeDoc.close();
+               }
+
+               elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) );
+
+               display = curCSS( elem, "display" );
+               document.body.removeChild( iframe );
+       }
+
+       // Store the correct default display
+       elemdisplay[ nodeName ] = display;
+
+       return display;
+}
+
+jQuery.each([ "height", "width" ], function( i, name ) {
+       jQuery.cssHooks[ name ] = {
+               get: function( elem, computed, extra ) {
+                       if ( computed ) {
+                               // certain elements can have dimension info if we invisibly show them
+                               // however, it must have a current display style that would benefit from this
+                               if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) {
+                                       return jQuery.swap( elem, cssShow, function() {
+                                               return getWidthOrHeight( elem, name, extra );
+                                       });
+                               } else {
+                                       return getWidthOrHeight( elem, name, extra );
+                               }
+                       }
+               },
+
+               set: function( elem, value, extra ) {
+                       return setPositiveNumber( elem, value, extra ?
+                               augmentWidthOrHeight(
+                                       elem,
+                                       name,
+                                       extra,
+                                       jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"
+                               ) : 0
+                       );
+               }
+       };
+});
+
+if ( !jQuery.support.opacity ) {
+       jQuery.cssHooks.opacity = {
+               get: function( elem, computed ) {
+                       // IE uses filters for opacity
+                       return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
+                               ( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
+                               computed ? "1" : "";
+               },
+
+               set: function( elem, value ) {
+                       var style = elem.style,
+                               currentStyle = elem.currentStyle,
+                               opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
+                               filter = currentStyle && currentStyle.filter || style.filter || "";
+
+                       // IE has trouble with opacity if it does not have layout
+                       // Force it by setting the zoom level
+                       style.zoom = 1;
+
+                       // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
+                       if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
+                               style.removeAttribute ) {
+
+                               // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
+                               // if "filter:" is present at all, clearType is disabled, we want to avoid this
+                               // style.removeAttribute is IE Only, but so apparently is this code path...
+                               style.removeAttribute( "filter" );
+
+                               // if there there is no filter style applied in a css rule, we are done
+                               if ( currentStyle && !currentStyle.filter ) {
+                                       return;
+                               }
+                       }
+
+                       // otherwise, set new filter values
+                       style.filter = ralpha.test( filter ) ?
+                               filter.replace( ralpha, opacity ) :
+                               filter + " " + opacity;
+               }
+       };
+}
+
+// These hooks cannot be added until DOM ready because the support test
+// for it is not run until after DOM ready
+jQuery(function() {
+       if ( !jQuery.support.reliableMarginRight ) {
+               jQuery.cssHooks.marginRight = {
+                       get: function( elem, computed ) {
+                               // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
+                               // Work around by temporarily setting element display to inline-block
+                               return jQuery.swap( elem, { "display": "inline-block" }, function() {
+                                       if ( computed ) {
+                                               return curCSS( elem, "marginRight" );
+                                       }
+                               });
+                       }
+               };
+       }
+
+       // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
+       // getComputedStyle returns percent when specified for top/left/bottom/right
+       // rather than make the css module depend on the offset module, we just check for it here
+       if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
+               jQuery.each( [ "top", "left" ], function( i, prop ) {
+                       jQuery.cssHooks[ prop ] = {
+                               get: function( elem, computed ) {
+                                       if ( computed ) {
+                                               var ret = curCSS( elem, prop );
+                                               // if curCSS returns percentage, fallback to offset
+                                               return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret;
+                                       }
+                               }
+                       };
+               });
+       }
+
+});
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+       jQuery.expr.filters.hidden = function( elem ) {
+               return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none");
+       };
+
+       jQuery.expr.filters.visible = function( elem ) {
+               return !jQuery.expr.filters.hidden( elem );
+       };
+}
+
+// These hooks are used by animate to expand properties
+jQuery.each({
+       margin: "",
+       padding: "",
+       border: "Width"
+}, function( prefix, suffix ) {
+       jQuery.cssHooks[ prefix + suffix ] = {
+               expand: function( value ) {
+                       var i,
+
+                               // assumes a single number if not a string
+                               parts = typeof value === "string" ? value.split(" ") : [ value ],
+                               expanded = {};
+
+                       for ( i = 0; i < 4; i++ ) {
+                               expanded[ prefix + cssExpand[ i ] + suffix ] =
+                                       parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
+                       }
+
+                       return expanded;
+               }
+       };
+
+       if ( !rmargin.test( prefix ) ) {
+               jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
+       }
+});
+var r20 = /%20/g,
+       rbracket = /\[\]$/,
+       rCRLF = /\r?\n/g,
+       rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
+       rselectTextarea = /^(?:select|textarea)/i;
+
+jQuery.fn.extend({
+       serialize: function() {
+               return jQuery.param( this.serializeArray() );
+       },
+       serializeArray: function() {
+               return this.map(function(){
+                       return this.elements ? jQuery.makeArray( this.elements ) : this;
+               })
+               .filter(function(){
+                       return this.name && !this.disabled &&
+                               ( this.checked || rselectTextarea.test( this.nodeName ) ||
+                                       rinput.test( this.type ) );
+               })
+               .map(function( i, elem ){
+                       var val = jQuery( this ).val();
+
+                       return val == null ?
+                               null :
+                               jQuery.isArray( val ) ?
+                                       jQuery.map( val, function( val, i ){
+                                               return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+                                       }) :
+                                       { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
+               }).get();
+       }
+});
+
+//Serialize an array of form elements or a set of
+//key/values into a query string
+jQuery.param = function( a, traditional ) {
+       var prefix,
+               s = [],
+               add = function( key, value ) {
+                       // If value is a function, invoke it and return its value
+                       value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
+                       s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
+               };
+
+       // Set traditional to true for jQuery <= 1.3.2 behavior.
+       if ( traditional === undefined ) {
+               traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
+       }
+
+       // If an array was passed in, assume that it is an array of form elements.
+       if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
+               // Serialize the form elements
+               jQuery.each( a, function() {
+                       add( this.name, this.value );
+               });
+
+       } else {
+               // If traditional, encode the "old" way (the way 1.3.2 or older
+               // did it), otherwise encode params recursively.
+               for ( prefix in a ) {
+                       buildParams( prefix, a[ prefix ], traditional, add );
+               }
+       }
+
+       // Return the resulting serialization
+       return s.join( "&" ).replace( r20, "+" );
+};
+
+function buildParams( prefix, obj, traditional, add ) {
+       var name;
+
+       if ( jQuery.isArray( obj ) ) {
+               // Serialize array item.
+               jQuery.each( obj, function( i, v ) {
+                       if ( traditional || rbracket.test( prefix ) ) {
+                               // Treat each array item as a scalar.
+                               add( prefix, v );
+
+                       } else {
+                               // If array item is non-scalar (array or object), encode its
+                               // numeric index to resolve deserialization ambiguity issues.
+                               // Note that rack (as of 1.0.0) can't currently deserialize
+                               // nested arrays properly, and attempting to do so may cause
+                               // a server error. Possible fixes are to modify rack's
+                               // deserialization algorithm or to provide an option or flag
+                               // to force array serialization to be shallow.
+                               buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
+                       }
+               });
+
+       } else if ( !traditional && jQuery.type( obj ) === "object" ) {
+               // Serialize object item.
+               for ( name in obj ) {
+                       buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
+               }
+
+       } else {
+               // Serialize scalar item.
+               add( prefix, obj );
+       }
+}
+var
+       // Document location
+       ajaxLocParts,
+       ajaxLocation,
+
+       rhash = /#.*$/,
+       rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
+       // #7653, #8125, #8152: local protocol detection
+       rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
+       rnoContent = /^(?:GET|HEAD)$/,
+       rprotocol = /^\/\//,
+       rquery = /\?/,
+       rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
+       rts = /([?&])_=[^&]*/,
+       rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
+
+       // Keep a copy of the old load method
+       _load = jQuery.fn.load,
+
+       /* Prefilters
+        * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
+        * 2) These are called:
+        *    - BEFORE asking for a transport
+        *    - AFTER param serialization (s.data is a string if s.processData is true)
+        * 3) key is the dataType
+        * 4) the catchall symbol "*" can be used
+        * 5) execution will start with transport dataType and THEN continue down to "*" if needed
+        */
+       prefilters = {},
+
+       /* Transports bindings
+        * 1) key is the dataType
+        * 2) the catchall symbol "*" can be used
+        * 3) selection will start with transport dataType and THEN go to "*" if needed
+        */
+       transports = {},
+
+       // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
+       allTypes = ["*/"] + ["*"];
+
+// #8138, IE may throw an exception when accessing
+// a field from window.location if document.domain has been set
+try {
+       ajaxLocation = location.href;
+} catch( e ) {
+       // Use the href attribute of an A element
+       // since IE will modify it given document.location
+       ajaxLocation = document.createElement( "a" );
+       ajaxLocation.href = "";
+       ajaxLocation = ajaxLocation.href;
+}
+
+// Segment location into parts
+ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
+
+// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
+function addToPrefiltersOrTransports( structure ) {
+
+       // dataTypeExpression is optional and defaults to "*"
+       return function( dataTypeExpression, func ) {
+
+               if ( typeof dataTypeExpression !== "string" ) {
+                       func = dataTypeExpression;
+                       dataTypeExpression = "*";
+               }
+
+               var dataType, list, placeBefore,
+                       dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ),
+                       i = 0,
+                       length = dataTypes.length;
+
+               if ( jQuery.isFunction( func ) ) {
+                       // For each dataType in the dataTypeExpression
+                       for ( ; i < length; i++ ) {
+                               dataType = dataTypes[ i ];
+                               // We control if we're asked to add before
+                               // any existing element
+                               placeBefore = /^\+/.test( dataType );
+                               if ( placeBefore ) {
+                                       dataType = dataType.substr( 1 ) || "*";
+                               }
+                               list = structure[ dataType ] = structure[ dataType ] || [];
+                               // then we add to the structure accordingly
+                               list[ placeBefore ? "unshift" : "push" ]( func );
+                       }
+               }
+       };
+}
+
+// Base inspection function for prefilters and transports
+function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
+               dataType /* internal */, inspected /* internal */ ) {
+
+       dataType = dataType || options.dataTypes[ 0 ];
+       inspected = inspected || {};
+
+       inspected[ dataType ] = true;
+
+       var selection,
+               list = structure[ dataType ],
+               i = 0,
+               length = list ? list.length : 0,
+               executeOnly = ( structure === prefilters );
+
+       for ( ; i < length && ( executeOnly || !selection ); i++ ) {
+               selection = list[ i ]( options, originalOptions, jqXHR );
+               // If we got redirected to another dataType
+               // we try there if executing only and not done already
+               if ( typeof selection === "string" ) {
+                       if ( !executeOnly || inspected[ selection ] ) {
+                               selection = undefined;
+                       } else {
+                               options.dataTypes.unshift( selection );
+                               selection = inspectPrefiltersOrTransports(
+                                               structure, options, originalOptions, jqXHR, selection, inspected );
+                       }
+               }
+       }
+       // If we're only executing or nothing was selected
+       // we try the catchall dataType if not done already
+       if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
+               selection = inspectPrefiltersOrTransports(
+                               structure, options, originalOptions, jqXHR, "*", inspected );
+       }
+       // unnecessary when only executing (prefilters)
+       // but it'll be ignored by the caller in that case
+       return selection;
+}
+
+// A special extend for ajax options
+// that takes "flat" options (not to be deep extended)
+// Fixes #9887
+function ajaxExtend( target, src ) {
+       var key, deep,
+               flatOptions = jQuery.ajaxSettings.flatOptions || {};
+       for ( key in src ) {
+               if ( src[ key ] !== undefined ) {
+                       ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
+               }
+       }
+       if ( deep ) {
+               jQuery.extend( true, target, deep );
+       }
+}
+
+jQuery.fn.load = function( url, params, callback ) {
+       if ( typeof url !== "string" && _load ) {
+               return _load.apply( this, arguments );
+       }
+
+       // Don't do a request if no elements are being requested
+       if ( !this.length ) {
+               return this;
+       }
+
+       var selector, type, response,
+               self = this,
+               off = url.indexOf(" ");
+
+       if ( off >= 0 ) {
+               selector = url.slice( off, url.length );
+               url = url.slice( 0, off );
+       }
+
+       // If it's a function
+       if ( jQuery.isFunction( params ) ) {
+
+               // We assume that it's the callback
+               callback = params;
+               params = undefined;
+
+       // Otherwise, build a param string
+       } else if ( params && typeof params === "object" ) {
+               type = "POST";
+       }
+
+       // Request the remote document
+       jQuery.ajax({
+               url: url,
+
+               // if "type" variable is undefined, then "GET" method will be used
+               type: type,
+               dataType: "html",
+               data: params,
+               complete: function( jqXHR, status ) {
+                       if ( callback ) {
+                               self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
+                       }
+               }
+       }).done(function( responseText ) {
+
+               // Save response for use in complete callback
+               response = arguments;
+
+               // See if a selector was specified
+               self.html( selector ?
+
+                       // Create a dummy div to hold the results
+                       jQuery("<div>")
+
+                               // inject the contents of the document in, removing the scripts
+                               // to avoid any 'Permission Denied' errors in IE
+                               .append( responseText.replace( rscript, "" ) )
+
+                               // Locate the specified elements
+                               .find( selector ) :
+
+                       // If not, just inject the full result
+                       responseText );
+
+       });
+
+       return this;
+};
+
+// Attach a bunch of functions for handling common AJAX events
+jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
+       jQuery.fn[ o ] = function( f ){
+               return this.on( o, f );
+       };
+});
+
+jQuery.each( [ "get", "post" ], function( i, method ) {
+       jQuery[ method ] = function( url, data, callback, type ) {
+               // shift arguments if data argument was omitted
+               if ( jQuery.isFunction( data ) ) {
+                       type = type || callback;
+                       callback = data;
+                       data = undefined;
+               }
+
+               return jQuery.ajax({
+                       type: method,
+                       url: url,
+                       data: data,
+                       success: callback,
+                       dataType: type
+               });
+       };
+});
+
+jQuery.extend({
+
+       getScript: function( url, callback ) {
+               return jQuery.get( url, undefined, callback, "script" );
+       },
+
+       getJSON: function( url, data, callback ) {
+               return jQuery.get( url, data, callback, "json" );
+       },
+
+       // Creates a full fledged settings object into target
+       // with both ajaxSettings and settings fields.
+       // If target is omitted, writes into ajaxSettings.
+       ajaxSetup: function( target, settings ) {
+               if ( settings ) {
+                       // Building a settings object
+                       ajaxExtend( target, jQuery.ajaxSettings );
+               } else {
+                       // Extending ajaxSettings
+                       settings = target;
+                       target = jQuery.ajaxSettings;
+               }
+               ajaxExtend( target, settings );
+               return target;
+       },
+
+       ajaxSettings: {
+               url: ajaxLocation,
+               isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
+               global: true,
+               type: "GET",
+               contentType: "application/x-www-form-urlencoded; charset=UTF-8",
+               processData: true,
+               async: true,
+               /*
+               timeout: 0,
+               data: null,
+               dataType: null,
+               username: null,
+               password: null,
+               cache: null,
+               throws: false,
+               traditional: false,
+               headers: {},
+               */
+
+               accepts: {
+                       xml: "application/xml, text/xml",
+                       html: "text/html",
+                       text: "text/plain",
+                       json: "application/json, text/javascript",
+                       "*": allTypes
+               },
+
+               contents: {
+                       xml: /xml/,
+                       html: /html/,
+                       json: /json/
+               },
+
+               responseFields: {
+                       xml: "responseXML",
+                       text: "responseText"
+               },
+
+               // List of data converters
+               // 1) key format is "source_type destination_type" (a single space in-between)
+               // 2) the catchall symbol "*" can be used for source_type
+               converters: {
+
+                       // Convert anything to text
+                       "* text": window.String,
+
+                       // Text to html (true = no transformation)
+                       "text html": true,
+
+                       // Evaluate text as a json expression
+                       "text json": jQuery.parseJSON,
+
+                       // Parse text as xml
+                       "text xml": jQuery.parseXML
+               },
+
+               // For options that shouldn't be deep extended:
+               // you can add your own custom options here if
+               // and when you create one that shouldn't be
+               // deep extended (see ajaxExtend)
+               flatOptions: {
+                       context: true,
+                       url: true
+               }
+       },
+
+       ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
+       ajaxTransport: addToPrefiltersOrTransports( transports ),
+
+       // Main method
+       ajax: function( url, options ) {
+
+               // If url is an object, simulate pre-1.5 signature
+               if ( typeof url === "object" ) {
+                       options = url;
+                       url = undefined;
+               }
+
+               // Force options to be an object
+               options = options || {};
+
+               var // ifModified key
+                       ifModifiedKey,
+                       // Response headers
+                       responseHeadersString,
+                       responseHeaders,
+                       // transport
+                       transport,
+                       // timeout handle
+                       timeoutTimer,
+                       // Cross-domain detection vars
+                       parts,
+                       // To know if global events are to be dispatched
+                       fireGlobals,
+                       // Loop variable
+                       i,
+                       // Create the final options object
+                       s = jQuery.ajaxSetup( {}, options ),
+                       // Callbacks context
+                       callbackContext = s.context || s,
+                       // Context for global events
+                       // It's the callbackContext if one was provided in the options
+                       // and if it's a DOM node or a jQuery collection
+                       globalEventContext = callbackContext !== s &&
+                               ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
+                                               jQuery( callbackContext ) : jQuery.event,
+                       // Deferreds
+                       deferred = jQuery.Deferred(),
+                       completeDeferred = jQuery.Callbacks( "once memory" ),
+                       // Status-dependent callbacks
+                       statusCode = s.statusCode || {},
+                       // Headers (they are sent all at once)
+                       requestHeaders = {},
+                       requestHeadersNames = {},
+                       // The jqXHR state
+                       state = 0,
+                       // Default abort message
+                       strAbort = "canceled",
+                       // Fake xhr
+                       jqXHR = {
+
+                               readyState: 0,
+
+                               // Caches the header
+                               setRequestHeader: function( name, value ) {
+                                       if ( !state ) {
+                                               var lname = name.toLowerCase();
+                                               name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
+                                               requestHeaders[ name ] = value;
+                                       }
+                                       return this;
+                               },
+
+                               // Raw string
+                               getAllResponseHeaders: function() {
+                                       return state === 2 ? responseHeadersString : null;
+                               },
+
+                               // Builds headers hashtable if needed
+                               getResponseHeader: function( key ) {
+                                       var match;
+                                       if ( state === 2 ) {
+                                               if ( !responseHeaders ) {
+                                                       responseHeaders = {};
+                                                       while( ( match = rheaders.exec( responseHeadersString ) ) ) {
+                                                               responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
+                                                       }
+                                               }
+                                               match = responseHeaders[ key.toLowerCase() ];
+                                       }
+                                       return match === undefined ? null : match;
+                               },
+
+                               // Overrides response content-type header
+                               overrideMimeType: function( type ) {
+                                       if ( !state ) {
+                                               s.mimeType = type;
+                                       }
+                                       return this;
+                               },
+
+                               // Cancel the request
+                               abort: function( statusText ) {
+                                       statusText = statusText || strAbort;
+                                       if ( transport ) {
+                                               transport.abort( statusText );
+                                       }
+                                       done( 0, statusText );
+                                       return this;
+                               }
+                       };
+
+               // Callback for when everything is done
+               // It is defined here because jslint complains if it is declared
+               // at the end of the function (which would be more logical and readable)
+               function done( status, nativeStatusText, responses, headers ) {
+                       var isSuccess, success, error, response, modified,
+                               statusText = nativeStatusText;
+
+                       // Called once
+                       if ( state === 2 ) {
+                               return;
+                       }
+
+                       // State is "done" now
+                       state = 2;
+
+                       // Clear timeout if it exists
+                       if ( timeoutTimer ) {
+                               clearTimeout( timeoutTimer );
+                       }
+
+                       // Dereference transport for early garbage collection
+                       // (no matter how long the jqXHR object will be used)
+                       transport = undefined;
+
+                       // Cache response headers
+                       responseHeadersString = headers || "";
+
+                       // Set readyState
+                       jqXHR.readyState = status > 0 ? 4 : 0;
+
+                       // Get response data
+                       if ( responses ) {
+                               response = ajaxHandleResponses( s, jqXHR, responses );
+                       }
+
+                       // If successful, handle type chaining
+                       if ( status >= 200 && status < 300 || status === 304 ) {
+
+                               // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+                               if ( s.ifModified ) {
+
+                                       modified = jqXHR.getResponseHeader("Last-Modified");
+                                       if ( modified ) {
+                                               jQuery.lastModified[ ifModifiedKey ] = modified;
+                                       }
+                                       modified = jqXHR.getResponseHeader("Etag");
+                                       if ( modified ) {
+                                               jQuery.etag[ ifModifiedKey ] = modified;
+                                       }
+                               }
+
+                               // If not modified
+                               if ( status === 304 ) {
+
+                                       statusText = "notmodified";
+                                       isSuccess = true;
+
+                               // If we have data
+                               } else {
+
+                                       isSuccess = ajaxConvert( s, response );
+                                       statusText = isSuccess.state;
+                                       success = isSuccess.data;
+                                       error = isSuccess.error;
+                                       isSuccess = !error;
+                               }
+                       } else {
+                               // We extract error from statusText
+                               // then normalize statusText and status for non-aborts
+                               error = statusText;
+                               if ( !statusText || status ) {
+                                       statusText = "error";
+                                       if ( status < 0 ) {
+                                               status = 0;
+                                       }
+                               }
+                       }
+
+                       // Set data for the fake xhr object
+                       jqXHR.status = status;
+                       jqXHR.statusText = ( nativeStatusText || statusText ) + "";
+
+                       // Success/Error
+                       if ( isSuccess ) {
+                               deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
+                       } else {
+                               deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
+                       }
+
+                       // Status-dependent callbacks
+                       jqXHR.statusCode( statusCode );
+                       statusCode = undefined;
+
+                       if ( fireGlobals ) {
+                               globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
+                                               [ jqXHR, s, isSuccess ? success : error ] );
+                       }
+
+                       // Complete
+                       completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
+
+                       if ( fireGlobals ) {
+                               globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
+                               // Handle the global AJAX counter
+                               if ( !( --jQuery.active ) ) {
+                                       jQuery.event.trigger( "ajaxStop" );
+                               }
+                       }
+               }
+
+               // Attach deferreds
+               deferred.promise( jqXHR );
+               jqXHR.success = jqXHR.done;
+               jqXHR.error = jqXHR.fail;
+               jqXHR.complete = completeDeferred.add;
+
+               // Status-dependent callbacks
+               jqXHR.statusCode = function( map ) {
+                       if ( map ) {
+                               var tmp;
+                               if ( state < 2 ) {
+                                       for ( tmp in map ) {
+                                               statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
+                                       }
+                               } else {
+                                       tmp = map[ jqXHR.status ];
+                                       jqXHR.always( tmp );
+                               }
+                       }
+                       return this;
+               };
+
+               // Remove hash character (#7531: and string promotion)
+               // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
+               // We also use the url parameter if available
+               s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
+
+               // Extract dataTypes list
+               s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace );
+
+               // A cross-domain request is in order when we have a protocol:host:port mismatch
+               if ( s.crossDomain == null ) {
+                       parts = rurl.exec( s.url.toLowerCase() );
+                       s.crossDomain = !!( parts &&
+                               ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
+                                       ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
+                                               ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
+                       );
+               }
+
+               // Convert data if not already a string
+               if ( s.data && s.processData && typeof s.data !== "string" ) {
+                       s.data = jQuery.param( s.data, s.traditional );
+               }
+
+               // Apply prefilters
+               inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
+
+               // If request was aborted inside a prefilter, stop there
+               if ( state === 2 ) {
+                       return jqXHR;
+               }
+
+               // We can fire global events as of now if asked to
+               fireGlobals = s.global;
+
+               // Uppercase the type
+               s.type = s.type.toUpperCase();
+
+               // Determine if request has content
+               s.hasContent = !rnoContent.test( s.type );
+
+               // Watch for a new set of requests
+               if ( fireGlobals && jQuery.active++ === 0 ) {
+                       jQuery.event.trigger( "ajaxStart" );
+               }
+
+               // More options handling for requests with no content
+               if ( !s.hasContent ) {
+
+                       // If data is available, append data to url
+                       if ( s.data ) {
+                               s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
+                               // #9682: remove data so that it's not used in an eventual retry
+                               delete s.data;
+                       }
+
+                       // Get ifModifiedKey before adding the anti-cache parameter
+                       ifModifiedKey = s.url;
+
+                       // Add anti-cache in url if needed
+                       if ( s.cache === false ) {
+
+                               var ts = jQuery.now(),
+                                       // try replacing _= if it is there
+                                       ret = s.url.replace( rts, "$1_=" + ts );
+
+                               // if nothing was replaced, add timestamp to the end
+                               s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
+                       }
+               }
+
+               // Set the correct header, if data is being sent
+               if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
+                       jqXHR.setRequestHeader( "Content-Type", s.contentType );
+               }
+
+               // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
+               if ( s.ifModified ) {
+                       ifModifiedKey = ifModifiedKey || s.url;
+                       if ( jQuery.lastModified[ ifModifiedKey ] ) {
+                               jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
+                       }
+                       if ( jQuery.etag[ ifModifiedKey ] ) {
+                               jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
+                       }
+               }
+
+               // Set the Accepts header for the server, depending on the dataType
+               jqXHR.setRequestHeader(
+                       "Accept",
+                       s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
+                               s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
+                               s.accepts[ "*" ]
+               );
+
+               // Check for headers option
+               for ( i in s.headers ) {
+                       jqXHR.setRequestHeader( i, s.headers[ i ] );
+               }
+
+               // Allow custom headers/mimetypes and early abort
+               if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
+                               // Abort if not done already and return
+                               return jqXHR.abort();
+
+               }
+
+               // aborting is no longer a cancellation
+               strAbort = "abort";
+
+               // Install callbacks on deferreds
+               for ( i in { success: 1, error: 1, complete: 1 } ) {
+                       jqXHR[ i ]( s[ i ] );
+               }
+
+               // Get transport
+               transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
+
+               // If no transport, we auto-abort
+               if ( !transport ) {
+                       done( -1, "No Transport" );
+               } else {
+                       jqXHR.readyState = 1;
+                       // Send global event
+                       if ( fireGlobals ) {
+                               globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
+                       }
+                       // Timeout
+                       if ( s.async && s.timeout > 0 ) {
+                               timeoutTimer = setTimeout( function(){
+                                       jqXHR.abort( "timeout" );
+                               }, s.timeout );
+                       }
+
+                       try {
+                               state = 1;
+                               transport.send( requestHeaders, done );
+                       } catch (e) {
+                               // Propagate exception as error if not done
+                               if ( state < 2 ) {
+                                       done( -1, e );
+                               // Simply rethrow otherwise
+                               } else {
+                                       throw e;
+                               }
+                       }
+               }
+
+               return jqXHR;
+       },
+
+       // Counter for holding the number of active queries
+       active: 0,
+
+       // Last-Modified header cache for next request
+       lastModified: {},
+       etag: {}
+
+});
+
+/* Handles responses to an ajax request:
+ * - sets all responseXXX fields accordingly
+ * - finds the right dataType (mediates between content-type and expected dataType)
+ * - returns the corresponding response
+ */
+function ajaxHandleResponses( s, jqXHR, responses ) {
+
+       var ct, type, finalDataType, firstDataType,
+               contents = s.contents,
+               dataTypes = s.dataTypes,
+               responseFields = s.responseFields;
+
+       // Fill responseXXX fields
+       for ( type in responseFields ) {
+               if ( type in responses ) {
+                       jqXHR[ responseFields[type] ] = responses[ type ];
+               }
+       }
+
+       // Remove auto dataType and get content-type in the process
+       while( dataTypes[ 0 ] === "*" ) {
+               dataTypes.shift();
+               if ( ct === undefined ) {
+                       ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
+               }
+       }
+
+       // Check if we're dealing with a known content-type
+       if ( ct ) {
+               for ( type in contents ) {
+                       if ( contents[ type ] && contents[ type ].test( ct ) ) {
+                               dataTypes.unshift( type );
+                               break;
+                       }
+               }
+       }
+
+       // Check to see if we have a response for the expected dataType
+       if ( dataTypes[ 0 ] in responses ) {
+               finalDataType = dataTypes[ 0 ];
+       } else {
+               // Try convertible dataTypes
+               for ( type in responses ) {
+                       if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
+                               finalDataType = type;
+                               break;
+                       }
+                       if ( !firstDataType ) {
+                               firstDataType = type;
+                       }
+               }
+               // Or just use first one
+               finalDataType = finalDataType || firstDataType;
+       }
+
+       // If we found a dataType
+       // We add the dataType to the list if needed
+       // and return the corresponding response
+       if ( finalDataType ) {
+               if ( finalDataType !== dataTypes[ 0 ] ) {
+                       dataTypes.unshift( finalDataType );
+               }
+               return responses[ finalDataType ];
+       }
+}
+
+// Chain conversions given the request and the original response
+function ajaxConvert( s, response ) {
+
+       var conv, conv2, current, tmp,
+               // Work with a copy of dataTypes in case we need to modify it for conversion
+               dataTypes = s.dataTypes.slice(),
+               prev = dataTypes[ 0 ],
+               converters = {},
+               i = 0;
+
+       // Apply the dataFilter if provided
+       if ( s.dataFilter ) {
+               response = s.dataFilter( response, s.dataType );
+       }
+
+       // Create converters map with lowercased keys
+       if ( dataTypes[ 1 ] ) {
+               for ( conv in s.converters ) {
+                       converters[ conv.toLowerCase() ] = s.converters[ conv ];
+               }
+       }
+
+       // Convert to each sequential dataType, tolerating list modification
+       for ( ; (current = dataTypes[++i]); ) {
+
+               // There's only work to do if current dataType is non-auto
+               if ( current !== "*" ) {
+
+                       // Convert response if prev dataType is non-auto and differs from current
+                       if ( prev !== "*" && prev !== current ) {
+
+                               // Seek a direct converter
+                               conv = converters[ prev + " " + current ] || converters[ "* " + current ];
+
+                               // If none found, seek a pair
+                               if ( !conv ) {
+                                       for ( conv2 in converters ) {
+
+                                               // If conv2 outputs current
+                                               tmp = conv2.split(" ");
+                                               if ( tmp[ 1 ] === current ) {
+
+                                                       // If prev can be converted to accepted input
+                                                       conv = converters[ prev + " " + tmp[ 0 ] ] ||
+                                                               converters[ "* " + tmp[ 0 ] ];
+                                                       if ( conv ) {
+                                                               // Condense equivalence converters
+                                                               if ( conv === true ) {
+                                                                       conv = converters[ conv2 ];
+
+                                                               // Otherwise, insert the intermediate dataType
+                                                               } else if ( converters[ conv2 ] !== true ) {
+                                                                       current = tmp[ 0 ];
+                                                                       dataTypes.splice( i--, 0, current );
+                                                               }
+
+                                                               break;
+                                                       }
+                                               }
+                                       }
+                               }
+
+                               // Apply converter (if not an equivalence)
+                               if ( conv !== true ) {
+
+                                       // Unless errors are allowed to bubble, catch and return them
+                                       if ( conv && s["throws"] ) {
+                                               response = conv( response );
+                                       } else {
+                                               try {
+                                                       response = conv( response );
+                                               } catch ( e ) {
+                                                       return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
+                                               }
+                                       }
+                               }
+                       }
+
+                       // Update prev for next iteration
+                       prev = current;
+               }
+       }
+
+       return { state: "success", data: response };
+}
+var oldCallbacks = [],
+       rquestion = /\?/,
+       rjsonp = /(=)\?(?=&|$)|\?\?/,
+       nonce = jQuery.now();
+
+// Default jsonp settings
+jQuery.ajaxSetup({
+       jsonp: "callback",
+       jsonpCallback: function() {
+               var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
+               this[ callback ] = true;
+               return callback;
+       }
+});
+
+// Detect, normalize options and install callbacks for jsonp requests
+jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
+
+       var callbackName, overwritten, responseContainer,
+               data = s.data,
+               url = s.url,
+               hasCallback = s.jsonp !== false,
+               replaceInUrl = hasCallback && rjsonp.test( url ),
+               replaceInData = hasCallback && !replaceInUrl && typeof data === "string" &&
+                       !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") &&
+                       rjsonp.test( data );
+
+       // Handle iff the expected data type is "jsonp" or we have a parameter to set
+       if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) {
+
+               // Get callback name, remembering preexisting value associated with it
+               callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
+                       s.jsonpCallback() :
+                       s.jsonpCallback;
+               overwritten = window[ callbackName ];
+
+               // Insert callback into url or form data
+               if ( replaceInUrl ) {
+                       s.url = url.replace( rjsonp, "$1" + callbackName );
+               } else if ( replaceInData ) {
+                       s.data = data.replace( rjsonp, "$1" + callbackName );
+               } else if ( hasCallback ) {
+                       s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
+               }
+
+               // Use data converter to retrieve json after script execution
+               s.converters["script json"] = function() {
+                       if ( !responseContainer ) {
+                               jQuery.error( callbackName + " was not called" );
+                       }
+                       return responseContainer[ 0 ];
+               };
+
+               // force json dataType
+               s.dataTypes[ 0 ] = "json";
+
+               // Install callback
+               window[ callbackName ] = function() {
+                       responseContainer = arguments;
+               };
+
+               // Clean-up function (fires after converters)
+               jqXHR.always(function() {
+                       // Restore preexisting value
+                       window[ callbackName ] = overwritten;
+
+                       // Save back as free
+                       if ( s[ callbackName ] ) {
+                               // make sure that re-using the options doesn't screw things around
+                               s.jsonpCallback = originalSettings.jsonpCallback;
+
+                               // save the callback name for future use
+                               oldCallbacks.push( callbackName );
+                       }
+
+                       // Call if it was a function and we have a response
+                       if ( responseContainer && jQuery.isFunction( overwritten ) ) {
+                               overwritten( responseContainer[ 0 ] );
+                       }
+
+                       responseContainer = overwritten = undefined;
+               });
+
+               // Delegate to script
+               return "script";
+       }
+});
+// Install script dataType
+jQuery.ajaxSetup({
+       accepts: {
+               script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
+       },
+       contents: {
+               script: /javascript|ecmascript/
+       },
+       converters: {
+               "text script": function( text ) {
+                       jQuery.globalEval( text );
+                       return text;
+               }
+       }
+});
+
+// Handle cache's special case and global
+jQuery.ajaxPrefilter( "script", function( s ) {
+       if ( s.cache === undefined ) {
+               s.cache = false;
+       }
+       if ( s.crossDomain ) {
+               s.type = "GET";
+               s.global = false;
+       }
+});
+
+// Bind script tag hack transport
+jQuery.ajaxTransport( "script", function(s) {
+
+       // This transport only deals with cross domain requests
+       if ( s.crossDomain ) {
+
+               var script,
+                       head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
+
+               return {
+
+                       send: function( _, callback ) {
+
+                               script = document.createElement( "script" );
+
+                               script.async = "async";
+
+                               if ( s.scriptCharset ) {
+                                       script.charset = s.scriptCharset;
+                               }
+
+                               script.src = s.url;
+
+                               // Attach handlers for all browsers
+                               script.onload = script.onreadystatechange = function( _, isAbort ) {
+
+                                       if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
+
+                                               // Handle memory leak in IE
+                                               script.onload = script.onreadystatechange = null;
+
+                                               // Remove the script
+                                               if ( head && script.parentNode ) {
+                                                       head.removeChild( script );
+                                               }
+
+                                               // Dereference the script
+                                               script = undefined;
+
+                                               // Callback if not abort
+                                               if ( !isAbort ) {
+                                                       callback( 200, "success" );
+                                               }
+                                       }
+                               };
+                               // Use insertBefore instead of appendChild  to circumvent an IE6 bug.
+                               // This arises when a base node is used (#2709 and #4378).
+                               head.insertBefore( script, head.firstChild );
+                       },
+
+                       abort: function() {
+                               if ( script ) {
+                                       script.onload( 0, 1 );
+                               }
+                       }
+               };
+       }
+});
+var xhrCallbacks,
+       // #5280: Internet Explorer will keep connections alive if we don't abort on unload
+       xhrOnUnloadAbort = window.ActiveXObject ? function() {
+               // Abort all pending requests
+               for ( var key in xhrCallbacks ) {
+                       xhrCallbacks[ key ]( 0, 1 );
+               }
+       } : false,
+       xhrId = 0;
+
+// Functions to create xhrs
+function createStandardXHR() {
+       try {
+               return new window.XMLHttpRequest();
+       } catch( e ) {}
+}
+
+function createActiveXHR() {
+       try {
+               return new window.ActiveXObject( "Microsoft.XMLHTTP" );
+       } catch( e ) {}
+}
+
+// Create the request object
+// (This is still attached to ajaxSettings for backward compatibility)
+jQuery.ajaxSettings.xhr = window.ActiveXObject ?
+       /* Microsoft failed to properly
+        * implement the XMLHttpRequest in IE7 (can't request local files),
+        * so we use the ActiveXObject when it is available
+        * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
+        * we need a fallback.
+        */
+       function() {
+               return !this.isLocal && createStandardXHR() || createActiveXHR();
+       } :
+       // For all other browsers, use the standard XMLHttpRequest object
+       createStandardXHR;
+
+// Determine support properties
+(function( xhr ) {
+       jQuery.extend( jQuery.support, {
+               ajax: !!xhr,
+               cors: !!xhr && ( "withCredentials" in xhr )
+       });
+})( jQuery.ajaxSettings.xhr() );
+
+// Create transport if the browser can provide an xhr
+if ( jQuery.support.ajax ) {
+
+       jQuery.ajaxTransport(function( s ) {
+               // Cross domain only allowed if supported through XMLHttpRequest
+               if ( !s.crossDomain || jQuery.support.cors ) {
+
+                       var callback;
+
+                       return {
+                               send: function( headers, complete ) {
+
+                                       // Get a new xhr
+                                       var handle, i,
+                                               xhr = s.xhr();
+
+                                       // Open the socket
+                                       // Passing null username, generates a login popup on Opera (#2865)
+                                       if ( s.username ) {
+                                               xhr.open( s.type, s.url, s.async, s.username, s.password );
+                                       } else {
+                                               xhr.open( s.type, s.url, s.async );
+                                       }
+
+                                       // Apply custom fields if provided
+                                       if ( s.xhrFields ) {
+                                               for ( i in s.xhrFields ) {
+                                                       xhr[ i ] = s.xhrFields[ i ];
+                                               }
+                                       }
+
+                                       // Override mime type if needed
+                                       if ( s.mimeType && xhr.overrideMimeType ) {
+                                               xhr.overrideMimeType( s.mimeType );
+                                       }
+
+                                       // X-Requested-With header
+                                       // For cross-domain requests, seeing as conditions for a preflight are
+                                       // akin to a jigsaw puzzle, we simply never set it to be sure.
+                                       // (it can always be set on a per-request basis or even using ajaxSetup)
+                                       // For same-domain requests, won't change header if already provided.
+                                       if ( !s.crossDomain && !headers["X-Requested-With"] ) {
+                                               headers[ "X-Requested-With" ] = "XMLHttpRequest";
+                                       }
+
+                                       // Need an extra try/catch for cross domain requests in Firefox 3
+                                       try {
+                                               for ( i in headers ) {
+                                                       xhr.setRequestHeader( i, headers[ i ] );
+                                               }
+                                       } catch( _ ) {}
+
+                                       // Do send the request
+                                       // This may raise an exception which is actually
+                                       // handled in jQuery.ajax (so no try/catch here)
+                                       xhr.send( ( s.hasContent && s.data ) || null );
+
+                                       // Listener
+                                       callback = function( _, isAbort ) {
+
+                                               var status,
+                                                       statusText,
+                                                       responseHeaders,
+                                                       responses,
+                                                       xml;
+
+                                               // Firefox throws exceptions when accessing properties
+                                               // of an xhr when a network error occurred
+                                               // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
+                                               try {
+
+                                                       // Was never called and is aborted or complete
+                                                       if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
+
+                                                               // Only called once
+                                                               callback = undefined;
+
+                                                               // Do not keep as active anymore
+                                                               if ( handle ) {
+                                                                       xhr.onreadystatechange = jQuery.noop;
+                                                                       if ( xhrOnUnloadAbort ) {
+                                                                               delete xhrCallbacks[ handle ];
+                                                                       }
+                                                               }
+
+                                                               // If it's an abort
+                                                               if ( isAbort ) {
+                                                                       // Abort it manually if needed
+                                                                       if ( xhr.readyState !== 4 ) {
+                                                                               xhr.abort();
+                                                                       }
+                                                               } else {
+                                                                       status = xhr.status;
+                                                                       responseHeaders = xhr.getAllResponseHeaders();
+                                                                       responses = {};
+                                                                       xml = xhr.responseXML;
+
+                                                                       // Construct response list
+                                                                       if ( xml && xml.documentElement /* #4958 */ ) {
+                                                                               responses.xml = xml;
+                                                                       }
+
+                                                                       // When requesting binary data, IE6-9 will throw an exception
+                                                                       // on any attempt to access responseText (#11426)
+                                                                       try {
+                                                                               responses.text = xhr.responseText;
+                                                                       } catch( e ) {
+                                                                       }
+
+                                                                       // Firefox throws an exception when accessing
+                                                                       // statusText for faulty cross-domain requests
+                                                                       try {
+                                                                               statusText = xhr.statusText;
+                                                                       } catch( e ) {
+                                                                               // We normalize with Webkit giving an empty statusText
+                                                                               statusText = "";
+                                                                       }
+
+                                                                       // Filter status for non standard behaviors
+
+                                                                       // If the request is local and we have data: assume a success
+                                                                       // (success with no data won't get notified, that's the best we
+                                                                       // can do given current implementations)
+                                                                       if ( !status && s.isLocal && !s.crossDomain ) {
+                                                                               status = responses.text ? 200 : 404;
+                                                                       // IE - #1450: sometimes returns 1223 when it should be 204
+                                                                       } else if ( status === 1223 ) {
+                                                                               status = 204;
+                                                                       }
+                                                               }
+                                                       }
+                                               } catch( firefoxAccessException ) {
+                                                       if ( !isAbort ) {
+                                                               complete( -1, firefoxAccessException );
+                                                       }
+                                               }
+
+                                               // Call complete if needed
+                                               if ( responses ) {
+                                                       complete( status, statusText, responses, responseHeaders );
+                                               }
+                                       };
+
+                                       if ( !s.async ) {
+                                               // if we're in sync mode we fire the callback
+                                               callback();
+                                       } else if ( xhr.readyState === 4 ) {
+                                               // (IE6 & IE7) if it's in cache and has been
+                                               // retrieved directly we need to fire the callback
+                                               setTimeout( callback, 0 );
+                                       } else {
+                                               handle = ++xhrId;
+                                               if ( xhrOnUnloadAbort ) {
+                                                       // Create the active xhrs callbacks list if needed
+                                                       // and attach the unload handler
+                                                       if ( !xhrCallbacks ) {
+                                                               xhrCallbacks = {};
+                                                               jQuery( window ).unload( xhrOnUnloadAbort );
+                                                       }
+                                                       // Add to list of active xhrs callbacks
+                                                       xhrCallbacks[ handle ] = callback;
+                                               }
+                                               xhr.onreadystatechange = callback;
+                                       }
+                               },
+
+                               abort: function() {
+                                       if ( callback ) {
+                                               callback(0,1);
+                                       }
+                               }
+                       };
+               }
+       });
+}
+var fxNow, timerId,
+       rfxtypes = /^(?:toggle|show|hide)$/,
+       rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
+       rrun = /queueHooks$/,
+       animationPrefilters = [ defaultPrefilter ],
+       tweeners = {
+               "*": [function( prop, value ) {
+                       var end, unit,
+                               tween = this.createTween( prop, value ),
+                               parts = rfxnum.exec( value ),
+                               target = tween.cur(),
+                               start = +target || 0,
+                               scale = 1,
+                               maxIterations = 20;
+
+                       if ( parts ) {
+                               end = +parts[2];
+                               unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
+
+                               // We need to compute starting value
+                               if ( unit !== "px" && start ) {
+                                       // Iteratively approximate from a nonzero starting point
+                                       // Prefer the current property, because this process will be trivial if it uses the same units
+                                       // Fallback to end or a simple constant
+                                       start = jQuery.css( tween.elem, prop, true ) || end || 1;
+
+                                       do {
+                                               // If previous iteration zeroed out, double until we get *something*
+                                               // Use a string for doubling factor so we don't accidentally see scale as unchanged below
+                                               scale = scale || ".5";
+
+                                               // Adjust and apply
+                                               start = start / scale;
+                                               jQuery.style( tween.elem, prop, start + unit );
+
+                                       // Update scale, tolerating zero or NaN from tween.cur()
+                                       // And breaking the loop if scale is unchanged or perfect, or if we've just had enough
+                                       } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
+                               }
+
+                               tween.unit = unit;
+                               tween.start = start;
+                               // If a +=/-= token was provided, we're doing a relative animation
+                               tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
+                       }
+                       return tween;
+               }]
+       };
+
+// Animations created synchronously will run synchronously
+function createFxNow() {
+       setTimeout(function() {
+               fxNow = undefined;
+       }, 0 );
+       return ( fxNow = jQuery.now() );
+}
+
+function createTweens( animation, props ) {
+       jQuery.each( props, function( prop, value ) {
+               var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
+                       index = 0,
+                       length = collection.length;
+               for ( ; index < length; index++ ) {
+                       if ( collection[ index ].call( animation, prop, value ) ) {
+
+                               // we're done with this property
+                               return;
+                       }
+               }
+       });
+}
+
+function Animation( elem, properties, options ) {
+       var result,
+               index = 0,
+               tweenerIndex = 0,
+               length = animationPrefilters.length,
+               deferred = jQuery.Deferred().always( function() {
+                       // don't match elem in the :animated selector
+                       delete tick.elem;
+               }),
+               tick = function() {
+                       var currentTime = fxNow || createFxNow(),
+                               remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
+                               // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
+                               temp = remaining / animation.duration || 0,
+                               percent = 1 - temp,
+                               index = 0,
+                               length = animation.tweens.length;
+
+                       for ( ; index < length ; index++ ) {
+                               animation.tweens[ index ].run( percent );
+                       }
+
+                       deferred.notifyWith( elem, [ animation, percent, remaining ]);
+
+                       if ( percent < 1 && length ) {
+                               return remaining;
+                       } else {
+                               deferred.resolveWith( elem, [ animation ] );
+                               return false;
+                       }
+               },
+               animation = deferred.promise({
+                       elem: elem,
+                       props: jQuery.extend( {}, properties ),
+                       opts: jQuery.extend( true, { specialEasing: {} }, options ),
+                       originalProperties: properties,
+                       originalOptions: options,
+                       startTime: fxNow || createFxNow(),
+                       duration: options.duration,
+                       tweens: [],
+                       createTween: function( prop, end, easing ) {
+                               var tween = jQuery.Tween( elem, animation.opts, prop, end,
+                                               animation.opts.specialEasing[ prop ] || animation.opts.easing );
+                               animation.tweens.push( tween );
+                               return tween;
+                       },
+                       stop: function( gotoEnd ) {
+                               var index = 0,
+                                       // if we are going to the end, we want to run all the tweens
+                                       // otherwise we skip this part
+                                       length = gotoEnd ? animation.tweens.length : 0;
+
+                               for ( ; index < length ; index++ ) {
+                                       animation.tweens[ index ].run( 1 );
+                               }
+
+                               // resolve when we played the last frame
+                               // otherwise, reject
+                               if ( gotoEnd ) {
+                                       deferred.resolveWith( elem, [ animation, gotoEnd ] );
+                               } else {
+                                       deferred.rejectWith( elem, [ animation, gotoEnd ] );
+                               }
+                               return this;
+                       }
+               }),
+               props = animation.props;
+
+       propFilter( props, animation.opts.specialEasing );
+
+       for ( ; index < length ; index++ ) {
+               result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
+               if ( result ) {
+                       return result;
+               }
+       }
+
+       createTweens( animation, props );
+
+       if ( jQuery.isFunction( animation.opts.start ) ) {
+               animation.opts.start.call( elem, animation );
+       }
+
+       jQuery.fx.timer(
+               jQuery.extend( tick, {
+                       anim: animation,
+                       queue: animation.opts.queue,
+                       elem: elem
+               })
+       );
+
+       // attach callbacks from options
+       return animation.progress( animation.opts.progress )
+               .done( animation.opts.done, animation.opts.complete )
+               .fail( animation.opts.fail )
+               .always( animation.opts.always );
+}
+
+function propFilter( props, specialEasing ) {
+       var index, name, easing, value, hooks;
+
+       // camelCase, specialEasing and expand cssHook pass
+       for ( index in props ) {
+               name = jQuery.camelCase( index );
+               easing = specialEasing[ name ];
+               value = props[ index ];
+               if ( jQuery.isArray( value ) ) {
+                       easing = value[ 1 ];
+                       value = props[ index ] = value[ 0 ];
+               }
+
+               if ( index !== name ) {
+                       props[ name ] = value;
+                       delete props[ index ];
+               }
+
+               hooks = jQuery.cssHooks[ name ];
+               if ( hooks && "expand" in hooks ) {
+                       value = hooks.expand( value );
+                       delete props[ name ];
+
+                       // not quite $.extend, this wont overwrite keys already present.
+                       // also - reusing 'index' from above because we have the correct "name"
+                       for ( index in value ) {
+                               if ( !( index in props ) ) {
+                                       props[ index ] = value[ index ];
+                                       specialEasing[ index ] = easing;
+                               }
+                       }
+               } else {
+                       specialEasing[ name ] = easing;
+               }
+       }
+}
+
+jQuery.Animation = jQuery.extend( Animation, {
+
+       tweener: function( props, callback ) {
+               if ( jQuery.isFunction( props ) ) {
+                       callback = props;
+                       props = [ "*" ];
+               } else {
+                       props = props.split(" ");
+               }
+
+               var prop,
+                       index = 0,
+                       length = props.length;
+
+               for ( ; index < length ; index++ ) {
+                       prop = props[ index ];
+                       tweeners[ prop ] = tweeners[ prop ] || [];
+                       tweeners[ prop ].unshift( callback );
+               }
+       },
+
+       prefilter: function( callback, prepend ) {
+               if ( prepend ) {
+                       animationPrefilters.unshift( callback );
+               } else {
+                       animationPrefilters.push( callback );
+               }
+       }
+});
+
+function defaultPrefilter( elem, props, opts ) {
+       var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire,
+               anim = this,
+               style = elem.style,
+               orig = {},
+               handled = [],
+               hidden = elem.nodeType && isHidden( elem );
+
+       // handle queue: false promises
+       if ( !opts.queue ) {
+               hooks = jQuery._queueHooks( elem, "fx" );
+               if ( hooks.unqueued == null ) {
+                       hooks.unqueued = 0;
+                       oldfire = hooks.empty.fire;
+                       hooks.empty.fire = function() {
+                               if ( !hooks.unqueued ) {
+                                       oldfire();
+                               }
+                       };
+               }
+               hooks.unqueued++;
+
+               anim.always(function() {
+                       // doing this makes sure that the complete handler will be called
+                       // before this completes
+                       anim.always(function() {
+                               hooks.unqueued--;
+                               if ( !jQuery.queue( elem, "fx" ).length ) {
+                                       hooks.empty.fire();
+                               }
+                       });
+               });
+       }
+
+       // height/width overflow pass
+       if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
+               // Make sure that nothing sneaks out
+               // Record all 3 overflow attributes because IE does not
+               // change the overflow attribute when overflowX and
+               // overflowY are set to the same value
+               opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
+
+               // Set display property to inline-block for height/width
+               // animations on inline elements that are having width/height animated
+               if ( jQuery.css( elem, "display" ) === "inline" &&
+                               jQuery.css( elem, "float" ) === "none" ) {
+
+                       // inline-level elements accept inline-block;
+                       // block-level elements need to be inline with layout
+                       if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
+                               style.display = "inline-block";
+
+                       } else {
+                               style.zoom = 1;
+                       }
+               }
+       }
+
+       if ( opts.overflow ) {
+               style.overflow = "hidden";
+               if ( !jQuery.support.shrinkWrapBlocks ) {
+                       anim.done(function() {
+                               style.overflow = opts.overflow[ 0 ];
+                               style.overflowX = opts.overflow[ 1 ];
+                               style.overflowY = opts.overflow[ 2 ];
+                       });
+               }
+       }
+
+
+       // show/hide pass
+       for ( index in props ) {
+               value = props[ index ];
+               if ( rfxtypes.exec( value ) ) {
+                       delete props[ index ];
+                       toggle = toggle || value === "toggle";
+                       if ( value === ( hidden ? "hide" : "show" ) ) {
+                               continue;
+                       }
+                       handled.push( index );
+               }
+       }
+
+       length = handled.length;
+       if ( length ) {
+               dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
+               if ( "hidden" in dataShow ) {
+                       hidden = dataShow.hidden;
+               }
+
+               // store state if its toggle - enables .stop().toggle() to "reverse"
+               if ( toggle ) {
+                       dataShow.hidden = !hidden;
+               }
+               if ( hidden ) {
+                       jQuery( elem ).show();
+               } else {
+                       anim.done(function() {
+                               jQuery( elem ).hide();
+                       });
+               }
+               anim.done(function() {
+                       var prop;
+                       jQuery.removeData( elem, "fxshow", true );
+                       for ( prop in orig ) {
+                               jQuery.style( elem, prop, orig[ prop ] );
+                       }
+               });
+               for ( index = 0 ; index < length ; index++ ) {
+                       prop = handled[ index ];
+                       tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
+                       orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
+
+                       if ( !( prop in dataShow ) ) {
+                               dataShow[ prop ] = tween.start;
+                               if ( hidden ) {
+                                       tween.end = tween.start;
+                                       tween.start = prop === "width" || prop === "height" ? 1 : 0;
+                               }
+                       }
+               }
+       }
+}
+
+function Tween( elem, options, prop, end, easing ) {
+       return new Tween.prototype.init( elem, options, prop, end, easing );
+}
+jQuery.Tween = Tween;
+
+Tween.prototype = {
+       constructor: Tween,
+       init: function( elem, options, prop, end, easing, unit ) {
+               this.elem = elem;
+               this.prop = prop;
+               this.easing = easing || "swing";
+               this.options = options;
+               this.start = this.now = this.cur();
+               this.end = end;
+               this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
+       },
+       cur: function() {
+               var hooks = Tween.propHooks[ this.prop ];
+
+               return hooks && hooks.get ?
+                       hooks.get( this ) :
+                       Tween.propHooks._default.get( this );
+       },
+       run: function( percent ) {
+               var eased,
+                       hooks = Tween.propHooks[ this.prop ];
+
+               if ( this.options.duration ) {
+                       this.pos = eased = jQuery.easing[ this.easing ](
+                               percent, this.options.duration * percent, 0, 1, this.options.duration
+                       );
+               } else {
+                       this.pos = eased = percent;
+               }
+               this.now = ( this.end - this.start ) * eased + this.start;
+
+               if ( this.options.step ) {
+                       this.options.step.call( this.elem, this.now, this );
+               }
+
+               if ( hooks && hooks.set ) {
+                       hooks.set( this );
+               } else {
+                       Tween.propHooks._default.set( this );
+               }
+               return this;
+       }
+};
+
+Tween.prototype.init.prototype = Tween.prototype;
+
+Tween.propHooks = {
+       _default: {
+               get: function( tween ) {
+                       var result;
+
+                       if ( tween.elem[ tween.prop ] != null &&
+                               (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
+                               return tween.elem[ tween.prop ];
+                       }
+
+                       // passing any value as a 4th parameter to .css will automatically
+                       // attempt a parseFloat and fallback to a string if the parse fails
+                       // so, simple values such as "10px" are parsed to Float.
+                       // complex values such as "rotate(1rad)" are returned as is.
+                       result = jQuery.css( tween.elem, tween.prop, false, "" );
+                       // Empty strings, null, undefined and "auto" are converted to 0.
+                       return !result || result === "auto" ? 0 : result;
+               },
+               set: function( tween ) {
+                       // use step hook for back compat - use cssHook if its there - use .style if its
+                       // available and use plain properties where available
+                       if ( jQuery.fx.step[ tween.prop ] ) {
+                               jQuery.fx.step[ tween.prop ]( tween );
+                       } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
+                               jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
+                       } else {
+                               tween.elem[ tween.prop ] = tween.now;
+                       }
+               }
+       }
+};
+
+// Remove in 2.0 - this supports IE8's panic based approach
+// to setting things on disconnected nodes
+
+Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
+       set: function( tween ) {
+               if ( tween.elem.nodeType && tween.elem.parentNode ) {
+                       tween.elem[ tween.prop ] = tween.now;
+               }
+       }
+};
+
+jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
+       var cssFn = jQuery.fn[ name ];
+       jQuery.fn[ name ] = function( speed, easing, callback ) {
+               return speed == null || typeof speed === "boolean" ||
+                       // special check for .toggle( handler, handler, ... )
+                       ( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ?
+                       cssFn.apply( this, arguments ) :
+                       this.animate( genFx( name, true ), speed, easing, callback );
+       };
+});
+
+jQuery.fn.extend({
+       fadeTo: function( speed, to, easing, callback ) {
+
+               // show any hidden elements after setting opacity to 0
+               return this.filter( isHidden ).css( "opacity", 0 ).show()
+
+                       // animate to the value specified
+                       .end().animate({ opacity: to }, speed, easing, callback );
+       },
+       animate: function( prop, speed, easing, callback ) {
+               var empty = jQuery.isEmptyObject( prop ),
+                       optall = jQuery.speed( speed, easing, callback ),
+                       doAnimation = function() {
+                               // Operate on a copy of prop so per-property easing won't be lost
+                               var anim = Animation( this, jQuery.extend( {}, prop ), optall );
+
+                               // Empty animations resolve immediately
+                               if ( empty ) {
+                                       anim.stop( true );
+                               }
+                       };
+
+               return empty || optall.queue === false ?
+                       this.each( doAnimation ) :
+                       this.queue( optall.queue, doAnimation );
+       },
+       stop: function( type, clearQueue, gotoEnd ) {
+               var stopQueue = function( hooks ) {
+                       var stop = hooks.stop;
+                       delete hooks.stop;
+                       stop( gotoEnd );
+               };
+
+               if ( typeof type !== "string" ) {
+                       gotoEnd = clearQueue;
+                       clearQueue = type;
+                       type = undefined;
+               }
+               if ( clearQueue && type !== false ) {
+                       this.queue( type || "fx", [] );
+               }
+
+               return this.each(function() {
+                       var dequeue = true,
+                               index = type != null && type + "queueHooks",
+                               timers = jQuery.timers,
+                               data = jQuery._data( this );
+
+                       if ( index ) {
+                               if ( data[ index ] && data[ index ].stop ) {
+                                       stopQueue( data[ index ] );
+                               }
+                       } else {
+                               for ( index in data ) {
+                                       if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
+                                               stopQueue( data[ index ] );
+                                       }
+                               }
+                       }
+
+                       for ( index = timers.length; index--; ) {
+                               if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
+                                       timers[ index ].anim.stop( gotoEnd );
+                                       dequeue = false;
+                                       timers.splice( index, 1 );
+                               }
+                       }
+
+                       // start the next in the queue if the last step wasn't forced
+                       // timers currently will call their complete callbacks, which will dequeue
+                       // but only if they were gotoEnd
+                       if ( dequeue || !gotoEnd ) {
+                               jQuery.dequeue( this, type );
+                       }
+               });
+       }
+});
+
+// Generate parameters to create a standard animation
+function genFx( type, includeWidth ) {
+       var which,
+               attrs = { height: type },
+               i = 0;
+
+       // if we include width, step value is 1 to do all cssExpand values,
+       // if we don't include width, step value is 2 to skip over Left and Right
+       includeWidth = includeWidth? 1 : 0;
+       for( ; i < 4 ; i += 2 - includeWidth ) {
+               which = cssExpand[ i ];
+               attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
+       }
+
+       if ( includeWidth ) {
+               attrs.opacity = attrs.width = type;
+       }
+
+       return attrs;
+}
+
+// Generate shortcuts for custom animations
+jQuery.each({
+       slideDown: genFx("show"),
+       slideUp: genFx("hide"),
+       slideToggle: genFx("toggle"),
+       fadeIn: { opacity: "show" },
+       fadeOut: { opacity: "hide" },
+       fadeToggle: { opacity: "toggle" }
+}, function( name, props ) {
+       jQuery.fn[ name ] = function( speed, easing, callback ) {
+               return this.animate( props, speed, easing, callback );
+       };
+});
+
+jQuery.speed = function( speed, easing, fn ) {
+       var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
+               complete: fn || !fn && easing ||
+                       jQuery.isFunction( speed ) && speed,
+               duration: speed,
+               easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
+       };
+
+       opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
+               opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
+
+       // normalize opt.queue - true/undefined/null -> "fx"
+       if ( opt.queue == null || opt.queue === true ) {
+               opt.queue = "fx";
+       }
+
+       // Queueing
+       opt.old = opt.complete;
+
+       opt.complete = function() {
+               if ( jQuery.isFunction( opt.old ) ) {
+                       opt.old.call( this );
+               }
+
+               if ( opt.queue ) {
+                       jQuery.dequeue( this, opt.queue );
+               }
+       };
+
+       return opt;
+};
+
+jQuery.easing = {
+       linear: function( p ) {
+               return p;
+       },
+       swing: function( p ) {
+               return 0.5 - Math.cos( p*Math.PI ) / 2;
+       }
+};
+
+jQuery.timers = [];
+jQuery.fx = Tween.prototype.init;
+jQuery.fx.tick = function() {
+       var timer,
+               timers = jQuery.timers,
+               i = 0;
+
+       fxNow = jQuery.now();
+
+       for ( ; i < timers.length; i++ ) {
+               timer = timers[ i ];
+               // Checks the timer has not already been removed
+               if ( !timer() && timers[ i ] === timer ) {
+                       timers.splice( i--, 1 );
+               }
+       }
+
+       if ( !timers.length ) {
+               jQuery.fx.stop();
+       }
+       fxNow = undefined;
+};
+
+jQuery.fx.timer = function( timer ) {
+       if ( timer() && jQuery.timers.push( timer ) && !timerId ) {
+               timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
+       }
+};
+
+jQuery.fx.interval = 13;
+
+jQuery.fx.stop = function() {
+       clearInterval( timerId );
+       timerId = null;
+};
+
+jQuery.fx.speeds = {
+       slow: 600,
+       fast: 200,
+       // Default speed
+       _default: 400
+};
+
+// Back Compat <1.8 extension point
+jQuery.fx.step = {};
+
+if ( jQuery.expr && jQuery.expr.filters ) {
+       jQuery.expr.filters.animated = function( elem ) {
+               return jQuery.grep(jQuery.timers, function( fn ) {
+                       return elem === fn.elem;
+               }).length;
+       };
+}
+var rroot = /^(?:body|html)$/i;
+
+jQuery.fn.offset = function( options ) {
+       if ( arguments.length ) {
+               return options === undefined ?
+                       this :
+                       this.each(function( i ) {
+                               jQuery.offset.setOffset( this, options, i );
+                       });
+       }
+
+       var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft,
+               box = { top: 0, left: 0 },
+               elem = this[ 0 ],
+               doc = elem && elem.ownerDocument;
+
+       if ( !doc ) {
+               return;
+       }
+
+       if ( (body = doc.body) === elem ) {
+               return jQuery.offset.bodyOffset( elem );
+       }
+
+       docElem = doc.documentElement;
+
+       // Make sure it's not a disconnected DOM node
+       if ( !jQuery.contains( docElem, elem ) ) {
+               return box;
+       }
+
+       // If we don't have gBCR, just use 0,0 rather than error
+       // BlackBerry 5, iOS 3 (original iPhone)
+       if ( typeof elem.getBoundingClientRect !== "undefined" ) {
+               box = elem.getBoundingClientRect();
+       }
+       win = getWindow( doc );
+       clientTop  = docElem.clientTop  || body.clientTop  || 0;
+       clientLeft = docElem.clientLeft || body.clientLeft || 0;
+       scrollTop  = win.pageYOffset || docElem.scrollTop;
+       scrollLeft = win.pageXOffset || docElem.scrollLeft;
+       return {
+               top: box.top  + scrollTop  - clientTop,
+               left: box.left + scrollLeft - clientLeft
+       };
+};
+
+jQuery.offset = {
+
+       bodyOffset: function( body ) {
+               var top = body.offsetTop,
+                       left = body.offsetLeft;
+
+               if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
+                       top  += parseFloat( jQuery.css(body, "marginTop") ) || 0;
+                       left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
+               }
+
+               return { top: top, left: left };
+       },
+
+       setOffset: function( elem, options, i ) {
+               var position = jQuery.css( elem, "position" );
+
+               // set position first, in-case top/left are set even on static elem
+               if ( position === "static" ) {
+                       elem.style.position = "relative";
+               }
+
+               var curElem = jQuery( elem ),
+                       curOffset = curElem.offset(),
+                       curCSSTop = jQuery.css( elem, "top" ),
+                       curCSSLeft = jQuery.css( elem, "left" ),
+                       calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
+                       props = {}, curPosition = {}, curTop, curLeft;
+
+               // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
+               if ( calculatePosition ) {
+                       curPosition = curElem.position();
+                       curTop = curPosition.top;
+                       curLeft = curPosition.left;
+               } else {
+                       curTop = parseFloat( curCSSTop ) || 0;
+                       curLeft = parseFloat( curCSSLeft ) || 0;
+               }
+
+               if ( jQuery.isFunction( options ) ) {
+                       options = options.call( elem, i, curOffset );
+               }
+
+               if ( options.top != null ) {
+                       props.top = ( options.top - curOffset.top ) + curTop;
+               }
+               if ( options.left != null ) {
+                       props.left = ( options.left - curOffset.left ) + curLeft;
+               }
+
+               if ( "using" in options ) {
+                       options.using.call( elem, props );
+               } else {
+                       curElem.css( props );
+               }
+       }
+};
+
+
+jQuery.fn.extend({
+
+       position: function() {
+               if ( !this[0] ) {
+                       return;
+               }
+
+               var elem = this[0],
+
+               // Get *real* offsetParent
+               offsetParent = this.offsetParent(),
+
+               // Get correct offsets
+               offset       = this.offset(),
+               parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
+
+               // Subtract element margins
+               // note: when an element has margin: auto the offsetLeft and marginLeft
+               // are the same in Safari causing offset.left to incorrectly be 0
+               offset.top  -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
+               offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
+
+               // Add offsetParent borders
+               parentOffset.top  += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
+               parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
+
+               // Subtract the two offsets
+               return {
+                       top:  offset.top  - parentOffset.top,
+                       left: offset.left - parentOffset.left
+               };
+       },
+
+       offsetParent: function() {
+               return this.map(function() {
+                       var offsetParent = this.offsetParent || document.body;
+                       while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
+                               offsetParent = offsetParent.offsetParent;
+                       }
+                       return offsetParent || document.body;
+               });
+       }
+});
+
+
+// Create scrollLeft and scrollTop methods
+jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
+       var top = /Y/.test( prop );
+
+       jQuery.fn[ method ] = function( val ) {
+               return jQuery.access( this, function( elem, method, val ) {
+                       var win = getWindow( elem );
+
+                       if ( val === undefined ) {
+                               return win ? (prop in win) ? win[ prop ] :
+                                       win.document.documentElement[ method ] :
+                                       elem[ method ];
+                       }
+
+                       if ( win ) {
+                               win.scrollTo(
+                                       !top ? val : jQuery( win ).scrollLeft(),
+                                        top ? val : jQuery( win ).scrollTop()
+                               );
+
+                       } else {
+                               elem[ method ] = val;
+                       }
+               }, method, val, arguments.length, null );
+       };
+});
+
+function getWindow( elem ) {
+       return jQuery.isWindow( elem ) ?
+               elem :
+               elem.nodeType === 9 ?
+                       elem.defaultView || elem.parentWindow :
+                       false;
+}
+// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
+jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
+       jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
+               // margin is only for outerHeight, outerWidth
+               jQuery.fn[ funcName ] = function( margin, value ) {
+                       var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
+                               extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
+
+                       return jQuery.access( this, function( elem, type, value ) {
+                               var doc;
+
+                               if ( jQuery.isWindow( elem ) ) {
+                                       // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
+                                       // isn't a whole lot we can do. See pull request at this URL for discussion:
+                                       // https://github.com/jquery/jquery/pull/764
+                                       return elem.document.documentElement[ "client" + name ];
+                               }
+
+                               // Get document width or height
+                               if ( elem.nodeType === 9 ) {
+                                       doc = elem.documentElement;
+
+                                       // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
+                                       // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
+                                       return Math.max(
+                                               elem.body[ "scroll" + name ], doc[ "scroll" + name ],
+                                               elem.body[ "offset" + name ], doc[ "offset" + name ],
+                                               doc[ "client" + name ]
+                                       );
+                               }
+
+                               return value === undefined ?
+                                       // Get width or height on the element, requesting but not forcing parseFloat
+                                       jQuery.css( elem, type, value, extra ) :
+
+                                       // Set width or height on the element
+                                       jQuery.style( elem, type, value, extra );
+                       }, type, chainable ? margin : undefined, chainable, null );
+               };
+       });
+});
+// Expose jQuery to the global object
+window.jQuery = window.$ = jQuery;
+
+// Expose jQuery as an AMD module, but only for AMD loaders that
+// understand the issues with loading multiple versions of jQuery
+// in a page that all might call define(). The loader will indicate
+// they have special allowances for multiple jQuery versions by
+// specifying define.amd.jQuery = true. Register as a named module,
+// since jQuery can be concatenated with other files that may use define,
+// but not use a proper concatenation script that understands anonymous
+// AMD modules. A named AMD is safest and most robust way to register.
+// Lowercase jquery is used because AMD module names are derived from
+// file names, and jQuery is normally delivered in a lowercase file name.
+// Do this after creating the global so that if an AMD module wants to call
+// noConflict to hide this version of jQuery, it will work.
+if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
+       define( "jquery", [], function () { return jQuery; } );
+}
+
+})( window );
diff --git a/app/webroot/js/jquery-ui-1.9.2.custom.js b/app/webroot/js/jquery-ui-1.9.2.custom.js
new file mode 100644 (file)
index 0000000..6dc062e
--- /dev/null
@@ -0,0 +1,14879 @@
+/*! jQuery UI - v1.9.2 - 2012-11-23
+* http://jqueryui.com
+* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.effect.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.progressbar.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.slider.js, jquery.ui.sortable.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
+* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */
+
+(function( $, undefined ) {
+
+var uuid = 0,
+       runiqueId = /^ui-id-\d+$/;
+
+// prevent duplicate loading
+// this is only a problem because we proxy existing functions
+// and we don't want to double proxy them
+$.ui = $.ui || {};
+if ( $.ui.version ) {
+       return;
+}
+
+$.extend( $.ui, {
+       version: "1.9.2",
+
+       keyCode: {
+               BACKSPACE: 8,
+               COMMA: 188,
+               DELETE: 46,
+               DOWN: 40,
+               END: 35,
+               ENTER: 13,
+               ESCAPE: 27,
+               HOME: 36,
+               LEFT: 37,
+               NUMPAD_ADD: 107,
+               NUMPAD_DECIMAL: 110,
+               NUMPAD_DIVIDE: 111,
+               NUMPAD_ENTER: 108,
+               NUMPAD_MULTIPLY: 106,
+               NUMPAD_SUBTRACT: 109,
+               PAGE_DOWN: 34,
+               PAGE_UP: 33,
+               PERIOD: 190,
+               RIGHT: 39,
+               SPACE: 32,
+               TAB: 9,
+               UP: 38
+       }
+});
+
+// plugins
+$.fn.extend({
+       _focus: $.fn.focus,
+       focus: function( delay, fn ) {
+               return typeof delay === "number" ?
+                       this.each(function() {
+                               var elem = this;
+                               setTimeout(function() {
+                                       $( elem ).focus();
+                                       if ( fn ) {
+                                               fn.call( elem );
+                                       }
+                               }, delay );
+                       }) :
+                       this._focus.apply( this, arguments );
+       },
+
+       scrollParent: function() {
+               var scrollParent;
+               if (($.ui.ie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
+                       scrollParent = this.parents().filter(function() {
+                               return (/(relative|absolute|fixed)/).test($.css(this,'position')) && (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x'));
+                       }).eq(0);
+               } else {
+                       scrollParent = this.parents().filter(function() {
+                               return (/(auto|scroll)/).test($.css(this,'overflow')+$.css(this,'overflow-y')+$.css(this,'overflow-x'));
+                       }).eq(0);
+               }
+
+               return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
+       },
+
+       zIndex: function( zIndex ) {
+               if ( zIndex !== undefined ) {
+                       return this.css( "zIndex", zIndex );
+               }
+
+               if ( this.length ) {
+                       var elem = $( this[ 0 ] ), position, value;
+                       while ( elem.length && elem[ 0 ] !== document ) {
+                               // Ignore z-index if position is set to a value where z-index is ignored by the browser
+                               // This makes behavior of this function consistent across browsers
+                               // WebKit always returns auto if the element is positioned
+                               position = elem.css( "position" );
+                               if ( position === "absolute" || position === "relative" || position === "fixed" ) {
+                                       // IE returns 0 when zIndex is not specified
+                                       // other browsers return a string
+                                       // we ignore the case of nested elements with an explicit value of 0
+                                       // <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
+                                       value = parseInt( elem.css( "zIndex" ), 10 );
+                                       if ( !isNaN( value ) && value !== 0 ) {
+                                               return value;
+                                       }
+                               }
+                               elem = elem.parent();
+                       }
+               }
+
+               return 0;
+       },
+
+       uniqueId: function() {
+               return this.each(function() {
+                       if ( !this.id ) {
+                               this.id = "ui-id-" + (++uuid);
+                       }
+               });
+       },
+
+       removeUniqueId: function() {
+               return this.each(function() {
+                       if ( runiqueId.test( this.id ) ) {
+                               $( this ).removeAttr( "id" );
+                       }
+               });
+       }
+});
+
+// selectors
+function focusable( element, isTabIndexNotNaN ) {
+       var map, mapName, img,
+               nodeName = element.nodeName.toLowerCase();
+       if ( "area" === nodeName ) {
+               map = element.parentNode;
+               mapName = map.name;
+               if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) {
+                       return false;
+               }
+               img = $( "img[usemap=#" + mapName + "]" )[0];
+               return !!img && visible( img );
+       }
+       return ( /input|select|textarea|button|object/.test( nodeName ) ?
+               !element.disabled :
+               "a" === nodeName ?
+                       element.href || isTabIndexNotNaN :
+                       isTabIndexNotNaN) &&
+               // the element and all of its ancestors must be visible
+               visible( element );
+}
+
+function visible( element ) {
+       return $.expr.filters.visible( element ) &&
+               !$( element ).parents().andSelf().filter(function() {
+                       return $.css( this, "visibility" ) === "hidden";
+               }).length;
+}
+
+$.extend( $.expr[ ":" ], {
+       data: $.expr.createPseudo ?
+               $.expr.createPseudo(function( dataName ) {
+                       return function( elem ) {
+                               return !!$.data( elem, dataName );
+                       };
+               }) :
+               // support: jQuery <1.8
+               function( elem, i, match ) {
+                       return !!$.data( elem, match[ 3 ] );
+               },
+
+       focusable: function( element ) {
+               return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) );
+       },
+
+       tabbable: function( element ) {
+               var tabIndex = $.attr( element, "tabindex" ),
+                       isTabIndexNaN = isNaN( tabIndex );
+               return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );
+       }
+});
+
+// support
+$(function() {
+       var body = document.body,
+               div = body.appendChild( div = document.createElement( "div" ) );
+
+       // access offsetHeight before setting the style to prevent a layout bug
+       // in IE 9 which causes the element to continue to take up space even
+       // after it is removed from the DOM (#8026)
+       div.offsetHeight;
+
+       $.extend( div.style, {
+               minHeight: "100px",
+               height: "auto",
+               padding: 0,
+               borderWidth: 0
+       });
+
+       $.support.minHeight = div.offsetHeight === 100;
+       $.support.selectstart = "onselectstart" in div;
+
+       // set display to none to avoid a layout bug in IE
+       // http://dev.jquery.com/ticket/4014
+       body.removeChild( div ).style.display = "none";
+});
+
+// support: jQuery <1.8
+if ( !$( "<a>" ).outerWidth( 1 ).jquery ) {
+       $.each( [ "Width", "Height" ], function( i, name ) {
+               var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ],
+                       type = name.toLowerCase(),
+                       orig = {
+                               innerWidth: $.fn.innerWidth,
+                               innerHeight: $.fn.innerHeight,
+                               outerWidth: $.fn.outerWidth,
+                               outerHeight: $.fn.outerHeight
+                       };
+
+               function reduce( elem, size, border, margin ) {
+                       $.each( side, function() {
+                               size -= parseFloat( $.css( elem, "padding" + this ) ) || 0;
+                               if ( border ) {
+                                       size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0;
+                               }
+                               if ( margin ) {
+                                       size -= parseFloat( $.css( elem, "margin" + this ) ) || 0;
+                               }
+                       });
+                       return size;
+               }
+
+               $.fn[ "inner" + name ] = function( size ) {
+                       if ( size === undefined ) {
+                               return orig[ "inner" + name ].call( this );
+                       }
+
+                       return this.each(function() {
+                               $( this ).css( type, reduce( this, size ) + "px" );
+                       });
+               };
+
+               $.fn[ "outer" + name] = function( size, margin ) {
+                       if ( typeof size !== "number" ) {
+                               return orig[ "outer" + name ].call( this, size );
+                       }
+
+                       return this.each(function() {
+                               $( this).css( type, reduce( this, size, true, margin ) + "px" );
+                       });
+               };
+       });
+}
+
+// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413)
+if ( $( "<a>" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) {
+       $.fn.removeData = (function( removeData ) {
+               return function( key ) {
+                       if ( arguments.length ) {
+                               return removeData.call( this, $.camelCase( key ) );
+                       } else {
+                               return removeData.call( this );
+                       }
+               };
+       })( $.fn.removeData );
+}
+
+
+
+
+
+// deprecated
+
+(function() {
+       var uaMatch = /msie ([\w.]+)/.exec( navigator.userAgent.toLowerCase() ) || [];
+       $.ui.ie = uaMatch.length ? true : false;
+       $.ui.ie6 = parseFloat( uaMatch[ 1 ], 10 ) === 6;
+})();
+
+$.fn.extend({
+       disableSelection: function() {
+               return this.bind( ( $.support.selectstart ? "selectstart" : "mousedown" ) +
+                       ".ui-disableSelection", function( event ) {
+                               event.preventDefault();
+                       });
+       },
+
+       enableSelection: function() {
+               return this.unbind( ".ui-disableSelection" );
+       }
+});
+
+$.extend( $.ui, {
+       // $.ui.plugin is deprecated.  Use the proxy pattern instead.
+       plugin: {
+               add: function( module, option, set ) {
+                       var i,
+                               proto = $.ui[ module ].prototype;
+                       for ( i in set ) {
+                               proto.plugins[ i ] = proto.plugins[ i ] || [];
+                               proto.plugins[ i ].push( [ option, set[ i ] ] );
+                       }
+               },
+               call: function( instance, name, args ) {
+                       var i,
+                               set = instance.plugins[ name ];
+                       if ( !set || !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) {
+                               return;
+                       }
+
+                       for ( i = 0; i < set.length; i++ ) {
+                               if ( instance.options[ set[ i ][ 0 ] ] ) {
+                                       set[ i ][ 1 ].apply( instance.element, args );
+                               }
+                       }
+               }
+       },
+
+       contains: $.contains,
+
+       // only used by resizable
+       hasScroll: function( el, a ) {
+
+               //If overflow is hidden, the element might have extra content, but the user wants to hide it
+               if ( $( el ).css( "overflow" ) === "hidden") {
+                       return false;
+               }
+
+               var scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop",
+                       has = false;
+
+               if ( el[ scroll ] > 0 ) {
+                       return true;
+               }
+
+               // TODO: determine which cases actually cause this to happen
+               // if the element doesn't have the scroll set, see if it's possible to
+               // set the scroll
+               el[ scroll ] = 1;
+               has = ( el[ scroll ] > 0 );
+               el[ scroll ] = 0;
+               return has;
+       },
+
+       // these are odd functions, fix the API or move into individual plugins
+       isOverAxis: function( x, reference, size ) {
+               //Determines when x coordinate is over "b" element axis
+               return ( x > reference ) && ( x < ( reference + size ) );
+       },
+       isOver: function( y, x, top, left, height, width ) {
+               //Determines when x, y coordinates is over "b" element
+               return $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );
+       }
+});
+
+})( jQuery );
+(function( $, undefined ) {
+
+var uuid = 0,
+       slice = Array.prototype.slice,
+       _cleanData = $.cleanData;
+$.cleanData = function( elems ) {
+       for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
+               try {
+                       $( elem ).triggerHandler( "remove" );
+               // http://bugs.jquery.com/ticket/8235
+               } catch( e ) {}
+       }
+       _cleanData( elems );
+};
+
+$.widget = function( name, base, prototype ) {
+       var fullName, existingConstructor, constructor, basePrototype,
+               namespace = name.split( "." )[ 0 ];
+
+       name = name.split( "." )[ 1 ];
+       fullName = namespace + "-" + name;
+
+       if ( !prototype ) {
+               prototype = base;
+               base = $.Widget;
+       }
+
+       // create selector for plugin
+       $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) {
+               return !!$.data( elem, fullName );
+       };
+
+       $[ namespace ] = $[ namespace ] || {};
+       existingConstructor = $[ namespace ][ name ];
+       constructor = $[ namespace ][ name ] = function( options, element ) {
+               // allow instantiation without "new" keyword
+               if ( !this._createWidget ) {
+                       return new constructor( options, element );
+               }
+
+               // allow instantiation without initializing for simple inheritance
+               // must use "new" keyword (the code above always passes args)
+               if ( arguments.length ) {
+                       this._createWidget( options, element );
+               }
+       };
+       // extend with the existing constructor to carry over any static properties
+       $.extend( constructor, existingConstructor, {
+               version: prototype.version,
+               // copy the object used to create the prototype in case we need to
+               // redefine the widget later
+               _proto: $.extend( {}, prototype ),
+               // track widgets that inherit from this widget in case this widget is
+               // redefined after a widget inherits from it
+               _childConstructors: []
+       });
+
+       basePrototype = new base();
+       // we need to make the options hash a property directly on the new instance
+       // otherwise we'll modify the options hash on the prototype that we're
+       // inheriting from
+       basePrototype.options = $.widget.extend( {}, basePrototype.options );
+       $.each( prototype, function( prop, value ) {
+               if ( $.isFunction( value ) ) {
+                       prototype[ prop ] = (function() {
+                               var _super = function() {
+                                               return base.prototype[ prop ].apply( this, arguments );
+                                       },
+                                       _superApply = function( args ) {
+                                               return base.prototype[ prop ].apply( this, args );
+                                       };
+                               return function() {
+                                       var __super = this._super,
+                                               __superApply = this._superApply,
+                                               returnValue;
+
+                                       this._super = _super;
+                                       this._superApply = _superApply;
+
+                                       returnValue = value.apply( this, arguments );
+
+                                       this._super = __super;
+                                       this._superApply = __superApply;
+
+                                       return returnValue;
+                               };
+                       })();
+               }
+       });
+       constructor.prototype = $.widget.extend( basePrototype, {
+               // TODO: remove support for widgetEventPrefix
+               // always use the name + a colon as the prefix, e.g., draggable:start
+               // don't prefix for widgets that aren't DOM-based
+               widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
+       }, prototype, {
+               constructor: constructor,
+               namespace: namespace,
+               widgetName: name,
+               // TODO remove widgetBaseClass, see #8155
+               widgetBaseClass: fullName,
+               widgetFullName: fullName
+       });
+
+       // If this widget is being redefined then we need to find all widgets that
+       // are inheriting from it and redefine all of them so that they inherit from
+       // the new version of this widget. We're essentially trying to replace one
+       // level in the prototype chain.
+       if ( existingConstructor ) {
+               $.each( existingConstructor._childConstructors, function( i, child ) {
+                       var childPrototype = child.prototype;
+
+                       // redefine the child widget using the same prototype that was
+                       // originally used, but inherit from the new version of the base
+                       $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto );
+               });
+               // remove the list of existing child constructors from the old constructor
+               // so the old child constructors can be garbage collected
+               delete existingConstructor._childConstructors;
+       } else {
+               base._childConstructors.push( constructor );
+       }
+
+       $.widget.bridge( name, constructor );
+};
+
+$.widget.extend = function( target ) {
+       var input = slice.call( arguments, 1 ),
+               inputIndex = 0,
+               inputLength = input.length,
+               key,
+               value;
+       for ( ; inputIndex < inputLength; inputIndex++ ) {
+               for ( key in input[ inputIndex ] ) {
+                       value = input[ inputIndex ][ key ];
+                       if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) {
+                               // Clone objects
+                               if ( $.isPlainObject( value ) ) {
+                                       target[ key ] = $.isPlainObject( target[ key ] ) ?
+                                               $.widget.extend( {}, target[ key ], value ) :
+                                               // Don't extend strings, arrays, etc. with objects
+                                               $.widget.extend( {}, value );
+                               // Copy everything else by reference
+                               } else {
+                                       target[ key ] = value;
+                               }
+                       }
+               }
+       }
+       return target;
+};
+
+$.widget.bridge = function( name, object ) {
+       var fullName = object.prototype.widgetFullName || name;
+       $.fn[ name ] = function( options ) {
+               var isMethodCall = typeof options === "string",
+                       args = slice.call( arguments, 1 ),
+                       returnValue = this;
+
+               // allow multiple hashes to be passed on init
+               options = !isMethodCall && args.length ?
+                       $.widget.extend.apply( null, [ options ].concat(args) ) :
+                       options;
+
+               if ( isMethodCall ) {
+                       this.each(function() {
+                               var methodValue,
+                                       instance = $.data( this, fullName );
+                               if ( !instance ) {
+                                       return $.error( "cannot call methods on " + name + " prior to initialization; " +
+                                               "attempted to call method '" + options + "'" );
+                               }
+                               if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) {
+                                       return $.error( "no such method '" + options + "' for " + name + " widget instance" );
+                               }
+                               methodValue = instance[ options ].apply( instance, args );
+                               if ( methodValue !== instance && methodValue !== undefined ) {
+                                       returnValue = methodValue && methodValue.jquery ?
+                                               returnValue.pushStack( methodValue.get() ) :
+                                               methodValue;
+                                       return false;
+                               }
+                       });
+               } else {
+                       this.each(function() {
+                               var instance = $.data( this, fullName );
+                               if ( instance ) {
+                                       instance.option( options || {} )._init();
+                               } else {
+                                       $.data( this, fullName, new object( options, this ) );
+                               }
+                       });
+               }
+
+               return returnValue;
+       };
+};
+
+$.Widget = function( /* options, element */ ) {};
+$.Widget._childConstructors = [];
+
+$.Widget.prototype = {
+       widgetName: "widget",
+       widgetEventPrefix: "",
+       defaultElement: "<div>",
+       options: {
+               disabled: false,
+
+               // callbacks
+               create: null
+       },
+       _createWidget: function( options, element ) {
+               element = $( element || this.defaultElement || this )[ 0 ];
+               this.element = $( element );
+               this.uuid = uuid++;
+               this.eventNamespace = "." + this.widgetName + this.uuid;
+               this.options = $.widget.extend( {},
+                       this.options,
+                       this._getCreateOptions(),
+                       options );
+
+               this.bindings = $();
+               this.hoverable = $();
+               this.focusable = $();
+
+               if ( element !== this ) {
+                       // 1.9 BC for #7810
+                       // TODO remove dual storage
+                       $.data( element, this.widgetName, this );
+                       $.data( element, this.widgetFullName, this );
+                       this._on( true, this.element, {
+                               remove: function( event ) {
+                                       if ( event.target === element ) {
+                                               this.destroy();
+                                       }
+                               }
+                       });
+                       this.document = $( element.style ?
+                               // element within the document
+                               element.ownerDocument :
+                               // element is window or document
+                               element.document || element );
+                       this.window = $( this.document[0].defaultView || this.document[0].parentWindow );
+               }
+
+               this._create();
+               this._trigger( "create", null, this._getCreateEventData() );
+               this._init();
+       },
+       _getCreateOptions: $.noop,
+       _getCreateEventData: $.noop,
+       _create: $.noop,
+       _init: $.noop,
+
+       destroy: function() {
+               this._destroy();
+               // we can probably remove the unbind calls in 2.0
+               // all event bindings should go through this._on()
+               this.element
+                       .unbind( this.eventNamespace )
+                       // 1.9 BC for #7810
+                       // TODO remove dual storage
+                       .removeData( this.widgetName )
+                       .removeData( this.widgetFullName )
+                       // support: jquery <1.6.3
+                       // http://bugs.jquery.com/ticket/9413
+                       .removeData( $.camelCase( this.widgetFullName ) );
+               this.widget()
+                       .unbind( this.eventNamespace )
+                       .removeAttr( "aria-disabled" )
+                       .removeClass(
+                               this.widgetFullName + "-disabled " +
+                               "ui-state-disabled" );
+
+               // clean up events and states
+               this.bindings.unbind( this.eventNamespace );
+               this.hoverable.removeClass( "ui-state-hover" );
+               this.focusable.removeClass( "ui-state-focus" );
+       },
+       _destroy: $.noop,
+
+       widget: function() {
+               return this.element;
+       },
+
+       option: function( key, value ) {
+               var options = key,
+                       parts,
+                       curOption,
+                       i;
+
+               if ( arguments.length === 0 ) {
+                       // don't return a reference to the internal hash
+                       return $.widget.extend( {}, this.options );
+               }
+
+               if ( typeof key === "string" ) {
+                       // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } }
+                       options = {};
+                       parts = key.split( "." );
+                       key = parts.shift();
+                       if ( parts.length ) {
+                               curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] );
+                               for ( i = 0; i < parts.length - 1; i++ ) {
+                                       curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {};
+                                       curOption = curOption[ parts[ i ] ];
+                               }
+                               key = parts.pop();
+                               if ( value === undefined ) {
+                                       return curOption[ key ] === undefined ? null : curOption[ key ];
+                               }
+                               curOption[ key ] = value;
+                       } else {
+                               if ( value === undefined ) {
+                                       return this.options[ key ] === undefined ? null : this.options[ key ];
+                               }
+                               options[ key ] = value;
+                       }
+               }
+
+               this._setOptions( options );
+
+               return this;
+       },
+       _setOptions: function( options ) {
+               var key;
+
+               for ( key in options ) {
+                       this._setOption( key, options[ key ] );
+               }
+
+               return this;
+       },
+       _setOption: function( key, value ) {
+               this.options[ key ] = value;
+
+               if ( key === "disabled" ) {
+                       this.widget()
+                               .toggleClass( this.widgetFullName + "-disabled ui-state-disabled", !!value )
+                               .attr( "aria-disabled", value );
+                       this.hoverable.removeClass( "ui-state-hover" );
+                       this.focusable.removeClass( "ui-state-focus" );
+               }
+
+               return this;
+       },
+
+       enable: function() {
+               return this._setOption( "disabled", false );
+       },
+       disable: function() {
+               return this._setOption( "disabled", true );
+       },
+
+       _on: function( suppressDisabledCheck, element, handlers ) {
+               var delegateElement,
+                       instance = this;
+
+               // no suppressDisabledCheck flag, shuffle arguments
+               if ( typeof suppressDisabledCheck !== "boolean" ) {
+                       handlers = element;
+                       element = suppressDisabledCheck;
+                       suppressDisabledCheck = false;
+               }
+
+               // no element argument, shuffle and use this.element
+               if ( !handlers ) {
+                       handlers = element;
+                       element = this.element;
+                       delegateElement = this.widget();
+               } else {
+                       // accept selectors, DOM elements
+                       element = delegateElement = $( element );
+                       this.bindings = this.bindings.add( element );
+               }
+
+               $.each( handlers, function( event, handler ) {
+                       function handlerProxy() {
+                               // allow widgets to customize the disabled handling
+                               // - disabled as an array instead of boolean
+                               // - disabled class as method for disabling individual parts
+                               if ( !suppressDisabledCheck &&
+                                               ( instance.options.disabled === true ||
+                                                       $( this ).hasClass( "ui-state-disabled" ) ) ) {
+                                       return;
+                               }
+                               return ( typeof handler === "string" ? instance[ handler ] : handler )
+                                       .apply( instance, arguments );
+                       }
+
+                       // copy the guid so direct unbinding works
+                       if ( typeof handler !== "string" ) {
+                               handlerProxy.guid = handler.guid =
+                                       handler.guid || handlerProxy.guid || $.guid++;
+                       }
+
+                       var match = event.match( /^(\w+)\s*(.*)$/ ),
+                               eventName = match[1] + instance.eventNamespace,
+                               selector = match[2];
+                       if ( selector ) {
+                               delegateElement.delegate( selector, eventName, handlerProxy );
+                       } else {
+                               element.bind( eventName, handlerProxy );
+                       }
+               });
+       },
+
+       _off: function( element, eventName ) {
+               eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + this.eventNamespace;
+               element.unbind( eventName ).undelegate( eventName );
+       },
+
+       _delay: function( handler, delay ) {
+               function handlerProxy() {
+                       return ( typeof handler === "string" ? instance[ handler ] : handler )
+                               .apply( instance, arguments );
+               }
+               var instance = this;
+               return setTimeout( handlerProxy, delay || 0 );
+       },
+
+       _hoverable: function( element ) {
+               this.hoverable = this.hoverable.add( element );
+               this._on( element, {
+                       mouseenter: function( event ) {
+                               $( event.currentTarget ).addClass( "ui-state-hover" );
+                       },
+                       mouseleave: function( event ) {
+                               $( event.currentTarget ).removeClass( "ui-state-hover" );
+                       }
+               });
+       },
+
+       _focusable: function( element ) {
+               this.focusable = this.focusable.add( element );
+               this._on( element, {
+                       focusin: function( event ) {
+                               $( event.currentTarget ).addClass( "ui-state-focus" );
+                       },
+                       focusout: function( event ) {
+                               $( event.currentTarget ).removeClass( "ui-state-focus" );
+                       }
+               });
+       },
+
+       _trigger: function( type, event, data ) {
+               var prop, orig,
+                       callback = this.options[ type ];
+
+               data = data || {};
+               event = $.Event( event );
+               event.type = ( type === this.widgetEventPrefix ?
+                       type :
+                       this.widgetEventPrefix + type ).toLowerCase();
+               // the original event may come from any element
+               // so we need to reset the target on the new event
+               event.target = this.element[ 0 ];
+
+               // copy original event properties over to the new event
+               orig = event.originalEvent;
+               if ( orig ) {
+                       for ( prop in orig ) {
+                               if ( !( prop in event ) ) {
+                                       event[ prop ] = orig[ prop ];
+                               }
+                       }
+               }
+
+               this.element.trigger( event, data );
+               return !( $.isFunction( callback ) &&
+                       callback.apply( this.element[0], [ event ].concat( data ) ) === false ||
+                       event.isDefaultPrevented() );
+       }
+};
+
+$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
+       $.Widget.prototype[ "_" + method ] = function( element, options, callback ) {
+               if ( typeof options === "string" ) {
+                       options = { effect: options };
+               }
+               var hasOptions,
+                       effectName = !options ?
+                               method :
+                               options === true || typeof options === "number" ?
+                                       defaultEffect :
+                                       options.effect || defaultEffect;
+               options = options || {};
+               if ( typeof options === "number" ) {
+                       options = { duration: options };
+               }
+               hasOptions = !$.isEmptyObject( options );
+               options.complete = callback;
+               if ( options.delay ) {
+                       element.delay( options.delay );
+               }
+               if ( hasOptions && $.effects && ( $.effects.effect[ effectName ] || $.uiBackCompat !== false && $.effects[ effectName ] ) ) {
+                       element[ method ]( options );
+               } else if ( effectName !== method && element[ effectName ] ) {
+                       element[ effectName ]( options.duration, options.easing, callback );
+               } else {
+                       element.queue(function( next ) {
+                               $( this )[ method ]();
+                               if ( callback ) {
+                                       callback.call( element[ 0 ] );
+                               }
+                               next();
+                       });
+               }
+       };
+});
+
+// DEPRECATED
+if ( $.uiBackCompat !== false ) {
+       $.Widget.prototype._getCreateOptions = function() {
+               return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
+       };
+}
+
+})( jQuery );
+(function( $, undefined ) {
+
+var mouseHandled = false;
+$( document ).mouseup( function( e ) {
+       mouseHandled = false;
+});
+
+$.widget("ui.mouse", {
+       version: "1.9.2",
+       options: {
+               cancel: 'input,textarea,button,select,option',
+               distance: 1,
+               delay: 0
+       },
+       _mouseInit: function() {
+               var that = this;
+
+               this.element
+                       .bind('mousedown.'+this.widgetName, function(event) {
+                               return that._mouseDown(event);
+                       })
+                       .bind('click.'+this.widgetName, function(event) {
+                               if (true === $.data(event.target, that.widgetName + '.preventClickEvent')) {
+                                       $.removeData(event.target, that.widgetName + '.preventClickEvent');
+                                       event.stopImmediatePropagation();
+                                       return false;
+                               }
+                       });
+
+               this.started = false;
+       },
+
+       // TODO: make sure destroying one instance of mouse doesn't mess with
+       // other instances of mouse
+       _mouseDestroy: function() {
+               this.element.unbind('.'+this.widgetName);
+               if ( this._mouseMoveDelegate ) {
+                       $(document)
+                               .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
+                               .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+               }
+       },
+
+       _mouseDown: function(event) {
+               // don't let more than one widget handle mouseStart
+               if( mouseHandled ) { return; }
+
+               // we may have missed mouseup (out of window)
+               (this._mouseStarted && this._mouseUp(event));
+
+               this._mouseDownEvent = event;
+
+               var that = this,
+                       btnIsLeft = (event.which === 1),
+                       // event.target.nodeName works around a bug in IE 8 with
+                       // disabled inputs (#7620)
+                       elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);
+               if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
+                       return true;
+               }
+
+               this.mouseDelayMet = !this.options.delay;
+               if (!this.mouseDelayMet) {
+                       this._mouseDelayTimer = setTimeout(function() {
+                               that.mouseDelayMet = true;
+                       }, this.options.delay);
+               }
+
+               if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
+                       this._mouseStarted = (this._mouseStart(event) !== false);
+                       if (!this._mouseStarted) {
+                               event.preventDefault();
+                               return true;
+                       }
+               }
+
+               // Click event may never have fired (Gecko & Opera)
+               if (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {
+                       $.removeData(event.target, this.widgetName + '.preventClickEvent');
+               }
+
+               // these delegates are required to keep context
+               this._mouseMoveDelegate = function(event) {
+                       return that._mouseMove(event);
+               };
+               this._mouseUpDelegate = function(event) {
+                       return that._mouseUp(event);
+               };
+               $(document)
+                       .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
+                       .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+
+               event.preventDefault();
+
+               mouseHandled = true;
+               return true;
+       },
+
+       _mouseMove: function(event) {
+               // IE mouseup check - mouseup happened when mouse was out of window
+               if ($.ui.ie && !(document.documentMode >= 9) && !event.button) {
+                       return this._mouseUp(event);
+               }
+
+               if (this._mouseStarted) {
+                       this._mouseDrag(event);
+                       return event.preventDefault();
+               }
+
+               if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
+                       this._mouseStarted =
+                               (this._mouseStart(this._mouseDownEvent, event) !== false);
+                       (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
+               }
+
+               return !this._mouseStarted;
+       },
+
+       _mouseUp: function(event) {
+               $(document)
+                       .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
+                       .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
+
+               if (this._mouseStarted) {
+                       this._mouseStarted = false;
+
+                       if (event.target === this._mouseDownEvent.target) {
+                               $.data(event.target, this.widgetName + '.preventClickEvent', true);
+                       }
+
+                       this._mouseStop(event);
+               }
+
+               return false;
+       },
+
+       _mouseDistanceMet: function(event) {
+               return (Math.max(
+                               Math.abs(this._mouseDownEvent.pageX - event.pageX),
+                               Math.abs(this._mouseDownEvent.pageY - event.pageY)
+                       ) >= this.options.distance
+               );
+       },
+
+       _mouseDelayMet: function(event) {
+               return this.mouseDelayMet;
+       },
+
+       // These are placeholder methods, to be overriden by extending plugin
+       _mouseStart: function(event) {},
+       _mouseDrag: function(event) {},
+       _mouseStop: function(event) {},
+       _mouseCapture: function(event) { return true; }
+});
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.ui = $.ui || {};
+
+var cachedScrollbarWidth,
+       max = Math.max,
+       abs = Math.abs,
+       round = Math.round,
+       rhorizontal = /left|center|right/,
+       rvertical = /top|center|bottom/,
+       roffset = /[\+\-]\d+%?/,
+       rposition = /^\w+/,
+       rpercent = /%$/,
+       _position = $.fn.position;
+
+function getOffsets( offsets, width, height ) {
+       return [
+               parseInt( offsets[ 0 ], 10 ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ),
+               parseInt( offsets[ 1 ], 10 ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 )
+       ];
+}
+function parseCss( element, property ) {
+       return parseInt( $.css( element, property ), 10 ) || 0;
+}
+
+$.position = {
+       scrollbarWidth: function() {
+               if ( cachedScrollbarWidth !== undefined ) {
+                       return cachedScrollbarWidth;
+               }
+               var w1, w2,
+                       div = $( "<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>" ),
+                       innerDiv = div.children()[0];
+
+               $( "body" ).append( div );
+               w1 = innerDiv.offsetWidth;
+               div.css( "overflow", "scroll" );
+
+               w2 = innerDiv.offsetWidth;
+
+               if ( w1 === w2 ) {
+                       w2 = div[0].clientWidth;
+               }
+
+               div.remove();
+
+               return (cachedScrollbarWidth = w1 - w2);
+       },
+       getScrollInfo: function( within ) {
+               var overflowX = within.isWindow ? "" : within.element.css( "overflow-x" ),
+                       overflowY = within.isWindow ? "" : within.element.css( "overflow-y" ),
+                       hasOverflowX = overflowX === "scroll" ||
+                               ( overflowX === "auto" && within.width < within.element[0].scrollWidth ),
+                       hasOverflowY = overflowY === "scroll" ||
+                               ( overflowY === "auto" && within.height < within.element[0].scrollHeight );
+               return {
+                       width: hasOverflowX ? $.position.scrollbarWidth() : 0,
+                       height: hasOverflowY ? $.position.scrollbarWidth() : 0
+               };
+       },
+       getWithinInfo: function( element ) {
+               var withinElement = $( element || window ),
+                       isWindow = $.isWindow( withinElement[0] );
+               return {
+                       element: withinElement,
+                       isWindow: isWindow,
+                       offset: withinElement.offset() || { left: 0, top: 0 },
+                       scrollLeft: withinElement.scrollLeft(),
+                       scrollTop: withinElement.scrollTop(),
+                       width: isWindow ? withinElement.width() : withinElement.outerWidth(),
+                       height: isWindow ? withinElement.height() : withinElement.outerHeight()
+               };
+       }
+};
+
+$.fn.position = function( options ) {
+       if ( !options || !options.of ) {
+               return _position.apply( this, arguments );
+       }
+
+       // make a copy, we don't want to modify arguments
+       options = $.extend( {}, options );
+
+       var atOffset, targetWidth, targetHeight, targetOffset, basePosition,
+               target = $( options.of ),
+               within = $.position.getWithinInfo( options.within ),
+               scrollInfo = $.position.getScrollInfo( within ),
+               targetElem = target[0],
+               collision = ( options.collision || "flip" ).split( " " ),
+               offsets = {};
+
+       if ( targetElem.nodeType === 9 ) {
+               targetWidth = target.width();
+               targetHeight = target.height();
+               targetOffset = { top: 0, left: 0 };
+       } else if ( $.isWindow( targetElem ) ) {
+               targetWidth = target.width();
+               targetHeight = target.height();
+               targetOffset = { top: target.scrollTop(), left: target.scrollLeft() };
+       } else if ( targetElem.preventDefault ) {
+               // force left top to allow flipping
+               options.at = "left top";
+               targetWidth = targetHeight = 0;
+               targetOffset = { top: targetElem.pageY, left: targetElem.pageX };
+       } else {
+               targetWidth = target.outerWidth();
+               targetHeight = target.outerHeight();
+               targetOffset = target.offset();
+       }
+       // clone to reuse original targetOffset later
+       basePosition = $.extend( {}, targetOffset );
+
+       // force my and at to have valid horizontal and vertical positions
+       // if a value is missing or invalid, it will be converted to center
+       $.each( [ "my", "at" ], function() {
+               var pos = ( options[ this ] || "" ).split( " " ),
+                       horizontalOffset,
+                       verticalOffset;
+
+               if ( pos.length === 1) {
+                       pos = rhorizontal.test( pos[ 0 ] ) ?
+                               pos.concat( [ "center" ] ) :
+                               rvertical.test( pos[ 0 ] ) ?
+                                       [ "center" ].concat( pos ) :
+                                       [ "center", "center" ];
+               }
+               pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center";
+               pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center";
+
+               // calculate offsets
+               horizontalOffset = roffset.exec( pos[ 0 ] );
+               verticalOffset = roffset.exec( pos[ 1 ] );
+               offsets[ this ] = [
+                       horizontalOffset ? horizontalOffset[ 0 ] : 0,
+                       verticalOffset ? verticalOffset[ 0 ] : 0
+               ];
+
+               // reduce to just the positions without the offsets
+               options[ this ] = [
+                       rposition.exec( pos[ 0 ] )[ 0 ],
+                       rposition.exec( pos[ 1 ] )[ 0 ]
+               ];
+       });
+
+       // normalize collision option
+       if ( collision.length === 1 ) {
+               collision[ 1 ] = collision[ 0 ];
+       }
+
+       if ( options.at[ 0 ] === "right" ) {
+               basePosition.left += targetWidth;
+       } else if ( options.at[ 0 ] === "center" ) {
+               basePosition.left += targetWidth / 2;
+       }
+
+       if ( options.at[ 1 ] === "bottom" ) {
+               basePosition.top += targetHeight;
+       } else if ( options.at[ 1 ] === "center" ) {
+               basePosition.top += targetHeight / 2;
+       }
+
+       atOffset = getOffsets( offsets.at, targetWidth, targetHeight );
+       basePosition.left += atOffset[ 0 ];
+       basePosition.top += atOffset[ 1 ];
+
+       return this.each(function() {
+               var collisionPosition, using,
+                       elem = $( this ),
+                       elemWidth = elem.outerWidth(),
+                       elemHeight = elem.outerHeight(),
+                       marginLeft = parseCss( this, "marginLeft" ),
+                       marginTop = parseCss( this, "marginTop" ),
+                       collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
+                       collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
+                       position = $.extend( {}, basePosition ),
+                       myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
+
+               if ( options.my[ 0 ] === "right" ) {
+                       position.left -= elemWidth;
+               } else if ( options.my[ 0 ] === "center" ) {
+                       position.left -= elemWidth / 2;
+               }
+
+               if ( options.my[ 1 ] === "bottom" ) {
+                       position.top -= elemHeight;
+               } else if ( options.my[ 1 ] === "center" ) {
+                       position.top -= elemHeight / 2;
+               }
+
+               position.left += myOffset[ 0 ];
+               position.top += myOffset[ 1 ];
+
+               // if the browser doesn't support fractions, then round for consistent results
+               if ( !$.support.offsetFractions ) {
+                       position.left = round( position.left );
+                       position.top = round( position.top );
+               }
+
+               collisionPosition = {
+                       marginLeft: marginLeft,
+                       marginTop: marginTop
+               };
+
+               $.each( [ "left", "top" ], function( i, dir ) {
+                       if ( $.ui.position[ collision[ i ] ] ) {
+                               $.ui.position[ collision[ i ] ][ dir ]( position, {
+                                       targetWidth: targetWidth,
+                                       targetHeight: targetHeight,
+                                       elemWidth: elemWidth,
+                                       elemHeight: elemHeight,
+                                       collisionPosition: collisionPosition,
+                                       collisionWidth: collisionWidth,
+                                       collisionHeight: collisionHeight,
+                                       offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ],
+                                       my: options.my,
+                                       at: options.at,
+                                       within: within,
+                                       elem : elem
+                               });
+                       }
+               });
+
+               if ( $.fn.bgiframe ) {
+                       elem.bgiframe();
+               }
+
+               if ( options.using ) {
+                       // adds feedback as second argument to using callback, if present
+                       using = function( props ) {
+                               var left = targetOffset.left - position.left,
+                                       right = left + targetWidth - elemWidth,
+                                       top = targetOffset.top - position.top,
+                                       bottom = top + targetHeight - elemHeight,
+                                       feedback = {
+                                               target: {
+                                                       element: target,
+                                                       left: targetOffset.left,
+                                                       top: targetOffset.top,
+                                                       width: targetWidth,
+                                                       height: targetHeight
+                                               },
+                                               element: {
+                                                       element: elem,
+                                                       left: position.left,
+                                                       top: position.top,
+                                                       width: elemWidth,
+                                                       height: elemHeight
+                                               },
+                                               horizontal: right < 0 ? "left" : left > 0 ? "right" : "center",
+                                               vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle"
+                                       };
+                               if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) {
+                                       feedback.horizontal = "center";
+                               }
+                               if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) {
+                                       feedback.vertical = "middle";
+                               }
+                               if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) {
+                                       feedback.important = "horizontal";
+                               } else {
+                                       feedback.important = "vertical";
+                               }
+                               options.using.call( this, props, feedback );
+                       };
+               }
+
+               elem.offset( $.extend( position, { using: using } ) );
+       });
+};
+
+$.ui.position = {
+       fit: {
+               left: function( position, data ) {
+                       var within = data.within,
+                               withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
+                               outerWidth = within.width,
+                               collisionPosLeft = position.left - data.collisionPosition.marginLeft,
+                               overLeft = withinOffset - collisionPosLeft,
+                               overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset,
+                               newOverRight;
+
+                       // element is wider than within
+                       if ( data.collisionWidth > outerWidth ) {
+                               // element is initially over the left side of within
+                               if ( overLeft > 0 && overRight <= 0 ) {
+                                       newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset;
+                                       position.left += overLeft - newOverRight;
+                               // element is initially over right side of within
+                               } else if ( overRight > 0 && overLeft <= 0 ) {
+                                       position.left = withinOffset;
+                               // element is initially over both left and right sides of within
+                               } else {
+                                       if ( overLeft > overRight ) {
+                                               position.left = withinOffset + outerWidth - data.collisionWidth;
+                                       } else {
+                                               position.left = withinOffset;
+                                       }
+                               }
+                       // too far left -> align with left edge
+                       } else if ( overLeft > 0 ) {
+                               position.left += overLeft;
+                       // too far right -> align with right edge
+                       } else if ( overRight > 0 ) {
+                               position.left -= overRight;
+                       // adjust based on position and margin
+                       } else {
+                               position.left = max( position.left - collisionPosLeft, position.left );
+                       }
+               },
+               top: function( position, data ) {
+                       var within = data.within,
+                               withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
+                               outerHeight = data.within.height,
+                               collisionPosTop = position.top - data.collisionPosition.marginTop,
+                               overTop = withinOffset - collisionPosTop,
+                               overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset,
+                               newOverBottom;
+
+                       // element is taller than within
+                       if ( data.collisionHeight > outerHeight ) {
+                               // element is initially over the top of within
+                               if ( overTop > 0 && overBottom <= 0 ) {
+                                       newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset;
+                                       position.top += overTop - newOverBottom;
+                               // element is initially over bottom of within
+                               } else if ( overBottom > 0 && overTop <= 0 ) {
+                                       position.top = withinOffset;
+                               // element is initially over both top and bottom of within
+                               } else {
+                                       if ( overTop > overBottom ) {
+                                               position.top = withinOffset + outerHeight - data.collisionHeight;
+                                       } else {
+                                               position.top = withinOffset;
+                                       }
+                               }
+                       // too far up -> align with top
+                       } else if ( overTop > 0 ) {
+                               position.top += overTop;
+                       // too far down -> align with bottom edge
+                       } else if ( overBottom > 0 ) {
+                               position.top -= overBottom;
+                       // adjust based on position and margin
+                       } else {
+                               position.top = max( position.top - collisionPosTop, position.top );
+                       }
+               }
+       },
+       flip: {
+               left: function( position, data ) {
+                       var within = data.within,
+                               withinOffset = within.offset.left + within.scrollLeft,
+                               outerWidth = within.width,
+                               offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
+                               collisionPosLeft = position.left - data.collisionPosition.marginLeft,
+                               overLeft = collisionPosLeft - offsetLeft,
+                               overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft,
+                               myOffset = data.my[ 0 ] === "left" ?
+                                       -data.elemWidth :
+                                       data.my[ 0 ] === "right" ?
+                                               data.elemWidth :
+                                               0,
+                               atOffset = data.at[ 0 ] === "left" ?
+                                       data.targetWidth :
+                                       data.at[ 0 ] === "right" ?
+                                               -data.targetWidth :
+                                               0,
+                               offset = -2 * data.offset[ 0 ],
+                               newOverRight,
+                               newOverLeft;
+
+                       if ( overLeft < 0 ) {
+                               newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset;
+                               if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) {
+                                       position.left += myOffset + atOffset + offset;
+                               }
+                       }
+                       else if ( overRight > 0 ) {
+                               newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft;
+                               if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) {
+                                       position.left += myOffset + atOffset + offset;
+                               }
+                       }
+               },
+               top: function( position, data ) {
+                       var within = data.within,
+                               withinOffset = within.offset.top + within.scrollTop,
+                               outerHeight = within.height,
+                               offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
+                               collisionPosTop = position.top - data.collisionPosition.marginTop,
+                               overTop = collisionPosTop - offsetTop,
+                               overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop,
+                               top = data.my[ 1 ] === "top",
+                               myOffset = top ?
+                                       -data.elemHeight :
+                                       data.my[ 1 ] === "bottom" ?
+                                               data.elemHeight :
+                                               0,
+                               atOffset = data.at[ 1 ] === "top" ?
+                                       data.targetHeight :
+                                       data.at[ 1 ] === "bottom" ?
+                                               -data.targetHeight :
+                                               0,
+                               offset = -2 * data.offset[ 1 ],
+                               newOverTop,
+                               newOverBottom;
+                       if ( overTop < 0 ) {
+                               newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset;
+                               if ( ( position.top + myOffset + atOffset + offset) > overTop && ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) ) {
+                                       position.top += myOffset + atOffset + offset;
+                               }
+                       }
+                       else if ( overBottom > 0 ) {
+                               newOverTop = position.top -  data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop;
+                               if ( ( position.top + myOffset + atOffset + offset) > overBottom && ( newOverTop > 0 || abs( newOverTop ) < overBottom ) ) {
+                                       position.top += myOffset + atOffset + offset;
+                               }
+                       }
+               }
+       },
+       flipfit: {
+               left: function() {
+                       $.ui.position.flip.left.apply( this, arguments );
+                       $.ui.position.fit.left.apply( this, arguments );
+               },
+               top: function() {
+                       $.ui.position.flip.top.apply( this, arguments );
+                       $.ui.position.fit.top.apply( this, arguments );
+               }
+       }
+};
+
+// fraction support test
+(function () {
+       var testElement, testElementParent, testElementStyle, offsetLeft, i,
+               body = document.getElementsByTagName( "body" )[ 0 ],
+               div = document.createElement( "div" );
+
+       //Create a "fake body" for testing based on method used in jQuery.support
+       testElement = document.createElement( body ? "div" : "body" );
+       testElementStyle = {
+               visibility: "hidden",
+               width: 0,
+               height: 0,
+               border: 0,
+               margin: 0,
+               background: "none"
+       };
+       if ( body ) {
+               $.extend( testElementStyle, {
+                       position: "absolute",
+                       left: "-1000px",
+                       top: "-1000px"
+               });
+       }
+       for ( i in testElementStyle ) {
+               testElement.style[ i ] = testElementStyle[ i ];
+       }
+       testElement.appendChild( div );
+       testElementParent = body || document.documentElement;
+       testElementParent.insertBefore( testElement, testElementParent.firstChild );
+
+       div.style.cssText = "position: absolute; left: 10.7432222px;";
+
+       offsetLeft = $( div ).offset().left;
+       $.support.offsetFractions = offsetLeft > 10 && offsetLeft < 11;
+
+       testElement.innerHTML = "";
+       testElementParent.removeChild( testElement );
+})();
+
+// DEPRECATED
+if ( $.uiBackCompat !== false ) {
+       // offset option
+       (function( $ ) {
+               var _position = $.fn.position;
+               $.fn.position = function( options ) {
+                       if ( !options || !options.offset ) {
+                               return _position.call( this, options );
+                       }
+                       var offset = options.offset.split( " " ),
+                               at = options.at.split( " " );
+                       if ( offset.length === 1 ) {
+                               offset[ 1 ] = offset[ 0 ];
+                       }
+                       if ( /^\d/.test( offset[ 0 ] ) ) {
+                               offset[ 0 ] = "+" + offset[ 0 ];
+                       }
+                       if ( /^\d/.test( offset[ 1 ] ) ) {
+                               offset[ 1 ] = "+" + offset[ 1 ];
+                       }
+                       if ( at.length === 1 ) {
+                               if ( /left|center|right/.test( at[ 0 ] ) ) {
+                                       at[ 1 ] = "center";
+                               } else {
+                                       at[ 1 ] = at[ 0 ];
+                                       at[ 0 ] = "center";
+                               }
+                       }
+                       return _position.call( this, $.extend( options, {
+                               at: at[ 0 ] + offset[ 0 ] + " " + at[ 1 ] + offset[ 1 ],
+                               offset: undefined
+                       } ) );
+               };
+       }( jQuery ) );
+}
+
+}( jQuery ) );
+(function( $, undefined ) {
+
+var uid = 0,
+       hideProps = {},
+       showProps = {};
+
+hideProps.height = hideProps.paddingTop = hideProps.paddingBottom =
+       hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide";
+showProps.height = showProps.paddingTop = showProps.paddingBottom =
+       showProps.borderTopWidth = showProps.borderBottomWidth = "show";
+
+$.widget( "ui.accordion", {
+       version: "1.9.2",
+       options: {
+               active: 0,
+               animate: {},
+               collapsible: false,
+               event: "click",
+               header: "> li > :first-child,> :not(li):even",
+               heightStyle: "auto",
+               icons: {
+                       activeHeader: "ui-icon-triangle-1-s",
+                       header: "ui-icon-triangle-1-e"
+               },
+
+               // callbacks
+               activate: null,
+               beforeActivate: null
+       },
+
+       _create: function() {
+               var accordionId = this.accordionId = "ui-accordion-" +
+                               (this.element.attr( "id" ) || ++uid),
+                       options = this.options;
+
+               this.prevShow = this.prevHide = $();
+               this.element.addClass( "ui-accordion ui-widget ui-helper-reset" );
+
+               this.headers = this.element.find( options.header )
+                       .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" );
+               this._hoverable( this.headers );
+               this._focusable( this.headers );
+
+               this.headers.next()
+                       .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
+                       .hide();
+
+               // don't allow collapsible: false and active: false / null
+               if ( !options.collapsible && (options.active === false || options.active == null) ) {
+                       options.active = 0;
+               }
+               // handle negative values
+               if ( options.active < 0 ) {
+                       options.active += this.headers.length;
+               }
+               this.active = this._findActive( options.active )
+                       .addClass( "ui-accordion-header-active ui-state-active" )
+                       .toggleClass( "ui-corner-all ui-corner-top" );
+               this.active.next()
+                       .addClass( "ui-accordion-content-active" )
+                       .show();
+
+               this._createIcons();
+               this.refresh();
+
+               // ARIA
+               this.element.attr( "role", "tablist" );
+
+               this.headers
+                       .attr( "role", "tab" )
+                       .each(function( i ) {
+                               var header = $( this ),
+                                       headerId = header.attr( "id" ),
+                                       panel = header.next(),
+                                       panelId = panel.attr( "id" );
+                               if ( !headerId ) {
+                                       headerId = accordionId + "-header-" + i;
+                                       header.attr( "id", headerId );
+                               }
+                               if ( !panelId ) {
+                                       panelId = accordionId + "-panel-" + i;
+                                       panel.attr( "id", panelId );
+                               }
+                               header.attr( "aria-controls", panelId );
+                               panel.attr( "aria-labelledby", headerId );
+                       })
+                       .next()
+                               .attr( "role", "tabpanel" );
+
+               this.headers
+                       .not( this.active )
+                       .attr({
+                               "aria-selected": "false",
+                               tabIndex: -1
+                       })
+                       .next()
+                               .attr({
+                                       "aria-expanded": "false",
+                                       "aria-hidden": "true"
+                               })
+                               .hide();
+
+               // make sure at least one header is in the tab order
+               if ( !this.active.length ) {
+                       this.headers.eq( 0 ).attr( "tabIndex", 0 );
+               } else {
+                       this.active.attr({
+                               "aria-selected": "true",
+                               tabIndex: 0
+                       })
+                       .next()
+                               .attr({
+                                       "aria-expanded": "true",
+                                       "aria-hidden": "false"
+                               });
+               }
+
+               this._on( this.headers, { keydown: "_keydown" });
+               this._on( this.headers.next(), { keydown: "_panelKeyDown" });
+               this._setupEvents( options.event );
+       },
+
+       _getCreateEventData: function() {
+               return {
+                       header: this.active,
+                       content: !this.active.length ? $() : this.active.next()
+               };
+       },
+
+       _createIcons: function() {
+               var icons = this.options.icons;
+               if ( icons ) {
+                       $( "<span>" )
+                               .addClass( "ui-accordion-header-icon ui-icon " + icons.header )
+                               .prependTo( this.headers );
+                       this.active.children( ".ui-accordion-header-icon" )
+                               .removeClass( icons.header )
+                               .addClass( icons.activeHeader );
+                       this.headers.addClass( "ui-accordion-icons" );
+               }
+       },
+
+       _destroyIcons: function() {
+               this.headers
+                       .removeClass( "ui-accordion-icons" )
+                       .children( ".ui-accordion-header-icon" )
+                               .remove();
+       },
+
+       _destroy: function() {
+               var contents;
+
+               // clean up main element
+               this.element
+                       .removeClass( "ui-accordion ui-widget ui-helper-reset" )
+                       .removeAttr( "role" );
+
+               // clean up headers
+               this.headers
+                       .removeClass( "ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
+                       .removeAttr( "role" )
+                       .removeAttr( "aria-selected" )
+                       .removeAttr( "aria-controls" )
+                       .removeAttr( "tabIndex" )
+                       .each(function() {
+                               if ( /^ui-accordion/.test( this.id ) ) {
+                                       this.removeAttribute( "id" );
+                               }
+                       });
+               this._destroyIcons();
+
+               // clean up content panels
+               contents = this.headers.next()
+                       .css( "display", "" )
+                       .removeAttr( "role" )
+                       .removeAttr( "aria-expanded" )
+                       .removeAttr( "aria-hidden" )
+                       .removeAttr( "aria-labelledby" )
+                       .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled" )
+                       .each(function() {
+                               if ( /^ui-accordion/.test( this.id ) ) {
+                                       this.removeAttribute( "id" );
+                               }
+                       });
+               if ( this.options.heightStyle !== "content" ) {
+                       contents.css( "height", "" );
+               }
+       },
+
+       _setOption: function( key, value ) {
+               if ( key === "active" ) {
+                       // _activate() will handle invalid values and update this.options
+                       this._activate( value );
+                       return;
+               }
+
+               if ( key === "event" ) {
+                       if ( this.options.event ) {
+                               this._off( this.headers, this.options.event );
+                       }
+                       this._setupEvents( value );
+               }
+
+               this._super( key, value );
+
+               // setting collapsible: false while collapsed; open first panel
+               if ( key === "collapsible" && !value && this.options.active === false ) {
+                       this._activate( 0 );
+               }
+
+               if ( key === "icons" ) {
+                       this._destroyIcons();
+                       if ( value ) {
+                               this._createIcons();
+                       }
+               }
+
+               // #5332 - opacity doesn't cascade to positioned elements in IE
+               // so we need to add the disabled class to the headers and panels
+               if ( key === "disabled" ) {
+                       this.headers.add( this.headers.next() )
+                               .toggleClass( "ui-state-disabled", !!value );
+               }
+       },
+
+       _keydown: function( event ) {
+               if ( event.altKey || event.ctrlKey ) {
+                       return;
+               }
+
+               var keyCode = $.ui.keyCode,
+                       length = this.headers.length,
+                       currentIndex = this.headers.index( event.target ),
+                       toFocus = false;
+
+               switch ( event.keyCode ) {
+                       case keyCode.RIGHT:
+                       case keyCode.DOWN:
+                               toFocus = this.headers[ ( currentIndex + 1 ) % length ];
+                               break;
+                       case keyCode.LEFT:
+                       case keyCode.UP:
+                               toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
+                               break;
+                       case keyCode.SPACE:
+                       case keyCode.ENTER:
+                               this._eventHandler( event );
+                               break;
+                       case keyCode.HOME:
+                               toFocus = this.headers[ 0 ];
+                               break;
+                       case keyCode.END:
+                               toFocus = this.headers[ length - 1 ];
+                               break;
+               }
+
+               if ( toFocus ) {
+                       $( event.target ).attr( "tabIndex", -1 );
+                       $( toFocus ).attr( "tabIndex", 0 );
+                       toFocus.focus();
+                       event.preventDefault();
+               }
+       },
+
+       _panelKeyDown : function( event ) {
+               if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
+                       $( event.currentTarget ).prev().focus();
+               }
+       },
+
+       refresh: function() {
+               var maxHeight, overflow,
+                       heightStyle = this.options.heightStyle,
+                       parent = this.element.parent();
+
+
+               if ( heightStyle === "fill" ) {
+                       // IE 6 treats height like minHeight, so we need to turn off overflow
+                       // in order to get a reliable height
+                       // we use the minHeight support test because we assume that only
+                       // browsers that don't support minHeight will treat height as minHeight
+                       if ( !$.support.minHeight ) {
+                               overflow = parent.css( "overflow" );
+                               parent.css( "overflow", "hidden");
+                       }
+                       maxHeight = parent.height();
+                       this.element.siblings( ":visible" ).each(function() {
+                               var elem = $( this ),
+                                       position = elem.css( "position" );
+
+                               if ( position === "absolute" || position === "fixed" ) {
+                                       return;
+                               }
+                               maxHeight -= elem.outerHeight( true );
+                       });
+                       if ( overflow ) {
+                               parent.css( "overflow", overflow );
+                       }
+
+                       this.headers.each(function() {
+                               maxHeight -= $( this ).outerHeight( true );
+                       });
+
+                       this.headers.next()
+                               .each(function() {
+                                       $( this ).height( Math.max( 0, maxHeight -
+                                               $( this ).innerHeight() + $( this ).height() ) );
+                               })
+                               .css( "overflow", "auto" );
+               } else if ( heightStyle === "auto" ) {
+                       maxHeight = 0;
+                       this.headers.next()
+                               .each(function() {
+                                       maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
+                               })
+                               .height( maxHeight );
+               }
+       },
+
+       _activate: function( index ) {
+               var active = this._findActive( index )[ 0 ];
+
+               // trying to activate the already active panel
+               if ( active === this.active[ 0 ] ) {
+                       return;
+               }
+
+               // trying to collapse, simulate a click on the currently active header
+               active = active || this.active[ 0 ];
+
+               this._eventHandler({
+                       target: active,
+                       currentTarget: active,
+                       preventDefault: $.noop
+               });
+       },
+
+       _findActive: function( selector ) {
+               return typeof selector === "number" ? this.headers.eq( selector ) : $();
+       },
+
+       _setupEvents: function( event ) {
+               var events = {};
+               if ( !event ) {
+                       return;
+               }
+               $.each( event.split(" "), function( index, eventName ) {
+                       events[ eventName ] = "_eventHandler";
+               });
+               this._on( this.headers, events );
+       },
+
+       _eventHandler: function( event ) {
+               var options = this.options,
+                       active = this.active,
+                       clicked = $( event.currentTarget ),
+                       clickedIsActive = clicked[ 0 ] === active[ 0 ],
+                       collapsing = clickedIsActive && options.collapsible,
+                       toShow = collapsing ? $() : clicked.next(),
+                       toHide = active.next(),
+                       eventData = {
+                               oldHeader: active,
+                               oldPanel: toHide,
+                               newHeader: collapsing ? $() : clicked,
+                               newPanel: toShow
+                       };
+
+               event.preventDefault();
+
+               if (
+                               // click on active header, but not collapsible
+                               ( clickedIsActive && !options.collapsible ) ||
+                               // allow canceling activation
+                               ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
+                       return;
+               }
+
+               options.active = collapsing ? false : this.headers.index( clicked );
+
+               // when the call to ._toggle() comes after the class changes
+               // it causes a very odd bug in IE 8 (see #6720)
+               this.active = clickedIsActive ? $() : clicked;
+               this._toggle( eventData );
+
+               // switch classes
+               // corner classes on the previously active header stay after the animation
+               active.removeClass( "ui-accordion-header-active ui-state-active" );
+               if ( options.icons ) {
+                       active.children( ".ui-accordion-header-icon" )
+                               .removeClass( options.icons.activeHeader )
+                               .addClass( options.icons.header );
+               }
+
+               if ( !clickedIsActive ) {
+                       clicked
+                               .removeClass( "ui-corner-all" )
+                               .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" );
+                       if ( options.icons ) {
+                               clicked.children( ".ui-accordion-header-icon" )
+                                       .removeClass( options.icons.header )
+                                       .addClass( options.icons.activeHeader );
+                       }
+
+                       clicked
+                               .next()
+                               .addClass( "ui-accordion-content-active" );
+               }
+       },
+
+       _toggle: function( data ) {
+               var toShow = data.newPanel,
+                       toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
+
+               // handle activating a panel during the animation for another activation
+               this.prevShow.add( this.prevHide ).stop( true, true );
+               this.prevShow = toShow;
+               this.prevHide = toHide;
+
+               if ( this.options.animate ) {
+                       this._animate( toShow, toHide, data );
+               } else {
+                       toHide.hide();
+                       toShow.show();
+                       this._toggleComplete( data );
+               }
+
+               toHide.attr({
+                       "aria-expanded": "false",
+                       "aria-hidden": "true"
+               });
+               toHide.prev().attr( "aria-selected", "false" );
+               // if we're switching panels, remove the old header from the tab order
+               // if we're opening from collapsed state, remove the previous header from the tab order
+               // if we're collapsing, then keep the collapsing header in the tab order
+               if ( toShow.length && toHide.length ) {
+                       toHide.prev().attr( "tabIndex", -1 );
+               } else if ( toShow.length ) {
+                       this.headers.filter(function() {
+                               return $( this ).attr( "tabIndex" ) === 0;
+                       })
+                       .attr( "tabIndex", -1 );
+               }
+
+               toShow
+                       .attr({
+                               "aria-expanded": "true",
+                               "aria-hidden": "false"
+                       })
+                       .prev()
+                               .attr({
+                                       "aria-selected": "true",
+                                       tabIndex: 0
+                               });
+       },
+
+       _animate: function( toShow, toHide, data ) {
+               var total, easing, duration,
+                       that = this,
+                       adjust = 0,
+                       down = toShow.length &&
+                               ( !toHide.length || ( toShow.index() < toHide.index() ) ),
+                       animate = this.options.animate || {},
+                       options = down && animate.down || animate,
+                       complete = function() {
+                               that._toggleComplete( data );
+                       };
+
+               if ( typeof options === "number" ) {
+                       duration = options;
+               }
+               if ( typeof options === "string" ) {
+                       easing = options;
+               }
+               // fall back from options to animation in case of partial down settings
+               easing = easing || options.easing || animate.easing;
+               duration = duration || options.duration || animate.duration;
+
+               if ( !toHide.length ) {
+                       return toShow.animate( showProps, duration, easing, complete );
+               }
+               if ( !toShow.length ) {
+                       return toHide.animate( hideProps, duration, easing, complete );
+               }
+
+               total = toShow.show().outerHeight();
+               toHide.animate( hideProps, {
+                       duration: duration,
+                       easing: easing,
+                       step: function( now, fx ) {
+                               fx.now = Math.round( now );
+                       }
+               });
+               toShow
+                       .hide()
+                       .animate( showProps, {
+                               duration: duration,
+                               easing: easing,
+                               complete: complete,
+                               step: function( now, fx ) {
+                                       fx.now = Math.round( now );
+                                       if ( fx.prop !== "height" ) {
+                                               adjust += fx.now;
+                                       } else if ( that.options.heightStyle !== "content" ) {
+                                               fx.now = Math.round( total - toHide.outerHeight() - adjust );
+                                               adjust = 0;
+                                       }
+                               }
+                       });
+       },
+
+       _toggleComplete: function( data ) {
+               var toHide = data.oldPanel;
+
+               toHide
+                       .removeClass( "ui-accordion-content-active" )
+                       .prev()
+                               .removeClass( "ui-corner-top" )
+                               .addClass( "ui-corner-all" );
+
+               // Work around for rendering bug in IE (#5421)
+               if ( toHide.length ) {
+                       toHide.parent()[0].className = toHide.parent()[0].className;
+               }
+
+               this._trigger( "activate", null, data );
+       }
+});
+
+
+
+// DEPRECATED
+if ( $.uiBackCompat !== false ) {
+       // navigation options
+       (function( $, prototype ) {
+               $.extend( prototype.options, {
+                       navigation: false,
+                       navigationFilter: function() {
+                               return this.href.toLowerCase() === location.href.toLowerCase();
+                       }
+               });
+
+               var _create = prototype._create;
+               prototype._create = function() {
+                       if ( this.options.navigation ) {
+                               var that = this,
+                                       headers = this.element.find( this.options.header ),
+                                       content = headers.next(),
+                                       current = headers.add( content )
+                                               .find( "a" )
+                                               .filter( this.options.navigationFilter )
+                                               [ 0 ];
+                               if ( current ) {
+                                       headers.add( content ).each( function( index ) {
+                                               if ( $.contains( this, current ) ) {
+                                                       that.options.active = Math.floor( index / 2 );
+                                                       return false;
+                                               }
+                                       });
+                               }
+                       }
+                       _create.call( this );
+               };
+       }( jQuery, jQuery.ui.accordion.prototype ) );
+
+       // height options
+       (function( $, prototype ) {
+               $.extend( prototype.options, {
+                       heightStyle: null, // remove default so we fall back to old values
+                       autoHeight: true, // use heightStyle: "auto"
+                       clearStyle: false, // use heightStyle: "content"
+                       fillSpace: false // use heightStyle: "fill"
+               });
+
+               var _create = prototype._create,
+                       _setOption = prototype._setOption;
+
+               $.extend( prototype, {
+                       _create: function() {
+                               this.options.heightStyle = this.options.heightStyle ||
+                                       this._mergeHeightStyle();
+
+                               _create.call( this );
+                       },
+
+                       _setOption: function( key ) {
+                               if ( key === "autoHeight" || key === "clearStyle" || key === "fillSpace" ) {
+                                       this.options.heightStyle = this._mergeHeightStyle();
+                               }
+                               _setOption.apply( this, arguments );
+                       },
+
+                       _mergeHeightStyle: function() {
+                               var options = this.options;
+
+                               if ( options.fillSpace ) {
+                                       return "fill";
+                               }
+
+                               if ( options.clearStyle ) {
+                                       return "content";
+                               }
+
+                               if ( options.autoHeight ) {
+                                       return "auto";
+                               }
+                       }
+               });
+       }( jQuery, jQuery.ui.accordion.prototype ) );
+
+       // icon options
+       (function( $, prototype ) {
+               $.extend( prototype.options.icons, {
+                       activeHeader: null, // remove default so we fall back to old values
+                       headerSelected: "ui-icon-triangle-1-s"
+               });
+
+               var _createIcons = prototype._createIcons;
+               prototype._createIcons = function() {
+                       if ( this.options.icons ) {
+                               this.options.icons.activeHeader = this.options.icons.activeHeader ||
+                                       this.options.icons.headerSelected;
+                       }
+                       _createIcons.call( this );
+               };
+       }( jQuery, jQuery.ui.accordion.prototype ) );
+
+       // expanded active option, activate method
+       (function( $, prototype ) {
+               prototype.activate = prototype._activate;
+
+               var _findActive = prototype._findActive;
+               prototype._findActive = function( index ) {
+                       if ( index === -1 ) {
+                               index = false;
+                       }
+                       if ( index && typeof index !== "number" ) {
+                               index = this.headers.index( this.headers.filter( index ) );
+                               if ( index === -1 ) {
+                                       index = false;
+                               }
+                       }
+                       return _findActive.call( this, index );
+               };
+       }( jQuery, jQuery.ui.accordion.prototype ) );
+
+       // resize method
+       jQuery.ui.accordion.prototype.resize = jQuery.ui.accordion.prototype.refresh;
+
+       // change events
+       (function( $, prototype ) {
+               $.extend( prototype.options, {
+                       change: null,
+                       changestart: null
+               });
+
+               var _trigger = prototype._trigger;
+               prototype._trigger = function( type, event, data ) {
+                       var ret = _trigger.apply( this, arguments );
+                       if ( !ret ) {
+                               return false;
+                       }
+
+                       if ( type === "beforeActivate" ) {
+                               ret = _trigger.call( this, "changestart", event, {
+                                       oldHeader: data.oldHeader,
+                                       oldContent: data.oldPanel,
+                                       newHeader: data.newHeader,
+                                       newContent: data.newPanel
+                               });
+                       } else if ( type === "activate" ) {
+                               ret = _trigger.call( this, "change", event, {
+                                       oldHeader: data.oldHeader,
+                                       oldContent: data.oldPanel,
+                                       newHeader: data.newHeader,
+                                       newContent: data.newPanel
+                               });
+                       }
+                       return ret;
+               };
+       }( jQuery, jQuery.ui.accordion.prototype ) );
+
+       // animated option
+       // NOTE: this only provides support for "slide", "bounceslide", and easings
+       // not the full $.ui.accordion.animations API
+       (function( $, prototype ) {
+               $.extend( prototype.options, {
+                       animate: null,
+                       animated: "slide"
+               });
+
+               var _create = prototype._create;
+               prototype._create = function() {
+                       var options = this.options;
+                       if ( options.animate === null ) {
+                               if ( !options.animated ) {
+                                       options.animate = false;
+                               } else if ( options.animated === "slide" ) {
+                                       options.animate = 300;
+                               } else if ( options.animated === "bounceslide" ) {
+                                       options.animate = {
+                                               duration: 200,
+                                               down: {
+                                                       easing: "easeOutBounce",
+                                                       duration: 1000
+                                               }
+                                       };
+                               } else {
+                                       options.animate = options.animated;
+                               }
+                       }
+
+                       _create.call( this );
+               };
+       }( jQuery, jQuery.ui.accordion.prototype ) );
+}
+
+})( jQuery );
+(function( $, undefined ) {
+
+// used to prevent race conditions with remote data sources
+var requestIndex = 0;
+
+$.widget( "ui.autocomplete", {
+       version: "1.9.2",
+       defaultElement: "<input>",
+       options: {
+               appendTo: "body",
+               autoFocus: false,
+               delay: 300,
+               minLength: 1,
+               position: {
+                       my: "left top",
+                       at: "left bottom",
+                       collision: "none"
+               },
+               source: null,
+
+               // callbacks
+               change: null,
+               close: null,
+               focus: null,
+               open: null,
+               response: null,
+               search: null,
+               select: null
+       },
+
+       pending: 0,
+
+       _create: function() {
+               // Some browsers only repeat keydown events, not keypress events,
+               // so we use the suppressKeyPress flag to determine if we've already
+               // handled the keydown event. #7269
+               // Unfortunately the code for & in keypress is the same as the up arrow,
+               // so we use the suppressKeyPressRepeat flag to avoid handling keypress
+               // events when we know the keydown event was used to modify the
+               // search term. #7799
+               var suppressKeyPress, suppressKeyPressRepeat, suppressInput;
+
+               this.isMultiLine = this._isMultiLine();
+               this.valueMethod = this.element[ this.element.is( "input,textarea" ) ? "val" : "text" ];
+               this.isNewMenu = true;
+
+               this.element
+                       .addClass( "ui-autocomplete-input" )
+                       .attr( "autocomplete", "off" );
+
+               this._on( this.element, {
+                       keydown: function( event ) {
+                               if ( this.element.prop( "readOnly" ) ) {
+                                       suppressKeyPress = true;
+                                       suppressInput = true;
+                                       suppressKeyPressRepeat = true;
+                                       return;
+                               }
+
+                               suppressKeyPress = false;
+                               suppressInput = false;
+                               suppressKeyPressRepeat = false;
+                               var keyCode = $.ui.keyCode;
+                               switch( event.keyCode ) {
+                               case keyCode.PAGE_UP:
+                                       suppressKeyPress = true;
+                                       this._move( "previousPage", event );
+                                       break;
+                               case keyCode.PAGE_DOWN:
+                                       suppressKeyPress = true;
+                                       this._move( "nextPage", event );
+                                       break;
+                               case keyCode.UP:
+                                       suppressKeyPress = true;
+                                       this._keyEvent( "previous", event );
+                                       break;
+                               case keyCode.DOWN:
+                                       suppressKeyPress = true;
+                                       this._keyEvent( "next", event );
+                                       break;
+                               case keyCode.ENTER:
+                               case keyCode.NUMPAD_ENTER:
+                                       // when menu is open and has focus
+                                       if ( this.menu.active ) {
+                                               // #6055 - Opera still allows the keypress to occur
+                                               // which causes forms to submit
+                                               suppressKeyPress = true;
+                                               event.preventDefault();
+                                               this.menu.select( event );
+                                       }
+                                       break;
+                               case keyCode.TAB:
+                                       if ( this.menu.active ) {
+                                               this.menu.select( event );
+                                       }
+                                       break;
+                               case keyCode.ESCAPE:
+                                       if ( this.menu.element.is( ":visible" ) ) {
+                                               this._value( this.term );
+                                               this.close( event );
+                                               // Different browsers have different default behavior for escape
+                                               // Single press can mean undo or clear
+                                               // Double press in IE means clear the whole form
+                                               event.preventDefault();
+                                       }
+                                       break;
+                               default:
+                                       suppressKeyPressRepeat = true;
+                                       // search timeout should be triggered before the input value is changed
+                                       this._searchTimeout( event );
+                                       break;
+                               }
+                       },
+                       keypress: function( event ) {
+                               if ( suppressKeyPress ) {
+                                       suppressKeyPress = false;
+                                       event.preventDefault();
+                                       return;
+                               }
+                               if ( suppressKeyPressRepeat ) {
+                                       return;
+                               }
+
+                               // replicate some key handlers to allow them to repeat in Firefox and Opera
+                               var keyCode = $.ui.keyCode;
+                               switch( event.keyCode ) {
+                               case keyCode.PAGE_UP:
+                                       this._move( "previousPage", event );
+                                       break;
+                               case keyCode.PAGE_DOWN:
+                                       this._move( "nextPage", event );
+                                       break;
+                               case keyCode.UP:
+                                       this._keyEvent( "previous", event );
+                                       break;
+                               case keyCode.DOWN:
+                                       this._keyEvent( "next", event );
+                                       break;
+                               }
+                       },
+                       input: function( event ) {
+                               if ( suppressInput ) {
+                                       suppressInput = false;
+                                       event.preventDefault();
+                                       return;
+                               }
+                               this._searchTimeout( event );
+                       },
+                       focus: function() {
+                               this.selectedItem = null;
+                               this.previous = this._value();
+                       },
+                       blur: function( event ) {
+                               if ( this.cancelBlur ) {
+                                       delete this.cancelBlur;
+                                       return;
+                               }
+
+                               clearTimeout( this.searching );
+                               this.close( event );
+                               this._change( event );
+                       }
+               });
+
+               this._initSource();
+               this.menu = $( "<ul>" )
+                       .addClass( "ui-autocomplete" )
+                       .appendTo( this.document.find( this.options.appendTo || "body" )[ 0 ] )
+                       .menu({
+                               // custom key handling for now
+                               input: $(),
+                               // disable ARIA support, the live region takes care of that
+                               role: null
+                       })
+                       .zIndex( this.element.zIndex() + 1 )
+                       .hide()
+                       .data( "menu" );
+
+               this._on( this.menu.element, {
+                       mousedown: function( event ) {
+                               // prevent moving focus out of the text field
+                               event.preventDefault();
+
+                               // IE doesn't prevent moving focus even with event.preventDefault()
+                               // so we set a flag to know when we should ignore the blur event
+                               this.cancelBlur = true;
+                               this._delay(function() {
+                                       delete this.cancelBlur;
+                               });
+
+                               // clicking on the scrollbar causes focus to shift to the body
+                               // but we can't detect a mouseup or a click immediately afterward
+                               // so we have to track the next mousedown and close the menu if
+                               // the user clicks somewhere outside of the autocomplete
+                               var menuElement = this.menu.element[ 0 ];
+                               if ( !$( event.target ).closest( ".ui-menu-item" ).length ) {
+                                       this._delay(function() {
+                                               var that = this;
+                                               this.document.one( "mousedown", function( event ) {
+                                                       if ( event.target !== that.element[ 0 ] &&
+                                                                       event.target !== menuElement &&
+                                                                       !$.contains( menuElement, event.target ) ) {
+                                                               that.close();
+                                                       }
+                                               });
+                                       });
+                               }
+                       },
+                       menufocus: function( event, ui ) {
+                               // #7024 - Prevent accidental activation of menu items in Firefox
+                               if ( this.isNewMenu ) {
+                                       this.isNewMenu = false;
+                                       if ( event.originalEvent && /^mouse/.test( event.originalEvent.type ) ) {
+                                               this.menu.blur();
+
+                                               this.document.one( "mousemove", function() {
+                                                       $( event.target ).trigger( event.originalEvent );
+                                               });
+
+                                               return;
+                                       }
+                               }
+
+                               // back compat for _renderItem using item.autocomplete, via #7810
+                               // TODO remove the fallback, see #8156
+                               var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" );
+                               if ( false !== this._trigger( "focus", event, { item: item } ) ) {
+                                       // use value to match what will end up in the input, if it was a key event
+                                       if ( event.originalEvent && /^key/.test( event.originalEvent.type ) ) {
+                                               this._value( item.value );
+                                       }
+                               } else {
+                                       // Normally the input is populated with the item's value as the
+                                       // menu is navigated, causing screen readers to notice a change and
+                                       // announce the item. Since the focus event was canceled, this doesn't
+                                       // happen, so we update the live region so that screen readers can
+                                       // still notice the change and announce it.
+                                       this.liveRegion.text( item.value );
+                               }
+                       },
+                       menuselect: function( event, ui ) {
+                               // back compat for _renderItem using item.autocomplete, via #7810
+                               // TODO remove the fallback, see #8156
+                               var item = ui.item.data( "ui-autocomplete-item" ) || ui.item.data( "item.autocomplete" ),
+                                       previous = this.previous;
+
+                               // only trigger when focus was lost (click on menu)
+                               if ( this.element[0] !== this.document[0].activeElement ) {
+                                       this.element.focus();
+                                       this.previous = previous;
+                                       // #6109 - IE triggers two focus events and the second
+                                       // is asynchronous, so we need to reset the previous
+                                       // term synchronously and asynchronously :-(
+                                       this._delay(function() {
+                                               this.previous = previous;
+                                               this.selectedItem = item;
+                                       });
+                               }
+
+                               if ( false !== this._trigger( "select", event, { item: item } ) ) {
+                                       this._value( item.value );
+                               }
+                               // reset the term after the select event
+                               // this allows custom select handling to work properly
+                               this.term = this._value();
+
+                               this.close( event );
+                               this.selectedItem = item;
+                       }
+               });
+
+               this.liveRegion = $( "<span>", {
+                               role: "status",
+                               "aria-live": "polite"
+                       })
+                       .addClass( "ui-helper-hidden-accessible" )
+                       .insertAfter( this.element );
+
+               if ( $.fn.bgiframe ) {
+                       this.menu.element.bgiframe();
+               }
+
+               // turning off autocomplete prevents the browser from remembering the
+               // value when navigating through history, so we re-enable autocomplete
+               // if the page is unloaded before the widget is destroyed. #7790
+               this._on( this.window, {
+                       beforeunload: function() {
+                               this.element.removeAttr( "autocomplete" );
+                       }
+               });
+       },
+
+       _destroy: function() {
+               clearTimeout( this.searching );
+               this.element
+                       .removeClass( "ui-autocomplete-input" )
+                       .removeAttr( "autocomplete" );
+               this.menu.element.remove();
+               this.liveRegion.remove();
+       },
+
+       _setOption: function( key, value ) {
+               this._super( key, value );
+               if ( key === "source" ) {
+                       this._initSource();
+               }
+               if ( key === "appendTo" ) {
+                       this.menu.element.appendTo( this.document.find( value || "body" )[0] );
+               }
+               if ( key === "disabled" && value && this.xhr ) {
+                       this.xhr.abort();
+               }
+       },
+
+       _isMultiLine: function() {
+               // Textareas are always multi-line
+               if ( this.element.is( "textarea" ) ) {
+                       return true;
+               }
+               // Inputs are always single-line, even if inside a contentEditable element
+               // IE also treats inputs as contentEditable
+               if ( this.element.is( "input" ) ) {
+                       return false;
+               }
+               // All other element types are determined by whether or not they're contentEditable
+               return this.element.prop( "isContentEditable" );
+       },
+
+       _initSource: function() {
+               var array, url,
+                       that = this;
+               if ( $.isArray(this.options.source) ) {
+                       array = this.options.source;
+                       this.source = function( request, response ) {
+                               response( $.ui.autocomplete.filter( array, request.term ) );
+                       };
+               } else if ( typeof this.options.source === "string" ) {
+                       url = this.options.source;
+                       this.source = function( request, response ) {
+                               if ( that.xhr ) {
+                                       that.xhr.abort();
+                               }
+                               that.xhr = $.ajax({
+                                       url: url,
+                                       data: request,
+                                       dataType: "json",
+                                       success: function( data ) {
+                                               response( data );
+                                       },
+                                       error: function() {
+                                               response( [] );
+                                       }
+                               });
+                       };
+               } else {
+                       this.source = this.options.source;
+               }
+       },
+
+       _searchTimeout: function( event ) {
+               clearTimeout( this.searching );
+               this.searching = this._delay(function() {
+                       // only search if the value has changed
+                       if ( this.term !== this._value() ) {
+                               this.selectedItem = null;
+                               this.search( null, event );
+                       }
+               }, this.options.delay );
+       },
+
+       search: function( value, event ) {
+               value = value != null ? value : this._value();
+
+               // always save the actual value, not the one passed as an argument
+               this.term = this._value();
+
+               if ( value.length < this.options.minLength ) {
+                       return this.close( event );
+               }
+
+               if ( this._trigger( "search", event ) === false ) {
+                       return;
+               }
+
+               return this._search( value );
+       },
+
+       _search: function( value ) {
+               this.pending++;
+               this.element.addClass( "ui-autocomplete-loading" );
+               this.cancelSearch = false;
+
+               this.source( { term: value }, this._response() );
+       },
+
+       _response: function() {
+               var that = this,
+                       index = ++requestIndex;
+
+               return function( content ) {
+                       if ( index === requestIndex ) {
+                               that.__response( content );
+                       }
+
+                       that.pending--;
+                       if ( !that.pending ) {
+                               that.element.removeClass( "ui-autocomplete-loading" );
+                       }
+               };
+       },
+
+       __response: function( content ) {
+               if ( content ) {
+                       content = this._normalize( content );
+               }
+               this._trigger( "response", null, { content: content } );
+               if ( !this.options.disabled && content && content.length && !this.cancelSearch ) {
+                       this._suggest( content );
+                       this._trigger( "open" );
+               } else {
+                       // use ._close() instead of .close() so we don't cancel future searches
+                       this._close();
+               }
+       },
+
+       close: function( event ) {
+               this.cancelSearch = true;
+               this._close( event );
+       },
+
+       _close: function( event ) {
+               if ( this.menu.element.is( ":visible" ) ) {
+                       this.menu.element.hide();
+                       this.menu.blur();
+                       this.isNewMenu = true;
+                       this._trigger( "close", event );
+               }
+       },
+
+       _change: function( event ) {
+               if ( this.previous !== this._value() ) {
+                       this._trigger( "change", event, { item: this.selectedItem } );
+               }
+       },
+
+       _normalize: function( items ) {
+               // assume all items have the right format when the first item is complete
+               if ( items.length && items[0].label && items[0].value ) {
+                       return items;
+               }
+               return $.map( items, function( item ) {
+                       if ( typeof item === "string" ) {
+                               return {
+                                       label: item,
+                                       value: item
+                               };
+                       }
+                       return $.extend({
+                               label: item.label || item.value,
+                               value: item.value || item.label
+                       }, item );
+               });
+       },
+
+       _suggest: function( items ) {
+               var ul = this.menu.element
+                       .empty()
+                       .zIndex( this.element.zIndex() + 1 );
+               this._renderMenu( ul, items );
+               this.menu.refresh();
+
+               // size and position menu
+               ul.show();
+               this._resizeMenu();
+               ul.position( $.extend({
+                       of: this.element
+               }, this.options.position ));
+
+               if ( this.options.autoFocus ) {
+                       this.menu.next();
+               }
+       },
+
+       _resizeMenu: function() {
+               var ul = this.menu.element;
+               ul.outerWidth( Math.max(
+                       // Firefox wraps long text (possibly a rounding bug)
+                       // so we add 1px to avoid the wrapping (#7513)
+                       ul.width( "" ).outerWidth() + 1,
+                       this.element.outerWidth()
+               ) );
+       },
+
+       _renderMenu: function( ul, items ) {
+               var that = this;
+               $.each( items, function( index, item ) {
+                       that._renderItemData( ul, item );
+               });
+       },
+
+       _renderItemData: function( ul, item ) {
+               return this._renderItem( ul, item ).data( "ui-autocomplete-item", item );
+       },
+
+       _renderItem: function( ul, item ) {
+               return $( "<li>" )
+                       .append( $( "<a>" ).text( item.label ) )
+                       .appendTo( ul );
+       },
+
+       _move: function( direction, event ) {
+               if ( !this.menu.element.is( ":visible" ) ) {
+                       this.search( null, event );
+                       return;
+               }
+               if ( this.menu.isFirstItem() && /^previous/.test( direction ) ||
+                               this.menu.isLastItem() && /^next/.test( direction ) ) {
+                       this._value( this.term );
+                       this.menu.blur();
+                       return;
+               }
+               this.menu[ direction ]( event );
+       },
+
+       widget: function() {
+               return this.menu.element;
+       },
+
+       _value: function() {
+               return this.valueMethod.apply( this.element, arguments );
+       },
+
+       _keyEvent: function( keyEvent, event ) {
+               if ( !this.isMultiLine || this.menu.element.is( ":visible" ) ) {
+                       this._move( keyEvent, event );
+
+                       // prevents moving cursor to beginning/end of the text field in some browsers
+                       event.preventDefault();
+               }
+       }
+});
+
+$.extend( $.ui.autocomplete, {
+       escapeRegex: function( value ) {
+               return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
+       },
+       filter: function(array, term) {
+               var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
+               return $.grep( array, function(value) {
+                       return matcher.test( value.label || value.value || value );
+               });
+       }
+});
+
+
+// live region extension, adding a `messages` option
+// NOTE: This is an experimental API. We are still investigating
+// a full solution for string manipulation and internationalization.
+$.widget( "ui.autocomplete", $.ui.autocomplete, {
+       options: {
+               messages: {
+                       noResults: "No search results.",
+                       results: function( amount ) {
+                               return amount + ( amount > 1 ? " results are" : " result is" ) +
+                                       " available, use up and down arrow keys to navigate.";
+                       }
+               }
+       },
+
+       __response: function( content ) {
+               var message;
+               this._superApply( arguments );
+               if ( this.options.disabled || this.cancelSearch ) {
+                       return;
+               }
+               if ( content && content.length ) {
+                       message = this.options.messages.results( content.length );
+               } else {
+                       message = this.options.messages.noResults;
+               }
+               this.liveRegion.text( message );
+       }
+});
+
+
+}( jQuery ));
+(function( $, undefined ) {
+
+var lastActive, startXPos, startYPos, clickDragged,
+       baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
+       stateClasses = "ui-state-hover ui-state-active ",
+       typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
+       formResetHandler = function() {
+               var buttons = $( this ).find( ":ui-button" );
+               setTimeout(function() {
+                       buttons.button( "refresh" );
+               }, 1 );
+       },
+       radioGroup = function( radio ) {
+               var name = radio.name,
+                       form = radio.form,
+                       radios = $( [] );
+               if ( name ) {
+                       if ( form ) {
+                               radios = $( form ).find( "[name='" + name + "']" );
+                       } else {
+                               radios = $( "[name='" + name + "']", radio.ownerDocument )
+                                       .filter(function() {
+                                               return !this.form;
+                                       });
+                       }
+               }
+               return radios;
+       };
+
+$.widget( "ui.button", {
+       version: "1.9.2",
+       defaultElement: "<button>",
+       options: {
+               disabled: null,
+               text: true,
+               label: null,
+               icons: {
+                       primary: null,
+                       secondary: null
+               }
+       },
+       _create: function() {
+               this.element.closest( "form" )
+                       .unbind( "reset" + this.eventNamespace )
+                       .bind( "reset" + this.eventNamespace, formResetHandler );
+
+               if ( typeof this.options.disabled !== "boolean" ) {
+                       this.options.disabled = !!this.element.prop( "disabled" );
+               } else {
+                       this.element.prop( "disabled", this.options.disabled );
+               }
+
+               this._determineButtonType();
+               this.hasTitle = !!this.buttonElement.attr( "title" );
+
+               var that = this,
+                       options = this.options,
+                       toggleButton = this.type === "checkbox" || this.type === "radio",
+                       activeClass = !toggleButton ? "ui-state-active" : "",
+                       focusClass = "ui-state-focus";
+
+               if ( options.label === null ) {
+                       options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html());
+               }
+
+               this._hoverable( this.buttonElement );
+
+               this.buttonElement
+                       .addClass( baseClasses )
+                       .attr( "role", "button" )
+                       .bind( "mouseenter" + this.eventNamespace, function() {
+                               if ( options.disabled ) {
+                                       return;
+                               }
+                               if ( this === lastActive ) {
+                                       $( this ).addClass( "ui-state-active" );
+                               }
+                       })
+                       .bind( "mouseleave" + this.eventNamespace, function() {
+                               if ( options.disabled ) {
+                                       return;
+                               }
+                               $( this ).removeClass( activeClass );
+                       })
+                       .bind( "click" + this.eventNamespace, function( event ) {
+                               if ( options.disabled ) {
+                                       event.preventDefault();
+                                       event.stopImmediatePropagation();
+                               }
+                       });
+
+               this.element
+                       .bind( "focus" + this.eventNamespace, function() {
+                               // no need to check disabled, focus won't be triggered anyway
+                               that.buttonElement.addClass( focusClass );
+                       })
+                       .bind( "blur" + this.eventNamespace, function() {
+                               that.buttonElement.removeClass( focusClass );
+                       });
+
+               if ( toggleButton ) {
+                       this.element.bind( "change" + this.eventNamespace, function() {
+                               if ( clickDragged ) {
+                                       return;
+                               }
+                               that.refresh();
+                       });
+                       // if mouse moves between mousedown and mouseup (drag) set clickDragged flag
+                       // prevents issue where button state changes but checkbox/radio checked state
+                       // does not in Firefox (see ticket #6970)
+                       this.buttonElement
+                               .bind( "mousedown" + this.eventNamespace, function( event ) {
+                                       if ( options.disabled ) {
+                                               return;
+                                       }
+                                       clickDragged = false;
+                                       startXPos = event.pageX;
+                                       startYPos = event.pageY;
+                               })
+                               .bind( "mouseup" + this.eventNamespace, function( event ) {
+                                       if ( options.disabled ) {
+                                               return;
+                                       }
+                                       if ( startXPos !== event.pageX || startYPos !== event.pageY ) {
+                                               clickDragged = true;
+                                       }
+                       });
+               }
+
+               if ( this.type === "checkbox" ) {
+                       this.buttonElement.bind( "click" + this.eventNamespace, function() {
+                               if ( options.disabled || clickDragged ) {
+                                       return false;
+                               }
+                               $( this ).toggleClass( "ui-state-active" );
+                               that.buttonElement.attr( "aria-pressed", that.element[0].checked );
+                       });
+               } else if ( this.type === "radio" ) {
+                       this.buttonElement.bind( "click" + this.eventNamespace, function() {
+                               if ( options.disabled || clickDragged ) {
+                                       return false;
+                               }
+                               $( this ).addClass( "ui-state-active" );
+                               that.buttonElement.attr( "aria-pressed", "true" );
+
+                               var radio = that.element[ 0 ];
+                               radioGroup( radio )
+                                       .not( radio )
+                                       .map(function() {
+                                               return $( this ).button( "widget" )[ 0 ];
+                                       })
+                                       .removeClass( "ui-state-active" )
+                                       .attr( "aria-pressed", "false" );
+                       });
+               } else {
+                       this.buttonElement
+                               .bind( "mousedown" + this.eventNamespace, function() {
+                                       if ( options.disabled ) {
+                                               return false;
+                                       }
+                                       $( this ).addClass( "ui-state-active" );
+                                       lastActive = this;
+                                       that.document.one( "mouseup", function() {
+                                               lastActive = null;
+                                       });
+                               })
+                               .bind( "mouseup" + this.eventNamespace, function() {
+                                       if ( options.disabled ) {
+                                               return false;
+                                       }
+                                       $( this ).removeClass( "ui-state-active" );
+                               })
+                               .bind( "keydown" + this.eventNamespace, function(event) {
+                                       if ( options.disabled ) {
+                                               return false;
+                                       }
+                                       if ( event.keyCode === $.ui.keyCode.SPACE || event.keyCode === $.ui.keyCode.ENTER ) {
+                                               $( this ).addClass( "ui-state-active" );
+                                       }
+                               })
+                               .bind( "keyup" + this.eventNamespace, function() {
+                                       $( this ).removeClass( "ui-state-active" );
+                               });
+
+                       if ( this.buttonElement.is("a") ) {
+                               this.buttonElement.keyup(function(event) {
+                                       if ( event.keyCode === $.ui.keyCode.SPACE ) {
+                                               // TODO pass through original event correctly (just as 2nd argument doesn't work)
+                                               $( this ).click();
+                                       }
+                               });
+                       }
+               }
+
+               // TODO: pull out $.Widget's handling for the disabled option into
+               // $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
+               // be overridden by individual plugins
+               this._setOption( "disabled", options.disabled );
+               this._resetButton();
+       },
+
+       _determineButtonType: function() {
+               var ancestor, labelSelector, checked;
+
+               if ( this.element.is("[type=checkbox]") ) {
+                       this.type = "checkbox";
+               } else if ( this.element.is("[type=radio]") ) {
+                       this.type = "radio";
+               } else if ( this.element.is("input") ) {
+                       this.type = "input";
+               } else {
+                       this.type = "button";
+               }
+
+               if ( this.type === "checkbox" || this.type === "radio" ) {
+                       // we don't search against the document in case the element
+                       // is disconnected from the DOM
+                       ancestor = this.element.parents().last();
+                       labelSelector = "label[for='" + this.element.attr("id") + "']";
+                       this.buttonElement = ancestor.find( labelSelector );
+                       if ( !this.buttonElement.length ) {
+                               ancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();
+                               this.buttonElement = ancestor.filter( labelSelector );
+                               if ( !this.buttonElement.length ) {
+                                       this.buttonElement = ancestor.find( labelSelector );
+                               }
+                       }
+                       this.element.addClass( "ui-helper-hidden-accessible" );
+
+                       checked = this.element.is( ":checked" );
+                       if ( checked ) {
+                               this.buttonElement.addClass( "ui-state-active" );
+                       }
+                       this.buttonElement.prop( "aria-pressed", checked );
+               } else {
+                       this.buttonElement = this.element;
+               }
+       },
+
+       widget: function() {
+               return this.buttonElement;
+       },
+
+       _destroy: function() {
+               this.element
+                       .removeClass( "ui-helper-hidden-accessible" );
+               this.buttonElement
+                       .removeClass( baseClasses + " " + stateClasses + " " + typeClasses )
+                       .removeAttr( "role" )
+                       .removeAttr( "aria-pressed" )
+                       .html( this.buttonElement.find(".ui-button-text").html() );
+
+               if ( !this.hasTitle ) {
+                       this.buttonElement.removeAttr( "title" );
+               }
+       },
+
+       _setOption: function( key, value ) {
+               this._super( key, value );
+               if ( key === "disabled" ) {
+                       if ( value ) {
+                               this.element.prop( "disabled", true );
+                       } else {
+                               this.element.prop( "disabled", false );
+                       }
+                       return;
+               }
+               this._resetButton();
+       },
+
+       refresh: function() {
+               //See #8237 & #8828
+               var isDisabled = this.element.is( "input, button" ) ? this.element.is( ":disabled" ) : this.element.hasClass( "ui-button-disabled" );
+
+               if ( isDisabled !== this.options.disabled ) {
+                       this._setOption( "disabled", isDisabled );
+               }
+               if ( this.type === "radio" ) {
+                       radioGroup( this.element[0] ).each(function() {
+                               if ( $( this ).is( ":checked" ) ) {
+                                       $( this ).button( "widget" )
+                                               .addClass( "ui-state-active" )
+                                               .attr( "aria-pressed", "true" );
+                               } else {
+                                       $( this ).button( "widget" )
+                                               .removeClass( "ui-state-active" )
+                                               .attr( "aria-pressed", "false" );
+                               }
+                       });
+               } else if ( this.type === "checkbox" ) {
+                       if ( this.element.is( ":checked" ) ) {
+                               this.buttonElement
+                                       .addClass( "ui-state-active" )
+                                       .attr( "aria-pressed", "true" );
+                       } else {
+                               this.buttonElement
+                                       .removeClass( "ui-state-active" )
+                                       .attr( "aria-pressed", "false" );
+                       }
+               }
+       },
+
+       _resetButton: function() {
+               if ( this.type === "input" ) {
+                       if ( this.options.label ) {
+                               this.element.val( this.options.label );
+                       }
+                       return;
+               }
+               var buttonElement = this.buttonElement.removeClass( typeClasses ),
+                       buttonText = $( "<span></span>", this.document[0] )
+                               .addClass( "ui-button-text" )
+                               .html( this.options.label )
+                               .appendTo( buttonElement.empty() )
+                               .text(),
+                       icons = this.options.icons,
+                       multipleIcons = icons.primary && icons.secondary,
+                       buttonClasses = [];
+
+               if ( icons.primary || icons.secondary ) {
+                       if ( this.options.text ) {
+                               buttonClasses.push( "ui-button-text-icon" + ( multipleIcons ? "s" : ( icons.primary ? "-primary" : "-secondary" ) ) );
+                       }
+
+                       if ( icons.primary ) {
+                               buttonElement.prepend( "<span class='ui-button-icon-primary ui-icon " + icons.primary + "'></span>" );
+                       }
+
+                       if ( icons.secondary ) {
+                               buttonElement.append( "<span class='ui-button-icon-secondary ui-icon " + icons.secondary + "'></span>" );
+                       }
+
+                       if ( !this.options.text ) {
+                               buttonClasses.push( multipleIcons ? "ui-button-icons-only" : "ui-button-icon-only" );
+
+                               if ( !this.hasTitle ) {
+                                       buttonElement.attr( "title", $.trim( buttonText ) );
+                               }
+                       }
+               } else {
+                       buttonClasses.push( "ui-button-text-only" );
+               }
+               buttonElement.addClass( buttonClasses.join( " " ) );
+       }
+});
+
+$.widget( "ui.buttonset", {
+       version: "1.9.2",
+       options: {
+               items: "button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(button)"
+       },
+
+       _create: function() {
+               this.element.addClass( "ui-buttonset" );
+       },
+
+       _init: function() {
+               this.refresh();
+       },
+
+       _setOption: function( key, value ) {
+               if ( key === "disabled" ) {
+                       this.buttons.button( "option", key, value );
+               }
+
+               this._super( key, value );
+       },
+
+       refresh: function() {
+               var rtl = this.element.css( "direction" ) === "rtl";
+
+               this.buttons = this.element.find( this.options.items )
+                       .filter( ":ui-button" )
+                               .button( "refresh" )
+                       .end()
+                       .not( ":ui-button" )
+                               .button()
+                       .end()
+                       .map(function() {
+                               return $( this ).button( "widget" )[ 0 ];
+                       })
+                               .removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
+                               .filter( ":first" )
+                                       .addClass( rtl ? "ui-corner-right" : "ui-corner-left" )
+                               .end()
+                               .filter( ":last" )
+                                       .addClass( rtl ? "ui-corner-left" : "ui-corner-right" )
+                               .end()
+                       .end();
+       },
+
+       _destroy: function() {
+               this.element.removeClass( "ui-buttonset" );
+               this.buttons
+                       .map(function() {
+                               return $( this ).button( "widget" )[ 0 ];
+                       })
+                               .removeClass( "ui-corner-left ui-corner-right" )
+                       .end()
+                       .button( "destroy" );
+       }
+});
+
+}( jQuery ) );
+(function( $, undefined ) {
+
+$.extend($.ui, { datepicker: { version: "1.9.2" } });
+
+var PROP_NAME = 'datepicker';
+var dpuuid = new Date().getTime();
+var instActive;
+
+/* Date picker manager.
+   Use the singleton instance of this class, $.datepicker, to interact with the date picker.
+   Settings for (groups of) date pickers are maintained in an instance object,
+   allowing multiple different settings on the same page. */
+
+function Datepicker() {
+       this.debug = false; // Change this to true to start debugging
+       this._curInst = null; // The current instance in use
+       this._keyEvent = false; // If the last event was a key event
+       this._disabledInputs = []; // List of date picker inputs that have been disabled
+       this._datepickerShowing = false; // True if the popup picker is showing , false if not
+       this._inDialog = false; // True if showing within a "dialog", false if not
+       this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
+       this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
+       this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
+       this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
+       this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
+       this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
+       this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
+       this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
+       this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
+       this.regional = []; // Available regional settings, indexed by language code
+       this.regional[''] = { // Default regional settings
+               closeText: 'Done', // Display text for close link
+               prevText: 'Prev', // Display text for previous month link
+               nextText: 'Next', // Display text for next month link
+               currentText: 'Today', // Display text for current month link
+               monthNames: ['January','February','March','April','May','June',
+                       'July','August','September','October','November','December'], // Names of months for drop-down and formatting
+               monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
+               dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
+               dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
+               dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
+               weekHeader: 'Wk', // Column header for week of the year
+               dateFormat: 'mm/dd/yy', // See format options on parseDate
+               firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
+               isRTL: false, // True if right-to-left language, false if left-to-right
+               showMonthAfterYear: false, // True if the year select precedes month, false for month then year
+               yearSuffix: '' // Additional text to append to the year in the month headers
+       };
+       this._defaults = { // Global defaults for all the date picker instances
+               showOn: 'focus', // 'focus' for popup on focus,
+                       // 'button' for trigger button, or 'both' for either
+               showAnim: 'fadeIn', // Name of jQuery animation for popup
+               showOptions: {}, // Options for enhanced animations
+               defaultDate: null, // Used when field is blank: actual date,
+                       // +/-number for offset from today, null for today
+               appendText: '', // Display text following the input box, e.g. showing the format
+               buttonText: '...', // Text for trigger button
+               buttonImage: '', // URL for trigger button image
+               buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
+               hideIfNoPrevNext: false, // True to hide next/previous month links
+                       // if not applicable, false to just disable them
+               navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
+               gotoCurrent: false, // True if today link goes back to current selection instead
+               changeMonth: false, // True if month can be selected directly, false if only prev/next
+               changeYear: false, // True if year can be selected directly, false if only prev/next
+               yearRange: 'c-10:c+10', // Range of years to display in drop-down,
+                       // either relative to today's year (-nn:+nn), relative to currently displayed year
+                       // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
+               showOtherMonths: false, // True to show dates in other months, false to leave blank
+               selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
+               showWeek: false, // True to show week of the year, false to not show it
+               calculateWeek: this.iso8601Week, // How to calculate the week of the year,
+                       // takes a Date and returns the number of the week for it
+               shortYearCutoff: '+10', // Short year values < this are in the current century,
+                       // > this are in the previous century,
+                       // string value starting with '+' for current year + value
+               minDate: null, // The earliest selectable date, or null for no limit
+               maxDate: null, // The latest selectable date, or null for no limit
+               duration: 'fast', // Duration of display/closure
+               beforeShowDay: null, // Function that takes a date and returns an array with
+                       // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
+                       // [2] = cell title (optional), e.g. $.datepicker.noWeekends
+               beforeShow: null, // Function that takes an input field and
+                       // returns a set of custom settings for the date picker
+               onSelect: null, // Define a callback function when a date is selected
+               onChangeMonthYear: null, // Define a callback function when the month or year is changed
+               onClose: null, // Define a callback function when the datepicker is closed
+               numberOfMonths: 1, // Number of months to show at a time
+               showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
+               stepMonths: 1, // Number of months to step back/forward
+               stepBigMonths: 12, // Number of months to step back/forward for the big links
+               altField: '', // Selector for an alternate field to store selected dates into
+               altFormat: '', // The date format to use for the alternate field
+               constrainInput: true, // The input is constrained by the current date format
+               showButtonPanel: false, // True to show button panel, false to not show it
+               autoSize: false, // True to size the input for the date format, false to leave as is
+               disabled: false // The initial disabled state
+       };
+       $.extend(this._defaults, this.regional['']);
+       this.dpDiv = bindHover($('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'));
+}
+
+$.extend(Datepicker.prototype, {
+       /* Class name added to elements to indicate already configured with a date picker. */
+       markerClassName: 'hasDatepicker',
+
+       //Keep track of the maximum number of rows displayed (see #7043)
+       maxRows: 4,
+
+       /* Debug logging (if enabled). */
+       log: function () {
+               if (this.debug)
+                       console.log.apply('', arguments);
+       },
+
+       // TODO rename to "widget" when switching to widget factory
+       _widgetDatepicker: function() {
+               return this.dpDiv;
+       },
+
+       /* Override the default settings for all instances of the date picker.
+          @param  settings  object - the new settings to use as defaults (anonymous object)
+          @return the manager object */
+       setDefaults: function(settings) {
+               extendRemove(this._defaults, settings || {});
+               return this;
+       },
+
+       /* Attach the date picker to a jQuery selection.
+          @param  target    element - the target input field or division or span
+          @param  settings  object - the new settings to use for this date picker instance (anonymous) */
+       _attachDatepicker: function(target, settings) {
+               // check for settings on the control itself - in namespace 'date:'
+               var inlineSettings = null;
+               for (var attrName in this._defaults) {
+                       var attrValue = target.getAttribute('date:' + attrName);
+                       if (attrValue) {
+                               inlineSettings = inlineSettings || {};
+                               try {
+                                       inlineSettings[attrName] = eval(attrValue);
+                               } catch (err) {
+                                       inlineSettings[attrName] = attrValue;
+                               }
+                       }
+               }
+               var nodeName = target.nodeName.toLowerCase();
+               var inline = (nodeName == 'div' || nodeName == 'span');
+               if (!target.id) {
+                       this.uuid += 1;
+                       target.id = 'dp' + this.uuid;
+               }
+               var inst = this._newInst($(target), inline);
+               inst.settings = $.extend({}, settings || {}, inlineSettings || {});
+               if (nodeName == 'input') {
+                       this._connectDatepicker(target, inst);
+               } else if (inline) {
+                       this._inlineDatepicker(target, inst);
+               }
+       },
+
+       /* Create a new instance object. */
+       _newInst: function(target, inline) {
+               var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars
+               return {id: id, input: target, // associated target
+                       selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
+                       drawMonth: 0, drawYear: 0, // month being drawn
+                       inline: inline, // is datepicker inline or not
+                       dpDiv: (!inline ? this.dpDiv : // presentation div
+                       bindHover($('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')))};
+       },
+
+       /* Attach the date picker to an input field. */
+       _connectDatepicker: function(target, inst) {
+               var input = $(target);
+               inst.append = $([]);
+               inst.trigger = $([]);
+               if (input.hasClass(this.markerClassName))
+                       return;
+               this._attachments(input, inst);
+               input.addClass(this.markerClassName).keydown(this._doKeyDown).
+                       keypress(this._doKeyPress).keyup(this._doKeyUp).
+                       bind("setData.datepicker", function(event, key, value) {
+                               inst.settings[key] = value;
+                       }).bind("getData.datepicker", function(event, key) {
+                               return this._get(inst, key);
+                       });
+               this._autoSize(inst);
+               $.data(target, PROP_NAME, inst);
+               //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)
+               if( inst.settings.disabled ) {
+                       this._disableDatepicker( target );
+               }
+       },
+
+       /* Make attachments based on settings. */
+       _attachments: function(input, inst) {
+               var appendText = this._get(inst, 'appendText');
+               var isRTL = this._get(inst, 'isRTL');
+               if (inst.append)
+                       inst.append.remove();
+               if (appendText) {
+                       inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
+                       input[isRTL ? 'before' : 'after'](inst.append);
+               }
+               input.unbind('focus', this._showDatepicker);
+               if (inst.trigger)
+                       inst.trigger.remove();
+               var showOn = this._get(inst, 'showOn');
+               if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
+                       input.focus(this._showDatepicker);
+               if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
+                       var buttonText = this._get(inst, 'buttonText');
+                       var buttonImage = this._get(inst, 'buttonImage');
+                       inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
+                               $('<img/>').addClass(this._triggerClass).
+                                       attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
+                               $('<button type="button"></button>').addClass(this._triggerClass).
+                                       html(buttonImage == '' ? buttonText : $('<img/>').attr(
+                                       { src:buttonImage, alt:buttonText, title:buttonText })));
+                       input[isRTL ? 'before' : 'after'](inst.trigger);
+                       inst.trigger.click(function() {
+                               if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
+                                       $.datepicker._hideDatepicker();
+                               else if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) {
+                                       $.datepicker._hideDatepicker();
+                                       $.datepicker._showDatepicker(input[0]);
+                               } else
+                                       $.datepicker._showDatepicker(input[0]);
+                               return false;
+                       });
+               }
+       },
+
+       /* Apply the maximum length for the date format. */
+       _autoSize: function(inst) {
+               if (this._get(inst, 'autoSize') && !inst.inline) {
+                       var date = new Date(2009, 12 - 1, 20); // Ensure double digits
+                       var dateFormat = this._get(inst, 'dateFormat');
+                       if (dateFormat.match(/[DM]/)) {
+                               var findMax = function(names) {
+                                       var max = 0;
+                                       var maxI = 0;
+                                       for (var i = 0; i < names.length; i++) {
+                                               if (names[i].length > max) {
+                                                       max = names[i].length;
+                                                       maxI = i;
+                                               }
+                                       }
+                                       return maxI;
+                               };
+                               date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
+                                       'monthNames' : 'monthNamesShort'))));
+                               date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
+                                       'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());
+                       }
+                       inst.input.attr('size', this._formatDate(inst, date).length);
+               }
+       },
+
+       /* Attach an inline date picker to a div. */
+       _inlineDatepicker: function(target, inst) {
+               var divSpan = $(target);
+               if (divSpan.hasClass(this.markerClassName))
+                       return;
+               divSpan.addClass(this.markerClassName).append(inst.dpDiv).
+                       bind("setData.datepicker", function(event, key, value){
+                               inst.settings[key] = value;
+                       }).bind("getData.datepicker", function(event, key){
+                               return this._get(inst, key);
+                       });
+               $.data(target, PROP_NAME, inst);
+               this._setDate(inst, this._getDefaultDate(inst), true);
+               this._updateDatepicker(inst);
+               this._updateAlternate(inst);
+               //If disabled option is true, disable the datepicker before showing it (see ticket #5665)
+               if( inst.settings.disabled ) {
+                       this._disableDatepicker( target );
+               }
+               // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements
+               // http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height
+               inst.dpDiv.css( "display", "block" );
+       },
+
+       /* Pop-up the date picker in a "dialog" box.
+          @param  input     element - ignored
+          @param  date      string or Date - the initial date to display
+          @param  onSelect  function - the function to call when a date is selected
+          @param  settings  object - update the dialog date picker instance's settings (anonymous object)
+          @param  pos       int[2] - coordinates for the dialog's position within the screen or
+                            event - with x/y coordinates or
+                            leave empty for default (screen centre)
+          @return the manager object */
+       _dialogDatepicker: function(input, date, onSelect, settings, pos) {
+               var inst = this._dialogInst; // internal instance
+               if (!inst) {
+                       this.uuid += 1;
+                       var id = 'dp' + this.uuid;
+                       this._dialogInput = $('<input type="text" id="' + id +
+                               '" style="position: absolute; top: -100px; width: 0px;"/>');
+                       this._dialogInput.keydown(this._doKeyDown);
+                       $('body').append(this._dialogInput);
+                       inst = this._dialogInst = this._newInst(this._dialogInput, false);
+                       inst.settings = {};
+                       $.data(this._dialogInput[0], PROP_NAME, inst);
+               }
+               extendRemove(inst.settings, settings || {});
+               date = (date && date.constructor == Date ? this._formatDate(inst, date) : date);
+               this._dialogInput.val(date);
+
+               this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
+               if (!this._pos) {
+                       var browserWidth = document.documentElement.clientWidth;
+                       var browserHeight = document.documentElement.clientHeight;
+                       var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
+                       var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
+                       this._pos = // should use actual width/height below
+                               [(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
+               }
+
+               // move input on screen for focus, but hidden behind dialog
+               this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');
+               inst.settings.onSelect = onSelect;
+               this._inDialog = true;
+               this.dpDiv.addClass(this._dialogClass);
+               this._showDatepicker(this._dialogInput[0]);
+               if ($.blockUI)
+                       $.blockUI(this.dpDiv);
+               $.data(this._dialogInput[0], PROP_NAME, inst);
+               return this;
+       },
+
+       /* Detach a datepicker from its control.
+          @param  target    element - the target input field or division or span */
+       _destroyDatepicker: function(target) {
+               var $target = $(target);
+               var inst = $.data(target, PROP_NAME);
+               if (!$target.hasClass(this.markerClassName)) {
+                       return;
+               }
+               var nodeName = target.nodeName.toLowerCase();
+               $.removeData(target, PROP_NAME);
+               if (nodeName == 'input') {
+                       inst.append.remove();
+                       inst.trigger.remove();
+                       $target.removeClass(this.markerClassName).
+                               unbind('focus', this._showDatepicker).
+                               unbind('keydown', this._doKeyDown).
+                               unbind('keypress', this._doKeyPress).
+                               unbind('keyup', this._doKeyUp);
+               } else if (nodeName == 'div' || nodeName == 'span')
+                       $target.removeClass(this.markerClassName).empty();
+       },
+
+       /* Enable the date picker to a jQuery selection.
+          @param  target    element - the target input field or division or span */
+       _enableDatepicker: function(target) {
+               var $target = $(target);
+               var inst = $.data(target, PROP_NAME);
+               if (!$target.hasClass(this.markerClassName)) {
+                       return;
+               }
+               var nodeName = target.nodeName.toLowerCase();
+               if (nodeName == 'input') {
+                       target.disabled = false;
+                       inst.trigger.filter('button').
+                               each(function() { this.disabled = false; }).end().
+                               filter('img').css({opacity: '1.0', cursor: ''});
+               }
+               else if (nodeName == 'div' || nodeName == 'span') {
+                       var inline = $target.children('.' + this._inlineClass);
+                       inline.children().removeClass('ui-state-disabled');
+                       inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
+                               prop("disabled", false);
+               }
+               this._disabledInputs = $.map(this._disabledInputs,
+                       function(value) { return (value == target ? null : value); }); // delete entry
+       },
+
+       /* Disable the date picker to a jQuery selection.
+          @param  target    element - the target input field or division or span */
+       _disableDatepicker: function(target) {
+               var $target = $(target);
+               var inst = $.data(target, PROP_NAME);
+               if (!$target.hasClass(this.markerClassName)) {
+                       return;
+               }
+               var nodeName = target.nodeName.toLowerCase();
+               if (nodeName == 'input') {
+                       target.disabled = true;
+                       inst.trigger.filter('button').
+                               each(function() { this.disabled = true; }).end().
+                               filter('img').css({opacity: '0.5', cursor: 'default'});
+               }
+               else if (nodeName == 'div' || nodeName == 'span') {
+                       var inline = $target.children('.' + this._inlineClass);
+                       inline.children().addClass('ui-state-disabled');
+                       inline.find("select.ui-datepicker-month, select.ui-datepicker-year").
+                               prop("disabled", true);
+               }
+               this._disabledInputs = $.map(this._disabledInputs,
+                       function(value) { return (value == target ? null : value); }); // delete entry
+               this._disabledInputs[this._disabledInputs.length] = target;
+       },
+
+       /* Is the first field in a jQuery collection disabled as a datepicker?
+          @param  target    element - the target input field or division or span
+          @return boolean - true if disabled, false if enabled */
+       _isDisabledDatepicker: function(target) {
+               if (!target) {
+                       return false;
+               }
+               for (var i = 0; i < this._disabledInputs.length; i++) {
+                       if (this._disabledInputs[i] == target)
+                               return true;
+               }
+               return false;
+       },
+
+       /* Retrieve the instance data for the target control.
+          @param  target  element - the target input field or division or span
+          @return  object - the associated instance data
+          @throws  error if a jQuery problem getting data */
+       _getInst: function(target) {
+               try {
+                       return $.data(target, PROP_NAME);
+               }
+               catch (err) {
+                       throw 'Missing instance data for this datepicker';
+               }
+       },
+
+       /* Update or retrieve the settings for a date picker attached to an input field or division.
+          @param  target  element - the target input field or division or span
+          @param  name    object - the new settings to update or
+                          string - the name of the setting to change or retrieve,
+                          when retrieving also 'all' for all instance settings or
+                          'defaults' for all global defaults
+          @param  value   any - the new value for the setting
+                          (omit if above is an object or to retrieve a value) */
+       _optionDatepicker: function(target, name, value) {
+               var inst = this._getInst(target);
+               if (arguments.length == 2 && typeof name == 'string') {
+                       return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
+                               (inst ? (name == 'all' ? $.extend({}, inst.settings) :
+                               this._get(inst, name)) : null));
+               }
+               var settings = name || {};
+               if (typeof name == 'string') {
+                       settings = {};
+                       settings[name] = value;
+               }
+               if (inst) {
+                       if (this._curInst == inst) {
+                               this._hideDatepicker();
+                       }
+                       var date = this._getDateDatepicker(target, true);
+                       var minDate = this._getMinMaxDate(inst, 'min');
+                       var maxDate = this._getMinMaxDate(inst, 'max');
+                       extendRemove(inst.settings, settings);
+                       // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
+                       if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined)
+                               inst.settings.minDate = this._formatDate(inst, minDate);
+                       if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined)
+                               inst.settings.maxDate = this._formatDate(inst, maxDate);
+                       this._attachments($(target), inst);
+                       this._autoSize(inst);
+                       this._setDate(inst, date);
+                       this._updateAlternate(inst);
+                       this._updateDatepicker(inst);
+               }
+       },
+
+       // change method deprecated
+       _changeDatepicker: function(target, name, value) {
+               this._optionDatepicker(target, name, value);
+       },
+
+       /* Redraw the date picker attached to an input field or division.
+          @param  target  element - the target input field or division or span */
+       _refreshDatepicker: function(target) {
+               var inst = this._getInst(target);
+               if (inst) {
+                       this._updateDatepicker(inst);
+               }
+       },
+
+       /* Set the dates for a jQuery selection.
+          @param  target   element - the target input field or division or span
+          @param  date     Date - the new date */
+       _setDateDatepicker: function(target, date) {
+               var inst = this._getInst(target);
+               if (inst) {
+                       this._setDate(inst, date);
+                       this._updateDatepicker(inst);
+                       this._updateAlternate(inst);
+               }
+       },
+
+       /* Get the date(s) for the first entry in a jQuery selection.
+          @param  target     element - the target input field or division or span
+          @param  noDefault  boolean - true if no default date is to be used
+          @return Date - the current date */
+       _getDateDatepicker: function(target, noDefault) {
+               var inst = this._getInst(target);
+               if (inst && !inst.inline)
+                       this._setDateFromField(inst, noDefault);
+               return (inst ? this._getDate(inst) : null);
+       },
+
+       /* Handle keystrokes. */
+       _doKeyDown: function(event) {
+               var inst = $.datepicker._getInst(event.target);
+               var handled = true;
+               var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
+               inst._keyEvent = true;
+               if ($.datepicker._datepickerShowing)
+                       switch (event.keyCode) {
+                               case 9: $.datepicker._hideDatepicker();
+                                               handled = false;
+                                               break; // hide on tab out
+                               case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
+                                                                       $.datepicker._currentClass + ')', inst.dpDiv);
+                                               if (sel[0])
+                                                       $.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
+                                                       var onSelect = $.datepicker._get(inst, 'onSelect');
+                                                       if (onSelect) {
+                                                               var dateStr = $.datepicker._formatDate(inst);
+
+                                                               // trigger custom callback
+                                                               onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);
+                                                       }
+                                               else
+                                                       $.datepicker._hideDatepicker();
+                                               return false; // don't submit the form
+                                               break; // select the value on enter
+                               case 27: $.datepicker._hideDatepicker();
+                                               break; // hide on escape
+                               case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+                                                       -$.datepicker._get(inst, 'stepBigMonths') :
+                                                       -$.datepicker._get(inst, 'stepMonths')), 'M');
+                                               break; // previous month/year on page up/+ ctrl
+                               case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+                                                       +$.datepicker._get(inst, 'stepBigMonths') :
+                                                       +$.datepicker._get(inst, 'stepMonths')), 'M');
+                                               break; // next month/year on page down/+ ctrl
+                               case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
+                                               handled = event.ctrlKey || event.metaKey;
+                                               break; // clear on ctrl or command +end
+                               case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
+                                               handled = event.ctrlKey || event.metaKey;
+                                               break; // current on ctrl or command +home
+                               case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
+                                               handled = event.ctrlKey || event.metaKey;
+                                               // -1 day on ctrl or command +left
+                                               if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+                                                                       -$.datepicker._get(inst, 'stepBigMonths') :
+                                                                       -$.datepicker._get(inst, 'stepMonths')), 'M');
+                                               // next month/year on alt +left on Mac
+                                               break;
+                               case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
+                                               handled = event.ctrlKey || event.metaKey;
+                                               break; // -1 week on ctrl or command +up
+                               case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
+                                               handled = event.ctrlKey || event.metaKey;
+                                               // +1 day on ctrl or command +right
+                                               if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
+                                                                       +$.datepicker._get(inst, 'stepBigMonths') :
+                                                                       +$.datepicker._get(inst, 'stepMonths')), 'M');
+                                               // next month/year on alt +right
+                                               break;
+                               case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
+                                               handled = event.ctrlKey || event.metaKey;
+                                               break; // +1 week on ctrl or command +down
+                               default: handled = false;
+                       }
+               else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
+                       $.datepicker._showDatepicker(this);
+               else {
+                       handled = false;
+               }
+               if (handled) {
+                       event.preventDefault();
+                       event.stopPropagation();
+               }
+       },
+
+       /* Filter entered characters - based on date format. */
+       _doKeyPress: function(event) {
+               var inst = $.datepicker._getInst(event.target);
+               if ($.datepicker._get(inst, 'constrainInput')) {
+                       var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
+                       var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
+                       return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
+               }
+       },
+
+       /* Synchronise manual entry and field/alternate field. */
+       _doKeyUp: function(event) {
+               var inst = $.datepicker._getInst(event.target);
+               if (inst.input.val() != inst.lastVal) {
+                       try {
+                               var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
+                                       (inst.input ? inst.input.val() : null),
+                                       $.datepicker._getFormatConfig(inst));
+                               if (date) { // only if valid
+                                       $.datepicker._setDateFromField(inst);
+                                       $.datepicker._updateAlternate(inst);
+                                       $.datepicker._updateDatepicker(inst);
+                               }
+                       }
+                       catch (err) {
+                               $.datepicker.log(err);
+                       }
+               }
+               return true;
+       },
+
+       /* Pop-up the date picker for a given input field.
+          If false returned from beforeShow event handler do not show.
+          @param  input  element - the input field attached to the date picker or
+                         event - if triggered by focus */
+       _showDatepicker: function(input) {
+               input = input.target || input;
+               if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
+                       input = $('input', input.parentNode)[0];
+               if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
+                       return;
+               var inst = $.datepicker._getInst(input);
+               if ($.datepicker._curInst && $.datepicker._curInst != inst) {
+                       $.datepicker._curInst.dpDiv.stop(true, true);
+                       if ( inst && $.datepicker._datepickerShowing ) {
+                               $.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );
+                       }
+               }
+               var beforeShow = $.datepicker._get(inst, 'beforeShow');
+               var beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};
+               if(beforeShowSettings === false){
+                       //false
+                       return;
+               }
+               extendRemove(inst.settings, beforeShowSettings);
+               inst.lastVal = null;
+               $.datepicker._lastInput = input;
+               $.datepicker._setDateFromField(inst);
+               if ($.datepicker._inDialog) // hide cursor
+                       input.value = '';
+               if (!$.datepicker._pos) { // position below input
+                       $.datepicker._pos = $.datepicker._findPos(input);
+                       $.datepicker._pos[1] += input.offsetHeight; // add the height
+               }
+               var isFixed = false;
+               $(input).parents().each(function() {
+                       isFixed |= $(this).css('position') == 'fixed';
+                       return !isFixed;
+               });
+               var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
+               $.datepicker._pos = null;
+               //to avoid flashes on Firefox
+               inst.dpDiv.empty();
+               // determine sizing offscreen
+               inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
+               $.datepicker._updateDatepicker(inst);
+               // fix width for dynamic number of date pickers
+               // and adjust position before showing
+               offset = $.datepicker._checkOffset(inst, offset, isFixed);
+               inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
+                       'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
+                       left: offset.left + 'px', top: offset.top + 'px'});
+               if (!inst.inline) {
+                       var showAnim = $.datepicker._get(inst, 'showAnim');
+                       var duration = $.datepicker._get(inst, 'duration');
+                       var postProcess = function() {
+                               var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
+                               if( !! cover.length ){
+                                       var borders = $.datepicker._getBorders(inst.dpDiv);
+                                       cover.css({left: -borders[0], top: -borders[1],
+                                               width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
+                               }
+                       };
+                       inst.dpDiv.zIndex($(input).zIndex()+1);
+                       $.datepicker._datepickerShowing = true;
+
+                       // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
+                       if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) )
+                               inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
+                       else
+                               inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
+                       if (!showAnim || !duration)
+                               postProcess();
+                       if (inst.input.is(':visible') && !inst.input.is(':disabled'))
+                               inst.input.focus();
+                       $.datepicker._curInst = inst;
+               }
+       },
+
+       /* Generate the date picker content. */
+       _updateDatepicker: function(inst) {
+               this.maxRows = 4; //Reset the max number of rows being displayed (see #7043)
+               var borders = $.datepicker._getBorders(inst.dpDiv);
+               instActive = inst; // for delegate hover events
+               inst.dpDiv.empty().append(this._generateHTML(inst));
+               this._attachHandlers(inst);
+               var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
+               if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6
+                       cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
+               }
+               inst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover();
+               var numMonths = this._getNumberOfMonths(inst);
+               var cols = numMonths[1];
+               var width = 17;
+               inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
+               if (cols > 1)
+                       inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
+               inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
+                       'Class']('ui-datepicker-multi');
+               inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
+                       'Class']('ui-datepicker-rtl');
+               if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
+                               // #6694 - don't focus the input if it's already focused
+                               // this breaks the change event in IE
+                               inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)
+                       inst.input.focus();
+               // deffered render of the years select (to avoid flashes on Firefox)
+               if( inst.yearshtml ){
+                       var origyearshtml = inst.yearshtml;
+                       setTimeout(function(){
+                               //assure that inst.yearshtml didn't change.
+                               if( origyearshtml === inst.yearshtml && inst.yearshtml ){
+                                       inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml);
+                               }
+                               origyearshtml = inst.yearshtml = null;
+                       }, 0);
+               }
+       },
+
+       /* Retrieve the size of left and top borders for an element.
+          @param  elem  (jQuery object) the element of interest
+          @return  (number[2]) the left and top borders */
+       _getBorders: function(elem) {
+               var convert = function(value) {
+                       return {thin: 1, medium: 2, thick: 3}[value] || value;
+               };
+               return [parseFloat(convert(elem.css('border-left-width'))),
+                       parseFloat(convert(elem.css('border-top-width')))];
+       },
+
+       /* Check positioning to remain on screen. */
+       _checkOffset: function(inst, offset, isFixed) {
+               var dpWidth = inst.dpDiv.outerWidth();
+               var dpHeight = inst.dpDiv.outerHeight();
+               var inputWidth = inst.input ? inst.input.outerWidth() : 0;
+               var inputHeight = inst.input ? inst.input.outerHeight() : 0;
+               var viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft());
+               var viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());
+
+               offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
+               offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
+               offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
+
+               // now check if datepicker is showing outside window viewport - move to a better place if so.
+               offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
+                       Math.abs(offset.left + dpWidth - viewWidth) : 0);
+               offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
+                       Math.abs(dpHeight + inputHeight) : 0);
+
+               return offset;
+       },
+
+       /* Find an object's position on the screen. */
+       _findPos: function(obj) {
+               var inst = this._getInst(obj);
+               var isRTL = this._get(inst, 'isRTL');
+               while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) {
+                       obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
+               }
+               var position = $(obj).offset();
+               return [position.left, position.top];
+       },
+
+       /* Hide the date picker from view.
+          @param  input  element - the input field attached to the date picker */
+       _hideDatepicker: function(input) {
+               var inst = this._curInst;
+               if (!inst || (input && inst != $.data(input, PROP_NAME)))
+                       return;
+               if (this._datepickerShowing) {
+                       var showAnim = this._get(inst, 'showAnim');
+                       var duration = this._get(inst, 'duration');
+                       var postProcess = function() {
+                               $.datepicker._tidyDialog(inst);
+                       };
+
+                       // DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed
+                       if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) )
+                               inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
+                       else
+                               inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
+                                       (showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
+                       if (!showAnim)
+                               postProcess();
+                       this._datepickerShowing = false;
+                       var onClose = this._get(inst, 'onClose');
+                       if (onClose)
+                               onClose.apply((inst.input ? inst.input[0] : null),
+                                       [(inst.input ? inst.input.val() : ''), inst]);
+                       this._lastInput = null;
+                       if (this._inDialog) {
+                               this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
+                               if ($.blockUI) {
+                                       $.unblockUI();
+                                       $('body').append(this.dpDiv);
+                               }
+                       }
+                       this._inDialog = false;
+               }
+       },
+
+       /* Tidy up after a dialog display. */
+       _tidyDialog: function(inst) {
+               inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
+       },
+
+       /* Close date picker if clicked elsewhere. */
+       _checkExternalClick: function(event) {
+               if (!$.datepicker._curInst)
+                       return;
+
+               var $target = $(event.target),
+                       inst = $.datepicker._getInst($target[0]);
+
+               if ( ( ( $target[0].id != $.datepicker._mainDivId &&
+                               $target.parents('#' + $.datepicker._mainDivId).length == 0 &&
+                               !$target.hasClass($.datepicker.markerClassName) &&
+                               !$target.closest("." + $.datepicker._triggerClass).length &&
+                               $.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
+                       ( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst != inst ) )
+                       $.datepicker._hideDatepicker();
+       },
+
+       /* Adjust one of the date sub-fields. */
+       _adjustDate: function(id, offset, period) {
+               var target = $(id);
+               var inst = this._getInst(target[0]);
+               if (this._isDisabledDatepicker(target[0])) {
+                       return;
+               }
+               this._adjustInstDate(inst, offset +
+                       (period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
+                       period);
+               this._updateDatepicker(inst);
+       },
+
+       /* Action for current link. */
+       _gotoToday: function(id) {
+               var target = $(id);
+               var inst = this._getInst(target[0]);
+               if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
+                       inst.selectedDay = inst.currentDay;
+                       inst.drawMonth = inst.selectedMonth = inst.currentMonth;
+                       inst.drawYear = inst.selectedYear = inst.currentYear;
+               }
+               else {
+                       var date = new Date();
+                       inst.selectedDay = date.getDate();
+                       inst.drawMonth = inst.selectedMonth = date.getMonth();
+                       inst.drawYear = inst.selectedYear = date.getFullYear();
+               }
+               this._notifyChange(inst);
+               this._adjustDate(target);
+       },
+
+       /* Action for selecting a new month/year. */
+       _selectMonthYear: function(id, select, period) {
+               var target = $(id);
+               var inst = this._getInst(target[0]);
+               inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
+               inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
+                       parseInt(select.options[select.selectedIndex].value,10);
+               this._notifyChange(inst);
+               this._adjustDate(target);
+       },
+
+       /* Action for selecting a day. */
+       _selectDay: function(id, month, year, td) {
+               var target = $(id);
+               if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
+                       return;
+               }
+               var inst = this._getInst(target[0]);
+               inst.selectedDay = inst.currentDay = $('a', td).html();
+               inst.selectedMonth = inst.currentMonth = month;
+               inst.selectedYear = inst.currentYear = year;
+               this._selectDate(id, this._formatDate(inst,
+                       inst.currentDay, inst.currentMonth, inst.currentYear));
+       },
+
+       /* Erase the input field and hide the date picker. */
+       _clearDate: function(id) {
+               var target = $(id);
+               var inst = this._getInst(target[0]);
+               this._selectDate(target, '');
+       },
+
+       /* Update the input field with the selected date. */
+       _selectDate: function(id, dateStr) {
+               var target = $(id);
+               var inst = this._getInst(target[0]);
+               dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
+               if (inst.input)
+                       inst.input.val(dateStr);
+               this._updateAlternate(inst);
+               var onSelect = this._get(inst, 'onSelect');
+               if (onSelect)
+                       onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);  // trigger custom callback
+               else if (inst.input)
+                       inst.input.trigger('change'); // fire the change event
+               if (inst.inline)
+                       this._updateDatepicker(inst);
+               else {
+                       this._hideDatepicker();
+                       this._lastInput = inst.input[0];
+                       if (typeof(inst.input[0]) != 'object')
+                               inst.input.focus(); // restore focus
+                       this._lastInput = null;
+               }
+       },
+
+       /* Update any alternate field to synchronise with the main field. */
+       _updateAlternate: function(inst) {
+               var altField = this._get(inst, 'altField');
+               if (altField) { // update alternate field too
+                       var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
+                       var date = this._getDate(inst);
+                       var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
+                       $(altField).each(function() { $(this).val(dateStr); });
+               }
+       },
+
+       /* Set as beforeShowDay function to prevent selection of weekends.
+          @param  date  Date - the date to customise
+          @return [boolean, string] - is this date selectable?, what is its CSS class? */
+       noWeekends: function(date) {
+               var day = date.getDay();
+               return [(day > 0 && day < 6), ''];
+       },
+
+       /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
+          @param  date  Date - the date to get the week for
+          @return  number - the number of the week within the year that contains this date */
+       iso8601Week: function(date) {
+               var checkDate = new Date(date.getTime());
+               // Find Thursday of this week starting on Monday
+               checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
+               var time = checkDate.getTime();
+               checkDate.setMonth(0); // Compare with Jan 1
+               checkDate.setDate(1);
+               return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
+       },
+
+       /* Parse a string value into a date object.
+          See formatDate below for the possible formats.
+
+          @param  format    string - the expected format of the date
+          @param  value     string - the date in the above format
+          @param  settings  Object - attributes include:
+                            shortYearCutoff  number - the cutoff year for determining the century (optional)
+                            dayNamesShort    string[7] - abbreviated names of the days from Sunday (optional)
+                            dayNames         string[7] - names of the days from Sunday (optional)
+                            monthNamesShort  string[12] - abbreviated names of the months (optional)
+                            monthNames       string[12] - names of the months (optional)
+          @return  Date - the extracted date value or null if value is blank */
+       parseDate: function (format, value, settings) {
+               if (format == null || value == null)
+                       throw 'Invalid arguments';
+               value = (typeof value == 'object' ? value.toString() : value + '');
+               if (value == '')
+                       return null;
+               var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
+               shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
+                               new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
+               var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
+               var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
+               var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
+               var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
+               var year = -1;
+               var month = -1;
+               var day = -1;
+               var doy = -1;
+               var literal = false;
+               // Check whether a format character is doubled
+               var lookAhead = function(match) {
+                       var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
+                       if (matches)
+                               iFormat++;
+                       return matches;
+               };
+               // Extract a number from the string value
+               var getNumber = function(match) {
+                       var isDoubled = lookAhead(match);
+                       var size = (match == '@' ? 14 : (match == '!' ? 20 :
+                               (match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2))));
+                       var digits = new RegExp('^\\d{1,' + size + '}');
+                       var num = value.substring(iValue).match(digits);
+                       if (!num)
+                               throw 'Missing number at position ' + iValue;
+                       iValue += num[0].length;
+                       return parseInt(num[0], 10);
+               };
+               // Extract a name from the string value and convert to an index
+               var getName = function(match, shortNames, longNames) {
+                       var names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {
+                               return [ [k, v] ];
+                       }).sort(function (a, b) {
+                               return -(a[1].length - b[1].length);
+                       });
+                       var index = -1;
+                       $.each(names, function (i, pair) {
+                               var name = pair[1];
+                               if (value.substr(iValue, name.length).toLowerCase() == name.toLowerCase()) {
+                                       index = pair[0];
+                                       iValue += name.length;
+                                       return false;
+                               }
+                       });
+                       if (index != -1)
+                               return index + 1;
+                       else
+                               throw 'Unknown name at position ' + iValue;
+               };
+               // Confirm that a literal character matches the string value
+               var checkLiteral = function() {
+                       if (value.charAt(iValue) != format.charAt(iFormat))
+                               throw 'Unexpected literal at position ' + iValue;
+                       iValue++;
+               };
+               var iValue = 0;
+               for (var iFormat = 0; iFormat < format.length; iFormat++) {
+                       if (literal)
+                               if (format.charAt(iFormat) == "'" && !lookAhead("'"))
+                                       literal = false;
+                               else
+                                       checkLiteral();
+                       else
+                               switch (format.charAt(iFormat)) {
+                                       case 'd':
+                                               day = getNumber('d');
+                                               break;
+                                       case 'D':
+                                               getName('D', dayNamesShort, dayNames);
+                                               break;
+                                       case 'o':
+                                               doy = getNumber('o');
+                                               break;
+                                       case 'm':
+                                               month = getNumber('m');
+                                               break;
+                                       case 'M':
+                                               month = getName('M', monthNamesShort, monthNames);
+                                               break;
+                                       case 'y':
+                                               year = getNumber('y');
+                                               break;
+                                       case '@':
+                                               var date = new Date(getNumber('@'));
+                                               year = date.getFullYear();
+                                               month = date.getMonth() + 1;
+                                               day = date.getDate();
+                                               break;
+                                       case '!':
+                                               var date = new Date((getNumber('!') - this._ticksTo1970) / 10000);
+                                               year = date.getFullYear();
+                                               month = date.getMonth() + 1;
+                                               day = date.getDate();
+                                               break;
+                                       case "'":
+                                               if (lookAhead("'"))
+                                                       checkLiteral();
+                                               else
+                                                       literal = true;
+                                               break;
+                                       default:
+                                               checkLiteral();
+                               }
+               }
+               if (iValue < value.length){
+                       var extra = value.substr(iValue);
+                       if (!/^\s+/.test(extra)) {
+                               throw "Extra/unparsed characters found in date: " + extra;
+                       }
+               }
+               if (year == -1)
+                       year = new Date().getFullYear();
+               else if (year < 100)
+                       year += new Date().getFullYear() - new Date().getFullYear() % 100 +
+                               (year <= shortYearCutoff ? 0 : -100);
+               if (doy > -1) {
+                       month = 1;
+                       day = doy;
+                       do {
+                               var dim = this._getDaysInMonth(year, month - 1);
+                               if (day <= dim)
+                                       break;
+                               month++;
+                               day -= dim;
+                       } while (true);
+               }
+               var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
+               if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
+                       throw 'Invalid date'; // E.g. 31/02/00
+               return date;
+       },
+
+       /* Standard date formats. */
+       ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
+       COOKIE: 'D, dd M yy',
+       ISO_8601: 'yy-mm-dd',
+       RFC_822: 'D, d M y',
+       RFC_850: 'DD, dd-M-y',
+       RFC_1036: 'D, d M y',
+       RFC_1123: 'D, d M yy',
+       RFC_2822: 'D, d M yy',
+       RSS: 'D, d M y', // RFC 822
+       TICKS: '!',
+       TIMESTAMP: '@',
+       W3C: 'yy-mm-dd', // ISO 8601
+
+       _ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
+               Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
+
+       /* Format a date object into a string value.
+          The format can be combinations of the following:
+          d  - day of month (no leading zero)
+          dd - day of month (two digit)
+          o  - day of year (no leading zeros)
+          oo - day of year (three digit)
+          D  - day name short
+          DD - day name long
+          m  - month of year (no leading zero)
+          mm - month of year (two digit)
+          M  - month name short
+          MM - month name long
+          y  - year (two digit)
+          yy - year (four digit)
+          @ - Unix timestamp (ms since 01/01/1970)
+          ! - Windows ticks (100ns since 01/01/0001)
+          '...' - literal text
+          '' - single quote
+
+          @param  format    string - the desired format of the date
+          @param  date      Date - the date value to format
+          @param  settings  Object - attributes include:
+                            dayNamesShort    string[7] - abbreviated names of the days from Sunday (optional)
+                            dayNames         string[7] - names of the days from Sunday (optional)
+                            monthNamesShort  string[12] - abbreviated names of the months (optional)
+                            monthNames       string[12] - names of the months (optional)
+          @return  string - the date in the above format */
+       formatDate: function (format, date, settings) {
+               if (!date)
+                       return '';
+               var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
+               var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
+               var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
+               var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
+               // Check whether a format character is doubled
+               var lookAhead = function(match) {
+                       var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
+                       if (matches)
+                               iFormat++;
+                       return matches;
+               };
+               // Format a number, with leading zero if necessary
+               var formatNumber = function(match, value, len) {
+                       var num = '' + value;
+                       if (lookAhead(match))
+                               while (num.length < len)
+                                       num = '0' + num;
+                       return num;
+               };
+               // Format a name, short or long as requested
+               var formatName = function(match, value, shortNames, longNames) {
+                       return (lookAhead(match) ? longNames[value] : shortNames[value]);
+               };
+               var output = '';
+               var literal = false;
+               if (date)
+                       for (var iFormat = 0; iFormat < format.length; iFormat++) {
+                               if (literal)
+                                       if (format.charAt(iFormat) == "'" && !lookAhead("'"))
+                                               literal = false;
+                                       else
+                                               output += format.charAt(iFormat);
+                               else
+                                       switch (format.charAt(iFormat)) {
+                                               case 'd':
+                                                       output += formatNumber('d', date.getDate(), 2);
+                                                       break;
+                                               case 'D':
+                                                       output += formatName('D', date.getDay(), dayNamesShort, dayNames);
+                                                       break;
+                                               case 'o':
+                                                       output += formatNumber('o',
+                                                               Math.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);
+                                                       break;
+                                               case 'm':
+                                                       output += formatNumber('m', date.getMonth() + 1, 2);
+                                                       break;
+                                               case 'M':
+                                                       output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
+                                                       break;
+                                               case 'y':
+                                                       output += (lookAhead('y') ? date.getFullYear() :
+                                                               (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
+                                                       break;
+                                               case '@':
+                                                       output += date.getTime();
+                                                       break;
+                                               case '!':
+                                                       output += date.getTime() * 10000 + this._ticksTo1970;
+                                                       break;
+                                               case "'":
+                                                       if (lookAhead("'"))
+                                                               output += "'";
+                                                       else
+                                                               literal = true;
+                                                       break;
+                                               default:
+                                                       output += format.charAt(iFormat);
+                                       }
+                       }
+               return output;
+       },
+
+       /* Extract all possible characters from the date format. */
+       _possibleChars: function (format) {
+               var chars = '';
+               var literal = false;
+               // Check whether a format character is doubled
+               var lookAhead = function(match) {
+                       var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
+                       if (matches)
+                               iFormat++;
+                       return matches;
+               };
+               for (var iFormat = 0; iFormat < format.length; iFormat++)
+                       if (literal)
+                               if (format.charAt(iFormat) == "'" && !lookAhead("'"))
+                                       literal = false;
+                               else
+                                       chars += format.charAt(iFormat);
+                       else
+                               switch (format.charAt(iFormat)) {
+                                       case 'd': case 'm': case 'y': case '@':
+                                               chars += '0123456789';
+                                               break;
+                                       case 'D': case 'M':
+                                               return null; // Accept anything
+                                       case "'":
+                                               if (lookAhead("'"))
+                                                       chars += "'";
+                                               else
+                                                       literal = true;
+                                               break;
+                                       default:
+                                               chars += format.charAt(iFormat);
+                               }
+               return chars;
+       },
+
+       /* Get a setting value, defaulting if necessary. */
+       _get: function(inst, name) {
+               return inst.settings[name] !== undefined ?
+                       inst.settings[name] : this._defaults[name];
+       },
+
+       /* Parse existing date and initialise date picker. */
+       _setDateFromField: function(inst, noDefault) {
+               if (inst.input.val() == inst.lastVal) {
+                       return;
+               }
+               var dateFormat = this._get(inst, 'dateFormat');
+               var dates = inst.lastVal = inst.input ? inst.input.val() : null;
+               var date, defaultDate;
+               date = defaultDate = this._getDefaultDate(inst);
+               var settings = this._getFormatConfig(inst);
+               try {
+                       date = this.parseDate(dateFormat, dates, settings) || defaultDate;
+               } catch (event) {
+                       this.log(event);
+                       dates = (noDefault ? '' : dates);
+               }
+               inst.selectedDay = date.getDate();
+               inst.drawMonth = inst.selectedMonth = date.getMonth();
+               inst.drawYear = inst.selectedYear = date.getFullYear();
+               inst.currentDay = (dates ? date.getDate() : 0);
+               inst.currentMonth = (dates ? date.getMonth() : 0);
+               inst.currentYear = (dates ? date.getFullYear() : 0);
+               this._adjustInstDate(inst);
+       },
+
+       /* Retrieve the default date shown on opening. */
+       _getDefaultDate: function(inst) {
+               return this._restrictMinMax(inst,
+                       this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));
+       },
+
+       /* A date may be specified as an exact value or a relative one. */
+       _determineDate: function(inst, date, defaultDate) {
+               var offsetNumeric = function(offset) {
+                       var date = new Date();
+                       date.setDate(date.getDate() + offset);
+                       return date;
+               };
+               var offsetString = function(offset) {
+                       try {
+                               return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
+                                       offset, $.datepicker._getFormatConfig(inst));
+                       }
+                       catch (e) {
+                               // Ignore
+                       }
+                       var date = (offset.toLowerCase().match(/^c/) ?
+                               $.datepicker._getDate(inst) : null) || new Date();
+                       var year = date.getFullYear();
+                       var month = date.getMonth();
+                       var day = date.getDate();
+                       var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
+                       var matches = pattern.exec(offset);
+                       while (matches) {
+                               switch (matches[2] || 'd') {
+                                       case 'd' : case 'D' :
+                                               day += parseInt(matches[1],10); break;
+                                       case 'w' : case 'W' :
+                                               day += parseInt(matches[1],10) * 7; break;
+                                       case 'm' : case 'M' :
+                                               month += parseInt(matches[1],10);
+                                               day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
+                                               break;
+                                       case 'y': case 'Y' :
+                                               year += parseInt(matches[1],10);
+                                               day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
+                                               break;
+                               }
+                               matches = pattern.exec(offset);
+                       }
+                       return new Date(year, month, day);
+               };
+               var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) :
+                       (typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
+               newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate);
+               if (newDate) {
+                       newDate.setHours(0);
+                       newDate.setMinutes(0);
+                       newDate.setSeconds(0);
+                       newDate.setMilliseconds(0);
+               }
+               return this._daylightSavingAdjust(newDate);
+       },
+
+       /* Handle switch to/from daylight saving.
+          Hours may be non-zero on daylight saving cut-over:
+          > 12 when midnight changeover, but then cannot generate
+          midnight datetime, so jump to 1AM, otherwise reset.
+          @param  date  (Date) the date to check
+          @return  (Date) the corrected date */
+       _daylightSavingAdjust: function(date) {
+               if (!date) return null;
+               date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
+               return date;
+       },
+
+       /* Set the date(s) directly. */
+       _setDate: function(inst, date, noChange) {
+               var clear = !date;
+               var origMonth = inst.selectedMonth;
+               var origYear = inst.selectedYear;
+               var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
+               inst.selectedDay = inst.currentDay = newDate.getDate();
+               inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
+               inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
+               if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
+                       this._notifyChange(inst);
+               this._adjustInstDate(inst);
+               if (inst.input) {
+                       inst.input.val(clear ? '' : this._formatDate(inst));
+               }
+       },
+
+       /* Retrieve the date(s) directly. */
+       _getDate: function(inst) {
+               var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
+                       this._daylightSavingAdjust(new Date(
+                       inst.currentYear, inst.currentMonth, inst.currentDay)));
+                       return startDate;
+       },
+
+       /* Attach the onxxx handlers.  These are declared statically so
+        * they work with static code transformers like Caja.
+        */
+       _attachHandlers: function(inst) {
+               var stepMonths = this._get(inst, 'stepMonths');
+               var id = '#' + inst.id.replace( /\\\\/g, "\\" );
+               inst.dpDiv.find('[data-handler]').map(function () {
+                       var handler = {
+                               prev: function () {
+                                       window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, -stepMonths, 'M');
+                               },
+                               next: function () {
+                                       window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, +stepMonths, 'M');
+                               },
+                               hide: function () {
+                                       window['DP_jQuery_' + dpuuid].datepicker._hideDatepicker();
+                               },
+                               today: function () {
+                                       window['DP_jQuery_' + dpuuid].datepicker._gotoToday(id);
+                               },
+                               selectDay: function () {
+                                       window['DP_jQuery_' + dpuuid].datepicker._selectDay(id, +this.getAttribute('data-month'), +this.getAttribute('data-year'), this);
+                                       return false;
+                               },
+                               selectMonth: function () {
+                                       window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'M');
+                                       return false;
+                               },
+                               selectYear: function () {
+                                       window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'Y');
+                                       return false;
+                               }
+                       };
+                       $(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]);
+               });
+       },
+
+       /* Generate the HTML for the current state of the date picker. */
+       _generateHTML: function(inst) {
+               var today = new Date();
+               today = this._daylightSavingAdjust(
+                       new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
+               var isRTL = this._get(inst, 'isRTL');
+               var showButtonPanel = this._get(inst, 'showButtonPanel');
+               var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
+               var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
+               var numMonths = this._getNumberOfMonths(inst);
+               var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
+               var stepMonths = this._get(inst, 'stepMonths');
+               var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
+               var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
+                       new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
+               var minDate = this._getMinMaxDate(inst, 'min');
+               var maxDate = this._getMinMaxDate(inst, 'max');
+               var drawMonth = inst.drawMonth - showCurrentAtPos;
+               var drawYear = inst.drawYear;
+               if (drawMonth < 0) {
+                       drawMonth += 12;
+                       drawYear--;
+               }
+               if (maxDate) {
+                       var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
+                               maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
+                       maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
+                       while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
+                               drawMonth--;
+                               if (drawMonth < 0) {
+                                       drawMonth = 11;
+                                       drawYear--;
+                               }
+                       }
+               }
+               inst.drawMonth = drawMonth;
+               inst.drawYear = drawYear;
+               var prevText = this._get(inst, 'prevText');
+               prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
+                       this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
+                       this._getFormatConfig(inst)));
+               var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
+                       '<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click"' +
+                       ' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
+                       (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>'));
+               var nextText = this._get(inst, 'nextText');
+               nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
+                       this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
+                       this._getFormatConfig(inst)));
+               var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
+                       '<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click"' +
+                       ' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
+                       (hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>'));
+               var currentText = this._get(inst, 'currentText');
+               var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
+               currentText = (!navigationAsDateFormat ? currentText :
+                       this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
+               var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">' +
+                       this._get(inst, 'closeText') + '</button>' : '');
+               var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
+                       (this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click"' +
+                       '>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
+               var firstDay = parseInt(this._get(inst, 'firstDay'),10);
+               firstDay = (isNaN(firstDay) ? 0 : firstDay);
+               var showWeek = this._get(inst, 'showWeek');
+               var dayNames = this._get(inst, 'dayNames');
+               var dayNamesShort = this._get(inst, 'dayNamesShort');
+               var dayNamesMin = this._get(inst, 'dayNamesMin');
+               var monthNames = this._get(inst, 'monthNames');
+               var monthNamesShort = this._get(inst, 'monthNamesShort');
+               var beforeShowDay = this._get(inst, 'beforeShowDay');
+               var showOtherMonths = this._get(inst, 'showOtherMonths');
+               var selectOtherMonths = this._get(inst, 'selectOtherMonths');
+               var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
+               var defaultDate = this._getDefaultDate(inst);
+               var html = '';
+               for (var row = 0; row < numMonths[0]; row++) {
+                       var group = '';
+                       this.maxRows = 4;
+                       for (var col = 0; col < numMonths[1]; col++) {
+                               var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
+                               var cornerClass = ' ui-corner-all';
+                               var calender = '';
+                               if (isMultiMonth) {
+                                       calender += '<div class="ui-datepicker-group';
+                                       if (numMonths[1] > 1)
+                                               switch (col) {
+                                                       case 0: calender += ' ui-datepicker-group-first';
+                                                               cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
+                                                       case numMonths[1]-1: calender += ' ui-datepicker-group-last';
+                                                               cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
+                                                       default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;
+                                               }
+                                       calender += '">';
+                               }
+                               calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
+                                       (/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
+                                       (/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
+                                       this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
+                                       row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
+                                       '</div><table class="ui-datepicker-calendar"><thead>' +
+                                       '<tr>';
+                               var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '');
+                               for (var dow = 0; dow < 7; dow++) { // days of the week
+                                       var day = (dow + firstDay) % 7;
+                                       thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
+                                               '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
+                               }
+                               calender += thead + '</tr></thead><tbody>';
+                               var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
+                               if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
+                                       inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
+                               var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
+                               var curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate
+                               var numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)
+                               this.maxRows = numRows;
+                               var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
+                               for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
+                                       calender += '<tr>';
+                                       var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' +
+                                               this._get(inst, 'calculateWeek')(printDate) + '</td>');
+                                       for (var dow = 0; dow < 7; dow++) { // create date picker days
+                                               var daySettings = (beforeShowDay ?
+                                                       beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
+                                               var otherMonth = (printDate.getMonth() != drawMonth);
+                                               var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
+                                                       (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
+                                               tbody += '<td class="' +
+                                                       ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
+                                                       (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
+                                                       ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
+                                                       (defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
+                                                       // or defaultDate is current printedDate and defaultDate is selectedDate
+                                                       ' ' + this._dayOverClass : '') + // highlight selected day
+                                                       (unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') +  // highlight unselectable days
+                                                       (otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
+                                                       (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day
+                                                       (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
+                                                       ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
+                                                       (unselectable ? '' : ' data-handler="selectDay" data-event="click" data-month="' + printDate.getMonth() + '" data-year="' + printDate.getFullYear() + '"') + '>' + // actions
+                                                       (otherMonth && !showOtherMonths ? '&#xa0;' : // display for other months
+                                                       (unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
+                                                       (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
+                                                       (printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day
+                                                       (otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months
+                                                       '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date
+                                               printDate.setDate(printDate.getDate() + 1);
+                                               printDate = this._daylightSavingAdjust(printDate);
+                                       }
+                                       calender += tbody + '</tr>';
+                               }
+                               drawMonth++;
+                               if (drawMonth > 11) {
+                                       drawMonth = 0;
+                                       drawYear++;
+                               }
+                               calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
+                                                       ((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
+                               group += calender;
+                       }
+                       html += group;
+               }
+               html += buttonPanel + ($.ui.ie6 && !inst.inline ?
+                       '<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
+               inst._keyEvent = false;
+               return html;
+       },
+
+       /* Generate the month and year header. */
+       _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
+                       secondary, monthNames, monthNamesShort) {
+               var changeMonth = this._get(inst, 'changeMonth');
+               var changeYear = this._get(inst, 'changeYear');
+               var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
+               var html = '<div class="ui-datepicker-title">';
+               var monthHtml = '';
+               // month selection
+               if (secondary || !changeMonth)
+                       monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>';
+               else {
+                       var inMinYear = (minDate && minDate.getFullYear() == drawYear);
+                       var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
+                       monthHtml += '<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">';
+                       for (var month = 0; month < 12; month++) {
+                               if ((!inMinYear || month >= minDate.getMonth()) &&
+                                               (!inMaxYear || month <= maxDate.getMonth()))
+                                       monthHtml += '<option value="' + month + '"' +
+                                               (month == drawMonth ? ' selected="selected"' : '') +
+                                               '>' + monthNamesShort[month] + '</option>';
+                       }
+                       monthHtml += '</select>';
+               }
+               if (!showMonthAfterYear)
+                       html += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '');
+               // year selection
+               if ( !inst.yearshtml ) {
+                       inst.yearshtml = '';
+                       if (secondary || !changeYear)
+                               html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
+                       else {
+                               // determine range of years to display
+                               var years = this._get(inst, 'yearRange').split(':');
+                               var thisYear = new Date().getFullYear();
+                               var determineYear = function(value) {
+                                       var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :
+                                               (value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :
+                                               parseInt(value, 10)));
+                                       return (isNaN(year) ? thisYear : year);
+                               };
+                               var year = determineYear(years[0]);
+                               var endYear = Math.max(year, determineYear(years[1] || ''));
+                               year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
+                               endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
+                               inst.yearshtml += '<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">';
+                               for (; year <= endYear; year++) {
+                                       inst.yearshtml += '<option value="' + year + '"' +
+                                               (year == drawYear ? ' selected="selected"' : '') +
+                                               '>' + year + '</option>';
+                               }
+                               inst.yearshtml += '</select>';
+
+                               html += inst.yearshtml;
+                               inst.yearshtml = null;
+                       }
+               }
+               html += this._get(inst, 'yearSuffix');
+               if (showMonthAfterYear)
+                       html += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml;
+               html += '</div>'; // Close datepicker_header
+               return html;
+       },
+
+       /* Adjust one of the date sub-fields. */
+       _adjustInstDate: function(inst, offset, period) {
+               var year = inst.drawYear + (period == 'Y' ? offset : 0);
+               var month = inst.drawMonth + (period == 'M' ? offset : 0);
+               var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
+                       (period == 'D' ? offset : 0);
+               var date = this._restrictMinMax(inst,
+                       this._daylightSavingAdjust(new Date(year, month, day)));
+               inst.selectedDay = date.getDate();
+               inst.drawMonth = inst.selectedMonth = date.getMonth();
+               inst.drawYear = inst.selectedYear = date.getFullYear();
+               if (period == 'M' || period == 'Y')
+                       this._notifyChange(inst);
+       },
+
+       /* Ensure a date is within any min/max bounds. */
+       _restrictMinMax: function(inst, date) {
+               var minDate = this._getMinMaxDate(inst, 'min');
+               var maxDate = this._getMinMaxDate(inst, 'max');
+               var newDate = (minDate && date < minDate ? minDate : date);
+               newDate = (maxDate && newDate > maxDate ? maxDate : newDate);
+               return newDate;
+       },
+
+       /* Notify change of month/year. */
+       _notifyChange: function(inst) {
+               var onChange = this._get(inst, 'onChangeMonthYear');
+               if (onChange)
+                       onChange.apply((inst.input ? inst.input[0] : null),
+                               [inst.selectedYear, inst.selectedMonth + 1, inst]);
+       },
+
+       /* Determine the number of months to show. */
+       _getNumberOfMonths: function(inst) {
+               var numMonths = this._get(inst, 'numberOfMonths');
+               return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
+       },
+
+       /* Determine the current maximum date - ensure no time components are set. */
+       _getMinMaxDate: function(inst, minMax) {
+               return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);
+       },
+
+       /* Find the number of days in a given month. */
+       _getDaysInMonth: function(year, month) {
+               return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
+       },
+
+       /* Find the day of the week of the first of a month. */
+       _getFirstDayOfMonth: function(year, month) {
+               return new Date(year, month, 1).getDay();
+       },
+
+       /* Determines if we should allow a "next/prev" month display change. */
+       _canAdjustMonth: function(inst, offset, curYear, curMonth) {
+               var numMonths = this._getNumberOfMonths(inst);
+               var date = this._daylightSavingAdjust(new Date(curYear,
+                       curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
+               if (offset < 0)
+                       date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
+               return this._isInRange(inst, date);
+       },
+
+       /* Is the given date in the accepted range? */
+       _isInRange: function(inst, date) {
+               var minDate = this._getMinMaxDate(inst, 'min');
+               var maxDate = this._getMinMaxDate(inst, 'max');
+               return ((!minDate || date.getTime() >= minDate.getTime()) &&
+                       (!maxDate || date.getTime() <= maxDate.getTime()));
+       },
+
+       /* Provide the configuration settings for formatting/parsing. */
+       _getFormatConfig: function(inst) {
+               var shortYearCutoff = this._get(inst, 'shortYearCutoff');
+               shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
+                       new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
+               return {shortYearCutoff: shortYearCutoff,
+                       dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
+                       monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
+       },
+
+       /* Format the given date for display. */
+       _formatDate: function(inst, day, month, year) {
+               if (!day) {
+                       inst.currentDay = inst.selectedDay;
+                       inst.currentMonth = inst.selectedMonth;
+                       inst.currentYear = inst.selectedYear;
+               }
+               var date = (day ? (typeof day == 'object' ? day :
+                       this._daylightSavingAdjust(new Date(year, month, day))) :
+                       this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
+               return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
+       }
+});
+
+/*
+ * Bind hover events for datepicker elements.
+ * Done via delegate so the binding only occurs once in the lifetime of the parent div.
+ * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.
+ */
+function bindHover(dpDiv) {
+       var selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';
+       return dpDiv.delegate(selector, 'mouseout', function() {
+                       $(this).removeClass('ui-state-hover');
+                       if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
+                       if (this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
+               })
+               .delegate(selector, 'mouseover', function(){
+                       if (!$.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0])) {
+                               $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
+                               $(this).addClass('ui-state-hover');
+                               if (this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');
+                               if (this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');
+                       }
+               });
+}
+
+/* jQuery extend now ignores nulls! */
+function extendRemove(target, props) {
+       $.extend(target, props);
+       for (var name in props)
+               if (props[name] == null || props[name] == undefined)
+                       target[name] = props[name];
+       return target;
+};
+
+/* Invoke the datepicker functionality.
+   @param  options  string - a command, optionally followed by additional parameters or
+                       Object - settings for attaching new datepicker functionality
+   @return  jQuery object */
+$.fn.datepicker = function(options){
+
+       /* Verify an empty collection wasn't passed - Fixes #6976 */
+       if ( !this.length ) {
+               return this;
+       }
+
+       /* Initialise the date picker. */
+       if (!$.datepicker.initialized) {
+               $(document).mousedown($.datepicker._checkExternalClick).
+                       find(document.body).append($.datepicker.dpDiv);
+               $.datepicker.initialized = true;
+       }
+
+       var otherArgs = Array.prototype.slice.call(arguments, 1);
+       if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))
+               return $.datepicker['_' + options + 'Datepicker'].
+                       apply($.datepicker, [this[0]].concat(otherArgs));
+       if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
+               return $.datepicker['_' + options + 'Datepicker'].
+                       apply($.datepicker, [this[0]].concat(otherArgs));
+       return this.each(function() {
+               typeof options == 'string' ?
+                       $.datepicker['_' + options + 'Datepicker'].
+                               apply($.datepicker, [this].concat(otherArgs)) :
+                       $.datepicker._attachDatepicker(this, options);
+       });
+};
+
+$.datepicker = new Datepicker(); // singleton instance
+$.datepicker.initialized = false;
+$.datepicker.uuid = new Date().getTime();
+$.datepicker.version = "1.9.2";
+
+// Workaround for #4055
+// Add another global to avoid noConflict issues with inline event handlers
+window['DP_jQuery_' + dpuuid] = $;
+
+})(jQuery);
+(function( $, undefined ) {
+
+var uiDialogClasses = "ui-dialog ui-widget ui-widget-content ui-corner-all ",
+       sizeRelatedOptions = {
+               buttons: true,
+               height: true,
+               maxHeight: true,
+               maxWidth: true,
+               minHeight: true,
+               minWidth: true,
+               width: true
+       },
+       resizableRelatedOptions = {
+               maxHeight: true,
+               maxWidth: true,
+               minHeight: true,
+               minWidth: true
+       };
+
+$.widget("ui.dialog", {
+       version: "1.9.2",
+       options: {
+               autoOpen: true,
+               buttons: {},
+               closeOnEscape: true,
+               closeText: "close",
+               dialogClass: "",
+               draggable: true,
+               hide: null,
+               height: "auto",
+               maxHeight: false,
+               maxWidth: false,
+               minHeight: 150,
+               minWidth: 150,
+               modal: false,
+               position: {
+                       my: "center",
+                       at: "center",
+                       of: window,
+                       collision: "fit",
+                       // ensure that the titlebar is never outside the document
+                       using: function( pos ) {
+                               var topOffset = $( this ).css( pos ).offset().top;
+                               if ( topOffset < 0 ) {
+                                       $( this ).css( "top", pos.top - topOffset );
+                               }
+                       }
+               },
+               resizable: true,
+               show: null,
+               stack: true,
+               title: "",
+               width: 300,
+               zIndex: 1000
+       },
+
+       _create: function() {
+               this.originalTitle = this.element.attr( "title" );
+               // #5742 - .attr() might return a DOMElement
+               if ( typeof this.originalTitle !== "string" ) {
+                       this.originalTitle = "";
+               }
+               this.oldPosition = {
+                       parent: this.element.parent(),
+                       index: this.element.parent().children().index( this.element )
+               };
+               this.options.title = this.options.title || this.originalTitle;
+               var that = this,
+                       options = this.options,
+
+                       title = options.title || "&#160;",
+                       uiDialog,
+                       uiDialogTitlebar,
+                       uiDialogTitlebarClose,
+                       uiDialogTitle,
+                       uiDialogButtonPane;
+
+                       uiDialog = ( this.uiDialog = $( "<div>" ) )
+                               .addClass( uiDialogClasses + options.dialogClass )
+                               .css({
+                                       display: "none",
+                                       outline: 0, // TODO: move to stylesheet
+                                       zIndex: options.zIndex
+                               })
+                               // setting tabIndex makes the div focusable
+                               .attr( "tabIndex", -1)
+                               .keydown(function( event ) {
+                                       if ( options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
+                                                       event.keyCode === $.ui.keyCode.ESCAPE ) {
+                                               that.close( event );
+                                               event.preventDefault();
+                                       }
+                               })
+                               .mousedown(function( event ) {
+                                       that.moveToTop( false, event );
+                               })
+                               .appendTo( "body" );
+
+                       this.element
+                               .show()
+                               .removeAttr( "title" )
+                               .addClass( "ui-dialog-content ui-widget-content" )
+                               .appendTo( uiDialog );
+
+                       uiDialogTitlebar = ( this.uiDialogTitlebar = $( "<div>" ) )
+                               .addClass( "ui-dialog-titlebar  ui-widget-header  " +
+                                       "ui-corner-all  ui-helper-clearfix" )
+                               .bind( "mousedown", function() {
+                                       // Dialog isn't getting focus when dragging (#8063)
+                                       uiDialog.focus();
+                               })
+                               .prependTo( uiDialog );
+
+                       uiDialogTitlebarClose = $( "<a href='#'></a>" )
+                               .addClass( "ui-dialog-titlebar-close  ui-corner-all" )
+                               .attr( "role", "button" )
+                               .click(function( event ) {
+                                       event.preventDefault();
+                                       that.close( event );
+                               })
+                               .appendTo( uiDialogTitlebar );
+
+                       ( this.uiDialogTitlebarCloseText = $( "<span>" ) )
+                               .addClass( "ui-icon ui-icon-closethick" )
+                               .text( options.closeText )
+                               .appendTo( uiDialogTitlebarClose );
+
+                       uiDialogTitle = $( "<span>" )
+                               .uniqueId()
+                               .addClass( "ui-dialog-title" )
+                               .html( title )
+                               .prependTo( uiDialogTitlebar );
+
+                       uiDialogButtonPane = ( this.uiDialogButtonPane = $( "<div>" ) )
+                               .addClass( "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix" );
+
+                       ( this.uiButtonSet = $( "<div>" ) )
+                               .addClass( "ui-dialog-buttonset" )
+                               .appendTo( uiDialogButtonPane );
+
+               uiDialog.attr({
+                       role: "dialog",
+                       "aria-labelledby": uiDialogTitle.attr( "id" )
+               });
+
+               uiDialogTitlebar.find( "*" ).add( uiDialogTitlebar ).disableSelection();
+               this._hoverable( uiDialogTitlebarClose );
+               this._focusable( uiDialogTitlebarClose );
+
+               if ( options.draggable && $.fn.draggable ) {
+                       this._makeDraggable();
+               }
+               if ( options.resizable && $.fn.resizable ) {
+                       this._makeResizable();
+               }
+
+               this._createButtons( options.buttons );
+               this._isOpen = false;
+
+               if ( $.fn.bgiframe ) {
+                       uiDialog.bgiframe();
+               }
+
+               // prevent tabbing out of modal dialogs
+               this._on( uiDialog, { keydown: function( event ) {
+                       if ( !options.modal || event.keyCode !== $.ui.keyCode.TAB ) {
+                               return;
+                       }
+
+                       var tabbables = $( ":tabbable", uiDialog ),
+                               first = tabbables.filter( ":first" ),
+                               last  = tabbables.filter( ":last" );
+
+                       if ( event.target === last[0] && !event.shiftKey ) {
+                               first.focus( 1 );
+                               return false;
+                       } else if ( event.target === first[0] && event.shiftKey ) {
+                               last.focus( 1 );
+                               return false;
+                       }
+               }});
+       },
+
+       _init: function() {
+               if ( this.options.autoOpen ) {
+                       this.open();
+               }
+       },
+
+       _destroy: function() {
+               var next,
+                       oldPosition = this.oldPosition;
+
+               if ( this.overlay ) {
+                       this.overlay.destroy();
+               }
+               this.uiDialog.hide();
+               this.element
+                       .removeClass( "ui-dialog-content ui-widget-content" )
+                       .hide()
+                       .appendTo( "body" );
+               this.uiDialog.remove();
+
+               if ( this.originalTitle ) {
+                       this.element.attr( "title", this.originalTitle );
+               }
+
+               next = oldPosition.parent.children().eq( oldPosition.index );
+               // Don't try to place the dialog next to itself (#8613)
+               if ( next.length && next[ 0 ] !== this.element[ 0 ] ) {
+                       next.before( this.element );
+               } else {
+                       oldPosition.parent.append( this.element );
+               }
+       },
+
+       widget: function() {
+               return this.uiDialog;
+       },
+
+       close: function( event ) {
+               var that = this,
+                       maxZ, thisZ;
+
+               if ( !this._isOpen ) {
+                       return;
+               }
+
+               if ( false === this._trigger( "beforeClose", event ) ) {
+                       return;
+               }
+
+               this._isOpen = false;
+
+               if ( this.overlay ) {
+                       this.overlay.destroy();
+               }
+
+               if ( this.options.hide ) {
+                       this._hide( this.uiDialog, this.options.hide, function() {
+                               that._trigger( "close", event );
+                       });
+               } else {
+                       this.uiDialog.hide();
+                       this._trigger( "close", event );
+               }
+
+               $.ui.dialog.overlay.resize();
+
+               // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
+               if ( this.options.modal ) {
+                       maxZ = 0;
+                       $( ".ui-dialog" ).each(function() {
+                               if ( this !== that.uiDialog[0] ) {
+                                       thisZ = $( this ).css( "z-index" );
+                                       if ( !isNaN( thisZ ) ) {
+                                               maxZ = Math.max( maxZ, thisZ );
+                                       }
+                               }
+                       });
+                       $.ui.dialog.maxZ = maxZ;
+               }
+
+               return this;
+       },
+
+       isOpen: function() {
+               return this._isOpen;
+       },
+
+       // the force parameter allows us to move modal dialogs to their correct
+       // position on open
+       moveToTop: function( force, event ) {
+               var options = this.options,
+                       saveScroll;
+
+               if ( ( options.modal && !force ) ||
+                               ( !options.stack && !options.modal ) ) {
+                       return this._trigger( "focus", event );
+               }
+
+               if ( options.zIndex > $.ui.dialog.maxZ ) {
+                       $.ui.dialog.maxZ = options.zIndex;
+               }
+               if ( this.overlay ) {
+                       $.ui.dialog.maxZ += 1;
+                       $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ;
+                       this.overlay.$el.css( "z-index", $.ui.dialog.overlay.maxZ );
+               }
+
+               // Save and then restore scroll
+               // Opera 9.5+ resets when parent z-index is changed.
+               // http://bugs.jqueryui.com/ticket/3193
+               saveScroll = {
+                       scrollTop: this.element.scrollTop(),
+                       scrollLeft: this.element.scrollLeft()
+               };
+               $.ui.dialog.maxZ += 1;
+               this.uiDialog.css( "z-index", $.ui.dialog.maxZ );
+               this.element.attr( saveScroll );
+               this._trigger( "focus", event );
+
+               return this;
+       },
+
+       open: function() {
+               if ( this._isOpen ) {
+                       return;
+               }
+
+               var hasFocus,
+                       options = this.options,
+                       uiDialog = this.uiDialog;
+
+               this._size();
+               this._position( options.position );
+               uiDialog.show( options.show );
+               this.overlay = options.modal ? new $.ui.dialog.overlay( this ) : null;
+               this.moveToTop( true );
+
+               // set focus to the first tabbable element in the content area or the first button
+               // if there are no tabbable elements, set focus on the dialog itself
+               hasFocus = this.element.find( ":tabbable" );
+               if ( !hasFocus.length ) {
+                       hasFocus = this.uiDialogButtonPane.find( ":tabbable" );
+                       if ( !hasFocus.length ) {
+                               hasFocus = uiDialog;
+                       }
+               }
+               hasFocus.eq( 0 ).focus();
+
+               this._isOpen = true;
+               this._trigger( "open" );
+
+               return this;
+       },
+
+       _createButtons: function( buttons ) {
+               var that = this,
+                       hasButtons = false;
+
+               // if we already have a button pane, remove it
+               this.uiDialogButtonPane.remove();
+               this.uiButtonSet.empty();
+
+               if ( typeof buttons === "object" && buttons !== null ) {
+                       $.each( buttons, function() {
+                               return !(hasButtons = true);
+                       });
+               }
+               if ( hasButtons ) {
+                       $.each( buttons, function( name, props ) {
+                               var button, click;
+                               props = $.isFunction( props ) ?
+                                       { click: props, text: name } :
+                                       props;
+                               // Default to a non-submitting button
+                               props = $.extend( { type: "button" }, props );
+                               // Change the context for the click callback to be the main element
+                               click = props.click;
+                               props.click = function() {
+                                       click.apply( that.element[0], arguments );
+                               };
+                               button = $( "<button></button>", props )
+                                       .appendTo( that.uiButtonSet );
+                               if ( $.fn.button ) {
+                                       button.button();
+                               }
+                       });
+                       this.uiDialog.addClass( "ui-dialog-buttons" );
+                       this.uiDialogButtonPane.appendTo( this.uiDialog );
+               } else {
+                       this.uiDialog.removeClass( "ui-dialog-buttons" );
+               }
+       },
+
+       _makeDraggable: function() {
+               var that = this,
+                       options = this.options;
+
+               function filteredUi( ui ) {
+                       return {
+                               position: ui.position,
+                               offset: ui.offset
+                       };
+               }
+
+               this.uiDialog.draggable({
+                       cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
+                       handle: ".ui-dialog-titlebar",
+                       containment: "document",
+                       start: function( event, ui ) {
+                               $( this )
+                                       .addClass( "ui-dialog-dragging" );
+                               that._trigger( "dragStart", event, filteredUi( ui ) );
+                       },
+                       drag: function( event, ui ) {
+                               that._trigger( "drag", event, filteredUi( ui ) );
+                       },
+                       stop: function( event, ui ) {
+                               options.position = [
+                                       ui.position.left - that.document.scrollLeft(),
+                                       ui.position.top - that.document.scrollTop()
+                               ];
+                               $( this )
+                                       .removeClass( "ui-dialog-dragging" );
+                               that._trigger( "dragStop", event, filteredUi( ui ) );
+                               $.ui.dialog.overlay.resize();
+                       }
+               });
+       },
+
+       _makeResizable: function( handles ) {
+               handles = (handles === undefined ? this.options.resizable : handles);
+               var that = this,
+                       options = this.options,
+                       // .ui-resizable has position: relative defined in the stylesheet
+                       // but dialogs have to use absolute or fixed positioning
+                       position = this.uiDialog.css( "position" ),
+                       resizeHandles = typeof handles === 'string' ?
+                               handles :
+                               "n,e,s,w,se,sw,ne,nw";
+
+               function filteredUi( ui ) {
+                       return {
+                               originalPosition: ui.originalPosition,
+                               originalSize: ui.originalSize,
+                               position: ui.position,
+                               size: ui.size
+                       };
+               }
+
+               this.uiDialog.resizable({
+                       cancel: ".ui-dialog-content",
+                       containment: "document",
+                       alsoResize: this.element,
+                       maxWidth: options.maxWidth,
+                       maxHeight: options.maxHeight,
+                       minWidth: options.minWidth,
+                       minHeight: this._minHeight(),
+                       handles: resizeHandles,
+                       start: function( event, ui ) {
+                               $( this ).addClass( "ui-dialog-resizing" );
+                               that._trigger( "resizeStart", event, filteredUi( ui ) );
+                       },
+                       resize: function( event, ui ) {
+                               that._trigger( "resize", event, filteredUi( ui ) );
+                       },
+                       stop: function( event, ui ) {
+                               $( this ).removeClass( "ui-dialog-resizing" );
+                               options.height = $( this ).height();
+                               options.width = $( this ).width();
+                               that._trigger( "resizeStop", event, filteredUi( ui ) );
+                               $.ui.dialog.overlay.resize();
+                       }
+               })
+               .css( "position", position )
+               .find( ".ui-resizable-se" )
+                       .addClass( "ui-icon ui-icon-grip-diagonal-se" );
+       },
+
+       _minHeight: function() {
+               var options = this.options;
+
+               if ( options.height === "auto" ) {
+                       return options.minHeight;
+               } else {
+                       return Math.min( options.minHeight, options.height );
+               }
+       },
+
+       _position: function( position ) {
+               var myAt = [],
+                       offset = [ 0, 0 ],
+                       isVisible;
+
+               if ( position ) {
+                       // deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
+       //              if (typeof position == 'string' || $.isArray(position)) {
+       //                      myAt = $.isArray(position) ? position : position.split(' ');
+
+                       if ( typeof position === "string" || (typeof position === "object" && "0" in position ) ) {
+                               myAt = position.split ? position.split( " " ) : [ position[ 0 ], position[ 1 ] ];
+                               if ( myAt.length === 1 ) {
+                                       myAt[ 1 ] = myAt[ 0 ];
+                               }
+
+                               $.each( [ "left", "top" ], function( i, offsetPosition ) {
+                                       if ( +myAt[ i ] === myAt[ i ] ) {
+                                               offset[ i ] = myAt[ i ];
+                                               myAt[ i ] = offsetPosition;
+                                       }
+                               });
+
+                               position = {
+                                       my: myAt[0] + (offset[0] < 0 ? offset[0] : "+" + offset[0]) + " " +
+                                               myAt[1] + (offset[1] < 0 ? offset[1] : "+" + offset[1]),
+                                       at: myAt.join( " " )
+                               };
+                       }
+
+                       position = $.extend( {}, $.ui.dialog.prototype.options.position, position );
+               } else {
+                       position = $.ui.dialog.prototype.options.position;
+               }
+
+               // need to show the dialog to get the actual offset in the position plugin
+               isVisible = this.uiDialog.is( ":visible" );
+               if ( !isVisible ) {
+                       this.uiDialog.show();
+               }
+               this.uiDialog.position( position );
+               if ( !isVisible ) {
+                       this.uiDialog.hide();
+               }
+       },
+
+       _setOptions: function( options ) {
+               var that = this,
+                       resizableOptions = {},
+                       resize = false;
+
+               $.each( options, function( key, value ) {
+                       that._setOption( key, value );
+
+                       if ( key in sizeRelatedOptions ) {
+                               resize = true;
+                       }
+                       if ( key in resizableRelatedOptions ) {
+                               resizableOptions[ key ] = value;
+                       }
+               });
+
+               if ( resize ) {
+                       this._size();
+               }
+               if ( this.uiDialog.is( ":data(resizable)" ) ) {
+                       this.uiDialog.resizable( "option", resizableOptions );
+               }
+       },
+
+       _setOption: function( key, value ) {
+               var isDraggable, isResizable,
+                       uiDialog = this.uiDialog;
+
+               switch ( key ) {
+                       case "buttons":
+                               this._createButtons( value );
+                               break;
+                       case "closeText":
+                               // ensure that we always pass a string
+                               this.uiDialogTitlebarCloseText.text( "" + value );
+                               break;
+                       case "dialogClass":
+                               uiDialog
+                                       .removeClass( this.options.dialogClass )
+                                       .addClass( uiDialogClasses + value );
+                               break;
+                       case "disabled":
+                               if ( value ) {
+                                       uiDialog.addClass( "ui-dialog-disabled" );
+                               } else {
+                                       uiDialog.removeClass( "ui-dialog-disabled" );
+                               }
+                               break;
+                       case "draggable":
+                               isDraggable = uiDialog.is( ":data(draggable)" );
+                               if ( isDraggable && !value ) {
+                                       uiDialog.draggable( "destroy" );
+                               }
+
+                               if ( !isDraggable && value ) {
+                                       this._makeDraggable();
+                               }
+                               break;
+                       case "position":
+                               this._position( value );
+                               break;
+                       case "resizable":
+                               // currently resizable, becoming non-resizable
+                               isResizable = uiDialog.is( ":data(resizable)" );
+                               if ( isResizable && !value ) {
+                                       uiDialog.resizable( "destroy" );
+                               }
+
+                               // currently resizable, changing handles
+                               if ( isResizable && typeof value === "string" ) {
+                                       uiDialog.resizable( "option", "handles", value );
+                               }
+
+                               // currently non-resizable, becoming resizable
+                               if ( !isResizable && value !== false ) {
+                                       this._makeResizable( value );
+                               }
+                               break;
+                       case "title":
+                               // convert whatever was passed in o a string, for html() to not throw up
+                               $( ".ui-dialog-title", this.uiDialogTitlebar )
+                                       .html( "" + ( value || "&#160;" ) );
+                               break;
+               }
+
+               this._super( key, value );
+       },
+
+       _size: function() {
+               /* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
+                * divs will both have width and height set, so we need to reset them
+                */
+               var nonContentHeight, minContentHeight, autoHeight,
+                       options = this.options,
+                       isVisible = this.uiDialog.is( ":visible" );
+
+               // reset content sizing
+               this.element.show().css({
+                       width: "auto",
+                       minHeight: 0,
+                       height: 0
+               });
+
+               if ( options.minWidth > options.width ) {
+                       options.width = options.minWidth;
+               }
+
+               // reset wrapper sizing
+               // determine the height of all the non-content elements
+               nonContentHeight = this.uiDialog.css({
+                               height: "auto",
+                               width: options.width
+                       })
+                       .outerHeight();
+               minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
+
+               if ( options.height === "auto" ) {
+                       // only needed for IE6 support
+                       if ( $.support.minHeight ) {
+                               this.element.css({
+                                       minHeight: minContentHeight,
+                                       height: "auto"
+                               });
+                       } else {
+                               this.uiDialog.show();
+                               autoHeight = this.element.css( "height", "auto" ).height();
+                               if ( !isVisible ) {
+                                       this.uiDialog.hide();
+                               }
+                               this.element.height( Math.max( autoHeight, minContentHeight ) );
+                       }
+               } else {
+                       this.element.height( Math.max( options.height - nonContentHeight, 0 ) );
+               }
+
+               if (this.uiDialog.is( ":data(resizable)" ) ) {
+                       this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
+               }
+       }
+});
+
+$.extend($.ui.dialog, {
+       uuid: 0,
+       maxZ: 0,
+
+       getTitleId: function($el) {
+               var id = $el.attr( "id" );
+               if ( !id ) {
+                       this.uuid += 1;
+                       id = this.uuid;
+               }
+               return "ui-dialog-title-" + id;
+       },
+
+       overlay: function( dialog ) {
+               this.$el = $.ui.dialog.overlay.create( dialog );
+       }
+});
+
+$.extend( $.ui.dialog.overlay, {
+       instances: [],
+       // reuse old instances due to IE memory leak with alpha transparency (see #5185)
+       oldInstances: [],
+       maxZ: 0,
+       events: $.map(
+               "focus,mousedown,mouseup,keydown,keypress,click".split( "," ),
+               function( event ) {
+                       return event + ".dialog-overlay";
+               }
+       ).join( " " ),
+       create: function( dialog ) {
+               if ( this.instances.length === 0 ) {
+                       // prevent use of anchors and inputs
+                       // we use a setTimeout in case the overlay is created from an
+                       // event that we're going to be cancelling (see #2804)
+                       setTimeout(function() {
+                               // handle $(el).dialog().dialog('close') (see #4065)
+                               if ( $.ui.dialog.overlay.instances.length ) {
+                                       $( document ).bind( $.ui.dialog.overlay.events, function( event ) {
+                                               // stop events if the z-index of the target is < the z-index of the overlay
+                                               // we cannot return true when we don't want to cancel the event (#3523)
+                                               if ( $( event.target ).zIndex() < $.ui.dialog.overlay.maxZ ) {
+                                                       return false;
+                                               }
+                                       });
+                               }
+                       }, 1 );
+
+                       // handle window resize
+                       $( window ).bind( "resize.dialog-overlay", $.ui.dialog.overlay.resize );
+               }
+
+               var $el = ( this.oldInstances.pop() || $( "<div>" ).addClass( "ui-widget-overlay" ) );
+
+               // allow closing by pressing the escape key
+               $( document ).bind( "keydown.dialog-overlay", function( event ) {
+                       var instances = $.ui.dialog.overlay.instances;
+                       // only react to the event if we're the top overlay
+                       if ( instances.length !== 0 && instances[ instances.length - 1 ] === $el &&
+                               dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
+                               event.keyCode === $.ui.keyCode.ESCAPE ) {
+
+                               dialog.close( event );
+                               event.preventDefault();
+                       }
+               });
+
+               $el.appendTo( document.body ).css({
+                       width: this.width(),
+                       height: this.height()
+               });
+
+               if ( $.fn.bgiframe ) {
+                       $el.bgiframe();
+               }
+
+               this.instances.push( $el );
+               return $el;
+       },
+
+       destroy: function( $el ) {
+               var indexOf = $.inArray( $el, this.instances ),
+                       maxZ = 0;
+
+               if ( indexOf !== -1 ) {
+                       this.oldInstances.push( this.instances.splice( indexOf, 1 )[ 0 ] );
+               }
+
+               if ( this.instances.length === 0 ) {
+                       $( [ document, window ] ).unbind( ".dialog-overlay" );
+               }
+
+               $el.height( 0 ).width( 0 ).remove();
+
+               // adjust the maxZ to allow other modal dialogs to continue to work (see #4309)
+               $.each( this.instances, function() {
+                       maxZ = Math.max( maxZ, this.css( "z-index" ) );
+               });
+               this.maxZ = maxZ;
+       },
+
+       height: function() {
+               var scrollHeight,
+                       offsetHeight;
+               // handle IE
+               if ( $.ui.ie ) {
+                       scrollHeight = Math.max(
+                               document.documentElement.scrollHeight,
+                               document.body.scrollHeight
+                       );
+                       offsetHeight = Math.max(
+                               document.documentElement.offsetHeight,
+                               document.body.offsetHeight
+                       );
+
+                       if ( scrollHeight < offsetHeight ) {
+                               return $( window ).height() + "px";
+                       } else {
+                               return scrollHeight + "px";
+                       }
+               // handle "good" browsers
+               } else {
+                       return $( document ).height() + "px";
+               }
+       },
+
+       width: function() {
+               var scrollWidth,
+                       offsetWidth;
+               // handle IE
+               if ( $.ui.ie ) {
+                       scrollWidth = Math.max(
+                               document.documentElement.scrollWidth,
+                               document.body.scrollWidth
+                       );
+                       offsetWidth = Math.max(
+                               document.documentElement.offsetWidth,
+                               document.body.offsetWidth
+                       );
+
+                       if ( scrollWidth < offsetWidth ) {
+                               return $( window ).width() + "px";
+                       } else {
+                               return scrollWidth + "px";
+                       }
+               // handle "good" browsers
+               } else {
+                       return $( document ).width() + "px";
+               }
+       },
+
+       resize: function() {
+               /* If the dialog is draggable and the user drags it past the
+                * right edge of the window, the document becomes wider so we
+                * need to stretch the overlay. If the user then drags the
+                * dialog back to the left, the document will become narrower,
+                * so we need to shrink the overlay to the appropriate size.
+                * This is handled by shrinking the overlay before setting it
+                * to the full document size.
+                */
+               var $overlays = $( [] );
+               $.each( $.ui.dialog.overlay.instances, function() {
+                       $overlays = $overlays.add( this );
+               });
+
+               $overlays.css({
+                       width: 0,
+                       height: 0
+               }).css({
+                       width: $.ui.dialog.overlay.width(),
+                       height: $.ui.dialog.overlay.height()
+               });
+       }
+});
+
+$.extend( $.ui.dialog.overlay.prototype, {
+       destroy: function() {
+               $.ui.dialog.overlay.destroy( this.$el );
+       }
+});
+
+}( jQuery ) );
+(function( $, undefined ) {
+
+$.widget("ui.draggable", $.ui.mouse, {
+       version: "1.9.2",
+       widgetEventPrefix: "drag",
+       options: {
+               addClasses: true,
+               appendTo: "parent",
+               axis: false,
+               connectToSortable: false,
+               containment: false,
+               cursor: "auto",
+               cursorAt: false,
+               grid: false,
+               handle: false,
+               helper: "original",
+               iframeFix: false,
+               opacity: false,
+               refreshPositions: false,
+               revert: false,
+               revertDuration: 500,
+               scope: "default",
+               scroll: true,
+               scrollSensitivity: 20,
+               scrollSpeed: 20,
+               snap: false,
+               snapMode: "both",
+               snapTolerance: 20,
+               stack: false,
+               zIndex: false
+       },
+       _create: function() {
+
+               if (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css("position")))
+                       this.element[0].style.position = 'relative';
+
+               (this.options.addClasses && this.element.addClass("ui-draggable"));
+               (this.options.disabled && this.element.addClass("ui-draggable-disabled"));
+
+               this._mouseInit();
+
+       },
+
+       _destroy: function() {
+               this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" );
+               this._mouseDestroy();
+       },
+
+       _mouseCapture: function(event) {
+
+               var o = this.options;
+
+               // among others, prevent a drag on a resizable-handle
+               if (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))
+                       return false;
+
+               //Quit if we're not on a valid handle
+               this.handle = this._getHandle(event);
+               if (!this.handle)
+                       return false;
+
+               $(o.iframeFix === true ? "iframe" : o.iframeFix).each(function() {
+                       $('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>')
+                       .css({
+                               width: this.offsetWidth+"px", height: this.offsetHeight+"px",
+                               position: "absolute", opacity: "0.001", zIndex: 1000
+                       })
+                       .css($(this).offset())
+                       .appendTo("body");
+               });
+
+               return true;
+
+       },
+
+       _mouseStart: function(event) {
+
+               var o = this.options;
+
+               //Create and append the visible helper
+               this.helper = this._createHelper(event);
+
+               this.helper.addClass("ui-draggable-dragging");
+
+               //Cache the helper size
+               this._cacheHelperProportions();
+
+               //If ddmanager is used for droppables, set the global draggable
+               if($.ui.ddmanager)
+                       $.ui.ddmanager.current = this;
+
+               /*
+                * - Position generation -
+                * This block generates everything position related - it's the core of draggables.
+                */
+
+               //Cache the margins of the original element
+               this._cacheMargins();
+
+               //Store the helper's css position
+               this.cssPosition = this.helper.css("position");
+               this.scrollParent = this.helper.scrollParent();
+
+               //The element's absolute position on the page minus margins
+               this.offset = this.positionAbs = this.element.offset();
+               this.offset = {
+                       top: this.offset.top - this.margins.top,
+                       left: this.offset.left - this.margins.left
+               };
+
+               $.extend(this.offset, {
+                       click: { //Where the click happened, relative to the element
+                               left: event.pageX - this.offset.left,
+                               top: event.pageY - this.offset.top
+                       },
+                       parent: this._getParentOffset(),
+                       relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
+               });
+
+               //Generate the original position
+               this.originalPosition = this.position = this._generatePosition(event);
+               this.originalPageX = event.pageX;
+               this.originalPageY = event.pageY;
+
+               //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
+               (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
+
+               //Set a containment if given in the options
+               if(o.containment)
+                       this._setContainment();
+
+               //Trigger event + callbacks
+               if(this._trigger("start", event) === false) {
+                       this._clear();
+                       return false;
+               }
+
+               //Recache the helper size
+               this._cacheHelperProportions();
+
+               //Prepare the droppable offsets
+               if ($.ui.ddmanager && !o.dropBehaviour)
+                       $.ui.ddmanager.prepareOffsets(this, event);
+
+
+               this._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+
+               //If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)
+               if ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event);
+
+               return true;
+       },
+
+       _mouseDrag: function(event, noPropagation) {
+
+               //Compute the helpers position
+               this.position = this._generatePosition(event);
+               this.positionAbs = this._convertPositionTo("absolute");
+
+               //Call plugins and callbacks and use the resulting position if something is returned
+               if (!noPropagation) {
+                       var ui = this._uiHash();
+                       if(this._trigger('drag', event, ui) === false) {
+                               this._mouseUp({});
+                               return false;
+                       }
+                       this.position = ui.position;
+               }
+
+               if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
+               if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
+               if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
+
+               return false;
+       },
+
+       _mouseStop: function(event) {
+
+               //If we are using droppables, inform the manager about the drop
+               var dropped = false;
+               if ($.ui.ddmanager && !this.options.dropBehaviour)
+                       dropped = $.ui.ddmanager.drop(this, event);
+
+               //if a drop comes from outside (a sortable)
+               if(this.dropped) {
+                       dropped = this.dropped;
+                       this.dropped = false;
+               }
+
+               //if the original element is no longer in the DOM don't bother to continue (see #8269)
+               var element = this.element[0], elementInDom = false;
+               while ( element && (element = element.parentNode) ) {
+                       if (element == document ) {
+                               elementInDom = true;
+                       }
+               }
+               if ( !elementInDom && this.options.helper === "original" )
+                       return false;
+
+               if((this.options.revert == "invalid" && !dropped) || (this.options.revert == "valid" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {
+                       var that = this;
+                       $(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {
+                               if(that._trigger("stop", event) !== false) {
+                                       that._clear();
+                               }
+                       });
+               } else {
+                       if(this._trigger("stop", event) !== false) {
+                               this._clear();
+                       }
+               }
+
+               return false;
+       },
+
+       _mouseUp: function(event) {
+               //Remove frame helpers
+               $("div.ui-draggable-iframeFix").each(function() {
+                       this.parentNode.removeChild(this);
+               });
+
+               //If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)
+               if( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event);
+
+               return $.ui.mouse.prototype._mouseUp.call(this, event);
+       },
+
+       cancel: function() {
+
+               if(this.helper.is(".ui-draggable-dragging")) {
+                       this._mouseUp({});
+               } else {
+                       this._clear();
+               }
+
+               return this;
+
+       },
+
+       _getHandle: function(event) {
+
+               var handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;
+               $(this.options.handle, this.element)
+                       .find("*")
+                       .andSelf()
+                       .each(function() {
+                               if(this == event.target) handle = true;
+                       });
+
+               return handle;
+
+       },
+
+       _createHelper: function(event) {
+
+               var o = this.options;
+               var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element);
+
+               if(!helper.parents('body').length)
+                       helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
+
+               if(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css("position")))
+                       helper.css("position", "absolute");
+
+               return helper;
+
+       },
+
+       _adjustOffsetFromHelper: function(obj) {
+               if (typeof obj == 'string') {
+                       obj = obj.split(' ');
+               }
+               if ($.isArray(obj)) {
+                       obj = {left: +obj[0], top: +obj[1] || 0};
+               }
+               if ('left' in obj) {
+                       this.offset.click.left = obj.left + this.margins.left;
+               }
+               if ('right' in obj) {
+                       this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
+               }
+               if ('top' in obj) {
+                       this.offset.click.top = obj.top + this.margins.top;
+               }
+               if ('bottom' in obj) {
+                       this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
+               }
+       },
+
+       _getParentOffset: function() {
+
+               //Get the offsetParent and cache its position
+               this.offsetParent = this.helper.offsetParent();
+               var po = this.offsetParent.offset();
+
+               // This is a special case where we need to modify a offset calculated on start, since the following happened:
+               // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
+               // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
+               //    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
+               if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
+                       po.left += this.scrollParent.scrollLeft();
+                       po.top += this.scrollParent.scrollTop();
+               }
+
+               if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
+               || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix
+                       po = { top: 0, left: 0 };
+
+               return {
+                       top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
+                       left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
+               };
+
+       },
+
+       _getRelativeOffset: function() {
+
+               if(this.cssPosition == "relative") {
+                       var p = this.element.position();
+                       return {
+                               top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
+                               left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
+                       };
+               } else {
+                       return { top: 0, left: 0 };
+               }
+
+       },
+
+       _cacheMargins: function() {
+               this.margins = {
+                       left: (parseInt(this.element.css("marginLeft"),10) || 0),
+                       top: (parseInt(this.element.css("marginTop"),10) || 0),
+                       right: (parseInt(this.element.css("marginRight"),10) || 0),
+                       bottom: (parseInt(this.element.css("marginBottom"),10) || 0)
+               };
+       },
+
+       _cacheHelperProportions: function() {
+               this.helperProportions = {
+                       width: this.helper.outerWidth(),
+                       height: this.helper.outerHeight()
+               };
+       },
+
+       _setContainment: function() {
+
+               var o = this.options;
+               if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
+               if(o.containment == 'document' || o.containment == 'window') this.containment = [
+                       o.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,
+                       o.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,
+                       (o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
+                       (o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
+               ];
+
+               if(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {
+                       var c = $(o.containment);
+                       var ce = c[0]; if(!ce) return;
+                       var co = c.offset();
+                       var over = ($(ce).css("overflow") != 'hidden');
+
+                       this.containment = [
+                               (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0),
+                               (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0),
+                               (over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right,
+                               (over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top  - this.margins.bottom
+                       ];
+                       this.relative_container = c;
+
+               } else if(o.containment.constructor == Array) {
+                       this.containment = o.containment;
+               }
+
+       },
+
+       _convertPositionTo: function(d, pos) {
+
+               if(!pos) pos = this.position;
+               var mod = d == "absolute" ? 1 : -1;
+               var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+
+               return {
+                       top: (
+                               pos.top                                                                                                                                 // The absolute mouse position
+                               + this.offset.relative.top * mod                                                                                // Only for relative positioned nodes: Relative offset from element to offset parent
+                               + this.offset.parent.top * mod                                                                                  // The offsetParent's offset without borders (offset + border)
+                               - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
+                       ),
+                       left: (
+                               pos.left                                                                                                                                // The absolute mouse position
+                               + this.offset.relative.left * mod                                                                               // Only for relative positioned nodes: Relative offset from element to offset parent
+                               + this.offset.parent.left * mod                                                                                 // The offsetParent's offset without borders (offset + border)
+                               - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
+                       )
+               };
+
+       },
+
+       _generatePosition: function(event) {
+
+               var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+               var pageX = event.pageX;
+               var pageY = event.pageY;
+
+               /*
+                * - Position constraining -
+                * Constrain the position to a mix of grid, containment.
+                */
+
+               if(this.originalPosition) { //If we are not dragging yet, we won't check for options
+                       var containment;
+                       if(this.containment) {
+                       if (this.relative_container){
+                               var co = this.relative_container.offset();
+                               containment = [ this.containment[0] + co.left,
+                                       this.containment[1] + co.top,
+                                       this.containment[2] + co.left,
+                                       this.containment[3] + co.top ];
+                       }
+                       else {
+                               containment = this.containment;
+                       }
+
+                               if(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left;
+                               if(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top;
+                               if(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left;
+                               if(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top;
+                       }
+
+                       if(o.grid) {
+                               //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
+                               var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
+                               pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+
+                               var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
+                               pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+                       }
+
+               }
+
+               return {
+                       top: (
+                               pageY                                                                                                                           // The absolute mouse position
+                               - this.offset.click.top                                                                                                 // Click offset (relative to the element)
+                               - this.offset.relative.top                                                                                              // Only for relative positioned nodes: Relative offset from element to offset parent
+                               - this.offset.parent.top                                                                                                // The offsetParent's offset without borders (offset + border)
+                               + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
+                       ),
+                       left: (
+                               pageX                                                                                                                           // The absolute mouse position
+                               - this.offset.click.left                                                                                                // Click offset (relative to the element)
+                               - this.offset.relative.left                                                                                             // Only for relative positioned nodes: Relative offset from element to offset parent
+                               - this.offset.parent.left                                                                                               // The offsetParent's offset without borders (offset + border)
+                               + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
+                       )
+               };
+
+       },
+
+       _clear: function() {
+               this.helper.removeClass("ui-draggable-dragging");
+               if(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();
+               //if($.ui.ddmanager) $.ui.ddmanager.current = null;
+               this.helper = null;
+               this.cancelHelperRemoval = false;
+       },
+
+       // From now on bulk stuff - mainly helpers
+
+       _trigger: function(type, event, ui) {
+               ui = ui || this._uiHash();
+               $.ui.plugin.call(this, type, [event, ui]);
+               if(type == "drag") this.positionAbs = this._convertPositionTo("absolute"); //The absolute position has to be recalculated after plugins
+               return $.Widget.prototype._trigger.call(this, type, event, ui);
+       },
+
+       plugins: {},
+
+       _uiHash: function(event) {
+               return {
+                       helper: this.helper,
+                       position: this.position,
+                       originalPosition: this.originalPosition,
+                       offset: this.positionAbs
+               };
+       }
+
+});
+
+$.ui.plugin.add("draggable", "connectToSortable", {
+       start: function(event, ui) {
+
+               var inst = $(this).data("draggable"), o = inst.options,
+                       uiSortable = $.extend({}, ui, { item: inst.element });
+               inst.sortables = [];
+               $(o.connectToSortable).each(function() {
+                       var sortable = $.data(this, 'sortable');
+                       if (sortable && !sortable.options.disabled) {
+                               inst.sortables.push({
+                                       instance: sortable,
+                                       shouldRevert: sortable.options.revert
+                               });
+                               sortable.refreshPositions();    // Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page).
+                               sortable._trigger("activate", event, uiSortable);
+                       }
+               });
+
+       },
+       stop: function(event, ui) {
+
+               //If we are still over the sortable, we fake the stop event of the sortable, but also remove helper
+               var inst = $(this).data("draggable"),
+                       uiSortable = $.extend({}, ui, { item: inst.element });
+
+               $.each(inst.sortables, function() {
+                       if(this.instance.isOver) {
+
+                               this.instance.isOver = 0;
+
+                               inst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance
+                               this.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)
+
+                               //The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'
+                               if(this.shouldRevert) this.instance.options.revert = true;
+
+                               //Trigger the stop of the sortable
+                               this.instance._mouseStop(event);
+
+                               this.instance.options.helper = this.instance.options._helper;
+
+                               //If the helper has been the original item, restore properties in the sortable
+                               if(inst.options.helper == 'original')
+                                       this.instance.currentItem.css({ top: 'auto', left: 'auto' });
+
+                       } else {
+                               this.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance
+                               this.instance._trigger("deactivate", event, uiSortable);
+                       }
+
+               });
+
+       },
+       drag: function(event, ui) {
+
+               var inst = $(this).data("draggable"), that = this;
+
+               var checkPos = function(o) {
+                       var dyClick = this.offset.click.top, dxClick = this.offset.click.left;
+                       var helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;
+                       var itemHeight = o.height, itemWidth = o.width;
+                       var itemTop = o.top, itemLeft = o.left;
+
+                       return $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);
+               };
+
+               $.each(inst.sortables, function(i) {
+
+                       var innermostIntersecting = false;
+                       var thisSortable = this;
+                       //Copy over some variables to allow calling the sortable's native _intersectsWith
+                       this.instance.positionAbs = inst.positionAbs;
+                       this.instance.helperProportions = inst.helperProportions;
+                       this.instance.offset.click = inst.offset.click;
+
+                       if(this.instance._intersectsWith(this.instance.containerCache)) {
+                               innermostIntersecting = true;
+                               $.each(inst.sortables, function () {
+                                       this.instance.positionAbs = inst.positionAbs;
+                                       this.instance.helperProportions = inst.helperProportions;
+                                       this.instance.offset.click = inst.offset.click;
+                                       if  (this != thisSortable
+                                               && this.instance._intersectsWith(this.instance.containerCache)
+                                               && $.ui.contains(thisSortable.instance.element[0], this.instance.element[0]))
+                                               innermostIntersecting = false;
+                                               return innermostIntersecting;
+                               });
+                       }
+
+
+                       if(innermostIntersecting) {
+                               //If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
+                               if(!this.instance.isOver) {
+
+                                       this.instance.isOver = 1;
+                                       //Now we fake the start of dragging for the sortable instance,
+                                       //by cloning the list group item, appending it to the sortable and using it as inst.currentItem
+                                       //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
+                                       this.instance.currentItem = $(that).clone().removeAttr('id').appendTo(this.instance.element).data("sortable-item", true);
+                                       this.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it
+                                       this.instance.options.helper = function() { return ui.helper[0]; };
+
+                                       event.target = this.instance.currentItem[0];
+                                       this.instance._mouseCapture(event, true);
+                                       this.instance._mouseStart(event, true, true);
+
+                                       //Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes
+                                       this.instance.offset.click.top = inst.offset.click.top;
+                                       this.instance.offset.click.left = inst.offset.click.left;
+                                       this.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;
+                                       this.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;
+
+                                       inst._trigger("toSortable", event);
+                                       inst.dropped = this.instance.element; //draggable revert needs that
+                                       //hack so receive/update callbacks work (mostly)
+                                       inst.currentItem = inst.element;
+                                       this.instance.fromOutside = inst;
+
+                               }
+
+                               //Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable
+                               if(this.instance.currentItem) this.instance._mouseDrag(event);
+
+                       } else {
+
+                               //If it doesn't intersect with the sortable, and it intersected before,
+                               //we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval
+                               if(this.instance.isOver) {
+
+                                       this.instance.isOver = 0;
+                                       this.instance.cancelHelperRemoval = true;
+
+                                       //Prevent reverting on this forced stop
+                                       this.instance.options.revert = false;
+
+                                       // The out event needs to be triggered independently
+                                       this.instance._trigger('out', event, this.instance._uiHash(this.instance));
+
+                                       this.instance._mouseStop(event, true);
+                                       this.instance.options.helper = this.instance.options._helper;
+
+                                       //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
+                                       this.instance.currentItem.remove();
+                                       if(this.instance.placeholder) this.instance.placeholder.remove();
+
+                                       inst._trigger("fromSortable", event);
+                                       inst.dropped = false; //draggable revert needs that
+                               }
+
+                       };
+
+               });
+
+       }
+});
+
+$.ui.plugin.add("draggable", "cursor", {
+       start: function(event, ui) {
+               var t = $('body'), o = $(this).data('draggable').options;
+               if (t.css("cursor")) o._cursor = t.css("cursor");
+               t.css("cursor", o.cursor);
+       },
+       stop: function(event, ui) {
+               var o = $(this).data('draggable').options;
+               if (o._cursor) $('body').css("cursor", o._cursor);
+       }
+});
+
+$.ui.plugin.add("draggable", "opacity", {
+       start: function(event, ui) {
+               var t = $(ui.helper), o = $(this).data('draggable').options;
+               if(t.css("opacity")) o._opacity = t.css("opacity");
+               t.css('opacity', o.opacity);
+       },
+       stop: function(event, ui) {
+               var o = $(this).data('draggable').options;
+               if(o._opacity) $(ui.helper).css('opacity', o._opacity);
+       }
+});
+
+$.ui.plugin.add("draggable", "scroll", {
+       start: function(event, ui) {
+               var i = $(this).data("draggable");
+               if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();
+       },
+       drag: function(event, ui) {
+
+               var i = $(this).data("draggable"), o = i.options, scrolled = false;
+
+               if(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {
+
+                       if(!o.axis || o.axis != 'x') {
+                               if((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
+                                       i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;
+                               else if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)
+                                       i.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;
+                       }
+
+                       if(!o.axis || o.axis != 'y') {
+                               if((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
+                                       i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;
+                               else if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)
+                                       i.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;
+                       }
+
+               } else {
+
+                       if(!o.axis || o.axis != 'x') {
+                               if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
+                                       scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
+                               else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
+                                       scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
+                       }
+
+                       if(!o.axis || o.axis != 'y') {
+                               if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
+                                       scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
+                               else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
+                                       scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
+                       }
+
+               }
+
+               if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
+                       $.ui.ddmanager.prepareOffsets(i, event);
+
+       }
+});
+
+$.ui.plugin.add("draggable", "snap", {
+       start: function(event, ui) {
+
+               var i = $(this).data("draggable"), o = i.options;
+               i.snapElements = [];
+
+               $(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {
+                       var $t = $(this); var $o = $t.offset();
+                       if(this != i.element[0]) i.snapElements.push({
+                               item: this,
+                               width: $t.outerWidth(), height: $t.outerHeight(),
+                               top: $o.top, left: $o.left
+                       });
+               });
+
+       },
+       drag: function(event, ui) {
+
+               var inst = $(this).data("draggable"), o = inst.options;
+               var d = o.snapTolerance;
+
+               var x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,
+                       y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;
+
+               for (var i = inst.snapElements.length - 1; i >= 0; i--){
+
+                       var l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,
+                               t = inst.snapElements[i].top, b = t + inst.snapElements[i].height;
+
+                       //Yes, I know, this is insane ;)
+                       if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {
+                               if(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
+                               inst.snapElements[i].snapping = false;
+                               continue;
+                       }
+
+                       if(o.snapMode != 'inner') {
+                               var ts = Math.abs(t - y2) <= d;
+                               var bs = Math.abs(b - y1) <= d;
+                               var ls = Math.abs(l - x2) <= d;
+                               var rs = Math.abs(r - x1) <= d;
+                               if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
+                               if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b, left: 0 }).top - inst.margins.top;
+                               if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;
+                               if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r }).left - inst.margins.left;
+                       }
+
+                       var first = (ts || bs || ls || rs);
+
+                       if(o.snapMode != 'outer') {
+                               var ts = Math.abs(t - y1) <= d;
+                               var bs = Math.abs(b - y2) <= d;
+                               var ls = Math.abs(l - x1) <= d;
+                               var rs = Math.abs(r - x2) <= d;
+                               if(ts) ui.position.top = inst._convertPositionTo("relative", { top: t, left: 0 }).top - inst.margins.top;
+                               if(bs) ui.position.top = inst._convertPositionTo("relative", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;
+                               if(ls) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: l }).left - inst.margins.left;
+                               if(rs) ui.position.left = inst._convertPositionTo("relative", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;
+                       }
+
+                       if(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))
+                               (inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));
+                       inst.snapElements[i].snapping = (ts || bs || ls || rs || first);
+
+               };
+
+       }
+});
+
+$.ui.plugin.add("draggable", "stack", {
+       start: function(event, ui) {
+
+               var o = $(this).data("draggable").options;
+
+               var group = $.makeArray($(o.stack)).sort(function(a,b) {
+                       return (parseInt($(a).css("zIndex"),10) || 0) - (parseInt($(b).css("zIndex"),10) || 0);
+               });
+               if (!group.length) { return; }
+
+               var min = parseInt(group[0].style.zIndex) || 0;
+               $(group).each(function(i) {
+                       this.style.zIndex = min + i;
+               });
+
+               this[0].style.zIndex = min + group.length;
+
+       }
+});
+
+$.ui.plugin.add("draggable", "zIndex", {
+       start: function(event, ui) {
+               var t = $(ui.helper), o = $(this).data("draggable").options;
+               if(t.css("zIndex")) o._zIndex = t.css("zIndex");
+               t.css('zIndex', o.zIndex);
+       },
+       stop: function(event, ui) {
+               var o = $(this).data("draggable").options;
+               if(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);
+       }
+});
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.widget("ui.droppable", {
+       version: "1.9.2",
+       widgetEventPrefix: "drop",
+       options: {
+               accept: '*',
+               activeClass: false,
+               addClasses: true,
+               greedy: false,
+               hoverClass: false,
+               scope: 'default',
+               tolerance: 'intersect'
+       },
+       _create: function() {
+
+               var o = this.options, accept = o.accept;
+               this.isover = 0; this.isout = 1;
+
+               this.accept = $.isFunction(accept) ? accept : function(d) {
+                       return d.is(accept);
+               };
+
+               //Store the droppable's proportions
+               this.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };
+
+               // Add the reference and positions to the manager
+               $.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];
+               $.ui.ddmanager.droppables[o.scope].push(this);
+
+               (o.addClasses && this.element.addClass("ui-droppable"));
+
+       },
+
+       _destroy: function() {
+               var drop = $.ui.ddmanager.droppables[this.options.scope];
+               for ( var i = 0; i < drop.length; i++ )
+                       if ( drop[i] == this )
+                               drop.splice(i, 1);
+
+               this.element.removeClass("ui-droppable ui-droppable-disabled");
+       },
+
+       _setOption: function(key, value) {
+
+               if(key == 'accept') {
+                       this.accept = $.isFunction(value) ? value : function(d) {
+                               return d.is(value);
+                       };
+               }
+               $.Widget.prototype._setOption.apply(this, arguments);
+       },
+
+       _activate: function(event) {
+               var draggable = $.ui.ddmanager.current;
+               if(this.options.activeClass) this.element.addClass(this.options.activeClass);
+               (draggable && this._trigger('activate', event, this.ui(draggable)));
+       },
+
+       _deactivate: function(event) {
+               var draggable = $.ui.ddmanager.current;
+               if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
+               (draggable && this._trigger('deactivate', event, this.ui(draggable)));
+       },
+
+       _over: function(event) {
+
+               var draggable = $.ui.ddmanager.current;
+               if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
+
+               if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+                       if(this.options.hoverClass) this.element.addClass(this.options.hoverClass);
+                       this._trigger('over', event, this.ui(draggable));
+               }
+
+       },
+
+       _out: function(event) {
+
+               var draggable = $.ui.ddmanager.current;
+               if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element
+
+               if (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+                       if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
+                       this._trigger('out', event, this.ui(draggable));
+               }
+
+       },
+
+       _drop: function(event,custom) {
+
+               var draggable = custom || $.ui.ddmanager.current;
+               if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element
+
+               var childrenIntersection = false;
+               this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function() {
+                       var inst = $.data(this, 'droppable');
+                       if(
+                               inst.options.greedy
+                               && !inst.options.disabled
+                               && inst.options.scope == draggable.options.scope
+                               && inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))
+                               && $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)
+                       ) { childrenIntersection = true; return false; }
+               });
+               if(childrenIntersection) return false;
+
+               if(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+                       if(this.options.activeClass) this.element.removeClass(this.options.activeClass);
+                       if(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);
+                       this._trigger('drop', event, this.ui(draggable));
+                       return this.element;
+               }
+
+               return false;
+
+       },
+
+       ui: function(c) {
+               return {
+                       draggable: (c.currentItem || c.element),
+                       helper: c.helper,
+                       position: c.position,
+                       offset: c.positionAbs
+               };
+       }
+
+});
+
+$.ui.intersect = function(draggable, droppable, toleranceMode) {
+
+       if (!droppable.offset) return false;
+
+       var x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,
+               y1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;
+       var l = droppable.offset.left, r = l + droppable.proportions.width,
+               t = droppable.offset.top, b = t + droppable.proportions.height;
+
+       switch (toleranceMode) {
+               case 'fit':
+                       return (l <= x1 && x2 <= r
+                               && t <= y1 && y2 <= b);
+                       break;
+               case 'intersect':
+                       return (l < x1 + (draggable.helperProportions.width / 2) // Right Half
+                               && x2 - (draggable.helperProportions.width / 2) < r // Left Half
+                               && t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
+                               && y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
+                       break;
+               case 'pointer':
+                       var draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),
+                               draggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),
+                               isOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);
+                       return isOver;
+                       break;
+               case 'touch':
+                       return (
+                                       (y1 >= t && y1 <= b) || // Top edge touching
+                                       (y2 >= t && y2 <= b) || // Bottom edge touching
+                                       (y1 < t && y2 > b)              // Surrounded vertically
+                               ) && (
+                                       (x1 >= l && x1 <= r) || // Left edge touching
+                                       (x2 >= l && x2 <= r) || // Right edge touching
+                                       (x1 < l && x2 > r)              // Surrounded horizontally
+                               );
+                       break;
+               default:
+                       return false;
+                       break;
+               }
+
+};
+
+/*
+       This manager tracks offsets of draggables and droppables
+*/
+$.ui.ddmanager = {
+       current: null,
+       droppables: { 'default': [] },
+       prepareOffsets: function(t, event) {
+
+               var m = $.ui.ddmanager.droppables[t.options.scope] || [];
+               var type = event ? event.type : null; // workaround for #2317
+               var list = (t.currentItem || t.element).find(":data(droppable)").andSelf();
+
+               droppablesLoop: for (var i = 0; i < m.length; i++) {
+
+                       if(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue;   //No disabled and non-accepted
+                       for (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item
+                       m[i].visible = m[i].element.css("display") != "none"; if(!m[i].visible) continue;                                                                       //If the element is not visible, continue
+
+                       if(type == "mousedown") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables
+
+                       m[i].offset = m[i].element.offset();
+                       m[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };
+
+               }
+
+       },
+       drop: function(draggable, event) {
+
+               var dropped = false;
+               $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
+
+                       if(!this.options) return;
+                       if (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))
+                               dropped = this._drop.call(this, event) || dropped;
+
+                       if (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {
+                               this.isout = 1; this.isover = 0;
+                               this._deactivate.call(this, event);
+                       }
+
+               });
+               return dropped;
+
+       },
+       dragStart: function( draggable, event ) {
+               //Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)
+               draggable.element.parentsUntil( "body" ).bind( "scroll.droppable", function() {
+                       if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
+               });
+       },
+       drag: function(draggable, event) {
+
+               //If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
+               if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);
+
+               //Run through all droppables and check their positions based on specific tolerance options
+               $.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {
+
+                       if(this.options.disabled || this.greedyChild || !this.visible) return;
+                       var intersects = $.ui.intersect(draggable, this, this.options.tolerance);
+
+                       var c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);
+                       if(!c) return;
+
+                       var parentInstance;
+                       if (this.options.greedy) {
+                               // find droppable parents with same scope
+                               var scope = this.options.scope;
+                               var parent = this.element.parents(':data(droppable)').filter(function () {
+                                       return $.data(this, 'droppable').options.scope === scope;
+                               });
+
+                               if (parent.length) {
+                                       parentInstance = $.data(parent[0], 'droppable');
+                                       parentInstance.greedyChild = (c == 'isover' ? 1 : 0);
+                               }
+                       }
+
+                       // we just moved into a greedy child
+                       if (parentInstance && c == 'isover') {
+                               parentInstance['isover'] = 0;
+                               parentInstance['isout'] = 1;
+                               parentInstance._out.call(parentInstance, event);
+                       }
+
+                       this[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;
+                       this[c == "isover" ? "_over" : "_out"].call(this, event);
+
+                       // we just moved out of a greedy child
+                       if (parentInstance && c == 'isout') {
+                               parentInstance['isout'] = 0;
+                               parentInstance['isover'] = 1;
+                               parentInstance._over.call(parentInstance, event);
+                       }
+               });
+
+       },
+       dragStop: function( draggable, event ) {
+               draggable.element.parentsUntil( "body" ).unbind( "scroll.droppable" );
+               //Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)
+               if( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );
+       }
+};
+
+})(jQuery);
+;(jQuery.effects || (function($, undefined) {
+
+var backCompat = $.uiBackCompat !== false,
+       // prefix used for storing data on .data()
+       dataSpace = "ui-effects-";
+
+$.effects = {
+       effect: {}
+};
+
+/*!
+ * jQuery Color Animations v2.0.0
+ * http://jquery.com/
+ *
+ * Copyright 2012 jQuery Foundation and other contributors
+ * Released under the MIT license.
+ * http://jquery.org/license
+ *
+ * Date: Mon Aug 13 13:41:02 2012 -0500
+ */
+(function( jQuery, undefined ) {
+
+       var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor".split(" "),
+
+       // plusequals test for += 100 -= 100
+       rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
+       // a set of RE's that can match strings and generate color tuples.
+       stringParsers = [{
+                       re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
+                       parse: function( execResult ) {
+                               return [
+                                       execResult[ 1 ],
+                                       execResult[ 2 ],
+                                       execResult[ 3 ],
+                                       execResult[ 4 ]
+                               ];
+                       }
+               }, {
+                       re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
+                       parse: function( execResult ) {
+                               return [
+                                       execResult[ 1 ] * 2.55,
+                                       execResult[ 2 ] * 2.55,
+                                       execResult[ 3 ] * 2.55,
+                                       execResult[ 4 ]
+                               ];
+                       }
+               }, {
+                       // this regex ignores A-F because it's compared against an already lowercased string
+                       re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
+                       parse: function( execResult ) {
+                               return [
+                                       parseInt( execResult[ 1 ], 16 ),
+                                       parseInt( execResult[ 2 ], 16 ),
+                                       parseInt( execResult[ 3 ], 16 )
+                               ];
+                       }
+               }, {
+                       // this regex ignores A-F because it's compared against an already lowercased string
+                       re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
+                       parse: function( execResult ) {
+                               return [
+                                       parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
+                                       parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
+                                       parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
+                               ];
+                       }
+               }, {
+                       re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,
+                       space: "hsla",
+                       parse: function( execResult ) {
+                               return [
+                                       execResult[ 1 ],
+                                       execResult[ 2 ] / 100,
+                                       execResult[ 3 ] / 100,
+                                       execResult[ 4 ]
+                               ];
+                       }
+               }],
+
+       // jQuery.Color( )
+       color = jQuery.Color = function( color, green, blue, alpha ) {
+               return new jQuery.Color.fn.parse( color, green, blue, alpha );
+       },
+       spaces = {
+               rgba: {
+                       props: {
+                               red: {
+                                       idx: 0,
+                                       type: "byte"
+                               },
+                               green: {
+                                       idx: 1,
+                                       type: "byte"
+                               },
+                               blue: {
+                                       idx: 2,
+                                       type: "byte"
+                               }
+                       }
+               },
+
+               hsla: {
+                       props: {
+                               hue: {
+                                       idx: 0,
+                                       type: "degrees"
+                               },
+                               saturation: {
+                                       idx: 1,
+                                       type: "percent"
+                               },
+                               lightness: {
+                                       idx: 2,
+                                       type: "percent"
+                               }
+                       }
+               }
+       },
+       propTypes = {
+               "byte": {
+                       floor: true,
+                       max: 255
+               },
+               "percent": {
+                       max: 1
+               },
+               "degrees": {
+                       mod: 360,
+                       floor: true
+               }
+       },
+       support = color.support = {},
+
+       // element for support tests
+       supportElem = jQuery( "<p>" )[ 0 ],
+
+       // colors = jQuery.Color.names
+       colors,
+
+       // local aliases of functions called often
+       each = jQuery.each;
+
+// determine rgba support immediately
+supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
+support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
+
+// define cache name and alpha properties
+// for rgba and hsla spaces
+each( spaces, function( spaceName, space ) {
+       space.cache = "_" + spaceName;
+       space.props.alpha = {
+               idx: 3,
+               type: "percent",
+               def: 1
+       };
+});
+
+function clamp( value, prop, allowEmpty ) {
+       var type = propTypes[ prop.type ] || {};
+
+       if ( value == null ) {
+               return (allowEmpty || !prop.def) ? null : prop.def;
+       }
+
+       // ~~ is an short way of doing floor for positive numbers
+       value = type.floor ? ~~value : parseFloat( value );
+
+       // IE will pass in empty strings as value for alpha,
+       // which will hit this case
+       if ( isNaN( value ) ) {
+               return prop.def;
+       }
+
+       if ( type.mod ) {
+               // we add mod before modding to make sure that negatives values
+               // get converted properly: -10 -> 350
+               return (value + type.mod) % type.mod;
+       }
+
+       // for now all property types without mod have min and max
+       return 0 > value ? 0 : type.max < value ? type.max : value;
+}
+
+function stringParse( string ) {
+       var inst = color(),
+               rgba = inst._rgba = [];
+
+       string = string.toLowerCase();
+
+       each( stringParsers, function( i, parser ) {
+               var parsed,
+                       match = parser.re.exec( string ),
+                       values = match && parser.parse( match ),
+                       spaceName = parser.space || "rgba";
+
+               if ( values ) {
+                       parsed = inst[ spaceName ]( values );
+
+                       // if this was an rgba parse the assignment might happen twice
+                       // oh well....
+                       inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
+                       rgba = inst._rgba = parsed._rgba;
+
+                       // exit each( stringParsers ) here because we matched
+                       return false;
+               }
+       });
+
+       // Found a stringParser that handled it
+       if ( rgba.length ) {
+
+               // if this came from a parsed string, force "transparent" when alpha is 0
+               // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
+               if ( rgba.join() === "0,0,0,0" ) {
+                       jQuery.extend( rgba, colors.transparent );
+               }
+               return inst;
+       }
+
+       // named colors
+       return colors[ string ];
+}
+
+color.fn = jQuery.extend( color.prototype, {
+       parse: function( red, green, blue, alpha ) {
+               if ( red === undefined ) {
+                       this._rgba = [ null, null, null, null ];
+                       return this;
+               }
+               if ( red.jquery || red.nodeType ) {
+                       red = jQuery( red ).css( green );
+                       green = undefined;
+               }
+
+               var inst = this,
+                       type = jQuery.type( red ),
+                       rgba = this._rgba = [];
+
+               // more than 1 argument specified - assume ( red, green, blue, alpha )
+               if ( green !== undefined ) {
+                       red = [ red, green, blue, alpha ];
+                       type = "array";
+               }
+
+               if ( type === "string" ) {
+                       return this.parse( stringParse( red ) || colors._default );
+               }
+
+               if ( type === "array" ) {
+                       each( spaces.rgba.props, function( key, prop ) {
+                               rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
+                       });
+                       return this;
+               }
+
+               if ( type === "object" ) {
+                       if ( red instanceof color ) {
+                               each( spaces, function( spaceName, space ) {
+                                       if ( red[ space.cache ] ) {
+                                               inst[ space.cache ] = red[ space.cache ].slice();
+                                       }
+                               });
+                       } else {
+                               each( spaces, function( spaceName, space ) {
+                                       var cache = space.cache;
+                                       each( space.props, function( key, prop ) {
+
+                                               // if the cache doesn't exist, and we know how to convert
+                                               if ( !inst[ cache ] && space.to ) {
+
+                                                       // if the value was null, we don't need to copy it
+                                                       // if the key was alpha, we don't need to copy it either
+                                                       if ( key === "alpha" || red[ key ] == null ) {
+                                                               return;
+                                                       }
+                                                       inst[ cache ] = space.to( inst._rgba );
+                                               }
+
+                                               // this is the only case where we allow nulls for ALL properties.
+                                               // call clamp with alwaysAllowEmpty
+                                               inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
+                                       });
+
+                                       // everything defined but alpha?
+                                       if ( inst[ cache ] && $.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
+                                               // use the default of 1
+                                               inst[ cache ][ 3 ] = 1;
+                                               if ( space.from ) {
+                                                       inst._rgba = space.from( inst[ cache ] );
+                                               }
+                                       }
+                               });
+                       }
+                       return this;
+               }
+       },
+       is: function( compare ) {
+               var is = color( compare ),
+                       same = true,
+                       inst = this;
+
+               each( spaces, function( _, space ) {
+                       var localCache,
+                               isCache = is[ space.cache ];
+                       if (isCache) {
+                               localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
+                               each( space.props, function( _, prop ) {
+                                       if ( isCache[ prop.idx ] != null ) {
+                                               same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
+                                               return same;
+                                       }
+                               });
+                       }
+                       return same;
+               });
+               return same;
+       },
+       _space: function() {
+               var used = [],
+                       inst = this;
+               each( spaces, function( spaceName, space ) {
+                       if ( inst[ space.cache ] ) {
+                               used.push( spaceName );
+                       }
+               });
+               return used.pop();
+       },
+       transition: function( other, distance ) {
+               var end = color( other ),
+                       spaceName = end._space(),
+                       space = spaces[ spaceName ],
+                       startColor = this.alpha() === 0 ? color( "transparent" ) : this,
+                       start = startColor[ space.cache ] || space.to( startColor._rgba ),
+                       result = start.slice();
+
+               end = end[ space.cache ];
+               each( space.props, function( key, prop ) {
+                       var index = prop.idx,
+                               startValue = start[ index ],
+                               endValue = end[ index ],
+                               type = propTypes[ prop.type ] || {};
+
+                       // if null, don't override start value
+                       if ( endValue === null ) {
+                               return;
+                       }
+                       // if null - use end
+                       if ( startValue === null ) {
+                               result[ index ] = endValue;
+                       } else {
+                               if ( type.mod ) {
+                                       if ( endValue - startValue > type.mod / 2 ) {
+                                               startValue += type.mod;
+                                       } else if ( startValue - endValue > type.mod / 2 ) {
+                                               startValue -= type.mod;
+                                       }
+                               }
+                               result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
+                       }
+               });
+               return this[ spaceName ]( result );
+       },
+       blend: function( opaque ) {
+               // if we are already opaque - return ourself
+               if ( this._rgba[ 3 ] === 1 ) {
+                       return this;
+               }
+
+               var rgb = this._rgba.slice(),
+                       a = rgb.pop(),
+                       blend = color( opaque )._rgba;
+
+               return color( jQuery.map( rgb, function( v, i ) {
+                       return ( 1 - a ) * blend[ i ] + a * v;
+               }));
+       },
+       toRgbaString: function() {
+               var prefix = "rgba(",
+                       rgba = jQuery.map( this._rgba, function( v, i ) {
+                               return v == null ? ( i > 2 ? 1 : 0 ) : v;
+                       });
+
+               if ( rgba[ 3 ] === 1 ) {
+                       rgba.pop();
+                       prefix = "rgb(";
+               }
+
+               return prefix + rgba.join() + ")";
+       },
+       toHslaString: function() {
+               var prefix = "hsla(",
+                       hsla = jQuery.map( this.hsla(), function( v, i ) {
+                               if ( v == null ) {
+                                       v = i > 2 ? 1 : 0;
+                               }
+
+                               // catch 1 and 2
+                               if ( i && i < 3 ) {
+                                       v = Math.round( v * 100 ) + "%";
+                               }
+                               return v;
+                       });
+
+               if ( hsla[ 3 ] === 1 ) {
+                       hsla.pop();
+                       prefix = "hsl(";
+               }
+               return prefix + hsla.join() + ")";
+       },
+       toHexString: function( includeAlpha ) {
+               var rgba = this._rgba.slice(),
+                       alpha = rgba.pop();
+
+               if ( includeAlpha ) {
+                       rgba.push( ~~( alpha * 255 ) );
+               }
+
+               return "#" + jQuery.map( rgba, function( v ) {
+
+                       // default to 0 when nulls exist
+                       v = ( v || 0 ).toString( 16 );
+                       return v.length === 1 ? "0" + v : v;
+               }).join("");
+       },
+       toString: function() {
+               return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
+       }
+});
+color.fn.parse.prototype = color.fn;
+
+// hsla conversions adapted from:
+// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
+
+function hue2rgb( p, q, h ) {
+       h = ( h + 1 ) % 1;
+       if ( h * 6 < 1 ) {
+               return p + (q - p) * h * 6;
+       }
+       if ( h * 2 < 1) {
+               return q;
+       }
+       if ( h * 3 < 2 ) {
+               return p + (q - p) * ((2/3) - h) * 6;
+       }
+       return p;
+}
+
+spaces.hsla.to = function ( rgba ) {
+       if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
+               return [ null, null, null, rgba[ 3 ] ];
+       }
+       var r = rgba[ 0 ] / 255,
+               g = rgba[ 1 ] / 255,
+               b = rgba[ 2 ] / 255,
+               a = rgba[ 3 ],
+               max = Math.max( r, g, b ),
+               min = Math.min( r, g, b ),
+               diff = max - min,
+               add = max + min,
+               l = add * 0.5,
+               h, s;
+
+       if ( min === max ) {
+               h = 0;
+       } else if ( r === max ) {
+               h = ( 60 * ( g - b ) / diff ) + 360;
+       } else if ( g === max ) {
+               h = ( 60 * ( b - r ) / diff ) + 120;
+       } else {
+               h = ( 60 * ( r - g ) / diff ) + 240;
+       }
+
+       if ( l === 0 || l === 1 ) {
+               s = l;
+       } else if ( l <= 0.5 ) {
+               s = diff / add;
+       } else {
+               s = diff / ( 2 - add );
+       }
+       return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
+};
+
+spaces.hsla.from = function ( hsla ) {
+       if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
+               return [ null, null, null, hsla[ 3 ] ];
+       }
+       var h = hsla[ 0 ] / 360,
+               s = hsla[ 1 ],
+               l = hsla[ 2 ],
+               a = hsla[ 3 ],
+               q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
+               p = 2 * l - q;
+
+       return [
+               Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
+               Math.round( hue2rgb( p, q, h ) * 255 ),
+               Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
+               a
+       ];
+};
+
+
+each( spaces, function( spaceName, space ) {
+       var props = space.props,
+               cache = space.cache,
+               to = space.to,
+               from = space.from;
+
+       // makes rgba() and hsla()
+       color.fn[ spaceName ] = function( value ) {
+
+               // generate a cache for this space if it doesn't exist
+               if ( to && !this[ cache ] ) {
+                       this[ cache ] = to( this._rgba );
+               }
+               if ( value === undefined ) {
+                       return this[ cache ].slice();
+               }
+
+               var ret,
+                       type = jQuery.type( value ),
+                       arr = ( type === "array" || type === "object" ) ? value : arguments,
+                       local = this[ cache ].slice();
+
+               each( props, function( key, prop ) {
+                       var val = arr[ type === "object" ? key : prop.idx ];
+                       if ( val == null ) {
+                               val = local[ prop.idx ];
+                       }
+                       local[ prop.idx ] = clamp( val, prop );
+               });
+
+               if ( from ) {
+                       ret = color( from( local ) );
+                       ret[ cache ] = local;
+                       return ret;
+               } else {
+                       return color( local );
+               }
+       };
+
+       // makes red() green() blue() alpha() hue() saturation() lightness()
+       each( props, function( key, prop ) {
+               // alpha is included in more than one space
+               if ( color.fn[ key ] ) {
+                       return;
+               }
+               color.fn[ key ] = function( value ) {
+                       var vtype = jQuery.type( value ),
+                               fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
+                               local = this[ fn ](),
+                               cur = local[ prop.idx ],
+                               match;
+
+                       if ( vtype === "undefined" ) {
+                               return cur;
+                       }
+
+                       if ( vtype === "function" ) {
+                               value = value.call( this, cur );
+                               vtype = jQuery.type( value );
+                       }
+                       if ( value == null && prop.empty ) {
+                               return this;
+                       }
+                       if ( vtype === "string" ) {
+                               match = rplusequals.exec( value );
+                               if ( match ) {
+                                       value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
+                               }
+                       }
+                       local[ prop.idx ] = value;
+                       return this[ fn ]( local );
+               };
+       });
+});
+
+// add .fx.step functions
+each( stepHooks, function( i, hook ) {
+       jQuery.cssHooks[ hook ] = {
+               set: function( elem, value ) {
+                       var parsed, curElem,
+                               backgroundColor = "";
+
+                       if ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) {
+                               value = color( parsed || value );
+                               if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
+                                       curElem = hook === "backgroundColor" ? elem.parentNode : elem;
+                                       while (
+                                               (backgroundColor === "" || backgroundColor === "transparent") &&
+                                               curElem && curElem.style
+                                       ) {
+                                               try {
+                                                       backgroundColor = jQuery.css( curElem, "backgroundColor" );
+                                                       curElem = curElem.parentNode;
+                                               } catch ( e ) {
+                                               }
+                                       }
+
+                                       value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
+                                               backgroundColor :
+                                               "_default" );
+                               }
+
+                               value = value.toRgbaString();
+                       }
+                       try {
+                               elem.style[ hook ] = value;
+                       } catch( error ) {
+                               // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
+                       }
+               }
+       };
+       jQuery.fx.step[ hook ] = function( fx ) {
+               if ( !fx.colorInit ) {
+                       fx.start = color( fx.elem, hook );
+                       fx.end = color( fx.end );
+                       fx.colorInit = true;
+               }
+               jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
+       };
+});
+
+jQuery.cssHooks.borderColor = {
+       expand: function( value ) {
+               var expanded = {};
+
+               each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
+                       expanded[ "border" + part + "Color" ] = value;
+               });
+               return expanded;
+       }
+};
+
+// Basic color names only.
+// Usage of any of the other color names requires adding yourself or including
+// jquery.color.svg-names.js.
+colors = jQuery.Color.names = {
+       // 4.1. Basic color keywords
+       aqua: "#00ffff",
+       black: "#000000",
+       blue: "#0000ff",
+       fuchsia: "#ff00ff",
+       gray: "#808080",
+       green: "#008000",
+       lime: "#00ff00",
+       maroon: "#800000",
+       navy: "#000080",
+       olive: "#808000",
+       purple: "#800080",
+       red: "#ff0000",
+       silver: "#c0c0c0",
+       teal: "#008080",
+       white: "#ffffff",
+       yellow: "#ffff00",
+
+       // 4.2.3. "transparent" color keyword
+       transparent: [ null, null, null, 0 ],
+
+       _default: "#ffffff"
+};
+
+})( jQuery );
+
+
+
+/******************************************************************************/
+/****************************** CLASS ANIMATIONS ******************************/
+/******************************************************************************/
+(function() {
+
+var classAnimationActions = [ "add", "remove", "toggle" ],
+       shorthandStyles = {
+               border: 1,
+               borderBottom: 1,
+               borderColor: 1,
+               borderLeft: 1,
+               borderRight: 1,
+               borderTop: 1,
+               borderWidth: 1,
+               margin: 1,
+               padding: 1
+       };
+
+$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function( _, prop ) {
+       $.fx.step[ prop ] = function( fx ) {
+               if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
+                       jQuery.style( fx.elem, prop, fx.end );
+                       fx.setAttr = true;
+               }
+       };
+});
+
+function getElementStyles() {
+       var style = this.ownerDocument.defaultView ?
+                       this.ownerDocument.defaultView.getComputedStyle( this, null ) :
+                       this.currentStyle,
+               newStyle = {},
+               key,
+               len;
+
+       // webkit enumerates style porperties
+       if ( style && style.length && style[ 0 ] && style[ style[ 0 ] ] ) {
+               len = style.length;
+               while ( len-- ) {
+                       key = style[ len ];
+                       if ( typeof style[ key ] === "string" ) {
+                               newStyle[ $.camelCase( key ) ] = style[ key ];
+                       }
+               }
+       } else {
+               for ( key in style ) {
+                       if ( typeof style[ key ] === "string" ) {
+                               newStyle[ key ] = style[ key ];
+                       }
+               }
+       }
+
+       return newStyle;
+}
+
+
+function styleDifference( oldStyle, newStyle ) {
+       var diff = {},
+               name, value;
+
+       for ( name in newStyle ) {
+               value = newStyle[ name ];
+               if ( oldStyle[ name ] !== value ) {
+                       if ( !shorthandStyles[ name ] ) {
+                               if ( $.fx.step[ name ] || !isNaN( parseFloat( value ) ) ) {
+                                       diff[ name ] = value;
+                               }
+                       }
+               }
+       }
+
+       return diff;
+}
+
+$.effects.animateClass = function( value, duration, easing, callback ) {
+       var o = $.speed( duration, easing, callback );
+
+       return this.queue( function() {
+               var animated = $( this ),
+                       baseClass = animated.attr( "class" ) || "",
+                       applyClassChange,
+                       allAnimations = o.children ? animated.find( "*" ).andSelf() : animated;
+
+               // map the animated objects to store the original styles.
+               allAnimations = allAnimations.map(function() {
+                       var el = $( this );
+                       return {
+                               el: el,
+                               start: getElementStyles.call( this )
+                       };
+               });
+
+               // apply class change
+               applyClassChange = function() {
+                       $.each( classAnimationActions, function(i, action) {
+                               if ( value[ action ] ) {
+                                       animated[ action + "Class" ]( value[ action ] );
+                               }
+                       });
+               };
+               applyClassChange();
+
+               // map all animated objects again - calculate new styles and diff
+               allAnimations = allAnimations.map(function() {
+                       this.end = getElementStyles.call( this.el[ 0 ] );
+                       this.diff = styleDifference( this.start, this.end );
+                       return this;
+               });
+
+               // apply original class
+               animated.attr( "class", baseClass );
+
+               // map all animated objects again - this time collecting a promise
+               allAnimations = allAnimations.map(function() {
+                       var styleInfo = this,
+                               dfd = $.Deferred(),
+                               opts = jQuery.extend({}, o, {
+                                       queue: false,
+                                       complete: function() {
+                                               dfd.resolve( styleInfo );
+                                       }
+                               });
+
+                       this.el.animate( this.diff, opts );
+                       return dfd.promise();
+               });
+
+               // once all animations have completed:
+               $.when.apply( $, allAnimations.get() ).done(function() {
+
+                       // set the final class
+                       applyClassChange();
+
+                       // for each animated element,
+                       // clear all css properties that were animated
+                       $.each( arguments, function() {
+                               var el = this.el;
+                               $.each( this.diff, function(key) {
+                                       el.css( key, '' );
+                               });
+                       });
+
+                       // this is guarnteed to be there if you use jQuery.speed()
+                       // it also handles dequeuing the next anim...
+                       o.complete.call( animated[ 0 ] );
+               });
+       });
+};
+
+$.fn.extend({
+       _addClass: $.fn.addClass,
+       addClass: function( classNames, speed, easing, callback ) {
+               return speed ?
+                       $.effects.animateClass.call( this,
+                               { add: classNames }, speed, easing, callback ) :
+                       this._addClass( classNames );
+       },
+
+       _removeClass: $.fn.removeClass,
+       removeClass: function( classNames, speed, easing, callback ) {
+               return speed ?
+                       $.effects.animateClass.call( this,
+                               { remove: classNames }, speed, easing, callback ) :
+                       this._removeClass( classNames );
+       },
+
+       _toggleClass: $.fn.toggleClass,
+       toggleClass: function( classNames, force, speed, easing, callback ) {
+               if ( typeof force === "boolean" || force === undefined ) {
+                       if ( !speed ) {
+                               // without speed parameter
+                               return this._toggleClass( classNames, force );
+                       } else {
+                               return $.effects.animateClass.call( this,
+                                       (force ? { add: classNames } : { remove: classNames }),
+                                       speed, easing, callback );
+                       }
+               } else {
+                       // without force parameter
+                       return $.effects.animateClass.call( this,
+                               { toggle: classNames }, force, speed, easing );
+               }
+       },
+
+       switchClass: function( remove, add, speed, easing, callback) {
+               return $.effects.animateClass.call( this, {
+                       add: add,
+                       remove: remove
+               }, speed, easing, callback );
+       }
+});
+
+})();
+
+/******************************************************************************/
+/*********************************** EFFECTS **********************************/
+/******************************************************************************/
+
+(function() {
+
+$.extend( $.effects, {
+       version: "1.9.2",
+
+       // Saves a set of properties in a data storage
+       save: function( element, set ) {
+               for( var i=0; i < set.length; i++ ) {
+                       if ( set[ i ] !== null ) {
+                               element.data( dataSpace + set[ i ], element[ 0 ].style[ set[ i ] ] );
+                       }
+               }
+       },
+
+       // Restores a set of previously saved properties from a data storage
+       restore: function( element, set ) {
+               var val, i;
+               for( i=0; i < set.length; i++ ) {
+                       if ( set[ i ] !== null ) {
+                               val = element.data( dataSpace + set[ i ] );
+                               // support: jQuery 1.6.2
+                               // http://bugs.jquery.com/ticket/9917
+                               // jQuery 1.6.2 incorrectly returns undefined for any falsy value.
+                               // We can't differentiate between "" and 0 here, so we just assume
+                               // empty string since it's likely to be a more common value...
+                               if ( val === undefined ) {
+                                       val = "";
+                               }
+                               element.css( set[ i ], val );
+                       }
+               }
+       },
+
+       setMode: function( el, mode ) {
+               if (mode === "toggle") {
+                       mode = el.is( ":hidden" ) ? "show" : "hide";
+               }
+               return mode;
+       },
+
+       // Translates a [top,left] array into a baseline value
+       // this should be a little more flexible in the future to handle a string & hash
+       getBaseline: function( origin, original ) {
+               var y, x;
+               switch ( origin[ 0 ] ) {
+                       case "top": y = 0; break;
+                       case "middle": y = 0.5; break;
+                       case "bottom": y = 1; break;
+                       default: y = origin[ 0 ] / original.height;
+               }
+               switch ( origin[ 1 ] ) {
+                       case "left": x = 0; break;
+                       case "center": x = 0.5; break;
+                       case "right": x = 1; break;
+                       default: x = origin[ 1 ] / original.width;
+               }
+               return {
+                       x: x,
+                       y: y
+               };
+       },
+
+       // Wraps the element around a wrapper that copies position properties
+       createWrapper: function( element ) {
+
+               // if the element is already wrapped, return it
+               if ( element.parent().is( ".ui-effects-wrapper" )) {
+                       return element.parent();
+               }
+
+               // wrap the element
+               var props = {
+                               width: element.outerWidth(true),
+                               height: element.outerHeight(true),
+                               "float": element.css( "float" )
+                       },
+                       wrapper = $( "<div></div>" )
+                               .addClass( "ui-effects-wrapper" )
+                               .css({
+                                       fontSize: "100%",
+                                       background: "transparent",
+                                       border: "none",
+                                       margin: 0,
+                                       padding: 0
+                               }),
+                       // Store the size in case width/height are defined in % - Fixes #5245
+                       size = {
+                               width: element.width(),
+                               height: element.height()
+                       },
+                       active = document.activeElement;
+
+               // support: Firefox
+               // Firefox incorrectly exposes anonymous content
+               // https://bugzilla.mozilla.org/show_bug.cgi?id=561664
+               try {
+                       active.id;
+               } catch( e ) {
+                       active = document.body;
+               }
+
+               element.wrap( wrapper );
+
+               // Fixes #7595 - Elements lose focus when wrapped.
+               if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
+                       $( active ).focus();
+               }
+
+               wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually lose the reference to the wrapped element
+
+               // transfer positioning properties to the wrapper
+               if ( element.css( "position" ) === "static" ) {
+                       wrapper.css({ position: "relative" });
+                       element.css({ position: "relative" });
+               } else {
+                       $.extend( props, {
+                               position: element.css( "position" ),
+                               zIndex: element.css( "z-index" )
+                       });
+                       $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
+                               props[ pos ] = element.css( pos );
+                               if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
+                                       props[ pos ] = "auto";
+                               }
+                       });
+                       element.css({
+                               position: "relative",
+                               top: 0,
+                               left: 0,
+                               right: "auto",
+                               bottom: "auto"
+                       });
+               }
+               element.css(size);
+
+               return wrapper.css( props ).show();
+       },
+
+       removeWrapper: function( element ) {
+               var active = document.activeElement;
+
+               if ( element.parent().is( ".ui-effects-wrapper" ) ) {
+                       element.parent().replaceWith( element );
+
+                       // Fixes #7595 - Elements lose focus when wrapped.
+                       if ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {
+                               $( active ).focus();
+                       }
+               }
+
+
+               return element;
+       },
+
+       setTransition: function( element, list, factor, value ) {
+               value = value || {};
+               $.each( list, function( i, x ) {
+                       var unit = element.cssUnit( x );
+                       if ( unit[ 0 ] > 0 ) {
+                               value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
+                       }
+               });
+               return value;
+       }
+});
+
+// return an effect options object for the given parameters:
+function _normalizeArguments( effect, options, speed, callback ) {
+
+       // allow passing all options as the first parameter
+       if ( $.isPlainObject( effect ) ) {
+               options = effect;
+               effect = effect.effect;
+       }
+
+       // convert to an object
+       effect = { effect: effect };
+
+       // catch (effect, null, ...)
+       if ( options == null ) {
+               options = {};
+       }
+
+       // catch (effect, callback)
+       if ( $.isFunction( options ) ) {
+               callback = options;
+               speed = null;
+               options = {};
+       }
+
+       // catch (effect, speed, ?)
+       if ( typeof options === "number" || $.fx.speeds[ options ] ) {
+               callback = speed;
+               speed = options;
+               options = {};
+       }
+
+       // catch (effect, options, callback)
+       if ( $.isFunction( speed ) ) {
+               callback = speed;
+               speed = null;
+       }
+
+       // add options to effect
+       if ( options ) {
+               $.extend( effect, options );
+       }
+
+       speed = speed || options.duration;
+       effect.duration = $.fx.off ? 0 :
+               typeof speed === "number" ? speed :
+               speed in $.fx.speeds ? $.fx.speeds[ speed ] :
+               $.fx.speeds._default;
+
+       effect.complete = callback || options.complete;
+
+       return effect;
+}
+
+function standardSpeed( speed ) {
+       // valid standard speeds
+       if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
+               return true;
+       }
+
+       // invalid strings - treat as "normal" speed
+       if ( typeof speed === "string" && !$.effects.effect[ speed ] ) {
+               // TODO: remove in 2.0 (#7115)
+               if ( backCompat && $.effects[ speed ] ) {
+                       return false;
+               }
+               return true;
+       }
+
+       return false;
+}
+
+$.fn.extend({
+       effect: function( /* effect, options, speed, callback */ ) {
+               var args = _normalizeArguments.apply( this, arguments ),
+                       mode = args.mode,
+                       queue = args.queue,
+                       effectMethod = $.effects.effect[ args.effect ],
+
+                       // DEPRECATED: remove in 2.0 (#7115)
+                       oldEffectMethod = !effectMethod && backCompat && $.effects[ args.effect ];
+
+               if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) {
+                       // delegate to the original method (e.g., .show()) if possible
+                       if ( mode ) {
+                               return this[ mode ]( args.duration, args.complete );
+                       } else {
+                               return this.each( function() {
+                                       if ( args.complete ) {
+                                               args.complete.call( this );
+                                       }
+                               });
+                       }
+               }
+
+               function run( next ) {
+                       var elem = $( this ),
+                               complete = args.complete,
+                               mode = args.mode;
+
+                       function done() {
+                               if ( $.isFunction( complete ) ) {
+                                       complete.call( elem[0] );
+                               }
+                               if ( $.isFunction( next ) ) {
+                                       next();
+                               }
+                       }
+
+                       // if the element is hiddden and mode is hide,
+                       // or element is visible and mode is show
+                       if ( elem.is( ":hidden" ) ? mode === "hide" : mode === "show" ) {
+                               done();
+                       } else {
+                               effectMethod.call( elem[0], args, done );
+                       }
+               }
+
+               // TODO: remove this check in 2.0, effectMethod will always be true
+               if ( effectMethod ) {
+                       return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
+               } else {
+                       // DEPRECATED: remove in 2.0 (#7115)
+                       return oldEffectMethod.call(this, {
+                               options: args,
+                               duration: args.duration,
+                               callback: args.complete,
+                               mode: args.mode
+                       });
+               }
+       },
+
+       _show: $.fn.show,
+       show: function( speed ) {
+               if ( standardSpeed( speed ) ) {
+                       return this._show.apply( this, arguments );
+               } else {
+                       var args = _normalizeArguments.apply( this, arguments );
+                       args.mode = "show";
+                       return this.effect.call( this, args );
+               }
+       },
+
+       _hide: $.fn.hide,
+       hide: function( speed ) {
+               if ( standardSpeed( speed ) ) {
+                       return this._hide.apply( this, arguments );
+               } else {
+                       var args = _normalizeArguments.apply( this, arguments );
+                       args.mode = "hide";
+                       return this.effect.call( this, args );
+               }
+       },
+
+       // jQuery core overloads toggle and creates _toggle
+       __toggle: $.fn.toggle,
+       toggle: function( speed ) {
+               if ( standardSpeed( speed ) || typeof speed === "boolean" || $.isFunction( speed ) ) {
+                       return this.__toggle.apply( this, arguments );
+               } else {
+                       var args = _normalizeArguments.apply( this, arguments );
+                       args.mode = "toggle";
+                       return this.effect.call( this, args );
+               }
+       },
+
+       // helper functions
+       cssUnit: function(key) {
+               var style = this.css( key ),
+                       val = [];
+
+               $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
+                       if ( style.indexOf( unit ) > 0 ) {
+                               val = [ parseFloat( style ), unit ];
+                       }
+               });
+               return val;
+       }
+});
+
+})();
+
+/******************************************************************************/
+/*********************************** EASING ***********************************/
+/******************************************************************************/
+
+(function() {
+
+// based on easing equations from Robert Penner (http://www.robertpenner.com/easing)
+
+var baseEasings = {};
+
+$.each( [ "Quad", "Cubic", "Quart", "Quint", "Expo" ], function( i, name ) {
+       baseEasings[ name ] = function( p ) {
+               return Math.pow( p, i + 2 );
+       };
+});
+
+$.extend( baseEasings, {
+       Sine: function ( p ) {
+               return 1 - Math.cos( p * Math.PI / 2 );
+       },
+       Circ: function ( p ) {
+               return 1 - Math.sqrt( 1 - p * p );
+       },
+       Elastic: function( p ) {
+               return p === 0 || p === 1 ? p :
+                       -Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );
+       },
+       Back: function( p ) {
+               return p * p * ( 3 * p - 2 );
+       },
+       Bounce: function ( p ) {
+               var pow2,
+                       bounce = 4;
+
+               while ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}
+               return 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );
+       }
+});
+
+$.each( baseEasings, function( name, easeIn ) {
+       $.easing[ "easeIn" + name ] = easeIn;
+       $.easing[ "easeOut" + name ] = function( p ) {
+               return 1 - easeIn( 1 - p );
+       };
+       $.easing[ "easeInOut" + name ] = function( p ) {
+               return p < 0.5 ?
+                       easeIn( p * 2 ) / 2 :
+                       1 - easeIn( p * -2 + 2 ) / 2;
+       };
+});
+
+})();
+
+})(jQuery));
+(function( $, undefined ) {
+
+var rvertical = /up|down|vertical/,
+       rpositivemotion = /up|left|vertical|horizontal/;
+
+$.effects.effect.blind = function( o, done ) {
+       // Create element
+       var el = $( this ),
+               props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+               mode = $.effects.setMode( el, o.mode || "hide" ),
+               direction = o.direction || "up",
+               vertical = rvertical.test( direction ),
+               ref = vertical ? "height" : "width",
+               ref2 = vertical ? "top" : "left",
+               motion = rpositivemotion.test( direction ),
+               animation = {},
+               show = mode === "show",
+               wrapper, distance, margin;
+
+       // if already wrapped, the wrapper's properties are my property. #6245
+       if ( el.parent().is( ".ui-effects-wrapper" ) ) {
+               $.effects.save( el.parent(), props );
+       } else {
+               $.effects.save( el, props );
+       }
+       el.show();
+       wrapper = $.effects.createWrapper( el ).css({
+               overflow: "hidden"
+       });
+
+       distance = wrapper[ ref ]();
+       margin = parseFloat( wrapper.css( ref2 ) ) || 0;
+
+       animation[ ref ] = show ? distance : 0;
+       if ( !motion ) {
+               el
+                       .css( vertical ? "bottom" : "right", 0 )
+                       .css( vertical ? "top" : "left", "auto" )
+                       .css({ position: "absolute" });
+
+               animation[ ref2 ] = show ? margin : distance + margin;
+       }
+
+       // start at 0 if we are showing
+       if ( show ) {
+               wrapper.css( ref, 0 );
+               if ( ! motion ) {
+                       wrapper.css( ref2, margin + distance );
+               }
+       }
+
+       // Animate
+       wrapper.animate( animation, {
+               duration: o.duration,
+               easing: o.easing,
+               queue: false,
+               complete: function() {
+                       if ( mode === "hide" ) {
+                               el.hide();
+                       }
+                       $.effects.restore( el, props );
+                       $.effects.removeWrapper( el );
+                       done();
+               }
+       });
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.bounce = function( o, done ) {
+       var el = $( this ),
+               props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+
+               // defaults:
+               mode = $.effects.setMode( el, o.mode || "effect" ),
+               hide = mode === "hide",
+               show = mode === "show",
+               direction = o.direction || "up",
+               distance = o.distance,
+               times = o.times || 5,
+
+               // number of internal animations
+               anims = times * 2 + ( show || hide ? 1 : 0 ),
+               speed = o.duration / anims,
+               easing = o.easing,
+
+               // utility:
+               ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
+               motion = ( direction === "up" || direction === "left" ),
+               i,
+               upAnim,
+               downAnim,
+
+               // we will need to re-assemble the queue to stack our animations in place
+               queue = el.queue(),
+               queuelen = queue.length;
+
+       // Avoid touching opacity to prevent clearType and PNG issues in IE
+       if ( show || hide ) {
+               props.push( "opacity" );
+       }
+
+       $.effects.save( el, props );
+       el.show();
+       $.effects.createWrapper( el ); // Create Wrapper
+
+       // default distance for the BIGGEST bounce is the outer Distance / 3
+       if ( !distance ) {
+               distance = el[ ref === "top" ? "outerHeight" : "outerWidth" ]() / 3;
+       }
+
+       if ( show ) {
+               downAnim = { opacity: 1 };
+               downAnim[ ref ] = 0;
+
+               // if we are showing, force opacity 0 and set the initial position
+               // then do the "first" animation
+               el.css( "opacity", 0 )
+                       .css( ref, motion ? -distance * 2 : distance * 2 )
+                       .animate( downAnim, speed, easing );
+       }
+
+       // start at the smallest distance if we are hiding
+       if ( hide ) {
+               distance = distance / Math.pow( 2, times - 1 );
+       }
+
+       downAnim = {};
+       downAnim[ ref ] = 0;
+       // Bounces up/down/left/right then back to 0 -- times * 2 animations happen here
+       for ( i = 0; i < times; i++ ) {
+               upAnim = {};
+               upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
+
+               el.animate( upAnim, speed, easing )
+                       .animate( downAnim, speed, easing );
+
+               distance = hide ? distance * 2 : distance / 2;
+       }
+
+       // Last Bounce when Hiding
+       if ( hide ) {
+               upAnim = { opacity: 0 };
+               upAnim[ ref ] = ( motion ? "-=" : "+=" ) + distance;
+
+               el.animate( upAnim, speed, easing );
+       }
+
+       el.queue(function() {
+               if ( hide ) {
+                       el.hide();
+               }
+               $.effects.restore( el, props );
+               $.effects.removeWrapper( el );
+               done();
+       });
+
+       // inject all the animations we just queued to be first in line (after "inprogress")
+       if ( queuelen > 1) {
+               queue.splice.apply( queue,
+                       [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+       }
+       el.dequeue();
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.clip = function( o, done ) {
+       // Create element
+       var el = $( this ),
+               props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+               mode = $.effects.setMode( el, o.mode || "hide" ),
+               show = mode === "show",
+               direction = o.direction || "vertical",
+               vert = direction === "vertical",
+               size = vert ? "height" : "width",
+               position = vert ? "top" : "left",
+               animation = {},
+               wrapper, animate, distance;
+
+       // Save & Show
+       $.effects.save( el, props );
+       el.show();
+
+       // Create Wrapper
+       wrapper = $.effects.createWrapper( el ).css({
+               overflow: "hidden"
+       });
+       animate = ( el[0].tagName === "IMG" ) ? wrapper : el;
+       distance = animate[ size ]();
+
+       // Shift
+       if ( show ) {
+               animate.css( size, 0 );
+               animate.css( position, distance / 2 );
+       }
+
+       // Create Animation Object:
+       animation[ size ] = show ? distance : 0;
+       animation[ position ] = show ? 0 : distance / 2;
+
+       // Animate
+       animate.animate( animation, {
+               queue: false,
+               duration: o.duration,
+               easing: o.easing,
+               complete: function() {
+                       if ( !show ) {
+                               el.hide();
+                       }
+                       $.effects.restore( el, props );
+                       $.effects.removeWrapper( el );
+                       done();
+               }
+       });
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.drop = function( o, done ) {
+
+       var el = $( this ),
+               props = [ "position", "top", "bottom", "left", "right", "opacity", "height", "width" ],
+               mode = $.effects.setMode( el, o.mode || "hide" ),
+               show = mode === "show",
+               direction = o.direction || "left",
+               ref = ( direction === "up" || direction === "down" ) ? "top" : "left",
+               motion = ( direction === "up" || direction === "left" ) ? "pos" : "neg",
+               animation = {
+                       opacity: show ? 1 : 0
+               },
+               distance;
+
+       // Adjust
+       $.effects.save( el, props );
+       el.show();
+       $.effects.createWrapper( el );
+
+       distance = o.distance || el[ ref === "top" ? "outerHeight": "outerWidth" ]( true ) / 2;
+
+       if ( show ) {
+               el
+                       .css( "opacity", 0 )
+                       .css( ref, motion === "pos" ? -distance : distance );
+       }
+
+       // Animation
+       animation[ ref ] = ( show ?
+               ( motion === "pos" ? "+=" : "-=" ) :
+               ( motion === "pos" ? "-=" : "+=" ) ) +
+               distance;
+
+       // Animate
+       el.animate( animation, {
+               queue: false,
+               duration: o.duration,
+               easing: o.easing,
+               complete: function() {
+                       if ( mode === "hide" ) {
+                               el.hide();
+                       }
+                       $.effects.restore( el, props );
+                       $.effects.removeWrapper( el );
+                       done();
+               }
+       });
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.explode = function( o, done ) {
+
+       var rows = o.pieces ? Math.round( Math.sqrt( o.pieces ) ) : 3,
+               cells = rows,
+               el = $( this ),
+               mode = $.effects.setMode( el, o.mode || "hide" ),
+               show = mode === "show",
+
+               // show and then visibility:hidden the element before calculating offset
+               offset = el.show().css( "visibility", "hidden" ).offset(),
+
+               // width and height of a piece
+               width = Math.ceil( el.outerWidth() / cells ),
+               height = Math.ceil( el.outerHeight() / rows ),
+               pieces = [],
+
+               // loop
+               i, j, left, top, mx, my;
+
+       // children animate complete:
+       function childComplete() {
+               pieces.push( this );
+               if ( pieces.length === rows * cells ) {
+                       animComplete();
+               }
+       }
+
+       // clone the element for each row and cell.
+       for( i = 0; i < rows ; i++ ) { // ===>
+               top = offset.top + i * height;
+               my = i - ( rows - 1 ) / 2 ;
+
+               for( j = 0; j < cells ; j++ ) { // |||
+                       left = offset.left + j * width;
+                       mx = j - ( cells - 1 ) / 2 ;
+
+                       // Create a clone of the now hidden main element that will be absolute positioned
+                       // within a wrapper div off the -left and -top equal to size of our pieces
+                       el
+                               .clone()
+                               .appendTo( "body" )
+                               .wrap( "<div></div>" )
+                               .css({
+                                       position: "absolute",
+                                       visibility: "visible",
+                                       left: -j * width,
+                                       top: -i * height
+                               })
+
+                       // select the wrapper - make it overflow: hidden and absolute positioned based on
+                       // where the original was located +left and +top equal to the size of pieces
+                               .parent()
+                               .addClass( "ui-effects-explode" )
+                               .css({
+                                       position: "absolute",
+                                       overflow: "hidden",
+                                       width: width,
+                                       height: height,
+                                       left: left + ( show ? mx * width : 0 ),
+                                       top: top + ( show ? my * height : 0 ),
+                                       opacity: show ? 0 : 1
+                               }).animate({
+                                       left: left + ( show ? 0 : mx * width ),
+                                       top: top + ( show ? 0 : my * height ),
+                                       opacity: show ? 1 : 0
+                               }, o.duration || 500, o.easing, childComplete );
+               }
+       }
+
+       function animComplete() {
+               el.css({
+                       visibility: "visible"
+               });
+               $( pieces ).remove();
+               if ( !show ) {
+                       el.hide();
+               }
+               done();
+       }
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.fade = function( o, done ) {
+       var el = $( this ),
+               mode = $.effects.setMode( el, o.mode || "toggle" );
+
+       el.animate({
+               opacity: mode
+       }, {
+               queue: false,
+               duration: o.duration,
+               easing: o.easing,
+               complete: done
+       });
+};
+
+})( jQuery );
+(function( $, undefined ) {
+
+$.effects.effect.fold = function( o, done ) {
+
+       // Create element
+       var el = $( this ),
+               props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+               mode = $.effects.setMode( el, o.mode || "hide" ),
+               show = mode === "show",
+               hide = mode === "hide",
+               size = o.size || 15,
+               percent = /([0-9]+)%/.exec( size ),
+               horizFirst = !!o.horizFirst,
+               widthFirst = show !== horizFirst,
+               ref = widthFirst ? [ "width", "height" ] : [ "height", "width" ],
+               duration = o.duration / 2,
+               wrapper, distance,
+               animation1 = {},
+               animation2 = {};
+
+       $.effects.save( el, props );
+       el.show();
+
+       // Create Wrapper
+       wrapper = $.effects.createWrapper( el ).css({
+               overflow: "hidden"
+       });
+       distance = widthFirst ?
+               [ wrapper.width(), wrapper.height() ] :
+               [ wrapper.height(), wrapper.width() ];
+
+       if ( percent ) {
+               size = parseInt( percent[ 1 ], 10 ) / 100 * distance[ hide ? 0 : 1 ];
+       }
+       if ( show ) {
+               wrapper.css( horizFirst ? {
+                       height: 0,
+                       width: size
+               } : {
+                       height: size,
+                       width: 0
+               });
+       }
+
+       // Animation
+       animation1[ ref[ 0 ] ] = show ? distance[ 0 ] : size;
+       animation2[ ref[ 1 ] ] = show ? distance[ 1 ] : 0;
+
+       // Animate
+       wrapper
+               .animate( animation1, duration, o.easing )
+               .animate( animation2, duration, o.easing, function() {
+                       if ( hide ) {
+                               el.hide();
+                       }
+                       $.effects.restore( el, props );
+                       $.effects.removeWrapper( el );
+                       done();
+               });
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.highlight = function( o, done ) {
+       var elem = $( this ),
+               props = [ "backgroundImage", "backgroundColor", "opacity" ],
+               mode = $.effects.setMode( elem, o.mode || "show" ),
+               animation = {
+                       backgroundColor: elem.css( "backgroundColor" )
+               };
+
+       if (mode === "hide") {
+               animation.opacity = 0;
+       }
+
+       $.effects.save( elem, props );
+
+       elem
+               .show()
+               .css({
+                       backgroundImage: "none",
+                       backgroundColor: o.color || "#ffff99"
+               })
+               .animate( animation, {
+                       queue: false,
+                       duration: o.duration,
+                       easing: o.easing,
+                       complete: function() {
+                               if ( mode === "hide" ) {
+                                       elem.hide();
+                               }
+                               $.effects.restore( elem, props );
+                               done();
+                       }
+               });
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.pulsate = function( o, done ) {
+       var elem = $( this ),
+               mode = $.effects.setMode( elem, o.mode || "show" ),
+               show = mode === "show",
+               hide = mode === "hide",
+               showhide = ( show || mode === "hide" ),
+
+               // showing or hiding leaves of the "last" animation
+               anims = ( ( o.times || 5 ) * 2 ) + ( showhide ? 1 : 0 ),
+               duration = o.duration / anims,
+               animateTo = 0,
+               queue = elem.queue(),
+               queuelen = queue.length,
+               i;
+
+       if ( show || !elem.is(":visible")) {
+               elem.css( "opacity", 0 ).show();
+               animateTo = 1;
+       }
+
+       // anims - 1 opacity "toggles"
+       for ( i = 1; i < anims; i++ ) {
+               elem.animate({
+                       opacity: animateTo
+               }, duration, o.easing );
+               animateTo = 1 - animateTo;
+       }
+
+       elem.animate({
+               opacity: animateTo
+       }, duration, o.easing);
+
+       elem.queue(function() {
+               if ( hide ) {
+                       elem.hide();
+               }
+               done();
+       });
+
+       // We just queued up "anims" animations, we need to put them next in the queue
+       if ( queuelen > 1 ) {
+               queue.splice.apply( queue,
+                       [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+       }
+       elem.dequeue();
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.puff = function( o, done ) {
+       var elem = $( this ),
+               mode = $.effects.setMode( elem, o.mode || "hide" ),
+               hide = mode === "hide",
+               percent = parseInt( o.percent, 10 ) || 150,
+               factor = percent / 100,
+               original = {
+                       height: elem.height(),
+                       width: elem.width(),
+                       outerHeight: elem.outerHeight(),
+                       outerWidth: elem.outerWidth()
+               };
+
+       $.extend( o, {
+               effect: "scale",
+               queue: false,
+               fade: true,
+               mode: mode,
+               complete: done,
+               percent: hide ? percent : 100,
+               from: hide ?
+                       original :
+                       {
+                               height: original.height * factor,
+                               width: original.width * factor,
+                               outerHeight: original.outerHeight * factor,
+                               outerWidth: original.outerWidth * factor
+                       }
+       });
+
+       elem.effect( o );
+};
+
+$.effects.effect.scale = function( o, done ) {
+
+       // Create element
+       var el = $( this ),
+               options = $.extend( true, {}, o ),
+               mode = $.effects.setMode( el, o.mode || "effect" ),
+               percent = parseInt( o.percent, 10 ) ||
+                       ( parseInt( o.percent, 10 ) === 0 ? 0 : ( mode === "hide" ? 0 : 100 ) ),
+               direction = o.direction || "both",
+               origin = o.origin,
+               original = {
+                       height: el.height(),
+                       width: el.width(),
+                       outerHeight: el.outerHeight(),
+                       outerWidth: el.outerWidth()
+               },
+               factor = {
+                       y: direction !== "horizontal" ? (percent / 100) : 1,
+                       x: direction !== "vertical" ? (percent / 100) : 1
+               };
+
+       // We are going to pass this effect to the size effect:
+       options.effect = "size";
+       options.queue = false;
+       options.complete = done;
+
+       // Set default origin and restore for show/hide
+       if ( mode !== "effect" ) {
+               options.origin = origin || ["middle","center"];
+               options.restore = true;
+       }
+
+       options.from = o.from || ( mode === "show" ? {
+               height: 0,
+               width: 0,
+               outerHeight: 0,
+               outerWidth: 0
+       } : original );
+       options.to = {
+               height: original.height * factor.y,
+               width: original.width * factor.x,
+               outerHeight: original.outerHeight * factor.y,
+               outerWidth: original.outerWidth * factor.x
+       };
+
+       // Fade option to support puff
+       if ( options.fade ) {
+               if ( mode === "show" ) {
+                       options.from.opacity = 0;
+                       options.to.opacity = 1;
+               }
+               if ( mode === "hide" ) {
+                       options.from.opacity = 1;
+                       options.to.opacity = 0;
+               }
+       }
+
+       // Animate
+       el.effect( options );
+
+};
+
+$.effects.effect.size = function( o, done ) {
+
+       // Create element
+       var original, baseline, factor,
+               el = $( this ),
+               props0 = [ "position", "top", "bottom", "left", "right", "width", "height", "overflow", "opacity" ],
+
+               // Always restore
+               props1 = [ "position", "top", "bottom", "left", "right", "overflow", "opacity" ],
+
+               // Copy for children
+               props2 = [ "width", "height", "overflow" ],
+               cProps = [ "fontSize" ],
+               vProps = [ "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom" ],
+               hProps = [ "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight" ],
+
+               // Set options
+               mode = $.effects.setMode( el, o.mode || "effect" ),
+               restore = o.restore || mode !== "effect",
+               scale = o.scale || "both",
+               origin = o.origin || [ "middle", "center" ],
+               position = el.css( "position" ),
+               props = restore ? props0 : props1,
+               zero = {
+                       height: 0,
+                       width: 0,
+                       outerHeight: 0,
+                       outerWidth: 0
+               };
+
+       if ( mode === "show" ) {
+               el.show();
+       }
+       original = {
+               height: el.height(),
+               width: el.width(),
+               outerHeight: el.outerHeight(),
+               outerWidth: el.outerWidth()
+       };
+
+       if ( o.mode === "toggle" && mode === "show" ) {
+               el.from = o.to || zero;
+               el.to = o.from || original;
+       } else {
+               el.from = o.from || ( mode === "show" ? zero : original );
+               el.to = o.to || ( mode === "hide" ? zero : original );
+       }
+
+       // Set scaling factor
+       factor = {
+               from: {
+                       y: el.from.height / original.height,
+                       x: el.from.width / original.width
+               },
+               to: {
+                       y: el.to.height / original.height,
+                       x: el.to.width / original.width
+               }
+       };
+
+       // Scale the css box
+       if ( scale === "box" || scale === "both" ) {
+
+               // Vertical props scaling
+               if ( factor.from.y !== factor.to.y ) {
+                       props = props.concat( vProps );
+                       el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
+                       el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
+               }
+
+               // Horizontal props scaling
+               if ( factor.from.x !== factor.to.x ) {
+                       props = props.concat( hProps );
+                       el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
+                       el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
+               }
+       }
+
+       // Scale the content
+       if ( scale === "content" || scale === "both" ) {
+
+               // Vertical props scaling
+               if ( factor.from.y !== factor.to.y ) {
+                       props = props.concat( cProps ).concat( props2 );
+                       el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
+                       el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
+               }
+       }
+
+       $.effects.save( el, props );
+       el.show();
+       $.effects.createWrapper( el );
+       el.css( "overflow", "hidden" ).css( el.from );
+
+       // Adjust
+       if (origin) { // Calculate baseline shifts
+               baseline = $.effects.getBaseline( origin, original );
+               el.from.top = ( original.outerHeight - el.outerHeight() ) * baseline.y;
+               el.from.left = ( original.outerWidth - el.outerWidth() ) * baseline.x;
+               el.to.top = ( original.outerHeight - el.to.outerHeight ) * baseline.y;
+               el.to.left = ( original.outerWidth - el.to.outerWidth ) * baseline.x;
+       }
+       el.css( el.from ); // set top & left
+
+       // Animate
+       if ( scale === "content" || scale === "both" ) { // Scale the children
+
+               // Add margins/font-size
+               vProps = vProps.concat([ "marginTop", "marginBottom" ]).concat(cProps);
+               hProps = hProps.concat([ "marginLeft", "marginRight" ]);
+               props2 = props0.concat(vProps).concat(hProps);
+
+               el.find( "*[width]" ).each( function(){
+                       var child = $( this ),
+                               c_original = {
+                                       height: child.height(),
+                                       width: child.width(),
+                                       outerHeight: child.outerHeight(),
+                                       outerWidth: child.outerWidth()
+                               };
+                       if (restore) {
+                               $.effects.save(child, props2);
+                       }
+
+                       child.from = {
+                               height: c_original.height * factor.from.y,
+                               width: c_original.width * factor.from.x,
+                               outerHeight: c_original.outerHeight * factor.from.y,
+                               outerWidth: c_original.outerWidth * factor.from.x
+                       };
+                       child.to = {
+                               height: c_original.height * factor.to.y,
+                               width: c_original.width * factor.to.x,
+                               outerHeight: c_original.height * factor.to.y,
+                               outerWidth: c_original.width * factor.to.x
+                       };
+
+                       // Vertical props scaling
+                       if ( factor.from.y !== factor.to.y ) {
+                               child.from = $.effects.setTransition( child, vProps, factor.from.y, child.from );
+                               child.to = $.effects.setTransition( child, vProps, factor.to.y, child.to );
+                       }
+
+                       // Horizontal props scaling
+                       if ( factor.from.x !== factor.to.x ) {
+                               child.from = $.effects.setTransition( child, hProps, factor.from.x, child.from );
+                               child.to = $.effects.setTransition( child, hProps, factor.to.x, child.to );
+                       }
+
+                       // Animate children
+                       child.css( child.from );
+                       child.animate( child.to, o.duration, o.easing, function() {
+
+                               // Restore children
+                               if ( restore ) {
+                                       $.effects.restore( child, props2 );
+                               }
+                       });
+               });
+       }
+
+       // Animate
+       el.animate( el.to, {
+               queue: false,
+               duration: o.duration,
+               easing: o.easing,
+               complete: function() {
+                       if ( el.to.opacity === 0 ) {
+                               el.css( "opacity", el.from.opacity );
+                       }
+                       if( mode === "hide" ) {
+                               el.hide();
+                       }
+                       $.effects.restore( el, props );
+                       if ( !restore ) {
+
+                               // we need to calculate our new positioning based on the scaling
+                               if ( position === "static" ) {
+                                       el.css({
+                                               position: "relative",
+                                               top: el.to.top,
+                                               left: el.to.left
+                                       });
+                               } else {
+                                       $.each([ "top", "left" ], function( idx, pos ) {
+                                               el.css( pos, function( _, str ) {
+                                                       var val = parseInt( str, 10 ),
+                                                               toRef = idx ? el.to.left : el.to.top;
+
+                                                       // if original was "auto", recalculate the new value from wrapper
+                                                       if ( str === "auto" ) {
+                                                               return toRef + "px";
+                                                       }
+
+                                                       return val + toRef + "px";
+                                               });
+                                       });
+                               }
+                       }
+
+                       $.effects.removeWrapper( el );
+                       done();
+               }
+       });
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.shake = function( o, done ) {
+
+       var el = $( this ),
+               props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
+               mode = $.effects.setMode( el, o.mode || "effect" ),
+               direction = o.direction || "left",
+               distance = o.distance || 20,
+               times = o.times || 3,
+               anims = times * 2 + 1,
+               speed = Math.round(o.duration/anims),
+               ref = (direction === "up" || direction === "down") ? "top" : "left",
+               positiveMotion = (direction === "up" || direction === "left"),
+               animation = {},
+               animation1 = {},
+               animation2 = {},
+               i,
+
+               // we will need to re-assemble the queue to stack our animations in place
+               queue = el.queue(),
+               queuelen = queue.length;
+
+       $.effects.save( el, props );
+       el.show();
+       $.effects.createWrapper( el );
+
+       // Animation
+       animation[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance;
+       animation1[ ref ] = ( positiveMotion ? "+=" : "-=" ) + distance * 2;
+       animation2[ ref ] = ( positiveMotion ? "-=" : "+=" ) + distance * 2;
+
+       // Animate
+       el.animate( animation, speed, o.easing );
+
+       // Shakes
+       for ( i = 1; i < times; i++ ) {
+               el.animate( animation1, speed, o.easing ).animate( animation2, speed, o.easing );
+       }
+       el
+               .animate( animation1, speed, o.easing )
+               .animate( animation, speed / 2, o.easing )
+               .queue(function() {
+                       if ( mode === "hide" ) {
+                               el.hide();
+                       }
+                       $.effects.restore( el, props );
+                       $.effects.removeWrapper( el );
+                       done();
+               });
+
+       // inject all the animations we just queued to be first in line (after "inprogress")
+       if ( queuelen > 1) {
+               queue.splice.apply( queue,
+                       [ 1, 0 ].concat( queue.splice( queuelen, anims + 1 ) ) );
+       }
+       el.dequeue();
+
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.slide = function( o, done ) {
+
+       // Create element
+       var el = $( this ),
+               props = [ "position", "top", "bottom", "left", "right", "width", "height" ],
+               mode = $.effects.setMode( el, o.mode || "show" ),
+               show = mode === "show",
+               direction = o.direction || "left",
+               ref = (direction === "up" || direction === "down") ? "top" : "left",
+               positiveMotion = (direction === "up" || direction === "left"),
+               distance,
+               animation = {};
+
+       // Adjust
+       $.effects.save( el, props );
+       el.show();
+       distance = o.distance || el[ ref === "top" ? "outerHeight" : "outerWidth" ]( true );
+
+       $.effects.createWrapper( el ).css({
+               overflow: "hidden"
+       });
+
+       if ( show ) {
+               el.css( ref, positiveMotion ? (isNaN(distance) ? "-" + distance : -distance) : distance );
+       }
+
+       // Animation
+       animation[ ref ] = ( show ?
+               ( positiveMotion ? "+=" : "-=") :
+               ( positiveMotion ? "-=" : "+=")) +
+               distance;
+
+       // Animate
+       el.animate( animation, {
+               queue: false,
+               duration: o.duration,
+               easing: o.easing,
+               complete: function() {
+                       if ( mode === "hide" ) {
+                               el.hide();
+                       }
+                       $.effects.restore( el, props );
+                       $.effects.removeWrapper( el );
+                       done();
+               }
+       });
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.effects.effect.transfer = function( o, done ) {
+       var elem = $( this ),
+               target = $( o.to ),
+               targetFixed = target.css( "position" ) === "fixed",
+               body = $("body"),
+               fixTop = targetFixed ? body.scrollTop() : 0,
+               fixLeft = targetFixed ? body.scrollLeft() : 0,
+               endPosition = target.offset(),
+               animation = {
+                       top: endPosition.top - fixTop ,
+                       left: endPosition.left - fixLeft ,
+                       height: target.innerHeight(),
+                       width: target.innerWidth()
+               },
+               startPosition = elem.offset(),
+               transfer = $( '<div class="ui-effects-transfer"></div>' )
+                       .appendTo( document.body )
+                       .addClass( o.className )
+                       .css({
+                               top: startPosition.top - fixTop ,
+                               left: startPosition.left - fixLeft ,
+                               height: elem.innerHeight(),
+                               width: elem.innerWidth(),
+                               position: targetFixed ? "fixed" : "absolute"
+                       })
+                       .animate( animation, o.duration, o.easing, function() {
+                               transfer.remove();
+                               done();
+                       });
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+var mouseHandled = false;
+
+$.widget( "ui.menu", {
+       version: "1.9.2",
+       defaultElement: "<ul>",
+       delay: 300,
+       options: {
+               icons: {
+                       submenu: "ui-icon-carat-1-e"
+               },
+               menus: "ul",
+               position: {
+                       my: "left top",
+                       at: "right top"
+               },
+               role: "menu",
+
+               // callbacks
+               blur: null,
+               focus: null,
+               select: null
+       },
+
+       _create: function() {
+               this.activeMenu = this.element;
+               this.element
+                       .uniqueId()
+                       .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
+                       .toggleClass( "ui-menu-icons", !!this.element.find( ".ui-icon" ).length )
+                       .attr({
+                               role: this.options.role,
+                               tabIndex: 0
+                       })
+                       // need to catch all clicks on disabled menu
+                       // not possible through _on
+                       .bind( "click" + this.eventNamespace, $.proxy(function( event ) {
+                               if ( this.options.disabled ) {
+                                       event.preventDefault();
+                               }
+                       }, this ));
+
+               if ( this.options.disabled ) {
+                       this.element
+                               .addClass( "ui-state-disabled" )
+                               .attr( "aria-disabled", "true" );
+               }
+
+               this._on({
+                       // Prevent focus from sticking to links inside menu after clicking
+                       // them (focus should always stay on UL during navigation).
+                       "mousedown .ui-menu-item > a": function( event ) {
+                               event.preventDefault();
+                       },
+                       "click .ui-state-disabled > a": function( event ) {
+                               event.preventDefault();
+                       },
+                       "click .ui-menu-item:has(a)": function( event ) {
+                               var target = $( event.target ).closest( ".ui-menu-item" );
+                               if ( !mouseHandled && target.not( ".ui-state-disabled" ).length ) {
+                                       mouseHandled = true;
+
+                                       this.select( event );
+                                       // Open submenu on click
+                                       if ( target.has( ".ui-menu" ).length ) {
+                                               this.expand( event );
+                                       } else if ( !this.element.is( ":focus" ) ) {
+                                               // Redirect focus to the menu
+                                               this.element.trigger( "focus", [ true ] );
+
+                                               // If the active item is on the top level, let it stay active.
+                                               // Otherwise, blur the active item since it is no longer visible.
+                                               if ( this.active && this.active.parents( ".ui-menu" ).length === 1 ) {
+                                                       clearTimeout( this.timer );
+                                               }
+                                       }
+                               }
+                       },
+                       "mouseenter .ui-menu-item": function( event ) {
+                               var target = $( event.currentTarget );
+                               // Remove ui-state-active class from siblings of the newly focused menu item
+                               // to avoid a jump caused by adjacent elements both having a class with a border
+                               target.siblings().children( ".ui-state-active" ).removeClass( "ui-state-active" );
+                               this.focus( event, target );
+                       },
+                       mouseleave: "collapseAll",
+                       "mouseleave .ui-menu": "collapseAll",
+                       focus: function( event, keepActiveItem ) {
+                               // If there's already an active item, keep it active
+                               // If not, activate the first item
+                               var item = this.active || this.element.children( ".ui-menu-item" ).eq( 0 );
+
+                               if ( !keepActiveItem ) {
+                                       this.focus( event, item );
+                               }
+                       },
+                       blur: function( event ) {
+                               this._delay(function() {
+                                       if ( !$.contains( this.element[0], this.document[0].activeElement ) ) {
+                                               this.collapseAll( event );
+                                       }
+                               });
+                       },
+                       keydown: "_keydown"
+               });
+
+               this.refresh();
+
+               // Clicks outside of a menu collapse any open menus
+               this._on( this.document, {
+                       click: function( event ) {
+                               if ( !$( event.target ).closest( ".ui-menu" ).length ) {
+                                       this.collapseAll( event );
+                               }
+
+                               // Reset the mouseHandled flag
+                               mouseHandled = false;
+                       }
+               });
+       },
+
+       _destroy: function() {
+               // Destroy (sub)menus
+               this.element
+                       .removeAttr( "aria-activedescendant" )
+                       .find( ".ui-menu" ).andSelf()
+                               .removeClass( "ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons" )
+                               .removeAttr( "role" )
+                               .removeAttr( "tabIndex" )
+                               .removeAttr( "aria-labelledby" )
+                               .removeAttr( "aria-expanded" )
+                               .removeAttr( "aria-hidden" )
+                               .removeAttr( "aria-disabled" )
+                               .removeUniqueId()
+                               .show();
+
+               // Destroy menu items
+               this.element.find( ".ui-menu-item" )
+                       .removeClass( "ui-menu-item" )
+                       .removeAttr( "role" )
+                       .removeAttr( "aria-disabled" )
+                       .children( "a" )
+                               .removeUniqueId()
+                               .removeClass( "ui-corner-all ui-state-hover" )
+                               .removeAttr( "tabIndex" )
+                               .removeAttr( "role" )
+                               .removeAttr( "aria-haspopup" )
+                               .children().each( function() {
+                                       var elem = $( this );
+                                       if ( elem.data( "ui-menu-submenu-carat" ) ) {
+                                               elem.remove();
+                                       }
+                               });
+
+               // Destroy menu dividers
+               this.element.find( ".ui-menu-divider" ).removeClass( "ui-menu-divider ui-widget-content" );
+       },
+
+       _keydown: function( event ) {
+               var match, prev, character, skip, regex,
+                       preventDefault = true;
+
+               function escape( value ) {
+                       return value.replace( /[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&" );
+               }
+
+               switch ( event.keyCode ) {
+               case $.ui.keyCode.PAGE_UP:
+                       this.previousPage( event );
+                       break;
+               case $.ui.keyCode.PAGE_DOWN:
+                       this.nextPage( event );
+                       break;
+               case $.ui.keyCode.HOME:
+                       this._move( "first", "first", event );
+                       break;
+               case $.ui.keyCode.END:
+                       this._move( "last", "last", event );
+                       break;
+               case $.ui.keyCode.UP:
+                       this.previous( event );
+                       break;
+               case $.ui.keyCode.DOWN:
+                       this.next( event );
+                       break;
+               case $.ui.keyCode.LEFT:
+                       this.collapse( event );
+                       break;
+               case $.ui.keyCode.RIGHT:
+                       if ( this.active && !this.active.is( ".ui-state-disabled" ) ) {
+                               this.expand( event );
+                       }
+                       break;
+               case $.ui.keyCode.ENTER:
+               case $.ui.keyCode.SPACE:
+                       this._activate( event );
+                       break;
+               case $.ui.keyCode.ESCAPE:
+                       this.collapse( event );
+                       break;
+               default:
+                       preventDefault = false;
+                       prev = this.previousFilter || "";
+                       character = String.fromCharCode( event.keyCode );
+                       skip = false;
+
+                       clearTimeout( this.filterTimer );
+
+                       if ( character === prev ) {
+                               skip = true;
+                       } else {
+                               character = prev + character;
+                       }
+
+                       regex = new RegExp( "^" + escape( character ), "i" );
+                       match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
+                               return regex.test( $( this ).children( "a" ).text() );
+                       });
+                       match = skip && match.index( this.active.next() ) !== -1 ?
+                               this.active.nextAll( ".ui-menu-item" ) :
+                               match;
+
+                       // If no matches on the current filter, reset to the last character pressed
+                       // to move down the menu to the first item that starts with that character
+                       if ( !match.length ) {
+                               character = String.fromCharCode( event.keyCode );
+                               regex = new RegExp( "^" + escape( character ), "i" );
+                               match = this.activeMenu.children( ".ui-menu-item" ).filter(function() {
+                                       return regex.test( $( this ).children( "a" ).text() );
+                               });
+                       }
+
+                       if ( match.length ) {
+                               this.focus( event, match );
+                               if ( match.length > 1 ) {
+                                       this.previousFilter = character;
+                                       this.filterTimer = this._delay(function() {
+                                               delete this.previousFilter;
+                                       }, 1000 );
+                               } else {
+                                       delete this.previousFilter;
+                               }
+                       } else {
+                               delete this.previousFilter;
+                       }
+               }
+
+               if ( preventDefault ) {
+                       event.preventDefault();
+               }
+       },
+
+       _activate: function( event ) {
+               if ( !this.active.is( ".ui-state-disabled" ) ) {
+                       if ( this.active.children( "a[aria-haspopup='true']" ).length ) {
+                               this.expand( event );
+                       } else {
+                               this.select( event );
+                       }
+               }
+       },
+
+       refresh: function() {
+               var menus,
+                       icon = this.options.icons.submenu,
+                       submenus = this.element.find( this.options.menus );
+
+               // Initialize nested menus
+               submenus.filter( ":not(.ui-menu)" )
+                       .addClass( "ui-menu ui-widget ui-widget-content ui-corner-all" )
+                       .hide()
+                       .attr({
+                               role: this.options.role,
+                               "aria-hidden": "true",
+                               "aria-expanded": "false"
+                       })
+                       .each(function() {
+                               var menu = $( this ),
+                                       item = menu.prev( "a" ),
+                                       submenuCarat = $( "<span>" )
+                                               .addClass( "ui-menu-icon ui-icon " + icon )
+                                               .data( "ui-menu-submenu-carat", true );
+
+                               item
+                                       .attr( "aria-haspopup", "true" )
+                                       .prepend( submenuCarat );
+                               menu.attr( "aria-labelledby", item.attr( "id" ) );
+                       });
+
+               menus = submenus.add( this.element );
+
+               // Don't refresh list items that are already adapted
+               menus.children( ":not(.ui-menu-item):has(a)" )
+                       .addClass( "ui-menu-item" )
+                       .attr( "role", "presentation" )
+                       .children( "a" )
+                               .uniqueId()
+                               .addClass( "ui-corner-all" )
+                               .attr({
+                                       tabIndex: -1,
+                                       role: this._itemRole()
+                               });
+
+               // Initialize unlinked menu-items containing spaces and/or dashes only as dividers
+               menus.children( ":not(.ui-menu-item)" ).each(function() {
+                       var item = $( this );
+                       // hyphen, em dash, en dash
+                       if ( !/[^\-—–\s]/.test( item.text() ) ) {
+                               item.addClass( "ui-widget-content ui-menu-divider" );
+                       }
+               });
+
+               // Add aria-disabled attribute to any disabled menu item
+               menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
+
+               // If the active item has been removed, blur the menu
+               if ( this.active && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
+                       this.blur();
+               }
+       },
+
+       _itemRole: function() {
+               return {
+                       menu: "menuitem",
+                       listbox: "option"
+               }[ this.options.role ];
+       },
+
+       focus: function( event, item ) {
+               var nested, focused;
+               this.blur( event, event && event.type === "focus" );
+
+               this._scrollIntoView( item );
+
+               this.active = item.first();
+               focused = this.active.children( "a" ).addClass( "ui-state-focus" );
+               // Only update aria-activedescendant if there's a role
+               // otherwise we assume focus is managed elsewhere
+               if ( this.options.role ) {
+                       this.element.attr( "aria-activedescendant", focused.attr( "id" ) );
+               }
+
+               // Highlight active parent menu item, if any
+               this.active
+                       .parent()
+                       .closest( ".ui-menu-item" )
+                       .children( "a:first" )
+                       .addClass( "ui-state-active" );
+
+               if ( event && event.type === "keydown" ) {
+                       this._close();
+               } else {
+                       this.timer = this._delay(function() {
+                               this._close();
+                       }, this.delay );
+               }
+
+               nested = item.children( ".ui-menu" );
+               if ( nested.length && ( /^mouse/.test( event.type ) ) ) {
+                       this._startOpening(nested);
+               }
+               this.activeMenu = item.parent();
+
+               this._trigger( "focus", event, { item: item } );
+       },
+
+       _scrollIntoView: function( item ) {
+               var borderTop, paddingTop, offset, scroll, elementHeight, itemHeight;
+               if ( this._hasScroll() ) {
+                       borderTop = parseFloat( $.css( this.activeMenu[0], "borderTopWidth" ) ) || 0;
+                       paddingTop = parseFloat( $.css( this.activeMenu[0], "paddingTop" ) ) || 0;
+                       offset = item.offset().top - this.activeMenu.offset().top - borderTop - paddingTop;
+                       scroll = this.activeMenu.scrollTop();
+                       elementHeight = this.activeMenu.height();
+                       itemHeight = item.height();
+
+                       if ( offset < 0 ) {
+                               this.activeMenu.scrollTop( scroll + offset );
+                       } else if ( offset + itemHeight > elementHeight ) {
+                               this.activeMenu.scrollTop( scroll + offset - elementHeight + itemHeight );
+                       }
+               }
+       },
+
+       blur: function( event, fromFocus ) {
+               if ( !fromFocus ) {
+                       clearTimeout( this.timer );
+               }
+
+               if ( !this.active ) {
+                       return;
+               }
+
+               this.active.children( "a" ).removeClass( "ui-state-focus" );
+               this.active = null;
+
+               this._trigger( "blur", event, { item: this.active } );
+       },
+
+       _startOpening: function( submenu ) {
+               clearTimeout( this.timer );
+
+               // Don't open if already open fixes a Firefox bug that caused a .5 pixel
+               // shift in the submenu position when mousing over the carat icon
+               if ( submenu.attr( "aria-hidden" ) !== "true" ) {
+                       return;
+               }
+
+               this.timer = this._delay(function() {
+                       this._close();
+                       this._open( submenu );
+               }, this.delay );
+       },
+
+       _open: function( submenu ) {
+               var position = $.extend({
+                       of: this.active
+               }, this.options.position );
+
+               clearTimeout( this.timer );
+               this.element.find( ".ui-menu" ).not( submenu.parents( ".ui-menu" ) )
+                       .hide()
+                       .attr( "aria-hidden", "true" );
+
+               submenu
+                       .show()
+                       .removeAttr( "aria-hidden" )
+                       .attr( "aria-expanded", "true" )
+                       .position( position );
+       },
+
+       collapseAll: function( event, all ) {
+               clearTimeout( this.timer );
+               this.timer = this._delay(function() {
+                       // If we were passed an event, look for the submenu that contains the event
+                       var currentMenu = all ? this.element :
+                               $( event && event.target ).closest( this.element.find( ".ui-menu" ) );
+
+                       // If we found no valid submenu ancestor, use the main menu to close all sub menus anyway
+                       if ( !currentMenu.length ) {
+                               currentMenu = this.element;
+                       }
+
+                       this._close( currentMenu );
+
+                       this.blur( event );
+                       this.activeMenu = currentMenu;
+               }, this.delay );
+       },
+
+       // With no arguments, closes the currently active menu - if nothing is active
+       // it closes all menus.  If passed an argument, it will search for menus BELOW
+       _close: function( startMenu ) {
+               if ( !startMenu ) {
+                       startMenu = this.active ? this.active.parent() : this.element;
+               }
+
+               startMenu
+                       .find( ".ui-menu" )
+                               .hide()
+                               .attr( "aria-hidden", "true" )
+                               .attr( "aria-expanded", "false" )
+                       .end()
+                       .find( "a.ui-state-active" )
+                               .removeClass( "ui-state-active" );
+       },
+
+       collapse: function( event ) {
+               var newItem = this.active &&
+                       this.active.parent().closest( ".ui-menu-item", this.element );
+               if ( newItem && newItem.length ) {
+                       this._close();
+                       this.focus( event, newItem );
+               }
+       },
+
+       expand: function( event ) {
+               var newItem = this.active &&
+                       this.active
+                               .children( ".ui-menu " )
+                               .children( ".ui-menu-item" )
+                               .first();
+
+               if ( newItem && newItem.length ) {
+                       this._open( newItem.parent() );
+
+                       // Delay so Firefox will not hide activedescendant change in expanding submenu from AT
+                       this._delay(function() {
+                               this.focus( event, newItem );
+                       });
+               }
+       },
+
+       next: function( event ) {
+               this._move( "next", "first", event );
+       },
+
+       previous: function( event ) {
+               this._move( "prev", "last", event );
+       },
+
+       isFirstItem: function() {
+               return this.active && !this.active.prevAll( ".ui-menu-item" ).length;
+       },
+
+       isLastItem: function() {
+               return this.active && !this.active.nextAll( ".ui-menu-item" ).length;
+       },
+
+       _move: function( direction, filter, event ) {
+               var next;
+               if ( this.active ) {
+                       if ( direction === "first" || direction === "last" ) {
+                               next = this.active
+                                       [ direction === "first" ? "prevAll" : "nextAll" ]( ".ui-menu-item" )
+                                       .eq( -1 );
+                       } else {
+                               next = this.active
+                                       [ direction + "All" ]( ".ui-menu-item" )
+                                       .eq( 0 );
+                       }
+               }
+               if ( !next || !next.length || !this.active ) {
+                       next = this.activeMenu.children( ".ui-menu-item" )[ filter ]();
+               }
+
+               this.focus( event, next );
+       },
+
+       nextPage: function( event ) {
+               var item, base, height;
+
+               if ( !this.active ) {
+                       this.next( event );
+                       return;
+               }
+               if ( this.isLastItem() ) {
+                       return;
+               }
+               if ( this._hasScroll() ) {
+                       base = this.active.offset().top;
+                       height = this.element.height();
+                       this.active.nextAll( ".ui-menu-item" ).each(function() {
+                               item = $( this );
+                               return item.offset().top - base - height < 0;
+                       });
+
+                       this.focus( event, item );
+               } else {
+                       this.focus( event, this.activeMenu.children( ".ui-menu-item" )
+                               [ !this.active ? "first" : "last" ]() );
+               }
+       },
+
+       previousPage: function( event ) {
+               var item, base, height;
+               if ( !this.active ) {
+                       this.next( event );
+                       return;
+               }
+               if ( this.isFirstItem() ) {
+                       return;
+               }
+               if ( this._hasScroll() ) {
+                       base = this.active.offset().top;
+                       height = this.element.height();
+                       this.active.prevAll( ".ui-menu-item" ).each(function() {
+                               item = $( this );
+                               return item.offset().top - base + height > 0;
+                       });
+
+                       this.focus( event, item );
+               } else {
+                       this.focus( event, this.activeMenu.children( ".ui-menu-item" ).first() );
+               }
+       },
+
+       _hasScroll: function() {
+               return this.element.outerHeight() < this.element.prop( "scrollHeight" );
+       },
+
+       select: function( event ) {
+               // TODO: It should never be possible to not have an active item at this
+               // point, but the tests don't trigger mouseenter before click.
+               this.active = this.active || $( event.target ).closest( ".ui-menu-item" );
+               var ui = { item: this.active };
+               if ( !this.active.has( ".ui-menu" ).length ) {
+                       this.collapseAll( event, true );
+               }
+               this._trigger( "select", event, ui );
+       }
+});
+
+}( jQuery ));
+(function( $, undefined ) {
+
+$.widget( "ui.progressbar", {
+       version: "1.9.2",
+       options: {
+               value: 0,
+               max: 100
+       },
+
+       min: 0,
+
+       _create: function() {
+               this.element
+                       .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
+                       .attr({
+                               role: "progressbar",
+                               "aria-valuemin": this.min,
+                               "aria-valuemax": this.options.max,
+                               "aria-valuenow": this._value()
+                       });
+
+               this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
+                       .appendTo( this.element );
+
+               this.oldValue = this._value();
+               this._refreshValue();
+       },
+
+       _destroy: function() {
+               this.element
+                       .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
+                       .removeAttr( "role" )
+                       .removeAttr( "aria-valuemin" )
+                       .removeAttr( "aria-valuemax" )
+                       .removeAttr( "aria-valuenow" );
+
+               this.valueDiv.remove();
+       },
+
+       value: function( newValue ) {
+               if ( newValue === undefined ) {
+                       return this._value();
+               }
+
+               this._setOption( "value", newValue );
+               return this;
+       },
+
+       _setOption: function( key, value ) {
+               if ( key === "value" ) {
+                       this.options.value = value;
+                       this._refreshValue();
+                       if ( this._value() === this.options.max ) {
+                               this._trigger( "complete" );
+                       }
+               }
+
+               this._super( key, value );
+       },
+
+       _value: function() {
+               var val = this.options.value;
+               // normalize invalid value
+               if ( typeof val !== "number" ) {
+                       val = 0;
+               }
+               return Math.min( this.options.max, Math.max( this.min, val ) );
+       },
+
+       _percentage: function() {
+               return 100 * this._value() / this.options.max;
+       },
+
+       _refreshValue: function() {
+               var value = this.value(),
+                       percentage = this._percentage();
+
+               if ( this.oldValue !== value ) {
+                       this.oldValue = value;
+                       this._trigger( "change" );
+               }
+
+               this.valueDiv
+                       .toggle( value > this.min )
+                       .toggleClass( "ui-corner-right", value === this.options.max )
+                       .width( percentage.toFixed(0) + "%" );
+               this.element.attr( "aria-valuenow", value );
+       }
+});
+
+})( jQuery );
+(function( $, undefined ) {
+
+$.widget("ui.resizable", $.ui.mouse, {
+       version: "1.9.2",
+       widgetEventPrefix: "resize",
+       options: {
+               alsoResize: false,
+               animate: false,
+               animateDuration: "slow",
+               animateEasing: "swing",
+               aspectRatio: false,
+               autoHide: false,
+               containment: false,
+               ghost: false,
+               grid: false,
+               handles: "e,s,se",
+               helper: false,
+               maxHeight: null,
+               maxWidth: null,
+               minHeight: 10,
+               minWidth: 10,
+               zIndex: 1000
+       },
+       _create: function() {
+
+               var that = this, o = this.options;
+               this.element.addClass("ui-resizable");
+
+               $.extend(this, {
+                       _aspectRatio: !!(o.aspectRatio),
+                       aspectRatio: o.aspectRatio,
+                       originalElement: this.element,
+                       _proportionallyResizeElements: [],
+                       _helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null
+               });
+
+               //Wrap the element if it cannot hold child nodes
+               if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {
+
+                       //Create a wrapper element and set the wrapper to the new current internal element
+                       this.element.wrap(
+                               $('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({
+                                       position: this.element.css('position'),
+                                       width: this.element.outerWidth(),
+                                       height: this.element.outerHeight(),
+                                       top: this.element.css('top'),
+                                       left: this.element.css('left')
+                               })
+                       );
+
+                       //Overwrite the original this.element
+                       this.element = this.element.parent().data(
+                               "resizable", this.element.data('resizable')
+                       );
+
+                       this.elementIsWrapper = true;
+
+                       //Move margins to the wrapper
+                       this.element.css({ marginLeft: this.originalElement.css("marginLeft"), marginTop: this.originalElement.css("marginTop"), marginRight: this.originalElement.css("marginRight"), marginBottom: this.originalElement.css("marginBottom") });
+                       this.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});
+
+                       //Prevent Safari textarea resize
+                       this.originalResizeStyle = this.originalElement.css('resize');
+                       this.originalElement.css('resize', 'none');
+
+                       //Push the actual element to our proportionallyResize internal array
+                       this._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' }));
+
+                       // avoid IE jump (hard set the margin)
+                       this.originalElement.css({ margin: this.originalElement.css('margin') });
+
+                       // fix handlers offset
+                       this._proportionallyResize();
+
+               }
+
+               this.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? "e,s,se" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' });
+               if(this.handles.constructor == String) {
+
+                       if(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw';
+                       var n = this.handles.split(","); this.handles = {};
+
+                       for(var i = 0; i < n.length; i++) {
+
+                               var handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;
+                               var axis = $('<div class="ui-resizable-handle ' + hname + '"></div>');
+
+                               // Apply zIndex to all handles - see #7960
+                               axis.css({ zIndex: o.zIndex });
+
+                               //TODO : What's going on here?
+                               if ('se' == handle) {
+                                       axis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');
+                               };
+
+                               //Insert into internal handles object and append to element
+                               this.handles[handle] = '.ui-resizable-'+handle;
+                               this.element.append(axis);
+                       }
+
+               }
+
+               this._renderAxis = function(target) {
+
+                       target = target || this.element;
+
+                       for(var i in this.handles) {
+
+                               if(this.handles[i].constructor == String)
+                                       this.handles[i] = $(this.handles[i], this.element).show();
+
+                               //Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)
+                               if (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {
+
+                                       var axis = $(this.handles[i], this.element), padWrapper = 0;
+
+                                       //Checking the correct pad and border
+                                       padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();
+
+                                       //The padding type i have to apply...
+                                       var padPos = [ 'padding',
+                                               /ne|nw|n/.test(i) ? 'Top' :
+                                               /se|sw|s/.test(i) ? 'Bottom' :
+                                               /^e$/.test(i) ? 'Right' : 'Left' ].join("");
+
+                                       target.css(padPos, padWrapper);
+
+                                       this._proportionallyResize();
+
+                               }
+
+                               //TODO: What's that good for? There's not anything to be executed left
+                               if(!$(this.handles[i]).length)
+                                       continue;
+
+                       }
+               };
+
+               //TODO: make renderAxis a prototype function
+               this._renderAxis(this.element);
+
+               this._handles = $('.ui-resizable-handle', this.element)
+                       .disableSelection();
+
+               //Matching axis name
+               this._handles.mouseover(function() {
+                       if (!that.resizing) {
+                               if (this.className)
+                                       var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);
+                               //Axis, default = se
+                               that.axis = axis && axis[1] ? axis[1] : 'se';
+                       }
+               });
+
+               //If we want to auto hide the elements
+               if (o.autoHide) {
+                       this._handles.hide();
+                       $(this.element)
+                               .addClass("ui-resizable-autohide")
+                               .mouseenter(function() {
+                                       if (o.disabled) return;
+                                       $(this).removeClass("ui-resizable-autohide");
+                                       that._handles.show();
+                               })
+                               .mouseleave(function(){
+                                       if (o.disabled) return;
+                                       if (!that.resizing) {
+                                               $(this).addClass("ui-resizable-autohide");
+                                               that._handles.hide();
+                                       }
+                               });
+               }
+
+               //Initialize the mouse interaction
+               this._mouseInit();
+
+       },
+
+       _destroy: function() {
+
+               this._mouseDestroy();
+
+               var _destroy = function(exp) {
+                       $(exp).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing")
+                               .removeData("resizable").removeData("ui-resizable").unbind(".resizable").find('.ui-resizable-handle').remove();
+               };
+
+               //TODO: Unwrap at same DOM position
+               if (this.elementIsWrapper) {
+                       _destroy(this.element);
+                       var wrapper = this.element;
+                       this.originalElement.css({
+                               position: wrapper.css('position'),
+                               width: wrapper.outerWidth(),
+                               height: wrapper.outerHeight(),
+                               top: wrapper.css('top'),
+                               left: wrapper.css('left')
+                       }).insertAfter( wrapper );
+                       wrapper.remove();
+               }
+
+               this.originalElement.css('resize', this.originalResizeStyle);
+               _destroy(this.originalElement);
+
+               return this;
+       },
+
+       _mouseCapture: function(event) {
+               var handle = false;
+               for (var i in this.handles) {
+                       if ($(this.handles[i])[0] == event.target) {
+                               handle = true;
+                       }
+               }
+
+               return !this.options.disabled && handle;
+       },
+
+       _mouseStart: function(event) {
+
+               var o = this.options, iniPos = this.element.position(), el = this.element;
+
+               this.resizing = true;
+               this.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };
+
+               // bugfix for http://dev.jquery.com/ticket/1749
+               if (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {
+                       el.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });
+               }
+
+               this._renderProxy();
+
+               var curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));
+
+               if (o.containment) {
+                       curleft += $(o.containment).scrollLeft() || 0;
+                       curtop += $(o.containment).scrollTop() || 0;
+               }
+
+               //Store needed variables
+               this.offset = this.helper.offset();
+               this.position = { left: curleft, top: curtop };
+               this.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
+               this.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };
+               this.originalPosition = { left: curleft, top: curtop };
+               this.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };
+               this.originalMousePosition = { left: event.pageX, top: event.pageY };
+
+               //Aspect Ratio
+               this.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);
+
+               var cursor = $('.ui-resizable-' + this.axis).css('cursor');
+               $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);
+
+               el.addClass("ui-resizable-resizing");
+               this._propagate("start", event);
+               return true;
+       },
+
+       _mouseDrag: function(event) {
+
+               //Increase performance, avoid regex
+               var el = this.helper, o = this.options, props = {},
+                       that = this, smp = this.originalMousePosition, a = this.axis;
+
+               var dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;
+               var trigger = this._change[a];
+               if (!trigger) return false;
+
+               // Calculate the attrs that will be change
+               var data = trigger.apply(this, [event, dx, dy]);
+
+               // Put this in the mouseDrag handler since the user can start pressing shift while resizing
+               this._updateVirtualBoundaries(event.shiftKey);
+               if (this._aspectRatio || event.shiftKey)
+                       data = this._updateRatio(data, event);
+
+               data = this._respectSize(data, event);
+
+               // plugins callbacks need to be called first
+               this._propagate("resize", event);
+
+               el.css({
+                       top: this.position.top + "px", left: this.position.left + "px",
+                       width: this.size.width + "px", height: this.size.height + "px"
+               });
+
+               if (!this._helper && this._proportionallyResizeElements.length)
+                       this._proportionallyResize();
+
+               this._updateCache(data);
+
+               // calling the user callback at the end
+               this._trigger('resize', event, this.ui());
+
+               return false;
+       },
+
+       _mouseStop: function(event) {
+
+               this.resizing = false;
+               var o = this.options, that = this;
+
+               if(this._helper) {
+                       var pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
+                               soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height,
+                               soffsetw = ista ? 0 : that.sizeDiff.width;
+
+                       var s = { width: (that.helper.width()  - soffsetw), height: (that.helper.height() - soffseth) },
+                               left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null,
+                               top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null;
+
+                       if (!o.animate)
+                               this.element.css($.extend(s, { top: top, left: left }));
+
+                       that.helper.height(that.size.height);
+                       that.helper.width(that.size.width);
+
+                       if (this._helper && !o.animate) this._proportionallyResize();
+               }
+
+               $('body').css('cursor', 'auto');
+
+               this.element.removeClass("ui-resizable-resizing");
+
+               this._propagate("stop", event);
+
+               if (this._helper) this.helper.remove();
+               return false;
+
+       },
+
+       _updateVirtualBoundaries: function(forceAspectRatio) {
+               var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b;
+
+               b = {
+                       minWidth: isNumber(o.minWidth) ? o.minWidth : 0,
+                       maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity,
+                       minHeight: isNumber(o.minHeight) ? o.minHeight : 0,
+                       maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity
+               };
+
+               if(this._aspectRatio || forceAspectRatio) {
+                       // We want to create an enclosing box whose aspect ration is the requested one
+                       // First, compute the "projected" size for each dimension based on the aspect ratio and other dimension
+                       pMinWidth = b.minHeight * this.aspectRatio;
+                       pMinHeight = b.minWidth / this.aspectRatio;
+                       pMaxWidth = b.maxHeight * this.aspectRatio;
+                       pMaxHeight = b.maxWidth / this.aspectRatio;
+
+                       if(pMinWidth > b.minWidth) b.minWidth = pMinWidth;
+                       if(pMinHeight > b.minHeight) b.minHeight = pMinHeight;
+                       if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth;
+                       if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight;
+               }
+               this._vBoundaries = b;
+       },
+
+       _updateCache: function(data) {
+               var o = this.options;
+               this.offset = this.helper.offset();
+               if (isNumber(data.left)) this.position.left = data.left;
+               if (isNumber(data.top)) this.position.top = data.top;
+               if (isNumber(data.height)) this.size.height = data.height;
+               if (isNumber(data.width)) this.size.width = data.width;
+       },
+
+       _updateRatio: function(data, event) {
+
+               var o = this.options, cpos = this.position, csize = this.size, a = this.axis;
+
+               if (isNumber(data.height)) data.width = (data.height * this.aspectRatio);
+               else if (isNumber(data.width)) data.height = (data.width / this.aspectRatio);
+
+               if (a == 'sw') {
+                       data.left = cpos.left + (csize.width - data.width);
+                       data.top = null;
+               }
+               if (a == 'nw') {
+                       data.top = cpos.top + (csize.height - data.height);
+                       data.left = cpos.left + (csize.width - data.width);
+               }
+
+               return data;
+       },
+
+       _respectSize: function(data, event) {
+
+               var el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,
+                               ismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),
+                                       isminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);
+
+               if (isminw) data.width = o.minWidth;
+               if (isminh) data.height = o.minHeight;
+               if (ismaxw) data.width = o.maxWidth;
+               if (ismaxh) data.height = o.maxHeight;
+
+               var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;
+               var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);
+
+               if (isminw && cw) data.left = dw - o.minWidth;
+               if (ismaxw && cw) data.left = dw - o.maxWidth;
+               if (isminh && ch)       data.top = dh - o.minHeight;
+               if (ismaxh && ch)       data.top = dh - o.maxHeight;
+
+               // fixing jump error on top/left - bug #2330
+               var isNotwh = !data.width && !data.height;
+               if (isNotwh && !data.left && data.top) data.top = null;
+               else if (isNotwh && !data.top && data.left) data.left = null;
+
+               return data;
+       },
+
+       _proportionallyResize: function() {
+
+               var o = this.options;
+               if (!this._proportionallyResizeElements.length) return;
+               var element = this.helper || this.element;
+
+               for (var i=0; i < this._proportionallyResizeElements.length; i++) {
+
+                       var prel = this._proportionallyResizeElements[i];
+
+                       if (!this.borderDif) {
+                               var b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],
+                                       p = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];
+
+                               this.borderDif = $.map(b, function(v, i) {
+                                       var border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;
+                                       return border + padding;
+                               });
+                       }
+
+                       prel.css({
+                               height: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,
+                               width: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0
+                       });
+
+               };
+
+       },
+
+       _renderProxy: function() {
+
+               var el = this.element, o = this.options;
+               this.elementOffset = el.offset();
+
+               if(this._helper) {
+
+                       this.helper = this.helper || $('<div style="overflow:hidden;"></div>');
+
+                       // fix ie6 offset TODO: This seems broken
+                       var ie6offset = ($.ui.ie6 ? 1 : 0),
+                       pxyoffset = ( $.ui.ie6 ? 2 : -1 );
+
+                       this.helper.addClass(this._helper).css({
+                               width: this.element.outerWidth() + pxyoffset,
+                               height: this.element.outerHeight() + pxyoffset,
+                               position: 'absolute',
+                               left: this.elementOffset.left - ie6offset +'px',
+                               top: this.elementOffset.top - ie6offset +'px',
+                               zIndex: ++o.zIndex //TODO: Don't modify option
+                       });
+
+                       this.helper
+                               .appendTo("body")
+                               .disableSelection();
+
+               } else {
+                       this.helper = this.element;
+               }
+
+       },
+
+       _change: {
+               e: function(event, dx, dy) {
+                       return { width: this.originalSize.width + dx };
+               },
+               w: function(event, dx, dy) {
+                       var o = this.options, cs = this.originalSize, sp = this.originalPosition;
+                       return { left: sp.left + dx, width: cs.width - dx };
+               },
+               n: function(event, dx, dy) {
+                       var o = this.options, cs = this.originalSize, sp = this.originalPosition;
+                       return { top: sp.top + dy, height: cs.height - dy };
+               },
+               s: function(event, dx, dy) {
+                       return { height: this.originalSize.height + dy };
+               },
+               se: function(event, dx, dy) {
+                       return $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
+               },
+               sw: function(event, dx, dy) {
+                       return $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
+               },
+               ne: function(event, dx, dy) {
+                       return $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));
+               },
+               nw: function(event, dx, dy) {
+                       return $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));
+               }
+       },
+
+       _propagate: function(n, event) {
+               $.ui.plugin.call(this, n, [event, this.ui()]);
+               (n != "resize" && this._trigger(n, event, this.ui()));
+       },
+
+       plugins: {},
+
+       ui: function() {
+               return {
+                       originalElement: this.originalElement,
+                       element: this.element,
+                       helper: this.helper,
+                       position: this.position,
+                       size: this.size,
+                       originalSize: this.originalSize,
+                       originalPosition: this.originalPosition
+               };
+       }
+
+});
+
+/*
+ * Resizable Extensions
+ */
+
+$.ui.plugin.add("resizable", "alsoResize", {
+
+       start: function (event, ui) {
+               var that = $(this).data("resizable"), o = that.options;
+
+               var _store = function (exp) {
+                       $(exp).each(function() {
+                               var el = $(this);
+                               el.data("resizable-alsoresize", {
+                                       width: parseInt(el.width(), 10), height: parseInt(el.height(), 10),
+                                       left: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10)
+                               });
+                       });
+               };
+
+               if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {
+                       if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }
+                       else { $.each(o.alsoResize, function (exp) { _store(exp); }); }
+               }else{
+                       _store(o.alsoResize);
+               }
+       },
+
+       resize: function (event, ui) {
+               var that = $(this).data("resizable"), o = that.options, os = that.originalSize, op = that.originalPosition;
+
+               var delta = {
+                       height: (that.size.height - os.height) || 0, width: (that.size.width - os.width) || 0,
+                       top: (that.position.top - op.top) || 0, left: (that.position.left - op.left) || 0
+               },
+
+               _alsoResize = function (exp, c) {
+                       $(exp).each(function() {
+                               var el = $(this), start = $(this).data("resizable-alsoresize"), style = {},
+                                       css = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];
+
+                               $.each(css, function (i, prop) {
+                                       var sum = (start[prop]||0) + (delta[prop]||0);
+                                       if (sum && sum >= 0)
+                                               style[prop] = sum || null;
+                               });
+
+                               el.css(style);
+                       });
+               };
+
+               if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {
+                       $.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });
+               }else{
+                       _alsoResize(o.alsoResize);
+               }
+       },
+
+       stop: function (event, ui) {
+               $(this).removeData("resizable-alsoresize");
+       }
+});
+
+$.ui.plugin.add("resizable", "animate", {
+
+       stop: function(event, ui) {
+               var that = $(this).data("resizable"), o = that.options;
+
+               var pr = that._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),
+                                       soffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : that.sizeDiff.height,
+                                               soffsetw = ista ? 0 : that.sizeDiff.width;
+
+               var style = { width: (that.size.width - soffsetw), height: (that.size.height - soffseth) },
+                                       left = (parseInt(that.element.css('left'), 10) + (that.position.left - that.originalPosition.left)) || null,
+                                               top = (parseInt(that.element.css('top'), 10) + (that.position.top - that.originalPosition.top)) || null;
+
+               that.element.animate(
+                       $.extend(style, top && left ? { top: top, left: left } : {}), {
+                               duration: o.animateDuration,
+                               easing: o.animateEasing,
+                               step: function() {
+
+                                       var data = {
+                                               width: parseInt(that.element.css('width'), 10),
+                                               height: parseInt(that.element.css('height'), 10),
+                                               top: parseInt(that.element.css('top'), 10),
+                                               left: parseInt(that.element.css('left'), 10)
+                                       };
+
+                                       if (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height });
+
+                                       // propagating resize, and updating values for each animation step
+                                       that._updateCache(data);
+                                       that._propagate("resize", event);
+
+                               }
+                       }
+               );
+       }
+
+});
+
+$.ui.plugin.add("resizable", "containment", {
+
+       start: function(event, ui) {
+               var that = $(this).data("resizable"), o = that.options, el = that.element;
+               var oc = o.containment, ce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;
+               if (!ce) return;
+
+               that.containerElement = $(ce);
+
+               if (/document/.test(oc) || oc == document) {
+                       that.containerOffset = { left: 0, top: 0 };
+                       that.containerPosition = { left: 0, top: 0 };
+
+                       that.parentData = {
+                               element: $(document), left: 0, top: 0,
+                               width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight
+                       };
+               }
+
+               // i'm a node, so compute top, left, right, bottom
+               else {
+                       var element = $(ce), p = [];
+                       $([ "Top", "Right", "Left", "Bottom" ]).each(function(i, name) { p[i] = num(element.css("padding" + name)); });
+
+                       that.containerOffset = element.offset();
+                       that.containerPosition = element.position();
+                       that.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };
+
+                       var co = that.containerOffset, ch = that.containerSize.height,  cw = that.containerSize.width,
+                                               width = ($.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);
+
+                       that.parentData = {
+                               element: ce, left: co.left, top: co.top, width: width, height: height
+                       };
+               }
+       },
+
+       resize: function(event, ui) {
+               var that = $(this).data("resizable"), o = that.options,
+                               ps = that.containerSize, co = that.containerOffset, cs = that.size, cp = that.position,
+                               pRatio = that._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = that.containerElement;
+
+               if (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;
+
+               if (cp.left < (that._helper ? co.left : 0)) {
+                       that.size.width = that.size.width + (that._helper ? (that.position.left - co.left) : (that.position.left - cop.left));
+                       if (pRatio) that.size.height = that.size.width / that.aspectRatio;
+                       that.position.left = o.helper ? co.left : 0;
+               }
+
+               if (cp.top < (that._helper ? co.top : 0)) {
+                       that.size.height = that.size.height + (that._helper ? (that.position.top - co.top) : that.position.top);
+                       if (pRatio) that.size.width = that.size.height * that.aspectRatio;
+                       that.position.top = that._helper ? co.top : 0;
+               }
+
+               that.offset.left = that.parentData.left+that.position.left;
+               that.offset.top = that.parentData.top+that.position.top;
+
+               var woset = Math.abs( (that._helper ? that.offset.left - cop.left : (that.offset.left - cop.left)) + that.sizeDiff.width ),
+                                       hoset = Math.abs( (that._helper ? that.offset.top - cop.top : (that.offset.top - co.top)) + that.sizeDiff.height );
+
+               var isParent = that.containerElement.get(0) == that.element.parent().get(0),
+                       isOffsetRelative = /relative|absolute/.test(that.containerElement.css('position'));
+
+               if(isParent && isOffsetRelative) woset -= that.parentData.left;
+
+               if (woset + that.size.width >= that.parentData.width) {
+                       that.size.width = that.parentData.width - woset;
+                       if (pRatio) that.size.height = that.size.width / that.aspectRatio;
+               }
+
+               if (hoset + that.size.height >= that.parentData.height) {
+                       that.size.height = that.parentData.height - hoset;
+                       if (pRatio) that.size.width = that.size.height * that.aspectRatio;
+               }
+       },
+
+       stop: function(event, ui){
+               var that = $(this).data("resizable"), o = that.options, cp = that.position,
+                               co = that.containerOffset, cop = that.containerPosition, ce = that.containerElement;
+
+               var helper = $(that.helper), ho = helper.offset(), w = helper.outerWidth() - that.sizeDiff.width, h = helper.outerHeight() - that.sizeDiff.height;
+
+               if (that._helper && !o.animate && (/relative/).test(ce.css('position')))
+                       $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
+
+               if (that._helper && !o.animate && (/static/).test(ce.css('position')))
+                       $(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });
+
+       }
+});
+
+$.ui.plugin.add("resizable", "ghost", {
+
+       start: function(event, ui) {
+
+               var that = $(this).data("resizable"), o = that.options, cs = that.size;
+
+               that.ghost = that.originalElement.clone();
+               that.ghost
+                       .css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })
+                       .addClass('ui-resizable-ghost')
+                       .addClass(typeof o.ghost == 'string' ? o.ghost : '');
+
+               that.ghost.appendTo(that.helper);
+
+       },
+
+       resize: function(event, ui){
+               var that = $(this).data("resizable"), o = that.options;
+               if (that.ghost) that.ghost.css({ position: 'relative', height: that.size.height, width: that.size.width });
+       },
+
+       stop: function(event, ui){
+               var that = $(this).data("resizable"), o = that.options;
+               if (that.ghost && that.helper) that.helper.get(0).removeChild(that.ghost.get(0));
+       }
+
+});
+
+$.ui.plugin.add("resizable", "grid", {
+
+       resize: function(event, ui) {
+               var that = $(this).data("resizable"), o = that.options, cs = that.size, os = that.originalSize, op = that.originalPosition, a = that.axis, ratio = o._aspectRatio || event.shiftKey;
+               o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;
+               var ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);
+
+               if (/^(se|s|e)$/.test(a)) {
+                       that.size.width = os.width + ox;
+                       that.size.height = os.height + oy;
+               }
+               else if (/^(ne)$/.test(a)) {
+                       that.size.width = os.width + ox;
+                       that.size.height = os.height + oy;
+                       that.position.top = op.top - oy;
+               }
+               else if (/^(sw)$/.test(a)) {
+                       that.size.width = os.width + ox;
+                       that.size.height = os.height + oy;
+                       that.position.left = op.left - ox;
+               }
+               else {
+                       that.size.width = os.width + ox;
+                       that.size.height = os.height + oy;
+                       that.position.top = op.top - oy;
+                       that.position.left = op.left - ox;
+               }
+       }
+
+});
+
+var num = function(v) {
+       return parseInt(v, 10) || 0;
+};
+
+var isNumber = function(value) {
+       return !isNaN(parseInt(value, 10));
+};
+
+})(jQuery);
+(function( $, undefined ) {
+
+$.widget("ui.selectable", $.ui.mouse, {
+       version: "1.9.2",
+       options: {
+               appendTo: 'body',
+               autoRefresh: true,
+               distance: 0,
+               filter: '*',
+               tolerance: 'touch'
+       },
+       _create: function() {
+               var that = this;
+
+               this.element.addClass("ui-selectable");
+
+               this.dragged = false;
+
+               // cache selectee children based on filter
+               var selectees;
+               this.refresh = function() {
+                       selectees = $(that.options.filter, that.element[0]);
+                       selectees.addClass("ui-selectee");
+                       selectees.each(function() {
+                               var $this = $(this);
+                               var pos = $this.offset();
+                               $.data(this, "selectable-item", {
+                                       element: this,
+                                       $element: $this,
+                                       left: pos.left,
+                                       top: pos.top,
+                                       right: pos.left + $this.outerWidth(),
+                                       bottom: pos.top + $this.outerHeight(),
+                                       startselected: false,
+                                       selected: $this.hasClass('ui-selected'),
+                                       selecting: $this.hasClass('ui-selecting'),
+                                       unselecting: $this.hasClass('ui-unselecting')
+                               });
+                       });
+               };
+               this.refresh();
+
+               this.selectees = selectees.addClass("ui-selectee");
+
+               this._mouseInit();
+
+               this.helper = $("<div class='ui-selectable-helper'></div>");
+       },
+
+       _destroy: function() {
+               this.selectees
+                       .removeClass("ui-selectee")
+                       .removeData("selectable-item");
+               this.element
+                       .removeClass("ui-selectable ui-selectable-disabled");
+               this._mouseDestroy();
+       },
+
+       _mouseStart: function(event) {
+               var that = this;
+
+               this.opos = [event.pageX, event.pageY];
+
+               if (this.options.disabled)
+                       return;
+
+               var options = this.options;
+
+               this.selectees = $(options.filter, this.element[0]);
+
+               this._trigger("start", event);
+
+               $(options.appendTo).append(this.helper);
+               // position helper (lasso)
+               this.helper.css({
+                       "left": event.clientX,
+                       "top": event.clientY,
+                       "width": 0,
+                       "height": 0
+               });
+
+               if (options.autoRefresh) {
+                       this.refresh();
+               }
+
+               this.selectees.filter('.ui-selected').each(function() {
+                       var selectee = $.data(this, "selectable-item");
+                       selectee.startselected = true;
+                       if (!event.metaKey && !event.ctrlKey) {
+                               selectee.$element.removeClass('ui-selected');
+                               selectee.selected = false;
+                               selectee.$element.addClass('ui-unselecting');
+                               selectee.unselecting = true;
+                               // selectable UNSELECTING callback
+                               that._trigger("unselecting", event, {
+                                       unselecting: selectee.element
+                               });
+                       }
+               });
+
+               $(event.target).parents().andSelf().each(function() {
+                       var selectee = $.data(this, "selectable-item");
+                       if (selectee) {
+                               var doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected');
+                               selectee.$element
+                                       .removeClass(doSelect ? "ui-unselecting" : "ui-selected")
+                                       .addClass(doSelect ? "ui-selecting" : "ui-unselecting");
+                               selectee.unselecting = !doSelect;
+                               selectee.selecting = doSelect;
+                               selectee.selected = doSelect;
+                               // selectable (UN)SELECTING callback
+                               if (doSelect) {
+                                       that._trigger("selecting", event, {
+                                               selecting: selectee.element
+                                       });
+                               } else {
+                                       that._trigger("unselecting", event, {
+                                               unselecting: selectee.element
+                                       });
+                               }
+                               return false;
+                       }
+               });
+
+       },
+
+       _mouseDrag: function(event) {
+               var that = this;
+               this.dragged = true;
+
+               if (this.options.disabled)
+                       return;
+
+               var options = this.options;
+
+               var x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;
+               if (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }
+               if (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }
+               this.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});
+
+               this.selectees.each(function() {
+                       var selectee = $.data(this, "selectable-item");
+                       //prevent helper from being selected if appendTo: selectable
+                       if (!selectee || selectee.element == that.element[0])
+                               return;
+                       var hit = false;
+                       if (options.tolerance == 'touch') {
+                               hit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );
+                       } else if (options.tolerance == 'fit') {
+                               hit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);
+                       }
+
+                       if (hit) {
+                               // SELECT
+                               if (selectee.selected) {
+                                       selectee.$element.removeClass('ui-selected');
+                                       selectee.selected = false;
+                               }
+                               if (selectee.unselecting) {
+                                       selectee.$element.removeClass('ui-unselecting');
+                                       selectee.unselecting = false;
+                               }
+                               if (!selectee.selecting) {
+                                       selectee.$element.addClass('ui-selecting');
+                                       selectee.selecting = true;
+                                       // selectable SELECTING callback
+                                       that._trigger("selecting", event, {
+                                               selecting: selectee.element
+                                       });
+                               }
+                       } else {
+                               // UNSELECT
+                               if (selectee.selecting) {
+                                       if ((event.metaKey || event.ctrlKey) && selectee.startselected) {
+                                               selectee.$element.removeClass('ui-selecting');
+                                               selectee.selecting = false;
+                                               selectee.$element.addClass('ui-selected');
+                                               selectee.selected = true;
+                                       } else {
+                                               selectee.$element.removeClass('ui-selecting');
+                                               selectee.selecting = false;
+                                               if (selectee.startselected) {
+                                                       selectee.$element.addClass('ui-unselecting');
+                                                       selectee.unselecting = true;
+                                               }
+                                               // selectable UNSELECTING callback
+                                               that._trigger("unselecting", event, {
+                                                       unselecting: selectee.element
+                                               });
+                                       }
+                               }
+                               if (selectee.selected) {
+                                       if (!event.metaKey && !event.ctrlKey && !selectee.startselected) {
+                                               selectee.$element.removeClass('ui-selected');
+                                               selectee.selected = false;
+
+                                               selectee.$element.addClass('ui-unselecting');
+                                               selectee.unselecting = true;
+                                               // selectable UNSELECTING callback
+                                               that._trigger("unselecting", event, {
+                                                       unselecting: selectee.element
+                                               });
+                                       }
+                               }
+                       }
+               });
+
+               return false;
+       },
+
+       _mouseStop: function(event) {
+               var that = this;
+
+               this.dragged = false;
+
+               var options = this.options;
+
+               $('.ui-unselecting', this.element[0]).each(function() {
+                       var selectee = $.data(this, "selectable-item");
+                       selectee.$element.removeClass('ui-unselecting');
+                       selectee.unselecting = false;
+                       selectee.startselected = false;
+                       that._trigger("unselected", event, {
+                               unselected: selectee.element
+                       });
+               });
+               $('.ui-selecting', this.element[0]).each(function() {
+                       var selectee = $.data(this, "selectable-item");
+                       selectee.$element.removeClass('ui-selecting').addClass('ui-selected');
+                       selectee.selecting = false;
+                       selectee.selected = true;
+                       selectee.startselected = true;
+                       that._trigger("selected", event, {
+                               selected: selectee.element
+                       });
+               });
+               this._trigger("stop", event);
+
+               this.helper.remove();
+
+               return false;
+       }
+
+});
+
+})(jQuery);
+(function( $, undefined ) {
+
+// number of pages in a slider
+// (how many times can you page up/down to go through the whole range)
+var numPages = 5;
+
+$.widget( "ui.slider", $.ui.mouse, {
+       version: "1.9.2",
+       widgetEventPrefix: "slide",
+
+       options: {
+               animate: false,
+               distance: 0,
+               max: 100,
+               min: 0,
+               orientation: "horizontal",
+               range: false,
+               step: 1,
+               value: 0,
+               values: null
+       },
+
+       _create: function() {
+               var i, handleCount,
+                       o = this.options,
+                       existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
+                       handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",
+                       handles = [];
+
+               this._keySliding = false;
+               this._mouseSliding = false;
+               this._animateOff = true;
+               this._handleIndex = null;
+               this._detectOrientation();
+               this._mouseInit();
+
+               this.element
+                       .addClass( "ui-slider" +
+                               " ui-slider-" + this.orientation +
+                               " ui-widget" +
+                               " ui-widget-content" +
+                               " ui-corner-all" +
+                               ( o.disabled ? " ui-slider-disabled ui-disabled" : "" ) );
+
+               this.range = $([]);
+
+               if ( o.range ) {
+                       if ( o.range === true ) {
+                               if ( !o.values ) {
+                                       o.values = [ this._valueMin(), this._valueMin() ];
+                               }
+                               if ( o.values.length && o.values.length !== 2 ) {
+                                       o.values = [ o.values[0], o.values[0] ];
+                               }
+                       }
+
+                       this.range = $( "<div></div>" )
+                               .appendTo( this.element )
+                               .addClass( "ui-slider-range" +
+                               // note: this isn't the most fittingly semantic framework class for this element,
+                               // but worked best visually with a variety of themes
+                               " ui-widget-header" +
+                               ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) );
+               }
+
+               handleCount = ( o.values && o.values.length ) || 1;
+
+               for ( i = existingHandles.length; i < handleCount; i++ ) {
+                       handles.push( handle );
+               }
+
+               this.handles = existingHandles.add( $( handles.join( "" ) ).appendTo( this.element ) );
+
+               this.handle = this.handles.eq( 0 );
+
+               this.handles.add( this.range ).filter( "a" )
+                       .click(function( event ) {
+                               event.preventDefault();
+                       })
+                       .mouseenter(function() {
+                               if ( !o.disabled ) {
+                                       $( this ).addClass( "ui-state-hover" );
+                               }
+                       })
+                       .mouseleave(function() {
+                               $( this ).removeClass( "ui-state-hover" );
+                       })
+                       .focus(function() {
+                               if ( !o.disabled ) {
+                                       $( ".ui-slider .ui-state-focus" ).removeClass( "ui-state-focus" );
+                                       $( this ).addClass( "ui-state-focus" );
+                               } else {
+                                       $( this ).blur();
+                               }
+                       })
+                       .blur(function() {
+                               $( this ).removeClass( "ui-state-focus" );
+                       });
+
+               this.handles.each(function( i ) {
+                       $( this ).data( "ui-slider-handle-index", i );
+               });
+
+               this._on( this.handles, {
+                       keydown: function( event ) {
+                               var allowed, curVal, newVal, step,
+                                       index = $( event.target ).data( "ui-slider-handle-index" );
+
+                               switch ( event.keyCode ) {
+                                       case $.ui.keyCode.HOME:
+                                       case $.ui.keyCode.END:
+                                       case $.ui.keyCode.PAGE_UP:
+                                       case $.ui.keyCode.PAGE_DOWN:
+                                       case $.ui.keyCode.UP:
+                                       case $.ui.keyCode.RIGHT:
+                                       case $.ui.keyCode.DOWN:
+                                       case $.ui.keyCode.LEFT:
+                                               event.preventDefault();
+                                               if ( !this._keySliding ) {
+                                                       this._keySliding = true;
+                                                       $( event.target ).addClass( "ui-state-active" );
+                                                       allowed = this._start( event, index );
+                                                       if ( allowed === false ) {
+                                                               return;
+                                                       }
+                                               }
+                                               break;
+                               }
+
+                               step = this.options.step;
+                               if ( this.options.values && this.options.values.length ) {
+                                       curVal = newVal = this.values( index );
+                               } else {
+                                       curVal = newVal = this.value();
+                               }
+
+                               switch ( event.keyCode ) {
+                                       case $.ui.keyCode.HOME:
+                                               newVal = this._valueMin();
+                                               break;
+                                       case $.ui.keyCode.END:
+                                               newVal = this._valueMax();
+                                               break;
+                                       case $.ui.keyCode.PAGE_UP:
+                                               newVal = this._trimAlignValue( curVal + ( (this._valueMax() - this._valueMin()) / numPages ) );
+                                               break;
+                                       case $.ui.keyCode.PAGE_DOWN:
+                                               newVal = this._trimAlignValue( curVal - ( (this._valueMax() - this._valueMin()) / numPages ) );
+                                               break;
+                                       case $.ui.keyCode.UP:
+                                       case $.ui.keyCode.RIGHT:
+                                               if ( curVal === this._valueMax() ) {
+                                                       return;
+                                               }
+                                               newVal = this._trimAlignValue( curVal + step );
+                                               break;
+                                       case $.ui.keyCode.DOWN:
+                                       case $.ui.keyCode.LEFT:
+                                               if ( curVal === this._valueMin() ) {
+                                                       return;
+                                               }
+                                               newVal = this._trimAlignValue( curVal - step );
+                                               break;
+                               }
+
+                               this._slide( event, index, newVal );
+                       },
+                       keyup: function( event ) {
+                               var index = $( event.target ).data( "ui-slider-handle-index" );
+
+                               if ( this._keySliding ) {
+                                       this._keySliding = false;
+                                       this._stop( event, index );
+                                       this._change( event, index );
+                                       $( event.target ).removeClass( "ui-state-active" );
+                               }
+                       }
+               });
+
+               this._refreshValue();
+
+               this._animateOff = false;
+       },
+
+       _destroy: function() {
+               this.handles.remove();
+               this.range.remove();
+
+               this.element
+                       .removeClass( "ui-slider" +
+                               " ui-slider-horizontal" +
+                               " ui-slider-vertical" +
+                               " ui-slider-disabled" +
+                               " ui-widget" +
+                               " ui-widget-content" +
+                               " ui-corner-all" );
+
+               this._mouseDestroy();
+       },
+
+       _mouseCapture: function( event ) {
+               var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
+                       that = this,
+                       o = this.options;
+
+               if ( o.disabled ) {
+                       return false;
+               }
+
+               this.elementSize = {
+                       width: this.element.outerWidth(),
+                       height: this.element.outerHeight()
+               };
+               this.elementOffset = this.element.offset();
+
+               position = { x: event.pageX, y: event.pageY };
+               normValue = this._normValueFromMouse( position );
+               distance = this._valueMax() - this._valueMin() + 1;
+               this.handles.each(function( i ) {
+                       var thisDistance = Math.abs( normValue - that.values(i) );
+                       if ( distance > thisDistance ) {
+                               distance = thisDistance;
+                               closestHandle = $( this );
+                               index = i;
+                       }
+               });
+
+               // workaround for bug #3736 (if both handles of a range are at 0,
+               // the first is always used as the one with least distance,
+               // and moving it is obviously prevented by preventing negative ranges)
+               if( o.range === true && this.values(1) === o.min ) {
+                       index += 1;
+                       closestHandle = $( this.handles[index] );
+               }
+
+               allowed = this._start( event, index );
+               if ( allowed === false ) {
+                       return false;
+               }
+               this._mouseSliding = true;
+
+               this._handleIndex = index;
+
+               closestHandle
+                       .addClass( "ui-state-active" )
+                       .focus();
+
+               offset = closestHandle.offset();
+               mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" );
+               this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
+                       left: event.pageX - offset.left - ( closestHandle.width() / 2 ),
+                       top: event.pageY - offset.top -
+                               ( closestHandle.height() / 2 ) -
+                               ( parseInt( closestHandle.css("borderTopWidth"), 10 ) || 0 ) -
+                               ( parseInt( closestHandle.css("borderBottomWidth"), 10 ) || 0) +
+                               ( parseInt( closestHandle.css("marginTop"), 10 ) || 0)
+               };
+
+               if ( !this.handles.hasClass( "ui-state-hover" ) ) {
+                       this._slide( event, index, normValue );
+               }
+               this._animateOff = true;
+               return true;
+       },
+
+       _mouseStart: function() {
+               return true;
+       },
+
+       _mouseDrag: function( event ) {
+               var position = { x: event.pageX, y: event.pageY },
+                       normValue = this._normValueFromMouse( position );
+
+               this._slide( event, this._handleIndex, normValue );
+
+               return false;
+       },
+
+       _mouseStop: function( event ) {
+               this.handles.removeClass( "ui-state-active" );
+               this._mouseSliding = false;
+
+               this._stop( event, this._handleIndex );
+               this._change( event, this._handleIndex );
+
+               this._handleIndex = null;
+               this._clickOffset = null;
+               this._animateOff = false;
+
+               return false;
+       },
+
+       _detectOrientation: function() {
+               this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal";
+       },
+
+       _normValueFromMouse: function( position ) {
+               var pixelTotal,
+                       pixelMouse,
+                       percentMouse,
+                       valueTotal,
+                       valueMouse;
+
+               if ( this.orientation === "horizontal" ) {
+                       pixelTotal = this.elementSize.width;
+                       pixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );
+               } else {
+                       pixelTotal = this.elementSize.height;
+                       pixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );
+               }
+
+               percentMouse = ( pixelMouse / pixelTotal );
+               if ( percentMouse > 1 ) {
+                       percentMouse = 1;
+               }
+               if ( percentMouse < 0 ) {
+                       percentMouse = 0;
+               }
+               if ( this.orientation === "vertical" ) {
+                       percentMouse = 1 - percentMouse;
+               }
+
+               valueTotal = this._valueMax() - this._valueMin();
+               valueMouse = this._valueMin() + percentMouse * valueTotal;
+
+               return this._trimAlignValue( valueMouse );
+       },
+
+       _start: function( event, index ) {
+               var uiHash = {
+                       handle: this.handles[ index ],
+                       value: this.value()
+               };
+               if ( this.options.values && this.options.values.length ) {
+                       uiHash.value = this.values( index );
+                       uiHash.values = this.values();
+               }
+               return this._trigger( "start", event, uiHash );
+       },
+
+       _slide: function( event, index, newVal ) {
+               var otherVal,
+                       newValues,
+                       allowed;
+
+               if ( this.options.values && this.options.values.length ) {
+                       otherVal = this.values( index ? 0 : 1 );
+
+                       if ( ( this.options.values.length === 2 && this.options.range === true ) &&
+                                       ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
+                               ) {
+                               newVal = otherVal;
+                       }
+
+                       if ( newVal !== this.values( index ) ) {
+                               newValues = this.values();
+                               newValues[ index ] = newVal;
+                               // A slide can be canceled by returning false from the slide callback
+                               allowed = this._trigger( "slide", event, {
+                                       handle: this.handles[ index ],
+                                       value: newVal,
+                                       values: newValues
+                               } );
+                               otherVal = this.values( index ? 0 : 1 );
+                               if ( allowed !== false ) {
+                                       this.values( index, newVal, true );
+                               }
+                       }
+               } else {
+                       if ( newVal !== this.value() ) {
+                               // A slide can be canceled by returning false from the slide callback
+                               allowed = this._trigger( "slide", event, {
+                                       handle: this.handles[ index ],
+                                       value: newVal
+                               } );
+                               if ( allowed !== false ) {
+                                       this.value( newVal );
+                               }
+                       }
+               }
+       },
+
+       _stop: function( event, index ) {
+               var uiHash = {
+                       handle: this.handles[ index ],
+                       value: this.value()
+               };
+               if ( this.options.values && this.options.values.length ) {
+                       uiHash.value = this.values( index );
+                       uiHash.values = this.values();
+               }
+
+               this._trigger( "stop", event, uiHash );
+       },
+
+       _change: function( event, index ) {
+               if ( !this._keySliding && !this._mouseSliding ) {
+                       var uiHash = {
+                               handle: this.handles[ index ],
+                               value: this.value()
+                       };
+                       if ( this.options.values && this.options.values.length ) {
+                               uiHash.value = this.values( index );
+                               uiHash.values = this.values();
+                       }
+
+                       this._trigger( "change", event, uiHash );
+               }
+       },
+
+       value: function( newValue ) {
+               if ( arguments.length ) {
+                       this.options.value = this._trimAlignValue( newValue );
+                       this._refreshValue();
+                       this._change( null, 0 );
+                       return;
+               }
+
+               return this._value();
+       },
+
+       values: function( index, newValue ) {
+               var vals,
+                       newValues,
+                       i;
+
+               if ( arguments.length > 1 ) {
+                       this.options.values[ index ] = this._trimAlignValue( newValue );
+                       this._refreshValue();
+                       this._change( null, index );
+                       return;
+               }
+
+               if ( arguments.length ) {
+                       if ( $.isArray( arguments[ 0 ] ) ) {
+                               vals = this.options.values;
+                               newValues = arguments[ 0 ];
+                               for ( i = 0; i < vals.length; i += 1 ) {
+                                       vals[ i ] = this._trimAlignValue( newValues[ i ] );
+                                       this._change( null, i );
+                               }
+                               this._refreshValue();
+                       } else {
+                               if ( this.options.values && this.options.values.length ) {
+                                       return this._values( index );
+                               } else {
+                                       return this.value();
+                               }
+                       }
+               } else {
+                       return this._values();
+               }
+       },
+
+       _setOption: function( key, value ) {
+               var i,
+                       valsLength = 0;
+
+               if ( $.isArray( this.options.values ) ) {
+                       valsLength = this.options.values.length;
+               }
+
+               $.Widget.prototype._setOption.apply( this, arguments );
+
+               switch ( key ) {
+                       case "disabled":
+                               if ( value ) {
+                                       this.handles.filter( ".ui-state-focus" ).blur();
+                                       this.handles.removeClass( "ui-state-hover" );
+                                       this.handles.prop( "disabled", true );
+                                       this.element.addClass( "ui-disabled" );
+                               } else {
+                                       this.handles.prop( "disabled", false );
+                                       this.element.removeClass( "ui-disabled" );
+                               }
+                               break;
+                       case "orientation":
+                               this._detectOrientation();
+                               this.element
+                                       .removeClass( "ui-slider-horizontal ui-slider-vertical" )
+                                       .addClass( "ui-slider-" + this.orientation );
+                               this._refreshValue();
+                               break;
+                       case "value":
+                               this._animateOff = true;
+                               this._refreshValue();
+                               this._change( null, 0 );
+                               this._animateOff = false;
+                               break;
+                       case "values":
+                               this._animateOff = true;
+                               this._refreshValue();
+                               for ( i = 0; i < valsLength; i += 1 ) {
+                                       this._change( null, i );
+                               }
+                               this._animateOff = false;
+                               break;
+                       case "min":
+                       case "max":
+                               this._animateOff = true;
+                               this._refreshValue();
+                               this._animateOff = false;
+                               break;
+               }
+       },
+
+       //internal value getter
+       // _value() returns value trimmed by min and max, aligned by step
+       _value: function() {
+               var val = this.options.value;
+               val = this._trimAlignValue( val );
+
+               return val;
+       },
+
+       //internal values getter
+       // _values() returns array of values trimmed by min and max, aligned by step
+       // _values( index ) returns single value trimmed by min and max, aligned by step
+       _values: function( index ) {
+               var val,
+                       vals,
+                       i;
+
+               if ( arguments.length ) {
+                       val = this.options.values[ index ];
+                       val = this._trimAlignValue( val );
+
+                       return val;
+               } else {
+                       // .slice() creates a copy of the array
+                       // this copy gets trimmed by min and max and then returned
+                       vals = this.options.values.slice();
+                       for ( i = 0; i < vals.length; i+= 1) {
+                               vals[ i ] = this._trimAlignValue( vals[ i ] );
+                       }
+
+                       return vals;
+               }
+       },
+
+       // returns the step-aligned value that val is closest to, between (inclusive) min and max
+       _trimAlignValue: function( val ) {
+               if ( val <= this._valueMin() ) {
+                       return this._valueMin();
+               }
+               if ( val >= this._valueMax() ) {
+                       return this._valueMax();
+               }
+               var step = ( this.options.step > 0 ) ? this.options.step : 1,
+                       valModStep = (val - this._valueMin()) % step,
+                       alignValue = val - valModStep;
+
+               if ( Math.abs(valModStep) * 2 >= step ) {
+                       alignValue += ( valModStep > 0 ) ? step : ( -step );
+               }
+
+               // Since JavaScript has problems with large floats, round
+               // the final value to 5 digits after the decimal point (see #4124)
+               return parseFloat( alignValue.toFixed(5) );
+       },
+
+       _valueMin: function() {
+               return this.options.min;
+       },
+
+       _valueMax: function() {
+               return this.options.max;
+       },
+
+       _refreshValue: function() {
+               var lastValPercent, valPercent, value, valueMin, valueMax,
+                       oRange = this.options.range,
+                       o = this.options,
+                       that = this,
+                       animate = ( !this._animateOff ) ? o.animate : false,
+                       _set = {};
+
+               if ( this.options.values && this.options.values.length ) {
+                       this.handles.each(function( i ) {
+                               valPercent = ( that.values(i) - that._valueMin() ) / ( that._valueMax() - that._valueMin() ) * 100;
+                               _set[ that.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
+                               $( this ).stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
+                               if ( that.options.range === true ) {
+                                       if ( that.orientation === "horizontal" ) {
+                                               if ( i === 0 ) {
+                                                       that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { left: valPercent + "%" }, o.animate );
+                                               }
+                                               if ( i === 1 ) {
+                                                       that.range[ animate ? "animate" : "css" ]( { width: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
+                                               }
+                                       } else {
+                                               if ( i === 0 ) {
+                                                       that.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { bottom: ( valPercent ) + "%" }, o.animate );
+                                               }
+                                               if ( i === 1 ) {
+                                                       that.range[ animate ? "animate" : "css" ]( { height: ( valPercent - lastValPercent ) + "%" }, { queue: false, duration: o.animate } );
+                                               }
+                                       }
+                               }
+                               lastValPercent = valPercent;
+                       });
+               } else {
+                       value = this.value();
+                       valueMin = this._valueMin();
+                       valueMax = this._valueMax();
+                       valPercent = ( valueMax !== valueMin ) ?
+                                       ( value - valueMin ) / ( valueMax - valueMin ) * 100 :
+                                       0;
+                       _set[ this.orientation === "horizontal" ? "left" : "bottom" ] = valPercent + "%";
+                       this.handle.stop( 1, 1 )[ animate ? "animate" : "css" ]( _set, o.animate );
+
+                       if ( oRange === "min" && this.orientation === "horizontal" ) {
+                               this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { width: valPercent + "%" }, o.animate );
+                       }
+                       if ( oRange === "max" && this.orientation === "horizontal" ) {
+                               this.range[ animate ? "animate" : "css" ]( { width: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
+                       }
+                       if ( oRange === "min" && this.orientation === "vertical" ) {
+                               this.range.stop( 1, 1 )[ animate ? "animate" : "css" ]( { height: valPercent + "%" }, o.animate );
+                       }
+                       if ( oRange === "max" && this.orientation === "vertical" ) {
+                               this.range[ animate ? "animate" : "css" ]( { height: ( 100 - valPercent ) + "%" }, { queue: false, duration: o.animate } );
+                       }
+               }
+       }
+
+});
+
+}(jQuery));
+(function( $, undefined ) {
+
+$.widget("ui.sortable", $.ui.mouse, {
+       version: "1.9.2",
+       widgetEventPrefix: "sort",
+       ready: false,
+       options: {
+               appendTo: "parent",
+               axis: false,
+               connectWith: false,
+               containment: false,
+               cursor: 'auto',
+               cursorAt: false,
+               dropOnEmpty: true,
+               forcePlaceholderSize: false,
+               forceHelperSize: false,
+               grid: false,
+               handle: false,
+               helper: "original",
+               items: '> *',
+               opacity: false,
+               placeholder: false,
+               revert: false,
+               scroll: true,
+               scrollSensitivity: 20,
+               scrollSpeed: 20,
+               scope: "default",
+               tolerance: "intersect",
+               zIndex: 1000
+       },
+       _create: function() {
+
+               var o = this.options;
+               this.containerCache = {};
+               this.element.addClass("ui-sortable");
+
+               //Get the items
+               this.refresh();
+
+               //Let's determine if the items are being displayed horizontally
+               this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false;
+
+               //Let's determine the parent's offset
+               this.offset = this.element.offset();
+
+               //Initialize mouse events for interaction
+               this._mouseInit();
+
+               //We're ready to go
+               this.ready = true
+
+       },
+
+       _destroy: function() {
+               this.element
+                       .removeClass("ui-sortable ui-sortable-disabled");
+               this._mouseDestroy();
+
+               for ( var i = this.items.length - 1; i >= 0; i-- )
+                       this.items[i].item.removeData(this.widgetName + "-item");
+
+               return this;
+       },
+
+       _setOption: function(key, value){
+               if ( key === "disabled" ) {
+                       this.options[ key ] = value;
+
+                       this.widget().toggleClass( "ui-sortable-disabled", !!value );
+               } else {
+                       // Don't call widget base _setOption for disable as it adds ui-state-disabled class
+                       $.Widget.prototype._setOption.apply(this, arguments);
+               }
+       },
+
+       _mouseCapture: function(event, overrideHandle) {
+               var that = this;
+
+               if (this.reverting) {
+                       return false;
+               }
+
+               if(this.options.disabled || this.options.type == 'static') return false;
+
+               //We have to refresh the items data once first
+               this._refreshItems(event);
+
+               //Find out if the clicked node (or one of its parents) is a actual item in this.items
+               var currentItem = null, nodes = $(event.target).parents().each(function() {
+                       if($.data(this, that.widgetName + '-item') == that) {
+                               currentItem = $(this);
+                               return false;
+                       }
+               });
+               if($.data(event.target, that.widgetName + '-item') == that) currentItem = $(event.target);
+
+               if(!currentItem) return false;
+               if(this.options.handle && !overrideHandle) {
+                       var validHandle = false;
+
+                       $(this.options.handle, currentItem).find("*").andSelf().each(function() { if(this == event.target) validHandle = true; });
+                       if(!validHandle) return false;
+               }
+
+               this.currentItem = currentItem;
+               this._removeCurrentsFromItems();
+               return true;
+
+       },
+
+       _mouseStart: function(event, overrideHandle, noActivation) {
+
+               var o = this.options;
+               this.currentContainer = this;
+
+               //We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture
+               this.refreshPositions();
+
+               //Create and append the visible helper
+               this.helper = this._createHelper(event);
+
+               //Cache the helper size
+               this._cacheHelperProportions();
+
+               /*
+                * - Position generation -
+                * This block generates everything position related - it's the core of draggables.
+                */
+
+               //Cache the margins of the original element
+               this._cacheMargins();
+
+               //Get the next scrolling parent
+               this.scrollParent = this.helper.scrollParent();
+
+               //The element's absolute position on the page minus margins
+               this.offset = this.currentItem.offset();
+               this.offset = {
+                       top: this.offset.top - this.margins.top,
+                       left: this.offset.left - this.margins.left
+               };
+
+               $.extend(this.offset, {
+                       click: { //Where the click happened, relative to the element
+                               left: event.pageX - this.offset.left,
+                               top: event.pageY - this.offset.top
+                       },
+                       parent: this._getParentOffset(),
+                       relative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper
+               });
+
+               // Only after we got the offset, we can change the helper's position to absolute
+               // TODO: Still need to figure out a way to make relative sorting possible
+               this.helper.css("position", "absolute");
+               this.cssPosition = this.helper.css("position");
+
+               //Generate the original position
+               this.originalPosition = this._generatePosition(event);
+               this.originalPageX = event.pageX;
+               this.originalPageY = event.pageY;
+
+               //Adjust the mouse offset relative to the helper if 'cursorAt' is supplied
+               (o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));
+
+               //Cache the former DOM position
+               this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };
+
+               //If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way
+               if(this.helper[0] != this.currentItem[0]) {
+                       this.currentItem.hide();
+               }
+
+               //Create the placeholder
+               this._createPlaceholder();
+
+               //Set a containment if given in the options
+               if(o.containment)
+                       this._setContainment();
+
+               if(o.cursor) { // cursor option
+                       if ($('body').css("cursor")) this._storedCursor = $('body').css("cursor");
+                       $('body').css("cursor", o.cursor);
+               }
+
+               if(o.opacity) { // opacity option
+                       if (this.helper.css("opacity")) this._storedOpacity = this.helper.css("opacity");
+                       this.helper.css("opacity", o.opacity);
+               }
+
+               if(o.zIndex) { // zIndex option
+                       if (this.helper.css("zIndex")) this._storedZIndex = this.helper.css("zIndex");
+                       this.helper.css("zIndex", o.zIndex);
+               }
+
+               //Prepare scrolling
+               if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')
+                       this.overflowOffset = this.scrollParent.offset();
+
+               //Call callbacks
+               this._trigger("start", event, this._uiHash());
+
+               //Recache the helper size
+               if(!this._preserveHelperProportions)
+                       this._cacheHelperProportions();
+
+
+               //Post 'activate' events to possible containers
+               if(!noActivation) {
+                        for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger("activate", event, this._uiHash(this)); }
+               }
+
+               //Prepare possible droppables
+               if($.ui.ddmanager)
+                       $.ui.ddmanager.current = this;
+
+               if ($.ui.ddmanager && !o.dropBehaviour)
+                       $.ui.ddmanager.prepareOffsets(this, event);
+
+               this.dragging = true;
+
+               this.helper.addClass("ui-sortable-helper");
+               this._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position
+               return true;
+
+       },
+
+       _mouseDrag: function(event) {
+
+               //Compute the helpers position
+               this.position = this._generatePosition(event);
+               this.positionAbs = this._convertPositionTo("absolute");
+
+               if (!this.lastPositionAbs) {
+                       this.lastPositionAbs = this.positionAbs;
+               }
+
+               //Do scrolling
+               if(this.options.scroll) {
+                       var o = this.options, scrolled = false;
+                       if(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {
+
+                               if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
+                                       this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
+                               else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
+                                       this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
+
+                               if((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
+                                       this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
+                               else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
+                                       this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
+
+                       } else {
+
+                               if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
+                                       scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
+                               else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
+                                       scrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
+
+                               if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
+                                       scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
+                               else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
+                                       scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
+
+                       }
+
+                       if(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)
+                               $.ui.ddmanager.prepareOffsets(this, event);
+               }
+
+               //Regenerate the absolute position used for position checks
+               this.positionAbs = this._convertPositionTo("absolute");
+
+               //Set the helper position
+               if(!this.options.axis || this.options.axis != "y") this.helper[0].style.left = this.position.left+'px';
+               if(!this.options.axis || this.options.axis != "x") this.helper[0].style.top = this.position.top+'px';
+
+               //Rearrange
+               for (var i = this.items.length - 1; i >= 0; i--) {
+
+                       //Cache variables and intersection, continue if no intersection
+                       var item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);
+                       if (!intersection) continue;
+
+                       // Only put the placeholder inside the current Container, skip all
+                       // items form other containers. This works because when moving
+                       // an item from one container to another the
+                       // currentContainer is switched before the placeholder is moved.
+                       //
+                       // Without this moving items in "sub-sortables" can cause the placeholder to jitter
+                       // beetween the outer and inner container.
+                       if (item.instance !== this.currentContainer) continue;
+
+                       if (itemElement != this.currentItem[0] //cannot intersect with itself
+                               &&      this.placeholder[intersection == 1 ? "next" : "prev"]()[0] != itemElement //no useless actions that have been done before
+                               &&      !$.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked
+                               && (this.options.type == 'semi-dynamic' ? !$.contains(this.element[0], itemElement) : true)
+                               //&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container
+                       ) {
+
+                               this.direction = intersection == 1 ? "down" : "up";
+
+                               if (this.options.tolerance == "pointer" || this._intersectsWithSides(item)) {
+                                       this._rearrange(event, item);
+                               } else {
+                                       break;
+                               }
+
+                               this._trigger("change", event, this._uiHash());
+                               break;
+                       }
+               }
+
+               //Post events to containers
+               this._contactContainers(event);
+
+               //Interconnect with droppables
+               if($.ui.ddmanager) $.ui.ddmanager.drag(this, event);
+
+               //Call callbacks
+               this._trigger('sort', event, this._uiHash());
+
+               this.lastPositionAbs = this.positionAbs;
+               return false;
+
+       },
+
+       _mouseStop: function(event, noPropagation) {
+
+               if(!event) return;
+
+               //If we are using droppables, inform the manager about the drop
+               if ($.ui.ddmanager && !this.options.dropBehaviour)
+                       $.ui.ddmanager.drop(this, event);
+
+               if(this.options.revert) {
+                       var that = this;
+                       var cur = this.placeholder.offset();
+
+                       this.reverting = true;
+
+                       $(this.helper).animate({
+                               left: cur.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),
+                               top: cur.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)
+                       }, parseInt(this.options.revert, 10) || 500, function() {
+                               that._clear(event);
+                       });
+               } else {
+                       this._clear(event, noPropagation);
+               }
+
+               return false;
+
+       },
+
+       cancel: function() {
+
+               if(this.dragging) {
+
+                       this._mouseUp({ target: null });
+
+                       if(this.options.helper == "original")
+                               this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
+                       else
+                               this.currentItem.show();
+
+                       //Post deactivating events to containers
+                       for (var i = this.containers.length - 1; i >= 0; i--){
+                               this.containers[i]._trigger("deactivate", null, this._uiHash(this));
+                               if(this.containers[i].containerCache.over) {
+                                       this.containers[i]._trigger("out", null, this._uiHash(this));
+                                       this.containers[i].containerCache.over = 0;
+                               }
+                       }
+
+               }
+
+               if (this.placeholder) {
+                       //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
+                       if(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
+                       if(this.options.helper != "original" && this.helper && this.helper[0].parentNode) this.helper.remove();
+
+                       $.extend(this, {
+                               helper: null,
+                               dragging: false,
+                               reverting: false,
+                               _noFinalSort: null
+                       });
+
+                       if(this.domPosition.prev) {
+                               $(this.domPosition.prev).after(this.currentItem);
+                       } else {
+                               $(this.domPosition.parent).prepend(this.currentItem);
+                       }
+               }
+
+               return this;
+
+       },
+
+       serialize: function(o) {
+
+               var items = this._getItemsAsjQuery(o && o.connected);
+               var str = []; o = o || {};
+
+               $(items).each(function() {
+                       var res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
+                       if(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));
+               });
+
+               if(!str.length && o.key) {
+                       str.push(o.key + '=');
+               }
+
+               return str.join('&');
+
+       },
+
+       toArray: function(o) {
+
+               var items = this._getItemsAsjQuery(o && o.connected);
+               var ret = []; o = o || {};
+
+               items.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });
+               return ret;
+
+       },
+
+       /* Be careful with the following core functions */
+       _intersectsWith: function(item) {
+
+               var x1 = this.positionAbs.left,
+                       x2 = x1 + this.helperProportions.width,
+                       y1 = this.positionAbs.top,
+                       y2 = y1 + this.helperProportions.height;
+
+               var l = item.left,
+                       r = l + item.width,
+                       t = item.top,
+                       b = t + item.height;
+
+               var dyClick = this.offset.click.top,
+                       dxClick = this.offset.click.left;
+
+               var isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;
+
+               if(        this.options.tolerance == "pointer"
+                       || this.options.forcePointerForContainers
+                       || (this.options.tolerance != "pointer" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])
+               ) {
+                       return isOverElement;
+               } else {
+
+                       return (l < x1 + (this.helperProportions.width / 2) // Right Half
+                               && x2 - (this.helperProportions.width / 2) < r // Left Half
+                               && t < y1 + (this.helperProportions.height / 2) // Bottom Half
+                               && y2 - (this.helperProportions.height / 2) < b ); // Top Half
+
+               }
+       },
+
+       _intersectsWithPointer: function(item) {
+
+               var isOverElementHeight = (this.options.axis === 'x') || $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),
+                       isOverElementWidth = (this.options.axis === 'y') || $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),
+                       isOverElement = isOverElementHeight && isOverElementWidth,
+                       verticalDirection = this._getDragVerticalDirection(),
+                       horizontalDirection = this._getDragHorizontalDirection();
+
+               if (!isOverElement)
+                       return false;
+
+               return this.floating ?
+                       ( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )
+                       : ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );
+
+       },
+
+       _intersectsWithSides: function(item) {
+
+               var isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),
+                       isOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),
+                       verticalDirection = this._getDragVerticalDirection(),
+                       horizontalDirection = this._getDragHorizontalDirection();
+
+               if (this.floating && horizontalDirection) {
+                       return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
+               } else {
+                       return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
+               }
+
+       },
+
+       _getDragVerticalDirection: function() {
+               var delta = this.positionAbs.top - this.lastPositionAbs.top;
+               return delta != 0 && (delta > 0 ? "down" : "up");
+       },
+
+       _getDragHorizontalDirection: function() {
+               var delta = this.positionAbs.left - this.lastPositionAbs.left;
+               return delta != 0 && (delta > 0 ? "right" : "left");
+       },
+
+       refresh: function(event) {
+               this._refreshItems(event);
+               this.refreshPositions();
+               return this;
+       },
+
+       _connectWith: function() {
+               var options = this.options;
+               return options.connectWith.constructor == String
+                       ? [options.connectWith]
+                       : options.connectWith;
+       },
+
+       _getItemsAsjQuery: function(connected) {
+
+               var items = [];
+               var queries = [];
+               var connectWith = this._connectWith();
+
+               if(connectWith && connected) {
+                       for (var i = connectWith.length - 1; i >= 0; i--){
+                               var cur = $(connectWith[i]);
+                               for (var j = cur.length - 1; j >= 0; j--){
+                                       var inst = $.data(cur[j], this.widgetName);
+                                       if(inst && inst != this && !inst.options.disabled) {
+                                               queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), inst]);
+                                       }
+                               };
+                       };
+               }
+
+               queries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(".ui-sortable-helper").not('.ui-sortable-placeholder'), this]);
+
+               for (var i = queries.length - 1; i >= 0; i--){
+                       queries[i][0].each(function() {
+                               items.push(this);
+                       });
+               };
+
+               return $(items);
+
+       },
+
+       _removeCurrentsFromItems: function() {
+
+               var list = this.currentItem.find(":data(" + this.widgetName + "-item)");
+
+               this.items = $.grep(this.items, function (item) {
+                       for (var j=0; j < list.length; j++) {
+                               if(list[j] == item.item[0])
+                                       return false;
+                       };
+                       return true;
+               });
+
+       },
+
+       _refreshItems: function(event) {
+
+               this.items = [];
+               this.containers = [this];
+               var items = this.items;
+               var queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];
+               var connectWith = this._connectWith();
+
+               if(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down
+                       for (var i = connectWith.length - 1; i >= 0; i--){
+                               var cur = $(connectWith[i]);
+                               for (var j = cur.length - 1; j >= 0; j--){
+                                       var inst = $.data(cur[j], this.widgetName);
+                                       if(inst && inst != this && !inst.options.disabled) {
+                                               queries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);
+                                               this.containers.push(inst);
+                                       }
+                               };
+                       };
+               }
+
+               for (var i = queries.length - 1; i >= 0; i--) {
+                       var targetData = queries[i][1];
+                       var _queries = queries[i][0];
+
+                       for (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {
+                               var item = $(_queries[j]);
+
+                               item.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager)
+
+                               items.push({
+                                       item: item,
+                                       instance: targetData,
+                                       width: 0, height: 0,
+                                       left: 0, top: 0
+                               });
+                       };
+               };
+
+       },
+
+       refreshPositions: function(fast) {
+
+               //This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change
+               if(this.offsetParent && this.helper) {
+                       this.offset.parent = this._getParentOffset();
+               }
+
+               for (var i = this.items.length - 1; i >= 0; i--){
+                       var item = this.items[i];
+
+                       //We ignore calculating positions of all connected containers when we're not over them
+                       if(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0])
+                               continue;
+
+                       var t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;
+
+                       if (!fast) {
+                               item.width = t.outerWidth();
+                               item.height = t.outerHeight();
+                       }
+
+                       var p = t.offset();
+                       item.left = p.left;
+                       item.top = p.top;
+               };
+
+               if(this.options.custom && this.options.custom.refreshContainers) {
+                       this.options.custom.refreshContainers.call(this);
+               } else {
+                       for (var i = this.containers.length - 1; i >= 0; i--){
+                               var p = this.containers[i].element.offset();
+                               this.containers[i].containerCache.left = p.left;
+                               this.containers[i].containerCache.top = p.top;
+                               this.containers[i].containerCache.width = this.containers[i].element.outerWidth();
+                               this.containers[i].containerCache.height = this.containers[i].element.outerHeight();
+                       };
+               }
+
+               return this;
+       },
+
+       _createPlaceholder: function(that) {
+               that = that || this;
+               var o = that.options;
+
+               if(!o.placeholder || o.placeholder.constructor == String) {
+                       var className = o.placeholder;
+                       o.placeholder = {
+                               element: function() {
+
+                                       var el = $(document.createElement(that.currentItem[0].nodeName))
+                                               .addClass(className || that.currentItem[0].className+" ui-sortable-placeholder")
+                                               .removeClass("ui-sortable-helper")[0];
+
+                                       if(!className)
+                                               el.style.visibility = "hidden";
+
+                                       return el;
+                               },
+                               update: function(container, p) {
+
+                                       // 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that
+                                       // 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified
+                                       if(className && !o.forcePlaceholderSize) return;
+
+                                       //If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item
+                                       if(!p.height()) { p.height(that.currentItem.innerHeight() - parseInt(that.currentItem.css('paddingTop')||0, 10) - parseInt(that.currentItem.css('paddingBottom')||0, 10)); };
+                                       if(!p.width()) { p.width(that.currentItem.innerWidth() - parseInt(that.currentItem.css('paddingLeft')||0, 10) - parseInt(that.currentItem.css('paddingRight')||0, 10)); };
+                               }
+                       };
+               }
+
+               //Create the placeholder
+               that.placeholder = $(o.placeholder.element.call(that.element, that.currentItem));
+
+               //Append it after the actual current item
+               that.currentItem.after(that.placeholder);
+
+               //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)
+               o.placeholder.update(that, that.placeholder);
+
+       },
+
+       _contactContainers: function(event) {
+
+               // get innermost container that intersects with item
+               var innermostContainer = null, innermostIndex = null;
+
+
+               for (var i = this.containers.length - 1; i >= 0; i--){
+
+                       // never consider a container that's located within the item itself
+                       if($.contains(this.currentItem[0], this.containers[i].element[0]))
+                               continue;
+
+                       if(this._intersectsWith(this.containers[i].containerCache)) {
+
+                               // if we've already found a container and it's more "inner" than this, then continue
+                               if(innermostContainer && $.contains(this.containers[i].element[0], innermostContainer.element[0]))
+                                       continue;
+
+                               innermostContainer = this.containers[i];
+                               innermostIndex = i;
+
+                       } else {
+                               // container doesn't intersect. trigger "out" event if necessary
+                               if(this.containers[i].containerCache.over) {
+                                       this.containers[i]._trigger("out", event, this._uiHash(this));
+                                       this.containers[i].containerCache.over = 0;
+                               }
+                       }
+
+               }
+
+               // if no intersecting containers found, return
+               if(!innermostContainer) return;
+
+               // move the item into the container if it's not there already
+               if(this.containers.length === 1) {
+                       this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
+                       this.containers[innermostIndex].containerCache.over = 1;
+               } else {
+
+                       //When entering a new container, we will find the item with the least distance and append our item near it
+                       var dist = 10000; var itemWithLeastDistance = null;
+                       var posProperty = this.containers[innermostIndex].floating ? 'left' : 'top';
+                       var sizeProperty = this.containers[innermostIndex].floating ? 'width' : 'height';
+                       var base = this.positionAbs[posProperty] + this.offset.click[posProperty];
+                       for (var j = this.items.length - 1; j >= 0; j--) {
+                               if(!$.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;
+                               if(this.items[j].item[0] == this.currentItem[0]) continue;
+                               var cur = this.items[j].item.offset()[posProperty];
+                               var nearBottom = false;
+                               if(Math.abs(cur - base) > Math.abs(cur + this.items[j][sizeProperty] - base)){
+                                       nearBottom = true;
+                                       cur += this.items[j][sizeProperty];
+                               }
+
+                               if(Math.abs(cur - base) < dist) {
+                                       dist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];
+                                       this.direction = nearBottom ? "up": "down";
+                               }
+                       }
+
+                       if(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled
+                               return;
+
+                       this.currentContainer = this.containers[innermostIndex];
+                       itemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);
+                       this._trigger("change", event, this._uiHash());
+                       this.containers[innermostIndex]._trigger("change", event, this._uiHash(this));
+
+                       //Update the placeholder
+                       this.options.placeholder.update(this.currentContainer, this.placeholder);
+
+                       this.containers[innermostIndex]._trigger("over", event, this._uiHash(this));
+                       this.containers[innermostIndex].containerCache.over = 1;
+               }
+
+
+       },
+
+       _createHelper: function(event) {
+
+               var o = this.options;
+               var helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);
+
+               if(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already
+                       $(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);
+
+               if(helper[0] == this.currentItem[0])
+                       this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") };
+
+               if(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());
+               if(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());
+
+               return helper;
+
+       },
+
+       _adjustOffsetFromHelper: function(obj) {
+               if (typeof obj == 'string') {
+                       obj = obj.split(' ');
+               }
+               if ($.isArray(obj)) {
+                       obj = {left: +obj[0], top: +obj[1] || 0};
+               }
+               if ('left' in obj) {
+                       this.offset.click.left = obj.left + this.margins.left;
+               }
+               if ('right' in obj) {
+                       this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;
+               }
+               if ('top' in obj) {
+                       this.offset.click.top = obj.top + this.margins.top;
+               }
+               if ('bottom' in obj) {
+                       this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;
+               }
+       },
+
+       _getParentOffset: function() {
+
+
+               //Get the offsetParent and cache its position
+               this.offsetParent = this.helper.offsetParent();
+               var po = this.offsetParent.offset();
+
+               // This is a special case where we need to modify a offset calculated on start, since the following happened:
+               // 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent
+               // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that
+               //    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag
+               if(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) {
+                       po.left += this.scrollParent.scrollLeft();
+                       po.top += this.scrollParent.scrollTop();
+               }
+
+               if((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information
+               || (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.ui.ie)) //Ugly IE fix
+                       po = { top: 0, left: 0 };
+
+               return {
+                       top: po.top + (parseInt(this.offsetParent.css("borderTopWidth"),10) || 0),
+                       left: po.left + (parseInt(this.offsetParent.css("borderLeftWidth"),10) || 0)
+               };
+
+       },
+
+       _getRelativeOffset: function() {
+
+               if(this.cssPosition == "relative") {
+                       var p = this.currentItem.position();
+                       return {
+                               top: p.top - (parseInt(this.helper.css("top"),10) || 0) + this.scrollParent.scrollTop(),
+                               left: p.left - (parseInt(this.helper.css("left"),10) || 0) + this.scrollParent.scrollLeft()
+                       };
+               } else {
+                       return { top: 0, left: 0 };
+               }
+
+       },
+
+       _cacheMargins: function() {
+               this.margins = {
+                       left: (parseInt(this.currentItem.css("marginLeft"),10) || 0),
+                       top: (parseInt(this.currentItem.css("marginTop"),10) || 0)
+               };
+       },
+
+       _cacheHelperProportions: function() {
+               this.helperProportions = {
+                       width: this.helper.outerWidth(),
+                       height: this.helper.outerHeight()
+               };
+       },
+
+       _setContainment: function() {
+
+               var o = this.options;
+               if(o.containment == 'parent') o.containment = this.helper[0].parentNode;
+               if(o.containment == 'document' || o.containment == 'window') this.containment = [
+                       0 - this.offset.relative.left - this.offset.parent.left,
+                       0 - this.offset.relative.top - this.offset.parent.top,
+                       $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,
+                       ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top
+               ];
+
+               if(!(/^(document|window|parent)$/).test(o.containment)) {
+                       var ce = $(o.containment)[0];
+                       var co = $(o.containment).offset();
+                       var over = ($(ce).css("overflow") != 'hidden');
+
+                       this.containment = [
+                               co.left + (parseInt($(ce).css("borderLeftWidth"),10) || 0) + (parseInt($(ce).css("paddingLeft"),10) || 0) - this.margins.left,
+                               co.top + (parseInt($(ce).css("borderTopWidth"),10) || 0) + (parseInt($(ce).css("paddingTop"),10) || 0) - this.margins.top,
+                               co.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - (parseInt($(ce).css("paddingRight"),10) || 0) - this.helperProportions.width - this.margins.left,
+                               co.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - (parseInt($(ce).css("paddingBottom"),10) || 0) - this.helperProportions.height - this.margins.top
+                       ];
+               }
+
+       },
+
+       _convertPositionTo: function(d, pos) {
+
+               if(!pos) pos = this.position;
+               var mod = d == "absolute" ? 1 : -1;
+               var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+
+               return {
+                       top: (
+                               pos.top                                                                                                                                 // The absolute mouse position
+                               + this.offset.relative.top * mod                                                                                // Only for relative positioned nodes: Relative offset from element to offset parent
+                               + this.offset.parent.top * mod                                                                                  // The offsetParent's offset without borders (offset + border)
+                               - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)
+                       ),
+                       left: (
+                               pos.left                                                                                                                                // The absolute mouse position
+                               + this.offset.relative.left * mod                                                                               // Only for relative positioned nodes: Relative offset from element to offset parent
+                               + this.offset.parent.left * mod                                                                                 // The offsetParent's offset without borders (offset + border)
+                               - ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)
+                       )
+               };
+
+       },
+
+       _generatePosition: function(event) {
+
+               var o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);
+
+               // This is another very weird special case that only happens for relative elements:
+               // 1. If the css position is relative
+               // 2. and the scroll parent is the document or similar to the offset parent
+               // we have to refresh the relative offset during the scroll so there are no jumps
+               if(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {
+                       this.offset.relative = this._getRelativeOffset();
+               }
+
+               var pageX = event.pageX;
+               var pageY = event.pageY;
+
+               /*
+                * - Position constraining -
+                * Constrain the position to a mix of grid, containment.
+                */
+
+               if(this.originalPosition) { //If we are not dragging yet, we won't check for options
+
+                       if(this.containment) {
+                               if(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;
+                               if(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;
+                               if(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;
+                               if(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;
+                       }
+
+                       if(o.grid) {
+                               var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
+                               pageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
+
+                               var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
+                               pageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
+                       }
+
+               }
+
+               return {
+                       top: (
+                               pageY                                                                                                                           // The absolute mouse position
+                               - this.offset.click.top                                                                                                 // Click offset (relative to the element)
+                               - this.offset.relative.top                                                                                              // Only for relative positioned nodes: Relative offset from element to offset parent
+                               - this.offset.parent.top                                                                                                // The offsetParent's offset without borders (offset + border)
+                               + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))
+                       ),
+                       left: (
+                               pageX                                                                                                                           // The absolute mouse position
+                               - this.offset.click.left                                                                                                // Click offset (relative to the element)
+                               - this.offset.relative.left                                                                                             // Only for relative positioned nodes: Relative offset from element to offset parent
+                               - this.offset.parent.left                                                                                               // The offsetParent's offset without borders (offset + border)
+                               + ( ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))
+                       )
+               };
+
+       },
+
+       _rearrange: function(event, i, a, hardRefresh) {
+
+               a ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling));
+
+               //Various things done here to improve the performance:
+               // 1. we create a setTimeout, that calls refreshPositions
+               // 2. on the instance, we have a counter variable, that get's higher after every append
+               // 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same
+               // 4. this lets only the last addition to the timeout stack through
+               this.counter = this.counter ? ++this.counter : 1;
+               var counter = this.counter;
+
+               this._delay(function() {
+                       if(counter == this.counter) this.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove
+               });
+
+       },
+
+       _clear: function(event, noPropagation) {
+
+               this.reverting = false;
+               // We delay all events that have to be triggered to after the point where the placeholder has been removed and
+               // everything else normalized again
+               var delayedTriggers = [];
+
+               // We first have to update the dom position of the actual currentItem
+               // Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)
+               if(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem);
+               this._noFinalSort = null;
+
+               if(this.helper[0] == this.currentItem[0]) {
+                       for(var i in this._storedCSS) {
+                               if(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = '';
+                       }
+                       this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper");
+               } else {
+                       this.currentItem.show();
+               }
+
+               if(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger("receive", event, this._uiHash(this.fromOutside)); });
+               if((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(".ui-sortable-helper")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger("update", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed
+
+               // Check if the items Container has Changed and trigger appropriate
+               // events.
+               if (this !== this.currentContainer) {
+                       if(!noPropagation) {
+                               delayedTriggers.push(function(event) { this._trigger("remove", event, this._uiHash()); });
+                               delayedTriggers.push((function(c) { return function(event) { c._trigger("receive", event, this._uiHash(this)); };  }).call(this, this.currentContainer));
+                               delayedTriggers.push((function(c) { return function(event) { c._trigger("update", event, this._uiHash(this));  }; }).call(this, this.currentContainer));
+                       }
+               }
+
+
+               //Post events to containers
+               for (var i = this.containers.length - 1; i >= 0; i--){
+                       if(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger("deactivate", event, this._uiHash(this)); };  }).call(this, this.containers[i]));
+                       if(this.containers[i].containerCache.over) {
+                               delayedTriggers.push((function(c) { return function(event) { c._trigger("out", event, this._uiHash(this)); };  }).call(this, this.containers[i]));
+                               this.containers[i].containerCache.over = 0;
+                       }
+               }
+
+               //Do what was originally in plugins
+               if(this._storedCursor) $('body').css("cursor", this._storedCursor); //Reset cursor
+               if(this._storedOpacity) this.helper.css("opacity", this._storedOpacity); //Reset opacity
+               if(this._storedZIndex) this.helper.css("zIndex", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index
+
+               this.dragging = false;
+               if(this.cancelHelperRemoval) {
+                       if(!noPropagation) {
+                               this._trigger("beforeStop", event, this._uiHash());
+                               for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
+                               this._trigger("stop", event, this._uiHash());
+                       }
+
+                       this.fromOutside = false;
+                       return false;
+               }
+
+               if(!noPropagation) this._trigger("beforeStop", event, this._uiHash());
+
+               //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!
+               this.placeholder[0].parentNode.removeChild(this.placeholder[0]);
+
+               if(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;
+
+               if(!noPropagation) {
+                       for (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events
+                       this._trigger("stop", event, this._uiHash());
+               }
+
+               this.fromOutside = false;
+               return true;
+
+       },
+
+       _trigger: function() {
+               if ($.Widget.prototype._trigger.apply(this, arguments) === false) {
+                       this.cancel();
+               }
+       },
+
+       _uiHash: function(_inst) {
+               var inst = _inst || this;
+               return {
+                       helper: inst.helper,
+                       placeholder: inst.placeholder || $([]),
+                       position: inst.position,
+                       originalPosition: inst.originalPosition,
+                       offset: inst.positionAbs,
+                       item: inst.currentItem,
+                       sender: _inst ? _inst.element : null
+               };
+       }
+
+});
+
+})(jQuery);
+(function( $ ) {
+
+function modifier( fn ) {
+       return function() {
+               var previous = this.element.val();
+               fn.apply( this, arguments );
+               this._refresh();
+               if ( previous !== this.element.val() ) {
+                       this._trigger( "change" );
+               }
+       };
+}
+
+$.widget( "ui.spinner", {
+       version: "1.9.2",
+       defaultElement: "<input>",
+       widgetEventPrefix: "spin",
+       options: {
+               culture: null,
+               icons: {
+                       down: "ui-icon-triangle-1-s",
+                       up: "ui-icon-triangle-1-n"
+               },
+               incremental: true,
+               max: null,
+               min: null,
+               numberFormat: null,
+               page: 10,
+               step: 1,
+
+               change: null,
+               spin: null,
+               start: null,
+               stop: null
+       },
+
+       _create: function() {
+               // handle string values that need to be parsed
+               this._setOption( "max", this.options.max );
+               this._setOption( "min", this.options.min );
+               this._setOption( "step", this.options.step );
+
+               // format the value, but don't constrain
+               this._value( this.element.val(), true );
+
+               this._draw();
+               this._on( this._events );
+               this._refresh();
+
+               // turning off autocomplete prevents the browser from remembering the
+               // value when navigating through history, so we re-enable autocomplete
+               // if the page is unloaded before the widget is destroyed. #7790
+               this._on( this.window, {
+                       beforeunload: function() {
+                               this.element.removeAttr( "autocomplete" );
+                       }
+               });
+       },
+
+       _getCreateOptions: function() {
+               var options = {},
+                       element = this.element;
+
+               $.each( [ "min", "max", "step" ], function( i, option ) {
+                       var value = element.attr( option );
+                       if ( value !== undefined && value.length ) {
+                               options[ option ] = value;
+                       }
+               });
+
+               return options;
+       },
+
+       _events: {
+               keydown: function( event ) {
+                       if ( this._start( event ) && this._keydown( event ) ) {
+                               event.preventDefault();
+                       }
+               },
+               keyup: "_stop",
+               focus: function() {
+                       this.previous = this.element.val();
+               },
+               blur: function( event ) {
+                       if ( this.cancelBlur ) {
+                               delete this.cancelBlur;
+                               return;
+                       }
+
+                       this._refresh();
+                       if ( this.previous !== this.element.val() ) {
+                               this._trigger( "change", event );
+                       }
+               },
+               mousewheel: function( event, delta ) {
+                       if ( !delta ) {
+                               return;
+                       }
+                       if ( !this.spinning && !this._start( event ) ) {
+                               return false;
+                       }
+
+                       this._spin( (delta > 0 ? 1 : -1) * this.options.step, event );
+                       clearTimeout( this.mousewheelTimer );
+                       this.mousewheelTimer = this._delay(function() {
+                               if ( this.spinning ) {
+                                       this._stop( event );
+                               }
+                       }, 100 );
+                       event.preventDefault();
+               },
+               "mousedown .ui-spinner-button": function( event ) {
+                       var previous;
+
+                       // We never want the buttons to have focus; whenever the user is
+                       // interacting with the spinner, the focus should be on the input.
+                       // If the input is focused then this.previous is properly set from
+                       // when the input first received focus. If the input is not focused
+                       // then we need to set this.previous based on the value before spinning.
+                       previous = this.element[0] === this.document[0].activeElement ?
+                               this.previous : this.element.val();
+                       function checkFocus() {
+                               var isActive = this.element[0] === this.document[0].activeElement;
+                               if ( !isActive ) {
+                                       this.element.focus();
+                                       this.previous = previous;
+                                       // support: IE
+                                       // IE sets focus asynchronously, so we need to check if focus
+                                       // moved off of the input because the user clicked on the button.
+                                       this._delay(function() {
+                                               this.previous = previous;
+                                       });
+                               }
+                       }
+
+                       // ensure focus is on (or stays on) the text field
+                       event.preventDefault();
+                       checkFocus.call( this );
+
+                       // support: IE
+                       // IE doesn't prevent moving focus even with event.preventDefault()
+                       // so we set a flag to know when we should ignore the blur event
+                       // and check (again) if focus moved off of the input.
+                       this.cancelBlur = true;
+                       this._delay(function() {
+                               delete this.cancelBlur;
+                               checkFocus.call( this );
+                       });
+
+                       if ( this._start( event ) === false ) {
+                               return;
+                       }
+
+                       this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
+               },
+               "mouseup .ui-spinner-button": "_stop",
+               "mouseenter .ui-spinner-button": function( event ) {
+                       // button will add ui-state-active if mouse was down while mouseleave and kept down
+                       if ( !$( event.currentTarget ).hasClass( "ui-state-active" ) ) {
+                               return;
+                       }
+
+                       if ( this._start( event ) === false ) {
+                               return false;
+                       }
+                       this._repeat( null, $( event.currentTarget ).hasClass( "ui-spinner-up" ) ? 1 : -1, event );
+               },
+               // TODO: do we really want to consider this a stop?
+               // shouldn't we just stop the repeater and wait until mouseup before
+               // we trigger the stop event?
+               "mouseleave .ui-spinner-button": "_stop"
+       },
+
+       _draw: function() {
+               var uiSpinner = this.uiSpinner = this.element
+                       .addClass( "ui-spinner-input" )
+                       .attr( "autocomplete", "off" )
+                       .wrap( this._uiSpinnerHtml() )
+                       .parent()
+                               // add buttons
+                               .append( this._buttonHtml() );
+
+               this.element.attr( "role", "spinbutton" );
+
+               // button bindings
+               this.buttons = uiSpinner.find( ".ui-spinner-button" )
+                       .attr( "tabIndex", -1 )
+                       .button()
+                       .removeClass( "ui-corner-all" );
+
+               // IE 6 doesn't understand height: 50% for the buttons
+               // unless the wrapper has an explicit height
+               if ( this.buttons.height() > Math.ceil( uiSpinner.height() * 0.5 ) &&
+                               uiSpinner.height() > 0 ) {
+                       uiSpinner.height( uiSpinner.height() );
+               }
+
+               // disable spinner if element was already disabled
+               if ( this.options.disabled ) {
+                       this.disable();
+               }
+       },
+
+       _keydown: function( event ) {
+               var options = this.options,
+                       keyCode = $.ui.keyCode;
+
+               switch ( event.keyCode ) {
+               case keyCode.UP:
+                       this._repeat( null, 1, event );
+                       return true;
+               case keyCode.DOWN:
+                       this._repeat( null, -1, event );
+                       return true;
+               case keyCode.PAGE_UP:
+                       this._repeat( null, options.page, event );
+                       return true;
+               case keyCode.PAGE_DOWN:
+                       this._repeat( null, -options.page, event );
+                       return true;
+               }
+
+               return false;
+       },
+
+       _uiSpinnerHtml: function() {
+               return "<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>";
+       },
+
+       _buttonHtml: function() {
+               return "" +
+                       "<a class='ui-spinner-button ui-spinner-up ui-corner-tr'>" +
+                               "<span class='ui-icon " + this.options.icons.up + "'>&#9650;</span>" +
+                       "</a>" +
+                       "<a class='ui-spinner-button ui-spinner-down ui-corner-br'>" +
+                               "<span class='ui-icon " + this.options.icons.down + "'>&#9660;</span>" +
+                       "</a>";
+       },
+
+       _start: function( event ) {
+               if ( !this.spinning && this._trigger( "start", event ) === false ) {
+                       return false;
+               }
+
+               if ( !this.counter ) {
+                       this.counter = 1;
+               }
+               this.spinning = true;
+               return true;
+       },
+
+       _repeat: function( i, steps, event ) {
+               i = i || 500;
+
+               clearTimeout( this.timer );
+               this.timer = this._delay(function() {
+                       this._repeat( 40, steps, event );
+               }, i );
+
+               this._spin( steps * this.options.step, event );
+       },
+
+       _spin: function( step, event ) {
+               var value = this.value() || 0;
+
+               if ( !this.counter ) {
+                       this.counter = 1;
+               }
+
+               value = this._adjustValue( value + step * this._increment( this.counter ) );
+
+               if ( !this.spinning || this._trigger( "spin", event, { value: value } ) !== false) {
+                       this._value( value );
+                       this.counter++;
+               }
+       },
+
+       _increment: function( i ) {
+               var incremental = this.options.incremental;
+
+               if ( incremental ) {
+                       return $.isFunction( incremental ) ?
+                               incremental( i ) :
+                               Math.floor( i*i*i/50000 - i*i/500 + 17*i/200 + 1 );
+               }
+
+               return 1;
+       },
+
+       _precision: function() {
+               var precision = this._precisionOf( this.options.step );
+               if ( this.options.min !== null ) {
+                       precision = Math.max( precision, this._precisionOf( this.options.min ) );
+               }
+               return precision;
+       },
+
+       _precisionOf: function( num ) {
+               var str = num.toString(),
+                       decimal = str.indexOf( "." );
+               return decimal === -1 ? 0 : str.length - decimal - 1;
+       },
+
+       _adjustValue: function( value ) {
+               var base, aboveMin,
+                       options = this.options;
+
+               // make sure we're at a valid step
+               // - find out where we are relative to the base (min or 0)
+               base = options.min !== null ? options.min : 0;
+               aboveMin = value - base;
+               // - round to the nearest step
+               aboveMin = Math.round(aboveMin / options.step) * options.step;
+               // - rounding is based on 0, so adjust back to our base
+               value = base + aboveMin;
+
+               // fix precision from bad JS floating point math
+               value = parseFloat( value.toFixed( this._precision() ) );
+
+               // clamp the value
+               if ( options.max !== null && value > options.max) {
+                       return options.max;
+               }
+               if ( options.min !== null && value < options.min ) {
+                       return options.min;
+               }
+
+               return value;
+       },
+
+       _stop: function( event ) {
+               if ( !this.spinning ) {
+                       return;
+               }
+
+               clearTimeout( this.timer );
+               clearTimeout( this.mousewheelTimer );
+               this.counter = 0;
+               this.spinning = false;
+               this._trigger( "stop", event );
+       },
+
+       _setOption: function( key, value ) {
+               if ( key === "culture" || key === "numberFormat" ) {
+                       var prevValue = this._parse( this.element.val() );
+                       this.options[ key ] = value;
+                       this.element.val( this._format( prevValue ) );
+                       return;
+               }
+
+               if ( key === "max" || key === "min" || key === "step" ) {
+                       if ( typeof value === "string" ) {
+                               value = this._parse( value );
+                       }
+               }
+
+               this._super( key, value );
+
+               if ( key === "disabled" ) {
+                       if ( value ) {
+                               this.element.prop( "disabled", true );
+                               this.buttons.button( "disable" );
+                       } else {
+                               this.element.prop( "disabled", false );
+                               this.buttons.button( "enable" );
+                       }
+               }
+       },
+
+       _setOptions: modifier(function( options ) {
+               this._super( options );
+               this._value( this.element.val() );
+       }),
+
+       _parse: function( val ) {
+               if ( typeof val === "string" && val !== "" ) {
+                       val = window.Globalize && this.options.numberFormat ?
+                               Globalize.parseFloat( val, 10, this.options.culture ) : +val;
+               }
+               return val === "" || isNaN( val ) ? null : val;
+       },
+
+       _format: function( value ) {
+               if ( value === "" ) {
+                       return "";
+               }
+               return window.Globalize && this.options.numberFormat ?
+                       Globalize.format( value, this.options.numberFormat, this.options.culture ) :
+                       value;
+       },
+
+       _refresh: function() {
+               this.element.attr({
+                       "aria-valuemin": this.options.min,
+                       "aria-valuemax": this.options.max,
+                       // TODO: what should we do with values that can't be parsed?
+                       "aria-valuenow": this._parse( this.element.val() )
+               });
+       },
+
+       // update the value without triggering change
+       _value: function( value, allowAny ) {
+               var parsed;
+               if ( value !== "" ) {
+                       parsed = this._parse( value );
+                       if ( parsed !== null ) {
+                               if ( !allowAny ) {
+                                       parsed = this._adjustValue( parsed );
+                               }
+                               value = this._format( parsed );
+                       }
+               }
+               this.element.val( value );
+               this._refresh();
+       },
+
+       _destroy: function() {
+               this.element
+                       .removeClass( "ui-spinner-input" )
+                       .prop( "disabled", false )
+                       .removeAttr( "autocomplete" )
+                       .removeAttr( "role" )
+                       .removeAttr( "aria-valuemin" )
+                       .removeAttr( "aria-valuemax" )
+                       .removeAttr( "aria-valuenow" );
+               this.uiSpinner.replaceWith( this.element );
+       },
+
+       stepUp: modifier(function( steps ) {
+               this._stepUp( steps );
+       }),
+       _stepUp: function( steps ) {
+               this._spin( (steps || 1) * this.options.step );
+       },
+
+       stepDown: modifier(function( steps ) {
+               this._stepDown( steps );
+       }),
+       _stepDown: function( steps ) {
+               this._spin( (steps || 1) * -this.options.step );
+       },
+
+       pageUp: modifier(function( pages ) {
+               this._stepUp( (pages || 1) * this.options.page );
+       }),
+
+       pageDown: modifier(function( pages ) {
+               this._stepDown( (pages || 1) * this.options.page );
+       }),
+
+       value: function( newVal ) {
+               if ( !arguments.length ) {
+                       return this._parse( this.element.val() );
+               }
+               modifier( this._value ).call( this, newVal );
+       },
+
+       widget: function() {
+               return this.uiSpinner;
+       }
+});
+
+}( jQuery ) );
+(function( $, undefined ) {
+
+var tabId = 0,
+       rhash = /#.*$/;
+
+function getNextTabId() {
+       return ++tabId;
+}
+
+function isLocal( anchor ) {
+       return anchor.hash.length > 1 &&
+               anchor.href.replace( rhash, "" ) ===
+                       location.href.replace( rhash, "" )
+                               // support: Safari 5.1
+                               // Safari 5.1 doesn't encode spaces in window.location
+                               // but it does encode spaces from anchors (#8777)
+                               .replace( /\s/g, "%20" );
+}
+
+$.widget( "ui.tabs", {
+       version: "1.9.2",
+       delay: 300,
+       options: {
+               active: null,
+               collapsible: false,
+               event: "click",
+               heightStyle: "content",
+               hide: null,
+               show: null,
+
+               // callbacks
+               activate: null,
+               beforeActivate: null,
+               beforeLoad: null,
+               load: null
+       },
+
+       _create: function() {
+               var that = this,
+                       options = this.options,
+                       active = options.active,
+                       locationHash = location.hash.substring( 1 );
+
+               this.running = false;
+
+               this.element
+                       .addClass( "ui-tabs ui-widget ui-widget-content ui-corner-all" )
+                       .toggleClass( "ui-tabs-collapsible", options.collapsible )
+                       // Prevent users from focusing disabled tabs via click
+                       .delegate( ".ui-tabs-nav > li", "mousedown" + this.eventNamespace, function( event ) {
+                               if ( $( this ).is( ".ui-state-disabled" ) ) {
+                                       event.preventDefault();
+                               }
+                       })
+                       // support: IE <9
+                       // Preventing the default action in mousedown doesn't prevent IE
+                       // from focusing the element, so if the anchor gets focused, blur.
+                       // We don't have to worry about focusing the previously focused
+                       // element since clicking on a non-focusable element should focus
+                       // the body anyway.
+                       .delegate( ".ui-tabs-anchor", "focus" + this.eventNamespace, function() {
+                               if ( $( this ).closest( "li" ).is( ".ui-state-disabled" ) ) {
+                                       this.blur();
+                               }
+                       });
+
+               this._processTabs();
+
+               if ( active === null ) {
+                       // check the fragment identifier in the URL
+                       if ( locationHash ) {
+                               this.tabs.each(function( i, tab ) {
+                                       if ( $( tab ).attr( "aria-controls" ) === locationHash ) {
+                                               active = i;
+                                               return false;
+                                       }
+                               });
+                       }
+
+                       // check for a tab marked active via a class
+                       if ( active === null ) {
+                               active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) );
+                       }
+
+                       // no active tab, set to false
+                       if ( active === null || active === -1 ) {
+                               active = this.tabs.length ? 0 : false;
+                       }
+               }
+
+               // handle numbers: negative, out of range
+               if ( active !== false ) {
+                       active = this.tabs.index( this.tabs.eq( active ) );
+                       if ( active === -1 ) {
+                               active = options.collapsible ? false : 0;
+                       }
+               }
+               options.active = active;
+
+               // don't allow collapsible: false and active: false
+               if ( !options.collapsible && options.active === false && this.anchors.length ) {
+                       options.active = 0;
+               }
+
+               // Take disabling tabs via class attribute from HTML
+               // into account and update option properly.
+               if ( $.isArray( options.disabled ) ) {
+                       options.disabled = $.unique( options.disabled.concat(
+                               $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
+                                       return that.tabs.index( li );
+                               })
+                       ) ).sort();
+               }
+
+               // check for length avoids error when initializing empty list
+               if ( this.options.active !== false && this.anchors.length ) {
+                       this.active = this._findActive( this.options.active );
+               } else {
+                       this.active = $();
+               }
+
+               this._refresh();
+
+               if ( this.active.length ) {
+                       this.load( options.active );
+               }
+       },
+
+       _getCreateEventData: function() {
+               return {
+                       tab: this.active,
+                       panel: !this.active.length ? $() : this._getPanelForTab( this.active )
+               };
+       },
+
+       _tabKeydown: function( event ) {
+               var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
+                       selectedIndex = this.tabs.index( focusedTab ),
+                       goingForward = true;
+
+               if ( this._handlePageNav( event ) ) {
+                       return;
+               }
+
+               switch ( event.keyCode ) {
+                       case $.ui.keyCode.RIGHT:
+                       case $.ui.keyCode.DOWN:
+                               selectedIndex++;
+                               break;
+                       case $.ui.keyCode.UP:
+                       case $.ui.keyCode.LEFT:
+                               goingForward = false;
+                               selectedIndex--;
+                               break;
+                       case $.ui.keyCode.END:
+                               selectedIndex = this.anchors.length - 1;
+                               break;
+                       case $.ui.keyCode.HOME:
+                               selectedIndex = 0;
+                               break;
+                       case $.ui.keyCode.SPACE:
+                               // Activate only, no collapsing
+                               event.preventDefault();
+                               clearTimeout( this.activating );
+                               this._activate( selectedIndex );
+                               return;
+                       case $.ui.keyCode.ENTER:
+                               // Toggle (cancel delayed activation, allow collapsing)
+                               event.preventDefault();
+                               clearTimeout( this.activating );
+                               // Determine if we should collapse or activate
+                               this._activate( selectedIndex === this.options.active ? false : selectedIndex );
+                               return;
+                       default:
+                               return;
+               }
+
+               // Focus the appropriate tab, based on which key was pressed
+               event.preventDefault();
+               clearTimeout( this.activating );
+               selectedIndex = this._focusNextTab( selectedIndex, goingForward );
+
+               // Navigating with control key will prevent automatic activation
+               if ( !event.ctrlKey ) {
+                       // Update aria-selected immediately so that AT think the tab is already selected.
+                       // Otherwise AT may confuse the user by stating that they need to activate the tab,
+                       // but the tab will already be activated by the time the announcement finishes.
+                       focusedTab.attr( "aria-selected", "false" );
+                       this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
+
+                       this.activating = this._delay(function() {
+                               this.option( "active", selectedIndex );
+                       }, this.delay );
+               }
+       },
+
+       _panelKeydown: function( event ) {
+               if ( this._handlePageNav( event ) ) {
+                       return;
+               }
+
+               // Ctrl+up moves focus to the current tab
+               if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) {
+                       event.preventDefault();
+                       this.active.focus();
+               }
+       },
+
+       // Alt+page up/down moves focus to the previous/next tab (and activates)
+       _handlePageNav: function( event ) {
+               if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
+                       this._activate( this._focusNextTab( this.options.active - 1, false ) );
+                       return true;
+               }
+               if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) {
+                       this._activate( this._focusNextTab( this.options.active + 1, true ) );
+                       return true;
+               }
+       },
+
+       _findNextTab: function( index, goingForward ) {
+               var lastTabIndex = this.tabs.length - 1;
+
+               function constrain() {
+                       if ( index > lastTabIndex ) {
+                               index = 0;
+                       }
+                       if ( index < 0 ) {
+                               index = lastTabIndex;
+                       }
+                       return index;
+               }
+
+               while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) {
+                       index = goingForward ? index + 1 : index - 1;
+               }
+
+               return index;
+       },
+
+       _focusNextTab: function( index, goingForward ) {
+               index = this._findNextTab( index, goingForward );
+               this.tabs.eq( index ).focus();
+               return index;
+       },
+
+       _setOption: function( key, value ) {
+               if ( key === "active" ) {
+                       // _activate() will handle invalid values and update this.options
+                       this._activate( value );
+                       return;
+               }
+
+               if ( key === "disabled" ) {
+                       // don't use the widget factory's disabled handling
+                       this._setupDisabled( value );
+                       return;
+               }
+
+               this._super( key, value);
+
+               if ( key === "collapsible" ) {
+                       this.element.toggleClass( "ui-tabs-collapsible", value );
+                       // Setting collapsible: false while collapsed; open first panel
+                       if ( !value && this.options.active === false ) {
+                               this._activate( 0 );
+                       }
+               }
+
+               if ( key === "event" ) {
+                       this._setupEvents( value );
+               }
+
+               if ( key === "heightStyle" ) {
+                       this._setupHeightStyle( value );
+               }
+       },
+
+       _tabId: function( tab ) {
+               return tab.attr( "aria-controls" ) || "ui-tabs-" + getNextTabId();
+       },
+
+       _sanitizeSelector: function( hash ) {
+               return hash ? hash.replace( /[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&" ) : "";
+       },
+
+       refresh: function() {
+               var options = this.options,
+                       lis = this.tablist.children( ":has(a[href])" );
+
+               // get disabled tabs from class attribute from HTML
+               // this will get converted to a boolean if needed in _refresh()
+               options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) {
+                       return lis.index( tab );
+               });
+
+               this._processTabs();
+
+               // was collapsed or no tabs
+               if ( options.active === false || !this.anchors.length ) {
+                       options.active = false;
+                       this.active = $();
+               // was active, but active tab is gone
+               } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
+                       // all remaining tabs are disabled
+                       if ( this.tabs.length === options.disabled.length ) {
+                               options.active = false;
+                               this.active = $();
+                       // activate previous tab
+                       } else {
+                               this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) );
+                       }
+               // was active, active tab still exists
+               } else {
+                       // make sure active index is correct
+                       options.active = this.tabs.index( this.active );
+               }
+
+               this._refresh();
+       },
+
+       _refresh: function() {
+               this._setupDisabled( this.options.disabled );
+               this._setupEvents( this.options.event );
+               this._setupHeightStyle( this.options.heightStyle );
+
+               this.tabs.not( this.active ).attr({
+                       "aria-selected": "false",
+                       tabIndex: -1
+               });
+               this.panels.not( this._getPanelForTab( this.active ) )
+                       .hide()
+                       .attr({
+                               "aria-expanded": "false",
+                               "aria-hidden": "true"
+                       });
+
+               // Make sure one tab is in the tab order
+               if ( !this.active.length ) {
+                       this.tabs.eq( 0 ).attr( "tabIndex", 0 );
+               } else {
+                       this.active
+                               .addClass( "ui-tabs-active ui-state-active" )
+                               .attr({
+                                       "aria-selected": "true",
+                                       tabIndex: 0
+                               });
+                       this._getPanelForTab( this.active )
+                               .show()
+                               .attr({
+                                       "aria-expanded": "true",
+                                       "aria-hidden": "false"
+                               });
+               }
+       },
+
+       _processTabs: function() {
+               var that = this;
+
+               this.tablist = this._getList()
+                       .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
+                       .attr( "role", "tablist" );
+
+               this.tabs = this.tablist.find( "> li:has(a[href])" )
+                       .addClass( "ui-state-default ui-corner-top" )
+                       .attr({
+                               role: "tab",
+                               tabIndex: -1
+                       });
+
+               this.anchors = this.tabs.map(function() {
+                               return $( "a", this )[ 0 ];
+                       })
+                       .addClass( "ui-tabs-anchor" )
+                       .attr({
+                               role: "presentation",
+                               tabIndex: -1
+                       });
+
+               this.panels = $();
+
+               this.anchors.each(function( i, anchor ) {
+                       var selector, panel, panelId,
+                               anchorId = $( anchor ).uniqueId().attr( "id" ),
+                               tab = $( anchor ).closest( "li" ),
+                               originalAriaControls = tab.attr( "aria-controls" );
+
+                       // inline tab
+                       if ( isLocal( anchor ) ) {
+                               selector = anchor.hash;
+                               panel = that.element.find( that._sanitizeSelector( selector ) );
+                       // remote tab
+                       } else {
+                               panelId = that._tabId( tab );
+                               selector = "#" + panelId;
+                               panel = that.element.find( selector );
+                               if ( !panel.length ) {
+                                       panel = that._createPanel( panelId );
+                                       panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
+                               }
+                               panel.attr( "aria-live", "polite" );
+                       }
+
+                       if ( panel.length) {
+                               that.panels = that.panels.add( panel );
+                       }
+                       if ( originalAriaControls ) {
+                               tab.data( "ui-tabs-aria-controls", originalAriaControls );
+                       }
+                       tab.attr({
+                               "aria-controls": selector.substring( 1 ),
+                               "aria-labelledby": anchorId
+                       });
+                       panel.attr( "aria-labelledby", anchorId );
+               });
+
+               this.panels
+                       .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
+                       .attr( "role", "tabpanel" );
+       },
+
+       // allow overriding how to find the list for rare usage scenarios (#7715)
+       _getList: function() {
+               return this.element.find( "ol,ul" ).eq( 0 );
+       },
+
+       _createPanel: function( id ) {
+               return $( "<div>" )
+                       .attr( "id", id )
+                       .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
+                       .data( "ui-tabs-destroy", true );
+       },
+
+       _setupDisabled: function( disabled ) {
+               if ( $.isArray( disabled ) ) {
+                       if ( !disabled.length ) {
+                               disabled = false;
+                       } else if ( disabled.length === this.anchors.length ) {
+                               disabled = true;
+                       }
+               }
+
+               // disable tabs
+               for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) {
+                       if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
+                               $( li )
+                                       .addClass( "ui-state-disabled" )
+                                       .attr( "aria-disabled", "true" );
+                       } else {
+                               $( li )
+                                       .removeClass( "ui-state-disabled" )
+                                       .removeAttr( "aria-disabled" );
+                       }
+               }
+
+               this.options.disabled = disabled;
+       },
+
+       _setupEvents: function( event ) {
+               var events = {
+                       click: function( event ) {
+                               event.preventDefault();
+                       }
+               };
+               if ( event ) {
+                       $.each( event.split(" "), function( index, eventName ) {
+                               events[ eventName ] = "_eventHandler";
+                       });
+               }
+
+               this._off( this.anchors.add( this.tabs ).add( this.panels ) );
+               this._on( this.anchors, events );
+               this._on( this.tabs, { keydown: "_tabKeydown" } );
+               this._on( this.panels, { keydown: "_panelKeydown" } );
+
+               this._focusable( this.tabs );
+               this._hoverable( this.tabs );
+       },
+
+       _setupHeightStyle: function( heightStyle ) {
+               var maxHeight, overflow,
+                       parent = this.element.parent();
+
+               if ( heightStyle === "fill" ) {
+                       // IE 6 treats height like minHeight, so we need to turn off overflow
+                       // in order to get a reliable height
+                       // we use the minHeight support test because we assume that only
+                       // browsers that don't support minHeight will treat height as minHeight
+                       if ( !$.support.minHeight ) {
+                               overflow = parent.css( "overflow" );
+                               parent.css( "overflow", "hidden");
+                       }
+                       maxHeight = parent.height();
+                       this.element.siblings( ":visible" ).each(function() {
+                               var elem = $( this ),
+                                       position = elem.css( "position" );
+
+                               if ( position === "absolute" || position === "fixed" ) {
+                                       return;
+                               }
+                               maxHeight -= elem.outerHeight( true );
+                       });
+                       if ( overflow ) {
+                               parent.css( "overflow", overflow );
+                       }
+
+                       this.element.children().not( this.panels ).each(function() {
+                               maxHeight -= $( this ).outerHeight( true );
+                       });
+
+                       this.panels.each(function() {
+                               $( this ).height( Math.max( 0, maxHeight -
+                                       $( this ).innerHeight() + $( this ).height() ) );
+                       })
+                       .css( "overflow", "auto" );
+               } else if ( heightStyle === "auto" ) {
+                       maxHeight = 0;
+                       this.panels.each(function() {
+                               maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() );
+                       }).height( maxHeight );
+               }
+       },
+
+       _eventHandler: function( event ) {
+               var options = this.options,
+                       active = this.active,
+                       anchor = $( event.currentTarget ),
+                       tab = anchor.closest( "li" ),
+                       clickedIsActive = tab[ 0 ] === active[ 0 ],
+                       collapsing = clickedIsActive && options.collapsible,
+                       toShow = collapsing ? $() : this._getPanelForTab( tab ),
+                       toHide = !active.length ? $() : this._getPanelForTab( active ),
+                       eventData = {
+                               oldTab: active,
+                               oldPanel: toHide,
+                               newTab: collapsing ? $() : tab,
+                               newPanel: toShow
+                       };
+
+               event.preventDefault();
+
+               if ( tab.hasClass( "ui-state-disabled" ) ||
+                               // tab is already loading
+                               tab.hasClass( "ui-tabs-loading" ) ||
+                               // can't switch durning an animation
+                               this.running ||
+                               // click on active header, but not collapsible
+                               ( clickedIsActive && !options.collapsible ) ||
+                               // allow canceling activation
+                               ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
+                       return;
+               }
+
+               options.active = collapsing ? false : this.tabs.index( tab );
+
+               this.active = clickedIsActive ? $() : tab;
+               if ( this.xhr ) {
+                       this.xhr.abort();
+               }
+
+               if ( !toHide.length && !toShow.length ) {
+                       $.error( "jQuery UI Tabs: Mismatching fragment identifier." );
+               }
+
+               if ( toShow.length ) {
+                       this.load( this.tabs.index( tab ), event );
+               }
+               this._toggle( event, eventData );
+       },
+
+       // handles show/hide for selecting tabs
+       _toggle: function( event, eventData ) {
+               var that = this,
+                       toShow = eventData.newPanel,
+                       toHide = eventData.oldPanel;
+
+               this.running = true;
+
+               function complete() {
+                       that.running = false;
+                       that._trigger( "activate", event, eventData );
+               }
+
+               function show() {
+                       eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
+
+                       if ( toShow.length && that.options.show ) {
+                               that._show( toShow, that.options.show, complete );
+                       } else {
+                               toShow.show();
+                               complete();
+                       }
+               }
+
+               // start out by hiding, then showing, then completing
+               if ( toHide.length && this.options.hide ) {
+                       this._hide( toHide, this.options.hide, function() {
+                               eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
+                               show();
+                       });
+               } else {
+                       eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
+                       toHide.hide();
+                       show();
+               }
+
+               toHide.attr({
+                       "aria-expanded": "false",
+                       "aria-hidden": "true"
+               });
+               eventData.oldTab.attr( "aria-selected", "false" );
+               // If we're switching tabs, remove the old tab from the tab order.
+               // If we're opening from collapsed state, remove the previous tab from the tab order.
+               // If we're collapsing, then keep the collapsing tab in the tab order.
+               if ( toShow.length && toHide.length ) {
+                       eventData.oldTab.attr( "tabIndex", -1 );
+               } else if ( toShow.length ) {
+                       this.tabs.filter(function() {
+                               return $( this ).attr( "tabIndex" ) === 0;
+                       })
+                       .attr( "tabIndex", -1 );
+               }
+
+               toShow.attr({
+                       "aria-expanded": "true",
+                       "aria-hidden": "false"
+               });
+               eventData.newTab.attr({
+                       "aria-selected": "true",
+                       tabIndex: 0
+               });
+       },
+
+       _activate: function( index ) {
+               var anchor,
+                       active = this._findActive( index );
+
+               // trying to activate the already active panel
+               if ( active[ 0 ] === this.active[ 0 ] ) {
+                       return;
+               }
+
+               // trying to collapse, simulate a click on the current active header
+               if ( !active.length ) {
+                       active = this.active;
+               }
+
+               anchor = active.find( ".ui-tabs-anchor" )[ 0 ];
+               this._eventHandler({
+                       target: anchor,
+                       currentTarget: anchor,
+                       preventDefault: $.noop
+               });
+       },
+
+       _findActive: function( index ) {
+               return index === false ? $() : this.tabs.eq( index );
+       },
+
+       _getIndex: function( index ) {
+               // meta-function to give users option to provide a href string instead of a numerical index.
+               if ( typeof index === "string" ) {
+                       index = this.anchors.index( this.anchors.filter( "[href$='" + index + "']" ) );
+               }
+
+               return index;
+       },
+
+       _destroy: function() {
+               if ( this.xhr ) {
+                       this.xhr.abort();
+               }
+
+               this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" );
+
+               this.tablist
+                       .removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
+                       .removeAttr( "role" );
+
+               this.anchors
+                       .removeClass( "ui-tabs-anchor" )
+                       .removeAttr( "role" )
+                       .removeAttr( "tabIndex" )
+                       .removeData( "href.tabs" )
+                       .removeData( "load.tabs" )
+                       .removeUniqueId();
+
+               this.tabs.add( this.panels ).each(function() {
+                       if ( $.data( this, "ui-tabs-destroy" ) ) {
+                               $( this ).remove();
+                       } else {
+                               $( this )
+                                       .removeClass( "ui-state-default ui-state-active ui-state-disabled " +
+                                               "ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel" )
+                                       .removeAttr( "tabIndex" )
+                                       .removeAttr( "aria-live" )
+                                       .removeAttr( "aria-busy" )
+                                       .removeAttr( "aria-selected" )
+                                       .removeAttr( "aria-labelledby" )
+                                       .removeAttr( "aria-hidden" )
+                                       .removeAttr( "aria-expanded" )
+                                       .removeAttr( "role" );
+                       }
+               });
+
+               this.tabs.each(function() {
+                       var li = $( this ),
+                               prev = li.data( "ui-tabs-aria-controls" );
+                       if ( prev ) {
+                               li.attr( "aria-controls", prev );
+                       } else {
+                               li.removeAttr( "aria-controls" );
+                       }
+               });
+
+               this.panels.show();
+
+               if ( this.options.heightStyle !== "content" ) {
+                       this.panels.css( "height", "" );
+               }
+       },
+
+       enable: function( index ) {
+               var disabled = this.options.disabled;
+               if ( disabled === false ) {
+                       return;
+               }
+
+               if ( index === undefined ) {
+                       disabled = false;
+               } else {
+                       index = this._getIndex( index );
+                       if ( $.isArray( disabled ) ) {
+                               disabled = $.map( disabled, function( num ) {
+                                       return num !== index ? num : null;
+                               });
+                       } else {
+                               disabled = $.map( this.tabs, function( li, num ) {
+                                       return num !== index ? num : null;
+                               });
+                       }
+               }
+               this._setupDisabled( disabled );
+       },
+
+       disable: function( index ) {
+               var disabled = this.options.disabled;
+               if ( disabled === true ) {
+                       return;
+               }
+
+               if ( index === undefined ) {
+                       disabled = true;
+               } else {
+                       index = this._getIndex( index );
+                       if ( $.inArray( index, disabled ) !== -1 ) {
+                               return;
+                       }
+                       if ( $.isArray( disabled ) ) {
+                               disabled = $.merge( [ index ], disabled ).sort();
+                       } else {
+                               disabled = [ index ];
+                       }
+               }
+               this._setupDisabled( disabled );
+       },
+
+       load: function( index, event ) {
+               index = this._getIndex( index );
+               var that = this,
+                       tab = this.tabs.eq( index ),
+                       anchor = tab.find( ".ui-tabs-anchor" ),
+                       panel = this._getPanelForTab( tab ),
+                       eventData = {
+                               tab: tab,
+                               panel: panel
+                       };
+
+               // not remote
+               if ( isLocal( anchor[ 0 ] ) ) {
+                       return;
+               }
+
+               this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) );
+
+               // support: jQuery <1.8
+               // jQuery <1.8 returns false if the request is canceled in beforeSend,
+               // but as of 1.8, $.ajax() always returns a jqXHR object.
+               if ( this.xhr && this.xhr.statusText !== "canceled" ) {
+                       tab.addClass( "ui-tabs-loading" );
+                       panel.attr( "aria-busy", "true" );
+
+                       this.xhr
+                               .success(function( response ) {
+                                       // support: jQuery <1.8
+                                       // http://bugs.jquery.com/ticket/11778
+                                       setTimeout(function() {
+                                               panel.html( response );
+                                               that._trigger( "load", event, eventData );
+                                       }, 1 );
+                               })
+                               .complete(function( jqXHR, status ) {
+                                       // support: jQuery <1.8
+                                       // http://bugs.jquery.com/ticket/11778
+                                       setTimeout(function() {
+                                               if ( status === "abort" ) {
+                                                       that.panels.stop( false, true );
+                                               }
+
+                                               tab.removeClass( "ui-tabs-loading" );
+                                               panel.removeAttr( "aria-busy" );
+
+                                               if ( jqXHR === that.xhr ) {
+                                                       delete that.xhr;
+                                               }
+                                       }, 1 );
+                               });
+               }
+       },
+
+       // TODO: Remove this function in 1.10 when ajaxOptions is removed
+       _ajaxSettings: function( anchor, event, eventData ) {
+               var that = this;
+               return {
+                       url: anchor.attr( "href" ),
+                       beforeSend: function( jqXHR, settings ) {
+                               return that._trigger( "beforeLoad", event,
+                                       $.extend( { jqXHR : jqXHR, ajaxSettings: settings }, eventData ) );
+                       }
+               };
+       },
+
+       _getPanelForTab: function( tab ) {
+               var id = $( tab ).attr( "aria-controls" );
+               return this.element.find( this._sanitizeSelector( "#" + id ) );
+       }
+});
+
+// DEPRECATED
+if ( $.uiBackCompat !== false ) {
+
+       // helper method for a lot of the back compat extensions
+       $.ui.tabs.prototype._ui = function( tab, panel ) {
+               return {
+                       tab: tab,
+                       panel: panel,
+                       index: this.anchors.index( tab )
+               };
+       };
+
+       // url method
+       $.widget( "ui.tabs", $.ui.tabs, {
+               url: function( index, url ) {
+                       this.anchors.eq( index ).attr( "href", url );
+               }
+       });
+
+       // TODO: Remove _ajaxSettings() method when removing this extension
+       // ajaxOptions and cache options
+       $.widget( "ui.tabs", $.ui.tabs, {
+               options: {
+                       ajaxOptions: null,
+                       cache: false
+               },
+
+               _create: function() {
+                       this._super();
+
+                       var that = this;
+
+                       this._on({ tabsbeforeload: function( event, ui ) {
+                               // tab is already cached
+                               if ( $.data( ui.tab[ 0 ], "cache.tabs" ) ) {
+                                       event.preventDefault();
+                                       return;
+                               }
+
+                               ui.jqXHR.success(function() {
+                                       if ( that.options.cache ) {
+                                               $.data( ui.tab[ 0 ], "cache.tabs", true );
+                                       }
+                               });
+                       }});
+               },
+
+               _ajaxSettings: function( anchor, event, ui ) {
+                       var ajaxOptions = this.options.ajaxOptions;
+                       return $.extend( {}, ajaxOptions, {
+                               error: function( xhr, status ) {
+                                       try {
+                                               // Passing index avoid a race condition when this method is
+                                               // called after the user has selected another tab.
+                                               // Pass the anchor that initiated this request allows
+                                               // loadError to manipulate the tab content panel via $(a.hash)
+                                               ajaxOptions.error(
+                                                       xhr, status, ui.tab.closest( "li" ).index(), ui.tab[ 0 ] );
+                                       }
+                                       catch ( error ) {}
+                               }
+                       }, this._superApply( arguments ) );
+               },
+
+               _setOption: function( key, value ) {
+                       // reset cache if switching from cached to not cached
+                       if ( key === "cache" && value === false ) {
+                               this.anchors.removeData( "cache.tabs" );
+                       }
+                       this._super( key, value );
+               },
+
+               _destroy: function() {
+                       this.anchors.removeData( "cache.tabs" );
+                       this._super();
+               },
+
+               url: function( index ){
+                       this.anchors.eq( index ).removeData( "cache.tabs" );
+                       this._superApply( arguments );
+               }
+       });
+
+       // abort method
+       $.widget( "ui.tabs", $.ui.tabs, {
+               abort: function() {
+                       if ( this.xhr ) {
+                               this.xhr.abort();
+                       }
+               }
+       });
+
+       // spinner
+       $.widget( "ui.tabs", $.ui.tabs, {
+               options: {
+                       spinner: "<em>Loading&#8230;</em>"
+               },
+               _create: function() {
+                       this._super();
+                       this._on({
+                               tabsbeforeload: function( event, ui ) {
+                                       // Don't react to nested tabs or tabs that don't use a spinner
+                                       if ( event.target !== this.element[ 0 ] ||
+                                                       !this.options.spinner ) {
+                                               return;
+                                       }
+
+                                       var span = ui.tab.find( "span" ),
+                                               html = span.html();
+                                       span.html( this.options.spinner );
+                                       ui.jqXHR.complete(function() {
+                                               span.html( html );
+                                       });
+                               }
+                       });
+               }
+       });
+
+       // enable/disable events
+       $.widget( "ui.tabs", $.ui.tabs, {
+               options: {
+                       enable: null,
+                       disable: null
+               },
+
+               enable: function( index ) {
+                       var options = this.options,
+                               trigger;
+
+                       if ( index && options.disabled === true ||
+                                       ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) !== -1 ) ) {
+                               trigger = true;
+                       }
+
+                       this._superApply( arguments );
+
+                       if ( trigger ) {
+                               this._trigger( "enable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
+                       }
+               },
+
+               disable: function( index ) {
+                       var options = this.options,
+                               trigger;
+
+                       if ( index && options.disabled === false ||
+                                       ( $.isArray( options.disabled ) && $.inArray( index, options.disabled ) === -1 ) ) {
+                               trigger = true;
+                       }
+
+                       this._superApply( arguments );
+
+                       if ( trigger ) {
+                               this._trigger( "disable", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
+                       }
+               }
+       });
+
+       // add/remove methods and events
+       $.widget( "ui.tabs", $.ui.tabs, {
+               options: {
+                       add: null,
+                       remove: null,
+                       tabTemplate: "<li><a href='#{href}'><span>#{label}</span></a></li>"
+               },
+
+               add: function( url, label, index ) {
+                       if ( index === undefined ) {
+                               index = this.anchors.length;
+                       }
+
+                       var doInsertAfter, panel,
+                               options = this.options,
+                               li = $( options.tabTemplate
+                                       .replace( /#\{href\}/g, url )
+                                       .replace( /#\{label\}/g, label ) ),
+                               id = !url.indexOf( "#" ) ?
+                                       url.replace( "#", "" ) :
+                                       this._tabId( li );
+
+                       li.addClass( "ui-state-default ui-corner-top" ).data( "ui-tabs-destroy", true );
+                       li.attr( "aria-controls", id );
+
+                       doInsertAfter = index >= this.tabs.length;
+
+                       // try to find an existing element before creating a new one
+                       panel = this.element.find( "#" + id );
+                       if ( !panel.length ) {
+                               panel = this._createPanel( id );
+                               if ( doInsertAfter ) {
+                                       if ( index > 0 ) {
+                                               panel.insertAfter( this.panels.eq( -1 ) );
+                                       } else {
+                                               panel.appendTo( this.element );
+                                       }
+                               } else {
+                                       panel.insertBefore( this.panels[ index ] );
+                               }
+                       }
+                       panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ).hide();
+
+                       if ( doInsertAfter ) {
+                               li.appendTo( this.tablist );
+                       } else {
+                               li.insertBefore( this.tabs[ index ] );
+                       }
+
+                       options.disabled = $.map( options.disabled, function( n ) {
+                               return n >= index ? ++n : n;
+                       });
+
+                       this.refresh();
+                       if ( this.tabs.length === 1 && options.active === false ) {
+                               this.option( "active", 0 );
+                       }
+
+                       this._trigger( "add", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );
+                       return this;
+               },
+
+               remove: function( index ) {
+                       index = this._getIndex( index );
+                       var options = this.options,
+                               tab = this.tabs.eq( index ).remove(),
+                               panel = this._getPanelForTab( tab ).remove();
+
+                       // If selected tab was removed focus tab to the right or
+                       // in case the last tab was removed the tab to the left.
+                       // We check for more than 2 tabs, because if there are only 2,
+                       // then when we remove this tab, there will only be one tab left
+                       // so we don't need to detect which tab to activate.
+                       if ( tab.hasClass( "ui-tabs-active" ) && this.anchors.length > 2 ) {
+                               this._activate( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
+                       }
+
+                       options.disabled = $.map(
+                               $.grep( options.disabled, function( n ) {
+                                       return n !== index;
+                               }),
+                               function( n ) {
+                                       return n >= index ? --n : n;
+                               });
+
+                       this.refresh();
+
+                       this._trigger( "remove", null, this._ui( tab.find( "a" )[ 0 ], panel[ 0 ] ) );
+                       return this;
+               }
+       });
+
+       // length method
+       $.widget( "ui.tabs", $.ui.tabs, {
+               length: function() {
+                       return this.anchors.length;
+               }
+       });
+
+       // panel ids (idPrefix option + title attribute)
+       $.widget( "ui.tabs", $.ui.tabs, {
+               options: {
+                       idPrefix: "ui-tabs-"
+               },
+
+               _tabId: function( tab ) {
+                       var a = tab.is( "li" ) ? tab.find( "a[href]" ) : tab;
+                       a = a[0];
+                       return $( a ).closest( "li" ).attr( "aria-controls" ) ||
+                               a.title && a.title.replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF\-]/g, "" ) ||
+                               this.options.idPrefix + getNextTabId();
+               }
+       });
+
+       // _createPanel method
+       $.widget( "ui.tabs", $.ui.tabs, {
+               options: {
+                       panelTemplate: "<div></div>"
+               },
+
+               _createPanel: function( id ) {
+                       return $( this.options.panelTemplate )
+                               .attr( "id", id )
+                               .addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" )
+                               .data( "ui-tabs-destroy", true );
+               }
+       });
+
+       // selected option
+       $.widget( "ui.tabs", $.ui.tabs, {
+               _create: function() {
+                       var options = this.options;
+                       if ( options.active === null && options.selected !== undefined ) {
+                               options.active = options.selected === -1 ? false : options.selected;
+                       }
+                       this._super();
+                       options.selected = options.active;
+                       if ( options.selected === false ) {
+                               options.selected = -1;
+                       }
+               },
+
+               _setOption: function( key, value ) {
+                       if ( key !== "selected" ) {
+                               return this._super( key, value );
+                       }
+
+                       var options = this.options;
+                       this._super( "active", value === -1 ? false : value );
+                       options.selected = options.active;
+                       if ( options.selected === false ) {
+                               options.selected = -1;
+                       }
+               },
+
+               _eventHandler: function() {
+                       this._superApply( arguments );
+                       this.options.selected = this.options.active;
+                       if ( this.options.selected === false ) {
+                               this.options.selected = -1;
+                       }
+               }
+       });
+
+       // show and select event
+       $.widget( "ui.tabs", $.ui.tabs, {
+               options: {
+                       show: null,
+                       select: null
+               },
+               _create: function() {
+                       this._super();
+                       if ( this.options.active !== false ) {
+                               this._trigger( "show", null, this._ui(
+                                       this.active.find( ".ui-tabs-anchor" )[ 0 ],
+                                       this._getPanelForTab( this.active )[ 0 ] ) );
+                       }
+               },
+               _trigger: function( type, event, data ) {
+                       var tab, panel,
+                               ret = this._superApply( arguments );
+
+                       if ( !ret ) {
+                               return false;
+                       }
+
+                       if ( type === "beforeActivate" ) {
+                               tab = data.newTab.length ? data.newTab : data.oldTab;
+                               panel = data.newPanel.length ? data.newPanel : data.oldPanel;
+                               ret = this._super( "select", event, {
+                                       tab: tab.find( ".ui-tabs-anchor" )[ 0],
+                                       panel: panel[ 0 ],
+                                       index: tab.closest( "li" ).index()
+                               });
+                       } else if ( type === "activate" && data.newTab.length ) {
+                               ret = this._super( "show", event, {
+                                       tab: data.newTab.find( ".ui-tabs-anchor" )[ 0 ],
+                                       panel: data.newPanel[ 0 ],
+                                       index: data.newTab.closest( "li" ).index()
+                               });
+                       }
+                       return ret;
+               }
+       });
+
+       // select method
+       $.widget( "ui.tabs", $.ui.tabs, {
+               select: function( index ) {
+                       index = this._getIndex( index );
+                       if ( index === -1 ) {
+                               if ( this.options.collapsible && this.options.selected !== -1 ) {
+                                       index = this.options.selected;
+                               } else {
+                                       return;
+                               }
+                       }
+                       this.anchors.eq( index ).trigger( this.options.event + this.eventNamespace );
+               }
+       });
+
+       // cookie option
+       (function() {
+
+       var listId = 0;
+
+       $.widget( "ui.tabs", $.ui.tabs, {
+               options: {
+                       cookie: null // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
+               },
+               _create: function() {
+                       var options = this.options,
+                               active;
+                       if ( options.active == null && options.cookie ) {
+                               active = parseInt( this._cookie(), 10 );
+                               if ( active === -1 ) {
+                                       active = false;
+                               }
+                               options.active = active;
+                       }
+                       this._super();
+               },
+               _cookie: function( active ) {
+                       var cookie = [ this.cookie ||
+                               ( this.cookie = this.options.cookie.name || "ui-tabs-" + (++listId) ) ];
+                       if ( arguments.length ) {
+                               cookie.push( active === false ? -1 : active );
+                               cookie.push( this.options.cookie );
+                       }
+                       return $.cookie.apply( null, cookie );
+               },
+               _refresh: function() {
+                       this._super();
+                       if ( this.options.cookie ) {
+                               this._cookie( this.options.active, this.options.cookie );
+                       }
+               },
+               _eventHandler: function() {
+                       this._superApply( arguments );
+                       if ( this.options.cookie ) {
+                               this._cookie( this.options.active, this.options.cookie );
+                       }
+               },
+               _destroy: function() {
+                       this._super();
+                       if ( this.options.cookie ) {
+                               this._cookie( null, this.options.cookie );
+                       }
+               }
+       });
+
+       })();
+
+       // load event
+       $.widget( "ui.tabs", $.ui.tabs, {
+               _trigger: function( type, event, data ) {
+                       var _data = $.extend( {}, data );
+                       if ( type === "load" ) {
+                               _data.panel = _data.panel[ 0 ];
+                               _data.tab = _data.tab.find( ".ui-tabs-anchor" )[ 0 ];
+                       }
+                       return this._super( type, event, _data );
+               }
+       });
+
+       // fx option
+       // The new animation options (show, hide) conflict with the old show callback.
+       // The old fx option wins over show/hide anyway (always favor back-compat).
+       // If a user wants to use the new animation API, they must give up the old API.
+       $.widget( "ui.tabs", $.ui.tabs, {
+               options: {
+                       fx: null // e.g. { height: "toggle", opacity: "toggle", duration: 200 }
+               },
+
+               _getFx: function() {
+                       var hide, show,
+                               fx = this.options.fx;
+
+                       if ( fx ) {
+                               if ( $.isArray( fx ) ) {
+                                       hide = fx[ 0 ];
+                                       show = fx[ 1 ];
+                               } else {
+                                       hide = show = fx;
+                               }
+                       }
+
+                       return fx ? { show: show, hide: hide } : null;
+               },
+
+               _toggle: function( event, eventData ) {
+                       var that = this,
+                               toShow = eventData.newPanel,
+                               toHide = eventData.oldPanel,
+                               fx = this._getFx();
+
+                       if ( !fx ) {
+                               return this._super( event, eventData );
+                       }
+
+                       that.running = true;
+
+                       function complete() {
+                               that.running = false;
+                               that._trigger( "activate", event, eventData );
+                       }
+
+                       function show() {
+                               eventData.newTab.closest( "li" ).addClass( "ui-tabs-active ui-state-active" );
+
+                               if ( toShow.length && fx.show ) {
+                                       toShow
+                                               .animate( fx.show, fx.show.duration, function() {
+                                                       complete();
+                                               });
+                               } else {
+                                       toShow.show();
+                                       complete();
+                               }
+                       }
+
+                       // start out by hiding, then showing, then completing
+                       if ( toHide.length && fx.hide ) {
+                               toHide.animate( fx.hide, fx.hide.duration, function() {
+                                       eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
+                                       show();
+                               });
+                       } else {
+                               eventData.oldTab.closest( "li" ).removeClass( "ui-tabs-active ui-state-active" );
+                               toHide.hide();
+                               show();
+                       }
+               }
+       });
+}
+
+})( jQuery );
+(function( $ ) {
+
+var increments = 0;
+
+function addDescribedBy( elem, id ) {
+       var describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ );
+       describedby.push( id );
+       elem
+               .data( "ui-tooltip-id", id )
+               .attr( "aria-describedby", $.trim( describedby.join( " " ) ) );
+}
+
+function removeDescribedBy( elem ) {
+       var id = elem.data( "ui-tooltip-id" ),
+               describedby = (elem.attr( "aria-describedby" ) || "").split( /\s+/ ),
+               index = $.inArray( id, describedby );
+       if ( index !== -1 ) {
+               describedby.splice( index, 1 );
+       }
+
+       elem.removeData( "ui-tooltip-id" );
+       describedby = $.trim( describedby.join( " " ) );
+       if ( describedby ) {
+               elem.attr( "aria-describedby", describedby );
+       } else {
+               elem.removeAttr( "aria-describedby" );
+       }
+}
+
+$.widget( "ui.tooltip", {
+       version: "1.9.2",
+       options: {
+               content: function() {
+                       return $( this ).attr( "title" );
+               },
+               hide: true,
+               // Disabled elements have inconsistent behavior across browsers (#8661)
+               items: "[title]:not([disabled])",
+               position: {
+                       my: "left top+15",
+                       at: "left bottom",
+                       collision: "flipfit flip"
+               },
+               show: true,
+               tooltipClass: null,
+               track: false,
+
+               // callbacks
+               close: null,
+               open: null
+       },
+
+       _create: function() {
+               this._on({
+                       mouseover: "open",
+                       focusin: "open"
+               });
+
+               // IDs of generated tooltips, needed for destroy
+               this.tooltips = {};
+               // IDs of parent tooltips where we removed the title attribute
+               this.parents = {};
+
+               if ( this.options.disabled ) {
+                       this._disable();
+               }
+       },
+
+       _setOption: function( key, value ) {
+               var that = this;
+
+               if ( key === "disabled" ) {
+                       this[ value ? "_disable" : "_enable" ]();
+                       this.options[ key ] = value;
+                       // disable element style changes
+                       return;
+               }
+
+               this._super( key, value );
+
+               if ( key === "content" ) {
+                       $.each( this.tooltips, function( id, element ) {
+                               that._updateContent( element );
+                       });
+               }
+       },
+
+       _disable: function() {
+               var that = this;
+
+               // close open tooltips
+               $.each( this.tooltips, function( id, element ) {
+                       var event = $.Event( "blur" );
+                       event.target = event.currentTarget = element[0];
+                       that.close( event, true );
+               });
+
+               // remove title attributes to prevent native tooltips
+               this.element.find( this.options.items ).andSelf().each(function() {
+                       var element = $( this );
+                       if ( element.is( "[title]" ) ) {
+                               element
+                                       .data( "ui-tooltip-title", element.attr( "title" ) )
+                                       .attr( "title", "" );
+                       }
+               });
+       },
+
+       _enable: function() {
+               // restore title attributes
+               this.element.find( this.options.items ).andSelf().each(function() {
+                       var element = $( this );
+                       if ( element.data( "ui-tooltip-title" ) ) {
+                               element.attr( "title", element.data( "ui-tooltip-title" ) );
+                       }
+               });
+       },
+
+       open: function( event ) {
+               var that = this,
+                       target = $( event ? event.target : this.element )
+                               // we need closest here due to mouseover bubbling,
+                               // but always pointing at the same event target
+                               .closest( this.options.items );
+
+               // No element to show a tooltip for or the tooltip is already open
+               if ( !target.length || target.data( "ui-tooltip-id" ) ) {
+                       return;
+               }
+
+               if ( target.attr( "title" ) ) {
+                       target.data( "ui-tooltip-title", target.attr( "title" ) );
+               }
+
+               target.data( "ui-tooltip-open", true );
+
+               // kill parent tooltips, custom or native, for hover
+               if ( event && event.type === "mouseover" ) {
+                       target.parents().each(function() {
+                               var parent = $( this ),
+                                       blurEvent;
+                               if ( parent.data( "ui-tooltip-open" ) ) {
+                                       blurEvent = $.Event( "blur" );
+                                       blurEvent.target = blurEvent.currentTarget = this;
+                                       that.close( blurEvent, true );
+                               }
+                               if ( parent.attr( "title" ) ) {
+                                       parent.uniqueId();
+                                       that.parents[ this.id ] = {
+                                               element: this,
+                                               title: parent.attr( "title" )
+                                       };
+                                       parent.attr( "title", "" );
+                               }
+                       });
+               }
+
+               this._updateContent( target, event );
+       },
+
+       _updateContent: function( target, event ) {
+               var content,
+                       contentOption = this.options.content,
+                       that = this,
+                       eventType = event ? event.type : null;
+
+               if ( typeof contentOption === "string" ) {
+                       return this._open( event, target, contentOption );
+               }
+
+               content = contentOption.call( target[0], function( response ) {
+                       // ignore async response if tooltip was closed already
+                       if ( !target.data( "ui-tooltip-open" ) ) {
+                               return;
+                       }
+                       // IE may instantly serve a cached response for ajax requests
+                       // delay this call to _open so the other call to _open runs first
+                       that._delay(function() {
+                               // jQuery creates a special event for focusin when it doesn't
+                               // exist natively. To improve performance, the native event
+                               // object is reused and the type is changed. Therefore, we can't
+                               // rely on the type being correct after the event finished
+                               // bubbling, so we set it back to the previous value. (#8740)
+                               if ( event ) {
+                                       event.type = eventType;
+                               }
+                               this._open( event, target, response );
+                       });
+               });
+               if ( content ) {
+                       this._open( event, target, content );
+               }
+       },
+
+       _open: function( event, target, content ) {
+               var tooltip, events, delayedShow,
+                       positionOption = $.extend( {}, this.options.position );
+
+               if ( !content ) {
+                       return;
+               }
+
+               // Content can be updated multiple times. If the tooltip already
+               // exists, then just update the content and bail.
+               tooltip = this._find( target );
+               if ( tooltip.length ) {
+                       tooltip.find( ".ui-tooltip-content" ).html( content );
+                       return;
+               }
+
+               // if we have a title, clear it to prevent the native tooltip
+               // we have to check first to avoid defining a title if none exists
+               // (we don't want to cause an element to start matching [title])
+               //
+               // We use removeAttr only for key events, to allow IE to export the correct
+               // accessible attributes. For mouse events, set to empty string to avoid
+               // native tooltip showing up (happens only when removing inside mouseover).
+               if ( target.is( "[title]" ) ) {
+                       if ( event && event.type === "mouseover" ) {
+                               target.attr( "title", "" );
+                       } else {
+                               target.removeAttr( "title" );
+                       }
+               }
+
+               tooltip = this._tooltip( target );
+               addDescribedBy( target, tooltip.attr( "id" ) );
+               tooltip.find( ".ui-tooltip-content" ).html( content );
+
+               function position( event ) {
+                       positionOption.of = event;
+                       if ( tooltip.is( ":hidden" ) ) {
+                               return;
+                       }
+                       tooltip.position( positionOption );
+               }
+               if ( this.options.track && event && /^mouse/.test( event.type ) ) {
+                       this._on( this.document, {
+                               mousemove: position
+                       });
+                       // trigger once to override element-relative positioning
+                       position( event );
+               } else {
+                       tooltip.position( $.extend({
+                               of: target
+                       }, this.options.position ) );
+               }
+
+               tooltip.hide();
+
+               this._show( tooltip, this.options.show );
+               // Handle tracking tooltips that are shown with a delay (#8644). As soon
+               // as the tooltip is visible, position the tooltip using the most recent
+               // event.
+               if ( this.options.show && this.options.show.delay ) {
+                       delayedShow = setInterval(function() {
+                               if ( tooltip.is( ":visible" ) ) {
+                                       position( positionOption.of );
+                                       clearInterval( delayedShow );
+                               }
+                       }, $.fx.interval );
+               }
+
+               this._trigger( "open", event, { tooltip: tooltip } );
+
+               events = {
+                       keyup: function( event ) {
+                               if ( event.keyCode === $.ui.keyCode.ESCAPE ) {
+                                       var fakeEvent = $.Event(event);
+                                       fakeEvent.currentTarget = target[0];
+                                       this.close( fakeEvent, true );
+                               }
+                       },
+                       remove: function() {
+                               this._removeTooltip( tooltip );
+                       }
+               };
+               if ( !event || event.type === "mouseover" ) {
+                       events.mouseleave = "close";
+               }
+               if ( !event || event.type === "focusin" ) {
+                       events.focusout = "close";
+               }
+               this._on( true, target, events );
+       },
+
+       close: function( event ) {
+               var that = this,
+                       target = $( event ? event.currentTarget : this.element ),
+                       tooltip = this._find( target );
+
+               // disabling closes the tooltip, so we need to track when we're closing
+               // to avoid an infinite loop in case the tooltip becomes disabled on close
+               if ( this.closing ) {
+                       return;
+               }
+
+               // only set title if we had one before (see comment in _open())
+               if ( target.data( "ui-tooltip-title" ) ) {
+                       target.attr( "title", target.data( "ui-tooltip-title" ) );
+               }
+
+               removeDescribedBy( target );
+
+               tooltip.stop( true );
+               this._hide( tooltip, this.options.hide, function() {
+                       that._removeTooltip( $( this ) );
+               });
+
+               target.removeData( "ui-tooltip-open" );
+               this._off( target, "mouseleave focusout keyup" );
+               // Remove 'remove' binding only on delegated targets
+               if ( target[0] !== this.element[0] ) {
+                       this._off( target, "remove" );
+               }
+               this._off( this.document, "mousemove" );
+
+               if ( event && event.type === "mouseleave" ) {
+                       $.each( this.parents, function( id, parent ) {
+                               $( parent.element ).attr( "title", parent.title );
+                               delete that.parents[ id ];
+                       });
+               }
+
+               this.closing = true;
+               this._trigger( "close", event, { tooltip: tooltip } );
+               this.closing = false;
+       },
+
+       _tooltip: function( element ) {
+               var id = "ui-tooltip-" + increments++,
+                       tooltip = $( "<div>" )
+                               .attr({
+                                       id: id,
+                                       role: "tooltip"
+                               })
+                               .addClass( "ui-tooltip ui-widget ui-corner-all ui-widget-content " +
+                                       ( this.options.tooltipClass || "" ) );
+               $( "<div>" )
+                       .addClass( "ui-tooltip-content" )
+                       .appendTo( tooltip );
+               tooltip.appendTo( this.document[0].body );
+               if ( $.fn.bgiframe ) {
+                       tooltip.bgiframe();
+               }
+               this.tooltips[ id ] = element;
+               return tooltip;
+       },
+
+       _find: function( target ) {
+               var id = target.data( "ui-tooltip-id" );
+               return id ? $( "#" + id ) : $();
+       },
+
+       _removeTooltip: function( tooltip ) {
+               tooltip.remove();
+               delete this.tooltips[ tooltip.attr( "id" ) ];
+       },
+
+       _destroy: function() {
+               var that = this;
+
+               // close open tooltips
+               $.each( this.tooltips, function( id, element ) {
+                       // Delegate to close method to handle common cleanup
+                       var event = $.Event( "blur" );
+                       event.target = event.currentTarget = element[0];
+                       that.close( event, true );
+
+                       // Remove immediately; destroying an open tooltip doesn't use the
+                       // hide animation
+                       $( "#" + id ).remove();
+
+                       // Restore the title
+                       if ( element.data( "ui-tooltip-title" ) ) {
+                               element.attr( "title", element.data( "ui-tooltip-title" ) );
+                               element.removeData( "ui-tooltip-title" );
+                       }
+               });
+       }
+});
+
+}( jQuery ) );
diff --git a/app/webroot/js/jquery-ui-1.9.2.custom.min.js b/app/webroot/js/jquery-ui-1.9.2.custom.min.js
new file mode 100644 (file)
index 0000000..9b3b84d
--- /dev/null
@@ -0,0 +1,6 @@
+/*! jQuery UI - v1.9.2 - 2012-11-23
+* http://jqueryui.com
+* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.effect.js, jquery.ui.effect-blind.js, jquery.ui.effect-bounce.js, jquery.ui.effect-clip.js, jquery.ui.effect-drop.js, jquery.ui.effect-explode.js, jquery.ui.effect-fade.js, jquery.ui.effect-fold.js, jquery.ui.effect-highlight.js, jquery.ui.effect-pulsate.js, jquery.ui.effect-scale.js, jquery.ui.effect-shake.js, jquery.ui.effect-slide.js, jquery.ui.effect-transfer.js, jquery.ui.menu.js, jquery.ui.progressbar.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.slider.js, jquery.ui.sortable.js, jquery.ui.spinner.js, jquery.ui.tabs.js, jquery.ui.tooltip.js
+* Copyright (c) 2012 jQuery Foundation and other contributors Licensed MIT */
+
+(function(e,t){function i(t,n){var r,i,o,u=t.nodeName.toLowerCase();return"area"===u?(r=t.parentNode,i=r.name,!t.href||!i||r.nodeName.toLowerCase()!=="map"?!1:(o=e("img[usemap=#"+i+"]")[0],!!o&&s(o))):(/input|select|textarea|button|object/.test(u)?!t.disabled:"a"===u?t.href||n:n)&&s(t)}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().andSelf().filter(function(){return e.css(this,"visibility")==="hidden"}).length}var n=0,r=/^ui-id-\d+$/;e.ui=e.ui||{};if(e.ui.version)return;e.extend(e.ui,{version:"1.9.2",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({_focus:e.fn.focus,focus:function(t,n){return typeof t=="number"?this.each(function(){var r=this;setTimeout(function(){e(r).focus(),n&&n.call(r)},t)}):this._focus.apply(this,arguments)},scrollParent:function(){var t;return e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?t=this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):t=this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(n){if(n!==t)return this.css("zIndex",n);if(this.length){var r=e(this[0]),i,s;while(r.length&&r[0]!==document){i=r.css("position");if(i==="absolute"||i==="relative"||i==="fixed"){s=parseInt(r.css("zIndex"),10);if(!isNaN(s)&&s!==0)return s}r=r.parent()}}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++n)})},removeUniqueId:function(){return this.each(function(){r.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,r){return!!e.data(t,r[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var n=e.attr(t,"tabindex"),r=isNaN(n);return(r||n>=0)&&i(t,!r)}}),e(function(){var t=document.body,n=t.appendChild(n=document.createElement("div"));n.offsetHeight,e.extend(n.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0}),e.support.minHeight=n.offsetHeight===100,e.support.selectstart="onselectstart"in n,t.removeChild(n).style.display="none"}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(n,r){function u(t,n,r,s){return e.each(i,function(){n-=parseFloat(e.css(t,"padding"+this))||0,r&&(n-=parseFloat(e.css(t,"border"+this+"Width"))||0),s&&(n-=parseFloat(e.css(t,"margin"+this))||0)}),n}var i=r==="Width"?["Left","Right"]:["Top","Bottom"],s=r.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+r]=function(n){return n===t?o["inner"+r].call(this):this.each(function(){e(this).css(s,u(this,n)+"px")})},e.fn["outer"+r]=function(t,n){return typeof t!="number"?o["outer"+r].call(this,t):this.each(function(){e(this).css(s,u(this,t,!0,n)+"px")})}}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(n){return arguments.length?t.call(this,e.camelCase(n)):t.call(this)}}(e.fn.removeData)),function(){var t=/msie ([\w.]+)/.exec(navigator.userAgent.toLowerCase())||[];e.ui.ie=t.length?!0:!1,e.ui.ie6=parseFloat(t[1],10)===6}(),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,n,r){var i,s=e.ui[t].prototype;for(i in r)s.plugins[i]=s.plugins[i]||[],s.plugins[i].push([n,r[i]])},call:function(e,t,n){var r,i=e.plugins[t];if(!i||!e.element[0].parentNode||e.element[0].parentNode.nodeType===11)return;for(r=0;r<i.length;r++)e.options[i[r][0]]&&i[r][1].apply(e.element,n)}},contains:e.contains,hasScroll:function(t,n){if(e(t).css("overflow")==="hidden")return!1;var r=n&&n==="left"?"scrollLeft":"scrollTop",i=!1;return t[r]>0?!0:(t[r]=1,i=t[r]>0,t[r]=0,i)},isOverAxis:function(e,t,n){return e>t&&e<t+n},isOver:function(t,n,r,i,s,o){return e.ui.isOverAxis(t,r,s)&&e.ui.isOverAxis(n,i,o)}})})(jQuery);(function(e,t){var n=0,r=Array.prototype.slice,i=e.cleanData;e.cleanData=function(t){for(var n=0,r;(r=t[n])!=null;n++)try{e(r).triggerHandler("remove")}catch(s){}i(t)},e.widget=function(t,n,r){var i,s,o,u,a=t.split(".")[0];t=t.split(".")[1],i=a+"-"+t,r||(r=n,n=e.Widget),e.expr[":"][i.toLowerCase()]=function(t){return!!e.data(t,i)},e[a]=e[a]||{},s=e[a][t],o=e[a][t]=function(e,t){if(!this._createWidget)return new o(e,t);arguments.length&&this._createWidget(e,t)},e.extend(o,s,{version:r.version,_proto:e.extend({},r),_childConstructors:[]}),u=new n,u.options=e.widget.extend({},u.options),e.each(r,function(t,i){e.isFunction(i)&&(r[t]=function(){var e=function(){return n.prototype[t].apply(this,arguments)},r=function(e){return n.prototype[t].apply(this,e)};return function(){var t=this._super,n=this._superApply,s;return this._super=e,this._superApply=r,s=i.apply(this,arguments),this._super=t,this._superApply=n,s}}())}),o.prototype=e.widget.extend(u,{widgetEventPrefix:s?u.widgetEventPrefix:t},r,{constructor:o,namespace:a,widgetName:t,widgetBaseClass:i,widgetFullName:i}),s?(e.each(s._childConstructors,function(t,n){var r=n.prototype;e.widget(r.namespace+"."+r.widgetName,o,n._proto)}),delete s._childConstructors):n._childConstructors.push(o),e.widget.bridge(t,o)},e.widget.extend=function(n){var i=r.call(arguments,1),s=0,o=i.length,u,a;for(;s<o;s++)for(u in i[s])a=i[s][u],i[s].hasOwnProperty(u)&&a!==t&&(e.isPlainObject(a)?n[u]=e.isPlainObject(n[u])?e.widget.extend({},n[u],a):e.widget.extend({},a):n[u]=a);return n},e.widget.bridge=function(n,i){var s=i.prototype.widgetFullName||n;e.fn[n]=function(o){var u=typeof o=="string",a=r.call(arguments,1),f=this;return o=!u&&a.length?e.widget.extend.apply(null,[o].concat(a)):o,u?this.each(function(){var r,i=e.data(this,s);if(!i)return e.error("cannot call methods on "+n+" prior to initialization; "+"attempted to call method '"+o+"'");if(!e.isFunction(i[o])||o.charAt(0)==="_")return e.error("no such method '"+o+"' for "+n+" widget instance");r=i[o].apply(i,a);if(r!==i&&r!==t)return f=r&&r.jquery?f.pushStack(r.get()):r,!1}):this.each(function(){var t=e.data(this,s);t?t.option(o||{})._init():e.data(this,s,new i(o,this))}),f}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,r){r=e(r||this.defaultElement||this)[0],this.element=e(r),this.uuid=n++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),r!==this&&(e.data(r,this.widgetName,this),e.data(r,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===r&&this.destroy()}}),this.document=e(r.style?r.ownerDocument:r.document||r),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(n,r){var i=n,s,o,u;if(arguments.length===0)return e.widget.extend({},this.options);if(typeof n=="string"){i={},s=n.split("."),n=s.shift();if(s.length){o=i[n]=e.widget.extend({},this.options[n]);for(u=0;u<s.length-1;u++)o[s[u]]=o[s[u]]||{},o=o[s[u]];n=s.pop();if(r===t)return o[n]===t?null:o[n];o[n]=r}else{if(r===t)return this.options[n]===t?null:this.options[n];i[n]=r}}return this._setOptions(i),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,e==="disabled"&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(t,n,r){var i,s=this;typeof t!="boolean"&&(r=n,n=t,t=!1),r?(n=i=e(n),this.bindings=this.bindings.add(n)):(r=n,n=this.element,i=this.widget()),e.each(r,function(r,o){function u(){if(!t&&(s.options.disabled===!0||e(this).hasClass("ui-state-disabled")))return;return(typeof o=="string"?s[o]:o).apply(s,arguments)}typeof o!="string"&&(u.guid=o.guid=o.guid||u.guid||e.guid++);var a=r.match(/^(\w+)\s*(.*)$/),f=a[1]+s.eventNamespace,l=a[2];l?i.delegate(l,f,u):n.bind(f,u)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function n(){return(typeof e=="string"?r[e]:e).apply(r,arguments)}var r=this;return setTimeout(n,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,n,r){var i,s,o=this.options[t];r=r||{},n=e.Event(n),n.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),n.target=this.element[0],s=n.originalEvent;if(s)for(i in s)i in n||(n[i]=s[i]);return this.element.trigger(n,r),!(e.isFunction(o)&&o.apply(this.element[0],[n].concat(r))===!1||n.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,n){e.Widget.prototype["_"+t]=function(r,i,s){typeof i=="string"&&(i={effect:i});var o,u=i?i===!0||typeof i=="number"?n:i.effect||n:t;i=i||{},typeof i=="number"&&(i={duration:i}),o=!e.isEmptyObject(i),i.complete=s,i.delay&&r.delay(i.delay),o&&e.effects&&(e.effects.effect[u]||e.uiBackCompat!==!1&&e.effects[u])?r[t](i):u!==t&&r[u]?r[u](i.duration,i.easing,s):r.queue(function(n){e(this)[t](),s&&s.call(r[0]),n()})}}),e.uiBackCompat!==!1&&(e.Widget.prototype._getCreateOptions=function(){return e.metadata&&e.metadata.get(this.element[0])[this.widgetName]})})(jQuery);(function(e,t){var n=!1;e(document).mouseup(function(e){n=!1}),e.widget("ui.mouse",{version:"1.9.2",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(n){if(!0===e.data(n.target,t.widgetName+".preventClickEvent"))return e.removeData(n.target,t.widgetName+".preventClickEvent"),n.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(n)return;this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var r=this,i=t.which===1,s=typeof this.options.cancel=="string"&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;if(!i||s||!this._mouseCapture(t))return!0;this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){r.mouseDelayMet=!0},this.options.delay));if(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)){this._mouseStarted=this._mouseStart(t)!==!1;if(!this._mouseStarted)return t.preventDefault(),!0}return!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return r._mouseMove(e)},this._mouseUpDelegate=function(e){return r._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),n=!0,!0},_mouseMove:function(t){return!e.ui.ie||document.documentMode>=9||!!t.button?this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted):this._mouseUp(t)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(e){return this.mouseDelayMet},_mouseStart:function(e){},_mouseDrag:function(e){},_mouseStop:function(e){},_mouseCapture:function(e){return!0}})})(jQuery);(function(e,t){function h(e,t,n){return[parseInt(e[0],10)*(l.test(e[0])?t/100:1),parseInt(e[1],10)*(l.test(e[1])?n/100:1)]}function p(t,n){return parseInt(e.css(t,n),10)||0}e.ui=e.ui||{};var n,r=Math.max,i=Math.abs,s=Math.round,o=/left|center|right/,u=/top|center|bottom/,a=/[\+\-]\d+%?/,f=/^\w+/,l=/%$/,c=e.fn.position;e.position={scrollbarWidth:function(){if(n!==t)return n;var r,i,s=e("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=s.children()[0];return e("body").append(s),r=o.offsetWidth,s.css("overflow","scroll"),i=o.offsetWidth,r===i&&(i=s[0].clientWidth),s.remove(),n=r-i},getScrollInfo:function(t){var n=t.isWindow?"":t.element.css("overflow-x"),r=t.isWindow?"":t.element.css("overflow-y"),i=n==="scroll"||n==="auto"&&t.width<t.element[0].scrollWidth,s=r==="scroll"||r==="auto"&&t.height<t.element[0].scrollHeight;return{width:i?e.position.scrollbarWidth():0,height:s?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var n=e(t||window),r=e.isWindow(n[0]);return{element:n,isWindow:r,offset:n.offset()||{left:0,top:0},scrollLeft:n.scrollLeft(),scrollTop:n.scrollTop(),width:r?n.width():n.outerWidth(),height:r?n.height():n.outerHeight()}}},e.fn.position=function(t){if(!t||!t.of)return c.apply(this,arguments);t=e.extend({},t);var n,l,d,v,m,g=e(t.of),y=e.position.getWithinInfo(t.within),b=e.position.getScrollInfo(y),w=g[0],E=(t.collision||"flip").split(" "),S={};return w.nodeType===9?(l=g.width(),d=g.height(),v={top:0,left:0}):e.isWindow(w)?(l=g.width(),d=g.height(),v={top:g.scrollTop(),left:g.scrollLeft()}):w.preventDefault?(t.at="left top",l=d=0,v={top:w.pageY,left:w.pageX}):(l=g.outerWidth(),d=g.outerHeight(),v=g.offset()),m=e.extend({},v),e.each(["my","at"],function(){var e=(t[this]||"").split(" "),n,r;e.length===1&&(e=o.test(e[0])?e.concat(["center"]):u.test(e[0])?["center"].concat(e):["center","center"]),e[0]=o.test(e[0])?e[0]:"center",e[1]=u.test(e[1])?e[1]:"center",n=a.exec(e[0]),r=a.exec(e[1]),S[this]=[n?n[0]:0,r?r[0]:0],t[this]=[f.exec(e[0])[0],f.exec(e[1])[0]]}),E.length===1&&(E[1]=E[0]),t.at[0]==="right"?m.left+=l:t.at[0]==="center"&&(m.left+=l/2),t.at[1]==="bottom"?m.top+=d:t.at[1]==="center"&&(m.top+=d/2),n=h(S.at,l,d),m.left+=n[0],m.top+=n[1],this.each(function(){var o,u,a=e(this),f=a.outerWidth(),c=a.outerHeight(),w=p(this,"marginLeft"),x=p(this,"marginTop"),T=f+w+p(this,"marginRight")+b.width,N=c+x+p(this,"marginBottom")+b.height,C=e.extend({},m),k=h(S.my,a.outerWidth(),a.outerHeight());t.my[0]==="right"?C.left-=f:t.my[0]==="center"&&(C.left-=f/2),t.my[1]==="bottom"?C.top-=c:t.my[1]==="center"&&(C.top-=c/2),C.left+=k[0],C.top+=k[1],e.support.offsetFractions||(C.left=s(C.left),C.top=s(C.top)),o={marginLeft:w,marginTop:x},e.each(["left","top"],function(r,i){e.ui.position[E[r]]&&e.ui.position[E[r]][i](C,{targetWidth:l,targetHeight:d,elemWidth:f,elemHeight:c,collisionPosition:o,collisionWidth:T,collisionHeight:N,offset:[n[0]+k[0],n[1]+k[1]],my:t.my,at:t.at,within:y,elem:a})}),e.fn.bgiframe&&a.bgiframe(),t.using&&(u=function(e){var n=v.left-C.left,s=n+l-f,o=v.top-C.top,u=o+d-c,h={target:{element:g,left:v.left,top:v.top,width:l,height:d},element:{element:a,left:C.left,top:C.top,width:f,height:c},horizontal:s<0?"left":n>0?"right":"center",vertical:u<0?"top":o>0?"bottom":"middle"};l<f&&i(n+s)<l&&(h.horizontal="center"),d<c&&i(o+u)<d&&(h.vertical="middle"),r(i(n),i(s))>r(i(o),i(u))?h.important="horizontal":h.important="vertical",t.using.call(this,e,h)}),a.offset(e.extend(C,{using:u}))})},e.ui.position={fit:{left:function(e,t){var n=t.within,i=n.isWindow?n.scrollLeft:n.offset.left,s=n.width,o=e.left-t.collisionPosition.marginLeft,u=i-o,a=o+t.collisionWidth-s-i,f;t.collisionWidth>s?u>0&&a<=0?(f=e.left+u+t.collisionWidth-s-i,e.left+=u-f):a>0&&u<=0?e.left=i:u>a?e.left=i+s-t.collisionWidth:e.left=i:u>0?e.left+=u:a>0?e.left-=a:e.left=r(e.left-o,e.left)},top:function(e,t){var n=t.within,i=n.isWindow?n.scrollTop:n.offset.top,s=t.within.height,o=e.top-t.collisionPosition.marginTop,u=i-o,a=o+t.collisionHeight-s-i,f;t.collisionHeight>s?u>0&&a<=0?(f=e.top+u+t.collisionHeight-s-i,e.top+=u-f):a>0&&u<=0?e.top=i:u>a?e.top=i+s-t.collisionHeight:e.top=i:u>0?e.top+=u:a>0?e.top-=a:e.top=r(e.top-o,e.top)}},flip:{left:function(e,t){var n=t.within,r=n.offset.left+n.scrollLeft,s=n.width,o=n.isWindow?n.scrollLeft:n.offset.left,u=e.left-t.collisionPosition.marginLeft,a=u-o,f=u+t.collisionWidth-s-o,l=t.my[0]==="left"?-t.elemWidth:t.my[0]==="right"?t.elemWidth:0,c=t.at[0]==="left"?t.targetWidth:t.at[0]==="right"?-t.targetWidth:0,h=-2*t.offset[0],p,d;if(a<0){p=e.left+l+c+h+t.collisionWidth-s-r;if(p<0||p<i(a))e.left+=l+c+h}else if(f>0){d=e.left-t.collisionPosition.marginLeft+l+c+h-o;if(d>0||i(d)<f)e.left+=l+c+h}},top:function(e,t){var n=t.within,r=n.offset.top+n.scrollTop,s=n.height,o=n.isWindow?n.scrollTop:n.offset.top,u=e.top-t.collisionPosition.marginTop,a=u-o,f=u+t.collisionHeight-s-o,l=t.my[1]==="top",c=l?-t.elemHeight:t.my[1]==="bottom"?t.elemHeight:0,h=t.at[1]==="top"?t.targetHeight:t.at[1]==="bottom"?-t.targetHeight:0,p=-2*t.offset[1],d,v;a<0?(v=e.top+c+h+p+t.collisionHeight-s-r,e.top+c+h+p>a&&(v<0||v<i(a))&&(e.top+=c+h+p)):f>0&&(d=e.top-t.collisionPosition.marginTop+c+h+p-o,e.top+c+h+p>f&&(d>0||i(d)<f)&&(e.top+=c+h+p))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,n,r,i,s,o=document.getElementsByTagName("body")[0],u=document.createElement("div");t=document.createElement(o?"div":"body"),r={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},o&&e.extend(r,{position:"absolute",left:"-1000px",top:"-1000px"});for(s in r)t.style[s]=r[s];t.appendChild(u),n=o||document.documentElement,n.insertBefore(t,n.firstChild),u.style.cssText="position: absolute; left: 10.7432222px;",i=e(u).offset().left,e.support.offsetFractions=i>10&&i<11,t.innerHTML="",n.removeChild(t)}(),e.uiBackCompat!==!1&&function(e){var n=e.fn.position;e.fn.position=function(r){if(!r||!r.offset)return n.call(this,r);var i=r.offset.split(" "),s=r.at.split(" ");return i.length===1&&(i[1]=i[0]),/^\d/.test(i[0])&&(i[0]="+"+i[0]),/^\d/.test(i[1])&&(i[1]="+"+i[1]),s.length===1&&(/left|center|right/.test(s[0])?s[1]="center":(s[1]=s[0],s[0]="center")),n.call(this,e.extend(r,{at:s[0]+i[0]+" "+s[1]+i[1],offset:t}))}}(jQuery)})(jQuery);(function(e,t){var n=0,r={},i={};r.height=r.paddingTop=r.paddingBottom=r.borderTopWidth=r.borderBottomWidth="hide",i.height=i.paddingTop=i.paddingBottom=i.borderTopWidth=i.borderBottomWidth="show",e.widget("ui.accordion",{version:"1.9.2",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},_create:function(){var t=this.accordionId="ui-accordion-"+(this.element.attr("id")||++n),r=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset"),this.headers=this.element.find(r.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all"),this._hoverable(this.headers),this._focusable(this.headers),this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").hide(),!r.collapsible&&(r.active===!1||r.active==null)&&(r.active=0),r.active<0&&(r.active+=this.headers.length),this.active=this._findActive(r.active).addClass("ui-accordion-header-active ui-state-active").toggleClass("ui-corner-all ui-corner-top"),this.active.next().addClass("ui-accordion-content-active").show(),this._createIcons(),this.refresh(),this.element.attr("role","tablist"),this.headers.attr("role","tab").each(function(n){var r=e(this),i=r.attr("id"),s=r.next(),o=s.attr("id");i||(i=t+"-header-"+n,r.attr("id",i)),o||(o=t+"-panel-"+n,s.attr("id",o)),r.attr("aria-controls",o),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false",tabIndex:-1}).next().attr({"aria-expanded":"false","aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true",tabIndex:0}).next().attr({"aria-expanded":"true","aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._on(this.headers,{keydown:"_keydown"}),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._setupEvents(r.event)},_getCreateEventData:function(){return{header:this.active,content:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),this._destroyIcons(),e=this.headers.next().css("display","").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").each(function(){/^ui-accordion/.test(this.id)&&this.removeAttribute("id")}),this.options.heightStyle!=="content"&&e.css("height","")},_setOption:function(e,t){if(e==="active"){this._activate(t);return}e==="event"&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),e==="collapsible"&&!t&&this.options.active===!1&&this._activate(0),e==="icons"&&(this._destroyIcons(),t&&this._createIcons()),e==="disabled"&&this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)},_keydown:function(t){if(t.altKey||t.ctrlKey)return;var n=e.ui.keyCode,r=this.headers.length,i=this.headers.index(t.target),s=!1;switch(t.keyCode){case n.RIGHT:case n.DOWN:s=this.headers[(i+1)%r];break;case n.LEFT:case n.UP:s=this.headers[(i-1+r)%r];break;case n.SPACE:case n.ENTER:this._eventHandler(t);break;case n.HOME:s=this.headers[0];break;case n.END:s=this.headers[r-1]}s&&(e(t.target).attr("tabIndex",-1),e(s).attr("tabIndex",0),s.focus(),t.preventDefault())},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t,n,r=this.options.heightStyle,i=this.element.parent();r==="fill"?(e.support.minHeight||(n=i.css("overflow"),i.css("overflow","hidden")),t=i.height(),this.element.siblings(":visible").each(function(){var n=e(this),r=n.css("position");if(r==="absolute"||r==="fixed")return;t-=n.outerHeight(!0)}),n&&i.css("overflow",n),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):r==="auto"&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var n=this._findActive(t)[0];if(n===this.active[0])return;n=n||this.active[0],this._eventHandler({target:n,currentTarget:n,preventDefault:e.noop})},_findActive:function(t){return typeof t=="number"?this.headers.eq(t):e()},_setupEvents:function(t){var n={};if(!t)return;e.each(t.split(" "),function(e,t){n[t]="_eventHandler"}),this._on(this.headers,n)},_eventHandler:function(t){var n=this.options,r=this.active,i=e(t.currentTarget),s=i[0]===r[0],o=s&&n.collapsible,u=o?e():i.next(),a=r.next(),f={oldHeader:r,oldPanel:a,newHeader:o?e():i,newPanel:u};t.preventDefault();if(s&&!n.collapsible||this._trigger("beforeActivate",t,f)===!1)return;n.active=o?!1:this.headers.index(i),this.active=s?e():i,this._toggle(f),r.removeClass("ui-accordion-header-active ui-state-active"),n.icons&&r.children(".ui-accordion-header-icon").removeClass(n.icons.activeHeader).addClass(n.icons.header),s||(i.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),n.icons&&i.children(".ui-accordion-header-icon").removeClass(n.icons.header).addClass(n.icons.activeHeader),i.next().addClass("ui-accordion-content-active"))},_toggle:function(t){var n=t.newPanel,r=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=n,this.prevHide=r,this.options.animate?this._animate(n,r,t):(r.hide(),n.show(),this._toggleComplete(t)),r.attr({"aria-expanded":"false","aria-hidden":"true"}),r.prev().attr("aria-selected","false"),n.length&&r.length?r.prev().attr("tabIndex",-1):n.length&&this.headers.filter(function(){return e(this).attr("tabIndex")===0}).attr("tabIndex",-1),n.attr({"aria-expanded":"true","aria-hidden":"false"}).prev().attr({"aria-selected":"true",tabIndex:0})},_animate:function(e,t,n){var s,o,u,a=this,f=0,l=e.length&&(!t.length||e.index()<t.index()),c=this.options.animate||{},h=l&&c.down||c,p=function(){a._toggleComplete(n)};typeof h=="number"&&(u=h),typeof h=="string"&&(o=h),o=o||h.easing||c.easing,u=u||h.duration||c.duration;if(!t.length)return e.animate(i,u,o,p);if(!e.length)return t.animate(r,u,o,p);s=e.show().outerHeight(),t.animate(r,{duration:u,easing:o,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(i,{duration:u,easing:o,complete:p,step:function(e,n){n.now=Math.round(e),n.prop!=="height"?f+=n.now:a.options.heightStyle!=="content"&&(n.now=Math.round(s-t.outerHeight()-f),f=0)}})},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),e.uiBackCompat!==!1&&(function(e,t){e.extend(t.options,{navigation:!1,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}});var n=t._create;t._create=function(){if(this.options.navigation){var t=this,r=this.element.find(this.options.header),i=r.next(),s=r.add(i).find("a").filter(this.options.navigationFilter)[0];s&&r.add(i).each(function(n){if(e.contains(this,s))return t.options.active=Math.floor(n/2),!1})}n.call(this)}}(jQuery,jQuery.ui.accordion.prototype),function(e,t){e.extend(t.options,{heightStyle:null,autoHeight:!0,clearStyle:!1,fillSpace:!1});var n=t._create,r=t._setOption;e.extend(t,{_create:function(){this.options.heightStyle=this.options.heightStyle||this._mergeHeightStyle(),n.call(this)},_setOption:function(e){if(e==="autoHeight"||e==="clearStyle"||e==="fillSpace")this.options.heightStyle=this._mergeHeightStyle();r.apply(this,arguments)},_mergeHeightStyle:function(){var e=this.options;if(e.fillSpace)return"fill";if(e.clearStyle)return"content";if(e.autoHeight)return"auto"}})}(jQuery,jQuery.ui.accordion.prototype),function(e,t){e.extend(t.options.icons,{activeHeader:null,headerSelected:"ui-icon-triangle-1-s"});var n=t._createIcons;t._createIcons=function(){this.options.icons&&(this.options.icons.activeHeader=this.options.icons.activeHeader||this.options.icons.headerSelected),n.call(this)}}(jQuery,jQuery.ui.accordion.prototype),function(e,t){t.activate=t._activate;var n=t._findActive;t._findActive=function(e){return e===-1&&(e=!1),e&&typeof e!="number"&&(e=this.headers.index(this.headers.filter(e)),e===-1&&(e=!1)),n.call(this,e)}}(jQuery,jQuery.ui.accordion.prototype),jQuery.ui.accordion.prototype.resize=jQuery.ui.accordion.prototype.refresh,function(e,t){e.extend(t.options,{change:null,changestart:null});var n=t._trigger;t._trigger=function(e,t,r){var i=n.apply(this,arguments);return i?(e==="beforeActivate"?i=n.call(this,"changestart",t,{oldHeader:r.oldHeader,oldContent:r.oldPanel,newHeader:r.newHeader,newContent:r.newPanel}):e==="activate"&&(i=n.call(this,"change",t,{oldHeader:r.oldHeader,oldContent:r.oldPanel,newHeader:r.newHeader,newContent:r.newPanel})),i):!1}}(jQuery,jQuery.ui.accordion.prototype),function(e,t){e.extend(t.options,{animate:null,animated:"slide"});var n=t._create;t._create=function(){var e=this.options;e.animate===null&&(e.animated?e.animated==="slide"?e.animate=300:e.animated==="bounceslide"?e.animate={duration:200,down:{easing:"easeOutBounce",duration:1e3}}:e.animate=e.animated:e.animate=!1),n.call(this)}}(jQuery,jQuery.ui.accordion.prototype))})(jQuery);(function(e,t){var n=0;e.widget("ui.autocomplete",{version:"1.9.2",defaultElement:"<input>",options:{appendTo:"body",autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var t,n,r;this.isMultiLine=this._isMultiLine(),this.valueMethod=this.element[this.element.is("input,textarea")?"val":"text"],this.isNewMenu=!0,this.element.addClass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(i){if(this.element.prop("readOnly")){t=!0,r=!0,n=!0;return}t=!1,r=!1,n=!1;var s=e.ui.keyCode;switch(i.keyCode){case s.PAGE_UP:t=!0,this._move("previousPage",i);break;case s.PAGE_DOWN:t=!0,this._move("nextPage",i);break;case s.UP:t=!0,this._keyEvent("previous",i);break;case s.DOWN:t=!0,this._keyEvent("next",i);break;case s.ENTER:case s.NUMPAD_ENTER:this.menu.active&&(t=!0,i.preventDefault(),this.menu.select(i));break;case s.TAB:this.menu.active&&this.menu.select(i);break;case s.ESCAPE:this.menu.element.is(":visible")&&(this._value(this.term),this.close(i),i.preventDefault());break;default:n=!0,this._searchTimeout(i)}},keypress:function(r){if(t){t=!1,r.preventDefault();return}if(n)return;var i=e.ui.keyCode;switch(r.keyCode){case i.PAGE_UP:this._move("previousPage",r);break;case i.PAGE_DOWN:this._move("nextPage",r);break;case i.UP:this._keyEvent("previous",r);break;case i.DOWN:this._keyEvent("next",r)}},input:function(e){if(r){r=!1,e.preventDefault();return}this._searchTimeout(e)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(e){if(this.cancelBlur){delete this.cancelBlur;return}clearTimeout(this.searching),this.close(e),this._change(e)}}),this._initSource(),this.menu=e("<ul>").addClass("ui-autocomplete").appendTo(this.document.find(this.options.appendTo||"body")[0]).menu({input:e(),role:null}).zIndex(this.element.zIndex()+1).hide().data("menu"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault(),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur});var n=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(r){r.target!==t.element[0]&&r.target!==n&&!e.contains(n,r.target)&&t.close()})})},menufocus:function(t,n){if(this.isNewMenu){this.isNewMenu=!1;if(t.originalEvent&&/^mouse/.test(t.originalEvent.type)){this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalEvent)});return}}var r=n.item.data("ui-autocomplete-item")||n.item.data("item.autocomplete");!1!==this._trigger("focus",t,{item:r})?t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(r.value):this.liveRegion.text(r.value)},menuselect:function(e,t){var n=t.item.data("ui-autocomplete-item")||t.item.data("item.autocomplete"),r=this.previous;this.element[0]!==this.document[0].activeElement&&(this.element.focus(),this.previous=r,this._delay(function(){this.previous=r,this.selectedItem=n})),!1!==this._trigger("select",e,{item:n})&&this._value(n.value),this.term=this._value(),this.close(e),this.selectedItem=n}}),this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("ui-helper-hidden-accessible").insertAfter(this.element),e.fn.bgiframe&&this.menu.element.bgiframe(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(e,t){this._super(e,t),e==="source"&&this._initSource(),e==="appendTo"&&this.menu.element.appendTo(this.document.find(t||"body")[0]),e==="disabled"&&t&&this.xhr&&this.xhr.abort()},_isMultiLine:function(){return this.element.is("textarea")?!0:this.element.is("input")?!1:this.element.prop("isContentEditable")},_initSource:function(){var t,n,r=this;e.isArray(this.options.source)?(t=this.options.source,this.source=function(n,r){r(e.ui.autocomplete.filter(t,n.term))}):typeof this.options.source=="string"?(n=this.options.source,this.source=function(t,i){r.xhr&&r.xhr.abort(),r.xhr=e.ajax({url:n,data:t,dataType:"json",success:function(e){i(e)},error:function(){i([])}})}):this.source=this.options.source},_searchTimeout:function(e){clearTimeout(this.searching),this.searching=this._delay(function(){this.term!==this._value()&&(this.selectedItem=null,this.search(null,e))},this.options.delay)},search:function(e,t){e=e!=null?e:this._value(),this.term=this._value();if(e.length<this.options.minLength)return this.close(t);if(this._trigger("search",t)===!1)return;return this._search(e)},_search:function(e){this.pending++,this.element.addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:e},this._response())},_response:function(){var e=this,t=++n;return function(r){t===n&&e.__response(r),e.pending--,e.pending||e.element.removeClass("ui-autocomplete-loading")}},__response:function(e){e&&(e=this._normalize(e)),this._trigger("response",null,{content:e}),!this.options.disabled&&e&&e.length&&!this.cancelSearch?(this._suggest(e),this._trigger("open")):this._close()},close:function(e){this.cancelSearch=!0,this._close(e)},_close:function(e){this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",e))},_change:function(e){this.previous!==this._value()&&this._trigger("change",e,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:e.map(t,function(t){return typeof t=="string"?{label:t,value:t}:e.extend({label:t.label||t.value,value:t.value||t.label},t)})},_suggest:function(t){var n=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(n,t),this.menu.refresh(),n.show(),this._resizeMenu(),n.position(e.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next()},_resizeMenu:function(){var e=this.menu.element;e.outerWidth(Math.max(e.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(t,n){var r=this;e.each(n,function(e,n){r._renderItemData(t,n)})},_renderItemData:function(e,t){return this._renderItem(e,t).data("ui-autocomplete-item",t)},_renderItem:function(t,n){return e("<li>").append(e("<a>").text(n.label)).appendTo(t)},_move:function(e,t){if(!this.menu.element.is(":visible")){this.search(null,t);return}if(this.menu.isFirstItem()&&/^previous/.test(e)||this.menu.isLastItem()&&/^next/.test(e)){this._value(this.term),this.menu.blur();return}this.menu[e](t)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(e,t){if(!this.isMultiLine||this.menu.element.is(":visible"))this._move(e,t),t.preventDefault()}}),e.extend(e.ui.autocomplete,{escapeRegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,n){var r=new RegExp(e.ui.autocomplete.escapeRegex(n),"i");return e.grep(t,function(e){return r.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var t;this._superApply(arguments);if(this.options.disabled||this.cancelSearch)return;e&&e.length?t=this.options.messages.results(e.length):t=this.options.messages.noResults,this.liveRegion.text(t)}})})(jQuery);(function(e,t){var n,r,i,s,o="ui-button ui-widget ui-state-default ui-corner-all",u="ui-state-hover ui-state-active ",a="ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",f=function(){var t=e(this).find(":ui-button");setTimeout(function(){t.button("refresh")},1)},l=function(t){var n=t.name,r=t.form,i=e([]);return n&&(r?i=e(r).find("[name='"+n+"']"):i=e("[name='"+n+"']",t.ownerDocument).filter(function(){return!this.form})),i};e.widget("ui.button",{version:"1.9.2",defaultElement:"<button>",options:{disabled:null,text:!0,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset"+this.eventNamespace).bind("reset"+this.eventNamespace,f),typeof this.options.disabled!="boolean"?this.options.disabled=!!this.element.prop("disabled"):this.element.prop("disabled",this.options.disabled),this._determineButtonType(),this.hasTitle=!!this.buttonElement.attr("title");var t=this,u=this.options,a=this.type==="checkbox"||this.type==="radio",c=a?"":"ui-state-active",h="ui-state-focus";u.label===null&&(u.label=this.type==="input"?this.buttonElement.val():this.buttonElement.html()),this._hoverable(this.buttonElement),this.buttonElement.addClass(o).attr("role","button").bind("mouseenter"+this.eventNamespace,function(){if(u.disabled)return;this===n&&e(this).addClass("ui-state-active")}).bind("mouseleave"+this.eventNamespace,function(){if(u.disabled)return;e(this).removeClass(c)}).bind("click"+this.eventNamespace,function(e){u.disabled&&(e.preventDefault(),e.stopImmediatePropagation())}),this.element.bind("focus"+this.eventNamespace,function(){t.buttonElement.addClass(h)}).bind("blur"+this.eventNamespace,function(){t.buttonElement.removeClass(h)}),a&&(this.element.bind("change"+this.eventNamespace,function(){if(s)return;t.refresh()}),this.buttonElement.bind("mousedown"+this.eventNamespace,function(e){if(u.disabled)return;s=!1,r=e.pageX,i=e.pageY}).bind("mouseup"+this.eventNamespace,function(e){if(u.disabled)return;if(r!==e.pageX||i!==e.pageY)s=!0})),this.type==="checkbox"?this.buttonElement.bind("click"+this.eventNamespace,function(){if(u.disabled||s)return!1;e(this).toggleClass("ui-state-active"),t.buttonElement.attr("aria-pressed",t.element[0].checked)}):this.type==="radio"?this.buttonElement.bind("click"+this.eventNamespace,function(){if(u.disabled||s)return!1;e(this).addClass("ui-state-active"),t.buttonElement.attr("aria-pressed","true");var n=t.element[0];l(n).not(n).map(function(){return e(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")}):(this.buttonElement.bind("mousedown"+this.eventNamespace,function(){if(u.disabled)return!1;e(this).addClass("ui-state-active"),n=this,t.document.one("mouseup",function(){n=null})}).bind("mouseup"+this.eventNamespace,function(){if(u.disabled)return!1;e(this).removeClass("ui-state-active")}).bind("keydown"+this.eventNamespace,function(t){if(u.disabled)return!1;(t.keyCode===e.ui.keyCode.SPACE||t.keyCode===e.ui.keyCode.ENTER)&&e(this).addClass("ui-state-active")}).bind("keyup"+this.eventNamespace,function(){e(this).removeClass("ui-state-active")}),this.buttonElement.is("a")&&this.buttonElement.keyup(function(t){t.keyCode===e.ui.keyCode.SPACE&&e(this).click()})),this._setOption("disabled",u.disabled),this._resetButton()},_determineButtonType:function(){var e,t,n;this.element.is("[type=checkbox]")?this.type="checkbox":this.element.is("[type=radio]")?this.type="radio":this.element.is("input")?this.type="input":this.type="button",this.type==="checkbox"||this.type==="radio"?(e=this.element.parents().last(),t="label[for='"+this.element.attr("id")+"']",this.buttonElement=e.find(t),this.buttonElement.length||(e=e.length?e.siblings():this.element.siblings(),this.buttonElement=e.filter(t),this.buttonElement.length||(this.buttonElement=e.find(t))),this.element.addClass("ui-helper-hidden-accessible"),n=this.element.is(":checked"),n&&this.buttonElement.addClass("ui-state-active"),this.buttonElement.prop("aria-pressed",n)):this.buttonElement=this.element},widget:function(){return this.buttonElement},_destroy:function(){this.element.removeClass("ui-helper-hidden-accessible"),this.buttonElement.removeClass(o+" "+u+" "+a).removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html()),this.hasTitle||this.buttonElement.removeAttr("title")},_setOption:function(e,t){this._super(e,t);if(e==="disabled"){t?this.element.prop("disabled",!0):this.element.prop("disabled",!1);return}this._resetButton()},refresh:function(){var t=this.element.is("input, button")?this.element.is(":disabled"):this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOption("disabled",t),this.type==="radio"?l(this.element[0]).each(function(){e(this).is(":checked")?e(this).button("widget").addClass("ui-state-active").attr("aria-pressed","true"):e(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")}):this.type==="checkbox"&&(this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false"))},_resetButton:function(){if(this.type==="input"){this.options.label&&this.element.val(this.options.label);return}var t=this.buttonElement.removeClass(a),n=e("<span></span>",this.document[0]).addClass("ui-button-text").html(this.options.label).appendTo(t.empty()).text(),r=this.options.icons,i=r.primary&&r.secondary,s=[];r.primary||r.secondary?(this.options.text&&s.push("ui-button-text-icon"+(i?"s":r.primary?"-primary":"-secondary")),r.primary&&t.prepend("<span class='ui-button-icon-primary ui-icon "+r.primary+"'></span>"),r.secondary&&t.append("<span class='ui-button-icon-secondary ui-icon "+r.secondary+"'></span>"),this.options.text||(s.push(i?"ui-button-icons-only":"ui-button-icon-only"),this.hasTitle||t.attr("title",e.trim(n)))):s.push("ui-button-text-only"),t.addClass(s.join(" "))}}),e.widget("ui.buttonset",{version:"1.9.2",options:{items:"button, input[type=button], input[type=submit], input[type=reset], input[type=checkbox], input[type=radio], a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(e,t){e==="disabled"&&this.buttons.button("option",e,t),this._super(e,t)},refresh:function(){var t=this.element.css("direction")==="rtl";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(t?"ui-corner-right":"ui-corner-left").end().filter(":last").addClass(t?"ui-corner-left":"ui-corner-right").end().end()},_destroy:function(){this.element.removeClass("ui-buttonset"),this.buttons.map(function(){return e(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy")}})})(jQuery);(function($,undefined){function Datepicker(){this.debug=!1,this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},$.extend(this._defaults,this.regional[""]),this.dpDiv=bindHover($('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function bindHover(e){var t="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.delegate(t,"mouseout",function(){$(this).removeClass("ui-state-hover"),this.className.indexOf("ui-datepicker-prev")!=-1&&$(this).removeClass("ui-datepicker-prev-hover"),this.className.indexOf("ui-datepicker-next")!=-1&&$(this).removeClass("ui-datepicker-next-hover")}).delegate(t,"mouseover",function(){$.datepicker._isDisabledDatepicker(instActive.inline?e.parent()[0]:instActive.input[0])||($(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),$(this).addClass("ui-state-hover"),this.className.indexOf("ui-datepicker-prev")!=-1&&$(this).addClass("ui-datepicker-prev-hover"),this.className.indexOf("ui-datepicker-next")!=-1&&$(this).addClass("ui-datepicker-next-hover"))})}function extendRemove(e,t){$.extend(e,t);for(var n in t)if(t[n]==null||t[n]==undefined)e[n]=t[n];return e}$.extend($.ui,{datepicker:{version:"1.9.2"}});var PROP_NAME="datepicker",dpuuid=(new Date).getTime(),instActive;$.extend(Datepicker.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(e){return extendRemove(this._defaults,e||{}),this},_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults){var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}var nodeName=target.nodeName.toLowerCase(),inline=nodeName=="div"||nodeName=="span";target.id||(this.uuid+=1,target.id="dp"+this.uuid);var inst=this._newInst($(target),inline);inst.settings=$.extend({},settings||{},inlineSettings||{}),nodeName=="input"?this._connectDatepicker(target,inst):inline&&this._inlineDatepicker(target,inst)},_newInst:function(e,t){var n=e[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1");return{id:n,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:t,dpDiv:t?bindHover($('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')):this.dpDiv}},_connectDatepicker:function(e,t){var n=$(e);t.append=$([]),t.trigger=$([]);if(n.hasClass(this.markerClassName))return;this._attachments(n,t),n.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,n,r){t.settings[n]=r}).bind("getData.datepicker",function(e,n){return this._get(t,n)}),this._autoSize(t),$.data(e,PROP_NAME,t),t.settings.disabled&&this._disableDatepicker(e)},_attachments:function(e,t){var n=this._get(t,"appendText"),r=this._get(t,"isRTL");t.append&&t.append.remove(),n&&(t.append=$('<span class="'+this._appendClass+'">'+n+"</span>"),e[r?"before":"after"](t.append)),e.unbind("focus",this._showDatepicker),t.trigger&&t.trigger.remove();var i=this._get(t,"showOn");(i=="focus"||i=="both")&&e.focus(this._showDatepicker);if(i=="button"||i=="both"){var s=this._get(t,"buttonText"),o=this._get(t,"buttonImage");t.trigger=$(this._get(t,"buttonImageOnly")?$("<img/>").addClass(this._triggerClass).attr({src:o,alt:s,title:s}):$('<button type="button"></button>').addClass(this._triggerClass).html(o==""?s:$("<img/>").attr({src:o,alt:s,title:s}))),e[r?"before":"after"](t.trigger),t.trigger.click(function(){return $.datepicker._datepickerShowing&&$.datepicker._lastInput==e[0]?$.datepicker._hideDatepicker():$.datepicker._datepickerShowing&&$.datepicker._lastInput!=e[0]?($.datepicker._hideDatepicker(),$.datepicker._showDatepicker(e[0])):$.datepicker._showDatepicker(e[0]),!1})}},_autoSize:function(e){if(this._get(e,"autoSize")&&!e.inline){var t=new Date(2009,11,20),n=this._get(e,"dateFormat");if(n.match(/[DM]/)){var r=function(e){var t=0,n=0;for(var r=0;r<e.length;r++)e[r].length>t&&(t=e[r].length,n=r);return n};t.setMonth(r(this._get(e,n.match(/MM/)?"monthNames":"monthNamesShort"))),t.setDate(r(this._get(e,n.match(/DD/)?"dayNames":"dayNamesShort"))+20-t.getDay())}e.input.attr("size",this._formatDate(e,t).length)}},_inlineDatepicker:function(e,t){var n=$(e);if(n.hasClass(this.markerClassName))return;n.addClass(this.markerClassName).append(t.dpDiv).bind("setData.datepicker",function(e,n,r){t.settings[n]=r}).bind("getData.datepicker",function(e,n){return this._get(t,n)}),$.data(e,PROP_NAME,t),this._setDate(t,this._getDefaultDate(t),!0),this._updateDatepicker(t),this._updateAlternate(t),t.settings.disabled&&this._disableDatepicker(e),t.dpDiv.css("display","block")},_dialogDatepicker:function(e,t,n,r,i){var s=this._dialogInst;if(!s){this.uuid+=1;var o="dp"+this.uuid;this._dialogInput=$('<input type="text" id="'+o+'" style="position: absolute; top: -100px; width: 0px;"/>'),this._dialogInput.keydown(this._doKeyDown),$("body").append(this._dialogInput),s=this._dialogInst=this._newInst(this._dialogInput,!1),s.settings={},$.data(this._dialogInput[0],PROP_NAME,s)}extendRemove(s.settings,r||{}),t=t&&t.constructor==Date?this._formatDate(s,t):t,this._dialogInput.val(t),this._pos=i?i.length?i:[i.pageX,i.pageY]:null;if(!this._pos){var u=document.documentElement.clientWidth,a=document.documentElement.clientHeight,f=document.documentElement.scrollLeft||document.body.scrollLeft,l=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[u/2-100+f,a/2-150+l]}return this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),s.settings.onSelect=n,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),$.blockUI&&$.blockUI(this.dpDiv),$.data(this._dialogInput[0],PROP_NAME,s),this},_destroyDatepicker:function(e){var t=$(e),n=$.data(e,PROP_NAME);if(!t.hasClass(this.markerClassName))return;var r=e.nodeName.toLowerCase();$.removeData(e,PROP_NAME),r=="input"?(n.append.remove(),n.trigger.remove(),t.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):(r=="div"||r=="span")&&t.removeClass(this.markerClassName).empty()},_enableDatepicker:function(e){var t=$(e),n=$.data(e,PROP_NAME);if(!t.hasClass(this.markerClassName))return;var r=e.nodeName.toLowerCase();if(r=="input")e.disabled=!1,n.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""});else if(r=="div"||r=="span"){var i=t.children("."+this._inlineClass);i.children().removeClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)}this._disabledInputs=$.map(this._disabledInputs,function(t){return t==e?null:t})},_disableDatepicker:function(e){var t=$(e),n=$.data(e,PROP_NAME);if(!t.hasClass(this.markerClassName))return;var r=e.nodeName.toLowerCase();if(r=="input")e.disabled=!0,n.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"});else if(r=="div"||r=="span"){var i=t.children("."+this._inlineClass);i.children().addClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)}this._disabledInputs=$.map(this._disabledInputs,function(t){return t==e?null:t}),this._disabledInputs[this._disabledInputs.length]=e},_isDisabledDatepicker:function(e){if(!e)return!1;for(var t=0;t<this._disabledInputs.length;t++)if(this._disabledInputs[t]==e)return!0;return!1},_getInst:function(e){try{return $.data(e,PROP_NAME)}catch(t){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(e,t,n){var r=this._getInst(e);if(arguments.length==2&&typeof t=="string")return t=="defaults"?$.extend({},$.datepicker._defaults):r?t=="all"?$.extend({},r.settings):this._get(r,t):null;var i=t||{};typeof t=="string"&&(i={},i[t]=n);if(r){this._curInst==r&&this._hideDatepicker();var s=this._getDateDatepicker(e,!0),o=this._getMinMaxDate(r,"min"),u=this._getMinMaxDate(r,"max");extendRemove(r.settings,i),o!==null&&i.dateFormat!==undefined&&i.minDate===undefined&&(r.settings.minDate=this._formatDate(r,o)),u!==null&&i.dateFormat!==undefined&&i.maxDate===undefined&&(r.settings.maxDate=this._formatDate(r,u)),this._attachments($(e),r),this._autoSize(r),this._setDate(r,s),this._updateAlternate(r),this._updateDatepicker(r)}},_changeDatepicker:function(e,t,n){this._optionDatepicker(e,t,n)},_refreshDatepicker:function(e){var t=this._getInst(e);t&&this._updateDatepicker(t)},_setDateDatepicker:function(e,t){var n=this._getInst(e);n&&(this._setDate(n,t),this._updateDatepicker(n),this._updateAlternate(n))},_getDateDatepicker:function(e,t){var n=this._getInst(e);return n&&!n.inline&&this._setDateFromField(n,t),n?this._getDate(n):null},_doKeyDown:function(e){var t=$.datepicker._getInst(e.target),n=!0,r=t.dpDiv.is(".ui-datepicker-rtl");t._keyEvent=!0;if($.datepicker._datepickerShowing)switch(e.keyCode){case 9:$.datepicker._hideDatepicker(),n=!1;break;case 13:var i=$("td."+$.datepicker._dayOverClass+":not(."+$.datepicker._currentClass+")",t.dpDiv);i[0]&&$.datepicker._selectDay(e.target,t.selectedMonth,t.selectedYear,i[0]);var s=$.datepicker._get(t,"onSelect");if(s){var o=$.datepicker._formatDate(t);s.apply(t.input?t.input[0]:null,[o,t])}else $.datepicker._hideDatepicker();return!1;case 27:$.datepicker._hideDatepicker();break;case 33:$.datepicker._adjustDate(e.target,e.ctrlKey?-$.datepicker._get(t,"stepBigMonths"):-$.datepicker._get(t,"stepMonths"),"M");break;case 34:$.datepicker._adjustDate(e.target,e.ctrlKey?+$.datepicker._get(t,"stepBigMonths"):+$.datepicker._get(t,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&$.datepicker._clearDate(e.target),n=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&$.datepicker._gotoToday(e.target),n=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&$.datepicker._adjustDate(e.target,r?1:-1,"D"),n=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&$.datepicker._adjustDate(e.target,e.ctrlKey?-$.datepicker._get(t,"stepBigMonths"):-$.datepicker._get(t,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&$.datepicker._adjustDate(e.target,-7,"D"),n=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&$.datepicker._adjustDate(e.target,r?-1:1,"D"),n=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&$.datepicker._adjustDate(e.target,e.ctrlKey?+$.datepicker._get(t,"stepBigMonths"):+$.datepicker._get(t,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&$.datepicker._adjustDate(e.target,7,"D"),n=e.ctrlKey||e.metaKey;break;default:n=!1}else e.keyCode==36&&e.ctrlKey?$.datepicker._showDatepicker(this):n=!1;n&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(e){var t=$.datepicker._getInst(e.target);if($.datepicker._get(t,"constrainInput")){var n=$.datepicker._possibleChars($.datepicker._get(t,"dateFormat")),r=String.fromCharCode(e.charCode==undefined?e.keyCode:e.charCode);return e.ctrlKey||e.metaKey||r<" "||!n||n.indexOf(r)>-1}},_doKeyUp:function(e){var t=$.datepicker._getInst(e.target);if(t.input.val()!=t.lastVal)try{var n=$.datepicker.parseDate($.datepicker._get(t,"dateFormat"),t.input?t.input.val():null,$.datepicker._getFormatConfig(t));n&&($.datepicker._setDateFromField(t),$.datepicker._updateAlternate(t),$.datepicker._updateDatepicker(t))}catch(r){$.datepicker.log(r)}return!0},_showDatepicker:function(e){e=e.target||e,e.nodeName.toLowerCase()!="input"&&(e=$("input",e.parentNode)[0]);if($.datepicker._isDisabledDatepicker(e)||$.datepicker._lastInput==e)return;var t=$.datepicker._getInst(e);$.datepicker._curInst&&$.datepicker._curInst!=t&&($.datepicker._curInst.dpDiv.stop(!0,!0),t&&$.datepicker._datepickerShowing&&$.datepicker._hideDatepicker($.datepicker._curInst.input[0]));var n=$.datepicker._get(t,"beforeShow"),r=n?n.apply(e,[e,t]):{};if(r===!1)return;extendRemove(t.settings,r),t.lastVal=null,$.datepicker._lastInput=e,$.datepicker._setDateFromField(t),$.datepicker._inDialog&&(e.value=""),$.datepicker._pos||($.datepicker._pos=$.datepicker._findPos(e),$.datepicker._pos[1]+=e.offsetHeight);var i=!1;$(e).parents().each(function(){return i|=$(this).css("position")=="fixed",!i});var s={left:$.datepicker._pos[0],top:$.datepicker._pos[1]};$.datepicker._pos=null,t.dpDiv.empty(),t.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),$.datepicker._updateDatepicker(t),s=$.datepicker._checkOffset(t,s,i),t.dpDiv.css({position:$.datepicker._inDialog&&$.blockUI?"static":i?"fixed":"absolute",display:"none",left:s.left+"px",top:s.top+"px"});if(!t.inline){var o=$.datepicker._get(t,"showAnim"),u=$.datepicker._get(t,"duration"),a=function(){var e=t.dpDiv.find("iframe.ui-datepicker-cover");if(!!e.length){var n=$.datepicker._getBorders(t.dpDiv);e.css({left:-n[0],top:-n[1],width:t.dpDiv.outerWidth(),height:t.dpDiv.outerHeight()})}};t.dpDiv.zIndex($(e).zIndex()+1),$.datepicker._datepickerShowing=!0,$.effects&&($.effects.effect[o]||$.effects[o])?t.dpDiv.show(o,$.datepicker._get(t,"showOptions"),u,a):t.dpDiv[o||"show"](o?u:null,a),(!o||!u)&&a(),t.input.is(":visible")&&!t.input.is(":disabled")&&t.input.focus(),$.datepicker._curInst=t}},_updateDatepicker:function(e){this.maxRows=4;var t=$.datepicker._getBorders(e.dpDiv);instActive=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e);var n=e.dpDiv.find("iframe.ui-datepicker-cover");!n.length||n.css({left:-t[0],top:-t[1],width:e.dpDiv.outerWidth(),height:e.dpDiv.outerHeight()}),e.dpDiv.find("."+this._dayOverClass+" a").mouseover();var r=this._getNumberOfMonths(e),i=r[1],s=17;e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),i>1&&e.dpDiv.addClass("ui-datepicker-multi-"+i).css("width",s*i+"em"),e.dpDiv[(r[0]!=1||r[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e==$.datepicker._curInst&&$.datepicker._datepickerShowing&&e.input&&e.input.is(":visible")&&!e.input.is(":disabled")&&e.input[0]!=document.activeElement&&e.input.focus();if(e.yearshtml){var o=e.yearshtml;setTimeout(function(){o===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),o=e.yearshtml=null},0)}},_getBorders:function(e){var t=function(e){return{thin:1,medium:2,thick:3}[e]||e};return[parseFloat(t(e.css("border-left-width"))),parseFloat(t(e.css("border-top-width")))]},_checkOffset:function(e,t,n){var r=e.dpDiv.outerWidth(),i=e.dpDiv.outerHeight(),s=e.input?e.input.outerWidth():0,o=e.input?e.input.outerHeight():0,u=document.documentElement.clientWidth+(n?0:$(document).scrollLeft()),a=document.documentElement.clientHeight+(n?0:$(document).scrollTop());return t.left-=this._get(e,"isRTL")?r-s:0,t.left-=n&&t.left==e.input.offset().left?$(document).scrollLeft():0,t.top-=n&&t.top==e.input.offset().top+o?$(document).scrollTop():0,t.left-=Math.min(t.left,t.left+r>u&&u>r?Math.abs(t.left+r-u):0),t.top-=Math.min(t.top,t.top+i>a&&a>i?Math.abs(i+o):0),t},_findPos:function(e){var t=this._getInst(e),n=this._get(t,"isRTL");while(e&&(e.type=="hidden"||e.nodeType!=1||$.expr.filters.hidden(e)))e=e[n?"previousSibling":"nextSibling"];var r=$(e).offset();return[r.left,r.top]},_hideDatepicker:function(e){var t=this._curInst;if(!t||e&&t!=$.data(e,PROP_NAME))return;if(this._datepickerShowing){var n=this._get(t,"showAnim"),r=this._get(t,"duration"),i=function(){$.datepicker._tidyDialog(t)};$.effects&&($.effects.effect[n]||$.effects[n])?t.dpDiv.hide(n,$.datepicker._get(t,"showOptions"),r,i):t.dpDiv[n=="slideDown"?"slideUp":n=="fadeIn"?"fadeOut":"hide"](n?r:null,i),n||i(),this._datepickerShowing=!1;var s=this._get(t,"onClose");s&&s.apply(t.input?t.input[0]:null,[t.input?t.input.val():"",t]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),$.blockUI&&($.unblockUI(),$("body").append(this.dpDiv))),this._inDialog=!1}},_tidyDialog:function(e){e.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(!$.datepicker._curInst)return;var t=$(e.target),n=$.datepicker._getInst(t[0]);(t[0].id!=$.datepicker._mainDivId&&t.parents("#"+$.datepicker._mainDivId).length==0&&!t.hasClass($.datepicker.markerClassName)&&!t.closest("."+$.datepicker._triggerClass).length&&$.datepicker._datepickerShowing&&(!$.datepicker._inDialog||!$.blockUI)||t.hasClass($.datepicker.markerClassName)&&$.datepicker._curInst!=n)&&$.datepicker._hideDatepicker()},_adjustDate:function(e,t,n){var r=$(e),i=this._getInst(r[0]);if(this._isDisabledDatepicker(r[0]))return;this._adjustInstDate(i,t+(n=="M"?this._get(i,"showCurrentAtPos"):0),n),this._updateDatepicker(i)},_gotoToday:function(e){var t=$(e),n=this._getInst(t[0]);if(this._get(n,"gotoCurrent")&&n.currentDay)n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear;else{var r=new Date;n.selectedDay=r.getDate(),n.drawMonth=n.selectedMonth=r.getMonth(),n.drawYear=n.selectedYear=r.getFullYear()}this._notifyChange(n),this._adjustDate(t)},_selectMonthYear:function(e,t,n){var r=$(e),i=this._getInst(r[0]);i["selected"+(n=="M"?"Month":"Year")]=i["draw"+(n=="M"?"Month":"Year")]=parseInt(t.options[t.selectedIndex].value,10),this._notifyChange(i),this._adjustDate(r)},_selectDay:function(e,t,n,r){var i=$(e);if($(r).hasClass(this._unselectableClass)||this._isDisabledDatepicker(i[0]))return;var s=this._getInst(i[0]);s.selectedDay=s.currentDay=$("a",r).html(),s.selectedMonth=s.currentMonth=t,s.selectedYear=s.currentYear=n,this._selectDate(e,this._formatDate(s,s.currentDay,s.currentMonth,s.currentYear))},_clearDate:function(e){var t=$(e),n=this._getInst(t[0]);this._selectDate(t,"")},_selectDate:function(e,t){var n=$(e),r=this._getInst(n[0]);t=t!=null?t:this._formatDate(r),r.input&&r.input.val(t),this._updateAlternate(r);var i=this._get(r,"onSelect");i?i.apply(r.input?r.input[0]:null,[t,r]):r.input&&r.input.trigger("change"),r.inline?this._updateDatepicker(r):(this._hideDatepicker(),this._lastInput=r.input[0],typeof r.input[0]!="object"&&r.input.focus(),this._lastInput=null)},_updateAlternate:function(e){var t=this._get(e,"altField");if(t){var n=this._get(e,"altFormat")||this._get(e,"dateFormat"),r=this._getDate(e),i=this.formatDate(n,r,this._getFormatConfig(e));$(t).each(function(){$(this).val(i)})}},noWeekends:function(e){var t=e.getDay();return[t>0&&t<6,""]},iso8601Week:function(e){var t=new Date(e.getTime());t.setDate(t.getDate()+4-(t.getDay()||7));var n=t.getTime();return t.setMonth(0),t.setDate(1),Math.floor(Math.round((n-t)/864e5)/7)+1},parseDate:function(e,t,n){if(e==null||t==null)throw"Invalid arguments";t=typeof t=="object"?t.toString():t+"";if(t=="")return null;var r=(n?n.shortYearCutoff:null)||this._defaults.shortYearCutoff;r=typeof r!="string"?r:(new Date).getFullYear()%100+parseInt(r,10);var i=(n?n.dayNamesShort:null)||this._defaults.dayNamesShort,s=(n?n.dayNames:null)||this._defaults.dayNames,o=(n?n.monthNamesShort:null)||this._defaults.monthNamesShort,u=(n?n.monthNames:null)||this._defaults.monthNames,a=-1,f=-1,l=-1,c=-1,h=!1,p=function(t){var n=y+1<e.length&&e.charAt(y+1)==t;return n&&y++,n},d=function(e){var n=p(e),r=e=="@"?14:e=="!"?20:e=="y"&&n?4:e=="o"?3:2,i=new RegExp("^\\d{1,"+r+"}"),s=t.substring(g).match(i);if(!s)throw"Missing number at position "+g;return g+=s[0].length,parseInt(s[0],10)},v=function(e,n,r){var i=$.map(p(e)?r:n,function(e,t){return[[t,e]]}).sort(function(e,t){return-(e[1].length-t[1].length)}),s=-1;$.each(i,function(e,n){var r=n[1];if(t.substr(g,r.length).toLowerCase()==r.toLowerCase())return s=n[0],g+=r.length,!1});if(s!=-1)return s+1;throw"Unknown name at position "+g},m=function(){if(t.charAt(g)!=e.charAt(y))throw"Unexpected literal at position "+g;g++},g=0;for(var y=0;y<e.length;y++)if(h)e.charAt(y)=="'"&&!p("'")?h=!1:m();else switch(e.charAt(y)){case"d":l=d("d");break;case"D":v("D",i,s);break;case"o":c=d("o");break;case"m":f=d("m");break;case"M":f=v("M",o,u);break;case"y":a=d("y");break;case"@":var b=new Date(d("@"));a=b.getFullYear(),f=b.getMonth()+1,l=b.getDate();break;case"!":var b=new Date((d("!")-this._ticksTo1970)/1e4);a=b.getFullYear(),f=b.getMonth()+1,l=b.getDate();break;case"'":p("'")?m():h=!0;break;default:m()}if(g<t.length){var w=t.substr(g);if(!/^\s+/.test(w))throw"Extra/unparsed characters found in date: "+w}a==-1?a=(new Date).getFullYear():a<100&&(a+=(new Date).getFullYear()-(new Date).getFullYear()%100+(a<=r?0:-100));if(c>-1){f=1,l=c;do{var E=this._getDaysInMonth(a,f-1);if(l<=E)break;f++,l-=E}while(!0)}var b=this._daylightSavingAdjust(new Date(a,f-1,l));if(b.getFullYear()!=a||b.getMonth()+1!=f||b.getDate()!=l)throw"Invalid date";return b},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1e7,formatDate:function(e,t,n){if(!t)return"";var r=(n?n.dayNamesShort:null)||this._defaults.dayNamesShort,i=(n?n.dayNames:null)||this._defaults.dayNames,s=(n?n.monthNamesShort:null)||this._defaults.monthNamesShort,o=(n?n.monthNames:null)||this._defaults.monthNames,u=function(t){var n=h+1<e.length&&e.charAt(h+1)==t;return n&&h++,n},a=function(e,t,n){var r=""+t;if(u(e))while(r.length<n)r="0"+r;return r},f=function(e,t,n,r){return u(e)?r[t]:n[t]},l="",c=!1;if(t)for(var h=0;h<e.length;h++)if(c)e.charAt(h)=="'"&&!u("'")?c=!1:l+=e.charAt(h);else switch(e.charAt(h)){case"d":l+=a("d",t.getDate(),2);break;case"D":l+=f("D",t.getDay(),r,i);break;case"o":l+=a("o",Math.round(((new Date(t.getFullYear(),t.getMonth(),t.getDate())).getTime()-(new Date(t.getFullYear(),0,0)).getTime())/864e5),3);break;case"m":l+=a("m",t.getMonth()+1,2);break;case"M":l+=f("M",t.getMonth(),s,o);break;case"y":l+=u("y")?t.getFullYear():(t.getYear()%100<10?"0":"")+t.getYear()%100;break;case"@":l+=t.getTime();break;case"!":l+=t.getTime()*1e4+this._ticksTo1970;break;case"'":u("'")?l+="'":c=!0;break;default:l+=e.charAt(h)}return l},_possibleChars:function(e){var t="",n=!1,r=function(t){var n=i+1<e.length&&e.charAt(i+1)==t;return n&&i++,n};for(var i=0;i<e.length;i++)if(n)e.charAt(i)=="'"&&!r("'")?n=!1:t+=e.charAt(i);else switch(e.charAt(i)){case"d":case"m":case"y":case"@":t+="0123456789";break;case"D":case"M":return null;case"'":r("'")?t+="'":n=!0;break;default:t+=e.charAt(i)}return t},_get:function(e,t){return e.settings[t]!==undefined?e.settings[t]:this._defaults[t]},_setDateFromField:function(e,t){if(e.input.val()==e.lastVal)return;var n=this._get(e,"dateFormat"),r=e.lastVal=e.input?e.input.val():null,i,s;i=s=this._getDefaultDate(e);var o=this._getFormatConfig(e);try{i=this.parseDate(n,r,o)||s}catch(u){this.log(u),r=t?"":r}e.selectedDay=i.getDate(),e.drawMonth=e.selectedMonth=i.getMonth(),e.drawYear=e.selectedYear=i.getFullYear(),e.currentDay=r?i.getDate():0,e.currentMonth=r?i.getMonth():0,e.currentYear=r?i.getFullYear():0,this._adjustInstDate(e)},_getDefaultDate:function(e){return this._restrictMinMax(e,this._determineDate(e,this._get(e,"defaultDate"),new Date))},_determineDate:function(e,t,n){var r=function(e){var t=new Date;return t.setDate(t.getDate()+e),t},i=function(t){try{return $.datepicker.parseDate($.datepicker._get(e,"dateFormat"),t,$.datepicker._getFormatConfig(e))}catch(n){}var r=(t.toLowerCase().match(/^c/)?$.datepicker._getDate(e):null)||new Date,i=r.getFullYear(),s=r.getMonth(),o=r.getDate(),u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,a=u.exec(t);while(a){switch(a[2]||"d"){case"d":case"D":o+=parseInt(a[1],10);break;case"w":case"W":o+=parseInt(a[1],10)*7;break;case"m":case"M":s+=parseInt(a[1],10),o=Math.min(o,$.datepicker._getDaysInMonth(i,s));break;case"y":case"Y":i+=parseInt(a[1],10),o=Math.min(o,$.datepicker._getDaysInMonth(i,s))}a=u.exec(t)}return new Date(i,s,o)},s=t==null||t===""?n:typeof t=="string"?i(t):typeof t=="number"?isNaN(t)?n:r(t):new Date(t.getTime());return s=s&&s.toString()=="Invalid Date"?n:s,s&&(s.setHours(0),s.setMinutes(0),s.setSeconds(0),s.setMilliseconds(0)),this._daylightSavingAdjust(s)},_daylightSavingAdjust:function(e){return e?(e.setHours(e.getHours()>12?e.getHours()+2:0),e):null},_setDate:function(e,t,n){var r=!t,i=e.selectedMonth,s=e.selectedYear,o=this._restrictMinMax(e,this._determineDate(e,t,new Date));e.selectedDay=e.currentDay=o.getDate(),e.drawMonth=e.selectedMonth=e.currentMonth=o.getMonth(),e.drawYear=e.selectedYear=e.currentYear=o.getFullYear(),(i!=e.selectedMonth||s!=e.selectedYear)&&!n&&this._notifyChange(e),this._adjustInstDate(e),e.input&&e.input.val(r?"":this._formatDate(e))},_getDate:function(e){var t=!e.currentYear||e.input&&e.input.val()==""?null:this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return t},_attachHandlers:function(e){var t=this._get(e,"stepMonths"),n="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(n,-t,"M")},next:function(){window["DP_jQuery_"+dpuuid].datepicker._adjustDate(n,+t,"M")},hide:function(){window["DP_jQuery_"+dpuuid].datepicker._hideDatepicker()},today:function(){window["DP_jQuery_"+dpuuid].datepicker._gotoToday(n)},selectDay:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectDay(n,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(n,this,"M"),!1},selectYear:function(){return window["DP_jQuery_"+dpuuid].datepicker._selectMonthYear(n,this,"Y"),!1}};$(this).bind(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(e){var t=new Date;t=this._daylightSavingAdjust(new Date(t.getFullYear(),t.getMonth(),t.getDate()));var n=this._get(e,"isRTL"),r=this._get(e,"showButtonPanel"),i=this._get(e,"hideIfNoPrevNext"),s=this._get(e,"navigationAsDateFormat"),o=this._getNumberOfMonths(e),u=this._get(e,"showCurrentAtPos"),a=this._get(e,"stepMonths"),f=o[0]!=1||o[1]!=1,l=this._daylightSavingAdjust(e.currentDay?new Date(e.currentYear,e.currentMonth,e.currentDay):new Date(9999,9,9)),c=this._getMinMaxDate(e,"min"),h=this._getMinMaxDate(e,"max"),p=e.drawMonth-u,d=e.drawYear;p<0&&(p+=12,d--);if(h){var v=this._daylightSavingAdjust(new Date(h.getFullYear(),h.getMonth()-o[0]*o[1]+1,h.getDate()));v=c&&v<c?c:v;while(this._daylightSavingAdjust(new Date(d,p,1))>v)p--,p<0&&(p=11,d--)}e.drawMonth=p,e.drawYear=d;var m=this._get(e,"prevText");m=s?this.formatDate(m,this._daylightSavingAdjust(new Date(d,p-a,1)),this._getFormatConfig(e)):m;var g=this._canAdjustMonth(e,-1,d,p)?'<a class="ui-datepicker-prev ui-corner-all" data-handler="prev" data-event="click" title="'+m+'"><span class="ui-icon ui-icon-circle-triangle-'+(n?"e":"w")+'">'+m+"</span></a>":i?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+m+'"><span class="ui-icon ui-icon-circle-triangle-'+(n?"e":"w")+'">'+m+"</span></a>",y=this._get(e,"nextText");y=s?this.formatDate(y,this._daylightSavingAdjust(new Date(d,p+a,1)),this._getFormatConfig(e)):y;var b=this._canAdjustMonth(e,1,d,p)?'<a class="ui-datepicker-next ui-corner-all" data-handler="next" data-event="click" title="'+y+'"><span class="ui-icon ui-icon-circle-triangle-'+(n?"w":"e")+'">'+y+"</span></a>":i?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+y+'"><span class="ui-icon ui-icon-circle-triangle-'+(n?"w":"e")+'">'+y+"</span></a>",w=this._get(e,"currentText"),E=this._get(e,"gotoCurrent")&&e.currentDay?l:t;w=s?this.formatDate(w,E,this._getFormatConfig(e)):w;var S=e.inline?"":'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">'+this._get(e,"closeText")+"</button>",x=r?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(n?S:"")+(this._isInRange(e,E)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" data-handler="today" data-event="click">'+w+"</button>":"")+(n?"":S)+"</div>":"",T=parseInt(this._get(e,"firstDay"),10);T=isNaN(T)?0:T;var N=this._get(e,"showWeek"),C=this._get(e,"dayNames"),k=this._get(e,"dayNamesShort"),L=this._get(e,"dayNamesMin"),A=this._get(e,"monthNames"),O=this._get(e,"monthNamesShort"),M=this._get(e,"beforeShowDay"),_=this._get(e,"showOtherMonths"),D=this._get(e,"selectOtherMonths"),P=this._get(e,"calculateWeek")||this.iso8601Week,H=this._getDefaultDate(e),B="";for(var j=0;j<o[0];j++){var F="";this.maxRows=4;for(var I=0;I<o[1];I++){var q=this._daylightSavingAdjust(new Date(d,p,e.selectedDay)),R=" ui-corner-all",U="";if(f){U+='<div class="ui-datepicker-group';if(o[1]>1)switch(I){case 0:U+=" ui-datepicker-group-first",R=" ui-corner-"+(n?"right":"left");break;case o[1]-1:U+=" ui-datepicker-group-last",R=" ui-corner-"+(n?"left":"right");break;default:U+=" ui-datepicker-group-middle",R=""}U+='">'}U+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+R+'">'+(/all|left/.test(R)&&j==0?n?b:g:"")+(/all|right/.test(R)&&j==0?n?g:b:"")+this._generateMonthYearHeader(e,p,d,c,h,j>0||I>0,A,O)+'</div><table class="ui-datepicker-calendar"><thead>'+"<tr>";var z=N?'<th class="ui-datepicker-week-col">'+this._get(e,"weekHeader")+"</th>":"";for(var W=0;W<7;W++){var X=(W+T)%7;z+="<th"+((W+T+6)%7>=5?' class="ui-datepicker-week-end"':"")+">"+'<span title="'+C[X]+'">'+L[X]+"</span></th>"}U+=z+"</tr></thead><tbody>";var V=this._getDaysInMonth(d,p);d==e.selectedYear&&p==e.selectedMonth&&(e.selectedDay=Math.min(e.selectedDay,V));var J=(this._getFirstDayOfMonth(d,p)-T+7)%7,K=Math.ceil((J+V)/7),Q=f?this.maxRows>K?this.maxRows:K:K;this.maxRows=Q;var G=this._daylightSavingAdjust(new Date(d,p,1-J));for(var Y=0;Y<Q;Y++){U+="<tr>";var Z=N?'<td class="ui-datepicker-week-col">'+this._get(e,"calculateWeek")(G)+"</td>":"";for(var W=0;W<7;W++){var et=M?M.apply(e.input?e.input[0]:null,[G]):[!0,""],tt=G.getMonth()!=p,nt=tt&&!D||!et[0]||c&&G<c||h&&G>h;Z+='<td class="'+((W+T+6)%7>=5?" ui-datepicker-week-end":"")+(tt?" ui-datepicker-other-month":"")+(G.getTime()==q.getTime()&&p==e.selectedMonth&&e._keyEvent||H.getTime()==G.getTime()&&H.getTime()==q.getTime()?" "+this._dayOverClass:"")+(nt?" "+this._unselectableClass+" ui-state-disabled":"")+(tt&&!_?"":" "+et[1]+(G.getTime()==l.getTime()?" "+this._currentClass:"")+(G.getTime()==t.getTime()?" ui-datepicker-today":""))+'"'+((!tt||_)&&et[2]?' title="'+et[2]+'"':"")+(nt?"":' data-handler="selectDay" data-event="click" data-month="'+G.getMonth()+'" data-year="'+G.getFullYear()+'"')+">"+(tt&&!_?"&#xa0;":nt?'<span class="ui-state-default">'+G.getDate()+"</span>":'<a class="ui-state-default'+(G.getTime()==t.getTime()?" ui-state-highlight":"")+(G.getTime()==l.getTime()?" ui-state-active":"")+(tt?" ui-priority-secondary":"")+'" href="#">'+G.getDate()+"</a>")+"</td>",G.setDate(G.getDate()+1),G=this._daylightSavingAdjust(G)}U+=Z+"</tr>"}p++,p>11&&(p=0,d++),U+="</tbody></table>"+(f?"</div>"+(o[0]>0&&I==o[1]-1?'<div class="ui-datepicker-row-break"></div>':""):""),F+=U}B+=F}return B+=x+($.ui.ie6&&!e.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':""),e._keyEvent=!1,B},_generateMonthYearHeader:function(e,t,n,r,i,s,o,u){var a=this._get(e,"changeMonth"),f=this._get(e,"changeYear"),l=this._get(e,"showMonthAfterYear"),c='<div class="ui-datepicker-title">',h="";if(s||!a)h+='<span class="ui-datepicker-month">'+o[t]+"</span>";else{var p=r&&r.getFullYear()==n,d=i&&i.getFullYear()==n;h+='<select class="ui-datepicker-month" data-handler="selectMonth" data-event="change">';for(var v=0;v<12;v++)(!p||v>=r.getMonth())&&(!d||v<=i.getMonth())&&(h+='<option value="'+v+'"'+(v==t?' selected="selected"':"")+">"+u[v]+"</option>");h+="</select>"}l||(c+=h+(s||!a||!f?"&#xa0;":""));if(!e.yearshtml){e.yearshtml="";if(s||!f)c+='<span class="ui-datepicker-year">'+n+"</span>";else{var m=this._get(e,"yearRange").split(":"),g=(new Date).getFullYear(),y=function(e){var t=e.match(/c[+-].*/)?n+parseInt(e.substring(1),10):e.match(/[+-].*/)?g+parseInt(e,10):parseInt(e,10);return isNaN(t)?g:t},b=y(m[0]),w=Math.max(b,y(m[1]||""));b=r?Math.max(b,r.getFullYear()):b,w=i?Math.min(w,i.getFullYear()):w,e.yearshtml+='<select class="ui-datepicker-year" data-handler="selectYear" data-event="change">';for(;b<=w;b++)e.yearshtml+='<option value="'+b+'"'+(b==n?' selected="selected"':"")+">"+b+"</option>";e.yearshtml+="</select>",c+=e.yearshtml,e.yearshtml=null}}return c+=this._get(e,"yearSuffix"),l&&(c+=(s||!a||!f?"&#xa0;":"")+h),c+="</div>",c},_adjustInstDate:function(e,t,n){var r=e.drawYear+(n=="Y"?t:0),i=e.drawMonth+(n=="M"?t:0),s=Math.min(e.selectedDay,this._getDaysInMonth(r,i))+(n=="D"?t:0),o=this._restrictMinMax(e,this._daylightSavingAdjust(new Date(r,i,s)));e.selectedDay=o.getDate(),e.drawMonth=e.selectedMonth=o.getMonth(),e.drawYear=e.selectedYear=o.getFullYear(),(n=="M"||n=="Y")&&this._notifyChange(e)},_restrictMinMax:function(e,t){var n=this._getMinMaxDate(e,"min"),r=this._getMinMaxDate(e,"max"),i=n&&t<n?n:t;return i=r&&i>r?r:i,i},_notifyChange:function(e){var t=this._get(e,"onChangeMonthYear");t&&t.apply(e.input?e.input[0]:null,[e.selectedYear,e.selectedMonth+1,e])},_getNumberOfMonths:function(e){var t=this._get(e,"numberOfMonths");return t==null?[1,1]:typeof t=="number"?[1,t]:t},_getMinMaxDate:function(e,t){return this._determineDate(e,this._get(e,t+"Date"),null)},_getDaysInMonth:function(e,t){return 32-this._daylightSavingAdjust(new Date(e,t,32)).getDate()},_getFirstDayOfMonth:function(e,t){return(new Date(e,t,1)).getDay()},_canAdjustMonth:function(e,t,n,r){var i=this._getNumberOfMonths(e),s=this._daylightSavingAdjust(new Date(n,r+(t<0?t:i[0]*i[1]),1));return t<0&&s.setDate(this._getDaysInMonth(s.getFullYear(),s.getMonth())),this._isInRange(e,s)},_isInRange:function(e,t){var n=this._getMinMaxDate(e,"min"),r=this._getMinMaxDate(e,"max");return(!n||t.getTime()>=n.getTime())&&(!r||t.getTime()<=r.getTime())},_getFormatConfig:function(e){var t=this._get(e,"shortYearCutoff");return t=typeof t!="string"?t:(new Date).getFullYear()%100+parseInt(t,10),{shortYearCutoff:t,dayNamesShort:this._get(e,"dayNamesShort"),dayNames:this._get(e,"dayNames"),monthNamesShort:this._get(e,"monthNamesShort"),monthNames:this._get(e,"monthNames")}},_formatDate:function(e,t,n,r){t||(e.currentDay=e.selectedDay,e.currentMonth=e.selectedMonth,e.currentYear=e.selectedYear);var i=t?typeof t=="object"?t:this._daylightSavingAdjust(new Date(r,n,t)):this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));return this.formatDate(this._get(e,"dateFormat"),i,this._getFormatConfig(e))}}),$.fn.datepicker=function(e){if(!this.length)return this;$.datepicker.initialized||($(document).mousedown($.datepicker._checkExternalClick).find(document.body).append($.datepicker.dpDiv),$.datepicker.initialized=!0);var t=Array.prototype.slice.call(arguments,1);return typeof e!="string"||e!="isDisabled"&&e!="getDate"&&e!="widget"?e=="option"&&arguments.length==2&&typeof arguments[1]=="string"?$.datepicker["_"+e+"Datepicker"].apply($.datepicker,[this[0]].concat(t)):this.each(function(){typeof e=="string"?$.datepicker["_"+e+"Datepicker"].apply($.datepicker,[this].concat(t)):$.datepicker._attachDatepicker(this,e)}):$.datepicker["_"+e+"Datepicker"].apply($.datepicker,[this[0]].concat(t))},$.datepicker=new Datepicker,$.datepicker.initialized=!1,$.datepicker.uuid=(new Date).getTime(),$.datepicker.version="1.9.2",window["DP_jQuery_"+dpuuid]=$})(jQuery);(function(e,t){var n="ui-dialog ui-widget ui-widget-content ui-corner-all ",r={buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},i={maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0};e.widget("ui.dialog",{version:"1.9.2",options:{autoOpen:!0,buttons:{},closeOnEscape:!0,closeText:"close",dialogClass:"",draggable:!0,hide:null,height:"auto",maxHeight:!1,maxWidth:!1,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var n=e(this).css(t).offset().top;n<0&&e(this).css("top",t.top-n)}},resizable:!0,show:null,stack:!0,title:"",width:300,zIndex:1e3},_create:function(){this.originalTitle=this.element.attr("title"),typeof this.originalTitle!="string"&&(this.originalTitle=""),this.oldPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.options.title=this.options.title||this.originalTitle;var t=this,r=this.options,i=r.title||"&#160;",s,o,u,a,f;s=(this.uiDialog=e("<div>")).addClass(n+r.dialogClass).css({display:"none",outline:0,zIndex:r.zIndex}).attr("tabIndex",-1).keydown(function(n){r.closeOnEscape&&!n.isDefaultPrevented()&&n.keyCode&&n.keyCode===e.ui.keyCode.ESCAPE&&(t.close(n),n.preventDefault())}).mousedown(function(e){t.moveToTop(!1,e)}).appendTo("body"),this.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(s),o=(this.uiDialogTitlebar=e("<div>")).addClass("ui-dialog-titlebar  ui-widget-header  ui-corner-all  ui-helper-clearfix").bind("mousedown",function(){s.focus()}).prependTo(s),u=e("<a href='#'></a>").addClass("ui-dialog-titlebar-close  ui-corner-all").attr("role","button").click(function(e){e.preventDefault(),t.close(e)}).appendTo(o),(this.uiDialogTitlebarCloseText=e("<span>")).addClass("ui-icon ui-icon-closethick").text(r.closeText).appendTo(u),a=e("<span>").uniqueId().addClass("ui-dialog-title").html(i).prependTo(o),f=(this.uiDialogButtonPane=e("<div>")).addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),(this.uiButtonSet=e("<div>")).addClass("ui-dialog-buttonset").appendTo(f),s.attr({role:"dialog","aria-labelledby":a.attr("id")}),o.find("*").add(o).disableSelection(),this._hoverable(u),this._focusable(u),r.draggable&&e.fn.draggable&&this._makeDraggable(),r.resizable&&e.fn.resizable&&this._makeResizable(),this._createButtons(r.buttons),this._isOpen=!1,e.fn.bgiframe&&s.bgiframe(),this._on(s,{keydown:function(t){if(!r.modal||t.keyCode!==e.ui.keyCode.TAB)return;var n=e(":tabbable",s),i=n.filter(":first"),o=n.filter(":last");if(t.target===o[0]&&!t.shiftKey)return i.focus(1),!1;if(t.target===i[0]&&t.shiftKey)return o.focus(1),!1}})},_init:function(){this.options.autoOpen&&this.open()},_destroy:function(){var e,t=this.oldPosition;this.overlay&&this.overlay.destroy(),this.uiDialog.hide(),this.element.removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uiDialog},close:function(t){var n=this,r,i;if(!this._isOpen)return;if(!1===this._trigger("beforeClose",t))return;return this._isOpen=!1,this.overlay&&this.overlay.destroy(),this.options.hide?this._hide(this.uiDialog,this.options.hide,function(){n._trigger("close",t)}):(this.uiDialog.hide(),this._trigger("close",t)),e.ui.dialog.overlay.resize(),this.options.modal&&(r=0,e(".ui-dialog").each(function(){this!==n.uiDialog[0]&&(i=e(this).css("z-index"),isNaN(i)||(r=Math.max(r,i)))}),e.ui.dialog.maxZ=r),this},isOpen:function(){return this._isOpen},moveToTop:function(t,n){var r=this.options,i;return r.modal&&!t||!r.stack&&!r.modal?this._trigger("focus",n):(r.zIndex>e.ui.dialog.maxZ&&(e.ui.dialog.maxZ=r.zIndex),this.overlay&&(e.ui.dialog.maxZ+=1,e.ui.dialog.overlay.maxZ=e.ui.dialog.maxZ,this.overlay.$el.css("z-index",e.ui.dialog.overlay.maxZ)),i={scrollTop:this.element.scrollTop(),scrollLeft:this.element.scrollLeft()},e.ui.dialog.maxZ+=1,this.uiDialog.css("z-index",e.ui.dialog.maxZ),this.element.attr(i),this._trigger("focus",n),this)},open:function(){if(this._isOpen)return;var t,n=this.options,r=this.uiDialog;return this._size(),this._position(n.position),r.show(n.show),this.overlay=n.modal?new e.ui.dialog.overlay(this):null,this.moveToTop(!0),t=this.element.find(":tabbable"),t.length||(t=this.uiDialogButtonPane.find(":tabbable"),t.length||(t=r)),t.eq(0).focus(),this._isOpen=!0,this._trigger("open"),this},_createButtons:function(t){var n=this,r=!1;this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),typeof t=="object"&&t!==null&&e.each(t,function(){return!(r=!0)}),r?(e.each(t,function(t,r){var i,s;r=e.isFunction(r)?{click:r,text:t}:r,r=e.extend({type:"button"},r),s=r.click,r.click=function(){s.apply(n.element[0],arguments)},i=e("<button></button>",r).appendTo(n.uiButtonSet),e.fn.button&&i.button()}),this.uiDialog.addClass("ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog)):this.uiDialog.removeClass("ui-dialog-buttons")},_makeDraggable:function(){function r(e){return{position:e.position,offset:e.offset}}var t=this,n=this.options;this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(n,i){e(this).addClass("ui-dialog-dragging"),t._trigger("dragStart",n,r(i))},drag:function(e,n){t._trigger("drag",e,r(n))},stop:function(i,s){n.position=[s.position.left-t.document.scrollLeft(),s.position.top-t.document.scrollTop()],e(this).removeClass("ui-dialog-dragging"),t._trigger("dragStop",i,r(s)),e.ui.dialog.overlay.resize()}})},_makeResizable:function(n){function u(e){return{originalPosition:e.originalPosition,originalSize:e.originalSize,position:e.position,size:e.size}}n=n===t?this.options.resizable:n;var r=this,i=this.options,s=this.uiDialog.css("position"),o=typeof n=="string"?n:"n,e,s,w,se,sw,ne,nw";this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:i.maxWidth,maxHeight:i.maxHeight,minWidth:i.minWidth,minHeight:this._minHeight(),handles:o,start:function(t,n){e(this).addClass("ui-dialog-resizing"),r._trigger("resizeStart",t,u(n))},resize:function(e,t){r._trigger("resize",e,u(t))},stop:function(t,n){e(this).removeClass("ui-dialog-resizing"),i.height=e(this).height(),i.width=e(this).width(),r._trigger("resizeStop",t,u(n)),e.ui.dialog.overlay.resize()}}).css("position",s).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var e=this.options;return e.height==="auto"?e.minHeight:Math.min(e.minHeight,e.height)},_position:function(t){var n=[],r=[0,0],i;if(t){if(typeof t=="string"||typeof t=="object"&&"0"in t)n=t.split?t.split(" "):[t[0],t[1]],n.length===1&&(n[1]=n[0]),e.each(["left","top"],function(e,t){+n[e]===n[e]&&(r[e]=n[e],n[e]=t)}),t={my:n[0]+(r[0]<0?r[0]:"+"+r[0])+" "+n[1]+(r[1]<0?r[1]:"+"+r[1]),at:n.join(" ")};t=e.extend({},e.ui.dialog.prototype.options.position,t)}else t=e.ui.dialog.prototype.options.position;i=this.uiDialog.is(":visible"),i||this.uiDialog.show(),this.uiDialog.position(t),i||this.uiDialog.hide()},_setOptions:function(t){var n=this,s={},o=!1;e.each(t,function(e,t){n._setOption(e,t),e in r&&(o=!0),e in i&&(s[e]=t)}),o&&this._size(),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",s)},_setOption:function(t,r){var i,s,o=this.uiDialog;switch(t){case"buttons":this._createButtons(r);break;case"closeText":this.uiDialogTitlebarCloseText.text(""+r);break;case"dialogClass":o.removeClass(this.options.dialogClass).addClass(n+r);break;case"disabled":r?o.addClass("ui-dialog-disabled"):o.removeClass("ui-dialog-disabled");break;case"draggable":i=o.is(":data(draggable)"),i&&!r&&o.draggable("destroy"),!i&&r&&this._makeDraggable();break;case"position":this._position(r);break;case"resizable":s=o.is(":data(resizable)"),s&&!r&&o.resizable("destroy"),s&&typeof r=="string"&&o.resizable("option","handles",r),!s&&r!==!1&&this._makeResizable(r);break;case"title":e(".ui-dialog-title",this.uiDialogTitlebar).html(""+(r||"&#160;"))}this._super(t,r)},_size:function(){var t,n,r,i=this.options,s=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0}),i.minWidth>i.width&&(i.width=i.minWidth),t=this.uiDialog.css({height:"auto",width:i.width}).outerHeight(),n=Math.max(0,i.minHeight-t),i.height==="auto"?e.support.minHeight?this.element.css({minHeight:n,height:"auto"}):(this.uiDialog.show(),r=this.element.css("height","auto").height(),s||this.uiDialog.hide(),this.element.height(Math.max(r,n))):this.element.height(Math.max(i.height-t,0)),this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}}),e.extend(e.ui.dialog,{uuid:0,maxZ:0,getTitleId:function(e){var t=e.attr("id");return t||(this.uuid+=1,t=this.uuid),"ui-dialog-title-"+t},overlay:function(t){this.$el=e.ui.dialog.overlay.create(t)}}),e.extend(e.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:e.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(e){return e+".dialog-overlay"}).join(" "),create:function(t){this.instances.length===0&&(setTimeout(function(){e.ui.dialog.overlay.instances.length&&e(document).bind(e.ui.dialog.overlay.events,function(t){if(e(t.target).zIndex()<e.ui.dialog.overlay.maxZ)return!1})},1),e(window).bind("resize.dialog-overlay",e.ui.dialog.overlay.resize));var n=this.oldInstances.pop()||e("<div>").addClass("ui-widget-overlay");return e(document).bind("keydown.dialog-overlay",function(r){var i=e.ui.dialog.overlay.instances;i.length!==0&&i[i.length-1]===n&&t.options.closeOnEscape&&!r.isDefaultPrevented()&&r.keyCode&&r.keyCode===e.ui.keyCode.ESCAPE&&(t.close(r),r.preventDefault())}),n.appendTo(document.body).css({width:this.width(),height:this.height()}),e.fn.bgiframe&&n.bgiframe(),this.instances.push(n),n},destroy:function(t){var n=e.inArray(t,this.instances),r=0;n!==-1&&this.oldInstances.push(this.instances.splice(n,1)[0]),this.instances.length===0&&e([document,window]).unbind(".dialog-overlay"),t.height(0).width(0).remove(),e.each(this.instances,function(){r=Math.max(r,this.css("z-index"))}),this.maxZ=r},height:function(){var t,n;return e.ui.ie?(t=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),n=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight),t<n?e(window).height()+"px":t+"px"):e(document).height()+"px"},width:function(){var t,n;return e.ui.ie?(t=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),n=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth),t<n?e(window).width()+"px":t+"px"):e(document).width()+"px"},resize:function(){var t=e([]);e.each(e.ui.dialog.overlay.instances,function(){t=t.add(this)}),t.css({width:0,height:0}).css({width:e.ui.dialog.overlay.width(),height:e.ui.dialog.overlay.height()})}}),e.extend(e.ui.dialog.overlay.prototype,{destroy:function(){e.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);(function(e,t){e.widget("ui.draggable",e.ui.mouse,{version:"1.9.2",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1},_create:function(){this.options.helper=="original"&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var n=this.options;return this.helper||n.disabled||e(t.target).is(".ui-resizable-handle")?!1:(this.handle=this._getHandle(t),this.handle?(e(n.iframeFix===!0?"iframe":n.iframeFix).each(function(){e('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var n=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),n.containment&&this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,n){this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute");if(!n){var r=this._uiHash();if(this._trigger("drag",t,r)===!1)return this._mouseUp({}),!1;this.position=r.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";return e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var n=!1;e.ui.ddmanager&&!this.options.dropBehaviour&&(n=e.ui.ddmanager.drop(this,t)),this.dropped&&(n=this.dropped,this.dropped=!1);var r=this.element[0],i=!1;while(r&&(r=r.parentNode))r==document&&(i=!0);if(!i&&this.options.helper==="original")return!1;if(this.options.revert=="invalid"&&!n||this.options.revert=="valid"&&n||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,n)){var s=this;e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){s._trigger("stop",t)!==!1&&s._clear()})}else this._trigger("stop",t)!==!1&&this._clear();return!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){var n=!this.options.handle||!e(this.options.handle,this.element).length?!0:!1;return e(this.options.handle,this.element).find("*").andSelf().each(function(){this==t.target&&(n=!0)}),n},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper)?e(n.helper.apply(this.element[0],[t])):n.helper=="clone"?this.element.clone().removeAttr("id"):this.element;return r.parents("body").length||r.appendTo(n.appendTo=="parent"?this.element[0].parentNode:n.appendTo),r[0]!=this.element[0]&&!/(fixed|absolute)/.test(r.css("position"))&&r.css("position","absolute"),r},_adjustOffsetFromHelper:function(t){typeof t=="string"&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&e.ui.ie)t={top:0,left:0};return{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t=this.options;t.containment=="parent"&&(t.containment=this.helper[0].parentNode);if(t.containment=="document"||t.containment=="window")this.containment=[t.containment=="document"?0:e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t.containment=="document"?0:e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,(t.containment=="document"?0:e(window).scrollLeft())+e(t.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(t.containment=="document"?0:e(window).scrollTop())+(e(t.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(t.containment)&&t.containment.constructor!=Array){var n=e(t.containment),r=n[0];if(!r)return;var i=n.offset(),s=e(r).css("overflow")!="hidden";this.containment=[(parseInt(e(r).css("borderLeftWidth"),10)||0)+(parseInt(e(r).css("paddingLeft"),10)||0),(parseInt(e(r).css("borderTopWidth"),10)||0)+(parseInt(e(r).css("paddingTop"),10)||0),(s?Math.max(r.scrollWidth,r.offsetWidth):r.offsetWidth)-(parseInt(e(r).css("borderLeftWidth"),10)||0)-(parseInt(e(r).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(s?Math.max(r.scrollHeight,r.offsetHeight):r.offsetHeight)-(parseInt(e(r).css("borderTopWidth"),10)||0)-(parseInt(e(r).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=n}else t.containment.constructor==Array&&(this.containment=t.containment)},_convertPositionTo:function(t,n){n||(n=this.position);var r=t=="absolute"?1:-1,i=this.options,s=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(s[0].tagName);return{top:n.top+this.offset.relative.top*r+this.offset.parent.top*r-(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():o?0:s.scrollTop())*r,left:n.left+this.offset.relative.left*r+this.offset.parent.left*r-(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():o?0:s.scrollLeft())*r}},_generatePosition:function(t){var n=this.options,r=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,i=/(html|body)/i.test(r[0].tagName),s=t.pageX,o=t.pageY;if(this.originalPosition){var u;if(this.containment){if(this.relative_container){var a=this.relative_container.offset();u=[this.containment[0]+a.left,this.containment[1]+a.top,this.containment[2]+a.left,this.containment[3]+a.top]}else u=this.containment;t.pageX-this.offset.click.left<u[0]&&(s=u[0]+this.offset.click.left),t.pageY-this.offset.click.top<u[1]&&(o=u[1]+this.offset.click.top),t.pageX-this.offset.click.left>u[2]&&(s=u[2]+this.offset.click.left),t.pageY-this.offset.click.top>u[3]&&(o=u[3]+this.offset.click.top)}if(n.grid){var f=n.grid[1]?this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1]:this.originalPageY;o=u?f-this.offset.click.top<u[1]||f-this.offset.click.top>u[3]?f-this.offset.click.top<u[1]?f+n.grid[1]:f-n.grid[1]:f:f;var l=n.grid[0]?this.originalPageX+Math.round((s-this.originalPageX)/n.grid[0])*n.grid[0]:this.originalPageX;s=u?l-this.offset.click.left<u[0]||l-this.offset.click.left>u[2]?l-this.offset.click.left<u[0]?l+n.grid[0]:l-n.grid[0]:l:l}}return{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():i?0:r.scrollTop()),left:s-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:r.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,n,r){return r=r||this._uiHash(),e.ui.plugin.call(this,t,[n,r]),t=="drag"&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,n,r)},plugins:{},_uiHash:function(e){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,n){var r=e(this).data("draggable"),i=r.options,s=e.extend({},n,{item:r.element});r.sortables=[],e(i.connectToSortable).each(function(){var n=e.data(this,"sortable");n&&!n.options.disabled&&(r.sortables.push({instance:n,shouldRevert:n.options.revert}),n.refreshPositions(),n._trigger("activate",t,s))})},stop:function(t,n){var r=e(this).data("draggable"),i=e.extend({},n,{item:r.element});e.each(r.sortables,function(){this.instance.isOver?(this.instance.isOver=0,r.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=!0),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,r.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,i))})},drag:function(t,n){var r=e(this).data("draggable"),i=this,s=function(t){var n=this.offset.click.top,r=this.offset.click.left,i=this.positionAbs.top,s=this.positionAbs.left,o=t.height,u=t.width,a=t.top,f=t.left;return e.ui.isOver(i+n,s+r,a,f,o,u)};e.each(r.sortables,function(s){var o=!1,u=this;this.instance.positionAbs=r.positionAbs,this.instance.helperProportions=r.helperProportions,this.instance.offset.click=r.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(o=!0,e.each(r.sortables,function(){return this.instance.positionAbs=r.positionAbs,this.instance.helperProportions=r.helperProportions,this.instance.offset.click=r.offset.click,this!=u&&this.instance._intersectsWith(this.instance.containerCache)&&e.ui.contains(u.instance.element[0],this.instance.element[0])&&(o=!1),o})),o?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(i).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return n.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=r.offset.click.top,this.instance.offset.click.left=r.offset.click.left,this.instance.offset.parent.left-=r.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=r.offset.parent.top-this.instance.offset.parent.top,r._trigger("toSortable",t),r.dropped=this.instance.element,r.currentItem=r.element,this.instance.fromOutside=r),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),r._trigger("fromSortable",t),r.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,n){var r=e("body"),i=e(this).data("draggable").options;r.css("cursor")&&(i._cursor=r.css("cursor")),r.css("cursor",i.cursor)},stop:function(t,n){var r=e(this).data("draggable").options;r._cursor&&e("body").css("cursor",r._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,n){var r=e(n.helper),i=e(this).data("draggable").options;r.css("opacity")&&(i._opacity=r.css("opacity")),r.css("opacity",i.opacity)},stop:function(t,n){var r=e(this).data("draggable").options;r._opacity&&e(n.helper).css("opacity",r._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(t,n){var r=e(this).data("draggable");r.scrollParent[0]!=document&&r.scrollParent[0].tagName!="HTML"&&(r.overflowOffset=r.scrollParent.offset())},drag:function(t,n){var r=e(this).data("draggable"),i=r.options,s=!1;if(r.scrollParent[0]!=document&&r.scrollParent[0].tagName!="HTML"){if(!i.axis||i.axis!="x")r.overflowOffset.top+r.scrollParent[0].offsetHeight-t.pageY<i.scrollSensitivity?r.scrollParent[0].scrollTop=s=r.scrollParent[0].scrollTop+i.scrollSpeed:t.pageY-r.overflowOffset.top<i.scrollSensitivity&&(r.scrollParent[0].scrollTop=s=r.scrollParent[0].scrollTop-i.scrollSpeed);if(!i.axis||i.axis!="y")r.overflowOffset.left+r.scrollParent[0].offsetWidth-t.pageX<i.scrollSensitivity?r.scrollParent[0].scrollLeft=s=r.scrollParent[0].scrollLeft+i.scrollSpeed:t.pageX-r.overflowOffset.left<i.scrollSensitivity&&(r.scrollParent[0].scrollLeft=s=r.scrollParent[0].scrollLeft-i.scrollSpeed)}else{if(!i.axis||i.axis!="x")t.pageY-e(document).scrollTop()<i.scrollSensitivity?s=e(document).scrollTop(e(document).scrollTop()-i.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<i.scrollSensitivity&&(s=e(document).scrollTop(e(document).scrollTop()+i.scrollSpeed));if(!i.axis||i.axis!="y")t.pageX-e(document).scrollLeft()<i.scrollSensitivity?s=e(document).scrollLeft(e(document).scrollLeft()-i.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<i.scrollSensitivity&&(s=e(document).scrollLeft(e(document).scrollLeft()+i.scrollSpeed))}s!==!1&&e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(r,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,n){var r=e(this).data("draggable"),i=r.options;r.snapElements=[],e(i.snap.constructor!=String?i.snap.items||":data(draggable)":i.snap).each(function(){var t=e(this),n=t.offset();this!=r.element[0]&&r.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:n.top,left:n.left})})},drag:function(t,n){var r=e(this).data("draggable"),i=r.options,s=i.snapTolerance,o=n.offset.left,u=o+r.helperProportions.width,a=n.offset.top,f=a+r.helperProportions.height;for(var l=r.snapElements.length-1;l>=0;l--){var c=r.snapElements[l].left,h=c+r.snapElements[l].width,p=r.snapElements[l].top,d=p+r.snapElements[l].height;if(!(c-s<o&&o<h+s&&p-s<a&&a<d+s||c-s<o&&o<h+s&&p-s<f&&f<d+s||c-s<u&&u<h+s&&p-s<a&&a<d+s||c-s<u&&u<h+s&&p-s<f&&f<d+s)){r.snapElements[l].snapping&&r.options.snap.release&&r.options.snap.release.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[l].item})),r.snapElements[l].snapping=!1;continue}if(i.snapMode!="inner"){var v=Math.abs(p-f)<=s,m=Math.abs(d-a)<=s,g=Math.abs(c-u)<=s,y=Math.abs(h-o)<=s;v&&(n.position.top=r._convertPositionTo("relative",{top:p-r.helperProportions.height,left:0}).top-r.margins.top),m&&(n.position.top=r._convertPositionTo("relative",{top:d,left:0}).top-r.margins.top),g&&(n.position.left=r._convertPositionTo("relative",{top:0,left:c-r.helperProportions.width}).left-r.margins.left),y&&(n.position.left=r._convertPositionTo("relative",{top:0,left:h}).left-r.margins.left)}var b=v||m||g||y;if(i.snapMode!="outer"){var v=Math.abs(p-a)<=s,m=Math.abs(d-f)<=s,g=Math.abs(c-o)<=s,y=Math.abs(h-u)<=s;v&&(n.position.top=r._convertPositionTo("relative",{top:p,left:0}).top-r.margins.top),m&&(n.position.top=r._convertPositionTo("relative",{top:d-r.helperProportions.height,left:0}).top-r.margins.top),g&&(n.position.left=r._convertPositionTo("relative",{top:0,left:c}).left-r.margins.left),y&&(n.position.left=r._convertPositionTo("relative",{top:0,left:h-r.helperProportions.width}).left-r.margins.left)}!r.snapElements[l].snapping&&(v||m||g||y||b)&&r.options.snap.snap&&r.options.snap.snap.call(r.element,t,e.extend(r._uiHash(),{snapItem:r.snapElements[l].item})),r.snapElements[l].snapping=v||m||g||y||b}}}),e.ui.plugin.add("draggable","stack",{start:function(t,n){var r=e(this).data("draggable").options,i=e.makeArray(e(r.stack)).sort(function(t,n){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(n).css("zIndex"),10)||0)});if(!i.length)return;var s=parseInt(i[0].style.zIndex)||0;e(i).each(function(e){this.style.zIndex=s+e}),this[0].style.zIndex=s+i.length}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,n){var r=e(n.helper),i=e(this).data("draggable").options;r.css("zIndex")&&(i._zIndex=r.css("zIndex")),r.css("zIndex",i.zIndex)},stop:function(t,n){var r=e(this).data("draggable").options;r._zIndex&&e(n.helper).css("zIndex",r._zIndex)}})})(jQuery);(function(e,t){e.widget("ui.droppable",{version:"1.9.2",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect"},_create:function(){var t=this.options,n=t.accept;this.isover=0,this.isout=1,this.accept=e.isFunction(n)?n:function(e){return e.is(n)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},e.ui.ddmanager.droppables[t.scope]=e.ui.ddmanager.droppables[t.scope]||[],e.ui.ddmanager.droppables[t.scope].push(this),t.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];for(var n=0;n<t.length;n++)t[n]==this&&t.splice(n,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,n){t=="accept"&&(this.accept=e.isFunction(n)?n:function(e){return e.is(n)}),e.Widget.prototype._setOption.apply(this,arguments)},_activate:function(t){var n=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),n&&this._trigger("activate",t,this.ui(n))},_deactivate:function(t){var n=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),n&&this._trigger("deactivate",t,this.ui(n))},_over:function(t){var n=e.ui.ddmanager.current;if(!n||(n.currentItem||n.element)[0]==this.element[0])return;this.accept.call(this.element[0],n.currentItem||n.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(n)))},_out:function(t){var n=e.ui.ddmanager.current;if(!n||(n.currentItem||n.element)[0]==this.element[0])return;this.accept.call(this.element[0],n.currentItem||n.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(n)))},_drop:function(t,n){var r=n||e.ui.ddmanager.current;if(!r||(r.currentItem||r.element)[0]==this.element[0])return!1;var i=!1;return this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"droppable");if(t.options.greedy&&!t.options.disabled&&t.options.scope==r.options.scope&&t.accept.call(t.element[0],r.currentItem||r.element)&&e.ui.intersect(r,e.extend(t,{offset:t.element.offset()}),t.options.tolerance))return i=!0,!1}),i?!1:this.accept.call(this.element[0],r.currentItem||r.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(r)),this.element):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(t,n,r){if(!n.offset)return!1;var i=(t.positionAbs||t.position.absolute).left,s=i+t.helperProportions.width,o=(t.positionAbs||t.position.absolute).top,u=o+t.helperProportions.height,a=n.offset.left,f=a+n.proportions.width,l=n.offset.top,c=l+n.proportions.height;switch(r){case"fit":return a<=i&&s<=f&&l<=o&&u<=c;case"intersect":return a<i+t.helperProportions.width/2&&s-t.helperProportions.width/2<f&&l<o+t.helperProportions.height/2&&u-t.helperProportions.height/2<c;case"pointer":var h=(t.positionAbs||t.position.absolute).left+(t.clickOffset||t.offset.click).left,p=(t.positionAbs||t.position.absolute).top+(t.clickOffset||t.offset.click).top,d=e.ui.isOver(p,h,l,a,n.proportions.height,n.proportions.width);return d;case"touch":return(o>=l&&o<=c||u>=l&&u<=c||o<l&&u>c)&&(i>=a&&i<=f||s>=a&&s<=f||i<a&&s>f);default:return!1}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,n){var r=e.ui.ddmanager.droppables[t.options.scope]||[],i=n?n.type:null,s=(t.currentItem||t.element).find(":data(droppable)").andSelf();e:for(var o=0;o<r.length;o++){if(r[o].options.disabled||t&&!r[o].accept.call(r[o].element[0],t.currentItem||t.element))continue;for(var u=0;u<s.length;u++)if(s[u]==r[o].element[0]){r[o].proportions.height=0;continue e}r[o].visible=r[o].element.css("display")!="none";if(!r[o].visible)continue;i=="mousedown"&&r[o]._activate.call(r[o],n),r[o].offset=r[o].element.offset(),r[o].proportions={width:r[o].element[0].offsetWidth,height:r[o].element[0].offsetHeight}}},drop:function(t,n){var r=!1;return e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options)return;!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(r=this._drop.call(this,n)||r),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=1,this.isover=0,this._deactivate.call(this,n))}),r},dragStart:function(t,n){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,n)})},drag:function(t,n){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,n),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(this.options.disabled||this.greedyChild||!this.visible)return;var r=e.ui.intersect(t,this,this.options.tolerance),i=!r&&this.isover==1?"isout":r&&this.isover==0?"isover":null;if(!i)return;var s;if(this.options.greedy){var o=this.options.scope,u=this.element.parents(":data(droppable)").filter(function(){return e.data(this,"droppable").options.scope===o});u.length&&(s=e.data(u[0],"droppable"),s.greedyChild=i=="isover"?1:0)}s&&i=="isover"&&(s.isover=0,s.isout=1,s._out.call(s,n)),this[i]=1,this[i=="isout"?"isover":"isout"]=0,this[i=="isover"?"_over":"_out"].call(this,n),s&&i=="isout"&&(s.isout=0,s.isover=1,s._over.call(s,n))})},dragStop:function(t,n){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,n)}}})(jQuery);jQuery.effects||function(e,t){var n=e.uiBackCompat!==!1,r="ui-effects-";e.effects={effect:{}},function(t,n){function p(e,t,n){var r=a[t.type]||{};return e==null?n||!t.def?null:t.def:(e=r.floor?~~e:parseFloat(e),isNaN(e)?t.def:r.mod?(e+r.mod)%r.mod:0>e?0:r.max<e?r.max:e)}function d(e){var n=o(),r=n._rgba=[];return e=e.toLowerCase(),h(s,function(t,i){var s,o=i.re.exec(e),a=o&&i.parse(o),f=i.space||"rgba";if(a)return s=n[f](a),n[u[f].cache]=s[u[f].cache],r=n._rgba=s._rgba,!1}),r.length?(r.join()==="0,0,0,0"&&t.extend(r,c.transparent),n):c[e]}function v(e,t,n){return n=(n+1)%1,n*6<1?e+(t-e)*n*6:n*2<1?t:n*3<2?e+(t-e)*(2/3-n)*6:e}var r="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor".split(" "),i=/^([\-+])=\s*(\d+\.?\d*)/,s=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1]*2.55,e[2]*2.55,e[3]*2.55,e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d+(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],o=t.Color=function(e,n,r,i){return new t.Color.fn.parse(e,n,r,i)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},a={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},f=o.support={},l=t("<p>")[0],c,h=t.each;l.style.cssText="background-color:rgba(1,1,1,.5)",f.rgba=l.style.backgroundColor.indexOf("rgba")>-1,h(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),o.fn=t.extend(o.prototype,{parse:function(r,i,s,a){if(r===n)return this._rgba=[null,null,null,null],this;if(r.jquery||r.nodeType)r=t(r).css(i),i=n;var f=this,l=t.type(r),v=this._rgba=[];i!==n&&(r=[r,i,s,a],l="array");if(l==="string")return this.parse(d(r)||c._default);if(l==="array")return h(u.rgba.props,function(e,t){v[t.idx]=p(r[t.idx],t)}),this;if(l==="object")return r instanceof o?h(u,function(e,t){r[t.cache]&&(f[t.cache]=r[t.cache].slice())}):h(u,function(t,n){var i=n.cache;h(n.props,function(e,t){if(!f[i]&&n.to){if(e==="alpha"||r[e]==null)return;f[i]=n.to(f._rgba)}f[i][t.idx]=p(r[e],t,!0)}),f[i]&&e.inArray(null,f[i].slice(0,3))<0&&(f[i][3]=1,n.from&&(f._rgba=n.from(f[i])))}),this},is:function(e){var t=o(e),n=!0,r=this;return h(u,function(e,i){var s,o=t[i.cache];return o&&(s=r[i.cache]||i.to&&i.to(r._rgba)||[],h(i.props,function(e,t){if(o[t.idx]!=null)return n=o[t.idx]===s[t.idx],n})),n}),n},_space:function(){var e=[],t=this;return h(u,function(n,r){t[r.cache]&&e.push(n)}),e.pop()},transition:function(e,t){var n=o(e),r=n._space(),i=u[r],s=this.alpha()===0?o("transparent"):this,f=s[i.cache]||i.to(s._rgba),l=f.slice();return n=n[i.cache],h(i.props,function(e,r){var i=r.idx,s=f[i],o=n[i],u=a[r.type]||{};if(o===null)return;s===null?l[i]=o:(u.mod&&(o-s>u.mod/2?s+=u.mod:s-o>u.mod/2&&(s-=u.mod)),l[i]=p((o-s)*t+s,r))}),this[r](l)},blend:function(e){if(this._rgba[3]===1)return this;var n=this._rgba.slice(),r=n.pop(),i=o(e)._rgba;return o(t.map(n,function(e,t){return(1-r)*i[t]+r*e}))},toRgbaString:function(){var e="rgba(",n=t.map(this._rgba,function(e,t){return e==null?t>2?1:0:e});return n[3]===1&&(n.pop(),e="rgb("),e+n.join()+")"},toHslaString:function(){var e="hsla(",n=t.map(this.hsla(),function(e,t){return e==null&&(e=t>2?1:0),t&&t<3&&(e=Math.round(e*100)+"%"),e});return n[3]===1&&(n.pop(),e="hsl("),e+n.join()+")"},toHexString:function(e){var n=this._rgba.slice(),r=n.pop();return e&&n.push(~~(r*255)),"#"+t.map(n,function(e){return e=(e||0).toString(16),e.length===1?"0"+e:e}).join("")},toString:function(){return this._rgba[3]===0?"transparent":this.toRgbaString()}}),o.fn.parse.prototype=o.fn,u.hsla.to=function(e){if(e[0]==null||e[1]==null||e[2]==null)return[null,null,null,e[3]];var t=e[0]/255,n=e[1]/255,r=e[2]/255,i=e[3],s=Math.max(t,n,r),o=Math.min(t,n,r),u=s-o,a=s+o,f=a*.5,l,c;return o===s?l=0:t===s?l=60*(n-r)/u+360:n===s?l=60*(r-t)/u+120:l=60*(t-n)/u+240,f===0||f===1?c=f:f<=.5?c=u/a:c=u/(2-a),[Math.round(l)%360,c,f,i==null?1:i]},u.hsla.from=function(e){if(e[0]==null||e[1]==null||e[2]==null)return[null,null,null,e[3]];var t=e[0]/360,n=e[1],r=e[2],i=e[3],s=r<=.5?r*(1+n):r+n-r*n,o=2*r-s;return[Math.round(v(o,s,t+1/3)*255),Math.round(v(o,s,t)*255),Math.round(v(o,s,t-1/3)*255),i]},h(u,function(e,r){var s=r.props,u=r.cache,a=r.to,f=r.from;o.fn[e]=function(e){a&&!this[u]&&(this[u]=a(this._rgba));if(e===n)return this[u].slice();var r,i=t.type(e),l=i==="array"||i==="object"?e:arguments,c=this[u].slice();return h(s,function(e,t){var n=l[i==="object"?e:t.idx];n==null&&(n=c[t.idx]),c[t.idx]=p(n,t)}),f?(r=o(f(c)),r[u]=c,r):o(c)},h(s,function(n,r){if(o.fn[n])return;o.fn[n]=function(s){var o=t.type(s),u=n==="alpha"?this._hsla?"hsla":"rgba":e,a=this[u](),f=a[r.idx],l;return o==="undefined"?f:(o==="function"&&(s=s.call(this,f),o=t.type(s)),s==null&&r.empty?this:(o==="string"&&(l=i.exec(s),l&&(s=f+parseFloat(l[2])*(l[1]==="+"?1:-1))),a[r.idx]=s,this[u](a)))}})}),h(r,function(e,n){t.cssHooks[n]={set:function(e,r){var i,s,u="";if(t.type(r)!=="string"||(i=d(r))){r=o(i||r);if(!f.rgba&&r._rgba[3]!==1){s=n==="backgroundColor"?e.parentNode:e;while((u===""||u==="transparent")&&s&&s.style)try{u=t.css(s,"backgroundColor"),s=s.parentNode}catch(a){}r=r.blend(u&&u!=="transparent"?u:"_default")}r=r.toRgbaString()}try{e.style[n]=r}catch(l){}}},t.fx.step[n]=function(e){e.colorInit||(e.start=o(e.elem,n),e.end=o(e.end),e.colorInit=!0),t.cssHooks[n].set(e.elem,e.start.transition(e.end,e.pos))}}),t.cssHooks.borderColor={expand:function(e){var t={};return h(["Top","Right","Bottom","Left"],function(n,r){t["border"+r+"Color"]=e}),t}},c=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function i(){var t=this.ownerDocument.defaultView?this.ownerDocument.defaultView.getComputedStyle(this,null):this.currentStyle,n={},r,i;if(t&&t.length&&t[0]&&t[t[0]]){i=t.length;while(i--)r=t[i],typeof t[r]=="string"&&(n[e.camelCase(r)]=t[r])}else for(r in t)typeof t[r]=="string"&&(n[r]=t[r]);return n}function s(t,n){var i={},s,o;for(s in n)o=n[s],t[s]!==o&&!r[s]&&(e.fx.step[s]||!isNaN(parseFloat(o)))&&(i[s]=o);return i}var n=["add","remove","toggle"],r={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,n){e.fx.step[n]=function(e){if(e.end!=="none"&&!e.setAttr||e.pos===1&&!e.setAttr)jQuery.style(e.elem,n,e.end),e.setAttr=!0}}),e.effects.animateClass=function(t,r,o,u){var a=e.speed(r,o,u);return this.queue(function(){var r=e(this),o=r.attr("class")||"",u,f=a.children?r.find("*").andSelf():r;f=f.map(function(){var t=e(this);return{el:t,start:i.call(this)}}),u=function(){e.each(n,function(e,n){t[n]&&r[n+"Class"](t[n])})},u(),f=f.map(function(){return this.end=i.call(this.el[0]),this.diff=s(this.start,this.end),this}),r.attr("class",o),f=f.map(function(){var t=this,n=e.Deferred(),r=jQuery.extend({},a,{queue:!1,complete:function(){n.resolve(t)}});return this.el.animate(this.diff,r),n.promise()}),e.when.apply(e,f.get()).done(function(){u(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),a.complete.call(r[0])})})},e.fn.extend({_addClass:e.fn.addClass,addClass:function(t,n,r,i){return n?e.effects.animateClass.call(this,{add:t},n,r,i):this._addClass(t)},_removeClass:e.fn.removeClass,removeClass:function(t,n,r,i){return n?e.effects.animateClass.call(this,{remove:t},n,r,i):this._removeClass(t)},_toggleClass:e.fn.toggleClass,toggleClass:function(n,r,i,s,o){return typeof r=="boolean"||r===t?i?e.effects.animateClass.call(this,r?{add:n}:{remove:n},i,s,o):this._toggleClass(n,r):e.effects.animateClass.call(this,{toggle:n},r,i,s)},switchClass:function(t,n,r,i,s){return e.effects.animateClass.call(this,{add:n,remove:t},r,i,s)}})}(),function(){function i(t,n,r,i){e.isPlainObject(t)&&(n=t,t=t.effect),t={effect:t},n==null&&(n={}),e.isFunction(n)&&(i=n,r=null,n={});if(typeof n=="number"||e.fx.speeds[n])i=r,r=n,n={};return e.isFunction(r)&&(i=r,r=null),n&&e.extend(t,n),r=r||n.duration,t.duration=e.fx.off?0:typeof r=="number"?r:r in e.fx.speeds?e.fx.speeds[r]:e.fx.speeds._default,t.complete=i||n.complete,t}function s(t){return!t||typeof t=="number"||e.fx.speeds[t]?!0:typeof t=="string"&&!e.effects.effect[t]?n&&e.effects[t]?!1:!0:!1}e.extend(e.effects,{version:"1.9.2",save:function(e,t){for(var n=0;n<t.length;n++)t[n]!==null&&e.data(r+t[n],e[0].style[t[n]])},restore:function(e,n){var i,s;for(s=0;s<n.length;s++)n[s]!==null&&(i=e.data(r+n[s]),i===t&&(i=""),e.css(n[s],i))},setMode:function(e,t){return t==="toggle"&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var n,r;switch(e[0]){case"top":n=0;break;case"middle":n=.5;break;case"bottom":n=1;break;default:n=e[0]/t.height}switch(e[1]){case"left":r=0;break;case"center":r=.5;break;case"right":r=1;break;default:r=e[1]/t.width}return{x:r,y:n}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var n={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},r=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),i={width:t.width(),height:t.height()},s=document.activeElement;try{s.id}catch(o){s=document.body}return t.wrap(r),(t[0]===s||e.contains(t[0],s))&&e(s).focus(),r=t.parent(),t.css("position")==="static"?(r.css({position:"relative"}),t.css({position:"relative"})):(e.extend(n,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,r){n[r]=t.css(r),isNaN(parseInt(n[r],10))&&(n[r]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(i),r.css(n).show()},removeWrapper:function(t){var n=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===n||e.contains(t[0],n))&&e(n).focus()),t},setTransition:function(t,n,r,i){return i=i||{},e.each(n,function(e,n){var s=t.cssUnit(n);s[0]>0&&(i[n]=s[0]*r+s[1])}),i}}),e.fn.extend({effect:function(){function a(n){function u(){e.isFunction(i)&&i.call(r[0]),e.isFunction(n)&&n()}var r=e(this),i=t.complete,s=t.mode;(r.is(":hidden")?s==="hide":s==="show")?u():o.call(r[0],t,u)}var t=i.apply(this,arguments),r=t.mode,s=t.queue,o=e.effects.effect[t.effect],u=!o&&n&&e.effects[t.effect];return e.fx.off||!o&&!u?r?this[r](t.duration,t.complete):this.each(function(){t.complete&&t.complete.call(this)}):o?s===!1?this.each(a):this.queue(s||"fx",a):u.call(this,{options:t,duration:t.duration,callback:t.complete,mode:t.mode})},_show:e.fn.show,show:function(e){if(s(e))return this._show.apply(this,arguments);var t=i.apply(this,arguments);return t.mode="show",this.effect.call(this,t)},_hide:e.fn.hide,hide:function(e){if(s(e))return this._hide.apply(this,arguments);var t=i.apply(this,arguments);return t.mode="hide",this.effect.call(this,t)},__toggle:e.fn.toggle,toggle:function(t){if(s(t)||typeof t=="boolean"||e.isFunction(t))return this.__toggle.apply(this,arguments);var n=i.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)},cssUnit:function(t){var n=this.css(t),r=[];return e.each(["em","px","%","pt"],function(e,t){n.indexOf(t)>0&&(r=[parseFloat(n),t])}),r}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,n){t[n]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return e===0||e===1?e:-Math.pow(2,8*(e-1))*Math.sin(((e-1)*80-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){var t,n=4;while(e<((t=Math.pow(2,--n))-1)/11);return 1/Math.pow(4,3-n)-7.5625*Math.pow((t*3-2)/22-e,2)}}),e.each(t,function(t,n){e.easing["easeIn"+t]=n,e.easing["easeOut"+t]=function(e){return 1-n(1-e)},e.easing["easeInOut"+t]=function(e){return e<.5?n(e*2)/2:1-n(e*-2+2)/2}})}()}(jQuery);(function(e,t){var n=/up|down|vertical/,r=/up|left|vertical|horizontal/;e.effects.effect.blind=function(t,i){var s=e(this),o=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(s,t.mode||"hide"),a=t.direction||"up",f=n.test(a),l=f?"height":"width",c=f?"top":"left",h=r.test(a),p={},d=u==="show",v,m,g;s.parent().is(".ui-effects-wrapper")?e.effects.save(s.parent(),o):e.effects.save(s,o),s.show(),v=e.effects.createWrapper(s).css({overflow:"hidden"}),m=v[l](),g=parseFloat(v.css(c))||0,p[l]=d?m:0,h||(s.css(f?"bottom":"right",0).css(f?"top":"left","auto").css({position:"absolute"}),p[c]=d?g:m+g),d&&(v.css(l,0),h||v.css(c,g+m)),v.animate(p,{duration:t.duration,easing:t.easing,queue:!1,complete:function(){u==="hide"&&s.hide(),e.effects.restore(s,o),e.effects.removeWrapper(s),i()}})}})(jQuery);(function(e,t){e.effects.effect.bounce=function(t,n){var r=e(this),i=["position","top","bottom","left","right","height","width"],s=e.effects.setMode(r,t.mode||"effect"),o=s==="hide",u=s==="show",a=t.direction||"up",f=t.distance,l=t.times||5,c=l*2+(u||o?1:0),h=t.duration/c,p=t.easing,d=a==="up"||a==="down"?"top":"left",v=a==="up"||a==="left",m,g,y,b=r.queue(),w=b.length;(u||o)&&i.push("opacity"),e.effects.save(r,i),r.show(),e.effects.createWrapper(r),f||(f=r[d==="top"?"outerHeight":"outerWidth"]()/3),u&&(y={opacity:1},y[d]=0,r.css("opacity",0).css(d,v?-f*2:f*2).animate(y,h,p)),o&&(f/=Math.pow(2,l-1)),y={},y[d]=0;for(m=0;m<l;m++)g={},g[d]=(v?"-=":"+=")+f,r.animate(g,h,p).animate(y,h,p),f=o?f*2:f/2;o&&(g={opacity:0},g[d]=(v?"-=":"+=")+f,r.animate(g,h,p)),r.queue(function(){o&&r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()}),w>1&&b.splice.apply(b,[1,0].concat(b.splice(w,c+1))),r.dequeue()}})(jQuery);(function(e,t){e.effects.effect.clip=function(t,n){var r=e(this),i=["position","top","bottom","left","right","height","width"],s=e.effects.setMode(r,t.mode||"hide"),o=s==="show",u=t.direction||"vertical",a=u==="vertical",f=a?"height":"width",l=a?"top":"left",c={},h,p,d;e.effects.save(r,i),r.show(),h=e.effects.createWrapper(r).css({overflow:"hidden"}),p=r[0].tagName==="IMG"?h:r,d=p[f](),o&&(p.css(f,0),p.css(l,d/2)),c[f]=o?d:0,c[l]=o?0:d/2,p.animate(c,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){o||r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()}})}})(jQuery);(function(e,t){e.effects.effect.drop=function(t,n){var r=e(this),i=["position","top","bottom","left","right","opacity","height","width"],s=e.effects.setMode(r,t.mode||"hide"),o=s==="show",u=t.direction||"left",a=u==="up"||u==="down"?"top":"left",f=u==="up"||u==="left"?"pos":"neg",l={opacity:o?1:0},c;e.effects.save(r,i),r.show(),e.effects.createWrapper(r),c=t.distance||r[a==="top"?"outerHeight":"outerWidth"](!0)/2,o&&r.css("opacity",0).css(a,f==="pos"?-c:c),l[a]=(o?f==="pos"?"+=":"-=":f==="pos"?"-=":"+=")+c,r.animate(l,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){s==="hide"&&r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()}})}})(jQuery);(function(e,t){e.effects.effect.explode=function(t,n){function y(){c.push(this),c.length===r*i&&b()}function b(){s.css({visibility:"visible"}),e(c).remove(),u||s.hide(),n()}var r=t.pieces?Math.round(Math.sqrt(t.pieces)):3,i=r,s=e(this),o=e.effects.setMode(s,t.mode||"hide"),u=o==="show",a=s.show().css("visibility","hidden").offset(),f=Math.ceil(s.outerWidth()/i),l=Math.ceil(s.outerHeight()/r),c=[],h,p,d,v,m,g;for(h=0;h<r;h++){v=a.top+h*l,g=h-(r-1)/2;for(p=0;p<i;p++)d=a.left+p*f,m=p-(i-1)/2,s.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-p*f,top:-h*l}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:f,height:l,left:d+(u?m*f:0),top:v+(u?g*l:0),opacity:u?0:1}).animate({left:d+(u?0:m*f),top:v+(u?0:g*l),opacity:u?1:0},t.duration||500,t.easing,y)}}})(jQuery);(function(e,t){e.effects.effect.fade=function(t,n){var r=e(this),i=e.effects.setMode(r,t.mode||"toggle");r.animate({opacity:i},{queue:!1,duration:t.duration,easing:t.easing,complete:n})}})(jQuery);(function(e,t){e.effects.effect.fold=function(t,n){var r=e(this),i=["position","top","bottom","left","right","height","width"],s=e.effects.setMode(r,t.mode||"hide"),o=s==="show",u=s==="hide",a=t.size||15,f=/([0-9]+)%/.exec(a),l=!!t.horizFirst,c=o!==l,h=c?["width","height"]:["height","width"],p=t.duration/2,d,v,m={},g={};e.effects.save(r,i),r.show(),d=e.effects.createWrapper(r).css({overflow:"hidden"}),v=c?[d.width(),d.height()]:[d.height(),d.width()],f&&(a=parseInt(f[1],10)/100*v[u?0:1]),o&&d.css(l?{height:0,width:a}:{height:a,width:0}),m[h[0]]=o?v[0]:a,g[h[1]]=o?v[1]:0,d.animate(m,p,t.easing).animate(g,p,t.easing,function(){u&&r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()})}})(jQuery);(function(e,t){e.effects.effect.highlight=function(t,n){var r=e(this),i=["backgroundImage","backgroundColor","opacity"],s=e.effects.setMode(r,t.mode||"show"),o={backgroundColor:r.css("backgroundColor")};s==="hide"&&(o.opacity=0),e.effects.save(r,i),r.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(o,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){s==="hide"&&r.hide(),e.effects.restore(r,i),n()}})}})(jQuery);(function(e,t){e.effects.effect.pulsate=function(t,n){var r=e(this),i=e.effects.setMode(r,t.mode||"show"),s=i==="show",o=i==="hide",u=s||i==="hide",a=(t.times||5)*2+(u?1:0),f=t.duration/a,l=0,c=r.queue(),h=c.length,p;if(s||!r.is(":visible"))r.css("opacity",0).show(),l=1;for(p=1;p<a;p++)r.animate({opacity:l},f,t.easing),l=1-l;r.animate({opacity:l},f,t.easing),r.queue(function(){o&&r.hide(),n()}),h>1&&c.splice.apply(c,[1,0].concat(c.splice(h,a+1))),r.dequeue()}})(jQuery);(function(e,t){e.effects.effect.puff=function(t,n){var r=e(this),i=e.effects.setMode(r,t.mode||"hide"),s=i==="hide",o=parseInt(t.percent,10)||150,u=o/100,a={height:r.height(),width:r.width(),outerHeight:r.outerHeight(),outerWidth:r.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:i,complete:n,percent:s?o:100,from:s?a:{height:a.height*u,width:a.width*u,outerHeight:a.outerHeight*u,outerWidth:a.outerWidth*u}}),r.effect(t)},e.effects.effect.scale=function(t,n){var r=e(this),i=e.extend(!0,{},t),s=e.effects.setMode(r,t.mode||"effect"),o=parseInt(t.percent,10)||(parseInt(t.percent,10)===0?0:s==="hide"?0:100),u=t.direction||"both",a=t.origin,f={height:r.height(),width:r.width(),outerHeight:r.outerHeight(),outerWidth:r.outerWidth()},l={y:u!=="horizontal"?o/100:1,x:u!=="vertical"?o/100:1};i.effect="size",i.queue=!1,i.complete=n,s!=="effect"&&(i.origin=a||["middle","center"],i.restore=!0),i.from=t.from||(s==="show"?{height:0,width:0,outerHeight:0,outerWidth:0}:f),i.to={height:f.height*l.y,width:f.width*l.x,outerHeight:f.outerHeight*l.y,outerWidth:f.outerWidth*l.x},i.fade&&(s==="show"&&(i.from.opacity=0,i.to.opacity=1),s==="hide"&&(i.from.opacity=1,i.to.opacity=0)),r.effect(i)},e.effects.effect.size=function(t,n){var r,i,s,o=e(this),u=["position","top","bottom","left","right","width","height","overflow","opacity"],a=["position","top","bottom","left","right","overflow","opacity"],f=["width","height","overflow"],l=["fontSize"],c=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],h=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(o,t.mode||"effect"),d=t.restore||p!=="effect",v=t.scale||"both",m=t.origin||["middle","center"],g=o.css("position"),y=d?u:a,b={height:0,width:0,outerHeight:0,outerWidth:0};p==="show"&&o.show(),r={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},t.mode==="toggle"&&p==="show"?(o.from=t.to||b,o.to=t.from||r):(o.from=t.from||(p==="show"?b:r),o.to=t.to||(p==="hide"?b:r)),s={from:{y:o.from.height/r.height,x:o.from.width/r.width},to:{y:o.to.height/r.height,x:o.to.width/r.width}};if(v==="box"||v==="both")s.from.y!==s.to.y&&(y=y.concat(c),o.from=e.effects.setTransition(o,c,s.from.y,o.from),o.to=e.effects.setTransition(o,c,s.to.y,o.to)),s.from.x!==s.to.x&&(y=y.concat(h),o.from=e.effects.setTransition(o,h,s.from.x,o.from),o.to=e.effects.setTransition(o,h,s.to.x,o.to));(v==="content"||v==="both")&&s.from.y!==s.to.y&&(y=y.concat(l).concat(f),o.from=e.effects.setTransition(o,l,s.from.y,o.from),o.to=e.effects.setTransition(o,l,s.to.y,o.to)),e.effects.save(o,y),o.show(),e.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),m&&(i=e.effects.getBaseline(m,r),o.from.top=(r.outerHeight-o.outerHeight())*i.y,o.from.left=(r.outerWidth-o.outerWidth())*i.x,o.to.top=(r.outerHeight-o.to.outerHeight)*i.y,o.to.left=(r.outerWidth-o.to.outerWidth)*i.x),o.css(o.from);if(v==="content"||v==="both")c=c.concat(["marginTop","marginBottom"]).concat(l),h=h.concat(["marginLeft","marginRight"]),f=u.concat(c).concat(h),o.find("*[width]").each(function(){var n=e(this),r={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()};d&&e.effects.save(n,f),n.from={height:r.height*s.from.y,width:r.width*s.from.x,outerHeight:r.outerHeight*s.from.y,outerWidth:r.outerWidth*s.from.x},n.to={height:r.height*s.to.y,width:r.width*s.to.x,outerHeight:r.height*s.to.y,outerWidth:r.width*s.to.x},s.from.y!==s.to.y&&(n.from=e.effects.setTransition(n,c,s.from.y,n.from),n.to=e.effects.setTransition(n,c,s.to.y,n.to)),s.from.x!==s.to.x&&(n.from=e.effects.setTransition(n,h,s.from.x,n.from),n.to=e.effects.setTransition(n,h,s.to.x,n.to)),n.css(n.from),n.animate(n.to,t.duration,t.easing,function(){d&&e.effects.restore(n,f)})});o.animate(o.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){o.to.opacity===0&&o.css("opacity",o.from.opacity),p==="hide"&&o.hide(),e.effects.restore(o,y),d||(g==="static"?o.css({position:"relative",top:o.to.top,left:o.to.left}):e.each(["top","left"],function(e,t){o.css(t,function(t,n){var r=parseInt(n,10),i=e?o.to.left:o.to.top;return n==="auto"?i+"px":r+i+"px"})})),e.effects.removeWrapper(o),n()}})}})(jQuery);(function(e,t){e.effects.effect.shake=function(t,n){var r=e(this),i=["position","top","bottom","left","right","height","width"],s=e.effects.setMode(r,t.mode||"effect"),o=t.direction||"left",u=t.distance||20,a=t.times||3,f=a*2+1,l=Math.round(t.duration/f),c=o==="up"||o==="down"?"top":"left",h=o==="up"||o==="left",p={},d={},v={},m,g=r.queue(),y=g.length;e.effects.save(r,i),r.show(),e.effects.createWrapper(r),p[c]=(h?"-=":"+=")+u,d[c]=(h?"+=":"-=")+u*2,v[c]=(h?"-=":"+=")+u*2,r.animate(p,l,t.easing);for(m=1;m<a;m++)r.animate(d,l,t.easing).animate(v,l,t.easing);r.animate(d,l,t.easing).animate(p,l/2,t.easing).queue(function(){s==="hide"&&r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()}),y>1&&g.splice.apply(g,[1,0].concat(g.splice(y,f+1))),r.dequeue()}})(jQuery);(function(e,t){e.effects.effect.slide=function(t,n){var r=e(this),i=["position","top","bottom","left","right","width","height"],s=e.effects.setMode(r,t.mode||"show"),o=s==="show",u=t.direction||"left",a=u==="up"||u==="down"?"top":"left",f=u==="up"||u==="left",l,c={};e.effects.save(r,i),r.show(),l=t.distance||r[a==="top"?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(r).css({overflow:"hidden"}),o&&r.css(a,f?isNaN(l)?"-"+l:-l:l),c[a]=(o?f?"+=":"-=":f?"-=":"+=")+l,r.animate(c,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){s==="hide"&&r.hide(),e.effects.restore(r,i),e.effects.removeWrapper(r),n()}})}})(jQuery);(function(e,t){e.effects.effect.transfer=function(t,n){var r=e(this),i=e(t.to),s=i.css("position")==="fixed",o=e("body"),u=s?o.scrollTop():0,a=s?o.scrollLeft():0,f=i.offset(),l={top:f.top-u,left:f.left-a,height:i.innerHeight(),width:i.innerWidth()},c=r.offset(),h=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(t.className).css({top:c.top-u,left:c.left-a,height:r.innerHeight(),width:r.innerWidth(),position:s?"fixed":"absolute"}).animate(l,t.duration,t.easing,function(){h.remove(),n()})}})(jQuery);(function(e,t){var n=!1;e.widget("ui.menu",{version:"1.9.2",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content ui-corner-all").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}).bind("click"+this.eventNamespace,e.proxy(function(e){this.options.disabled&&e.preventDefault()},this)),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item > a":function(e){e.preventDefault()},"click .ui-state-disabled > a":function(e){e.preventDefault()},"click .ui-menu-item:has(a)":function(t){var r=e(t.target).closest(".ui-menu-item");!n&&r.not(".ui-state-disabled").length&&(n=!0,this.select(t),r.has(".ui-menu").length?this.expand(t):this.element.is(":focus")||(this.element.trigger("focus",[!0]),this.active&&this.active.parents(".ui-menu").length===1&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){var n=e(t.currentTarget);n.siblings().children(".ui-state-active").removeClass("ui-state-active"),this.focus(t,n)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var n=this.active||this.element.children(".ui-menu-item").eq(0);t||this.focus(e,n)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){e(t.target).closest(".ui-menu").length||this.collapseAll(t),n=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").andSelf().removeClass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").children("a").removeUniqueId().removeClass("ui-corner-all ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){function a(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var n,r,i,s,o,u=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:u=!1,r=this.previousFilter||"",i=String.fromCharCode(t.keyCode),s=!1,clearTimeout(this.filterTimer),i===r?s=!0:i=r+i,o=new RegExp("^"+a(i),"i"),n=this.activeMenu.children(".ui-menu-item").filter(function(){return o.test(e(this).children("a").text())}),n=s&&n.index(this.active.next())!==-1?this.active.nextAll(".ui-menu-item"):n,n.length||(i=String.fromCharCode(t.keyCode),o=new RegExp("^"+a(i),"i"),n=this.activeMenu.children(".ui-menu-item").filter(function(){return o.test(e(this).children("a").text())})),n.length?(this.focus(t,n),n.length>1?(this.previousFilter=i,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter):delete this.previousFilter}u&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.children("a[aria-haspopup='true']").length?this.expand(e):this.select(e))},refresh:function(){var t,n=this.options.icons.submenu,r=this.element.find(this.options.menus);r.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-corner-all").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),r=t.prev("a"),i=e("<span>").addClass("ui-menu-icon ui-icon "+n).data("ui-menu-submenu-carat",!0);r.attr("aria-haspopup","true").prepend(i),t.attr("aria-labelledby",r.attr("id"))}),t=r.add(this.element),t.children(":not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","presentation").children("a").uniqueId().addClass("ui-corner-all").attr({tabIndex:-1,role:this._itemRole()}),t.children(":not(.ui-menu-item)").each(function(){var t=e(this);/[^\-—–\s]/.test(t.text())||t.addClass("ui-widget-content ui-menu-divider")}),t.children(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},focus:function(e,t){var n,r;this.blur(e,e&&e.type==="focus"),this._scrollIntoView(t),this.active=t.first(),r=this.active.children("a").addClass("ui-state-focus"),this.options.role&&this.element.attr("aria-activedescendant",r.attr("id")),this.active.parent().closest(".ui-menu-item").children("a:first").addClass("ui-state-active"),e&&e.type==="keydown"?this._close():this.timer=this._delay(function(){this._close()},this.delay),n=t.children(".ui-menu"),n.length&&/^mouse/.test(e.type)&&this._startOpening(n),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var n,r,i,s,o,u;this._hasScroll()&&(n=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,r=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,i=t.offset().top-this.activeMenu.offset().top-n-r,s=this.activeMenu.scrollTop(),o=this.activeMenu.height(),u=t.height(),i<0?this.activeMenu.scrollTop(s+i):i+u>o&&this.activeMenu.scrollTop(s+i-o+u))},blur:function(e,t){t||clearTimeout(this.timer);if(!this.active)return;this.active.children("a").removeClass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active})},_startOpening:function(e){clearTimeout(this.timer);if(e.attr("aria-hidden")!=="true")return;this.timer=this._delay(function(){this._close(),this._open(e)},this.delay)},_open:function(t){var n=e.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(n)},collapseAll:function(t,n){clearTimeout(this.timer),this.timer=this._delay(function(){var r=n?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));r.length||(r=this.element),this._close(r),this.blur(t),this.activeMenu=r},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeClass("ui-state-active")},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").children(".ui-menu-item").first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_move:function(e,t,n){var r;this.active&&(e==="first"||e==="last"?r=this.active[e==="first"?"prevAll":"nextAll"](".ui-menu-item").eq(-1):r=this.active[e+"All"](".ui-menu-item").eq(0));if(!r||!r.length||!this.active)r=this.activeMenu.children(".ui-menu-item")[t]();this.focus(n,r)},nextPage:function(t){var n,r,i;if(!this.active){this.next(t);return}if(this.isLastItem())return;this._hasScroll()?(r=this.active.offset().top,i=this.element.height(),this.active.nextAll(".ui-menu-item").each(function(){return n=e(this),n.offset().top-r-i<0}),this.focus(t,n)):this.focus(t,this.activeMenu.children(".ui-menu-item")[this.active?"last":"first"]())},previousPage:function(t){var n,r,i;if(!this.active){this.next(t);return}if(this.isFirstItem())return;this._hasScroll()?(r=this.active.offset().top,i=this.element.height(),this.active.prevAll(".ui-menu-item").each(function(){return n=e(this),n.offset().top-r+i>0}),this.focus(t,n)):this.focus(t,this.activeMenu.children(".ui-menu-item").first())},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||e(t.target).closest(".ui-menu-item");var n={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,n)}})})(jQuery);(function(e,t){e.widget("ui.progressbar",{version:"1.9.2",options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=e("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element),this.oldValue=this._value(),this._refreshValue()},_destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove()},value:function(e){return e===t?this._value():(this._setOption("value",e),this)},_setOption:function(e,t){e==="value"&&(this.options.value=t,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),this._super(e,t)},_value:function(){var e=this.options.value;return typeof e!="number"&&(e=0),Math.min(this.options.max,Math.max(this.min,e))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var e=this.value(),t=this._percentage();this.oldValue!==e&&(this.oldValue=e,this._trigger("change")),this.valueDiv.toggle(e>this.min).toggleClass("ui-corner-right",e===this.options.max).width(t.toFixed(0)+"%"),this.element.attr("aria-valuenow",e)}})})(jQuery);(function(e,t){e.widget("ui.resizable",e.ui.mouse,{version:"1.9.2",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1e3},_create:function(){var t=this,n=this.options;this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!n.aspectRatio,aspectRatio:n.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:n.helper||n.ghost||n.animate?n.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("resizable",this.element.data("resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=n.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se");if(this.handles.constructor==String){this.handles=="all"&&(this.handles="n,e,s,w,se,sw,ne,nw");var r=this.handles.split(",");this.handles={};for(var i=0;i<r.length;i++){var s=e.trim(r[i]),o="ui-resizable-"+s,u=e('<div class="ui-resizable-handle '+o+'"></div>');u.css({zIndex:n.zIndex}),"se"==s&&u.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(u)}}this._renderAxis=function(t){t=t||this.element;for(var n in this.handles){this.handles[n].constructor==String&&(this.handles[n]=e(this.handles[n],this.element).show());if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var r=e(this.handles[n],this.element),i=0;i=/sw|ne|nw|se|n|s/.test(n)?r.outerHeight():r.outerWidth();var s=["padding",/ne|nw|n/.test(n)?"Top":/se|sw|s/.test(n)?"Bottom":/^e$/.test(n)?"Right":"Left"].join("");t.css(s,i),this._proportionallyResize()}if(!e(this.handles[n]).length)continue}},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){if(!t.resizing){if(this.className)var e=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);t.axis=e&&e[1]?e[1]:"se"}}),n.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){if(n.disabled)return;e(this).removeClass("ui-resizable-autohide"),t._handles.show()}).mouseleave(function(){if(n.disabled)return;t.resizing||(e(this).addClass("ui-resizable-autohide"),t._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){t(this.element);var n=this.element;this.originalElement.css({position:n.css("position"),width:n.outerWidth(),height:n.outerHeight(),top:n.css("top"),left:n.css("left")}).insertAfter(n),n.remove()}return this.originalElement.css("resize",this.originalResizeStyle),t(this.originalElement),this},_mouseCapture:function(t){var n=!1;for(var r in this.handles)e(this.handles[r])[0]==t.target&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(t){var r=this.options,i=this.element.position(),s=this.element;this.resizing=!0,this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()},(s.is(".ui-draggable")||/absolute/.test(s.css("position")))&&s.css({position:"absolute",top:i.top,left:i.left}),this._renderProxy();var o=n(this.helper.css("left")),u=n(this.helper.css("top"));r.containment&&(o+=e(r.containment).scrollLeft()||0,u+=e(r.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:o,top:u},this.size=this._helper?{width:s.outerWidth(),height:s.outerHeight()}:{width:s.width(),height:s.height()},this.originalSize=this._helper?{width:s.outerWidth(),height:s.outerHeight()}:{width:s.width(),height:s.height()},this.originalPosition={left:o,top:u},this.sizeDiff={width:s.outerWidth()-s.width(),height:s.outerHeight()-s.height()},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio=typeof r.aspectRatio=="number"?r.aspectRatio:this.originalSize.width/this.originalSize.height||1;var a=e(".ui-resizable-"+this.axis).css("cursor");return e("body").css("cursor",a=="auto"?this.axis+"-resize":a),s.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(e){var t=this.helper,n=this.options,r={},i=this,s=this.originalMousePosition,o=this.axis,u=e.pageX-s.left||0,a=e.pageY-s.top||0,f=this._change[o];if(!f)return!1;var l=f.apply(this,[e,u,a]);this._updateVirtualBoundaries(e.shiftKey);if(this._aspectRatio||e.shiftKey)l=this._updateRatio(l,e);return l=this._respectSize(l,e),this._propagate("resize",e),t.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"}),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),this._updateCache(l),this._trigger("resize",e,this.ui()),!1},_mouseStop:function(t){this.resizing=!1;var n=this.options,r=this;if(this._helper){var i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),o=s&&e.ui.hasScroll(i[0],"left")?0:r.sizeDiff.height,u=s?0:r.sizeDiff.width,a={width:r.helper.width()-u,height:r.helper.height()-o},f=parseInt(r.element.css("left"),10)+(r.position.left-r.originalPosition.left)||null,l=parseInt(r.element.css("top"),10)+(r.position.top-r.originalPosition.top)||null;n.animate||this.element.css(e.extend(a,{top:l,left:f})),r.helper.height(r.size.height),r.helper.width(r.size.width),this._helper&&!n.animate&&this._proportionallyResize()}return e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updateVirtualBoundaries:function(e){var t=this.options,n,i,s,o,u;u={minWidth:r(t.minWidth)?t.minWidth:0,maxWidth:r(t.maxWidth)?t.maxWidth:Infinity,minHeight:r(t.minHeight)?t.minHeight:0,maxHeight:r(t.maxHeight)?t.maxHeight:Infinity};if(this._aspectRatio||e)n=u.minHeight*this.aspectRatio,s=u.minWidth/this.aspectRatio,i=u.maxHeight*this.aspectRatio,o=u.maxWidth/this.aspectRatio,n>u.minWidth&&(u.minWidth=n),s>u.minHeight&&(u.minHeight=s),i<u.maxWidth&&(u.maxWidth=i),o<u.maxHeight&&(u.maxHeight=o);this._vBoundaries=u},_updateCache:function(e){var t=this.options;this.offset=this.helper.offset(),r(e.left)&&(this.position.left=e.left),r(e.top)&&(this.position.top=e.top),r(e.height)&&(this.size.height=e.height),r(e.width)&&(this.size.width=e.width)},_updateRatio:function(e,t){var n=this.options,i=this.position,s=this.size,o=this.axis;return r(e.height)?e.width=e.height*this.aspectRatio:r(e.width)&&(e.height=e.width/this.aspectRatio),o=="sw"&&(e.left=i.left+(s.width-e.width),e.top=null),o=="nw"&&(e.top=i.top+(s.height-e.height),e.left=i.left+(s.width-e.width)),e},_respectSize:function(e,t){var n=this.helper,i=this._vBoundaries,s=this._aspectRatio||t.shiftKey,o=this.axis,u=r(e.width)&&i.maxWidth&&i.maxWidth<e.width,a=r(e.height)&&i.maxHeight&&i.maxHeight<e.height,f=r(e.width)&&i.minWidth&&i.minWidth>e.width,l=r(e.height)&&i.minHeight&&i.minHeight>e.height;f&&(e.width=i.minWidth),l&&(e.height=i.minHeight),u&&(e.width=i.maxWidth),a&&(e.height=i.maxHeight);var c=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,p=/sw|nw|w/.test(o),d=/nw|ne|n/.test(o);f&&p&&(e.left=c-i.minWidth),u&&p&&(e.left=c-i.maxWidth),l&&d&&(e.top=h-i.minHeight),a&&d&&(e.top=h-i.maxHeight);var v=!e.width&&!e.height;return v&&!e.left&&e.top?e.top=null:v&&!e.top&&e.left&&(e.left=null),e},_proportionallyResize:function(){var t=this.options;if(!this._proportionallyResizeElements.length)return;var n=this.helper||this.element;for(var r=0;r<this._proportionallyResizeElements.length;r++){var i=this._proportionallyResizeElements[r];if(!this.borderDif){var s=[i.css("borderTopWidth"),i.css("borderRightWidth"),i.css("borderBottomWidth"),i.css("borderLeftWidth")],o=[i.css("paddingTop"),i.css("paddingRight"),i.css("paddingBottom"),i.css("paddingLeft")];this.borderDif=e.map(s,function(e,t){var n=parseInt(e,10)||0,r=parseInt(o[t],10)||0;return n+r})}i.css({height:n.height()-this.borderDif[0]-this.borderDif[2]||0,width:n.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var t=this.element,n=this.options;this.elementOffset=t.offset();if(this._helper){this.helper=this.helper||e('<div style="overflow:hidden;"></div>');var r=e.ui.ie6?1:0,i=e.ui.ie6?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+i,height:this.element.outerHeight()+i,position:"absolute",left:this.elementOffset.left-r+"px",top:this.elementOffset.top-r+"px",zIndex:++n.zIndex}),this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(e,t,n){return{width:this.originalSize.width+t}},w:function(e,t,n){var r=this.options,i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,n){var r=this.options,i=this.originalSize,s=this.originalPosition;return{top:s.top+n,height:i.height-n}},s:function(e,t,n){return{height:this.originalSize.height+n}},se:function(t,n,r){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,n,r]))},sw:function(t,n,r){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,n,r]))},ne:function(t,n,r){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,n,r]))},nw:function(t,n,r){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,n,r]))}},_propagate:function(t,n){e.ui.plugin.call(this,t,[n,this.ui()]),t!="resize"&&this._trigger(t,n,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","alsoResize",{start:function(t,n){var r=e(this).data("resizable"),i=r.options,s=function(t){e(t).each(function(){var t=e(this);t.data("resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};typeof i.alsoResize=="object"&&!i.alsoResize.parentNode?i.alsoResize.length?(i.alsoResize=i.alsoResize[0],s(i.alsoResize)):e.each(i.alsoResize,function(e){s(e)}):s(i.alsoResize)},resize:function(t,n){var r=e(this).data("resizable"),i=r.options,s=r.originalSize,o=r.originalPosition,u={height:r.size.height-s.height||0,width:r.size.width-s.width||0,top:r.position.top-o.top||0,left:r.position.left-o.left||0},a=function(t,r){e(t).each(function(){var t=e(this),i=e(this).data("resizable-alsoresize"),s={},o=r&&r.length?r:t.parents(n.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(o,function(e,t){var n=(i[t]||0)+(u[t]||0);n&&n>=0&&(s[t]=n||null)}),t.css(s)})};typeof i.alsoResize=="object"&&!i.alsoResize.nodeType?e.each(i.alsoResize,function(e,t){a(e,t)}):a(i.alsoResize)},stop:function(t,n){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","animate",{stop:function(t,n){var r=e(this).data("resizable"),i=r.options,s=r._proportionallyResizeElements,o=s.length&&/textarea/i.test(s[0].nodeName),u=o&&e.ui.hasScroll(s[0],"left")?0:r.sizeDiff.height,a=o?0:r.sizeDiff.width,f={width:r.size.width-a,height:r.size.height-u},l=parseInt(r.element.css("left"),10)+(r.position.left-r.originalPosition.left)||null,c=parseInt(r.element.css("top"),10)+(r.position.top-r.originalPosition.top)||null;r.element.animate(e.extend(f,c&&l?{top:c,left:l}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var n={width:parseInt(r.element.css("width"),10),height:parseInt(r.element.css("height"),10),top:parseInt(r.element.css("top"),10),left:parseInt(r.element.css("left"),10)};s&&s.length&&e(s[0]).css({width:n.width,height:n.height}),r._updateCache(n),r._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(t,r){var i=e(this).data("resizable"),s=i.options,o=i.element,u=s.containment,a=u instanceof e?u.get(0):/parent/.test(u)?o.parent().get(0):u;if(!a)return;i.containerElement=e(a);if(/document/.test(u)||u==document)i.containerOffset={left:0,top:0},i.containerPosition={left:0,top:0},i.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight};else{var f=e(a),l=[];e(["Top","Right","Left","Bottom"]).each(function(e,t){l[e]=n(f.css("padding"+t))}),i.containerOffset=f.offset(),i.containerPosition=f.position(),i.containerSize={height:f.innerHeight()-l[3],width:f.innerWidth()-l[1]};var c=i.containerOffset,h=i.containerSize.height,p=i.containerSize.width,d=e.ui.hasScroll(a,"left")?a.scrollWidth:p,v=e.ui.hasScroll(a)?a.scrollHeight:h;i.parentData={element:a,left:c.left,top:c.top,width:d,height:v}}},resize:function(t,n){var r=e(this).data("resizable"),i=r.options,s=r.containerSize,o=r.containerOffset,u=r.size,a=r.position,f=r._aspectRatio||t.shiftKey,l={top:0,left:0},c=r.containerElement;c[0]!=document&&/static/.test(c.css("position"))&&(l=o),a.left<(r._helper?o.left:0)&&(r.size.width=r.size.width+(r._helper?r.position.left-o.left:r.position.left-l.left),f&&(r.size.height=r.size.width/r.aspectRatio),r.position.left=i.helper?o.left:0),a.top<(r._helper?o.top:0)&&(r.size.height=r.size.height+(r._helper?r.position.top-o.top:r.position.top),f&&(r.size.width=r.size.height*r.aspectRatio),r.position.top=r._helper?o.top:0),r.offset.left=r.parentData.left+r.position.left,r.offset.top=r.parentData.top+r.position.top;var h=Math.abs((r._helper?r.offset.left-l.left:r.offset.left-l.left)+r.sizeDiff.width),p=Math.abs((r._helper?r.offset.top-l.top:r.offset.top-o.top)+r.sizeDiff.height),d=r.containerElement.get(0)==r.element.parent().get(0),v=/relative|absolute/.test(r.containerElement.css("position"));d&&v&&(h-=r.parentData.left),h+r.size.width>=r.parentData.width&&(r.size.width=r.parentData.width-h,f&&(r.size.height=r.size.width/r.aspectRatio)),p+r.size.height>=r.parentData.height&&(r.size.height=r.parentData.height-p,f&&(r.size.width=r.size.height*r.aspectRatio))},stop:function(t,n){var r=e(this).data("resizable"),i=r.options,s=r.position,o=r.containerOffset,u=r.containerPosition,a=r.containerElement,f=e(r.helper),l=f.offset(),c=f.outerWidth()-r.sizeDiff.width,h=f.outerHeight()-r.sizeDiff.height;r._helper&&!i.animate&&/relative/.test(a.css("position"))&&e(this).css({left:l.left-u.left-o.left,width:c,height:h}),r._helper&&!i.animate&&/static/.test(a.css("position"))&&e(this).css({left:l.left-u.left-o.left,width:c,height:h})}}),e.ui.plugin.add("resizable","ghost",{start:function(t,n){var r=e(this).data("resizable"),i=r.options,s=r.size;r.ghost=r.originalElement.clone(),r.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof i.ghost=="string"?i.ghost:""),r.ghost.appendTo(r.helper)},resize:function(t,n){var r=e(this).data("resizable"),i=r.options;r.ghost&&r.ghost.css({position:"relative",height:r.size.height,width:r.size.width})},stop:function(t,n){var r=e(this).data("resizable"),i=r.options;r.ghost&&r.helper&&r.helper.get(0).removeChild(r.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(t,n){var r=e(this).data("resizable"),i=r.options,s=r.size,o=r.originalSize,u=r.originalPosition,a=r.axis,f=i._aspectRatio||t.shiftKey;i.grid=typeof i.grid=="number"?[i.grid,i.grid]:i.grid;var l=Math.round((s.width-o.width)/(i.grid[0]||1))*(i.grid[0]||1),c=Math.round((s.height-o.height)/(i.grid[1]||1))*(i.grid[1]||1);/^(se|s|e)$/.test(a)?(r.size.width=o.width+l,r.size.height=o.height+c):/^(ne)$/.test(a)?(r.size.width=o.width+l,r.size.height=o.height+c,r.position.top=u.top-c):/^(sw)$/.test(a)?(r.size.width=o.width+l,r.size.height=o.height+c,r.position.left=u.left-l):(r.size.width=o.width+l,r.size.height=o.height+c,r.position.top=u.top-c,r.position.left=u.left-l)}});var n=function(e){return parseInt(e,10)||0},r=function(e){return!isNaN(parseInt(e,10))}})(jQuery);(function(e,t){e.widget("ui.selectable",e.ui.mouse,{version:"1.9.2",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch"},_create:function(){var t=this;this.element.addClass("ui-selectable"),this.dragged=!1;var n;this.refresh=function(){n=e(t.options.filter,t.element[0]),n.addClass("ui-selectee"),n.each(function(){var t=e(this),n=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:n.left,top:n.top,right:n.left+t.outerWidth(),bottom:n.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=n.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var n=this;this.opos=[t.pageX,t.pageY];if(this.options.disabled)return;var r=this.options;this.selectees=e(r.filter,this.element[0]),this._trigger("start",t),e(r.appendTo).append(this.helper),this.helper.css({left:t.clientX,top:t.clientY,width:0,height:0}),r.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var r=e.data(this,"selectable-item");r.startselected=!0,!t.metaKey&&!t.ctrlKey&&(r.$element.removeClass("ui-selected"),r.selected=!1,r.$element.addClass("ui-unselecting"),r.unselecting=!0,n._trigger("unselecting",t,{unselecting:r.element}))}),e(t.target).parents().andSelf().each(function(){var r=e.data(this,"selectable-item");if(r){var i=!t.metaKey&&!t.ctrlKey||!r.$element.hasClass("ui-selected");return r.$element.removeClass(i?"ui-unselecting":"ui-selected").addClass(i?"ui-selecting":"ui-unselecting"),r.unselecting=!i,r.selecting=i,r.selected=i,i?n._trigger("selecting",t,{selecting:r.element}):n._trigger("unselecting",t,{unselecting:r.element}),!1}})},_mouseDrag:function(t){var n=this;this.dragged=!0;if(this.options.disabled)return;var r=this.options,i=this.opos[0],s=this.opos[1],o=t.pageX,u=t.pageY;if(i>o){var a=o;o=i,i=a}if(s>u){var a=u;u=s,s=a}return this.helper.css({left:i,top:s,width:o-i,height:u-s}),this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!a||a.element==n.element[0])return;var f=!1;r.tolerance=="touch"?f=!(a.left>o||a.right<i||a.top>u||a.bottom<s):r.tolerance=="fit"&&(f=a.left>i&&a.right<o&&a.top>s&&a.bottom<u),f?(a.selected&&(a.$element.removeClass("ui-selected"),a.selected=!1),a.unselecting&&(a.$element.removeClass("ui-unselecting"),a.unselecting=!1),a.selecting||(a.$element.addClass("ui-selecting"),a.selecting=!0,n._trigger("selecting",t,{selecting:a.element}))):(a.selecting&&((t.metaKey||t.ctrlKey)&&a.startselected?(a.$element.removeClass("ui-selecting"),a.selecting=!1,a.$element.addClass("ui-selected"),a.selected=!0):(a.$element.removeClass("ui-selecting"),a.selecting=!1,a.startselected&&(a.$element.addClass("ui-unselecting"),a.unselecting=!0),n._trigger("unselecting",t,{unselecting:a.element}))),a.selected&&!t.metaKey&&!t.ctrlKey&&!a.startselected&&(a.$element.removeClass("ui-selected"),a.selected=!1,a.$element.addClass("ui-unselecting"),a.unselecting=!0,n._trigger("unselecting",t,{unselecting:a.element})))}),!1},_mouseStop:function(t){var n=this;this.dragged=!1;var r=this.options;return e(".ui-unselecting",this.element[0]).each(function(){var r=e.data(this,"selectable-item");r.$element.removeClass("ui-unselecting"),r.unselecting=!1,r.startselected=!1,n._trigger("unselected",t,{unselected:r.element})}),e(".ui-selecting",this.element[0]).each(function(){var r=e.data(this,"selectable-item");r.$element.removeClass("ui-selecting").addClass("ui-selected"),r.selecting=!1,r.selected=!0,r.startselected=!0,n._trigger("selected",t,{selected:r.element})}),this._trigger("stop",t),this.helper.remove(),!1}})})(jQuery);(function(e,t){var n=5;e.widget("ui.slider",e.ui.mouse,{version:"1.9.2",widgetEventPrefix:"slide",options:{animate:!1,distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null},_create:function(){var t,r,i=this.options,s=this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"),o="<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>",u=[];this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget"+" ui-widget-content"+" ui-corner-all"+(i.disabled?" ui-slider-disabled ui-disabled":"")),this.range=e([]),i.range&&(i.range===!0&&(i.values||(i.values=[this._valueMin(),this._valueMin()]),i.values.length&&i.values.length!==2&&(i.values=[i.values[0],i.values[0]])),this.range=e("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(i.range==="min"||i.range==="max"?" ui-slider-range-"+i.range:""))),r=i.values&&i.values.length||1;for(t=s.length;t<r;t++)u.push(o);this.handles=s.add(e(u.join("")).appendTo(this.element)),this.handle=this.handles.eq(0),this.handles.add(this.range).filter("a").click(function(e){e.preventDefault()}).mouseenter(function(){i.disabled||e(this).addClass("ui-state-hover")}).mouseleave(function(){e(this).removeClass("ui-state-hover")}).focus(function(){i.disabled?e(this).blur():(e(".ui-slider .ui-state-focus").removeClass("ui-state-focus"),e(this).addClass("ui-state-focus"))}).blur(function(){e(this).removeClass("ui-state-focus")}),this.handles.each(function(t){e(this).data("ui-slider-handle-index",t)}),this._on(this.handles,{keydown:function(t){var r,i,s,o,u=e(t.target).data("ui-slider-handle-index");switch(t.keyCode){case e.ui.keyCode.HOME:case e.ui.keyCode.END:case e.ui.keyCode.PAGE_UP:case e.ui.keyCode.PAGE_DOWN:case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:t.preventDefault();if(!this._keySliding){this._keySliding=!0,e(t.target).addClass("ui-state-active"),r=this._start(t,u);if(r===!1)return}}o=this.options.step,this.options.values&&this.options.values.length?i=s=this.values(u):i=s=this.value();switch(t.keyCode){case e.ui.keyCode.HOME:s=this._valueMin();break;case e.ui.keyCode.END:s=this._valueMax();break;case e.ui.keyCode.PAGE_UP:s=this._trimAlignValue(i+(this._valueMax()-this._valueMin())/n);break;case e.ui.keyCode.PAGE_DOWN:s=this._trimAlignValue(i-(this._valueMax()-this._valueMin())/n);break;case e.ui.keyCode.UP:case e.ui.keyCode.RIGHT:if(i===this._valueMax())return;s=this._trimAlignValue(i+o);break;case e.ui.keyCode.DOWN:case e.ui.keyCode.LEFT:if(i===this._valueMin())return;s=this._trimAlignValue(i-o)}this._slide(t,u,s)},keyup:function(t){var n=e(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,n),this._change(t,n),e(t.target).removeClass("ui-state-active"))}}),this._refreshValue(),this._animateOff=!1},_destroy:function(){this.handles.remove(),this.range.remove(),this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all"),this._mouseDestroy()},_mouseCapture:function(t){var n,r,i,s,o,u,a,f,l=this,c=this.options;return c.disabled?!1:(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),n={x:t.pageX,y:t.pageY},r=this._normValueFromMouse(n),i=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var n=Math.abs(r-l.values(t));i>n&&(i=n,s=e(this),o=t)}),c.range===!0&&this.values(1)===c.min&&(o+=1,s=e(this.handles[o])),u=this._start(t,o),u===!1?!1:(this._mouseSliding=!0,this._handleIndex=o,s.addClass("ui-state-active").focus(),a=s.offset(),f=!e(t.target).parents().andSelf().is(".ui-slider-handle"),this._clickOffset=f?{left:0,top:0}:{left:t.pageX-a.left-s.width()/2,top:t.pageY-a.top-s.height()/2-(parseInt(s.css("borderTopWidth"),10)||0)-(parseInt(s.css("borderBottomWidth"),10)||0)+(parseInt(s.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,r),this._animateOff=!0,!0))},_mouseStart:function(){return!0},_mouseDrag:function(e){var t={x:e.pageX,y:e.pageY},n=this._normValueFromMouse(t);return this._slide(e,this._handleIndex,n),!1},_mouseStop:function(e){return this.handles.removeClass("ui-state-active"),this._mouseSliding=!1,this._stop(e,this._handleIndex),this._change(e,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1,!1},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(e){var t,n,r,i,s;return this.orientation==="horizontal"?(t=this.elementSize.width,n=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(t=this.elementSize.height,n=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),r=n/t,r>1&&(r=1),r<0&&(r=0),this.orientation==="vertical"&&(r=1-r),i=this._valueMax()-this._valueMin(),s=this._valueMin()+r*i,this._trimAlignValue(s)},_start:function(e,t){var n={handle:this.handles[t],value:this.value()};return this.options.values&&this.options.values.length&&(n.value=this.values(t),n.values=this.values()),this._trigger("start",e,n)},_slide:function(e,t,n){var r,i,s;this.options.values&&this.options.values.length?(r=this.values(t?0:1),this.options.values.length===2&&this.options.range===!0&&(t===0&&n>r||t===1&&n<r)&&(n=r),n!==this.values(t)&&(i=this.values(),i[t]=n,s=this._trigger("slide",e,{handle:this.handles[t],value:n,values:i}),r=this.values(t?0:1),s!==!1&&this.values(t,n,!0))):n!==this.value()&&(s=this._trigger("slide",e,{handle:this.handles[t],value:n}),s!==!1&&this.value(n))},_stop:function(e,t){var n={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(n.value=this.values(t),n.values=this.values()),this._trigger("stop",e,n)},_change:function(e,t){if(!this._keySliding&&!this._mouseSliding){var n={handle:this.handles[t],value:this.value()};this.options.values&&this.options.values.length&&(n.value=this.values(t),n.values=this.values()),this._trigger("change",e,n)}},value:function(e){if(arguments.length){this.options.value=this._trimAlignValue(e),this._refreshValue(),this._change(null,0);return}return this._value()},values:function(t,n){var r,i,s;if(arguments.length>1){this.options.values[t]=this._trimAlignValue(n),this._refreshValue(),this._change(null,t);return}if(!arguments.length)return this._values();if(!e.isArray(arguments[0]))return this.options.values&&this.options.values.length?this._values(t):this.value();r=this.options.values,i=arguments[0];for(s=0;s<r.length;s+=1)r[s]=this._trimAlignValue(i[s]),this._change(null,s);this._refreshValue()},_setOption:function(t,n){var r,i=0;e.isArray(this.options.values)&&(i=this.options.values.length),e.Widget.prototype._setOption.apply(this,arguments);switch(t){case"disabled":n?(this.handles.filter(".ui-state-focus").blur(),this.handles.removeClass("ui-state-hover"),this.handles.prop("disabled",!0),this.element.addClass("ui-disabled")):(this.handles.prop("disabled",!1),this.element.removeClass("ui-disabled"));break;case"orientation":this._detectOrientation(),this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation),this._refreshValue();break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":this._animateOff=!0,this._refreshValue();for(r=0;r<i;r+=1)this._change(null,r);this._animateOff=!1;break;case"min":case"max":this._animateOff=!0,this._refreshValue(),this._animateOff=!1}},_value:function(){var e=this.options.value;return e=this._trimAlignValue(e),e},_values:function(e){var t,n,r;if(arguments.length)return t=this.options.values[e],t=this._trimAlignValue(t),t;n=this.options.values.slice();for(r=0;r<n.length;r+=1)n[r]=this._trimAlignValue(n[r]);return n},_trimAlignValue:function(e){if(e<=this._valueMin())return this._valueMin();if(e>=this._valueMax())return this._valueMax();var t=this.options.step>0?this.options.step:1,n=(e-this._valueMin())%t,r=e-n;return Math.abs(n)*2>=t&&(r+=n>0?t:-t),parseFloat(r.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var t,n,r,i,s,o=this.options.range,u=this.options,a=this,f=this._animateOff?!1:u.animate,l={};this.options.values&&this.options.values.length?this.handles.each(function(r){n=(a.values(r)-a._valueMin())/(a._valueMax()-a._valueMin())*100,l[a.orientation==="horizontal"?"left":"bottom"]=n+"%",e(this).stop(1,1)[f?"animate":"css"](l,u.animate),a.options.range===!0&&(a.orientation==="horizontal"?(r===0&&a.range.stop(1,1)[f?"animate":"css"]({left:n+"%"},u.animate),r===1&&a.range[f?"animate":"css"]({width:n-t+"%"},{queue:!1,duration:u.animate})):(r===0&&a.range.stop(1,1)[f?"animate":"css"]({bottom:n+"%"},u.animate),r===1&&a.range[f?"animate":"css"]({height:n-t+"%"},{queue:!1,duration:u.animate}))),t=n}):(r=this.value(),i=this._valueMin(),s=this._valueMax(),n=s!==i?(r-i)/(s-i)*100:0,l[this.orientation==="horizontal"?"left":"bottom"]=n+"%",this.handle.stop(1,1)[f?"animate":"css"](l,u.animate),o==="min"&&this.orientation==="horizontal"&&this.range.stop(1,1)[f?"animate":"css"]({width:n+"%"},u.animate),o==="max"&&this.orientation==="horizontal"&&this.range[f?"animate":"css"]({width:100-n+"%"},{queue:!1,duration:u.animate}),o==="min"&&this.orientation==="vertical"&&this.range.stop(1,1)[f?"animate":"css"]({height:n+"%"},u.animate),o==="max"&&this.orientation==="vertical"&&this.range[f?"animate":"css"]({height:100-n+"%"},{queue:!1,duration:u.animate}))}})})(jQuery);(function(e,t){e.widget("ui.sortable",e.ui.mouse,{version:"1.9.2",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?e.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_setOption:function(t,n){t==="disabled"?(this.options[t]=n,this.widget().toggleClass("ui-sortable-disabled",!!n)):e.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(t,n){var r=this;if(this.reverting)return!1;if(this.options.disabled||this.options.type=="static")return!1;this._refreshItems(t);var i=null,s=e(t.target).parents().each(function(){if(e.data(this,r.widgetName+"-item")==r)return i=e(this),!1});e.data(t.target,r.widgetName+"-item")==r&&(i=e(t.target));if(!i)return!1;if(this.options.handle&&!n){var o=!1;e(this.options.handle,i).find("*").andSelf().each(function(){this==t.target&&(o=!0)});if(!o)return!1}return this.currentItem=i,this._removeCurrentsFromItems(),!0},_mouseStart:function(t,n,r){var i=this.options;this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!=this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),i.containment&&this._setContainment(),i.cursor&&(e("body").css("cursor")&&(this._storedCursor=e("body").css("cursor")),e("body").css("cursor",i.cursor)),i.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",i.opacity)),i.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",i.zIndex)),this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions();if(!r)for(var s=this.containers.length-1;s>=0;s--)this.containers[s]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs);if(this.options.scroll){var n=this.options,r=!1;this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<n.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+n.scrollSpeed:t.pageY-this.overflowOffset.top<n.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-n.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<n.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+n.scrollSpeed:t.pageX-this.overflowOffset.left<n.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-n.scrollSpeed)):(t.pageY-e(document).scrollTop()<n.scrollSensitivity?r=e(document).scrollTop(e(document).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<n.scrollSensitivity&&(r=e(document).scrollTop(e(document).scrollTop()+n.scrollSpeed)),t.pageX-e(document).scrollLeft()<n.scrollSensitivity?r=e(document).scrollLeft(e(document).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<n.scrollSensitivity&&(r=e(document).scrollLeft(e(document).scrollLeft()+n.scrollSpeed))),r!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(var i=this.items.length-1;i>=0;i--){var s=this.items[i],o=s.item[0],u=this._intersectsWithPointer(s);if(!u)continue;if(s.instance!==this.currentContainer)continue;if(o!=this.currentItem[0]&&this.placeholder[u==1?"next":"prev"]()[0]!=o&&!e.contains(this.placeholder[0],o)&&(this.options.type=="semi-dynamic"?!e.contains(this.element[0],o):!0)){this.direction=u==1?"down":"up";if(this.options.tolerance!="pointer"&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash());break}}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,n){if(!t)return;e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t);if(this.options.revert){var r=this,i=this.placeholder.offset();this.reverting=!0,e(this.helper).animate({left:i.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:i.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){r._clear(t)})}else this._clear(t,n);return!1},cancel:function(){if(this.dragging){this._mouseUp({target:null}),this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var n=this._getItemsAsjQuery(t&&t.connected),r=[];return t=t||{},e(n).each(function(){var n=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[-=_](.+)/);n&&r.push((t.key||n[1]+"[]")+"="+(t.key&&t.expression?n[1]:n[2]))}),!r.length&&t.key&&r.push(t.key+"="),r.join("&")},toArray:function(t){var n=this._getItemsAsjQuery(t&&t.connected),r=[];return t=t||{},n.each(function(){r.push(e(t.item||this).attr(t.attribute||"id")||"")}),r},_intersectsWith:function(e){var t=this.positionAbs.left,n=t+this.helperProportions.width,r=this.positionAbs.top,i=r+this.helperProportions.height,s=e.left,o=s+e.width,u=e.top,a=u+e.height,f=this.offset.click.top,l=this.offset.click.left,c=r+f>u&&r+f<a&&t+l>s&&t+l<o;return this.options.tolerance=="pointer"||this.options.forcePointerForContainers||this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?c:s<t+this.helperProportions.width/2&&n-this.helperProportions.width/2<o&&u<r+this.helperProportions.height/2&&i-this.helperProportions.height/2<a},_intersectsWithPointer:function(t){var n=this.options.axis==="x"||e.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),r=this.options.axis==="y"||e.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),i=n&&r,s=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return i?this.floating?o&&o=="right"||s=="down"?2:1:s&&(s=="down"?2:1):!1},_intersectsWithSides:function(t){var n=e.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),r=e.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),i=this._getDragVerticalDirection(),s=this._getDragHorizontalDirection();return this.floating&&s?s=="right"&&r||s=="left"&&!r:i&&(i=="down"&&n||i=="up"&&!n)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return e!=0&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return e!=0&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor==String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){var n=[],r=[],i=this._connectWith();if(i&&t)for(var s=i.length-1;s>=0;s--){var o=e(i[s]);for(var u=o.length-1;u>=0;u--){var a=e.data(o[u],this.widgetName);a&&a!=this&&!a.options.disabled&&r.push([e.isFunction(a.options.items)?a.options.items.call(a.element):e(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a])}}r.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]);for(var s=r.length-1;s>=0;s--)r[s][0].each(function(){n.push(this)});return e(n)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var n=0;n<t.length;n++)if(t[n]==e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var n=this.items,r=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],i=this._connectWith();if(i&&this.ready)for(var s=i.length-1;s>=0;s--){var o=e(i[s]);for(var u=o.length-1;u>=0;u--){var a=e.data(o[u],this.widgetName);a&&a!=this&&!a.options.disabled&&(r.push([e.isFunction(a.options.items)?a.options.items.call(a.element[0],t,{item:this.currentItem}):e(a.options.items,a.element),a]),this.containers.push(a))}}for(var s=r.length-1;s>=0;s--){var f=r[s][1],l=r[s][0];for(var u=0,c=l.length;u<c;u++){var h=e(l[u]);h.data(this.widgetName+"-item",f),n.push({item:h,instance:f,width:0,height:0,left:0,top:0})}}},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());for(var n=this.items.length-1;n>=0;n--){var r=this.items[n];if(r.instance!=this.currentContainer&&this.currentContainer&&r.item[0]!=this.currentItem[0])continue;var i=this.options.toleranceElement?e(this.options.toleranceElement,r.item):r.item;t||(r.width=i.outerWidth(),r.height=i.outerHeight());var s=i.offset();r.left=s.left,r.top=s.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(var n=this.containers.length-1;n>=0;n--){var s=this.containers[n].element.offset();this.containers[n].containerCache.left=s.left,this.containers[n].containerCache.top=s.top,this.containers[n].containerCache.width=this.containers[n].element.outerWidth(),this.containers[n].containerCache.height=this.containers[n].element.outerHeight()}return this},_createPlaceholder:function(t){t=t||this;var n=t.options;if(!n.placeholder||n.placeholder.constructor==String){var r=n.placeholder;n.placeholder={element:function(){var n=e(document.createElement(t.currentItem[0].nodeName)).addClass(r||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];return r||(n.style.visibility="hidden"),n},update:function(e,i){if(r&&!n.forcePlaceholderSize)return;i.height()||i.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),i.width()||i.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10))}}}t.placeholder=e(n.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),n.placeholder.update(t,t.placeholder)},_contactContainers:function(t){var n=null,r=null;for(var i=this.containers.length-1;i>=0;i--){if(e.contains(this.currentItem[0],this.containers[i].element[0]))continue;if(this._intersectsWith(this.containers[i].containerCache)){if(n&&e.contains(this.containers[i].element[0],n.element[0]))continue;n=this.containers[i],r=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0)}if(!n)return;if(this.containers.length===1)this.containers[r]._trigger("over",t,this._uiHash(this)),this.containers[r].containerCache.over=1;else{var s=1e4,o=null,u=this.containers[r].floating?"left":"top",a=this.containers[r].floating?"width":"height",f=this.positionAbs[u]+this.offset.click[u];for(var l=this.items.length-1;l>=0;l--){if(!e.contains(this.containers[r].element[0],this.items[l].item[0]))continue;if(this.items[l].item[0]==this.currentItem[0])continue;var c=this.items[l].item.offset()[u],h=!1;Math.abs(c-f)>Math.abs(c+this.items[l][a]-f)&&(h=!0,c+=this.items[l][a]),Math.abs(c-f)<s&&(s=Math.abs(c-f),o=this.items[l],this.direction=h?"up":"down")}if(!o&&!this.options.dropOnEmpty)return;this.currentContainer=this.containers[r],o?this._rearrange(t,o,null,!0):this._rearrange(t,null,this.containers[r].element,!0),this._trigger("change",t,this._uiHash()),this.containers[r]._trigger("change",t,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[r]._trigger("over",t,this._uiHash(this)),this.containers[r].containerCache.over=1}},_createHelper:function(t){var n=this.options,r=e.isFunction(n.helper)?e(n.helper.apply(this.element[0],[t,this.currentItem])):n.helper=="clone"?this.currentItem.clone():this.currentItem;return r.parents("body").length||e(n.appendTo!="parent"?n.appendTo:this.currentItem[0].parentNode)[0].appendChild(r[0]),r[0]==this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(r[0].style.width==""||n.forceHelperSize)&&r.width(this.currentItem.width()),(r[0].style.height==""||n.forceHelperSize)&&r.height(this.currentItem.height()),r},_adjustOffsetFromHelper:function(t){typeof t=="string"&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop());if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&e.ui.ie)t={top:0,left:0};return{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t=this.options;t.containment=="parent"&&(t.containment=this.helper[0].parentNode);if(t.containment=="document"||t.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e(t.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(e(t.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(t.containment)){var n=e(t.containment)[0],r=e(t.containment).offset(),i=e(n).css("overflow")!="hidden";this.containment=[r.left+(parseInt(e(n).css("borderLeftWidth"),10)||0)+(parseInt(e(n).css("paddingLeft"),10)||0)-this.margins.left,r.top+(parseInt(e(n).css("borderTopWidth"),10)||0)+(parseInt(e(n).css("paddingTop"),10)||0)-this.margins.top,r.left+(i?Math.max(n.scrollWidth,n.offsetWidth):n.offsetWidth)-(parseInt(e(n).css("borderLeftWidth"),10)||0)-(parseInt(e(n).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,r.top+(i?Math.max(n.scrollHeight,n.offsetHeight):n.offsetHeight)-(parseInt(e(n).css("borderTopWidth"),10)||0)-(parseInt(e(n).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(t,n){n||(n=this.position);var r=t=="absolute"?1:-1,i=this.options,s=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(s[0].tagName);return{top:n.top+this.offset.relative.top*r+this.offset.parent.top*r-(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():o?0:s.scrollTop())*r,left:n.left+this.offset.relative.left*r+this.offset.parent.left*r-(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():o?0:s.scrollLeft())*r}},_generatePosition:function(t){var n=this.options,r=this.cssPosition!="absolute"||this.scrollParent[0]!=document&&!!e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,i=/(html|body)/i.test(r[0].tagName);this.cssPosition=="relative"&&(this.scrollParent[0]==document||this.scrollParent[0]==this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset());var s=t.pageX,o=t.pageY;if(this.originalPosition){this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(s=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(s=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top));if(n.grid){var u=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1];o=this.containment?u-this.offset.click.top<this.containment[1]||u-this.offset.click.top>this.containment[3]?u-this.offset.click.top<this.containment[1]?u+n.grid[1]:u-n.grid[1]:u:u;var a=this.originalPageX+Math.round((s-this.originalPageX)/n.grid[0])*n.grid[0];s=this.containment?a-this.offset.click.left<this.containment[0]||a-this.offset.click.left>this.containment[2]?a-this.offset.click.left<this.containment[0]?a+n.grid[0]:a-n.grid[0]:a:a}}return{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():i?0:r.scrollTop()),left:s-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():i?0:r.scrollLeft())}},_rearrange:function(e,t,n,r){n?n[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],this.direction=="down"?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var i=this.counter;this._delay(function(){i==this.counter&&this.refreshPositions(!r)})},_clear:function(t,n){this.reverting=!1;var r=[];!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var i in this._storedCSS)if(this._storedCSS[i]=="auto"||this._storedCSS[i]=="static")this._storedCSS[i]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();this.fromOutside&&!n&&r.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),(this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!n&&r.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(n||(r.push(function(e){this._trigger("remove",e,this._uiHash())}),r.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),r.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer))));for(var i=this.containers.length-1;i>=0;i--)n||r.push(function(e){return function(t){e._trigger("deactivate",t,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over&&(r.push(function(e){return function(t){e._trigger("out",t,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over=0);this._storedCursor&&e("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex),this.dragging=!1;if(this.cancelHelperRemoval){if(!n){this._trigger("beforeStop",t,this._uiHash());for(var i=0;i<r.length;i++)r[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!1}n||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!=this.currentItem[0]&&this.helper.remove(),this.helper=null;if(!n){for(var i=0;i<r.length;i++)r[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var n=t||this;return{helper:n.helper,placeholder:n.placeholder||e([]),position:n.position,originalPosition:n.originalPosition,offset:n.positionAbs,item:n.currentItem,sender:t?t.element:null}}})})(jQuery);(function(e){function t(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.widget("ui.spinner",{version:"1.9.2",defaultElement:"<input>",widgetEventPrefix:"spin",options:{culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var t={},n=this.element;return e.each(["min","max","step"],function(e,r){var i=n.attr(r);i!==undefined&&i.length&&(t[r]=i)}),t},_events:{keydown:function(e){this._start(e)&&this._keydown(e)&&e.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(e){if(this.cancelBlur){delete this.cancelBlur;return}this._refresh(),this.previous!==this.element.val()&&this._trigger("change",e)},mousewheel:function(e,t){if(!t)return;if(!this.spinning&&!this._start(e))return!1;this._spin((t>0?1:-1)*this.options.step,e),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(e)},100),e.preventDefault()},"mousedown .ui-spinner-button":function(t){function r(){var e=this.element[0]===this.document[0].activeElement;e||(this.element.focus(),this.previous=n,this._delay(function(){this.previous=n}))}var n;n=this.element[0]===this.document[0].activeElement?this.previous:this.element.val(),t.preventDefault(),r.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,r.call(this)});if(this._start(t)===!1)return;this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){if(!e(t.currentTarget).hasClass("ui-state-active"))return;if(this._start(t)===!1)return!1;this._repeat(null,e(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseleave .ui-spinner-button":"_stop"},_draw:function(){var e=this.uiSpinner=this.element.addClass("ui-spinner-input").attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml());this.element.attr("role","spinbutton"),this.buttons=e.find(".ui-spinner-button").attr("tabIndex",-1).button().removeClass("ui-corner-all"),this.buttons.height()>Math.ceil(e.height()*.5)&&e.height()>0&&e.height(e.height()),this.options.disabled&&this.disable()},_keydown:function(t){var n=this.options,r=e.ui.keyCode;switch(t.keyCode){case r.UP:return this._repeat(null,1,t),!0;case r.DOWN:return this._repeat(null,-1,t),!0;case r.PAGE_UP:return this._repeat(null,n.page,t),!0;case r.PAGE_DOWN:return this._repeat(null,-n.page,t),!0}return!1},_uiSpinnerHtml:function(){return"<span class='ui-spinner ui-widget ui-widget-content ui-corner-all'></span>"},_buttonHtml:function(){return"<a class='ui-spinner-button ui-spinner-up ui-corner-tr'><span class='ui-icon "+this.options.icons.up+"'>&#9650;</span>"+"</a>"+"<a class='ui-spinner-button ui-spinner-down ui-corner-br'>"+"<span class='ui-icon "+this.options.icons.down+"'>&#9660;</span>"+"</a>"},_start:function(e){return!this.spinning&&this._trigger("start",e)===!1?!1:(this.counter||(this.counter=1),this.spinning=!0,!0)},_repeat:function(e,t,n){e=e||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,t,n)},e),this._spin(t*this.options.step,n)},_spin:function(e,t){var n=this.value()||0;this.counter||(this.counter=1),n=this._adjustValue(n+e*this._increment(this.counter));if(!this.spinning||this._trigger("spin",t,{value:n})!==!1)this._value(n),this.counter++},_increment:function(t){var n=this.options.incremental;return n?e.isFunction(n)?n(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var e=this._precisionOf(this.options.step);return this.options.min!==null&&(e=Math.max(e,this._precisionOf(this.options.min))),e},_precisionOf:function(e){var t=e.toString(),n=t.indexOf(".");return n===-1?0:t.length-n-1},_adjustValue:function(e){var t,n,r=this.options;return t=r.min!==null?r.min:0,n=e-t,n=Math.round(n/r.step)*r.step,e=t+n,e=parseFloat(e.toFixed(this._precision())),r.max!==null&&e>r.max?r.max:r.min!==null&&e<r.min?r.min:e},_stop:function(e){if(!this.spinning)return;clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",e)},_setOption:function(e,t){if(e==="culture"||e==="numberFormat"){var n=this._parse(this.element.val());this.options[e]=t,this.element.val(this._format(n));return}(e==="max"||e==="min"||e==="step")&&typeof t=="string"&&(t=this._parse(t)),this._super(e,t),e==="disabled"&&(t?(this.element.prop("disabled",!0),this.buttons.button("disable")):(this.element.prop("disabled",!1),this.buttons.button("enable")))},_setOptions:t(function(e){this._super(e),this._value(this.element.val())}),_parse:function(e){return typeof e=="string"&&e!==""&&(e=window.Globalize&&this.options.numberFormat?Globalize.parseFloat(e,10,this.options.culture):+e),e===""||isNaN(e)?null:e},_format:function(e){return e===""?"":window.Globalize&&this.options.numberFormat?Globalize.format(e,this.options.numberFormat,this.options.culture):e},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},_value:function(e,t){var n;e!==""&&(n=this._parse(e),n!==null&&(t||(n=this._adjustValue(n)),e=this._format(n))),this.element.val(e),this._refresh()},_destroy:function(){this.element.removeClass("ui-spinner-input").prop("disabled",!1).removeAttr("autocomplete").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:t(function(e){this._stepUp(e)}),_stepUp:function(e){this._spin((e||1)*this.options.step)},stepDown:t(function(e){this._stepDown(e)}),_stepDown:function(e){this._spin((e||1)*-this.options.step)},pageUp:t(function(e){this._stepUp((e||1)*this.options.page)}),pageDown:t(function(e){this._stepDown((e||1)*this.options.page)}),value:function(e){if(!arguments.length)return this._parse(this.element.val());t(this._value).call(this,e)},widget:function(){return this.uiSpinner}})})(jQuery);(function(e,t){function i(){return++n}function s(e){return e.hash.length>1&&e.href.replace(r,"")===location.href.replace(r,"").replace(/\s/g,"%20")}var n=0,r=/#.*$/;e.widget("ui.tabs",{version:"1.9.2",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_create:function(){var t=this,n=this.options,r=n.active,i=location.hash.substring(1);this.running=!1,this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",n.collapsible).delegate(".ui-tabs-nav > li","mousedown"+this.eventNamespace,function(t){e(this).is(".ui-state-disabled")&&t.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){e(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this._processTabs();if(r===null){i&&this.tabs.each(function(t,n){if(e(n).attr("aria-controls")===i)return r=t,!1}),r===null&&(r=this.tabs.index(this.tabs.filter(".ui-tabs-active")));if(r===null||r===-1)r=this.tabs.length?0:!1}r!==!1&&(r=this.tabs.index(this.tabs.eq(r)),r===-1&&(r=n.collapsible?!1:0)),n.active=r,!n.collapsible&&n.active===!1&&this.anchors.length&&(n.active=0),e.isArray(n.disabled)&&(n.disabled=e.unique(n.disabled.concat(e.map(this.tabs.filter(".ui-state-disabled"),function(e){return t.tabs.index(e)}))).sort()),this.options.active!==!1&&this.anchors.length?this.active=this._findActive(this.options.active):this.active=e(),this._refresh(),this.active.length&&this.load(n.active)},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):e()}},_tabKeydown:function(t){var n=e(this.document[0].activeElement).closest("li"),r=this.tabs.index(n),i=!0;if(this._handlePageNav(t))return;switch(t.keyCode){case e.ui.keyCode.RIGHT:case e.ui.keyCode.DOWN:r++;break;case e.ui.keyCode.UP:case e.ui.keyCode.LEFT:i=!1,r--;break;case e.ui.keyCode.END:r=this.anchors.length-1;break;case e.ui.keyCode.HOME:r=0;break;case e.ui.keyCode.SPACE:t.preventDefault(),clearTimeout(this.activating),this._activate(r);return;case e.ui.keyCode.ENTER:t.preventDefault(),clearTimeout(this.activating),this._activate(r===this.options.active?!1:r);return;default:return}t.preventDefault(),clearTimeout(this.activating),r=this._focusNextTab(r,i),t.ctrlKey||(n.attr("aria-selected","false"),this.tabs.eq(r).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",r)},this.delay))},_panelKeydown:function(t){if(this._handlePageNav(t))return;t.ctrlKey&&t.keyCode===e.ui.keyCode.UP&&(t.preventDefault(),this.active.focus())},_handlePageNav:function(t){if(t.altKey&&t.keyCode===e.ui.keyCode.PAGE_UP)return this._activate(this._focusNextTab(this.options.active-1,!1)),!0;if(t.altKey&&t.keyCode===e.ui.keyCode.PAGE_DOWN)return this._activate(this._focusNextTab(this.options.active+1,!0)),!0},_findNextTab:function(t,n){function i(){return t>r&&(t=0),t<0&&(t=r),t}var r=this.tabs.length-1;while(e.inArray(i(),this.options.disabled)!==-1)t=n?t+1:t-1;return t},_focusNextTab:function(e,t){return e=this._findNextTab(e,t),this.tabs.eq(e).focus(),e},_setOption:function(e,t){if(e==="active"){this._activate(t);return}if(e==="disabled"){this._setupDisabled(t);return}this._super(e,t),e==="collapsible"&&(this.element.toggleClass("ui-tabs-collapsible",t),!t&&this.options.active===!1&&this._activate(0)),e==="event"&&this._setupEvents(t),e==="heightStyle"&&this._setupHeightStyle(t)},_tabId:function(e){return e.attr("aria-controls")||"ui-tabs-"+i()},_sanitizeSelector:function(e){return e?e.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,n=this.tablist.children(":has(a[href])");t.disabled=e.map(n.filter(".ui-state-disabled"),function(e){return n.index(e)}),this._processTabs(),t.active===!1||!this.anchors.length?(t.active=!1,this.active=e()):this.active.length&&!e.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=e()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active),this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-expanded":"false","aria-hidden":"true"}),this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-expanded":"true","aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var t=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist"),this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1}),this.anchors=this.tabs.map(function(){return e("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1}),this.panels=e(),this.anchors.each(function(n,r){var i,o,u,a=e(r).uniqueId().attr("id"),f=e(r).closest("li"),l=f.attr("aria-controls");s(r)?(i=r.hash,o=t.element.find(t._sanitizeSelector(i))):(u=t._tabId(f),i="#"+u,o=t.element.find(i),o.length||(o=t._createPanel(u),o.insertAfter(t.panels[n-1]||t.tablist)),o.attr("aria-live","polite")),o.length&&(t.panels=t.panels.add(o)),l&&f.data("ui-tabs-aria-controls",l),f.attr({"aria-controls":i.substring(1),"aria-labelledby":a}),o.attr("aria-labelledby",a)}),this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},_getList:function(){return this.element.find("ol,ul").eq(0)},_createPanel:function(t){return e("<div>").attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(t){e.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var n=0,r;r=this.tabs[n];n++)t===!0||e.inArray(n,t)!==-1?e(r).addClass("ui-state-disabled").attr("aria-disabled","true"):e(r).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=t},_setupEvents:function(t){var n={click:function(e){e.preventDefault()}};t&&e.each(t.split(" "),function(e,t){n[t]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(this.anchors,n),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var n,r,i=this.element.parent();t==="fill"?(e.support.minHeight||(r=i.css("overflow"),i.css("overflow","hidden")),n=i.height(),this.element.siblings(":visible").each(function(){var t=e(this),r=t.css("position");if(r==="absolute"||r==="fixed")return;n-=t.outerHeight(!0)}),r&&i.css("overflow",r),this.element.children().not(this.panels).each(function(){n-=e(this).outerHeight(!0)}),this.panels.each(function(){e(this).height(Math.max(0,n-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):t==="auto"&&(n=0,this.panels.each(function(){n=Math.max(n,e(this).height("").height())}).height(n))},_eventHandler:function(t){var n=this.options,r=this.active,i=e(t.currentTarget),s=i.closest("li"),o=s[0]===r[0],u=o&&n.collapsible,a=u?e():this._getPanelForTab(s),f=r.length?this._getPanelForTab(r):e(),l={oldTab:r,oldPanel:f,newTab:u?e():s,newPanel:a};t.preventDefault();if(s.hasClass("ui-state-disabled")||s.hasClass("ui-tabs-loading")||this.running||o&&!n.collapsible||this._trigger("beforeActivate",t,l)===!1)return;n.active=u?!1:this.tabs.index(s),this.active=o?e():s,this.xhr&&this.xhr.abort(),!f.length&&!a.length&&e.error("jQuery UI Tabs: Mismatching fragment identifier."),a.length&&this.load(this.tabs.index(s),t),this._toggle(t,l)},_toggle:function(t,n){function o(){r.running=!1,r._trigger("activate",t,n)}function u(){n.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),i.length&&r.options.show?r._show(i,r.options.show,o):(i.show(),o())}var r=this,i=n.newPanel,s=n.oldPanel;this.running=!0,s.length&&this.options.hide?this._hide(s,this.options.hide,function(){n.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),u()}):(n.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),s.hide(),u()),s.attr({"aria-expanded":"false","aria-hidden":"true"}),n.oldTab.attr("aria-selected","false"),i.length&&s.length?n.oldTab.attr("tabIndex",-1):i.length&&this.tabs.filter(function(){return e(this).attr("tabIndex")===0}).attr("tabIndex",-1),i.attr({"aria-expanded":"true","aria-hidden":"false"}),n.newTab.attr({"aria-selected":"true",tabIndex:0})},_activate:function(t){var n,r=this._findActive(t);if(r[0]===this.active[0])return;r.length||(r=this.active),n=r.find(".ui-tabs-anchor")[0],this._eventHandler({target:n,currentTarget:n,preventDefault:e.noop})},_findActive:function(t){return t===!1?e():this.tabs.eq(t)},_getIndex:function(e){return typeof e=="string"&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_destroy:function(){this.xhr&&this.xhr.abort(),this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible"),this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role"),this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeData("href.tabs").removeData("load.tabs").removeUniqueId(),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")}),this.tabs.each(function(){var t=e(this),n=t.data("ui-tabs-aria-controls");n?t.attr("aria-controls",n):t.removeAttr("aria-controls")}),this.panels.show(),this.options.heightStyle!=="content"&&this.panels.css("height","")},enable:function(n){var r=this.options.disabled;if(r===!1)return;n===t?r=!1:(n=this._getIndex(n),e.isArray(r)?r=e.map(r,function(e){return e!==n?e:null}):r=e.map(this.tabs,function(e,t){return t!==n?t:null})),this._setupDisabled(r)},disable:function(n){var r=this.options.disabled;if(r===!0)return;if(n===t)r=!0;else{n=this._getIndex(n);if(e.inArray(n,r)!==-1)return;e.isArray(r)?r=e.merge([n],r).sort():r=[n]}this._setupDisabled(r)},load:function(t,n){t=this._getIndex(t);var r=this,i=this.tabs.eq(t),o=i.find(".ui-tabs-anchor"),u=this._getPanelForTab(i),a={tab:i,panel:u};if(s(o[0]))return;this.xhr=e.ajax(this._ajaxSettings(o,n,a)),this.xhr&&this.xhr.statusText!=="canceled"&&(i.addClass("ui-tabs-loading"),u.attr("aria-busy","true"),this.xhr.success(function(e){setTimeout(function(){u.html(e),r._trigger("load",n,a)},1)}).complete(function(e,t){setTimeout(function(){t==="abort"&&r.panels.stop(!1,!0),i.removeClass("ui-tabs-loading"),u.removeAttr("aria-busy"),e===r.xhr&&delete r.xhr},1)}))},_ajaxSettings:function(t,n,r){var i=this;return{url:t.attr("href"),beforeSend:function(t,s){return i._trigger("beforeLoad",n,e.extend({jqXHR:t,ajaxSettings:s},r))}}},_getPanelForTab:function(t){var n=e(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+n))}}),e.uiBackCompat!==!1&&(e.ui.tabs.prototype._ui=function(e,t){return{tab:e,panel:t,index:this.anchors.index(e)}},e.widget("ui.tabs",e.ui.tabs,{url:function(e,t){this.anchors.eq(e).attr("href",t)}}),e.widget("ui.tabs",e.ui.tabs,{options:{ajaxOptions:null,cache:!1},_create:function(){this._super();var t=this;this._on({tabsbeforeload:function(n,r){if(e.data(r.tab[0],"cache.tabs")){n.preventDefault();return}r.jqXHR.success(function(){t.options.cache&&e.data(r.tab[0],"cache.tabs",!0)})}})},_ajaxSettings:function(t,n,r){var i=this.options.ajaxOptions;return e.extend({},i,{error:function(e,t){try{i.error(e,t,r.tab.closest("li").index(),r.tab[0])}catch(n){}}},this._superApply(arguments))},_setOption:function(e,t){e==="cache"&&t===!1&&this.anchors.removeData("cache.tabs"),this._super(e,t)},_destroy:function(){this.anchors.removeData("cache.tabs"),this._super()},url:function(e){this.anchors.eq(e).removeData("cache.tabs"),this._superApply(arguments)}}),e.widget("ui.tabs",e.ui.tabs,{abort:function(){this.xhr&&this.xhr.abort()}}),e.widget("ui.tabs",e.ui.tabs,{options:{spinner:"<em>Loading&#8230;</em>"},_create:function(){this._super(),this._on({tabsbeforeload:function(e,t){if(e.target!==this.element[0]||!this.options.spinner)return;var n=t.tab.find("span"),r=n.html();n.html(this.options.spinner),t.jqXHR.complete(function(){n.html(r)})}})}}),e.widget("ui.tabs",e.ui.tabs,{options:{enable:null,disable:null},enable:function(t){var n=this.options,r;if(t&&n.disabled===!0||e.isArray(n.disabled)&&e.inArray(t,n.disabled)!==-1)r=!0;this._superApply(arguments),r&&this._trigger("enable",null,this._ui(this.anchors[t],this.panels[t]))},disable:function(t){var n=this.options,r;if(t&&n.disabled===!1||e.isArray(n.disabled)&&e.inArray(t,n.disabled)===-1)r=!0;this._superApply(arguments),r&&this._trigger("disable",null,this._ui(this.anchors[t],this.panels[t]))}}),e.widget("ui.tabs",e.ui.tabs,{options:{add:null,remove:null,tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},add:function(n,r,i){i===t&&(i=this.anchors.length);var s,o,u=this.options,a=e(u.tabTemplate.replace(/#\{href\}/g,n).replace(/#\{label\}/g,r)),f=n.indexOf("#")?this._tabId(a):n.replace("#","");return a.addClass("ui-state-default ui-corner-top").data("ui-tabs-destroy",!0),a.attr("aria-controls",f),s=i>=this.tabs.length,o=this.element.find("#"+f),o.length||(o=this._createPanel(f),s?i>0?o.insertAfter(this.panels.eq(-1)):o.appendTo(this.element):o.insertBefore(this.panels[i])),o.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").hide(),s?a.appendTo(this.tablist):a.insertBefore(this.tabs[i]),u.disabled=e.map(u.disabled,function(e){return e>=i?++e:e}),this.refresh(),this.tabs.length===1&&u.active===!1&&this.option("active",0),this._trigger("add",null,this._ui(this.anchors[i],this.panels[i])),this},remove:function(t){t=this._getIndex(t);var n=this.options,r=this.tabs.eq(t).remove(),i=this._getPanelForTab(r).remove();return r.hasClass("ui-tabs-active")&&this.anchors.length>2&&this._activate(t+(t+1<this.anchors.length?1:-1)),n.disabled=e.map(e.grep(n.disabled,function(e){return e!==t}),function(e){return e>=t?--e:e}),this.refresh(),this._trigger("remove",null,this._ui(r.find("a")[0],i[0])),this}}),e.widget("ui.tabs",e.ui.tabs,{length:function(){return this.anchors.length}}),e.widget("ui.tabs",e.ui.tabs,{options:{idPrefix:"ui-tabs-"},_tabId:function(t){var n=t.is("li")?t.find("a[href]"):t;return n=n[0],e(n).closest("li").attr("aria-controls")||n.title&&n.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF\-]/g,"")||this.options.idPrefix+i()}}),e.widget("ui.tabs",e.ui.tabs,{options:{panelTemplate:"<div></div>"},_createPanel:function(t){return e(this.options.panelTemplate).attr("id",t).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)}}),e.widget("ui.tabs",e.ui.tabs,{_create:function(){var e=this.options;e.active===null&&e.selected!==t&&(e.active=e.selected===-1?!1:e.selected),this._super(),e.selected=e.active,e.selected===!1&&(e.selected=-1)},_setOption:function(e,t){if(e!=="selected")return this._super(e,t);var n=this.options;this._super("active",t===-1?!1:t),n.selected=n.active,n.selected===!1&&(n.selected=-1)},_eventHandler:function(){this._superApply(arguments),this.options.selected=this.options.active,this.options.selected===!1&&(this.options.selected=-1)}}),e.widget("ui.tabs",e.ui.tabs,{options:{show:null,select:null},_create:function(){this._super(),this.options.active!==!1&&this._trigger("show",null,this._ui(this.active.find(".ui-tabs-anchor")[0],this._getPanelForTab(this.active)[0]))},_trigger:function(e,t,n){var r,i,s=this._superApply(arguments);return s?(e==="beforeActivate"?(r=n.newTab.length?n.newTab:n.oldTab,i=n.newPanel.length?n.newPanel:n.oldPanel,s=this._super("select",t,{tab:r.find(".ui-tabs-anchor")[0],panel:i[0],index:r.closest("li").index()})):e==="activate"&&n.newTab.length&&(s=this._super("show",t,{tab:n.newTab.find(".ui-tabs-anchor")[0],panel:n.newPanel[0],index:n.newTab.closest("li").index()})),s):!1}}),e.widget("ui.tabs",e.ui.tabs,{select:function(e){e=this._getIndex(e);if(e===-1){if(!this.options.collapsible||this.options.selected===-1)return;e=this.options.selected}this.anchors.eq(e).trigger(this.options.event+this.eventNamespace)}}),function(){var t=0;e.widget("ui.tabs",e.ui.tabs,{options:{cookie:null},_create:function(){var e=this.options,t;e.active==null&&e.cookie&&(t=parseInt(this._cookie(),10),t===-1&&(t=!1),e.active=t),this._super()},_cookie:function(n){var r=[this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+ ++t)];return arguments.length&&(r.push(n===!1?-1:n),r.push(this.options.cookie)),e.cookie.apply(null,r)},_refresh:function(){this._super(),this.options.cookie&&this._cookie(this.options.active,this.options.cookie)},_eventHandler:function(){this._superApply(arguments),this.options.cookie&&this._cookie(this.options.active,this.options.cookie)},_destroy:function(){this._super(),this.options.cookie&&this._cookie(null,this.options.cookie)}})}(),e.widget("ui.tabs",e.ui.tabs,{_trigger:function(t,n,r){var i=e.extend({},r);return t==="load"&&(i.panel=i.panel[0],i.tab=i.tab.find(".ui-tabs-anchor")[0]),this._super(t,n,i)}}),e.widget("ui.tabs",e.ui.tabs,{options:{fx:null},_getFx:function(){var t,n,r=this.options.fx;return r&&(e.isArray(r)?(t=r[0],n=r[1]):t=n=r),r?{show:n,hide:t}:null},_toggle:function(e,t){function o(){n.running=!1,n._trigger("activate",e,t)}function u(){t.newTab.closest("li").addClass("ui-tabs-active ui-state-active"),r.length&&s.show?r.animate(s.show,s.show.duration,function(){o()}):(r.show(),o())}var n=this,r=t.newPanel,i=t.oldPanel,s=this._getFx();if(!s)return this._super(e,t);n.running=!0,i.length&&s.hide?i.animate(s.hide,s.hide.duration,function(){t.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),u()}):(t.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),i.hide(),u())}}))})(jQuery);(function(e){function n(t,n){var r=(t.attr("aria-describedby")||"").split(/\s+/);r.push(n),t.data("ui-tooltip-id",n).attr("aria-describedby",e.trim(r.join(" ")))}function r(t){var n=t.data("ui-tooltip-id"),r=(t.attr("aria-describedby")||"").split(/\s+/),i=e.inArray(n,r);i!==-1&&r.splice(i,1),t.removeData("ui-tooltip-id"),r=e.trim(r.join(" ")),r?t.attr("aria-describedby",r):t.removeAttr("aria-describedby")}var t=0;e.widget("ui.tooltip",{version:"1.9.2",options:{content:function(){return e(this).attr("title")},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,tooltipClass:null,track:!1,close:null,open:null},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.options.disabled&&this._disable()},_setOption:function(t,n){var r=this;if(t==="disabled"){this[n?"_disable":"_enable"](),this.options[t]=n;return}this._super(t,n),t==="content"&&e.each(this.tooltips,function(e,t){r._updateContent(t)})},_disable:function(){var t=this;e.each(this.tooltips,function(n,r){var i=e.Event("blur");i.target=i.currentTarget=r[0],t.close(i,!0)}),this.element.find(this.options.items).andSelf().each(function(){var t=e(this);t.is("[title]")&&t.data("ui-tooltip-title",t.attr("title")).attr("title","")})},_enable:function(){this.element.find(this.options.items).andSelf().each(function(){var t=e(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))})},open:function(t){var n=this,r=e(t?t.target:this.element).closest(this.options.items);if(!r.length||r.data("ui-tooltip-id"))return;r.attr("title")&&r.data("ui-tooltip-title",r.attr("title")),r.data("ui-tooltip-open",!0),t&&t.type==="mouseover"&&r.parents().each(function(){var t=e(this),r;t.data("ui-tooltip-open")&&(r=e.Event("blur"),r.target=r.currentTarget=this,n.close(r,!0)),t.attr("title")&&(t.uniqueId(),n.parents[this.id]={element:this,title:t.attr("title")},t.attr("title",""))}),this._updateContent(r,t)},_updateContent:function(e,t){var n,r=this.options.content,i=this,s=t?t.type:null;if(typeof r=="string")return this._open(t,e,r);n=r.call(e[0],function(n){if(!e.data("ui-tooltip-open"))return;i._delay(function(){t&&(t.type=s),this._open(t,e,n)})}),n&&this._open(t,e,n)},_open:function(t,r,i){function f(e){a.of=e;if(s.is(":hidden"))return;s.position(a)}var s,o,u,a=e.extend({},this.options.position);if(!i)return;s=this._find(r);if(s.length){s.find(".ui-tooltip-content").html(i);return}r.is("[title]")&&(t&&t.type==="mouseover"?r.attr("title",""):r.removeAttr("title")),s=this._tooltip(r),n(r,s.attr("id")),s.find(".ui-tooltip-content").html(i),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:f}),f(t)):s.position(e.extend({of:r},this.options.position)),s.hide(),this._show(s,this.options.show),this.options.show&&this.options.show.delay&&(u=setInterval(function(){s.is(":visible")&&(f(a.of),clearInterval(u))},e.fx.interval)),this._trigger("open",t,{tooltip:s}),o={keyup:function(t){if(t.keyCode===e.ui.keyCode.ESCAPE){var n=e.Event(t);n.currentTarget=r[0],this.close(n,!0)}},remove:function(){this._removeTooltip(s)}};if(!t||t.type==="mouseover")o.mouseleave="close";if(!t||t.type==="focusin")o.focusout="close";this._on(!0,r,o)},close:function(t){var n=this,i=e(t?t.currentTarget:this.element),s=this._find(i);if(this.closing)return;i.data("ui-tooltip-title")&&i.attr("title",i.data("ui-tooltip-title")),r(i),s.stop(!0),this._hide(s,this.options.hide,function(){n._removeTooltip(e(this))}),i.removeData("ui-tooltip-open"),this._off(i,"mouseleave focusout keyup"),i[0]!==this.element[0]&&this._off(i,"remove"),this._off(this.document,"mousemove"),t&&t.type==="mouseleave"&&e.each(this.parents,function(t,r){e(r.element).attr("title",r.title),delete n.parents[t]}),this.closing=!0,this._trigger("close",t,{tooltip:s}),this.closing=!1},_tooltip:function(n){var r="ui-tooltip-"+t++,i=e("<div>").attr({id:r,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return e("<div>").addClass("ui-tooltip-content").appendTo(i),i.appendTo(this.document[0].body),e.fn.bgiframe&&i.bgiframe(),this.tooltips[r]=n,i},_find:function(t){var n=t.data("ui-tooltip-id");return n?e("#"+n):e()},_removeTooltip:function(e){e.remove(),delete this.tooltips[e.attr("id")]},_destroy:function(){var t=this;e.each(this.tooltips,function(n,r){var i=e.Event("blur");i.target=i.currentTarget=r[0],t.close(i,!0),e("#"+n).remove(),r.data("ui-tooltip-title")&&(r.attr("title",r.data("ui-tooltip-title")),r.removeData("ui-tooltip-title"))})}})})(jQuery);
\ No newline at end of file
diff --git a/app/webroot/test.php b/app/webroot/test.php
new file mode 100644 (file)
index 0000000..39bea7a
--- /dev/null
@@ -0,0 +1,92 @@
+<?php
+/**
+ * Web Access Frontend for TestSuite
+ *
+ * PHP 5
+ *
+ * CakePHP(tm) Tests <http://book.cakephp.org/2.0/en/development/testing.html>
+ * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ *
+ * Licensed under The MIT License
+ * Redistributions of files must retain the above copyright notice
+ *
+ * @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
+ * @link          http://book.cakephp.org/2.0/en/development/testing.html
+ * @package       app.webroot
+ * @since         CakePHP(tm) v 1.2.0.4433
+ * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
+ */
+set_time_limit(0);
+ini_set('display_errors', 1);
+/**
+ * Use the DS to separate the directories in other defines
+ */
+if (!defined('DS')) {
+       define('DS', DIRECTORY_SEPARATOR);
+}
+/**
+ * These defines should only be edited if you have cake installed in
+ * a directory layout other than the way it is distributed.
+ * When using custom settings be sure to use the DS and do not add a trailing DS.
+ */
+
+/**
+ * The full path to the directory which holds "app", WITHOUT a trailing DS.
+ *
+ */
+if (!defined('ROOT')) {
+       define('ROOT', dirname(dirname(dirname(__FILE__))));
+}
+/**
+ * The actual directory name for the "app".
+ *
+ */
+if (!defined('APP_DIR')) {
+       define('APP_DIR', basename(dirname(dirname(__FILE__))));
+}
+
+/**
+ * The absolute path to the "Cake" directory, WITHOUT a trailing DS.
+ *
+ * For ease of development CakePHP uses PHP's include_path.  If you
+ * need to cannot modify your include_path, you can set this path.
+ *
+ * Leaving this constant undefined will result in it being defined in Cake/bootstrap.php
+ */
+       //define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . 'lib');
+
+/**
+ * Editing below this line should not be necessary.
+ * Change at your own risk.
+ *
+ */
+if (!defined('WEBROOT_DIR')) {
+       define('WEBROOT_DIR', basename(dirname(__FILE__)));
+}
+if (!defined('WWW_ROOT')) {
+       define('WWW_ROOT', dirname(__FILE__) . DS);
+}
+
+if (!defined('CAKE_CORE_INCLUDE_PATH')) {
+       if (function_exists('ini_set')) {
+               ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
+       }
+       if (!include ('Cake' . DS . 'bootstrap.php')) {
+               $failed = true;
+       }
+} else {
+       if (!include (CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php')) {
+               $failed = true;
+       }
+}
+if (!empty($failed)) {
+       trigger_error("CakePHP core could not be found.  Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php.  It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
+}
+
+if (Configure::read('debug') < 1) {
+       die(__d('cake_dev', 'Debug setting does not allow access to this url.'));
+}
+
+require_once CAKE . 'TestSuite' . DS . 'CakeTestSuiteDispatcher.php';
+
+CakeTestSuiteDispatcher::run();